8056061: Mark implementations of public interfaces with an annotation
authorjlahoda
Wed, 27 Aug 2014 07:44:00 +0200
changeset 26266 2d24bda701dc
parent 26265 46aacfffd3b5
child 26267 4ebd9393b373
8056061: Mark implementations of public interfaces with an annotation Summary: Adding @DefinedBy annotation to mark methods that implement public API methods; annotating the methods; adding a coding rules analyzer to enforce all such methods are annotated. Reviewed-by: jjg, mcimadamore, jfranck Contributed-by: jan.lahoda@oracle.com, jonathan.gibbons@oracle.com
langtools/make/test/crules/DefinedByAnalyzer/Test.java
langtools/make/test/crules/DefinedByAnalyzer/Test.out
langtools/make/tools/crules/AbstractCodingRulesAnalyzer.java
langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java
langtools/make/tools/crules/DefinedByAnalyzer.java
langtools/make/tools/crules/resources/crules.properties
langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/MultiTaskListener.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/AnnoConstruct.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DefinedBy.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Position.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/SharedNameTable.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTool.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/LLNI.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/TypeSignature.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Util.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTaskImpl.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/test/crules/DefinedByAnalyzer/Test.java	Wed Aug 27 07:44:00 2014 +0200
@@ -0,0 +1,32 @@
+/**@test /nodynamiccopyright/
+ * @compile/fail/ref=Test.out -Xplugin:coding_rules -XDrawDiagnostics Test.java
+ */
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
+public class Test implements SourcePositions, TaskListener {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public long getStartPosition(CompilationUnitTree file, Tree tree) {
+        return 0;
+    }
+    @Override
+    public long getEndPosition(CompilationUnitTree file, Tree tree) {
+        return 0;
+    }
+    @DefinedBy(Api.COMPILER_TREE)
+    public long getEndPosition(Tree tree) {
+        return 0;
+    }
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    public void started(TaskEvent e) {
+    }
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public void finished(TaskEvent e) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/test/crules/DefinedByAnalyzer/Test.out	Wed Aug 27 07:44:00 2014 +0200
@@ -0,0 +1,4 @@
+Test.java:19:17: compiler.err.proc.messager: compiler.misc.crules.no.defined.by
+Test.java:23:17: compiler.err.proc.messager: compiler.misc.crules.defined.by.no.api
+Test.java:27:17: compiler.err.proc.messager: compiler.misc.crules.wrong.defined.by
+3 errors
--- a/langtools/make/tools/crules/AbstractCodingRulesAnalyzer.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/make/tools/crules/AbstractCodingRulesAnalyzer.java	Wed Aug 27 07:44:00 2014 +0200
@@ -30,6 +30,8 @@
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.BasicJavacTask;
 import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.model.JavacElements;
+import com.sun.tools.javac.model.JavacTypes;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.util.Context;
@@ -49,6 +51,8 @@
     private   final Options options;
     protected final Messages messages;
     protected final Symtab syms;
+    protected final JavacElements elements;
+    protected final JavacTypes types;
     protected TreeScanner treeVisitor;
     protected Kind eventKind;
 
@@ -61,6 +65,8 @@
         diags = JCDiagnostic.Factory.instance(context);
         messages = new Messages();
         syms = Symtab.instance(context);
+        elements = JavacElements.instance(context);
+        types = JavacTypes.instance(context);
     }
 
     protected class Messages {
--- a/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java	Wed Aug 27 07:44:00 2014 +0200
@@ -41,6 +41,8 @@
 import com.sun.tools.javac.api.BasicJavacTask;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Log;
 
 public class CodingRulesAnalyzerPlugin implements Plugin {
@@ -48,6 +50,7 @@
     protected Log log;
     protected Trees trees;
 
+    @DefinedBy(Api.COMPILER_TREE)
     public void init(JavacTask task, String... args) {
         BasicJavacTask impl = (BasicJavacTask)task;
         Context context = impl.getContext();
@@ -55,7 +58,8 @@
         trees = Trees.instance(task);
         task.addTaskListener(new PostAnalyzeTaskListener(
                 new MutableFieldsAnalyzer(task),
-                new AssertCheckAnalyzer(task)
+                new AssertCheckAnalyzer(task),
+                new DefinedByAnalyzer(task)
         ));
     }
 
@@ -74,10 +78,10 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public void started(TaskEvent taskEvent) {}
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public void finished(TaskEvent taskEvent) {
             List<AbstractCodingRulesAnalyzer> currentAnalyzers = this.analyzers.get(taskEvent.getKind());
 
@@ -99,7 +103,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public String getName() {
         return "coding_rules";
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/tools/crules/DefinedByAnalyzer.java	Wed Aug 27 07:44:00 2014 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package crules;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent.Kind;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
+/**This analyzer ensures that all method that implement a public supported API method are marked with
+ * {@link DefinedBy} annotation, and that methods that don't implement a public API are not marked
+ * using the annotation.
+ */
+public class DefinedByAnalyzer extends AbstractCodingRulesAnalyzer {
+
+    public DefinedByAnalyzer(JavacTask task) {
+        super(task);
+        treeVisitor = new DefinedByVisitor();
+        eventKind = Kind.ANALYZE;
+    }
+
+    class DefinedByVisitor extends TreeScanner {
+        @Override
+        public void visitMethodDef(JCMethodDecl tree) {
+            if (!isAPIPackage(packageName(tree.sym))) {
+                boolean seenAPIPackage = false;
+
+                for (MethodSymbol overridden : types.getOverriddenMethods(tree.sym)) {
+                    String overriddenPackage = packageName(overridden);
+
+                    if (!isAPIPackage(overriddenPackage))
+                        continue;
+
+                    seenAPIPackage = true;
+
+                    DefinedBy definedBy = tree.sym.getAnnotation(DefinedBy.class);
+
+                    if (definedBy != null) {
+                        String packageRoot = definedBy.value().packageRoot;
+                        if (!overriddenPackage.startsWith(packageRoot)) {
+                            messages.error(tree, "crules.wrong.defined.by");
+                        }
+                        continue;
+                    }
+
+                    messages.error(tree, "crules.no.defined.by");
+                }
+
+                if (!seenAPIPackage && tree.sym.getAnnotation(DefinedBy.class) != null) {
+                    messages.error(tree, "crules.defined.by.no.api");
+                }
+            }
+
+            super.visitMethodDef(tree);
+        }
+
+        private boolean isAPIPackage(String pack) {
+            for (Api api : Api.values()) {
+                if (pack.startsWith(api.packageRoot))
+                    return true;
+            }
+
+            return false;
+        }
+
+        private String packageName(Symbol sym) {
+            return elements.getPackageOf(sym).getQualifiedName().toString();
+        }
+    }
+}
--- a/langtools/make/tools/crules/resources/crules.properties	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/make/tools/crules/resources/crules.properties	Wed Aug 27 07:44:00 2014 +0200
@@ -28,3 +28,9 @@
     Static variable {0} must be final
 crules.should.not.use.string.concatenation=\
     Should not use string concatenation.
+crules.no.defined.by=\
+    This method implements a public API method, and should be marked with @DefinedBy.
+crules.wrong.defined.by=\
+    This method implements a public API method, and is marked with incorrect @DefinedBy.
+crules.defined.by.no.api=\
+    This method does not implement a public API method, and should not be marked with @DefinedBy.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Wed Aug 27 07:44:00 2014 +0200
@@ -81,6 +81,8 @@
 import com.sun.source.util.TreePath;
 import com.sun.tools.doclint.HtmlTag.AttrKind;
 import com.sun.tools.javac.tree.DocPretty;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.StringUtils;
 import static com.sun.tools.doclint.Messages.Group.*;
 
@@ -213,7 +215,7 @@
         env.messages.report(REFERENCE, Kind.WARNING, env.currPath.getLeaf(), code, args);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocComment(DocCommentTree tree, Void ignore) {
         super.visitDocComment(tree, ignore);
         for (TagStackItem tsi: tagStack) {
@@ -230,7 +232,7 @@
 
     // <editor-fold defaultstate="collapsed" desc="Text and entities.">
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitText(TextTree tree, Void ignore) {
         if (hasNonWhitespace(tree)) {
             checkAllowsText(tree);
@@ -239,7 +241,7 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEntity(EntityTree tree, Void ignore) {
         checkAllowsText(tree);
         markEnclosingTag(Flag.HAS_TEXT);
@@ -273,7 +275,7 @@
 
     // <editor-fold defaultstate="collapsed" desc="HTML elements">
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitStartElement(StartElementTree tree, Void ignore) {
         final Name treeName = tree.getName();
         final HtmlTag t = HtmlTag.get(treeName);
@@ -437,7 +439,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEndElement(EndElementTree tree, Void ignore) {
         final Name treeName = tree.getName();
         final HtmlTag t = HtmlTag.get(treeName);
@@ -509,7 +511,7 @@
 
     // <editor-fold defaultstate="collapsed" desc="HTML attributes">
 
-    @Override @SuppressWarnings("fallthrough")
+    @Override @DefinedBy(Api.COMPILER_TREE) @SuppressWarnings("fallthrough")
     public Void visitAttribute(AttributeTree tree, Void ignore) {
         HtmlTag currTag = tagStack.peek().tag;
         if (currTag != null) {
@@ -654,19 +656,19 @@
 
     // <editor-fold defaultstate="collapsed" desc="javadoc tags">
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitAuthor(AuthorTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getName());
         return super.visitAuthor(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocRoot(DocRootTree tree, Void ignore) {
         markEnclosingTag(Flag.HAS_INLINE_TAG);
         return super.visitDocRoot(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitInheritDoc(InheritDocTree tree, Void ignore) {
         markEnclosingTag(Flag.HAS_INLINE_TAG);
         // TODO: verify on overridden method
@@ -674,7 +676,7 @@
         return super.visitInheritDoc(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitLink(LinkTree tree, Void ignore) {
         markEnclosingTag(Flag.HAS_INLINE_TAG);
         // simulate inline context on tag stack
@@ -688,7 +690,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitLiteral(LiteralTree tree, Void ignore) {
         markEnclosingTag(Flag.HAS_INLINE_TAG);
         if (tree.getKind() == DocTree.Kind.CODE) {
@@ -702,7 +704,7 @@
         return super.visitLiteral(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     @SuppressWarnings("fallthrough")
     public Void visitParam(ParamTree tree, Void ignore) {
         boolean typaram = tree.isTypeParameter();
@@ -748,7 +750,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReference(ReferenceTree tree, Void ignore) {
         String sig = tree.getSignature();
         if (sig.contains("<") || sig.contains(">"))
@@ -760,7 +762,7 @@
         return super.visitReference(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReturn(ReturnTree tree, Void ignore) {
         Element e = env.trees.getElement(env.currPath);
         if (e.getKind() != ElementKind.METHOD
@@ -771,25 +773,25 @@
         return super.visitReturn(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialData(SerialDataTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getDescription());
         return super.visitSerialData(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialField(SerialFieldTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getDescription());
         return super.visitSerialField(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSince(SinceTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getBody());
         return super.visitSince(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitThrows(ThrowsTree tree, Void ignore) {
         ReferenceTree exName = tree.getExceptionName();
         Element ex = env.trees.getElement(new DocTreePath(getCurrentPath(), exName));
@@ -845,13 +847,13 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownBlockTag(UnknownBlockTagTree tree, Void ignore) {
         checkUnknownTag(tree, tree.getTagName());
         return super.visitUnknownBlockTag(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownInlineTag(UnknownInlineTagTree tree, Void ignore) {
         checkUnknownTag(tree, tree.getTagName());
         return super.visitUnknownInlineTag(tree, ignore);
@@ -862,7 +864,7 @@
             env.messages.error(SYNTAX, tree, "dc.tag.unknown", tagName);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitValue(ValueTree tree, Void ignore) {
         ReferenceTree ref = tree.getReference();
         if (ref == null || ref.getSignature().isEmpty()) {
@@ -891,13 +893,13 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitVersion(VersionTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getBody());
         return super.visitVersion(tree, ignore);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitErroneous(ErroneousTree tree, Void ignore) {
         env.messages.error(SYNTAX, tree, null, tree.getDiagnostic().getMessage(null));
         return null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java	Wed Aug 27 07:44:00 2014 +0200
@@ -54,6 +54,8 @@
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
  * Multi-function entry point for the doc check utility.
@@ -244,12 +246,12 @@
 
     // <editor-fold defaultstate="collapsed" desc="javac Plugin">
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public String getName() {
         return "doclint";
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void init(JavacTask task, String... args) {
         init(task, args, true);
     }
@@ -289,7 +291,7 @@
             };
 
             TaskListener tl = new TaskListener() {
-                @Override
+                @Override @DefinedBy(Api.COMPILER_TREE)
                 public void started(TaskEvent e) {
                     switch (e.getKind()) {
                         case ANALYZE:
@@ -300,7 +302,7 @@
                     }
                 }
 
-                @Override
+                @Override @DefinedBy(Api.COMPILER_TREE)
                 public void finished(TaskEvent e) {
                     switch (e.getKind()) {
                         case PARSE:
@@ -348,25 +350,25 @@
     static abstract class DeclScanner extends TreePathScanner<Void, Void> {
         abstract void visitDecl(Tree tree, Name name);
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Void visitPackage(PackageTree tree, Void ignore) {
             visitDecl(tree, null);
             return super.visitPackage(tree, ignore);
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Void visitClass(ClassTree tree, Void ignore) {
             visitDecl(tree, tree.getSimpleName());
             return super.visitClass(tree, ignore);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Void visitMethod(MethodTree tree, Void ignore) {
             visitDecl(tree, tree.getName());
             //return super.visitMethod(tree, ignore);
             return null;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Void visitVariable(VariableTree tree, Void ignore) {
             visitDecl(tree, tree.getName());
             return super.visitVariable(tree, ignore);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Wed Aug 27 07:44:00 2014 +0200
@@ -49,6 +49,8 @@
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.PropagatedException;
@@ -79,22 +81,22 @@
             context.put(JavacTask.class, this);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends CompilationUnitTree> parse() {
         throw new IllegalStateException();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends Element> analyze() {
         throw new IllegalStateException();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends JavaFileObject> generate() {
         throw new IllegalStateException();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void setTaskListener(TaskListener tl) {
         MultiTaskListener mtl = MultiTaskListener.instance(context);
         if (taskListener != null)
@@ -104,13 +106,13 @@
         taskListener = tl;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void addTaskListener(TaskListener taskListener) {
         MultiTaskListener mtl = MultiTaskListener.instance(context);
         mtl.add(taskListener);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void removeTaskListener(TaskListener taskListener) {
         MultiTaskListener mtl = MultiTaskListener.instance(context);
         mtl.remove(taskListener);
@@ -121,7 +123,7 @@
         return mtl.getTaskListeners();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public TypeMirror getTypeMirror(Iterable<? extends Tree> path) {
         // TODO: Should complete attribution if necessary
         Tree last = null;
@@ -130,31 +132,31 @@
         return ((JCTree)last).type;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Elements getElements() {
         if (context == null)
             throw new IllegalStateException();
         return JavacElements.instance(context);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Types getTypes() {
         if (context == null)
             throw new IllegalStateException();
         return JavacTypes.instance(context);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public void setProcessors(Iterable<? extends Processor> processors) {
         throw new IllegalStateException();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public void setLocale(Locale locale) {
         throw new IllegalStateException();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Boolean call() {
         throw new IllegalStateException();
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Wed Aug 27 07:44:00 2014 +0200
@@ -60,6 +60,8 @@
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic;
 
 /**
@@ -209,7 +211,7 @@
             this.clientJavaFileManager = clientJavaFileManager;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public ClassLoader getClassLoader(Location location) {
             try {
                 return clientJavaFileManager.getClassLoader(location);
@@ -220,7 +222,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
             try {
                 return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse));
@@ -231,7 +233,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public String inferBinaryName(Location location, JavaFileObject file) {
             try {
                 return clientJavaFileManager.inferBinaryName(location, unwrap(file));
@@ -242,7 +244,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean isSameFile(FileObject a, FileObject b) {
             try {
                 return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b));
@@ -253,7 +255,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean handleOption(String current, Iterator<String> remaining) {
             try {
                 return clientJavaFileManager.handleOption(current, remaining);
@@ -264,7 +266,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean hasLocation(Location location) {
             try {
                 return clientJavaFileManager.hasLocation(location);
@@ -275,7 +277,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
             try {
                 return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind));
@@ -286,7 +288,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
             try {
                 return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling)));
@@ -297,7 +299,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
             try {
                 return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName));
@@ -308,7 +310,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
             try {
                 return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling)));
@@ -319,7 +321,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public void flush() throws IOException {
             try {
                 clientJavaFileManager.flush();
@@ -330,7 +332,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public void close() throws IOException {
             try {
                 clientJavaFileManager.close();
@@ -341,7 +343,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public int isSupportedOption(String option) {
             try {
                 return clientJavaFileManager.isSupportedOption(option);
@@ -365,7 +367,7 @@
             this.clientFileObject = clientFileObject;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public URI toUri() {
             try {
                 return clientFileObject.toUri();
@@ -376,7 +378,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public String getName() {
             try {
                 return clientFileObject.getName();
@@ -387,7 +389,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public InputStream openInputStream() throws IOException {
             try {
                 return clientFileObject.openInputStream();
@@ -398,7 +400,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public OutputStream openOutputStream() throws IOException {
             try {
                 return clientFileObject.openOutputStream();
@@ -409,7 +411,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
             try {
                 return clientFileObject.openReader(ignoreEncodingErrors);
@@ -420,7 +422,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
             try {
                 return clientFileObject.getCharContent(ignoreEncodingErrors);
@@ -431,7 +433,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Writer openWriter() throws IOException {
             try {
                 return clientFileObject.openWriter();
@@ -442,7 +444,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public long getLastModified() {
             try {
                 return clientFileObject.getLastModified();
@@ -453,7 +455,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean delete() {
             try {
                 return clientFileObject.delete();
@@ -475,7 +477,7 @@
             super(clientJavaFileObject);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Kind getKind() {
             try {
                 return ((JavaFileObject)clientFileObject).getKind();
@@ -486,7 +488,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean isNameCompatible(String simpleName, Kind kind) {
             try {
                 return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind);
@@ -497,7 +499,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public NestingKind getNestingKind() {
             try {
                 return ((JavaFileObject)clientFileObject).getNestingKind();
@@ -508,7 +510,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Modifier getAccessLevel() {
             try {
                 return ((JavaFileObject)clientFileObject).getAccessLevel();
@@ -532,7 +534,7 @@
             this.clientDiagnosticListener = clientDiagnosticListener;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public void report(Diagnostic<? extends T> diagnostic) {
             try {
                 clientDiagnosticListener.report(unwrap(diagnostic));
@@ -556,38 +558,47 @@
             this.d = d;
         }
 
+        @DefinedBy(Api.COMPILER)
         public Diagnostic.Kind getKind() {
             return d.getKind();
         }
 
+        @DefinedBy(Api.COMPILER)
         public JavaFileObject getSource() {
             return unwrap(d.getSource());
         }
 
+        @DefinedBy(Api.COMPILER)
         public long getPosition() {
             return d.getPosition();
         }
 
+        @DefinedBy(Api.COMPILER)
         public long getStartPosition() {
             return d.getStartPosition();
         }
 
+        @DefinedBy(Api.COMPILER)
         public long getEndPosition() {
             return d.getEndPosition();
         }
 
+        @DefinedBy(Api.COMPILER)
         public long getLineNumber() {
             return d.getLineNumber();
         }
 
+        @DefinedBy(Api.COMPILER)
         public long getColumnNumber() {
             return d.getColumnNumber();
         }
 
+        @DefinedBy(Api.COMPILER)
         public String getCode() {
             return d.getCode();
         }
 
+        @DefinedBy(Api.COMPILER)
         public String getMessage(Locale locale) {
             return d.getMessage(locale);
         }
@@ -605,7 +616,7 @@
             this.clientTaskListener = clientTaskListener;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public void started(TaskEvent ev) {
             try {
                 clientTaskListener.started(ev);
@@ -616,7 +627,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public void finished(TaskEvent ev) {
             try {
                 clientTaskListener.finished(ev);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java	Wed Aug 27 07:44:00 2014 +0200
@@ -32,6 +32,8 @@
 
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 
 
@@ -52,7 +54,7 @@
             //the "top-level" scope needs to return both imported and defined elements
             //see test CheckLocalElements
             return new JavacScope(env) {
-                @Override
+                @Override @DefinedBy(Api.COMPILER_TREE)
                 public Iterable<? extends Element> getLocalElements() {
                     return env.toplevel.namedImportScope.getSymbols();
                 }
@@ -69,6 +71,7 @@
         this.env = env;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JavacScope getEnclosingScope() {
         if (env.outer != null && env.outer != env) {
             return create(env.outer);
@@ -78,9 +81,11 @@
                 public boolean isStarImportScope() {
                     return true;
                 }
+                @DefinedBy(Api.COMPILER_TREE)
                 public JavacScope getEnclosingScope() {
                     return null;
                 }
+                @DefinedBy(Api.COMPILER_TREE)
                 public Iterable<? extends Element> getLocalElements() {
                     return env.toplevel.starImportScope.getSymbols();
                 }
@@ -88,15 +93,18 @@
         }
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public TypeElement getEnclosingClass() {
         // hide the dummy class that javac uses to enclose the top level declarations
         return (env.outer == null || env.outer == env ? null : env.enclClass.sym);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public ExecutableElement getEnclosingMethod() {
         return (env.enclMethod == null ? null : env.enclMethod.sym);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends Element> getLocalElements() {
         return env.info.getLocalElements();
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Wed Aug 27 07:44:00 2014 +0200
@@ -48,6 +48,7 @@
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Log.PrefixKind;
 import com.sun.tools.javac.util.Log.WriterKind;
@@ -77,7 +78,7 @@
         args = Arguments.instance(context);
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public Boolean call() {
         return doCall().isOK();
     }
@@ -102,7 +103,7 @@
         }
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public void setProcessors(Iterable<? extends Processor> processors) {
         processors.getClass(); // null check
         // not mt-safe
@@ -111,7 +112,7 @@
         this.processors = processors;
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public void setLocale(Locale locale) {
         if (used.get())
             throw new IllegalStateException();
@@ -206,7 +207,7 @@
         notYetEntered = null;
     }
 
-    @Override // @DefinedBy(TREE_API)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends CompilationUnitTree> parse() {
         return handleExceptions(new Callable<Iterable<? extends CompilationUnitTree>>() {
             @Override
@@ -320,7 +321,7 @@
         }
     }
 
-    @Override // @DefinedBy(TREE_API)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends Element> analyze() {
         return handleExceptions(new Callable<Iterable<? extends Element>>() {
             @Override
@@ -382,7 +383,7 @@
             genList.addAll(queue);
         }
 
-    @Override // @DefinedBy(TREE_API)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Iterable<? extends JavaFileObject> generate() {
         return handleExceptions(new Callable<Iterable<? extends JavaFileObject>>() {
             @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Wed Aug 27 07:44:00 2014 +0200
@@ -45,6 +45,8 @@
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.PropagatedException;
 
@@ -78,7 +80,7 @@
         return new JavacTool();
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public JavacFileManager getStandardFileManager(
         DiagnosticListener<? super JavaFileObject> diagnosticListener,
         Locale locale,
@@ -94,7 +96,7 @@
         return new JavacFileManager(context, true, charset);
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public JavacTask getTask(Writer out,
                              JavaFileManager fileManager,
                              DiagnosticListener<? super JavaFileObject> diagnosticListener,
@@ -165,7 +167,7 @@
         }
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
         if (err == null)
             err = System.err;
@@ -174,13 +176,13 @@
         return com.sun.tools.javac.Main.compile(arguments, new PrintWriter(err, true));
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public Set<SourceVersion> getSourceVersions() {
         return Collections.unmodifiableSet(EnumSet.range(SourceVersion.RELEASE_3,
                                                          SourceVersion.latest()));
     }
 
-    @Override // @DefinedBy(COMPILER_API)
+    @Override @DefinedBy(Api.COMPILER)
     public int isSupportedOption(String option) {
         Set<Option> recognizedOptions = Option.getJavacToolOptions();
         for (Option o : recognizedOptions) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Aug 27 07:44:00 2014 +0200
@@ -96,6 +96,8 @@
 import com.sun.tools.javac.util.Abort;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
@@ -176,21 +178,25 @@
             javacTaskImpl = (JavacTaskImpl) t;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public DocSourcePositions getSourcePositions() {
         return new DocSourcePositions() {
+                @DefinedBy(Api.COMPILER_TREE)
                 public long getStartPosition(CompilationUnitTree file, Tree tree) {
                     return TreeInfo.getStartPos((JCTree) tree);
                 }
 
+                @DefinedBy(Api.COMPILER_TREE)
                 public long getEndPosition(CompilationUnitTree file, Tree tree) {
                     EndPosTable endPosTable = ((JCCompilationUnit) file).endPositions;
                     return TreeInfo.getEndPos((JCTree) tree, endPosTable);
                 }
 
+                @DefinedBy(Api.COMPILER_TREE)
                 public long getStartPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree) {
                     return ((DCTree) tree).getSourcePosition((DCDocComment) comment);
                 }
-                @SuppressWarnings("fallthrough")
+                @SuppressWarnings("fallthrough") @DefinedBy(Api.COMPILER_TREE)
                 public long getEndPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree) {
                     DCDocComment dcComment = (DCDocComment) comment;
                     if (tree instanceof DCEndPosTree) {
@@ -251,7 +257,8 @@
         final DocTree[] last = new DocTree[] {null};
 
         tree.accept(new DocTreeScanner<Void, Void>() {
-            @Override public Void scan(DocTree node, Void p) {
+            @Override @DefinedBy(Api.COMPILER_TREE)
+ public Void scan(DocTree node, Void p) {
                 if (node != null) last[0] = node;
                 return null;
             }
@@ -260,22 +267,27 @@
         return last[0];
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCClassDecl getTree(TypeElement element) {
         return (JCClassDecl) getTree((Element) element);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCMethodDecl getTree(ExecutableElement method) {
         return (JCMethodDecl) getTree((Element) method);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree getTree(Element element) {
         return getTree(element, null);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree getTree(Element e, AnnotationMirror a) {
         return getTree(e, a, null);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree getTree(Element e, AnnotationMirror a, AnnotationValue v) {
         Pair<JCTree, JCCompilationUnit> treeTopLevel = elements.getTreeAndTopLevel(e, a, v);
         if (treeTopLevel == null)
@@ -283,18 +295,22 @@
         return treeTopLevel.fst;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public TreePath getPath(CompilationUnitTree unit, Tree node) {
         return TreePath.getPath(unit, node);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public TreePath getPath(Element e) {
         return getPath(e, null, null);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public TreePath getPath(Element e, AnnotationMirror a) {
         return getPath(e, a, null);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v) {
         final Pair<JCTree, JCCompilationUnit> treeTopLevel = elements.getTreeAndTopLevel(e, a, v);
         if (treeTopLevel == null)
@@ -302,6 +318,7 @@
         return TreePath.getPath(treeTopLevel.snd, treeTopLevel.fst);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Symbol getElement(TreePath path) {
         JCTree tree = (JCTree) path.getLeaf();
         Symbol sym = TreeInfo.symbolFor(tree);
@@ -325,7 +342,7 @@
         return sym;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Element getElement(DocTreePath path) {
         DocTree forTree = path.getLeaf();
         if (forTree instanceof DCReference)
@@ -675,15 +692,18 @@
         }
     };
 
+    @DefinedBy(Api.COMPILER_TREE)
     public TypeMirror getTypeMirror(TreePath path) {
         Tree t = path.getLeaf();
         return ((JCTree)t).type;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JavacScope getScope(TreePath path) {
         return JavacScope.create(getAttrContext(path));
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public String getDocComment(TreePath path) {
         CompilationUnitTree t = path.getCompilationUnit();
         Tree leaf = path.getLeaf();
@@ -696,6 +716,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public DocCommentTree getDocCommentTree(TreePath path) {
         CompilationUnitTree t = path.getCompilationUnit();
         Tree leaf = path.getLeaf();
@@ -708,6 +729,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public boolean isAccessible(Scope scope, TypeElement type) {
         if (scope instanceof JavacScope && type instanceof ClassSymbol) {
             Env<AttrContext> env = ((JavacScope) scope).env;
@@ -716,6 +738,7 @@
             return false;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public boolean isAccessible(Scope scope, Element member, DeclaredType type) {
         if (scope instanceof JavacScope
                 && member instanceof Symbol
@@ -852,6 +875,7 @@
      * @returns TypeMirror corresponding to the original type, replaced by the ErrorType.
      *          noType (type.tag == NONE) is returned if there is no original type.
      */
+    @DefinedBy(Api.COMPILER_TREE)
     public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
         if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType) {
             return ((com.sun.tools.javac.code.Type.ErrorType)errorType).getOriginalType();
@@ -869,12 +893,14 @@
      * @param t    the tree to use as a position hint
      * @param root the compilation unit that contains tree
      */
+    @DefinedBy(Api.COMPILER_TREE)
     public void printMessage(Diagnostic.Kind kind, CharSequence msg,
             com.sun.source.tree.Tree t,
             com.sun.source.tree.CompilationUnitTree root) {
         printMessage(kind, msg, ((JCTree) t).pos(), root);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public void printMessage(Diagnostic.Kind kind, CharSequence msg,
             com.sun.source.doctree.DocTree t,
             com.sun.source.doctree.DocCommentTree c,
@@ -923,7 +949,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public TypeMirror getLub(CatchTree tree) {
         JCCatch ct = (JCCatch) tree;
         JCVariableDecl v = ct.param;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/MultiTaskListener.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/MultiTaskListener.java	Wed Aug 27 07:44:00 2014 +0200
@@ -31,9 +31,12 @@
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
- * TODO.
+ * A collection of currently registered {@link TaskListener}s. Events passed to this TaskListener
+ * will be forwarded to all the registered TaskListeners.
  *
  * <p><b>This is NOT part of any supported API.
  * If you write code that depends on this, you do so at your own risk.
@@ -94,7 +97,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void started(TaskEvent e) {
         // guard against listeners being updated by a listener
         TaskListener[] ll = this.listeners;
@@ -102,7 +105,7 @@
             l.started(e);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void finished(TaskEvent e) {
         // guard against listeners being updated by a listener
         TaskListener[] ll = this.listeners;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java	Wed Aug 27 07:44:00 2014 +0200
@@ -35,6 +35,9 @@
 import javax.tools.*;
 import javax.tools.JavaFileObject.Kind;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * Wraps all calls to a given file manager.  Subclasses of this class
  * might override some of these methods and might also provide
@@ -134,6 +137,7 @@
     /**
      * @throws IllegalStateException {@inheritDoc}
      */
+    @DefinedBy(Api.COMPILER)
     public Iterable<JavaFileObject> list(Location location,
                                          String packageName,
                                          Set<Kind> kinds,
@@ -146,6 +150,7 @@
     /**
      * @throws IllegalStateException {@inheritDoc}
      */
+    @DefinedBy(Api.COMPILER)
     public String inferBinaryName(Location location, JavaFileObject file) {
         return super.inferBinaryName(location, unwrap(file));
     }
@@ -155,6 +160,7 @@
      * @throws UnsupportedOperationException {@inheritDoc}
      * @throws IllegalStateException {@inheritDoc}
      */
+    @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForInput(Location location,
                                               String className,
                                               Kind kind)
@@ -168,6 +174,7 @@
      * @throws UnsupportedOperationException {@inheritDoc}
      * @throws IllegalStateException {@inheritDoc}
      */
+    @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForOutput(Location location,
                                                String className,
                                                Kind kind,
@@ -181,6 +188,7 @@
      * @throws IllegalArgumentException {@inheritDoc}
      * @throws IllegalStateException {@inheritDoc}
      */
+    @DefinedBy(Api.COMPILER)
     public FileObject getFileForInput(Location location,
                                       String packageName,
                                       String relativeName)
@@ -193,6 +201,7 @@
      * @throws IllegalArgumentException {@inheritDoc}
      * @throws IllegalStateException {@inheritDoc}
      */
+    @DefinedBy(Api.COMPILER)
     public FileObject getFileForOutput(Location location,
                                        String packageName,
                                        String relativeName,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/AnnoConstruct.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/AnnoConstruct.java	Wed Aug 27 07:44:00 2014 +0200
@@ -32,6 +32,8 @@
 import javax.lang.model.AnnotatedConstruct;
 
 import com.sun.tools.javac.model.AnnotationProxyMaker;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
@@ -50,7 +52,7 @@
 
 
     // Override to enforce a narrower return type.
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public abstract List<? extends Attribute.Compound> getAnnotationMirrors();
 
 
@@ -74,6 +76,7 @@
 
 
     // This method is part of the javax.lang.model API, do not use this in javac code.
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public <A extends Annotation> A[] getAnnotationsByType(Class<A> annoType) {
 
         if (!annoType.isAnnotation())
@@ -170,6 +173,7 @@
     }
 
     // This method is part of the javax.lang.model API, do not use this in javac code.
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public <A extends Annotation> A getAnnotation(Class<A> annoType) {
 
         if (!annoType.isAnnotation())
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java	Wed Aug 27 07:44:00 2014 +0200
@@ -33,6 +33,7 @@
 import javax.lang.model.type.DeclaredType;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 /** An annotation value.
  *
@@ -52,10 +53,12 @@
 
     public abstract void accept(Visitor v);
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Object getValue() {
         throw new UnsupportedOperationException();
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
         throw new UnsupportedOperationException();
     }
@@ -74,12 +77,15 @@
             super(type);
             this.value = value;
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return Constants.format(value, type);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Object getValue() {
             return Constants.decode(value, type);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             if (value instanceof String)
                 return v.visitString((String) value, p);
@@ -121,12 +127,15 @@
                                       types.syms.classType.tsym,
                                       Type.noAnnotations);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return classType + ".class";
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getValue() {
             return classType;
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             return v.visitType(classType, p);
         }
@@ -183,6 +192,7 @@
          *     @com.example.foo
          * Omit parens for marker annotations, and omit "value=" when allowed.
          */
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder buf = new StringBuilder();
             buf.append("@");
@@ -218,18 +228,22 @@
             return null;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Attribute.Compound getValue() {
             return this;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             return v.visitAnnotation(this, p);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public DeclaredType getAnnotationType() {
             return (DeclaredType) type;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Map<MethodSymbol, Attribute> getElementValues() {
             Map<MethodSymbol, Attribute> valmap = new LinkedHashMap<>();
             for (Pair<MethodSymbol, Attribute> value : values)
@@ -272,6 +286,7 @@
         }
 
         public void accept(Visitor v) { v.visitArray(this); }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder buf = new StringBuilder();
             buf.append('{');
@@ -285,9 +300,11 @@
             buf.append('}');
             return buf.toString();
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Attribute> getValue() {
             return List.from(values);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             return v.visitArray(getValue(), p);
         }
@@ -310,12 +327,15 @@
             this.value = Assert.checkNonNull(value);
         }
         public void accept(Visitor v) { v.visitEnum(this); }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return value.enclClass() + "." + value;     // qualified name
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public VarSymbol getValue() {
             return value;
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             return v.visitEnumConstant(value, p);
         }
@@ -326,12 +346,15 @@
             super(type);
         }
         public void accept(Visitor v) { v.visitError(this); }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "<error>";
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String getValue() {
             return toString();
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             return v.visitString(toString(), p);
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Aug 27 07:44:00 2014 +0200
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Name;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
@@ -572,22 +573,27 @@
         return true;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Type asType() {
         return type;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Symbol getEnclosingElement() {
         return owner;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public ElementKind getKind() {
         return ElementKind.OTHER;       // most unkind
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Set<Modifier> getModifiers() {
         return Flags.asModifierSet(flags());
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Name getSimpleName() {
         return name;
     }
@@ -596,13 +602,14 @@
      * This is the implementation for {@code
      * javax.lang.model.element.Element.getAnnotationMirrors()}.
      */
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public List<Attribute.Compound> getAnnotationMirrors() {
         return getRawAttributes();
     }
 
 
     // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public java.util.List<Symbol> getEnclosedElements() {
         return List.nil();
     }
@@ -645,6 +652,7 @@
         public Symbol asMemberOf(Type site, Types types) { return other.asMemberOf(site, types); }
         public void complete() throws CompletionFailure { other.complete(); }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return other.accept(v, p);
         }
@@ -715,7 +723,7 @@
             return type.hasTag(TYPEVAR);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public java.util.List<Symbol> getEnclosedElements() {
             List<Symbol> list = List.nil();
             if (kind == TYP && type.hasTag(TYPEVAR)) {
@@ -744,15 +752,17 @@
             super(TYP, flags, name, type, owner);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public ElementKind getKind() {
             return ElementKind.TYPE_PARAMETER;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Symbol getGenericElement() {
             return owner;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type> getBounds() {
             TypeVar t = (TypeVar)type;
             Type bound = t.getUpperBound();
@@ -768,7 +778,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Attribute.Compound> getAnnotationMirrors() {
             // Declaration annotations on type variables are stored in type attributes
             // on the owner of the TypeVariableSymbol
@@ -807,7 +817,7 @@
             }
 
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitTypeParameter(this, p);
         }
@@ -837,10 +847,12 @@
             return fullname.toString();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Name getQualifiedName() {
             return fullname;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean isUnnamed() {
             return name.isEmpty() && owner != null;
         }
@@ -880,14 +892,17 @@
             return (flags_field & EXISTS) != 0;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public ElementKind getKind() {
             return ElementKind.PACKAGE;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Symbol getEnclosingElement() {
             return null;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitPackage(this, p);
         }
@@ -1004,6 +1019,7 @@
                 return fullname.toString();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Name getQualifiedName() {
             return fullname;
         }
@@ -1041,6 +1057,7 @@
             }
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type> getInterfaces() {
             complete();
             if (type instanceof ClassType) {
@@ -1055,6 +1072,7 @@
             }
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getSuperclass() {
             complete();
             if (type instanceof ClassType) {
@@ -1095,6 +1113,7 @@
         }
 
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public ElementKind getKind() {
             long flags = flags();
             if ((flags & ANNOTATION) != 0)
@@ -1107,12 +1126,13 @@
                 return ElementKind.CLASS;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<Modifier> getModifiers() {
             long flags = flags();
             return Flags.asModifierSet(flags & ~DEFAULT);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public NestingKind getNestingKind() {
             complete();
             if (owner.kind == PCK)
@@ -1144,6 +1164,7 @@
 
 
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitType(this, p);
         }
@@ -1223,6 +1244,7 @@
             return new VarSymbol(flags_field, name, types.memberType(site, this), owner);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public ElementKind getKind() {
             long flags = flags();
             if ((flags & PARAMETER) != 0) {
@@ -1241,10 +1263,12 @@
             }
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitVariable(this, p);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Object getConstantValue() { // Mirror API
             return Constants.decode(getConstValue(), type);
         }
@@ -1350,7 +1374,7 @@
             return m;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<Modifier> getModifiers() {
             long flags = flags();
             return Flags.asModifierSet((flags & DEFAULT) != 0 ? flags & ~ABSTRACT : flags);
@@ -1612,6 +1636,7 @@
             return new MethodSymbol(flags_field, name, types.memberType(site, this), owner);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public ElementKind getKind() {
             if (name == name.table.names.init)
                 return ElementKind.CONSTRUCTOR;
@@ -1628,22 +1653,27 @@
                     getKind() == ElementKind.INSTANCE_INIT;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Attribute getDefaultValue() {
             return defaultValue;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<VarSymbol> getParameters() {
             return params();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean isVarArgs() {
             return (flags() & VARARGS) != 0;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean isDefault() {
             return (flags() & DEFAULT) != 0;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitExecutable(this, p);
         }
@@ -1652,14 +1682,17 @@
             return v.visitMethodSymbol(this, p);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getReceiverType() {
             return asType().getReceiverType();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getReturnType() {
             return asType().getReturnType();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type> getThrownTypes() {
             return asType().getThrownTypes();
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Aug 27 07:44:00 2014 +0200
@@ -55,6 +55,8 @@
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Log;
@@ -425,6 +427,7 @@
                 }
             };
         noSymbol = new TypeSymbol(Kinds.NIL, 0, names.empty, Type.noType, rootPackage) {
+            @DefinedBy(Api.LANGUAGE_MODEL)
             public <R, P> R accept(ElementVisitor<R, P> v, P p) {
                 return v.visitUnknown(this, p);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Wed Aug 27 07:44:00 2014 +0200
@@ -36,6 +36,7 @@
 
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import static com.sun.tools.javac.code.BoundKind.*;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
@@ -73,7 +74,7 @@
 
     /** Constant type: no type at all. */
     public static final JCNoType noType = new JCNoType() {
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "none";
         }
@@ -81,7 +82,7 @@
 
     /** Constant type: special type to be used during recovery of deferred expressions. */
     public static final JCNoType recoveryType = new JCNoType(){
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "recovery";
         }
@@ -89,7 +90,7 @@
 
     /** Constant type: special type to be used for marking stuck trees. */
     public static final JCNoType stuckType = new JCNoType() {
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "stuck";
         }
@@ -258,19 +259,19 @@
         return !annos.isEmpty();
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public List<Attribute.TypeCompound> getAnnotationMirrors() {
         return annos;
     }
 
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
         return null;
     }
 
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
         @SuppressWarnings("unchecked")
         A[] tmp = (A[]) java.lang.reflect.Array.newInstance(annotationType, 0);
@@ -306,6 +307,7 @@
 
     /** The Java source which this type represents.
      */
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public String toString() {
         StringBuilder sb = new StringBuilder();
         appendAnnotationsString(sb);
@@ -350,12 +352,12 @@
      * never complete classes. Where isSameType would complete a
      * class, equals assumes that the two types are different.
      */
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean equals(Object t) {
         return super.equals(t);
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public int hashCode() {
         return super.hashCode();
     }
@@ -506,12 +508,12 @@
         return tsym;
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeKind getKind() {
         return TypeKind.OTHER;
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public <R, P> R accept(TypeVisitor<R, P> v, P p) {
         throw new AssertionError();
     }
@@ -612,12 +614,12 @@
                 ((Integer)constValue()).intValue() != 0;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitPrimitive(this, p);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             switch (tag) {
                 case BYTE:      return TypeKind.BYTE;
@@ -720,6 +722,7 @@
         }
 
         boolean isPrintingBound = false;
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder s = new StringBuilder();
             appendAnnotationsString(s);
@@ -747,6 +750,7 @@
                 return new WildcardType(t, kind, tsym, bound, annos);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getExtendsBound() {
             if (kind == EXTENDS)
                 return type;
@@ -754,6 +758,7 @@
                 return null;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getSuperBound() {
             if (kind == SUPER)
                 return type;
@@ -761,10 +766,12 @@
                 return null;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.WILDCARD;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitWildcard(this, p);
         }
@@ -858,6 +865,7 @@
 
         /** The Java source which this type represents.
          */
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder buf = new StringBuilder();
             appendAnnotationsString(buf);
@@ -906,6 +914,7 @@
                 }
             }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type> getTypeArguments() {
             if (typarams_field == null) {
                 complete();
@@ -919,6 +928,7 @@
             return isRaw();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getEnclosingType() {
             return outer_field;
         }
@@ -993,10 +1003,12 @@
             if (tsym.completer != null) tsym.complete();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.DECLARED;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitDeclared(this, p);
         }
@@ -1037,16 +1049,17 @@
             return tsym.type;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public java.util.List<? extends TypeMirror> getAlternatives() {
             return Collections.unmodifiableList(alternatives_field);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.UNION;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitUnion(this, p);
         }
@@ -1073,6 +1086,7 @@
                     !supertype_field.isInterface(), supertype_field);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public java.util.List<? extends TypeMirror> getBounds() {
             return Collections.unmodifiableList(getExplicitComponents());
         }
@@ -1087,12 +1101,12 @@
                     getComponents();
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.INTERSECTION;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitIntersection(this, p);
         }
@@ -1127,6 +1141,7 @@
             return v.visitArrayType(this, s);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder sb = new StringBuilder();
             sb.append(elemtype);
@@ -1135,6 +1150,7 @@
             return sb.toString();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean equals(Object obj) {
             return
                 this == obj ||
@@ -1142,6 +1158,7 @@
                  this.elemtype.equals(((ArrayType)obj).elemtype));
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public int hashCode() {
             return (ARRAY.ordinal() << 5) + elemtype.hashCode();
         }
@@ -1197,14 +1214,17 @@
             elemtype.complete();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getComponentType() {
             return elemtype;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.ARRAY;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitArray(this, p);
         }
@@ -1251,6 +1271,7 @@
          *  XXX 06/09/99 iris This isn't correct Java syntax, but it probably
          *  should be.
          */
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder sb = new StringBuilder();
             appendAnnotationsString(sb);
@@ -1261,9 +1282,13 @@
             return sb.toString();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type>        getParameterTypes() { return argtypes; }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type              getReturnType()     { return restype; }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type              getReceiverType()   { return recvtype; }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type>        getThrownTypes()    { return thrown; }
 
         public boolean isErroneous() {
@@ -1297,6 +1322,7 @@
                 l.head.complete();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<TypeVar> getTypeVariables() {
             return List.nil();
         }
@@ -1305,10 +1331,12 @@
             return null;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.EXECUTABLE;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitExecutable(this, p);
         }
@@ -1336,14 +1364,17 @@
             return v.visitPackageType(this, s);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return tsym.getQualifiedName().toString();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.PACKAGE;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitNoType(this, p);
         }
@@ -1403,7 +1434,7 @@
             return v.visitTypeVar(this, s);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getUpperBound() {
             if ((bound == null || bound.hasTag(NONE)) && this != tsym.type) {
                 bound = tsym.type.getUpperBound();
@@ -1413,11 +1444,12 @@
 
         int rank_field = -1;
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getLowerBound() {
             return lower;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.TYPEVAR;
         }
@@ -1436,7 +1468,7 @@
             return true;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitTypeVariable(this, p);
         }
@@ -1487,7 +1519,7 @@
             return true;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder sb = new StringBuilder();
             appendAnnotationsString(sb);
@@ -1509,6 +1541,7 @@
             this.qtype = qtype;
         }
         public TypeTag getTag() { return tag; }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() { return qtype.toString(); }
         public List<Type> getTypeArguments() { return qtype.getTypeArguments(); }
         public Type getEnclosingType() { return qtype.getEnclosingType(); }
@@ -1544,6 +1577,7 @@
             return v.visitForAll(this, s);
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder sb = new StringBuilder();
             appendAnnotationsString(sb);
@@ -1579,14 +1613,17 @@
             qtype.complete();
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<TypeVar> getTypeVariables() {
             return List.convert(TypeVar.class, getTypeArguments());
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.EXECUTABLE;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitExecutable(this, p);
         }
@@ -1657,6 +1694,7 @@
             bounds.put(InferenceBound.EQ, List.<Type>nil());
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder sb = new StringBuilder();
             appendAnnotationsString(sb);
@@ -1857,12 +1895,12 @@
             return NONE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.NONE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitNoType(this, p);
         }
@@ -1890,7 +1928,7 @@
             return VOID;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.VOID;
         }
@@ -1898,7 +1936,7 @@
         @Override
         public boolean isCompound() { return false; }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitNoType(this, p);
         }
@@ -1925,7 +1963,7 @@
             return BOT;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.NULL;
         }
@@ -1933,7 +1971,7 @@
         @Override
         public boolean isCompound() { return false; }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitNull(this, p);
         }
@@ -2013,6 +2051,7 @@
         }
 
         public Type constType(Object constValue) { return this; }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public Type getEnclosingType()           { return this; }
         public Type getReturnType()              { return this; }
         public Type asSub(Symbol sym)            { return this; }
@@ -2024,8 +2063,10 @@
         public boolean isInterface()             { return false; }
 
         public List<Type> allparams()            { return List.nil(); }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public List<Type> getTypeArguments()     { return List.nil(); }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.ERROR;
         }
@@ -2034,6 +2075,7 @@
             return originalType;
         }
 
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitError(this, p);
         }
@@ -2057,7 +2099,7 @@
             return UNKNOWN;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitUnknown(this, p);
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Aug 27 07:44:00 2014 +0200
@@ -34,6 +34,7 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
@@ -243,7 +244,7 @@
             this.on = on;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "<placeholder: " + placeholderFor + " on: " + on + ">";
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Aug 27 07:44:00 2014 +0200
@@ -49,6 +49,7 @@
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Dependencies.AttributionKind;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
@@ -337,7 +338,7 @@
     // where
         private TreeVisitor<Symbol,Env<AttrContext>> identAttributer = new IdentAttributer();
         private class IdentAttributer extends SimpleTreeVisitor<Symbol,Env<AttrContext>> {
-            @Override
+            @Override @DefinedBy(Api.COMPILER_TREE)
             public Symbol visitMemberSelect(MemberSelectTree node, Env<AttrContext> env) {
                 Symbol site = visit(node.getExpression(), env);
                 if (site.kind == ERR || site.kind == ABSENT_TYP)
@@ -352,7 +353,7 @@
                 }
             }
 
-            @Override
+            @Override @DefinedBy(Api.COMPILER_TREE)
             public Symbol visitIdentifier(IdentifierTree node, Env<AttrContext> env) {
                 return rs.findIdent(env, (Name)node.getName(), TYP | PCK);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Aug 27 07:44:00 2014 +0200
@@ -30,6 +30,7 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
@@ -156,7 +157,7 @@
             return DEFERRED;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "DeferredType";
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Aug 27 07:44:00 2014 +0200
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
@@ -1325,7 +1326,7 @@
                     synthesizeTyparams((ClassSymbol) clazzType.tsym, tree.arguments.size());
                 final List<Type> actuals = visit(tree.arguments);
                 result = new ErrorType(tree.type, clazzType.tsym) {
-                    @Override
+                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
                     public List<Type> getTypeArguments() {
                         return actuals;
                     }
@@ -1338,7 +1339,7 @@
             ClassSymbol c = new ClassSymbol(flags, name, owner);
             c.members_field = new Scope.ErrorScope(c);
             c.type = new ErrorType(originalType, c) {
-                @Override
+                @Override @DefinedBy(Api.LANGUAGE_MODEL)
                 public List<Type> getTypeArguments() {
                     return typarams_field;
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Aug 27 07:44:00 2014 +0200
@@ -48,6 +48,7 @@
 import com.sun.tools.javac.tree.JCTree.JCMemberReference.ReferenceKind;
 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
@@ -3481,7 +3482,7 @@
             this.debugName = debugName;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             throw new AssertionError();
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java	Wed Aug 27 07:44:00 2014 +0200
@@ -40,6 +40,8 @@
 import static javax.tools.JavaFileObject.Kind.*;
 
 import com.sun.tools.javac.util.BaseFileManager;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
  * <p><b>This is NOT part of any supported API.
@@ -61,10 +63,13 @@
         return getClass().getSimpleName() + "[" + getName() + "]";
     }
 
+    @DefinedBy(Api.COMPILER)
     public NestingKind getNestingKind() { return null; }
 
+    @DefinedBy(Api.COMPILER)
     public Modifier getAccessLevel()  { return null; }
 
+    @DefinedBy(Api.COMPILER)
     public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
         return new InputStreamReader(openInputStream(), getDecoder(ignoreEncodingErrors));
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Aug 27 07:44:00 2014 +0200
@@ -58,6 +58,8 @@
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
@@ -174,6 +176,7 @@
         return getJavaFileForOutput(CLASS_OUTPUT, classname, kind, sibling);
     }
 
+    @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
         ListBuffer<File> files = new ListBuffer<>();
         for (String name : names)
@@ -181,6 +184,7 @@
         return getJavaFileObjectsFromFiles(files.toList());
     }
 
+    @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
         return getJavaFileObjectsFromStrings(Arrays.asList(nullCheck(names)));
     }
@@ -556,6 +560,7 @@
 
     /** Flush any output resources.
      */
+    @DefinedBy(Api.COMPILER)
     public void flush() {
         contentCache.clear();
     }
@@ -563,6 +568,7 @@
     /**
      * Close the JavaFileManager, releasing resources.
      */
+    @DefinedBy(Api.COMPILER)
     public void close() {
         for (Iterator<Archive> i = archives.values().iterator(); i.hasNext(); ) {
             Archive a = i.next();
@@ -574,6 +580,7 @@
         }
     }
 
+    @DefinedBy(Api.COMPILER)
     public ClassLoader getClassLoader(Location location) {
         nullCheck(location);
         Iterable<? extends File> path = getLocation(location);
@@ -591,6 +598,7 @@
         return getClassLoader(lb.toArray(new URL[lb.size()]));
     }
 
+    @DefinedBy(Api.COMPILER)
     public Iterable<JavaFileObject> list(Location location,
                                          String packageName,
                                          Set<JavaFileObject.Kind> kinds,
@@ -612,6 +620,7 @@
         return results.toList();
     }
 
+    @DefinedBy(Api.COMPILER)
     public String inferBinaryName(Location location, JavaFileObject file) {
         file.getClass(); // null check
         location.getClass(); // null check
@@ -627,6 +636,7 @@
             throw new IllegalArgumentException(file.getClass().getName());
     }
 
+    @DefinedBy(Api.COMPILER)
     public boolean isSameFile(FileObject a, FileObject b) {
         nullCheck(a);
         nullCheck(b);
@@ -637,10 +647,12 @@
         return a.equals(b);
     }
 
+    @DefinedBy(Api.COMPILER)
     public boolean hasLocation(Location location) {
         return getLocation(location) != null;
     }
 
+    @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForInput(Location location,
                                               String className,
                                               JavaFileObject.Kind kind)
@@ -655,6 +667,7 @@
         return getFileForInput(location, RelativeFile.forClass(className, kind));
     }
 
+    @DefinedBy(Api.COMPILER)
     public FileObject getFileForInput(Location location,
                                       String packageName,
                                       String relativeName)
@@ -696,6 +709,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForOutput(Location location,
                                                String className,
                                                JavaFileObject.Kind kind,
@@ -711,6 +725,7 @@
         return getFileForOutput(location, RelativeFile.forClass(className, kind), sibling);
     }
 
+    @DefinedBy(Api.COMPILER)
     public FileObject getFileForOutput(Location location,
                                        String packageName,
                                        String relativeName,
@@ -760,6 +775,7 @@
 
     }
 
+    @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(
         Iterable<? extends File> files)
     {
@@ -773,10 +789,12 @@
         return result;
     }
 
+    @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
         return getJavaFileObjectsFromFiles(Arrays.asList(nullCheck(files)));
     }
 
+    @DefinedBy(Api.COMPILER)
     public void setLocation(Location location,
                             Iterable<? extends File> path)
         throws IOException
@@ -785,6 +803,7 @@
         locations.setLocation(location, path);
     }
 
+    @DefinedBy(Api.COMPILER)
     public Iterable<? extends File> getLocation(Location location) {
         nullCheck(location);
         return locations.getLocation(location);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Aug 27 07:44:00 2014 +0200
@@ -42,6 +42,9 @@
 import javax.tools.JavaFileObject;
 import java.text.Normalizer;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * A subclass of JavaFileObject representing regular files.
  *
@@ -75,12 +78,12 @@
             fileManager.log.warning("file.from.future", f);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public URI toUri() {
         return file.toURI().normalize();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public String getName() {
         return file.getPath();
     }
@@ -90,24 +93,24 @@
         return name;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject.Kind getKind() {
         return getKind(name);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public InputStream openInputStream() throws IOException {
         return new FileInputStream(file);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public OutputStream openOutputStream() throws IOException {
         fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new FileOutputStream(file);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
         CharBuffer cb = fileManager.getCachedContent(this);
         if (cb == null) {
@@ -128,19 +131,19 @@
         return cb;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Writer openWriter() throws IOException {
         fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new OutputStreamWriter(new FileOutputStream(file), fileManager.getEncodingName());
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public long getLastModified() {
         return file.lastModified();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean delete() {
         return file.delete();
     }
@@ -170,7 +173,7 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean isNameCompatible(String cn, JavaFileObject.Kind kind) {
         cn.getClass();
         // null check
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java	Wed Aug 27 07:44:00 2014 +0200
@@ -46,6 +46,8 @@
 import com.sun.tools.javac.file.JavacFileManager.Archive;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
@@ -171,12 +173,13 @@
             this.entry = entry;
         }
 
+        @DefinedBy(Api.COMPILER)
         public URI toUri() {
             File zipFile = new File(zarch.zfile.getName());
             return createJarUri(zipFile, entry.getName());
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public String getName() {
             return zarch.zfile.getName() + "(" + entry.getName() + ")";
         }
@@ -186,22 +189,22 @@
             return new File(zarch.zfile.getName()).getName() + "(" + entry + ")";
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public JavaFileObject.Kind getKind() {
             return getKind(entry.getName());
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public InputStream openInputStream() throws IOException {
             return zarch.zfile.getInputStream(entry);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public OutputStream openOutputStream() throws IOException {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
             CharBuffer cb = fileManager.getCachedContent(this);
             if (cb == null) {
@@ -222,17 +225,17 @@
             return cb;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Writer openWriter() throws IOException {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public long getLastModified() {
             return entry.getTime();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean delete() {
             throw new UnsupportedOperationException();
         }
@@ -248,7 +251,7 @@
             return removeExtension(entryName).replace('/', '.');
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean isNameCompatible(String cn, JavaFileObject.Kind k) {
             cn.getClass();
             // null check
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Wed Aug 27 07:44:00 2014 +0200
@@ -43,6 +43,8 @@
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 
 /**
@@ -120,12 +122,12 @@
             this.zipName = zipFileName;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public URI toUri() {
             return createJarUri(zipName, getPrefixedEntryName());
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public String getName() {
             return zipName + "(" + getPrefixedEntryName() + ")";
         }
@@ -135,23 +137,23 @@
             return zipName.getName() + "(" + entry.getName() + ")";
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public JavaFileObject.Kind getKind() {
             return getKind(entry.getName());
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public InputStream openInputStream() throws IOException {
             Assert.checkNonNull(entry); // see constructor
             return new ByteArrayInputStream(zfIndex.read(entry));
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public OutputStream openOutputStream() throws IOException {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
             CharBuffer cb = fileManager.getCachedContent(this);
             if (cb == null) {
@@ -171,17 +173,17 @@
             return cb;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Writer openWriter() throws IOException {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public long getLastModified() {
             return entry.getLastModified();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean delete() {
             throw new UnsupportedOperationException();
         }
@@ -202,7 +204,7 @@
             return removeExtension(entryName).replace('/', '.');
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean isNameCompatible(String cn, JavaFileObject.Kind k) {
             cn.getClass(); // null check
             if (k == Kind.OTHER && getKind() != k)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Aug 27 07:44:00 2014 +0200
@@ -47,6 +47,7 @@
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.file.BaseFileObject;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -668,7 +669,7 @@
                 outer = new ClassType(outer, sigToTypes('>'), t,
                                       Type.noAnnotations) {
                         boolean completed = false;
-                        @Override
+                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
                         public Type getEnclosingType() {
                             if (!completed) {
                                 completed = true;
@@ -1656,7 +1657,7 @@
             this.enumerator = enumerator;
         }
         public void accept(Visitor v) { ((ProxyVisitor)v).visitEnumAttributeProxy(this); }
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "/*proxy enum*/" + enumType + "." + enumerator;
         }
@@ -1669,7 +1670,7 @@
             this.values = values;
         }
         public void accept(Visitor v) { ((ProxyVisitor)v).visitArrayAttributeProxy(this); }
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             return "{" + values + "}";
         }
@@ -1685,7 +1686,7 @@
             this.values = values;
         }
         public void accept(Visitor v) { ((ProxyVisitor)v).visitCompoundAnnotationProxy(this); }
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public String toString() {
             StringBuilder buf = new StringBuilder();
             buf.append("@");
@@ -2426,7 +2427,7 @@
             this.flatname = flatname;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public URI toUri() {
             try {
                 return new URI(null, name.toString(), null);
@@ -2435,7 +2436,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public String getName() {
             return name.toString();
         }
@@ -2445,42 +2446,42 @@
             return getName();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public JavaFileObject.Kind getKind() {
             return getKind(getName());
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public InputStream openInputStream() {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public OutputStream openOutputStream() {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public CharBuffer getCharContent(boolean ignoreEncodingErrors) {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Reader openReader(boolean ignoreEncodingErrors) {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Writer openWriter() {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public long getLastModified() {
             throw new UnsupportedOperationException();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean delete() {
             throw new UnsupportedOperationException();
         }
@@ -2490,7 +2491,7 @@
             return flatname.toString();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean isNameCompatible(String simpleName, JavaFileObject.Kind kind) {
             return true; // fail-safe mode
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Pool.java	Wed Aug 27 07:44:00 2014 +0200
@@ -40,6 +40,9 @@
 
 import java.util.*;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /** An internal structure that corresponds to the constant pool of a classfile.
  *
  *  <p><b>This is NOT part of any supported API.
@@ -155,6 +158,7 @@
             super(m);
             this.uniqueType = new UniqueType(m.type, types);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean equals(Object any) {
             if (!(any instanceof Method)) return false;
             MethodSymbol o = ((Method)any).other;
@@ -164,6 +168,7 @@
                 o.owner == m.owner &&
                 ((Method)any).uniqueType.equals(uniqueType);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public int hashCode() {
             MethodSymbol m = this.other;
             return
@@ -181,7 +186,7 @@
             uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean equals(Object any) {
             if (!super.equals(any)) return false;
             if (!(any instanceof DynamicMethod)) return false;
@@ -193,7 +198,7 @@
                             ((DynamicMethod)any).uniqueStaticArgs);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public int hashCode() {
             int hash = super.hashCode();
             DynamicMethodSymbol dm = (DynamicMethodSymbol)other;
@@ -224,6 +229,7 @@
             super(v);
             this.uniqueType = new UniqueType(v.type, types);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean equals(Object any) {
             if (!(any instanceof Variable)) return false;
             VarSymbol o = ((Variable)any).other;
@@ -233,6 +239,7 @@
                 o.owner == v.owner &&
                 ((Variable)any).uniqueType.equals(uniqueType);
         }
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public int hashCode() {
             VarSymbol v = other;
             return
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed Aug 27 07:44:00 2014 +0200
@@ -47,6 +47,7 @@
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Name;
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
@@ -84,6 +85,7 @@
         enter = Enter.instance(context);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public PackageSymbol getPackageElement(CharSequence name) {
         String strName = name.toString();
         if (strName.equals(""))
@@ -93,6 +95,7 @@
             : null;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public ClassSymbol getTypeElement(CharSequence name) {
         String strName = name.toString();
         return SourceVersion.isName(strName)
@@ -308,6 +311,7 @@
         return (treeTop != null) ? treeTop.fst : null;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public String getDocComment(Element e) {
         // Our doc comment is contained in a map in our toplevel,
         // indexed by our tree.  Find our enter environment, which gives
@@ -323,19 +327,23 @@
         return toplevel.docComments.getCommentText(tree);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public PackageElement getPackageOf(Element e) {
         return cast(Symbol.class, e).packge();
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isDeprecated(Element e) {
         Symbol sym = cast(Symbol.class, e);
         return (sym.flags() & Flags.DEPRECATED) != 0;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Name getBinaryName(TypeElement type) {
         return cast(TypeSymbol.class, type).flatName();
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Map<MethodSymbol, Attribute> getElementValuesWithDefaults(
                                                         AnnotationMirror a) {
         Attribute.Compound anno = cast(Attribute.Compound.class, a);
@@ -356,6 +364,7 @@
     /**
      * {@inheritDoc}
      */
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public FilteredMemberList getAllMembers(TypeElement element) {
         Symbol sym = cast(Symbol.class, element);
         WriteableScope scope = sym.members().dupUnshared();
@@ -393,7 +402,7 @@
      * @param e  the element being examined
      * @return all annotations of the element
      */
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public List<Attribute.Compound> getAllAnnotationMirrors(Element e) {
         Symbol sym = cast(Symbol.class, e);
         List<Attribute.Compound> annos = sym.getAnnotationMirrors();
@@ -436,6 +445,7 @@
         return false;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean hides(Element hiderEl, Element hideeEl) {
         Symbol hider = cast(Symbol.class, hiderEl);
         Symbol hidee = cast(Symbol.class, hideeEl);
@@ -472,6 +482,7 @@
         return hidee.isInheritedIn(hiderClass, types);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean overrides(ExecutableElement riderEl,
                              ExecutableElement rideeEl, TypeElement typeEl) {
         MethodSymbol rider = cast(MethodSymbol.class, riderEl);
@@ -494,6 +505,7 @@
                rider.overrides(ridee, origin, types, false);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public String getConstantExpression(Object value) {
         return Constants.format(value);
     }
@@ -507,16 +519,18 @@
      * @param w the writer to print the output to
      * @param elements the elements to print
      */
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public void printElements(java.io.Writer w, Element... elements) {
         for (Element element : elements)
             (new PrintingProcessor.PrintingElementVisitor(w, this)).visit(element).flush();
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Name getName(CharSequence cs) {
         return names.fromString(cs.toString());
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isFunctionalInterface(TypeElement element) {
         if (element.getKind() != ElementKind.INTERFACE)
             return false;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java	Wed Aug 27 07:44:00 2014 +0200
@@ -37,6 +37,7 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
  * Utility methods for operating on types.
@@ -64,6 +65,7 @@
         types = Types.instance(context);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public Element asElement(TypeMirror t) {
         switch (t.getKind()) {
             case DECLARED:
@@ -77,47 +79,56 @@
         }
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isSameType(TypeMirror t1, TypeMirror t2) {
         return types.isSameType((Type) t1, (Type) t2);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isSubtype(TypeMirror t1, TypeMirror t2) {
         validateTypeNotIn(t1, EXEC_OR_PKG);
         validateTypeNotIn(t2, EXEC_OR_PKG);
         return types.isSubtype((Type) t1, (Type) t2);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isAssignable(TypeMirror t1, TypeMirror t2) {
         validateTypeNotIn(t1, EXEC_OR_PKG);
         validateTypeNotIn(t2, EXEC_OR_PKG);
         return types.isAssignable((Type) t1, (Type) t2);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean contains(TypeMirror t1, TypeMirror t2) {
         validateTypeNotIn(t1, EXEC_OR_PKG);
         validateTypeNotIn(t2, EXEC_OR_PKG);
         return types.containsType((Type) t1, (Type) t2);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
         return types.isSubSignature((Type) m1, (Type) m2);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public List<Type> directSupertypes(TypeMirror t) {
         validateTypeNotIn(t, EXEC_OR_PKG);
         return types.directSupertypes((Type) t);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeMirror erasure(TypeMirror t) {
         if (t.getKind() == TypeKind.PACKAGE)
             throw new IllegalArgumentException(t.toString());
         return types.erasure((Type) t);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeElement boxedClass(PrimitiveType p) {
         return types.boxedClass((Type) p);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public PrimitiveType unboxedType(TypeMirror t) {
         if (t.getKind() != TypeKind.DECLARED)
             throw new IllegalArgumentException(t.toString());
@@ -127,11 +138,13 @@
         return (PrimitiveType)unboxed;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeMirror capture(TypeMirror t) {
         validateTypeNotIn(t, EXEC_OR_PKG);
         return types.capture((Type) t);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public PrimitiveType getPrimitiveType(TypeKind kind) {
         switch (kind) {
         case BOOLEAN:   return syms.booleanType;
@@ -147,10 +160,12 @@
         }
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public NullType getNullType() {
         return (NullType) syms.botType;
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public NoType getNoType(TypeKind kind) {
         switch (kind) {
         case VOID:      return syms.voidType;
@@ -160,6 +175,7 @@
         }
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public ArrayType getArrayType(TypeMirror componentType) {
         switch (componentType.getKind()) {
         case VOID:
@@ -172,6 +188,7 @@
                                   Type.noAnnotations);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public WildcardType getWildcardType(TypeMirror extendsBound,
                                         TypeMirror superBound) {
         BoundKind bkind;
@@ -201,6 +218,7 @@
         }
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public DeclaredType getDeclaredType(TypeElement typeElem,
                                         TypeMirror... typeArgs) {
         ClassSymbol sym = (ClassSymbol) typeElem;
@@ -213,6 +231,7 @@
         return getDeclaredType0(sym.type.getEnclosingType(), sym, typeArgs);
     }
 
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public DeclaredType getDeclaredType(DeclaredType enclosing,
                                         TypeElement typeElem,
                                         TypeMirror... typeArgs) {
@@ -263,6 +282,7 @@
      * @throws IllegalArgumentException if the element is not a valid one
      *          for the given type
      */
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public TypeMirror asMemberOf(DeclaredType containing, Element element) {
         Type site = (Type)containing;
         Symbol sym = (Symbol)element;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Wed Aug 27 07:44:00 2014 +0200
@@ -60,6 +60,8 @@
 
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
@@ -138,18 +140,18 @@
         defaultFileSystem = fs;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public void flush() throws IOException {
         contentCache.clear();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public void close() throws IOException {
         for (FileSystem fs: fileSystems.values())
             fs.close();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public ClassLoader getClassLoader(Location location) {
         nullCheck(location);
         Iterable<? extends Path> path = getLocation(location);
@@ -169,6 +171,7 @@
 
     // <editor-fold defaultstate="collapsed" desc="Location handling">
 
+    @DefinedBy(Api.COMPILER)
     public boolean hasLocation(Location location) {
         return (getLocation(location) != null);
     }
@@ -281,7 +284,7 @@
         return ((PathFileObject) fo).getPath();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean isSameFile(FileObject a, FileObject b) {
         nullCheck(a);
         nullCheck(b);
@@ -292,7 +295,7 @@
         return ((PathFileObject) a).isSameFile((PathFileObject) b);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<JavaFileObject> list(Location location,
             String packageName, Set<Kind> kinds, boolean recurse)
             throws IOException {
@@ -402,13 +405,13 @@
         return getJavaFileObjectsFromPaths(Arrays.asList(nullCheck(paths)));
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForInput(Location location,
             String className, Kind kind) throws IOException {
         return getFileForInput(location, getRelativePath(className, kind));
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public FileObject getFileForInput(Location location,
             String packageName, String relativeName) throws IOException {
         return getFileForInput(location, getRelativePath(packageName, relativeName));
@@ -433,13 +436,13 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForOutput(Location location,
             String className, Kind kind, FileObject sibling) throws IOException {
         return getFileForOutput(location, getRelativePath(className, kind), sibling);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public FileObject getFileForOutput(Location location, String packageName,
             String relativeName, FileObject sibling)
             throws IOException {
@@ -474,7 +477,7 @@
 
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public String inferBinaryName(Location location, JavaFileObject fo) {
         nullCheck(fo);
         // Need to match the path semantics of list(location, ...)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Wed Aug 27 07:44:00 2014 +0200
@@ -44,6 +44,8 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.util.BaseFileManager;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 
 /**
@@ -150,12 +152,12 @@
         return path;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Kind getKind() {
         return BaseFileManager.getKind(path.getFileName().toString());
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean isNameCompatible(String simpleName, Kind kind) {
         simpleName.getClass();
         // null check
@@ -177,45 +179,45 @@
         return false;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public NestingKind getNestingKind() {
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Modifier getAccessLevel() {
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public URI toUri() {
         return path.toUri();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public String getName() {
         return path.toString();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public InputStream openInputStream() throws IOException {
         return Files.newInputStream(path);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public OutputStream openOutputStream() throws IOException {
         fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return Files.newOutputStream(path);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
         CharsetDecoder decoder = fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors);
         return new InputStreamReader(openInputStream(), decoder);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
         CharBuffer cb = fileManager.getCachedContent(this);
         if (cb == null) {
@@ -236,14 +238,14 @@
         return cb;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Writer openWriter() throws IOException {
         fileManager.flushCache(this);
         ensureParentDirectoriesExist();
         return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName());
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public long getLastModified() {
         try {
             return Files.getLastModifiedTime(path).toMillis();
@@ -252,7 +254,7 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean delete() {
         try {
             Files.delete(path);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Wed Aug 27 07:44:00 2014 +0200
@@ -52,6 +52,7 @@
 
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
 
@@ -120,7 +121,7 @@
             this.name = name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public synchronized OutputStream openOutputStream() throws IOException {
             if (opened)
                 throw new IOException(ALREADY_OPENED);
@@ -128,7 +129,7 @@
             return new FilerOutputStream(name, fileObject);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public synchronized Writer openWriter() throws IOException {
             if (opened)
                 throw new IOException(ALREADY_OPENED);
@@ -137,22 +138,22 @@
         }
 
         // Three anti-literacy methods
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public InputStream openInputStream() throws IOException {
             throw new IllegalStateException(NOT_FOR_READING);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
             throw new IllegalStateException(NOT_FOR_READING);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
             throw new IllegalStateException(NOT_FOR_READING);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean delete() {
             return false;
         }
@@ -165,19 +166,23 @@
             this.javaFileObject = javaFileObject;
         }
 
+        @DefinedBy(Api.COMPILER)
         public JavaFileObject.Kind getKind() {
             return javaFileObject.getKind();
         }
 
+        @DefinedBy(Api.COMPILER)
         public boolean isNameCompatible(String simpleName,
                                         JavaFileObject.Kind kind) {
             return javaFileObject.isNameCompatible(simpleName, kind);
         }
 
+        @DefinedBy(Api.COMPILER)
         public NestingKind getNestingKind() {
             return javaFileObject.getNestingKind();
         }
 
+        @DefinedBy(Api.COMPILER)
         public Modifier getAccessLevel() {
             return javaFileObject.getAccessLevel();
         }
@@ -191,17 +196,17 @@
             super(fileObject);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public OutputStream openOutputStream() throws IOException {
             throw new IllegalStateException(NOT_FOR_WRITING);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public Writer openWriter() throws IOException {
             throw new IllegalStateException(NOT_FOR_WRITING);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER)
         public boolean delete() {
             return false;
         }
@@ -214,19 +219,23 @@
             this.javaFileObject = javaFileObject;
         }
 
+        @DefinedBy(Api.COMPILER)
         public JavaFileObject.Kind getKind() {
             return javaFileObject.getKind();
         }
 
+        @DefinedBy(Api.COMPILER)
         public boolean isNameCompatible(String simpleName,
                                         JavaFileObject.Kind kind) {
             return javaFileObject.isNameCompatible(simpleName, kind);
         }
 
+        @DefinedBy(Api.COMPILER)
         public NestingKind getNestingKind() {
             return javaFileObject.getNestingKind();
         }
 
+        @DefinedBy(Api.COMPILER)
         public Modifier getAccessLevel() {
             return javaFileObject.getAccessLevel();
         }
@@ -373,11 +382,13 @@
         lint = (Lint.instance(context)).isEnabled(PROCESSING);
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public JavaFileObject createSourceFile(CharSequence name,
                                            Element... originatingElements) throws IOException {
         return createSourceOrClassFile(true, name.toString());
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public JavaFileObject createClassFile(CharSequence name,
                                            Element... originatingElements) throws IOException {
         return createSourceOrClassFile(false, name.toString());
@@ -415,6 +426,7 @@
         return new FilerOutputJavaFileObject(name, fileObject);
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public FileObject createResource(JavaFileManager.Location location,
                                      CharSequence pkg,
                                      CharSequence relativeName,
@@ -445,6 +457,7 @@
         }
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public FileObject getResource(JavaFileManager.Location location,
                                   CharSequence pkg,
                                   CharSequence relativeName) throws IOException {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Wed Aug 27 07:44:00 2014 +0200
@@ -27,6 +27,7 @@
 
 import com.sun.tools.javac.model.JavacElements;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
 import javax.lang.model.element.*;
@@ -55,10 +56,12 @@
 
     // processingEnv.getElementUtils()
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public void printMessage(Diagnostic.Kind kind, CharSequence msg) {
         printMessage(kind, msg, null, null, null);
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public void printMessage(Diagnostic.Kind kind, CharSequence msg,
                       Element e) {
         printMessage(kind, msg, e, null, null);
@@ -73,6 +76,7 @@
      * @param e    the annotated element
      * @param a    the annotation to use as a position hint
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public void printMessage(Diagnostic.Kind kind, CharSequence msg,
                       Element e, AnnotationMirror a) {
         printMessage(kind, msg, e, a, null);
@@ -89,6 +93,7 @@
      * @param a    the annotation containing the annotaiton value
      * @param v    the annotation value to use as a position hint
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public void printMessage(Diagnostic.Kind kind, CharSequence msg,
                       Element e, AnnotationMirror a, AnnotationValue v) {
         JavaFileObject oldSource = null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Aug 27 07:44:00 2014 +0200
@@ -64,6 +64,8 @@
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.List;
@@ -757,20 +759,20 @@
             this.elements = elements;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<TypeElement> visitPackage(PackageElement e, Set<TypeElement> p) {
             // Don't scan enclosed elements of a package
             return p;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<TypeElement> visitType(TypeElement e, Set<TypeElement> p) {
             // Type parameters are not considered to be enclosed by a type
             scan(e.getTypeParameters(), p);
             return super.visitType(e, p);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<TypeElement> visitExecutable(ExecutableElement e, Set<TypeElement> p) {
             // Type parameters are not considered to be enclosed by an executable
             scan(e.getTypeParameters(), p);
@@ -785,7 +787,7 @@
             }
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<TypeElement> scan(Element e, Set<TypeElement> p) {
             addAnnotations(e, p);
             return super.scan(e, p);
@@ -1390,30 +1392,37 @@
      * processors.
      * {@literal "-Afoo=bar"} should be {@literal "-Afoo" => "bar"}.
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Map<String,String> getOptions() {
         return processorOptions;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Messager getMessager() {
         return messager;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Filer getFiler() {
         return filer;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public JavacElements getElementUtils() {
         return elementUtils;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public JavacTypes getTypeUtils() {
         return typeUtils;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public SourceVersion getSourceVersion() {
         return Source.toSourceVersion(source);
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Locale getLocale() {
         return messages.getCurrentLocale();
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Wed Aug 27 07:44:00 2014 +0200
@@ -31,6 +31,9 @@
 import javax.lang.model.util.*;
 import java.util.*;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * Object providing state about a prior round of annotation processing.
  *
@@ -69,6 +72,7 @@
                              processingOver);
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public boolean processingOver() {
         return processingOver;
     }
@@ -80,6 +84,7 @@
      * @return {@code true} if an error was raised in the prior round
      * of processing; returns {@code false} otherwise.
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public boolean errorRaised() {
         return errorRaised;
     }
@@ -90,6 +95,7 @@
      * @return the types elements specified by the prior round, or an
      * empty set if there were none
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Set<? extends Element> getRootElements() {
         return rootElements;
     }
@@ -109,6 +115,7 @@
      * @return the elements annotated with the given annotation type,
      * or an empty set if there are none
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Set<? extends Element> getElementsAnnotatedWith(TypeElement a) {
         Set<Element> result = Collections.emptySet();
         if (a.getKind() != ElementKind.ANNOTATION_TYPE)
@@ -133,21 +140,21 @@
             super(defaultSet);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<Element> visitType(TypeElement e, TypeElement p) {
             // Type parameters are not considered to be enclosed by a type
             scan(e.getTypeParameters(), p);
             return super.visitType(e, p);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<Element> visitExecutable(ExecutableElement e, TypeElement p) {
             // Type parameters are not considered to be enclosed by an executable
             scan(e.getTypeParameters(), p);
             return super.visitExecutable(e, p);
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public Set<Element> scan(Element e, TypeElement p) {
             java.util.List<? extends AnnotationMirror> annotationMirrors =
                 processingEnv.getElementUtils().getAllAnnotationMirrors(e);
@@ -163,6 +170,7 @@
     /**
      * {@inheritdoc}
      */
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public Set<? extends Element> getElementsAnnotatedWith(Class<? extends Annotation> a) {
         if (!a.isAnnotation())
             throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Wed Aug 27 07:44:00 2014 +0200
@@ -36,6 +36,9 @@
 import java.io.PrintWriter;
 import java.io.Writer;
 import java.util.*;
+
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.StringUtils;
 
 /**
@@ -62,7 +65,7 @@
         writer = new PrintWriter(w);
     }
 
-    @Override
+    @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
     public boolean process(Set<? extends TypeElement> tes,
                            RoundEnvironment renv) {
 
@@ -95,7 +98,7 @@
             indentation = 0;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         protected PrintingElementVisitor defaultAction(Element e, Boolean newLine) {
             if (newLine != null && newLine)
                 writer.println();
@@ -104,7 +107,7 @@
             return this;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public PrintingElementVisitor visitExecutable(ExecutableElement e, Boolean p) {
             ElementKind kind = e.getKind();
 
@@ -118,7 +121,7 @@
                     NestingKind.ANONYMOUS ==
                     // Use an anonymous class to determine anonymity!
                     (new SimpleElementVisitor7<NestingKind, Void>() {
-                        @Override
+                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
                         public NestingKind visitType(TypeElement e, Void p) {
                             return e.getNestingKind();
                         }
@@ -155,7 +158,7 @@
         }
 
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public PrintingElementVisitor visitType(TypeElement e, Boolean p) {
             ElementKind kind = e.getKind();
             NestingKind nestingKind = e.getNestingKind();
@@ -259,7 +262,7 @@
             return this;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public PrintingElementVisitor visitVariable(VariableElement e, Boolean newLine) {
             ElementKind kind = e.getKind();
             defaultAction(e, newLine);
@@ -278,14 +281,14 @@
             return this;
         }
 
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public PrintingElementVisitor visitTypeParameter(TypeParameterElement e, Boolean p) {
             writer.print(e.getSimpleName());
             return this;
         }
 
         // Should we do more here?
-        @Override
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public PrintingElementVisitor visitPackage(PackageElement e, Boolean p) {
             defaultAction(e, false);
             if (!e.isUnnamed())
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Wed Aug 27 07:44:00 2014 +0200
@@ -37,6 +37,8 @@
 import com.sun.tools.javac.jvm.ClassWriter;
 import com.sun.tools.javac.jvm.Pool;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Pair;
@@ -102,6 +104,7 @@
         return keys;
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
         try {
             if (renv.processingOver())
@@ -271,6 +274,7 @@
         }
     }
 
+    @DefinedBy(Api.ANNOTATION_PROCESSING)
     public SourceVersion getSupportedSourceVersion() {
         return SourceVersion.latest();
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Wed Aug 27 07:44:00 2014 +0200
@@ -31,6 +31,8 @@
 import com.sun.source.doctree.*;
 import com.sun.tools.javac.parser.Tokens.Comment;
 import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.DiagnosticSource;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
@@ -114,22 +116,27 @@
             this.tags = tags;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.DOC_COMMENT;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitDocComment(this, d);
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getFirstSentence() {
             return firstSentence;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBody() {
             return body;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBlockTags() {
             return tags;
         }
@@ -137,12 +144,14 @@
     }
 
     public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
+        @DefinedBy(Api.COMPILER_TREE)
         public String getTagName() {
             return getKind().tagName;
         }
     }
 
     public static abstract class DCInlineTag extends DCEndPosTree<DCInlineTag> implements InlineTagTree {
+        @DefinedBy(Api.COMPILER_TREE)
         public String getTagName() {
             return getKind().tagName;
         }
@@ -160,27 +169,27 @@
             this.value = value;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.ATTRIBUTE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitAttribute(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Name getName() {
             return name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public ValueKind getValueKind() {
             return vkind;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<DCTree> getValue() {
             return value;
         }
@@ -193,17 +202,17 @@
             this.name = name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.AUTHOR;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitAuthor(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getName() {
             return name;
         }
@@ -216,17 +225,17 @@
             this.body = body;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.COMMENT;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitComment(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getBody() {
             return body;
         }
@@ -239,17 +248,17 @@
             this.body = body;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.DEPRECATED;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitDeprecated(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBody() {
             return body;
         }
@@ -257,12 +266,12 @@
 
     public static class DCDocRoot extends DCInlineTag implements DocRootTree {
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.DOC_ROOT;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitDocRoot(this, d);
         }
@@ -275,17 +284,17 @@
             this.name = name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.END_ELEMENT;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitEndElement(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Name getName() {
             return name;
         }
@@ -298,17 +307,17 @@
             this.name = name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.ENTITY;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitEntity(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Name getName() {
             return name;
         }
@@ -323,22 +332,22 @@
             this.diag = diags.error(diagSource, this, code, args);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.ERRONEOUS;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitErroneous(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getBody() {
             return body;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Diagnostic<JavaFileObject> getDiagnostic() {
             return diag;
         }
@@ -372,29 +381,29 @@
             this.name = name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.IDENTIFIER;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitIdentifier(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Name getName() {
             return name;
         }
     }
 
     public static class DCInheritDoc extends DCInlineTag implements InheritDocTree {
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.INHERIT_DOC;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitInheritDoc(this, d);
         }
@@ -412,22 +421,22 @@
             this.label = label;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return kind;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitLink(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public ReferenceTree getReference() {
             return ref;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getLabel() {
             return label;
         }
@@ -443,17 +452,17 @@
             this.body = body;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return kind;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitLiteral(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public DCText getBody() {
             return body;
         }
@@ -470,27 +479,27 @@
             this.description = description;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.PARAM;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitParam(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public boolean isTypeParameter() {
             return isTypeParameter;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public IdentifierTree getName() {
             return name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getDescription() {
             return description;
         }
@@ -513,17 +522,17 @@
             this.paramTypes = paramTypes;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.REFERENCE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitReference(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getSignature() {
             return signature;
         }
@@ -536,17 +545,17 @@
             this.description = description;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.RETURN;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitReturn(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getDescription() {
             return description;
         }
@@ -559,17 +568,17 @@
             this.reference = reference;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.SEE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitSee(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getReference() {
             return reference;
         }
@@ -582,17 +591,17 @@
             this.description = description;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.SERIAL;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitSerial(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getDescription() {
             return description;
         }
@@ -605,17 +614,17 @@
             this.description = description;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.SERIAL_DATA;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitSerialData(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getDescription() {
             return description;
         }
@@ -632,27 +641,27 @@
             this.type = type;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.SERIAL_FIELD;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitSerialField(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getDescription() {
             return description;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public IdentifierTree getName() {
             return name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public ReferenceTree getType() {
             return type;
         }
@@ -665,17 +674,17 @@
             this.body = body;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.SINCE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitSince(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBody() {
             return body;
         }
@@ -692,27 +701,27 @@
             this.selfClosing = selfClosing;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.START_ELEMENT;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitStartElement(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Name getName() {
             return name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getAttributes() {
             return attrs;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public boolean isSelfClosing() {
             return selfClosing;
         }
@@ -725,17 +734,17 @@
             this.text = text;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.TEXT;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitText(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getBody() {
             return text;
         }
@@ -753,22 +762,22 @@
             this.description = description;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return kind;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitThrows(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public ReferenceTree getExceptionName() {
             return name;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getDescription() {
             return description;
         }
@@ -783,22 +792,22 @@
             this.content = content;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.UNKNOWN_BLOCK_TAG;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitUnknownBlockTag(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getTagName() {
             return name.toString();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getContent() {
             return content;
         }
@@ -813,22 +822,22 @@
             this.content = content;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.UNKNOWN_INLINE_TAG;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitUnknownInlineTag(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getTagName() {
             return name.toString();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getContent() {
             return content;
         }
@@ -841,17 +850,17 @@
             this.ref = ref;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.VALUE;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitValue(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public ReferenceTree getReference() {
             return ref;
         }
@@ -864,17 +873,17 @@
             this.body = body;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.VERSION;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitVersion(this, d);
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBody() {
             return body;
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Wed Aug 27 07:44:00 2014 +0200
@@ -30,6 +30,8 @@
 import com.sun.source.doctree.*;
 import com.sun.source.doctree.AttributeTree.ValueKind;
 import com.sun.tools.javac.util.Convert;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import java.io.IOException;
 import java.util.List;
 
@@ -128,6 +130,7 @@
     }
 
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitAttribute(AttributeTree node, Void p) {
         try {
             print(node.getName());
@@ -159,6 +162,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitAuthor(AuthorTree node, Void p) {
         try {
             printTagName(node);
@@ -170,6 +174,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitComment(CommentTree node, Void p) {
         try {
             print(node.getBody());
@@ -179,6 +184,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitDeprecated(DeprecatedTree node, Void p) {
         try {
             printTagName(node);
@@ -192,6 +198,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocComment(DocCommentTree node, Void p) {
         try {
             List<? extends DocTree> fs = node.getFirstSentence();
@@ -210,6 +217,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocRoot(DocRootTree node, Void p) {
         try {
             print("{");
@@ -221,6 +229,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitEndElement(EndElementTree node, Void p) {
         try {
             print("</");
@@ -232,6 +241,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitEntity(EntityTree node, Void p) {
         try {
             print("&");
@@ -243,6 +253,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitErroneous(ErroneousTree node, Void p) {
         try {
             print(node.getBody());
@@ -252,6 +263,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitIdentifier(IdentifierTree node, Void p) {
         try {
             print(node.getName());
@@ -261,6 +273,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitInheritDoc(InheritDocTree node, Void p) {
         try {
             print("{");
@@ -272,6 +285,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitLink(LinkTree node, Void p) {
         try {
             print("{");
@@ -289,6 +303,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitLiteral(LiteralTree node, Void p) {
         try {
             print("{");
@@ -302,6 +317,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitParam(ParamTree node, Void p) {
         try {
             printTagName(node);
@@ -319,6 +335,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitReference(ReferenceTree node, Void p) {
         try {
             print(node.getSignature());
@@ -328,6 +345,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitReturn(ReturnTree node, Void p) {
         try {
             printTagName(node);
@@ -339,6 +357,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitSee(SeeTree node, Void p) {
         try {
             printTagName(node);
@@ -356,6 +375,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerial(SerialTree node, Void p) {
         try {
             printTagName(node);
@@ -369,6 +389,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialData(SerialDataTree node, Void p) {
         try {
             printTagName(node);
@@ -382,6 +403,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialField(SerialFieldTree node, Void p) {
         try {
             printTagName(node);
@@ -399,6 +421,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitSince(SinceTree node, Void p) {
         try {
             printTagName(node);
@@ -410,6 +433,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitStartElement(StartElementTree node, Void p) {
         try {
             print("<");
@@ -432,6 +456,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitText(TextTree node, Void p) {
         try {
             print(node.getBody());
@@ -441,6 +466,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitThrows(ThrowsTree node, Void p) {
         try {
             printTagName(node);
@@ -456,6 +482,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
         try {
             print("@");
@@ -468,6 +495,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownInlineTag(UnknownInlineTagTree node, Void p) {
         try {
             print("{");
@@ -482,6 +510,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitValue(ValueTree node, Void p) {
         try {
             print("{");
@@ -497,6 +526,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitVersion(VersionTree node, Void p) {
         try {
             printTagName(node);
@@ -508,6 +538,7 @@
         return null;
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public Void visitOther(DocTree node, Void p) {
         try {
             print("(UNKNOWN: " + node + ")");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Aug 27 07:44:00 2014 +0200
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Scope.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
@@ -439,6 +440,7 @@
      */
     public abstract void accept(Visitor v);
 
+    @DefinedBy(Api.COMPILER_TREE)
     public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
 
     /** Return a shallow copy of this tree.
@@ -508,23 +510,28 @@
         @Override
         public void accept(Visitor v) { v.visitTopLevel(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.COMPILATION_UNIT; }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public JCPackageDecl getPackage() {
             // PackageDecl must be the first entry if it exists
             if (!defs.isEmpty() && defs.head.hasTag(PACKAGEDEF))
                 return (JCPackageDecl)defs.head;
             return null;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getPackageAnnotations() {
             JCPackageDecl pd = getPackage();
             return pd != null ? pd.getAnnotations() : List.<JCAnnotation>nil();
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public ExpressionTree getPackageName() {
             JCPackageDecl pd = getPackage();
             return pd != null ? pd.getPackageName() : null;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCImport> getImports() {
             ListBuffer<JCImport> imports = new ListBuffer<>();
             for (JCTree tree : defs) {
@@ -535,12 +542,15 @@
             }
             return imports.toList();
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JavaFileObject getSourceFile() {
             return sourcefile;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public Position.LineMap getLineMap() {
             return lineMap;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCTree> getTypeDecls() {
             List<JCTree> typeDefs;
             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
@@ -548,7 +558,7 @@
                     break;
             return typeDefs;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitCompilationUnit(this, d);
         }
@@ -573,16 +583,19 @@
         }
         @Override
         public void accept(Visitor v) { v.visitPackageDef(this); }
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.PACKAGE;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getAnnotations() {
             return annotations;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getPackageName() {
             return pid;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitPackage(this, d);
         }
@@ -606,11 +619,14 @@
         @Override
         public void accept(Visitor v) { v.visitImport(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public boolean isStatic() { return staticImport; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getQualifiedIdentifier() { return qualid; }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.IMPORT; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitImport(this, d);
         }
@@ -728,6 +744,7 @@
         @Override
         public void accept(Visitor v) { v.visitClassDef(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             if ((mods.flags & Flags.ANNOTATION) != 0)
                 return Kind.ANNOTATION_TYPE;
@@ -739,19 +756,25 @@
                 return Kind.CLASS;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public JCModifiers getModifiers() { return mods; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getSimpleName() { return name; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCTypeParameter> getTypeParameters() {
             return typarams;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExtendsClause() { return extending; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getImplementsClause() {
             return implementing;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCTree> getMembers() {
             return defs;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitClass(this, d);
         }
@@ -813,25 +836,35 @@
         @Override
         public void accept(Visitor v) { v.visitMethodDef(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.METHOD; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCModifiers getModifiers() { return mods; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getName() { return name; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getReturnType() { return restype; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCTypeParameter> getTypeParameters() {
             return typarams;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCVariableDecl> getParameters() {
             return params;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCVariableDecl getReceiverParameter() { return recvparam; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getThrows() {
             return thrown;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCBlock getBody() { return body; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getDefaultValue() { // for annotation types
             return defaultValue;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitMethod(this, d);
         }
@@ -887,15 +920,21 @@
         @Override
         public void accept(Visitor v) { v.visitVarDef(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.VARIABLE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCModifiers getModifiers() { return mods; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getName() { return name; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getNameExpression() { return nameexpr; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getType() { return vartype; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getInitializer() {
             return init;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitVariable(this, d);
         }
@@ -915,8 +954,9 @@
         @Override
         public void accept(Visitor v) { v.visitSkip(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.EMPTY_STATEMENT; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitEmptyStatement(this, d);
         }
@@ -944,12 +984,15 @@
         @Override
         public void accept(Visitor v) { v.visitBlock(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.BLOCK; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCStatement> getStatements() {
             return stats;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitBlock(this, d);
         }
@@ -973,10 +1016,13 @@
         @Override
         public void accept(Visitor v) { v.visitDoLoop(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.DO_WHILE_LOOP; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getCondition() { return cond; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getStatement() { return body; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitDoWhileLoop(this, d);
         }
@@ -1000,10 +1046,13 @@
         @Override
         public void accept(Visitor v) { v.visitWhileLoop(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.WHILE_LOOP; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getCondition() { return cond; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getStatement() { return body; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitWhileLoop(this, d);
         }
@@ -1035,16 +1084,21 @@
         @Override
         public void accept(Visitor v) { v.visitForLoop(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.FOR_LOOP; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getCondition() { return cond; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getStatement() { return body; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCStatement> getInitializer() {
             return init;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpressionStatement> getUpdate() {
             return step;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitForLoop(this, d);
         }
@@ -1070,11 +1124,15 @@
         @Override
         public void accept(Visitor v) { v.visitForeachLoop(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCVariableDecl getVariable() { return var; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getStatement() { return body; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitEnhancedForLoop(this, d);
         }
@@ -1096,10 +1154,13 @@
         }
         @Override
         public void accept(Visitor v) { v.visitLabelled(this); }
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.LABELED_STATEMENT; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getLabel() { return label; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getStatement() { return body; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitLabeledStatement(this, d);
         }
@@ -1122,10 +1183,13 @@
         @Override
         public void accept(Visitor v) { v.visitSwitch(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.SWITCH; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return selector; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCCase> getCases() { return cases; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitSwitch(this, d);
         }
@@ -1148,10 +1212,13 @@
         @Override
         public void accept(Visitor v) { v.visitCase(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.CASE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return pat; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCStatement> getStatements() { return stats; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitCase(this, d);
         }
@@ -1174,10 +1241,13 @@
         @Override
         public void accept(Visitor v) { v.visitSynchronized(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.SYNCHRONIZED; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return lock; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCBlock getBlock() { return body; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitSynchronized(this, d);
         }
@@ -1208,17 +1278,21 @@
         @Override
         public void accept(Visitor v) { v.visitTry(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.TRY; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCBlock getBlock() { return body; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCCatch> getCatches() {
             return catchers;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCBlock getFinallyBlock() { return finalizer; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTry(this, d);
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<JCTree> getResources() {
             return resources;
         }
@@ -1241,10 +1315,13 @@
         @Override
         public void accept(Visitor v) { v.visitCatch(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.CATCH; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCVariableDecl getParameter() { return param; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCBlock getBlock() { return body; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitCatch(this, d);
         }
@@ -1272,11 +1349,15 @@
         @Override
         public void accept(Visitor v) { v.visitConditional(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getCondition() { return cond; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getTrueExpression() { return truepart; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getFalseExpression() { return falsepart; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitConditionalExpression(this, d);
         }
@@ -1304,11 +1385,15 @@
         @Override
         public void accept(Visitor v) { v.visitIf(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.IF; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getCondition() { return cond; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getThenStatement() { return thenpart; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCStatement getElseStatement() { return elsepart; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitIf(this, d);
         }
@@ -1331,9 +1416,11 @@
         @Override
         public void accept(Visitor v) { v.visitExec(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitExpressionStatement(this, d);
         }
@@ -1371,9 +1458,11 @@
         @Override
         public void accept(Visitor v) { v.visitBreak(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.BREAK; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getLabel() { return label; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitBreak(this, d);
         }
@@ -1396,9 +1485,11 @@
         @Override
         public void accept(Visitor v) { v.visitContinue(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.CONTINUE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getLabel() { return label; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitContinue(this, d);
         }
@@ -1419,9 +1510,11 @@
         @Override
         public void accept(Visitor v) { v.visitReturn(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.RETURN; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitReturn(this, d);
         }
@@ -1442,9 +1535,11 @@
         @Override
         public void accept(Visitor v) { v.visitThrow(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.THROW; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitThrow(this, d);
         }
@@ -1467,10 +1562,13 @@
         @Override
         public void accept(Visitor v) { v.visitAssert(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ASSERT; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getCondition() { return cond; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getDetail() { return detail; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitAssert(this, d);
         }
@@ -1500,15 +1598,19 @@
         @Override
         public void accept(Visitor v) { v.visitApply(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.METHOD_INVOCATION; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getTypeArguments() {
             return typeargs;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getMethodSelect() { return meth; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getArguments() {
             return args;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitMethodInvocation(this, d);
         }
@@ -1551,19 +1653,25 @@
         @Override
         public void accept(Visitor v) { v.visitNewClass(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.NEW_CLASS; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
             return encl;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getTypeArguments() {
             return typeargs;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getIdentifier() { return clazz; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getArguments() {
             return args;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCClassDecl getClassBody() { return def; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitNewClass(this, d);
         }
@@ -1597,15 +1705,19 @@
         @Override
         public void accept(Visitor v) { v.visitNewArray(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.NEW_ARRAY; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getType() { return elemtype; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getDimensions() {
             return dims;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getInitializers() {
             return elems;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitNewArray(this, d);
         }
@@ -1614,12 +1726,12 @@
             return NEWARRAY;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getAnnotations() {
             return annotations;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<List<JCAnnotation>> getDimAnnotations() {
             return dimAnnotations;
         }
@@ -1659,16 +1771,19 @@
         public void accept(Visitor v) {
             v.visitLambda(this);
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
             return v.visitLambdaExpression(this, d);
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.LAMBDA_EXPRESSION;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getBody() {
             return body;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public java.util.List<? extends VariableTree> getParameters() {
             return params;
         }
@@ -1677,7 +1792,7 @@
             super.setType(type);
             return this;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public BodyKind getBodyKind() {
             return body.hasTag(BLOCK) ?
                     BodyKind.STATEMENT :
@@ -1696,9 +1811,11 @@
         @Override
         public void accept(Visitor v) { v.visitParens(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.PARENTHESIZED; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitParenthesized(this, d);
         }
@@ -1721,10 +1838,13 @@
         @Override
         public void accept(Visitor v) { v.visitAssign(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ASSIGNMENT; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getVariable() { return lhs; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return rhs; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitAssignment(this, d);
         }
@@ -1751,13 +1871,16 @@
         @Override
         public void accept(Visitor v) { v.visitAssignop(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getVariable() { return lhs; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return rhs; }
         public Symbol getOperator() {
             return operator;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitCompoundAssignment(this, d);
         }
@@ -1781,12 +1904,14 @@
         @Override
         public void accept(Visitor v) { v.visitUnary(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return arg; }
         public Symbol getOperator() {
             return operator;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitUnary(this, d);
         }
@@ -1820,13 +1945,16 @@
         @Override
         public void accept(Visitor v) { v.visitBinary(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getLeftOperand() { return lhs; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getRightOperand() { return rhs; }
         public Symbol getOperator() {
             return operator;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitBinary(this, d);
         }
@@ -1849,10 +1977,13 @@
         @Override
         public void accept(Visitor v) { v.visitTypeCast(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.TYPE_CAST; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getType() { return clazz; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTypeCast(this, d);
         }
@@ -1875,10 +2006,13 @@
         @Override
         public void accept(Visitor v) { v.visitTypeTest(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.INSTANCE_OF; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getType() { return clazz; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitInstanceOf(this, d);
         }
@@ -1901,10 +2035,13 @@
         @Override
         public void accept(Visitor v) { v.visitIndexed(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ARRAY_ACCESS; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return indexed; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getIndex() { return index; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitArrayAccess(this, d);
         }
@@ -1932,12 +2069,15 @@
         @Override
         public void accept(Visitor v) { v.visitSelect(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.MEMBER_SELECT; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return selected; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitMemberSelect(this, d);
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getIdentifier() { return name; }
         @Override
         public Tag getTag() {
@@ -2008,17 +2148,18 @@
         @Override
         public void accept(Visitor v) { v.visitReference(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.MEMBER_REFERENCE; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public ReferenceMode getMode() { return mode; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getQualifierExpression() { return expr; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Name getName() { return name; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getTypeArguments() { return typeargs; }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitMemberReference(this, d);
         }
@@ -2046,9 +2187,11 @@
         @Override
         public void accept(Visitor v) { v.visitIdent(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.IDENTIFIER; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getName() { return name; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitIdentifier(this, d);
         }
@@ -2072,10 +2215,12 @@
         @Override
         public void accept(Visitor v) { v.visitLiteral(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return typetag.getKindLiteral();
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Object getValue() {
             switch (typetag) {
                 case BOOLEAN:
@@ -2091,7 +2236,7 @@
                     return value;
             }
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitLiteral(this, d);
         }
@@ -2119,12 +2264,14 @@
         @Override
         public void accept(Visitor v) { v.visitTypeIdent(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public TypeKind getPrimitiveTypeKind() {
             return typetag.getPrimitiveTypeKind();
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitPrimitiveType(this, d);
         }
@@ -2145,9 +2292,11 @@
         @Override
         public void accept(Visitor v) { v.visitTypeArray(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ARRAY_TYPE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getType() { return elemtype; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitArrayType(this, d);
         }
@@ -2170,12 +2319,15 @@
         @Override
         public void accept(Visitor v) { v.visitTypeApply(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getType() { return clazz; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getTypeArguments() {
             return arguments;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitParameterizedType(this, d);
         }
@@ -2198,12 +2350,14 @@
         @Override
         public void accept(Visitor v) { v.visitTypeUnion(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.UNION_TYPE; }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getTypeAlternatives() {
             return alternatives;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitUnionType(this, d);
         }
@@ -2226,12 +2380,14 @@
         @Override
         public void accept(Visitor v) { v.visitTypeIntersection(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.INTERSECTION_TYPE; }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getBounds() {
             return bounds;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitIntersectionType(this, d);
         }
@@ -2259,15 +2415,19 @@
         @Override
         public void accept(Visitor v) { v.visitTypeParameter(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.TYPE_PARAMETER; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Name getName() { return name; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getBounds() {
             return bounds;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getAnnotations() {
             return annotations;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTypeParameter(this, d);
         }
@@ -2288,6 +2448,7 @@
         @Override
         public void accept(Visitor v) { v.visitWildcard(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             switch (kind.kind) {
             case UNBOUND:
@@ -2300,8 +2461,9 @@
                 throw new AssertionError("Unknown wildcard bound " + kind);
             }
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getBound() { return inner; }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitWildcard(this, d);
         }
@@ -2319,10 +2481,11 @@
         @Override
         public void accept(Visitor v) { v.visitTypeBoundKind(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             throw new AssertionError("TypeBoundKind is not part of a public API");
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             throw new AssertionError("TypeBoundKind is not part of a public API");
         }
@@ -2355,13 +2518,16 @@
         @Override
         public void accept(Visitor v) { v.visitAnnotation(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public JCTree getAnnotationType() { return annotationType; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCExpression> getArguments() {
             return args;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitAnnotation(this, d);
         }
@@ -2381,14 +2547,17 @@
         @Override
         public void accept(Visitor v) { v.visitModifiers(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.MODIFIERS; }
+        @DefinedBy(Api.COMPILER_TREE)
         public Set<Modifier> getFlags() {
             return Flags.asModifierSet(flags);
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getAnnotations() {
             return annotations;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitModifiers(this, d);
         }
@@ -2411,14 +2580,17 @@
         @Override
         public void accept(Visitor v) { v.visitAnnotatedType(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ANNOTATED_TYPE; }
+        @DefinedBy(Api.COMPILER_TREE)
         public List<JCAnnotation> getAnnotations() {
             return annotations;
         }
+        @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getUnderlyingType() {
             return underlyingType;
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitAnnotatedType(this, d);
         }
@@ -2437,13 +2609,15 @@
         @Override
         public void accept(Visitor v) { v.visitErroneous(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() { return Kind.ERRONEOUS; }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public List<? extends JCTree> getErrorTrees() {
             return errs;
         }
 
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitErroneous(this, d);
         }
@@ -2464,10 +2638,11 @@
         @Override
         public void accept(Visitor v) { v.visitLetExpr(this); }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             throw new AssertionError("LetExpr is not part of a public API");
         }
-        @Override
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             throw new AssertionError("LetExpr is not part of a public API");
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Wed Aug 27 07:44:00 2014 +0200
@@ -27,6 +27,8 @@
 
 import com.sun.source.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
@@ -71,6 +73,7 @@
         return lb.toList();
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
         JCAnnotatedType t = (JCAnnotatedType) node;
         List<JCAnnotation> annotations = copy(t.annotations, p);
@@ -78,6 +81,7 @@
         return M.at(t.pos).AnnotatedType(annotations, underlyingType);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitAnnotation(AnnotationTree node, P p) {
         JCAnnotation t = (JCAnnotation) node;
         JCTree annotationType = copy(t.annotationType, p);
@@ -93,6 +97,7 @@
         }
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitAssert(AssertTree node, P p) {
         JCAssert t = (JCAssert) node;
         JCExpression cond = copy(t.cond, p);
@@ -100,6 +105,7 @@
         return M.at(t.pos).Assert(cond, detail);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitAssignment(AssignmentTree node, P p) {
         JCAssign t = (JCAssign) node;
         JCExpression lhs = copy(t.lhs, p);
@@ -107,6 +113,7 @@
         return M.at(t.pos).Assign(lhs, rhs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitCompoundAssignment(CompoundAssignmentTree node, P p) {
         JCAssignOp t = (JCAssignOp) node;
         JCTree lhs = copy(t.lhs, p);
@@ -114,6 +121,7 @@
         return M.at(t.pos).Assignop(t.getTag(), lhs, rhs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitBinary(BinaryTree node, P p) {
         JCBinary t = (JCBinary) node;
         JCExpression lhs = copy(t.lhs, p);
@@ -121,17 +129,20 @@
         return M.at(t.pos).Binary(t.getTag(), lhs, rhs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitBlock(BlockTree node, P p) {
         JCBlock t = (JCBlock) node;
         List<JCStatement> stats = copy(t.stats, p);
         return M.at(t.pos).Block(t.flags, stats);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitBreak(BreakTree node, P p) {
         JCBreak t = (JCBreak) node;
         return M.at(t.pos).Break(t.label);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitCase(CaseTree node, P p) {
         JCCase t = (JCCase) node;
         JCExpression pat = copy(t.pat, p);
@@ -139,6 +150,7 @@
         return M.at(t.pos).Case(pat, stats);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitCatch(CatchTree node, P p) {
         JCCatch t = (JCCatch) node;
         JCVariableDecl param = copy(t.param, p);
@@ -146,6 +158,7 @@
         return M.at(t.pos).Catch(param, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitClass(ClassTree node, P p) {
         JCClassDecl t = (JCClassDecl) node;
         JCModifiers mods = copy(t.mods, p);
@@ -156,6 +169,7 @@
         return M.at(t.pos).ClassDef(mods, t.name, typarams, extending, implementing, defs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitConditionalExpression(ConditionalExpressionTree node, P p) {
         JCConditional t = (JCConditional) node;
         JCExpression cond = copy(t.cond, p);
@@ -164,11 +178,13 @@
         return M.at(t.pos).Conditional(cond, truepart, falsepart);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitContinue(ContinueTree node, P p) {
         JCContinue t = (JCContinue) node;
         return M.at(t.pos).Continue(t.label);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitDoWhileLoop(DoWhileLoopTree node, P p) {
         JCDoWhileLoop t = (JCDoWhileLoop) node;
         JCStatement body = copy(t.body, p);
@@ -176,18 +192,21 @@
         return M.at(t.pos).DoLoop(body, cond);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitErroneous(ErroneousTree node, P p) {
         JCErroneous t = (JCErroneous) node;
         List<? extends JCTree> errs = copy(t.errs, p);
         return M.at(t.pos).Erroneous(errs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitExpressionStatement(ExpressionStatementTree node, P p) {
         JCExpressionStatement t = (JCExpressionStatement) node;
         JCExpression expr = copy(t.expr, p);
         return M.at(t.pos).Exec(expr);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitEnhancedForLoop(EnhancedForLoopTree node, P p) {
         JCEnhancedForLoop t = (JCEnhancedForLoop) node;
         JCVariableDecl var = copy(t.var, p);
@@ -196,6 +215,7 @@
         return M.at(t.pos).ForeachLoop(var, expr, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitForLoop(ForLoopTree node, P p) {
         JCForLoop t = (JCForLoop) node;
         List<JCStatement> init = copy(t.init, p);
@@ -205,11 +225,13 @@
         return M.at(t.pos).ForLoop(init, cond, step, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitIdentifier(IdentifierTree node, P p) {
         JCIdent t = (JCIdent) node;
         return M.at(t.pos).Ident(t.name);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitIf(IfTree node, P p) {
         JCIf t = (JCIf) node;
         JCExpression cond = copy(t.cond, p);
@@ -218,12 +240,14 @@
         return M.at(t.pos).If(cond, thenpart, elsepart);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitImport(ImportTree node, P p) {
         JCImport t = (JCImport) node;
         JCTree qualid = copy(t.qualid, p);
         return M.at(t.pos).Import(qualid, t.staticImport);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitArrayAccess(ArrayAccessTree node, P p) {
         JCArrayAccess t = (JCArrayAccess) node;
         JCExpression indexed = copy(t.indexed, p);
@@ -231,17 +255,20 @@
         return M.at(t.pos).Indexed(indexed, index);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitLabeledStatement(LabeledStatementTree node, P p) {
         JCLabeledStatement t = (JCLabeledStatement) node;
         JCStatement body = copy(t.body, p);
         return M.at(t.pos).Labelled(t.label, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitLiteral(LiteralTree node, P p) {
         JCLiteral t = (JCLiteral) node;
         return M.at(t.pos).Literal(t.typetag, t.value);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitMethod(MethodTree node, P p) {
         JCMethodDecl t  = (JCMethodDecl) node;
         JCModifiers mods = copy(t.mods, p);
@@ -255,6 +282,7 @@
         return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, recvparam, params, thrown, body, defaultValue);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
         JCMethodInvocation t = (JCMethodInvocation) node;
         List<JCExpression> typeargs = copy(t.typeargs, p);
@@ -263,12 +291,14 @@
         return M.at(t.pos).Apply(typeargs, meth, args);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitModifiers(ModifiersTree node, P p) {
         JCModifiers t = (JCModifiers) node;
         List<JCAnnotation> annotations = copy(t.annotations, p);
         return M.at(t.pos).Modifiers(t.flags, annotations);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitNewArray(NewArrayTree node, P p) {
         JCNewArray t = (JCNewArray) node;
         JCExpression elemtype = copy(t.elemtype, p);
@@ -277,6 +307,7 @@
         return M.at(t.pos).NewArray(elemtype, dims, elems);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitNewClass(NewClassTree node, P p) {
         JCNewClass t = (JCNewClass) node;
         JCExpression encl = copy(t.encl, p);
@@ -287,6 +318,7 @@
         return M.at(t.pos).NewClass(encl, typeargs, clazz, args, def);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitLambdaExpression(LambdaExpressionTree node, P p) {
         JCLambda t = (JCLambda) node;
         List<JCVariableDecl> params = copy(t.params, p);
@@ -294,24 +326,28 @@
         return M.at(t.pos).Lambda(params, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitParenthesized(ParenthesizedTree node, P p) {
         JCParens t = (JCParens) node;
         JCExpression expr = copy(t.expr, p);
         return M.at(t.pos).Parens(expr);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitReturn(ReturnTree node, P p) {
         JCReturn t = (JCReturn) node;
         JCExpression expr = copy(t.expr, p);
         return M.at(t.pos).Return(expr);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitMemberSelect(MemberSelectTree node, P p) {
         JCFieldAccess t = (JCFieldAccess) node;
         JCExpression selected = copy(t.selected, p);
         return M.at(t.pos).Select(selected, t.name);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitMemberReference(MemberReferenceTree node, P p) {
         JCMemberReference t = (JCMemberReference) node;
         JCExpression expr = copy(t.expr, p);
@@ -319,11 +355,13 @@
         return M.at(t.pos).Reference(t.mode, t.name, expr, typeargs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitEmptyStatement(EmptyStatementTree node, P p) {
         JCSkip t = (JCSkip) node;
         return M.at(t.pos).Skip();
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitSwitch(SwitchTree node, P p) {
         JCSwitch t = (JCSwitch) node;
         JCExpression selector = copy(t.selector, p);
@@ -331,6 +369,7 @@
         return M.at(t.pos).Switch(selector, cases);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitSynchronized(SynchronizedTree node, P p) {
         JCSynchronized t = (JCSynchronized) node;
         JCExpression lock = copy(t.lock, p);
@@ -338,18 +377,21 @@
         return M.at(t.pos).Synchronized(lock, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitThrow(ThrowTree node, P p) {
         JCThrow t = (JCThrow) node;
         JCExpression expr = copy(t.expr, p);
         return M.at(t.pos).Throw(expr);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitCompilationUnit(CompilationUnitTree node, P p) {
         JCCompilationUnit t = (JCCompilationUnit) node;
         List<JCTree> defs = copy(t.defs, p);
         return M.at(t.pos).TopLevel(defs);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitPackage(PackageTree node, P p) {
         JCPackageDecl t = (JCPackageDecl) node;
         List<JCAnnotation> annotations = copy(t.annotations, p);
@@ -357,6 +399,7 @@
         return M.at(t.pos).PackageDecl(annotations, pid);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitTry(TryTree node, P p) {
         JCTry t = (JCTry) node;
         List<JCTree> resources = copy(t.resources, p);
@@ -366,6 +409,7 @@
         return M.at(t.pos).Try(resources, body, catchers, finalizer);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitParameterizedType(ParameterizedTypeTree node, P p) {
         JCTypeApply t = (JCTypeApply) node;
         JCExpression clazz = copy(t.clazz, p);
@@ -373,24 +417,28 @@
         return M.at(t.pos).TypeApply(clazz, arguments);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitUnionType(UnionTypeTree node, P p) {
         JCTypeUnion t = (JCTypeUnion) node;
         List<JCExpression> components = copy(t.alternatives, p);
         return M.at(t.pos).TypeUnion(components);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitIntersectionType(IntersectionTypeTree node, P p) {
         JCTypeIntersection t = (JCTypeIntersection) node;
         List<JCExpression> bounds = copy(t.bounds, p);
         return M.at(t.pos).TypeIntersection(bounds);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitArrayType(ArrayTypeTree node, P p) {
         JCArrayTypeTree t = (JCArrayTypeTree) node;
         JCExpression elemtype = copy(t.elemtype, p);
         return M.at(t.pos).TypeArray(elemtype);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitTypeCast(TypeCastTree node, P p) {
         JCTypeCast t = (JCTypeCast) node;
         JCTree clazz = copy(t.clazz, p);
@@ -398,11 +446,13 @@
         return M.at(t.pos).TypeCast(clazz, expr);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitPrimitiveType(PrimitiveTypeTree node, P p) {
         JCPrimitiveTypeTree t = (JCPrimitiveTypeTree) node;
         return M.at(t.pos).TypeIdent(t.typetag);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitTypeParameter(TypeParameterTree node, P p) {
         JCTypeParameter t = (JCTypeParameter) node;
         List<JCAnnotation> annos = copy(t.annotations, p);
@@ -410,6 +460,7 @@
         return M.at(t.pos).TypeParameter(t.name, bounds, annos);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitInstanceOf(InstanceOfTree node, P p) {
         JCInstanceOf t = (JCInstanceOf) node;
         JCExpression expr = copy(t.expr, p);
@@ -417,12 +468,14 @@
         return M.at(t.pos).TypeTest(expr, clazz);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitUnary(UnaryTree node, P p) {
         JCUnary t = (JCUnary) node;
         JCExpression arg = copy(t.arg, p);
         return M.at(t.pos).Unary(t.getTag(), arg);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitVariable(VariableTree node, P p) {
         JCVariableDecl t = (JCVariableDecl) node;
         JCModifiers mods = copy(t.mods, p);
@@ -436,6 +489,7 @@
         }
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitWhileLoop(WhileLoopTree node, P p) {
         JCWhileLoop t = (JCWhileLoop) node;
         JCStatement body = copy(t.body, p);
@@ -443,6 +497,7 @@
         return M.at(t.pos).WhileLoop(cond, body);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitWildcard(WildcardTree node, P p) {
         JCWildcard t = (JCWildcard) node;
         TypeBoundKind kind = M.at(t.kind.pos).TypeBoundKind(t.kind.kind);
@@ -450,6 +505,7 @@
         return M.at(t.pos).Wildcard(kind, inner);
     }
 
+    @DefinedBy(Api.COMPILER_TREE)
     public JCTree visitOther(Tree node, P p) {
         JCTree tree = (JCTree) node;
         switch (tree.getTag()) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Wed Aug 27 07:44:00 2014 +0200
@@ -58,6 +58,7 @@
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.main.OptionHelper;
 import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
 
 /**
@@ -137,7 +138,7 @@
     }
 
     // <editor-fold defaultstate="collapsed" desc="Option handling">
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean handleOption(String current, Iterator<String> remaining) {
         OptionHelper helper = new GrumpyHelper(log) {
             @Override
@@ -183,7 +184,7 @@
         private static final Set<Option> javacFileManagerOptions =
             Option.getJavacFileManagerOptions();
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public int isSupportedOption(String option) {
         for (Option o : javacFileManagerOptions) {
             if (o.matches(option))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DefinedBy.java	Wed Aug 27 07:44:00 2014 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**Methods that directly implement a method declared in a public, supported API should be marked
+ * with this annotation.
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface DefinedBy {
+
+    /**The API which defines the implemented method.
+     */
+    Api value();
+
+    public enum Api {
+        ANNOTATION_PROCESSING("javax.annotation.processing"),
+        COMPILER("javax.tools"),
+        COMPILER_TREE("com.sun.source"),
+        LANGUAGE_MODEL("javax.lang.model");
+
+        /**The package under which all interfaces/classes of this API belong.
+         */
+        public final String packageRoot;
+
+        private Api(String packageRoot) {
+            this.packageRoot = packageRoot;
+        }
+
+    }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Wed Aug 27 07:44:00 2014 +0200
@@ -36,6 +36,7 @@
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.tree.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
 
@@ -466,6 +467,7 @@
      * Get the name of the source file referred to by this diagnostic.
      * @return the name of the source referred to with this diagnostic, or null if none
      */
+    @DefinedBy(Api.COMPILER)
     public JavaFileObject getSource() {
         if (source == null)
             return null;
@@ -493,14 +495,17 @@
         return (position == null ? Position.NOPOS : position.getEndPosition(source.getEndPosTable()));
     }
 
+    @DefinedBy(Api.COMPILER)
     public long getStartPosition() {
         return getIntStartPosition();
     }
 
+    @DefinedBy(Api.COMPILER)
     public long getPosition() {
         return getIntPosition();
     }
 
+    @DefinedBy(Api.COMPILER)
     public long getEndPosition() {
         return getIntEndPosition();
     }
@@ -513,6 +518,7 @@
      * Get the line number within the source referred to by this diagnostic.
      * @return  the line number within the source referred to by this diagnostic
      */
+    @DefinedBy(Api.COMPILER)
     public long getLineNumber() {
         if (sourcePosition == null) {
             sourcePosition = new SourcePosition();
@@ -524,6 +530,7 @@
      * Get the column number within the line of source referred to by this diagnostic.
      * @return  the column number within the line of source referred to by this diagnostic
      */
+    @DefinedBy(Api.COMPILER)
     public long getColumnNumber() {
         if (sourcePosition == null) {
             sourcePosition = new SourcePosition();
@@ -569,6 +576,7 @@
 
     // Methods for javax.tools.Diagnostic
 
+    @DefinedBy(Api.COMPILER)
     public Diagnostic.Kind getKind() {
         switch (type) {
         case NOTE:
@@ -584,10 +592,12 @@
         }
     }
 
+    @DefinedBy(Api.COMPILER)
     public String getCode() {
         return key;
     }
 
+    @DefinedBy(Api.COMPILER)
     public String getMessage(Locale locale) {
         return defaultFormatter.formatMessage(this, locale);
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Name.java	Wed Aug 27 07:44:00 2014 +0200
@@ -25,6 +25,8 @@
 
 package com.sun.tools.javac.util;
 
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /** An abstraction for internal compiler strings. They are stored in
  *  Utf8 format. Names are stored in a Name.Table, and are unique within
  *  that table.
@@ -45,6 +47,7 @@
     /**
      * {@inheritDoc}
      */
+    @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean contentEquals(CharSequence cs) {
         return toString().equals(cs.toString());
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Position.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Position.java	Wed Aug 27 07:44:00 2014 +0200
@@ -26,6 +26,9 @@
 package com.sun.tools.javac.util;
 
 import java.util.BitSet;
+
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 import static com.sun.tools.javac.util.LayoutCharacters.*;
 
 /** A class that defines source code positions as simple character
@@ -174,6 +177,7 @@
             return startPosition[line - FIRSTLINE];
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public long getStartPosition(long line) {
             return getStartPosition(longToInt(line));
         }
@@ -182,6 +186,7 @@
             return startPosition[line - FIRSTLINE] + column - FIRSTCOLUMN;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public long getPosition(long line, long column) {
             return getPosition(longToInt(line), longToInt(column));
         }
@@ -215,6 +220,7 @@
             return lastLine;  // pos is on this line
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public long getLineNumber(long pos) {
             return getLineNumber(longToInt(pos));
         }
@@ -223,6 +229,7 @@
             return pos - startPosition[getLineNumber(pos) - FIRSTLINE] + FIRSTCOLUMN;
         }
 
+        @DefinedBy(Api.COMPILER_TREE)
         public long getColumnNumber(long pos) {
             return getColumnNumber(longToInt(pos));
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/SharedNameTable.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/SharedNameTable.java	Wed Aug 27 07:44:00 2014 +0200
@@ -27,6 +27,8 @@
 
 import java.lang.ref.SoftReference;
 
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * Implementation of Name.Table that stores all names in a single shared
  * byte array, expanding it as needed. This avoids the overhead incurred
@@ -192,12 +194,14 @@
 
         /** Return the hash value of this name.
          */
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public int hashCode() {
             return index;
         }
 
         /** Is this name equal to other?
          */
+        @DefinedBy(Api.LANGUAGE_MODEL)
         public boolean equals(Object other) {
             if (other instanceof Name)
                 return
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java	Wed Aug 27 07:44:00 2014 +0200
@@ -76,6 +76,8 @@
 
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.main.CommandLine;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
  * Javah generates support files for native methods.
@@ -313,6 +315,7 @@
     private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
         final PrintWriter pw = getPrintWriterForWriter(w);
         return new DiagnosticListener<JavaFileObject> () {
+            @DefinedBy(Api.COMPILER)
             public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
                     pw.print(getMessage("err.prefix"));
@@ -570,38 +573,47 @@
 
     private Diagnostic<JavaFileObject> createDiagnostic(final String key, final Object... args) {
         return new Diagnostic<JavaFileObject>() {
+            @DefinedBy(Api.COMPILER)
             public Kind getKind() {
                 return Diagnostic.Kind.ERROR;
             }
 
+            @DefinedBy(Api.COMPILER)
             public JavaFileObject getSource() {
                 return null;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getPosition() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getStartPosition() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getEndPosition() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getLineNumber() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getColumnNumber() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public String getCode() {
                 return key;
             }
 
+            @DefinedBy(Api.COMPILER)
             public String getMessage(Locale locale) {
                 return JavahTask.this.getMessage(locale, key, args);
             }
@@ -675,19 +687,20 @@
             this.g = g;
         }
 
-        @Override
+        @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
         public SourceVersion getSupportedSourceVersion() {
             // since this is co-bundled with javac, we can assume it supports
             // the latest source version
             return SourceVersion.latest();
         }
 
-        @Override
+        @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
         public void init(ProcessingEnvironment pEnv) {
             super.init(pEnv);
             messager  = processingEnv.getMessager();
         }
 
+        @DefinedBy(Api.ANNOTATION_PROCESSING)
         public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
             try {
                 Set<TypeElement> classes = getAllClasses(ElementFilter.typesIn(roundEnv.getRootElements()));
@@ -739,12 +752,12 @@
 
         private TypeVisitor<Void,Types> checkMethodParametersVisitor =
                 new SimpleTypeVisitor9<Void,Types>() {
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Void visitArray(ArrayType t, Types types) {
                 visit(t.getComponentType(), types);
                 return null;
             }
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Void visitDeclared(DeclaredType t, Types types) {
                 t.asElement().getKind(); // ensure class exists
                 for (TypeMirror st: types.directSupertypes(t))
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTool.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTool.java	Wed Aug 27 07:44:00 2014 +0200
@@ -39,6 +39,9 @@
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /*
  * <p><b>This is NOT part of any supported API.
  * If you write code that depends on this, you do so at your own
@@ -59,6 +62,7 @@
         return JavahTask.getDefaultFileManager(diagnosticListener, null);
     }
 
+    @DefinedBy(Api.COMPILER)
     public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
         JavahTask t = new JavahTask(
                 JavahTask.getPrintWriterForStream(out),
@@ -69,10 +73,12 @@
         return (t.run() ? 0 : 1);
     }
 
+    @DefinedBy(Api.COMPILER)
     public Set<SourceVersion> getSourceVersions() {
         return EnumSet.allOf(SourceVersion.class);
     }
 
+    @DefinedBy(Api.COMPILER)
     public int isSupportedOption(String option) {
         for (JavahTask.Option opt : JavahTask.recognizedOptions) {
             if (opt.matches(option))
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/LLNI.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/LLNI.java	Wed Aug 27 07:44:00 2014 +0200
@@ -47,6 +47,9 @@
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.SimpleTypeVisitor9;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /*
  * <p><b>This is NOT part of any supported API.
  * If you write code that depends on this, you do so at your own
@@ -629,12 +632,15 @@
 
     protected final boolean isLongOrDouble(TypeMirror t) {
         TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor9<Boolean,Void>() {
+            @DefinedBy(Api.LANGUAGE_MODEL)
             public Boolean defaultAction(TypeMirror t, Void p){
                 return false;
             }
+            @DefinedBy(Api.LANGUAGE_MODEL)
             public Boolean visitArray(ArrayType t, Void p) {
                 return visit(t.getComponentType(), p);
             }
+            @DefinedBy(Api.LANGUAGE_MODEL)
             public Boolean visitPrimitive(PrimitiveType t, Void p) {
                 TypeKind tk = t.getKind();
                 return (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/TypeSignature.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/TypeSignature.java	Wed Aug 27 07:44:00 2014 +0200
@@ -40,6 +40,9 @@
 import javax.lang.model.util.Elements;
 import javax.lang.model.util.SimpleTypeVisitor9;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * Returns internal type signature.
  *
@@ -249,29 +252,29 @@
 
     String qualifiedTypeName(TypeMirror type) {
         TypeVisitor<Name, Void> v = new SimpleTypeVisitor9<Name, Void>() {
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Name visitArray(ArrayType t, Void p) {
                 return t.getComponentType().accept(this, p);
             }
 
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Name visitDeclared(DeclaredType t, Void p) {
                 return ((TypeElement) t.asElement()).getQualifiedName();
             }
 
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Name visitPrimitive(PrimitiveType t, Void p) {
                 return elems.getName(t.toString());
             }
 
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Name visitNoType(NoType t, Void p) {
                 if (t.getKind() == TypeKind.VOID)
                     return elems.getName("void");
                 return defaultAction(t, p);
             }
 
-            @Override
+            @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Name visitTypeVariable(TypeVariable t, Void p) {
                 return t.getUpperBound().accept(this, p);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Util.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Util.java	Wed Aug 27 07:44:00 2014 +0200
@@ -36,6 +36,9 @@
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * Messages, verbose and error handling support.
  *
@@ -152,32 +155,41 @@
     private Diagnostic<JavaFileObject> createDiagnostic(
             final Diagnostic.Kind kind, final String code, final Object... args) {
         return new Diagnostic<JavaFileObject>() {
+            @DefinedBy(Api.COMPILER)
             public String getCode() {
                 return code;
             }
+            @DefinedBy(Api.COMPILER)
             public long getColumnNumber() {
                 return Diagnostic.NOPOS;
             }
+            @DefinedBy(Api.COMPILER)
             public long getEndPosition() {
                 return Diagnostic.NOPOS;
             }
+            @DefinedBy(Api.COMPILER)
             public Kind getKind() {
                 return kind;
             }
+            @DefinedBy(Api.COMPILER)
             public long getLineNumber() {
                 return Diagnostic.NOPOS;
             }
+            @DefinedBy(Api.COMPILER)
             public String getMessage(Locale locale) {
                 if (code.length() == 0)
                     return (String) args[0];
                 return getText(code, args); // FIXME locale
             }
+            @DefinedBy(Api.COMPILER)
             public long getPosition() {
                 return Diagnostic.NOPOS;
             }
+            @DefinedBy(Api.COMPILER)
             public JavaFileObject getSource() {
                 return null;
             }
+            @DefinedBy(Api.COMPILER)
             public long getStartPosition() {
                 return Diagnostic.NOPOS;
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java	Wed Aug 27 07:44:00 2014 +0200
@@ -65,6 +65,9 @@
 import java.net.URL;
 import java.net.URLConnection;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  *  "Main" class for javap, normally accessed from the command line
  *  via Main, or from JSR199 via DisassemblerTool.
@@ -380,6 +383,7 @@
     private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
         final PrintWriter pw = getPrintWriterForWriter(w);
         return new DiagnosticListener<JavaFileObject> () {
+            @DefinedBy(Api.COMPILER)
             public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 switch (diagnostic.getKind()) {
                     case ERROR:
@@ -678,54 +682,67 @@
                 final URL url = uri.toURL();
                 final URLConnection conn = url.openConnection();
                 return new JavaFileObject() {
+                    @DefinedBy(Api.COMPILER)
                     public Kind getKind() {
                         return JavaFileObject.Kind.CLASS;
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public boolean isNameCompatible(String simpleName, Kind kind) {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public NestingKind getNestingKind() {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public Modifier getAccessLevel() {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public URI toUri() {
                         return uri;
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public String getName() {
                         return url.toString();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public InputStream openInputStream() throws IOException {
                         return conn.getInputStream();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public OutputStream openOutputStream() throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public Writer openWriter() throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public long getLastModified() {
                         return conn.getLastModified();
                     }
 
+                    @DefinedBy(Api.COMPILER)
                     public boolean delete() {
                         throw new UnsupportedOperationException();
                     }
@@ -913,38 +930,47 @@
     private Diagnostic<JavaFileObject> createDiagnostic(
             final Diagnostic.Kind kind, final String key, final Object... args) {
         return new Diagnostic<JavaFileObject>() {
+            @DefinedBy(Api.COMPILER)
             public Kind getKind() {
                 return kind;
             }
 
+            @DefinedBy(Api.COMPILER)
             public JavaFileObject getSource() {
                 return null;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getPosition() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getStartPosition() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getEndPosition() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getLineNumber() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public long getColumnNumber() {
                 return Diagnostic.NOPOS;
             }
 
+            @DefinedBy(Api.COMPILER)
             public String getCode() {
                 return key;
             }
 
+            @DefinedBy(Api.COMPILER)
             public String getMessage(Locale locale) {
                 return JavapTask.this.getMessage(locale, key, args);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java	Wed Aug 27 07:44:00 2014 +0200
@@ -34,6 +34,9 @@
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.ElementScanner9;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /** Utility class that constructs a textual representation
  * of the public api of a class.
  *
@@ -57,7 +60,7 @@
         return "                                              ".substring(0, l);
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public Void visitType(TypeElement e, Void p) {
         if (e.getModifiers().contains(Modifier.PUBLIC)
             || e.getModifiers().contains(Modifier.PROTECTED))
@@ -71,7 +74,7 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public Void visitVariable(VariableElement e, Void p) {
         if (e.getModifiers().contains(Modifier.PUBLIC)
             || e.getModifiers().contains(Modifier.PROTECTED)) {
@@ -86,7 +89,7 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public Void visitExecutable(ExecutableElement e, Void p) {
         if (e.getModifiers().contains(Modifier.PUBLIC)
             || e.getModifiers().contains(Modifier.PROTECTED)) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java	Wed Aug 27 07:44:00 2014 +0200
@@ -37,6 +37,8 @@
 import javax.tools.JavaFileObject.Kind;
 
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.ListBuffer;
 
 /**
@@ -92,7 +94,7 @@
         return packageArtifacts;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<JavaFileObject> list(Location location,
                                          String packageName,
                                          Set<Kind> kinds,
@@ -116,12 +118,12 @@
         return filteredFiles;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public boolean hasLocation(Location location) {
         return super.hasLocation(location);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForInput(Location location,
                                               String className,
                                               Kind kind) throws IOException {
@@ -136,7 +138,7 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForOutput(Location location,
                                                String className,
                                                Kind kind,
@@ -154,7 +156,7 @@
         return file;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public FileObject getFileForInput(Location location,
                                       String packageName,
                                       String relativeName) throws IOException {
@@ -169,7 +171,7 @@
         return null;
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public FileObject getFileForOutput(Location location,
                                        String packageName,
                                        String relativeName,
@@ -201,12 +203,12 @@
         return sb.toString();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public void flush() throws IOException {
         super.flush();
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public void close() throws IOException {
         super.close();
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java	Wed Aug 27 07:44:00 2014 +0200
@@ -31,6 +31,9 @@
 import javax.lang.model.element.NestingKind;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * The SmartFileObject will return an outputstream that cache the written data
  * and compare the new content with the old content on disk. Only if they differ,
@@ -61,36 +64,44 @@
         return file.hashCode();
     }
 
+    @DefinedBy(Api.COMPILER)
     public Kind getKind() {
         return file.getKind();
     }
 
+    @DefinedBy(Api.COMPILER)
     public boolean isNameCompatible(String simpleName, Kind kind) {
         return file.isNameCompatible(simpleName, kind);
     }
 
+    @DefinedBy(Api.COMPILER)
     public URI toUri() {
         return file.toUri();
     }
 
+    @DefinedBy(Api.COMPILER)
     public String getName() {
         return file.getName();
     }
 
+    @DefinedBy(Api.COMPILER)
     public InputStream openInputStream() throws IOException {
         return file.openInputStream();
     }
 
+    @DefinedBy(Api.COMPILER)
     public OutputStream openOutputStream() throws IOException {
         return file.openOutputStream();
     }
 
+    @DefinedBy(Api.COMPILER)
     public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
         return file.getCharContent(ignoreEncodingErrors);
     }
 
     static String lineseparator = System.getProperty("line.separator");
 
+    @DefinedBy(Api.COMPILER)
     public Writer openWriter() throws IOException {
         StringBuilder s = new StringBuilder();
         try (BufferedReader r = new BufferedReader(file.openReader(true))) {
@@ -103,22 +114,27 @@
         return new SmartWriter(file, s.toString(), file.getName(), stdout);
     }
 
+    @DefinedBy(Api.COMPILER)
     public long getLastModified() {
         return file.getLastModified();
     }
 
+    @DefinedBy(Api.COMPILER)
     public boolean delete() {
         return file.delete();
     }
 
+    @DefinedBy(Api.COMPILER)
     public Modifier getAccessLevel() {
         return file.getAccessLevel();
     }
 
+    @DefinedBy(Api.COMPILER)
     public NestingKind getNestingKind() {
         return file.getNestingKind();
     }
 
+    @DefinedBy(Api.COMPILER)
     public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
         return file.openReader(ignoreEncodingErrors);
     }
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTaskImpl.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTaskImpl.java	Wed Aug 27 07:44:00 2014 +0200
@@ -35,6 +35,9 @@
 import com.sun.tools.javadoc.Start;
 import java.util.Collections;
 
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
 /**
  * Provides access to functionality specific to the JDK documentation tool,
  * javadoc.
@@ -65,12 +68,14 @@
         setLocale(Locale.getDefault());
     }
 
+    @DefinedBy(Api.COMPILER)
     public void setLocale(Locale locale) {
         if (used.get())
             throw new IllegalStateException();
         this.locale = locale;
     }
 
+    @DefinedBy(Api.COMPILER)
     public Boolean call() {
         if (!used.getAndSet(true)) {
             initContext();
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Tue Aug 26 12:45:28 2014 +0100
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Wed Aug 27 07:44:00 2014 +0200
@@ -47,6 +47,8 @@
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javadoc.ToolOption;
 
@@ -60,7 +62,7 @@
  * or deletion without notice.</b></p>
  */
 public class JavadocTool implements DocumentationTool {
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public DocumentationTask getTask(
             Writer out,
             JavaFileManager fileManager,
@@ -121,7 +123,7 @@
     }
 
     // TODO: used shared static method in JavacFileManager
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public StandardJavaFileManager getStandardFileManager(
             DiagnosticListener<? super JavaFileObject> diagnosticListener,
             Locale locale,
@@ -137,7 +139,7 @@
         return new JavacFileManager(context, true, charset);
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
         PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
         PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
@@ -152,13 +154,13 @@
         }
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public Set<SourceVersion> getSourceVersions() {
         return Collections.unmodifiableSet(
                 EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()));
     }
 
-    @Override
+    @Override @DefinedBy(Api.COMPILER)
     public int isSupportedOption(String option) {
         if (option == null)
             throw new NullPointerException();