Skip to content

Commit

Permalink
applied suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asotona committed Nov 10, 2023
1 parent 78dc984 commit 1141201
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package com.sun.tools.javap;

import com.sun.tools.javac.file.Locations;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.FilterInputStream;
Expand Down Expand Up @@ -861,16 +860,18 @@ private JavaFileObject getClassFileObject(String className) throws IOException {
if (moduleLocation != null) {
fo = fileManager.getJavaFileForInput(moduleLocation, className, JavaFileObject.Kind.CLASS);
} else {
if (className.indexOf('.') > 0) try {
if (className.indexOf('.') > 0) {
//search for classes with a named package in the JDK modules specifed by --system option first
for (Set<Location> locations: fileManager.listLocationsForModules(StandardLocation.SYSTEM_MODULES)) {
for (Location systemModule: locations) {
fo = fileManager.getJavaFileForInput(systemModule, className, JavaFileObject.Kind.CLASS);
if (fo != null) return fo;
try {
for (Set<Location> 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) {
//skip when listLocationsForModules is not supported
}
} catch (UnsupportedOperationException e) {
//skip when listLocationsForModules is not supported
}
fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS);
if (fo == null)
Expand Down

0 comments on commit 1141201

Please sign in to comment.