Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13383
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to turn off those warning messages during ant build? |
| Date | 2012-04-04 10:54 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <14865168.2734.1333562096706.JavaMail.geo-discussion-forums@pbje9> (permalink) |
| References | <32649009.2052.1333546152596.JavaMail.geo-discussion-forums@vbsf4> |
zyng wrote:
> When I run ant, a lot of warnings are printed out on the screen. It is very daunting. It makes
The warnings you cite are due to errors in your coding.
> new people to feel, as first response, this is broken. But actually, the build is successful.
> I pasted a few warning messages below. In our real code, there are hundreds of them.
>
> [javac] /abc/efg/MyTools.java:125: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
> [javac] recursiveDirectoriesToBuild.add(workingDir);
Don't use raw types!
That's an invitation to runtime bugs. Generics are there to pull these bugs back to compilation time, thus making them four to sixteen times cheaper to fix than if they were runtime bugs.
Do not use raw types.
> [javac] ^
> [javac] /abc/efg/MyTools.java:212: warning: [unchecked] unchecked call to Vector(java.util.Collection<? extends E>) as a member of the raw type java.util.Vector
> [javac] return new Vector(v2);
Why are you using 'java.util.Vector' instead of, say, 'java.util.ArrayList'?
> ....
>
> I know one solution, the basic solution, is to going to the code and use Java Annotation
> feature to add "Ignore Warning etc" at those places.
That's not a solution!
That hides the problem without fixing it. There are rules to using '@SuppressWarnings("unchecked")'. You don't just use the annotation to hide problems.
> But there are so many places and the code were written by different people.
This is called "technical debt", and it is an issue.
> We don't want to modify the code! I am wondering if ant has a feature to turn off the warning messages.
'javac' does. That's more relevant because Ant isn't the one issuing the warnings.
"-Xlint:-rawtypes"
This is bad because it hides the problem without fixing it.
You should familiarize yourself with the Java tools.
http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html#xlintwarnings
>
> This is my ant script to build:
> <target name="compile" depends="prepare">
> <javac srcdir="${src.dir}" destdir="${build.dir}" compiler="modern" fork="yes" debug="on">
> <classpath refid="project.classpath"/>
> <compilerarg value="-Xlint"/>
"-Xlint:what"?
All you do with that option is: "Enable all recommended warnings. In this release, enabling all available warnings is recommended."
As mentioned in the documentation for "javac", which you should study.
> </javac>
> </target>
>
> To be honest, I do not know the feature "-Xlint" etc.
To be honest, shame on you.
RTFM.
--
Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to turn off those warning messages during ant build? zyng <xsli2@yahoo.com> - 2012-04-04 06:29 -0700
Re: How to turn off those warning messages during ant build? Lew <lewbloch@gmail.com> - 2012-04-04 10:54 -0700
Re: How to turn off those warning messages during ant build? Roedy Green <see_website@mindprod.com.invalid> - 2012-04-04 13:05 -0700
Re: How to turn off those warning messages during ant build? Lew <lewbloch@gmail.com> - 2012-04-04 18:24 -0700
Re: How to turn off those warning messages during ant build? Patricia Shanahan <pats@acm.org> - 2012-04-04 19:15 -0700
Re: How to turn off those warning messages during ant build? Lew <noone@lewscanon.com> - 2012-04-04 19:39 -0700
Re: How to turn off those warning messages during ant build? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-04-05 09:46 -0700
Re: How to turn off those warning messages during ant build? Lew <lewbloch@gmail.com> - 2012-04-05 11:42 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-05 19:46 -0400
Re: How to turn off those warning messages during ant build? Gene Wirchenko <genew@ocis.net> - 2012-04-05 19:35 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-12 20:27 -0400
Re: How to turn off those warning messages during ant build? Gene Wirchenko <genew@ocis.net> - 2012-04-12 19:29 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-13 21:07 -0400
Re: How to turn off those warning messages during ant build? Lew <lewbloch@gmail.com> - 2012-04-14 12:53 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-14 16:16 -0400
Re: How to turn off those warning messages during ant build? Lew <lewbloch@gmail.com> - 2012-04-14 13:37 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-14 17:29 -0400
Re: How to turn off those warning messages during ant build? Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-04-15 01:25 -0500
Re: How to turn off those warning messages during ant build? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-15 10:30 -0300
Re: How to turn off those warning messages during ant build? Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-04-15 11:16 -0500
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-05-05 20:48 -0400
Re: How to turn off those warning messages during ant build? Gene Wirchenko <genew@ocis.net> - 2012-04-15 19:54 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-05-05 20:47 -0400
Re: How to turn off those warning messages during ant build? Gene Wirchenko <genew@ocis.net> - 2012-05-07 09:31 -0700
Re: How to turn off those warning messages during ant build? Gene Wirchenko <genew@ocis.net> - 2012-04-15 19:58 -0700
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-05-05 20:50 -0400
Re: How to turn off those warning messages during ant build? Gene Wirchenko <genew@ocis.net> - 2012-05-07 09:33 -0700
Re: How to turn off those warning messages during ant build? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-04-05 22:41 -0400
Re: How to turn off those warning messages during ant build? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-06 19:53 -0300
Re: How to turn off those warning messages during ant build? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-04-06 21:35 -0400
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-12 20:33 -0400
Re: How to turn off those warning messages during ant build? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-13 21:16 -0300
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-13 21:03 -0400
Re: How to turn off those warning messages during ant build? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-13 22:51 -0300
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-05-05 20:51 -0400
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-12 20:29 -0400
Re: How to turn off those warning messages during ant build? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-04-12 21:28 -0400
Re: How to turn off those warning messages during ant build? Arne Vajhøj <arne@vajhoej.dk> - 2012-04-13 21:04 -0400
Re: How to turn off those warning messages during ant build? Patricia Shanahan <pats@acm.org> - 2012-04-05 14:04 -0700
csiph-web