FULL PRODUCT VERSION :
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b98)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b40, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
compiler internal error when passing a lambda to a method without explicitly parameter type
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
@Test
public void test() {
String word = "Hello world!";
assertThat(bind(Optional.of(word), optional -> Optional.of(optional.get().length())), is(Optional.of(12)));
}
private <V, R> Optional<R> bind(Optional<V> optional, Function<Optional<V>, Optional<R>> function) {
return function.apply(optional);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compilation completed without error
ACTUAL -
java: 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.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
@Test
public void test() {
String word = "Hello world!";
assertThat(bind(Optional.of(word), optional -> Optional.of(optional.get().length())), is(Optional.of(12)));
}
private <V, R> Optional<R> bind(Optional<V> optional, Function<Optional<V>, Optional<R>> function) {
return function.apply(optional);
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
@Test
public void test() {
String word = "Hello world!";
// assertThat(bind(Optional.of(word), optional -> Optional.of(optional.get().length())), is(Optional.of(12)));
assertThat(bind(Optional.of(word), (Optional<String> optional) -> Optional.of(optional.get().length())), is(Optional.of(12)));
}
SUPPORT :
YES
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b98)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b40, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
compiler internal error when passing a lambda to a method without explicitly parameter type
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
@Test
public void test() {
String word = "Hello world!";
assertThat(bind(Optional.of(word), optional -> Optional.of(optional.get().length())), is(Optional.of(12)));
}
private <V, R> Optional<R> bind(Optional<V> optional, Function<Optional<V>, Optional<R>> function) {
return function.apply(optional);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compilation completed without error
ACTUAL -
java: 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.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
@Test
public void test() {
String word = "Hello world!";
assertThat(bind(Optional.of(word), optional -> Optional.of(optional.get().length())), is(Optional.of(12)));
}
private <V, R> Optional<R> bind(Optional<V> optional, Function<Optional<V>, Optional<R>> function) {
return function.apply(optional);
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
@Test
public void test() {
String word = "Hello world!";
// assertThat(bind(Optional.of(word), optional -> Optional.of(optional.get().length())), is(Optional.of(12)));
assertThat(bind(Optional.of(word), (Optional<String> optional) -> Optional.of(optional.get().length())), is(Optional.of(12)));
}
SUPPORT :
YES