| Summary: | Eclipse compiler resolves typename from superclass instead of template type | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Bence Sipka <sipkab> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sasikanth.bharadwaj |
| Version: | 4.7.1a | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| Whiteboard: | stalebug | ||
Same behavior as far back as 4.4.1. I have a change that will change the behavior, but need to find the reference in JLS that dictates behavior in this situation before proceeding with that 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. |
When a type name is referenced in the body if a class, the Eclipse compiler resolves it against the superclass' appropriate type instead of the type parameter present on the class declaration. Given the following example: package test; class SuperClass { class InnerClass { } } public class Test<InnerClass> extends SuperClass { InnerClass ic = new InnerClass(); } Javac reports an error on the new InnerClass() expression. This code compiles fine with the Eclipse Compiler for Java, although it shouldn't. The example requires that the superclass has an inner class with the same name as the type parameter.