Bug 209824 - [compiler] Sometimes wrong problem reported for unnecessary declaration of thrown checked exception
Summary: [compiler] Sometimes wrong problem reported for unnecessary declaration of th...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-14 10:44 EST by Dani Megert CLA
Modified: 2007-12-11 07:03 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2007-11-14 10:44:27 EST
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
Comment 1 Dani Megert CLA 2007-11-15 05:19:09 EST
>unnecessary declaration of checked warning
Should read: unnecessary declaration of thrown checked exception
Comment 2 Maxime Daniel CLA 2007-11-19 03:37:09 EST
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.
Comment 3 Maxime Daniel CLA 2007-11-19 03:50:46 EST
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.
Comment 4 Maxime Daniel CLA 2007-11-19 05:15:24 EST
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.
Comment 5 Dani Megert CLA 2007-11-19 05:48:31 EST
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.
Comment 6 Maxime Daniel CLA 2007-11-19 07:10:55 EST
Released a slight change to JavaCore#getDefaultOptions javadoc to make the meaning of unusedDeclaredThrownExceptionWhenOverriding clearer.
Comment 7 David Audel CLA 2007-12-11 07:03:51 EST
Verified for 3.4M4 using build I20071210-1800.