Last active
August 29, 2015 14:11
-
-
Save tnymlr/eb28e44dcadb9f8e9de3 to your computer and use it in GitHub Desktop.
Javac (1.8.0_25) bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ermys; | |
/** | |
* Hello world! | |
* | |
*/ | |
public class App | |
{ | |
@FunctionalInterface | |
public interface FunctionalInterfaceFoo<X, Y> { | |
public boolean apply(X x, Y y); | |
public default FunctionalInterfaceFoo<X, Y> or(FunctionalInterfaceFoo<X, Y> condition) { | |
return (x, y) -> this.apply(x, y) || condition.apply(x, y); | |
} | |
public default FunctionalInterfaceFoo<X, Y> and(FunctionalInterfaceFoo<X, Y> condition) { | |
return (x, y) -> this.apply(x, y) || condition.apply(x, y); | |
} | |
} | |
public interface SpecificFunctionalInterfaceFoo<Z> extends FunctionalInterfaceFoo<Integer, Z> { | |
@Override | |
public boolean apply(Integer integer, Z z); | |
} | |
public enum EnumWithFunctionalInterface implements SpecificFunctionalInterfaceFoo<Object> { | |
ANY((x, y) -> true), | |
EQUALS ((x, y) -> x.equals(y)); | |
private final SpecificFunctionalInterfaceFoo action; | |
private EnumWithFunctionalInterface(SpecificFunctionalInterfaceFoo action) { | |
this.action = action; | |
} | |
@Override | |
public boolean apply(Integer integer, Object o) { | |
return action.apply(integer, o); | |
} | |
} | |
public static void main( String[] args ) | |
{ | |
System.out.println(EnumWithFunctionalInterface.ANY); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment