Bug 300031 - The deprecation warning for a type should not include the package name
Summary: The deprecation warning for a type should not include the package name
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 169995 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-19 04:50 EST by Dani Megert CLA
Modified: 2010-03-19 05:38 EDT (History)
2 users (show)

See Also:
Olivier_Thomann: review+


Attachments
proposed fix v1.0 + regression tests (40.58 KB, patch)
2010-03-17 05:24 EDT, Ayushman Jain CLA
Olivier_Thomann: iplog+
Details | Diff
Same patch with copyright updates (41.29 KB, patch)
2010-03-18 12:25 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-01-19 04:50:29 EST
I20100112-0800.

The deprecation warning for a type should not include the package name.

Test Case:
1. paste the following snippet into the Package Explorer.

package a.b.c.d;

/** @deprecated */
public class Deprecated {

}
package a.b.c.d;

public class T {

	a.b.c.d.Deprecated f;
	
}

==> the deprecation warning covers "a.b.c.d.Deprecated" but should only cover the type name ("Deprecated") since the package itself is not deprecated. This is similar to deprecated methods where we also only mark the method as deprecated.

See also bug 169995.
Comment 1 Srikanth Sankaran CLA 2010-01-19 04:58:07 EST
Ayush, can you please take a look ? This sounds similar to
some of your recent fixes, Thanks!
Comment 2 Ayushman Jain CLA 2010-03-17 05:24:22 EDT
Created attachment 162250 [details]
proposed fix v1.0 + regression tests

The above patch takes care of not just the warning marker for types, but also for method and constructor invocations. The changes in ProblemReporter pertain to setting the starting point of the marker to the correct location. 
Also, QualifiedTypeReference#getTypeBinding(Scope) had an erroneous checking condition 'i<last' which is changed here to 'i<=last'. This method is called in TypeReference#internalResolveType on line 131. The getTypeBinding already checks for deprecation so there's no need to double check for deprecation after its call on line TypeReference.java:131 - which was being done on TypeReference.java:148. The same duplication of checkin for deprecation is avoided by the change on JavadocQualifiedTypeRef:59.

As a side effect, some new "The type * is never used locally" warnings have come out. This is because the method for checking deprecation - QualifiedTypeRef#isTypeUseDeprecated affects the AccLocallyUsed bit and due to the erroneous i<last condition in getTypeBinding, the isTypeUseDeprecated was not being called in some cases.

This also addresses bug 169995.
Comment 3 Ayushman Jain CLA 2010-03-17 05:28:05 EDT
Olivier, since you worked on bug 132677, which was a close relative of this one, I guess it'd be best if you reviewed the changes here. Thanks!
Comment 4 Olivier Thomann CLA 2010-03-17 20:47:43 EDT
Looks good.
Comment 5 Olivier Thomann CLA 2010-03-18 12:25:36 EDT
Created attachment 162429 [details]
Same patch with copyright updates
Comment 6 Olivier Thomann CLA 2010-03-18 12:26:15 EDT
Released for 3.6M7.
Updated existing regression tests.
Comment 7 Ayushman Jain CLA 2010-03-18 14:04:53 EDT
I think this should be marked as a dup of bug 169995
Comment 8 Olivier Thomann CLA 2010-03-18 14:08:57 EDT
*** Bug 169995 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2010-03-19 05:38:32 EDT
Verified in HEAD.