private int [ ] createInitialLocals ( ) { int [ ] initialLocals = new int [ itsMaxLocals ] ; int localsTop = 0 ; // Instance methods require the first local variable in the array // to be "this". However, if the method being created is a // constructor, aka the method is <init>, then the type of "this" // should be StackMapTable.UNINITIALIZED_THIS if ( ( itsCurrentMethod . getFlags ( ) & ACC_STATIC ) == 0 ) { if ( "<init>" . equals ( itsCurrentMethod . getName ( ) ) ) { initialLocals [ localsTop ++ ] = TypeInfo . UNINITIALIZED_THIS ; } else { initialLocals [ localsTop ++ ] = TypeInfo . OBJECT ( itsThisClassIndex ) ; } } // No error checking should be necessary, sizeOfParameters does this String type = itsCurrentMethod . getType ( ) ; int lParenIndex = type . indexOf ( ' ' ) ; int rParenIndex = type . indexOf ( ' ' ) ; if ( lParenIndex != 0 || rParenIndex < 0 ) { throw new IllegalArgumentException ( "bad method type" ) ; } int start = lParenIndex + 1 ; StringBuilder paramType = new StringBuilder ( ) ; while ( start < rParenIndex ) { switch ( type . charAt ( start ) ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : paramType . append ( type . charAt ( start ) ) ; ++ start ; break ; case ' ' : int end = type . indexOf ( ' ' , start ) + 1 ; String name = type . substring ( start , end ) ; paramType . append ( name ) ; start = end ; break ; case ' ' : paramType . append ( ' ' ) ; ++ start ; continue ; } String internalType = descriptorToInternalName ( paramType . toString ( ) ) ; int typeInfo = TypeInfo . fromType ( internalType , itsConstantPool ) ; initialLocals [ localsTop ++ ] = typeInfo ; if ( TypeInfo . isTwoWords ( typeInfo ) ) { localsTop ++ ; } paramType . setLength ( 0 ) ; } return initialLocals ; }
Compute the initial local variable array for the current method .