1
votes

How to prevent NetBeans from generating hordes of build warnings similar to this? warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.NbBundleProcessor' less than -source '1.8'

Ultimately, I want to build my projects with no build warnings. If anyone has an approach that works, I am eager to hear it.

There are no known compiler flags to prevent these warnings, despite years of people complaining about it. I have tried work-arounds to no success, and I have studied way too many tech-blogs (here are a few of the more useful ones): JDK-7184902 : "Supported source version..." warning should be -Xlint aware - http://bugs.java.com/view_bug.do?bug_id=7184902 JDK-8037955 : "Supported source version..." warning should be -Xlint aware - http://bugs.java.com/view_bug.do?bug_id=8037955 Bug 210286 - Warnings from annotation processors when using -source 7 - https://netbeans.org/bugzilla/show_bug.cgi?id=210286 Supported source version RELEASE_6 from annotation processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor less than source1.7 - Supported source version RELEASE_6 from annotation processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor less than source1.7

The best bet so far has been to try implementing an AntLogger (using an approach mentioned in the Bug 210286 article and the source code they provided for SuppressionFilterAntLogger.java located at https://netbeans.org/bugzilla/attachment.cgi?id=122191).

Adding a dependency upon the Ant module did not work. Apparently the Ant module is considered an "excluded module", so I cannot just have NetBeans add the import statement for me with the little red-lightbulb icon. Here is what it took to get the project to compile (after lots of research and experimenting to figure this out): Right-click the module application's root node and select Project Properties, then click on its Libraries tab. Within the Platform Modules listing, scroll to each of the following list entries and check their Included checkboxes. Whenever we select one platform module, we will receive some error message (located along the bottom of the dialog window) about "but this is excluded", so we hunt for that module and keep going until it has included everything it needs. Check/enable the Included checkboxes for the following list entries: extide|Ant extide | Java Options ide | Navigator API ide | Project API ide | Project UI ide | Project UI API ide | Projects Indexing Bridge ide | XML Tools API javafx (i.e. select all entries within the javafx cluster) platform | Execution API Uncheck/disable the Included checkboxes for the following list entries: platform | JavaFX wrapper Now we can press the Resolve button (which was disabled previously). Restart the NetBeans IDE (because it doesn't fully use the changes we've just made without a full restart).

After all of that, I finally have the SuppressionFilterAntLogger class compiling successfully... but NetBeans is not triggering any of its methods (and I still get the RELEASE_7 build warnings)!

I am using Java 8u66 and NetBeans IDE 8.0.2 on Microsoft Windows 7 Professional. I am experimenting with this AntLogger using a NetBeans Platform module application, but the Java build warnings occur in all kinds of projects.

1

1 Answers

0
votes

If you are not actually using JDK 8 features such as lambdas. You can use the latest JDK but still set the source level to 1.7 in properties source. Your code could use classes from 1.8 but could not use lambda's etc.