JEP 217: Annotations Pipeline 2.0JEP 217: Annotations Pipeline 2.0OwnerJoel Borggrén-FranckTypeFeatureScopeImplementationStatusClosed / DeliveredRelease9Componenttools / javacDiscussioncompiler dash dev at openjdk dot java dot netEffortLDurationLRelates toJEP 215: Tiered Attribution for javacReviewed byAlex Buckley, Jonathan Gibbons, Maurizio CimadamoreEndorsed byBrian GoetzCreated2014/06/23 21:29Updated2016/07/12 21:03Issue8047926Summary
Redesign the javac annotations pipeline to better address the
requirements of annotations and tools that process annotations.
Goals


The compiler should behave correctly with regard to annotations and
type annotations: the emitted class files should have
correctly-formatted attributes for all kinds of annotations.


Compile-time reflection (javax.lang.model and
javax.annotation.processing) should properly handle all annotations
in signature-visible positions.


Run-time reflection (Core Reflection) should work properly with
annotations in class files.


The Checkers Framework must continue to work.


The Java Compiler API should continue to work as designed.


Non-Goals
No new language features or APIs will be added. It is not a goal to
update support for annotations in related tools such as javadoc and
javap.
Motivation
Java SE 8 introduced two new annotation features,
Repeating Annotations (JEP 120) and
Annotations on Java Types (JSR 308 / JEP 104).
In addition Lambda Expressions (JSR 335 / JEP 126) added new
syntactic position for annotations. These features, none of which existed
when the javac annotation pipeline was initially conceived, can be
combined together, leading to patterns such as:
Function<String, String> fss = (@Anno @Anno String s) -> s;
The existing annotation pipeline could not handle such cases out of the
box; as a result, the original design has been stretched in order to
accommodate the new use cases, leading to a brittle and hard-to-maintain
implementation. The goal of this work is to replace this aging
architecture with a new one which supports the new use cases in a more
straightforward fashion, leading to more-correct and maintainable code.
Description
Refactor the javac annotation pipeline. This should not be externally
noticeable except where we fix bugs and improve correctness. The first
step is to improve testing coverage so we can measure and evaluate our
exit criteria. After that follows a series of incremental
refactorings. This work will be done in the OpenJDK
Annotations Pipeline 2.0 Project.
The javadoc tool has some related issues with regards to type
annotations. javadoc is, however, undergoing significant work as part of
the Javadoc.Next Project.
Part of that work includes converting javadoc to use the
javax.lang.model API instead of the older com.sun.javadoc
API. It is, therefore, not a goal of this project to work on javadoc to
ensure that annotations, including type annotations, are presented
correctly. It is expected that, as part of the JavaDoc.Next Project,
javadoc will be enhanced to leverage the updates to the
javax.lang.model API that are a goal of this project.
Testing
There is already good coverage of a substantial set of end-to-end use
cases of annotations. This includes JCK and langtools regression tests.
A big part of this work is to develop further tests to ensure the
measurability of the success metrics.
We will create tests that exercise the intersection of the new features
in Java SE 8, as mentioned above.
InstallingContributingSponsoringDevelopers' GuideVulnerabilitiesJDK GA/EA BuildsMailing listsWiki
                      · IRCBylaws · CensusLegalWorkshopJEP ProcessSource codeMercurialGitHubToolsGitjtreg harnessGroups(overview)AdoptionBuildClient LibrariesCompatibility & Specification ReviewCompilerConformanceCore LibrariesGoverning BoardHotSpotIDE Tooling & SupportInternationalizationJMXMembersNetworkingPortersQualitySecurityServiceabilityVulnerabilityWebProjects(overview,
      archive)AmberBabylonCRaCCaciocavalloClosuresCode ToolsCoinCommon VM InterfaceCompiler GrammarDetroitDevelopers' GuideDevice I/ODukeGalahadGraalIcedTeaJDK 7JDK 8JDK 8 UpdatesJDK 9JDK
      (…,
       21,
       22,
       23)JDK UpdatesJavaDoc.NextJigsawKonaKullaLambdaLanaiLeydenLilliputLocale EnhancementLoomMemory Model UpdateMetropolisMission ControlMulti-Language VMNashornNew I/OOpenJFXPanamaPenrosePort: AArch32Port: AArch64Port: BSDPort: HaikuPort: Mac OS XPort: MIPSPort: MobilePort: PowerPC/AIXPort: RISC-VPort: s390xPortolaSCTPShenandoahSkaraSumatraTiered AttributionTsanType AnnotationsValhallaVeronaVisualVMWakefieldZeroZGC

        © 2024 Oracle Corporation and/or its affiliates
        Terms of Use
        ·
        
            License: GPLv2
        · Privacy
        · Trademarks
