Introduction

This document lists changes made to the Java Source API.


Index of APIs

Incompatible changes by date

Fuller descriptions of all changes can be found below (follow links).

Not all deprecations are listed here, assuming that the deprecated APIs continue to essentially work. For a full deprecation list, please consult the Javadoc.

All changes by date

Changes by version

These API specification versions may be used to indicate that a module requires a certain API feature in order to function. For example, if you see here a feature you need which is labelled 1.20, your manifest should contain in its main attributes the line:

OpenIDE-Module-Module-Dependencies: org.netbeans.modules.java.source > 1.20

Changes by affected class

org.netbeans.api.java.source.BuildArtifactMapper

org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory

org.netbeans.api.java.source.ClassIndex

org.netbeans.api.java.source.ClasspathInfo

org.netbeans.api.java.source.CodeStyle

org.netbeans.api.java.source.Comment

org.netbeans.api.java.source.CompilationController

org.netbeans.api.java.source.CompilationInfo

org.netbeans.api.java.source.support.EditorAwareJavaSourceTaskFactory

org.netbeans.api.java.source.ElementHandle

org.netbeans.api.java.source.GeneratorUtilities

org.netbeans.api.java.source.JavaParserResultTask

org.netbeans.api.java.source.JavaSource

org.netbeans.api.java.source.JavaSourceTaskFactory

org.netbeans.api.java.source.support.LookupBasedJavaSourceTaskFactory

org.netbeans.api.java.source.ModificationResult

org.netbeans.api.java.source.ScanUtils

org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory

org.netbeans.api.java.source.SourceUtils

org.netbeans.api.java.source.TreeMaker

org.netbeans.api.java.source.TreePathHandle

org.netbeans.api.java.source.TreeUtilities

org.netbeans.api.java.source.TypeUtilities

org.netbeans.api.java.source.WorkingCopy


Details of all changes by API and date


Java Source API

Added WorkingCopy.resolveRewriteTarget.

Apr 11 '12; API spec. version: 0.102; affected top-level classes: WorkingCopy; made by: jlahoda; issues: #209375
Added a method resolveRewriteTarget to class WorkingCopy, that returns the tree into which the given tree has been rewritten.

Added GeneratorUtilities.createFromTemplate.

Apr 5 '12; API spec. version: 0.100; affected top-level classes: GeneratorUtilities; made by: ralphbenjamin; issues: #209798
Added the method createFromTemplate to class GeneratorUtilities, which will create a new CompilationUnitTree from a template.

Added GeneratorUtilities.appendToAnnotationValue.

Mar 13 '12; API spec. version: 0.99; affected top-level classes: GeneratorUtilities; made by: jlahoda; issues: #208570
Added two overloaded methods appendToAnnotationValue to class GeneratorUtilites, which augment ModifiersTree or CompilationUnitTree with annotation with the given attribute values.

Added factory methods to create an ElementHandle for type and package.

Mar 13 '12; API spec. version: 0.98; affected top-level classes: ElementHandle; made by: tzezula; issues: #209082
Added a factory methods to create an ElementHandle for type and package from binary name.

Added ReferencesCount support class which provides frequences of type usage in a source root.

Mar 13 '12; API spec. version: 0.97; made by: tzezula; issues: #209038
Added ReferencesCount support class which provides information how many classes on the source path (source root) are using given type or package.

Added several methods to CodeStyle supporting customization of the generated class members order and other minor formatting enhancements.

Feb 21 '12; API spec. version: 0.96; made by: dbalek; issues: #208503
Added CodeStyle.getClassMemberGroups, CodeStyle.getClassMemberInsertionPoint, to support customization of the generated class members order, and CodeStyle.wrapAfterDotInChainedMethodCalls, CodeStyle.getBlankLinesAfterAnonymousClassHeader, CodeStyle.spaceAroundAnnotationValueAssignOps to support minor formatting enhancements.

Added SourceUtils.waitUserActionTask.

