Test for absence static warnings
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
import test.TestPackage;
|
||||||
|
|
||||||
|
// Check absence of 'Static method reference via subclass warning' for kotlin usages
|
||||||
|
public class UsingKotlinPackageDeclarations {
|
||||||
|
public static int test() {
|
||||||
|
TestPackage.foo();
|
||||||
|
TestPackage.setBar(15);
|
||||||
|
return TestPackage.getBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun foo() {}
|
||||||
|
var bar = 12
|
||||||
@@ -17,11 +17,18 @@
|
|||||||
package org.jetbrains.jet.checkers;
|
package org.jetbrains.jet.checkers;
|
||||||
|
|
||||||
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase;
|
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase;
|
||||||
|
import com.intellij.codeInspection.LocalInspectionTool;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
|
import com.siyeh.ig.bugs.StaticCallOnSubclassInspection;
|
||||||
|
import com.siyeh.ig.bugs.StaticFieldReferenceOnSubclassInspection;
|
||||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
|
|
||||||
public class KotlinAndJavaCheckerTest extends DaemonAnalyzerTestCase {
|
public class KotlinAndJavaCheckerTest extends DaemonAnalyzerTestCase {
|
||||||
|
@Override
|
||||||
|
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||||
|
return new LocalInspectionTool[] { new StaticCallOnSubclassInspection(), new StaticFieldReferenceOnSubclassInspection()};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Sdk getTestProjectJdk() {
|
protected Sdk getTestProjectJdk() {
|
||||||
@@ -36,4 +43,8 @@ public class KotlinAndJavaCheckerTest extends DaemonAnalyzerTestCase {
|
|||||||
public void testName() throws Exception {
|
public void testName() throws Exception {
|
||||||
doTest(false, false, "ClassObjects.java", "ClassObjects.kt");
|
doTest(false, false, "ClassObjects.java", "ClassObjects.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testUsingKotlinPackageDeclarations() throws Exception {
|
||||||
|
doTest(true, true, "UsingKotlinPackageDeclarations.java", "UsingKotlinPackageDeclarations.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user