Community
Participate
Working Groups
Build Identifier: Build id: 20090621-0832 I have a type where some method declares an exception to allow derived types to throw that exception. The basic implemenation however just returns null and thus does not actually throw any exception. However, when I silence the resulting warning using a @SuppressWarning("unused") annotation then I get another warning stating "Unnecessary @SuppressWarning("unused")". The latter is probably due to the fact, that the compiler recognices, that the throws is NOT unused and hence the annotation is superfluous. I append a condensed example that shows the problem below. How do I phrase this code without getting *any* warning? Michael ----------------------------------------- package test; public class Test { @SuppressWarnings("serial") class MyException extends Exception { MyException(String msg) { super(msg); } } class A { protected Object foo(Object x) throws MyException { return null; } } class B extends A { @Override protected Object foo(Object x) throws MyException { if (x == null) throw new MyException("x is null"); return x.getClass(); } } } ----------------------------------------- Reproducible: Always
Please provide your compiler options.
Created attachment 160295 [details] screen shot of Compiler options - part 1
Created attachment 160296 [details] screen shot of Compiler options - part 2
Sorry for appending this as screenshot, but I found not way to export just the compiler flags. And an exported eclipse pref's file is not only a longish mess but also seems to contain confidential data, like code repository login ids (and credentials?), that I don't want to make public... M.
Could you please try with a newer build? I cannot reproduce with I20100224-2242. I am closing as WORKSFORME. Please reopen if you see it again with a 3.6 I-build.
Verified that it works well in 3.5.0, 3.6M5 and 3.6M6. Note that the build id you gave is not the 3.5.0 one as its ID is I20090611-1540... !?