Project: JDT
Bug 93541 [refactoring] All extract refactorings and quick fixes fail with wildcard return type
Reported: 2005-05-03 11:06:30 | Status: verified fixed

N20050503-0010 All extract refactorings and quick fixes fail in examples with a wildcard return type: static ArrayList<? extends Number> al= new ArrayList<Integer>(); void test () { al.get(0); //<-select method invocation expression and extract } - Failing refactorings: Extract Local Variable, Extract Constant, Introduce Parameter, Extract Method - Failing Quick Assists: Assign statement to new local variable, .. to new field I think we should have one utility method with this fix, since all affected parties currently just use the import rewrite and get back a wildcard type from there. The correct declaration type for wildcards is: - the upper bound of the wildcard if it exists, - java.lang.Object otherwise

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractConstant/canExtract/A_test29_in.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractConstant/canExtract/A_test29_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractConstant/canExtract/A_test30_in.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractConstant/canExtract/A_test30_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1111.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1112.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1111.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1112.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test90_in.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test90_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test91_in.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test91_out.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameter/simple/Wildcard1.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameter/simple/Wildcard2.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameter/simple/out/Wildcard1.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameter/simple/out/Wildcard2.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractConstantTests.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractTempTests.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceParameterTests.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/infra/TextRangeUtil.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/Bindings.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractConstantRefactoring.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractTempRefactoring.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceParameterRefactoring.java