commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <>
Subject [jira] [Commented] (BCEL-192) Verification error when defining an inner class
Date Sat, 07 Mar 2015 23:50:38 GMT


Emmanuel Bourg commented on BCEL-192:

I get a test failure:

 Time elapsed: 0.127 sec  <<< ERROR!
org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Some RuntimeException
occured while verify()ing class 'org.apache.bcel.verifier.tests.TestUninitialized04', method
'public void <init>()'. Original RuntimeException's stack trace:
org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Field 'o' not found
in org.apache.bcel.verifier.tests.TestUninitialized04
        at org.apache.bcel.verifier.structurals.InstConstraintVisitor.visitPUTFIELD(
        at org.apache.bcel.generic.PUTFIELD.accept(
        at org.apache.bcel.generic.InstructionHandle.accept(
        at org.apache.bcel.verifier.structurals.ControlFlowGraph$InstructionContextImpl.execute(
        at org.apache.bcel.verifier.structurals.Pass3bVerifier.circulationPump(
        at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(

I suspect BCEL-189 has to be fixed first.

> Verification error when defining an inner class
> -----------------------------------------------
>                 Key: BCEL-192
>                 URL:
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Verifier
>    Affects Versions: 6.0
>            Reporter: Jérôme Leroux
>         Attachments: BCEL-192.patch,
> The verification of the following code fails:
> {code:java}
>     public void test(){
>         new Runnable() {
>             @Override
>             public void run() {
>             }
>         };
>     }
> {code}
> The cause is a wrong verification of field modification on uninitialized object. The
modification of an uninitialized object is allowed in a constructor if this object is the
receiver of the constructor.
> Here is the explanation from the §4.9.4 of _The Java Virtual Machine Specification,
Second Edition_:
> {quote}
> The instance initialization method (§3.9) for class myClass sees the new uninitialized
object as its this argument in local variable 0. Before that method invokes another instance
initialization method of myClass or its direct superclass on this, the only operation the
method can perform on this is assigning fields declared within myClass.
> {quote}

This message was sent by Atlassian JIRA

View raw message