This commit is contained in:
anna
2012-02-20 18:27:18 +01:00
parent f4905037b4
commit 216e15280e
4 changed files with 59 additions and 9 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -762,12 +762,11 @@ public class ExtractMethodProcessor implements MatchProvider {
}
adjustFinalParameters(newMethod);
for (int i = 0, length = myVariableDatum.length; i < length; i++) {
ParameterTablePanel.VariableData data = myVariableDatum[i];
int i = 0;
for (ParameterTablePanel.VariableData data : myVariableDatum) {
if (!data.passAsParameter) continue;
final PsiVariable variable = data.variable;
final PsiParameter psiParameter = newMethod.getParameterList().getParameters()[i];
final PsiParameter psiParameter = newMethod.getParameterList().getParameters()[i++];
if (!TypeConversionUtil.isAssignable(variable.getType(), psiParameter.getType())) {
for (PsiReference reference : ReferencesSearch.search(psiParameter, new LocalSearchScope(body))){
final PsiElement element = reference.getElement();
@@ -1,6 +1,22 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Fest {
public static void main(String[] args) {
String f = "";
<selection>System.out.println(f);</selection>
String bar = ""
<selection> System.out.println(f + ";" + bar);</selection>
}
}
@@ -1,11 +1,27 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Fest {
public static void main(String[] args) {
String f = "";
newMethod();
String bar = ""
newMethod(bar);
}
private static void newMethod() {
private static void newMethod(String bar) {
String f = ;
System.out.println(f);
System.out.println(f + ";" + bar);
}
}
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
@@ -503,6 +518,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
}
public void testDisabledParam() throws Exception {
doTestDisabledParam();
}
private void doTestDisabledParam() throws PrepareFailedException {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
settings.ELSE_ON_NEW_LINE = true;
settings.CATCH_ON_NEW_LINE = myCatchOnNewLine;