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.

Bug 181439

Summary: Minimal AnnotationProcessingQueryImplementation for freeform projects
Product: java Reporter: Jesse Glick <jglick>
Component: FreeformAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: normal CC: jessholle, tzezula
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 182574    
Bug Blocks: 111065    
Attachments: freeform-project-java/3 diff
annotation processing error message and traceback
Two new exceptions occurring during code scanning/parsing

Description Jesse Glick 2010-03-02 09:24:10 UTC
<classpath mode="processor">...</classpath> to specify a processor path. Defaults to be the same as <classpath mode="compile"/>. Can be left empty to disable AP. No GUI.
Comment 1 Jesse Glick 2010-03-02 09:26:49 UTC
core-main #a331e263c813
Comment 2 Quality Engineering 2010-03-02 22:10:02 UTC
Integrated into 'main-golden', will be available in build *201003030200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a331e263c813
User: Jesse Glick <jglick@netbeans.org>
Log: #181439: minimal AP query impl.
Comment 3 Jesse Glick 2010-03-03 12:52:37 UTC
Really this should be in a http://www.netbeans.org/ns/freeform-project-java/3 schema (together with 1.6/1.7 source levels and possibly other changes), but doing a schema upgrade is significant work and we are generally not doing development on the freeform project type going forward. Be advised that a project using mode="processor" cannot be opened in NB 6.8.
Comment 4 jessholle 2010-03-03 14:46:19 UTC
"not doing development on the freeform project type going forward"????

That's the only thing that keeps us using NetBeans.

Without this we'd have gone to Eclipse quite some time ago.