Jan 26 '12; API spec. version: 0.95; affected top-level classes: ScanUtils; made by: sdedic; issues: #207704
Added class ScanUtils, which help to check completness of parsing data and allow to restart processing after project scan finishes to see most complete data. Elements can be checked using new methods checkElement, resolveElement, findElement and findTypeElement that throws an exception indicating the user task should be aborted and restarted later. See javadoc for more info.

Added TaskIndexingMode into JavaSourceTaskFactorys

Jan 26 '12; API spec. version: 0.94; affected top-level classes: JavaParserResultTask JavaSourceTaskFactory SelectionAwareJavaSourceTaskFactory LookupBasedJavaSourceTaskFactory EditorAwareJavaSourceTaskFactory CaretAwareJavaSourceTaskFactory; made by: tzezula; issues: #207459
The CancellableTasks created by the JavaSourceTaskFactorys are not executed during the scan to keep the semantic backward compatibility. Constructors with the TaskIndexingMode were added into these factories to allow tasks to run during the scan.

Added TreePathHandle.getElementHandle.

Nov 30 '11; API spec. version: 0.93; made by: jbecicka; issues: #205719
Added TreePathHandle.getElementHandle that returns corresponding ElementHandle for given TreePathHandle.

Added TreeUtilities.isCompileTimeConstantExpression.

Nov 7 '11; API spec. version: 0.91; made by: jlahoda; issues: #204435
Added TreeUtilities.isCompileTimeConstantExpression that tests whether the given expression is a compile-time constant.

Added CompilationInfo.getCachedValue, CompilationInfo.putCachedValue and CompilationInfo.CacheClearPolicy.

Oct 26 '11; API spec. version: 0.90; made by: jlahoda; issues: #203890
Added CompilationInfo.getCachedValue and CompilationInfo.putCachedValue methods and CompilationInfo.CacheClearPolicy enum so that tasks can easily store temporary data with predictable termination.

Added ClassIndex.getResourcesForPackage and ClassIndex.getElementsForPackageto allow to find package usages.

Oct 20 '11; API spec. version: 0.89; made by: tzezula; issues: #131944
Added ClassIndex.getResourcesForPackage and ClassIndex.getElementsForPackageto allow to find package usages. Currently the client which needs to find usages of all types declared in the package has to list the package and query usages of each type individually which is inefficient.

Added GeneratorUtilities.addImports and several methods to CodeStyle to support organizing imports.

Aug 29 '11; API spec. version: 0.86; made by: dbalek; issues: #201254
Added GeneratorUtilities.addImports method to add import statements for given elements to a compilation unit in a way that complies with the rules specified in CodeStyle. Added CodeStyle.importInnerClasses, CodeStyle.getImportGroups, and CodeStyle.separateImportGroups to specify the rules.

Added SourceUtils.computeDuplicates to get code duplicates of provided expression

Aug 26 '11; API spec. version: 0.85; affected top-level classes: SourceUtils; made by: jbecicka; issues: #199106
Added a method SourceUtils.computeDuplicates to get code duplicates of provided expression.

Added SourceUtils.getJVMSignature to obtain the JVM signature for an ElementHandle

Aug 1 '11; API spec. version: 0.84; affected top-level classes: SourceUtils; made by: tzezula; issues: #200237
Added a method SourceUtils.getJVMSignature to obtain the JVM signature for an ElementHandle.

Added several methods to CodeStyle to support reformatting of comments.

Jul 13 '11; API spec. version: 0.83; made by: dbalek; issues: #20672
Added CodeStyle.enableBlockCommentFormatting, CodeStyle.enableJavadocFormatting, CodeStyle.wrapCommentText, CodeStyle.wrapOneLineComments, CodeStyle.preserveNewLinesInCommentst, CodeStyle.blankLineAfterJavadocDescription, CodeStyle.blankLineAfterJavadocParameterDescriptions, CodeStyle.blankLineAfterJavadocReturnTag, CodeStyle.generateParagraphTagOnBlankLines, CodeStyle.alignJavadocParameterDescriptions, CodeStyle.alignJavadocReturnDescriptions, CodeStyle.alignJavadocExceptionDescriptions, to support reformatting of comments.

