nhatminhle / cofoja

Contracts for Java
GNU Lesser General Public License v3.0
151 stars 18 forks source link

Invariant contract with final field #24

Closed nhatminhle closed 10 years ago

nhatminhle commented 10 years ago

From tom.mago...@gmail.com on April 26, 2011 03:14:48

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: http://code.google.com/p/cofoja/issues/detail?id=19

nhatminhle commented 10 years ago

From chat...@google.com on April 27, 2011 04:50:19

Status: Accepted
Owner: chat...@google.com

nhatminhle commented 10 years ago

From chat...@google.com on May 09, 2011 04:53:30

Fixed on r115 .

Status: Fixed