Add jep511 module: module import declarations on JDK 25 and 27
Runnable sources, deliberate compile failures, three small modules and nine captured transcripts for import module (JEP 511). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import module java.base;
|
||||
import module java.sql;
|
||||
|
||||
public class AmbiguousDate {
|
||||
public static void main(String[] args) {
|
||||
Date d = new Date(0L);
|
||||
System.out.println(d);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import module java.base;
|
||||
import module java.desktop;
|
||||
|
||||
public class AmbiguousList {
|
||||
public static void main(String[] args) {
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add("x");
|
||||
System.out.println(names);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class ClassicNoImport {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(List.of("no imports at all"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
public class ModuleInsideClass {
|
||||
import module java.base;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import module java.nosuch;
|
||||
|
||||
public class NoSuchModule {
|
||||
public static void main(String[] args) { }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import module java.sql;
|
||||
|
||||
public class SqlDoesNotGiveBase {
|
||||
public static void main(String[] args) {
|
||||
List<String> l = List.of("x"); // java.util.List lives in java.base
|
||||
System.out.println(l);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user