Top Description Inners Fields Constructors Methods
com.sun.tools.javac.jvm

public Class PoolReader

extends Object
Class Inheritance
Imports
com.sun.tools.javac.code.Source, .Symbol.ClassSymbol, .Symbol.ModuleSymbol, .Symbol.PackageSymbol, .Symtab, .Type, com.sun.tools.javac.jvm.PoolConstant.NameAndType, com.sun.tools.javac.resources.CompilerProperties.Fragments, .CompilerProperties.Warnings, com.sun.tools.javac.util.ByteBuffer, .ByteBuffer.UnderflowException, .Convert, .InvalidUtfException, .Name, .Names, java.util.Arrays, .BitSet

Pool interface towards ClassReader. Exposes methods to decode and read javac entities from the constant pool.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
public static interface

Field Summary

Modifier and TypeField and Description
private final ByteBuffer
private static final BitSet
private static final BitSet
private static final BitSet
private static final BitSet
private final Names
private static final BitSet
private PoolReader.ImmutablePoolHelper
private final ClassReader
private final Symtab
private static final BitSet
private final Convert.Validation

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
PoolReader(ClassReader reader, Names names, Symtab syms)

pack-priv
PoolReader(ClassReader reader, ByteBuffer buf, Names names, Symtab syms)

Method Summary

Modifier and TypeMethod and Description
pack-priv Symbol.ClassSymbol
getClass(int index)

Get a class symbol from the pool at given index.

pack-priv Object
getConstant(int index)

Get a class symbol from the pool at given index.

pack-priv Symbol.ModuleSymbol
getModule(int index)

Get a module symbol from the pool at given index.

pack-priv Name
getName(int index)

Get a name from the pool at given index.

pack-priv PoolConstant.NameAndType
getNameAndType(int index)

Get a name and type pair from the pool at given index.

pack-priv Symbol.PackageSymbol
getPackage(int index)

Get a module symbol from the pool at given index.

pack-priv Type
getType(int index)

Get a type from the pool at given index.

private <Z> Z
getUtf8(int index, PoolReader.Utf8Mapper<Z> mapper)

pack-priv boolean
hasTag(int index, int tag)

pack-priv <Z> Z
peekClassName(int index, PoolReader.Utf8Mapper<Z> mapper)

Get class name without resolving

private <Z> Z
peekItemName(int index, PoolReader.Utf8Mapper<Z> mapper)

pack-priv <Z> Z
peekModuleName(int index, PoolReader.Utf8Mapper<Z> mapper)

Get module name without resolving

pack-priv <Z> Z
peekName(int index, PoolReader.Utf8Mapper<Z> mapper)

Peek a name from the pool at given index without resolving.

pack-priv <Z> Z
peekPackageName(int index, PoolReader.Utf8Mapper<Z> mapper)

Get package name without resolving

pack-priv int
readPool(ByteBuffer poolbuf, int offset)

Parse all constant pool entries, and keep track of their offsets.

private int
readPoolInternal(ByteBuffer poolbuf, int offset)

private Object
resolve(ByteBuffer poolbuf, int tag, int offset)

private int
sizeof(int tag)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private final ByteBuffer buf
classCPback to summary
private static final BitSet classCP
constantCPback to summary
private static final BitSet constantCP
moduleCPback to summary
private static final BitSet moduleCP
nameAndTypeCPback to summary
private static final BitSet nameAndTypeCP
namesback to summary
private final Names names
packageCPback to summary
private static final BitSet packageCP
poolback to summary
private PoolReader.ImmutablePoolHelper pool
readerback to summary
private final ClassReader reader
symsback to summary
private final Symtab syms
utf8CPback to summary
private static final BitSet utf8CP
utf8validationback to summary
private final Convert.Validation utf8validation

Constructor Detail

PoolReaderback to summary
pack-priv PoolReader(ByteBuffer buf)
PoolReaderback to summary
pack-priv PoolReader(ClassReader reader, Names names, Symtab syms)
PoolReaderback to summary
pack-priv PoolReader(ClassReader reader, ByteBuffer buf, Names names, Symtab syms)

Method Detail

