Project: JDT
Bug 95401 [refactoring] [inline] Inlining method of generic class gives illegal result.
Reported: 2005-05-16 13:13:59 | Status: verified fixed

--------------------- BEFORE -------------------------- class Bug { class Model<Row extends java.util.List> { Row getObjectAtRow(){ return new java.util.HashSet<Row>().iterator().next(); } } class UI<Clazz extends java.util.ArrayList>{ public final Clazz[] getBeginAndEndSelections() { return (Clazz[])java.lang.reflect.Array.newInstance (tableModel_.getObjectAtRow().getClass(),1); } } Model<java.util.ArrayList> tableModel_; void foo(){ new UI<java.util.ArrayList>().getBeginAndEndSelections(); } } ------------------------- AFTER ------------------------------------- class Bug { class Model<Row extends java.util.List> { Row getObjectAtRow(){ return new java.util.HashSet<Row>().iterator().next(); } } class UI<Clazz extends java.util.ArrayList>{ } Model<java.util.ArrayList> tableModel_; void foo(){ Clazz[] getBeginAndEndSelections = (ArrayList[]) java.lang.reflect.Array.newInstance(new UI<java.util.ArrayList> ().tableModel_.getObjectAtRow().getClass(),1); // COMPILE ERROR! } }

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/generic_in/TestParameterizedType3.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/generic_out/TestParameterizedType3.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java