pashapm / cofoja

Automatically exported from code.google.com/p/cofoja
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Invariant contract with final field #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following code causes the error

com.google.java.contract.InvariantError: field != 0

to be thrown when a ClassWithFinalField object is instantiated.

@Invariant("field != 0")
public class ClassWithFinalField {

    private final int field;

    public ClassWithFinalField(int field) {
        this.field = field;
    }
}

public class CofojaClassWithFinalFieldTest {

    @Test
    public void canCreateClassWithFinalFieldAndValidInvariant() {
        new ClassWithFinalField(1);
    }
}

Original issue reported on code.google.com by tom.mago...@gmail.com on 26 Apr 2011 at 10:14

GoogleCodeExporter commented 9 years ago

Original comment by chat...@google.com on 27 Apr 2011 at 11:50

GoogleCodeExporter commented 9 years ago
Fixed on r115.

Original comment by chat...@google.com on 9 May 2011 at 11:53