private boolean resolveArrayOrParameterizationPartOfTypeLiteral( String[] T, boolean bIgnoreArrayBrackets, TypeLiteral e )
  {
    boolean bArrayOrParameterization = false;
    if( !bIgnoreArrayBrackets )
    {
      bArrayOrParameterization = parseArrayType( e );
    }
    pushExpression( e );

    if( !T[0].endsWith( "[]" ) )
    {
      int iOffset = _tokenizer.getTokenStart();
      int iLineNum = _tokenizer.getLineNumber();
      int iColumn = getTokenizer().getTokenColumn();

      if( match( null, "<", SourceCodeTokenizer.TT_OPERATOR ) )
      {
        TypeLiteral typeLiteral = (TypeLiteral)peekExpression();
        IType type = typeLiteral.getType().getType();
        verify( e, type.isGenericType(), Res.MSG_PARAMETERIZATION_NOT_SUPPORTED_FOR_TYPE, type.getName() );
        List<TypeLiteral> paramTypes = parseTypeParameters( type );
        verify( e, match( null, ">", SourceCodeTokenizer.TT_OPERATOR ), Res.MSG_EXPECTING_CLOSING_ANGLE_BRACKET_FOR_TYPE );
        makeTypeParameterListClause( iOffset, iLineNum, iColumn, paramTypes );
        int numArrays = 0;
        while( !bIgnoreArrayBrackets && match( null, '[' ) )
        {
          verify( e, match( null, ']' ), Res.MSG_EXPECTING_ARRAY_BRACKET );
          ++numArrays;
        }
        if( !(type instanceof ErrorType) )
        {
          IType[] types = new IType[paramTypes.size()];
          for( int i = 0; i < paramTypes.size(); i++ )
          {
            TypeLiteral tl = paramTypes.get( i );
            types[i] = (tl.getType()).getType();
          }
          verifyCanParameterizeType( e, type, types );
          typeLiteral.setParameterTypes( types );
          type = typeLiteral.getType().getType();
          if( numArrays > 0 )
          {
            for( int i = 0; i < numArrays; i++ )
            {
              type = type.getArrayType();
            }
            typeLiteral.setType( MetaType.getLiteral( type ) );
          }
        }
        bArrayOrParameterization = true;
      }
      else
      {
        TypeLiteral typeLiteral = (TypeLiteral)peekExpression();
        IType type = typeLiteral.getType().getType();
        try
        {
          if( type.isGenericType() && !type.isParameterizedType() && !isParsingCompileTimeConstantExpression() )
          {
            // If a generic type, assume the default parameterized version e.g., List => List<Object>.
            // But if the type is assignable to the context type and the context type is parameterized,
            // derive the parameters from the context type.

            ContextType ctxType = getContextType();
            type = TypeLord.deriveParameterizedTypeFromContext( type, ctxType.getUnboundType() != null ? ctxType.getUnboundType() : ctxType.getType() );
            TypeVarToTypeMap inferenceMap = getInferenceMap();
            if( inferenceMap != null )
            {
              type = TypeLord.getActualType( type, inferenceMap, isParsingTypeListeralForNewExpression() );
            }
            typeLiteral.setType( MetaType.getLiteral( type ) );
          }
        }
        catch( Exception ex )
        {
          throw GosuExceptionUtil.forceThrow( ex, type.getName() );
        }
      }
    }
    return bArrayOrParameterization;
  }
private boolean resolveArrayOrParameterizationPartOfTypeLiteral ( String [ ] T , boolean bIgnoreArrayBrackets , TypeLiteral e ) { boolean bArrayOrParameterization = false ; if ( ! bIgnoreArrayBrackets ) { bArrayOrParameterization = parseArrayType ( e ) ; } pushExpression ( e ) ; if ( ! T [ 0 ] . endsWith ( "[]" ) ) { int iOffset = _tokenizer . getTokenStart ( ) ; int iLineNum = _tokenizer . getLineNumber ( ) ; int iColumn = getTokenizer ( ) . getTokenColumn ( ) ; if ( match ( null , "<" , SourceCodeTokenizer . TT_OPERATOR ) ) { TypeLiteral typeLiteral = ( TypeLiteral ) peekExpression ( ) ; IType type = typeLiteral . getType ( ) . getType ( ) ; verify ( e , type . isGenericType ( ) , Res . MSG_PARAMETERIZATION_NOT_SUPPORTED_FOR_TYPE , type . getName ( ) ) ; List < TypeLiteral > paramTypes = parseTypeParameters ( type ) ; verify ( e , match ( null , ">" , SourceCodeTokenizer . TT_OPERATOR ) , Res . MSG_EXPECTING_CLOSING_ANGLE_BRACKET_FOR_TYPE ) ; makeTypeParameterListClause ( iOffset , iLineNum , iColumn , paramTypes ) ; int numArrays = 0 ; while ( ! bIgnoreArrayBrackets && match ( null , '[' ) ) { verify ( e , match ( null , ']' ) , Res . MSG_EXPECTING_ARRAY_BRACKET ) ; ++ numArrays ; } if ( ! ( type instanceof ErrorType ) ) { IType [ ] types = new IType [ paramTypes . size ( ) ] ; for ( int i = 0 ; i < paramTypes . size ( ) ; i ++ ) { TypeLiteral tl = paramTypes . get ( i ) ; types [ i ] = ( tl . getType ( ) ) . getType ( ) ; } verifyCanParameterizeType ( e , type , types ) ; typeLiteral . setParameterTypes ( types ) ; type = typeLiteral . getType ( ) . getType ( ) ; if ( numArrays > 0 ) { for ( int i = 0 ; i < numArrays ; i ++ ) { type = type . getArrayType ( ) ; } typeLiteral . setType ( MetaType . getLiteral ( type ) ) ; } } bArrayOrParameterization = true ; } else { TypeLiteral typeLiteral = ( TypeLiteral ) peekExpression ( ) ; IType type = typeLiteral . getType ( ) . getType ( ) ; try { if ( type . isGenericType ( ) && ! type . isParameterizedType ( ) && ! isParsingCompileTimeConstantExpression ( ) ) { ContextType ctxType = getContextType ( ) ; type = TypeLord . deriveParameterizedTypeFromContext ( type , ctxType . getUnboundType ( ) != null ? ctxType . getUnboundType ( ) : ctxType . getType ( ) ) ; TypeVarToTypeMap inferenceMap = getInferenceMap ( ) ; if ( inferenceMap != null ) { type = TypeLord . getActualType ( type , inferenceMap , isParsingTypeListeralForNewExpression ( ) ) ; } typeLiteral . setType ( MetaType . getLiteral ( type ) ) ; } } catch ( Exception ex ) { throw GosuExceptionUtil . forceThrow ( ex , type . getName ( ) ) ; } } } return bArrayOrParameterization ; }
@return True if parsed parameterized type.