Bug 101283 - [1.5][javadoc] Javadoc validation raises missing implementation in compiler
Summary: [1.5][javadoc] Javadoc validation raises missing implementation in compiler
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 109108 (view as bug list)
Depends on:
Blocks: 102735
  Show dependency tree
 
Reported: 2005-06-22 12:13 EDT by Philipe Mulet CLA
Modified: 2005-09-26 10:51 EDT (History)
3 users (show)

See Also:


Attachments
Patch to fix this issue (3.27 KB, patch)
2005-06-22 18:41 EDT, Frederic Fusier CLA
no flags Details | Diff
Complete patch to fix this issue (10.07 KB, patch)
2005-07-06 11:59 EDT, Frederic Fusier CLA
no flags Details | Diff
Added tests in JavadocTest_1_? classes (21.69 KB, patch)
2005-07-06 12:00 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2005-06-22 12:13:31 EDT
Build 3.1rc3

The following code causes compiler to reject it due to missing some support for it:

package foo;

public class ListenerSupport<T, F> {

	/**
	 * @param <T>
	 * @param <F>
	 */
	class Entry<L, R> {
		// empty
	}
}
Comment 1 Philipe Mulet CLA 2005-06-22 12:16:04 EDT
Also see bug 29144#c6 for original reported issue.
Comment 2 Philipe Mulet CLA 2005-06-22 12:23:00 EDT
Offending code path is:
org.eclipse.jdt.internal.compiler.problem.ProblemReporter.needImplementation(ProblemReporter.java:3988)
	at
org.eclipse.jdt.internal.compiler.problem.ProblemReporter.javadocInvalidType(ProblemReporter.java:3650)
	at
org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference.reportInvalidType(JavadocSingleTypeReference.java:30)
	at
org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference.internalResolveType(JavadocSingleTypeReference.java:66)
	at
org.eclipse.jdt.internal.compiler.ast.Javadoc.resolveTypeParameterTags(Javadoc.java:400)
	at org.eclipse.jdt.internal.compiler.ast.Javadoc.resolve(Javadoc.java:86)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1069)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1105)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:996)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1112)
	at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:305)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:560)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:599)
	at
org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:165)
	at
org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:214)
	at
org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:79)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:718)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:777)
	at
org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1081)
	at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:98)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
	at org.eclipse.core.runtime.Platform.run(Platform.java:783)
	at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82)
	at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:147)
	at
org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
	at
org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:94)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75)
	at org.eclipse.jdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:339)
	at
org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)
Comment 3 Philipe Mulet CLA 2005-06-22 12:23:37 EDT
Not I needed to use full test case to reproduce (see bug 29144).
Comment 4 Philipe Mulet CLA 2005-06-22 12:25:55 EDT
Problem occurs on Javadoc ref to 'T' at position 445.
Comment 5 Philipe Mulet CLA 2005-06-22 12:27:56 EDT
The offending problem reference binding ID is NonStaticReferenceInStaticContext.
Comment 6 Philipe Mulet CLA 2005-06-22 12:33:44 EDT
Reduced testcase is actually:

public class X<T, F> {

	/**
	 * @param <T>
	 * @param <F>
	 */
	static class Entry<L, R> {
		// empty
	}
}
Comment 7 Philipe Mulet CLA 2005-06-22 12:34:54 EDT
Problem comes from the fact the reference to type variables occurs from within
static context.

Does javadoc allow it ?
Comment 8 Philipe Mulet CLA 2005-06-22 12:38:42 EDT
It feels like when doc single type ref fails locally, it should recurse in
enclosing type, as it does for doc message sends; to step away from static context.
Comment 9 Frederic Fusier CLA 2005-06-22 18:31:08 EDT
comment 7: no javadoc does not allow this kind of reference.
On comment 6 sample, javadoc raises 2 warnings:
warning - @param argument "<T>" is not a type parameter name.
warning - @param argument "<F>" is not a type parameter name.
Comment 10 Philipe Mulet CLA 2005-06-22 18:33:18 EDT
Good candidate for 3.1.1
Comment 11 Frederic Fusier CLA 2005-06-22 18:41:26 EDT
Created attachment 23791 [details]
Patch to fix this issue

Add a specific javadoc message to handle this specific error:
"Javadoc: Cannot make a static reference to the non-static type variable {0}"
Comment 12 Frederic Fusier CLA 2005-07-05 11:45:31 EDT
*** Bug 102735 has been marked as a duplicate of this bug. ***
Comment 13 Frederic Fusier CLA 2005-07-06 11:59:51 EDT
Created attachment 24384 [details]
Complete patch to fix this issue

It was not enough just to add specific message for 2 reasons:
1) for @param tag with incorrect tag, we do prefer warn about wrong param name
rather than non-static reference in static context
2) javadoc.exe consider reference to enclosing type type variables as invalid,
so we have to behave the same way.
Comment 14 Frederic Fusier CLA 2005-07-06 12:00:32 EDT
Created attachment 24385 [details]
Added tests in JavadocTest_1_? classes
Comment 15 Garret Wilson CLA 2005-07-06 12:07:28 EDT
I reported https://bugs.eclipse.org/bugs/show_bug.cgi?id=102735 , later marked
as a duplicate of this bug. I'm not yet completely sure these are the same bugs,
so I wanted to make sure:

* Does the new patch fix the bug in which auto-completion of JavaDoc variables
will incorrectly use the generic variable of the enclosing type rather than of
the enclosed type?

* Does the new patch fix the bug that, when the JavaDoc reference correctly
refers to the generic variable of the enclosed type, the JavaDoc reference is
shown with a yellow underline warning?

Cheers,

Garret
Comment 16 Frederic Fusier CLA 2005-07-06 12:17:38 EDT
Patch released in R3_1_maintenance stream.

[jdt-core internal]
All JDT/Core and JDT/UI tests pass.
Comment 17 Frederic Fusier CLA 2005-07-06 12:21:05 EDT
According to bug 102735 summary this was a real duplicate...
However, it seems real issue was more about code completion in javadoc so I will
change this summary and reassign it to correct component...
Comment 18 Olivier Thomann CLA 2005-08-09 10:30:01 EDT
Verified in 3.2M1 (I20050808-2000)
Comment 19 Frederic Fusier CLA 2005-09-09 03:32:18 EDT
*** Bug 109108 has been marked as a duplicate of this bug. ***
Comment 20 Maxime Daniel CLA 2005-09-26 10:32:24 EDT
Verified for 3.1.1 using build M20050923-1430.