CDV ❯ Errors when compiling under Eclipse 3.5
-
Bug
-
Status: Open
-
2 Major
-
Resolution:
-
-
-
prodmgmt
-
Reporter: wharley
-
May 18, 2009
-
0
-
Watchers: 1
-
March 19, 2010
-
Description
Eclipse 3.5 is in release candidate mode, due to ship in June. It seems that its unreachable-reference detection has been improved since 3.4, which means some of our formerly warning-free code now has warnings (which we treat as errors). For instance, private inner classes that expose public methods that are not used in the outer class will now trigger a “method not used” error where in 3.4 they wouldn’t have:
public class Outer {
private static class Inner {
public void foo() {} // CAUSES A WARNING IN 3.5
}
public static void main(String[] args) {
Inner i = null;
if (i == null) {
System.out.println("Who uses foo()?");
}
}
}
We have a few hundred errors, in trunk. Unfortunately there tends to be a ripple effect from cleaning stuff like this up (e.g., if you remove an unused getter, then you’ve got an unread private field; if you remove the field, you need to change the constructor, so you need to change the code that calls the constructor, etc.). Something might be legitimately needed (e.g., for reflective access), in which case you can use @SuppressWarnings(“unused”), but it’s hard to know without spending some time with the code.
So I’m not sure if we want to:
-
Punt till post-Rivera. But Rivera is the code we’re going to be maintaining in the field for the next year, so it would be nice to have it compile without errors in Eclipse.
-
Fix the code now. Some otherwise-unneeded code churn, and there’s never a great time for that.
-
Set the Eclipse compiler warning properties so that unused declarations are ignored. Yuck.
I don’t have a strong opinion on it, just figured I’d mention it.