| Summary: | [move member type] Move Type to New File creates compile error with parametrized outer type | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | raksha.vasisht | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7 M5 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Raksha, please have a look. (In reply to comment #1) > Raksha, please have a look. I'm not able to reproduce the compile error with I20110114-1330. After refactoring I see the following Outer and Inner classes without any compile errors during or after refactoring: Inner.java -------------- class Inner { //Move Type to New File /** * */ private final Outer outer; /** * @param outer */ Inner(Outer outer) { this.outer = outer; } void foo() { System.out.println(this.outer.fSet[0]); // broken // System.out.println(fSet); // OK } } Outer.java --------------- public class Outer { final Object[] fSet= new Object[1]; } Am I missing something? Created attachment 186975 [details]
fix & test
Sorry, I reduced this out of a much more complicated example, and I must have gotten something wrong. The problem is not an array access, but a parameterized outer type. The refactoring does not force me to specify a field for the enclosing instance.
package pack;
public class Outer<E> {
private final Object fSet= new Object();
class Inner { //Move Type to New File
void foo() {
System.out.println(fSet); // fSet needs outer field
}
}
}
Fixed in HEAD. |
HEAD The 'Move Type to New File' refactoring creates a compile error when the member type contains an array access expression: public class Outer { private final Object[] fSet= new Object[1]; class Inner { //Move Type to New File void foo() { System.out.println(fSet[0]); // broken // System.out.println(fSet); // OK } } }