Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port the missing branch for ConstantDynamic #1102

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.objectweb.asm.ConstantDynamic;
import org.objectweb.asm.Handle;
import org.objectweb.asm.commons.JSRInlinerAdapter;
import org.objectweb.asm.tree.*;
Expand Down Expand Up @@ -961,6 +963,15 @@ private Immediate toSootValue(@Nonnull Object val) throws UnsupportedOperationEx
JavaJimple.getInstance()
.newMethodHandle(toSootFieldSignature((Handle) val), ((Handle) val).getTag());
}
} else if (val instanceof ConstantDynamic) {
ConstantDynamic cd = (ConstantDynamic) val;
if (MethodHandle.isMethodRef(cd.getBootstrapMethod().getTag())) {
v = JavaJimple.getInstance()
.newMethodHandle(toMethodSignature(cd.getBootstrapMethod()), cd.getBootstrapMethod().getTag());
} else {
v = JavaJimple.getInstance()
.newMethodHandle(toSootFieldSignature(cd.getBootstrapMethod()), cd.getBootstrapMethod().getTag());
}
} else {
throw new UnsupportedOperationException("Unknown constant type: " + val.getClass());
}
Expand Down
Loading