提交 6e0f945f 编写于 作者: K kvn

8175052: [AOT] jaotc does not accept file name with .class

Reviewed-by: iveresov
上级 4336295f
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册