提交 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 { ...@@ -625,7 +625,9 @@ public class Main implements LogPrinter {
private void reportError(Throwable e) { private void reportError(Throwable e) {
log.println("Error: " + e.getMessage()); log.println("Error: " + e.getMessage());
e.printStackTrace(log); if (options.info) {
e.printStackTrace(log);
}
log.flush(); log.flush();
} }
......
...@@ -77,7 +77,7 @@ public class ClassSearch { ...@@ -77,7 +77,7 @@ public class ClassSearch {
} }
if (found == null) { if (found == null) {
throw new InternalError("Failed to find: " + searchFor.toString()); throw new InternalError("Failed to find " + searchFor.getType() + " file: " + searchFor.getName());
} }
return found; return found;
} }
......
...@@ -27,7 +27,7 @@ public class SearchFor { ...@@ -27,7 +27,7 @@ public class SearchFor {
private final String type; private final String type;
public SearchFor(String name) { public SearchFor(String name) {
this(name, "unknown"); this(name, "");
} }
public SearchFor(String name, String type) { public SearchFor(String name, String type) {
...@@ -36,7 +36,7 @@ public class SearchFor { ...@@ -36,7 +36,7 @@ public class SearchFor {
} }
public boolean isUnknown() { public boolean isUnknown() {
return "unknown".equals(type); return "".equals(type);
} }
public String getType() { public String getType() {
...@@ -49,6 +49,6 @@ public class SearchFor { ...@@ -49,6 +49,6 @@ public class SearchFor {
@Override @Override
public String toString() { public String toString() {
return type + ":" + name; return type + ": " + name;
} }
} }
...@@ -31,7 +31,7 @@ import java.nio.file.Path; ...@@ -31,7 +31,7 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
public class ClassNameSourceProvider implements SourceProvider { public class ClassNameSourceProvider implements SourceProvider {
public final static String TYPE = "classname"; public final static String TYPE = "class";
private final ClassLoader classLoader; private final ClassLoader classLoader;
public ClassNameSourceProvider(FileSupport fileSupport) { public ClassNameSourceProvider(FileSupport fileSupport) {
...@@ -47,6 +47,10 @@ public class ClassNameSourceProvider implements SourceProvider { ...@@ -47,6 +47,10 @@ public class ClassNameSourceProvider implements SourceProvider {
@Override @Override
public ClassSource findSource(String name, SearchPath searchPath) { public ClassSource findSource(String name, SearchPath searchPath) {
Path path = Paths.get(name);
if (ClassSource.pathIsClassFile(path)) {
name = ClassSource.makeClassName(path);
}
try { try {
classLoader.loadClass(name); classLoader.loadClass(name);
return new ClassNameSource(name, classLoader); return new ClassNameSource(name, classLoader);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册