Community
Participate
Working Groups
Java Compiler > Unused Code > Unnecessary declaration of thrown checked exception > Check overriding The checkbox seems to behave just the wrong way
Works for me. If the check option is enabled, then overriding/implementing methods are checked as well, if not, they are ignored.
I think, I got the option's sense wrong. But now, another option is missing to me. I thought that the 'Check overriding' option would be what I am missing now. Please look at the following two classes ClassA and ClassB: public class ClassA { protected void foo() throws IOException {} } public class ClassB extends ClassA { protected void foo() throws IOException { throw new IOException(); } } foo() in ClassA needs to have the 'throws' clause because foo() in ClassB has a 'throws' clause and ClassB extends ClassA. Thus, the 'throws' clause in ClassA is NOT unnecessary and no warning or error should be shown. There could be an option for this - the one I said I was missing.
See bug 44876#c2 for explanation of current behavior.