Bug 55039 - Unused imports not found when there is a reference in javadoc
Summary: Unused imports not found when there is a reference in javadoc
Status: RESOLVED DUPLICATE of bug 55478
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-16 17:21 EST by DJ Houghton CLA
Modified: 2004-04-15 10:19 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2004-03-16 17:21:06 EST
build i0316:1300

Interesting scenerio. I have unused imports set to show as a compiler warning. I
have a class loaded in my workspace and I have no warnings. But there are
warnings in the log for today's integration build.

Looking at the class further, there are no code references but there is a
reference in the javadoc. When I delete the javadoc reference, the warning
appears that my import is unused.

org.eclipse.core.resources.ResourcesPlugin (v20040316a)
Comment 1 DJ Houghton CLA 2004-03-16 17:24:51 EST
Note that hitting ctrl-shift-o to organize imports brings the import statement
back into the file.
Comment 2 Olivier Thomann CLA 2004-03-24 11:57:02 EST
I thought this was fixed with bug 52264.
Comment 3 Frederic Fusier CLA 2004-03-24 16:41:13 EST
Questions about your test case: 
1) have you Javadoc global option activated in your workspace or on the project 
of the offending class?
2) did you hit Ctrl-Shift-O to organize import after having removed the 
reference in javadoc or before?
Comment 4 DJ Houghton CLA 2004-03-24 16:59:27 EST
Where is this Global javadoc option? I didn't set anything so I would presume
that it would be the default value.

I did ctrl-shift-o both before and after removing the reference in the javadoc.
When I removed the reference the organize import was fine.
Comment 5 Frederic Fusier CLA 2004-03-29 06:29:27 EST
The javadoc global option is on Preference->Java->Compiler->Javadoc tab.
If this option is not set then you only have one check-bock ("Process Javadoc 
comments") to set on this compiler tab.
Otherwise, if the check-box is checked, then you have access to other Javadoc 
options on this tab:
- Malformed Javadoc comments
- Missing Javadoc tags
- Missing Javadoc comments

My assumption is that this global option is set in your workspace. This would 
explain why you have no warnings in your workspace: when this option is set, 
javadoc comments are parsed, so reference to your class is seen, then the 
import is used :)

But during the integration the global is not set, so the javadoc is not parsed, 
the reference is not seen, then the import is not used...

This problem was noticed by bug 55478 and fixed. So, could you please change 
your ant script to include new Main compiler option (-enableJavadoc) to enable 
javadoc option during your build and let me know if it fixes this issue?
Comment 6 DJ Houghton CLA 2004-03-30 12:22:52 EST
Adding Sonia to the CC list for comment.

Recommend that we add the "-enableJavadoc" command-line compiler arg to the
build process.
Comment 7 Sonia Dimitrov CLA 2004-03-31 11:12:01 EST
The N20040331 build ran with this flag.  Any way to verify that it had the 
desired effect from the compile logs?
Comment 8 Frederic Fusier CLA 2004-04-02 12:32:22 EST
DJ,
could oyu let me know if this problem is fixed with the proposed solution?
thx
Comment 9 DJ Houghton CLA 2004-04-02 13:07:13 EST
I've changed org.eclipse.core.resources.ResourcesPlugin to use the short names
in the javadoc and add the import statements. I released this to HEAD so we can
check the results in the next nightly build.
Comment 10 DJ Houghton CLA 2004-04-13 12:18:03 EDT
The unused imports are still listed as problems with build i0413:1110.
Comment 11 Sonia Dimitrov CLA 2004-04-14 16:30:09 EDT
Patch received, to verify in the N20040415 build (compilerArg set to -
enableJavadoc in our outermost script).
Comment 12 Frederic Fusier CLA 2004-04-15 06:35:43 EDT
DJ,
It seems to be fixed as I didn't see any compiler warning for resources 
component :)
Do you agree if I close this bug as duplicate of bug 55478?

Sonia,
I think this option should be also set for jdt-core projects:
 - org.eclipse.jdt.core
 - org.eclipse.jdt.core.tests.compiler
 - org.eclipse.jdt.core.tests.model
 - org.eclipse.jdt.core.tests.builder
I've seen in N20040415 results that jdt.core.tests.model has similar errors
which will be fixed when this option will be set.
TIA
Comment 13 Frederic Fusier CLA 2004-04-15 07:36:13 EDT
Sonia,

Sorry, the warnings in org.eclipse.jdt.core.tests.model project were not due to 
missing -enableJavadoc option, they were "real" unused imports and I've fixed 
them...
Comment 14 DJ Houghton CLA 2004-04-15 08:36:33 EDT
yes, this can be marked as fixed or a dup.
Comment 15 Frederic Fusier CLA 2004-04-15 10:19:31 EDT

*** This bug has been marked as a duplicate of 55478 ***