Add inspection for usages of Kotlin internal declarations in Java

#KT-11393 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2017-03-16 13:33:07 +03:00
parent bd53922c64
commit a795313c7d
12 changed files with 206 additions and 10 deletions
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="B" />
</component>
</module>
@@ -0,0 +1 @@
internal class SomeInternalClass
@@ -0,0 +1,17 @@
import kotlin.collections.MapsKt;
import kotlin.internal.PlatformImplementations; // Internal in stdlib, error
import java.util.function.Consumer;
public class SomeClass extends PlatformImplementations { // Internal in stdlib, error
public static void doSomething() {
PlatformImplementations a; // Internal in stdlib, error
Integer c;
MapsKt.mapCapacity(3); // Internal in stdlib, error
Consumer<Integer> fun = MapsKt::mapCapacity; // Internal in stdlib, error
SomeInternalClass b = new SomeInternalClass(); // Internal in same module, OK
SomeInternalClassInOtherModule b = new SomeInternalClassInOtherModule(); // Internal in other module, error
}
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
@@ -0,0 +1 @@
internal class SomeInternalClassInOtherModule