Summary: Our patch to Javalib has been accepted, so we can parse programs with invokedynamic! invokedynamic still crashes Sawja, but I have worked around this by replacing all invokedynamic's with invokestatic's before passing them to Sawja. This means we can handle everything about invokedynamic except calling the correct function (I call a dummy function with the correct signature for now). We can try to actually call the right method in the future. Reviewed By: jvillard Differential Revision: D4160384 fbshipit-source-id: a8ef4e1master
parent
b792d04fbd
commit
75d6fb30e4
@ -1,3 +1,7 @@
|
||||
|
||||
[project]
|
||||
ignore = .git, .ml, .mli
|
||||
|
||||
[java]
|
||||
source_level = 8
|
||||
target_level = 8
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2016 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package codetoanalyze.java.infer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class InvokeDynamic {
|
||||
|
||||
void invokeDynamicThenNpeBad(List<String> list) {
|
||||
Object o = null;
|
||||
Collections.sort(list, (String a, String b) -> {
|
||||
return b.compareTo(a);
|
||||
});
|
||||
o.toString();
|
||||
}
|
||||
|
||||
void npeInLambdaBad(List<String> list) {
|
||||
Collections.sort(list, (String a, String b) -> {
|
||||
Object o = null;
|
||||
o.toString();
|
||||
return b.compareTo(a);
|
||||
});
|
||||
}
|
||||
|
||||
// we won't get this one because we don't actually translate the invocation of the lambda
|
||||
void FN_npeViaCaptureBad(List<String> list) {
|
||||
String s = null;
|
||||
Collections.sort(list, (String a, String b) -> {
|
||||
return s.compareTo(a);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue