can somebody help me out with this problem (second try)?
Luc Duponcheel
luc.duponcheel at gmail.com
Sun Mar 31 14:08:04 PDT 2013
Hello all,
Here I am again with the probem (I think a bug) I found.
Frankly: I am using lambda-8-b75-linux-x64-28_jan_2013.
I am downloading the latest version (I am at an airport ...) to see if the
problem will still persist.
I can "fix" the compile time problem, but then I get a runtime problem.
(problematic output included after the code).
I have limited the amount of lines of code to a bare minimum.
You can put it in one file or separate files.
=== begin code ===
package bug01;
public final class Tuple<Z, Y> {
final Z _1;
final Y _2;
Tuple(
final Z _1,
final Y _2
) {
this._1 = _1;
this._2 = _2;
}
@Override
public
String toString() {
return
("(" + _1 + ", " + _2 + ")");
}
}
===
package bug01;
public final class Tuples {
public static <Z, Y>
Tuple<Z, Y> tuple(
final Z _1,
final Y _2
) {
return
new Tuple<Z, Y>(_1, _2);
}
}
===
package bug01;
import java.util.function.Function;
public interface State<S, Z> {
public
Function<S, Tuple<Z, S>> open();
}
===
package bug01;
import java.util.function.Function;
import static bug01.Tuples.tuple;
public class StateStatics {
public static <S, Z>
Function<Z, State<S, Z>> runTimeProblematicResult(
) {
Function<Z, State<S, Z>> stateFunction =
z ->
new State<S, Z>() {
@Override
public
Function<S, Tuple<Z, S>> open() {
return
s -> tuple(z, s);
}
};
return
stateFunction;
}
// uncomment to see compile problem
/*
public static <S, Z>
Function<Z, State<S, Z>> compileTimeProblematicResult(
) {
return
z ->
new State<S, Z>() {
@Override
public
Function<S, Tuple<Z, S>> open() {
return
s -> tuple(z, s);
}
};
}
*/
}
===
package bug01;
public class StateApp {
public static void main(String[] args) {
State<Integer, String> state =
StateStatics.<Integer, String>runTimeProblematicResult().apply("a");
System.out.println(state.open().apply(new Integer(0)));
}
}
===
=== end code ===
=== begin compile time message ===
An exception has occurred in the compiler (1.8.0-ea). Please file a bug at
the Java Developer Connection (http://java.sun.com/webapps/bugreport)
after checking the Bug Parade for duplicates. Include your program and the
following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.jvm.Code.emitop0(Code.java:538)
at com.sun.tools.javac.jvm.Items$SelfItem.load(Items.java:367)
at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:912)
at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1746)
at
com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1412)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:893)
at com.sun.tools.javac.jvm.Gen.visitReturn(Gen.java:1715)
at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1330)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:718)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:704)
at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:755)
at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1090)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:854)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:718)
at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:968)
at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:941)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:738)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:683)
at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2310)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:752)
at
com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1547)
at
com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1511)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:908)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:867)
at com.sun.tools.javac.main.Main.compile(Main.java:505)
at com.sun.tools.javac.main.Main.compile(Main.java:365)
at com.sun.tools.javac.main.Main.compile(Main.java:354)
at com.sun.tools.javac.main.Main.compile(Main.java:345)
at com.sun.tools.javac.Main.compile(Main.java:76)
at com.sun.tools.javac.Main.main(Main.java:61)
=== end compile time message ===
=== begin runtime message ===
Exception in thread "main" java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
bug01/StateStatics.result()Ljava/util/function/Function; @0: aload_0
Reason:
Type top (current frame, locals[0]) is not assignable to reference type
Current Frame:
bci: @0
flags: { }
locals: { }
stack: { }
Bytecode:
0000000: 2aba 0002 0000 4b2a b0
at javaz.datastructures.StateApp.main(StateApp.java:6)
=== end runtime message ===
Luc
--
__~O
-\ <,
(*)/ (*)
reality goes far beyond imagination
More information about the lambda-dev
mailing list