Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,15 @@ class BootstrapMethodInvocationImpl implements BootstrapMethodInvocation {
private final String name;
private final JavaConstant type;
private final List<JavaConstant> staticArguments;
private final int index;
private final int cpiOrIndyIndex;

BootstrapMethodInvocationImpl(boolean indy, ResolvedJavaMethod method, String name, JavaConstant type, List<JavaConstant> staticArguments, int index) {
BootstrapMethodInvocationImpl(boolean indy, ResolvedJavaMethod method, String name, JavaConstant type, List<JavaConstant> staticArguments, int cpiOrIndyIndex) {
this.indy = indy;
this.method = method;
this.name = name;
this.type = type;
this.staticArguments = staticArguments;
// for indys this holds the indyIndex; otherwise holds the cpi
this.index = index;
this.cpiOrIndyIndex = cpiOrIndyIndex;
}

@Override
Expand Down Expand Up @@ -577,18 +576,18 @@ public List<JavaConstant> getStaticArguments() {
@Override
public void resolve() {
if (isInvokeDynamic()) {
loadReferencedType(index, Bytecodes.INVOKEDYNAMIC);
loadReferencedType(cpiOrIndyIndex, Bytecodes.INVOKEDYNAMIC);
} else {
lookupConstant(index, true);
lookupConstant(cpiOrIndyIndex, true);
}
}

@Override
public JavaConstant lookup() {
if (isInvokeDynamic()) {
return lookupAppendix(index, Bytecodes.INVOKEDYNAMIC);
return lookupAppendix(cpiOrIndyIndex, Bytecodes.INVOKEDYNAMIC);
} else {
return (JavaConstant) lookupConstant(index, false);
return (JavaConstant) lookupConstant(cpiOrIndyIndex, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,19 @@ interface BootstrapMethodInvocation {
List<JavaConstant> getStaticArguments();

/**
* Resolves the element corresponding to this bootstrap. If {@code isInvokeDynamic()}, then the
* corresponding invoke dynamic is resolved. If {@code !isInvokeDynamic()}, then the dynamic constant
* pool entry will be resolved.
* Resolves the element corresponding to this bootstrap. If
* {@code isInvokeDynamic()}, then the corresponding invoke dynamic is resolved.
* If {@code !isInvokeDynamic()}, then the dynamic constant pool entry will be
* resolved.
*
* @jvms 5.4.3.6
*/
void resolve();

/**
* If {@code isInvokeDynamic()}, then this method looks up the
* corresponding invoke dynamic's appendix. If {@code !isInvokeDynamic()},
* then this will return the constant pool entry's value.
* If {@code isInvokeDynamic()}, then this method looks up the corresponding
* invoke dynamic's appendix. If {@code !isInvokeDynamic()}, then this will
* return the constant pool entry's value.
*/
JavaConstant lookup();
}
Expand All @@ -229,13 +230,15 @@ default BootstrapMethodInvocation lookupBootstrapMethodInvocation(int index, int

/**
* Returns either the BootstrapMethodInvocation instances for all invokedynamic
* bytecodes which reference this constant pool, or all {@code CONSTANT_Dynamic_info}
* BootstrapMethodInvocations within this constant pool.
* The returned List is unmodifiable; calls to any mutator method
* will always cause {@code UnsupportedOperationException} to be thrown.
* bytecodes which reference this constant pool, or all
* {@code CONSTANT_Dynamic_info} BootstrapMethodInvocations within this constant
* pool. The returned List is unmodifiable; calls to any mutator method will
* always cause {@code UnsupportedOperationException} to be thrown.
*
* @param invokeDynamic when true, return all invokedynamic BootstrapMethodInvocations;
* otherwise, return all {@code CONSTANT_Dynamic_info} BootstrapMethodInvocations.
* @param invokeDynamic when true, return all invokedynamic
* BootstrapMethodInvocations; otherwise, return all
* {@code CONSTANT_Dynamic_info}
* BootstrapMethodInvocations.
*/
List<BootstrapMethodInvocation> lookupBootstrapMethodInvocations(boolean invokeDynamic);

Expand Down