Bug 292510

Summary: FUP of 292364: Error messages don't identify partial types precisely.
Product: [Eclipse Project] JDT Reporter: Srikanth Sankaran <srikanth_sankaran>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, srikanth_sankaran
Version: 3.5Flags: Olivier_Thomann: review+
Target Milestone: 3.6 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed fix v0.5 + regression tests
none
proposed fix with correction + regression tests Olivier_Thomann: iplog+

Description Srikanth Sankaran CLA 2009-10-16 06:24:33 EDT
HEAD.

org.eclipse.jdt.core.tests.compiler.regression.Deprecated15Test.test002()
org.eclipse.jdt.core.tests.compiler.regression.DeprecatedTest.test015()
org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test1347()

are some tests that show that when the compiler wants to report that type
X is deprecated in a type reference of the form:

   X.Inner.InnerMost

We actually identify the full type reference.

i.e instead of saying 

   X.Inner.InnerMost
   ^

we end up saying

   X.Inner.InnerMost
   ^^^^^^^^^^^^^^^^^

See the patch attached to bug#292364 comment#4 for a proposed fix.
(the portions relevant to bug#292364 itself should be ignored)

Also see comment#6 for a test patch that shows the outstanding
issues with that patch. Since this issue of type highlighting is
orthogonal to the original issue bug#292364 intended to address,
it is being spwaned off as a separe issue.

Ayush, please start with the patch in bug#292364 comment#4 and address
concerns raised by bug#292364 comment#6.
Comment 1 Srikanth Sankaran CLA 2009-10-16 06:28:14 EDT
Ayush, please investigate - Thanks!
Comment 2 Ayushman Jain CLA 2009-10-29 06:39:43 EDT
Created attachment 150810 [details]
proposed fix v0.5 + regression tests

a few changes have been carried over from the patch in https://bugs.eclipse.org/bugs/show_bug.cgi?id=292364#c4. These changes fix the problem in the case of deprecated type error reporting. To fix the javadoc side of the same problem, the method ProblemReporter#javadocDeprecatedType is fixed. Regarding the problems reported in comment 6 of bug 292364: 

>- Sometimes instead of reporting IProblem.JavadocUsingDeprecatedType,
>     we incorrectly report IProblem.UsingDeprecatedType

Fixed.

> -IProblem.JavadocUsingDeprecatedType reporting continues to fail to
>     demarcate partial types in messages.

ProblemReporter#javadocDeprecatedType fixed. Added regression test JavadocBugsTest.testBug292510().

>-We also need to inspect the code to see if there are other places
>     we should be using nodeSourceEnd(null, location), instead of
>     location.sourceEnd 

Fixed :
a)ProblemReporter#staticMemberOfParameterizedType
   - GenericTypeTest.test0290(), GenericTypeTest.test0755() remastered to  reflect changes.
b)ProblemReporter#incorrectArityForParameterizedType
   - GenericTypeTest.test1457() remastered to reflect changes.
c)ProblemReporter#parameterizedMemberTypeMissingArguments
   - GenericTypeTest.test0289() remastered to reflect the change.
Comment 3 Olivier Thomann CLA 2009-10-29 13:24:35 EDT
I don't understand why a modifier is used as an index in:
ProblemReporter#public void javadocDeprecatedType(TypeBinding type, ASTNode location, int modifiers) {
I believe we should pass a new int argument that would be the index and keep the modifiers as before.
Could you please clarify that point, Ayushman ?
Thanks.
Comment 4 Ayushman Jain CLA 2009-10-29 14:28:20 EDT
Created attachment 150858 [details]
proposed fix with correction + regression tests

oops! my bad. I passed the index in the modifiers argument. Corrected the fix and created a new method with an added argument.
Comment 5 Olivier Thomann CLA 2009-11-02 15:26:28 EST
I'll release the latest patch as soon as all tests are run.
Comment 6 Olivier Thomann CLA 2009-11-03 10:12:07 EST
Released for 3.6M4.
Regression tests have been updated.

Thanks, Ayushman.
Comment 7 Srikanth Sankaran CLA 2009-12-08 01:43:39 EST
Verified for 3.6M4 using Build id: I20091207-1800