APIdia Launch Partner
Top Description Inners Fields Constructors Methods
java.lang.invoke

pack-priv abstract Class AbstractConstantGroup

extends Object
implements ConstantGroup
Class Inheritance
All Implemented Interfaces
java.lang.invoke.ConstantGroup
Known Direct Subclasses
java.lang.invoke.AbstractConstantGroup.SubGroup, java.lang.invoke.AbstractConstantGroup.WithCache
Imports
java.util.*, jdk.internal.vm.annotation.Stable

Utility class for implementing ConstantGroup.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
AbstractConstantGroup.BSCIWithCache<T>

Skeleton implementation of BootstrapCallInfo.

pack-priv static class
pack-priv abstract static class

Field Summary

Modifier and TypeField and Description
protected final int
size

The size of this constant group, set permanently by the constructor.

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractConstantGroup(int
the size of this constant group, set permanently by the constructor
size
)

The constructor requires the size of the constant group being represented.

Method Summary

Modifier and TypeMethod and Description
public abstract Object
get(int index)

Redeclares java.lang.invoke.ConstantGroup.get.

Returns the selected constant, resolving it if necessary.

public abstract Object
get(int index, Object ifNotPresent)

Redeclares java.lang.invoke.ConstantGroup.get.

Returns the selected constant, or the given sentinel value if there is none available.

public abstract boolean
isPresent(int index)

Redeclares java.lang.invoke.ConstantGroup.isPresent.

Returns an indication of whether a constant may be available.

public final int
size()

Implements java.lang.invoke.ConstantGroup.size.

Returns the number of constants in this group.

public String

Returns:

this.asList("*").toString()
toString
()

Overrides java.lang.Object.toString.

Produce a string using the non-resolving list view, where unresolved elements are presented as asterisks.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

sizeback to summary
protected final int size

The size of this constant group, set permanently by the constructor.

Constructor Detail

AbstractConstantGroupback to summary
pack-priv AbstractConstantGroup(int size)

The constructor requires the size of the constant group being represented.

Parameters
size:int

the size of this constant group, set permanently by the constructor

Method Detail

getback to summary
public abstract Object get(int index) throws LinkageError

Redeclares java.lang.invoke.ConstantGroup.get.

Doc from java.lang.invoke.ConstantGroup.get.

Returns the selected constant, resolving it if necessary. Throws a linkage error if resolution proves impossible.

Exceptions
LinkageError:
if the selected constant needs resolution and cannot be resolved
getback to summary
public abstract Object get(int index, Object ifNotPresent)

Redeclares java.lang.invoke.ConstantGroup.get.

Doc from java.lang.invoke.ConstantGroup.get.

Returns the selected constant, or the given sentinel value if there is none available. If the constant cannot be resolved, the sentinel will be returned. If the constant can (perhaps) be resolved, but has not yet been resolved, then the sentinel may be returned, at the implementation's discretion. To force resolution (and a possible exception), call get(int).

isPresentback to summary
public abstract boolean isPresent(int index)

Redeclares java.lang.invoke.ConstantGroup.isPresent.

Doc from java.lang.invoke.ConstantGroup.isPresent.

Returns an indication of whether a constant may be available. If it returns true, it will always return true in the future, and a call to get(int) will never throw an exception.

After a normal return from get(int) or a present value is reported from get(int, Object), this method must always return true.

If this method returns false, nothing in particular can be inferred, since the query only concerns the internal logic of the ConstantGroup object which ensures that a successful query to a constant will always remain successful. The only way to force a permanent decision about whether a constant is available is to call get(int) and be ready for an exception if the constant is unavailable.

sizeback to summary
public final int size()

Implements java.lang.invoke.ConstantGroup.size.

Doc from java.lang.invoke.ConstantGroup.size.

Returns the number of constants in this group. This value never changes, for any particular group.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Produce a string using the non-resolving list view, where unresolved elements are presented as asterisks.

Returns:String

this.asList("*").toString()

Annotations
@Override
java.lang.invoke back to summary

