KT-46049 Java-Kotlin sealed inheritors inspection: false positive for type parameter
^KT-46049 Fixed
This commit is contained in:
+1
@@ -43,6 +43,7 @@ class KotlinSealedInheritorsInJavaInspection : LocalInspectionTool() {
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||
return object : JavaElementVisitor() {
|
||||
override fun visitClass(aClass: PsiClass?) {
|
||||
if (aClass is PsiTypeParameter) return
|
||||
aClass?.listSealedParentReferences()?.forEach {
|
||||
holder.registerProblem(
|
||||
it, KotlinBundle.message("inheritance.of.kotlin.sealed", 0.takeIf { aClass.isInterface } ?: 1),
|
||||
|
||||
Vendored
+2
@@ -8,6 +8,8 @@ public class JavaTriesToExtendKotlinSealed {
|
||||
interface OkToExtend extends KotlinInterface {}
|
||||
class OkToExtendClass extends KotlinClass{}
|
||||
|
||||
public <OkTypeParam extends KotlinSealedClass> void getSealed() {}
|
||||
|
||||
public static void main(String[] args) {
|
||||
KotlinSealedInterface sealedInterface = new KotlinSealedInterface() {}; // anonymouns class implements interface
|
||||
KotlinSealedClass sealedClass = new KotlinSealedClass() {};
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>12</line>
|
||||
<line>14</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed$1" />
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>13</line>
|
||||
<line>15</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed$2" />
|
||||
|
||||
Reference in New Issue
Block a user