signature:
public class ClassReader { /** * Reads a JVMS ' element _ value ' structure and makes the given visitor visit it .
 * @ param annotationVisitor the visitor that must visit the element _ value structure .
 * @ param elementValueOffset the start offset in { @ link # b } of the element _ value structure to be
 * read .
 * @ param elementName the name of the element _ value structure to be read , or { @ literal null } .
 * @ param charBuffer the buffer used to read strings in the constant pool .
 * @ return the end offset of the JVMS ' element _ value ' structure . */
private int readElementValue ( final AnnotationVisitor annotationVisitor , final int elementValueOffset , final String elementName , final char [ ] charBuffer ) { } }

implementation:
int currentOffset = elementValueOffset ; if ( annotationVisitor == null ) { switch ( b [ currentOffset ] & 0xFF ) { case 'e' : // enum _ const _ value
return currentOffset + 5 ; case '@' : // annotation _ value
return readElementValues ( null , currentOffset + 3 , /* named = */
true , charBuffer ) ; case '[' : // array _ value
return readElementValues ( null , currentOffset + 1 , /* named = */
false , charBuffer ) ; default : return currentOffset + 3 ; } } switch ( b [ currentOffset ++ ] & 0xFF ) { case 'B' : // const _ value _ index , CONSTANT _ Integer
annotationVisitor . visit ( elementName , ( byte ) readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset ) ] ) ) ; currentOffset += 2 ; break ; case 'C' : // const _ value _ index , CONSTANT _ Integer
annotationVisitor . visit ( elementName , ( char ) readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset ) ] ) ) ; currentOffset += 2 ; break ; case 'D' : // const _ value _ index , CONSTANT _ Double
case 'F' : // const _ value _ index , CONSTANT _ Float
case 'I' : // const _ value _ index , CONSTANT _ Integer
case 'J' : // const _ value _ index , CONSTANT _ Long
annotationVisitor . visit ( elementName , readConst ( readUnsignedShort ( currentOffset ) , charBuffer ) ) ; currentOffset += 2 ; break ; case 'S' : // const _ value _ index , CONSTANT _ Integer
annotationVisitor . visit ( elementName , ( short ) readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset ) ] ) ) ; currentOffset += 2 ; break ; case 'Z' : // const _ value _ index , CONSTANT _ Integer
annotationVisitor . visit ( elementName , readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset ) ] ) == 0 ? Boolean . FALSE : Boolean . TRUE ) ; currentOffset += 2 ; break ; case 's' : // const _ value _ index , CONSTANT _ Utf8
annotationVisitor . visit ( elementName , readUTF8 ( currentOffset , charBuffer ) ) ; currentOffset += 2 ; break ; case 'e' : // enum _ const _ value
annotationVisitor . visitEnum ( elementName , readUTF8 ( currentOffset , charBuffer ) , readUTF8 ( currentOffset + 2 , charBuffer ) ) ; currentOffset += 4 ; break ; case 'c' : // class _ info
annotationVisitor . visit ( elementName , Type . getType ( readUTF8 ( currentOffset , charBuffer ) ) ) ; currentOffset += 2 ; break ; case '@' : // annotation _ value
currentOffset = readElementValues ( annotationVisitor . visitAnnotation ( elementName , readUTF8 ( currentOffset , charBuffer ) ) , currentOffset + 2 , true , charBuffer ) ; break ; case '[' : // array _ value
int numValues = readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; if ( numValues == 0 ) { return readElementValues ( annotationVisitor . visitArray ( elementName ) , currentOffset - 2 , /* named = */
false , charBuffer ) ; } switch ( b [ currentOffset ] & 0xFF ) { case 'B' : byte [ ] byteValues = new byte [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { byteValues [ i ] = ( byte ) readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , byteValues ) ; break ; case 'Z' : boolean [ ] booleanValues = new boolean [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { booleanValues [ i ] = readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) != 0 ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , booleanValues ) ; break ; case 'S' : short [ ] shortValues = new short [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { shortValues [ i ] = ( short ) readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , shortValues ) ; break ; case 'C' : char [ ] charValues = new char [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { charValues [ i ] = ( char ) readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , charValues ) ; break ; case 'I' : int [ ] intValues = new int [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { intValues [ i ] = readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , intValues ) ; break ; case 'J' : long [ ] longValues = new long [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { longValues [ i ] = readLong ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , longValues ) ; break ; case 'F' : float [ ] floatValues = new float [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { floatValues [ i ] = Float . intBitsToFloat ( readInt ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , floatValues ) ; break ; case 'D' : double [ ] doubleValues = new double [ numValues ] ; for ( int i = 0 ; i < numValues ; i ++ ) { doubleValues [ i ] = Double . longBitsToDouble ( readLong ( cpInfoOffsets [ readUnsignedShort ( currentOffset + 1 ) ] ) ) ; currentOffset += 3 ; } annotationVisitor . visit ( elementName , doubleValues ) ; break ; default : currentOffset = readElementValues ( annotationVisitor . visitArray ( elementName ) , currentOffset - 2 , /* named = */
false , charBuffer ) ; break ; } break ; default : throw new IllegalArgumentException ( ) ; } return currentOffset ;


signature:
public class ClassReader { /** * Computes the implicit frame of the method currently being parsed ( as defined in the given
 * { @ link Context } ) and stores it in the given context .
 * @ param context information about the class being parsed . */
private void computeImplicitFrame ( final Context context ) { } }

implementation:
String methodDescriptor = context . currentMethodDescriptor ; Object [ ] locals = context . currentFrameLocalTypes ; int numLocal = 0 ; if ( ( context . currentMethodAccessFlags & Opcodes . ACC_STATIC ) == 0 ) { if ( "<init>" . equals ( context . currentMethodName ) ) { locals [ numLocal ++ ] = Opcodes . UNINITIALIZED_THIS ; } else { locals [ numLocal ++ ] = readClass ( header + 2 , context . charBuffer ) ; } } // Parse the method descriptor , one argument type descriptor at each iteration . Start by
// skipping the first method descriptor character , which is always ' ( ' .
int currentMethodDescritorOffset = 1 ; while ( true ) { int currentArgumentDescriptorStartOffset = currentMethodDescritorOffset ; switch ( methodDescriptor . charAt ( currentMethodDescritorOffset ++ ) ) { case 'Z' : case 'C' : case 'B' : case 'S' : case 'I' : locals [ numLocal ++ ] = Opcodes . INTEGER ; break ; case 'F' : locals [ numLocal ++ ] = Opcodes . FLOAT ; break ; case 'J' : locals [ numLocal ++ ] = Opcodes . LONG ; break ; case 'D' : locals [ numLocal ++ ] = Opcodes . DOUBLE ; break ; case '[' : while ( methodDescriptor . charAt ( currentMethodDescritorOffset ) == '[' ) { ++ currentMethodDescritorOffset ; } if ( methodDescriptor . charAt ( currentMethodDescritorOffset ) == 'L' ) { ++ currentMethodDescritorOffset ; while ( methodDescriptor . charAt ( currentMethodDescritorOffset ) != ';' ) { ++ currentMethodDescritorOffset ; } } locals [ numLocal ++ ] = methodDescriptor . substring ( currentArgumentDescriptorStartOffset , ++ currentMethodDescritorOffset ) ; break ; case 'L' : while ( methodDescriptor . charAt ( currentMethodDescritorOffset ) != ';' ) { ++ currentMethodDescritorOffset ; } locals [ numLocal ++ ] = methodDescriptor . substring ( currentArgumentDescriptorStartOffset + 1 , currentMethodDescritorOffset ++ ) ; break ; default : context . currentFrameLocalCount = numLocal ; return ; } }


signature:
public class ClassReader { /** * Reads a JVMS ' stack _ map _ frame ' structure and stores the result in the given { @ link Context }
 * object . This method can also be used to read a full _ frame structure , excluding its frame _ type
 * field ( this is used to parse the legacy StackMap attributes ) .
 * @ param stackMapFrameOffset the start offset in { @ link # b } of the stack _ map _ frame _ value
 * structure to be read , or the start offset of a full _ frame structure ( excluding its
 * frame _ type field ) .
 * @ param compressed true to read a ' stack _ map _ frame ' structure , false to read a ' full _ frame '
 * structure without its frame _ type field .
 * @ param expand if the stack map frame must be expanded . See { @ link # EXPAND _ FRAMES } .
 * @ param context where the parsed stack map frame must be stored .
 * @ return the end offset of the JVMS ' stack _ map _ frame ' or ' full _ frame ' structure . */
private int readStackMapFrame ( final int stackMapFrameOffset , final boolean compressed , final boolean expand , final Context context ) { } }

implementation:
int currentOffset = stackMapFrameOffset ; final char [ ] charBuffer = context . charBuffer ; final Label [ ] labels = context . currentMethodLabels ; int frameType ; if ( compressed ) { // Read the frame _ type field .
frameType = b [ currentOffset ++ ] & 0xFF ; } else { frameType = Frame . FULL_FRAME ; context . currentFrameOffset = - 1 ; } int offsetDelta ; context . currentFrameLocalCountDelta = 0 ; if ( frameType < Frame . SAME_LOCALS_1_STACK_ITEM_FRAME ) { offsetDelta = frameType ; context . currentFrameType = Opcodes . F_SAME ; context . currentFrameStackCount = 0 ; } else if ( frameType < Frame . RESERVED ) { offsetDelta = frameType - Frame . SAME_LOCALS_1_STACK_ITEM_FRAME ; currentOffset = readVerificationTypeInfo ( currentOffset , context . currentFrameStackTypes , 0 , charBuffer , labels ) ; context . currentFrameType = Opcodes . F_SAME1 ; context . currentFrameStackCount = 1 ; } else if ( frameType >= Frame . SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED ) { offsetDelta = readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; if ( frameType == Frame . SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED ) { currentOffset = readVerificationTypeInfo ( currentOffset , context . currentFrameStackTypes , 0 , charBuffer , labels ) ; context . currentFrameType = Opcodes . F_SAME1 ; context . currentFrameStackCount = 1 ; } else if ( frameType >= Frame . CHOP_FRAME && frameType < Frame . SAME_FRAME_EXTENDED ) { context . currentFrameType = Opcodes . F_CHOP ; context . currentFrameLocalCountDelta = Frame . SAME_FRAME_EXTENDED - frameType ; context . currentFrameLocalCount -= context . currentFrameLocalCountDelta ; context . currentFrameStackCount = 0 ; } else if ( frameType == Frame . SAME_FRAME_EXTENDED ) { context . currentFrameType = Opcodes . F_SAME ; context . currentFrameStackCount = 0 ; } else if ( frameType < Frame . FULL_FRAME ) { int local = expand ? context . currentFrameLocalCount : 0 ; for ( int k = frameType - Frame . SAME_FRAME_EXTENDED ; k > 0 ; k -- ) { currentOffset = readVerificationTypeInfo ( currentOffset , context . currentFrameLocalTypes , local ++ , charBuffer , labels ) ; } context . currentFrameType = Opcodes . F_APPEND ; context . currentFrameLocalCountDelta = frameType - Frame . SAME_FRAME_EXTENDED ; context . currentFrameLocalCount += context . currentFrameLocalCountDelta ; context . currentFrameStackCount = 0 ; } else { final int numberOfLocals = readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; context . currentFrameType = Opcodes . F_FULL ; context . currentFrameLocalCountDelta = numberOfLocals ; context . currentFrameLocalCount = numberOfLocals ; for ( int local = 0 ; local < numberOfLocals ; ++ local ) { currentOffset = readVerificationTypeInfo ( currentOffset , context . currentFrameLocalTypes , local , charBuffer , labels ) ; } final int numberOfStackItems = readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; context . currentFrameStackCount = numberOfStackItems ; for ( int stack = 0 ; stack < numberOfStackItems ; ++ stack ) { currentOffset = readVerificationTypeInfo ( currentOffset , context . currentFrameStackTypes , stack , charBuffer , labels ) ; } } } else { throw new IllegalArgumentException ( ) ; } context . currentFrameOffset += offsetDelta + 1 ; createLabel ( context . currentFrameOffset , labels ) ; return currentOffset ;


signature:
public class ClassReader { /** * Reads a JVMS ' verification _ type _ info ' structure and stores it at the given index in the given
 * array .
 * @ param verificationTypeInfoOffset the start offset of the ' verification _ type _ info ' structure to
 * read .
 * @ param frame the array where the parsed type must be stored .
 * @ param index the index in ' frame ' where the parsed type must be stored .
 * @ param charBuffer the buffer used to read strings in the constant pool .
 * @ param labels the labels of the method currently being parsed , indexed by their offset . If the
 * parsed type is an ITEM _ Uninitialized , a new label for the corresponding NEW instruction is
 * stored in this array if it does not already exist .
 * @ return the end offset of the JVMS ' verification _ type _ info ' structure . */
private int readVerificationTypeInfo ( final int verificationTypeInfoOffset , final Object [ ] frame , final int index , final char [ ] charBuffer , final Label [ ] labels ) { } }

implementation: int currentOffset = verificationTypeInfoOffset ; int tag = b [ currentOffset ++ ] & 0xFF ; switch ( tag ) { case Frame . ITEM_TOP : frame [ index ] = Opcodes . TOP ; break ; case Frame . ITEM_INTEGER : frame [ index ] = Opcodes . INTEGER ; break ; case Frame . ITEM_FLOAT : frame [ index ] = Opcodes . FLOAT ; break ; case Frame . ITEM_DOUBLE : frame [ index ] = Opcodes . DOUBLE ; break ; case Frame . ITEM_LONG : frame [ index ] = Opcodes . LONG ; break ; case Frame . ITEM_NULL : frame [ index ] = Opcodes . NULL ; break ; case Frame . ITEM_UNINITIALIZED_THIS : frame [ index ] = Opcodes . UNINITIALIZED_THIS ; break ; case Frame . ITEM_OBJECT : frame [ index ] = readClass ( currentOffset , charBuffer ) ; currentOffset += 2 ; break ; case Frame . ITEM_UNINITIALIZED : frame [ index ] = createLabel ( readUnsignedShort ( currentOffset ) , labels ) ; currentOffset += 2 ; break ; default : throw new IllegalArgumentException ( ) ; } return currentOffset ;


signature:
public class ClassReader { /** * Returns the offset in { @ link # b } of the first ClassFile ' s ' attributes ' array field entry .
 * @ return the offset in { @ link # b } of the first ClassFile ' s ' attributes ' array field entry . */
final int getFirstAttributeOffset ( ) { } }

implementation:
// Skip the access _ flags , this _ class , super _ class , and interfaces _ count fields ( using 2 bytes
// each ) , as well as the interfaces array field ( 2 bytes per interface ) .
int currentOffset = header + 8 + readUnsignedShort ( header + 6 ) * 2 ; // Read the fields _ count field .
int fieldsCount = readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; // Skip the ' fields ' array field .
while ( fieldsCount -- > 0 ) { // Invariant : currentOffset is the offset of a field _ info structure .
// Skip the access _ flags , name _ index and descriptor _ index fields ( 2 bytes each ) , and read the
// attributes _ count field .
int attributesCount = readUnsignedShort ( currentOffset + 6 ) ; currentOffset += 8 ; // Skip the ' attributes ' array field .
while ( attributesCount -- > 0 ) { // Invariant : currentOffset is the offset of an attribute _ info structure .
// Read the attribute _ length field ( 2 bytes after the start of the attribute _ info ) and skip
// this many bytes , plus 6 for the attribute _ name _ index and attribute _ length fields
// ( yielding the total size of the attribute _ info structure ) .
currentOffset += 6 + readInt ( currentOffset + 2 ) ; } } // Skip the methods _ count and ' methods ' fields , using the same method as above .
int methodsCount = readUnsignedShort ( currentOffset ) ; currentOffset += 2 ; while ( methodsCount -- > 0 ) { int attributesCount = readUnsignedShort ( currentOffset + 6 ) ; currentOffset += 8 ; while ( attributesCount -- > 0 ) { currentOffset += 6 + readInt ( currentOffset + 2 ) ; } } // Skip the ClassFile ' s attributes _ count field .
return currentOffset + 2 ;


signature:
public class ClassReader { /** * Reads the BootstrapMethods attribute to compute the offset of each bootstrap method .
 * @ param maxStringLength a conservative estimate of the maximum length of the strings contained
 * in the constant pool of the class .
 * @ return the offsets of the bootstrap methods or null . */
private int [ ] readBootstrapMethodsAttribute ( final int maxStringLength ) { } }

implementation:
char [ ] charBuffer = new char [ maxStringLength ] ; int currentAttributeOffset = getFirstAttributeOffset ( ) ; int [ ] currentBootstrapMethodOffsets = null ; for ( int i = readUnsignedShort ( currentAttributeOffset - 2 ) ; i > 0 ; -- i ) { // Read the attribute _ info ' s attribute _ name and attribute _ length fields .
String attributeName = readUTF8 ( currentAttributeOffset , charBuffer ) ; int attributeLength = readInt ( currentAttributeOffset + 2 ) ; currentAttributeOffset += 6 ; if ( Constants . BOOTSTRAP_METHODS . equals ( attributeName ) ) { // Read the num _ bootstrap _ methods field and create an array of this size .
currentBootstrapMethodOffsets = new int [ readUnsignedShort ( currentAttributeOffset ) ] ; // Compute and store the offset of each ' bootstrap _ methods ' array field entry .
int currentBootstrapMethodOffset = currentAttributeOffset + 2 ; for ( int j = 0 ; j < currentBootstrapMethodOffsets . length ; ++ j ) { currentBootstrapMethodOffsets [ j ] = currentBootstrapMethodOffset ; // Skip the bootstrap _ method _ ref and num _ bootstrap _ arguments fields ( 2 bytes each ) ,
// as well as the bootstrap _ arguments array field ( of size num _ bootstrap _ arguments * 2 ) .
currentBootstrapMethodOffset += 4 + readUnsignedShort ( currentBootstrapMethodOffset + 2 ) * 2 ; } return currentBootstrapMethodOffsets ; } currentAttributeOffset += attributeLength ; } return null ;


signature:
public class ClassReader { /** * Reads a non standard JVMS ' attribute ' structure in { @ link # b } .
 * @ param attributePrototypes prototypes of the attributes that must be parsed during the visit of
 * the class . Any attribute whose type is not equal to the type of one the prototypes will not
 * be parsed : its byte array value will be passed unchanged to the ClassWriter .
 * @ param type the type of the attribute .
 * @ param offset the start offset of the JVMS ' attribute ' structure in { @ link # b } . The 6 attribute
 * header bytes ( attribute _ name _ index and attribute _ length ) are not taken into account here .
 * @ param length the length of the attribute ' s content ( excluding the 6 attribute header bytes ) .
 * @ param charBuffer the buffer to be used to read strings in the constant pool .
 * @ param codeAttributeOffset the start offset of the enclosing Code attribute in { @ link # b } , or
 * - 1 if the attribute to be read is not a code attribute . The 6 attribute header bytes
 * ( attribute _ name _ index and attribute _ length ) are not taken into account here .
 * @ param labels the labels of the method ' s code , or { @ literal null } if the attribute to be read
 * is not a code attribute .
 * @ return the attribute that has been read . */
private Attribute readAttribute ( final Attribute [ ] attributePrototypes , final String type , final int offset , final int length , final char [ ] charBuffer , final int codeAttributeOffset , final Label [ ] labels ) { } }

implementation: for ( Attribute attributePrototype : attributePrototypes ) { if ( attributePrototype . type . equals ( type ) ) { return attributePrototype . read ( this , offset , length , charBuffer , codeAttributeOffset , labels ) ; } } return new Attribute ( type ) . read ( this , offset , length , null , - 1 , null ) ;


signature:
public class ClassReader { /** * Reads a signed int value in { @ link # b } . < i > This method is intended for { @ link Attribute } sub
 * classes , and is normally not needed by class generators or adapters . < / i >
 * @ param offset the start offset of the value to be read in { @ link # b } .
 * @ return the read value . */
public int readInt ( final int offset ) { } }

implementation: byte [ ] classFileBuffer = b ; return ( ( classFileBuffer [ offset ] & 0xFF ) << 24 ) | ( ( classFileBuffer [ offset + 1 ] & 0xFF ) << 16 ) | ( ( classFileBuffer [ offset + 2 ] & 0xFF ) << 8 ) | ( classFileBuffer [ offset + 3 ] & 0xFF ) ;


signature:
public class ClassReader { /** * Reads a signed long value in { @ link # b } . < i > This method is intended for { @ link Attribute } sub
 * classes , and is normally not needed by class generators or adapters . < / i >
 * @ param offset the start offset of the value to be read in { @ link # b } .
 * @ return the read value . */
public long readLong ( final int offset ) { } }

implementation: long l1 = readInt ( offset ) ; long l0 = readInt ( offset + 4 ) & 0xFFFFFFFFL ; return ( l1 << 32 ) | l0 ;


signature:
public class ClassReader { /** * DontCheck ( AbbreviationAsWordInName ) : can ' t be renamed ( for backward binary compatibility ) . */
public String readUTF8 ( final int offset , final char [ ] charBuffer ) { } }

implementation: int constantPoolEntryIndex = readUnsignedShort ( offset ) ; if ( offset == 0 || constantPoolEntryIndex == 0 ) { return null ; } return readUtf ( constantPoolEntryIndex , charBuffer ) ;


signature:
public class ClassReader { /** * Reads a CONSTANT _ Utf8 constant pool entry in { @ link # b } .
 * @ param constantPoolEntryIndex the index of a CONSTANT _ Utf8 entry in the class ' s constant pool
 * table .
 * @ param charBuffer the buffer to be used to read the string . This buffer must be sufficiently
 * large . It is not automatically resized .
 * @ return the String corresponding to the specified CONSTANT _ Utf8 entry . */
final String readUtf ( final int constantPoolEntryIndex , final char [ ] charBuffer ) { } }

implementation: String value = constantUtf8Values [ constantPoolEntryIndex ] ; if ( value != null ) { return value ; } int cpInfoOffset = cpInfoOffsets [ constantPoolEntryIndex ] ; return constantUtf8Values [ constantPoolEntryIndex ] = readUtf ( cpInfoOffset + 2 , readUnsignedShort ( cpInfoOffset ) , charBuffer ) ;


signature:
public class ClassReader { /** * Reads an UTF8 string in { @ link # b } .
 * @ param utfOffset the start offset of the UTF8 string to be read .
 * @ param utfLength the length of the UTF8 string to be read .
 * @ param charBuffer the buffer to be used to read the string . This buffer must be sufficiently
 * large . It is not automatically resized .
 * @ return the String corresponding to the specified UTF8 string . */
private String readUtf ( final int utfOffset , final int utfLength , final char [ ] charBuffer ) { } }

implementation: int currentOffset = utfOffset ; int endOffset = currentOffset + utfLength ; int strLength = 0 ; byte [ ] classFileBuffer = b ; while ( currentOffset < endOffset ) { int currentByte = classFileBuffer [ currentOffset ++ ] ; if ( ( currentByte & 0x80 ) == 0 ) { charBuffer [ strLength ++ ] = ( char ) ( currentByte & 0x7F ) ; } else if ( ( currentByte & 0xE0 ) == 0xC0 ) { charBuffer [ strLength ++ ] = ( char ) ( ( ( currentByte & 0x1F ) << 6 ) + ( classFileBuffer [ currentOffset ++ ] & 0x3F ) ) ; } else { charBuffer [ strLength ++ ] = ( char ) ( ( ( currentByte & 0xF ) << 12 ) + ( ( classFileBuffer [ currentOffset ++ ] & 0x3F ) << 6 ) + ( classFileBuffer [ currentOffset ++ ] & 0x3F ) ) ; } } return new String ( charBuffer , 0 , strLength ) ;


signature:
public class ClassReader { /** * Reads a CONSTANT _ Dynamic constant pool entry in { @ link # b } .
 * @ param constantPoolEntryIndex the index of a CONSTANT _ Dynamic entry in the class ' s constant
 * pool table .
 * @ param charBuffer the buffer to be used to read the string . This buffer must be sufficiently
 * large . It is not automatically resized .
 * @ return the ConstantDynamic corresponding to the specified CONSTANT _ Dynamic entry . */
private ConstantDynamic readConstantDynamic ( final int constantPoolEntryIndex , final char [ ] charBuffer ) { } }

implementation: ConstantDynamic constantDynamic = constantDynamicValues [ constantPoolEntryIndex ] ; if ( constantDynamic != null ) { return constantDynamic ; } int cpInfoOffset = cpInfoOffsets [ constantPoolEntryIndex ] ; int nameAndTypeCpInfoOffset = cpInfoOffsets [ readUnsignedShort ( cpInfoOffset + 2 ) ] ; String name = readUTF8 ( nameAndTypeCpInfoOffset , charBuffer ) ; String descriptor = readUTF8 ( nameAndTypeCpInfoOffset + 2 , charBuffer ) ; int bootstrapMethodOffset = bootstrapMethodOffsets [ readUnsignedShort ( cpInfoOffset ) ] ; Handle handle = ( Handle ) readConst ( readUnsignedShort ( bootstrapMethodOffset ) , charBuffer ) ; Object [ ] bootstrapMethodArguments = new Object [ readUnsignedShort ( bootstrapMethodOffset + 2 ) ] ; bootstrapMethodOffset += 4 ; for ( int i = 0 ; i < bootstrapMethodArguments . length ; i ++ ) { bootstrapMethodArguments [ i ] = readConst ( readUnsignedShort ( bootstrapMethodOffset ) , charBuffer ) ; bootstrapMethodOffset += 2 ; } return constantDynamicValues [ constantPoolEntryIndex ] = new ConstantDynamic ( name , descriptor , handle , bootstrapMethodArguments ) ;


signature:
public class ClassReader { /** * Reads a numeric or string constant pool entry in { @ link # b } . < i > This method is intended for
 * { @ link Attribute } sub classes , and is normally not needed by class generators or adapters . < / i >
 * @ param constantPoolEntryIndex the index of a CONSTANT _ Integer , CONSTANT _ Float , CONSTANT _ Long ,
 * CONSTANT _ Double , CONSTANT _ Class , CONSTANT _ String , CONSTANT _ MethodType ,
 * CONSTANT _ MethodHandle or CONSTANT _ Dynamic entry in the class ' s constant pool .
 * @ param charBuffer the buffer to be used to read strings . This buffer must be sufficiently
 * large . It is not automatically resized .
 * @ return the { @ link Integer } , { @ link Float } , { @ link Long } , { @ link Double } , { @ link String } ,
 * { @ link Type } , { @ link Handle } or { @ link ConstantDynamic } corresponding to the specified
 * constant pool entry . */
public Object readConst ( final int constantPoolEntryIndex , final char [ ] charBuffer ) { } }

implementation: int cpInfoOffset = cpInfoOffsets [ constantPoolEntryIndex ] ; switch ( b [ cpInfoOffset - 1 ] ) { case Symbol . CONSTANT_INTEGER_TAG : return readInt ( cpInfoOffset ) ; case Symbol . CONSTANT_FLOAT_TAG : return Float . intBitsToFloat ( readInt ( cpInfoOffset ) ) ; case Symbol . CONSTANT_LONG_TAG : return readLong ( cpInfoOffset ) ; case Symbol . CONSTANT_DOUBLE_TAG : return Double . longBitsToDouble ( readLong ( cpInfoOffset ) ) ; case Symbol . CONSTANT_CLASS_TAG : return Type . getObjectType ( readUTF8 ( cpInfoOffset , charBuffer ) ) ; case Symbol . CONSTANT_STRING_TAG : return readUTF8 ( cpInfoOffset , charBuffer ) ; case Symbol . CONSTANT_METHOD_TYPE_TAG : return Type . getMethodType ( readUTF8 ( cpInfoOffset , charBuffer ) ) ; case Symbol . CONSTANT_METHOD_HANDLE_TAG : int referenceKind = readByte ( cpInfoOffset ) ; int referenceCpInfoOffset = cpInfoOffsets [ readUnsignedShort ( cpInfoOffset + 1 ) ] ; int nameAndTypeCpInfoOffset = cpInfoOffsets [ readUnsignedShort ( referenceCpInfoOffset + 2 ) ] ; String owner = readClass ( referenceCpInfoOffset , charBuffer ) ; String name = readUTF8 ( nameAndTypeCpInfoOffset , charBuffer ) ; String descriptor = readUTF8 ( nameAndTypeCpInfoOffset + 2 , charBuffer ) ; boolean isInterface = b [ referenceCpInfoOffset - 1 ] == Symbol . CONSTANT_INTERFACE_METHODREF_TAG ; return new Handle ( referenceKind , owner , name , descriptor , isInterface ) ; case Symbol . CONSTANT_DYNAMIC_TAG : return readConstantDynamic ( constantPoolEntryIndex , charBuffer ) ; default : throw new IllegalArgumentException ( ) ; }


signature:
public class ClobSqlType { /** * { @ inheritDoc } */
@ Override public Clob get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { } }

implementation: return rs . getClob ( index ) ;


signature:
public class ClobSqlType { /** * { @ inheritDoc } */
@ Override public void set ( final PreparedStatement st , final int index , final Clob value , final int dbSqlType ) throws SQLException { } }

implementation: st . setClob ( index , value ) ;


signature:
public class MadvocResponseWrapper { /** * Sets content type . If charset is missing , current value is reset .
 * If passed value is < code > null < / code > , content type will be reset
 * as never set . */
@ Override public void setContentType ( final String type ) { } }

implementation: if ( type == null ) { mimeType = null ; characterEncoding = null ; return ; } ContentTypeHeaderResolver contentTypeResolver = new ContentTypeHeaderResolver ( type ) ; mimeType = contentTypeResolver . getMimeType ( ) ; characterEncoding = contentTypeResolver . getEncoding ( ) ;


signature:
public class MadvocResponseWrapper { /** * Returns content type and , optionally , charset . Returns < code > null < / code >
 * when mime type is not set . */
@ Override public String getContentType ( ) { } }

implementation: String contentType = mimeType ; if ( mimeType != null && characterEncoding != null ) { contentType += ";charset=" + characterEncoding ; } return contentType ;


signature:
public class StringSqlType { /** * { @ inheritDoc } */
@ Override public String get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { } }

implementation: return rs . getString ( index ) ;


signature:
public class StringSqlType { /** * { @ inheritDoc } */
@ Override public void set ( final PreparedStatement st , final int index , final String value , final int dbSqlType ) throws SQLException { } }

implementation: st . setString ( index , value ) ;


signature:
public class Ctors { /** * Inspects all declared constructors of a target type . */
protected CtorDescriptor [ ] inspectConstructors ( ) { } }

implementation: Class type = classDescriptor . getType ( ) ; Constructor [ ] ctors = type . getDeclaredConstructors ( ) ; CtorDescriptor [ ] allCtors = new CtorDescriptor [ ctors . length ] ; for ( int i = 0 ; i < ctors . length ; i ++ ) { Constructor ctor = ctors [ i ] ; CtorDescriptor ctorDescriptor = createCtorDescriptor ( ctor ) ; allCtors [ i ] = ctorDescriptor ; if ( ctorDescriptor . isDefault ( ) ) { defaultCtor = ctorDescriptor ; } } return allCtors ;


signature:
public class Ctors { /** * Finds constructor description that matches given argument types . */
public CtorDescriptor getCtorDescriptor ( final Class ... args ) { } }

implementation: ctors : for ( CtorDescriptor ctorDescriptor : allCtors ) { Class [ ] arg = ctorDescriptor . getParameters ( ) ; if ( arg . length != args . length ) { continue ; } for ( int j = 0 ; j < arg . length ; j ++ ) { if ( arg [ j ] != args [ j ] ) { continue ctors ; } } return ctorDescriptor ; } return null ;


signature:
public class RequestScope { /** * Returns instance map from http request . */
@ SuppressWarnings ( "unchecked" ) protected Map < String , TransientBeanData > getRequestMap ( final HttpServletRequest servletRequest ) { } }

implementation: return ( Map < String , TransientBeanData > ) servletRequest . getAttribute ( ATTR_NAME ) ;


signature:
public class RequestScope { /** * Creates instance map and stores it in the request . */
protected Map < String , TransientBeanData > createRequestMap ( final HttpServletRequest servletRequest ) { } }

implementation: Map < String , TransientBeanData > map = new HashMap < > ( ) ; servletRequest . setAttribute ( ATTR_NAME , map ) ; return map ;


signature:
public class RequestScope { /** * Returns request from current thread . */
protected HttpServletRequest getCurrentHttpRequest ( ) { } }

implementation: HttpServletRequest request = RequestContextListener . getRequest ( ) ; if ( request == null ) { throw new PetiteException ( "No HTTP request bound to the current thread. Is RequestContextListener registered?" ) ; } return request ;


signature:
public class LongArrayConverter { /** * Converts non - array value to array . Detects various
 * collection types and iterates them to make conversion
 * and to create target array . */
protected long [ ] convertValueToArray ( final Object value ) { } }

implementation:
if ( value instanceof Collection ) { final Collection collection = ( Collection ) value ; final long [ ] target = new long [ collection . size ( ) ] ; int i = 0 ; for ( final Object element : collection ) { target [ i ] = convertType ( element ) ; i ++ ; } return target ; } if ( value instanceof Iterable ) { final Iterable iterable = ( Iterable ) value ; final ArrayList < Long > longArrayList = new ArrayList < > ( ) ; for ( final Object element : iterable ) { final long convertedValue = convertType ( element ) ; longArrayList . add ( Long . valueOf ( convertedValue ) ) ; } final long [ ] array = new long [ longArrayList . size ( ) ] ; for ( int i = 0 ; i < longArrayList . size ( ) ; i ++ ) { final Long l = longArrayList . get ( i ) ; array [ i ] = l . longValue ( ) ; } return array ; } if ( value instanceof CharSequence ) { final String [ ] strings = StringUtil . splitc ( value . toString ( ) , ArrayConverter . NUMBER_DELIMITERS ) ; return convertArrayToArray ( strings ) ; } // everything else :
return convertToSingleElementArray ( value ) ;


signature:
public class LongArrayConverter { /** * Converts array value to array . */
protected long [ ] convertArrayToArray ( final Object value ) { } }

implementation:
final Class valueComponentType = value . getClass ( ) . getComponentType ( ) ; final long [ ] result ; if ( valueComponentType . isPrimitive ( ) ) { result = convertPrimitiveArrayToArray ( value , valueComponentType ) ; } else { // convert object array to target array
final Object [ ] array = ( Object [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = convertType ( array [ i ] ) ; } } return result ;


signature:
public class LongArrayConverter { /** * Converts primitive array to target array . */
protected long [ ] convertPrimitiveArrayToArray ( final Object value , final Class primitiveComponentType ) { } }

implementation: long [ ] result = null ; if ( primitiveComponentType == long . class ) { return ( long [ ] ) value ; } if ( primitiveComponentType == int . class ) { final int [ ] array = ( int [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = array [ i ] ; } } else if ( primitiveComponentType == float . class ) { final float [ ] array = ( float [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = ( long ) array [ i ] ; } } else if ( primitiveComponentType == double . class ) { final double [ ] array = ( double [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = ( long ) array [ i ] ; } } else if ( primitiveComponentType == short . class ) { final short [ ] array = ( short [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = array [ i ] ; } } else if ( primitiveComponentType == byte . class ) { final byte [ ] array = ( byte [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = array [ i ] ; } } else if ( primitiveComponentType == char . class ) { final char [ ] array = ( char [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = array [ i ] ; } } else if ( primitiveComponentType == boolean . class ) { final boolean [ ] array = ( boolean [ ] ) value ; result = new long [ array . length ] ; for ( int i = 0 ; i < array . length ; i ++ ) { result [ i ] = array [ i ] ? 1 : 0 ; } } return result ;


signature:
public class DecoraServletFilter { /** * Initializes Decora filter . Loads manager and parser from init parameters . */
@ Override public void init ( final FilterConfig filterConfig ) throws ServletException { } }

implementation: final String decoraManagerClass = filterConfig . getInitParameter ( PARAM_DECORA_MANAGER ) ; if ( decoraManagerClass != null ) { try { final Class decoraManagerType = ClassLoaderUtil . loadClass ( decoraManagerClass ) ; decoraManager = ( DecoraManager ) ClassUtil . newInstance ( decoraManagerType ) ; } catch ( Exception ex ) { log . error ( "Unable to load Decora manager class: " + decoraManagerClass , ex ) ; throw new ServletException ( ex ) ; } } else { decoraManager = createDecoraManager ( ) ; } final String decoraParserClass = filterConfig . getInitParameter ( PARAM_DECORA_PARSER ) ; if ( decoraParserClass != null ) { try { final Class decoraParserType = ClassLoaderUtil . loadClass ( decoraParserClass ) ; decoraParser = ( DecoraParser ) ClassUtil . newInstance ( decoraParserType ) ; } catch ( Exception ex ) { log . error ( "Unable to load Decora parser class: " + decoraParserClass , ex ) ; throw new ServletException ( ex ) ; } } else { decoraParser = createDecoraParser ( ) ; } final String decoraCache = filterConfig . getInitParameter ( PARAM_DECORA_CACHE ) ; if ( decoraCache != null ) { cached = Converter . get ( ) . toBoolean ( decoraCache , false ) ; }


signature:
public class FindFile { /** * Registers file consumer */
public FindFile onFile ( final Consumer < File > fileConsumer ) { } }

implementation: if ( consumers == null ) { consumers = Consumers . of ( fileConsumer ) ; } else { consumers . add ( fileConsumer ) ; } return this ;


signature:
public class FindFile { /** * Specifies the search path . If provided path contains
 * { @ link File # pathSeparator } than string will be tokenized
 * and each part will be added separately as a search path . */
public FindFile searchPath ( final String searchPath ) { } }

implementation: if ( searchPath . indexOf ( File . pathSeparatorChar ) != - 1 ) { String [ ] paths = StringUtil . split ( searchPath , File . pathSeparator ) ; for ( String path : paths ) { addPath ( new File ( path ) ) ; } } else { addPath ( new File ( searchPath ) ) ; } return this ;


signature:
public class FindFile { /** * Specifies the search path . Throws an exception if URI is invalid . */
public FindFile searchPath ( final URI searchPath ) { } }

implementation: File file ; try { file = new File ( searchPath ) ; } catch ( Exception ex ) { throw new FindFileException ( "URI error: " + searchPath , ex ) ; } addPath ( file ) ; return this ;


signature:
public class FindFile { /** * Specifies the search path . Throws an exception if URL is invalid . */
public FindFile searchPath ( final URL searchPath ) { } }

implementation: File file = FileUtil . toContainerFile ( searchPath ) ; if ( file == null ) { throw new FindFileException ( "URL error: " + searchPath ) ; } addPath ( file ) ; return this ;


signature:
public class FindFile { /** * Defines include patterns . */
public FindFile include ( final String ... patterns ) { } }

implementation: for ( String pattern : patterns ) { rules . include ( pattern ) ; } return this ;


signature:
public class FindFile { /** * Defines exclude patterns . */
public FindFile exclude ( final String ... patterns ) { } }

implementation: for ( String pattern : patterns ) { rules . exclude ( pattern ) ; } return this ;


signature:
public class FindFile { /** * Determine if file is accepted , based on include and exclude
 * rules . Called on each file entry ( file or directory ) and
 * returns < code > true < / code > if file passes search criteria .
 * File is matched using { @ link # getMatchingFilePath ( java . io . File ) matching file path } .
 * @ see InExRules */
protected boolean acceptFile ( final File file ) { } }

implementation: String matchingFilePath = getMatchingFilePath ( file ) ; if ( rules . match ( matchingFilePath ) ) { if ( consumers != null ) { consumers . accept ( file ) ; } return true ; } return false ;


signature:
public class FindFile { /** * Resolves file path depending on { @ link Match matching type }
 * Returned path is formatted in unix style . */
protected String getMatchingFilePath ( final File file ) { } }

implementation: String path = null ; switch ( matchType ) { case FULL_PATH : path = file . getAbsolutePath ( ) ; break ; case RELATIVE_PATH : path = file . getAbsolutePath ( ) ; path = path . substring ( rootPath . length ( ) ) ; break ; case NAME : path = file . getName ( ) ; } path = FileNameUtil . separatorsToUnix ( path ) ; return path ;


signature:
public class FindFile { /** * Adds existing search path to the file list .
 * Non existing files are ignored .
 * If path is a folder , it will be scanned for all files . */
protected void addPath ( final File path ) { } }

implementation: if ( ! path . exists ( ) ) { return ; } if ( pathList == null ) { pathList = new LinkedList < > ( ) ; } pathList . add ( path ) ;


signature:
public class FindFile { /** * Reset the search so it can be run again with very
 * same parameters ( and sorting options ) . */
public void reset ( ) { } }

implementation: pathList = pathListOriginal ; pathListOriginal = null ; todoFiles = null ; lastFile = null ; rules . reset ( ) ;


signature:
public class FindFile { /** * Finds the next file . Returns founded file that matches search configuration
 * or < code > null < / code > if no more files can be found . */
public File nextFile ( ) { } }

implementation:
if ( todoFiles == null ) { init ( ) ; } while ( true ) { // iterate files
if ( ! todoFiles . isEmpty ( ) ) { FilesIterator filesIterator = todoFiles . getLast ( ) ; File nextFile = filesIterator . next ( ) ; if ( nextFile == null ) { todoFiles . removeLast ( ) ; continue ; } if ( nextFile . isDirectory ( ) ) { if ( ! walking ) { todoFolders . add ( nextFile ) ; continue ; } // walking
if ( recursive ) { todoFiles . add ( new FilesIterator ( nextFile ) ) ; } if ( includeDirs ) { if ( acceptFile ( nextFile ) ) { lastFile = nextFile ; return nextFile ; } } continue ; } lastFile = nextFile ; return nextFile ; } // process folders
File folder ; boolean initialDir = false ; if ( todoFolders . isEmpty ( ) ) { if ( pathList . isEmpty ( ) ) { // the end
return null ; } folder = pathList . removeFirst ( ) ; rootFile = folder ; rootPath = rootFile . getAbsolutePath ( ) ; initialDir = true ; } else { folder = todoFolders . removeFirst ( ) ; } if ( ( initialDir ) || ( recursive ) ) { todoFiles . add ( new FilesIterator ( folder ) ) ; } if ( ( ! initialDir ) && ( includeDirs ) ) { if ( acceptFile ( folder ) ) { lastFile = folder ; return folder ; } } }


signature:
public class FindFile { /** * Finds all files and returns list of founded files . */
public List < File > findAll ( ) { } }

implementation: List < File > allFiles = new ArrayList < > ( ) ; File file ; while ( ( file = nextFile ( ) ) != null ) { allFiles . add ( file ) ; } return allFiles ;


signature:
public class FindFile { /** * Initializes file walking .
 * Separates input files and folders . */
protected void init ( ) { } }

implementation: rules . detectMode ( ) ; todoFiles = new LinkedList < > ( ) ; todoFolders = new LinkedList < > ( ) ; if ( pathList == null ) { pathList = new LinkedList < > ( ) ; return ; } if ( pathListOriginal == null ) { pathListOriginal = ( LinkedList < File > ) pathList . clone ( ) ; } String [ ] files = new String [ pathList . size ( ) ] ; int index = 0 ; Iterator < File > iterator = pathList . iterator ( ) ; while ( iterator . hasNext ( ) ) { File file = iterator . next ( ) ; if ( file . isFile ( ) ) { files [ index ++ ] = file . getAbsolutePath ( ) ; iterator . remove ( ) ; } } if ( index != 0 ) { FilesIterator filesIterator = new FilesIterator ( files ) ; todoFiles . add ( filesIterator ) ; }


signature:
public class FindFile { /** * Returns file walking iterator . */
@ Override public Iterator < File > iterator ( ) { } }

implementation: return new Iterator < File > ( ) { private File nextFile ; @ Override public boolean hasNext ( ) { nextFile = nextFile ( ) ; return nextFile != null ; } @ Override public File next ( ) { if ( nextFile == null ) { throw new NoSuchElementException ( ) ; } return nextFile ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ;


signature:
public class ByteArraySqlType { /** * { @ inheritDoc } */
@ Override public byte [ ] get ( final ResultSet rs , final int index , final int dbSqlType ) throws SQLException { } }

implementation: return rs . getBytes ( index ) ;


signature:
public class ByteArraySqlType { /** * { @ inheritDoc } */
@ Override public void set ( final PreparedStatement st , final int index , final byte [ ] value , final int dbSqlType ) throws SQLException { } }

implementation: st . setBytes ( index , value ) ;


signature:
public class AnnotationResolver { /** * Resolves bean ' s auto - wire flag from the annotation . Returns default auto - wire if annotation doesn ' t exist . */
public WiringMode resolveBeanWiringMode ( final Class type ) { } }

implementation: PetiteBean petiteBean = ( ( Class < ? > ) type ) . getAnnotation ( PetiteBean . class ) ; return petiteBean != null ? petiteBean . wiring ( ) : WiringMode . DEFAULT ;


signature:
public class AnnotationResolver { /** * Resolves bean ' s scope type from the annotation . Returns < code > null < / code >
 * if annotation doesn ' t exist . */
public Class < ? extends Scope > resolveBeanScopeType ( final Class type ) { } }

implementation: PetiteBean petiteBean = ( ( Class < ? > ) type ) . getAnnotation ( PetiteBean . class ) ; return petiteBean != null ? petiteBean . scope ( ) : null ;


signature:
public class AnnotationResolver { /** * Resolves bean ' s name from bean annotation or type name . May be used for resolving bean name
 * of base type during registration of bean subclass . */
public String resolveBeanName ( final Class type , final boolean useLongTypeName ) { } }

implementation: PetiteBean petiteBean = ( ( Class < ? > ) type ) . getAnnotation ( PetiteBean . class ) ; String name = null ; if ( petiteBean != null ) { name = petiteBean . value ( ) . trim ( ) ; } if ( ( name == null ) || ( name . length ( ) == 0 ) ) { if ( useLongTypeName ) { name = type . getName ( ) ; } else { name = StringUtil . uncapitalize ( type . getSimpleName ( ) ) ; } } return name ;


signature:
public class AnnotationResolver { /** * Returns < code > true < / code > if bean has name defined by Petite annotation . */
public boolean beanHasAnnotationName ( final Class type ) { } }

implementation: PetiteBean petiteBean = ( ( Class < ? > ) type ) . getAnnotation ( PetiteBean . class ) ; if ( petiteBean == null ) { return false ; } String name = petiteBean . value ( ) . trim ( ) ; return ! name . isEmpty ( ) ;


signature:
public class Buffer { /** * Returns a writer . */
public PrintWriter getWriter ( ) { } }

implementation:
if ( outWriter == null ) { if ( outStream != null ) { throw new IllegalStateException ( "Can't call getWriter() after getOutputStream()" ) ; } bufferedWriter = new FastCharArrayWriter ( ) ; outWriter = new PrintWriter ( bufferedWriter ) { @ Override public void close ( ) { // do not close the print writer after rendering
// since it will remove reference to bufferedWriter
} } ; } return outWriter ;


signature:
public class Buffer { /** * Returns a servlet output stream . */
public ServletOutputStream getOutputStream ( ) { } }

implementation: if ( outStream == null ) { if ( outWriter != null ) { throw new IllegalStateException ( "Can't call getOutputStream() after getWriter()" ) ; } bufferOutputStream = new FastByteArrayServletOutputStream ( ) ; outStream = bufferOutputStream ; } return outStream ;


signature:
public class Type { /** * Returns the { @ link Type } corresponding to the given class .
 * @ param clazz a class .
 * @ return the { @ link Type } corresponding to the given class . */
public static Type getType ( final Class < ? > clazz ) { } }

implementation: if ( clazz . isPrimitive ( ) ) { if ( clazz == Integer . TYPE ) { return INT_TYPE ; } else if ( clazz == Void . TYPE ) { return VOID_TYPE ; } else if ( clazz == Boolean . TYPE ) { return BOOLEAN_TYPE ; } else if ( clazz == Byte . TYPE ) { return BYTE_TYPE ; } else if ( clazz == Character . TYPE ) { return CHAR_TYPE ; } else if ( clazz == Short . TYPE ) { return SHORT_TYPE ; } else if ( clazz == Double . TYPE ) { return DOUBLE_TYPE ; } else if ( clazz == Float . TYPE ) { return FLOAT_TYPE ; } else if ( clazz == Long . TYPE ) { return LONG_TYPE ; } else { throw new AssertionError ( ) ; } } else { return getType ( getDescriptor ( clazz ) ) ; }


signature:
public class Type { /** * Returns the { @ link Type } corresponding to the given internal name .
 * @ param internalName an internal name .
 * @ return the { @ link Type } corresponding to the given internal name . */
public static Type getObjectType ( final String internalName ) { } }

implementation: return new Type ( internalName . charAt ( 0 ) == '[' ? ARRAY : INTERNAL , internalName , 0 , internalName . length ( ) ) ;


signature:
public class Type { /** * Returns the method { @ link Type } corresponding to the given argument and return types .
 * @ param returnType the return type of the method .
 * @ param argumentTypes the argument types of the method .
 * @ return the method { @ link Type } corresponding to the given argument and return types . */
public static Type getMethodType ( final Type returnType , final Type ... argumentTypes ) { } }

implementation: return getType ( getMethodDescriptor ( returnType , argumentTypes ) ) ;


signature:
public class Type { /** * Returns the { @ link Type } values corresponding to the argument types of the given method
 * descriptor .
 * @ param methodDescriptor a method descriptor .
 * @ return the { @ link Type } values corresponding to the argument types of the given method
 * descriptor . */
public static Type [ ] getArgumentTypes ( final String methodDescriptor ) { } }

implementation:
// First step : compute the number of argument types in methodDescriptor .
int numArgumentTypes = 0 ; // Skip the first character , which is always a ' ( ' .
int currentOffset = 1 ; // Parse the argument types , one at a each loop iteration .
while ( methodDescriptor . charAt ( currentOffset ) != ')' ) { while ( methodDescriptor . charAt ( currentOffset ) == '[' ) { currentOffset ++ ; } if ( methodDescriptor . charAt ( currentOffset ++ ) == 'L' ) { // Skip the argument descriptor content .
currentOffset = methodDescriptor . indexOf ( ';' , currentOffset ) + 1 ; } ++ numArgumentTypes ; } // Second step : create a Type instance for each argument type .
Type [ ] argumentTypes = new Type [ numArgumentTypes ] ; // Skip the first character , which is always a ' ( ' .
currentOffset = 1 ; // Parse and create the argument types , one at each loop iteration .
int currentArgumentTypeIndex = 0 ; while ( methodDescriptor . charAt ( currentOffset ) != ')' ) { final int currentArgumentTypeOffset = currentOffset ; while ( methodDescriptor . charAt ( currentOffset ) == '[' ) { currentOffset ++ ; } if ( methodDescriptor . charAt ( currentOffset ++ ) == 'L' ) { // Skip the argument descriptor content .
currentOffset = methodDescriptor . indexOf ( ';' , currentOffset ) + 1 ; } argumentTypes [ currentArgumentTypeIndex ++ ] = getTypeInternal ( methodDescriptor , currentArgumentTypeOffset , currentOffset ) ; } return argumentTypes ;


signature:
public class Type { /** * Returns the { @ link Type } corresponding to the return type of the given method descriptor .
 * @ param methodDescriptor a method descriptor .
 * @ return the { @ link Type } corresponding to the return type of the given method descriptor . */
public static Type getReturnType ( final String methodDescriptor ) { } }

implementation:
// Skip the first character , which is always a ' ( ' .
int currentOffset = 1 ; // Skip the argument types , one at a each loop iteration .
while ( methodDescriptor . charAt ( currentOffset ) != ')' ) { while ( methodDescriptor . charAt ( currentOffset ) == '[' ) { currentOffset ++ ; } if ( methodDescriptor . charAt ( currentOffset ++ ) == 'L' ) { // Skip the argument descriptor content .
currentOffset = methodDescriptor . indexOf ( ';' , currentOffset ) + 1 ; } } return getTypeInternal ( methodDescriptor , currentOffset + 1 , methodDescriptor . length ( ) ) ;


signature:
public class Type { /** * Returns the { @ link Type } corresponding to the given field or method descriptor .
 * @ param descriptorBuffer a buffer containing the field or method descriptor .
 * @ param descriptorBegin the beginning index , inclusive , of the field or method descriptor in
 * descriptorBuffer .
 * @ param descriptorEnd the end index , exclusive , of the field or method descriptor in
 * descriptorBuffer .
 * @ return the { @ link Type } corresponding to the given type descriptor . */
private static Type getTypeInternal ( final String descriptorBuffer , final int descriptorBegin , final int descriptorEnd ) { } }

implementation: switch ( descriptorBuffer . charAt ( descriptorBegin ) ) { case 'V' : return VOID_TYPE ; case 'Z' : return BOOLEAN_TYPE ; case 'C' : return CHAR_TYPE ; case 'B' : return BYTE_TYPE ; case 'S' : return SHORT_TYPE ; case 'I' : return INT_TYPE ; case 'F' : return FLOAT_TYPE ; case 'J' : return LONG_TYPE ; case 'D' : return DOUBLE_TYPE ; case '[' : return new Type ( ARRAY , descriptorBuffer , descriptorBegin , descriptorEnd ) ; case 'L' : return new Type ( OBJECT , descriptorBuffer , descriptorBegin + 1 , descriptorEnd - 1 ) ; case '(' : return new Type ( METHOD , descriptorBuffer , descriptorBegin , descriptorEnd ) ; default : throw new IllegalArgumentException ( ) ; }


signature:
public class Type { /** * Returns the binary name of the class corresponding to this type . This method must not be used
 * on method types .
 * @ return the binary name of the class corresponding to this type . */
public String getClassName ( ) { } }

implementation: switch ( sort ) { case VOID : return "void" ; case BOOLEAN : return "boolean" ; case CHAR : return "char" ; case BYTE : return "byte" ; case SHORT : return "short" ; case INT : return "int" ; case FLOAT : return "float" ; case LONG : return "long" ; case DOUBLE : return "double" ; case ARRAY : StringBuilder stringBuilder = new StringBuilder ( getElementType ( ) . getClassName ( ) ) ; for ( int i = getDimensions ( ) ; i > 0 ; -- i ) { stringBuilder . append ( "[]" ) ; } return stringBuilder . toString ( ) ; case OBJECT : case INTERNAL : return valueBuffer . substring ( valueBegin , valueEnd ) . replace ( '/' , '.' ) ; default : throw new AssertionError ( ) ; }


signature:
public class Type { /** * Returns the descriptor corresponding to the given constructor .
 * @ param constructor a { @ link Constructor } object .
 * @ return the descriptor of the given constructor . */
public static String getConstructorDescriptor ( final Constructor < ? > constructor ) { } }

implementation: StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( '(' ) ; Class < ? > [ ] parameters = constructor . getParameterTypes ( ) ; for ( Class < ? > parameter : parameters ) { appendDescriptor ( parameter , stringBuilder ) ; } return stringBuilder . append ( ")V" ) . toString ( ) ;


signature:
public class Type { /** * Returns the descriptor corresponding to the given argument and return types .
 * @ param returnType the return type of the method .
 * @ param argumentTypes the argument types of the method .
 * @ return the descriptor corresponding to the given argument and return types . */
public static String getMethodDescriptor ( final Type returnType , final Type ... argumentTypes ) { } }

implementation: StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( '(' ) ; for ( Type argumentType : argumentTypes ) { argumentType . appendDescriptor ( stringBuilder ) ; } stringBuilder . append ( ')' ) ; returnType . appendDescriptor ( stringBuilder ) ; return stringBuilder . toString ( ) ;


signature:
public class Type { /** * Returns the descriptor corresponding to the given method .
 * @ param method a { @ link Method } object .
 * @ return the descriptor of the given method . */
public static String getMethodDescriptor ( final Method method ) { } }

implementation: StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( '(' ) ; Class < ? > [ ] parameters = method . getParameterTypes ( ) ; for ( Class < ? > parameter : parameters ) { appendDescriptor ( parameter , stringBuilder ) ; } stringBuilder . append ( ')' ) ; appendDescriptor ( method . getReturnType ( ) , stringBuilder ) ; return stringBuilder . toString ( ) ;


signature:
public class Type { /** * Appends the descriptor corresponding to this type to the given string buffer .
 * @ param stringBuilder the string builder to which the descriptor must be appended . */
private void appendDescriptor ( final StringBuilder stringBuilder ) { } }

implementation: if ( sort == OBJECT ) { stringBuilder . append ( valueBuffer , valueBegin - 1 , valueEnd + 1 ) ; } else if ( sort == INTERNAL ) { stringBuilder . append ( 'L' ) . append ( valueBuffer , valueBegin , valueEnd ) . append ( ';' ) ; } else { stringBuilder . append ( valueBuffer , valueBegin , valueEnd ) ; }


signature:
public class Type { /** * Returns the size of values of this type . This method must not be used for method types .
 * @ return the size of values of this type , i . e . , 2 for { @ code long } and { @ code double } , 0 for
 * { @ code void } and 1 otherwise . */
public int getSize ( ) { } }

implementation: switch ( sort ) { case VOID : return 0 ; case BOOLEAN : case CHAR : case BYTE : case SHORT : case INT : case FLOAT : case ARRAY : case OBJECT : case INTERNAL : return 1 ; case LONG : case DOUBLE : return 2 ; default : throw new AssertionError ( ) ; }


signature:
public class Type { /** * Computes the size of the arguments and of the return value of a method .
 * @ param methodDescriptor a method descriptor .
 * @ return the size of the arguments of the method ( plus one for the implicit this argument ) ,
 * argumentsSize , and the size of its return value , returnSize , packed into a single int i =
 * { @ code ( argumentsSize & lt ; & lt ; 2 ) | returnSize } ( argumentsSize is therefore equal to { @ code
 * i & gt ; & gt ; 2 } , and returnSize to { @ code i & amp ; 0x03 } ) . */
public static int getArgumentsAndReturnSizes ( final String methodDescriptor ) { } }

implementation:
int argumentsSize = 1 ; // Skip the first character , which is always a ' ( ' .
int currentOffset = 1 ; int currentChar = methodDescriptor . charAt ( currentOffset ) ; // Parse the argument types and compute their size , one at a each loop iteration .
while ( currentChar != ')' ) { if ( currentChar == 'J' || currentChar == 'D' ) { currentOffset ++ ; argumentsSize += 2 ; } else { while ( methodDescriptor . charAt ( currentOffset ) == '[' ) { currentOffset ++ ; } if ( methodDescriptor . charAt ( currentOffset ++ ) == 'L' ) { // Skip the argument descriptor content .
currentOffset = methodDescriptor . indexOf ( ';' , currentOffset ) + 1 ; } argumentsSize += 1 ; } currentChar = methodDescriptor . charAt ( currentOffset ) ; } currentChar = methodDescriptor . charAt ( currentOffset + 1 ) ; if ( currentChar == 'V' ) { return argumentsSize << 2 ; } else { int returnSize = ( currentChar == 'J' || currentChar == 'D' ) ? 2 : 1 ; return argumentsSize << 2 | returnSize ; }


signature:
public class Type { /** * Returns a JVM instruction opcode adapted to this { @ link Type } . This method must not be used for
 * method types .
 * @ param opcode a JVM instruction opcode . This opcode must be one of ILOAD , ISTORE , IALOAD ,
 * IASTORE , IADD , ISUB , IMUL , IDIV , IREM , INEG , ISHL , ISHR , IUSHR , IAND , IOR , IXOR and
 * IRETURN .
 * @ return an opcode that is similar to the given opcode , but adapted to this { @ link Type } . For
 * example , if this type is { @ code float } and { @ code opcode } is IRETURN , this method returns
 * FRETURN . */
public int getOpcode ( final int opcode ) { } }

implementation: if ( opcode == Opcodes . IALOAD || opcode == Opcodes . IASTORE ) { switch ( sort ) { case BOOLEAN : case BYTE : return opcode + ( Opcodes . BALOAD - Opcodes . IALOAD ) ; case CHAR : return opcode + ( Opcodes . CALOAD - Opcodes . IALOAD ) ; case SHORT : return opcode + ( Opcodes . SALOAD - Opcodes . IALOAD ) ; case INT : return opcode ; case FLOAT : return opcode + ( Opcodes . FALOAD - Opcodes . IALOAD ) ; case LONG : return opcode + ( Opcodes . LALOAD - Opcodes . IALOAD ) ; case DOUBLE : return opcode + ( Opcodes . DALOAD - Opcodes . IALOAD ) ; case ARRAY : case OBJECT : case INTERNAL : return opcode + ( Opcodes . AALOAD - Opcodes . IALOAD ) ; case METHOD : case VOID : throw new UnsupportedOperationException ( ) ; default : throw new AssertionError ( ) ; } } else { switch ( sort ) { case VOID : if ( opcode != Opcodes . IRETURN ) { throw new UnsupportedOperationException ( ) ; } return Opcodes . RETURN ; case BOOLEAN : case BYTE : case CHAR : case SHORT : case INT : return opcode ; case FLOAT : return opcode + ( Opcodes . FRETURN - Opcodes . IRETURN ) ; case LONG : return opcode + ( Opcodes . LRETURN - Opcodes . IRETURN ) ; case DOUBLE : return opcode + ( Opcodes . DRETURN - Opcodes . IRETURN ) ; case ARRAY : case OBJECT : case INTERNAL : if ( opcode != Opcodes . ILOAD && opcode != Opcodes . ISTORE && opcode != Opcodes . IRETURN ) { throw new UnsupportedOperationException ( ) ; } return opcode + ( Opcodes . ARETURN - Opcodes . IRETURN ) ; case METHOD : throw new UnsupportedOperationException ( ) ; default : throw new AssertionError ( ) ; } }


signature:
public class JtxTransaction { /** * Modify the transaction associated with the target object such that the only possible outcome
 * of the transaction is to roll back the transaction . */
public void setRollbackOnly ( final Throwable th ) { } }

implementation: if ( ! isNoTransaction ( ) ) { if ( ( status != STATUS_MARKED_ROLLBACK ) && ( status != STATUS_ACTIVE ) ) { throw new JtxException ( "TNo active TX that can be marked as rollback only" ) ; } } rollbackCause = th ; status = STATUS_MARKED_ROLLBACK ;


signature:
public class JtxTransaction { /** * Performs either commit or rollback on all transaction resources . */
protected void commitOrRollback ( boolean doCommit ) { } }

implementation: if ( log . isDebugEnabled ( ) ) { if ( doCommit ) { log . debug ( "Commit JTX" ) ; } else { log . debug ( "Rollback JTX" ) ; } } boolean forcedRollback = false ; if ( ! isNoTransaction ( ) ) { if ( isRollbackOnly ( ) ) { if ( doCommit ) { doCommit = false ; forcedRollback = true ; } } else if ( ! isActive ( ) ) { if ( isCompleted ( ) ) { throw new JtxException ( "TX is already completed, commit or rollback should be called once per TX" ) ; } throw new JtxException ( "No active TX to " + ( doCommit ? "commit" : "rollback" ) ) ; } } if ( doCommit ) { commitAllResources ( ) ; } else { rollbackAllResources ( forcedRollback ) ; }


signature:
public class JtxTransaction { /** * Commits all attached resources . On successful commit , resource will be closed
 * and detached from this transaction . On exception , resource remains attached
 * to transaction .
 * All resources will be committed , even if commit fails on some in that process .
 * If there was at least one failed commit , its exception will be re - thrown after finishing
 * committing all resources , and transaction will be marked as rollback only . */
protected void commitAllResources ( ) throws JtxException { } }

implementation: status = STATUS_COMMITTING ; Exception lastException = null ; Iterator < JtxResource > it = resources . iterator ( ) ; while ( it . hasNext ( ) ) { JtxResource resource = it . next ( ) ; try { resource . commitTransaction ( ) ; it . remove ( ) ; } catch ( Exception ex ) { lastException = ex ; } } if ( lastException != null ) { setRollbackOnly ( lastException ) ; throw new JtxException ( "Commit failed: one or more TX resources couldn't commit a TX" , lastException ) ; } txManager . removeTransaction ( this ) ; status = STATUS_COMMITTED ;


signature:
public class JtxTransaction { /** * Rollbacks all attached resources . Resource will be closed . and detached from this transaction .
 * If exception occurs , it will be rethrown at the end . */
protected void rollbackAllResources ( final boolean wasForced ) { } }

implementation: status = STATUS_ROLLING_BACK ; Exception lastException = null ; Iterator < JtxResource > it = resources . iterator ( ) ; while ( it . hasNext ( ) ) { JtxResource resource = it . next ( ) ; try { resource . rollbackTransaction ( ) ; } catch ( Exception ex ) { lastException = ex ; } finally { it . remove ( ) ; } } txManager . removeTransaction ( this ) ; status = STATUS_ROLLEDBACK ; if ( lastException != null ) { status = STATUS_UNKNOWN ; throw new JtxException ( "Rollback failed: one or more TX resources couldn't rollback a TX" , lastException ) ; } if ( wasForced ) { throw new JtxException ( "TX rolled back because it has been marked as rollback-only" , rollbackCause ) ; }


signature:
public class JtxTransaction { /** * Requests a resource . If resource is not found , it will be created and new transaction will be started on it . */
public < E > E requestResource ( final Class < E > resourceType ) { } }

implementation: if ( isCompleted ( ) ) { throw new JtxException ( "TX is already completed, resource are not available after commit or rollback" ) ; } if ( isRollbackOnly ( ) ) { throw new JtxException ( "TX is marked as rollback only, resource are not available" , rollbackCause ) ; } if ( ! isNoTransaction ( ) && ! isActive ( ) ) { throw new JtxException ( "Resources are not available since TX is not active" ) ; } checkTimeout ( ) ; E resource = lookupResource ( resourceType ) ; if ( resource == null ) { int maxResources = txManager . getMaxResourcesPerTransaction ( ) ; if ( ( maxResources != - 1 ) && ( resources . size ( ) >= maxResources ) ) { throw new JtxException ( "TX already has attached max. number of resources" ) ; } JtxResourceManager < E > resourceManager = txManager . lookupResourceManager ( resourceType ) ; resource = resourceManager . beginTransaction ( mode , isActive ( ) ) ; resources . add ( new JtxResource < > ( this , resourceManager , resource ) ) ; } return resource ;


signature:
public class JtxTransaction { /** * Lookups for open resource . Returns < code > null < / code > if resource not found .
 * Only open resources can be found . */
protected < E > E lookupResource ( final Class < E > resourceType ) { } }

implementation:
for ( JtxResource jtxResource : resources ) { if ( jtxResource . isSameTypeAsResource ( resourceType ) ) { // noinspection unchecked
return ( E ) jtxResource . getResource ( ) ; } } return null ;


signature:
public class JsonWriter { /** * Stores name to temporary stack . Used when name ' s value may or may not be
 * serialized ( e . g . it may be excluded ) , in that case we do not need to
 * write the name . */
public void pushName ( final String name , final boolean withComma ) { } }

implementation: pushedName = name ; pushedComma = withComma ; isPushed = true ;


signature:
public class JsonWriter { /** * Writes stored name to JSON string . Cleans storage . */
protected void popName ( ) { } }

implementation: if ( isPushed ) { if ( pushedComma ) { writeComma ( ) ; } String name = pushedName ; pushedName = null ; isPushed = false ; writeName ( name ) ; }


signature:
public class JsonWriter { /** * Writes object ' s property name : string and a colon . */
public void writeName ( final String name ) { } }

implementation: if ( name != null ) { writeString ( name ) ; } else { write ( NULL ) ; } write ( ':' ) ;


signature:
public class JsonWriter { /** * Write a quoted and escaped value to the output . */
public void writeString ( final String value ) { } }

implementation: popName ( ) ; write ( StringPool . QUOTE ) ; int len = value . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = value . charAt ( i ) ; switch ( c ) { case '"' : write ( "\\\"" ) ; break ; case '\\' : write ( "\\\\" ) ; break ; case '/' : if ( strictStringEncoding ) { write ( "\\/" ) ; } else { write ( c ) ; } break ; case '\b' : write ( "\\b" ) ; break ; case '\f' : write ( "\\f" ) ; break ; case '\n' : write ( "\\n" ) ; break ; case '\r' : write ( "\\r" ) ; break ; case '\t' : write ( "\\t" ) ; break ; default : if ( Character . isISOControl ( c ) ) { unicode ( c ) ; } else { write ( c ) ; } } } write ( StringPool . QUOTE ) ;


signature:
public class JsonWriter { /** * Writes unicode representation of a character . */
protected void unicode ( final char c ) { } }

implementation: write ( "\\u" ) ; int n = c ; for ( int i = 0 ; i < 4 ; ++ i ) { int digit = ( n & 0xf000 ) >> 12 ; char hex = CharUtil . int2hex ( digit ) ; write ( hex ) ; n <<= 4 ; }


signature:
public class JsonWriter { /** * Appends char sequence to the buffer . Used for numbers , nulls , booleans , etc . */
public void write ( final CharSequence charSequence ) { } }

implementation: popName ( ) ; try { out . append ( charSequence ) ; } catch ( IOException ioex ) { throw new JsonException ( ioex ) ; }


signature:
public class LagartoDomBuilderConfig { /** * Sets parsing error log level as a name . */
public LagartoDomBuilderConfig setParsingErrorLogLevelName ( String logLevel ) { } }

implementation: logLevel = logLevel . trim ( ) . toUpperCase ( ) ; parsingErrorLogLevel = Logger . Level . valueOf ( logLevel ) ; return this ;


signature:
public class BaseNamingStrategy { /** * - - - - - util methods */
protected static StringBuilder toUppercase ( final StringBuilder string ) { } }

implementation: final int strLen = string . length ( ) ; for ( int i = 0 ; i < strLen ; i ++ ) { char c = string . charAt ( i ) ; char uppercaseChar = Character . toUpperCase ( c ) ; if ( c != uppercaseChar ) { string . setCharAt ( i , uppercaseChar ) ; } } return string ;


signature:
public class DecoraTag { /** * Returns < code > true < / code > if provided tag
 * matches decorator tag . */
public boolean isMatchedTag ( final Tag tag ) { } }

implementation: if ( ! tag . nameEquals ( name ) ) { return false ; } if ( id != null ) { CharSequence tagId = tag . getId ( ) ; if ( tagId == null ) { return false ; } if ( ! CharSequenceUtil . equals ( id , tagId ) ) { return false ; } } return true ;


signature:
public class DecoraTag { /** * Starts defining region by setting the start index and reset region length to zero . */
public void startRegion ( final int start , final int tagLen , final int deepLevel ) { } }

implementation: this . regionStart = start + tagLen ; this . regionLength = 0 ; this . regionTagStart = start ; this . deepLevel = deepLevel ;


signature:
public class DecoraTag { /** * Returns < code > true < / code > if region of this Decora tag
 * is inside of region of provided Decora tag . */
public boolean isInsideOtherTagRegion ( final DecoraTag decoraTag ) { } }

implementation: return ( regionStart > decoraTag . getRegionStart ( ) ) && ( regionStart < decoraTag . getRegionStart ( ) + decoraTag . getRegionLength ( ) ) ;


signature:
public class Attribute { /** * Returns true if attribute is containing some value . */
public boolean isContaining ( final String include ) { } }

implementation: if ( value == null ) { return false ; } if ( splits == null ) { splits = StringUtil . splitc ( value , ' ' ) ; } for ( String s : splits ) { if ( s . equals ( include ) ) { return true ; } } return false ;


signature:
public class PseudoFunctionSelector { /** * Registers pseudo function . */
public static void registerPseudoFunction ( final Class < ? extends PseudoFunction > pseudoFunctionType ) { } }

implementation: PseudoFunction pseudoFunction ; try { pseudoFunction = ClassUtil . newInstance ( pseudoFunctionType ) ; } catch ( Exception ex ) { throw new CSSellyException ( ex ) ; } PSEUDO_FUNCTION_MAP . put ( pseudoFunction . getPseudoFunctionName ( ) , pseudoFunction ) ;


signature:
public class PseudoFunctionSelector { /** * Lookups pseudo function for given pseudo function name . */
public static PseudoFunction < ? > lookupPseudoFunction ( final String pseudoFunctionName ) { } }

implementation: PseudoFunction pseudoFunction = PSEUDO_FUNCTION_MAP . get ( pseudoFunctionName ) ; if ( pseudoFunction == null ) { throw new CSSellyException ( "Unsupported pseudo function: " + pseudoFunctionName ) ; } return pseudoFunction ;


signature:
public class PseudoFunctionSelector { /** * Accepts node within selected results . Invoked after results are matched . */
@ Override public boolean accept ( final List < Node > currentResults , final Node node , final int index ) { } }

implementation: return pseudoFunction . match ( currentResults , node , index , parsedExpression ) ;


signature:
public class ProxettaClassBuilder { /** * Creates destination subclass header from current target class . Destination name is created from targets by
 * adding a suffix and , optionally , a number . Destination extends the target . */
@ Override public void visit ( final int version , int access , final String name , final String signature , final String superName , final String [ ] interfaces ) { } }

implementation:
wd . init ( name , superName , this . suffix , this . reqProxyClassName ) ; // change access of destination
access &= ~ AsmUtil . ACC_ABSTRACT ; // write destination class
final int v = ProxettaAsmUtil . resolveJavaVersion ( version ) ; wd . dest . visit ( v , access , wd . thisReference , signature , wd . superName , null ) ; wd . proxyAspects = new ProxyAspectData [ aspects . length ] ; for ( int i = 0 ; i < aspects . length ; i ++ ) { wd . proxyAspects [ i ] = new ProxyAspectData ( wd , aspects [ i ] , i ) ; }


signature:
public class ProxettaClassBuilder { /** * Creates proxified methods and constructors .
 * Destination proxy will have all constructors as a target class , using { @ link jodd . proxetta . asm . ProxettaCtorBuilder } .
 * Static initializers are removed , since they will be execute in target anyway .
 * For each method , { @ link ProxettaMethodBuilder } determines if method matches pointcut . If so , method will be proxified . */
@ Override public MethodVisitor visitMethod ( final int access , final String name , final String desc , final String signature , final String [ ] exceptions ) { } }

implementation:
final MethodSignatureVisitor msign = targetClassInfo . lookupMethodSignatureVisitor ( access , name , desc , wd . superReference ) ; if ( msign == null ) { return null ; } if ( msign . isFinal && ! wd . allowFinalMethods ) { return null ; } // destination constructors [ A1]
if ( name . equals ( INIT ) ) { MethodVisitor mv = wd . dest . visitMethod ( access , name , desc , msign . getAsmMethodSignature ( ) , null ) ; return new ProxettaCtorBuilder ( mv , msign , wd ) ; } // ignore destination static block
if ( name . equals ( CLINIT ) ) { return null ; } return applyProxy ( msign ) ;


signature:
public class ProxettaClassBuilder { /** * Copies all destination type annotations to the target . */
@ Override public AnnotationVisitor visitAnnotation ( final String desc , final boolean visible ) { } }

implementation:
AnnotationVisitor destAnn = wd . dest . visitAnnotation ( desc , visible ) ; // [ A3]
return new AnnotationVisitorAdapter ( destAnn ) ;


signature:
public class ProxettaClassBuilder { /** * Creates static initialization block that simply calls all
 * advice static init methods in correct order . */
protected void makeStaticInitBlock ( ) { } }

implementation: if ( wd . adviceClinits != null ) { MethodVisitor mv = wd . dest . visitMethod ( AsmUtil . ACC_STATIC , CLINIT , DESC_VOID , null , null ) ; mv . visitCode ( ) ; for ( String name : wd . adviceClinits ) { mv . visitMethodInsn ( INVOKESTATIC , wd . thisReference , name , DESC_VOID , false ) ; } mv . visitInsn ( RETURN ) ; mv . visitMaxs ( 0 , 0 ) ; mv . visitEnd ( ) ; }


signature:
public class ProxettaClassBuilder { /** * Creates init method that simply calls all advice constructor methods in correct order .
 * This created init method is called from each destination ' s constructor . */
protected void makeProxyConstructor ( ) { } }

implementation: MethodVisitor mv = wd . dest . visitMethod ( AsmUtil . ACC_PRIVATE | AsmUtil . ACC_FINAL , ProxettaNames . initMethodName , DESC_VOID , null , null ) ; mv . visitCode ( ) ; if ( wd . adviceInits != null ) { for ( String name : wd . adviceInits ) { mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitMethodInsn ( INVOKESPECIAL , wd . thisReference , name , DESC_VOID , false ) ; } } mv . visitInsn ( RETURN ) ; mv . visitMaxs ( 0 , 0 ) ; mv . visitEnd ( ) ;


signature:
public class ProxettaClassBuilder { /** * Checks for all public super methods that are not overridden . */
protected void processSuperMethods ( ) { } }

implementation: for ( ClassReader cr : targetClassInfo . superClassReaders ) { cr . accept ( new EmptyClassVisitor ( ) { String declaredClassName ; @ Override public void visit ( final int version , final int access , final String name , final String signature , final String superName , final String [ ] interfaces ) { declaredClassName = name ; } @ Override public MethodVisitor visitMethod ( final int access , final String name , final String desc , final String signature , final String [ ] exceptions ) { if ( name . equals ( INIT ) || name . equals ( CLINIT ) ) { return null ; } MethodSignatureVisitor msign = targetClassInfo . lookupMethodSignatureVisitor ( access , name , desc , declaredClassName ) ; if ( msign == null ) { return null ; } return applyProxy ( msign ) ; } } , 0 ) ; }


signature:
public class ProxettaClassBuilder { /** * Check if proxy should be applied on method and return proxy method builder if so .
 * Otherwise , returns < code > null < / code > . */
protected ProxettaMethodBuilder applyProxy ( final MethodSignatureVisitor msign ) { } }

implementation:
List < ProxyAspectData > aspectList = matchMethodPointcuts ( msign ) ; if ( aspectList == null ) { // no pointcuts on this method , return
return null ; } int access = msign . getAccessFlags ( ) ; if ( ( access & ACC_ABSTRACT ) != 0 ) { throw new ProxettaException ( "Unable to process abstract method: " + msign ) ; } wd . proxyApplied = true ; return new ProxettaMethodBuilder ( msign , wd , aspectList ) ;


signature:
public class ProxettaClassBuilder { /** * Matches pointcuts on method . If no pointcut found , returns < code > null < / code > . */
protected List < ProxyAspectData > matchMethodPointcuts ( final MethodSignatureVisitor msign ) { } }

implementation: List < ProxyAspectData > aspectList = null ; for ( ProxyAspectData aspectData : wd . proxyAspects ) { if ( aspectData . apply ( msign ) ) { if ( aspectList == null ) { aspectList = new ArrayList < > ( wd . proxyAspects . length ) ; } aspectList . add ( aspectData ) ; } } return aspectList ;


signature:
public class BinarySearchBase { /** * Finds index of given element in inclusive index range . Returns negative
 * value if element is not found . */
public int find ( int low , int high ) { } }

implementation:
while ( low <= high ) { int mid = ( low + high ) >>> 1 ; int delta = compare ( mid ) ; if ( delta < 0 ) { low = mid + 1 ; } else if ( delta > 0 ) { high = mid - 1 ; } else { return mid ; } } // not found
return - ( low + 1 ) ;


signature:
public class BinarySearchBase { /** * Finds very first index of given element in inclusive index range . Returns negative
 * value if element is not found . */
public int findFirst ( int low , int high ) { } }

implementation: int ndx = - 1 ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; int delta = compare ( mid ) ; if ( delta < 0 ) { low = mid + 1 ; } else { if ( delta == 0 ) { ndx = mid ; } high = mid - 1 ; } } if ( ndx == - 1 ) { return - ( low + 1 ) ; } return ndx ;


signature:
public class BinarySearchBase { /** * Finds very last index of given element in inclusive index range . Returns negative
 * value if element is not found . */
public int findLast ( int low , int high ) { } }

implementation: int ndx = - 1 ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; int delta = compare ( mid ) ; if ( delta > 0 ) { high = mid - 1 ; } else { if ( delta == 0 ) { ndx = mid ; } low = mid + 1 ; } } if ( ndx == - 1 ) { return - ( low + 1 ) ; } return ndx ;


signature:
public class Chalk { /** * - - - - - internal */
protected void startSequence ( final String value ) { } }

implementation: if ( prefix == null ) { prefix = new StringBuilder ( ) ; prefix . append ( "\u001B[" ) ; } else { prefix . append ( StringPool . SEMICOLON ) ; } prefix . append ( value ) ;


signature:
public class Chalk { /** * Returns chalked string . */
public String on ( final String string ) { } }

implementation: if ( ! enabled ) { return string ; } final StringBuilder sb = new StringBuilder ( ) ; if ( prefix != null ) { sb . append ( prefix ) . append ( "m" ) ; } sb . append ( string ) ; if ( suffix != null ) { sb . append ( suffix ) . append ( "m" ) ; } return sb . toString ( ) ;


signature: public class ClassWriter { @ Override public final void visit ( final int version , final int access , final String name , final String signature , final String superName , final String [ ] interfaces ) { } }

implementation: this . version = version ; this . accessFlags = access ; this . thisClass = symbolTable . setMajorVersionAndClassName ( version & 0xFFFF , name ) ; if ( signature != null ) { this . signatureIndex = symbolTable . addConstantUtf8 ( signature ) ; } this . superClass = superName == null ? 0 : symbolTable . addConstantClass ( superName ) . index ; if ( interfaces != null && interfaces . length > 0 ) { interfaceCount = interfaces . length ; this . interfaces = new int [ interfaceCount ] ; for ( int i = 0 ; i < interfaceCount ; ++ i ) { this . interfaces [ i ] = symbolTable . addConstantClass ( interfaces [ i ] ) . index ; } } if ( compute == MethodWriter . COMPUTE_MAX_STACK_AND_LOCAL && ( version & 0xFFFF ) >= Opcodes . V1_7 ) { compute = MethodWriter . COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES ; }


signature:
public class ClassWriter { /** * Returns the content of the class file that was built by this ClassWriter .
 * @ return the binary content of the JVMS ClassFile structure that was built by this ClassWriter .
 * @ throws ClassTooLargeException if the constant pool of the class is too large .
 * @ throws MethodTooLargeException if the Code attribute of a method is too large . */
public byte [ ] toByteArray ( ) throws ClassTooLargeException , MethodTooLargeException { } }

implementation:
// First step : compute the size in bytes of the ClassFile structure .
// The magic field uses 4 bytes , 10 mandatory fields ( minor _ version , major _ version ,
// constant _ pool _ count , access _ flags , this _ class , super _ class , interfaces _ count , fields _ count ,
// methods _ count and attributes _ count ) use 2 bytes each , and each interface uses 2 bytes too .
int size = 24 + 2 * interfaceCount ; int fieldsCount = 0 ; FieldWriter fieldWriter = firstField ; while ( fieldWriter != null ) { ++ fieldsCount ; size += fieldWriter . computeFieldInfoSize ( ) ; fieldWriter = ( FieldWriter ) fieldWriter . fv ; } int methodsCount = 0 ; MethodWriter methodWriter = firstMethod ; while ( methodWriter != null ) { ++ methodsCount ; size += methodWriter . computeMethodInfoSize ( ) ; methodWriter = ( MethodWriter ) methodWriter . mv ; } // For ease of reference , we use here the same attribute order as in Section 4.7 of the JVMS .
int attributesCount = 0 ; if ( innerClasses != null ) { ++ attributesCount ; size += 8 + innerClasses . length ; symbolTable . addConstantUtf8 ( Constants . INNER_CLASSES ) ; } if ( enclosingClassIndex != 0 ) { ++ attributesCount ; size += 10 ; symbolTable . addConstantUtf8 ( Constants . ENCLOSING_METHOD ) ; } if ( ( accessFlags & Opcodes . ACC_SYNTHETIC ) != 0 && ( version & 0xFFFF ) < Opcodes . V1_5 ) { ++ attributesCount ; size += 6 ; symbolTable . addConstantUtf8 ( Constants . SYNTHETIC ) ; } if ( signatureIndex != 0 ) { ++ attributesCount ; size += 8 ; symbolTable . addConstantUtf8 ( Constants . SIGNATURE ) ; } if ( sourceFileIndex != 0 ) { ++ attributesCount ; size += 8 ; symbolTable . addConstantUtf8 ( Constants . SOURCE_FILE ) ; } if ( debugExtension != null ) { ++ attributesCount ; size += 6 + debugExtension . length ; symbolTable . addConstantUtf8 ( Constants . SOURCE_DEBUG_EXTENSION ) ; } if ( ( accessFlags & Opcodes . ACC_DEPRECATED ) != 0 ) { ++ attributesCount ; size += 6 ; symbolTable . addConstantUtf8 ( Constants . DEPRECATED ) ; } if ( lastRuntimeVisibleAnnotation != null ) { ++ attributesCount ; size += lastRuntimeVisibleAnnotation . computeAnnotationsSize ( Constants . RUNTIME_VISIBLE_ANNOTATIONS ) ; } if ( lastRuntimeInvisibleAnnotation != null ) { ++ attributesCount ; size += lastRuntimeInvisibleAnnotation . computeAnnotationsSize ( Constants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; } if ( lastRuntimeVisibleTypeAnnotation != null ) { ++ attributesCount ; size += lastRuntimeVisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) ; } if ( lastRuntimeInvisibleTypeAnnotation != null ) { ++ attributesCount ; size += lastRuntimeInvisibleTypeAnnotation . computeAnnotationsSize ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) ; } if ( symbolTable . computeBootstrapMethodsSize ( ) > 0 ) { ++ attributesCount ; size += symbolTable . computeBootstrapMethodsSize ( ) ; } if ( moduleWriter != null ) { attributesCount += moduleWriter . getAttributeCount ( ) ; size += moduleWriter . computeAttributesSize ( ) ; } if ( nestHostClassIndex != 0 ) { ++ attributesCount ; size += 8 ; symbolTable . addConstantUtf8 ( Constants . NEST_HOST ) ; } if ( nestMemberClasses != null ) { ++ attributesCount ; size += 8 + nestMemberClasses . length ; symbolTable . addConstantUtf8 ( Constants . NEST_MEMBERS ) ; } if ( firstAttribute != null ) { attributesCount += firstAttribute . getAttributeCount ( ) ; size += firstAttribute . computeAttributesSize ( symbolTable ) ; } // IMPORTANT : this must be the last part of the ClassFile size computation , because the previous
// statements can add attribute names to the constant pool , thereby changing its size !
size += symbolTable . getConstantPoolLength ( ) ; int constantPoolCount = symbolTable . getConstantPoolCount ( ) ; if ( constantPoolCount > 0xFFFF ) { throw new ClassTooLargeException ( symbolTable . getClassName ( ) , constantPoolCount ) ; } // Second step : allocate a ByteVector of the correct size ( in order to avoid any array copy in
// dynamic resizes ) and fill it with the ClassFile content .
ByteVector result = new ByteVector ( size ) ; result . putInt ( 0xCAFEBABE ) . putInt ( version ) ; symbolTable . putConstantPool ( result ) ; int mask = ( version & 0xFFFF ) < Opcodes . V1_5 ? Opcodes . ACC_SYNTHETIC : 0 ; result . putShort ( accessFlags & ~ mask ) . putShort ( thisClass ) . putShort ( superClass ) ; result . putShort ( interfaceCount ) ; for ( int i = 0 ; i < interfaceCount ; ++ i ) { result . putShort ( interfaces [ i ] ) ; } result . putShort ( fieldsCount ) ; fieldWriter = firstField ; while ( fieldWriter != null ) { fieldWriter . putFieldInfo ( result ) ; fieldWriter = ( FieldWriter ) fieldWriter . fv ; } result . putShort ( methodsCount ) ; boolean hasFrames = false ; boolean hasAsmInstructions = false ; methodWriter = firstMethod ; while ( methodWriter != null ) { hasFrames |= methodWriter . hasFrames ( ) ; hasAsmInstructions |= methodWriter . hasAsmInstructions ( ) ; methodWriter . putMethodInfo ( result ) ; methodWriter = ( MethodWriter ) methodWriter . mv ; } // For ease of reference , we use here the same attribute order as in Section 4.7 of the JVMS .
result . putShort ( attributesCount ) ; if ( innerClasses != null ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . INNER_CLASSES ) ) . putInt ( innerClasses . length + 2 ) . putShort ( numberOfInnerClasses ) . putByteArray ( innerClasses . data , 0 , innerClasses . length ) ; } if ( enclosingClassIndex != 0 ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . ENCLOSING_METHOD ) ) . putInt ( 4 ) . putShort ( enclosingClassIndex ) . putShort ( enclosingMethodIndex ) ; } if ( ( accessFlags & Opcodes . ACC_SYNTHETIC ) != 0 && ( version & 0xFFFF ) < Opcodes . V1_5 ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . SYNTHETIC ) ) . putInt ( 0 ) ; } if ( signatureIndex != 0 ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . SIGNATURE ) ) . putInt ( 2 ) . putShort ( signatureIndex ) ; } if ( sourceFileIndex != 0 ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . SOURCE_FILE ) ) . putInt ( 2 ) . putShort ( sourceFileIndex ) ; } if ( debugExtension != null ) { int length = debugExtension . length ; result . putShort ( symbolTable . addConstantUtf8 ( Constants . SOURCE_DEBUG_EXTENSION ) ) . putInt ( length ) . putByteArray ( debugExtension . data , 0 , length ) ; } if ( ( accessFlags & Opcodes . ACC_DEPRECATED ) != 0 ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . DEPRECATED ) ) . putInt ( 0 ) ; } if ( lastRuntimeVisibleAnnotation != null ) { lastRuntimeVisibleAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_VISIBLE_ANNOTATIONS ) , result ) ; } if ( lastRuntimeInvisibleAnnotation != null ) { lastRuntimeInvisibleAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_INVISIBLE_ANNOTATIONS ) , result ) ; } if ( lastRuntimeVisibleTypeAnnotation != null ) { lastRuntimeVisibleTypeAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_VISIBLE_TYPE_ANNOTATIONS ) , result ) ; } if ( lastRuntimeInvisibleTypeAnnotation != null ) { lastRuntimeInvisibleTypeAnnotation . putAnnotations ( symbolTable . addConstantUtf8 ( Constants . RUNTIME_INVISIBLE_TYPE_ANNOTATIONS ) , result ) ; } symbolTable . putBootstrapMethods ( result ) ; if ( moduleWriter != null ) { moduleWriter . putAttributes ( result ) ; } if ( nestHostClassIndex != 0 ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . NEST_HOST ) ) . putInt ( 2 ) . putShort ( nestHostClassIndex ) ; } if ( nestMemberClasses != null ) { result . putShort ( symbolTable . addConstantUtf8 ( Constants . NEST_MEMBERS ) ) . putInt ( nestMemberClasses . length + 2 ) . putShort ( numberOfNestMemberClasses ) . putByteArray ( nestMemberClasses . data , 0 , nestMemberClasses . length ) ; } if ( firstAttribute != null ) { firstAttribute . putAttributes ( symbolTable , result ) ; } // Third step : replace the ASM specific instructions , if any .
if ( hasAsmInstructions ) { return replaceAsmInstructions ( result . data , hasFrames ) ; } else { return result . data ; }


