text
stringlengths
30
1.67M
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . ThisReference ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class CodeSnippetThisReference extends ThisReference implements EvaluationConstants , InvocationSite { EvaluationContext evaluationContext ; FieldBinding delegateThis ; boolean isImplicit ; public CodeSnippetThisReference ( int s , int sourceEnd , EvaluationContext evaluationContext , boolean isImplicit ) { super ( s , sourceEnd ) ; this . evaluationContext = evaluationContext ; this . isImplicit = isImplicit ; } public boolean checkAccess ( MethodScope methodScope ) { if ( this . evaluationContext . isConstructorCall ) { methodScope . problemReporter ( ) . fieldsOrThisBeforeConstructorInvocation ( this ) ; return false ; } if ( this . evaluationContext . declaringTypeName == null || this . evaluationContext . isStatic ) { methodScope . problemReporter ( ) . errorThisSuperInStatic ( this ) ; return false ; } return true ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . aload_0 ( ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , this . delegateThis , null ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return false ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { char [ ] declaringType = this . evaluationContext . declaringTypeName ; output . append ( '<CHAR_LIT:(>' ) ; if ( declaringType == null ) output . append ( "<STR_LIT>" ) ; else output . append ( declaringType ) ; return output . append ( "<STR_LIT>" ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; TypeBinding snippetType = null ; MethodScope methodScope = scope . methodScope ( ) ; if ( ! this . isImplicit && ! checkAccess ( methodScope ) ) { return null ; } snippetType = scope . enclosingSourceType ( ) ; this . delegateThis = scope . getField ( snippetType , DELEGATE_THIS , this ) ; if ( this . delegateThis == null || ! this . delegateThis . isValidBinding ( ) ) { methodScope . problemReporter ( ) . errorThisSuperInStatic ( this ) ; return null ; } return this . resolvedType = this . delegateThis . type ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int index ) { } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . ProblemBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; public class CodeSnippetQualifiedNameReference extends QualifiedNameReference implements EvaluationConstants , ProblemReasons { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetQualifiedNameReference ( char [ ] [ ] sources , long [ ] positions , int sourceStart , int sourceEnd , EvaluationContext evaluationContext ) { super ( sources , positions , sourceStart , sourceEnd ) ; this . evaluationContext = evaluationContext ; } public TypeBinding checkFieldAccess ( BlockScope scope ) { FieldBinding fieldBinding = ( FieldBinding ) this . binding ; MethodScope methodScope = scope . methodScope ( ) ; TypeBinding declaringClass = fieldBinding . original ( ) . declaringClass ; if ( ( this . indexOfFirstFieldBinding == <NUM_LIT:1> || declaringClass . isEnum ( ) ) && methodScope . enclosingSourceType ( ) == declaringClass && methodScope . lastVisibleFieldID >= <NUM_LIT:0> && fieldBinding . id >= methodScope . lastVisibleFieldID && ( ! fieldBinding . isStatic ( ) || methodScope . isStatic ) ) { scope . problemReporter ( ) . forwardReference ( this , this . indexOfFirstFieldBinding - <NUM_LIT:1> , fieldBinding ) ; } this . bits &= ~ ASTNode . RestrictiveFlagMASK ; this . bits |= Binding . FIELD ; return getOtherFieldBindings ( scope ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( ( this . bits & Binding . VARIABLE ) == <NUM_LIT:0> ) { codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generateCode ( currentScope , codeStream , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; if ( lastFieldBinding != null ) { boolean isStatic = lastFieldBinding . isStatic ( ) ; Constant fieldConstant = lastFieldBinding . constant ( ) ; if ( fieldConstant != Constant . NotAConstant ) { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } if ( valueRequired ) { codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } } else { boolean isFirst = lastFieldBinding == this . binding && ( this . indexOfFirstFieldBinding == <NUM_LIT:1> || lastFieldBinding . declaringClass == currentScope . enclosingReceiverType ( ) ) && this . otherBindings == null ; TypeBinding requiredGenericCast = getGenericCast ( this . otherBindings == null ? <NUM_LIT:0> : this . otherBindings . length ) ; if ( valueRequired || ( ! isFirst && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ) || ( ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) || requiredGenericCast != null ) { int lastFieldPc = codeStream . position ; if ( lastFieldBinding . declaringClass == null ) { codeStream . arraylength ( ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { codeStream . pop ( ) ; } } else { codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; if ( requiredGenericCast != null ) codeStream . checkcast ( requiredGenericCast ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( isUnboxing ) codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( isUnboxing ? postConversionType ( currentScope ) . id : lastFieldBinding . type . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } } int fieldPosition = ( int ) ( this . sourcePositions [ this . sourcePositions . length - <NUM_LIT:1> ] > > > <NUM_LIT:32> ) ; codeStream . recordPositionsFrom ( lastFieldPc , fieldPosition ) ; } else { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generateAssignment ( currentScope , codeStream , assignment , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; codeStream . generateEmulationForField ( lastFieldBinding ) ; codeStream . swap ( ) ; assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { switch ( lastFieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( lastFieldBinding ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generateCompoundAssignment ( currentScope , codeStream , expression , operator , assignmentImplicitConversion , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . generateEmulationForField ( lastFieldBinding ) ; codeStream . swap ( ) ; codeStream . aconst_null ( ) ; codeStream . swap ( ) ; codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } else { codeStream . generateEmulationForField ( lastFieldBinding ) ; codeStream . swap ( ) ; codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } int operationTypeID ; if ( ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_JavaLangString ) { codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; } else { codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } if ( valueRequired ) { switch ( lastFieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( lastFieldBinding ) ; } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; if ( valueRequired ) { switch ( lastFieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } codeStream . generateEmulationForField ( lastFieldBinding ) ; if ( ( lastFieldBinding . type == TypeBinding . LONG ) || ( lastFieldBinding . type == TypeBinding . DOUBLE ) ) { codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReadSequence ( currentScope , codeStream ) ; } codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; } else { codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReadSequence ( currentScope , codeStream ) ; } codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; } codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , lastFieldBinding . type . id ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; codeStream . generateEmulatedWriteAccessForField ( lastFieldBinding ) ; } public FieldBinding generateReadSequence ( BlockScope currentScope , CodeStream codeStream ) { int otherBindingsCount = this . otherBindings == null ? <NUM_LIT:0> : this . otherBindings . length ; boolean needValue = otherBindingsCount == <NUM_LIT:0> || ! this . otherBindings [ <NUM_LIT:0> ] . isStatic ( ) ; FieldBinding lastFieldBinding ; TypeBinding lastGenericCast ; TypeBinding lastReceiverType ; boolean complyTo14 = currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ; switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : lastFieldBinding = ( ( FieldBinding ) this . binding ) . original ( ) ; lastGenericCast = this . genericCast ; lastReceiverType = this . actualReceiverType ; if ( lastFieldBinding . constant ( ) != Constant . NotAConstant ) { break ; } if ( needValue ) { if ( lastFieldBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { if ( ! lastFieldBinding . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } } } else { if ( ! lastFieldBinding . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } else { codeStream . aconst_null ( ) ; } } } break ; case Binding . LOCAL : lastFieldBinding = null ; lastGenericCast = null ; LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; lastReceiverType = localBinding . type ; if ( ! needValue ) break ; Constant localConstant = localBinding . constant ( ) ; if ( localConstant != Constant . NotAConstant ) { codeStream . generateConstant ( localConstant , <NUM_LIT:0> ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { VariableBinding [ ] path = currentScope . getEmulationPath ( localBinding ) ; codeStream . generateOuterAccess ( path , this , localBinding , currentScope ) ; } else { codeStream . load ( localBinding ) ; } } break ; default : return null ; } int positionsLength = this . sourcePositions . length ; FieldBinding initialFieldBinding = lastFieldBinding ; if ( this . otherBindings != null ) { for ( int i = <NUM_LIT:0> ; i < otherBindingsCount ; i ++ ) { int pc = codeStream . position ; FieldBinding nextField = this . otherBindings [ i ] . original ( ) ; TypeBinding nextGenericCast = this . otherGenericCasts == null ? null : this . otherGenericCasts [ i ] ; if ( lastFieldBinding != null ) { needValue = ! nextField . isStatic ( ) ; Constant fieldConstant = lastFieldBinding . constant ( ) ; if ( fieldConstant != Constant . NotAConstant ) { if ( i > <NUM_LIT:0> && ! lastFieldBinding . isStatic ( ) ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } if ( needValue ) { codeStream . generateConstant ( fieldConstant , <NUM_LIT:0> ) ; } } else { if ( needValue || ( i > <NUM_LIT:0> && complyTo14 ) || lastGenericCast != null ) { if ( lastFieldBinding . canBeSeenBy ( lastReceiverType , this , currentScope ) ) { MethodBinding accessor = this . syntheticReadAccessors == null ? null : this . syntheticReadAccessors [ i ] ; if ( accessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , lastFieldBinding , lastReceiverType , i == <NUM_LIT:0> && this . indexOfFirstFieldBinding == <NUM_LIT:1> ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , lastFieldBinding , constantPoolDeclaringClass ) ; } else { codeStream . fieldAccess ( Opcodes . OPC_getfield , lastFieldBinding , constantPoolDeclaringClass ) ; } } else { codeStream . invoke ( Opcodes . OPC_invokestatic , accessor , null ) ; } } else { codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } if ( lastGenericCast != null ) { codeStream . checkcast ( lastGenericCast ) ; lastReceiverType = lastGenericCast ; } else { lastReceiverType = lastFieldBinding . type ; } if ( ! needValue ) codeStream . pop ( ) ; } else { if ( lastFieldBinding == initialFieldBinding ) { if ( lastFieldBinding . isStatic ( ) ) { if ( initialFieldBinding . declaringClass != this . actualReceiverType . erasure ( ) ) { if ( lastFieldBinding . canBeSeenBy ( lastReceiverType , this , currentScope ) ) { MethodBinding accessor = this . syntheticReadAccessors == null ? null : this . syntheticReadAccessors [ i ] ; if ( accessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , lastFieldBinding , lastReceiverType , i == <NUM_LIT:0> && this . indexOfFirstFieldBinding == <NUM_LIT:1> ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , lastFieldBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , accessor , null ) ; } } else { codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } codeStream . pop ( ) ; } } } else if ( ! lastFieldBinding . isStatic ( ) ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } lastReceiverType = lastFieldBinding . type ; } if ( ( positionsLength - otherBindingsCount + i - <NUM_LIT:1> ) >= <NUM_LIT:0> ) { int fieldPosition = ( int ) ( this . sourcePositions [ positionsLength - otherBindingsCount + i - <NUM_LIT:1> ] > > > <NUM_LIT:32> ) ; codeStream . recordPositionsFrom ( pc , fieldPosition ) ; } } } lastFieldBinding = nextField ; lastGenericCast = nextGenericCast ; if ( lastFieldBinding != null && ! lastFieldBinding . canBeSeenBy ( lastReceiverType , this , currentScope ) ) { if ( lastFieldBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } } } } return lastFieldBinding ; } public void generateReceiver ( CodeStream codeStream ) { codeStream . aload_0 ( ) ; if ( this . delegateThis != null ) { codeStream . fieldAccess ( Opcodes . OPC_getfield , this . delegateThis , null ) ; } } public TypeBinding getOtherFieldBindings ( BlockScope scope ) { int length = this . tokens . length ; if ( ( this . bits & Binding . FIELD ) != <NUM_LIT:0> ) { if ( ! ( ( FieldBinding ) this . binding ) . isStatic ( ) ) { if ( this . indexOfFirstFieldBinding == <NUM_LIT:1> ) { if ( scope . methodScope ( ) . isStatic ) { scope . problemReporter ( ) . staticFieldAccessToNonStaticVariable ( this , ( FieldBinding ) this . binding ) ; return null ; } } else { scope . problemReporter ( ) . staticFieldAccessToNonStaticVariable ( this , ( FieldBinding ) this . binding ) ; return null ; } } if ( isFieldUseDeprecated ( ( FieldBinding ) this . binding , scope , ( this . bits & IsStrictlyAssigned ) != <NUM_LIT:0> && this . indexOfFirstFieldBinding == length ) ) { scope . problemReporter ( ) . deprecatedField ( ( FieldBinding ) this . binding , this ) ; } } TypeBinding type = ( ( VariableBinding ) this . binding ) . type ; int index = this . indexOfFirstFieldBinding ; if ( index == length ) { this . constant = ( ( FieldBinding ) this . binding ) . constant ( ) ; return type ; } int otherBindingsLength = length - index ; this . otherBindings = new FieldBinding [ otherBindingsLength ] ; this . constant = ( ( VariableBinding ) this . binding ) . constant ( ) ; while ( index < length ) { char [ ] token = this . tokens [ index ] ; if ( type == null ) return null ; FieldBinding field = scope . getField ( type , token , this ) ; int place = index - this . indexOfFirstFieldBinding ; this . otherBindings [ place ] = field ; if ( ! field . isValidBinding ( ) ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; if ( this . delegateThis == null ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { return super . reportError ( scope ) ; } this . actualReceiverType = this . delegateThis . type ; } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , field , index , type ) ; return null ; } } field = localScope . getFieldForCodeSnippet ( this . delegateThis . type , token , this ) ; this . otherBindings [ place ] = field ; } if ( field . isValidBinding ( ) ) { if ( isFieldUseDeprecated ( field , scope , ( this . bits & IsStrictlyAssigned ) != <NUM_LIT:0> && index + <NUM_LIT:1> == length ) ) { scope . problemReporter ( ) . deprecatedField ( field , this ) ; } if ( this . constant != Constant . NotAConstant ) { this . constant = field . constant ( ) ; } type = field . type ; index ++ ; } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , field , index , type ) ; return null ; } } return ( this . otherBindings [ otherBindingsLength - <NUM_LIT:1> ] ) . type ; } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FieldBinding fieldBinding , int index , FlowInfo flowInfo ) { } public TypeBinding reportError ( BlockScope scope ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { return super . reportError ( scope ) ; } this . actualReceiverType = this . delegateThis . type ; } else { return super . reportError ( scope ) ; } if ( ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotFound ) || ( this . binding instanceof ProblemBinding && ( ( ProblemBinding ) this . binding ) . problemId ( ) == NotFound ) ) { FieldBinding fieldBinding = scope . getField ( this . delegateThis . type , this . tokens [ <NUM_LIT:0> ] , this ) ; if ( ! fieldBinding . isValidBinding ( ) ) { if ( ( ( ProblemFieldBinding ) fieldBinding ) . problemId ( ) == NotVisible ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . binding = localScope . getFieldForCodeSnippet ( this . delegateThis . type , this . tokens [ <NUM_LIT:0> ] , this ) ; if ( this . binding . isValidBinding ( ) ) { return checkFieldAccess ( scope ) ; } else { return super . reportError ( scope ) ; } } else { return super . reportError ( scope ) ; } } this . binding = fieldBinding ; return checkFieldAccess ( scope ) ; } TypeBinding result ; if ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotVisible ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; if ( ( this . binding = localScope . getBinding ( this . tokens , this . bits & RestrictiveFlagMASK , this , ( ReferenceBinding ) this . delegateThis . type ) ) . isValidBinding ( ) ) { this . bits &= ~ RestrictiveFlagMASK ; this . bits |= Binding . FIELD ; result = getOtherFieldBindings ( scope ) ; } else { return super . reportError ( scope ) ; } if ( result != null && result . isValidBinding ( ) ) { return result ; } } return super . reportError ( scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortType ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CodeSnippetTypeDeclaration extends TypeDeclaration { public CodeSnippetTypeDeclaration ( CompilationResult compilationResult ) { super ( compilationResult ) ; } public void generateCode ( ClassFile enclosingClassFile ) { if ( ( this . bits & ASTNode . HasBeenGenerated ) != <NUM_LIT:0> ) return ; this . bits |= ASTNode . HasBeenGenerated ; if ( this . ignoreFurtherInvestigation ) { if ( this . binding == null ) return ; CodeSnippetClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; return ; } try { ClassFile classFile = new CodeSnippetClassFile ( this . binding , enclosingClassFile , false ) ; classFile . addFieldInfos ( ) ; if ( this . binding . isMemberType ( ) ) { classFile . recordInnerClasses ( this . binding ) ; } else if ( this . binding . isLocalType ( ) ) { enclosingClassFile . recordInnerClasses ( this . binding ) ; classFile . recordInnerClasses ( this . binding ) ; } TypeVariableBinding [ ] typeVariables = this . binding . typeVariables ( ) ; for ( int i = <NUM_LIT:0> , max = typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariables [ i ] ; if ( ( typeVariableBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , typeVariableBinding ) ; } } if ( this . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = this . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = this . memberTypes [ i ] ; classFile . recordInnerClasses ( memberType . binding ) ; memberType . generateCode ( this . scope , classFile ) ; } } classFile . setForMethodInfos ( ) ; if ( this . methods != null ) { for ( int i = <NUM_LIT:0> , max = this . methods . length ; i < max ; i ++ ) { this . methods [ i ] . generateCode ( this . scope , classFile ) ; } } classFile . addSpecialMethods ( ) ; if ( this . ignoreFurtherInvestigation ) { throw new AbortType ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } classFile . addAttributes ( ) ; this . scope . referenceCompilationUnit ( ) . compilationResult . record ( this . binding . constantPoolName ( ) , classFile ) ; } catch ( AbortType e ) { if ( this . binding == null ) return ; CodeSnippetClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; } } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; public class CodeSnippetEnvironment implements INameEnvironment , EvaluationConstants { INameEnvironment env ; EvaluationContext context ; public CodeSnippetEnvironment ( INameEnvironment env , EvaluationContext context ) { this . env = env ; this . context = context ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) { NameEnvironmentAnswer result = this . env . findType ( compoundTypeName ) ; if ( result != null ) { return result ; } if ( CharOperation . equals ( compoundTypeName , ROOT_COMPOUND_NAME ) ) { IBinaryType binary = this . context . getRootCodeSnippetBinary ( ) ; if ( binary == null ) { return null ; } else { return new NameEnvironmentAnswer ( binary , null ) ; } } VariablesInfo installedVars = this . context . installedVars ; ClassFile [ ] classFiles = installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; if ( CharOperation . equals ( compoundTypeName , classFile . getCompoundName ( ) ) ) { ClassFileReader binary = null ; try { binary = new ClassFileReader ( classFile . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; return null ; } return new NameEnvironmentAnswer ( binary , null ) ; } } return null ; } public NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) { NameEnvironmentAnswer result = this . env . findType ( typeName , packageName ) ; if ( result != null ) { return result ; } return findType ( CharOperation . arrayConcat ( packageName , typeName ) ) ; } public boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] packageName ) { return this . env . isPackage ( parentPackageName , packageName ) ; } public void cleanup ( ) { this . env . cleanup ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; public class InstallException extends Exception { private static final long serialVersionUID = - <NUM_LIT> ; public InstallException ( ) { super ( ) ; } public InstallException ( String s ) { super ( s ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . AllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; public class CodeSnippetAllocationExpression extends AllocationExpression implements ProblemReasons , EvaluationConstants { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetAllocationExpression ( EvaluationContext evaluationContext ) { this . evaluationContext = evaluationContext ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding allocatedType = codegenBinding . declaringClass ; if ( codegenBinding . canBeSeenBy ( allocatedType , this , currentScope ) ) { codeStream . new_ ( allocatedType ) ; if ( valueRequired ) { codeStream . dup ( ) ; } codeStream . recordPositionsFrom ( pc , this . type . sourceStart ) ; if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticEnclosingInstanceValues ( currentScope , allocatedType , enclosingInstance ( ) , this ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { this . arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; } } if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticOuterArgumentValues ( currentScope , allocatedType , this ) ; } codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , null ) ; } else { codeStream . generateEmulationForConstructor ( currentScope , codegenBinding ) ; if ( this . arguments != null ) { int argsLength = this . arguments . length ; codeStream . generateInlinedValue ( argsLength ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; codeStream . dup ( ) ; for ( int i = <NUM_LIT:0> ; i < argsLength ; i ++ ) { codeStream . generateInlinedValue ( i ) ; this . arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; TypeBinding parameterBinding = codegenBinding . parameters [ i ] ; if ( parameterBinding . isBaseType ( ) && parameterBinding != TypeBinding . NULL ) { codeStream . generateBoxingConversion ( codegenBinding . parameters [ i ] . id ) ; } codeStream . aastore ( ) ; if ( i < argsLength - <NUM_LIT:1> ) { codeStream . dup ( ) ; } } } else { codeStream . generateInlinedValue ( <NUM_LIT:0> ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; } codeStream . invokeJavaLangReflectConstructorNewInstance ( ) ; codeStream . checkcast ( allocatedType ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; this . resolvedType = this . type . resolveType ( scope , true ) ; checkParameterizedAllocation : { if ( this . type instanceof ParameterizedQualifiedTypeReference ) { ReferenceBinding currentType = ( ReferenceBinding ) this . resolvedType ; if ( currentType == null ) return currentType ; do { if ( ( currentType . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ) break checkParameterizedAllocation ; if ( currentType . isRawType ( ) ) break checkParameterizedAllocation ; } while ( ( currentType = currentType . enclosingType ( ) ) != null ) ; ParameterizedQualifiedTypeReference qRef = ( ParameterizedQualifiedTypeReference ) this . type ; for ( int i = qRef . typeArguments . length - <NUM_LIT:2> ; i >= <NUM_LIT:0> ; i -- ) { if ( qRef . typeArguments [ i ] != null ) { scope . problemReporter ( ) . illegalQualifiedParameterizedTypeAllocation ( this . type , this . resolvedType ) ; break ; } } } } if ( this . typeArguments != null ) { int length = this . typeArguments . length ; boolean argHasError = scope . compilerOptions ( ) . sourceLevel < ClassFileConstants . JDK1_5 ; this . genericTypeArguments = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeReference typeReference = this . typeArguments [ i ] ; if ( ( this . genericTypeArguments [ i ] = typeReference . resolveType ( scope , true ) ) == null ) { argHasError = true ; } if ( argHasError && typeReference instanceof Wildcard ) { scope . problemReporter ( ) . illegalUsageOfWildcard ( typeReference ) ; } } if ( argHasError ) { if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { this . arguments [ i ] . resolveType ( scope ) ; } } return null ; } } boolean argsContainCast = false ; TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; if ( this . arguments != null ) { boolean argHasError = false ; int length = this . arguments . length ; argumentTypes = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression argument = this . arguments [ i ] ; if ( argument instanceof CastExpression ) { argument . bits |= DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = argument . resolveType ( scope ) ) == null ) { argHasError = true ; } } if ( argHasError ) { return this . resolvedType ; } } if ( this . resolvedType == null ) { return null ; } if ( ! this . resolvedType . canBeInstantiated ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , this . resolvedType ) ; return this . resolvedType ; } ReferenceBinding allocatedType = ( ReferenceBinding ) this . resolvedType ; if ( ! ( this . binding = scope . getConstructor ( allocatedType , argumentTypes , this ) ) . isValidBinding ( ) ) { if ( this . binding instanceof ProblemMethodBinding && ( ( ProblemMethodBinding ) this . binding ) . problemId ( ) == NotVisible ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; MethodBinding privateBinding = localScope . getConstructor ( ( ReferenceBinding ) this . delegateThis . type , argumentTypes , this ) ; if ( ! privateBinding . isValidBinding ( ) ) { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } else { this . binding = privateBinding ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) { scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> ; i < this . arguments . length ; i ++ ) { TypeBinding parameterType = this . binding . parameters [ i ] ; TypeBinding argumentType = argumentTypes [ i ] ; this . arguments [ i ] . computeConversion ( scope , parameterType , argumentType ) ; if ( argumentType . needsUncheckedConversion ( parameterType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( this . arguments [ i ] , argumentType , parameterType ) ; } } if ( argsContainCast ) { CastExpression . checkNeedForArgumentCasts ( scope , null , allocatedType , this . binding , this . arguments , argumentTypes , this ) ; } } if ( allocatedType . isRawType ( ) && this . binding . hasSubstitutedParameters ( ) ) { scope . problemReporter ( ) . unsafeRawInvocation ( this , this . binding ) ; } if ( this . typeArguments != null && this . binding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( this . binding , this . genericTypeArguments , this . typeArguments ) ; } return allocatedType ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . NameReference ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; public class CodeSnippetMessageSend extends MessageSend { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetMessageSend ( EvaluationContext evaluationContext ) { this . evaluationContext = evaluationContext ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { boolean isStatic = codegenBinding . isStatic ( ) ; if ( ! isStatic && ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] path = currentScope . getEmulationPath ( targetType , true , false ) ; if ( path == null ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { codeStream . generateOuterAccess ( path , this , targetType , currentScope ) ; } } else { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ( this . bits & NeedReceiverGenericCast ) != <NUM_LIT:0> ) { codeStream . checkcast ( this . actualReceiverType ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } generateArguments ( this . binding , this . arguments , currentScope , codeStream ) ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; if ( isStatic ) { codeStream . invoke ( Opcodes . OPC_invokestatic , codegenBinding , constantPoolDeclaringClass ) ; } else if ( ( this . receiver . isSuper ( ) ) || codegenBinding . isPrivate ( ) ) { codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , constantPoolDeclaringClass ) ; } else { if ( constantPoolDeclaringClass . isInterface ( ) ) { codeStream . invoke ( Opcodes . OPC_invokeinterface , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokevirtual , codegenBinding , constantPoolDeclaringClass ) ; } } } else { codeStream . generateEmulationForMethod ( currentScope , codegenBinding ) ; boolean isStatic = codegenBinding . isStatic ( ) ; if ( ! isStatic && ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ( this . bits & NeedReceiverGenericCast ) != <NUM_LIT:0> ) { codeStream . checkcast ( this . actualReceiverType ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } if ( isStatic ) { codeStream . aconst_null ( ) ; } if ( this . arguments != null ) { int argsLength = this . arguments . length ; codeStream . generateInlinedValue ( argsLength ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; codeStream . dup ( ) ; for ( int i = <NUM_LIT:0> ; i < argsLength ; i ++ ) { codeStream . generateInlinedValue ( i ) ; this . arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; TypeBinding parameterBinding = codegenBinding . parameters [ i ] ; if ( parameterBinding . isBaseType ( ) && parameterBinding != TypeBinding . NULL ) { codeStream . generateBoxingConversion ( codegenBinding . parameters [ i ] . id ) ; } codeStream . aastore ( ) ; if ( i < argsLength - <NUM_LIT:1> ) { codeStream . dup ( ) ; } } } else { codeStream . generateInlinedValue ( <NUM_LIT:0> ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; } codeStream . invokeJavaLangReflectMethodInvoke ( ) ; if ( codegenBinding . returnType . isBaseType ( ) ) { int typeID = codegenBinding . returnType . id ; if ( typeID == T_void ) { codeStream . pop ( ) ; } codeStream . checkcast ( typeID ) ; codeStream . getBaseTypeValue ( typeID ) ; } else { codeStream . checkcast ( codegenBinding . returnType ) ; } } if ( this . valueCast != null ) codeStream . checkcast ( this . valueCast ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( isUnboxing ) codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( isUnboxing ? postConversionType ( currentScope ) . id : codegenBinding . returnType . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; case T_void : break ; default : codeStream . pop ( ) ; } } codeStream . recordPositionsFrom ( pc , ( int ) ( this . nameSourcePosition > > > <NUM_LIT:32> ) ) ; } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { MethodBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding != this . binding ) { if ( codegenBinding . returnType . isTypeVariable ( ) ) { TypeVariableBinding variableReturnType = ( TypeVariableBinding ) codegenBinding . returnType ; if ( variableReturnType . firstBound != this . binding . returnType ) { this . valueCast = this . binding . returnType ; } } } } } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; boolean receiverCast = false , argsContainCast = false ; if ( this . receiver instanceof CastExpression ) { this . receiver . bits |= DisableUnnecessaryCastCheck ; receiverCast = true ; } this . actualReceiverType = this . receiver . resolveType ( scope ) ; if ( receiverCast && this . actualReceiverType != null ) { if ( ( ( CastExpression ) this . receiver ) . expression . resolvedType == this . actualReceiverType ) { scope . problemReporter ( ) . unnecessaryCast ( ( CastExpression ) this . receiver ) ; } } if ( this . typeArguments != null ) { int length = this . typeArguments . length ; boolean argHasError = false ; this . genericTypeArguments = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ( this . genericTypeArguments [ i ] = this . typeArguments [ i ] . resolveType ( scope , true ) ) == null ) { argHasError = true ; } } if ( argHasError ) { return null ; } } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; if ( this . arguments != null ) { boolean argHasError = false ; int length = this . arguments . length ; argumentTypes = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression argument = this . arguments [ i ] ; if ( argument instanceof CastExpression ) { argument . bits |= DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = this . arguments [ i ] . resolveType ( scope ) ) == null ) argHasError = true ; } if ( argHasError ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding = scope . findMethod ( ( ReferenceBinding ) this . actualReceiverType , this . selector , new TypeBinding [ ] { } , this ) ; } return null ; } } if ( this . actualReceiverType == null ) { return null ; } if ( this . actualReceiverType . isBaseType ( ) ) { scope . problemReporter ( ) . errorNoMethodFor ( this , this . actualReceiverType , argumentTypes ) ; return null ; } this . binding = this . receiver . isImplicitThis ( ) ? scope . getImplicitMethod ( this . selector , argumentTypes , this ) : scope . getMethod ( this . actualReceiverType , this . selector , argumentTypes , this ) ; if ( ! this . binding . isValidBinding ( ) ) { if ( this . binding instanceof ProblemMethodBinding && ( ( ProblemMethodBinding ) this . binding ) . problemId ( ) == ProblemReasons . NotVisible ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , EvaluationConstants . DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; MethodBinding privateBinding = this . receiver instanceof CodeSnippetThisReference && ( ( CodeSnippetThisReference ) this . receiver ) . isImplicit ? localScope . getImplicitMethod ( ( ReferenceBinding ) this . delegateThis . type , this . selector , argumentTypes , this ) : localScope . getMethod ( this . delegateThis . type , this . selector , argumentTypes , this ) ; if ( ! privateBinding . isValidBinding ( ) ) { if ( this . binding . declaringClass == null ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding . declaringClass = ( ReferenceBinding ) this . actualReceiverType ; } else { scope . problemReporter ( ) . errorNoMethodFor ( this , this . actualReceiverType , argumentTypes ) ; return null ; } } scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } else { this . binding = privateBinding ; } } else { if ( this . binding . declaringClass == null ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding . declaringClass = ( ReferenceBinding ) this . actualReceiverType ; } else { scope . problemReporter ( ) . errorNoMethodFor ( this , this . actualReceiverType , argumentTypes ) ; return null ; } } scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } } if ( ! this . binding . isStatic ( ) ) { if ( this . receiver instanceof NameReference && ( ( ( NameReference ) this . receiver ) . bits & Binding . TYPE ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . mustUseAStaticMethod ( this , this . binding ) ; } else { TypeBinding oldReceiverType = this . actualReceiverType ; this . actualReceiverType = this . actualReceiverType . getErasureCompatibleType ( this . binding . declaringClass ) ; this . receiver . computeConversion ( scope , this . actualReceiverType , this . actualReceiverType ) ; if ( this . actualReceiverType != oldReceiverType && this . receiver . postConversionType ( scope ) != this . actualReceiverType ) { this . bits |= NeedReceiverGenericCast ; } } } if ( checkInvocationArguments ( scope , this . receiver , this . actualReceiverType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } if ( this . binding . isAbstract ( ) ) { if ( this . receiver . isSuper ( ) ) { scope . problemReporter ( ) . cannotDireclyInvokeAbstractMethod ( this , this . binding ) ; } } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; if ( this . actualReceiverType . isArrayType ( ) && this . binding . parameters == Binding . NO_PARAMETERS && scope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_5 && CharOperation . equals ( this . binding . selector , CLONE ) ) { this . resolvedType = this . actualReceiverType ; } else { TypeBinding returnType = this . binding . returnType ; if ( returnType != null ) { if ( ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) { returnType = scope . environment ( ) . convertToRawType ( returnType . erasure ( ) , true ) ; } returnType = returnType . capture ( scope , this . sourceEnd ) ; } this . resolvedType = returnType ; } return this . resolvedType ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . FieldReference ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class CodeSnippetFieldReference extends FieldReference implements ProblemReasons , EvaluationConstants { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetFieldReference ( char [ ] source , long pos , EvaluationContext evaluationContext ) { super ( source , pos ) ; this . evaluationContext = evaluationContext ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { FieldBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { this . receiver . generateCode ( currentScope , codeStream , ! codegenBinding . isStatic ( ) ) ; assignment . expression . generateCode ( currentScope , codeStream , true ) ; fieldStore ( currentScope , codeStream , codegenBinding , null , this . actualReceiverType , this . receiver . isImplicitThis ( ) , valueRequired ) ; } else { codeStream . generateEmulationForField ( codegenBinding ) ; this . receiver . generateCode ( currentScope , codeStream , ! codegenBinding . isStatic ( ) ) ; if ( codegenBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { switch ( codegenBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( codegenBinding ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } } else { FieldBinding codegenBinding = this . binding . original ( ) ; boolean isStatic = codegenBinding . isStatic ( ) ; this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( valueRequired ) { Constant fieldConstant = codegenBinding . constant ( ) ; if ( fieldConstant == Constant . NotAConstant ) { if ( codegenBinding . declaringClass == null ) { codeStream . arraylength ( ) ; } else { if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; if ( isStatic ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenBinding , constantPoolDeclaringClass ) ; } } else { if ( isStatic ) { codeStream . aconst_null ( ) ; } codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; } } codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } } else { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { boolean isStatic ; FieldBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; if ( isStatic ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . dup ( ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenBinding , constantPoolDeclaringClass ) ; } int operationTypeID ; switch ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_JavaLangString : case T_JavaLangObject : case T_undefined : codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; break ; default : codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } fieldStore ( currentScope , codeStream , codegenBinding , null , this . actualReceiverType , this . receiver . isImplicitThis ( ) , valueRequired ) ; } else { this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; if ( isStatic ) { codeStream . generateEmulationForField ( codegenBinding ) ; codeStream . aconst_null ( ) ; codeStream . aconst_null ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; } else { codeStream . generateEmulationForField ( this . binding ) ; this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; } int operationTypeID ; if ( ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_JavaLangString ) { codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; } else { codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } if ( valueRequired ) { if ( ( codegenBinding . type == TypeBinding . LONG ) || ( codegenBinding . type == TypeBinding . DOUBLE ) ) { codeStream . dup2_x2 ( ) ; } else { codeStream . dup_x2 ( ) ; } } codeStream . generateEmulatedWriteAccessForField ( codegenBinding ) ; } } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { boolean isStatic ; FieldBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; } else { this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; if ( isStatic ) { codeStream . aconst_null ( ) ; } codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; int typeID ; switch ( typeID = codegenBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : if ( valueRequired ) { codeStream . dup2_x1 ( ) ; } codeStream . dup2_x1 ( ) ; codeStream . pop2 ( ) ; break ; default : if ( valueRequired ) { codeStream . dup_x1 ( ) ; } codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; break ; } codeStream . generateEmulationForField ( codegenBinding ) ; codeStream . swap ( ) ; switch ( typeID ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup2_x1 ( ) ; break ; } codeStream . pop2 ( ) ; codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , codegenBinding . type . id ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; codeStream . generateEmulatedWriteAccessForField ( codegenBinding ) ; } } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo , boolean isReadAccess ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ) return ; } public TypeBinding resolveType ( BlockScope scope ) { this . actualReceiverType = this . receiver . resolveType ( scope ) ; if ( this . actualReceiverType == null ) { this . constant = Constant . NotAConstant ; return null ; } this . binding = scope . getField ( this . actualReceiverType , this . token , this ) ; FieldBinding firstAttempt = this . binding ; boolean isNotVisible = false ; if ( ! this . binding . isValidBinding ( ) ) { if ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotVisible ) { isNotVisible = true ; if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; return null ; } this . actualReceiverType = this . delegateThis . type ; } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; return null ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . binding = localScope . getFieldForCodeSnippet ( this . delegateThis . type , this . token , this ) ; } } if ( ! this . binding . isValidBinding ( ) ) { this . constant = Constant . NotAConstant ; if ( isNotVisible ) { this . binding = firstAttempt ; } scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; return null ; } if ( isFieldUseDeprecated ( this . binding , scope , ( this . bits & IsStrictlyAssigned ) != <NUM_LIT:0> ) ) { scope . problemReporter ( ) . deprecatedField ( this . binding , this ) ; } this . constant = this . receiver . isImplicitThis ( ) ? this . binding . constant ( ) : Constant . NotAConstant ; if ( ! this . receiver . isThis ( ) ) { this . constant = Constant . NotAConstant ; } return this . resolvedType = this . binding . type ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; public class GlobalVariable { char [ ] typeName ; char [ ] name ; char [ ] initializer ; int declarationStart = - <NUM_LIT:1> , initializerStart = - <NUM_LIT:1> , initExpressionStart ; int initializerLineStart = - <NUM_LIT:1> ; public GlobalVariable ( char [ ] typeName , char [ ] name , char [ ] initializer ) { this . typeName = typeName ; this . name = name ; this . initializer = initializer ; } public char [ ] getInitializer ( ) { return this . initializer ; } public char [ ] getName ( ) { return this . name ; } public char [ ] getTypeName ( ) { return this . typeName ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( this . typeName ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; buffer . append ( this . name ) ; if ( this . initializer != null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . initializer ) ; } buffer . append ( "<STR_LIT:;>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . Locale ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . CompletionRequestor ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . codeassist . CompletionEngine ; import org . eclipse . jdt . internal . codeassist . ISelectionRequestor ; import org . eclipse . jdt . internal . codeassist . SelectionEngine ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . SearchableEnvironment ; import org . eclipse . jdt . internal . core . util . Util ; public class EvaluationContext implements EvaluationConstants , SuffixConstants { static int VAR_CLASS_COUNTER = <NUM_LIT:0> ; static int CODE_SNIPPET_COUNTER = <NUM_LIT:0> ; GlobalVariable [ ] variables ; int variableCount ; char [ ] [ ] imports ; char [ ] packageName ; boolean varsChanged ; VariablesInfo installedVars ; IBinaryType codeSnippetBinary ; String lineSeparator ; char [ ] declaringTypeName ; int [ ] localVariableModifiers ; char [ ] [ ] localVariableTypeNames ; char [ ] [ ] localVariableNames ; boolean isStatic ; boolean isConstructorCall ; public EvaluationContext ( ) { this . variables = new GlobalVariable [ <NUM_LIT:5> ] ; this . variableCount = <NUM_LIT:0> ; this . imports = CharOperation . NO_CHAR_CHAR ; this . packageName = CharOperation . NO_CHAR ; this . varsChanged = true ; this . isStatic = true ; this . isConstructorCall = false ; this . lineSeparator = org . eclipse . jdt . internal . compiler . util . Util . LINE_SEPARATOR ; } public GlobalVariable [ ] allVariables ( ) { GlobalVariable [ ] result = new GlobalVariable [ this . variableCount ] ; System . arraycopy ( this . variables , <NUM_LIT:0> , result , <NUM_LIT:0> , this . variableCount ) ; return result ; } public void complete ( char [ ] codeSnippet , int completionPosition , SearchableEnvironment environment , CompletionRequestor requestor , Map options , final IJavaProject project , WorkingCopyOwner owner , IProgressMonitor monitor ) { try { IRequestor variableRequestor = new IRequestor ( ) { public boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) { return true ; } public void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) { } } ; evaluateVariables ( environment , options , variableRequestor , new DefaultProblemFactory ( Locale . getDefault ( ) ) ) ; } catch ( InstallException e ) { } final char [ ] className = "<STR_LIT>" . toCharArray ( ) ; final CodeSnippetToCuMapper mapper = new CodeSnippetToCuMapper ( codeSnippet , this . packageName , this . imports , className , this . installedVars == null ? null : this . installedVars . className , this . localVariableNames , this . localVariableTypeNames , this . localVariableModifiers , this . declaringTypeName , this . lineSeparator ) ; ICompilationUnit sourceUnit = new ICompilationUnit ( ) { public char [ ] getFileName ( ) { return CharOperation . concat ( className , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getContents ( ) { return mapper . getCUSource ( EvaluationContext . this . lineSeparator ) ; } public char [ ] getMainTypeName ( ) { return className ; } public char [ ] [ ] getPackageName ( ) { return null ; } } ; CompletionEngine engine = new CompletionEngine ( environment , mapper . getCompletionRequestor ( requestor ) , options , project , owner , monitor ) ; if ( this . installedVars != null ) { IBinaryType binaryType = getRootCodeSnippetBinary ( ) ; if ( binaryType != null ) { engine . lookupEnvironment . cacheBinaryType ( binaryType , null ) ; } ClassFile [ ] classFiles = this . installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; IBinaryType binary = null ; try { binary = new ClassFileReader ( classFile . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; } engine . lookupEnvironment . cacheBinaryType ( binary , null ) ; } } engine . complete ( sourceUnit , mapper . startPosOffset + completionPosition , mapper . startPosOffset , null ) ; } public void deleteVariable ( GlobalVariable variable ) { GlobalVariable [ ] vars = this . variables ; int index = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < this . variableCount ; i ++ ) { if ( vars [ i ] . equals ( variable ) ) { index = i ; break ; } } if ( index == - <NUM_LIT:1> ) { return ; } int elementCount = this . variableCount -- ; int j = elementCount - index - <NUM_LIT:1> ; if ( j > <NUM_LIT:0> ) { System . arraycopy ( vars , index + <NUM_LIT:1> , vars , index , j ) ; } vars [ elementCount - <NUM_LIT:1> ] = null ; this . varsChanged = true ; } private void deployCodeSnippetClassIfNeeded ( IRequestor requestor ) throws InstallException { if ( this . codeSnippetBinary == null ) { if ( ! requestor . acceptClassFiles ( new ClassFile [ ] { new ClassFile ( ) { public byte [ ] getBytes ( ) { return getCodeSnippetBytes ( ) ; } public char [ ] [ ] getCompoundName ( ) { return EvaluationConstants . ROOT_COMPOUND_NAME ; } } } , null ) ) throw new InstallException ( ) ; } } public void evaluate ( char [ ] codeSnippet , char [ ] [ ] contextLocalVariableTypeNames , char [ ] [ ] contextLocalVariableNames , int [ ] contextLocalVariableModifiers , char [ ] contextDeclaringTypeName , boolean contextIsStatic , boolean contextIsConstructorCall , INameEnvironment environment , Map options , final IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { this . localVariableTypeNames = contextLocalVariableTypeNames ; this . localVariableNames = contextLocalVariableNames ; this . localVariableModifiers = contextLocalVariableModifiers ; this . declaringTypeName = contextDeclaringTypeName ; this . isStatic = contextIsStatic ; this . isConstructorCall = contextIsConstructorCall ; deployCodeSnippetClassIfNeeded ( requestor ) ; try { class ForwardingRequestor implements IRequestor { boolean hasErrors = false ; public boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) { return requestor . acceptClassFiles ( classFiles , codeSnippetClassName ) ; } public void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) { requestor . acceptProblem ( problem , fragmentSource , fragmentKind ) ; if ( problem . isError ( ) ) { this . hasErrors = true ; } } } ForwardingRequestor forwardingRequestor = new ForwardingRequestor ( ) ; if ( this . varsChanged ) { evaluateVariables ( environment , options , forwardingRequestor , problemFactory ) ; } if ( ! forwardingRequestor . hasErrors ) { Evaluator evaluator = new CodeSnippetEvaluator ( codeSnippet , this , environment , options , requestor , problemFactory ) ; ClassFile [ ] classes = evaluator . getClasses ( ) ; if ( classes != null && classes . length > <NUM_LIT:0> ) { char [ ] simpleClassName = evaluator . getClassName ( ) ; char [ ] pkgName = getPackageName ( ) ; char [ ] qualifiedClassName = pkgName . length == <NUM_LIT:0> ? simpleClassName : CharOperation . concat ( pkgName , simpleClassName , '<CHAR_LIT:.>' ) ; CODE_SNIPPET_COUNTER ++ ; if ( ! requestor . acceptClassFiles ( classes , qualifiedClassName ) ) throw new InstallException ( ) ; } } } finally { this . localVariableTypeNames = null ; this . localVariableNames = null ; this . localVariableModifiers = null ; this . declaringTypeName = null ; this . isStatic = true ; this . isConstructorCall = false ; } } public void evaluate ( char [ ] codeSnippet , INameEnvironment environment , Map options , final IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { this . evaluate ( codeSnippet , null , null , null , null , true , false , environment , options , requestor , problemFactory ) ; } public void evaluateImports ( INameEnvironment environment , IRequestor requestor , IProblemFactory problemFactory ) { for ( int i = <NUM_LIT:0> ; i < this . imports . length ; i ++ ) { CategorizedProblem [ ] problems = new CategorizedProblem [ ] { null } ; char [ ] importDeclaration = this . imports [ i ] ; char [ ] [ ] splitDeclaration = CharOperation . splitOn ( '<CHAR_LIT:.>' , importDeclaration ) ; int splitLength = splitDeclaration . length ; if ( splitLength > <NUM_LIT:0> ) { char [ ] pkgName = splitDeclaration [ splitLength - <NUM_LIT:1> ] ; if ( pkgName . length == <NUM_LIT:1> && pkgName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { char [ ] [ ] parentName ; switch ( splitLength ) { case <NUM_LIT:1> : parentName = null ; break ; case <NUM_LIT:2> : parentName = null ; pkgName = splitDeclaration [ splitLength - <NUM_LIT:2> ] ; break ; default : parentName = CharOperation . subarray ( splitDeclaration , <NUM_LIT:0> , splitLength - <NUM_LIT:2> ) ; pkgName = splitDeclaration [ splitLength - <NUM_LIT:2> ] ; } if ( ! environment . isPackage ( parentName , pkgName ) ) { String [ ] arguments = new String [ ] { new String ( importDeclaration ) } ; problems [ <NUM_LIT:0> ] = problemFactory . createProblem ( importDeclaration , IProblem . ImportNotFound , arguments , arguments , ProblemSeverities . Warning , <NUM_LIT:0> , importDeclaration . length - <NUM_LIT:1> , i , <NUM_LIT:0> ) ; } } else { if ( environment . findType ( splitDeclaration ) == null ) { String [ ] arguments = new String [ ] { new String ( importDeclaration ) } ; problems [ <NUM_LIT:0> ] = problemFactory . createProblem ( importDeclaration , IProblem . ImportNotFound , arguments , arguments , ProblemSeverities . Warning , <NUM_LIT:0> , importDeclaration . length - <NUM_LIT:1> , i , <NUM_LIT:0> ) ; } } } else { String [ ] arguments = new String [ ] { new String ( importDeclaration ) } ; problems [ <NUM_LIT:0> ] = problemFactory . createProblem ( importDeclaration , IProblem . ImportNotFound , arguments , arguments , ProblemSeverities . Warning , <NUM_LIT:0> , importDeclaration . length - <NUM_LIT:1> , i , <NUM_LIT:0> ) ; } if ( problems [ <NUM_LIT:0> ] != null ) { requestor . acceptProblem ( problems [ <NUM_LIT:0> ] , importDeclaration , EvaluationResult . T_IMPORT ) ; } } } public void evaluateVariable ( GlobalVariable variable , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { this . evaluate ( variable . getName ( ) , environment , options , requestor , problemFactory ) ; } public void evaluateVariables ( INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { deployCodeSnippetClassIfNeeded ( requestor ) ; VariablesEvaluator evaluator = new VariablesEvaluator ( this , environment , options , requestor , problemFactory ) ; ClassFile [ ] classes = evaluator . getClasses ( ) ; if ( classes != null ) { if ( classes . length > <NUM_LIT:0> ) { Util . sort ( classes , new Util . Comparer ( ) { public int compare ( Object a , Object b ) { if ( a == b ) return <NUM_LIT:0> ; ClassFile enclosing = ( ( ClassFile ) a ) . enclosingClassFile ; while ( enclosing != null ) { if ( enclosing == b ) return <NUM_LIT:1> ; enclosing = enclosing . enclosingClassFile ; } return - <NUM_LIT:1> ; } } ) ; if ( ! requestor . acceptClassFiles ( classes , null ) ) { throw new InstallException ( ) ; } int count = this . variableCount ; GlobalVariable [ ] variablesCopy = new GlobalVariable [ count ] ; System . arraycopy ( this . variables , <NUM_LIT:0> , variablesCopy , <NUM_LIT:0> , count ) ; this . installedVars = new VariablesInfo ( evaluator . getPackageName ( ) , evaluator . getClassName ( ) , classes , variablesCopy , count ) ; VAR_CLASS_COUNTER ++ ; } this . varsChanged = false ; } } byte [ ] getCodeSnippetBytes ( ) { return new byte [ ] { - <NUM_LIT> , - <NUM_LIT:2> , - <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:7> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT:0> , <NUM_LIT:12> , <NUM_LIT:10> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:20> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:8> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:8> , <NUM_LIT:0> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT:0> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:15> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:20> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:24> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:24> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:24> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:30> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:30> , <NUM_LIT:0> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:31> , <NUM_LIT:0> , <NUM_LIT:32> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:24> , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT> } ; } public static String getCodeSnippetSource ( ) { return "<STR_LIT>" + "<STR_LIT:n>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ; } public char [ ] [ ] getImports ( ) { return this . imports ; } public char [ ] getPackageName ( ) { return this . packageName ; } IBinaryType getRootCodeSnippetBinary ( ) { if ( this . codeSnippetBinary == null ) { this . codeSnippetBinary = new CodeSnippetSkeleton ( ) ; } return this . codeSnippetBinary ; } public char [ ] getVarClassName ( ) { if ( this . installedVars == null ) return CharOperation . NO_CHAR ; return CharOperation . concat ( this . installedVars . packageName , this . installedVars . className , '<CHAR_LIT:.>' ) ; } public GlobalVariable newVariable ( char [ ] typeName , char [ ] name , char [ ] initializer ) { GlobalVariable var = new GlobalVariable ( typeName , name , initializer ) ; if ( this . variableCount >= this . variables . length ) System . arraycopy ( this . variables , <NUM_LIT:0> , this . variables = new GlobalVariable [ this . variableCount * <NUM_LIT:2> ] , <NUM_LIT:0> , this . variableCount ) ; this . variables [ this . variableCount ++ ] = var ; this . varsChanged = true ; return var ; } public void select ( char [ ] codeSnippet , int selectionSourceStart , int selectionSourceEnd , SearchableEnvironment environment , ISelectionRequestor requestor , Map options , WorkingCopyOwner owner ) { final char [ ] className = "<STR_LIT>" . toCharArray ( ) ; final CodeSnippetToCuMapper mapper = new CodeSnippetToCuMapper ( codeSnippet , this . packageName , this . imports , className , this . installedVars == null ? null : this . installedVars . className , this . localVariableNames , this . localVariableTypeNames , this . localVariableModifiers , this . declaringTypeName , this . lineSeparator ) ; ICompilationUnit sourceUnit = new ICompilationUnit ( ) { public char [ ] getFileName ( ) { return CharOperation . concat ( className , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getContents ( ) { return mapper . getCUSource ( EvaluationContext . this . lineSeparator ) ; } public char [ ] getMainTypeName ( ) { return className ; } public char [ ] [ ] getPackageName ( ) { return null ; } } ; SelectionEngine engine = new SelectionEngine ( environment , mapper . getSelectionRequestor ( requestor ) , options , owner ) ; engine . select ( sourceUnit , mapper . startPosOffset + selectionSourceStart , mapper . startPosOffset + selectionSourceEnd ) ; } public void setImports ( char [ ] [ ] imports ) { this . imports = imports ; this . varsChanged = true ; } public void setLineSeparator ( String lineSeparator ) { this . lineSeparator = lineSeparator ; } public void setPackageName ( char [ ] packageName ) { this . packageName = packageName ; this . varsChanged = true ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . BinaryExpression ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; public class CodeSnippetSingleNameReference extends SingleNameReference implements EvaluationConstants , ProblemReasons { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetSingleNameReference ( char [ ] source , long pos , EvaluationContext evaluationContext ) { super ( source , pos ) ; this . evaluationContext = evaluationContext ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , boolean valueRequired ) { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding fieldBinding ; if ( ( fieldBinding = ( FieldBinding ) this . binding ) . isBlankFinal ( ) && currentScope . needBlankFinalFieldInitializationCheck ( fieldBinding ) ) { FlowInfo fieldInits = flowContext . getInitsForFinalBlankInitializationCheck ( fieldBinding . declaringClass . original ( ) , flowInfo ) ; if ( ! fieldInits . isDefinitelyAssigned ( fieldBinding ) ) { currentScope . problemReporter ( ) . uninitializedBlankFinalField ( fieldBinding , this ) ; } } break ; case Binding . LOCAL : LocalVariableBinding localBinding ; if ( ! flowInfo . isDefinitelyAssigned ( localBinding = ( LocalVariableBinding ) this . binding ) ) { currentScope . problemReporter ( ) . uninitializedLocalVariable ( localBinding , this ) ; } if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { localBinding . useFlag = LocalVariableBinding . USED ; } else if ( localBinding . useFlag == LocalVariableBinding . UNUSED ) { localBinding . useFlag = LocalVariableBinding . FAKE_USED ; } } return flowInfo ; } public TypeBinding checkFieldAccess ( BlockScope scope ) { if ( this . delegateThis == null ) { return super . checkFieldAccess ( scope ) ; } FieldBinding fieldBinding = ( FieldBinding ) this . binding ; this . bits &= ~ RestrictiveFlagMASK ; this . bits |= Binding . FIELD ; if ( ! fieldBinding . isStatic ( ) ) { if ( this . evaluationContext . isStatic ) { scope . problemReporter ( ) . staticFieldAccessToNonStaticVariable ( this , fieldBinding ) ; this . constant = Constant . NotAConstant ; return null ; } } this . constant = fieldBinding . constant ( ) ; if ( isFieldUseDeprecated ( fieldBinding , scope , ( this . bits & IsStrictlyAssigned ) != <NUM_LIT:0> ) ) { scope . problemReporter ( ) . deprecatedField ( fieldBinding , this ) ; } return fieldBinding . type ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { if ( assignment . expression . isCompactableOperation ( ) ) { BinaryExpression operation = ( BinaryExpression ) assignment . expression ; int operator = ( operation . bits & OperatorMASK ) > > OperatorSHIFT ; SingleNameReference variableReference ; if ( ( operation . left instanceof SingleNameReference ) && ( ( variableReference = ( SingleNameReference ) operation . left ) . binding == this . binding ) ) { variableReference . generateCompoundAssignment ( currentScope , codeStream , this . syntheticAccessors == null ? null : this . syntheticAccessors [ WRITE ] , operation . right , operator , operation . implicitConversion , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } return ; } if ( ( operation . right instanceof SingleNameReference ) && ( ( operator == PLUS ) || ( operator == MULTIPLY ) ) && ( ( variableReference = ( SingleNameReference ) operation . right ) . binding == this . binding ) && ( operation . left . constant != Constant . NotAConstant ) && ( ( ( operation . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) != T_JavaLangString ) && ( ( ( operation . right . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) != T_JavaLangString ) ) { variableReference . generateCompoundAssignment ( currentScope , codeStream , this . syntheticAccessors == null ? null : this . syntheticAccessors [ WRITE ] , operation . left , operator , operation . implicitConversion , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } return ; } } switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { if ( ! codegenField . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } } assignment . expression . generateCode ( currentScope , codeStream , true ) ; fieldStore ( currentScope , codeStream , codegenField , null , this . actualReceiverType , this . delegateThis == null , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } else { codeStream . generateEmulationForField ( codegenField ) ; if ( ! codegenField . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } else { codeStream . aconst_null ( ) ; } assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { if ( ( codegenField . type == TypeBinding . LONG ) || ( codegenField . type == TypeBinding . DOUBLE ) ) { codeStream . dup2_x2 ( ) ; } else { codeStream . dup_x2 ( ) ; } } codeStream . generateEmulatedWriteAccessForField ( codegenField ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } return ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; if ( localBinding . resolvedPosition != - <NUM_LIT:1> ) { assignment . expression . generateCode ( currentScope , codeStream , true ) ; } else { if ( assignment . expression . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( assignment . expression . constant , assignment . implicitConversion ) ; } } else { assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } else { if ( ( localBinding . type == TypeBinding . LONG ) || ( localBinding . type == TypeBinding . DOUBLE ) ) { codeStream . pop2 ( ) ; } else { codeStream . pop ( ) ; } } } return ; } codeStream . store ( localBinding , valueRequired ) ; if ( ( this . bits & FirstAssignmentToLocal ) != <NUM_LIT:0> ) { localBinding . recordInitializationStartPC ( codeStream . position ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } } else { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : if ( ! valueRequired ) break ; FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; Constant fieldConstant = codegenField . constant ( ) ; if ( fieldConstant == Constant . NotAConstant ) { if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { TypeBinding someReceiverType = this . delegateThis != null ? this . delegateThis . type : this . actualReceiverType ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenField , someReceiverType , true ) ; if ( codegenField . isStatic ( ) ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenField , constantPoolDeclaringClass ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenField , constantPoolDeclaringClass ) ; } } else { if ( ! codegenField . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } else { codeStream . aconst_null ( ) ; } codeStream . generateEmulatedReadAccessForField ( codegenField ) ; } if ( this . genericCast != null ) codeStream . checkcast ( this . genericCast ) ; codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } break ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; if ( ! valueRequired ) break ; if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { VariableBinding [ ] path = currentScope . getEmulationPath ( localBinding ) ; codeStream . generateOuterAccess ( path , this , localBinding , currentScope ) ; } else { codeStream . load ( localBinding ) ; } codeStream . generateImplicitConversion ( this . implicitConversion ) ; break ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , MethodBinding writeAccessor , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . isStatic ( ) ) { if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { TypeBinding someReceiverType = this . delegateThis != null ? this . delegateThis . type : this . actualReceiverType ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenField , someReceiverType , true ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenField , constantPoolDeclaringClass ) ; } else { codeStream . generateEmulationForField ( codegenField ) ; codeStream . aconst_null ( ) ; codeStream . aconst_null ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenField ) ; } } else { if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } codeStream . dup ( ) ; TypeBinding someReceiverType = this . delegateThis != null ? this . delegateThis . type : this . actualReceiverType ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenField , someReceiverType , true ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenField , constantPoolDeclaringClass ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } codeStream . generateEmulationForField ( codegenField ) ; generateReceiver ( codeStream ) ; codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenField ) ; } } break ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; switch ( localBinding . type . id ) { case T_JavaLangString : codeStream . generateStringConcatenationAppend ( currentScope , this , expression ) ; if ( valueRequired ) { codeStream . dup ( ) ; } codeStream . store ( localBinding , false ) ; return ; case T_int : Constant assignConstant ; if ( ( ( assignConstant = expression . constant ) != Constant . NotAConstant ) && ( assignConstant . typeID ( ) != TypeIds . T_float ) && ( assignConstant . typeID ( ) != TypeIds . T_double ) ) { switch ( operator ) { case PLUS : int increment = assignConstant . intValue ( ) ; if ( increment != ( short ) increment ) break ; codeStream . iinc ( localBinding . resolvedPosition , increment ) ; if ( valueRequired ) { codeStream . load ( localBinding ) ; } return ; case MINUS : increment = - assignConstant . intValue ( ) ; if ( increment != ( short ) increment ) break ; codeStream . iinc ( localBinding . resolvedPosition , increment ) ; if ( valueRequired ) { codeStream . load ( localBinding ) ; } return ; } } default : codeStream . load ( localBinding ) ; } } int operationTypeID ; switch ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_JavaLangString : case T_JavaLangObject : case T_undefined : codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; break ; default : codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { fieldStore ( currentScope , codeStream , codegenField , writeAccessor , this . actualReceiverType , this . delegateThis == null , valueRequired ) ; } else { if ( valueRequired ) { switch ( codegenField . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( codegenField ) ; } return ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; if ( valueRequired ) { switch ( localBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } codeStream . store ( localBinding , false ) ; } } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; } else { if ( codegenField . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } codeStream . generateEmulatedReadAccessForField ( codegenField ) ; if ( valueRequired ) { switch ( codegenField . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } codeStream . generateEmulationForField ( codegenField ) ; switch ( codegenField . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; if ( codegenField . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReceiver ( codeStream ) ; } codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; break ; default : codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; if ( codegenField . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReceiver ( codeStream ) ; } codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; break ; } codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , codegenField . type . id ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; codeStream . generateEmulatedWriteAccessForField ( codegenField ) ; } return ; case Binding . LOCAL : super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; } } public void generateReceiver ( CodeStream codeStream ) { codeStream . aload_0 ( ) ; if ( this . delegateThis != null ) { codeStream . fieldAccess ( Opcodes . OPC_getfield , this . delegateThis , null ) ; } } public TypeBinding getReceiverType ( BlockScope currentScope ) { Scope scope = currentScope . parent ; while ( true ) { switch ( scope . kind ) { case Scope . CLASS_SCOPE : return ( ( ClassScope ) scope ) . referenceContext . binding ; default : scope = scope . parent ; } } } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo , boolean isReadAccess ) { if ( this . delegateThis == null ) { super . manageSyntheticAccessIfNecessary ( currentScope , flowInfo , isReadAccess ) ; return ; } if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ) return ; if ( this . constant != Constant . NotAConstant ) return ; if ( this . binding instanceof ParameterizedFieldBinding ) { ParameterizedFieldBinding parameterizedField = ( ParameterizedFieldBinding ) this . binding ; FieldBinding codegenField = parameterizedField . originalField ; if ( ( codegenField . type . tagBits & TagBits . HasTypeVariable ) != <NUM_LIT:0> ) { this . genericCast = codegenField . type . genericCast ( currentScope . boxing ( parameterizedField . type ) ) ; } } } public TypeBinding reportError ( BlockScope scope ) { this . constant = Constant . NotAConstant ; if ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotFound ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis != null ) { this . actualReceiverType = this . delegateThis . type ; this . binding = scope . getField ( this . delegateThis . type , this . token , this ) ; if ( ! this . binding . isValidBinding ( ) ) { return super . reportError ( scope ) ; } return checkFieldAccess ( scope ) ; } } } if ( this . binding instanceof ProblemBinding && ( ( ProblemBinding ) this . binding ) . problemId ( ) == NotFound ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis != null ) { this . actualReceiverType = this . delegateThis . type ; FieldBinding fieldBinding = scope . getField ( this . delegateThis . type , this . token , this ) ; if ( ! fieldBinding . isValidBinding ( ) ) { if ( ( ( ProblemFieldBinding ) fieldBinding ) . problemId ( ) == NotVisible ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . binding = localScope . getFieldForCodeSnippet ( this . delegateThis . type , this . token , this ) ; return checkFieldAccess ( scope ) ; } else { return super . reportError ( scope ) ; } } this . binding = fieldBinding ; return checkFieldAccess ( scope ) ; } } } return super . reportError ( scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrameCodeStream ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CodeSnippetClassFile extends ClassFile { public CodeSnippetClassFile ( org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding aType , org . eclipse . jdt . internal . compiler . ClassFile enclosingClassFile , boolean creatingProblemType ) { this . referenceBinding = aType ; initByteArrays ( ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:24> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:16> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:8> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:0> ) ; long targetVersion = this . targetJDK = this . referenceBinding . scope . compilerOptions ( ) . targetJDK ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:8> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:0> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:24> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:16> ) ; this . constantPoolOffset = this . headerOffset ; this . headerOffset += <NUM_LIT:2> ; this . constantPool = new ConstantPool ( this ) ; int accessFlags = aType . getAccessFlags ( ) ; if ( ! aType . isInterface ( ) ) { accessFlags |= ClassFileConstants . AccSuper ; } if ( aType . isNestedType ( ) ) { if ( aType . isStatic ( ) ) { accessFlags &= ~ ClassFileConstants . AccStatic ; } if ( aType . isPrivate ( ) ) { accessFlags &= ~ ( ClassFileConstants . AccPrivate | ClassFileConstants . AccPublic ) ; } if ( aType . isProtected ( ) ) { accessFlags &= ~ ClassFileConstants . AccProtected ; accessFlags |= ClassFileConstants . AccPublic ; } } accessFlags &= ~ ClassFileConstants . AccStrictfp ; this . enclosingClassFile = enclosingClassFile ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( accessFlags > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) accessFlags ; int classNameIndex = this . constantPool . literalIndexForType ( aType ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( classNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) classNameIndex ; int superclassNameIndex ; if ( aType . isInterface ( ) ) { superclassNameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangObjectConstantPoolName ) ; } else { superclassNameIndex = ( aType . superclass == null ? <NUM_LIT:0> : this . constantPool . literalIndexForType ( aType . superclass ) ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( superclassNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) superclassNameIndex ; ReferenceBinding [ ] superInterfacesBinding = aType . superInterfaces ( ) ; int interfacesCount = superInterfacesBinding . length ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( interfacesCount > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) interfacesCount ; for ( int i = <NUM_LIT:0> ; i < interfacesCount ; i ++ ) { int interfaceIndex = this . constantPool . literalIndexForType ( superInterfacesBinding [ i ] ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( interfaceIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) interfaceIndex ; } this . produceAttributes = this . referenceBinding . scope . compilerOptions ( ) . produceDebugAttributes ; this . creatingProblemType = creatingProblemType ; if ( this . targetJDK >= ClassFileConstants . JDK1_6 ) { this . codeStream = new StackMapFrameCodeStream ( this ) ; this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP_TABLE ; } else if ( this . targetJDK == ClassFileConstants . CLDC_1_1 ) { this . targetJDK = ClassFileConstants . JDK1_1 ; this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP ; this . codeStream = new StackMapFrameCodeStream ( this ) ; } else { this . codeStream = new CodeStream ( this ) ; } this . codeStream . maxFieldCount = aType . scope . outerMostClassScope ( ) . referenceType ( ) . maxFieldCount ; } public static void createProblemType ( TypeDeclaration typeDeclaration , CompilationResult unitResult ) { SourceTypeBinding typeBinding = typeDeclaration . binding ; ClassFile classFile = new CodeSnippetClassFile ( typeBinding , null , true ) ; if ( typeBinding . hasMemberTypes ( ) ) { ReferenceBinding [ ] members = typeBinding . memberTypes ; for ( int i = <NUM_LIT:0> , l = members . length ; i < l ; i ++ ) classFile . recordInnerClasses ( members [ i ] ) ; } if ( typeBinding . isNestedType ( ) ) { classFile . recordInnerClasses ( typeBinding ) ; } TypeVariableBinding [ ] typeVariables = typeBinding . typeVariables ( ) ; for ( int i = <NUM_LIT:0> , max = typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariables [ i ] ; if ( ( typeVariableBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , typeVariableBinding ) ; } } FieldBinding [ ] fields = typeBinding . fields ( ) ; if ( ( fields != null ) && ( fields != Binding . NO_FIELDS ) ) { classFile . addFieldInfos ( ) ; } else { classFile . contents [ classFile . contentsOffset ++ ] = <NUM_LIT:0> ; classFile . contents [ classFile . contentsOffset ++ ] = <NUM_LIT:0> ; } classFile . setForMethodInfos ( ) ; int problemsLength ; CategorizedProblem [ ] problems = unitResult . getErrors ( ) ; if ( problems == null ) { problems = new CategorizedProblem [ <NUM_LIT:0> ] ; } CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; AbstractMethodDeclaration [ ] methodDecls = typeDeclaration . methods ; if ( methodDecls != null ) { if ( typeBinding . isInterface ( ) ) { classFile . addProblemClinit ( problemsCopy ) ; for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { AbstractMethodDeclaration methodDecl = methodDecls [ i ] ; MethodBinding method = methodDecl . binding ; if ( method == null || method . isConstructor ( ) ) continue ; method . modifiers = ClassFileConstants . AccPublic | ClassFileConstants . AccAbstract ; classFile . addAbstractMethod ( methodDecl , method ) ; } } else { for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { AbstractMethodDeclaration methodDecl = methodDecls [ i ] ; MethodBinding method = methodDecl . binding ; if ( method == null ) continue ; if ( method . isConstructor ( ) ) { classFile . addProblemConstructor ( methodDecl , method , problemsCopy ) ; } else if ( method . isAbstract ( ) ) { classFile . addAbstractMethod ( methodDecl , method ) ; } else { classFile . addProblemMethod ( methodDecl , method , problemsCopy ) ; } } } classFile . addDefaultAbstractMethods ( ) ; } if ( typeDeclaration . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = typeDeclaration . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = typeDeclaration . memberTypes [ i ] ; if ( memberType . binding != null ) { ClassFile . createProblemType ( memberType , unitResult ) ; } } } classFile . addAttributes ( ) ; unitResult . record ( typeBinding . constantPoolName ( ) , classFile ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . core . util . Util ; public abstract class Evaluator { EvaluationContext context ; INameEnvironment environment ; Map options ; IRequestor requestor ; IProblemFactory problemFactory ; Evaluator ( EvaluationContext context , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) { this . context = context ; this . environment = environment ; this . options = options ; this . requestor = requestor ; this . problemFactory = problemFactory ; } protected abstract void addEvaluationResultForCompilationProblem ( Map resultsByIDs , CategorizedProblem problem , char [ ] cuSource ) ; protected EvaluationResult [ ] evaluationResultsForCompilationProblems ( CompilationResult result , char [ ] cuSource ) { CategorizedProblem [ ] problems = result . getAllProblems ( ) ; HashMap resultsByIDs = new HashMap ( <NUM_LIT:5> ) ; for ( int i = <NUM_LIT:0> ; i < problems . length ; i ++ ) { addEvaluationResultForCompilationProblem ( resultsByIDs , problems [ i ] , cuSource ) ; } int size = resultsByIDs . size ( ) ; EvaluationResult [ ] evalResults = new EvaluationResult [ size ] ; Iterator results = resultsByIDs . values ( ) . iterator ( ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { evalResults [ i ] = ( EvaluationResult ) results . next ( ) ; } return evalResults ; } ClassFile [ ] getClasses ( ) { final char [ ] source = getSource ( ) ; final ArrayList classDefinitions = new ArrayList ( ) ; class CompilerRequestor implements ICompilerRequestor { boolean hasErrors = false ; public void acceptResult ( CompilationResult result ) { if ( result . hasProblems ( ) ) { EvaluationResult [ ] evalResults = evaluationResultsForCompilationProblems ( result , source ) ; for ( int i = <NUM_LIT:0> ; i < evalResults . length ; i ++ ) { EvaluationResult evalResult = evalResults [ i ] ; CategorizedProblem [ ] problems = evalResult . getProblems ( ) ; for ( int j = <NUM_LIT:0> ; j < problems . length ; j ++ ) { Evaluator . this . requestor . acceptProblem ( problems [ j ] , evalResult . getEvaluationID ( ) , evalResult . getEvaluationType ( ) ) ; } } } if ( result . hasErrors ( ) ) { this . hasErrors = true ; } else { ClassFile [ ] classFiles = result . getClassFiles ( ) ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; classDefinitions . add ( classFile ) ; } } } } CompilerRequestor compilerRequestor = new CompilerRequestor ( ) ; Compiler compiler = getCompiler ( compilerRequestor ) ; compiler . compile ( new ICompilationUnit [ ] { new ICompilationUnit ( ) { public char [ ] getFileName ( ) { return CharOperation . concat ( Evaluator . this . getClassName ( ) , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getContents ( ) { return source ; } public char [ ] getMainTypeName ( ) { return Evaluator . this . getClassName ( ) ; } public char [ ] [ ] getPackageName ( ) { return null ; } } } ) ; if ( compilerRequestor . hasErrors ) { return null ; } else { ClassFile [ ] result = new ClassFile [ classDefinitions . size ( ) ] ; classDefinitions . toArray ( result ) ; return result ; } } protected abstract char [ ] getClassName ( ) ; Compiler getCompiler ( ICompilerRequestor compilerRequestor ) { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; compilerOptions . performMethodsFullRecovery = true ; compilerOptions . performStatementsRecovery = true ; return new Compiler ( this . environment , DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) , compilerOptions , compilerRequestor , this . problemFactory ) ; } protected abstract char [ ] getSource ( ) ; } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . SuperReference ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class CodeSnippetSuperReference extends SuperReference implements EvaluationConstants , InvocationSite { public CodeSnippetSuperReference ( int pos , int sourceEnd ) { super ( pos , sourceEnd ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public TypeBinding resolveType ( BlockScope scope ) { scope . problemReporter ( ) . cannotUseSuperInCodeSnippet ( this . sourceStart , this . sourceEnd ) ; return null ; } public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return false ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int index ) { } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . Map ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; public class CodeSnippetEvaluator extends Evaluator implements EvaluationConstants { static final boolean DEVELOPMENT_MODE = false ; char [ ] codeSnippet ; CodeSnippetToCuMapper mapper ; CodeSnippetEvaluator ( char [ ] codeSnippet , EvaluationContext context , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) { super ( context , environment , options , requestor , problemFactory ) ; this . codeSnippet = codeSnippet ; } protected void addEvaluationResultForCompilationProblem ( Map resultsByIDs , CategorizedProblem problem , char [ ] cuSource ) { CodeSnippetToCuMapper sourceMapper = getMapper ( ) ; int pbLineNumber = problem . getSourceLineNumber ( ) ; int evaluationType = sourceMapper . getEvaluationType ( pbLineNumber ) ; char [ ] evaluationID = null ; switch ( evaluationType ) { case EvaluationResult . T_PACKAGE : evaluationID = this . context . packageName ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; break ; case EvaluationResult . T_IMPORT : evaluationID = sourceMapper . getImport ( pbLineNumber ) ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; break ; case EvaluationResult . T_CODE_SNIPPET : evaluationID = this . codeSnippet ; problem . setSourceLineNumber ( pbLineNumber - this . mapper . lineNumberOffset ) ; problem . setSourceStart ( problem . getSourceStart ( ) - this . mapper . startPosOffset ) ; problem . setSourceEnd ( problem . getSourceEnd ( ) - this . mapper . startPosOffset ) ; break ; case EvaluationResult . T_INTERNAL : evaluationID = cuSource ; break ; } EvaluationResult result = ( EvaluationResult ) resultsByIDs . get ( evaluationID ) ; if ( result == null ) { resultsByIDs . put ( evaluationID , new EvaluationResult ( evaluationID , evaluationType , new CategorizedProblem [ ] { problem } ) ) ; } else { result . addProblem ( problem ) ; } } protected char [ ] getClassName ( ) { return CharOperation . concat ( CODE_SNIPPET_CLASS_NAME_PREFIX , Integer . toString ( EvaluationContext . CODE_SNIPPET_COUNTER + <NUM_LIT:1> ) . toCharArray ( ) ) ; } Compiler getCompiler ( ICompilerRequestor compilerRequestor ) { Compiler compiler = null ; if ( ! DEVELOPMENT_MODE ) { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; compilerOptions . performMethodsFullRecovery = true ; compilerOptions . performStatementsRecovery = true ; compiler = new CodeSnippetCompiler ( this . environment , DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) , compilerOptions , compilerRequestor , this . problemFactory , this . context , getMapper ( ) . startPosOffset , getMapper ( ) . startPosOffset + this . codeSnippet . length - <NUM_LIT:1> ) ; ( ( CodeSnippetParser ) compiler . parser ) . lineSeparatorLength = this . context . lineSeparator . length ( ) ; IBinaryType binary = this . context . getRootCodeSnippetBinary ( ) ; if ( binary != null ) { compiler . lookupEnvironment . cacheBinaryType ( binary , null ) ; } VariablesInfo installedVars = this . context . installedVars ; if ( installedVars != null ) { ClassFile [ ] globalClassFiles = installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < globalClassFiles . length ; i ++ ) { ClassFileReader binaryType = null ; try { binaryType = new ClassFileReader ( globalClassFiles [ i ] . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; } compiler . lookupEnvironment . cacheBinaryType ( binaryType , null ) ; } } } else { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; compilerOptions . performMethodsFullRecovery = true ; compilerOptions . performStatementsRecovery = true ; compiler = new Compiler ( getWrapperEnvironment ( ) , DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) , compilerOptions , compilerRequestor , this . problemFactory ) ; } return compiler ; } private CodeSnippetToCuMapper getMapper ( ) { if ( this . mapper == null ) { char [ ] varClassName = null ; VariablesInfo installedVars = this . context . installedVars ; if ( installedVars != null ) { char [ ] superPackageName = installedVars . packageName ; if ( superPackageName != null && superPackageName . length != <NUM_LIT:0> ) { varClassName = CharOperation . concat ( superPackageName , installedVars . className , '<CHAR_LIT:.>' ) ; } else { varClassName = installedVars . className ; } } this . mapper = new CodeSnippetToCuMapper ( this . codeSnippet , this . context . packageName , this . context . imports , getClassName ( ) , varClassName , this . context . localVariableNames , this . context . localVariableTypeNames , this . context . localVariableModifiers , this . context . declaringTypeName , this . context . lineSeparator ) ; } return this . mapper ; } protected char [ ] getSource ( ) { return getMapper ( ) . cuSource ; } private INameEnvironment getWrapperEnvironment ( ) { return new CodeSnippetEnvironment ( this . environment , this . context ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . Map ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; public class VariablesEvaluator extends Evaluator implements EvaluationConstants { VariablesEvaluator ( EvaluationContext context , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) { super ( context , environment , options , requestor , problemFactory ) ; } protected void addEvaluationResultForCompilationProblem ( Map resultsByIDs , CategorizedProblem problem , char [ ] cuSource ) { char [ ] evaluationID = cuSource ; int evaluationType = EvaluationResult . T_INTERNAL ; int pbLine = problem . getSourceLineNumber ( ) ; int currentLine = <NUM_LIT:1> ; char [ ] packageName = getPackageName ( ) ; if ( packageName . length > <NUM_LIT:0> ) { if ( pbLine == <NUM_LIT:1> ) { evaluationID = packageName ; evaluationType = EvaluationResult . T_PACKAGE ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; } currentLine ++ ; } char [ ] [ ] imports = this . context . imports ; if ( ( currentLine <= pbLine ) && ( pbLine < ( currentLine + imports . length ) ) ) { evaluationID = imports [ pbLine - currentLine ] ; evaluationType = EvaluationResult . T_IMPORT ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; } currentLine += imports . length + <NUM_LIT:1> ; int varCount = this . context . variableCount ; if ( ( currentLine <= pbLine ) && ( pbLine < currentLine + varCount ) ) { GlobalVariable var = this . context . variables [ pbLine - currentLine ] ; evaluationID = var . getName ( ) ; evaluationType = EvaluationResult . T_VARIABLE ; int pbStart = problem . getSourceStart ( ) - var . declarationStart ; int pbEnd = problem . getSourceEnd ( ) - var . declarationStart ; int typeLength = var . getTypeName ( ) . length ; if ( ( <NUM_LIT:0> <= pbStart ) && ( pbEnd < typeLength ) ) { problem . setSourceLineNumber ( - <NUM_LIT:1> ) ; } else { pbStart -= typeLength + <NUM_LIT:1> ; pbEnd -= typeLength + <NUM_LIT:1> ; problem . setSourceLineNumber ( <NUM_LIT:0> ) ; } problem . setSourceStart ( pbStart ) ; problem . setSourceEnd ( pbEnd ) ; } currentLine = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < varCount ; i ++ ) { GlobalVariable var = this . context . variables [ i ] ; char [ ] initializer = var . getInitializer ( ) ; int initializerLength = initializer == null ? <NUM_LIT:0> : initializer . length ; if ( ( var . initializerStart <= problem . getSourceStart ( ) ) && ( problem . getSourceEnd ( ) < var . initializerStart + var . name . length ) ) { return ; } else if ( ( var . initExpressionStart <= problem . getSourceStart ( ) ) && ( problem . getSourceEnd ( ) < var . initExpressionStart + initializerLength ) ) { evaluationID = var . name ; evaluationType = EvaluationResult . T_VARIABLE ; problem . setSourceLineNumber ( pbLine - var . initializerLineStart + <NUM_LIT:1> ) ; problem . setSourceStart ( problem . getSourceStart ( ) - var . initExpressionStart ) ; problem . setSourceEnd ( problem . getSourceEnd ( ) - var . initExpressionStart ) ; break ; } } EvaluationResult result = ( EvaluationResult ) resultsByIDs . get ( evaluationID ) ; if ( result == null ) { resultsByIDs . put ( evaluationID , new EvaluationResult ( evaluationID , evaluationType , new CategorizedProblem [ ] { problem } ) ) ; } else { result . addProblem ( problem ) ; } } protected char [ ] getClassName ( ) { return CharOperation . concat ( EvaluationConstants . GLOBAL_VARS_CLASS_NAME_PREFIX , Integer . toString ( EvaluationContext . VAR_CLASS_COUNTER + <NUM_LIT:1> ) . toCharArray ( ) ) ; } Compiler getCompiler ( ICompilerRequestor compilerRequestor ) { Compiler compiler = super . getCompiler ( compilerRequestor ) ; IBinaryType binaryType = this . context . getRootCodeSnippetBinary ( ) ; if ( binaryType != null ) { compiler . lookupEnvironment . cacheBinaryType ( binaryType , null ) ; } VariablesInfo installedVars = this . context . installedVars ; if ( installedVars != null ) { ClassFile [ ] classFiles = installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; IBinaryType binary = null ; try { binary = new ClassFileReader ( classFile . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; } compiler . lookupEnvironment . cacheBinaryType ( binary , null ) ; } } return compiler ; } protected char [ ] getPackageName ( ) { return this . context . packageName ; } protected char [ ] getSource ( ) { StringBuffer buffer = new StringBuffer ( ) ; int lineNumberOffset = <NUM_LIT:1> ; char [ ] packageName = getPackageName ( ) ; if ( packageName . length != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( packageName ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } char [ ] [ ] imports = this . context . imports ; for ( int i = <NUM_LIT:0> ; i < imports . length ; i ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( imports [ i ] ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( getClassName ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( PACKAGE_NAME ) ; buffer . append ( "<STR_LIT:.>" ) ; buffer . append ( ROOT_CLASS_NAME ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; GlobalVariable [ ] vars = this . context . variables ; VariablesInfo installedVars = this . context . installedVars ; for ( int i = <NUM_LIT:0> ; i < this . context . variableCount ; i ++ ) { GlobalVariable var = vars [ i ] ; buffer . append ( "<STR_LIT>" ) ; var . declarationStart = buffer . length ( ) ; buffer . append ( var . typeName ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; char [ ] varName = var . name ; buffer . append ( varName ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; for ( int i = <NUM_LIT:0> ; i < this . context . variableCount ; i ++ ) { GlobalVariable var = vars [ i ] ; char [ ] varName = var . name ; GlobalVariable installedVar = installedVars == null ? null : installedVars . varNamed ( varName ) ; if ( installedVar == null || ! CharOperation . equals ( installedVar . typeName , var . typeName ) ) { char [ ] initializer = var . initializer ; if ( initializer != null ) { buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; var . initializerLineStart = lineNumberOffset ; buffer . append ( "<STR_LIT>" ) ; var . initializerStart = buffer . length ( ) ; buffer . append ( varName ) ; buffer . append ( "<STR_LIT>" ) ; var . initExpressionStart = buffer . length ( ) ; buffer . append ( initializer ) ; lineNumberOffset += numberOfCRs ( initializer ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset += <NUM_LIT:4> ; } } else { buffer . append ( "<STR_LIT>" ) ; buffer . append ( varName ) ; buffer . append ( "<STR_LIT>" ) ; char [ ] installedPackageName = installedVars . packageName ; if ( installedPackageName != null && installedPackageName . length != <NUM_LIT:0> ) { buffer . append ( installedPackageName ) ; buffer . append ( "<STR_LIT:.>" ) ; } buffer . append ( installedVars . className ) ; buffer . append ( "<STR_LIT:.>" ) ; buffer . append ( varName ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } } buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; buffer . append ( '<CHAR_LIT:}>' ) . append ( this . context . lineSeparator ) ; int length = buffer . length ( ) ; char [ ] result = new char [ length ] ; buffer . getChars ( <NUM_LIT:0> , length , result , <NUM_LIT:0> ) ; return result ; } private int numberOfCRs ( char [ ] source ) { int numberOfCRs = <NUM_LIT:0> ; boolean lastWasCR = false ; for ( int i = <NUM_LIT:0> ; i < source . length ; i ++ ) { char currentChar = source [ i ] ; switch ( currentChar ) { case '<STR_LIT>' : lastWasCR = true ; numberOfCRs ++ ; break ; case '<STR_LIT:\n>' : if ( ! lastWasCR ) numberOfCRs ++ ; lastWasCR = false ; break ; default : lastWasCR = false ; } } return numberOfCRs ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . ClassFile ; public interface IRequestor { boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) ; void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) ; } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IErrorHandlingPolicy ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; public class CodeSnippetCompiler extends Compiler { EvaluationContext evaluationContext ; int codeSnippetStart ; int codeSnippetEnd ; public CodeSnippetCompiler ( INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions compilerOptions , ICompilerRequestor requestor , IProblemFactory problemFactory , EvaluationContext evaluationContext , int codeSnippetStart , int codeSnippetEnd ) { super ( environment , policy , compilerOptions , requestor , problemFactory ) ; this . codeSnippetStart = codeSnippetStart ; this . codeSnippetEnd = codeSnippetEnd ; this . evaluationContext = evaluationContext ; this . parser = new CodeSnippetParser ( this . problemReporter , evaluationContext , this . options . parseLiteralExpressionsAsConstants , codeSnippetStart , codeSnippetEnd ) ; this . parseThreshold = <NUM_LIT:1> ; } public void initializeParser ( ) { this . parser = new CodeSnippetParser ( this . problemReporter , this . evaluationContext , this . options . parseLiteralExpressionsAsConstants , this . codeSnippetStart , this . codeSnippetEnd ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryField ; import org . eclipse . jdt . internal . compiler . env . IBinaryMethod ; import org . eclipse . jdt . internal . compiler . env . IBinaryNestedType ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . core . util . Util ; public class CodeSnippetSkeleton implements IBinaryType , EvaluationConstants { public static class BinaryMethodSkeleton implements IBinaryMethod { char [ ] [ ] exceptionTypeNames ; char [ ] methodDescriptor ; char [ ] selector ; boolean isConstructor ; public BinaryMethodSkeleton ( char [ ] selector , char [ ] methodDescriptor , char [ ] [ ] exceptionTypeNames , boolean isConstructor ) { this . selector = selector ; this . methodDescriptor = methodDescriptor ; this . exceptionTypeNames = exceptionTypeNames ; this . isConstructor = isConstructor ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return null ; } public char [ ] [ ] getArgumentNames ( ) { return null ; } public Object getDefaultValue ( ) { return null ; } public char [ ] [ ] getExceptionTypeNames ( ) { return this . exceptionTypeNames ; } public char [ ] getGenericSignature ( ) { return null ; } public char [ ] getMethodDescriptor ( ) { return this . methodDescriptor ; } public int getModifiers ( ) { return ClassFileConstants . AccPublic ; } public IBinaryAnnotation [ ] getParameterAnnotations ( int index ) { return null ; } public char [ ] getSelector ( ) { return this . selector ; } public long getTagBits ( ) { return <NUM_LIT:0> ; } public boolean isClinit ( ) { return false ; } public boolean isConstructor ( ) { return this . isConstructor ; } } IBinaryMethod [ ] methods = new IBinaryMethod [ ] { new BinaryMethodSkeleton ( "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] [ ] { } , true ) , new BinaryMethodSkeleton ( "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) } , false ) , new BinaryMethodSkeleton ( "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] [ ] { } , false ) } ; public CodeSnippetSkeleton ( ) { super ( ) ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return null ; } public char [ ] getEnclosingMethod ( ) { return null ; } public char [ ] getEnclosingTypeName ( ) { return null ; } public IBinaryField [ ] getFields ( ) { return null ; } public char [ ] getFileName ( ) { return CharOperation . concat ( CODE_SNIPPET_NAME , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getGenericSignature ( ) { return null ; } public char [ ] [ ] getInterfaceNames ( ) { return null ; } public String getJavadocContents ( ) { return null ; } public String getJavadocContents ( IProgressMonitor monitor , String defaultEncoding ) throws JavaModelException { return null ; } public IBinaryNestedType [ ] getMemberTypes ( ) { return null ; } public IBinaryMethod [ ] getMethods ( ) { return this . methods ; } public int getModifiers ( ) { return ClassFileConstants . AccPublic ; } public char [ ] [ ] [ ] getMissingTypeNames ( ) { return null ; } public char [ ] getName ( ) { return CODE_SNIPPET_NAME ; } public char [ ] getSourceName ( ) { return ROOT_CLASS_NAME ; } public char [ ] getSuperclassName ( ) { return null ; } public long getTagBits ( ) { return <NUM_LIT:0> ; } public String getURLContents ( String docUrlValue , String defaultEncoding ) { return null ; } public boolean isAnonymous ( ) { return false ; } public boolean isBinaryType ( ) { return true ; } public boolean isLocal ( ) { return false ; } public boolean isMember ( ) { return false ; } public char [ ] sourceFileName ( ) { return null ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ICodeAssist { void codeComplete ( int offset , ICodeCompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException ; void codeComplete ( int offset , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException ; IJavaElement [ ] codeSelect ( int offset , int length , WorkingCopyOwner owner ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ITypeRoot extends IJavaElement , IParent , IOpenable , ISourceReference , ICodeAssist { IType findPrimaryType ( ) ; IJavaElement getElementAt ( int position ) throws JavaModelException ; ICompilationUnit getWorkingCopy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . core . util . Util ; public final class Signature { public static final char C_BOOLEAN = '<CHAR_LIT:Z>' ; public static final char C_BYTE = '<CHAR_LIT>' ; public static final char C_CHAR = '<CHAR_LIT>' ; public static final char C_DOUBLE = '<CHAR_LIT>' ; public static final char C_FLOAT = '<CHAR_LIT>' ; public static final char C_INT = '<CHAR_LIT>' ; public static final char C_SEMICOLON = '<CHAR_LIT:;>' ; public static final char C_COLON = '<CHAR_LIT::>' ; public static final char C_LONG = '<CHAR_LIT>' ; public static final char C_SHORT = '<CHAR_LIT>' ; public static final char C_VOID = '<CHAR_LIT>' ; public static final char C_TYPE_VARIABLE = '<CHAR_LIT>' ; public static final char C_STAR = '<CHAR_LIT>' ; public static final char C_EXCEPTION_START = '<CHAR_LIT>' ; public static final char C_EXTENDS = '<CHAR_LIT>' ; public static final char C_SUPER = '<CHAR_LIT:->' ; public static final char C_DOT = '<CHAR_LIT:.>' ; public static final char C_DOLLAR = '<CHAR_LIT>' ; public static final char C_ARRAY = '<CHAR_LIT:[>' ; public static final char C_RESOLVED = '<CHAR_LIT>' ; public static final char C_UNRESOLVED = '<CHAR_LIT>' ; public static final char C_NAME_END = '<CHAR_LIT:;>' ; public static final char C_PARAM_START = '<CHAR_LIT:(>' ; public static final char C_PARAM_END = '<CHAR_LIT:)>' ; public static final char C_GENERIC_START = '<CHAR_LIT>' ; public static final char C_GENERIC_END = '<CHAR_LIT:>>' ; public static final char C_CAPTURE = '<CHAR_LIT>' ; public static final String SIG_BOOLEAN = "<STR_LIT:Z>" ; public static final String SIG_BYTE = "<STR_LIT:B>" ; public static final String SIG_CHAR = "<STR_LIT:C>" ; public static final String SIG_DOUBLE = "<STR_LIT:D>" ; public static final String SIG_FLOAT = "<STR_LIT:F>" ; public static final String SIG_INT = "<STR_LIT:I>" ; public static final String SIG_LONG = "<STR_LIT>" ; public static final String SIG_SHORT = "<STR_LIT:S>" ; public static final String SIG_VOID = "<STR_LIT>" ; public static final int CLASS_TYPE_SIGNATURE = <NUM_LIT:1> ; public static final int BASE_TYPE_SIGNATURE = <NUM_LIT:2> ; public static final int TYPE_VARIABLE_SIGNATURE = <NUM_LIT:3> ; public static final int ARRAY_TYPE_SIGNATURE = <NUM_LIT:4> ; public static final int WILDCARD_TYPE_SIGNATURE = <NUM_LIT:5> ; public static final int CAPTURE_TYPE_SIGNATURE = <NUM_LIT:6> ; private static final char [ ] BOOLEAN = "<STR_LIT:boolean>" . toCharArray ( ) ; private static final char [ ] BYTE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] CHAR = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] DOUBLE = "<STR_LIT:double>" . toCharArray ( ) ; private static final char [ ] FLOAT = "<STR_LIT:float>" . toCharArray ( ) ; private static final char [ ] INT = "<STR_LIT:int>" . toCharArray ( ) ; private static final char [ ] LONG = "<STR_LIT:long>" . toCharArray ( ) ; private static final char [ ] SHORT = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] VOID = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] EXTENDS = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] SUPER = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] CAPTURE = "<STR_LIT>" . toCharArray ( ) ; private Signature ( ) { } private static int checkName ( char [ ] name , char [ ] typeName , int pos , int length ) { if ( CharOperation . fragmentEquals ( name , typeName , pos , true ) ) { pos += name . length ; if ( pos == length ) return pos ; char currentChar = typeName [ pos ] ; switch ( currentChar ) { case '<CHAR_LIT:U+0020>' : case '<CHAR_LIT:.>' : case '<CHAR_LIT>' : case '<CHAR_LIT:>>' : case '<CHAR_LIT:[>' : case '<CHAR_LIT:U+002C>' : return pos ; default : if ( ScannerHelper . isWhitespace ( currentChar ) ) return pos ; } } return - <NUM_LIT:1> ; } public static char [ ] createArraySignature ( char [ ] typeSignature , int arrayCount ) { if ( arrayCount == <NUM_LIT:0> ) return typeSignature ; int sigLength = typeSignature . length ; char [ ] result = new char [ arrayCount + sigLength ] ; for ( int i = <NUM_LIT:0> ; i < arrayCount ; i ++ ) { result [ i ] = C_ARRAY ; } System . arraycopy ( typeSignature , <NUM_LIT:0> , result , arrayCount , sigLength ) ; return result ; } public static String createArraySignature ( String typeSignature , int arrayCount ) { return new String ( createArraySignature ( typeSignature . toCharArray ( ) , arrayCount ) ) ; } public static char [ ] createMethodSignature ( char [ ] [ ] parameterTypes , char [ ] returnType ) { int parameterTypesLength = parameterTypes . length ; int parameterLength = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < parameterTypesLength ; i ++ ) { parameterLength += parameterTypes [ i ] . length ; } int returnTypeLength = returnType . length ; char [ ] result = new char [ <NUM_LIT:1> + parameterLength + <NUM_LIT:1> + returnTypeLength ] ; result [ <NUM_LIT:0> ] = C_PARAM_START ; int index = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < parameterTypesLength ; i ++ ) { char [ ] parameterType = parameterTypes [ i ] ; int length = parameterType . length ; System . arraycopy ( parameterType , <NUM_LIT:0> , result , index , length ) ; index += length ; } result [ index ] = C_PARAM_END ; System . arraycopy ( returnType , <NUM_LIT:0> , result , index + <NUM_LIT:1> , returnTypeLength ) ; return result ; } public static String createMethodSignature ( String [ ] parameterTypes , String returnType ) { int parameterTypesLenth = parameterTypes . length ; char [ ] [ ] parameters = new char [ parameterTypesLenth ] [ ] ; for ( int i = <NUM_LIT:0> ; i < parameterTypesLenth ; i ++ ) { parameters [ i ] = parameterTypes [ i ] . toCharArray ( ) ; } return new String ( createMethodSignature ( parameters , returnType . toCharArray ( ) ) ) ; } public static char [ ] createTypeParameterSignature ( char [ ] typeParameterName , char [ ] [ ] boundSignatures ) { int length = boundSignatures . length ; if ( length == <NUM_LIT:0> ) { return CharOperation . append ( typeParameterName , C_COLON ) ; } int boundsSize = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { boundsSize += boundSignatures [ i ] . length + <NUM_LIT:1> ; } int nameLength = typeParameterName . length ; char [ ] result = new char [ nameLength + boundsSize ] ; System . arraycopy ( typeParameterName , <NUM_LIT:0> , result , <NUM_LIT:0> , nameLength ) ; int index = nameLength ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ index ++ ] = C_COLON ; int boundLength = boundSignatures [ i ] . length ; System . arraycopy ( boundSignatures [ i ] , <NUM_LIT:0> , result , index , boundLength ) ; index += boundLength ; } return result ; } public static String createTypeParameterSignature ( String typeParameterName , String [ ] boundSignatures ) { int length = boundSignatures . length ; char [ ] [ ] boundSignatureChars = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { boundSignatureChars [ i ] = boundSignatures [ i ] . toCharArray ( ) ; } return new String ( createTypeParameterSignature ( typeParameterName . toCharArray ( ) , boundSignatureChars ) ) ; } public static String createTypeSignature ( char [ ] typeName , boolean isResolved ) { return new String ( createCharArrayTypeSignature ( typeName , isResolved ) ) ; } public static char [ ] createCharArrayTypeSignature ( char [ ] typeName , boolean isResolved ) { if ( typeName == null ) throw new IllegalArgumentException ( "<STR_LIT:null>" ) ; int length = typeName . length ; if ( length == <NUM_LIT:0> ) throw new IllegalArgumentException ( new String ( typeName ) ) ; StringBuffer buffer = new StringBuffer ( <NUM_LIT:5> ) ; int pos = encodeTypeSignature ( typeName , <NUM_LIT:0> , isResolved , length , buffer ) ; pos = consumeWhitespace ( typeName , pos , length ) ; if ( pos < length ) throw new IllegalArgumentException ( new String ( typeName ) ) ; char [ ] result = new char [ length = buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , length , result , <NUM_LIT:0> ) ; return result ; } private static int consumeWhitespace ( char [ ] typeName , int pos , int length ) { while ( pos < length ) { char currentChar = typeName [ pos ] ; if ( currentChar != '<CHAR_LIT:U+0020>' && ! ScannerHelper . isWhitespace ( currentChar ) ) { break ; } pos ++ ; } return pos ; } private static int encodeQualifiedName ( char [ ] typeName , int pos , int length , StringBuffer buffer ) { int count = <NUM_LIT:0> ; char lastAppendedChar = <NUM_LIT:0> ; nameLoop : while ( pos < length ) { char currentChar = typeName [ pos ] ; switch ( currentChar ) { case '<CHAR_LIT>' : case '<CHAR_LIT:>>' : case '<CHAR_LIT:[>' : case '<CHAR_LIT:U+002C>' : break nameLoop ; case '<CHAR_LIT:.>' : buffer . append ( C_DOT ) ; lastAppendedChar = C_DOT ; count ++ ; break ; default : if ( currentChar == '<CHAR_LIT:U+0020>' || ScannerHelper . isWhitespace ( currentChar ) ) { if ( lastAppendedChar == C_DOT ) { pos = consumeWhitespace ( typeName , pos , length ) - <NUM_LIT:1> ; break ; } int checkPos = checkNextChar ( typeName , '<CHAR_LIT:.>' , pos , length , true ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_DOT ) ; lastAppendedChar = C_DOT ; count ++ ; pos = checkPos ; break ; } break nameLoop ; } buffer . append ( currentChar ) ; lastAppendedChar = currentChar ; count ++ ; break ; } pos ++ ; } if ( count == <NUM_LIT:0> ) throw new IllegalArgumentException ( new String ( typeName ) ) ; return pos ; } private static int encodeArrayDimension ( char [ ] typeName , int pos , int length , StringBuffer buffer ) { int checkPos ; while ( pos < length && ( checkPos = checkNextChar ( typeName , '<CHAR_LIT:[>' , pos , length , true ) ) > <NUM_LIT:0> ) { pos = checkNextChar ( typeName , '<CHAR_LIT:]>' , checkPos , length , false ) ; buffer . append ( C_ARRAY ) ; } return pos ; } private static int checkArrayDimension ( char [ ] typeName , int pos , int length ) { int genericBalance = <NUM_LIT:0> ; while ( pos < length ) { switch ( typeName [ pos ] ) { case '<CHAR_LIT>' : genericBalance ++ ; break ; case '<CHAR_LIT:U+002C>' : if ( genericBalance == <NUM_LIT:0> ) return - <NUM_LIT:1> ; break ; case '<CHAR_LIT:>>' : if ( genericBalance == <NUM_LIT:0> ) return - <NUM_LIT:1> ; genericBalance -- ; break ; case '<CHAR_LIT:[>' : if ( genericBalance == <NUM_LIT:0> ) { return pos ; } } pos ++ ; } return - <NUM_LIT:1> ; } private static int checkNextChar ( char [ ] typeName , char expectedChar , int pos , int length , boolean isOptional ) { pos = consumeWhitespace ( typeName , pos , length ) ; if ( pos < length && typeName [ pos ] == expectedChar ) return pos + <NUM_LIT:1> ; if ( ! isOptional ) throw new IllegalArgumentException ( new String ( typeName ) ) ; return - <NUM_LIT:1> ; } private static int encodeTypeSignature ( char [ ] typeName , int start , boolean isResolved , int length , StringBuffer buffer ) { int pos = start ; pos = consumeWhitespace ( typeName , pos , length ) ; if ( pos >= length ) throw new IllegalArgumentException ( new String ( typeName ) ) ; int checkPos ; char currentChar = typeName [ pos ] ; switch ( currentChar ) { case '<CHAR_LIT:b>' : checkPos = checkName ( BOOLEAN , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_BOOLEAN ) ; return pos ; } checkPos = checkName ( BYTE , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_BYTE ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( DOUBLE , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_DOUBLE ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( FLOAT , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_FLOAT ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( INT , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_INT ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( LONG , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_LONG ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( SHORT , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_SHORT ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( VOID , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_VOID ) ; return pos ; } break ; case '<CHAR_LIT:c>' : checkPos = checkName ( CHAR , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_CHAR ) ; return pos ; } else { checkPos = checkName ( CAPTURE , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = consumeWhitespace ( typeName , checkPos , length ) ; if ( typeName [ pos ] != '<CHAR_LIT>' ) { break ; } } else { break ; } } buffer . append ( C_CAPTURE ) ; case '<CHAR_LIT>' : pos = consumeWhitespace ( typeName , pos + <NUM_LIT:1> , length ) ; checkPos = checkName ( EXTENDS , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_EXTENDS ) ; pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; return pos ; } checkPos = checkName ( SUPER , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_SUPER ) ; pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; return pos ; } buffer . append ( C_STAR ) ; return pos ; } checkPos = checkArrayDimension ( typeName , pos , length ) ; int end ; if ( checkPos > <NUM_LIT:0> ) { end = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; } else { end = - <NUM_LIT:1> ; } buffer . append ( isResolved ? C_RESOLVED : C_UNRESOLVED ) ; while ( true ) { pos = encodeQualifiedName ( typeName , pos , length , buffer ) ; checkPos = checkNextChar ( typeName , '<CHAR_LIT>' , pos , length , true ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_GENERIC_START ) ; pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; while ( ( checkPos = checkNextChar ( typeName , '<CHAR_LIT:U+002C>' , pos , length , true ) ) > <NUM_LIT:0> ) { pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; } pos = checkNextChar ( typeName , '<CHAR_LIT:>>' , pos , length , false ) ; buffer . append ( C_GENERIC_END ) ; } checkPos = checkNextChar ( typeName , '<CHAR_LIT:.>' , pos , length , true ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_DOT ) ; pos = checkPos ; } else { break ; } } buffer . append ( C_NAME_END ) ; if ( end > <NUM_LIT:0> ) pos = end ; return pos ; } public static String createTypeSignature ( String typeName , boolean isResolved ) { return createTypeSignature ( typeName == null ? null : typeName . toCharArray ( ) , isResolved ) ; } public static int getArrayCount ( char [ ] typeSignature ) throws IllegalArgumentException { try { int count = <NUM_LIT:0> ; while ( typeSignature [ count ] == C_ARRAY ) { ++ count ; } return count ; } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } } public static int getArrayCount ( String typeSignature ) throws IllegalArgumentException { return getArrayCount ( typeSignature . toCharArray ( ) ) ; } public static char [ ] getElementType ( char [ ] typeSignature ) throws IllegalArgumentException { int count = getArrayCount ( typeSignature ) ; if ( count == <NUM_LIT:0> ) return typeSignature ; int length = typeSignature . length ; char [ ] result = new char [ length - count ] ; System . arraycopy ( typeSignature , count , result , <NUM_LIT:0> , length - count ) ; return result ; } public static String getElementType ( String typeSignature ) throws IllegalArgumentException { return new String ( getElementType ( typeSignature . toCharArray ( ) ) ) ; } public static int getParameterCount ( char [ ] methodSignature ) throws IllegalArgumentException { try { int count = <NUM_LIT:0> ; int i = CharOperation . indexOf ( C_PARAM_START , methodSignature ) ; if ( i < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } else { i ++ ; } for ( ; ; ) { if ( methodSignature [ i ] == C_PARAM_END ) { return count ; } int e = Util . scanTypeSignature ( methodSignature , i ) ; if ( e < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } else { i = e + <NUM_LIT:1> ; } count ++ ; } } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } } public static int getTypeSignatureKind ( char [ ] typeSignature ) { if ( typeSignature . length < <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = typeSignature [ <NUM_LIT:0> ] ; if ( c == C_GENERIC_START ) { int count = <NUM_LIT:1> ; for ( int i = <NUM_LIT:1> , length = typeSignature . length ; i < length ; i ++ ) { switch ( typeSignature [ i ] ) { case C_GENERIC_START : count ++ ; break ; case C_GENERIC_END : count -- ; break ; } if ( count == <NUM_LIT:0> ) { if ( i + <NUM_LIT:1> < length ) c = typeSignature [ i + <NUM_LIT:1> ] ; break ; } } } switch ( c ) { case C_ARRAY : return ARRAY_TYPE_SIGNATURE ; case C_RESOLVED : case C_UNRESOLVED : return CLASS_TYPE_SIGNATURE ; case C_TYPE_VARIABLE : return TYPE_VARIABLE_SIGNATURE ; case C_BOOLEAN : case C_BYTE : case C_CHAR : case C_DOUBLE : case C_FLOAT : case C_INT : case C_LONG : case C_SHORT : case C_VOID : return BASE_TYPE_SIGNATURE ; case C_STAR : case C_SUPER : case C_EXTENDS : return WILDCARD_TYPE_SIGNATURE ; case C_CAPTURE : return CAPTURE_TYPE_SIGNATURE ; default : throw new IllegalArgumentException ( ) ; } } public static int getTypeSignatureKind ( String typeSignature ) { if ( typeSignature . length ( ) < <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = typeSignature . charAt ( <NUM_LIT:0> ) ; if ( c == C_GENERIC_START ) { int count = <NUM_LIT:1> ; for ( int i = <NUM_LIT:1> , length = typeSignature . length ( ) ; i < length ; i ++ ) { switch ( typeSignature . charAt ( i ) ) { case C_GENERIC_START : count ++ ; break ; case C_GENERIC_END : count -- ; break ; } if ( count == <NUM_LIT:0> ) { if ( i + <NUM_LIT:1> < length ) c = typeSignature . charAt ( i + <NUM_LIT:1> ) ; break ; } } } switch ( c ) { case C_ARRAY : return ARRAY_TYPE_SIGNATURE ; case C_RESOLVED : case C_UNRESOLVED : return CLASS_TYPE_SIGNATURE ; case C_TYPE_VARIABLE : return TYPE_VARIABLE_SIGNATURE ; case C_BOOLEAN : case C_BYTE : case C_CHAR : case C_DOUBLE : case C_FLOAT : case C_INT : case C_LONG : case C_SHORT : case C_VOID : return BASE_TYPE_SIGNATURE ; case C_STAR : case C_SUPER : case C_EXTENDS : return WILDCARD_TYPE_SIGNATURE ; case C_CAPTURE : return CAPTURE_TYPE_SIGNATURE ; default : throw new IllegalArgumentException ( ) ; } } public static int getParameterCount ( String methodSignature ) throws IllegalArgumentException { return getParameterCount ( methodSignature . toCharArray ( ) ) ; } public static char [ ] [ ] getParameterTypes ( char [ ] methodSignature ) throws IllegalArgumentException { try { int count = getParameterCount ( methodSignature ) ; char [ ] [ ] result = new char [ count ] [ ] ; if ( count == <NUM_LIT:0> ) { return result ; } int i = CharOperation . indexOf ( C_PARAM_START , methodSignature ) ; if ( i < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } else { i ++ ; } int t = <NUM_LIT:0> ; for ( ; ; ) { if ( methodSignature [ i ] == C_PARAM_END ) { return result ; } int e = Util . scanTypeSignature ( methodSignature , i ) ; if ( e < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } result [ t ] = CharOperation . subarray ( methodSignature , i , e + <NUM_LIT:1> ) ; t ++ ; i = e + <NUM_LIT:1> ; } } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } } public static String [ ] getParameterTypes ( String methodSignature ) throws IllegalArgumentException { char [ ] [ ] parameterTypes = getParameterTypes ( methodSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( parameterTypes ) ; } public static String [ ] getThrownExceptionTypes ( String methodSignature ) throws IllegalArgumentException { char [ ] [ ] parameterTypes = getThrownExceptionTypes ( methodSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( parameterTypes ) ; } public static char [ ] [ ] getThrownExceptionTypes ( char [ ] methodSignature ) throws IllegalArgumentException { int exceptionStart = CharOperation . indexOf ( C_EXCEPTION_START , methodSignature ) ; if ( exceptionStart == - <NUM_LIT:1> ) { int paren = CharOperation . lastIndexOf ( C_PARAM_END , methodSignature ) ; if ( paren == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } exceptionStart = Util . scanTypeSignature ( methodSignature , paren + <NUM_LIT:1> ) + <NUM_LIT:1> ; int length = methodSignature . length ; if ( exceptionStart == length ) return CharOperation . NO_CHAR_CHAR ; throw new IllegalArgumentException ( ) ; } int length = methodSignature . length ; int i = exceptionStart ; ArrayList exceptionList = new ArrayList ( <NUM_LIT:1> ) ; while ( i < length ) { if ( methodSignature [ i ] == C_EXCEPTION_START ) { exceptionStart ++ ; i ++ ; } else { throw new IllegalArgumentException ( ) ; } i = Util . scanTypeSignature ( methodSignature , i ) + <NUM_LIT:1> ; exceptionList . add ( CharOperation . subarray ( methodSignature , exceptionStart , i ) ) ; exceptionStart = i ; } char [ ] [ ] result ; exceptionList . toArray ( result = new char [ exceptionList . size ( ) ] [ ] ) ; return result ; } public static char [ ] [ ] getTypeArguments ( char [ ] parameterizedTypeSignature ) throws IllegalArgumentException { int length = parameterizedTypeSignature . length ; if ( length < <NUM_LIT:2> || parameterizedTypeSignature [ length - <NUM_LIT:2> ] != C_GENERIC_END ) return CharOperation . NO_CHAR_CHAR ; int count = <NUM_LIT:1> ; int start = length - <NUM_LIT:2> ; while ( start >= <NUM_LIT:0> && count > <NUM_LIT:0> ) { switch ( parameterizedTypeSignature [ -- start ] ) { case C_GENERIC_START : count -- ; break ; case C_GENERIC_END : count ++ ; break ; } } if ( start < <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; ArrayList args = new ArrayList ( ) ; int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= parameterizedTypeSignature . length ) { throw new IllegalArgumentException ( ) ; } char c = parameterizedTypeSignature [ p ] ; if ( c == C_GENERIC_END ) { int size = args . size ( ) ; char [ ] [ ] result = new char [ size ] [ ] ; args . toArray ( result ) ; return result ; } int e = Util . scanTypeArgumentSignature ( parameterizedTypeSignature , p ) ; args . add ( CharOperation . subarray ( parameterizedTypeSignature , p , e + <NUM_LIT:1> ) ) ; p = e + <NUM_LIT:1> ; } } public static String [ ] getTypeArguments ( String parameterizedTypeSignature ) throws IllegalArgumentException { char [ ] [ ] args = getTypeArguments ( parameterizedTypeSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( args ) ; } public static char [ ] getTypeErasure ( char [ ] parameterizedTypeSignature ) throws IllegalArgumentException { int end = CharOperation . indexOf ( C_GENERIC_START , parameterizedTypeSignature ) ; if ( end == - <NUM_LIT:1> ) return parameterizedTypeSignature ; int length = parameterizedTypeSignature . length ; char [ ] result = new char [ length ] ; int pos = <NUM_LIT:0> ; int start = <NUM_LIT:0> ; int deep = <NUM_LIT:0> ; for ( int idx = end ; idx < length ; idx ++ ) { switch ( parameterizedTypeSignature [ idx ] ) { case C_GENERIC_START : if ( deep == <NUM_LIT:0> ) { int size = idx - start ; System . arraycopy ( parameterizedTypeSignature , start , result , pos , size ) ; end = idx ; pos += size ; } deep ++ ; break ; case C_GENERIC_END : deep -- ; if ( deep < <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; if ( deep == <NUM_LIT:0> ) start = idx + <NUM_LIT:1> ; break ; } } if ( deep > <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; int size = pos + length - start ; char [ ] resized = new char [ size ] ; System . arraycopy ( result , <NUM_LIT:0> , resized , <NUM_LIT:0> , pos ) ; System . arraycopy ( parameterizedTypeSignature , start , resized , pos , length - start ) ; return resized ; } public static String getTypeErasure ( String parameterizedTypeSignature ) throws IllegalArgumentException { return new String ( getTypeErasure ( parameterizedTypeSignature . toCharArray ( ) ) ) ; } public static char [ ] [ ] getTypeParameters ( char [ ] methodOrTypeSignature ) throws IllegalArgumentException { try { int length = methodOrTypeSignature . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; if ( methodOrTypeSignature [ <NUM_LIT:0> ] != C_GENERIC_START ) return CharOperation . NO_CHAR_CHAR ; ArrayList paramList = new ArrayList ( <NUM_LIT:1> ) ; int paramStart = <NUM_LIT:1> , i = <NUM_LIT:1> ; while ( i < length ) { if ( methodOrTypeSignature [ i ] == C_GENERIC_END ) { int size = paramList . size ( ) ; if ( size == <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; char [ ] [ ] result ; paramList . toArray ( result = new char [ size ] [ ] ) ; return result ; } i = CharOperation . indexOf ( C_COLON , methodOrTypeSignature , i ) ; if ( i < <NUM_LIT:0> || i >= length ) throw new IllegalArgumentException ( ) ; while ( methodOrTypeSignature [ i ] == '<CHAR_LIT::>' ) { i ++ ; switch ( methodOrTypeSignature [ i ] ) { case '<CHAR_LIT::>' : break ; case C_GENERIC_END : break ; case C_RESOLVED : try { i = Util . scanClassTypeSignature ( methodOrTypeSignature , i ) ; i ++ ; } catch ( IllegalArgumentException e ) { } break ; case C_ARRAY : try { i = Util . scanArrayTypeSignature ( methodOrTypeSignature , i ) ; i ++ ; } catch ( IllegalArgumentException e ) { } break ; case C_TYPE_VARIABLE : try { i = Util . scanTypeVariableSignature ( methodOrTypeSignature , i ) ; i ++ ; } catch ( IllegalArgumentException e ) { } break ; } } paramList . add ( CharOperation . subarray ( methodOrTypeSignature , paramStart , i ) ) ; paramStart = i ; } } catch ( ArrayIndexOutOfBoundsException e ) { } throw new IllegalArgumentException ( ) ; } public static String [ ] getTypeParameters ( String methodOrTypeSignature ) throws IllegalArgumentException { char [ ] [ ] params = getTypeParameters ( methodOrTypeSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( params ) ; } public static String getTypeVariable ( String formalTypeParameterSignature ) throws IllegalArgumentException { return new String ( getTypeVariable ( formalTypeParameterSignature . toCharArray ( ) ) ) ; } public static char [ ] getTypeVariable ( char [ ] formalTypeParameterSignature ) throws IllegalArgumentException { int p = CharOperation . indexOf ( C_COLON , formalTypeParameterSignature ) ; if ( p < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } return CharOperation . subarray ( formalTypeParameterSignature , <NUM_LIT:0> , p ) ; } public static char [ ] [ ] getTypeParameterBounds ( char [ ] formalTypeParameterSignature ) throws IllegalArgumentException { int p1 = CharOperation . indexOf ( C_COLON , formalTypeParameterSignature ) ; if ( p1 < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } if ( p1 == formalTypeParameterSignature . length - <NUM_LIT:1> ) { return CharOperation . NO_CHAR_CHAR ; } int p2 = CharOperation . indexOf ( C_COLON , formalTypeParameterSignature , p1 + <NUM_LIT:1> ) ; char [ ] classBound ; if ( p2 < <NUM_LIT:0> ) { classBound = CharOperation . subarray ( formalTypeParameterSignature , p1 + <NUM_LIT:1> , formalTypeParameterSignature . length ) ; return new char [ ] [ ] { classBound } ; } if ( p2 == p1 + <NUM_LIT:1> ) { classBound = null ; } else { classBound = CharOperation . subarray ( formalTypeParameterSignature , p1 + <NUM_LIT:1> , p2 ) ; } char [ ] [ ] interfaceBounds = CharOperation . splitOn ( C_COLON , formalTypeParameterSignature , p2 + <NUM_LIT:1> , formalTypeParameterSignature . length ) ; if ( classBound == null ) { return interfaceBounds ; } int resultLength = interfaceBounds . length + <NUM_LIT:1> ; char [ ] [ ] result = new char [ resultLength ] [ ] ; result [ <NUM_LIT:0> ] = classBound ; System . arraycopy ( interfaceBounds , <NUM_LIT:0> , result , <NUM_LIT:1> , interfaceBounds . length ) ; return result ; } public static String [ ] getTypeParameterBounds ( String formalTypeParameterSignature ) throws IllegalArgumentException { char [ ] [ ] bounds = getTypeParameterBounds ( formalTypeParameterSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( bounds ) ; } public static char [ ] getQualifier ( char [ ] name ) { int firstGenericStart = CharOperation . indexOf ( C_GENERIC_START , name ) ; int lastDot = CharOperation . lastIndexOf ( C_DOT , name , <NUM_LIT:0> , firstGenericStart == - <NUM_LIT:1> ? name . length - <NUM_LIT:1> : firstGenericStart ) ; if ( lastDot == - <NUM_LIT:1> ) { return CharOperation . NO_CHAR ; } return CharOperation . subarray ( name , <NUM_LIT:0> , lastDot ) ; } public static String getQualifier ( String name ) { char [ ] qualifier = getQualifier ( name . toCharArray ( ) ) ; if ( qualifier . length == <NUM_LIT:0> ) return org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ; return new String ( qualifier ) ; } public static char [ ] getReturnType ( char [ ] methodSignature ) throws IllegalArgumentException { int paren = CharOperation . lastIndexOf ( C_PARAM_END , methodSignature ) ; if ( paren == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } int last = Util . scanTypeSignature ( methodSignature , paren + <NUM_LIT:1> ) ; return CharOperation . subarray ( methodSignature , paren + <NUM_LIT:1> , last + <NUM_LIT:1> ) ; } public static String getReturnType ( String methodSignature ) throws IllegalArgumentException { return new String ( getReturnType ( methodSignature . toCharArray ( ) ) ) ; } public static char [ ] getSignatureQualifier ( char [ ] typeSignature ) { if ( typeSignature == null ) return CharOperation . NO_CHAR ; char [ ] qualifiedType = Signature . toCharArray ( typeSignature ) ; int dotCount = <NUM_LIT:0> ; indexFound : for ( int i = <NUM_LIT:0> ; i < typeSignature . length ; i ++ ) { switch ( typeSignature [ i ] ) { case C_DOT : dotCount ++ ; break ; case C_GENERIC_START : break indexFound ; case C_DOLLAR : break indexFound ; } } if ( dotCount > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < qualifiedType . length ; i ++ ) { if ( qualifiedType [ i ] == '<CHAR_LIT:.>' ) { dotCount -- ; } if ( dotCount <= <NUM_LIT:0> ) { return CharOperation . subarray ( qualifiedType , <NUM_LIT:0> , i ) ; } } } return CharOperation . NO_CHAR ; } public static String getSignatureQualifier ( String typeSignature ) { return new String ( getSignatureQualifier ( typeSignature == null ? null : typeSignature . toCharArray ( ) ) ) ; } public static char [ ] getSignatureSimpleName ( char [ ] typeSignature ) { if ( typeSignature == null ) return CharOperation . NO_CHAR ; char [ ] qualifiedType = Signature . toCharArray ( typeSignature ) ; int dotCount = <NUM_LIT:0> ; indexFound : for ( int i = <NUM_LIT:0> ; i < typeSignature . length ; i ++ ) { switch ( typeSignature [ i ] ) { case C_DOT : dotCount ++ ; break ; case C_GENERIC_START : break indexFound ; case C_DOLLAR : break indexFound ; } } if ( dotCount > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < qualifiedType . length ; i ++ ) { if ( qualifiedType [ i ] == '<CHAR_LIT:.>' ) { dotCount -- ; } if ( dotCount <= <NUM_LIT:0> ) { return CharOperation . subarray ( qualifiedType , i + <NUM_LIT:1> , qualifiedType . length ) ; } } } return qualifiedType ; } public static String getSignatureSimpleName ( String typeSignature ) { return new String ( getSignatureSimpleName ( typeSignature == null ? null : typeSignature . toCharArray ( ) ) ) ; } public static char [ ] getSimpleName ( char [ ] name ) { int lastDot = - <NUM_LIT:1> , lastGenericStart = - <NUM_LIT:1> , lastGenericEnd = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; int length = name . length ; lastDotLookup : for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { switch ( name [ i ] ) { case '<CHAR_LIT:.>' : if ( depth == <NUM_LIT:0> ) { lastDot = i ; break lastDotLookup ; } break ; case '<CHAR_LIT>' : depth -- ; if ( depth == <NUM_LIT:0> ) lastGenericStart = i ; break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:0> ) lastGenericEnd = i ; depth ++ ; break ; } } if ( lastGenericStart < <NUM_LIT:0> ) { if ( lastDot < <NUM_LIT:0> ) { return name ; } return CharOperation . subarray ( name , lastDot + <NUM_LIT:1> , length ) ; } StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; int nameStart = lastDot < <NUM_LIT:0> ? <NUM_LIT:0> : lastDot + <NUM_LIT:1> ; buffer . append ( name , nameStart , lastGenericStart - nameStart ) ; appendArgumentSimpleNames ( name , lastGenericStart , lastGenericEnd , buffer ) ; buffer . append ( name , lastGenericEnd + <NUM_LIT:1> , length - lastGenericEnd - <NUM_LIT:1> ) ; char [ ] result = new char [ length = buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , length , result , <NUM_LIT:0> ) ; return result ; } public static String getSimpleName ( String name ) { int lastDot = - <NUM_LIT:1> , lastGenericStart = - <NUM_LIT:1> , lastGenericEnd = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; int length = name . length ( ) ; lastDotLookup : for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { switch ( name . charAt ( i ) ) { case '<CHAR_LIT:.>' : if ( depth == <NUM_LIT:0> ) { lastDot = i ; break lastDotLookup ; } break ; case '<CHAR_LIT>' : depth -- ; if ( depth == <NUM_LIT:0> ) lastGenericStart = i ; break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:0> ) lastGenericEnd = i ; depth ++ ; break ; } } if ( lastGenericStart < <NUM_LIT:0> ) { if ( lastDot < <NUM_LIT:0> ) { return name ; } return name . substring ( lastDot + <NUM_LIT:1> , length ) ; } StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; char [ ] nameChars = name . toCharArray ( ) ; int nameStart = lastDot < <NUM_LIT:0> ? <NUM_LIT:0> : lastDot + <NUM_LIT:1> ; buffer . append ( nameChars , nameStart , lastGenericStart - nameStart ) ; appendArgumentSimpleNames ( nameChars , lastGenericStart , lastGenericEnd , buffer ) ; buffer . append ( nameChars , lastGenericEnd + <NUM_LIT:1> , length - lastGenericEnd - <NUM_LIT:1> ) ; return buffer . toString ( ) ; } private static void appendSimpleName ( char [ ] name , int start , int end , StringBuffer buffer ) { int lastDot = - <NUM_LIT:1> , lastGenericStart = - <NUM_LIT:1> , lastGenericEnd = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; if ( name [ start ] == '<CHAR_LIT>' ) { buffer . append ( "<STR_LIT:?>" ) ; int index = consumeWhitespace ( name , start + <NUM_LIT:1> , end + <NUM_LIT:1> ) ; switch ( name [ index ] ) { case '<CHAR_LIT:e>' : int checkPos = checkName ( EXTENDS , name , index , end ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+0020>' ) . append ( EXTENDS ) . append ( '<CHAR_LIT:U+0020>' ) ; index = consumeWhitespace ( name , checkPos , end + <NUM_LIT:1> ) ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( SUPER , name , index , end + <NUM_LIT:1> ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+0020>' ) . append ( SUPER ) . append ( '<CHAR_LIT:U+0020>' ) ; index = consumeWhitespace ( name , checkPos , end + <NUM_LIT:1> ) ; } break ; } start = index ; } lastDotLookup : for ( int i = end ; i >= start ; i -- ) { switch ( name [ i ] ) { case '<CHAR_LIT:.>' : if ( depth == <NUM_LIT:0> ) { lastDot = i ; char c = name [ start ] ; if ( c == C_EXTENDS || c == C_SUPER ) { buffer . append ( c ) ; } break lastDotLookup ; } break ; case '<CHAR_LIT>' : depth -- ; if ( depth == <NUM_LIT:0> ) lastGenericStart = i ; break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:0> ) lastGenericEnd = i ; depth ++ ; break ; } } int nameStart = lastDot < <NUM_LIT:0> ? start : lastDot + <NUM_LIT:1> ; int nameEnd = lastGenericStart < <NUM_LIT:0> ? end + <NUM_LIT:1> : lastGenericStart ; buffer . append ( name , nameStart , nameEnd - nameStart ) ; if ( lastGenericStart >= <NUM_LIT:0> ) { appendArgumentSimpleNames ( name , lastGenericStart , lastGenericEnd , buffer ) ; buffer . append ( name , lastGenericEnd + <NUM_LIT:1> , end - lastGenericEnd ) ; } } private static void appendArgumentSimpleNames ( char [ ] name , int start , int end , StringBuffer buffer ) { buffer . append ( '<CHAR_LIT>' ) ; int depth = <NUM_LIT:0> ; int argumentStart = - <NUM_LIT:1> ; int argumentCount = <NUM_LIT:0> ; for ( int i = start ; i <= end ; i ++ ) { switch ( name [ i ] ) { case '<CHAR_LIT>' : depth ++ ; if ( depth == <NUM_LIT:1> ) { argumentStart = i + <NUM_LIT:1> ; } break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:1> ) { if ( argumentCount > <NUM_LIT:0> ) buffer . append ( '<CHAR_LIT:U+002C>' ) ; appendSimpleName ( name , argumentStart , i - <NUM_LIT:1> , buffer ) ; argumentCount ++ ; } depth -- ; break ; case '<CHAR_LIT:U+002C>' : if ( depth == <NUM_LIT:1> ) { if ( argumentCount > <NUM_LIT:0> ) buffer . append ( '<CHAR_LIT:U+002C>' ) ; appendSimpleName ( name , argumentStart , i - <NUM_LIT:1> , buffer ) ; argumentCount ++ ; argumentStart = i + <NUM_LIT:1> ; } break ; } } buffer . append ( '<CHAR_LIT:>>' ) ; } public static char [ ] [ ] getSimpleNames ( char [ ] name ) { int length = name == null ? <NUM_LIT:0> : name . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; int wordCount = <NUM_LIT:1> ; countingWords : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) switch ( name [ i ] ) { case C_DOT : wordCount ++ ; break ; case C_GENERIC_START : break countingWords ; } char [ ] [ ] split = new char [ wordCount ] [ ] ; int last = <NUM_LIT:0> , currentWord = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( name [ i ] == C_GENERIC_START ) break ; if ( name [ i ] == C_DOT ) { split [ currentWord ] = new char [ i - last ] ; System . arraycopy ( name , last , split [ currentWord ++ ] , <NUM_LIT:0> , i - last ) ; last = i + <NUM_LIT:1> ; } } split [ currentWord ] = new char [ length - last ] ; System . arraycopy ( name , last , split [ currentWord ] , <NUM_LIT:0> , length - last ) ; return split ; } public static String [ ] getSimpleNames ( String name ) { return CharOperation . toStrings ( getSimpleNames ( name . toCharArray ( ) ) ) ; } public static char [ ] removeCapture ( char [ ] methodOrTypeSignature ) { return CharOperation . remove ( methodOrTypeSignature , C_CAPTURE ) ; } public static String removeCapture ( String methodOrTypeSignature ) { char [ ] array = methodOrTypeSignature . toCharArray ( ) ; char [ ] result = removeCapture ( array ) ; if ( array == result ) return methodOrTypeSignature ; return new String ( result ) ; } public static char [ ] toCharArray ( char [ ] methodSignature , char [ ] methodName , char [ ] [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType ) { return toCharArray ( methodSignature , methodName , parameterNames , fullyQualifyTypeNames , includeReturnType , false ) ; } public static char [ ] toCharArray ( char [ ] methodSignature , char [ ] methodName , char [ ] [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType , boolean isVargArgs ) { int firstParen = CharOperation . indexOf ( C_PARAM_START , methodSignature ) ; if ( firstParen == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } StringBuffer buffer = new StringBuffer ( methodSignature . length + <NUM_LIT:10> ) ; if ( includeReturnType ) { char [ ] rts = getReturnType ( methodSignature ) ; appendTypeSignature ( rts , <NUM_LIT:0> , fullyQualifyTypeNames , buffer ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } if ( methodName != null ) { buffer . append ( methodName ) ; } buffer . append ( '<CHAR_LIT:(>' ) ; char [ ] [ ] pts = getParameterTypes ( methodSignature ) ; for ( int i = <NUM_LIT:0> , max = pts . length ; i < max ; i ++ ) { if ( i == max - <NUM_LIT:1> ) { appendTypeSignature ( pts [ i ] , <NUM_LIT:0> , fullyQualifyTypeNames , buffer , isVargArgs ) ; } else { appendTypeSignature ( pts [ i ] , <NUM_LIT:0> , fullyQualifyTypeNames , buffer ) ; } if ( parameterNames != null ) { buffer . append ( '<CHAR_LIT:U+0020>' ) ; buffer . append ( parameterNames [ i ] ) ; } if ( i != pts . length - <NUM_LIT:1> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; char [ ] result = new char [ buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , buffer . length ( ) , result , <NUM_LIT:0> ) ; return result ; } public static char [ ] toCharArray ( char [ ] signature ) throws IllegalArgumentException { int sigLength = signature . length ; if ( sigLength == <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } if ( signature [ <NUM_LIT:0> ] == C_PARAM_START || signature [ <NUM_LIT:0> ] == C_GENERIC_START ) { return toCharArray ( signature , CharOperation . NO_CHAR , null , true , true ) ; } StringBuffer buffer = new StringBuffer ( signature . length + <NUM_LIT:10> ) ; appendTypeSignature ( signature , <NUM_LIT:0> , true , buffer ) ; char [ ] result = new char [ buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , buffer . length ( ) , result , <NUM_LIT:0> ) ; return result ; } private static int appendTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { return appendTypeSignature ( string , start , fullyQualifyTypeNames , buffer , false ) ; } private static int appendTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer , boolean isVarArgs ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( isVarArgs ) { switch ( c ) { case C_ARRAY : return appendArrayTypeSignature ( string , start , fullyQualifyTypeNames , buffer , true ) ; case C_RESOLVED : case C_UNRESOLVED : case C_TYPE_VARIABLE : case C_BOOLEAN : case C_BYTE : case C_CHAR : case C_DOUBLE : case C_FLOAT : case C_INT : case C_LONG : case C_SHORT : case C_VOID : case C_STAR : case C_EXTENDS : case C_SUPER : case C_CAPTURE : default : throw new IllegalArgumentException ( ) ; } } else { switch ( c ) { case C_ARRAY : return appendArrayTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_RESOLVED : case C_UNRESOLVED : return appendClassTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_TYPE_VARIABLE : int e = Util . scanTypeVariableSignature ( string , start ) ; buffer . append ( string , start + <NUM_LIT:1> , e - start - <NUM_LIT:1> ) ; return e ; case C_BOOLEAN : buffer . append ( BOOLEAN ) ; return start ; case C_BYTE : buffer . append ( BYTE ) ; return start ; case C_CHAR : buffer . append ( CHAR ) ; return start ; case C_DOUBLE : buffer . append ( DOUBLE ) ; return start ; case C_FLOAT : buffer . append ( FLOAT ) ; return start ; case C_INT : buffer . append ( INT ) ; return start ; case C_LONG : buffer . append ( LONG ) ; return start ; case C_SHORT : buffer . append ( SHORT ) ; return start ; case C_VOID : buffer . append ( VOID ) ; return start ; case C_CAPTURE : return appendCaptureTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_STAR : case C_EXTENDS : case C_SUPER : return appendTypeArgumentSignature ( string , start , fullyQualifyTypeNames , buffer ) ; default : throw new IllegalArgumentException ( ) ; } } } private static int appendArrayTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { return appendArrayTypeSignature ( string , start , fullyQualifyTypeNames , buffer , false ) ; } private static int appendCaptureTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_CAPTURE ) { throw new IllegalArgumentException ( ) ; } buffer . append ( CAPTURE ) . append ( '<CHAR_LIT:U+0020>' ) ; return appendTypeArgumentSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; } private static int appendArrayTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer , boolean isVarArgs ) { int length = string . length ; if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_ARRAY ) { throw new IllegalArgumentException ( ) ; } int index = start ; c = string [ ++ index ] ; while ( c == C_ARRAY ) { if ( index >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ index ] ; } int e = appendTypeSignature ( string , index , fullyQualifyTypeNames , buffer ) ; for ( int i = <NUM_LIT:1> , dims = index - start ; i < dims ; i ++ ) { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } if ( isVarArgs ) { buffer . append ( '<CHAR_LIT:.>' ) . append ( '<CHAR_LIT:.>' ) . append ( '<CHAR_LIT:.>' ) ; } else { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } return e ; } private static int appendClassTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_RESOLVED && c != C_UNRESOLVED ) { throw new IllegalArgumentException ( ) ; } boolean resolved = ( c == C_RESOLVED ) ; boolean removePackageQualifiers = ! fullyQualifyTypeNames ; if ( ! resolved ) { removePackageQualifiers = false ; } int p = start + <NUM_LIT:1> ; int checkpoint = buffer . length ( ) ; int innerTypeStart = - <NUM_LIT:1> ; boolean inAnonymousType = false ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; switch ( c ) { case C_SEMICOLON : return p ; case C_GENERIC_START : int e = appendTypeArgumentSignatures ( string , p , fullyQualifyTypeNames , buffer ) ; removePackageQualifiers = false ; p = e ; break ; case C_DOT : if ( removePackageQualifiers ) { buffer . setLength ( checkpoint ) ; } else { buffer . append ( '<CHAR_LIT:.>' ) ; } break ; case '<CHAR_LIT:/>' : if ( removePackageQualifiers ) { buffer . setLength ( checkpoint ) ; } else { buffer . append ( '<CHAR_LIT:/>' ) ; } break ; case C_DOLLAR : innerTypeStart = buffer . length ( ) ; inAnonymousType = false ; if ( resolved ) { removePackageQualifiers = false ; buffer . append ( '<CHAR_LIT:.>' ) ; } break ; default : if ( innerTypeStart != - <NUM_LIT:1> && ! inAnonymousType && Character . isDigit ( c ) ) { inAnonymousType = true ; buffer . setLength ( innerTypeStart ) ; buffer . insert ( checkpoint , "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; } if ( ! inAnonymousType ) buffer . append ( c ) ; innerTypeStart = - <NUM_LIT:1> ; } p ++ ; } } private static int appendTypeArgumentSignatures ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_GENERIC_START ) { throw new IllegalArgumentException ( ) ; } buffer . append ( '<CHAR_LIT>' ) ; int p = start + <NUM_LIT:1> ; int count = <NUM_LIT:0> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; if ( c == C_GENERIC_END ) { buffer . append ( '<CHAR_LIT:>>' ) ; return p ; } if ( count != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } int e = appendTypeArgumentSignature ( string , p , fullyQualifyTypeNames , buffer ) ; count ++ ; p = e + <NUM_LIT:1> ; } } private static int appendTypeArgumentSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case C_STAR : buffer . append ( '<CHAR_LIT>' ) ; return start ; case C_EXTENDS : buffer . append ( "<STR_LIT>" ) ; return appendTypeSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; case C_SUPER : buffer . append ( "<STR_LIT>" ) ; return appendTypeSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; default : return appendTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; } } public static char [ ] toQualifiedName ( char [ ] [ ] segments ) { int length = segments . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR ; if ( length == <NUM_LIT:1> ) return segments [ <NUM_LIT:0> ] ; int resultLength = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { resultLength += segments [ i ] . length + <NUM_LIT:1> ; } resultLength -- ; char [ ] result = new char [ resultLength ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] segment = segments [ i ] ; int segmentLength = segment . length ; System . arraycopy ( segment , <NUM_LIT:0> , result , index , segmentLength ) ; index += segmentLength ; if ( i != length - <NUM_LIT:1> ) { result [ index ++ ] = C_DOT ; } } return result ; } public static String toQualifiedName ( String [ ] segments ) { int length = segments . length ; char [ ] [ ] charArrays = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { charArrays [ i ] = segments [ i ] . toCharArray ( ) ; } return new String ( toQualifiedName ( charArrays ) ) ; } public static String toString ( String signature ) throws IllegalArgumentException { return new String ( toCharArray ( signature . toCharArray ( ) ) ) ; } public static String toString ( String methodSignature , String methodName , String [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType ) { return toString ( methodSignature , methodName , parameterNames , fullyQualifyTypeNames , includeReturnType , false ) ; } public static String toString ( String methodSignature , String methodName , String [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType , boolean isVarArgs ) { char [ ] [ ] params ; if ( parameterNames == null ) { params = null ; } else { int paramLength = parameterNames . length ; params = new char [ paramLength ] [ ] ; for ( int i = <NUM_LIT:0> ; i < paramLength ; i ++ ) { params [ i ] = parameterNames [ i ] . toCharArray ( ) ; } } return new String ( toCharArray ( methodSignature . toCharArray ( ) , methodName == null ? null : methodName . toCharArray ( ) , params , fullyQualifyTypeNames , includeReturnType , isVarArgs ) ) ; } } </s>
<s> package org . eclipse . jdt . core ; public interface IBufferFactory { IBuffer createBuffer ( IOpenable owner ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IField extends IMember , IAnnotatable { public Object getConstant ( ) throws JavaModelException ; String getElementName ( ) ; String getKey ( ) ; String getTypeSignature ( ) throws JavaModelException ; boolean isEnumConstant ( ) throws JavaModelException ; boolean isResolved ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IImportContainer extends IJavaElement , IParent , ISourceReference { IImportDeclaration getImport ( String name ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . core . util . KeyKind ; import org . eclipse . jdt . internal . core . util . KeyToSignature ; public final class BindingKey { private String key ; public BindingKey ( String key ) { this . key = key ; } public static String createArrayTypeBindingKey ( String typeKey , int arrayDimension ) { StringBuffer buffer = new StringBuffer ( ) ; while ( arrayDimension -- > <NUM_LIT:0> ) buffer . append ( '<CHAR_LIT:[>' ) ; buffer . append ( typeKey ) ; return buffer . toString ( ) ; } public static String createParameterizedTypeBindingKey ( String genericTypeKey , String [ ] argumentTypeKeys ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( Signature . getTypeErasure ( genericTypeKey ) ) ; buffer . insert ( buffer . length ( ) - <NUM_LIT:1> , '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = argumentTypeKeys . length ; i < length ; i ++ ) { String argumentTypeKey = argumentTypeKeys [ i ] ; buffer . insert ( buffer . length ( ) - <NUM_LIT:1> , argumentTypeKey ) ; } buffer . insert ( buffer . length ( ) - <NUM_LIT:1> , '<CHAR_LIT:>>' ) ; return buffer . toString ( ) ; } public static String createTypeBindingKey ( String typeName ) { return Signature . createTypeSignature ( typeName . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) , true ) ; } public static String createTypeVariableBindingKey ( String typeVariableName , String declaringKey ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( declaringKey ) ; buffer . append ( '<CHAR_LIT::>' ) ; buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( typeVariableName ) ; buffer . append ( '<CHAR_LIT:;>' ) ; return buffer . toString ( ) ; } public static String createWilcardTypeBindingKey ( String typeKey , char kind ) { switch ( kind ) { case Signature . C_STAR : return "<STR_LIT:*>" ; case Signature . C_SUPER : return '<CHAR_LIT:->' + typeKey ; case Signature . C_EXTENDS : return '<CHAR_LIT>' + typeKey ; } return null ; } public static String createWildcardTypeBindingKey ( String genericTypeKey , char boundKind , String boundTypeKey , int rank ) { String wildCardKey ; switch ( boundKind ) { case Signature . C_STAR : wildCardKey = new String ( TypeConstants . WILDCARD_STAR ) ; break ; case Signature . C_SUPER : wildCardKey = new String ( TypeConstants . WILDCARD_MINUS ) + boundTypeKey ; break ; case Signature . C_EXTENDS : wildCardKey = new String ( TypeConstants . WILDCARD_PLUS ) + boundTypeKey ; break ; default : return null ; } return genericTypeKey + '<CHAR_LIT>' + rank + '<CHAR_LIT:}>' + wildCardKey ; } public String [ ] getThrownExceptions ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . THROWN_EXCEPTIONS ) ; keyToSignature . parse ( ) ; return keyToSignature . getThrownExceptions ( ) ; } public String [ ] getTypeArguments ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . TYPE_ARGUMENTS ) ; keyToSignature . parse ( ) ; return keyToSignature . getTypeArguments ( ) ; } public boolean isRawType ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_RAW_TYPE ) != <NUM_LIT:0> ; } public boolean isParameterizedType ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_PARAMETERIZED_TYPE ) != <NUM_LIT:0> ; } public boolean isParameterizedMethod ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_PARAMETERIZED_METHOD ) != <NUM_LIT:0> ; } public String toSignature ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . SIGNATURE ) ; keyToSignature . parse ( ) ; return keyToSignature . signature . toString ( ) ; } public String toString ( ) { return this . key ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IMarker ; public interface IJavaModelMarker { String JAVA_MODEL_PROBLEM_MARKER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String TRANSIENT_PROBLEM = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String TASK_MARKER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String ARGUMENTS = "<STR_LIT>" ; String ID = "<STR_LIT:id>" ; String CATEGORY_ID = "<STR_LIT>" ; String FLAGS = "<STR_LIT>" ; String CYCLE_DETECTED = "<STR_LIT>" ; String BUILDPATH_PROBLEM_MARKER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String CLASSPATH_FILE_FORMAT = "<STR_LIT>" ; } </s>
<s> package org . eclipse . jdt . core . eval ; public interface IGlobalVariable { public String getInitializer ( ) ; public String getName ( ) ; public String getTypeName ( ) ; } </s>
<s> package org . eclipse . jdt . core . eval ; import org . eclipse . core . resources . IMarker ; import org . eclipse . jdt . internal . eval . EvaluationConstants ; public interface ICodeSnippetRequestor { public static final String LOCAL_VAR_PREFIX = new String ( EvaluationConstants . LOCAL_VAR_PREFIX ) ; public static final String DELEGATE_THIS = new String ( EvaluationConstants . DELEGATE_THIS ) ; public static final String RUN_METHOD = EvaluationConstants . RUN_METHOD ; public static final String RESULT_VALUE_FIELD = EvaluationConstants . RESULT_VALUE_FIELD ; public static final String RESULT_TYPE_FIELD = EvaluationConstants . RESULT_TYPE_FIELD ; public static final int VARIABLE = <NUM_LIT:1> ; public static final int CODE_SNIPPET = <NUM_LIT:2> ; public static final int IMPORT = <NUM_LIT:3> ; public static final int PACKAGE = <NUM_LIT:4> ; public static final int INTERNAL = <NUM_LIT:5> ; public boolean acceptClassFiles ( byte [ ] [ ] classFileBytes , String [ ] [ ] classFileCompoundNames , String codeSnippetClassName ) ; public void acceptProblem ( IMarker problemMarker , String fragmentSource , int fragmentKind ) ; } </s>
<s> package org . eclipse . jdt . core . eval ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; public interface IEvaluationContext { public IGlobalVariable [ ] allVariables ( ) ; public void codeComplete ( String codeSnippet , int position , ICompletionRequestor requestor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; public IJavaElement [ ] codeSelect ( String codeSnippet , int offset , int length ) throws JavaModelException ; public IJavaElement [ ] codeSelect ( String codeSnippet , int offset , int length , WorkingCopyOwner owner ) throws JavaModelException ; public void deleteVariable ( IGlobalVariable variable ) ; public void evaluateCodeSnippet ( String codeSnippet , String [ ] localVariableTypeNames , String [ ] localVariableNames , int [ ] localVariableModifiers , IType declaringType , boolean isStatic , boolean isConstructorCall , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException ; public void evaluateCodeSnippet ( String codeSnippet , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException ; public void evaluateVariable ( IGlobalVariable variable , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException ; public String [ ] getImports ( ) ; public String getPackageName ( ) ; public IJavaProject getProject ( ) ; public IGlobalVariable newVariable ( String typeName , String name , String initializer ) ; public void setImports ( String [ ] imports ) ; public void setPackageName ( String packageName ) ; public void validateImports ( ICodeSnippetRequestor requestor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , org . eclipse . jdt . core . ICodeCompletionRequestor requestor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface ITypeParameter extends IJavaElement , ISourceReference { String [ ] getBounds ( ) throws JavaModelException ; String [ ] getBoundsSignatures ( ) throws JavaModelException ; IMember getDeclaringMember ( ) ; ISourceRange getNameRange ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Plugin ; import org . eclipse . core . runtime . QualifiedName ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IMarkerDelta ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceChangeListener ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . IWorkspaceRunnable ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . search . IJavaSearchConstants ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . core . search . SearchEngine ; import org . eclipse . jdt . core . search . SearchPattern ; import org . eclipse . jdt . core . search . TypeNameRequestor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . core . builder . State ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import org . osgi . framework . BundleContext ; public final class JavaCore extends Plugin { private static final IResource [ ] NO_GENERATED_RESOURCES = new IResource [ <NUM_LIT:0> ] ; private static Plugin JAVA_CORE_PLUGIN = null ; public static final String PLUGIN_ID = "<STR_LIT>" ; public static final String BUILDER_ID = PLUGIN_ID + "<STR_LIT>" ; public static final String MODEL_ID = PLUGIN_ID + "<STR_LIT>" ; public static final String NATURE_ID = PLUGIN_ID + "<STR_LIT>" ; protected static final String ATT_HANDLE_ID = "<STR_LIT>" ; public static final String USER_LIBRARY_CONTAINER_ID = "<STR_LIT>" ; public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_CODEGEN_INLINE_JSR_BYTECODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_DOC_COMMENT_SUPPORT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD = "<STR_LIT>" ; public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_TYPE_ARGUMENTS_FOR_METHOD_INVOCATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_ENUM_IDENTIFIER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INDIRECT_STATIC_ACCESS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_LOCAL_VARIABLE_HIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FIELD_HIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_TYPE_PARAMETER_HIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FALLTHROUGH_CASE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_EMPTY_STATEMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_BOOLEAN_METHOD_THROWING_EXCEPTION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNNECESSARY_TYPE_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNNECESSARY_ELSE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_EXEMPT_EXCEPTION_AND_THROWABLE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNQUALIFIED_FIELD_ACCESS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNSAFE_TYPE_OPERATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNCHECKED_TYPE_OPERATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_RAW_TYPE_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FINAL_PARAMETER_BOUND = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_SERIAL_VERSION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_AUTOBOXING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_ANNOTATION_SUPER_INTERFACE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_OVERRIDE_ANNOTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_DEPRECATED_ANNOTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_HASHCODE_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEAD_CODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEAD_CODE_IN_TRIVIAL_IF_STATEMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCOMPLETE_ENUM_SWITCH = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCONSISTENT_NULL_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_LABEL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_COMMENTS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FATAL_OPTIONAL_ERROR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_PARAMETER_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_SOURCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_COMPLIANCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_TASK_TAGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_TASK_CASE_SENSITIVE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FORBIDDEN_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DISCOURAGED_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SUPPRESS_WARNINGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNHANDLED_WARNING_TOKEN = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_WARNING_TOKEN = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NULL_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_POTENTIAL_NULL_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_REDUNDANT_NULL_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_OVERRIDING_METHOD_WITHOUT_SUPER_INVOCATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_COMPARING_IDENTICAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_OBJECT_ALLOCATION = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_INCOMPATIBLE_JDK_LEVEL = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_ENCODING = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + "<STR_LIT>" ; public static final String TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_DEPRECATION_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_CAMEL_CASE_MATCH = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FINAL_FIELD_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_FORBIDDEN_REFERENCE_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_DISCOURAGED_REFERENCE_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_SUGGEST_STATIC_IMPORTS = PLUGIN_ID + "<STR_LIT>" ; public static final String DEFAULT_TASK_TAG = "<STR_LIT>" ; public static final String DEFAULT_TASK_PRIORITY = "<STR_LIT>" ; public static final String DEFAULT_TASK_TAGS = "<STR_LIT>" ; public static final String DEFAULT_TASK_PRIORITIES = "<STR_LIT>" ; public static final String GENERATE = "<STR_LIT>" ; public static final String DO_NOT_GENERATE = "<STR_LIT>" ; public static final String PRESERVE = "<STR_LIT>" ; public static final String OPTIMIZE_OUT = "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITY_HIGH = "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITY_LOW = "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITY_NORMAL = "<STR_LIT>" ; public static final String VERSION_1_1 = "<STR_LIT>" ; public static final String VERSION_1_2 = "<STR_LIT>" ; public static final String VERSION_1_3 = "<STR_LIT>" ; public static final String VERSION_1_4 = "<STR_LIT>" ; public static final String VERSION_1_5 = "<STR_LIT>" ; public static final String VERSION_1_6 = "<STR_LIT>" ; public static final String VERSION_1_7 = "<STR_LIT>" ; public static final String VERSION_CLDC_1_1 = "<STR_LIT>" ; public static final String ABORT = "<STR_LIT>" ; public static final String ERROR = "<STR_LIT:error>" ; public static final String WARNING = "<STR_LIT>" ; public static final String IGNORE = "<STR_LIT>" ; public static final String COMPUTE = "<STR_LIT>" ; public static final String INSERT = "<STR_LIT>" ; public static final String DO_NOT_INSERT = "<STR_LIT>" ; public static final String PRESERVE_ONE = "<STR_LIT>" ; public static final String CLEAR_ALL = "<STR_LIT>" ; public static final String NORMAL = "<STR_LIT>" ; public static final String COMPACT = "<STR_LIT>" ; public static final String TAB = "<STR_LIT>" ; public static final String SPACE = "<STR_LIT>" ; public static final String ENABLED = "<STR_LIT>" ; public static final String DISABLED = "<STR_LIT>" ; public static final String CLEAN = "<STR_LIT>" ; public static final String PUBLIC = "<STR_LIT>" ; public static final String PROTECTED = "<STR_LIT>" ; public static final String DEFAULT = "<STR_LIT:default>" ; public static final String PRIVATE = "<STR_LIT>" ; public static final String NEVER = "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_NO_TAG = CompilerOptions . NO_TAG ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_RETURN_TAG = CompilerOptions . RETURN_TAG ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_STANDARD_TAGS = CompilerOptions . ALL_STANDARD_TAGS ; public static final String JAVA_SOURCE_CONTENT_TYPE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public JavaCore ( ) { super ( ) ; JAVA_CORE_PLUGIN = this ; } public static void addElementChangedListener ( IElementChangedListener listener ) { addElementChangedListener ( listener , ElementChangedEvent . POST_CHANGE | ElementChangedEvent . POST_RECONCILE ) ; } public static void addElementChangedListener ( IElementChangedListener listener , int eventMask ) { JavaModelManager . getDeltaState ( ) . addElementChangedListener ( listener , eventMask ) ; } public static void addJavaElementMarkerAttributes ( Map attributes , IJavaElement element ) { if ( element instanceof IMember ) element = ( ( IMember ) element ) . getClassFile ( ) ; if ( attributes != null && element != null ) attributes . put ( ATT_HANDLE_ID , element . getHandleIdentifier ( ) ) ; } private static void addNonJavaResources ( Object [ ] nonJavaResources , IContainer container , int rootPathSegmentCounts , ArrayList collector ) { for ( int i = <NUM_LIT:0> , max = nonJavaResources . length ; i < max ; i ++ ) { Object nonJavaResource = nonJavaResources [ i ] ; if ( nonJavaResource instanceof IFile ) { IFile file = ( IFile ) nonJavaResource ; IPath path = file . getFullPath ( ) . removeFirstSegments ( rootPathSegmentCounts ) ; IResource member = container . findMember ( path ) ; if ( member != null && member . exists ( ) ) { collector . add ( member ) ; } } else if ( nonJavaResource instanceof IFolder ) { IFolder folder = ( IFolder ) nonJavaResource ; IResource [ ] members = null ; try { members = folder . members ( ) ; } catch ( CoreException e ) { } if ( members != null ) { addNonJavaResources ( members , container , rootPathSegmentCounts , collector ) ; } } } } public static void addPreProcessingResourceChangedListener ( IResourceChangeListener listener ) { addPreProcessingResourceChangedListener ( listener , IResourceChangeEvent . POST_CHANGE ) ; } public static void addPreProcessingResourceChangedListener ( IResourceChangeListener listener , int eventMask ) { JavaModelManager . getDeltaState ( ) . addPreResourceChangedListener ( listener , eventMask ) ; } public void configureJavaElementMarker ( IMarker marker , IJavaElement element ) throws CoreException { if ( element instanceof IMember ) element = ( ( IMember ) element ) . getClassFile ( ) ; if ( marker != null && element != null ) marker . setAttribute ( ATT_HANDLE_ID , element . getHandleIdentifier ( ) ) ; } public static IJavaElement create ( String handleIdentifier ) { return create ( handleIdentifier , DefaultWorkingCopyOwner . PRIMARY ) ; } public static IJavaElement create ( String handleIdentifier , WorkingCopyOwner owner ) { if ( handleIdentifier == null ) { return null ; } if ( owner == null ) owner = DefaultWorkingCopyOwner . PRIMARY ; MementoTokenizer memento = new MementoTokenizer ( handleIdentifier ) ; JavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; return model . getHandleFromMemento ( memento , owner ) ; } public static IJavaElement create ( IFile file ) { return JavaModelManager . create ( file , null ) ; } public static IJavaElement create ( IFolder folder ) { return JavaModelManager . create ( folder , null ) ; } public static IJavaProject create ( IProject project ) { if ( project == null ) { return null ; } JavaModel javaModel = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; return javaModel . getJavaProject ( project ) ; } public static IJavaElement create ( IResource resource ) { return JavaModelManager . create ( resource , null ) ; } public static IJavaElement create ( IResource resource , IJavaProject project ) { return JavaModelManager . create ( resource , project ) ; } public static IJavaModel create ( IWorkspaceRoot root ) { if ( root == null ) { return null ; } return JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; } public static IClassFile createClassFileFrom ( IFile file ) { return JavaModelManager . createClassFileFrom ( file , null ) ; } public static ICompilationUnit createCompilationUnitFrom ( IFile file ) { return JavaModelManager . createCompilationUnitFrom ( file , null ) ; } public static IPackageFragmentRoot createJarPackageFragmentRootFrom ( IFile file ) { return JavaModelManager . createJarPackageFragmentRootFrom ( file , null ) ; } public static IClasspathContainer getClasspathContainer ( IPath containerPath , IJavaProject project ) throws JavaModelException { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IClasspathContainer container = manager . getClasspathContainer ( containerPath , project ) ; if ( container == JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) { return manager . getPreviousSessionContainer ( containerPath , project ) ; } return container ; } public static ClasspathContainerInitializer getClasspathContainerInitializer ( String containerID ) { Hashtable containerInitializersCache = JavaModelManager . getJavaModelManager ( ) . containerInitializersCache ; ClasspathContainerInitializer initializer = ( ClasspathContainerInitializer ) containerInitializersCache . get ( containerID ) ; if ( initializer == null ) { initializer = computeClasspathContainerInitializer ( containerID ) ; if ( initializer == null ) return null ; containerInitializersCache . put ( containerID , initializer ) ; } return initializer ; } private static ClasspathContainerInitializer computeClasspathContainerInitializer ( String containerID ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPCONTAINER_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { IConfigurationElement configurationElement = configElements [ j ] ; String initializerID = configurationElement . getAttribute ( "<STR_LIT:id>" ) ; if ( initializerID != null && initializerID . equals ( containerID ) ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_found_container_initializer ( containerID , configurationElement ) ; try { Object execExt = configurationElement . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( execExt instanceof ClasspathContainerInitializer ) { return ( ClasspathContainerInitializer ) execExt ; } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_failed_to_instanciate_container_initializer ( containerID , configurationElement ) ; e . printStackTrace ( ) ; } } } } } } return null ; } private static void verbose_failed_to_instanciate_container_initializer ( String containerID , IConfigurationElement configurationElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + containerID + '<STR_LIT:\n>' + "<STR_LIT>" + configurationElement . getAttribute ( "<STR_LIT:class>" ) , System . err ) ; } private static void verbose_found_container_initializer ( String containerID , IConfigurationElement configurationElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + containerID + '<STR_LIT:\n>' + "<STR_LIT>" + configurationElement . getAttribute ( "<STR_LIT:class>" ) ) ; } public static IPath getClasspathVariable ( final String variableName ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IPath variablePath = manager . variableGet ( variableName ) ; if ( variablePath == JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) { return manager . getPreviousSessionVariable ( variableName ) ; } if ( variablePath != null ) { if ( variablePath == JavaModelManager . CP_ENTRY_IGNORE_PATH ) return null ; return variablePath ; } final ClasspathVariableInitializer initializer = JavaCore . getClasspathVariableInitializer ( variableName ) ; if ( initializer != null ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE ) verbose_triggering_variable_initialization ( variableName , initializer ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_triggering_variable_initialization_invocation_trace ( ) ; manager . variablePut ( variableName , JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) ; boolean ok = false ; try { initializer . initialize ( variableName ) ; variablePath = manager . variableGet ( variableName ) ; if ( variablePath == JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) return null ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_variable_value_after_initialization ( variableName , variablePath ) ; manager . variablesWithInitializer . add ( variableName ) ; ok = true ; } catch ( RuntimeException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } catch ( Error e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } finally { if ( ! ok ) JavaModelManager . getJavaModelManager ( ) . variablePut ( variableName , null ) ; } } else { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) verbose_no_variable_initializer_found ( variableName ) ; } return variablePath ; } private static void verbose_no_variable_initializer_found ( String variableName ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName ) ; } private static void verbose_variable_value_after_initialization ( String variableName , IPath variablePath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName + '<STR_LIT:\n>' + "<STR_LIT>" + variablePath ) ; } private static void verbose_triggering_variable_initialization ( String variableName , ClasspathVariableInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private static void verbose_triggering_variable_initialization_invocation_trace ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public static String getClasspathVariableDeprecationMessage ( String variableName ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; String message = ( String ) manager . deprecatedVariables . get ( variableName ) ; if ( message != null ) { return message ; } IPath variablePath = manager . variableGet ( variableName ) ; if ( variablePath != null && variablePath != JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) { return null ; } Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPVARIABLE_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { IConfigurationElement configElement = configElements [ j ] ; String varAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( variableName . equals ( varAttribute ) ) { String deprecatedAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( deprecatedAttribute != null ) { return deprecatedAttribute ; } } } } } return null ; } public static ClasspathVariableInitializer getClasspathVariableInitializer ( String variable ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPVARIABLE_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { IConfigurationElement configElement = configElements [ j ] ; try { String varAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( variable . equals ( varAttribute ) ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_found_variable_initializer ( variable , configElement ) ; Object execExt = configElement . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( execExt instanceof ClasspathVariableInitializer ) { ClasspathVariableInitializer initializer = ( ClasspathVariableInitializer ) execExt ; String deprecatedAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( deprecatedAttribute != null ) { JavaModelManager . getJavaModelManager ( ) . deprecatedVariables . put ( variable , deprecatedAttribute ) ; } String readOnlyAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( JavaModelManager . TRUE . equals ( readOnlyAttribute ) ) { JavaModelManager . getJavaModelManager ( ) . readOnlyVariables . add ( variable ) ; } return initializer ; } } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_failed_to_instanciate_variable_initializer ( variable , configElement ) ; e . printStackTrace ( ) ; } } } } } return null ; } private static void verbose_failed_to_instanciate_variable_initializer ( String variable , IConfigurationElement configElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variable + '<STR_LIT:\n>' + "<STR_LIT>" + configElement . getAttribute ( "<STR_LIT:class>" ) , System . err ) ; } private static void verbose_found_variable_initializer ( String variable , IConfigurationElement configElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variable + '<STR_LIT:\n>' + "<STR_LIT>" + configElement . getAttribute ( "<STR_LIT:class>" ) ) ; } public static String [ ] getClasspathVariableNames ( ) { return JavaModelManager . getJavaModelManager ( ) . variableNames ( ) ; } public static Hashtable getDefaultOptions ( ) { return JavaModelManager . getJavaModelManager ( ) . getDefaultOptions ( ) ; } public static String getEncoding ( ) { try { return ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getDefaultCharset ( ) ; } catch ( IllegalStateException ise ) { return System . getProperty ( "<STR_LIT>" ) ; } catch ( CoreException ce ) { } return ResourcesPlugin . getEncoding ( ) ; } public static IResource [ ] getGeneratedResources ( IRegion region , boolean includesNonJavaResources ) { if ( region == null ) throw new IllegalArgumentException ( "<STR_LIT>" ) ; IJavaElement [ ] elements = region . getElements ( ) ; HashMap projectsStates = new HashMap ( ) ; ArrayList collector = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> , max = elements . length ; i < max ; i ++ ) { IJavaElement element = elements [ i ] ; IJavaProject javaProject = element . getJavaProject ( ) ; IProject project = javaProject . getProject ( ) ; State state = null ; State currentState = ( State ) projectsStates . get ( project ) ; if ( currentState != null ) { state = currentState ; } else { state = ( State ) JavaModelManager . getJavaModelManager ( ) . getLastBuiltState ( project , null ) ; if ( state != null ) { projectsStates . put ( project , state ) ; } } if ( state == null ) continue ; if ( element . getElementType ( ) == IJavaElement . JAVA_PROJECT ) { IPackageFragmentRoot [ ] roots = null ; try { roots = javaProject . getPackageFragmentRoots ( ) ; } catch ( JavaModelException e ) { } if ( roots == null ) continue ; IRegion region2 = JavaCore . newRegion ( ) ; for ( int j = <NUM_LIT:0> ; j < roots . length ; j ++ ) { region2 . add ( roots [ j ] ) ; } IResource [ ] res = getGeneratedResources ( region2 , includesNonJavaResources ) ; for ( int j = <NUM_LIT:0> , max2 = res . length ; j < max2 ; j ++ ) { collector . add ( res [ j ] ) ; } continue ; } IPath outputLocation = null ; try { outputLocation = javaProject . getOutputLocation ( ) ; } catch ( JavaModelException e ) { } IJavaElement root = element ; while ( root != null && root . getElementType ( ) != IJavaElement . PACKAGE_FRAGMENT_ROOT ) { root = root . getParent ( ) ; } if ( root == null ) continue ; IPackageFragmentRoot packageFragmentRoot = ( IPackageFragmentRoot ) root ; int rootPathSegmentCounts = packageFragmentRoot . getPath ( ) . segmentCount ( ) ; try { IClasspathEntry entry = packageFragmentRoot . getRawClasspathEntry ( ) ; IPath entryOutputLocation = entry . getOutputLocation ( ) ; if ( entryOutputLocation != null ) { outputLocation = entryOutputLocation ; } } catch ( JavaModelException e ) { e . printStackTrace ( ) ; } if ( outputLocation == null ) continue ; IContainer container = ( IContainer ) project . getWorkspace ( ) . getRoot ( ) . findMember ( outputLocation ) ; switch ( element . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : ICompilationUnit unit = ( ICompilationUnit ) element ; getGeneratedResource ( unit , container , state , rootPathSegmentCounts , collector ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : IPackageFragment fragment = ( IPackageFragment ) element ; ICompilationUnit [ ] compilationUnits = null ; try { compilationUnits = fragment . getCompilationUnits ( ) ; } catch ( JavaModelException e ) { } if ( compilationUnits == null ) continue ; for ( int j = <NUM_LIT:0> , max2 = compilationUnits . length ; j < max2 ; j ++ ) { getGeneratedResource ( compilationUnits [ j ] , container , state , rootPathSegmentCounts , collector ) ; } if ( includesNonJavaResources ) { Object [ ] nonJavaResources = null ; try { nonJavaResources = fragment . getNonJavaResources ( ) ; } catch ( JavaModelException e ) { } if ( nonJavaResources != null ) { addNonJavaResources ( nonJavaResources , container , rootPathSegmentCounts , collector ) ; } } break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : IPackageFragmentRoot fragmentRoot = ( IPackageFragmentRoot ) element ; if ( fragmentRoot . isArchive ( ) ) continue ; IJavaElement [ ] children = null ; try { children = fragmentRoot . getChildren ( ) ; } catch ( JavaModelException e ) { } if ( children == null ) continue ; for ( int j = <NUM_LIT:0> , max2 = children . length ; j < max2 ; j ++ ) { fragment = ( IPackageFragment ) children [ j ] ; ICompilationUnit [ ] units = null ; try { units = fragment . getCompilationUnits ( ) ; } catch ( JavaModelException e ) { } if ( units == null ) continue ; for ( int n = <NUM_LIT:0> , max3 = units . length ; n < max3 ; n ++ ) { getGeneratedResource ( units [ n ] , container , state , rootPathSegmentCounts , collector ) ; } if ( includesNonJavaResources ) { Object [ ] nonJavaResources = null ; try { nonJavaResources = fragment . getNonJavaResources ( ) ; } catch ( JavaModelException e ) { } if ( nonJavaResources != null ) { addNonJavaResources ( nonJavaResources , container , rootPathSegmentCounts , collector ) ; } } } break ; } } int size = collector . size ( ) ; if ( size != <NUM_LIT:0> ) { IResource [ ] result = new IResource [ size ] ; collector . toArray ( result ) ; return result ; } return NO_GENERATED_RESOURCES ; } private static void getGeneratedResource ( ICompilationUnit unit , IContainer container , State state , int rootPathSegmentCounts , ArrayList collector ) { IResource resource = unit . getResource ( ) ; char [ ] [ ] typeNames = state . getDefinedTypeNamesFor ( resource . getProjectRelativePath ( ) . toString ( ) ) ; if ( typeNames != null ) { IPath path = unit . getPath ( ) . removeFirstSegments ( rootPathSegmentCounts ) . removeLastSegments ( <NUM_LIT:1> ) ; for ( int j = <NUM_LIT:0> , max2 = typeNames . length ; j < max2 ; j ++ ) { IPath localPath = path . append ( new String ( typeNames [ j ] ) + "<STR_LIT:.class>" ) ; IResource member = container . findMember ( localPath ) ; if ( member != null && member . exists ( ) ) { collector . add ( member ) ; } } } else { IPath path = unit . getPath ( ) . removeFirstSegments ( rootPathSegmentCounts ) . removeLastSegments ( <NUM_LIT:1> ) ; path = path . append ( Util . getNameWithoutJavaLikeExtension ( unit . getElementName ( ) ) + "<STR_LIT:.class>" ) ; IResource member = container . findMember ( path ) ; if ( member != null && member . exists ( ) ) { collector . add ( member ) ; } } } public static JavaCore getJavaCore ( ) { return ( JavaCore ) getPlugin ( ) ; } public static String [ ] getJavaLikeExtensions ( ) { return CharOperation . toStrings ( Util . getJavaLikeExtensions ( ) ) ; } public static String getOption ( String optionName ) { return JavaModelManager . getJavaModelManager ( ) . getOption ( optionName ) ; } public static String getOptionForConfigurableSeverity ( int problemID ) { return CompilerOptions . optionKeyFromIrritant ( ProblemReporter . getIrritant ( problemID ) ) ; } public static Hashtable getOptions ( ) { return JavaModelManager . getJavaModelManager ( ) . getOptions ( ) ; } public static Plugin getPlugin ( ) { return JAVA_CORE_PLUGIN ; } public static IClasspathEntry getResolvedClasspathEntry ( IClasspathEntry entry ) { return JavaModelManager . getJavaModelManager ( ) . resolveVariableEntry ( entry , false ) ; } public static IPath getResolvedVariablePath ( IPath variablePath ) { return JavaModelManager . getJavaModelManager ( ) . getResolvedVariablePath ( variablePath , false ) ; } public static IWorkingCopy [ ] getSharedWorkingCopies ( IBufferFactory factory ) { if ( factory == null ) factory = BufferManager . getDefaultBufferManager ( ) . getDefaultBufferFactory ( ) ; return getWorkingCopies ( BufferFactoryWrapper . create ( factory ) ) ; } public static String [ ] getUserLibraryNames ( ) { return JavaModelManager . getUserLibraryManager ( ) . getUserLibraryNames ( ) ; } public static ICompilationUnit [ ] getWorkingCopies ( WorkingCopyOwner owner ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( owner == null ) owner = DefaultWorkingCopyOwner . PRIMARY ; ICompilationUnit [ ] result = manager . getWorkingCopies ( owner , false ) ; if ( result == null ) return JavaModelManager . NO_WORKING_COPY ; return result ; } public static void initializeAfterLoad ( IProgressMonitor monitor ) throws CoreException { try { if ( monitor != null ) { monitor . beginTask ( Messages . javamodel_initialization , <NUM_LIT:100> ) ; monitor . subTask ( Messages . javamodel_configuring_classpath_containers ) ; } JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; SubProgressMonitor subMonitor = null ; try { if ( monitor != null ) { subMonitor = new SubProgressMonitor ( monitor , <NUM_LIT> ) ; subMonitor . beginTask ( "<STR_LIT>" , <NUM_LIT:100> ) ; subMonitor . worked ( <NUM_LIT:5> ) ; manager . batchContainerInitializationsProgress . initializeAfterLoadMonitor . set ( subMonitor ) ; } if ( manager . forceBatchInitializations ( true ) ) { manager . getClasspathContainer ( Path . EMPTY , null ) ; } else { while ( manager . batchContainerInitializations == JavaModelManager . BATCH_INITIALIZATION_IN_PROGRESS ) { if ( subMonitor != null ) { subMonitor . subTask ( manager . batchContainerInitializationsProgress . subTaskName ) ; subMonitor . worked ( manager . batchContainerInitializationsProgress . getWorked ( ) ) ; } synchronized ( manager ) { try { manager . wait ( <NUM_LIT:100> ) ; } catch ( InterruptedException e ) { } } } } } finally { if ( subMonitor != null ) subMonitor . done ( ) ; manager . batchContainerInitializationsProgress . initializeAfterLoadMonitor . set ( null ) ; } if ( monitor != null ) monitor . subTask ( Messages . javamodel_resetting_source_attachment_properties ) ; ExternalFoldersManager externalFoldersManager = JavaModelManager . getExternalManager ( ) ; final IJavaProject [ ] projects = manager . getJavaModel ( ) . getJavaProjects ( ) ; HashSet visitedPaths = new HashSet ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { JavaProject javaProject = ( JavaProject ) projects [ i ] ; IClasspathEntry [ ] classpath ; try { classpath = javaProject . getResolvedClasspath ( ) ; } catch ( JavaModelException e ) { continue ; } if ( classpath != null ) { boolean needExternalFolderCreation = false ; for ( int j = <NUM_LIT:0> , length2 = classpath . length ; j < length2 ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; if ( entry . getSourceAttachmentPath ( ) != null ) { IPath entryPath = entry . getPath ( ) ; if ( visitedPaths . add ( entryPath ) ) { Util . setSourceAttachmentProperty ( entryPath , null ) ; } } if ( ! needExternalFolderCreation && entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath entryPath = entry . getPath ( ) ; if ( ExternalFoldersManager . isExternalFolderPath ( entryPath ) && externalFoldersManager . getFolder ( entryPath ) == null ) { needExternalFolderCreation = true ; } } } if ( needExternalFolderCreation ) manager . deltaState . addExternalFolderChange ( javaProject , null ) ; } } if ( monitor != null ) monitor . subTask ( Messages . javamodel_initializing_delta_state ) ; manager . deltaState . rootsAreStale = true ; manager . deltaState . initializeRoots ( true ) ; if ( monitor != null ) monitor . subTask ( Messages . javamodel_configuring_searchengine ) ; SearchEngine engine = new SearchEngine ( ) ; IJavaSearchScope scope = SearchEngine . createWorkspaceScope ( ) ; try { engine . searchAllTypeNames ( null , SearchPattern . R_EXACT_MATCH , "<STR_LIT>" . toCharArray ( ) , SearchPattern . R_PATTERN_MATCH | SearchPattern . R_CASE_SENSITIVE , IJavaSearchConstants . CLASS , scope , new TypeNameRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) { } } , IJavaSearchConstants . CANCEL_IF_NOT_READY_TO_SEARCH , monitor == null ? null : new SubProgressMonitor ( monitor , <NUM_LIT> ) ) ; } catch ( JavaModelException e ) { } catch ( OperationCanceledException e ) { if ( monitor != null && monitor . isCanceled ( ) ) throw e ; } if ( monitor != null ) monitor . subTask ( Messages . javamodel_getting_build_state_number ) ; QualifiedName qName = new QualifiedName ( JavaCore . PLUGIN_ID , "<STR_LIT>" ) ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; String versionNumber = null ; try { versionNumber = root . getPersistentProperty ( qName ) ; } catch ( CoreException e ) { } final JavaModel model = manager . getJavaModel ( ) ; String newVersionNumber = Byte . toString ( State . VERSION ) ; if ( ! newVersionNumber . equals ( versionNumber ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; IWorkspaceRunnable runnable = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor progressMonitor2 ) throws CoreException { for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject project = projects [ i ] ; try { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getElementName ( ) ) ; project . getProject ( ) . touch ( progressMonitor2 ) ; } catch ( CoreException e ) { } } } } ; if ( monitor != null ) monitor . subTask ( Messages . javamodel_building_after_upgrade ) ; try { ResourcesPlugin . getWorkspace ( ) . run ( runnable , monitor ) ; } catch ( CoreException e ) { } try { root . setPersistentProperty ( qName , newVersionNumber ) ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } } try { if ( monitor != null ) monitor . subTask ( Messages . javamodel_refreshing_external_jars ) ; model . refreshExternalArchives ( null , monitor == null ? null : new SubProgressMonitor ( monitor , <NUM_LIT:1> ) ) ; } catch ( JavaModelException e ) { } } finally { if ( monitor != null ) monitor . done ( ) ; } } public static boolean isClasspathVariableReadOnly ( String variableName ) { return JavaModelManager . getJavaModelManager ( ) . readOnlyVariables . contains ( variableName ) ; } public static boolean isJavaLikeFileName ( String fileName ) { return Util . isJavaLikeFileName ( fileName ) ; } public static boolean isReferencedBy ( IJavaElement element , IMarker marker ) throws CoreException { if ( element instanceof IMember ) { IMember member = ( IMember ) element ; if ( member . isBinary ( ) ) { element = member . getClassFile ( ) ; } else { element = member . getCompilationUnit ( ) ; } } if ( element == null ) return false ; if ( marker == null ) return false ; String markerHandleId = ( String ) marker . getAttribute ( ATT_HANDLE_ID ) ; if ( markerHandleId == null ) return false ; IJavaElement markerElement = JavaCore . create ( markerHandleId ) ; while ( true ) { if ( element . equals ( markerElement ) ) return true ; if ( markerElement instanceof IClassFile ) { IType enclosingType = ( ( IClassFile ) markerElement ) . getType ( ) . getDeclaringType ( ) ; if ( enclosingType != null ) { markerElement = enclosingType . getClassFile ( ) ; continue ; } } break ; } return false ; } public static boolean isReferencedBy ( IJavaElement element , IMarkerDelta markerDelta ) throws CoreException { if ( element instanceof IMember ) { IMember member = ( IMember ) element ; if ( member . isBinary ( ) ) { element = member . getClassFile ( ) ; } else { element = member . getCompilationUnit ( ) ; } } if ( element == null ) return false ; if ( markerDelta == null ) return false ; String markerDeltarHandleId = ( String ) markerDelta . getAttribute ( ATT_HANDLE_ID ) ; if ( markerDeltarHandleId == null ) return false ; IJavaElement markerElement = JavaCore . create ( markerDeltarHandleId ) ; while ( true ) { if ( element . equals ( markerElement ) ) return true ; if ( markerElement instanceof IClassFile ) { IType enclosingType = ( ( IClassFile ) markerElement ) . getType ( ) . getDeclaringType ( ) ; if ( enclosingType != null ) { markerElement = enclosingType . getClassFile ( ) ; continue ; } } break ; } return false ; } public static IAccessRule newAccessRule ( IPath filePattern , int kind ) { return new ClasspathAccessRule ( filePattern , kind ) ; } public static IClasspathAttribute newClasspathAttribute ( String name , String value ) { return new ClasspathAttribute ( name , value ) ; } public static IClasspathEntry newContainerEntry ( IPath containerPath ) { return newContainerEntry ( containerPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , false ) ; } public static IClasspathEntry newContainerEntry ( IPath containerPath , boolean isExported ) { return newContainerEntry ( containerPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newContainerEntry ( IPath containerPath , IAccessRule [ ] accessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( containerPath == null ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; } else if ( containerPath . segmentCount ( ) < <NUM_LIT:1> ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + containerPath . makeRelative ( ) . toString ( ) + "<STR_LIT>" ) ; } if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_CONTAINER , containerPath , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , null , null , null , isExported , accessRules , true , extraAttributes ) ; } public static ITypeHierarchy newTypeHierarchy ( IRegion region , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { if ( region == null ) { throw new IllegalArgumentException ( Messages . hierarchy_nullRegion ) ; } ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( region , workingCopies , null , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public static IClasspathEntry newLibraryEntry ( IPath path , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath ) { return newLibraryEntry ( path , sourceAttachmentPath , sourceAttachmentRootPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , false ) ; } public static IClasspathEntry newLibraryEntry ( IPath path , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath , boolean isExported ) { return newLibraryEntry ( path , sourceAttachmentPath , sourceAttachmentRootPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newLibraryEntry ( IPath path , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath , IAccessRule [ ] accessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( path == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } boolean hasDotDot = ClasspathEntry . hasDotDot ( path ) ; if ( ! hasDotDot && ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + path ) ; if ( sourceAttachmentPath != null ) { if ( sourceAttachmentPath . isEmpty ( ) ) { sourceAttachmentPath = null ; } else if ( ! sourceAttachmentPath . isAbsolute ( ) ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + sourceAttachmentPath + "<STR_LIT>" ) ; } } return new ClasspathEntry ( IPackageFragmentRoot . K_BINARY , IClasspathEntry . CPE_LIBRARY , hasDotDot ? path : JavaProject . canonicalizedPath ( path ) , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , sourceAttachmentPath , sourceAttachmentRootPath , null , isExported , accessRules , false , extraAttributes ) ; } public static IClasspathEntry newProjectEntry ( IPath path ) { return newProjectEntry ( path , false ) ; } public static IClasspathEntry newProjectEntry ( IPath path , boolean isExported ) { if ( ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; return newProjectEntry ( path , ClasspathEntry . NO_ACCESS_RULES , true , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newProjectEntry ( IPath path , IAccessRule [ ] accessRules , boolean combineAccessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_PROJECT , path , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , null , null , null , isExported , accessRules , combineAccessRules , extraAttributes ) ; } public static IRegion newRegion ( ) { return new Region ( ) ; } public static IClasspathEntry newSourceEntry ( IPath path ) { return newSourceEntry ( path , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , null ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] exclusionPatterns ) { return newSourceEntry ( path , ClasspathEntry . INCLUDE_ALL , exclusionPatterns , null ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] exclusionPatterns , IPath specificOutputLocation ) { return newSourceEntry ( path , ClasspathEntry . INCLUDE_ALL , exclusionPatterns , specificOutputLocation ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] inclusionPatterns , IPath [ ] exclusionPatterns , IPath specificOutputLocation ) { return newSourceEntry ( path , inclusionPatterns , exclusionPatterns , specificOutputLocation , ClasspathEntry . NO_EXTRA_ATTRIBUTES ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] inclusionPatterns , IPath [ ] exclusionPatterns , IPath specificOutputLocation , IClasspathAttribute [ ] extraAttributes ) { if ( path == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( exclusionPatterns == null ) { exclusionPatterns = ClasspathEntry . EXCLUDE_NONE ; } if ( inclusionPatterns == null ) { inclusionPatterns = ClasspathEntry . INCLUDE_ALL ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_SOURCE , path , inclusionPatterns , exclusionPatterns , null , null , specificOutputLocation , false , null , false , extraAttributes ) ; } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath sourceAttachmentRootPath ) { return newVariableEntry ( variablePath , variableSourceAttachmentPath , sourceAttachmentRootPath , false ) ; } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath variableSourceAttachmentRootPath , boolean isExported ) { return newVariableEntry ( variablePath , variableSourceAttachmentPath , variableSourceAttachmentRootPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath variableSourceAttachmentRootPath , IAccessRule [ ] accessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( variablePath == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( variablePath . segmentCount ( ) < <NUM_LIT:1> ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + variablePath . makeRelative ( ) . toString ( ) + "<STR_LIT>" ) ; } if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_VARIABLE , variablePath , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , variableSourceAttachmentPath , variableSourceAttachmentRootPath , null , isExported , accessRules , false , extraAttributes ) ; } public static IClasspathEntry [ ] getReferencedClasspathEntries ( IClasspathEntry libraryEntry , IJavaProject project ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; return manager . getReferencedClasspathEntries ( libraryEntry , project ) ; } public static void removeClasspathVariable ( String variableName ) { removeClasspathVariable ( variableName , null ) ; } public static void removeClasspathVariable ( String variableName , IProgressMonitor monitor ) { try { SetVariablesOperation operation = new SetVariablesOperation ( new String [ ] { variableName } , new IPath [ ] { null } , true ) ; operation . runOperation ( monitor ) ; } catch ( JavaModelException e ) { Util . log ( e , "<STR_LIT>" + variableName ) ; } } public static void removeElementChangedListener ( IElementChangedListener listener ) { JavaModelManager . getDeltaState ( ) . removeElementChangedListener ( listener ) ; } public static String removeJavaLikeExtension ( String fileName ) { return Util . getNameWithoutJavaLikeExtension ( fileName ) ; } public static void removePreProcessingResourceChangedListener ( IResourceChangeListener listener ) { JavaModelManager . getDeltaState ( ) . removePreResourceChangedListener ( listener ) ; } public static void run ( IWorkspaceRunnable action , IProgressMonitor monitor ) throws CoreException { run ( action , ResourcesPlugin . getWorkspace ( ) . getRoot ( ) , monitor ) ; } public static void run ( IWorkspaceRunnable action , ISchedulingRule rule , IProgressMonitor monitor ) throws CoreException { IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace . isTreeLocked ( ) ) { new BatchOperation ( action ) . run ( monitor ) ; } else { workspace . run ( new BatchOperation ( action ) , rule , IWorkspace . AVOID_UPDATE , monitor ) ; } } public static void setClasspathContainer ( IPath containerPath , IJavaProject [ ] affectedProjects , IClasspathContainer [ ] respectiveContainers , IProgressMonitor monitor ) throws JavaModelException { if ( affectedProjects . length != respectiveContainers . length ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( affectedProjects . length == <NUM_LIT:1> ) { IClasspathContainer container = respectiveContainers [ <NUM_LIT:0> ] ; if ( container != null ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IJavaProject project = affectedProjects [ <NUM_LIT:0> ] ; IClasspathContainer existingCointainer = manager . containerGet ( project , containerPath ) ; if ( existingCointainer == JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) { manager . containerBeingInitializedPut ( project , containerPath , container ) ; return ; } } } SetContainerOperation operation = new SetContainerOperation ( containerPath , affectedProjects , respectiveContainers ) ; operation . runOperation ( monitor ) ; } public static void setClasspathVariable ( String variableName , IPath path ) throws JavaModelException { setClasspathVariable ( variableName , path , null ) ; } public static void setClasspathVariable ( String variableName , IPath path , IProgressMonitor monitor ) throws JavaModelException { if ( path == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; setClasspathVariables ( new String [ ] { variableName } , new IPath [ ] { path } , monitor ) ; } public static void setClasspathVariables ( String [ ] variableNames , IPath [ ] paths , IProgressMonitor monitor ) throws JavaModelException { if ( variableNames . length != paths . length ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; SetVariablesOperation operation = new SetVariablesOperation ( variableNames , paths , true ) ; operation . runOperation ( monitor ) ; } public static void setComplianceOptions ( String compliance , Map options ) { switch ( ( int ) ( CompilerOptions . versionToJdkLevel ( compliance ) > > > <NUM_LIT:16> ) ) { case ClassFileConstants . MAJOR_VERSION_1_3 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_3 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_3 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_1 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . IGNORE ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . IGNORE ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_4 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_4 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_3 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_2 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . WARNING ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . WARNING ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_5 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_5 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_5 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_5 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_CODEGEN_INLINE_JSR_BYTECODE , JavaCore . ENABLED ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_6 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_6 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_6 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_6 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_CODEGEN_INLINE_JSR_BYTECODE , JavaCore . ENABLED ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_7 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_7 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_7 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_7 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_CODEGEN_INLINE_JSR_BYTECODE , JavaCore . ENABLED ) ; } } public static void setOptions ( Hashtable newOptions ) { JavaModelManager . getJavaModelManager ( ) . setOptions ( newOptions ) ; } public void stop ( BundleContext context ) throws Exception { try { JavaModelManager . getJavaModelManager ( ) . shutdown ( ) ; } finally { super . stop ( context ) ; } } public void start ( BundleContext context ) throws Exception { super . start ( context ) ; JavaModelManager . getJavaModelManager ( ) . startup ( ) ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IWorkingCopy { void commit ( boolean force , IProgressMonitor monitor ) throws JavaModelException ; void destroy ( ) ; IJavaElement findSharedWorkingCopy ( IBufferFactory bufferFactory ) ; IJavaElement getOriginal ( IJavaElement workingCopyElement ) ; IJavaElement getOriginalElement ( ) ; IJavaElement [ ] findElements ( IJavaElement element ) ; IType findPrimaryType ( ) ; IJavaElement getSharedWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory , IProblemRequestor problemRequestor ) throws JavaModelException ; IJavaElement getWorkingCopy ( ) throws JavaModelException ; IJavaElement getWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory , IProblemRequestor problemRequestor ) throws JavaModelException ; boolean isBasedOn ( IResource resource ) ; boolean isWorkingCopy ( ) ; IMarker [ ] reconcile ( ) throws JavaModelException ; void reconcile ( boolean forceProblemDetection , IProgressMonitor monitor ) throws JavaModelException ; void restore ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface IInitializer extends IMember { } </s>
<s> package org . eclipse . jdt . core ; import java . io . PrintStream ; import java . io . PrintWriter ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jdt . internal . core . JavaModelStatus ; public class JavaModelException extends CoreException { private static final long serialVersionUID = - <NUM_LIT> ; CoreException nestedCoreException ; public JavaModelException ( Throwable e , int code ) { this ( new JavaModelStatus ( code , e ) ) ; } public JavaModelException ( CoreException exception ) { super ( exception . getStatus ( ) ) ; this . nestedCoreException = exception ; } public JavaModelException ( IJavaModelStatus status ) { super ( status ) ; } public Throwable getException ( ) { if ( this . nestedCoreException == null ) { return getStatus ( ) . getException ( ) ; } else { return this . nestedCoreException ; } } public IJavaModelStatus getJavaModelStatus ( ) { IStatus status = getStatus ( ) ; if ( status instanceof IJavaModelStatus ) { return ( IJavaModelStatus ) status ; } else { return new JavaModelStatus ( this . nestedCoreException ) ; } } public boolean isDoesNotExist ( ) { IJavaModelStatus javaModelStatus = getJavaModelStatus ( ) ; return javaModelStatus != null && javaModelStatus . isDoesNotExist ( ) ; } public void printStackTrace ( PrintStream output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "<STR_LIT>" ) ; throwable . printStackTrace ( output ) ; } } } public void printStackTrace ( PrintWriter output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "<STR_LIT>" ) ; throwable . printStackTrace ( output ) ; } } } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; if ( getException ( ) != null ) { if ( getException ( ) instanceof CoreException ) { CoreException c = ( CoreException ) getException ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( c . getStatus ( ) . getCode ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( c . getStatus ( ) . getMessage ( ) ) ; } else { buffer . append ( getException ( ) . toString ( ) ) ; } } else { buffer . append ( getStatus ( ) . toString ( ) ) ; } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; public interface IJavaElement extends IAdaptable { int JAVA_MODEL = <NUM_LIT:1> ; int JAVA_PROJECT = <NUM_LIT:2> ; int PACKAGE_FRAGMENT_ROOT = <NUM_LIT:3> ; int PACKAGE_FRAGMENT = <NUM_LIT:4> ; int COMPILATION_UNIT = <NUM_LIT:5> ; int CLASS_FILE = <NUM_LIT:6> ; int TYPE = <NUM_LIT:7> ; int FIELD = <NUM_LIT:8> ; int METHOD = <NUM_LIT:9> ; int INITIALIZER = <NUM_LIT:10> ; int PACKAGE_DECLARATION = <NUM_LIT:11> ; int IMPORT_CONTAINER = <NUM_LIT:12> ; int IMPORT_DECLARATION = <NUM_LIT> ; int LOCAL_VARIABLE = <NUM_LIT> ; int TYPE_PARAMETER = <NUM_LIT:15> ; int ANNOTATION = <NUM_LIT:16> ; boolean exists ( ) ; IJavaElement getAncestor ( int ancestorType ) ; String getAttachedJavadoc ( IProgressMonitor monitor ) throws JavaModelException ; IResource getCorrespondingResource ( ) throws JavaModelException ; String getElementName ( ) ; int getElementType ( ) ; String getHandleIdentifier ( ) ; IJavaModel getJavaModel ( ) ; IJavaProject getJavaProject ( ) ; IOpenable getOpenable ( ) ; IJavaElement getParent ( ) ; IPath getPath ( ) ; IJavaElement getPrimaryElement ( ) ; IResource getResource ( ) ; ISchedulingRule getSchedulingRule ( ) ; IResource getUnderlyingResource ( ) throws JavaModelException ; boolean isReadOnly ( ) ; boolean isStructureKnown ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core . compiler ; public interface ITerminalSymbols { int TokenNameWHITESPACE = <NUM_LIT:1000> ; int TokenNameCOMMENT_LINE = <NUM_LIT> ; int TokenNameCOMMENT_BLOCK = <NUM_LIT> ; int TokenNameCOMMENT_JAVADOC = <NUM_LIT> ; int TokenNameIdentifier = <NUM_LIT:5> ; int TokenNameabstract = <NUM_LIT> ; int TokenNameassert = <NUM_LIT> ; int TokenNameboolean = <NUM_LIT> ; int TokenNamebreak = <NUM_LIT> ; int TokenNamebyte = <NUM_LIT> ; int TokenNamecase = <NUM_LIT> ; int TokenNamecatch = <NUM_LIT> ; int TokenNamechar = <NUM_LIT:20> ; int TokenNameclass = <NUM_LIT> ; int TokenNamecontinue = <NUM_LIT> ; int TokenNamedefault = <NUM_LIT> ; int TokenNamedo = <NUM_LIT> ; int TokenNamedouble = <NUM_LIT> ; int TokenNameelse = <NUM_LIT> ; int TokenNameextends = <NUM_LIT> ; int TokenNamefalse = <NUM_LIT> ; int TokenNamefinal = <NUM_LIT> ; int TokenNamefinally = <NUM_LIT> ; int TokenNamefloat = <NUM_LIT> ; int TokenNamefor = <NUM_LIT> ; int TokenNameif = <NUM_LIT> ; int TokenNameimplements = <NUM_LIT> ; int TokenNameimport = <NUM_LIT> ; int TokenNameinstanceof = <NUM_LIT> ; int TokenNameint = <NUM_LIT> ; int TokenNameinterface = <NUM_LIT> ; int TokenNamelong = <NUM_LIT:24> ; int TokenNamenative = <NUM_LIT:100> ; int TokenNamenew = <NUM_LIT:32> ; int TokenNamenull = <NUM_LIT> ; int TokenNamepackage = <NUM_LIT> ; int TokenNameprivate = <NUM_LIT> ; int TokenNameprotected = <NUM_LIT> ; int TokenNamepublic = <NUM_LIT> ; int TokenNamereturn = <NUM_LIT> ; int TokenNameshort = <NUM_LIT> ; int TokenNamestatic = <NUM_LIT> ; int TokenNamestrictfp = <NUM_LIT> ; int TokenNamesuper = <NUM_LIT> ; int TokenNameswitch = <NUM_LIT> ; int TokenNamesynchronized = <NUM_LIT> ; int TokenNamethis = <NUM_LIT> ; int TokenNamethrow = <NUM_LIT> ; int TokenNamethrows = <NUM_LIT> ; int TokenNametransient = <NUM_LIT> ; int TokenNametrue = <NUM_LIT> ; int TokenNametry = <NUM_LIT> ; int TokenNamevoid = <NUM_LIT> ; int TokenNamevolatile = <NUM_LIT> ; int TokenNamewhile = <NUM_LIT> ; int TokenNameIntegerLiteral = <NUM_LIT> ; int TokenNameLongLiteral = <NUM_LIT> ; int TokenNameFloatingPointLiteral = <NUM_LIT> ; int TokenNameDoubleLiteral = <NUM_LIT> ; int TokenNameCharacterLiteral = <NUM_LIT> ; int TokenNameStringLiteral = <NUM_LIT> ; int TokenNamePLUS_PLUS = <NUM_LIT:1> ; int TokenNameMINUS_MINUS = <NUM_LIT:2> ; int TokenNameEQUAL_EQUAL = <NUM_LIT> ; int TokenNameLESS_EQUAL = <NUM_LIT> ; int TokenNameGREATER_EQUAL = <NUM_LIT> ; int TokenNameNOT_EQUAL = <NUM_LIT> ; int TokenNameLEFT_SHIFT = <NUM_LIT> ; int TokenNameRIGHT_SHIFT = <NUM_LIT:11> ; int TokenNameUNSIGNED_RIGHT_SHIFT = <NUM_LIT:12> ; int TokenNamePLUS_EQUAL = <NUM_LIT> ; int TokenNameMINUS_EQUAL = <NUM_LIT> ; int TokenNameMULTIPLY_EQUAL = <NUM_LIT> ; int TokenNameDIVIDE_EQUAL = <NUM_LIT> ; int TokenNameAND_EQUAL = <NUM_LIT> ; int TokenNameOR_EQUAL = <NUM_LIT> ; int TokenNameXOR_EQUAL = <NUM_LIT> ; int TokenNameREMAINDER_EQUAL = <NUM_LIT> ; int TokenNameLEFT_SHIFT_EQUAL = <NUM_LIT> ; int TokenNameRIGHT_SHIFT_EQUAL = <NUM_LIT> ; int TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = <NUM_LIT> ; int TokenNameOR_OR = <NUM_LIT> ; int TokenNameAND_AND = <NUM_LIT> ; int TokenNamePLUS = <NUM_LIT:3> ; int TokenNameMINUS = <NUM_LIT:4> ; int TokenNameNOT = <NUM_LIT> ; int TokenNameREMAINDER = <NUM_LIT:9> ; int TokenNameXOR = <NUM_LIT> ; int TokenNameAND = <NUM_LIT> ; int TokenNameMULTIPLY = <NUM_LIT:8> ; int TokenNameOR = <NUM_LIT> ; int TokenNameTWIDDLE = <NUM_LIT> ; int TokenNameDIVIDE = <NUM_LIT:10> ; int TokenNameGREATER = <NUM_LIT> ; int TokenNameLESS = <NUM_LIT> ; int TokenNameLPAREN = <NUM_LIT:7> ; int TokenNameRPAREN = <NUM_LIT> ; int TokenNameLBRACE = <NUM_LIT> ; int TokenNameRBRACE = <NUM_LIT> ; int TokenNameLBRACKET = <NUM_LIT:15> ; int TokenNameRBRACKET = <NUM_LIT> ; int TokenNameSEMICOLON = <NUM_LIT> ; int TokenNameQUESTION = <NUM_LIT> ; int TokenNameCOLON = <NUM_LIT> ; int TokenNameCOMMA = <NUM_LIT> ; int TokenNameDOT = <NUM_LIT:6> ; int TokenNameEQUAL = <NUM_LIT> ; int TokenNameEOF = <NUM_LIT> ; int TokenNameERROR = <NUM_LIT> ; int TokenNameenum = <NUM_LIT> ; int TokenNameAT = <NUM_LIT> ; int TokenNameELLIPSIS = <NUM_LIT> ; int TokenNameconst = <NUM_LIT> ; int TokenNamegoto = <NUM_LIT> ; } </s>
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . core . IJavaProject ; public abstract class CompilationParticipant { public final static int READY_FOR_BUILD = <NUM_LIT:1> ; public final static int NEEDS_FULL_BUILD = <NUM_LIT:2> ; public int aboutToBuild ( IJavaProject project ) { return READY_FOR_BUILD ; } public void buildFinished ( IJavaProject project ) { } public void buildStarting ( BuildContext [ ] files , boolean isBatch ) { } public void cleanStarting ( IJavaProject project ) { } public boolean isActive ( IJavaProject project ) { return false ; } public boolean isAnnotationProcessor ( ) { return false ; } public void processAnnotations ( BuildContext [ ] files ) { } public void reconcile ( ReconcileContext context ) { } } </s>
<s> package org . eclipse . jdt . core . compiler ; import java . util . HashMap ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . IJavaModelMarker ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTParser ; import org . eclipse . jdt . internal . core . CompilationUnit ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jdt . internal . core . ReconcileWorkingCopyOperation ; public class ReconcileContext { private ReconcileWorkingCopyOperation operation ; private CompilationUnit workingCopy ; public ReconcileContext ( ReconcileWorkingCopyOperation operation , CompilationUnit workingCopy ) { this . operation = operation ; this . workingCopy = workingCopy ; } public org . eclipse . jdt . core . dom . CompilationUnit getAST3 ( ) throws JavaModelException { if ( this . operation . astLevel != AST . JLS3 || ! this . operation . resolveBindings ) { ASTParser parser = ASTParser . newParser ( AST . JLS3 ) ; parser . setCompilerOptions ( this . workingCopy . getJavaProject ( ) . getOptions ( true ) ) ; if ( JavaProject . hasJavaNature ( this . workingCopy . getJavaProject ( ) . getProject ( ) ) ) parser . setResolveBindings ( true ) ; parser . setStatementsRecovery ( ( this . operation . reconcileFlags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ) ; parser . setBindingsRecovery ( ( this . operation . reconcileFlags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> ) ; parser . setSource ( this . workingCopy ) ; parser . setIgnoreMethodBodies ( ( this . operation . reconcileFlags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) ; return ( org . eclipse . jdt . core . dom . CompilationUnit ) parser . createAST ( this . operation . progressMonitor ) ; } return this . operation . makeConsistent ( this . workingCopy ) ; } public int getASTLevel ( ) { return this . operation . astLevel ; } public boolean isResolvingBindings ( ) { return this . operation . resolveBindings ; } public int getReconcileFlags ( ) { return this . operation . reconcileFlags ; } public IJavaElementDelta getDelta ( ) { return this . operation . deltaBuilder . delta ; } public CategorizedProblem [ ] getProblems ( String markerType ) { if ( this . operation . problems == null ) return null ; return ( CategorizedProblem [ ] ) this . operation . problems . get ( markerType ) ; } public ICompilationUnit getWorkingCopy ( ) { return this . workingCopy ; } public void resetAST ( ) { this . operation . ast = null ; putProblems ( IJavaModelMarker . JAVA_MODEL_PROBLEM_MARKER , null ) ; putProblems ( IJavaModelMarker . TASK_MARKER , null ) ; } public void putProblems ( String markerType , CategorizedProblem [ ] problems ) { if ( this . operation . problems == null ) this . operation . problems = new HashMap ( ) ; this . operation . problems . put ( markerType , problems ) ; } } </s>
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . core . compiler . InvalidInputException ; public interface IScanner { char [ ] getCurrentTokenSource ( ) ; char [ ] getRawTokenSource ( ) ; int getCurrentTokenStartPosition ( ) ; int getCurrentTokenEndPosition ( ) ; int getLineStart ( int lineNumber ) ; int getLineEnd ( int lineNumber ) ; int [ ] getLineEnds ( ) ; int getLineNumber ( int charPosition ) ; int getNextToken ( ) throws InvalidInputException ; char [ ] getSource ( ) ; void resetTo ( int startPosition , int endPosition ) ; void setSource ( char [ ] source ) ; } </s>
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . core . resources . IFile ; public class BuildContext { public char [ ] getContents ( ) { return null ; } public IFile getFile ( ) { return null ; } public boolean hasAnnotations ( ) { return false ; } public void recordAddedGeneratedFiles ( IFile [ ] addedGeneratedFiles ) { } public void recordDeletedGeneratedFiles ( IFile [ ] deletedGeneratedFiles ) { } public void recordDependencies ( String [ ] typeNameDependencies ) { } public void recordNewProblems ( CategorizedProblem [ ] newProblems ) { } } </s>
<s> package org . eclipse . jdt . core ; public interface IParent { IJavaElement [ ] getChildren ( ) throws JavaModelException ; boolean hasChildren ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMField extends IDOMMember { public String getInitializer ( ) ; public String getName ( ) ; public String getType ( ) ; public void setInitializer ( String initializer ) ; public void setName ( String name ) throws IllegalArgumentException ; public void setType ( String typeName ) throws IllegalArgumentException ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMPackage extends IDOMNode { public String getName ( ) ; public void setName ( String name ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMFactory { public IDOMCompilationUnit createCompilationUnit ( ) ; public IDOMCompilationUnit createCompilationUnit ( char [ ] sourceCode , String name ) ; public IDOMCompilationUnit createCompilationUnit ( String sourceCode , String name ) ; public IDOMField createField ( ) ; public IDOMField createField ( String sourceCode ) ; public IDOMImport createImport ( ) ; public IDOMImport createImport ( String sourceCode ) ; public IDOMInitializer createInitializer ( ) ; public IDOMInitializer createInitializer ( String sourceCode ) ; public IDOMMethod createMethod ( ) ; public IDOMMethod createMethod ( String sourceCode ) ; public IDOMPackage createPackage ( ) ; public IDOMPackage createPackage ( String sourceCode ) ; public IDOMType createType ( ) ; public IDOMType createClass ( ) ; public IDOMType createInterface ( ) ; public IDOMType createType ( String sourceCode ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMMethod extends IDOMMember { public void addException ( String exceptionType ) throws IllegalArgumentException ; public void addParameter ( String type , String name ) throws IllegalArgumentException ; public String getBody ( ) ; public void setDefault ( String defaultValue ) ; public String getDefault ( ) ; public String [ ] getExceptions ( ) ; String [ ] getTypeParameters ( ) ; public String getName ( ) ; public String [ ] getParameterNames ( ) ; public String [ ] getParameterTypes ( ) ; public String getReturnType ( ) ; public boolean isConstructor ( ) ; public void setBody ( String body ) ; public void setConstructor ( boolean b ) ; public void setExceptions ( String [ ] exceptionTypes ) ; void setTypeParameters ( String [ ] typeParameters ) ; public void setName ( String name ) throws IllegalArgumentException ; public void setParameters ( String [ ] types , String [ ] names ) throws IllegalArgumentException ; public void setReturnType ( String type ) throws IllegalArgumentException ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMType extends IDOMMember { public void addSuperInterface ( String interfaceName ) throws IllegalArgumentException ; String [ ] getTypeParameters ( ) ; public String getName ( ) ; public String getSuperclass ( ) ; public String [ ] getSuperInterfaces ( ) ; public boolean isClass ( ) ; boolean isEnum ( ) ; boolean isAnnotation ( ) ; public void setClass ( boolean b ) ; public void setEnum ( boolean b ) ; public void setAnnotation ( boolean b ) ; void setTypeParameters ( String [ ] typeParameters ) ; public void setName ( String name ) throws IllegalArgumentException ; public void setSuperclass ( String superclassName ) ; public void setSuperInterfaces ( String [ ] interfaceNames ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMMember extends IDOMNode { public String getComment ( ) ; public int getFlags ( ) ; public void setComment ( String comment ) ; public void setFlags ( int flags ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public class DOMException extends RuntimeException { private static final long serialVersionUID = <NUM_LIT> ; public DOMException ( ) { } public DOMException ( String message ) { super ( message ) ; } } </s>
<s> package org . eclipse . jdt . core . jdom ; import java . util . Enumeration ; import org . eclipse . jdt . core . IJavaElement ; public interface IDOMNode extends Cloneable { public static int COMPILATION_UNIT = <NUM_LIT:1> ; public static int PACKAGE = <NUM_LIT:2> ; public static int IMPORT = <NUM_LIT:3> ; public static int TYPE = <NUM_LIT:4> ; public static int FIELD = <NUM_LIT:5> ; public static int METHOD = <NUM_LIT:6> ; public static int INITIALIZER = <NUM_LIT:7> ; public void addChild ( IDOMNode child ) throws DOMException , IllegalArgumentException ; public boolean canHaveChildren ( ) ; public Object clone ( ) ; public char [ ] getCharacters ( ) ; public IDOMNode getChild ( String name ) ; public Enumeration getChildren ( ) ; public String getContents ( ) ; public IDOMNode getFirstChild ( ) ; public IJavaElement getJavaElement ( IJavaElement parent ) throws IllegalArgumentException ; public String getName ( ) ; public IDOMNode getNextNode ( ) ; public int getNodeType ( ) ; public IDOMNode getParent ( ) ; public IDOMNode getPreviousNode ( ) ; public void insertSibling ( IDOMNode sibling ) throws DOMException , IllegalArgumentException ; public boolean isAllowableChild ( IDOMNode node ) ; public boolean isSignatureEqual ( IDOMNode node ) ; public void remove ( ) ; public void setName ( String name ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMImport extends IDOMNode { public String getName ( ) ; public boolean isOnDemand ( ) ; int getFlags ( ) ; void setFlags ( int flags ) ; public void setName ( String name ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMInitializer extends IDOMMember { public String getBody ( ) ; public String getName ( ) ; public void setBody ( String body ) ; public void setName ( String name ) ; } </s>
<s> package org . eclipse . jdt . core . jdom ; import org . eclipse . jdt . internal . core . jdom . * ; public class DOMFactory implements IDOMFactory { String lineSeparator ; public DOMFactory ( ) { this . lineSeparator = org . eclipse . jdt . internal . core . util . Util . getLineSeparator ( null , null ) ; } public IDOMCompilationUnit createCompilationUnit ( ) { return ( new DOMBuilder ( ) ) . createCompilationUnit ( ) ; } public IDOMCompilationUnit createCompilationUnit ( char [ ] sourceCode , String name ) { if ( sourceCode == null ) { return null ; } return ( new SimpleDOMBuilder ( ) ) . createCompilationUnit ( sourceCode , name . toCharArray ( ) ) ; } public IDOMCompilationUnit createCompilationUnit ( String sourceCode , String name ) { if ( sourceCode == null ) { return null ; } return ( new SimpleDOMBuilder ( ) ) . createCompilationUnit ( sourceCode . toCharArray ( ) , name . toCharArray ( ) ) ; } public IDOMField createField ( ) { return createField ( "<STR_LIT>" + this . lineSeparator ) ; } public IDOMField createField ( String sourceCode ) { if ( sourceCode == null ) { return null ; } return ( new DOMBuilder ( ) ) . createField ( sourceCode . toCharArray ( ) ) ; } public IDOMImport createImport ( ) { return ( new DOMBuilder ( ) ) . createImport ( ) ; } public IDOMImport createImport ( String sourceCode ) { if ( sourceCode == null ) { return null ; } return ( new DOMBuilder ( ) ) . createImport ( sourceCode . toCharArray ( ) ) ; } public IDOMInitializer createInitializer ( ) { return createInitializer ( "<STR_LIT>" + this . lineSeparator ) ; } public IDOMInitializer createInitializer ( String sourceCode ) { if ( sourceCode == null ) { return null ; } return ( new DOMBuilder ( ) ) . createInitializer ( sourceCode . toCharArray ( ) ) ; } public IDOMMethod createMethod ( ) { return createMethod ( "<STR_LIT>" + this . lineSeparator + "<STR_LIT:}>" + this . lineSeparator ) ; } public IDOMMethod createMethod ( String sourceCode ) { if ( sourceCode == null ) { return null ; } return ( new DOMBuilder ( ) ) . createMethod ( sourceCode . toCharArray ( ) ) ; } public IDOMPackage createPackage ( ) { return ( new DOMBuilder ( ) ) . createPackage ( ) ; } public IDOMPackage createPackage ( String sourceCode ) { if ( sourceCode == null ) { return null ; } return ( new DOMBuilder ( ) ) . createPackage ( sourceCode . toCharArray ( ) ) ; } public IDOMType createType ( ) { return createType ( "<STR_LIT>" + this . lineSeparator + "<STR_LIT:}>" + this . lineSeparator ) ; } public IDOMType createClass ( ) { return createType ( "<STR_LIT>" + this . lineSeparator + "<STR_LIT:}>" + this . lineSeparator ) ; } public IDOMType createInterface ( ) { return createType ( "<STR_LIT>" + this . lineSeparator + "<STR_LIT:}>" + this . lineSeparator ) ; } public IDOMType createType ( String sourceCode ) { if ( sourceCode == null ) { return null ; } return ( new DOMBuilder ( ) ) . createType ( sourceCode . toCharArray ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . jdom ; public interface IDOMCompilationUnit extends IDOMNode { public String getHeader ( ) ; public String getName ( ) ; public void setHeader ( String comment ) ; public void setName ( String name ) ; } </s>
<s> package org . eclipse . jdt . core ; public final class CompletionFlags { public static final int Default = <NUM_LIT> ; public static final int StaticImport = <NUM_LIT> ; private CompletionFlags ( ) { } public static boolean isStaticImport ( int flags ) { return ( flags & StaticImport ) != <NUM_LIT:0> ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IPackageFragment extends IParent , IJavaElement , IOpenable , ISourceManipulation { public static final String DEFAULT_PACKAGE_NAME = "<STR_LIT>" ; boolean containsJavaResources ( ) throws JavaModelException ; ICompilationUnit createCompilationUnit ( String name , String contents , boolean force , IProgressMonitor monitor ) throws JavaModelException ; IClassFile getClassFile ( String name ) ; IClassFile [ ] getClassFiles ( ) throws JavaModelException ; ICompilationUnit getCompilationUnit ( String name ) ; ICompilationUnit [ ] getCompilationUnits ( ) throws JavaModelException ; ICompilationUnit [ ] getCompilationUnits ( WorkingCopyOwner owner ) throws JavaModelException ; String getElementName ( ) ; int getKind ( ) throws JavaModelException ; Object [ ] getNonJavaResources ( ) throws JavaModelException ; boolean hasSubpackages ( ) throws JavaModelException ; boolean isDefaultPackage ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . core . compiler . IProblem ; public interface IProblemRequestor { void acceptProblem ( IProblem problem ) ; void beginReporting ( ) ; void endReporting ( ) ; boolean isActive ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; public final class Flags { public static final int AccDefault = ClassFileConstants . AccDefault ; public static final int AccPublic = ClassFileConstants . AccPublic ; public static final int AccPrivate = ClassFileConstants . AccPrivate ; public static final int AccProtected = ClassFileConstants . AccProtected ; public static final int AccStatic = ClassFileConstants . AccStatic ; public static final int AccFinal = ClassFileConstants . AccFinal ; public static final int AccSynchronized = ClassFileConstants . AccSynchronized ; public static final int AccVolatile = ClassFileConstants . AccVolatile ; public static final int AccTransient = ClassFileConstants . AccTransient ; public static final int AccNative = ClassFileConstants . AccNative ; public static final int AccInterface = ClassFileConstants . AccInterface ; public static final int AccAbstract = ClassFileConstants . AccAbstract ; public static final int AccStrictfp = ClassFileConstants . AccStrictfp ; public static final int AccSuper = ClassFileConstants . AccSuper ; public static final int AccSynthetic = ClassFileConstants . AccSynthetic ; public static final int AccDeprecated = ClassFileConstants . AccDeprecated ; public static final int AccBridge = ClassFileConstants . AccBridge ; public static final int AccVarargs = ClassFileConstants . AccVarargs ; public static final int AccEnum = ClassFileConstants . AccEnum ; public static final int AccAnnotation = ClassFileConstants . AccAnnotation ; private Flags ( ) { } public static boolean isAbstract ( int flags ) { return ( flags & AccAbstract ) != <NUM_LIT:0> ; } public static boolean isDeprecated ( int flags ) { return ( flags & AccDeprecated ) != <NUM_LIT:0> ; } public static boolean isFinal ( int flags ) { return ( flags & AccFinal ) != <NUM_LIT:0> ; } public static boolean isInterface ( int flags ) { return ( flags & AccInterface ) != <NUM_LIT:0> ; } public static boolean isNative ( int flags ) { return ( flags & AccNative ) != <NUM_LIT:0> ; } public static boolean isPackageDefault ( int flags ) { return ( flags & ( AccPublic | AccPrivate | AccProtected ) ) == <NUM_LIT:0> ; } public static boolean isPrivate ( int flags ) { return ( flags & AccPrivate ) != <NUM_LIT:0> ; } public static boolean isProtected ( int flags ) { return ( flags & AccProtected ) != <NUM_LIT:0> ; } public static boolean isPublic ( int flags ) { return ( flags & AccPublic ) != <NUM_LIT:0> ; } public static boolean isStatic ( int flags ) { return ( flags & AccStatic ) != <NUM_LIT:0> ; } public static boolean isSuper ( int flags ) { return ( flags & AccSuper ) != <NUM_LIT:0> ; } public static boolean isStrictfp ( int flags ) { return ( flags & AccStrictfp ) != <NUM_LIT:0> ; } public static boolean isSynchronized ( int flags ) { return ( flags & AccSynchronized ) != <NUM_LIT:0> ; } public static boolean isSynthetic ( int flags ) { return ( flags & AccSynthetic ) != <NUM_LIT:0> ; } public static boolean isTransient ( int flags ) { return ( flags & AccTransient ) != <NUM_LIT:0> ; } public static boolean isVolatile ( int flags ) { return ( flags & AccVolatile ) != <NUM_LIT:0> ; } public static boolean isBridge ( int flags ) { return ( flags & AccBridge ) != <NUM_LIT:0> ; } public static boolean isVarargs ( int flags ) { return ( flags & AccVarargs ) != <NUM_LIT:0> ; } public static boolean isEnum ( int flags ) { return ( flags & AccEnum ) != <NUM_LIT:0> ; } public static boolean isAnnotation ( int flags ) { return ( flags & AccAnnotation ) != <NUM_LIT:0> ; } public static String toString ( int flags ) { StringBuffer sb = new StringBuffer ( ) ; if ( isPublic ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isProtected ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isPrivate ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isStatic ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isAbstract ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isFinal ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isNative ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isSynchronized ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isTransient ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isVolatile ( flags ) ) sb . append ( "<STR_LIT>" ) ; if ( isStrictfp ( flags ) ) sb . append ( "<STR_LIT>" ) ; int len = sb . length ( ) ; if ( len == <NUM_LIT:0> ) return "<STR_LIT>" ; sb . setLength ( len - <NUM_LIT:1> ) ; return sb . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core ; public interface ISourceReference { boolean exists ( ) ; String getSource ( ) throws JavaModelException ; ISourceRange getSourceRange ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IPackageFragmentRoot extends IParent , IJavaElement , IOpenable { int K_SOURCE = <NUM_LIT:1> ; int K_BINARY = <NUM_LIT:2> ; String DEFAULT_PACKAGEROOT_PATH = "<STR_LIT>" ; int NO_RESOURCE_MODIFICATION = <NUM_LIT:1> ; int ORIGINATING_PROJECT_CLASSPATH = <NUM_LIT:2> ; int OTHER_REFERRING_PROJECTS_CLASSPATH = <NUM_LIT:4> ; int DESTINATION_PROJECT_CLASSPATH = <NUM_LIT:8> ; int REPLACE = <NUM_LIT:16> ; void attachSource ( IPath sourcePath , IPath rootPath , IProgressMonitor monitor ) throws JavaModelException ; void copy ( IPath destination , int updateResourceFlags , int updateModelFlags , IClasspathEntry sibling , IProgressMonitor monitor ) throws JavaModelException ; IPackageFragment createPackageFragment ( String name , boolean force , IProgressMonitor monitor ) throws JavaModelException ; void delete ( int updateResourceFlags , int updateModelFlags , IProgressMonitor monitor ) throws JavaModelException ; int getKind ( ) throws JavaModelException ; Object [ ] getNonJavaResources ( ) throws JavaModelException ; IPackageFragment getPackageFragment ( String packageName ) ; IClasspathEntry getRawClasspathEntry ( ) throws JavaModelException ; IClasspathEntry getResolvedClasspathEntry ( ) throws JavaModelException ; IPath getSourceAttachmentPath ( ) throws JavaModelException ; IPath getSourceAttachmentRootPath ( ) throws JavaModelException ; public boolean isArchive ( ) ; boolean isExternal ( ) ; void move ( IPath destination , int updateResourceFlags , int updateModelFlags , IClasspathEntry sibling , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IResourceDelta ; import org . eclipse . jdt . core . dom . CompilationUnit ; public interface IJavaElementDelta { public int ADDED = <NUM_LIT:1> ; public int REMOVED = <NUM_LIT:2> ; public int CHANGED = <NUM_LIT:4> ; public int F_CONTENT = <NUM_LIT> ; public int F_MODIFIERS = <NUM_LIT> ; public int F_CHILDREN = <NUM_LIT> ; public int F_MOVED_FROM = <NUM_LIT> ; public int F_MOVED_TO = <NUM_LIT> ; public int F_ADDED_TO_CLASSPATH = <NUM_LIT> ; public int F_REMOVED_FROM_CLASSPATH = <NUM_LIT> ; public int F_CLASSPATH_REORDER = <NUM_LIT> ; public int F_REORDER = <NUM_LIT> ; public int F_OPENED = <NUM_LIT> ; public int F_CLOSED = <NUM_LIT> ; public int F_SUPER_TYPES = <NUM_LIT> ; public int F_SOURCEATTACHED = <NUM_LIT> ; public int F_SOURCEDETACHED = <NUM_LIT> ; public int F_FINE_GRAINED = <NUM_LIT> ; public int F_ARCHIVE_CONTENT_CHANGED = <NUM_LIT> ; public int F_PRIMARY_WORKING_COPY = <NUM_LIT> ; public int F_CLASSPATH_CHANGED = <NUM_LIT> ; public int F_PRIMARY_RESOURCE = <NUM_LIT> ; public int F_AST_AFFECTED = <NUM_LIT> ; public int F_CATEGORIES = <NUM_LIT> ; public int F_RESOLVED_CLASSPATH_CHANGED = <NUM_LIT> ; public int F_ANNOTATIONS = <NUM_LIT> ; public IJavaElementDelta [ ] getAddedChildren ( ) ; public IJavaElementDelta [ ] getAffectedChildren ( ) ; public IJavaElementDelta [ ] getAnnotationDeltas ( ) ; public CompilationUnit getCompilationUnitAST ( ) ; public IJavaElementDelta [ ] getChangedChildren ( ) ; public IJavaElement getElement ( ) ; public int getFlags ( ) ; public int getKind ( ) ; public IJavaElement getMovedFromElement ( ) ; public IJavaElement getMovedToElement ( ) ; public IJavaElementDelta [ ] getRemovedChildren ( ) ; public IResourceDelta [ ] getResourceDeltas ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . internal . codeassist . InternalCompletionProposal ; public class CompletionProposal { public static final int ANONYMOUS_CLASS_DECLARATION = <NUM_LIT:1> ; public static final int FIELD_REF = <NUM_LIT:2> ; public static final int KEYWORD = <NUM_LIT:3> ; public static final int LABEL_REF = <NUM_LIT:4> ; public static final int LOCAL_VARIABLE_REF = <NUM_LIT:5> ; public static final int METHOD_REF = <NUM_LIT:6> ; public static final int METHOD_DECLARATION = <NUM_LIT:7> ; public static final int PACKAGE_REF = <NUM_LIT:8> ; public static final int TYPE_REF = <NUM_LIT:9> ; public static final int VARIABLE_DECLARATION = <NUM_LIT:10> ; public static final int POTENTIAL_METHOD_DECLARATION = <NUM_LIT:11> ; public static final int METHOD_NAME_REFERENCE = <NUM_LIT:12> ; public static final int ANNOTATION_ATTRIBUTE_REF = <NUM_LIT> ; public static final int JAVADOC_FIELD_REF = <NUM_LIT> ; public static final int JAVADOC_METHOD_REF = <NUM_LIT:15> ; public static final int JAVADOC_TYPE_REF = <NUM_LIT:16> ; public static final int JAVADOC_VALUE_REF = <NUM_LIT> ; public static final int JAVADOC_PARAM_REF = <NUM_LIT> ; public static final int JAVADOC_BLOCK_TAG = <NUM_LIT> ; public static final int JAVADOC_INLINE_TAG = <NUM_LIT:20> ; public static final int FIELD_IMPORT = <NUM_LIT> ; public static final int METHOD_IMPORT = <NUM_LIT> ; public static final int TYPE_IMPORT = <NUM_LIT> ; public static final int METHOD_REF_WITH_CASTED_RECEIVER = <NUM_LIT:24> ; public static final int FIELD_REF_WITH_CASTED_RECEIVER = <NUM_LIT> ; public static final int CONSTRUCTOR_INVOCATION = <NUM_LIT> ; public static final int ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION = <NUM_LIT> ; protected static final int FIRST_KIND = ANONYMOUS_CLASS_DECLARATION ; protected static final int LAST_KIND = ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION ; public static CompletionProposal create ( int kind , int completionOffset ) { return new InternalCompletionProposal ( kind , completionOffset ) ; } public int getAdditionalFlags ( ) { return - <NUM_LIT:1> ; } public void setAdditionalFlags ( int additionalFlags ) { } public int getKind ( ) { return - <NUM_LIT:1> ; } public int getCompletionLocation ( ) { return - <NUM_LIT:1> ; } public int getTokenStart ( ) { return - <NUM_LIT:1> ; } public int getTokenEnd ( ) { return - <NUM_LIT:1> ; } public void setTokenRange ( int startIndex , int endIndex ) { } public char [ ] getCompletion ( ) { return null ; } public void setCompletion ( char [ ] completion ) { } public int getReplaceStart ( ) { return - <NUM_LIT:1> ; } public int getReplaceEnd ( ) { return - <NUM_LIT:1> ; } public void setReplaceRange ( int startIndex , int endIndex ) { } public int getRelevance ( ) { return - <NUM_LIT:1> ; } public void setRelevance ( int rating ) { } public char [ ] getDeclarationSignature ( ) { return null ; } public char [ ] getDeclarationKey ( ) { return null ; } public void setDeclarationSignature ( char [ ] signature ) { } public void setDeclarationKey ( char [ ] key ) { } public char [ ] getName ( ) { return null ; } public void setName ( char [ ] name ) { } public char [ ] getSignature ( ) { return null ; } public char [ ] getKey ( ) { return null ; } public void setSignature ( char [ ] signature ) { } public void setKey ( char [ ] key ) { } public int getFlags ( ) { return - <NUM_LIT:1> ; } public void setFlags ( int flags ) { } public CompletionProposal [ ] getRequiredProposals ( ) { return null ; } public void setRequiredProposals ( CompletionProposal [ ] proposals ) { } public char [ ] [ ] findParameterNames ( IProgressMonitor monitor ) { return null ; } public void setParameterNames ( char [ ] [ ] parameterNames ) { } public int getAccessibility ( ) { return - <NUM_LIT:1> ; } public boolean isConstructor ( ) { return false ; } public char [ ] getReceiverSignature ( ) { return null ; } public int getReceiverStart ( ) { return - <NUM_LIT:1> ; } public int getReceiverEnd ( ) { return - <NUM_LIT:1> ; } public void setReceiverSignature ( char [ ] signature ) { } public void setReceiverRange ( int startIndex , int endIndex ) { } } </s>
<s> package org . eclipse . jdt . core ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . BufferManager ; import org . eclipse . jdt . internal . core . CompilationUnit ; import org . eclipse . jdt . internal . core . DefaultWorkingCopyOwner ; import org . eclipse . jdt . internal . core . ExternalJavaProject ; import org . eclipse . jdt . internal . core . PackageFragment ; import org . eclipse . jdt . internal . core . PackageFragmentRoot ; public abstract class WorkingCopyOwner { public static void setPrimaryBufferProvider ( WorkingCopyOwner primaryBufferProvider ) { DefaultWorkingCopyOwner . PRIMARY . primaryBufferProvider = primaryBufferProvider ; } public IBuffer createBuffer ( ICompilationUnit workingCopy ) { return BufferManager . createBuffer ( workingCopy ) ; } public IProblemRequestor getProblemRequestor ( ICompilationUnit workingCopy ) { return null ; } public String findSource ( String typeName , String packageName ) { return null ; } public boolean isPackage ( String [ ] pkg ) { return false ; } public final ICompilationUnit newWorkingCopy ( String name , IClasspathEntry [ ] classpath , IProblemRequestor problemRequestor , IProgressMonitor monitor ) throws JavaModelException { ExternalJavaProject project = new ExternalJavaProject ( classpath ) ; IPackageFragment parent = ( ( PackageFragmentRoot ) project . getPackageFragmentRoot ( project . getProject ( ) ) ) . getPackageFragment ( CharOperation . NO_STRINGS ) ; CompilationUnit result = LanguageSupportFactory . newCompilationUnit ( ( PackageFragment ) parent , name , this ) ; result . becomeWorkingCopy ( problemRequestor , monitor ) ; return result ; } public final ICompilationUnit newWorkingCopy ( String name , IClasspathEntry [ ] classpath , IProgressMonitor monitor ) throws JavaModelException { ExternalJavaProject project = new ExternalJavaProject ( classpath ) ; IPackageFragment parent = ( ( PackageFragmentRoot ) project . getPackageFragmentRoot ( project . getProject ( ) ) ) . getPackageFragment ( CharOperation . NO_STRINGS ) ; CompilationUnit result = LanguageSupportFactory . newCompilationUnit ( ( PackageFragment ) parent , name , this ) ; result . becomeWorkingCopy ( getProblemRequestor ( result ) , monitor ) ; return result ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IJavaModel extends IJavaElement , IOpenable , IParent { boolean contains ( IResource resource ) ; void copy ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean replace , IProgressMonitor monitor ) throws JavaModelException ; void delete ( IJavaElement [ ] elements , boolean force , IProgressMonitor monitor ) throws JavaModelException ; IJavaProject getJavaProject ( String name ) ; IJavaProject [ ] getJavaProjects ( ) throws JavaModelException ; Object [ ] getNonJavaResources ( ) throws JavaModelException ; IWorkspace getWorkspace ( ) ; void move ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean replace , IProgressMonitor monitor ) throws JavaModelException ; void refreshExternalArchives ( IJavaElement [ ] elementsScope , IProgressMonitor monitor ) throws JavaModelException ; void rename ( IJavaElement [ ] elements , IJavaElement [ ] destinations , String [ ] names , boolean replace , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface IClasspathAttribute { String JAVADOC_LOCATION_ATTRIBUTE_NAME = "<STR_LIT>" ; String OPTIONAL = "<STR_LIT>" ; String getName ( ) ; String getValue ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . core . INamingRequestor ; import org . eclipse . jdt . internal . core . InternalNamingConventions ; public final class NamingConventions { static class NamingRequestor implements INamingRequestor { private final static int SIZE = <NUM_LIT:10> ; private char [ ] [ ] firstPrefixAndFirstSuffixResults = new char [ SIZE ] [ ] ; private int firstPrefixAndFirstSuffixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] firstPrefixAndSuffixResults = new char [ SIZE ] [ ] ; private int firstPrefixAndSuffixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] prefixAndFirstSuffixResults = new char [ SIZE ] [ ] ; private int prefixAndFirstSuffixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] prefixAndSuffixResults = new char [ SIZE ] [ ] ; private int prefixAndSuffixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] firstPrefixResults = new char [ SIZE ] [ ] ; private int firstPrefixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] prefixResults = new char [ SIZE ] [ ] ; private int prefixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] firstSuffixResults = new char [ SIZE ] [ ] ; private int firstSuffixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] suffixResults = new char [ SIZE ] [ ] ; private int suffixResultsCount = <NUM_LIT:0> ; private char [ ] [ ] otherResults = new char [ SIZE ] [ ] ; private int otherResultsCount = <NUM_LIT:0> ; public void acceptNameWithoutPrefixAndSuffix ( char [ ] name , int reusedCharacters ) { int length = this . otherResults . length ; if ( length == this . otherResultsCount ) { System . arraycopy ( this . otherResults , <NUM_LIT:0> , this . otherResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . otherResults [ this . otherResultsCount ++ ] = name ; } public void acceptNameWithPrefix ( char [ ] name , boolean isFirstPrefix , int reusedCharacters ) { if ( isFirstPrefix ) { int length = this . firstPrefixResults . length ; if ( length == this . firstPrefixResultsCount ) { System . arraycopy ( this . firstPrefixResults , <NUM_LIT:0> , this . firstPrefixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . firstPrefixResults [ this . firstPrefixResultsCount ++ ] = name ; } else { int length = this . prefixResults . length ; if ( length == this . prefixResultsCount ) { System . arraycopy ( this . prefixResults , <NUM_LIT:0> , this . prefixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . prefixResults [ this . prefixResultsCount ++ ] = name ; } } public void acceptNameWithPrefixAndSuffix ( char [ ] name , boolean isFirstPrefix , boolean isFirstSuffix , int reusedCharacters ) { if ( isFirstPrefix && isFirstSuffix ) { int length = this . firstPrefixAndFirstSuffixResults . length ; if ( length == this . firstPrefixAndFirstSuffixResultsCount ) { System . arraycopy ( this . firstPrefixAndFirstSuffixResults , <NUM_LIT:0> , this . firstPrefixAndFirstSuffixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . firstPrefixAndFirstSuffixResults [ this . firstPrefixAndFirstSuffixResultsCount ++ ] = name ; } else if ( isFirstPrefix ) { int length = this . firstPrefixAndSuffixResults . length ; if ( length == this . firstPrefixAndSuffixResultsCount ) { System . arraycopy ( this . firstPrefixAndSuffixResults , <NUM_LIT:0> , this . firstPrefixAndSuffixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . firstPrefixAndSuffixResults [ this . firstPrefixAndSuffixResultsCount ++ ] = name ; } else if ( isFirstSuffix ) { int length = this . prefixAndFirstSuffixResults . length ; if ( length == this . prefixAndFirstSuffixResultsCount ) { System . arraycopy ( this . prefixAndFirstSuffixResults , <NUM_LIT:0> , this . prefixAndFirstSuffixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . prefixAndFirstSuffixResults [ this . prefixAndFirstSuffixResultsCount ++ ] = name ; } else { int length = this . prefixAndSuffixResults . length ; if ( length == this . prefixAndSuffixResultsCount ) { System . arraycopy ( this . prefixAndSuffixResults , <NUM_LIT:0> , this . prefixAndSuffixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . prefixAndSuffixResults [ this . prefixAndSuffixResultsCount ++ ] = name ; } } public void acceptNameWithSuffix ( char [ ] name , boolean isFirstSuffix , int reusedCharacters ) { if ( isFirstSuffix ) { int length = this . firstSuffixResults . length ; if ( length == this . firstSuffixResultsCount ) { System . arraycopy ( this . firstSuffixResults , <NUM_LIT:0> , this . firstSuffixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . firstSuffixResults [ this . firstSuffixResultsCount ++ ] = name ; } else { int length = this . suffixResults . length ; if ( length == this . suffixResultsCount ) { System . arraycopy ( this . suffixResults , <NUM_LIT:0> , this . suffixResults = new char [ length * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , length ) ; } this . suffixResults [ this . suffixResultsCount ++ ] = name ; } } public char [ ] [ ] getResults ( ) { int count = this . firstPrefixAndFirstSuffixResultsCount + this . firstPrefixAndSuffixResultsCount + this . prefixAndFirstSuffixResultsCount + this . prefixAndSuffixResultsCount + this . firstPrefixResultsCount + this . prefixResultsCount + this . firstSuffixResultsCount + this . suffixResultsCount + this . otherResultsCount ; char [ ] [ ] results = new char [ count ] [ ] ; int index = <NUM_LIT:0> ; System . arraycopy ( this . firstPrefixAndFirstSuffixResults , <NUM_LIT:0> , results , index , this . firstPrefixAndFirstSuffixResultsCount ) ; index += this . firstPrefixAndFirstSuffixResultsCount ; System . arraycopy ( this . firstPrefixAndSuffixResults , <NUM_LIT:0> , results , index , this . firstPrefixAndSuffixResultsCount ) ; index += this . firstPrefixAndSuffixResultsCount ; System . arraycopy ( this . prefixAndFirstSuffixResults , <NUM_LIT:0> , results , index , this . prefixAndFirstSuffixResultsCount ) ; index += this . prefixAndFirstSuffixResultsCount ; System . arraycopy ( this . prefixAndSuffixResults , <NUM_LIT:0> , results , index , this . prefixAndSuffixResultsCount ) ; index += this . prefixAndSuffixResultsCount ; System . arraycopy ( this . firstPrefixResults , <NUM_LIT:0> , results , index , this . firstPrefixResultsCount ) ; index += this . firstPrefixResultsCount ; System . arraycopy ( this . prefixResults , <NUM_LIT:0> , results , index , this . prefixResultsCount ) ; index += this . prefixResultsCount ; System . arraycopy ( this . firstSuffixResults , <NUM_LIT:0> , results , index , this . firstSuffixResultsCount ) ; index += this . firstSuffixResultsCount ; System . arraycopy ( this . suffixResults , <NUM_LIT:0> , results , index , this . suffixResultsCount ) ; index += this . suffixResultsCount ; System . arraycopy ( this . otherResults , <NUM_LIT:0> , results , index , this . otherResultsCount ) ; return results ; } } private static final char [ ] GETTER_BOOL_NAME = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] GETTER_NAME = "<STR_LIT:get>" . toCharArray ( ) ; private static final char [ ] SETTER_NAME = "<STR_LIT>" . toCharArray ( ) ; public static final int VK_STATIC_FIELD = InternalNamingConventions . VK_STATIC_FIELD ; public static final int VK_INSTANCE_FIELD = InternalNamingConventions . VK_INSTANCE_FIELD ; public static final int VK_STATIC_FINAL_FIELD = InternalNamingConventions . VK_STATIC_FINAL_FIELD ; public static final int VK_PARAMETER = InternalNamingConventions . VK_PARAMETER ; public static final int VK_LOCAL = InternalNamingConventions . VK_LOCAL ; public static final int BK_NAME = InternalNamingConventions . BK_SIMPLE_NAME ; public static final int BK_TYPE_NAME = InternalNamingConventions . BK_SIMPLE_TYPE_NAME ; private static String [ ] convertCharsToString ( char [ ] [ ] c ) { int length = c == null ? <NUM_LIT:0> : c . length ; String [ ] s = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { s [ i ] = String . valueOf ( c [ i ] ) ; } return s ; } private static char [ ] [ ] convertStringToChars ( String [ ] s ) { int length = s == null ? <NUM_LIT:0> : s . length ; char [ ] [ ] c = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( s [ i ] == null ) { c [ i ] = CharOperation . NO_CHAR ; } else { c [ i ] = s [ i ] . toCharArray ( ) ; } } return c ; } public static char [ ] removePrefixAndSuffixForArgumentName ( IJavaProject javaProject , char [ ] argumentName ) { return InternalNamingConventions . removeVariablePrefixAndSuffix ( VK_PARAMETER , javaProject , argumentName ) ; } public static String removePrefixAndSuffixForArgumentName ( IJavaProject javaProject , String argumentName ) { return String . valueOf ( removePrefixAndSuffixForArgumentName ( javaProject , argumentName . toCharArray ( ) ) ) ; } public static char [ ] removePrefixAndSuffixForFieldName ( IJavaProject javaProject , char [ ] fieldName , int modifiers ) { return InternalNamingConventions . removeVariablePrefixAndSuffix ( Flags . isStatic ( modifiers ) ? VK_STATIC_FIELD : VK_INSTANCE_FIELD , javaProject , fieldName ) ; } public static String removePrefixAndSuffixForFieldName ( IJavaProject javaProject , String fieldName , int modifiers ) { return String . valueOf ( removePrefixAndSuffixForFieldName ( javaProject , fieldName . toCharArray ( ) , modifiers ) ) ; } public static char [ ] removePrefixAndSuffixForLocalVariableName ( IJavaProject javaProject , char [ ] localName ) { return InternalNamingConventions . removeVariablePrefixAndSuffix ( VK_LOCAL , javaProject , localName ) ; } public static String removePrefixAndSuffixForLocalVariableName ( IJavaProject javaProject , String localName ) { return String . valueOf ( removePrefixAndSuffixForLocalVariableName ( javaProject , localName . toCharArray ( ) ) ) ; } public static String getBaseName ( int variableKind , String variableName , IJavaProject javaProject ) { return String . valueOf ( InternalNamingConventions . getBaseName ( variableKind , javaProject , variableName . toCharArray ( ) , true ) ) ; } private static int getFieldVariableKind ( int modifiers ) { if ( Flags . isStatic ( modifiers ) ) { if ( Flags . isFinal ( modifiers ) ) { return VK_STATIC_FINAL_FIELD ; } return VK_STATIC_FIELD ; } return VK_INSTANCE_FIELD ; } private static char [ ] suggestAccessorName ( IJavaProject project , char [ ] fieldName , int modifiers ) { char [ ] name = InternalNamingConventions . getBaseName ( getFieldVariableKind ( modifiers ) , project , fieldName , false ) ; if ( name . length > <NUM_LIT:0> && ScannerHelper . isLowerCase ( name [ <NUM_LIT:0> ] ) ) { if ( name . length == <NUM_LIT:1> || ! ScannerHelper . isUpperCase ( name [ <NUM_LIT:1> ] ) ) { name [ <NUM_LIT:0> ] = ScannerHelper . toUpperCase ( name [ <NUM_LIT:0> ] ) ; } } return name ; } public static char [ ] [ ] suggestArgumentNames ( IJavaProject javaProject , char [ ] packageName , char [ ] qualifiedTypeName , int dim , char [ ] [ ] excludedNames ) { if ( qualifiedTypeName == null || qualifiedTypeName . length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; char [ ] typeName = CharOperation . lastSegment ( qualifiedTypeName , '<CHAR_LIT:.>' ) ; NamingRequestor requestor = new NamingRequestor ( ) ; InternalNamingConventions . suggestVariableNames ( VK_PARAMETER , BK_TYPE_NAME , typeName , javaProject , dim , null , excludedNames , true , requestor ) ; return requestor . getResults ( ) ; } public static String [ ] suggestArgumentNames ( IJavaProject javaProject , String packageName , String qualifiedTypeName , int dim , String [ ] excludedNames ) { return convertCharsToString ( suggestArgumentNames ( javaProject , packageName . toCharArray ( ) , qualifiedTypeName . toCharArray ( ) , dim , convertStringToChars ( excludedNames ) ) ) ; } public static char [ ] [ ] suggestFieldNames ( IJavaProject javaProject , char [ ] packageName , char [ ] qualifiedTypeName , int dim , int modifiers , char [ ] [ ] excludedNames ) { if ( qualifiedTypeName == null || qualifiedTypeName . length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; char [ ] typeName = CharOperation . lastSegment ( qualifiedTypeName , '<CHAR_LIT:.>' ) ; NamingRequestor requestor = new NamingRequestor ( ) ; InternalNamingConventions . suggestVariableNames ( Flags . isStatic ( modifiers ) ? VK_STATIC_FIELD : VK_INSTANCE_FIELD , BK_TYPE_NAME , typeName , javaProject , dim , null , excludedNames , true , requestor ) ; return requestor . getResults ( ) ; } public static String [ ] suggestFieldNames ( IJavaProject javaProject , String packageName , String qualifiedTypeName , int dim , int modifiers , String [ ] excludedNames ) { return convertCharsToString ( suggestFieldNames ( javaProject , packageName . toCharArray ( ) , qualifiedTypeName . toCharArray ( ) , dim , modifiers , convertStringToChars ( excludedNames ) ) ) ; } public static char [ ] suggestGetterName ( IJavaProject project , char [ ] fieldName , int modifiers , boolean isBoolean , char [ ] [ ] excludedNames ) { if ( isBoolean ) { char [ ] name = InternalNamingConventions . getBaseName ( getFieldVariableKind ( modifiers ) , project , fieldName , false ) ; int prefixLen = GETTER_BOOL_NAME . length ; if ( CharOperation . prefixEquals ( GETTER_BOOL_NAME , name ) && name . length > prefixLen && ScannerHelper . isUpperCase ( name [ prefixLen ] ) ) { return suggestNewName ( name , excludedNames ) ; } else { return suggestNewName ( CharOperation . concat ( GETTER_BOOL_NAME , suggestAccessorName ( project , fieldName , modifiers ) ) , excludedNames ) ; } } else { return suggestNewName ( CharOperation . concat ( GETTER_NAME , suggestAccessorName ( project , fieldName , modifiers ) ) , excludedNames ) ; } } public static String suggestGetterName ( IJavaProject project , String fieldName , int modifiers , boolean isBoolean , String [ ] excludedNames ) { return String . valueOf ( suggestGetterName ( project , fieldName . toCharArray ( ) , modifiers , isBoolean , convertStringToChars ( excludedNames ) ) ) ; } public static char [ ] [ ] suggestLocalVariableNames ( IJavaProject javaProject , char [ ] packageName , char [ ] qualifiedTypeName , int dim , char [ ] [ ] excludedNames ) { if ( qualifiedTypeName == null || qualifiedTypeName . length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; char [ ] typeName = CharOperation . lastSegment ( qualifiedTypeName , '<CHAR_LIT:.>' ) ; NamingRequestor requestor = new NamingRequestor ( ) ; InternalNamingConventions . suggestVariableNames ( VK_LOCAL , BK_TYPE_NAME , typeName , javaProject , dim , null , excludedNames , true , requestor ) ; return requestor . getResults ( ) ; } public static String [ ] suggestLocalVariableNames ( IJavaProject javaProject , String packageName , String qualifiedTypeName , int dim , String [ ] excludedNames ) { return convertCharsToString ( suggestLocalVariableNames ( javaProject , packageName . toCharArray ( ) , qualifiedTypeName . toCharArray ( ) , dim , convertStringToChars ( excludedNames ) ) ) ; } private static char [ ] suggestNewName ( char [ ] name , char [ ] [ ] excludedNames ) { if ( excludedNames == null ) { return name ; } char [ ] newName = name ; int count = <NUM_LIT:2> ; int i = <NUM_LIT:0> ; while ( i < excludedNames . length ) { if ( CharOperation . equals ( newName , excludedNames [ i ] , false ) ) { newName = CharOperation . concat ( name , String . valueOf ( count ++ ) . toCharArray ( ) ) ; i = <NUM_LIT:0> ; } else { i ++ ; } } return newName ; } public static char [ ] suggestSetterName ( IJavaProject project , char [ ] fieldName , int modifiers , boolean isBoolean , char [ ] [ ] excludedNames ) { if ( isBoolean ) { char [ ] name = InternalNamingConventions . getBaseName ( getFieldVariableKind ( modifiers ) , project , fieldName , false ) ; int prefixLen = GETTER_BOOL_NAME . length ; if ( CharOperation . prefixEquals ( GETTER_BOOL_NAME , name ) && name . length > prefixLen && ScannerHelper . isUpperCase ( name [ prefixLen ] ) ) { name = CharOperation . subarray ( name , prefixLen , name . length ) ; return suggestNewName ( CharOperation . concat ( SETTER_NAME , suggestAccessorName ( project , name , modifiers ) ) , excludedNames ) ; } else { return suggestNewName ( CharOperation . concat ( SETTER_NAME , suggestAccessorName ( project , fieldName , modifiers ) ) , excludedNames ) ; } } else { return suggestNewName ( CharOperation . concat ( SETTER_NAME , suggestAccessorName ( project , fieldName , modifiers ) ) , excludedNames ) ; } } public static String suggestSetterName ( IJavaProject project , String fieldName , int modifiers , boolean isBoolean , String [ ] excludedNames ) { return String . valueOf ( suggestSetterName ( project , fieldName . toCharArray ( ) , modifiers , isBoolean , convertStringToChars ( excludedNames ) ) ) ; } public static String [ ] suggestVariableNames ( int variableKind , int baseNameKind , String baseName , IJavaProject javaProject , int dim , String [ ] excluded , boolean evaluateDefault ) { NamingRequestor requestor = new NamingRequestor ( ) ; InternalNamingConventions . suggestVariableNames ( variableKind , baseNameKind , baseName . toCharArray ( ) , javaProject , dim , null , convertStringToChars ( excluded ) , evaluateDefault , requestor ) ; return convertCharsToString ( requestor . getResults ( ) ) ; } private NamingConventions ( ) { } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IOpenable { public void close ( ) throws JavaModelException ; public String findRecommendedLineSeparator ( ) throws JavaModelException ; public IBuffer getBuffer ( ) throws JavaModelException ; boolean hasUnsavedChanges ( ) throws JavaModelException ; boolean isConsistent ( ) throws JavaModelException ; boolean isOpen ( ) ; void makeConsistent ( IProgressMonitor progress ) throws JavaModelException ; public void open ( IProgressMonitor progress ) throws JavaModelException ; public void save ( IProgressMonitor progress , boolean force ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IPath ; public interface IClasspathEntry { int CPE_LIBRARY = <NUM_LIT:1> ; int CPE_PROJECT = <NUM_LIT:2> ; int CPE_SOURCE = <NUM_LIT:3> ; int CPE_VARIABLE = <NUM_LIT:4> ; int CPE_CONTAINER = <NUM_LIT:5> ; boolean combineAccessRules ( ) ; IAccessRule [ ] getAccessRules ( ) ; int getContentKind ( ) ; int getEntryKind ( ) ; IPath [ ] getExclusionPatterns ( ) ; IClasspathAttribute [ ] getExtraAttributes ( ) ; IPath [ ] getInclusionPatterns ( ) ; IPath getOutputLocation ( ) ; IPath getPath ( ) ; IPath getSourceAttachmentPath ( ) ; IPath getSourceAttachmentRootPath ( ) ; IClasspathEntry getReferencingEntry ( ) ; boolean isExported ( ) ; IClasspathEntry getResolvedEntry ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import java . io . InputStream ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IType extends IMember , IAnnotatable { void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , ICompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException ; void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; IField createField ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException ; IInitializer createInitializer ( String contents , IJavaElement sibling , IProgressMonitor monitor ) throws JavaModelException ; IMethod createMethod ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException ; IType createType ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException ; IMethod [ ] findMethods ( IMethod method ) ; IJavaElement [ ] getChildrenForCategory ( String category ) throws JavaModelException ; String getElementName ( ) ; IField getField ( String name ) ; IField [ ] getFields ( ) throws JavaModelException ; String getFullyQualifiedName ( ) ; String getFullyQualifiedName ( char enclosingTypeSeparator ) ; String getFullyQualifiedParameterizedName ( ) throws JavaModelException ; IInitializer getInitializer ( int occurrenceCount ) ; IInitializer [ ] getInitializers ( ) throws JavaModelException ; String getKey ( ) ; IMethod getMethod ( String name , String [ ] parameterTypeSignatures ) ; IMethod [ ] getMethods ( ) throws JavaModelException ; IPackageFragment getPackageFragment ( ) ; String getSuperclassName ( ) throws JavaModelException ; String getSuperclassTypeSignature ( ) throws JavaModelException ; String [ ] getSuperInterfaceTypeSignatures ( ) throws JavaModelException ; String [ ] getSuperInterfaceNames ( ) throws JavaModelException ; String [ ] getTypeParameterSignatures ( ) throws JavaModelException ; ITypeParameter [ ] getTypeParameters ( ) throws JavaModelException ; IType getType ( String name ) ; ITypeParameter getTypeParameter ( String name ) ; String getTypeQualifiedName ( ) ; String getTypeQualifiedName ( char enclosingTypeSeparator ) ; IType [ ] getTypes ( ) throws JavaModelException ; boolean isAnonymous ( ) throws JavaModelException ; boolean isClass ( ) throws JavaModelException ; boolean isEnum ( ) throws JavaModelException ; boolean isInterface ( ) throws JavaModelException ; boolean isAnnotation ( ) throws JavaModelException ; boolean isLocal ( ) throws JavaModelException ; boolean isMember ( ) throws JavaModelException ; boolean isResolved ( ) ; ITypeHierarchy loadTypeHierachy ( InputStream input , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newSupertypeHierarchy ( IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newSupertypeHierarchy ( ICompilationUnit [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newSupertypeHierarchy ( IWorkingCopy [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newSupertypeHierarchy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IJavaProject project , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IJavaProject project , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( ICompilationUnit [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IWorkingCopy [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; String [ ] [ ] resolveType ( String typeName ) throws JavaModelException ; String [ ] [ ] resolveType ( String typeName , WorkingCopyOwner owner ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IStorage ; import org . eclipse . core . runtime . IPath ; public interface IJarEntryResource extends IStorage { IJarEntryResource [ ] getChildren ( ) ; IPath getFullPath ( ) ; Object getParent ( ) ; IPackageFragmentRoot getPackageFragmentRoot ( ) ; boolean isFile ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IMarker ; public interface ICodeCompletionRequestor { void acceptClass ( char [ ] packageName , char [ ] className , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) ; void acceptError ( IMarker marker ) ; void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , char [ ] typePackageName , char [ ] typeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) ; void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) ; void acceptKeyword ( char [ ] keywordName , int completionStart , int completionEnd ) ; void acceptLabel ( char [ ] labelName , int completionStart , int completionEnd ) ; void acceptLocalVariable ( char [ ] name , char [ ] typePackageName , char [ ] typeName , int modifiers , int completionStart , int completionEnd ) ; void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) ; void acceptModifier ( char [ ] modifierName , int completionStart , int completionEnd ) ; void acceptPackage ( char [ ] packageName , char [ ] completionName , int completionStart , int completionEnd ) ; void acceptType ( char [ ] packageName , char [ ] typeName , char [ ] completionName , int completionStart , int completionEnd ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IAnnotation extends IJavaElement , ISourceReference { String getElementName ( ) ; IMemberValuePair [ ] getMemberValuePairs ( ) throws JavaModelException ; ISourceRange getNameRange ( ) throws JavaModelException ; int getOccurrenceCount ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . Hashtable ; import java . util . Map ; import org . eclipse . core . resources . * ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . parser . * ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class CorrectionEngine { protected int correctionStart ; protected int correctionEnd ; protected int prefixLength ; protected ICompilationUnit compilationUnit ; protected ICorrectionRequestor correctionRequestor ; protected static final int CLASSES = <NUM_LIT> ; protected static final int INTERFACES = <NUM_LIT> ; protected static final int IMPORT = <NUM_LIT> ; protected static final int METHOD = <NUM_LIT> ; protected static final int FIELD = <NUM_LIT> ; protected static final int LOCAL = <NUM_LIT> ; protected int filter ; public CorrectionEngine ( Map setting ) { } public void computeCorrections ( IMarker marker , ICompilationUnit targetUnit , int positionOffset , ICorrectionRequestor requestor ) throws JavaModelException { IJavaElement element = targetUnit == null ? JavaCore . create ( marker . getResource ( ) ) : targetUnit ; if ( ! ( element instanceof ICompilationUnit ) ) return ; ICompilationUnit unit = ( ICompilationUnit ) element ; int id = marker . getAttribute ( IJavaModelMarker . ID , - <NUM_LIT:1> ) ; String [ ] args = Util . getProblemArgumentsFromMarker ( marker . getAttribute ( IJavaModelMarker . ARGUMENTS , "<STR_LIT>" ) ) ; int start = marker . getAttribute ( IMarker . CHAR_START , - <NUM_LIT:1> ) ; int end = marker . getAttribute ( IMarker . CHAR_END , - <NUM_LIT:1> ) ; computeCorrections ( unit , id , start + positionOffset , end + positionOffset , args , requestor ) ; } public void computeCorrections ( IProblem problem , ICompilationUnit targetUnit , ICorrectionRequestor requestor ) throws JavaModelException { if ( requestor == null ) { throw new IllegalArgumentException ( Messages . correction_nullUnit ) ; } this . computeCorrections ( targetUnit , problem . getID ( ) , problem . getSourceStart ( ) , problem . getSourceEnd ( ) , problem . getArguments ( ) , requestor ) ; } private void computeCorrections ( ICompilationUnit unit , int id , int start , int end , String [ ] arguments , ICorrectionRequestor requestor ) { if ( id == - <NUM_LIT:1> || arguments == null || start == - <NUM_LIT:1> || end == - <NUM_LIT:1> ) return ; if ( requestor == null ) { throw new IllegalArgumentException ( Messages . correction_nullRequestor ) ; } this . correctionRequestor = requestor ; this . correctionStart = start ; this . correctionEnd = end ; this . compilationUnit = unit ; String argument = null ; try { switch ( id ) { case IProblem . ImportNotFound : this . filter = IMPORT ; argument = arguments [ <NUM_LIT:0> ] ; break ; case IProblem . UndefinedType : this . filter = CLASSES | INTERFACES ; argument = arguments [ <NUM_LIT:0> ] ; break ; case IProblem . UndefinedMethod : this . filter = METHOD ; argument = arguments [ <NUM_LIT:1> ] ; break ; case IProblem . UndefinedField : this . filter = FIELD ; argument = arguments [ <NUM_LIT:0> ] ; break ; case IProblem . UndefinedName : case IProblem . UnresolvedVariable : this . filter = FIELD | LOCAL ; argument = arguments [ <NUM_LIT:0> ] ; break ; } } catch ( ArrayIndexOutOfBoundsException e ) { return ; } if ( argument != null ) { correct ( argument . toCharArray ( ) ) ; } } private void correct ( char [ ] argument ) { try { String source = this . compilationUnit . getSource ( ) ; Map currentProjectOptions = this . compilationUnit . getJavaProject ( ) . getOptions ( true ) ; long sourceLevel = CompilerOptions . versionToJdkLevel ( currentProjectOptions . get ( JavaCore . COMPILER_SOURCE ) ) ; long complianceLevel = CompilerOptions . versionToJdkLevel ( currentProjectOptions . get ( JavaCore . COMPILER_COMPLIANCE ) ) ; Scanner scanner = new Scanner ( false , false , false , sourceLevel , complianceLevel , null , null , true ) ; scanner . setSource ( source . toCharArray ( ) ) ; scanner . resetTo ( this . correctionStart , this . correctionEnd ) ; int token = <NUM_LIT:0> ; char [ ] argumentSource = CharOperation . NO_CHAR ; while ( true ) { token = scanner . getNextToken ( ) ; if ( token == TerminalTokens . TokenNameEOF ) return ; char [ ] tokenSource = scanner . getCurrentTokenSource ( ) ; argumentSource = CharOperation . concat ( argumentSource , tokenSource ) ; if ( ! CharOperation . prefixEquals ( argumentSource , argument ) ) return ; if ( CharOperation . equals ( argument , argumentSource ) ) { this . correctionStart = scanner . startPosition ; this . correctionEnd = scanner . currentPosition ; this . prefixLength = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , argument ) + <NUM_LIT:1> ; break ; } } int completionPosition = this . correctionStart ; scanner . resetTo ( completionPosition , this . correctionEnd ) ; int position = completionPosition ; for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:4> ; i ++ ) { if ( scanner . getNextCharAsJavaIdentifierPart ( ) ) { completionPosition = position ; position = scanner . currentPosition ; } else { break ; } } Hashtable oldOptions = JavaCore . getOptions ( ) ; try { Hashtable options = new Hashtable ( oldOptions ) ; options . put ( JavaCore . CODEASSIST_CAMEL_CASE_MATCH , JavaCore . DISABLED ) ; JavaCore . setOptions ( options ) ; this . compilationUnit . codeComplete ( completionPosition , this . completionRequestor ) ; } finally { JavaCore . setOptions ( oldOptions ) ; } } catch ( JavaModelException e ) { return ; } catch ( InvalidInputException e ) { return ; } } protected CompletionRequestor completionRequestor = new CompletionRequestor ( ) { public void accept ( CompletionProposal proposal ) { switch ( proposal . getKind ( ) ) { case CompletionProposal . TYPE_REF : int flags = proposal . getFlags ( ) ; if ( ! ( Flags . isEnum ( flags ) || Flags . isAnnotation ( flags ) ) ) { if ( ( CorrectionEngine . this . filter & ( CLASSES | INTERFACES ) ) != <NUM_LIT:0> ) { char [ ] completionName = proposal . getCompletion ( ) ; CorrectionEngine . this . correctionRequestor . acceptClass ( proposal . getDeclarationSignature ( ) , Signature . getSignatureSimpleName ( proposal . getSignature ( ) ) , CharOperation . subarray ( completionName , CorrectionEngine . this . prefixLength , completionName . length ) , proposal . getFlags ( ) , CorrectionEngine . this . correctionStart , CorrectionEngine . this . correctionEnd ) ; } else if ( ( CorrectionEngine . this . filter & IMPORT ) != <NUM_LIT:0> ) { char [ ] packageName = proposal . getDeclarationSignature ( ) ; char [ ] className = Signature . getSignatureSimpleName ( proposal . getSignature ( ) ) ; char [ ] fullName = CharOperation . concat ( packageName , className , '<CHAR_LIT:.>' ) ; CorrectionEngine . this . correctionRequestor . acceptClass ( packageName , className , CharOperation . subarray ( fullName , CorrectionEngine . this . prefixLength , fullName . length ) , proposal . getFlags ( ) , CorrectionEngine . this . correctionStart , CorrectionEngine . this . correctionEnd ) ; } } break ; case CompletionProposal . FIELD_REF : if ( ( CorrectionEngine . this . filter & FIELD ) != <NUM_LIT:0> ) { char [ ] declaringSignature = proposal . getDeclarationSignature ( ) ; char [ ] signature = proposal . getSignature ( ) ; CorrectionEngine . this . correctionRequestor . acceptField ( Signature . getSignatureQualifier ( declaringSignature ) , Signature . getSignatureSimpleName ( declaringSignature ) , proposal . getName ( ) , Signature . getSignatureQualifier ( signature ) , Signature . getSignatureSimpleName ( signature ) , proposal . getName ( ) , proposal . getFlags ( ) , CorrectionEngine . this . correctionStart , CorrectionEngine . this . correctionEnd ) ; } break ; case CompletionProposal . LOCAL_VARIABLE_REF : if ( ( CorrectionEngine . this . filter & LOCAL ) != <NUM_LIT:0> ) { char [ ] signature = proposal . getSignature ( ) ; CorrectionEngine . this . correctionRequestor . acceptLocalVariable ( proposal . getName ( ) , Signature . getSignatureQualifier ( signature ) , Signature . getSignatureSimpleName ( signature ) , proposal . getFlags ( ) , CorrectionEngine . this . correctionStart , CorrectionEngine . this . correctionEnd ) ; } break ; case CompletionProposal . METHOD_REF : if ( ( CorrectionEngine . this . filter & METHOD ) != <NUM_LIT:0> ) { char [ ] declaringSignature = proposal . getDeclarationSignature ( ) ; char [ ] signature = proposal . getSignature ( ) ; char [ ] [ ] parameterTypeSignatures = Signature . getParameterTypes ( signature ) ; int length = parameterTypeSignatures . length ; char [ ] [ ] parameterPackageNames = new char [ length ] [ ] ; char [ ] [ ] parameterTypeNames = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { parameterPackageNames [ i ] = Signature . getSignatureQualifier ( parameterTypeSignatures [ i ] ) ; parameterTypeNames [ i ] = Signature . getSignatureSimpleName ( parameterTypeSignatures [ i ] ) ; } char [ ] returnTypeSignature = Signature . getReturnType ( signature ) ; CorrectionEngine . this . correctionRequestor . acceptMethod ( Signature . getSignatureQualifier ( declaringSignature ) , Signature . getSignatureSimpleName ( declaringSignature ) , proposal . getName ( ) , parameterPackageNames , parameterTypeNames , proposal . findParameterNames ( null ) , Signature . getSignatureQualifier ( returnTypeSignature ) , Signature . getSignatureSimpleName ( returnTypeSignature ) , proposal . getName ( ) , proposal . getFlags ( ) , CorrectionEngine . this . correctionStart , CorrectionEngine . this . correctionEnd ) ; } break ; case CompletionProposal . PACKAGE_REF : if ( ( CorrectionEngine . this . filter & ( CLASSES | INTERFACES | IMPORT ) ) != <NUM_LIT:0> ) { char [ ] packageName = proposal . getDeclarationSignature ( ) ; CorrectionEngine . this . correctionRequestor . acceptPackage ( packageName , CharOperation . subarray ( packageName , CorrectionEngine . this . prefixLength , packageName . length ) , CorrectionEngine . this . correctionStart , CorrectionEngine . this . correctionEnd ) ; } break ; } } } ; public static String [ ] getAllWarningTokens ( ) { return CompilerOptions . warningTokens ; } public static String [ ] getProblemArguments ( IMarker problemMarker ) { String argumentsString = problemMarker . getAttribute ( IJavaModelMarker . ARGUMENTS , null ) ; return Util . getProblemArgumentsFromMarker ( argumentsString ) ; } public static String getWarningToken ( int problemID ) { int irritant = ProblemReporter . getIrritant ( problemID ) ; if ( irritant != <NUM_LIT:0> ) { return CompilerOptions . warningTokenFromIrritant ( irritant ) ; } return null ; } } </s>
<s> package org . eclipse . jdt . core ; public interface ISourceRange { int getLength ( ) ; int getOffset ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public abstract class ClasspathVariableInitializer { public ClasspathVariableInitializer ( ) { } public abstract void initialize ( String variable ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IPackageDeclaration extends IJavaElement , ISourceReference , IAnnotatable { String getElementName ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . util . HashMap ; import java . util . Map ; import java . util . zip . ZipEntry ; import java . util . zip . ZipFile ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . compiler . IScanner ; import org . eclipse . jdt . core . compiler . ITerminalSymbols ; import org . eclipse . jdt . core . formatter . CodeFormatter ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . core . util . ClassFileBytesDisassembler ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . JarPackageFragmentRoot ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . PackageFragment ; import org . eclipse . jdt . internal . core . util . ClassFileReader ; import org . eclipse . jdt . internal . core . util . Disassembler ; import org . eclipse . jdt . internal . core . util . PublicScanner ; import org . eclipse . jdt . internal . formatter . DefaultCodeFormatter ; public class ToolFactory { public static final int M_FORMAT_NEW = new Integer ( <NUM_LIT:0> ) . intValue ( ) ; public static final int M_FORMAT_EXISTING = new Integer ( <NUM_LIT:1> ) . intValue ( ) ; public static ICodeFormatter createCodeFormatter ( ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = jdtCorePlugin . getDescriptor ( ) . getExtensionPoint ( JavaModelManager . FORMATTER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { try { Object execExt = configElements [ j ] . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( execExt instanceof ICodeFormatter ) { return ( ICodeFormatter ) execExt ; } } catch ( CoreException e ) { } } } } return createDefaultCodeFormatter ( null ) ; } public static CodeFormatter createCodeFormatter ( Map options ) { return createCodeFormatter ( options , M_FORMAT_NEW ) ; } public static CodeFormatter createCodeFormatter ( Map options , int mode ) { if ( options == null ) options = JavaCore . getOptions ( ) ; Map currentOptions = new HashMap ( options ) ; if ( mode == M_FORMAT_NEW ) { currentOptions . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN , DefaultCodeFormatterConstants . TRUE ) ; currentOptions . put ( DefaultCodeFormatterConstants . FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN , DefaultCodeFormatterConstants . FALSE ) ; currentOptions . put ( DefaultCodeFormatterConstants . FORMATTER_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN , DefaultCodeFormatterConstants . FALSE ) ; } return new DefaultCodeFormatter ( currentOptions ) ; } public static ClassFileBytesDisassembler createDefaultClassFileBytesDisassembler ( ) { return new Disassembler ( ) ; } public static org . eclipse . jdt . core . util . IClassFileDisassembler createDefaultClassFileDisassembler ( ) { class DeprecatedDisassembler extends Disassembler implements org . eclipse . jdt . core . util . IClassFileDisassembler { } return new DeprecatedDisassembler ( ) ; } public static IClassFileReader createDefaultClassFileReader ( IClassFile classfile , int decodingFlag ) { IPackageFragmentRoot root = ( IPackageFragmentRoot ) classfile . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; if ( root != null ) { try { if ( root instanceof JarPackageFragmentRoot ) { String archiveName = null ; ZipFile jar = null ; try { jar = ( ( JarPackageFragmentRoot ) root ) . getJar ( ) ; archiveName = jar . getName ( ) ; } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( jar ) ; } PackageFragment packageFragment = ( PackageFragment ) classfile . getParent ( ) ; String classFileName = classfile . getElementName ( ) ; String entryName = org . eclipse . jdt . internal . core . util . Util . concatWith ( packageFragment . names , classFileName , '<CHAR_LIT:/>' ) ; return createDefaultClassFileReader ( archiveName , entryName , decodingFlag ) ; } else { InputStream in = null ; try { in = ( ( IFile ) ( ( JavaElement ) classfile ) . resource ( ) ) . getContents ( ) ; return createDefaultClassFileReader ( in , decodingFlag ) ; } finally { if ( in != null ) try { in . close ( ) ; } catch ( IOException e ) { } } } } catch ( CoreException e ) { } } return null ; } public static IClassFileReader createDefaultClassFileReader ( InputStream stream , int decodingFlag ) { try { return new ClassFileReader ( Util . getInputStreamAsByteArray ( stream , - <NUM_LIT:1> ) , decodingFlag ) ; } catch ( ClassFormatException e ) { return null ; } catch ( IOException e ) { return null ; } } public static IClassFileReader createDefaultClassFileReader ( String fileName , int decodingFlag ) { try { return new ClassFileReader ( Util . getFileByteContent ( new File ( fileName ) ) , decodingFlag ) ; } catch ( ClassFormatException e ) { return null ; } catch ( IOException e ) { return null ; } } public static IClassFileReader createDefaultClassFileReader ( String zipFileName , String zipEntryName , int decodingFlag ) { ZipFile zipFile = null ; try { if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + zipFileName ) ; } zipFile = new ZipFile ( zipFileName ) ; ZipEntry zipEntry = zipFile . getEntry ( zipEntryName ) ; if ( zipEntry == null ) { return null ; } if ( ! zipEntryName . toLowerCase ( ) . endsWith ( SuffixConstants . SUFFIX_STRING_class ) ) { return null ; } byte classFileBytes [ ] = Util . getZipEntryByteContent ( zipEntry , zipFile ) ; return new ClassFileReader ( classFileBytes , decodingFlag ) ; } catch ( ClassFormatException e ) { return null ; } catch ( IOException e ) { return null ; } finally { if ( zipFile != null ) { try { zipFile . close ( ) ; } catch ( IOException e ) { } } } } public static ICodeFormatter createDefaultCodeFormatter ( Map options ) { if ( options == null ) options = JavaCore . getOptions ( ) ; return new org . eclipse . jdt . internal . formatter . old . CodeFormatter ( options ) ; } public static IScanner createScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean assertMode , boolean recordLineSeparator ) { long complianceLevelValue = CompilerOptions . versionToJdkLevel ( JavaCore . getOption ( JavaCore . COMPILER_COMPLIANCE ) ) ; if ( complianceLevelValue == <NUM_LIT:0> ) complianceLevelValue = ClassFileConstants . JDK1_4 ; PublicScanner scanner = new PublicScanner ( tokenizeComments , tokenizeWhiteSpace , false , assertMode ? ClassFileConstants . JDK1_4 : ClassFileConstants . JDK1_3 , complianceLevelValue , null , null , true ) ; scanner . recordLineSeparator = recordLineSeparator ; return scanner ; } public static IScanner createScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean recordLineSeparator , String sourceLevel ) { long complianceLevelValue = CompilerOptions . versionToJdkLevel ( JavaCore . getOption ( JavaCore . COMPILER_COMPLIANCE ) ) ; if ( complianceLevelValue == <NUM_LIT:0> ) complianceLevelValue = ClassFileConstants . JDK1_4 ; long sourceLevelValue = CompilerOptions . versionToJdkLevel ( sourceLevel ) ; if ( sourceLevelValue == <NUM_LIT:0> ) sourceLevelValue = ClassFileConstants . JDK1_3 ; PublicScanner scanner = new PublicScanner ( tokenizeComments , tokenizeWhiteSpace , false , sourceLevelValue , complianceLevelValue , null , null , true ) ; scanner . recordLineSeparator = recordLineSeparator ; return scanner ; } public static IScanner createScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean recordLineSeparator , String sourceLevel , String complianceLevel ) { PublicScanner scanner = null ; long sourceLevelValue = CompilerOptions . versionToJdkLevel ( sourceLevel ) ; if ( sourceLevelValue == <NUM_LIT:0> ) sourceLevelValue = ClassFileConstants . JDK1_3 ; long complianceLevelValue = CompilerOptions . versionToJdkLevel ( complianceLevel ) ; if ( complianceLevelValue == <NUM_LIT:0> ) complianceLevelValue = ClassFileConstants . JDK1_4 ; scanner = new PublicScanner ( tokenizeComments , tokenizeWhiteSpace , false , sourceLevelValue , complianceLevelValue , null , null , true ) ; scanner . recordLineSeparator = recordLineSeparator ; return scanner ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . core . compiler . IProblem ; public abstract class CompletionRequestor { private int ignoreSet = <NUM_LIT:0> ; private String [ ] favoriteReferences ; private int requiredProposalAllowSet [ ] = null ; private boolean requireExtendedContext = false ; public CompletionRequestor ( ) { this ( false ) ; } public CompletionRequestor ( boolean ignoreAll ) { this . ignoreSet = ignoreAll ? <NUM_LIT> : <NUM_LIT> ; } public boolean isIgnored ( int completionProposalKind ) { if ( completionProposalKind < CompletionProposal . FIRST_KIND || completionProposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "<STR_LIT>" + completionProposalKind ) ; } return <NUM_LIT:0> != ( this . ignoreSet & ( <NUM_LIT:1> << completionProposalKind ) ) ; } public void setIgnored ( int completionProposalKind , boolean ignore ) { if ( completionProposalKind < CompletionProposal . FIRST_KIND || completionProposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "<STR_LIT>" + completionProposalKind ) ; } if ( ignore ) { this . ignoreSet |= ( <NUM_LIT:1> << completionProposalKind ) ; } else { this . ignoreSet &= ~ ( <NUM_LIT:1> << completionProposalKind ) ; } } public boolean isAllowingRequiredProposals ( int proposalKind , int requiredProposalKind ) { if ( proposalKind < CompletionProposal . FIRST_KIND || proposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "<STR_LIT>" + requiredProposalKind ) ; } if ( requiredProposalKind < CompletionProposal . FIRST_KIND || requiredProposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "<STR_LIT>" + requiredProposalKind ) ; } if ( this . requiredProposalAllowSet == null ) return false ; return <NUM_LIT:0> != ( this . requiredProposalAllowSet [ proposalKind ] & ( <NUM_LIT:1> << requiredProposalKind ) ) ; } public void setAllowsRequiredProposals ( int proposalKind , int requiredProposalKind , boolean allow ) { if ( proposalKind < CompletionProposal . FIRST_KIND || proposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "<STR_LIT>" + requiredProposalKind ) ; } if ( requiredProposalKind < CompletionProposal . FIRST_KIND || requiredProposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "<STR_LIT>" + requiredProposalKind ) ; } if ( this . requiredProposalAllowSet == null ) { this . requiredProposalAllowSet = new int [ CompletionProposal . LAST_KIND + <NUM_LIT:1> ] ; } if ( allow ) { this . requiredProposalAllowSet [ proposalKind ] |= ( <NUM_LIT:1> << requiredProposalKind ) ; } else { this . requiredProposalAllowSet [ proposalKind ] &= ~ ( <NUM_LIT:1> << requiredProposalKind ) ; } } public String [ ] getFavoriteReferences ( ) { return this . favoriteReferences ; } public void setFavoriteReferences ( String [ ] favoriteImports ) { this . favoriteReferences = favoriteImports ; } public void beginReporting ( ) { } public void endReporting ( ) { } public void completionFailure ( IProblem problem ) { } public abstract void accept ( CompletionProposal proposal ) ; public void acceptContext ( CompletionContext context ) { } public boolean isExtendedContextRequired ( ) { return this . requireExtendedContext ; } public void setRequireExtendedContext ( boolean require ) { this . requireExtendedContext = require ; } } </s>
<s> package org . eclipse . jdt . core ; public interface IMethod extends IMember , IAnnotatable { IMemberValuePair getDefaultValue ( ) throws JavaModelException ; String getElementName ( ) ; String [ ] getExceptionTypes ( ) throws JavaModelException ; String [ ] getTypeParameterSignatures ( ) throws JavaModelException ; ITypeParameter [ ] getTypeParameters ( ) throws JavaModelException ; int getNumberOfParameters ( ) ; String getKey ( ) ; String [ ] getParameterNames ( ) throws JavaModelException ; String [ ] getParameterTypes ( ) ; String [ ] getRawParameterNames ( ) throws JavaModelException ; String getReturnType ( ) throws JavaModelException ; String getSignature ( ) throws JavaModelException ; ITypeParameter getTypeParameter ( String name ) ; boolean isConstructor ( ) throws JavaModelException ; boolean isMainMethod ( ) throws JavaModelException ; boolean isResolved ( ) ; boolean isSimilar ( IMethod method ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface ICorrectionRequestor { void acceptClass ( char [ ] packageName , char [ ] className , char [ ] correctionName , int modifiers , int correctionStart , int correctionEnd ) ; void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , char [ ] typePackageName , char [ ] typeName , char [ ] correctionName , int modifiers , int correctionStart , int correctionEnd ) ; void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] correctionName , int modifiers , int correctionStart , int correctionEnd ) ; void acceptLocalVariable ( char [ ] name , char [ ] typePackageName , char [ ] typeName , int modifiers , int correctionStart , int correctionEnd ) ; void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] correctionName , int modifiers , int correctionStart , int correctionEnd ) ; void acceptPackage ( char [ ] packageName , char [ ] correctionName , int correctionStart , int correctionEnd ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . core . compiler . IProblem ; public class CompletionRequestorAdapter implements ICompletionRequestor { public void acceptAnonymousType ( char [ ] superTypePackageName , char [ ] superTypeName , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptClass ( char [ ] packageName , char [ ] className , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptError ( IProblem error ) { } public void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , char [ ] typePackageName , char [ ] typeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptKeyword ( char [ ] keywordName , int completionStart , int completionEnd , int relevance ) { } public void acceptLabel ( char [ ] labelName , int completionStart , int completionEnd , int relevance ) { } public void acceptLocalVariable ( char [ ] name , char [ ] typePackageName , char [ ] typeName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptMethodDeclaration ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptModifier ( char [ ] modifierName , int completionStart , int completionEnd , int relevance ) { } public void acceptPackage ( char [ ] packageName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { } public void acceptType ( char [ ] packageName , char [ ] typeName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { } public void acceptVariableName ( char [ ] typePackageName , char [ ] typeName , char [ ] name , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { } } </s>
<s> package org . eclipse . jdt . core ; public interface IImportDeclaration extends IJavaElement , ISourceReference , ISourceManipulation { String getElementName ( ) ; int getFlags ( ) throws JavaModelException ; boolean isOnDemand ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public final class SourceRange implements ISourceRange { public static boolean isAvailable ( ISourceRange range ) { return range != null && range . getOffset ( ) != - <NUM_LIT:1> ; } private int offset ; private int length ; public SourceRange ( int offset , int length ) { this . offset = offset ; this . length = length ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof ISourceRange ) ) return false ; ISourceRange sourceRange = ( ISourceRange ) obj ; return sourceRange . getOffset ( ) == this . offset && sourceRange . getLength ( ) == this . length ; } public int getLength ( ) { return this . length ; } public int getOffset ( ) { return this . offset ; } public int hashCode ( ) { return this . length ^ this . offset ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . offset ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . length ) ; buffer . append ( "<STR_LIT:]>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core ; import java . util . StringTokenizer ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . util . Messages ; public final class JavaConventions { private static final char DOT = '<CHAR_LIT:.>' ; private static final String PACKAGE_INFO = new String ( TypeConstants . PACKAGE_INFO_NAME ) ; private static final Scanner SCANNER = new Scanner ( false , true , false , ClassFileConstants . JDK1_3 , null , null , true ) ; private JavaConventions ( ) { } public static boolean isOverlappingRoots ( IPath rootPath1 , IPath rootPath2 ) { if ( rootPath1 == null || rootPath2 == null ) { return false ; } return rootPath1 . isPrefixOf ( rootPath2 ) || rootPath2 . isPrefixOf ( rootPath1 ) ; } private static synchronized char [ ] scannedIdentifier ( String id , String sourceLevel , String complianceLevel ) { if ( id == null ) { return null ; } SCANNER . sourceLevel = sourceLevel == null ? ClassFileConstants . JDK1_3 : CompilerOptions . versionToJdkLevel ( sourceLevel ) ; SCANNER . complianceLevel = complianceLevel == null ? ClassFileConstants . JDK1_3 : CompilerOptions . versionToJdkLevel ( complianceLevel ) ; try { SCANNER . setSource ( id . toCharArray ( ) ) ; int token = SCANNER . scanIdentifier ( ) ; if ( token != TerminalTokens . TokenNameIdentifier ) return null ; if ( SCANNER . currentPosition == SCANNER . eofPosition ) { try { return SCANNER . getCurrentIdentifierSource ( ) ; } catch ( ArrayIndexOutOfBoundsException e ) { return null ; } } else { return null ; } } catch ( InvalidInputException e ) { return null ; } } public static IStatus validateCompilationUnitName ( String name ) { return validateCompilationUnitName ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateCompilationUnitName ( String name , String sourceLevel , String complianceLevel ) { if ( name == null ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_unit_nullName , null ) ; } if ( ! org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( name ) ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_unit_notJavaName , null ) ; } String identifier ; int index ; index = name . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( index == - <NUM_LIT:1> ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_unit_notJavaName , null ) ; } identifier = name . substring ( <NUM_LIT:0> , index ) ; if ( ! identifier . equals ( PACKAGE_INFO ) ) { IStatus status = validateIdentifier ( identifier , sourceLevel , complianceLevel ) ; if ( ! status . isOK ( ) ) { return status ; } } IStatus status = ResourcesPlugin . getWorkspace ( ) . validateName ( name , IResource . FILE ) ; if ( ! status . isOK ( ) ) { return status ; } return JavaModelStatus . VERIFIED_OK ; } public static IStatus validateClassFileName ( String name ) { return validateClassFileName ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateClassFileName ( String name , String sourceLevel , String complianceLevel ) { if ( name == null ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_classFile_nullName , null ) ; } if ( ! org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( name ) ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_classFile_notClassFileName , null ) ; } String identifier ; int index ; index = name . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( index == - <NUM_LIT:1> ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_classFile_notClassFileName , null ) ; } identifier = name . substring ( <NUM_LIT:0> , index ) ; if ( ! identifier . equals ( PACKAGE_INFO ) ) { IStatus status = validateIdentifier ( identifier , sourceLevel , complianceLevel ) ; if ( ! status . isOK ( ) ) { return status ; } } IStatus status = ResourcesPlugin . getWorkspace ( ) . validateName ( name , IResource . FILE ) ; if ( ! status . isOK ( ) ) { return status ; } return JavaModelStatus . VERIFIED_OK ; } public static IStatus validateFieldName ( String name ) { return validateIdentifier ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateFieldName ( String name , String sourceLevel , String complianceLevel ) { return validateIdentifier ( name , sourceLevel , complianceLevel ) ; } public static IStatus validateIdentifier ( String id ) { return validateIdentifier ( id , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateIdentifier ( String id , String sourceLevel , String complianceLevel ) { if ( scannedIdentifier ( id , sourceLevel , complianceLevel ) != null ) { return JavaModelStatus . VERIFIED_OK ; } else { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . convention_illegalIdentifier , id ) , null ) ; } } public static IStatus validateImportDeclaration ( String name ) { return validateImportDeclaration ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateImportDeclaration ( String name , String sourceLevel , String complianceLevel ) { if ( name == null || name . length ( ) == <NUM_LIT:0> ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_import_nullImport , null ) ; } if ( name . charAt ( name . length ( ) - <NUM_LIT:1> ) == '<CHAR_LIT>' ) { if ( name . charAt ( name . length ( ) - <NUM_LIT:2> ) == '<CHAR_LIT:.>' ) { return validatePackageName ( name . substring ( <NUM_LIT:0> , name . length ( ) - <NUM_LIT:2> ) , sourceLevel , complianceLevel ) ; } else { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_import_unqualifiedImport , null ) ; } } return validatePackageName ( name , sourceLevel , complianceLevel ) ; } public static IStatus validateJavaTypeName ( String name ) { return validateJavaTypeName ( name , JavaCore . VERSION_1_3 , JavaCore . VERSION_1_3 ) ; } public static IStatus validateJavaTypeName ( String name , String sourceLevel , String complianceLevel ) { if ( name == null ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_type_nullName , null ) ; } String trimmed = name . trim ( ) ; if ( ! name . equals ( trimmed ) ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_type_nameWithBlanks , null ) ; } int index = name . lastIndexOf ( '<CHAR_LIT:.>' ) ; char [ ] scannedID ; if ( index == - <NUM_LIT:1> ) { scannedID = scannedIdentifier ( name , sourceLevel , complianceLevel ) ; } else { String pkg = name . substring ( <NUM_LIT:0> , index ) . trim ( ) ; IStatus status = validatePackageName ( pkg , sourceLevel , complianceLevel ) ; if ( ! status . isOK ( ) ) { return status ; } String type = name . substring ( index + <NUM_LIT:1> ) . trim ( ) ; scannedID = scannedIdentifier ( type , sourceLevel , complianceLevel ) ; } if ( scannedID != null ) { IStatus status = ResourcesPlugin . getWorkspace ( ) . validateName ( new String ( scannedID ) , IResource . FILE ) ; if ( ! status . isOK ( ) ) { return status ; } if ( CharOperation . contains ( '<CHAR_LIT>' , scannedID ) ) { return new Status ( IStatus . WARNING , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_type_dollarName , null ) ; } if ( ( scannedID . length > <NUM_LIT:0> && ScannerHelper . isLowerCase ( scannedID [ <NUM_LIT:0> ] ) ) ) { return new Status ( IStatus . WARNING , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_type_lowercaseName , null ) ; } return JavaModelStatus . VERIFIED_OK ; } else { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . convention_type_invalidName , name ) , null ) ; } } public static IStatus validateMethodName ( String name ) { return validateMethodName ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateMethodName ( String name , String sourceLevel , String complianceLevel ) { return validateIdentifier ( name , sourceLevel , complianceLevel ) ; } public static IStatus validatePackageName ( String name ) { return validatePackageName ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validatePackageName ( String name , String sourceLevel , String complianceLevel ) { if ( name == null ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_package_nullName , null ) ; } int length ; if ( ( length = name . length ( ) ) == <NUM_LIT:0> ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_package_emptyName , null ) ; } if ( name . charAt ( <NUM_LIT:0> ) == DOT || name . charAt ( length - <NUM_LIT:1> ) == DOT ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_package_dotName , null ) ; } if ( CharOperation . isWhitespace ( name . charAt ( <NUM_LIT:0> ) ) || CharOperation . isWhitespace ( name . charAt ( name . length ( ) - <NUM_LIT:1> ) ) ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_package_nameWithBlanks , null ) ; } int dot = <NUM_LIT:0> ; while ( dot != - <NUM_LIT:1> && dot < length - <NUM_LIT:1> ) { if ( ( dot = name . indexOf ( DOT , dot + <NUM_LIT:1> ) ) != - <NUM_LIT:1> && dot < length - <NUM_LIT:1> && name . charAt ( dot + <NUM_LIT:1> ) == DOT ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_package_consecutiveDotsName , null ) ; } } IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; StringTokenizer st = new StringTokenizer ( name , "<STR_LIT:.>" ) ; boolean firstToken = true ; IStatus warningStatus = null ; while ( st . hasMoreTokens ( ) ) { String typeName = st . nextToken ( ) ; typeName = typeName . trim ( ) ; char [ ] scannedID = scannedIdentifier ( typeName , sourceLevel , complianceLevel ) ; if ( scannedID == null ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . convention_illegalIdentifier , typeName ) , null ) ; } IStatus status = workspace . validateName ( new String ( scannedID ) , IResource . FOLDER ) ; if ( ! status . isOK ( ) ) { return status ; } if ( firstToken && scannedID . length > <NUM_LIT:0> && ScannerHelper . isUpperCase ( scannedID [ <NUM_LIT:0> ] ) ) { if ( warningStatus == null ) { warningStatus = new Status ( IStatus . WARNING , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . convention_package_uppercaseName , null ) ; } } firstToken = false ; } if ( warningStatus != null ) { return warningStatus ; } return JavaModelStatus . VERIFIED_OK ; } public static IJavaModelStatus validateClasspath ( IJavaProject javaProject , IClasspathEntry [ ] rawClasspath , IPath projectOutputLocation ) { return ClasspathEntry . validateClasspath ( javaProject , rawClasspath , projectOutputLocation ) ; } public static IJavaModelStatus validateClasspathEntry ( IJavaProject project , IClasspathEntry entry , boolean checkSourceAttachment ) { return ClasspathEntry . validateClasspathEntry ( project , entry , checkSourceAttachment , false ) ; } public static IStatus validateTypeVariableName ( String name ) { return validateIdentifier ( name , CompilerOptions . VERSION_1_3 , CompilerOptions . VERSION_1_3 ) ; } public static IStatus validateTypeVariableName ( String name , String sourceLevel , String complianceLevel ) { return validateIdentifier ( name , sourceLevel , complianceLevel ) ; } } </s>
<s> package org . eclipse . jdt . core . util ; public interface IClassFileDisassembler { int DETAILED = <NUM_LIT:1> ; int DEFAULT = <NUM_LIT:2> ; String disassemble ( IClassFileReader classFileReader , String lineSeparator ) ; String disassemble ( IClassFileReader classFileReader , String lineSeparator , int mode ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IVerificationTypeInfo { public static final int ITEM_TOP = <NUM_LIT:0> ; public static final int ITEM_INTEGER = <NUM_LIT:1> ; public static final int ITEM_FLOAT = <NUM_LIT:2> ; public static final int ITEM_DOUBLE = <NUM_LIT:3> ; public static final int ITEM_LONG = <NUM_LIT:4> ; public static final int ITEM_NULL = <NUM_LIT:5> ; public static final int ITEM_UNINITIALIZED_THIS = <NUM_LIT:6> ; public static final int ITEM_OBJECT = <NUM_LIT:7> ; public static final int ITEM_UNINITIALIZED = <NUM_LIT:8> ; int getTag ( ) ; int getOffset ( ) ; int getConstantPoolIndex ( ) ; char [ ] getClassTypeName ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IRuntimeInvisibleAnnotationsAttribute extends IClassFileAttribute { int getAnnotationsNumber ( ) ; IAnnotation [ ] getAnnotations ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; import java . io . File ; import java . io . IOException ; import java . util . Enumeration ; import java . util . HashMap ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . Map ; import java . util . PropertyResourceBundle ; import java . util . Set ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; public class CompilerUtils { public static final int IsGrails = <NUM_LIT> ; public static void configureOptionsBasedOnNature ( CompilerOptions compilerOptions , IJavaProject javaProject ) { IProject project = javaProject . getProject ( ) ; try { if ( isGroovyNaturedProject ( project ) ) { compilerOptions . storeAnnotations = true ; compilerOptions . buildGroovyFiles = <NUM_LIT:2> ; setGroovyClasspath ( compilerOptions , javaProject ) ; if ( isProbablyGrailsProject ( project ) ) { compilerOptions . groovyFlags = IsGrails ; } else { compilerOptions . groovyFlags = <NUM_LIT:0> ; } } else { compilerOptions . buildGroovyFiles = <NUM_LIT:1> ; compilerOptions . groovyFlags = <NUM_LIT:0> ; } } catch ( CoreException e ) { compilerOptions . buildGroovyFiles = <NUM_LIT:1> ; compilerOptions . groovyFlags = <NUM_LIT:0> ; } } public static void configureOptionsBasedOnNature ( Map optionMap , IJavaProject javaProject ) { IProject project = javaProject . getProject ( ) ; try { if ( isGroovyNaturedProject ( project ) ) { optionMap . put ( CompilerOptions . OPTIONG_BuildGroovyFiles , CompilerOptions . ENABLED ) ; setGroovyClasspath ( optionMap , javaProject ) ; if ( isProbablyGrailsProject ( project ) ) { optionMap . put ( CompilerOptions . OPTIONG_GroovyFlags , Integer . toString ( IsGrails ) ) ; } else { optionMap . put ( CompilerOptions . OPTIONG_GroovyFlags , "<STR_LIT:0>" ) ; } } else { optionMap . put ( CompilerOptions . OPTIONG_BuildGroovyFiles , CompilerOptions . DISABLED ) ; optionMap . put ( CompilerOptions . OPTIONG_GroovyFlags , "<STR_LIT:0>" ) ; } } catch ( CoreException e ) { e . printStackTrace ( ) ; optionMap . put ( CompilerOptions . OPTIONG_BuildGroovyFiles , CompilerOptions . DISABLED ) ; optionMap . put ( CompilerOptions . OPTIONG_GroovyFlags , "<STR_LIT:0>" ) ; } } private static boolean isProbablyGrailsProject ( IProject project ) { try { IFolder folder = project . getFolder ( "<STR_LIT>" ) ; return folder . exists ( ) ; } catch ( Exception e ) { return false ; } } public static void setGroovyClasspath ( CompilerOptions compilerOptions , IJavaProject javaProject ) { Map newOptions = new HashMap ( ) ; setGroovyClasspath ( newOptions , javaProject ) ; compilerOptions . groovyProjectName = javaProject . getProject ( ) . getName ( ) ; if ( ! newOptions . isEmpty ( ) ) { compilerOptions . set ( newOptions ) ; } } public static void setGroovyClasspath ( Map optionMap , IJavaProject javaProject ) { IFile file = javaProject . getProject ( ) . getFile ( "<STR_LIT>" ) ; if ( file . exists ( ) ) { try { PropertyResourceBundle prb = new PropertyResourceBundle ( file . getContents ( ) ) ; Enumeration e = prb . getKeys ( ) ; while ( e . hasMoreElements ( ) ) { String k = ( String ) e . nextElement ( ) ; String v = ( String ) prb . getObject ( k ) ; v = fixup ( v , javaProject ) ; if ( k . equals ( CompilerOptions . OPTIONG_GroovyClassLoaderPath ) ) { optionMap . put ( CompilerOptions . OPTIONG_GroovyClassLoaderPath , v ) ; } } } catch ( IOException ioe ) { System . err . println ( "<STR_LIT>" ) ; ioe . printStackTrace ( ) ; } catch ( CoreException ce ) { System . err . println ( "<STR_LIT>" ) ; ce . printStackTrace ( ) ; } catch ( Throwable t ) { System . err . println ( "<STR_LIT>" ) ; t . printStackTrace ( ) ; } } else { try { String classpath = calculateClasspath ( javaProject ) ; optionMap . put ( CompilerOptions . OPTIONG_GroovyClassLoaderPath , classpath ) ; } catch ( Throwable t ) { System . err . println ( "<STR_LIT>" ) ; t . printStackTrace ( ) ; } } optionMap . put ( CompilerOptions . OPTIONG_GroovyProjectName , javaProject . getProject ( ) . getName ( ) ) ; } private static String fixup ( String someString , IJavaProject javaProject ) { if ( someString . startsWith ( "<STR_LIT>" ) ) { someString = javaProject . getProject ( ) . getLocation ( ) . toOSString ( ) + File . separator + someString . substring ( "<STR_LIT>" . length ( ) ) ; } if ( someString . equals ( "<STR_LIT>" ) ) { someString = calculateClasspath ( javaProject ) ; } return someString ; } private static boolean isGroovyNaturedProject ( IProject project ) throws CoreException { return project . hasNature ( "<STR_LIT>" ) ; } private static String pathToString ( IPath path , IProject project ) { String realLocation = null ; if ( path != null ) { String prefix = path . segment ( <NUM_LIT:0> ) ; if ( prefix . equals ( project . getName ( ) ) ) { if ( path . segmentCount ( ) == <NUM_LIT:1> ) { IPath rawPath = project . getRawLocation ( ) ; if ( rawPath == null ) { System . err . println ( "<STR_LIT>" + project ) ; } else { realLocation = project . getRawLocation ( ) . toOSString ( ) ; } } else { realLocation = project . getFile ( path . removeFirstSegments ( <NUM_LIT:1> ) ) . getRawLocation ( ) . toOSString ( ) ; } } else { realLocation = path . toOSString ( ) ; } } return realLocation ; } public static String calculateClasspath ( IJavaProject javaProject ) { try { Set accumulatedPathEntries = new LinkedHashSet ( ) ; IProject project = javaProject . getProject ( ) ; String projectName = project . getName ( ) ; IPath defaultOutputPath = javaProject . getOutputLocation ( ) ; String defaultOutputLocation = pathToString ( defaultOutputPath , project ) ; IClasspathEntry [ ] cpes = javaProject . getResolvedClasspath ( true ) ; if ( cpes != null ) { for ( int i = <NUM_LIT:0> , max = cpes . length ; i < max ; i ++ ) { IClasspathEntry cpe = cpes [ i ] ; if ( cpe . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) { continue ; } IPath cpePath = cpe . getPath ( ) ; String pathElement = null ; String segmentZero = cpePath . segment ( <NUM_LIT:0> ) ; if ( segmentZero . equals ( projectName ) ) { pathElement = project . getFile ( cpePath . removeFirstSegments ( <NUM_LIT:1> ) ) . getRawLocation ( ) . toOSString ( ) ; } else { if ( cpe . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { try { IProject iproject = project . getWorkspace ( ) . getRoot ( ) . getProject ( segmentZero ) ; if ( iproject != null ) { IFile ifile = iproject . getFile ( cpePath . removeFirstSegments ( <NUM_LIT:1> ) ) ; IPath ipath = ( ifile == null ? null : ifile . getRawLocation ( ) ) ; pathElement = ( ipath == null ? null : ipath . toOSString ( ) ) ; } } catch ( Throwable t ) { t . printStackTrace ( ) ; } } if ( cpe . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) { computeDependenciesFromProject ( project , segmentZero , accumulatedPathEntries ) ; } else { if ( pathElement == null ) { pathElement = cpe . getPath ( ) . toOSString ( ) ; } } } if ( pathElement != null ) { accumulatedPathEntries . add ( pathElement ) ; } } accumulatedPathEntries . add ( defaultOutputLocation ) ; StringBuilder sb = new StringBuilder ( ) ; Iterator iter = accumulatedPathEntries . iterator ( ) ; while ( iter . hasNext ( ) ) { sb . append ( ( String ) iter . next ( ) ) ; sb . append ( File . pathSeparator ) ; } String classpath = sb . toString ( ) ; return classpath ; } } catch ( JavaModelException jme ) { System . err . println ( "<STR_LIT>" + javaProject . getProject ( ) . getName ( ) + "<STR_LIT::>" ) ; jme . printStackTrace ( ) ; } return "<STR_LIT>" ; } private static void computeDependenciesFromProject ( IProject baseProject , String otherProject , Set accumulatedPathEntries ) throws JavaModelException { IProject iproject = baseProject . getWorkspace ( ) . getRoot ( ) . getProject ( otherProject ) ; IJavaProject ijp = JavaCore . create ( iproject ) ; accumulatedPathEntries . add ( pathToString ( ijp . getOutputLocation ( ) , iproject ) ) ; IClasspathEntry [ ] cpes = ijp . getResolvedClasspath ( true ) ; if ( cpes != null ) { for ( int j = <NUM_LIT:0> ; j < cpes . length ; j ++ ) { IClasspathEntry cpe = cpes [ j ] ; if ( cpe . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) { continue ; } if ( cpe . isExported ( ) ) { IPath cpePath = cpes [ j ] . getPath ( ) ; String segmentZero = cpePath . segment ( <NUM_LIT:0> ) ; if ( segmentZero != null && segmentZero . equals ( otherProject ) ) { accumulatedPathEntries . add ( iproject . getFile ( cpePath . removeFirstSegments ( <NUM_LIT:1> ) ) . getRawLocation ( ) . toOSString ( ) ) ; } else { if ( cpe . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) { computeDependenciesFromProject ( baseProject , segmentZero , accumulatedPathEntries ) ; } else { String otherPathElement = null ; if ( segmentZero != null && segmentZero . equals ( iproject . getName ( ) ) ) { otherPathElement = iproject . getFile ( cpePath . removeFirstSegments ( <NUM_LIT:1> ) ) . getRawLocation ( ) . toOSString ( ) ; } else { otherPathElement = cpePath . toOSString ( ) ; } accumulatedPathEntries . add ( otherPathElement ) ; } } } } } } } </s>
<s> package org . eclipse . jdt . core . util ; public interface IMethodInfo { char [ ] getDescriptor ( ) ; int getDescriptorIndex ( ) ; int getAccessFlags ( ) ; char [ ] getName ( ) ; int getNameIndex ( ) ; boolean isClinit ( ) ; boolean isConstructor ( ) ; boolean isSynthetic ( ) ; boolean isDeprecated ( ) ; ICodeAttribute getCodeAttribute ( ) ; IExceptionAttribute getExceptionAttribute ( ) ; int getAttributeCount ( ) ; IClassFileAttribute [ ] getAttributes ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IExceptionTableEntry { int getStartPC ( ) ; int getEndPC ( ) ; int getHandlerPC ( ) ; int getCatchTypeIndex ( ) ; char [ ] getCatchType ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IClassFileAttribute { int getAttributeNameIndex ( ) ; char [ ] getAttributeName ( ) ; long getAttributeLength ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IConstantPoolConstant { int CONSTANT_Class = <NUM_LIT:7> ; int CONSTANT_Fieldref = <NUM_LIT:9> ; int CONSTANT_Methodref = <NUM_LIT:10> ; int CONSTANT_InterfaceMethodref = <NUM_LIT:11> ; int CONSTANT_String = <NUM_LIT:8> ; int CONSTANT_Integer = <NUM_LIT:3> ; int CONSTANT_Float = <NUM_LIT:4> ; int CONSTANT_Long = <NUM_LIT:5> ; int CONSTANT_Double = <NUM_LIT:6> ; int CONSTANT_NameAndType = <NUM_LIT:12> ; int CONSTANT_Utf8 = <NUM_LIT:1> ; int CONSTANT_Methodref_SIZE = <NUM_LIT:5> ; int CONSTANT_Class_SIZE = <NUM_LIT:3> ; int CONSTANT_Double_SIZE = <NUM_LIT:9> ; int CONSTANT_Fieldref_SIZE = <NUM_LIT:5> ; int CONSTANT_Float_SIZE = <NUM_LIT:5> ; int CONSTANT_Integer_SIZE = <NUM_LIT:5> ; int CONSTANT_InterfaceMethodref_SIZE = <NUM_LIT:5> ; int CONSTANT_Long_SIZE = <NUM_LIT:9> ; int CONSTANT_String_SIZE = <NUM_LIT:3> ; int CONSTANT_Utf8_SIZE = <NUM_LIT:3> ; int CONSTANT_NameAndType_SIZE = <NUM_LIT:5> ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IRuntimeVisibleAnnotationsAttribute extends IClassFileAttribute { int getAnnotationsNumber ( ) ; IAnnotation [ ] getAnnotations ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IInnerClassesAttribute extends IClassFileAttribute { int getNumberOfClasses ( ) ; IInnerClassesAttributeEntry [ ] getInnerClassAttributesEntries ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ISignatureAttribute extends IClassFileAttribute { int getSignatureIndex ( ) ; char [ ] getSignature ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IStackMapFrame { int getFrameType ( ) ; int getOffsetDelta ( ) ; int getNumberOfLocals ( ) ; IVerificationTypeInfo [ ] getLocals ( ) ; int getNumberOfStackItems ( ) ; IVerificationTypeInfo [ ] getStackItems ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IAnnotationDefaultAttribute extends IClassFileAttribute { IAnnotationComponentValue getMemberValue ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public class ClassFormatException extends Exception { public static final int ERROR_MALFORMED_UTF8 = <NUM_LIT:1> ; public static final int ERROR_TRUNCATED_INPUT = <NUM_LIT:2> ; public static final int INVALID_CONSTANT_POOL_ENTRY = <NUM_LIT:3> ; public static final int TOO_MANY_BYTES = <NUM_LIT:4> ; public static final int INVALID_ARGUMENTS_FOR_INVOKEINTERFACE = <NUM_LIT:5> ; public static final int INVALID_BYTECODE = <NUM_LIT:6> ; public static final int INVALID_TAG_CONSTANT = <NUM_LIT:7> ; public static final int INVALID_MAGIC_NUMBER = <NUM_LIT:8> ; private static final long serialVersionUID = <NUM_LIT> ; public ClassFormatException ( int errorID ) { } public ClassFormatException ( String message ) { super ( message ) ; } public ClassFormatException ( String message , Throwable cause ) { super ( message , cause ) ; } } </s>
<s> package org . eclipse . jdt . core . util ; public abstract class ClassFileBytesDisassembler { public final static int DETAILED = <NUM_LIT:1> ; public final static int DEFAULT = <NUM_LIT:2> ; public final static int SYSTEM = <NUM_LIT:4> ; public final static int COMPACT = <NUM_LIT:8> ; public final static int WORKING_COPY = <NUM_LIT:16> ; public abstract String disassemble ( byte [ ] classFileBytes , String lineSeparator ) throws ClassFormatException ; public abstract String disassemble ( byte [ ] classFileBytes , String lineSeparator , int mode ) throws ClassFormatException ; public abstract String getDescription ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IConstantPool { int getConstantPoolCount ( ) ; int getEntryKind ( int index ) ; IConstantPoolEntry decodeEntry ( int index ) ; } </s>