| Summary: | [1.5][compiler] Static reference to outer type variable should not be allowed | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Tim Hanson <thanson> | ||||||
| Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | ||||||||
| Version: | 3.1 | ||||||||
| Target Milestone: | 3.1 RC2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 19818 [details]
Proposed patch
The proposed patch simply marks inner interfaces as static. See JLS2 8.5.2.
Created attachment 19823 [details]
Proposed Test Case
Added a test to GenericTypeTest
Thanks Tim. Without any change, we already detect:
public class X<T> {
interface Y {
java.util.List<T> lt;
}
}
The suggested fix is adding a static modifier to member interfaces which I
believe we would need to clear at some later point. Would prefer another approach.
Fixed by using isStatic() in place of bit check in Scope#getTypeOrPackage(...). Added GenericTypeTest#test713 Fixed Verified in N20050606-0010 + JDT/Core HEAD Verified with I20050610-010 |
An inner interface is implicitly static. It should not be allowed to reference an outer classes type variable. The reference to "T" in the inner interface below should be flagged as an error. class Outer<T> { interface Inner { abstract void m1(T t); } }