signature:
public class ClassWriter { /** * Returns the equivalent of the given class file , with the ASM specific instructions replaced
 * with standard ones . This is done with a ClassReader - & gt ; ClassWriter round trip .
 * @ param classFile a class file containing ASM specific instructions , generated by this
 * ClassWriter .
 * @ param hasFrames whether there is at least one stack map frames in ' classFile ' .
 * @ return an equivalent of ' classFile ' , with the ASM specific instructions replaced with standard
 * ones . */
private byte [ ] replaceAsmInstructions ( final byte [ ] classFile , final boolean hasFrames ) { } }

implementation:
final Attribute [ ] attributes = getAttributePrototypes ( ) ; firstField = null ; lastField = null ; firstMethod = null ; lastMethod = null ; lastRuntimeVisibleAnnotation = null ; lastRuntimeInvisibleAnnotation = null ; lastRuntimeVisibleTypeAnnotation = null ; lastRuntimeInvisibleTypeAnnotation = null ; moduleWriter = null ; nestHostClassIndex = 0 ; numberOfNestMemberClasses = 0 ; nestMemberClasses = null ; firstAttribute = null ; compute = hasFrames ? MethodWriter . COMPUTE_INSERTED_FRAMES : MethodWriter . COMPUTE_NOTHING ; new ClassReader ( classFile , 0 , /* checkClassVersion = */
false ) . accept ( this , attributes , ( hasFrames ? ClassReader . EXPAND_FRAMES : 0 ) | ClassReader . EXPAND_ASM_INSNS ) ; return toByteArray ( ) ;


