KTIJ-717 [Java side inspection]: "implementation of Kotlin sealed"
This commit is contained in:
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
public class JavaTriesToExtendKotlinSealed {
|
||||
|
||||
private static class TryToImplement implements KotlinSealedInterface {}
|
||||
private static interface TryToExtend extends KotlinSealedInterface {}
|
||||
private static class TryToExtendClass extends KotlinSealedClass {}
|
||||
|
||||
class OkToImplement implements KotlinInterface {}
|
||||
interface OkToExtend extends KotlinInterface {}
|
||||
class OkToExtendClass extends KotlinClass{}
|
||||
|
||||
public static void main(String[] args) {
|
||||
KotlinSealedInterface sealedInterface = new KotlinSealedInterface() {}; // anonymouns class implements interface
|
||||
KotlinSealedClass sealedClass = new KotlinSealedClass() {};
|
||||
|
||||
new KotlinInterface() {};
|
||||
new KotlinClass() {};
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
sealed interface KotlinSealedInterface
|
||||
sealed class KotlinSealedClass
|
||||
|
||||
interface KotlinInterface: KotlinSealedInterface
|
||||
class KotlinClass: KotlinSealedClass()
|
||||
@@ -0,0 +1,72 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>3</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed.TryToImplement"/>
|
||||
<problem_class id="KotlinSealedInheritorsInJava" severity="ERROR" attribute_key="ERRORS_ATTRIBUTES">Inheritance of Kotlin sealed
|
||||
interface/class from Java
|
||||
</problem_class>
|
||||
<description>Java class cannot be a part of Kotlin sealed hierarchy</description>
|
||||
<highlighted_element>KotlinSealedInterface</highlighted_element>
|
||||
<offset>4</offset>
|
||||
<length>71</length>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>4</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed.TryToExtend"/>
|
||||
<problem_class id="KotlinSealedInheritorsInJava" severity="ERROR" attribute_key="ERRORS_ATTRIBUTES">Inheritance of Kotlin sealed
|
||||
interface/class from Java
|
||||
</problem_class>
|
||||
<description>Java interface cannot be a part of Kotlin sealed hierarchy</description>
|
||||
<highlighted_element>KotlinSealedInterface</highlighted_element>
|
||||
<offset>4</offset>
|
||||
<length>69</length>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>5</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed.TryToExtendClass"/>
|
||||
<problem_class id="KotlinSealedInheritorsInJava" severity="ERROR" attribute_key="ERRORS_ATTRIBUTES">Inheritance of Kotlin sealed
|
||||
interface/class from Java
|
||||
</problem_class>
|
||||
<description>Java class cannot be a part of Kotlin sealed hierarchy</description>
|
||||
<highlighted_element>KotlinSealedClass</highlighted_element>
|
||||
<offset>4</offset>
|
||||
<length>66</length>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>12</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed$1" />
|
||||
<problem_class id="KotlinSealedInheritorsInJava" severity="ERROR" attribute_key="ERRORS_ATTRIBUTES">Inheritance of Kotlin sealed interface/class from Java</problem_class>
|
||||
<description>Java class cannot be a part of Kotlin sealed hierarchy</description>
|
||||
<highlighted_element>KotlinSealedInterface</highlighted_element>
|
||||
<offset>52</offset>
|
||||
<length>26</length>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>JavaTriesToExtendKotlinSealed.java</file>
|
||||
<line>13</line>
|
||||
<module>testKotlinSealedInJavaTest_KotlinSealedInJavaTest</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="class" FQNAME="JavaTriesToExtendKotlinSealed$2" />
|
||||
<problem_class id="KotlinSealedInheritorsInJava" severity="ERROR" attribute_key="ERRORS_ATTRIBUTES">Inheritance of Kotlin sealed interface/class from Java</problem_class>
|
||||
<description>Java class cannot be a part of Kotlin sealed hierarchy</description>
|
||||
<highlighted_element>KotlinSealedClass()</highlighted_element>
|
||||
<offset>44</offset>
|
||||
<length>22</length>
|
||||
</problem>
|
||||
</problems>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"inspectionClass": "org.jetbrains.kotlin.idea.inspections.KotlinSealedInheritorsInJavaInspection"
|
||||
}
|
||||
Reference in New Issue
Block a user