You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Anton Mironenko <am...@jnetx.ru> on 2005/08/23 15:24:33 UTC
java.lang.VerifyError: "method: signature: ()V) Call to wrong initialization method" after specifying superclass
Hello,
I have two classes SimpleClass and SimpleSuperClass with no fields and methods.
I need to specify superclass SimpleSuperClass for SimpleClass in BCEL.
When I'm trying to do this, I get the following exception when I
access the class with the code:
Class clazz = Class.forName( "com.jnetx.jdo.SimpleClass" );
java.lang.VerifyError: (class: com/jnetx/jdo/SimpleClass, method: <init> signature: ()V) Call to wrong initialization method
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at com.jnetx.jdo.TestBCEL.class$(TestBCEL.java:40)
at com.jnetx.jdo.TestBCEL.testCheckSimpleClass(TestBCEL.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
The code how I specify the superclass is the following:
JavaClass jc = Repository.lookupClass( SimpleClass.class );
ClassGen cg = new ClassGen( jc );
cg.setSuperclassName( SimpleSuperClass.class.getName() );
cg.update();
String className = SimpleClass.class.getName();
String path = Repository.lookupClassFile(className).getPath();
File f = new File(path);
FileOutputStream fOut = null;
try
{
fOut = new FileOutputStream(f);
BufferedOutputStream bout = new BufferedOutputStream(fOut);
cg.getJavaClass().dump(bout);
bout.flush();
bout.flush();
}
finally
{
try
{
fOut.close();
fOut = null;
}
catch (Exception ignore)
{
//ignore exception in closing the stream
}
}
What am I doing wrong?
Thanks.
------------
Best regards,
Anton Mironenko
Software Engineer
jNETx LLC
tel. +7 095 780 790 0
mailto:amironenko@jnetx.ru
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org
Re[2]: java.lang.VerifyError: "method: signature: ()V) Call to wrong initialization method" after specifying superclass
Posted by Anton Mironenko <am...@jnetx.ru>.
Tuesday, August 23, 2005, 5:39:39 PM, dbrosius wrote:
dqn> Does SimpleClass have the appropriate super class
dqn> constructor call as it's first
dqn> instruction?
Even if SimpleClass has a constructor with no parameters in source
code,
I have the same exception.
May be compiler sees SimpleClass doesn't have superclass and ignores
this code?
So I need to add super(); into all constructors using BCEL?
How should I do this?
dqn> Quoting Anton Mironenko <am...@jnetx.ru>:
>>
>> Hello,
>>
>> I have two classes SimpleClass and SimpleSuperClass with no fields and
>> methods.
>>
>> I need to specify superclass SimpleSuperClass for SimpleClass in BCEL.
>>
>> When I'm trying to do this, I get the following exception when I
>> access the class with the code:
>> Class clazz = Class.forName( "com.jnetx.jdo.SimpleClass" );
>>
>> java.lang.VerifyError: (class: com/jnetx/jdo/SimpleClass, method: <init>
>> signature: ()V) Call to wrong initialization method
>> at java.lang.Class.forName0(Native Method)
>> at java.lang.Class.forName(Class.java:141)
>> at com.jnetx.jdo.TestBCEL.class$(TestBCEL.java:40)
>> at
>> com.jnetx.jdo.TestBCEL.testCheckSimpleClass(TestBCEL.java:72)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>>
dqn> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at
>> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
>>
>>
>> The code how I specify the superclass is the following:
>>
>>
>> JavaClass jc = Repository.lookupClass( SimpleClass.class );
>> ClassGen cg = new ClassGen( jc );
>>
>> cg.setSuperclassName( SimpleSuperClass.class.getName() );
>> cg.update();
>>
>> String className = SimpleClass.class.getName();
>> String path =
>> Repository.lookupClassFile(className).getPath();
>>
>> File f = new File(path);
>> FileOutputStream fOut = null;
>> try
>> {
>> fOut = new FileOutputStream(f);
>> BufferedOutputStream bout = new BufferedOutputStream(fOut);
>>
>> cg.getJavaClass().dump(bout);
>> bout.flush();
>>
>> bout.flush();
>> }
>> finally
>> {
>> try
>> {
>> fOut.close();
>> fOut = null;
>> }
>> catch (Exception ignore)
>> {
>> //ignore exception in closing the stream
>> }
>> }
>>
>>
>> What am I doing wrong?
>>
>> Thanks.
>>
>> ------------
>> Best regards,
>> Anton Mironenko
>> Software Engineer
>> jNETx LLC
>> tel. +7 095 780 790 0
>> mailto:amironenko@jnetx.ru
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>>
------------
Best regards,
Anton Mironenko
Software Engineer
jNETx LLC
tel. +7 095 780 790 0
mailto:amironenko@jnetx.ru
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org
Re: java.lang.VerifyError: "method: signature: ()V) Call to
wrong initialization method" after specifying superclass
Posted by ss <sa...@hotmail.com>.
I am having the same problem . I did verify and got this.
[Pass 2: Attribute '<LineNumberTable: LineNumber(0, 27), LineNumber(5, 28)>'
as an attribute of Code attribute '<CODE>' (method 'public void
<init>(psdi.mbo.MboServerInterface ms)
throws psdi.util.MXException, java.rmi.RemoteException') will effectively
be ignored and is only useful for debuggers and such., Pass 2: Attribute
'<LocalVariableTable: LocalVariable(start_pc = 0, length = 6, index =
0:psdi.tnd.app.asset.TNDSparePartSet this)
LocalVariable(start_pc = 0, length = 6, index =
1:psdi.mbo.MboServerInterface ms)>' as an attribute of Code attribute
'<CODE>' (method 'public void <init>(psdi.mbo.MboServerInterface ms)
throws psdi.util.MXException, java.rmi.RemoteException') will effectively
be ignored and is only useful for debuggers and such., Pass 2: Attribute
'<LineNumberTable: LineNumber(0, 35)>' as an attribute of Code attribute
'<CODE>' (method 'protected psdi.mbo.Mbo getMboInstance(psdi.mbo.MboSet ms)
throws psdi.util.MXException, java.rmi.RemoteException') will effectively
be ignored and is only useful for debuggers and such., Pass 2: Attribute
'<LocalVariableTable: LocalVariable(start_pc = 0, length = 2, index =
0:psdi.tnd.app.asset.TNDSparePartSet this)
LocalVariable(start_pc = 0, length = 2, index = 1:psdi.mbo.MboSet ms)>' as
an attribute of Code attribute '<CODE>' (method 'protected psdi.mbo.Mbo
getMboInstance(psdi.mbo.MboSet ms)
throws psdi.util.MXException, java.rmi.RemoteException') will effectively
be ignored and is only useful for debuggers and such.]
Is it ignoring all super call?
Dave Brosius wrote:
>
> Does SimpleClass have the appropriate super class constructor call as it's
> first
> instruction?
>
>
> Quoting Anton Mironenko <am...@jnetx.ru>:
>
>>
>> Hello,
>>
>> I have two classes SimpleClass and SimpleSuperClass with no fields and
>> methods.
>>
>> I need to specify superclass SimpleSuperClass for SimpleClass in BCEL.
>>
>> When I'm trying to do this, I get the following exception when I
>> access the class with the code:
>> Class clazz = Class.forName( "com.jnetx.jdo.SimpleClass" );
>>
>> java.lang.VerifyError: (class: com/jnetx/jdo/SimpleClass, method: <init>
>> signature: ()V) Call to wrong initialization method
>> at java.lang.Class.forName0(Native Method)
>> at java.lang.Class.forName(Class.java:141)
>> at com.jnetx.jdo.TestBCEL.class$(TestBCEL.java:40)
>> at com.jnetx.jdo.TestBCEL.testCheckSimpleClass(TestBCEL.java:72)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at
>> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
>>
>>
>> The code how I specify the superclass is the following:
>>
>>
>> JavaClass jc = Repository.lookupClass( SimpleClass.class );
>> ClassGen cg = new ClassGen( jc );
>>
>> cg.setSuperclassName( SimpleSuperClass.class.getName() );
>> cg.update();
>>
>> String className = SimpleClass.class.getName();
>> String path = Repository.lookupClassFile(className).getPath();
>>
>> File f = new File(path);
>> FileOutputStream fOut = null;
>> try
>> {
>> fOut = new FileOutputStream(f);
>> BufferedOutputStream bout = new BufferedOutputStream(fOut);
>>
>> cg.getJavaClass().dump(bout);
>> bout.flush();
>>
>> bout.flush();
>> }
>> finally
>> {
>> try
>> {
>> fOut.close();
>> fOut = null;
>> }
>> catch (Exception ignore)
>> {
>> //ignore exception in closing the stream
>> }
>> }
>>
>>
>> What am I doing wrong?
>>
>> Thanks.
>>
>> ------------
>> Best regards,
>> Anton Mironenko
>> Software Engineer
>> jNETx LLC
>> tel. +7 095 780 790 0
>> mailto:amironenko@jnetx.ru
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/java.lang.VerifyError%3A-%22method%3A-%3Cinit%3E-signature%3A-%28%29V%29-Call-to-wrong-initialization-method%22-after-specifying-superclass-tf246861.html#a6024250
Sent from the BCEL - User forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org
Re: java.lang.VerifyError: "method: signature: ()V) Call to wrong initialization method" after specifying superclass
Posted by db...@qis.net.
Does SimpleClass have the appropriate super class constructor call as it's first
instruction?
Quoting Anton Mironenko <am...@jnetx.ru>:
>
> Hello,
>
> I have two classes SimpleClass and SimpleSuperClass with no fields and
> methods.
>
> I need to specify superclass SimpleSuperClass for SimpleClass in BCEL.
>
> When I'm trying to do this, I get the following exception when I
> access the class with the code:
> Class clazz = Class.forName( "com.jnetx.jdo.SimpleClass" );
>
> java.lang.VerifyError: (class: com/jnetx/jdo/SimpleClass, method: <init>
> signature: ()V) Call to wrong initialization method
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:141)
> at com.jnetx.jdo.TestBCEL.class$(TestBCEL.java:40)
> at com.jnetx.jdo.TestBCEL.testCheckSimpleClass(TestBCEL.java:72)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
>
>
> The code how I specify the superclass is the following:
>
>
> JavaClass jc = Repository.lookupClass( SimpleClass.class );
> ClassGen cg = new ClassGen( jc );
>
> cg.setSuperclassName( SimpleSuperClass.class.getName() );
> cg.update();
>
> String className = SimpleClass.class.getName();
> String path = Repository.lookupClassFile(className).getPath();
>
> File f = new File(path);
> FileOutputStream fOut = null;
> try
> {
> fOut = new FileOutputStream(f);
> BufferedOutputStream bout = new BufferedOutputStream(fOut);
>
> cg.getJavaClass().dump(bout);
> bout.flush();
>
> bout.flush();
> }
> finally
> {
> try
> {
> fOut.close();
> fOut = null;
> }
> catch (Exception ignore)
> {
> //ignore exception in closing the stream
> }
> }
>
>
> What am I doing wrong?
>
> Thanks.
>
> ------------
> Best regards,
> Anton Mironenko
> Software Engineer
> jNETx LLC
> tel. +7 095 780 790 0
> mailto:amironenko@jnetx.ru
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org