If you can't add a few nuggets to the project.xml schema along the lines you indicated and route their data to the appropriate places, then I guess that's a sign to give up on NetBeans.
Comment 5 Tomas Zezula 2010-03-03 15:05:33 UTC
I am now on vacation but after it I will do a /3 schema.
Jesse, if you have any other things we want to add (except of cp type and source level) please add them into this issue.
Comment 6 Jesse Glick 2010-03-03 15:11:34 UTC
(In reply to comment #5)
> I am now on vacation but after it I will do a /3 schema.

Go ahead if you have time. Note that feature freeze is the end of this week. There is some fairly complicated code to decide whether to use a /1 or /2 schema which would need to be adapted to also work with /3, if something from the GUI wants to store new information - which would be true if you e.g. included 1.6 and 1.7 as options in the Source Level dropdown.
Comment 7 Tomas Zezula 2010-03-03 23:37:20 UTC
I know about the upgrade code, it's similar o UpdateHelper, and this was the reason why I didn't add the 1.6, 1.7 yet.
I will definitely not do it before feature freeze but as a bug fix after it.
Comment 8 Tomas Zezula 2010-03-22 14:29:12 UTC
Created attachment 95536 [details]
freeform-project-java/3 diff
Comment 9 Jesse Glick 2010-03-22 18:46:58 UTC
Typo in comment:

...
         // First check whether we need /2 data.
+        boolean need3 = false;
...


Can remove 'processor' from permitted CP types in /2 schema.


Otherwise looks good to me. Don't forget to publish new schema in old CVS under www/www/ns/ (or ask me to do so after you have committed to Hg).
Comment 10 Tomas Zezula 2010-03-23 13:25:49 UTC
The typo is fixed.
"Processor" is removed from /2.
I will commit the new schema into the cvs.netbeans.org, unfortunately the server is now down. I've created a new issue #182574
Comment 11 Tomas Zezula 2010-03-23 13:31:12 UTC
Integrated into jet-main 1c95fe60e70c.
To jessholle: If you are using processor path, you will need to upgrade the schema to /3.
Comment 12 jessholle 2010-03-23 13:48:35 UTC
When will this be available to try out?  The next 6.9 nightly or...?
Comment 13 Tomas Zezula 2010-03-23 13:55:55 UTC
Not sure, as it needs to merge from our team repository into the golden.
The merge should add the message into this issue, something like:
Integrated into 'main-golden', will be available in build *????????????????* on....
Comment 14 Quality Engineering 2010-03-24 05:23:57 UTC
Integrated into 'main-golden', will be available in build *201003240200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1c95fe60e70c
User: Tomas Zezula <tzezula@netbeans.org>
Log: #181439:Minimal AnnotationProcessingQueryImplementation for freeform projects
Comment 15 jessholle 2010-04-15 13:32:06 UTC
I finally got time to try this in the latest nightly of NB 6.9.

I get innumerable log messages stating:

INFO [com.sun.tools.javac.processing.JavacProcessingEnvironment]: Annotation processing error:
java.lang.IllegalArgumentException: Argument is not a primitive type or a string; it has class com.ptc.windchill.annotations.metadata.SupportedAPI.

This same annotation processor does not produce such output when run with javac from the command line.  I'm left wondering if the SupportedAPI class (which is an enum) is not being seen by the annotation processor, though its jar is in the processorpath along with the annotation processor implementation.

When invoked from the command line we also provide -s and several -A arguments which the freeform project XML currently does not allow me to provide, but I suspect this is not the issue.

Should I re-open this or file a new issue?
Comment 16 jessholle 2010-04-15 13:34:58 UTC
Created attachment 97451 [details]
annotation processing error message and traceback

Attaching the annotation processing error message and stack trace.
Comment 17 Jan Lahoda 2010-04-15 13:38:04 UTC
What exactly passes
at com.ptc.windchill.annotations.processors.SupportedAPIWrapper.<init>(SupportedAPIWrapper.java:23)

to Elements.getConstantExpression? Thanks.
Comment 18 Tomas Zezula 2010-04-15 13:44:12 UTC
The Elements.getConstantExpression() javadoc:
Returns the text of a constant expression representing a primitive value or a string.
Comment 19 jessholle 2010-04-15 13:49:16 UTC
I didn't even notice our code in the stack trace -- sorry for the sloppiness!

At any rate the interesting bit of the line in question is:

  env.getElementUtils().getConstantExpression(SupportedAPI.PRIVATE)

where SupportedAPI.PRIVATE is a value of the SupportedAPI enum, of course.

Given that this appears to be working fine outside NetBeans (or as an Ant task launched within the same NetBeans project), something seems amiss in NetBeans here.
Comment 20 jessholle 2010-04-15 13:50:12 UTC
So we're just getting away with this when this is invoked via javac?
Comment 21 Jan Lahoda 2010-04-15 14:00:09 UTC
(In reply to comment #20)
> So we're just getting away with this when this is invoked via javac?

Yes, as far as I can tell. There was a bug in javac that this was not enforced:
http://bugs.sun.com/view_bug.do?bug_id=6517779
The fix was pulled to the NetBeans' version of javac together with other fixes. The very same exception is thrown when javac from JDK7 (I tested b85) is used.
Comment 22 jessholle 2010-04-19 11:30:00 UTC
Having gotten past the constants vs. enums spec bit, we're now seeing two new exceptions over and over again, an IllegalArgumentException and a new NullPointerException.  Any ideas?  [Again, this works fine from the command line javac.]
Comment 23 jessholle 2010-04-19 11:34:47 UTC
Created attachment 97609 [details]
Two new exceptions occurring during code scanning/parsing

Two new exceptions occurring during code scanning/parsing.  Again, these do not occur with our annotation processor when used from javac from Ant from the command line.
Comment 24 Jesse Glick 2010-04-19 23:22:42 UTC
(In reply to comment #23)
> Two new exceptions occurring during code scanning/parsing.  Again, these do not
> occur with our annotation processor when used from javac from Ant from the
> command line.

Such things would be better filed as separate issues in java/source since they are likely not specific to freeform projects.
Comment 25 jessholle 2010-04-19 23:25:12 UTC
Okay, I can certainly file this as one or more separate issues against java/source -- I had little/no way of knowing what to file this against or even if there was some spec subtlety we'd missed once again.
Comment 26 jessholle 2010-04-19 23:32:16 UTC
I filed issue 184503 in regards to the exceptions.  If this should be split into 2 issues, that can be done later -- I didn't want to jump to the conclusion that the exceptions were unrelated, though.