Added package search scope into ClassIndex to restrict search in given packages

Jun 22 '11; API spec. version: 0.82; affected top-level classes: ClassIndex; made by: tzezula; issues: #197194
Added package search scope into ClassIndex to restrict search in given packages.

Find span of the MethodTree#getParameters() parameter list in the source.

Jun 1 '11; API spec. version: 0.81; affected top-level classes: TreeUtilities; made by: ralphbenjamin; issues: #199080
TreeUtilities has a new findMethodParameterSpan(MethodTree method) method.

TreePathHandle can be created from ElementHandle

Apr 26 '11; API spec. version: 0.79; affected top-level classes: TreePathHandle; made by: jlahoda; issues: #197848
TreePathHandle has a new from(ElementHandle) method.

JavaSource.runModificationTask can run on source-less JavaSources

Jan 21 '11; API spec. version: 0.74; affected top-level classes: JavaSource; made by: jlahoda; issues: #119887
JavaSource.runModificationTask method works on source-less JavaSources.

Added a method for checking the existence of the main method using index only

Dec 10 '10; API spec. version: 0.71; affected top-level classes: SourceUtils; made by: tzezula; issues: #191648
Added a new version of the isMain method into org.netbeans.api.java.source.SourceUtils which allows check based only on index information.

DisjointTypeTree renamed to DisjunctiveTypeTree, AnnotationTypeTree has been removed

Nov 12 '10; API spec. version: 0.70; affected top-level classes: TreeMaker; made by: jlahoda
com.sun.source.tree.DisjointTypeTree renamed to com.sun.source.tree.DisjunctiveTypeTree from javac, so adjusting TreeMaker to it. com.sun.source.tree.AnnotationTypeTree has been removed from javac and is no longer available.

Added several methods to support new API for modeling JDK7 features.

Oct 12 '10; API spec. version: 0.67; made by: jlahoda; issues: #190767
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.

Sep 27 '10; API spec. version: 0.66; affected top-level classes: TreeMaker; made by: jlahoda; issues: #157760
Added TreeMaker.CompilationUnit(List<AnnotationTree>, ...), TreeMaker.addPackageAnnotation, TreeMaker.insertPackageAnnotation, TreeMaker.removePackageAnnotation to allow modification of the list of package annotations.

Added TreeMaker.QualIdent(String) and TreeMaker.Type(String) method.

Sep 16 '10; API spec. version: 0.65; affected top-level classes: TreeMaker; made by: jlahoda; issues: #190123
Added TreeMaker.QualIdent(String) and TreeMaker.Type(String) method, which allow to construct QualIdents and Types from String specification.

Added TreeUtilities.translate method.

Sep 8 '10; API spec. version: 0.64; affected top-level classes: TreeUtilities; made by: jlahoda; issues: #190019
Added TreeUtilities.translate method, which allows to construct new tree based on a given set of changes.

Added TypeUtilities.getTypeName method.

Jul 13 '10; API spec. version: 0.62; affected top-level classes: TypeUtilities; made by: jlahoda; issues: #104194
Added TypeUtilities.getTypeName method, which allows to print type to string.

Added SourceUtils.getAttributeValueCompletions method.

Mar 2 '10; API spec. version: 0.57; affected top-level classes: SourceUtils; made by: dbalek; issues: #111292
Added SourceUtils.getAttributeValueCompletions method, which returns a list of completions for an annotation attribute value suggested by annotation processors.

Added support for encoding/decoding exotic identifiers to TreeUtilities.

Feb 24 '10; API spec. version: 0.56; affected top-level classes: TreeUtilities; made by: jlahoda; issues: #180842
Added support for encoding/decoding exotic identifiers to TreeUtilities.

