Skip to content

Commit

Permalink
Update BootstrapMethodInvocation.getStaticArguments documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeavee committed Sep 20, 2023
1 parent ea4aa98 commit 7c27481
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,22 @@ interface BootstrapMethodInvocation {
/**
* Gets the static arguments with which the bootstrap method will be invoked.
*
* An argument of type {@link PrimitiveConstant} represents a {@code CONSTANT_Dynamic_info}
* entry. To resolve this entry, the corresponding bootstrap method has to be called first:
* The {@linkplain JavaConstant#getJavaKind kind} of each argument will be
* {@link JavaKind#Object} or {@link JavaKind#Int}. The latter represents an
* unresolved {@code CONSTANT_Dynamic_info} entry. To resolve this entry, the
* corresponding bootstrap method has to be called first:
*
* <pre>
* List<JavaConstant> args = bmi.getStaticArguments();
* List<JavaConstant> resolvedArgs = new ArrayList<>(args.size());
* for (JavaConstant c : args) {
* JavaConstant r = c;
* if (c instanceof PrimitiveConstant pc) {
* if (c.getJavaKind() == JavaKind.Int) {
* // If needed, access corresponding BootstrapMethodInvocation using
* // cp.lookupBootstrapMethodInvocation(pc.asInt(), -1)
* r = cp.lookupConstant(pc.asInt(), true);
* r = cp.lookupConstant(c.asInt(), true);
* } else {
* assert c.getJavaKind() == JavaKind.Object;
* }
* resolvedArgs.append(r);
* }
Expand Down

0 comments on commit 7c27481

Please sign in to comment.