Generation of .java_output files spuriously fails
There are very simple .java
tests that nondeterministically either
- Fail to produce a non-empty
.out
reference fileclass HitboxTest { public static void main(String[] args) { Position p = new Position(); p.x = 100; p.y = 50; Hitbox b = new Hitbox(); b.x = 160; b.y = 90; b.w = 30; b.h = 20; while (!b.contains(p)) { p.move(2, 1); } System.out.println(p.x); System.out.println(p.y); } } class Position { public int x; public int y; public void move(int xstep, int ystep) { x = x + xstep; y = y + ystep; } } class Hitbox { public int x; public int y; public int w; public int h; public boolean contains(Position p) { return p.x >= x && p.x <= x + w && p.y >= y && p.y <= y + h; } }
- Have strange
javac
compile errors:[FAIL ] compile:transitive_object_chain.java invalid java code, but output file missing Report for failing test case transitive_object_chain.java Invalid java code, but output file missing Error code: 1 Javac error message: [0001] transitive_object_chain.java:8: error: non-static variable out cannot be referenced from a static context [0002] System.out.println(a.ref.ref.n); [0003] ^ [0004] transitive_object_chain.java:8: error: method println in class System cannot be applied to given types; [0005] System.out.println(a.ref.ref.n); [0006] ^ [0007] required: no arguments [0008] found: int [0009] reason: actual and formal argument lists differ in length [0010] 2 errors [0011] Source file: [0001] class transitive_object_chain { [0002] public static void main(String[] args) { [0003] A_2 a = new A_2(); [0004] A_2 b = new A_2(); [0005] a.ref = b; [0006] b.ref = a; [0007] a.n = 5; [0008] System.out.println(a.ref.ref.n); [0009] } [0010] } [0011] [0012] class A_2 { [0013] public A_2 ref; [0014] public int n; [0015] } [0016]
You can (hopefully) reproduce this by doing a git clean -fxd
in the tests
repository, followed by re-running mjtest
.
Johannes (@uqddy), maybe you suspect something?
Edited by rp1446