pack-priv Class AbstractConstantGroup.AsIterator

extends Object
implements Iterator<Object>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final int
private final Object
private int
private final boolean
private final ConstantGroup

Constructor Summary

AccessConstructor and Description
private
AsIterator(ConstantGroup self, int start, int end, boolean resolving, Object ifNotPresent)

pack-priv
AsIterator(ConstantGroup self, int start, int end)

pack-priv
AsIterator(ConstantGroup self, int start, int end, Object ifNotPresent)

Method Summary

Modifier and TypeMethod and Description
private int
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public Object
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endback to summary
private final int end
ifNotPresentback to summary
private final Object ifNotPresent
indexback to summary
private int index
resolvingback to summary
private final boolean resolving
selfback to summary
private final ConstantGroup self

Constructor Detail

AsIteratorback to summary
private AsIterator(ConstantGroup self, int start, int end, boolean resolving, Object ifNotPresent)
AsIteratorback to summary
pack-priv AsIterator(ConstantGroup self, int start, int end)
AsIteratorback to summary
pack-priv AsIterator(ConstantGroup self, int start, int end, Object ifNotPresent)

Method Detail

bumpIndexback to summary
private int bumpIndex()
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Annotations
@Override
nextback to summary
public Object next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Annotations
@Override
java.lang.invoke back to summary

pack-priv Class AbstractConstantGroup.AsList

extends AbstractList<Object>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Object
private final int
private final boolean
private final ConstantGroup
private final int
Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
private
AsList(ConstantGroup self, int start, int end, boolean resolving, Object ifNotPresent)

pack-priv
AsList(ConstantGroup self, int start, int end)

pack-priv
AsList(ConstantGroup self, int start, int end, Object ifNotPresent)

Method Summary

Modifier and TypeMethod and Description
public Object
get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

public Iterator<Object>
iterator()

Overrides java.util.AbstractList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this list in proper sequence.

private int
mapIndex(int index)

public final int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.

public List<Object>
subList(int start, int end)

Overrides java.util.AbstractList.subList.

Implements java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

public Object[]
toArray()

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

public <T> T[]
toArray(T[] a)

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

Inherited from java.util.AbstractList:
addaddaddAllclearequalshashCodeindexOflastIndexOflistIteratorlistIteratorremoveremoveRangeset

Field Detail

ifNotPresentback to summary
private final Object ifNotPresent
offsetback to summary
private final int offset
resolvingback to summary
private final boolean resolving
selfback to summary
private final ConstantGroup self
sizeback to summary
private final int size

Constructor Detail

AsListback to summary
private AsList(ConstantGroup self, int start, int end, boolean resolving, Object ifNotPresent)
AsListback to summary
pack-priv AsList(ConstantGroup self, int start, int end)
AsListback to summary
pack-priv AsList(ConstantGroup self, int start, int end, Object ifNotPresent)

Method Detail

getback to summary
public Object get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Doc from java.util.AbstractList.get.

Returns the element at the specified position in this list.

Annotations
@Override
iteratorback to summary
public Iterator<Object> iterator()

Overrides java.util.AbstractList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Doc from java.util.AbstractList.iterator.

Returns an iterator over the elements in this list in proper sequence.

Annotations
@Override
mapIndexback to summary
private int mapIndex(int index)
sizeback to summary
public final int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Annotations
@Override
subListback to summary
public List<Object> subList(int start, int end)

Overrides java.util.AbstractList.subList.

Implements java.util.List.subList.

Doc from java.util.AbstractList.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned list is empty.) The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa. The returned list supports all of the optional list operations supported by this list.

This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:

list.subList(from, to).clear();
Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList.

The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)

Annotations
@Override
toArrayback to summary
public Object[] toArray()

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.

This method acts as bridge between array-based and collection-based APIs.

Annotations
@Override
toArrayback to summary
public <T> T[] toArray(T[] a)

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.

If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)

Like the toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method allows precise control over the runtime type of the output array, and may, under certain circumstances, be used to save allocation costs.