signature:
public class ClassWriter { /** * Returns the prototypes of the attributes used by this class , its fields and its methods .
 * @ return the prototypes of the attributes used by this class , its fields and its methods . */
private Attribute [ ] getAttributePrototypes ( ) { } }

implementation: Attribute . Set attributePrototypes = new Attribute . Set ( ) ; attributePrototypes . addAttributes ( firstAttribute ) ; FieldWriter fieldWriter = firstField ; while ( fieldWriter != null ) { fieldWriter . collectAttributePrototypes ( attributePrototypes ) ; fieldWriter = ( FieldWriter ) fieldWriter . fv ; } MethodWriter methodWriter = firstMethod ; while ( methodWriter != null ) { methodWriter . collectAttributePrototypes ( attributePrototypes ) ; methodWriter = ( MethodWriter ) methodWriter . mv ; } return attributePrototypes . toArray ( ) ;


signature:
public class ClassWriter { /** * Adds a handle to the constant pool of the class being build . Does nothing if the constant pool
 * already contains a similar item . < i > This method is intended for { @ link Attribute } sub classes ,
 * and is normally not needed by class generators or adapters . < / i >
 * @ param tag the kind of this handle . Must be { @ link Opcodes # H _ GETFIELD } , { @ link
 * Opcodes # H _ GETSTATIC } , { @ link Opcodes # H _ PUTFIELD } , { @ link Opcodes # H _ PUTSTATIC } , { @ link
 * Opcodes # H _ INVOKEVIRTUAL } , { @ link Opcodes # H _ INVOKESTATIC } , { @ link Opcodes # H _ INVOKESPECIAL } ,
 * { @ link Opcodes # H _ NEWINVOKESPECIAL } or { @ link Opcodes # H _ INVOKEINTERFACE } .
 * @ param owner the internal name of the field or method owner class .
 * @ param name the name of the field or method .
 * @ param descriptor the descriptor of the field or method .
 * @ param isInterface true if the owner is an interface .
 * @ return the index of a new or already existing method type reference item . */
public int newHandle ( final int tag , final String owner , final String name , final String descriptor , final boolean isInterface ) { } }

