Bug 28557 - Deprecation is not checked when subclassing a deprecated member type
Summary: Deprecation is not checked when subclassing a deprecated member type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-17 15:33 EST by Olivier Thomann CLA
Modified: 2003-02-07 11:11 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2002-12-17 15:33:10 EST
Using 1216, we don't report a deprecation warning in this case:
1) Compile this code:
[
public class X {
	/** 
	 * @deprecated
	 */    
	public static class Y {
	}
}
]

2) delete the source X.java
3) compile this class putting the previous .class file on the classpath:
class A extends X.Y {
}

We don't report any deprecation warning, but we do if you move the javadoc
comment on the top level class.
Comment 1 Philipe Mulet CLA 2002-12-17 17:12:04 EST
Seems like the AccDeprecated flag isn't properly propagated through member 
types.
Comment 2 Olivier Thomann CLA 2003-01-06 09:28:45 EST
X$Y is tagged as deprecated. The problem seems to be the detection of the usage
of deprecated classes when the class is a member type.
Comment 3 Olivier Thomann CLA 2003-01-06 09:37:59 EST
The bug came from the getModifiers() method on ClassFileReader. If the classfile
reader had a inner info (it is an inner class) the modifiers were the inner
infos modifiers and not the access flags. The AccDeprecated flag was contained
only in the access flags value and not in the inner attribute.
Comment 4 Olivier Thomann CLA 2003-01-06 09:43:00 EST
This method should be changed for:
public int getModifiers() {
	if (this.innerInfo != null) {
		if ((this.accessFlags & AccDeprecated) != 0) {
			return this.innerInfo.getModifiers() | AccDeprecated;
		} else {
			return this.innerInfo.getModifiers();
		}
	}
	return this.accessFlags;
}

This fixes the problem.
Comment 5 Olivier Thomann CLA 2003-01-06 10:18:56 EST
Fixed and released in 2.1 stream.
Regression test added.
Comment 6 David Audel CLA 2003-02-07 11:11:36 EST
Verified.