Skip to content

Commit

Permalink
BCEL6: avoid exceptions on INVOKEDYNAMIC instructions, see findbugspr…
Browse files Browse the repository at this point in the history
…oject#106

Created TODO's in the code to avoid analysis errors while visiting
INVOKEDYNAMIC instructions.
  • Loading branch information
iloveeclipse committed Jun 8, 2016
1 parent b6bcb26 commit 070c1f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions findbugs/src/java/edu/umd/cs/findbugs/ba/Hierarchy2.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ Set<XMethod> resolveMethodCallTargets(InvokeInstruction invokeInstruction, TypeF
return Collections.<XMethod> emptySet();
}

// XXX handle INVOKEDYNAMIC
if (opcode == Constants.INVOKEDYNAMIC) {
return Collections.<XMethod> emptySet();
}

Type receiverType;
boolean receiverTypeIsExact;

Expand Down
9 changes: 7 additions & 2 deletions findbugs/src/java/edu/umd/cs/findbugs/ba/jsr305/Analysis.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.annotation.meta.When;

import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.INVOKEDYNAMIC;
import org.apache.bcel.generic.Instruction;
import org.apache.bcel.generic.InvokeInstruction;

Expand Down Expand Up @@ -105,8 +106,12 @@ public static Collection<TypeQualifierValue<?>> getRelevantTypeQualifiers(Method
Location location = i.next();
Instruction ins = location.getHandle().getInstruction();
if (ins instanceof InvokeInstruction) {
XMethod called = XFactory.createXMethod((InvokeInstruction) ins, cpg);
addEffectiveRelevantQualifiers(result, called);
if (ins instanceof INVOKEDYNAMIC) {
// TODO handle INVOKEDYNAMIC
} else {
XMethod called = XFactory.createXMethod((InvokeInstruction) ins, cpg);
addEffectiveRelevantQualifiers(result, called);
}
}

if (DEBUG_FIND_EFFECTIVE_RELEVANT_QUALIFIERS) {
Expand Down

0 comments on commit 070c1f3

Please sign in to comment.