Cleanup (deprecated code; formatting)

This commit is contained in:
Roman Shevchenko
2014-02-26 17:56:06 +01:00
parent 7d90896cd9
commit aea523f98a
5 changed files with 52 additions and 36 deletions
@@ -1,9 +1,7 @@
import java.lang.annotation.*;
@Target({ElementType.TYPE_USE/*, ElementType.TYPE*/})
@interface TA {
}
@Target({ElementType.TYPE_USE})
@interface TA { }
class C {
void foo () {
@@ -1,9 +1,7 @@
import java.lang.annotation.*;
@Target({ElementType.TYPE_USE/*, ElementType.TYPE*/})
@interface TA {
}
@Target({ElementType.TYPE_USE})
@interface TA { }
class C {
void foo () {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -28,7 +28,6 @@ import com.intellij.refactoring.introduceVariable.IntroduceVariableSettings;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.util.containers.MultiMap;
import junit.framework.Assert;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -302,6 +301,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
public void testNonExpression() throws Exception {
doTest(new MockIntroduceVariableHandler("sum", true, true, false, "int"));
}
public void testTypeAnnotations() throws Exception {
doTest(new MockIntroduceVariableHandler("y1", true, false, false, "@TA C"));
}
@@ -362,8 +362,8 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
InputValidator validator,
PsiElement anchor, final OccurrencesChooser.ReplaceChoice replaceChoice) {
final PsiType type = typeSelectorManager.getDefaultType();
Assert.assertTrue(type.getPresentableText(), type.getPresentableText().equals(expectedTypeName));
Assert.assertEquals("path", IntroduceVariableBase.getSuggestedName(type, expr).names[0]);
assertTrue(type.getPresentableText(), type.getPresentableText().equals(expectedTypeName));
assertEquals("path", IntroduceVariableBase.getSuggestedName(type, expr).names[0]);
return super.getSettings(project, editor, expr, occurrences, typeSelectorManager, declareFinalIfAll, anyAssignmentLHS,
validator, anchor, replaceChoice);
}
@@ -381,7 +381,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
InputValidator validator,
PsiElement anchor, final OccurrencesChooser.ReplaceChoice replaceChoice) {
final PsiType type = typeSelectorManager.getDefaultType();
Assert.assertTrue(type.getPresentableText(), type.getPresentableText().equals("B"));
assertTrue(type.getPresentableText(), type.getPresentableText().equals("B"));
return super.getSettings(project, editor, expr, occurrences, typeSelectorManager, declareFinalIfAll, anyAssignmentLHS,
validator, anchor, replaceChoice);
}
@@ -428,7 +428,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
}
public void testLambdaExpr() throws Exception {
doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
}
@@ -1,17 +1,35 @@
/*
* Copyright 2000-2014 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.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiType;
import com.intellij.refactoring.introduce.inplace.OccurrencesChooser;
import com.intellij.refactoring.introduceVariable.InputValidator;
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
import com.intellij.refactoring.introduceVariable.IntroduceVariableSettings;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.util.containers.MultiMap;
import junit.framework.Assert;
import org.jetbrains.annotations.NonNls;
import static org.junit.Assert.assertTrue;
/**
* @author dsl
*/
@@ -26,7 +44,6 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
public MockIntroduceVariableHandler(@NonNls final String name, final boolean replaceAll,
final boolean declareFinal, final boolean replaceLValues,
@NonNls final String expectedTypeCanonicalName) {
this(name, replaceAll, declareFinal, replaceLValues, expectedTypeCanonicalName, false);
}
@@ -52,7 +69,7 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
PsiElement anchor, final OccurrencesChooser.ReplaceChoice replaceChoice) {
final PsiType type = myLookForType ? findType(typeSelectorManager.getTypesForAll(), typeSelectorManager.getDefaultType())
: typeSelectorManager.getDefaultType();
Assert.assertTrue(type.getInternalCanonicalText(), type.getInternalCanonicalText().equals(myExpectedTypeCanonicalName));
assertTrue(type.getInternalCanonicalText(), type.getInternalCanonicalText().equals(myExpectedTypeCanonicalName));
IntroduceVariableSettings introduceVariableSettings = new IntroduceVariableSettings() {
@Override
public String getEnteredName() {
@@ -90,7 +107,7 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
}
protected void assertValidationResult(final boolean validationResult) {
Assert.assertTrue(validationResult);
assertTrue(validationResult);
}
@Override