From 7c274812d6079d0f11e38937ba5b92cd41a95991 Mon Sep 17 00:00:00 2001 From: Sacha Coppey Date: Wed, 20 Sep 2023 12:16:07 +0200 Subject: [PATCH] Update BootstrapMethodInvocation.getStaticArguments documentation --- .../share/classes/jdk/vm/ci/meta/ConstantPool.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java index c75081e46109c..2273b256f0315 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java @@ -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: * *
          * List args = bmi.getStaticArguments();
          * List 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);
          * }