Bug 210286 - Warnings from annotation processors when using -source 7
Warnings from annotation processors when using -source 7
Status: REOPENED
Product: platform
Classification: Unclassified
Component: -- Other --
7.1.1
All All
: P4 with 1 vote (vote)
: TBD
Assigned To: Jaroslav Tulach
issues@platform
jdk_bug_7184902
: JDK_1.7
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-28 13:48 UTC by mgoe
Modified: 2014-04-18 11:47 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
AntLogger extension from which a Netbeans module can be created. (4.33 KB, text/x-java)
2012-07-19 12:12 UTC, mgoe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mgoe 2012-03-28 13:48:26 UTC
When trying to compile a Netbeans project with jdk7 (source=1.7 and target=1.7)
a lot of the following warnings are issued:

warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.NbBundleProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.URLStreamHandlerRegistrationProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.awt.ActionProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.editor.mimelookup.CreateRegistrationProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.editor.lib2.EditorActionRegistrationProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.modules.PatchedPublicProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.templates.TemplateProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.windows.TopComponentProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.javahelp.HelpSetRegistrationProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.options.OptionsPanelControllerProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.projectapi.LookupProviderAnnotationProcessor' less than -source '1.7'

Do these warnings indicate that something is wrong with my code,
or will something not work correctly during runtime,
or do these warnings show that the Netbeans IDE 7.1.1 is not ready
for projects using jdk7?

Best regards,
Martin
Comment 1 Jesse Glick 2012-03-29 18:14:22 UTC
As far as I know it is harmless. It just means that NetBeans Platform modules, including those with annotation processors, were built against JDK 6 (since that is our baseline), and as such declared that they support (up to) SourceVersion.RELEASE_6. javac prints this warning when your module's source level is set to 1.7, because the compiler cannot assure that the processor will in fact work. The warning seems to be issued even without -Xlint, so short of using -nowarn it cannot be suppressed.

It is likely that all NB processors in fact work fine with RELEASE_7, since this had only relatively minor language changes with no effect on the Java element model (I just confirmed NbBundleProcessor works with -source 7). The processors cannot declare that they support RELEASE_7 without either

1. Using SourceVersion.valueOf("RELEASE_7") and falling back to RELEASE_6 in case of IAE - ugly.

2. Using SourceVersion.latest(), which is a bit dangerous since e.g. JDK 8 might change the language model in a way that actually forces updates to the processor to support some new constructs.
Comment 2 Jesse Glick 2012-03-29 18:15:22 UTC
Of course you can simply switch your module to use javac.source=1.6 but then you cannot take advantage of Project Coin enhancements.
Comment 3 Jesse Glick 2012-07-18 11:36:13 UTC
7184902 has discussion and requests an -Xlint category.
Comment 4 mgoe 2012-07-18 15:35:51 UTC
Unfortunately jdk bug 7184902 is not publicly available. So you cannot vote for it. This bug is very annoying. When compiling our project with jdk7 we have hundreds of lines with these warnings. It is easy to miss "real" warnings. Perhaps you could provide a filter for the output until this problem is fixed.
Comment 5 Jesse Glick 2012-07-18 15:58:40 UTC
7184902 just filed, should appear on the public site within a couple days - sorry for not mentioning that.

Providing an output filter is not a bad idea. Could be done by any plugin implementing AntLogger.
Comment 6 mgoe 2012-07-19 12:08:16 UTC
Thank you for your hint with the AntLogger. I implemented an AntLogger extension (see attachment) suppressing the following two message patterns (but can be extended by additional patterns):

Supported source version ... from annotation processor ...
No processor claimed any of these annotations: ...

Best regards,
Martin
Comment 7 mgoe 2012-07-19 12:12:05 UTC
Created attachment 122191 [details]
AntLogger extension from which a Netbeans module can be created.

Please feel free to use this code for a fix.
Comment 8 _ gtzabari 2013-09-02 03:59:02 UTC
The JDK issue was closed as "Not an issue" with no explanation. I've sent an email to Ingrid (of Oracle) asking for clarification.
Comment 9 Jesse Glick 2013-09-03 15:49:02 UTC
Thanks. The JDK bug tracker is rather opaque I am afraid.
Comment 10 _ gtzabari 2013-09-04 03:33:06 UTC
Jesse,

Here is what I was told:

> SupportedSourceVersion does not specify the minimum, but "the latest source
> version an annotation processor supports". So, annotating with RELEASE_6 and
> compiling with -source 7 is compiling with an unsupported version and a warning
> is issued.
>
> This is behaving as documented. If you still want this filed as an RFE to add
> an -Xlint option, please resubmit...no harm asking.

How would you like to proceed?
Comment 11 Jesse Glick 2013-09-04 14:36:46 UTC
> This is behaving as documented.

Yes; the issue is that this documented behavior is inconvenient.

> If you still want this filed as an RFE to add an -Xlint option, please resubmit

This is exactly what the original

http://bugs.sun.com/view_bug.do?bug_id=7184902

suggested!
Comment 12 Antonin Nebuzelsky 2013-12-27 12:36:08 UTC
Thus closing wontfix on NB side. Thanks.
Comment 13 Jesse Glick 2014-03-17 17:35:54 UTC
Resubmitted to Java team, number pending approval.
Comment 14 Jesse Glick 2014-04-02 14:37:12 UTC
Resubmitted and once again closed:

  https://bugs.openjdk.java.net/browse/JDK-8037955

The suggested workaround is to use

if (SourceVersion.latest > RELEASE_6)
  return (SourceVersion.values())[RELEASE_6.ordinal()+1];
else
  return RELEASE_6

At this point of course RELEASE_8 should be considered as well, though the language changes have been substantial enough that there is a slight possibility that existing processors would need some fixes to support it.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo