mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 13:20:53 +07:00
1. Do not report error if non-final variable is reassigned 2. Report error in Java 15 if 'final' modifier is used 3. Allow specifying 'final' modifier on introduce variable 4. Support non-final variables in PatternVariableCanBeUsed inspection 5. Copy modifiers in PatternVariableCanBeUsed quick-fix GitOrigin-RevId: d7b82261a018c9a48bcdcf237ade0d8c08f5978d
63 lines
1.9 KiB
Java
63 lines
1.9 KiB
Java
// Copyright 2000-2019 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;
|
|
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
|
import com.intellij.pom.java.LanguageLevel;
|
|
import com.intellij.testFramework.IdeaTestUtil;
|
|
import com.intellij.testFramework.LightProjectDescriptor;
|
|
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
public class LightPatternsHighlightingTest extends LightJavaCodeInsightFixtureTestCase {
|
|
@Override
|
|
protected String getBasePath() {
|
|
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advHighlightingPatterns";
|
|
}
|
|
|
|
@NotNull
|
|
@Override
|
|
protected LightProjectDescriptor getProjectDescriptor() {
|
|
return JAVA_15;
|
|
}
|
|
|
|
public void testInstanceOfBasics() {
|
|
doTest();
|
|
}
|
|
public void testInstanceOfAnnotations() {
|
|
doTest();
|
|
}
|
|
public void testInstanceOfNameConflicts() {
|
|
doTest();
|
|
}
|
|
public void testInstanceOfControlFlow() {
|
|
doTest();
|
|
}
|
|
public void testInstanceOfInSwitch() {
|
|
doTest();
|
|
}
|
|
public void testReassignPatternVariableJava15() {
|
|
doTest();
|
|
}
|
|
public void testReassignPatternVariable() {
|
|
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_16, this::doTest);
|
|
}
|
|
public void testUnusedPatternVariable() {
|
|
myFixture.enableInspections(new UnusedDeclarationInspection());
|
|
doTest();
|
|
}
|
|
public void testInstanceOfNonReified() {
|
|
doTest();
|
|
}
|
|
public void testInstanceOfSubtypeJava15() {
|
|
doTest();
|
|
}
|
|
public void testInstanceOfSubtype() {
|
|
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_16, this::doTest);
|
|
}
|
|
|
|
private void doTest() {
|
|
myFixture.configureByFile(getTestName(false) + ".java");
|
|
myFixture.checkHighlighting();
|
|
}
|
|
} |