implementation: return symbolTable . addConstantMethodHandle ( tag , owner , name , descriptor , isInterface ) . index ;


signature:
public class ClassWriter { /** * Adds a dynamic constant reference to the constant pool of the class being build . Does nothing
 * if the constant pool already contains a similar item . < i > This method is intended for { @ link
 * Attribute } sub classes , and is normally not needed by class generators or adapters . < / i >
 * @ param name name of the invoked method .
 * @ param descriptor field descriptor of the constant type .
 * @ param bootstrapMethodHandle the bootstrap method .
 * @ param bootstrapMethodArguments the bootstrap method constant arguments .
 * @ return the index of a new or already existing dynamic constant reference item . */
public int newConstantDynamic ( final String name , final String descriptor , final Handle bootstrapMethodHandle , final Object ... bootstrapMethodArguments ) { } }

implementation: return symbolTable . addConstantDynamic ( name , descriptor , bootstrapMethodHandle , bootstrapMethodArguments ) . index ;


signature:
public class ClassWriter { /** * Adds an invokedynamic reference to the constant pool of the class being build . Does nothing if
 * the constant pool already contains a similar item . < i > This method is intended for { @ link
 * Attribute } sub classes , and is normally not needed by class generators or adapters . < / i >
 * @ param name name of the invoked method .
 * @ param descriptor descriptor of the invoke method .
 * @ param bootstrapMethodHandle the bootstrap method .
 * @ param bootstrapMethodArguments the bootstrap method constant arguments .
 * @ return the index of a new or already existing invokedynamic reference item . */
public int newInvokeDynamic ( final String name , final String descriptor , final Handle bootstrapMethodHandle , final Object ... bootstrapMethodArguments ) { } }

