[jboss-jira] [JBoss JIRA] (JASSIST-181) java.lang.RuntimeException: multiple descriptors? with javac 1.7

Oleh Faizulin (JIRA) jira-events at lists.jboss.org
Sat Dec 1 08:51:56 EST 2012


     [ https://issues.jboss.org/browse/JASSIST-181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleh Faizulin updated JASSIST-181:
----------------------------------

    Workaround Description: 
As workaround we have to change existing code @ javassist.bytecode.Descriptor#toClassName

replace:
{noformat}
        if (c == 'L') {
            int i2 = descriptor.indexOf(';', i++);
            name = descriptor.substring(i, i2).replace('/', '.');
            i = i2;
        }
{noformat}

with 
{noformat}
        if (c == 'L') {
            if (descriptor.indexOf(';', i) != descriptor.lastIndexOf(';')) {
                StringBuilder buffer = new StringBuilder();

                int i2 = i;
                boolean isTypeDec = false;

                while (i2 < descriptor.length()) {
                    char c1 = descriptor.charAt(++i2);

                    if (!isTypeDec && c1 == ';') {
                        break;
                    }

                    if (c1 == '<') {
                        isTypeDec = true;
                        continue;
                    }
                    if (c1 == '>') {
                        isTypeDec = false;
                        continue;
                    }

                    if (c1 == '.')
                        c1 = '$';

                    if (!isTypeDec) {
                        buffer.append(c1);
                    }
                }

                name = buffer.toString().replace('/', '.');
                i = i2;
            } else {
                int i2 = descriptor.indexOf(';', i++);
                name = descriptor.substring(i, i2).replace('/', '.');
                i = i2;
            }
{noformat}

  was:
As workaround we have to change existing code @javassist.bytecode.Descriptor#toClassName

replace:
{noformat}
        if (c == 'L') {
            int i2 = descriptor.indexOf(';', i++);
            name = descriptor.substring(i, i2).replace('/', '.');
            i = i2;
        }
{noformat}

with 
{noformat}
        if (c == 'L') {
            if (descriptor.indexOf(';', i) != descriptor.lastIndexOf(';')) {
                StringBuilder buffer = new StringBuilder();

                int i2 = i;
                boolean isTypeDec = false;

                while (i2 < descriptor.length()) {
                    char c1 = descriptor.charAt(++i2);

                    if (!isTypeDec && c1 == ';') {
                        break;
                    }

                    if (c1 == '<') {
                        isTypeDec = true;
                        continue;
                    }
                    if (c1 == '>') {
                        isTypeDec = false;
                        continue;
                    }

                    if (c1 == '.')
                        c1 = '$';

                    if (!isTypeDec) {
                        buffer.append(c1);
                    }
                }

                name = buffer.toString().replace('/', '.');
                i = i2;
            } else {
                int i2 = descriptor.indexOf(';', i++);
                name = descriptor.substring(i, i2).replace('/', '.');
                i = i2;
            }
{noformat}


    
> java.lang.RuntimeException: multiple descriptors? with javac 1.7
> ----------------------------------------------------------------
>
>                 Key: JASSIST-181
>                 URL: https://issues.jboss.org/browse/JASSIST-181
>             Project: Javassist
>          Issue Type: Bug
>    Affects Versions: 3.17.0-GA
>         Environment: Windows 7 x64,
> java version "1.7.0_05"
> Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
> Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing)
> Eclipse Juno Service Release 1
>            Reporter: Oleh Faizulin
>            Assignee: Shigeru Chiba
>         Attachments: javassist_test.zip
>
>
> Hi,
> When I try to run attached code compiled with javac I recive the following error:
> {noformat}
> Exception in thread "main" java.lang.RuntimeException: multiple descriptors?: Ljavassist_test/A<TT;>.B;
> 	at javassist.bytecode.Descriptor.toClassName(Descriptor.java:108)
> 	at javassist.bytecode.annotation.ClassMemberValue.getValue(ClassMemberValue.java:100)
> 	at javassist.bytecode.annotation.ClassMemberValue.toString(ClassMemberValue.java:117)
> 	at java.lang.String.valueOf(String.java:2902)
> 	at java.lang.StringBuffer.append(StringBuffer.java:232)
> 	at javassist.bytecode.annotation.Annotation.toString(Annotation.java:223)
> 	at javassist.bytecode.annotation.AnnotationImpl.invoke(AnnotationImpl.java:137)
> 	at $Proxy0.toString(Unknown Source)
> 	at java.lang.String.valueOf(String.java:2902)
> 	at java.io.PrintStream.println(PrintStream.java:821)
> 	at javassist_test.Test.main(Test.java:21)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:601)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> {noformat}
> However if I run the same code from eclipse (ejc) i get expected result:
> {noformat}
> @javassist_test.Condition(condition=<javassist_test.A$B class>)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list