stack trace on master calling List.sort

69 views
Skip to first unread message

Stephen Haberman

unread,
May 22, 2015, 12:32:43 PM5/22/15
to google-web-toolkit-contributors

Sorry for the cheap bug report, but on GWT master, the innocent looking:

    final List<String> f = newArrayList();
    f.sort((a, b) -> a.compareTo(b));

Will result in a compiler NPE:

Caused by: java.lang.NullPointerException
    at com.google.gwt.dev.jjs.ast.JMethod.getJsniSignature(JMethod.java:518)
    at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.computeName(ControlFlowRecorder.java:49)
    at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.processMethodCall(ControlFlowRecorder.java:197)
    at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.visit(ControlFlowRecorder.java:151)
    at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:248)
    at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)

I get the root cause is that List.sort is a new JDK8 method that is not implemented, which is fine, I’ll use Collections.sort and everything is fine, but I was just surprised to see the compiler actually stack trace vs. fail with a nicer compiler error.

Feel free to ignore this if this really is expected/unavoidable; admittedly I don’t know what the previous behavior was in this situation of a super-sourced class missing a method.

- Stephen

Reply all
Reply to author
Forward
0 new messages