Added GeneratorUtilities.copyComments method.

Oct 27 '09; API spec. version: 0.51; affected top-level classes: GeneratorUtilities; made by: jlahoda; issues: #175020
Added GeneratorUtilities.copyComments method, which copies comments from one tree to another tree.

Added TreeUtilities.isEnumConstant() method.

Aug 14 '09; API spec. version: 0.48; affected top-level classes: TreeUtilities; made by: msauer; issues: #170373
Added TreeUtilities.isEnumConstant() method, which determines whether tree represents an enum constant.

Added CompilationInfo.getSourceVersion() method.

Aug 12 '09; API spec. version: 0.47; affected top-level classes: CompilationInfo; made by: dbalek; issues: #169970
Added CompilationInfo.getSourceVersion() to return the SourceVersion used by the javac compiler.

Removing the binary compatibility methods (using bytecode patching) from JavaSource

Aug 6 '09; API spec. version: 0.46; affected top-level classes: JavaSource; made by: tzezula; issues: #169974
The JavaSource class contains methods introduced to keep binary compatibility among milestones of NB 6.0. These methods are not needed anymore and will be removed.

Added new Method allowing creating varargs methods.

May 7 '09; API spec. version: 0.44; affected top-level classes: TreeMaker; made by: moonko
Adding TreeMake.Method(..., boolean isVarArg) to allow creation of methods with variable lenght of arguments.

Changed Comment API

Mar 31 '09; API spec. version: 0.43; affected top-level classes: Comment; made by: moonko
Adding Comment.create(Comment.Style, String) to create new comment of any style from string.

Migrated to the parsing.api

Nov 24 '08; API spec. version: 0.42; affected top-level classes: JavaParserResultTask ClasspathInfo CompilationInfo CompilationController ModificationResult WorkingCopy; made by: tzezula
The java source module migrated to use the common parsing api.

Better ways of getting CodeStyle instance

Aug 13 '08; API spec. version: 0.39; affected top-level classes: CodeStyle; made by: vstejskal
Added CodeStyle.getDefault(FileObject), CodeStyle.getDefault(Document). Deprecated CodeStyle.getDefault(Project).

Added BuildArtifactMapper

Jul 7 '08; API spec. version: 0.38; affected top-level classes: BuildArtifactMapper; made by: jlahoda
Added BuildArtifactMapper.

Added ModificationResult.getSpan and WorkingCopy.tag

Jun 25 '08; API spec. version: 0.37; made by: msauer
Added Methods allowing tagging of trees and getting their span inside modified document.

Added TypeUtilities.substitute

May 6 '08; API spec. version: 0.36; affected top-level classes: TypeUtilities; made by: jlahoda
Added TypeUtilities.substitute.

Added GeneratorUtilities.createMethod

Mar 25 '08; API spec. version: 0.34; made by: jlahoda; issues: #130240
Added method to create a new method tree for given method element.

Added ModificationResult.Difference.setCommitToGuards(boolean) and isCommitToGuards() methods permitting to write modifications even to guarded sections

Mar 15 '08; API spec. version: 0.33; made by: jpokorsky
Added methods to allow ModificationResult to write changes into guarded sections of a document in case the API client is aware of what he does.

Added CompilationInfo.getChangedTree method returning the reparsed subtree

Jan 25 '08; API spec. version: 0.31; made by: tzezula
Added method to return the reparsed subtree of the CompilationUnit tree, the result of this method should be used as a hint for the registered tasks to update model only for the changed subtree rather than for the whole CompilationUnit tree.

Added CancellableTreePathScanner(AtomicBoolean) and CancellableTreeScanner(AtomicBoolean)

Dec 21 '07; API spec. version: 0.30; made by: jlahoda; issues: #123762
Added constructors taking AtomicBoolean to the CancellableTreePathScanner and CancellableTreeScanner.

Added a method to obtain ElementHandles from TypeMirrorHandles representing DeclaredTypes

