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 43395 - Suggest that -Xlint:unchecked be turned on
Summary: Suggest that -Xlint:unchecked be turned on
Status: RESOLVED DUPLICATE of bug 46995
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: David Konecny
URL:
Keywords: RELNOTE
: 46314 (view as bug list)
Depends on:
Blocks: 41537
  Show dependency tree
 
Reported: 2004-05-17 20:05 UTC by Jesse Glick
Modified: 2004-08-24 15:30 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-05-17 20:05:14 UTC
I am not sure about this, just something I noticed
while working on a j2seproject. I got a warning
from javac (JDK 1.5):

Note:
/tmp/testantlogging/src/testantlogging/Main.java
uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

After adding this to my build.xml:

<target name="init-macrodef-javac">
    <macrodef name="javac"
uri="http://www.netbeans.org/ns/j2se-project/1">
        <attribute name="srcdir"
default="${src.dir}"/>
        <attribute name="destdir"
default="${build.classes.dir}"/>
        <attribute name="classpath"
default="${javac.classpath}"/>
        <attribute name="debug"
default="${javac.debug}"/>
        <element name="customize" optional="true"/>
        <sequential>
            <javac srcdir="@{srcdir}"
destdir="@{destdir}" debug="@{debug}"
deprecation="${javac.deprecation}"
source="${javac.source}" target="${javac.target}"
includeantruntime="false">
                <classpath>
                    <path path="@{classpath}"/>
                </classpath>
                <compilerarg compiler="javac1.5"
value="-Xlint:unchecked"/> <!-- *ADDED* -->
                <customize/>
            </javac>
        </sequential>
    </macrodef>
</target>

I get the real messages:

Compiling 1 source file to
/tmp/testantlogging/build/classes
/tmp/testantlogging/src/testantlogging/Main.java:63:
warning: [unchecked] unchecked call to addFirst(E)
as a member of the raw type java.util.LinkedList
        stack.addFirst(name);
                      ^
/tmp/testantlogging/src/testantlogging/Main.java:86:
warning: [unchecked] unchecked call to addFirst(E)
as a member of the raw type java.util.LinkedList
        stack.addFirst(name);
                      ^
2 warnings

Frankly I have no idea what these warnings mean,
but presumably they could be important to someone
more experienced with generics. :-) If I declare
the generic type of my LinkedList in JDK 1.5
semantics, then the warnings go away (to be
replaced with many background parser errors
because our trunk javac does not grok generics!).

Anyway, seems like something we might want to turn
on by default for 1.5 users, as a complement to
-deprecation (which is apparently now an alias for
-Xlint:deprecation??), since it is not obvious how
to do the right build.xml edit.

Or we could wait for more direct support for such
flags in Ant (with proper cross-compiler support).
Comment 1 Jesse Glick 2004-07-20 19:03:43 UTC
*** Issue 46314 has been marked as a duplicate of this issue. ***
Comment 2 tboerkel 2004-07-21 11:31:05 UTC
This should be an option in the UI, just like deprecation warnings on/off.
Comment 3 tboerkel 2004-07-21 11:38:50 UTC
IMHO, this has to be done for NB 4.0.
Comment 4 Jesse Glick 2004-07-21 18:58:16 UTC
Sorry, I think it is too late to be changing the UI for 4.0; we are
well past UI freeze. Will certainly be considered for 4.1 however.
Comment 5 tboerkel 2004-07-21 21:11:13 UTC
Then it should be documented how to turn it on in build.xml.
Comment 6 Jesse Glick 2004-07-21 22:00:49 UTC
That's why I added RELNOTE, for the docs team. There are a lot of
things we intend to make available in the online help, the knowledge
base, etc. Documentation is still in progress and will not be complete
until the release.

BTW there are already comments in the default build.xml noting various
targets you may wish to override. The exact syntax in Ant should be
covered in the Ant manual.
Comment 7 Jesse Glick 2004-08-24 15:30:42 UTC
Covered by issue #46995. No GUI for nonstandard (-X) options.

*** This issue has been marked as a duplicate of 46995 ***