8175052: [AOT] jaotc does not accept file name with .class
Reviewed-by: iveresov
This commit is contained in:
parent
7d969ccd55
commit
e309127c9e
@ -625,7 +625,9 @@ public class Main implements LogPrinter {
|
||||
|
||||
private void reportError(Throwable e) {
|
||||
log.println("Error: " + e.getMessage());
|
||||
e.printStackTrace(log);
|
||||
if (options.info) {
|
||||
e.printStackTrace(log);
|
||||
}
|
||||
log.flush();
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class ClassSearch {
|
||||
}
|
||||
|
||||
if (found == null) {
|
||||
throw new InternalError("Failed to find: " + searchFor.toString());
|
||||
throw new InternalError("Failed to find " + searchFor.getType() + " file: " + searchFor.getName());
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class SearchFor {
|
||||
private final String type;
|
||||
|
||||
public SearchFor(String name) {
|
||||
this(name, "unknown");
|
||||
this(name, "");
|
||||
}
|
||||
|
||||
public SearchFor(String name, String type) {
|
||||
@ -36,7 +36,7 @@ public class SearchFor {
|
||||
}
|
||||
|
||||
public boolean isUnknown() {
|
||||
return "unknown".equals(type);
|
||||
return "".equals(type);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
@ -49,6 +49,6 @@ public class SearchFor {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return type + ":" + name;
|
||||
return type + ": " + name;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class ClassNameSourceProvider implements SourceProvider {
|
||||
public final static String TYPE = "classname";
|
||||
public final static String TYPE = "class";
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
public ClassNameSourceProvider(FileSupport fileSupport) {
|
||||
@ -47,6 +47,10 @@ public class ClassNameSourceProvider implements SourceProvider {
|
||||
|
||||
@Override
|
||||
public ClassSource findSource(String name, SearchPath searchPath) {
|
||||
Path path = Paths.get(name);
|
||||
if (ClassSource.pathIsClassFile(path)) {
|
||||
name = ClassSource.makeClassName(path);
|
||||
}
|
||||
try {
|
||||
classLoader.loadClass(name);
|
||||
return new ClassNameSource(name, classLoader);
|
||||
|
Loading…
Reference in New Issue
Block a user