mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] IDEA-360291 'Make method constructor' fix shouldn't be shown for implicit classes
GitOrigin-RevId: ba571565430db01d06d37f2da5ab49a97b466db4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4de70108ea
commit
52fe84a033
@@ -104,6 +104,7 @@ public final class MethodNameSameAsClassNameInspection extends BaseInspection {
|
||||
final String methodName = method.getName();
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass == null) return;
|
||||
if (containingClass instanceof PsiImplicitClass) return;
|
||||
final String className = containingClass.getName();
|
||||
if (!methodName.equals(className)) return;
|
||||
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public static void main<caret>(String[] args) {
|
||||
System.out.println("Hello, World!");
|
||||
}
|
||||
+8
-1
@@ -1,6 +1,8 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.naming;
|
||||
|
||||
import com.intellij.pom.java.JavaFeature;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.IGQuickFixesTestCase;
|
||||
|
||||
@@ -23,6 +25,11 @@ public class MethodNameSameAsClassNameInspectionTest extends IGQuickFixesTestCas
|
||||
public void testConflictingCtor() { assertQuickfixNotAvailable(); }
|
||||
public void testConflictingCtorErasure() { assertQuickfixNotAvailable(); }
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public void testmain() {
|
||||
IdeaTestUtil.withLevel(getModule(), JavaFeature.IMPLICIT_CLASSES.getMinimumLevel(), () -> assertQuickfixNotAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRelativePath() {
|
||||
return "naming/method_name_same_as_class_name";
|
||||
|
||||
Reference in New Issue
Block a user