This is a compiler error that affects both Scala 2.8 and 2.9, where the compiler does not compute the proper trimmed method signature. I do not know the error report.
Method compilation:
object Test { def main(a: Array[String]) { val a = new java.util.ArrayList[String]() java.util.Collections.max(a) }}
Results in the following bytecode:
public void main(java.lang.String[]); Code: Stack=2, Locals=3, Args_size=2 0: new #16; //class java/util/ArrayList 3: dup 4: invokespecial #18; //Method java/util/ArrayList."<init>":()V 7: astore_2 8: aload_2 9: invokestatic #24; //Method java/util/Collections.max:(Ljava/util/Collection;)Ljava/lang/Comparable; 12: pop 13: return
Note that the bytecode in offset 9 calls the static method with the return type Comparable , while the actual Collections.max has an Object as the return type:
$ javap -p java.util.Collections | grep max public static java.lang.Object max(java.util.Collection);
notnoop
source share