Do not add all modules from module path when compiling unnamed module

Note that javac reports a nice error in this case ("package foo is
declared in module lib, which is not in the module graph"), but we only
report "unresolved reference" because the corresponding modules are not
added to classpath roots. We should improve this in the future

 #KT-18598 In Progress
This commit is contained in:
Alexander Udalov
2017-06-28 15:19:14 +03:00
parent f8346d21c2
commit 72f37a278c
6 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
package foo;
public class Foo {}

View File

@@ -0,0 +1,3 @@
module moduleA {
exports foo;
}

View File

@@ -0,0 +1,7 @@
compiler/testData/javaModules/unnamedDoesNotReadNotAdded/moduleB/usage.kt:1:8: error: unresolved reference: foo
import foo.Foo
^
compiler/testData/javaModules/unnamedDoesNotReadNotAdded/moduleB/usage.kt:4:5: error: unresolved reference: Foo
Foo()
^
COMPILATION_ERROR

View File

@@ -0,0 +1,5 @@
import foo.Foo
fun usage() {
Foo()
}