mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (highlighting tests unified)
This commit is contained in:
-39
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
class C {
|
||||
interface Simplest {
|
||||
void m();
|
||||
}
|
||||
void use(Simplest s) { }
|
||||
|
||||
interface IntParser {
|
||||
int parse(String s);
|
||||
}
|
||||
|
||||
void test() {
|
||||
Simplest simplest = () -> { };
|
||||
use(() -> { });
|
||||
|
||||
IntParser intParser = (String s) -> Integer.parseInt(s);
|
||||
}
|
||||
|
||||
Runnable foo() {
|
||||
return () -> { System.out.println("foo"); };
|
||||
}
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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 C {
|
||||
interface Simplest {
|
||||
void m();
|
||||
}
|
||||
void simplest() { }
|
||||
void use(Simplest s) { }
|
||||
|
||||
void test() {
|
||||
Simplest simplest = this::simplest;
|
||||
use(this::simplest);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import java.util.*;
|
||||
|
||||
class C {
|
||||
interface Simplest {
|
||||
void m();
|
||||
}
|
||||
void use(Simplest s) { }
|
||||
|
||||
interface IntParser {
|
||||
int parse(String s);
|
||||
}
|
||||
|
||||
void test() {
|
||||
Simplest simplest = () -> { };
|
||||
use(() -> { });
|
||||
|
||||
IntParser intParser = (String s) -> Integer.parseInt(s);
|
||||
}
|
||||
|
||||
Runnable foo() {
|
||||
return () -> { System.out.println("foo"); };
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class C {
|
||||
interface Simplest {
|
||||
void m();
|
||||
}
|
||||
void simplest() { }
|
||||
void use(Simplest s) { }
|
||||
|
||||
void test() {
|
||||
Simplest simplest = this::simplest;
|
||||
use(this::simplest);
|
||||
}
|
||||
}
|
||||
+9
-30
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon;
|
||||
import com.intellij.ToolExtensionPoints;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
|
||||
@@ -45,34 +44,20 @@ import java.util.List;
|
||||
*/
|
||||
public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting7";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
enableInspectionTool(new UnusedDeclarationInspection());
|
||||
}
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkInfos, InspectionProfileEntry... classes) {
|
||||
enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection());
|
||||
setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), myTestRootDisposable);
|
||||
enableInspectionTools(classes);
|
||||
}
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkInfos, InspectionProfileEntry... inspections) {
|
||||
enableInspectionTools(inspections);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
|
||||
}
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkWeakWarnings, boolean checkInfos, Class<?>... classes) {
|
||||
enableInspectionTools(classes);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkWeakWarnings, checkInfos);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[]{
|
||||
new UncheckedWarningLocalInspection(),
|
||||
new JavacQuirksInspection(),
|
||||
new RedundantCastInspection()
|
||||
};
|
||||
}
|
||||
|
||||
public void testAllJava15Features() { doTest(false, false); }
|
||||
public void testEnumSyntheticMethods() { doTest(false, false); }
|
||||
public void testDuplicateAnnotations() { doTest(false, false); }
|
||||
@@ -158,9 +143,6 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testExtendsBound() { doTest(false, false); }
|
||||
public void testIDEA84533() { doTest(false, false); }
|
||||
public void testClassLiteral() { doTest(false, false); }
|
||||
public void testMethodReferences() { doTest(false, true, false); }
|
||||
public void testUsedMethodsByMethodReferences() { doTest(true, true, false); }
|
||||
public void testLambdaExpressions() { doTest(false, true, false); }
|
||||
public void testUncheckedWarning() { doTest(true, false); }
|
||||
public void testUncheckedWarningIDEA59290() { doTest(true, false); }
|
||||
public void testUncheckedWarningIDEA70620() { doTest(true, false); }
|
||||
@@ -179,7 +161,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testAmbiguousMethodCallIDEA67669() { doTest(false, false); }
|
||||
public void testInstanceMemberNotAccessibleInStaticContext() { doTest(false, false); }
|
||||
public void testRejectedTypeParamsForConstructor() { doTest(false, false); }
|
||||
public void testAnnotationArgs() throws Exception { doTest(false, false);}
|
||||
public void testAnnotationArgs() { doTest(false, false);}
|
||||
public void testIDEA70890() { doTest(false, false); }
|
||||
public void testIDEA63731() { doTest(false, false); }
|
||||
public void testIDEA62056() { doTest(false, false); }
|
||||
@@ -188,8 +170,5 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA111450() { doTest(true, false); }
|
||||
public void testExternalizable() { doTest(true, false); }
|
||||
public void testAccessToStaticMethodsFromInterfaces() { doTest(true, false); }
|
||||
|
||||
public void testUncheckedExtendedWarnings() throws Exception {
|
||||
doTest(true, false);
|
||||
}
|
||||
public void testUncheckedExtendedWarnings() { doTest(true, false); }
|
||||
}
|
||||
|
||||
+11
-19
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -15,41 +15,33 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
|
||||
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
public class LightAdvHighlightingJdk9Test extends LightDaemonAnalyzerTestCase {
|
||||
private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting9";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
enableInspectionTool(new UnusedDeclarationInspection());
|
||||
}
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkInfos, InspectionProfileEntry... classes) {
|
||||
enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection());
|
||||
setLanguageLevel(LanguageLevel.JDK_1_9);
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), myTestRootDisposable);
|
||||
enableInspectionTools(classes);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), getTestRootDisposable());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[]{
|
||||
new UncheckedWarningLocalInspection(),
|
||||
new JavacQuirksInspection(),
|
||||
new RedundantCastInspection()
|
||||
};
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkInfos) {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
|
||||
}
|
||||
|
||||
public void testSafeVarargsApplicability() { doTest(true, false); }
|
||||
|
||||
+25
-26
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -16,44 +16,43 @@
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/advHighlighting";
|
||||
private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/advHighlighting";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[]{
|
||||
new JavacQuirksInspection(),
|
||||
};
|
||||
}
|
||||
|
||||
public void testUnderscore() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFinalVariableMightNotHaveBeenInitializedInsideLambda() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStrictfpInsideInterface() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
enableInspectionTools(new JavacQuirksInspection());
|
||||
setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true, false, false);
|
||||
}
|
||||
|
||||
private void doTest(boolean warnings, boolean weakWarnings, boolean infos, InspectionProfileEntry... inspections) {
|
||||
enableInspectionTools(inspections);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, weakWarnings, infos);
|
||||
}
|
||||
|
||||
public void testUnderscore() { doTest(); }
|
||||
public void testFinalVariableMightNotHaveBeenInitializedInsideLambda() { doTest(); }
|
||||
public void testStrictfpInsideInterface() { doTest(); }
|
||||
public void testMethodReferences() { doTest(false, true, false); }
|
||||
public void testUsedMethodsByMethodReferences() { doTest(true, true, false, new UnusedDeclarationInspection()); }
|
||||
public void testLambdaExpressions() { doTest(false, true, false); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user