Skip to content

Commit 1a27e6e

Browse files
author
duke
committedNov 21, 2023
Automatic merge of jdk:master into master
2 parents a1286c8 + 604d29a commit 1a27e6e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java

+13
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,19 @@ private JavaFileObject getClassFileObject(String className) throws IOException {
860860
if (moduleLocation != null) {
861861
fo = fileManager.getJavaFileForInput(moduleLocation, className, JavaFileObject.Kind.CLASS);
862862
} else {
863+
if (className.indexOf('.') > 0) {
864+
//search for classes with a named package in the JDK modules specifed by --system option first
865+
try {
866+
for (Set<Location> locations: fileManager.listLocationsForModules(StandardLocation.SYSTEM_MODULES)) {
867+
for (Location systemModule: locations) {
868+
fo = fileManager.getJavaFileForInput(systemModule, className, JavaFileObject.Kind.CLASS);
869+
if (fo != null) return fo;
870+
}
871+
}
872+
} catch (UnsupportedOperationException e) {
873+
//skip when listLocationsForModules is not supported
874+
}
875+
}
863876
fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS);
864877
if (fo == null)
865878
fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS);

0 commit comments

Comments
 (0)
Please sign in to comment.