mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (warnings/typos/duplicates/formatting)
This commit is contained in:
+34
-70
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -28,27 +14,33 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_8;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advFixture";
|
||||
}
|
||||
|
||||
public void testHidingOnDemandImports() {
|
||||
//noinspection StaticNonFinalField
|
||||
myFixture.addClass("package foo; public class Foo {" +
|
||||
" public static String foo;" +
|
||||
"}");
|
||||
|
||||
myFixture.addClass("package foo; public class Bar {" +
|
||||
" public static void foo(String s) {}" +
|
||||
"}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting(false, false, false);
|
||||
}
|
||||
|
||||
public void testPackageNamedAsClassInDefaultPackage() {
|
||||
myFixture.addClass("package test; public class A {}");
|
||||
final PsiClass aClass = myFixture.addClass("public class test {}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
|
||||
PsiClass aClass = myFixture.addClass("public class test {}");
|
||||
doTest();
|
||||
assertNull(ReferencesSearch.search(aClass).findFirst());
|
||||
}
|
||||
|
||||
@@ -56,37 +48,24 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
myFixture.addClass("package test; class A {}");
|
||||
myFixture.addClass("package test; public interface I { void m(A a);}");
|
||||
myFixture.addClass("package test; public interface J { A m();}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testBoundsPromotionWithCapturedWildcards() {
|
||||
myFixture.addClass("package a; public interface Provider<A> {}");
|
||||
myFixture.addClass("package b; public interface Provider<B> {}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStaticImportCompoundWithInheritance() {
|
||||
myFixture.addClass("package a; public interface A { static void foo(Object o){} static void foo(String str) {}}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSuppressedInGenerated() {
|
||||
myFixture.enableInspections(new RedundantCastInspection());
|
||||
myFixture.addClass("package javax.annotation; public @interface Generated {}");
|
||||
final RedundantCastInspection inspection = new RedundantCastInspection();
|
||||
try {
|
||||
myFixture.enableInspections(inspection);
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
finally {
|
||||
myFixture.disableInspections(inspection);
|
||||
}
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testReferenceThroughInheritance() {
|
||||
@@ -94,18 +73,17 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
"public class A {\n" +
|
||||
" public static class B {}\n" +
|
||||
"}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testReferenceThroughInheritance1() {
|
||||
//noinspection UnnecessaryInterfaceModifier
|
||||
myFixture.addClass("package me;\n" +
|
||||
"import me.Serializer.Format;\n" +
|
||||
"public interface Serializer<F extends Format> {\n" +
|
||||
" public static interface Format {}\n" +
|
||||
"}\n");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUsageOfProtectedAnnotationOutsideAPackage() {
|
||||
@@ -118,29 +96,24 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
" protected @interface Test{\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPackageLocalClassUsedinArrayTypeOutsidePackage() {
|
||||
public void testPackageLocalClassUsedInArrayTypeOutsidePackage() {
|
||||
myFixture.addClass("package a; class A {}");
|
||||
myFixture.addClass("package a; public class B {public static A[] getAs() {return null;}}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testProtectedFieldUsedInAnnotationParameterOfInheritor() {
|
||||
myFixture.addClass("package a; public class A {protected final static String A_FOO = \"A\";}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStaticImportClassConflictingWithPackageName() {
|
||||
myFixture.addClass("package p.P1; class Unrelated {}");
|
||||
myFixture.addClass("package p; public class P1 {public static final int FOO = 1;}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAmbiguousMethodCallWhenStaticImported() {
|
||||
@@ -158,22 +131,19 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
" return null;\n" +
|
||||
" }\n" +
|
||||
"}\n");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassPackageConflict() {
|
||||
myFixture.addClass("package a; public class b {}");
|
||||
myFixture.addClass("package c; public class a {}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassPackageConflict1() {
|
||||
myFixture.addClass("package a; public class b {}");
|
||||
myFixture.addClass("package c.d; public class a {}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTypeAnnotations() {
|
||||
@@ -193,14 +163,8 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
assertEquals(1, substituted.getAnnotations().length);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advFixture";
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user