Menu ▾ ▴

#20 capture of late-init'd variable

open
nobody
5
2002-09-09
2002-09-09
No

The Pizza compiler fails the following javac regression
test

/*
* @test @(#)Capture.java 1.1 02/01/27
* @bug 4441338
* @summary Captured variable synthetic parameters
should be passed before explicit params.
* @author gafter
*
* @compile Capture.java
* @run main Capture
*/

public class Capture {
final int k;
Capture(int n) {
k = n;
}
public static void main(String args[]) {
final int j;
int k1 = new Capture(2 + (j=3)){
int get () {return k+j;}
}.get();
if (k1 != 8) throw new Error("k1 = " + k1);
}
}

Discussion


Log in to post a comment.