changeset 23:2904229ed97e

Fix quoted class names handling bug, contributed by: mdegtyarev@gmail.com, reviewed by: leonid.kuskov@oracle.com
author afedorch
date Wed, 07 Mar 2018 12:21:07 -0800
parents 1e6791f5e622
children 2931522b78a4
files src/org/openjdk/asmtools/jasm/Parser.java
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/openjdk/asmtools/jasm/Parser.java	Wed Mar 07 12:17:01 2018 -0800
+++ b/src/org/openjdk/asmtools/jasm/Parser.java	Wed Mar 07 12:21:07 2018 -0800
@@ -416,6 +416,7 @@
             case STRINGVAL:
                 v = scanner.stringValue;
                 scanner.scan();
+                v = prependPackage(v, uncond);
                 return pool.FindCellAsciz(v);
                 // Some identifiers might coincide with token names.
                 // these should be OK to use as identifier names.
@@ -435,12 +436,7 @@
             case IDENT:
                 v = scanner.idValue;
                 scanner.scan();
-                if (uncond || (scanner.token == Token.FIELD)) {
-                    if ((!v.contains("/"))             // class identifier doesn't contain "/"
-                            && (!v.contains("["))){    // class identifier doesn't contain "["
-                        v = pkgPrefix + v; // add package
-                    }
-                }
+                v = prependPackage(v, uncond);
                 return pool.FindCellAsciz(v);
             default:
                 ConstType key = Tables.tag(scanner.token.value());
@@ -450,6 +446,16 @@
         }
     }
 
+    private String prependPackage(String className, boolean uncond) {
+        if (uncond || (scanner.token == Token.FIELD)) {
+            if ((!className.contains("/"))             // class identifier doesn't contain "/"
+                    && (!className.contains("["))){    // class identifier doesn't contain "["
+                className = pkgPrefix + className; // add package
+            }
+        }
+        return className;
+    }
+
 
     /**
      * Parse a signed integer of size bytes long.