[PATCH][asmtools] Fix incorrect handling of quoted class names by jasm (original) (raw)
Alexey Fedorchenko alexey.fedorchenko at oracle.com
Wed Mar 7 20:26:25 UTC 2018
- Previous message: [PATCH][asmtools] Fix incorrect handling of quoted class names by jasm
- Next message: [PATCH][asmtools] Fix incorrect handling of some CPX2 constant pool entries by JDIS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello, Maxim!
The patch was reviewed by Leonid Kuskov and pushed to ASMTools repository.
Thank you.
—Alexey
On Mar 6, 2018, at 8:26 AM, Maxim Degtyarev <mdegtyarev at gmail.com> wrote:
It seems file attach lost somewhere in the middle. Does this mailing list support attaches? Here is the patch: ===== # HG changeset patch # User maccimo # Date 1520137328 -10800 # Sun Mar 04 07:22:08 2018 +0300 # Node ID 2704790eab9c060bc0ba3f3c29a31e95379224f4 # Parent 872f704a0d9a0198ae7ce1ae12a676cb180fd424 Fix quoted class names handling bug. Quoted class names was not prepended by proper package name even if *.jasm file contains "package" statement. diff --git a/src/org/openjdk/asmtools/jasm/Parser.java b/src/org/openjdk/asmtools/jasm/Parser.java --- a/src/org/openjdk/asmtools/jasm/Parser.java +++ b/src/org/openjdk/asmtools/jasm/Parser.java @@ -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.
===== 2018-03-06 18:42 GMT+03:00 Kevin Looney <kevin.looney at oracle.com>: Hello Maxim,
Thanks for identifying the issue in asmtools.
The following patch address quoted class names handling bug in
asmtools_ _jasm
. Did you forget to attach the patch? - or are you simply reporting a problem without a fix? Thanks in advance, Regards, Kevin L Manager - Conformance toolsOn 3/3/18 9:22 PM, Maxim Degtyarev wrote: The following patch address quoted class names handling bug in
asmtools_ _jasm
. Quick example: Following code will produce classTestQuoted
in top-level package ignoring package, specified by the "package" statement. After removing quotes around class name resulting class file will contain classpkg.TestQuoted
as expected.package pkg; super public class "TestQuoted" version 52:0 { public Method "":"()V" stack 1 locals 1 { aload0; invokespecial Method java/lang/Object."":"()V"; return; } } // end Class TestQuoted -- kevin.looney at oracle.com
- Previous message: [PATCH][asmtools] Fix incorrect handling of quoted class names by jasm
- Next message: [PATCH][asmtools] Fix incorrect handling of some CPX2 constant pool entries by JDIS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]