Community
Participate
Working Groups
I20071113-0800 In some cases I get a problem reported for unnecessary declaration of checked warning even though it is documented in Javadoc. It normally works but not all the time. Test Case: 1. checkout org.eclipse.ui.tests and org.eclipse.ui.tests.harness 2. open org.eclipse.ui.tests.ide.api.FileEditorInputTest ==> correct warning on FileEditorInputTest.OtherFileEditorInput.getStorage() 3. use quick fix to document it 4. save ==> warning still there
>unnecessary declaration of checked warning Should read: unnecessary declaration of thrown checked exception
Reproduced. The key to get the erroneous behavior seems to be the use of the 'Check overriding and implementing methods' flag. If it's off, the warning disappears (as long as we set the 'Ignore exceptions documented with...' flag). Also noticed that the class was not extended in my workspace, but this may be irrelevant to the case. Will check the expected meaning of the options as documented and comment again here.
While the doc is not 100% clear (I'll realign it a bit), the header for the overriding option reads 'Reporting Unused Declared Thrown Exception in Overriding Method' strongly suggests that it only impacts overriding methods. In the considered case, since getStorage does not override any other method, the option should be irrelevant to the observed behavior.
I'll take former comments back. While getStorage is not overriding per se, it is implementing IStorageEditorInput#getStorage. Consequently, when 'Check overriding and implementing methods' is off, we do not check, and the warning disappears. When the flag is on, then for the @throws of the javadoc to clear the warning, we need the project to process javadocs, which is not the case here because 'Process Javadoc comments' is unchecked for the considered project. As a net effect, the javadoc is simply ignored and does not clear the warning. Working as designed. Closing as INVALID.
Got it now. We never turn the Javadoc stuff off but obviously Platform UI did in their test projects (I've corrected that now). Martin will remove the quick fix in this scenario. Disabling the doc-related stuff on the Errors/Warnings preference page would be nice but the user would probably not grasp why.
Released a slight change to JavaCore#getDefaultOptions javadoc to make the meaning of unusedDeclaredThrownExceptionWhenOverriding clearer.
Verified for 3.4M4 using build I20071210-1800.