Overview

# Introduction

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.

# Index of APIs

- Classpath API
- Java-related queries

# 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.

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system
- (Dec 9 '02) ClassPath.getClassPath is permitted to return null value

# All changes by date

- (Nov 8 '04) UnitTestForSourceQuery supports multiple source and test roots
- (Apr 27 '04) Added SourceLevelQuery
- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system
- (Mar 16 '04) Added `GlobalPathRegistry`
- (Mar 16 '04) Added several queries
- (Feb 21 '03) ClassPath.getClassLoader method added
- (Dec 9 '02) ClassPath.getClassPath is permitted to return null value

# 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.api.java/1 > 1.20

- (1.7) UnitTestForSourceQuery supports multiple source and test roots
- (1.5) Added SourceLevelQuery
- (1.4) `ClassPath` API changed to be pluggable and better support build system
- (1.4) Added `GlobalPathRegistry`
- (1.4) Added several queries
- (1.2.1) ClassPath.getClassLoader method added
- (1.2) ClassPath.getClassPath is permitted to return null value

# Changes by affected class

## `org.netbeans.api.java.queries.AccessibilityQuery`

- (Mar 16 '04) Added several queries

## `org.netbeans.spi.java.queries.AccessibilityQueryImplementation`

- (Mar 16 '04) Added several queries

## `org.netbeans.api.java.classpath.ClassPath`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.spi.java.classpath.ClassPathFactory`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.spi.java.classpath.ClassPathImplementation`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.spi.java.classpath.ClassPathProvider`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.spi.java.classpath.support.ClassPathSupport`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.spi.java.classpath.support.CompositePathResourceBase`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.api.java.classpath.GlobalPathRegistry`

- (Mar 16 '04) Added `GlobalPathRegistry`

## `org.netbeans.api.java.queries.JavadocForBinaryQuery`

- (Mar 16 '04) Added several queries

## `org.netbeans.spi.java.queries.JavadocForBinaryQueryImplementation`

- (Mar 16 '04) Added several queries

## `org.netbeans.spi.java.queries.MultipleRootsUnitTestForSourceQueryImplementation`

- (Nov 8 '04) UnitTestForSourceQuery supports multiple source and test roots

## `org.netbeans.spi.java.classpath.support.PathResourceBase`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.spi.java.classpath.PathResourceImplementation`

- (Mar 16 '04) `ClassPath` API changed to be pluggable and better support build system

## `org.netbeans.api.java.queries.SourceForBinaryQuery`

- (Mar 16 '04) Added several queries

## `org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation`

- (Mar 16 '04) Added several queries

## `org.netbeans.api.java.queries.SourceLevelQuery`

- (Apr 27 '04) Added SourceLevelQuery

## `org.netbeans.spi.java.queries.SourceLevelQueryImplementation`

- (Apr 27 '04) Added SourceLevelQuery

## `org.netbeans.api.java.queries.UnitTestForSourceQuery`

- (Nov 8 '04) UnitTestForSourceQuery supports multiple source and test roots
- (Mar 16 '04) Added several queries

## `org.netbeans.spi.java.queries.UnitTestForSourceQueryImplementation`

- (Nov 8 '04) UnitTestForSourceQuery supports multiple source and test roots
- (Mar 16 '04) Added several queries

# Details of all changes by API and date

## Classpath API

### `ClassPath` API changed to be pluggable and better support build system

Mar 16 '04; API spec. version: 1.4; affected top-level classes: `ClassPath` `ClassPathProvider` `ClassPathFactory` `ClassPathImplementation` `PathResourceImplementation` `ClassPathSupport` `CompositePathResourceBase` `PathResourceBase`; made by: jglick

`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.

Compatibility:

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.

### Added `GlobalPathRegistry`

Mar 16 '04; API spec. version: 1.4; affected top-level classes: `GlobalPathRegistry`; made by: jglick
Added a new class `GlobalPathRegistry` to represent classpaths of current interest, typically from open projects.
Compatibility:

Note that `GlobalPathRegistry` serves some of the same functions as `Repository.default` used to, but client code should be reviewed carefully for usage.

### ClassPath.getClassLoader method added

Feb 21 '03; API spec. version: 1.2.1; made by: sdedic
ClassPath.getClassLoader() method allows to get classloader capable of loading classes from the ClassPath.

### ClassPath.getClassPath is permitted to return null value

Dec 9 '02; API spec. version: 1.2; made by: sdedic
ClassPath.getClassPath() documentation omitted the fact, that the method may return `null`. Although the implementation functioned that way from the beginning, it is considered an incompatible change (tightening of the contract).

## Java-related queries

### UnitTestForSourceQuery supports multiple source and test roots

Nov 8 '04; API spec. version: 1.7; affected top-level classes: `UnitTestForSourceQuery` `UnitTestForSourceQueryImplementation` `MultipleRootsUnitTestForSourceQueryImplementation`; made by: tzezula

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.

Compatibility: Compatibility with the old API and SPI is provided. Both versions of SPI interfaces are used by the API; a project type may still implement the deprecated `UnitTestForSourceQueryImplementation` rather than `MultipleRootsUnitTestForSourceQueryImplementation`.

### Added SourceLevelQuery

Apr 27 '04; API spec. version: 1.5; affected top-level classes: `SourceLevelQuery` `SourceLevelQueryImplementation`; made by: dkonecny

Added query answering the source level of a Java file.

### Added several queries

Mar 16 '04; API spec. version: 1.4; affected top-level classes: `AccessibilityQuery` `JavadocForBinaryQuery` `SourceForBinaryQuery` `UnitTestForSourceQuery` `AccessibilityQueryImplementation` `JavadocForBinaryQueryImplementation` `SourceForBinaryQueryImplementation` `UnitTestForSourceQueryImplementation`; made by: jglick

Several new queries were added (API and SPI) to represent various aspects of Java sources.

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.