跳到主要内容

JEP 117: Remove the Annotation-Processing Tool (apt)

Summary

Remove the apt tool, associated API, and documentation from the JDK.

Goals

By removing apt from the JDK, annotation processing can finish transitioning to the superior, standardized JSR 269 API.

The apt annotation processing framework is JDK-specific and dates back to JDK 5. The functionality of the API was standardized with JSR 269, which shipped as part of Java SE 6. In JDK 7, the entirety of the apt API was deprecated.

Non-Goals

Developing automated tooling to convert apt annotation processors to JSR 269 annotation processors is out of scope for this effort.

Motivation

Unlike the JSR 269 API, the apt API cannot be updated to model language features introduced after JDK 5. Removing apt from the JDK will also ease maintenance of javac and related tools.

Description

Implementing the removal will include removing the affected files from the JDK 8 langtools Mercurial repository as well as supporting makefile changes.

Testing

Any testing will be limited to verifying the apt command and API are not present.

Risks and Assumptions

Subject to the dependency noted below, there are no engineering issues with excising apt from the JDK. Users of annotation processing will have ample warning apt has been removed so needed migrations can occur before JDK 8 ships.

Dependences

Portions of jaxws are built on top of apt. These components need to be migrated to use the JSR 269 implementation in the JDK before apt can be removed.

Impact

After this change, users of annotation processing will have to use the JSR 269 annotation processing facility, which has been supported in javac since JDK 6. Since apt is just part of the JDK and not part of Java SE, there is a looser compatibility contract around this component than around an API in java.* or javax.*. The removal of a command line tool from the JDK is not unprecedented, but the removal of apt should be clearly described in the release notes and similar documents.