jdk-24/langtools/make/test/crules/DefinedByAnalyzer/Test.java
Jan Lahoda c9406c88c4 8056061: Mark implementations of public interfaces with an annotation
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.

Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Reviewed-by: jjg, mcimadamore, jfranck
2014-08-27 07:44:00 +02:00

33 lines
1003 B
Java

/**@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) {
}
}