Suppose x is a list known to contain only strings. The following code can be used to dump the list into a newly allocated array of String:

String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to toArray().
Annotations
@Override
java.lang.invoke back to summary

pack-priv Class AbstractConstantGroup.BSCIWithCache<T>

extends WithCache
implements BootstrapCallInfo<T>
Class Inheritance
All Implemented Interfaces
java.lang.invoke.BootstrapCallInfo, java.lang.invoke.ConstantGroup
Known Direct Subclasses
java.lang.invoke.BootstrapMethodInvoker.VM_BSCI

Skeleton implementation of BootstrapCallInfo.

Field Summary

Modifier and TypeField and Description
private final MethodHandle
private final String
private final T
Inherited from java.lang.invoke.AbstractConstantGroup.WithCache:
cacheNOT_PRESENTRESOLVED_TO_NULL

Constructor Summary

AccessConstructor and Description
pack-priv
BSCIWithCache(MethodHandle bsm, String name, T type, int size)

Method Summary

Modifier and TypeMethod and Description
public MethodHandle
bootstrapMethod()

Implements java.lang.invoke.BootstrapCallInfo.bootstrapMethod.

Returns the bootstrap method for this call.

public String
invocationName()

Implements java.lang.invoke.BootstrapCallInfo.invocationName.

Returns the method name or constant name for this call.

public T
invocationType()

Implements java.lang.invoke.BootstrapCallInfo.invocationType.

Returns the method type or constant type for this call.

public String
toString()

Overrides java.lang.invoke.AbstractConstantGroup.toString.

Produce a string using the non-resolving list view, where unresolved elements are presented as asterisks.

Inherited from java.lang.invoke.AbstractConstantGroup.WithCache:
fillCachegetgetinitializeCacheisPresentunwrapNullwrapNull

Field Detail

bsmback to summary
private final MethodHandle bsm
nameback to summary
private final String name
typeback to summary
private final T type

Constructor Detail

BSCIWithCacheback to summary
pack-priv BSCIWithCache(MethodHandle bsm, String name, T type, int size)

Method Detail

bootstrapMethodback to summary
public MethodHandle bootstrapMethod()

Implements java.lang.invoke.BootstrapCallInfo.bootstrapMethod.

Doc from java.lang.invoke.BootstrapCallInfo.bootstrapMethod.

Returns the bootstrap method for this call.

Annotations
@Override
invocationNameback to summary
public String invocationName()

Implements java.lang.invoke.BootstrapCallInfo.invocationName.

Doc from java.lang.invoke.BootstrapCallInfo.invocationName.

Returns the method name or constant name for this call.

Annotations
@Override
invocationTypeback to summary
public T invocationType()

Implements java.lang.invoke.BootstrapCallInfo.invocationType.

Doc from java.lang.invoke.BootstrapCallInfo.invocationType.

Returns the method type or constant type for this call.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.invoke.AbstractConstantGroup.toString.

Doc from java.lang.invoke.AbstractConstantGroup.toString.

Produce a string using the non-resolving list view, where unresolved elements are presented as asterisks.

Annotations
@Override
java.lang.invoke back to summary

pack-priv Class AbstractConstantGroup.SubGroup

extends AbstractConstantGroup
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private final ConstantGroup
Inherited from java.lang.invoke.AbstractConstantGroup:
size

Constructor Summary

AccessConstructor and Description
pack-priv
SubGroup(ConstantGroup self, int start, int end)

Method Summary

Modifier and TypeMethod and Description
public List<Object>
asList()

Overrides default java.lang.invoke.ConstantGroup.asList.

Create a view on this group as a List view.

public List<Object>
asList(Object ifNotPresent)

Overrides default java.lang.invoke.ConstantGroup.asList.

Create a view on this group as a List view.

public int
copyConstants(int start, int end, Object[] buf, int pos)

Overrides default java.lang.invoke.ConstantGroup.copyConstants.

Copy a sequence of constant values into a given buffer.

