[jvm-inspections] Fix EmptyMethod compatibility with Kotlin

1. Fix suppression handling for Kotlin in global inspections
2. Fix RefMethodImpl#hasBody for top-level Kotlin functions
3. Move to JVM module
4. Add Kotlin tests
Fixes IDEA-330737 @file:Suppress("EmptyMethod") does not work

GitOrigin-RevId: 83f383e06754f510b6a99e35751263017734bb26
This commit is contained in:
Tagir Valeev
2024-01-29 17:06:24 +01:00
committed by intellij-monorepo-bot
parent c6e9c60193
commit 0385834f13
13 changed files with 117 additions and 38 deletions

View File

@@ -0,0 +1,62 @@
// Copyright 2000-2020 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.codeInspection.tests.java;
import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.emptyMethod.EmptyMethodInspection;
import com.intellij.testFramework.JavaInspectionTestCase;
public class EmptyMethodInspectionTest extends JavaInspectionTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
}
private void doTest() {
doTest(false);
}
private void doTest(final boolean checkRange) {
final EmptyMethodInspection tool = new EmptyMethodInspection();
doTest("emptyMethod/" + getTestName(true), tool, checkRange);
}
public void testSuperCall() {
doTest();
}
public void testSuperCallByRange() {
doTest(true);
}
public void testExternalOverride() {
doTest();
}
public void testSCR8321() {
doTest();
}
public void testInAnonymous() {
doTest(true);
}
public void testSuperFromAnotherPackageCall() {
doTest();
}
public void testSuperWithoutSync() {
doTest();
}
public void testEmptyMethodsHierarchy() {
doTest();
}
public void testEmptyInLambda() {
doTest();
}
public void testNonEmptyInLambda() {
doTest();
}
}