[ 
https://issues.apache.org/jira/browse/OPENJPA-2283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13786193#comment-13786193
 ] 

Romain Manni-Bucau edited comment on OPENJPA-2283 at 10/4/13 2:36 PM:
----------------------------------------------------------------------

Can't it be fixed with:

{code}
static {
        // try the "real" asm first, then the others
        tryClass("org.objectweb.asm.");
        tryClass("org.apache.xbean.asm4.");
        tryClass("org.apache.xbean.asm.");
        tryClass("org.springframework.asm.");

        // get needed stuff
        try {
            COMPUTE_FRAMES = cwClass.getField("COMPUTE_FRAMES").getInt(null);
            classReaderAccept = crClass.getMethod("accept", findClassVisitor(), 
int.class);
            classReaderConstructor = crClass.getConstructor(InputStream.class);
            classWriterConstructor = cwClass.getConstructor(int.class);
            classWritertoByteArray = cwClass.getMethod("toByteArray");
        } catch (Exception e) {
            throw new 
IllegalStateException(_loc.get("static-asm-exception").getMessage(), e);
        }
    }

    private static Class<?> findClassVisitor() throws ClassNotFoundException {
        final String cwName = cwClass.getName();
        return cwClass.getClassLoader().loadClass(cwName.substring(0, 
cwName.length() - "ClassWriter".length()) + "ClassVisitor");
    }
{code}


was (Author: romain.manni-bucau):
Can't it be fixed with:


static {
        // try the "real" asm first, then the others
        tryClass("org.objectweb.asm.");
        tryClass("org.apache.xbean.asm4.");
        tryClass("org.apache.xbean.asm.");
        tryClass("org.springframework.asm.");

        // get needed stuff
        try {
            COMPUTE_FRAMES = cwClass.getField("COMPUTE_FRAMES").getInt(null);
            classReaderAccept = crClass.getMethod("accept", findClassVisitor(), 
int.class);
            classReaderConstructor = crClass.getConstructor(InputStream.class);
            classWriterConstructor = cwClass.getConstructor(int.class);
            classWritertoByteArray = cwClass.getMethod("toByteArray");
        } catch (Exception e) {
            throw new 
IllegalStateException(_loc.get("static-asm-exception").getMessage(), e);
        }
    }

    private static Class<?> findClassVisitor() throws ClassNotFoundException {
        final String cwName = cwClass.getName();
        return cwClass.getClassLoader().loadClass(cwName.substring(0, 
cwName.length() - "ClassWriter".length()) + "ClassVisitor");
    }

> Upgrade to ASM 4 dependency
> ---------------------------
>
>                 Key: OPENJPA-2283
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2283
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: Enhance
>    Affects Versions: 2.3.0
>            Reporter: Kevin Sutter
>             Fix For: 2.3.0
>
>
> OpenJPA currently has a dependency on ASM 3.2 for some post-enhancement 
> processing to fix up the stack map tables (Java 7 requirement).  The latest 
> release of ASM is 4.1, which just came out last week.  The immediate need is 
> to move up to ASM 4.0.  We can entertain 4.1 at a later date.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to