Do not return nested/local classes as a part of package fragment
#KT-13757 Fixed
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public class JavaOuter {
|
||||
public static class JavaNested {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
class Outer {
|
||||
class Nested
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import test.Outer
|
||||
import test.JavaOuter
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Outer.Nested()
|
||||
test.`Outer$Nested`()
|
||||
|
||||
JavaOuter.JavaNested()
|
||||
test.`JavaOuter$JavaNested`()
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/prohibitNestedClassesByDollarName/main.kt:6:10: error: unresolved reference: `Outer$Nested`
|
||||
test.`Outer$Nested`()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/prohibitNestedClassesByDollarName/main.kt:9:10: error: unresolved reference: `JavaOuter$JavaNested`
|
||||
test.`JavaOuter$JavaNested`()
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
+17
@@ -386,4 +386,21 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
File library2 = compileLibrary("library-2");
|
||||
doTestWithTxt(usage, library2);
|
||||
}
|
||||
|
||||
public void testProhibitNestedClassesByDollarName() throws Exception {
|
||||
File library = compileLibrary("library");
|
||||
|
||||
KotlinTestUtils.compileJavaFiles(
|
||||
Collections.singletonList(
|
||||
new File(getTestDataDirectory() + "/library/test/JavaOuter.java")
|
||||
),
|
||||
Arrays.asList("-d", tmpdir.getPath())
|
||||
);
|
||||
|
||||
Pair<String, ExitCode> outputMain = compileKotlin("main.kt", tmpdir, tmpdir, library);
|
||||
|
||||
KotlinTestUtils.assertEqualsToFile(
|
||||
new File(getTestDataDirectory(), "output.txt"), normalizeOutput(outputMain)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user