changeset 43974:309b569feebb

8175052: [AOT] jaotc does not accept file name with .class Reviewed-by: iveresov
author kvn
date Fri, 17 Feb 2017 21:06:59 -0800
parents 1ade39b8381b
children b4dabf28579a
files hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/ClassSearch.java hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/SearchFor.java hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/classname/ClassNameSourceProvider.java
diffstat 4 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java	Thu Feb 16 15:46:09 2017 -0800
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java	Fri Feb 17 21:06:59 2017 -0800
@@ -625,7 +625,9 @@
 
     private void reportError(Throwable e) {
         log.println("Error: " + e.getMessage());
-        e.printStackTrace(log);
+        if (options.info) {
+            e.printStackTrace(log);
+        }
         log.flush();
     }
 
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/ClassSearch.java	Thu Feb 16 15:46:09 2017 -0800
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/ClassSearch.java	Fri Feb 17 21:06:59 2017 -0800
@@ -77,7 +77,7 @@
         }
 
         if (found == null) {
-            throw new InternalError("Failed to find: " + searchFor.toString());
+            throw new InternalError("Failed to find " + searchFor.getType() + " file: " + searchFor.getName());
         }
         return found;
     }
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/SearchFor.java	Thu Feb 16 15:46:09 2017 -0800
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/SearchFor.java	Fri Feb 17 21:06:59 2017 -0800
@@ -27,7 +27,7 @@
     private final String type;
 
     public SearchFor(String name) {
-        this(name, "unknown");
+        this(name, "");
     }
 
     public SearchFor(String name, String type) {
@@ -36,7 +36,7 @@
     }
 
     public boolean isUnknown() {
-        return "unknown".equals(type);
+        return "".equals(type);
     }
 
     public String getType() {
@@ -49,6 +49,6 @@
 
     @Override
     public String toString() {
-        return type + ":" + name;
+        return type + ": " + name;
     }
 }
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/classname/ClassNameSourceProvider.java	Thu Feb 16 15:46:09 2017 -0800
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/collect/classname/ClassNameSourceProvider.java	Fri Feb 17 21:06:59 2017 -0800
@@ -31,7 +31,7 @@
 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 @@
 
     @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);