File: EmptyConstructor.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (26 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (3)
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() {}
}