implementation: return symbolTable . addConstantInvokeDynamic ( name , descriptor , bootstrapMethodHandle , bootstrapMethodArguments ) . index ;


signature:
public class ClassWriter { /** * Adds a field reference to the constant pool of the class being build . Does nothing if the
 * constant pool already contains a similar item . < i > This method is intended for { @ link Attribute }
 * sub classes , and is normally not needed by class generators or adapters . < / i >
 * @ param owner the internal name of the field ' s owner class .
 * @ param name the field ' s name .
 * @ param descriptor the field ' s descriptor .
 * @ return the index of a new or already existing field reference item . */
public int newField ( final String owner , final String name , final String descriptor ) { } }

implementation: return symbolTable . addConstantFieldref ( owner , name , descriptor ) . index ;


signature:
public class ClassWriter { /** * Adds a method reference to the constant pool of the class being build . Does nothing if the
 * constant pool already contains a similar item . < i > This method is intended for { @ link Attribute }
 * sub classes , and is normally not needed by class generators or adapters . < / i >
 * @ param owner the internal name of the method ' s owner class .
 * @ param name the method ' s name .
 * @ param descriptor the method ' s descriptor .
 * @ param isInterface { @ literal true } if { @ code owner } is an interface .
 * @ return the index of a new or already existing method reference item . */
public int newMethod ( final String owner , final String name , final String descriptor , final boolean isInterface ) { } }

implementation: return symbolTable . addConstantMethodref ( owner , name , descriptor , isInterface ) . index ;