[JBoss-user] [Javassist user questions] - Re: Can we avoid
Thanks, it works now! I am indeed using Eclipse to compile classes. g View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3893269#3893269 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3893269 --- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Can we avoid "cannot edit NEW followed by no DUP"?
Hi, If I try to replace an expression like "new MyClass()" (without assignment), I get that error: javassist.CannotCompileException: sorry, cannot edit NEW followed by no DUP If I add an assignment like "MyClass dummy = new MyClass()", then there is no problem. Is there a fundamental issue in dealing with that sort of expression, or is it possible to fix it? Regards, Guillaume Pothier View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3893090#3893090 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3893090 --- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Javassist and Java5's enumerations
Ok, I found the problem. It is not specific to enumerations: Javassist doesn't properly handle array classes. For example, this code poses problems: String[] theStrings = {"A", "B"}; theStrings = theStrings.clone(); The problem is that in the class file, the method call is represented like that: 16: invokevirtual #5; //Method "[Ljava/lang/String;".clone:()Ljava/lang/Object; So this is a call to method "clone" in class "[Ljava/lang/String;". And when trying to retrieve the target class, MethodCall.getCtClass passes this classname to ClassPool.get. But ClassPool.get doesn't understand this syntax: it expects something like java.lang.String[] So I see two ways to fix it: - Either change MethodCall.getClassName so that it transforms [Ljava.lang.String; to java.lang.String[] - Change ClassPool.get() so that it accepts [Ljava.lang.String; PS: The reason why my original code worked with eclipse is that the eclipse compiler doesn't produce the same bytecode for enums in the values() method: Javac clones an array while eclipse instanciates a new array and does an arraycopy. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3875208#3875208 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3875208 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Javassist and Java5's enumerations
Sorry, the actual exception is a javassist.NotFoundException. Java's NoClassDefFound doesn't surface its root cause. Here is the stack trace: javassist.NotFoundException: [Lreflex.lib.logging.core.api.collector.BehaviourType; at javassist.ClassPool.get(ClassPool.java:301) at javassist.expr.MethodCall.getCtClass(MethodCall.java:76) at javassist.expr.MethodCall.getMethod(MethodCall.java:112) at reflex.core.model.expr.RMethodCallImpl.getMethod(RMethodCallImpl.java:69) ... BehaviourType being an enum. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874970#3874970 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874970 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Javassist and Java5's enumerations
Hi, I have a problem with enumerations classes and Javassist: I'm getting a java.lang.NoClassDefFoundError when the VM tries to load an enumeration. Is Javassist supposed to support enumerations? The enumerations that cause problems are not created by Javassist but already exist. There is also something strange: when my project is compiled by the Eclipse compiler, there is no problem. The problem appears only when the project is compiled by javac. Regards, Guillaume View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874845#3874845 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874845 --- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user