public int
copyConstants(int start, int end, Object[] buf, int pos, Object ifNotPresent)

Overrides default java.lang.invoke.ConstantGroup.copyConstants.

Copy a sequence of constant values into a given buffer.

public Object
get(int index)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Returns the selected constant, resolving it if necessary.

public Object
get(int index, Object ifNotPresent)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Returns the selected constant, or the given sentinel value if there is none available.

public boolean
isPresent(int index)

Implements abstract java.lang.invoke.AbstractConstantGroup.isPresent.

Implements java.lang.invoke.ConstantGroup.isPresent.

Returns an indication of whether a constant may be available.

private int
mapIndex(int index)

public ConstantGroup
subGroup(int start, int end)

Overrides default java.lang.invoke.ConstantGroup.subGroup.

Create a view on a sub-sequence of this group.

Inherited from java.lang.invoke.AbstractConstantGroup:
sizetoString

Field Detail

offsetback to summary
private final int offset
selfback to summary
private final ConstantGroup self

Constructor Detail

SubGroupback to summary
pack-priv SubGroup(ConstantGroup self, int start, int end)

Method Detail

asListback to summary
public List<Object> asList()

Overrides default java.lang.invoke.ConstantGroup.asList.

Doc from java.lang.invoke.ConstantGroup.asList.

Create a view on this group as a List view. Any request for a constant through this view will force resolution.

Annotations
@Override
asListback to summary
public List<Object> asList(Object ifNotPresent)

Overrides default java.lang.invoke.ConstantGroup.asList.

Doc from java.lang.invoke.ConstantGroup.asList.

Create a view on this group as a List view. Any request for a constant through this view will return the given sentinel value, if the corresponding call to get(int, Object) would do so.

Annotations
@Override
copyConstantsback to summary
public int copyConstants(int start, int end, Object[] buf, int pos) throws LinkageError

Overrides default java.lang.invoke.ConstantGroup.copyConstants.

Doc from java.lang.invoke.ConstantGroup.copyConstants.

Copy a sequence of constant values into a given buffer. This is equivalent to end-offset separate calls to get, for each index in the range from offset up to but not including end. For the first constant that cannot be resolved, a LinkageError is thrown, but only after preceding constant value have been stored.

Annotations
@Override
Exceptions
LinkageError:
if a constant cannot be resolved
copyConstantsback to summary
public int copyConstants(int start, int end, Object[] buf, int pos, Object ifNotPresent)

Overrides default java.lang.invoke.ConstantGroup.copyConstants.

Doc from java.lang.invoke.ConstantGroup.copyConstants.

Copy a sequence of constant values into a given buffer. This is equivalent to end-offset separate calls to get, for each index in the range from offset up to but not including end. Any constants that cannot be resolved are replaced by the given sentinel value.

Annotations
@Override
getback to summary
public Object get(int index)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Doc from java.lang.invoke.ConstantGroup.get.

Returns the selected constant, resolving it if necessary. Throws a linkage error if resolution proves impossible.

Annotations
@Override
getback to summary
public Object get(int index, Object ifNotPresent)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Doc from java.lang.invoke.ConstantGroup.get.

Returns the selected constant, or the given sentinel value if there is none available. If the constant cannot be resolved, the sentinel will be returned. If the constant can (perhaps) be resolved, but has not yet been resolved, then the sentinel may be returned, at the implementation's discretion. To force resolution (and a possible exception), call get(int).

Annotations
@Override
isPresentback to summary
public boolean isPresent(int index)

Implements abstract java.lang.invoke.AbstractConstantGroup.isPresent.

Implements java.lang.invoke.ConstantGroup.isPresent.

Doc from java.lang.invoke.ConstantGroup.isPresent.

Returns an indication of whether a constant may be available. If it returns true, it will always return true in the future, and a call to get(int) will never throw an exception.

After a normal return from get(int) or a present value is reported from get(int, Object), this method must always return true.

