JDK-8015899 : Cleanup Annotations API
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-06-04
  • Updated: 2015-12-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorUnresolved
Related Reports
Relates :  
Description
See 
http://mail.openjdk.java.net/pipermail/type-annotations-dev/2013-June/001040.html


*) There's an annoying split between symbol annos and type annos; we have twice the methods we need - I think some work should be done to consolidate existing APIs onto a more stable version where stuff like this:

public boolean hasAnnotations() {
+        return (annotations != null && !annotations.isEmpty());
+    }
+   
+    public boolean hasTypeAnnotations() {
+        return (annotations != null && !annotations.isTypesEmpty());
+    }


Is replaced  by this:

public boolean hasAnnotations(AnnoKind kind) { ... }


*) I think all methods that modify annotations should not be exposed through Symbol API

*) This should be done via a Symbol flag

- annotationsPendingCompletion

In other words, I would keep the Symbol API light by providing:

*) a way for getting symbol/type annos
*) a way to tell as to whether annotation completion has already happened (i.e. will the above method yield meaningful answer?)

Everything else should be done through a separate class (Annotations), pretty much like we do now, by accessing symbol's metadata and playing with it. I also would remove any back pointer from Annotations to Symbol (if any).

Comments
Retargetting fix version from being JDK9 to being unspecified. I may still work on this subject to time availability in the coming weeks/months and if a fix becomes available in time, may be considered for JDK9 subjecting to risk assessment.
10-12-2015

This is a placeholder request, and may have been done in Joel's cleanup in early 2015. In the past, the internal API for dealing with annotations in javac was ugly. If it still is, we should clean it up. Otherwise, this can be closed.
16-11-2015