Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make FunctionN into be a functional interface
And do the same for the specialized variants. Tested by a Java source file that uses lambda syntax to create instances of generic and specialized `Function{0,1}`. Here's how the interfaces look now: ``` % javap -c -classpath /tmp/function 'scala.Function1' Compiled from "Function1.scala" public interface scala.Function1<T1, R> { public abstract R apply(T1); public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>); Code: 0: aload_0 1: aload_1 2: invokestatic #18 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1; 5: areturn public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>); Code: 0: aload_0 1: aload_1 2: invokestatic #24 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1; 5: areturn public abstract java.lang.String toString(); public int apply$mcII$sp(int); Code: 0: aload_0 1: iload_1 2: invokestatic #110 // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I 5: ireturn public long apply$mcJI$sp(int); Code: 0: aload_0 1: iload_1 2: invokestatic #115 // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J 5: lreturn ... } % javap -c -classpath /tmp/function 'scala.Function1$mcII$sp' Compiled from "Function1.scala" public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> { public java.lang.Object apply(java.lang.Object); Code: 0: aload_0 1: aload_1 2: invokestatic #16 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I 5: invokeinterface #19, 2 // InterfaceMethod apply:(I)I 10: invokestatic #23 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; 13: areturn public abstract int apply$mcII$sp(int); public int apply(int); Code: 0: aload_0 1: iload_1 2: invokeinterface #30, 2 // InterfaceMethod apply$mcII$sp:(I)I 7: ireturn } ```
- Loading branch information