If this method returns false, nothing in particular can be inferred, since the query only concerns the internal logic of the ConstantGroup object which ensures that a successful query to a constant will always remain successful. The only way to force a permanent decision about whether a constant is available is to call get(int) and be ready for an exception if the constant is unavailable.

Annotations
@Override
mapIndexback to summary
private int mapIndex(int index)
subGroupback to summary
public ConstantGroup subGroup(int start, int end)

Overrides default java.lang.invoke.ConstantGroup.subGroup.

Doc from java.lang.invoke.ConstantGroup.subGroup.

Create a view on a sub-sequence of this group.

Annotations
@Override
java.lang.invoke back to summary

pack-priv abstract Class AbstractConstantGroup.WithCache

extends AbstractConstantGroup
Class Inheritance
Known Direct Subclasses
java.lang.invoke.AbstractConstantGroup.BSCIWithCache

Field Summary

Modifier and TypeField and Description
pack-priv final Object[]
pack-priv static final Object
pack-priv static final Object
Inherited from java.lang.invoke.AbstractConstantGroup:
size

Constructor Summary

AccessConstructor and Description
pack-priv
WithCache(int size)

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
fillCache(int i)

hook for local subclasses

public Object
get(int i)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Returns the selected constant, resolving it if necessary.

public Object
get(int i, Object ifNotAvailable)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Returns the selected constant, or the given sentinel value if there is none available.

pack-priv void
initializeCache(List<Object> cacheContents, Object ifNotPresent)

public boolean
isPresent(int i)

Implements abstract java.lang.invoke.AbstractConstantGroup.isPresent.

Implements java.lang.invoke.ConstantGroup.isPresent.

Returns an indication of whether a constant may be available.

pack-priv static Object
pack-priv static Object
Inherited from java.lang.invoke.AbstractConstantGroup:
sizetoString

Field Detail

cacheback to summary
pack-priv final Object[] cache
Annotations
@Stable
NOT_PRESENTback to summary
pack-priv static final Object NOT_PRESENT
RESOLVED_TO_NULLback to summary
pack-priv static final Object RESOLVED_TO_NULL

Constructor Detail

WithCacheback to summary
pack-priv WithCache(int size)

Method Detail

fillCacheback to summary
pack-priv Object fillCache(int i)

hook for local subclasses

getback to summary
public Object get(int i)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Doc from java.lang.invoke.ConstantGroup.get.

Returns the selected constant, resolving it if necessary. Throws a linkage error if resolution proves impossible.

Annotations
@Override
getback to summary
public Object get(int i, Object ifNotAvailable)

Implements abstract java.lang.invoke.AbstractConstantGroup.get.

Implements java.lang.invoke.ConstantGroup.get.

Doc from java.lang.invoke.ConstantGroup.get.

Returns the selected constant, or the given sentinel value if there is none available. If the constant cannot be resolved, the sentinel will be returned. If the constant can (perhaps) be resolved, but has not yet been resolved, then the sentinel may be returned, at the implementation's discretion. To force resolution (and a possible exception), call get(int).

Annotations
@Override
initializeCacheback to summary
pack-priv void initializeCache(List<Object> cacheContents, Object ifNotPresent)
isPresentback to summary
public boolean isPresent(int i)

Implements abstract java.lang.invoke.AbstractConstantGroup.isPresent.

Implements java.lang.invoke.ConstantGroup.isPresent.

Doc from java.lang.invoke.ConstantGroup.isPresent.

Returns an indication of whether a constant may be available. If it returns true, it will always return true in the future, and a call to get(int) will never throw an exception.

After a normal return from get(int) or a present value is reported from get(int, Object), this method must always return true.

If this method returns false, nothing in particular can be inferred, since the query only concerns the internal logic of the ConstantGroup object which ensures that a successful query to a constant will always remain successful. The only way to force a permanent decision about whether a constant is available is to call get(int) and be ready for an exception if the constant is unavailable.

Annotations
@Override
unwrapNullback to summary
pack-priv static Object unwrapNull(Object x)
wrapNullback to summary
pack-priv static Object wrapNull(Object x)