jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java
equal
deleted
inserted
replaced
26 import java.io.File; |
26 import java.io.File; |
27 import java.io.FileInputStream; |
27 import java.io.FileInputStream; |
28 import java.io.IOException; |
28 import java.io.IOException; |
29 import java.io.InputStream; |
29 import java.io.InputStream; |
30 import java.lang.reflect.InvocationTargetException; |
30 import java.lang.reflect.InvocationTargetException; |
31 import java.lang.reflect.Layer; |
|
32 import java.lang.reflect.Method; |
31 import java.lang.reflect.Method; |
33 |
32 |
34 /* |
33 /* |
35 * @test 8163162 |
34 * @test 8163162 |
36 * @summary Checks that LazyLoggers are returned for System.Logger instances |
35 * @summary Checks that LazyLoggers are returned for System.Logger instances |
104 if (appLogger == platformLogger) { |
103 if (appLogger == platformLogger) { |
105 throw new RuntimeException("Same loggers"); |
104 throw new RuntimeException("Same loggers"); |
106 } |
105 } |
107 Class<?> platformLoggerType = platformLogger.getClass(); |
106 Class<?> platformLoggerType = platformLogger.getClass(); |
108 System.out.println("platformLogger: " + platformLoggerType); |
107 System.out.println("platformLogger: " + platformLoggerType); |
109 boolean simpleConsoleOnly = !Layer.boot().findModule("java.logging").isPresent(); |
108 boolean simpleConsoleOnly = !ModuleLayer.boot().findModule("java.logging").isPresent(); |
110 if (simpleConsoleOnly) { |
109 if (simpleConsoleOnly) { |
111 /* Happens if the test is called with custom JDK without java.logging module |
110 /* Happens if the test is called with custom JDK without java.logging module |
112 or in case usage commandline option --limit-modules java.base */ |
111 or in case usage commandline option --limit-modules java.base */ |
113 if (!platformLoggerType.getSimpleName().equals("SimpleConsoleLogger")) { |
112 if (!platformLoggerType.getSimpleName().equals("SimpleConsoleLogger")) { |
114 throw new RuntimeException(platformLoggerType.getSimpleName() |
113 throw new RuntimeException(platformLoggerType.getSimpleName() |