Tagged Questions
1
vote
1answer
106 views
All warnings as errors with the Eclipse Java compiler (3.6.2)
How do I treat warnings as errors with the Eclipse Java compiler (ECJ) 3.6.2* when running from the command-line?
Newer versions (at least, 3.8.2) have the -err:all flag, however this isn't available ...
3
votes
1answer
130 views
Eclipse warning: unchecked conversion vs redundant specification of type arguments
I just recently switched from JDK1.6 to JDK 1.7.
I have this code:
SomeClass<SomeType> someVariable = new SomeClass<SomeType>(createSomeObject());
Now I'm getting a warning:
Redundant ...
0
votes
1answer
17 views
Java compiler warning for changing a method argument variable in method body
public class InsertionSort {
public static <T extends Comparable<T>> void sort(T[] array) {
for (int indexOfNextToInsert = 1; indexOfNextToInsert < array.length; ...
3
votes
1answer
89 views
False resource leak warning?
I'm getting a resource leak warnings on 's' and 'p' in this snippet. Is this warning valid?
try (StringWriter s = new StringWriter(); PrintWriter p = new PrintWriter(s)) {
...
0
votes
2answers
51 views
Eclipse warn about uncaught Error
When failing to catch a subclass of Exception, Eclipse will issue a compilation warning (red).
However, when an subclass of Error is uncaught, no warning is issued, making it easy to forget including ...
4
votes
2answers
1k views
Eclipse 4.2 resource leak through separate close method
I'm using Eclipse 4.2 with resource leak warnings enabled.
This code produces an, in my opinion false, resource leak warning.
public static void test(){
InputStream in = null;
try {
in = ...
0
votes
0answers
30 views
How do I validate javadoc to prevent useless tags
On our project, we place @author and @since javadoc tags on the classes, methods and attributes we create.
As a rule, if one is the @author of a class, there's no need for him/her to place @author ...
2
votes
2answers
405 views
How to use NonNullByDefault on a package
My compiler warns me about A default nullness annotation has not been specified for the package. I'm using Juno with Java 7.
The documentation stats you should add @NonNullByDefault as a package ...
0
votes
3answers
159 views
how to add a warning for not calling super() in Java/eclipse
I would expect subclass always call super() for some method.
How can I enforce or at least give a warning at compile time?
Thanks
1
vote
1answer
151 views
Eclipse disable warning for automatic source generation folder
I use JAXB and Maven to generate java files from xsd. Works nicely, but my project has warnings because the generate source code doesn't life up to the code style exspectations.
What is the easiest ...
7
votes
4answers
4k views
Unnecessary @SuppressWarnings(“unused”)
I'm getting a compiler warning for the @SuppressWarnings annotation in eclipse for the code:
@Override
public boolean doSomething(@SuppressWarnings("unused") String whatever) throws AnException {
...
2
votes
2answers
517 views
Java eclipse highlight missing brackets
I just can't find the option anywhere. Is there some way in eclipse to warn about stuff like this? if(a==b)continue; instead of if(a==b){continue;}
Or can maybe the format function fix this?
2
votes
1answer
275 views
Suppress Compiler Warnings in JUnit Tests
When testing public constructor calls the JUnit tests in my application produce temporary objects that are never used anywhere within the test methods. The compiler subsequently complains about unused ...
0
votes
1answer
115 views
Eclipse compiler error/warnings preferences
I've been wondering if there is such a thing as an optimal compiler error/warning configuration to "force" your code to be less bug prone.
I know many people tweak those configurations for their ...
4
votes
5answers
1k views
Only show warnings from some folders in eclipse
I am working in a larger Java codebase in eclipse, which currently issues around 7000 warnings. However I am working in rather isolated parts, in a few specific source folders and namespaces. I would ...