This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: VerifyError when compiling jetty
- From: "Bjarni Thorisson" <bjarni at menandmice dot com>
- To: <tromey at redhat dot com>
- Cc: <java at gcc dot gnu dot org>
- Date: Wed, 29 Jan 2003 16:38:44 -0000
- Subject: RE: VerifyError when compiling jetty
Hello, and thanks for the quick reply.
Below is a simple class you can compile into bytecode with gcj and try to
run it. Then this error should occurr:
<--------------------clip----------------------------->
Exception in thread "main" java.lang.VerifyError: (class: Smu$Foo, method:
run signature: ()V) Illegal use of nonvirtual function call
at Smu.start(Smu.java:28)
at Smu.main(Smu.java:13)
<-------------------/clip----------------------------->
If the line:
Smu.this.doFoo();
in Foo's run method is commented out, then this error occurrs when run (with
jre 1.3):
<--------------------clip----------------------------->
Exception in thread "main" java.lang.VerifyError: (class: Smu$Foo, method:
<init> signature: (LSmu;)V) Expecting to find object/array on stack
at Smu.start(Smu.java:28)
at Smu.main(Smu.java:13)
<-------------------/clip----------------------------->
The later error does not occurr when run in jre 1.4.
<------------------- code begins ----------------------------->
public class Smu
{
private transient Foo itsFoo= null;
public Smu()
{}
public static void main( String[] args )
{
Smu itsSmu= new Smu();
itsSmu.start();
itsSmu.stop();
}
public boolean isStarted()
{
return itsFoo != null;
}
public void start()
{
if ( itsFoo == null)
{
itsFoo= new Foo();
itsFoo.start();
}
}
public void stop()
{
Foo foo= itsFoo;
itsFoo= null;
if ( foo != null ) {
foo.interrupt();
}
}
private void doFoo()
{
System.out.println( "foo!" );
}
class Foo extends Thread
{
public void run()
{
try{
while (isStarted())
{
try {
sleep( 1000 );
Smu.this.doFoo();
}
catch ( InterruptedException ie ) { continue; }
}
}
finally
{
Smu.this.itsFoo= null;
}
}
Foo()
{
super( "Foo" );
}
} // Foo
} // Smu
<------------------- code ends ----------------------------->
Thanks,
Bjarni