This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
At least in a package-info.java, if I am missing a mandatory attribute in an annotation, the editor seems to display no error or warning. (When I go to compile, the annotation processor dies with an IncompleteAnnotationException, but I should not have to wait that long.)
Might ultimately be a bug in javac, since behavior even from an Ant build is odd: I would expect that a missing mandatory attribute would be flagged as a fatal error before annotation processors are even run. The Javadoc "Thrown to indicate that a program has attempted to access an element of an annotation type that was added to the annotation type definition after the annotation was compiled (or serialized)." gives no indication that this is expected to be thrown from inside an AP.
Yes, it is a bug in javac - there is actually no code to verify annotations on packages. I am not quite sure what is the proper fix, but a bit hackish solution would be to add explicit verification of package annotations of package-info.java in JavaCompiler.attribute.
(In reply to comment #2) > it is a bug in javac - there is actually no code to verify annotations on > packages. Interesting. I have also noticed that @SuppressWarnings is accepted without warning in package-info.java even though it is not declared to accept ElementType.PACKAGE! These issues seem pretty basic. Is there a JDK bug filed? If so, can probably put jdk_bug_NNNNNNN in status whiteboard, close, and wait for fixes to appear in a JDK 7 javac drop.
Re @SuppressWarnings: that's the same problem (the annotation is never validated). There is currently no JDK bug that I would know of - I was searching existing reports, but found nothing, and did not have time to report a new one yet.
When you file a javac bug, please add me to the CC list.
I made a fix in NB: http://hg.netbeans.org/jet-main/rev/228d93109f77 http://hg.netbeans.org/main/nb-javac/rev/584dfd1a6cf1 and contacted javac people. No response from them so far.
Integrated into 'main-golden', will be available in build *201008060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/228d93109f77 User: Jan Lahoda <jlahoda@netbeans.org> Log: #178452: new javac library: ensures that package annotations are validated and errors reported for them.