Jérôme Leroux created BCEL-192:
----------------------------------

             Summary: Verification error when defining an inner class
                 Key: BCEL-192
                 URL: https://issues.apache.org/jira/browse/BCEL-192
             Project: Commons BCEL
          Issue Type: Bug
          Components: Verifier
    Affects Versions: 6.0
            Reporter: Jérôme Leroux


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
(v6.3.4#6332)

Reply via email to