|
Link Here
|
| 11 |
* Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 |
11 |
* Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 |
| 12 |
* Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] should declare method static if extracted from anonymous in static method - https://bugs.eclipse.org/bugs/show_bug.cgi?id=152004 |
12 |
* Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] should declare method static if extracted from anonymous in static method - https://bugs.eclipse.org/bugs/show_bug.cgi?id=152004 |
| 13 |
* Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracted method should be declared static if extracted expression is also used in another static method https://bugs.eclipse.org/bugs/show_bug.cgi?id=393098 |
13 |
* Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracted method should be declared static if extracted expression is also used in another static method https://bugs.eclipse.org/bugs/show_bug.cgi?id=393098 |
|
|
14 |
* Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracting expression of parameterized type that is passed as argument to this constructor yields compilation error https://bugs.eclipse.org/bugs/show_bug.cgi?id=394030 |
| 14 |
*******************************************************************************/ |
15 |
*******************************************************************************/ |
| 15 |
package org.eclipse.jdt.internal.corext.refactoring.code; |
16 |
package org.eclipse.jdt.internal.corext.refactoring.code; |
| 16 |
|
17 |
|
|
Link Here
|
| 1002 |
} |
1003 |
} |
| 1003 |
} |
1004 |
} |
| 1004 |
|
1005 |
|
| 1005 |
ITypeBinding[] typeVariables= computeLocalTypeVariables(); |
1006 |
ITypeBinding[] typeVariables= computeLocalTypeVariables(modifiers); |
| 1006 |
List<TypeParameter> typeParameters= result.typeParameters(); |
1007 |
List<TypeParameter> typeParameters= result.typeParameters(); |
| 1007 |
for (int i= 0; i < typeVariables.length; i++) { |
1008 |
for (int i= 0; i < typeVariables.length; i++) { |
| 1008 |
TypeParameter parameter= fAST.newTypeParameter(); |
1009 |
TypeParameter parameter= fAST.newTypeParameter(); |
|
Link Here
|
| 1041 |
return result; |
1042 |
return result; |
| 1042 |
} |
1043 |
} |
| 1043 |
|
1044 |
|
| 1044 |
private ITypeBinding[] computeLocalTypeVariables() { |
1045 |
private ITypeBinding[] computeLocalTypeVariables(int modifier) { |
| 1045 |
List<ITypeBinding> result= new ArrayList<ITypeBinding>(Arrays.asList(fAnalyzer.getTypeVariables())); |
1046 |
List<ITypeBinding> result= new ArrayList<ITypeBinding>(Arrays.asList(fAnalyzer.getTypeVariables())); |
| 1046 |
for (int i= 0; i < fParameterInfos.size(); i++) { |
1047 |
for (int i= 0; i < fParameterInfos.size(); i++) { |
| 1047 |
ParameterInfo info= fParameterInfos.get(i); |
1048 |
ParameterInfo info= fParameterInfos.get(i); |
| 1048 |
processVariable(result, info.getOldBinding()); |
1049 |
processVariable(result, info.getOldBinding(), modifier); |
| 1049 |
} |
1050 |
} |
| 1050 |
IVariableBinding[] methodLocals= fAnalyzer.getMethodLocals(); |
1051 |
IVariableBinding[] methodLocals= fAnalyzer.getMethodLocals(); |
| 1051 |
for (int i= 0; i < methodLocals.length; i++) { |
1052 |
for (int i= 0; i < methodLocals.length; i++) { |
| 1052 |
processVariable(result, methodLocals[i]); |
1053 |
processVariable(result, methodLocals[i], modifier); |
| 1053 |
} |
1054 |
} |
| 1054 |
return result.toArray(new ITypeBinding[result.size()]); |
1055 |
return result.toArray(new ITypeBinding[result.size()]); |
| 1055 |
} |
1056 |
} |
| 1056 |
|
1057 |
|
| 1057 |
private void processVariable(List<ITypeBinding> result, IVariableBinding variable) { |
1058 |
private void processVariable(List<ITypeBinding> result, IVariableBinding variable, int modifier) { |
| 1058 |
if (variable == null) |
1059 |
if (variable == null) |
| 1059 |
return; |
1060 |
return; |
| 1060 |
ITypeBinding binding= variable.getType(); |
1061 |
ITypeBinding binding= variable.getType(); |
|
Link Here
|
| 1066 |
ASTNode decl= fRoot.findDeclaringNode(arg); |
1067 |
ASTNode decl= fRoot.findDeclaringNode(arg); |
| 1067 |
if (decl != null && decl.getParent() instanceof MethodDeclaration) { |
1068 |
if (decl != null && decl.getParent() instanceof MethodDeclaration) { |
| 1068 |
result.add(arg); |
1069 |
result.add(arg); |
|
|
1070 |
}else{ |
| 1071 |
if(decl != null && decl.getParent() instanceof TypeDeclaration && Modifier.isStatic(modifier)){ |
| 1072 |
result.add(arg); |
| 1073 |
} |
| 1074 |
} |
| 1075 |
}else{ |
| 1076 |
ITypeBinding bound = arg.getBound(); |
| 1077 |
if(arg.isWildcardType() && bound!=null && !result.contains(bound)){ |
| 1078 |
ASTNode decl= fRoot.findDeclaringNode(bound); |
| 1079 |
if (decl != null && decl.getParent() instanceof MethodDeclaration) { |
| 1080 |
result.add(bound); |
| 1081 |
}else{ |
| 1082 |
if(decl != null && decl.getParent() instanceof TypeDeclaration && Modifier.isStatic(modifier)){ |
| 1083 |
result.add(bound); |
| 1084 |
} |
| 1085 |
} |
| 1069 |
} |
1086 |
} |
| 1070 |
} |
1087 |
} |
|
|
1088 |
|
| 1071 |
} |
1089 |
} |
| 1072 |
} |
1090 |
} |
| 1073 |
} |
1091 |
} |