This document lists changes made to the Java Support APIs. Please ask on the
dev@java.netbeans.org
or nbdev@netbeans.org
mailing list if you have any questions about the details of a
change, or are wondering how to convert existing code to be compatible.
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.
SourceLevelQuery
supports JDK 8 profiles
ClassPath
API changed to be pluggable and better support build system
SourceJavadocAttacherImplementation.Definer
to reject a binary root.
JavaClassPathConstants
AccessibilityQueryImplementation2
to allow to listen on package accessibility changes
CompilerOptionsQuery
for additional compiler options
MINIMAL_SOURCE_LEVEL
into SourceLevelQuery
SourceLevelQuery
supports JDK 8 profiles
SourceLevelQuery
supports JDK 8 profiles
SourceLevelQuery
supports source level synonyms
ClassPath
API changed to be pluggable and better support build system
GlobalPathRegistry
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.api.java/1 > 1.20
SourceJavadocAttacherImplementation.Definer
to reject a binary root.
JavaClassPathConstants
AccessibilityQueryImplementation2
to allow to listen on package accessibility changes
CompilerOptionsQuery
for additional compiler options
MINIMAL_SOURCE_LEVEL
into SourceLevelQuery
SourceLevelQuery
supports JDK 8 profiles
SourceLevelQuery
supports JDK 8 profiles
SourceLevelQuery
supports source level synonyms
ClassPath
API changed to be pluggable and better support build system
GlobalPathRegistry
org.netbeans.api.java.queries.AccessibilityQuery
AccessibilityQueryImplementation2
to allow to listen on package accessibility changes
org.netbeans.spi.java.queries.AccessibilityQueryImplementation2
AccessibilityQueryImplementation2
to allow to listen on package accessibility changes
org.netbeans.api.java.queries.AnnotationProcessingQuery
org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation
org.netbeans.api.java.queries.CompilerOptionsQuery
org.netbeans.spi.java.queries.CompilerOptionsQueryImplementation
org.netbeans.api.java.classpath.JavaClassPathConstants
JavaClassPathConstants
org.netbeans.api.java.queries.SourceJavadocAttacher
org.netbeans.spi.java.queries.SourceJavadocAttacherImplementation
SourceJavadocAttacherImplementation.Definer
to reject a binary root.
org.netbeans.api.java.queries.SourceLevelQuery
MINIMAL_SOURCE_LEVEL
into SourceLevelQuery
org.netbeans.spi.java.queries.SourceLevelQueryImplementation2
JavaClassPathConstants
; made by: tzezula; issues:
#207717
Added a new COMPILE_ONLY
classpath type allowing project types to add
classpath resources which should be included in the complile classpath but should not
be inherited by runtime classpath.
AnnotationProcessingQuery
; made by: dbalek; issues:
#183793
Modifying AnnotationProcessingQuery.Result.annotationProcessingEnabled() to return a set of triggers on which the annotation processors should be run.
AnnotationProcessingQuery
; made by: dbalek; issues:
#181421
Adding AnnotationProcessingQuery.Result.processorOptions() to return options passed to annotation processors (-Akey=value).
AnnotationProcessingQuery
AnnotationProcessingQueryImplementation
; made by: jlahoda; issues:
#179749
Adding AnnotationProcessingQuery return annotation processing options for a given file/folder.
JavaClassPathConstants
; made by: jlahoda; issues:
#174202
Class org.netbeans.api.java.classpath.JavaClassPathConstants is created to hold java specific classpath constants. org.netbeans.api.java.classpath.JavaClassPathConstants.PROCESSOR_PATH constant is created as a key for Java processor path.
The copy of the ClassPath API was used by generic scripting framework, which cannot depend on the java cluster. To remove this copy of the ClassPath API the java API needs to be splitted into the ClassPath API (IDE cluster) and the rest of the java API (java cluster).
ClassPath.toString(PathConversionMode)
and
ClassPathSupport.createClassPath(String)
can be used to easily convert between traditional string classpaths
and NetBeans' internal representation.
Classpath implementations can now specify which files and folders/packages to include
or exclude. (This could be used for binary classpaths such as COMPILE
but
currently only excludes on SOURCE
paths are honored by Java language features.)
It is possible for clients of existing ClassPath
methods to have made
assumptions about their behavior that are no longer true.
ClassPath
API changed to be pluggable and better support build system
ClassPath
is now final, not abstract. (Not
incompatible, since the constructor was never public.) Same
for ClassPath.Entry
.
getClassPath
now looks for
ClassPathProvider
s rather than delegating to the
filesystems mounted in Repository
.
The classpath type DEBUG
was deprecated.
SOURCE
and BOOT
were added.
ClassPath.Entry.getURL()
was added.
There is a complete SPI for creating ClassPath
instances.
Code which just called ClassPath.getClassPath
and so on as API clients should still be safe, but
passing null as a reference file no longer works.
GlobalPathRegistry
GlobalPathRegistry
to represent
classpaths of current interest, typically from open projects.
Note that GlobalPathRegistry
serves some of the
same functions as Repository.default
used to,
but client code should be reviewed carefully for usage.
null
. Although the implementation functioned that way
from the beginning, it is considered an incompatible change (tightening of
the contract).
SourceJavadocAttacherImplementation.Definer
to reject a binary root.
SourceJavadocAttacherImplementation
; made by: sdedic
When multiple Definers are defined, an implementation can opt out from the source/javadoc download.
JavaClassPathConstants
JavaClassPathConstants
; made by: tzezula
Added constants for module paths into the JavaClassPathConstants
.
AccessibilityQueryImplementation2
to allow to listen on package accessibility changes
AccessibilityQuery
AccessibilityQueryImplementation2
; made by: tzezula
Added AccessibilityQueryImplementation2
interface and AccessibilityQuery.isPubliclyAccessible2
method
to allow to listen on package accessibility changes.
CompilerOptionsQuery
for additional compiler options
CompilerOptionsQuery
CompilerOptionsQueryImplementation
; made by: tzezula
Added CompilerOptionsQuery
for passing additional compiler options
to java infrastructure.
MINIMAL_SOURCE_LEVEL
into SourceLevelQuery
SourceLevelQuery
; made by: tzezula
Added the MINIMAL_SOURCE_LEVEL
constant into the SourceLevelQuery
specifying the minimal supported source level.
Added SourceJavadocAttacherImplementation.Definer
interface
allowing extending the default SourceJavadocAttacherImplementation.
Such an extension can download or locate the sources and javadoc for
given binary.
SourceLevelQuery
supports JDK 8 profiles
The JDK Profile was changed to enum type.
SourceLevelQuery
supports JDK 8 profiles
The JDK 8 provides three limited profiles (compact1, compact2, compact3) in addition
to the full JDK. Each profile specifies a specific set of Java API packages and
contains all of the APIs of the smaller profile. The new API allows a client of the
SourceLevelQuery
to query the required profile.
SourceLevelQuery
supports source level synonyms
The semantics of the SourceLevelQuery
, SourceLevelQueryImplementation
and SourceLevelQueryImplementation2
was extended to support source level synonyms.
The SourceLevelQueryImplementation
and SourceLevelQueryImplementation2
can return source level synonyms, e.g. "5" for "1.5". These synonyms are always normalized
by the SourceLevelQuery
before they are teturned to an API client.
SourceJavadocAttacher
SourceJavadocAttacherImplementation
; made by: tzezula; issues:
#200698
Added an API to allow clients to attach source roots and javadoc roots to binary roots. The API delegates to SPI implementations which provide specific behavior depending on type of binary root (platform, library, maven artifact). There is also fallback implementation handling unknown binary roots by storing the bindings into IDE's userdir.
SourceLevelQuery
SourceLevelQueryImplementation2
; made by: tzezula; issues:
#185031
The SourceLevelQuery did not allow listening on the source level changes. Such a notifications are required by the annotation processor support and indexing. This API change adds a SourceLevelQuery.getSourceLevel2 which returns a Result object which allows listening like other queries.
Added support base class for SourceForBinaryQueryImplementation2 which delegates to other SourceForBinaryQueryImplementations.
It is possible for the SouceForBinaryQuery provider to specify whether the java module should prefer sources or binaries. In general sources should be preferred for projects where user can make modification. The binaries should be preferred for libraries and platforms where sources may not be complete or correct.
The new API BinaryForSourceQuery was added to allow clients to find out the output (class files) corresponding to source root. The query uses instances of a SPI interface BinaryForSourceQueryImplementation registered in the system lookup to find out the binaries. When no binary is found it uses the default algorithm (SFBQ.findSources(ClassPath.EXECUTE) == sourceRoot)
Added two static methods, findSources(FileObject)
and findUnitTests(FileObject)
,
into UnitTestForSourceQuery
. Added a new SPI interface
MultipleRootsUnitTestForSourceQueryImplementation
which allows to a project type to return
more than one source/test root.
The change was required to allow support of multiple source and test roots.
UnitTestForSourceQueryImplementation
rather than
MultipleRootsUnitTestForSourceQueryImplementation
.
Added query answering the source level of a Java file.
Several new queries were added (API and SPI) to represent various aspects of Java sources.