| Summary: | [1.5][compiler] Enclosing instance used despite wrong type arguments | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Matt McCutchen <hashproduct+eclipse> |
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
Srikanth, please follow up. Thanks! This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: I20100608-0911 class OuterClassClash { static class Outer<T> { final T field; Outer(T val) { field = val; } class Inner { T get() { return field; } } } static class SubOuter extends Outer<Integer> { SubOuter(Integer val) { super(val); } class SubInner extends Outer<String>.Inner { /* Expected: "No enclosing instance of type Outer<String> is * accessible to invoke the super constructor..." * Actual: The Outer<Integer> enclosing instance is used, breaking * type safety. */ SubInner() {} } } public static void main(String[] args) { Outer<String>.Inner obj = new SubOuter(42).new SubInner(); String str = obj.get(); // ClassCastException } } The same bug exists in javac: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6886402 I ran across that bug entry and decided to test Eclipse. Reproducible: Always Steps to Reproduce: 1. Compile and run the given code.