getClassback to summary
pack-priv Symbol.ClassSymbol getClass(int index)

Get a class symbol from the pool at given index.

getConstantback to summary
pack-priv Object getConstant(int index)

Get a class symbol from the pool at given index.

getModuleback to summary
pack-priv Symbol.ModuleSymbol getModule(int index)

Get a module symbol from the pool at given index.

getNameback to summary
pack-priv Name getName(int index)

Get a name from the pool at given index.

getNameAndTypeback to summary
pack-priv PoolConstant.NameAndType getNameAndType(int index)

Get a name and type pair from the pool at given index.

getPackageback to summary
pack-priv Symbol.PackageSymbol getPackage(int index)

Get a module symbol from the pool at given index.

getTypeback to summary
pack-priv Type getType(int index)

Get a type from the pool at given index.

getUtf8back to summary
private <Z> Z getUtf8(int index, PoolReader.Utf8Mapper<Z> mapper) throws InvalidUtfException, UnderflowException
hasTagback to summary
pack-priv boolean hasTag(int index, int tag)
peekClassNameback to summary
pack-priv <Z> Z peekClassName(int index, PoolReader.Utf8Mapper<Z> mapper)

Get class name without resolving

peekItemNameback to summary
private <Z> Z peekItemName(int index, PoolReader.Utf8Mapper<Z> mapper)
peekModuleNameback to summary
pack-priv <Z> Z peekModuleName(int index, PoolReader.Utf8Mapper<Z> mapper)

Get module name without resolving

peekNameback to summary
pack-priv <Z> Z peekName(int index, PoolReader.Utf8Mapper<Z> mapper)

Peek a name from the pool at given index without resolving.

peekPackageNameback to summary
pack-priv <Z> Z peekPackageName(int index, PoolReader.Utf8Mapper<Z> mapper)

Get package name without resolving

readPoolback to summary
pack-priv int readPool(ByteBuffer poolbuf, int offset)

Parse all constant pool entries, and keep track of their offsets. For performance and laziness reasons, it would be unwise to eagerly turn all pool entries into corresponding javac entities. First, not all entries are actually going to be read/used by javac; secondly, there are cases where creating a symbol too early might result in issues (hence methods like PoolReader#peekClassName(int, Utf8Mapper).

readPoolInternalback to summary
private int readPoolInternal(ByteBuffer poolbuf, int offset) throws UnderflowException
resolveback to summary
private Object resolve(ByteBuffer poolbuf, int tag, int offset) throws InvalidUtfException, UnderflowException
sizeofback to summary
private int sizeof(int tag)
com.sun.tools.javac.jvm back to summary

pack-priv Class PoolReader.ImmutablePoolHelper

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final int[]
pack-priv final ByteBuffer
pack-priv final Object[]

Constructor Summary

AccessConstructor and Description
public
ImmutablePoolHelper(ByteBuffer poolbuf, int[] offsets)

Method Summary

Modifier and TypeMethod and Description
private int
checkIndex(int index)

pack-priv int
offset(int index)

pack-priv <P> P
readIfNeeded(int index, BitSet expectedTags)

pack-priv int
tag(int index)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

offsetsback to summary
pack-priv final int[] offsets
poolbufback to summary
pack-priv final ByteBuffer poolbuf
valuesback to summary
pack-priv final Object[] values

Constructor Detail

ImmutablePoolHelperback to summary
public ImmutablePoolHelper(ByteBuffer poolbuf, int[] offsets)

Method Detail

checkIndexback to summary
private int checkIndex(int index)
offsetback to summary
pack-priv int offset(int index)
readIfNeededback to summary
pack-priv <P> P readIfNeeded(int index, BitSet expectedTags)
Annotations
@SuppressWarnings:unchecked
tagback to summary
pack-priv int tag(int index)
com.sun.tools.javac.jvm back to summary

public Interface PoolReader.Utf8Mapper<X>


Method Summary

Modifier and TypeMethod and Description
public X
map(byte[] bytes, int offset, int len)

Method Detail

mapback to summary
public X map(byte[] bytes, int offset, int len) throws InvalidUtfException