1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
// @skip-test Change error key to one with a clearer message that explicitly mentions the superclass
// constructor
import org.checkerframework.dataflow.qual.*;
class SuperClass {
static int count = 0;
public SuperClass() {
count++;
}
}
// The error message is very confusing:
// EmptyConstructor.java:22: error: call to non-side-effect-free method not allowed in
// side-effect-free method
// public EmptyConstructor() {}
// ^
// because there's no obvious call. The message key should be changed to
// one whose message is "call to non-side-effect-free superclass
// constructor not allowed in side-effect-free constructor"
public class EmptyConstructor extends SuperClass {
@SideEffectFree
public EmptyConstructor() {}
}
|