Java Source API Adding TreeUtilities.parseType(String, Scope) method overload Adding TreeUtilities.parseType(String, Scope) method overload to support more exact type parsing. API Support for module imports Adding TreeMaker.ImportModule and ElementUtilities.transitivelyExportedPackages to support module imports. Adding TreeMaker.Class overload that takes permitted subclasses Adding TreeMaker.Class overload that allows to specify the permitted subclasses. SourceUtils.classNameFor nested classes support SourceUtils.classNameFor support for nested classes. Adding SourceUtils.classNameFor Adding SourceUtils.classNameFor. Adding TreeMaker.RawText Adding TreeMaker.RawText. Adding TreeMaker.RecordComponent Adding TreeMaker.RecordComponent and ElementUtilities.getLinkedRecordElements. Adding TreeMaker.StringTemplate Adding TreeMaker.StringTemplate Source file name for Element It is possible to hint SourceUtils.getFile list of file names to searh for. There is also SourceUtils.findSourceFileName to obtain name of file for an Element. Adding TreeUtilities.isExpressionStatement(ExpressionTree) Adding TreeUtilities.isExpressionStatement(ExpressionTree). Adding SourceUtils.isClassFile(FileObject) Adding SourceUtils.isClassFile(FileObject). Adding SourceUtils.forceSource(CompilationController, FileObject) Adding SourceUtils.forceSource(CompilationController, FileObject). CodeStyle.parensAroundSingularLambdaParam() added Method CodeStyle.parensAroundSingularLambdaParam() has been added. Creates a new SwitchExpressionTree Creates a new SwitchExpressionTree. Adding Matcher.setKeepSyntheticTrees method Added Matcher.setKeepSyntheticTrees method, that allows to keep synthetically generated variables mapping in the outgoing variables. Adding case-related overload to TreeMaker Added TreeMaker.CaseMultipleLabels(List<? extends ExpressionTree> patterns, List<? extends StatementTree> statements) and TreeMaker.Case(List<? extends ExpressionTree> patterns, Tree body) overloads. Check the var type variable in given tree path. Added BuildArtifactMapper.isCompileOnSaveSupported method, which checks if compile on save is suported in the current configuration. Check the tree has compile error in given collection of errors. Check the tree has compile error in given collection of errors. Check the var type variable in given tree path. Check the var type variable in given tree path. Check the tree is the end of compound declaration. Check the tree end with comma. Check the tree is the end of compound declaration. Check whether tree is part of compound declaration. Added a method to create an ElementHandle for module Added a method to create a module ElementHandle from a module name. Added methods to generate/modify the module-info.java files Added methods to generate/modify the module-info.java files Added an information about changes in the module-info Added an information about changes in the module-info. Provide type suitable for declaration in source Support method which allows to infer a type suitable for use in symbol declaration in the source was added. List elements with their definining Scope Allows to enumerate Elements matching passed ElementFilter according to hiding and inheritance rules. The method may be useful to list elements matching certain criteria, or to check whether an element exists and find what class/method defined it. Allow to return also unimplemented default methods

findUnimplementedMethods and findOverridableMethods work better with interface default methods: they are treated as implemented, but overridable.

Allow ElementUtilities.findUnimplementedMethods enumerate also default methods whose implementations are not provided by class or superclasses.

Code Generator uses caret location to insert members Added an overloaded method to Code Generator should to include the caret location when inserting members. This will be used when the codestyle is CodeStyle.InsertionPoint.CARET_LOCATION. ClassIndex SearchKind extended by FUNCTIONAL_IMPLEMENTORS Added a possibility to ClassIndex to search a lambda implementations. ClassIndex returns resources from binaryroots ClassIndex holds information from different types of roots. Added a parameter to ClassIndex#getResources to specify which roots to use for its results. Code Generator uses dependencies between fields Proper textual order of members should be used when inserting a field or class/interface initializer. The analysis could be optionally turned off. Remove dependency on Openide Text API

OpenIDE Text API dependencies are removed, affecting ModificationResult.Difference API class, whose interface changed incompatibly. The class now returns java.swing.text.Position instead of org.openide.text.PositionRef for the start and end positions.

For binary compatibility, an additional module java.source.compat8 was created, which provides compatible method that still returns PositionRef

Desktop independent parts of the Java Source module extracted

Runtime compatibility remains, compile time compatibility is mostly preserved too. It is however recommended to upgrade dependencies of client modules. Try running ant fix-dependencies in your Ant module.

Find the target of Break or Continue statement

Find the target of break or continue statement. Target is of type Tree here.

Added new method for getting Tree using VariableTree type

Regarding the JEP 394 (finalization of pattern matching for instanceof in JDK 16). The shape of the BindingPatternTree has changed; the BindingPatternTree does not have a name and type, but rather a VariableTree.

Change History for the Base Java Source API

Introduction

What do the Dates Mean?

The supplied dates indicate when the API change was made, on the CVS trunk. From this you can generally tell whether the change should be present in a given build or not; for trunk builds, simply whether it was made before or after the change; for builds on a stabilization branch, whether the branch was made before or after the given date. In some cases corresponding API changes have been made both in the trunk and in an in-progress stabilization branch, if they were needed for a bug fix; this ought to be marked in this list.



@FOOTER@