Support -Xmodule-path and -Xadd-modules command line arguments

#KT-18598 In Progress
 #KT-18599 Fixed
This commit is contained in:
Alexander Udalov
2017-05-26 15:20:05 +03:00
parent e32880d9a3
commit 03d83db660
43 changed files with 355 additions and 14 deletions
@@ -0,0 +1,2 @@
error: -Xadd-modules=ALL-MODULE-PATH can only be used when compiling the unnamed module
COMPILATION_ERROR
@@ -0,0 +1,3 @@
package foo
class Foo
@@ -0,0 +1,3 @@
module main {
exports foo;
}
@@ -0,0 +1,3 @@
package a;
public class A {}
@@ -0,0 +1,3 @@
module moduleA {
exports a;
}
@@ -0,0 +1,3 @@
package b;
public class B {}
@@ -0,0 +1,3 @@
module moduleB {
exports b;
}
@@ -0,0 +1,3 @@
package c;
public class C {}
@@ -0,0 +1,3 @@
module moduleC {
exports c;
}
@@ -0,0 +1 @@
OK
@@ -0,0 +1,5 @@
module moduleD {
requires moduleA;
requires moduleB;
requires moduleC;
}
@@ -0,0 +1,9 @@
import a.*
import b.B
import c.C
fun usage() {
A()
B()
C()
}
@@ -0,0 +1,4 @@
compiler/testData/javaModules/jdkModulesFromNamed/main/test.kt:11:24: error: unresolved reference: httpserver
val s: com.sun.net.httpserver.HttpServer? = null
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
module main {
requires java.naming;
requires jdk.net;
requires oracle.desktop;
}
@@ -0,0 +1,17 @@
fun main(args: Array<String>) {
// Module java.naming
val b: javax.naming.Binding? = null
println(b)
// Module jdk.net
val j: jdk.net.Sockets? = null
println(j)
// Module jdk.httpserver (this module doesn't depend on it)
val s: com.sun.net.httpserver.HttpServer? = null
println(s)
// Module oracle.desktop
val a: com.oracle.awt.AWTUtils? = null
println(a)
}
@@ -0,0 +1 @@
OK
@@ -0,0 +1,17 @@
fun main(args: Array<String>) {
// Module java.naming
val b: javax.naming.Binding? = null
println(b)
// Module jdk.net
val j: jdk.net.Sockets? = null
println(j)
// Module jdk.httpserver
val s: com.sun.net.httpserver.HttpServer? = null
println(s)
// Module oracle.desktop
val a: com.oracle.awt.AWTUtils? = null
println(a)
}
@@ -0,0 +1,3 @@
package foo;
public class Foo {}
@@ -0,0 +1,3 @@
module moduleA {
exports foo;
}
+1
View File
@@ -0,0 +1 @@
OK
@@ -0,0 +1,3 @@
module moduleB {
requires moduleA;
}
+5
View File
@@ -0,0 +1,5 @@
import foo.Foo
fun usage() {
Foo()
}
@@ -0,0 +1,9 @@
package a;
import a.impl.AImpl;
public class A {
public static AImpl getInstance() {
return new AImpl();
}
}
@@ -0,0 +1,5 @@
package a.impl;
import a.A;
public class AImpl extends A {}
@@ -0,0 +1,3 @@
module moduleA {
exports a;
}
@@ -0,0 +1,4 @@
compiler/testData/javaModules/simpleUseNonExportedPackage/moduleB/usage.kt:8:9: error: symbol is declared in module 'moduleA' which does not export package 'a.impl'
val a3: AImpl = A.getInstance()
^
COMPILATION_ERROR
@@ -0,0 +1,3 @@
module moduleB {
requires moduleA;
}
@@ -0,0 +1,8 @@
package test
import a.*
import a.impl.*
val a1: A = A()
val a2: A = A.getInstance()
val a3: AImpl = A.getInstance()
@@ -0,0 +1,3 @@
package foo;
public class Foo {}
@@ -0,0 +1,3 @@
module moduleA {
exports foo;
}
@@ -0,0 +1 @@
OK
@@ -0,0 +1,5 @@
public class Usage {
public static void main(String[] args) {
new foo.Foo();
}
}
@@ -0,0 +1,5 @@
import foo.Foo
fun usage() {
Foo()
}