Dec 14 '07; API spec. version: 0.29; made by: dbalek; issues: #123971
Added a method to obtain ElementHandles from TypeMirrorHandles representing DeclaredTypes.

Added ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE

Nov 26 '07; API spec. version: 0.28; made by: tzezula; issues: #122864
Added ClassIndex.NameKind.CAMEL_CASE_INSENSITIVE used by code completion for getting camel case names.

Support for JSPs and dialogs

Jun 15 '07; API spec. version: 0.21; made by: jlahoda; issues: #106629
Adding ability to use Java infrastructure for non-Java file (eg. JSP files) and inside dialogs.

Adding GeneratorUtilities

Jun 15 '07; API spec. version: 0.20; made by: jlahoda; issues: #106678
A utility class, org.netbeans.api.java.source.GeneratorUtilities has been added.

Removal of obsolete, duplicated and deprecated methods from java/source

Jun 15 '07; API spec. version: 0.19; made by: jlahoda; issues: #106719
Removal of a few obsolete, duplicated and deprecated methods from java/source.

CancellableTask split into Task and CancellableTask.

Jun 15 '07; API spec. version: 0.18; made by: tzezula
The JavaSource.runModificationTask(), runWhenScanFinished() and runUserActionTask() never call the cancel method of the CancellableTask, the implementor of such a CancellableTask just writes an empty cancel method. The compatible API change splits the CancellableTask into Task with run method and CancellableTask which extends the Task by cancel method. The JavaSource methods mentioned above take Task rather than CancellableTask. The CancellableTask is used only for tasks registered by factories.

ClassIndex methods are cancellable

Jun 13 '07; API spec. version: 0.16; made by: tzezula
The ClassIndex methods called from the CancellableTask are cancellable. In case when they are cancelled by the JavaSource infrastructure they return null instead of the Set to allow client to determine this state. The incompatible semantic change is that tasks registered by factories have to check if the value returned from class index is null.

Added a method to obtain top level elements defined in the source/class file.

Jun 5 '07; API spec. version: 0.14; made by: tzezula; issues: #93100
Added a method to obtain top level elements defined in the given source or class file.

Added factory method which returns a new TreePathHandle for given Element and CompilationInfo.

Apr 24 '07; API spec. version: 0.13; made by: jbecicka; issues: #102333
There is no simple way how to weakly reference all elements from javac. For instance local variables cannot be referenced by ElementHandles while source-less Elements cannot be referenced by TreePathHandles. This fix allows to create TreePathHandles for any javac Element (both local and source less).

Added a method to run a CancellableTask when the backgound scan is finished.

Apr 19 '07; API spec. version: 0.12; made by: tzezula; issues: #91117 #99923
The JavaSource.runWhenScanFinished performs the given task either synchronously when no background scan is running. When the background scan is running the task is performed asynchronously when the scan completes.

Added a method which returns all the project source roots depending on a given source root.

Apr 13 '07; API spec. version: 0.10; made by: tzezula; issues: #92030
The refactoring and find usages need to find the dependent roots of a project root in which the refactored type is declared, but finding such an information using the project API may be very expensive especially when lots of projects is opened. The goal of this API is to provide and cache this information.

Added a listener for listening on changes in the ClassIndex.

Apr 4 '07; API spec. version: 0.8; made by: tzezula; issues: #91763
The listener for listening on changes in the ClassIndex was added. The listener fires events when a declared type was removed, added, changed in the ClassIndex oe when the underlaying ClassPath was changed.

Adding template attribute package

Mar 26 '07; API spec. version: 0.7; made by: jpokorsky; issues: #95399
Added the template attribute package for templates using scripting language.

Removing CommentUtilities, adjusting TreeMaker and introducing TypeUtilities

Mar 18 '07; API spec. version: 0.6; affected top-level classes: TypeUtilities; made by: jlahoda; issues: #97542

Compatibility:

Built on October 10 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.