8344336: SM cleanup of java.lang.System, Runtime, String, StackWalker

Reviewed-by: dfuchs, alanb, lancea
This commit is contained in:
Roger Riggs 2024-11-21 21:50:41 +00:00
parent 0f458e2c3e
commit c199f5326b
6 changed files with 14 additions and 219 deletions

View file

@ -39,6 +39,8 @@ import java.lang.reflect.AccessFlag;
import java.lang.reflect.AnnotatedElement;
import java.net.URI;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -294,9 +296,12 @@ public final class Module implements AnnotatedElement {
String mod = isNamed() ? "module " + getName() : "an unnamed module";
if (currentClass != null) {
// try to extract location of the current class (e.g. jar or folder)
URL url = System.codeSource(currentClass);
if (url != null) {
mod += " (" + url + ")";
CodeSource cs = currentClass.getProtectionDomain().getCodeSource();
if (cs != null) {
URL url = cs.getLocation();
if (url != null) {
mod += " (" + url + ")";
}
}
}
if (illegalNativeAccess == ModuleBootstrap.IllegalNativeAccess.DENY) {