diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java index 134b4b424b793..8e5c4e113f5e6 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java @@ -25,6 +25,7 @@ package com.sun.tools.javap; +import com.sun.tools.javac.file.Locations; import java.io.EOFException; import java.io.FileNotFoundException; import java.io.FilterInputStream; @@ -860,6 +861,17 @@ private JavaFileObject getClassFileObject(String className) throws IOException { if (moduleLocation != null) { fo = fileManager.getJavaFileForInput(moduleLocation, className, JavaFileObject.Kind.CLASS); } else { + try { + //search over JDK modules specifed by --system option first + for (Set locations: fileManager.listLocationsForModules(StandardLocation.SYSTEM_MODULES)) { + for (Location systemModule: locations) { + fo = fileManager.getJavaFileForInput(systemModule, className, JavaFileObject.Kind.CLASS); + if (fo != null) return fo; + } + } + } catch (UnsupportedOperationException e) { + //ignore when listLocationsForModules is not supported + } fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS); if (fo == null) fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS);