# HG changeset patch # Parent bbf3fb4bf306089e420477f2e68c34beb8051e46 diff --git a/java.source/apichanges.xml b/java.source/apichanges.xml --- a/java.source/apichanges.xml +++ b/java.source/apichanges.xml @@ -108,6 +108,21 @@ + + + Added several methods to support new API for modeling JDK7 features. + + + + + + Added CodeStyle.alignMultilineTryResources, CodeStyle.spaceBeforeTryParen, + CodeStyle.spaceWithinTryParens, CodeStyle.wrapTryResources + TreeMaker.DisjointType, CodeStyle.Try and TreeUtilities.CLASS_TREE_KINDS + to support new language features in JDK7. + + + Added TreeMaker.CompilationUnit(List<AnnotationTree>, ...), TreeMaker.addPackageAnnotation, TreeMaker.insertPackageAnnotation, TreeMaker.removePackageAnnotation methods. diff --git a/java.source/nbproject/project.properties b/java.source/nbproject/project.properties --- a/java.source/nbproject/project.properties +++ b/java.source/nbproject/project.properties @@ -46,7 +46,7 @@ javadoc.title=Java Source javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=0.66.0 +spec.version.base=0.67.0 test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\ ${o.n.core.dir}/lib/boot.jar:\ diff --git a/java.source/src/org/netbeans/api/java/source/CodeStyle.java b/java.source/src/org/netbeans/api/java/source/CodeStyle.java --- a/java.source/src/org/netbeans/api/java/source/CodeStyle.java +++ b/java.source/src/org/netbeans/api/java/source/CodeStyle.java @@ -317,6 +317,9 @@ return preferences.getBoolean(alignMultilineAssignment, getDefaultAsBoolean(alignMultilineAssignment)); } + /** + * @since 0.67 + */ public boolean alignMultilineTryResources() { return preferences.getBoolean(alignMultilineTryResources, getDefaultAsBoolean(alignMultilineTryResources)); } @@ -396,6 +399,9 @@ return WrapStyle.valueOf(wrap); } + /** + * @since 0.67 + */ public WrapStyle wrapTryResources() { String wrap = preferences.get(wrapTryResources, getDefaultAsString(wrapTryResources)); return WrapStyle.valueOf(wrap); @@ -548,6 +554,9 @@ return preferences.getBoolean(spaceBeforeWhileParen, getDefaultAsBoolean(spaceBeforeWhileParen)); } + /** + * @since 0.67 + */ public boolean spaceBeforeTryParen() { return preferences.getBoolean(spaceBeforeTryParen, getDefaultAsBoolean(spaceBeforeTryParen)); } @@ -668,6 +677,9 @@ return preferences.getBoolean(spaceWithinSwitchParens, getDefaultAsBoolean(spaceWithinSwitchParens)); } + /** + * @since 0.67 + */ public boolean spaceWithinTryParens() { return preferences.getBoolean(spaceWithinTryParens, getDefaultAsBoolean(spaceWithinTryParens)); } diff --git a/java.source/src/org/netbeans/api/java/source/TreeMaker.java b/java.source/src/org/netbeans/api/java/source/TreeMaker.java --- a/java.source/src/org/netbeans/api/java/source/TreeMaker.java +++ b/java.source/src/org/netbeans/api/java/source/TreeMaker.java @@ -459,6 +459,13 @@ return delegate.Continue(label); } + /** + * Creates new DisjointTypeTree. + * + * @param typeComponents components from which the DisjointTypeTree should be created + * @return newly created DisjointTypeTree + * @since 0.67 + */ public DisjointTypeTree DisjointType(List typeComponents) { return delegate.DisjointType(typeComponents); } @@ -917,6 +924,16 @@ return Try(Collections.emptyList(), tryBlock, catches, finallyBlock); } + /** + * Creates a new TryTree. + * + * @param resource the resources of the try clause. + * @param tryBlock the statement block in the try clause. + * @param catches the list of catch clauses, or an empty list. + * @param finallyBlock the finally clause, or null. + * @see com.sun.source.tree.TryTree + * @since 0.67 + */ public TryTree Try(List resources, BlockTree tryBlock, List catches, diff --git a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java b/java.source/src/org/netbeans/api/java/source/TreeUtilities.java --- a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java +++ b/java.source/src/org/netbeans/api/java/source/TreeUtilities.java @@ -84,6 +84,12 @@ */ public final class TreeUtilities { + /**{@link Kind}s that are represented by {@link ClassTree}. + * + * @since 0.67 + */ + public static final Set CLASS_TREE_KINDS = EnumSet.of(Kind.ANNOTATION_TYPE, Kind.CLASS, Kind.ENUM, Kind.INTERFACE); + private final CompilationInfo info; private final CommentHandlerService handler; @@ -95,20 +101,26 @@ } /**Checks whether the given tree represents a class. + * @deprecated since 0.67, Tree.getKind() == Kind.CLASS should be used instead. */ + @Deprecated public boolean isClass(ClassTree tree) { return (((JCTree.JCModifiers)tree.getModifiers()).flags & (Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) == 0; } /**Checks whether the given tree represents an interface. + * @deprecated since 0.67, Tree.getKind() == Kind.INTERFACE should be used instead. */ + @Deprecated public boolean isInterface(ClassTree tree) { final long flags = ((JCTree.JCModifiers) tree.getModifiers()).flags; return (flags & Flags.INTERFACE) != 0 && (flags & Flags.ANNOTATION) == 0; } /**Checks whether the given tree represents an enum. + * @deprecated since 0.67, Tree.getKind() == Kind.ENUM should be used instead. */ + @Deprecated public boolean isEnum(ClassTree tree) { return (((JCTree.JCModifiers)tree.getModifiers()).flags & Flags.ENUM) != 0; } @@ -121,7 +133,9 @@ } /**Checks whether the given tree represents an annotation. + * @deprecated since 0.67, Tree.getKind() == Kind.ANNOTATION_TYPE should be used instead. */ + @Deprecated public boolean isAnnotation(ClassTree tree) { return (((JCTree.JCModifiers)tree.getModifiers()).flags & Flags.ANNOTATION) != 0; }