3 Jun 2002 16:30
12 Jun 2002 16:39
VerifyError after modifing a Class
Pasch, Thomas (ACTGRO <extern.thomas.pasch <at> volkswagen.de>
2002-06-12 14:39:54 GMT
2002-06-12 14:39:54 GMT
Hello,
after using:
ClassGen classGen = new ClassGen(jclass_);
ConstantPoolGen poolGen = new
ConstantPoolGen(jclass_.getConstantPool());
InstructionFactory instr = new InstructionFactory(classGen,
poolGen);
classGen.addEmptyConstructor(Constants.ACC_PUBLIC);
classGen.setClassName(name);
JavaClass modifiedClass = classGen.getJavaClass();
modifiedClass.dump(out);
and loading the class I encounter the following VerifyError:
java.lang.VerifyError: (class:
de/berlios/serijc/core/ReflectLinkHelper_modified, method: getLinkedTypesOld
signature: ()Ljava/util/List;) Incompatible type for getting or setting
field
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1613)
at java.lang.Class.getDeclaredMethods(Class.java:1102)
at
de.berlios.serijc.test.TestReflectLinkHelper.test2(TestReflectLinkHelper.jav
a:121)
at
de.berlios.serijc.test.TestReflectLinkHelper.doIt(TestReflectLinkHelper.java
(Continue reading)
12 Jun 2002 18:20
Re: VerifyError after modifing a Class
<markus.dahm <at> berlin.de>
2002-06-12 16:20:28 GMT
2002-06-12 16:20:28 GMT
Hi, > ConstantPoolGen poolGen = new > ConstantPoolGen(jclass_.getConstantPool()); should read ConstantPoolGen poolGen = classGen.getConstantPool(); alternatively you could use setConstantPool() on classGen, otherwise the cp has nothing to do with the modified class. Cheers Markus -- berlin.de - meine stadt im netz. Jetzt eigene eMail-adresse <at> berlin.de sichern! http://webmail.berlin.de
13 Jun 2002 09:27
AW: VerifyError after modifing a Class
Pasch, Thomas (ACTGRO <extern.thomas.pasch <at> volkswagen.de>
2002-06-13 07:27:06 GMT
2002-06-13 07:27:06 GMT
Dear Markus,
thank you for support. The error though, is still there. It
seem to depend on whether there are (more) methods
after the (static) main.
I attached a class to test the problem with.
Kind regards,
Thomas
/*
* BcelVerifyError.java
*/
import org.apache.bcel.*;
import org.apache.bcel.classfile.*;
import org.apache.bcel.generic.*;
import org.apache.bcel.util.*;
public class BcelVerifyError {
private Object trash2;
private BcelVerifyError(int dummy) {
}
private int getDummy() {
return 1;
(Continue reading)
18 Jun 2002 05:24
JavaClass to Class
Abel Wang <abelw <at> nvisionsoftware.net>
2002-06-18 03:24:06 GMT
2002-06-18 03:24:06 GMT
Hi BCEL users, I've been playing around with BCEL for a while now and was wondering if there's any way for me to go from a java.lang.Class object into a JavaClass object, and the other way around too. Basically, I'm trying to dynamically change some class files that are being loaded by a vendor specific class loader (one that doesn't get the class from the system's class path). Since the .class files are not in the class path, I was wondering if I could create a JavaClass object from the java.lang.Class object directly. Thanks, --Abel
18 Jun 2002 08:16
Re: JavaClass to Class
Juozas Baliuka <baliuka <at> centras.lt>
2002-06-18 06:16:18 GMT
2002-06-18 06:16:18 GMT
try to find resource by class name:
clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.','/')
+ ".class");
> Hi BCEL users, I've been playing around with BCEL for a while now and was
> wondering if there's any way for me to go from a java.lang.Class object
into
> a JavaClass object, and the other way around too.
>
> Basically, I'm trying to dynamically change some class files that are
being
> loaded by a vendor specific class loader (one that doesn't get the class
> from the system's class path). Since the .class files are not in the
class
> path, I was wondering if I could create a JavaClass object from the
> java.lang.Class object directly.
>
> Thanks,
>
> --Abel
>
>
> --
> To unsubscribe, e-mail:
<mailto:bcel-user-unsubscribe <at> jakarta.apache.org>
> For additional commands, e-mail:
<mailto:bcel-user-help <at> jakarta.apache.org>
>
(Continue reading)
19 Jun 2002 02:08
Retrieving References of Methods in Methods
Anthony La Forge <e_lection <at> hotmail.com>
2002-06-19 00:08:17 GMT
2002-06-19 00:08:17 GMT
I'm having a little bit of a problem finding a means to parse out the method references of a given function. Basically I'm attempting to do the following: 1.) Search for a method in the main class that takes a specific parameter (e.g. boolean Process(Workflow workflow) )(No Problem here) 2.) Upon finding that method, introspect it, and look for function calls to objects on its parameters list. In my case it's a "Workflow" object and I'm looking for workflow.get(String) and workflow.set(String, Object) command. (This is basically so I can generate a set of pre-conditions and post-conditions for a workitem). For #2 I've tried just about every API call I could think of, but none of them proved fruitful, including Code which looked fairly promising but ended up delivering nothing better than a string containing a trace of the byte code (albeit the specific byte code for the string, which in something I cannot say about the constantPool). At anyrate, does anyone have an idea how I could perform this operation using BCEL? Any ideas would be greatly appreciated. Regards, Anthony
19 Jun 2002 10:50
BCELifier
Peter Lundin <peter.lundin <at> home.se>
2002-06-19 08:50:38 GMT
2002-06-19 08:50:38 GMT
Hi,
I am using the BCELifier to get started with BCEL and it is really great. However I have problem with finally
and synchronized statements like the ones below. I get a NullPointerException which I suspect is due to
the handling of the Any Exception?
Is there a workaound or a patch available?
static void test0() {
System.out.println("enter test0");
try {
System.out.println("doing something test0");
} finally {
System.out.println("exit test0");
}
}
static void test1() {
Object obj = new Object();
synchronized (obj) {
System.out.println("doing something test1");
}
}
Exception in thread "main" java.lang.NullPointerException
at org.apache.bcel.util.BCELifier.printType(BCELifier.java:262)
at org.apache.bcel.util.BCELFactory.updateExceptionHandlers(BCELFactory.java:340)
at org.apache.bcel.util.BCELFactory.start(BCELFactory.java:108)
at org.apache.bcel.util.BCELifier.visitMethod(BCELifier.java:213)
at org.apache.bcel.classfile.Method.accept(Method.java:115)
at org.apache.bcel.util.BCELifier.visitJavaClass(BCELifier.java:143)
(Continue reading)
22 Jun 2002 14:40
Re: JavaClass to Class
<markus.dahm <at> berlin.de>
2002-06-22 12:40:26 GMT
2002-06-22 12:40:26 GMT
> > Von: "Abel Wang" <abelw <at> nvisionsoftware.net> > Datum: 2002/06/18 Di AM 05:24:06 GMT+02:00 > An: "BCEL Users List" <bcel-user <at> jakarta.apache.org> > Betreff: JavaClass to Class > > Hi BCEL users, I've been playing around with BCEL for a while now and was > wondering if there's any way for me to go from a java.lang.Class object into > a JavaClass object, and the other way around too. The "other way around" would be to load the class via a class loader. > Basically, I'm trying to dynamically change some class files that are being > loaded by a vendor specific class loader (one that doesn't get the class > from the system's class path). Since the .class files are not in the class > path, I was wondering if I could create a JavaClass object from the > java.lang.Class object directly. You can load the class file corresponding to the given class, see the corresponding method in the Repository. Cheers markus -- berlin.de - meine stadt im netz. Jetzt eigene eMail-adresse <at> berlin.de sichern! http://webmail.berlin.de ++++++++++++++++++++++++++++++++++++++++++++++++ 7 CITIES SUMMER(Continue reading)
22 Jun 2002 14:42
AW: BCELifier
<markus.dahm <at> berlin.de>
2002-06-22 12:42:42 GMT
2002-06-22 12:42:42 GMT
> Hi, > > I am using the BCELifier to get started with BCEL and it is really great. However I have problem with finally and synchronized statements like the ones below. I get a NullPointerException which I suspect is due to the handling of the Any Exception? > Is there a workaound or a patch available? I'll take a look at it as soon I get back from my vacation(Continue reading)Cheers Markus > > static void test0() { > System.out.println("enter test0"); > try { > System.out.println("doing something test0"); > } finally { > System.out.println("exit test0"); > } > } > > static void test1() { > Object obj = new Object(); > synchronized (obj) { > System.out.println("doing something test1"); > } > }
Cheers
Markus
>
> static void test0() {
> System.out.println("enter test0");
> try {
> System.out.println("doing something test0");
> } finally {
> System.out.println("exit test0");
> }
> }
>
> static void test1() {
> Object obj = new Object();
> synchronized (obj) {
> System.out.println("doing something test1");
> }
> }
RSS Feed