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 76702 - Options for background compiler are not synchronized with project's real compiler options
Summary: Options for background compiler are not synchronized with project's real comp...
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker with 1 vote (vote)
Assignee: Svata Dedic
: 87535 (view as bug list)
Depends on:
Reported: 2006-05-22 18:55 UTC by Jesse Glick
Modified: 2016-07-07 07:16 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Diff to unconditionally enable -Xlint. (955 bytes, patch)
2006-11-03 20:39 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2006-05-22 18:55:52 UTC
If you have a project using -source 1.5, often you want to enable
-Xlint:unchecked. The Ant build will then show warnings about misuse of
generics. But the NB editor window will not show such warnings as gutter
annotations as it should. This makes correcting generics problems more tedious;
you need to wait for a build to see them. And since they are warnings and not
errors, this is even worse: you have to use Clean and Build Project, not just
Build Project, to see all the warnings you have not yet corrected in the project.
Comment 1 Jesse Glick 2006-11-03 17:21:14 UTC
In my experience this is a substantial problem, especially compared to other
IDEs which display a complete list of project warnings and errors at all time.
Doing a JDK 1.4 -> JDK 5 upgrade is made significantly more time-consuming by
this bug.

It should not be terribly hard to fix, I guess: we need a new query API for
reporting compiler options, trivial impls in the known project types (freeform
can wait - needs a project.xml format change), and a little bit of code in
java/* to pass along the right options to the background compiler (excluding any
-J* options first, of course).

Or as a temporary partial solution, just pass -Xlint to the background compiler.
Generally the extra warnings should be welcome anyway for people trying to write
nice code.
Comment 2 Jan Lahoda 2006-11-03 17:51:12 UTC
I agree this would be nice. Should be solved in the infrastructure (the editor
only shows what it gets from the parser). I would really prefer the extra
compiler arguments query over hardcoding -Xlint into the infrastructure.
Comment 3 Jesse Glick 2006-11-03 19:56:20 UTC
BTW as an experiment I tried inserting this option into javac's options list in
various classes I found in java/source but none of those attempts seemed to have
any effect; for example, in

new java.util.ArrayList().add(5);
new org.xml.sax.helpers.AttributeListImpl();
ThisClass.class.getMethod("x", null);

only the last line is marked with a warning annotation. (This warning is
produced even without -Xlint.)

Out of curiosity - where exactly do the background compiler editor annotations
get registered? Was not able to find it. I found
but there do not appear to be any impls of Annotation in java/source matching
that ID. Also the Annotations node in Advanced Options shows several different
nodes all labelled "LAB_ParserAnnotation" (missing bundle key), and the
referenced warning-glyph.gif does not appear to exist. I guess all this code is
more or less copied from the old java module and hasn't been cleaned up yet?
Comment 4 Jan Lahoda 2006-11-03 20:37:21 UTC
I am attaching a diff that enables "-Xlint".

Yes, the
is not used and should be cleaned-up.

The annotations are attached by the editor/hints module, the data (where the
annotations should be shown) are provided by the java/hints module based on
Comment 5 Jan Lahoda 2006-11-03 20:39:13 UTC
Created attachment 35773 [details]
Diff to unconditionally enable -Xlint.
Comment 6 Jesse Glick 2006-11-03 20:47:12 UTC
Yup, that does it.
Comment 7 Jesse Glick 2006-11-06 16:34:56 UTC
I put in that patch but conditionally enabled (disabled by default), as a
workaround and for testing. So far seems to work very well and definitely makes
it faster to clean up sources.

committed     Up-To-Date  1.5        
Comment 8 Jan Lahoda 2006-12-11 17:18:51 UTC
I propose P3 when there is a workaround now.
Comment 9 Jesse Glick 2006-12-11 17:35:36 UTC
Yes, the workaround seems fine for the time being. BTW I will suppress [serial]
warnings since they are shown very frequently and are usually nonsense.
Comment 10 Jesse Glick 2006-12-18 21:37:07 UTC
*** Issue 87535 has been marked as a duplicate of this issue. ***
Comment 11 Jan Lahoda 2007-02-11 18:36:57 UTC
For the record: the command line option to enable the -Xlint is:
Comment 12 Jesse Glick 2007-04-18 20:42:04 UTC
So now there is a GUI to configure it, but it is not synchronized with the
project's compiler settings. Do you still plan to introduce an API for this
communication? If so, the new GUI will need to be thrown out anyway.
Comment 13 Jan Lahoda 2007-07-10 17:12:21 UTC
I would still prefer if the background parser would reuse project's settings, but I do not think this will happen for
NB6.0. Not a big problem IMO.
Comment 14 Jesse Glick 2007-10-26 17:34:39 UTC
Changing summary to reflect what I understand to be the current problem.
Comment 15 olegsukhodolsky 2007-11-02 21:41:28 UTC
I'd say that for (open)JDK development it would be very nice to have this implemented because, for example
the project for openJDK specifies compiler's property to suppress warnings about using Sun's package (e.g. sun.awt)
However NB highlight all such imports as "import from forbidden package" because of this issue.
So, (open)JDK developed has pretty big number of false alarms from NB (this means he/she ignore all warnings for imports).
Thus I'd suggest to reconsider priority of this problem.
Comment 16 Jan Lahoda 2007-11-02 22:31:13 UTC
Oleg, the warning you are talking about is a bit different than the other warnings discussed here, as it is produced by
NetBeans itself, not by javac (as of now, the in-IDE parser never completes against ct.sym). The hint can be configured
in Tools/Options/Java Code/Hints/Imports/Import from Forbidden Package.
Comment 17 olegsukhodolsky 2007-11-02 23:33:13 UTC
I want disallow imports from "forbidden packages" for all projects except JDK.  But the option you pointed is IDE wide :(
So, you either need to provide such options for every package or use option I'm passing to compiler.  If you prefer the
former option let me know and I will file RFE about it ;)
Comment 18 Rastislav Komara 2009-02-03 10:54:45 UTC
Comment 19 David Strupl 2009-03-31 16:06:35 UTC
Resolving all issues with milestone "future" as LATER. If you feel strongly that
it should be implemented please reopen and set the target milestone to "next".
Comment 20 Jesse Glick 2009-03-31 18:19:44 UTC
I think this ought to be fixed. It would not be that hard, and people legitimately expect that the IDE shows the same
warnings/errors as the build will. Looks bad next to Eclipse, too.
Comment 21 Jan Lahoda 2009-08-20 09:59:19 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 22 moilejter 2009-09-03 16:59:11 UTC
I needed to add a compiler option to force NetBeans 6.8 to use the new JAX-WS 2.2rc1, intead of the 2.1 it is ditributed
with.  I added the proper option to the "additional compiler options" in the project settings compile dialog - but that
had no effect on the background compiler used by NetBeans.  This made the editor flag as errors lines that would in fact
compile properly - since the background compiler was still using JAX-WS 2.1.

The work around I used was to edit netbeans.conf to add the proper additional option (modifying classpath to prepend
JAX-WS 2.2. jar files to the boot classpath), which then affected everything, including the background compiler....
Comment 23 Jesse Glick 2009-09-03 17:18:04 UTC
moilejter - your problem is unrelated. You probably just need to configure a Java Platform with the appropriate
bootclasspath and set that for the project; use for assistance. This issue is not about the
-classpath (or -bootclasspath) option, but about miscellaneous options such as -Xlint.
Comment 24 David Strupl 2012-10-25 13:41:52 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 25 Martin Balin 2016-07-07 07:16:12 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss