text
stringlengths 30
1.67M
|
|---|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import java . util . List ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Argument ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; import org . eclipse . jdt . internal . compiler . util . Util ; public class MethodBinding extends Binding { public int modifiers ; public char [ ] selector ; public TypeBinding returnType ; public TypeBinding [ ] parameters ; public ReferenceBinding [ ] thrownExceptions ; public ReferenceBinding declaringClass ; public TypeVariableBinding [ ] typeVariables = Binding . NO_TYPE_VARIABLES ; char [ ] signature ; public long tagBits ; protected MethodBinding ( ) { } public MethodBinding ( int modifiers , char [ ] selector , TypeBinding returnType , TypeBinding [ ] parameters , ReferenceBinding [ ] thrownExceptions , ReferenceBinding declaringClass ) { this . modifiers = modifiers ; this . selector = selector ; this . returnType = returnType ; this . parameters = ( parameters == null || parameters . length == <NUM_LIT:0> ) ? Binding . NO_PARAMETERS : parameters ; this . thrownExceptions = ( thrownExceptions == null || thrownExceptions . length == <NUM_LIT:0> ) ? Binding . NO_EXCEPTIONS : thrownExceptions ; this . declaringClass = declaringClass ; if ( this . declaringClass != null ) { if ( this . declaringClass . isStrictfp ( ) ) if ( ! ( isNative ( ) || isAbstract ( ) ) ) this . modifiers |= ClassFileConstants . AccStrictfp ; } } public MethodBinding ( int modifiers , TypeBinding [ ] parameters , ReferenceBinding [ ] thrownExceptions , ReferenceBinding declaringClass ) { this ( modifiers , TypeConstants . INIT , TypeBinding . VOID , parameters , thrownExceptions , declaringClass ) ; } public MethodBinding ( MethodBinding initialMethodBinding , ReferenceBinding declaringClass ) { this . modifiers = initialMethodBinding . modifiers ; this . selector = initialMethodBinding . selector ; this . returnType = initialMethodBinding . returnType ; this . parameters = initialMethodBinding . parameters ; this . thrownExceptions = initialMethodBinding . thrownExceptions ; this . declaringClass = declaringClass ; declaringClass . storeAnnotationHolder ( this , initialMethodBinding . declaringClass . retrieveAnnotationHolder ( initialMethodBinding , true ) ) ; } public final boolean areParameterErasuresEqual ( MethodBinding method ) { TypeBinding [ ] args = method . parameters ; if ( this . parameters == args ) return true ; int length = this . parameters . length ; if ( length != args . length ) return false ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( this . parameters [ i ] != args [ i ] && this . parameters [ i ] . erasure ( ) != args [ i ] . erasure ( ) ) return false ; return true ; } public final boolean areParametersCompatibleWith ( TypeBinding [ ] arguments ) { int paramLength = this . parameters . length ; int argLength = arguments . length ; int lastIndex = argLength ; if ( isVarargs ( ) ) { lastIndex = paramLength - <NUM_LIT:1> ; if ( paramLength == argLength ) { TypeBinding varArgType = this . parameters [ lastIndex ] ; TypeBinding lastArgument = arguments [ lastIndex ] ; if ( varArgType != lastArgument && ! lastArgument . isCompatibleWith ( varArgType ) ) return false ; } else if ( paramLength < argLength ) { TypeBinding varArgType = ( ( ArrayBinding ) this . parameters [ lastIndex ] ) . elementsType ( ) ; for ( int i = lastIndex ; i < argLength ; i ++ ) if ( varArgType != arguments [ i ] && ! arguments [ i ] . isCompatibleWith ( varArgType ) ) return false ; } else if ( lastIndex != argLength ) { return false ; } } for ( int i = <NUM_LIT:0> ; i < lastIndex ; i ++ ) if ( this . parameters [ i ] != arguments [ i ] && ! arguments [ i ] . isCompatibleWith ( this . parameters [ i ] ) ) return false ; return true ; } public final boolean areParametersEqual ( MethodBinding method ) { TypeBinding [ ] args = method . parameters ; if ( this . parameters == args ) return true ; int length = this . parameters . length ; if ( length != args . length ) return false ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( this . parameters [ i ] != args [ i ] ) return false ; return true ; } public final boolean areTypeVariableErasuresEqual ( MethodBinding method ) { TypeVariableBinding [ ] vars = method . typeVariables ; if ( this . typeVariables == vars ) return true ; int length = this . typeVariables . length ; if ( length != vars . length ) return false ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( this . typeVariables [ i ] != vars [ i ] && this . typeVariables [ i ] . erasure ( ) != vars [ i ] . erasure ( ) ) return false ; return true ; } MethodBinding asRawMethod ( LookupEnvironment env ) { if ( this . typeVariables == Binding . NO_TYPE_VARIABLES ) return this ; int length = this . typeVariables . length ; TypeBinding [ ] arguments = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeVariableBinding var = this . typeVariables [ i ] ; if ( var . boundsCount ( ) <= <NUM_LIT:1> ) { arguments [ i ] = env . convertToRawType ( var . upperBound ( ) , false ) ; } else { TypeBinding [ ] itsSuperinterfaces = var . superInterfaces ( ) ; int superLength = itsSuperinterfaces . length ; TypeBinding rawFirstBound = null ; TypeBinding [ ] rawOtherBounds = null ; if ( var . boundsCount ( ) == superLength ) { rawFirstBound = env . convertToRawType ( itsSuperinterfaces [ <NUM_LIT:0> ] , false ) ; rawOtherBounds = new TypeBinding [ superLength - <NUM_LIT:1> ] ; for ( int s = <NUM_LIT:1> ; s < superLength ; s ++ ) rawOtherBounds [ s - <NUM_LIT:1> ] = env . convertToRawType ( itsSuperinterfaces [ s ] , false ) ; } else { rawFirstBound = env . convertToRawType ( var . superclass ( ) , false ) ; rawOtherBounds = new TypeBinding [ superLength ] ; for ( int s = <NUM_LIT:0> ; s < superLength ; s ++ ) rawOtherBounds [ s ] = env . convertToRawType ( itsSuperinterfaces [ s ] , false ) ; } arguments [ i ] = env . createWildcard ( null , <NUM_LIT:0> , rawFirstBound , rawOtherBounds , org . eclipse . jdt . internal . compiler . ast . Wildcard . EXTENDS ) ; } } return env . createParameterizedGenericMethod ( this , arguments ) ; } public final boolean canBeSeenBy ( InvocationSite invocationSite , Scope scope ) { if ( isPublic ( ) ) return true ; SourceTypeBinding invocationType = scope . enclosingSourceType ( ) ; if ( invocationType == this . declaringClass ) return true ; if ( isProtected ( ) ) { if ( invocationType . fPackage == this . declaringClass . fPackage ) return true ; return invocationSite . isSuperAccess ( ) ; } if ( isPrivate ( ) ) { ReferenceBinding outerInvocationType = invocationType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = ( ReferenceBinding ) this . declaringClass . erasure ( ) ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } return outerInvocationType == outerDeclaringClass ; } return invocationType . fPackage == this . declaringClass . fPackage ; } public final boolean canBeSeenBy ( PackageBinding invocationPackage ) { if ( isPublic ( ) ) return true ; if ( isPrivate ( ) ) return false ; return invocationPackage == this . declaringClass . getPackage ( ) ; } public final boolean canBeSeenBy ( TypeBinding receiverType , InvocationSite invocationSite , Scope scope ) { if ( isPublic ( ) ) return true ; SourceTypeBinding invocationType = scope . enclosingSourceType ( ) ; if ( invocationType == this . declaringClass && invocationType == receiverType ) return true ; if ( invocationType == null ) return ! isPrivate ( ) && scope . getCurrentPackage ( ) == this . declaringClass . fPackage ; if ( isProtected ( ) ) { if ( invocationType == this . declaringClass ) return true ; if ( invocationType . fPackage == this . declaringClass . fPackage ) return true ; ReferenceBinding currentType = invocationType ; TypeBinding receiverErasure = receiverType . erasure ( ) ; ReferenceBinding declaringErasure = ( ReferenceBinding ) this . declaringClass . erasure ( ) ; int depth = <NUM_LIT:0> ; do { if ( currentType . findSuperTypeOriginatingFrom ( declaringErasure ) != null ) { if ( invocationSite . isSuperAccess ( ) ) return true ; if ( receiverType instanceof ArrayBinding ) return false ; if ( isStatic ( ) ) { if ( depth > <NUM_LIT:0> ) invocationSite . setDepth ( depth ) ; return true ; } if ( currentType == receiverErasure || receiverErasure . findSuperTypeOriginatingFrom ( currentType ) != null ) { if ( depth > <NUM_LIT:0> ) invocationSite . setDepth ( depth ) ; return true ; } } depth ++ ; currentType = currentType . enclosingType ( ) ; } while ( currentType != null ) ; return false ; } if ( isPrivate ( ) ) { receiverCheck : { if ( receiverType != this . declaringClass ) { if ( scope . compilerOptions ( ) . complianceLevel <= ClassFileConstants . JDK1_6 && receiverType . isTypeVariable ( ) && ( ( TypeVariableBinding ) receiverType ) . isErasureBoundTo ( this . declaringClass . erasure ( ) ) ) break receiverCheck ; return false ; } } if ( invocationType != this . declaringClass ) { ReferenceBinding outerInvocationType = invocationType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = ( ReferenceBinding ) this . declaringClass . erasure ( ) ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } if ( outerInvocationType != outerDeclaringClass ) return false ; } return true ; } PackageBinding declaringPackage = this . declaringClass . fPackage ; if ( invocationType . fPackage != declaringPackage ) return false ; if ( receiverType instanceof ArrayBinding ) return false ; TypeBinding originalDeclaringClass = this . declaringClass . original ( ) ; ReferenceBinding currentType = ( ReferenceBinding ) ( receiverType ) ; do { if ( currentType . isCapture ( ) ) { if ( originalDeclaringClass == currentType . erasure ( ) . original ( ) ) return true ; } else { if ( originalDeclaringClass == currentType . original ( ) ) return true ; } PackageBinding currentPackage = currentType . fPackage ; if ( currentPackage != null && currentPackage != declaringPackage ) return false ; } while ( ( currentType = currentType . superclass ( ) ) != null ) ; return false ; } public List collectMissingTypes ( List missingTypes ) { if ( ( this . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { missingTypes = this . returnType . collectMissingTypes ( missingTypes ) ; for ( int i = <NUM_LIT:0> , max = this . parameters . length ; i < max ; i ++ ) { missingTypes = this . parameters [ i ] . collectMissingTypes ( missingTypes ) ; } for ( int i = <NUM_LIT:0> , max = this . thrownExceptions . length ; i < max ; i ++ ) { missingTypes = this . thrownExceptions [ i ] . collectMissingTypes ( missingTypes ) ; } for ( int i = <NUM_LIT:0> , max = this . typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding variable = this . typeVariables [ i ] ; missingTypes = variable . superclass ( ) . collectMissingTypes ( missingTypes ) ; ReferenceBinding [ ] interfaces = variable . superInterfaces ( ) ; for ( int j = <NUM_LIT:0> , length = interfaces . length ; j < length ; j ++ ) { missingTypes = interfaces [ j ] . collectMissingTypes ( missingTypes ) ; } } } return missingTypes ; } MethodBinding computeSubstitutedMethod ( MethodBinding method , LookupEnvironment env ) { int length = this . typeVariables . length ; TypeVariableBinding [ ] vars = method . typeVariables ; if ( length != vars . length ) return null ; ParameterizedGenericMethodBinding substitute = env . createParameterizedGenericMethod ( method , this . typeVariables ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( ! this . typeVariables [ i ] . isInterchangeableWith ( vars [ i ] , substitute ) ) return null ; return substitute ; } public char [ ] computeUniqueKey ( boolean isLeaf ) { char [ ] declaringKey = this . declaringClass . computeUniqueKey ( false ) ; int declaringLength = declaringKey . length ; int selectorLength = this . selector == TypeConstants . INIT ? <NUM_LIT:0> : this . selector . length ; char [ ] sig = genericSignature ( ) ; boolean isGeneric = sig != null ; if ( ! isGeneric ) sig = signature ( ) ; int signatureLength = sig . length ; int thrownExceptionsLength = this . thrownExceptions . length ; int thrownExceptionsSignatureLength = <NUM_LIT:0> ; char [ ] [ ] thrownExceptionsSignatures = null ; boolean addThrownExceptions = thrownExceptionsLength > <NUM_LIT:0> && ( ! isGeneric || CharOperation . lastIndexOf ( '<CHAR_LIT>' , sig ) < <NUM_LIT:0> ) ; if ( addThrownExceptions ) { thrownExceptionsSignatures = new char [ thrownExceptionsLength ] [ ] ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionsLength ; i ++ ) { if ( this . thrownExceptions [ i ] != null ) { thrownExceptionsSignatures [ i ] = this . thrownExceptions [ i ] . signature ( ) ; thrownExceptionsSignatureLength += thrownExceptionsSignatures [ i ] . length + <NUM_LIT:1> ; } } } char [ ] uniqueKey = new char [ declaringLength + <NUM_LIT:1> + selectorLength + signatureLength + thrownExceptionsSignatureLength ] ; int index = <NUM_LIT:0> ; System . arraycopy ( declaringKey , <NUM_LIT:0> , uniqueKey , index , declaringLength ) ; index = declaringLength ; uniqueKey [ index ++ ] = '<CHAR_LIT:.>' ; System . arraycopy ( this . selector , <NUM_LIT:0> , uniqueKey , index , selectorLength ) ; index += selectorLength ; System . arraycopy ( sig , <NUM_LIT:0> , uniqueKey , index , signatureLength ) ; if ( thrownExceptionsSignatureLength > <NUM_LIT:0> ) { index += signatureLength ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionsLength ; i ++ ) { char [ ] thrownExceptionSignature = thrownExceptionsSignatures [ i ] ; if ( thrownExceptionSignature != null ) { uniqueKey [ index ++ ] = '<CHAR_LIT>' ; int length = thrownExceptionSignature . length ; System . arraycopy ( thrownExceptionSignature , <NUM_LIT:0> , uniqueKey , index , length ) ; index += length ; } } } return uniqueKey ; } public final char [ ] constantPoolName ( ) { return this . selector ; } public MethodBinding findOriginalInheritedMethod ( MethodBinding inheritedMethod ) { MethodBinding inheritedOriginal = inheritedMethod . original ( ) ; TypeBinding superType = this . declaringClass . findSuperTypeOriginatingFrom ( inheritedOriginal . declaringClass ) ; if ( superType == null || ! ( superType instanceof ReferenceBinding ) ) return null ; if ( inheritedOriginal . declaringClass != superType ) { MethodBinding [ ] superMethods = ( ( ReferenceBinding ) superType ) . getMethods ( inheritedOriginal . selector , inheritedOriginal . parameters . length ) ; for ( int m = <NUM_LIT:0> , l = superMethods . length ; m < l ; m ++ ) if ( superMethods [ m ] . original ( ) == inheritedOriginal ) return superMethods [ m ] ; } return inheritedOriginal ; } public char [ ] genericSignature ( ) { if ( ( this . modifiers & ExtraCompilerModifiers . AccGenericSignature ) == <NUM_LIT:0> ) return null ; StringBuffer sig = new StringBuffer ( <NUM_LIT:10> ) ; if ( this . typeVariables != Binding . NO_TYPE_VARIABLES ) { sig . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = this . typeVariables . length ; i < length ; i ++ ) { sig . append ( this . typeVariables [ i ] . genericSignature ( ) ) ; } sig . append ( '<CHAR_LIT:>>' ) ; } sig . append ( '<CHAR_LIT:(>' ) ; for ( int i = <NUM_LIT:0> , length = this . parameters . length ; i < length ; i ++ ) { sig . append ( this . parameters [ i ] . genericTypeSignature ( ) ) ; } sig . append ( '<CHAR_LIT:)>' ) ; if ( this . returnType != null ) sig . append ( this . returnType . genericTypeSignature ( ) ) ; boolean needExceptionSignatures = false ; int length = this . thrownExceptions . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ( this . thrownExceptions [ i ] . modifiers & ExtraCompilerModifiers . AccGenericSignature ) != <NUM_LIT:0> ) { needExceptionSignatures = true ; break ; } } if ( needExceptionSignatures ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { sig . append ( '<CHAR_LIT>' ) ; sig . append ( this . thrownExceptions [ i ] . genericTypeSignature ( ) ) ; } } int sigLength = sig . length ( ) ; char [ ] genericSignature = new char [ sigLength ] ; sig . getChars ( <NUM_LIT:0> , sigLength , genericSignature , <NUM_LIT:0> ) ; return genericSignature ; } public final int getAccessFlags ( ) { return this . modifiers & ExtraCompilerModifiers . AccJustFlag ; } public AnnotationBinding [ ] getAnnotations ( ) { MethodBinding originalMethod = original ( ) ; return originalMethod . declaringClass . retrieveAnnotations ( originalMethod ) ; } public long getAnnotationTagBits ( ) { MethodBinding originalMethod = original ( ) ; if ( ( originalMethod . tagBits & TagBits . AnnotationResolved ) == <NUM_LIT:0> && originalMethod . declaringClass instanceof SourceTypeBinding ) { ClassScope scope = ( ( SourceTypeBinding ) originalMethod . declaringClass ) . scope ; if ( scope != null ) { TypeDeclaration typeDecl = scope . referenceContext ; AbstractMethodDeclaration methodDecl = typeDecl . declarationOf ( originalMethod ) ; if ( methodDecl != null ) ASTNode . resolveAnnotations ( methodDecl . scope , methodDecl . annotations , originalMethod ) ; } } return originalMethod . tagBits ; } public Object getDefaultValue ( ) { MethodBinding originalMethod = original ( ) ; if ( ( originalMethod . tagBits & TagBits . DefaultValueResolved ) == <NUM_LIT:0> ) { if ( originalMethod . declaringClass instanceof SourceTypeBinding ) { SourceTypeBinding sourceType = ( SourceTypeBinding ) originalMethod . declaringClass ; if ( sourceType . scope != null ) { AbstractMethodDeclaration methodDeclaration = originalMethod . sourceMethod ( ) ; if ( methodDeclaration != null && methodDeclaration . isAnnotationMethod ( ) ) { methodDeclaration . resolve ( sourceType . scope ) ; } } } originalMethod . tagBits |= TagBits . DefaultValueResolved ; } AnnotationHolder holder = originalMethod . declaringClass . retrieveAnnotationHolder ( originalMethod , true ) ; return holder == null ? null : holder . getDefaultValue ( ) ; } public AnnotationBinding [ ] [ ] getParameterAnnotations ( ) { int length ; if ( ( length = this . parameters . length ) == <NUM_LIT:0> ) { return null ; } MethodBinding originalMethod = original ( ) ; AnnotationHolder holder = originalMethod . declaringClass . retrieveAnnotationHolder ( originalMethod , true ) ; AnnotationBinding [ ] [ ] allParameterAnnotations = holder == null ? null : holder . getParameterAnnotations ( ) ; if ( allParameterAnnotations == null && ( this . tagBits & TagBits . HasParameterAnnotations ) != <NUM_LIT:0> ) { allParameterAnnotations = new AnnotationBinding [ length ] [ ] ; if ( this . declaringClass instanceof SourceTypeBinding ) { SourceTypeBinding sourceType = ( SourceTypeBinding ) this . declaringClass ; if ( sourceType . scope != null ) { AbstractMethodDeclaration methodDecl = sourceType . scope . referenceType ( ) . declarationOf ( this ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Argument argument = methodDecl . arguments [ i ] ; if ( argument . annotations != null ) { ASTNode . resolveAnnotations ( methodDecl . scope , argument . annotations , argument . binding ) ; allParameterAnnotations [ i ] = argument . binding . getAnnotations ( ) ; } else { allParameterAnnotations [ i ] = Binding . NO_ANNOTATIONS ; } } } else { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { allParameterAnnotations [ i ] = Binding . NO_ANNOTATIONS ; } } } else { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { allParameterAnnotations [ i ] = Binding . NO_ANNOTATIONS ; } } setParameterAnnotations ( allParameterAnnotations ) ; } return allParameterAnnotations ; } public TypeVariableBinding getTypeVariable ( char [ ] variableName ) { for ( int i = this . typeVariables . length ; -- i >= <NUM_LIT:0> ; ) if ( CharOperation . equals ( this . typeVariables [ i ] . sourceName , variableName ) ) return this . typeVariables [ i ] ; return null ; } public boolean hasSubstitutedParameters ( ) { return false ; } public boolean hasSubstitutedReturnType ( ) { return false ; } public final boolean isAbstract ( ) { return ( this . modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ; } public final boolean isBridge ( ) { return ( this . modifiers & ClassFileConstants . AccBridge ) != <NUM_LIT:0> ; } public final boolean isConstructor ( ) { return this . selector == TypeConstants . INIT ; } public final boolean isDefault ( ) { return ! isPublic ( ) && ! isProtected ( ) && ! isPrivate ( ) ; } public final boolean isDefaultAbstract ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccDefaultAbstract ) != <NUM_LIT:0> ; } public final boolean isDeprecated ( ) { return ( this . modifiers & ClassFileConstants . AccDeprecated ) != <NUM_LIT:0> ; } public final boolean isFinal ( ) { return ( this . modifiers & ClassFileConstants . AccFinal ) != <NUM_LIT:0> ; } public final boolean isImplementing ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccImplementing ) != <NUM_LIT:0> ; } public final boolean isMain ( ) { if ( this . selector . length == <NUM_LIT:4> && CharOperation . equals ( this . selector , TypeConstants . MAIN ) && ( ( this . modifiers & ( ClassFileConstants . AccPublic | ClassFileConstants . AccStatic ) ) != <NUM_LIT:0> ) && TypeBinding . VOID == this . returnType && this . parameters . length == <NUM_LIT:1> ) { TypeBinding paramType = this . parameters [ <NUM_LIT:0> ] ; if ( paramType . dimensions ( ) == <NUM_LIT:1> && paramType . leafComponentType ( ) . id == TypeIds . T_JavaLangString ) { return true ; } } return false ; } public final boolean isNative ( ) { return ( this . modifiers & ClassFileConstants . AccNative ) != <NUM_LIT:0> ; } public final boolean isOverriding ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccOverriding ) != <NUM_LIT:0> ; } public final boolean isPrivate ( ) { return ( this . modifiers & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ; } public final boolean isOrEnclosedByPrivateType ( ) { if ( ( this . modifiers & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) return true ; return this . declaringClass != null && this . declaringClass . isOrEnclosedByPrivateType ( ) ; } public final boolean isProtected ( ) { return ( this . modifiers & ClassFileConstants . AccProtected ) != <NUM_LIT:0> ; } public final boolean isPublic ( ) { return ( this . modifiers & ClassFileConstants . AccPublic ) != <NUM_LIT:0> ; } public final boolean isStatic ( ) { return ( this . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ; } public final boolean isStrictfp ( ) { return ( this . modifiers & ClassFileConstants . AccStrictfp ) != <NUM_LIT:0> ; } public final boolean isSynchronized ( ) { return ( this . modifiers & ClassFileConstants . AccSynchronized ) != <NUM_LIT:0> ; } public final boolean isSynthetic ( ) { return ( this . modifiers & ClassFileConstants . AccSynthetic ) != <NUM_LIT:0> ; } public final boolean isUsed ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccLocallyUsed ) != <NUM_LIT:0> ; } public boolean isVarargs ( ) { return ( this . modifiers & ClassFileConstants . AccVarargs ) != <NUM_LIT:0> ; } public boolean isPolymorphic ( ) { return false ; } public final boolean isViewedAsDeprecated ( ) { return ( this . modifiers & ( ClassFileConstants . AccDeprecated | ExtraCompilerModifiers . AccDeprecatedImplicitly ) ) != <NUM_LIT:0> ; } public final int kind ( ) { return Binding . METHOD ; } public MethodBinding original ( ) { return this ; } public char [ ] readableName ( ) { StringBuffer buffer = new StringBuffer ( this . parameters . length + <NUM_LIT:1> * <NUM_LIT:20> ) ; if ( isConstructor ( ) ) buffer . append ( this . declaringClass . sourceName ( ) ) ; else buffer . append ( this . selector ) ; buffer . append ( '<CHAR_LIT:(>' ) ; if ( this . parameters != Binding . NO_PARAMETERS ) { for ( int i = <NUM_LIT:0> , length = this . parameters . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; buffer . append ( this . parameters [ i ] . sourceName ( ) ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; return buffer . toString ( ) . toCharArray ( ) ; } public void setAnnotations ( AnnotationBinding [ ] annotations ) { this . declaringClass . storeAnnotations ( this , annotations ) ; } public void setAnnotations ( AnnotationBinding [ ] annotations , AnnotationBinding [ ] [ ] parameterAnnotations , Object defaultValue , LookupEnvironment optionalEnv ) { this . declaringClass . storeAnnotationHolder ( this , AnnotationHolder . storeAnnotations ( annotations , parameterAnnotations , defaultValue , optionalEnv ) ) ; } public void setDefaultValue ( Object defaultValue ) { MethodBinding originalMethod = original ( ) ; originalMethod . tagBits |= TagBits . DefaultValueResolved ; AnnotationHolder holder = this . declaringClass . retrieveAnnotationHolder ( this , false ) ; if ( holder == null ) setAnnotations ( null , null , defaultValue , null ) ; else setAnnotations ( holder . getAnnotations ( ) , holder . getParameterAnnotations ( ) , defaultValue , null ) ; } public void setParameterAnnotations ( AnnotationBinding [ ] [ ] parameterAnnotations ) { AnnotationHolder holder = this . declaringClass . retrieveAnnotationHolder ( this , false ) ; if ( holder == null ) setAnnotations ( null , parameterAnnotations , null , null ) ; else setAnnotations ( holder . getAnnotations ( ) , parameterAnnotations , holder . getDefaultValue ( ) , null ) ; } protected final void setSelector ( char [ ] selector ) { this . selector = selector ; this . signature = null ; } public char [ ] shortReadableName ( ) { StringBuffer buffer = new StringBuffer ( this . parameters . length + <NUM_LIT:1> * <NUM_LIT:20> ) ; if ( isConstructor ( ) ) buffer . append ( this . declaringClass . shortReadableName ( ) ) ; else buffer . append ( this . selector ) ; buffer . append ( '<CHAR_LIT:(>' ) ; if ( this . parameters != Binding . NO_PARAMETERS ) { for ( int i = <NUM_LIT:0> , length = this . parameters . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; buffer . append ( this . parameters [ i ] . shortReadableName ( ) ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; int nameLength = buffer . length ( ) ; char [ ] shortReadableName = new char [ nameLength ] ; buffer . getChars ( <NUM_LIT:0> , nameLength , shortReadableName , <NUM_LIT:0> ) ; return shortReadableName ; } public final char [ ] signature ( ) { if ( this . signature != null ) return this . signature ; StringBuffer buffer = new StringBuffer ( this . parameters . length + <NUM_LIT:1> * <NUM_LIT:20> ) ; buffer . append ( '<CHAR_LIT:(>' ) ; TypeBinding [ ] targetParameters = this . parameters ; boolean isConstructor = isConstructor ( ) ; if ( isConstructor && this . declaringClass . isEnum ( ) ) { buffer . append ( ConstantPool . JavaLangStringSignature ) ; buffer . append ( TypeBinding . INT . signature ( ) ) ; } boolean needSynthetics = isConstructor && this . declaringClass . isNestedType ( ) ; if ( needSynthetics ) { ReferenceBinding [ ] syntheticArgumentTypes = this . declaringClass . syntheticEnclosingInstanceTypes ( ) ; if ( syntheticArgumentTypes != null ) { for ( int i = <NUM_LIT:0> , count = syntheticArgumentTypes . length ; i < count ; i ++ ) { buffer . append ( syntheticArgumentTypes [ i ] . signature ( ) ) ; } } if ( this instanceof SyntheticMethodBinding ) { targetParameters = ( ( SyntheticMethodBinding ) this ) . targetMethod . parameters ; } } if ( targetParameters != Binding . NO_PARAMETERS ) { for ( int i = <NUM_LIT:0> ; i < targetParameters . length ; i ++ ) { buffer . append ( targetParameters [ i ] . signature ( ) ) ; } } if ( needSynthetics ) { SyntheticArgumentBinding [ ] syntheticOuterArguments = this . declaringClass . syntheticOuterLocalVariables ( ) ; int count = syntheticOuterArguments == null ? <NUM_LIT:0> : syntheticOuterArguments . length ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { buffer . append ( syntheticOuterArguments [ i ] . type . signature ( ) ) ; } for ( int i = targetParameters . length , extraLength = this . parameters . length ; i < extraLength ; i ++ ) { buffer . append ( this . parameters [ i ] . signature ( ) ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; if ( this . returnType != null ) buffer . append ( this . returnType . signature ( ) ) ; int nameLength = buffer . length ( ) ; this . signature = new char [ nameLength ] ; buffer . getChars ( <NUM_LIT:0> , nameLength , this . signature , <NUM_LIT:0> ) ; return this . signature ; } public final char [ ] signature ( ClassFile classFile ) { if ( this . signature != null ) { if ( ( this . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { boolean isConstructor = isConstructor ( ) ; TypeBinding [ ] targetParameters = this . parameters ; boolean needSynthetics = isConstructor && this . declaringClass . isNestedType ( ) ; if ( needSynthetics ) { ReferenceBinding [ ] syntheticArgumentTypes = this . declaringClass . syntheticEnclosingInstanceTypes ( ) ; if ( syntheticArgumentTypes != null ) { for ( int i = <NUM_LIT:0> , count = syntheticArgumentTypes . length ; i < count ; i ++ ) { ReferenceBinding syntheticArgumentType = syntheticArgumentTypes [ i ] ; if ( ( syntheticArgumentType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , syntheticArgumentType ) ; } } } if ( this instanceof SyntheticMethodBinding ) { targetParameters = ( ( SyntheticMethodBinding ) this ) . targetMethod . parameters ; } } if ( targetParameters != Binding . NO_PARAMETERS ) { for ( int i = <NUM_LIT:0> , max = targetParameters . length ; i < max ; i ++ ) { TypeBinding targetParameter = targetParameters [ i ] ; TypeBinding leafTargetParameterType = targetParameter . leafComponentType ( ) ; if ( ( leafTargetParameterType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , leafTargetParameterType ) ; } } } if ( needSynthetics ) { for ( int i = targetParameters . length , extraLength = this . parameters . length ; i < extraLength ; i ++ ) { TypeBinding parameter = this . parameters [ i ] ; TypeBinding leafParameterType = parameter . leafComponentType ( ) ; if ( ( leafParameterType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , leafParameterType ) ; } } } if ( this . returnType != null ) { TypeBinding ret = this . returnType . leafComponentType ( ) ; if ( ( ret . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , ret ) ; } } } return this . signature ; } StringBuffer buffer = new StringBuffer ( ( this . parameters . length + <NUM_LIT:1> ) * <NUM_LIT:20> ) ; buffer . append ( '<CHAR_LIT:(>' ) ; TypeBinding [ ] targetParameters = this . parameters ; boolean isConstructor = isConstructor ( ) ; if ( isConstructor && this . declaringClass . isEnum ( ) ) { buffer . append ( ConstantPool . JavaLangStringSignature ) ; buffer . append ( TypeBinding . INT . signature ( ) ) ; } boolean needSynthetics = isConstructor && this . declaringClass . isNestedType ( ) ; if ( needSynthetics ) { ReferenceBinding [ ] syntheticArgumentTypes = this . declaringClass . syntheticEnclosingInstanceTypes ( ) ; if ( syntheticArgumentTypes != null ) { for ( int i = <NUM_LIT:0> , count = syntheticArgumentTypes . length ; i < count ; i ++ ) { ReferenceBinding syntheticArgumentType = syntheticArgumentTypes [ i ] ; if ( ( syntheticArgumentType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { this . tagBits |= TagBits . ContainsNestedTypeReferences ; Util . recordNestedType ( classFile , syntheticArgumentType ) ; } buffer . append ( syntheticArgumentType . signature ( ) ) ; } } if ( this instanceof SyntheticMethodBinding ) { targetParameters = ( ( SyntheticMethodBinding ) this ) . targetMethod . parameters ; } } if ( targetParameters != Binding . NO_PARAMETERS ) { for ( int i = <NUM_LIT:0> , max = targetParameters . length ; i < max ; i ++ ) { TypeBinding targetParameter = targetParameters [ i ] ; TypeBinding leafTargetParameterType = targetParameter . leafComponentType ( ) ; if ( ( leafTargetParameterType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { this . tagBits |= TagBits . ContainsNestedTypeReferences ; Util . recordNestedType ( classFile , leafTargetParameterType ) ; } buffer . append ( targetParameter . signature ( ) ) ; } } if ( needSynthetics ) { SyntheticArgumentBinding [ ] syntheticOuterArguments = this . declaringClass . syntheticOuterLocalVariables ( ) ; int count = syntheticOuterArguments == null ? <NUM_LIT:0> : syntheticOuterArguments . length ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { buffer . append ( syntheticOuterArguments [ i ] . type . signature ( ) ) ; } for ( int i = targetParameters . length , extraLength = this . parameters . length ; i < extraLength ; i ++ ) { TypeBinding parameter = this . parameters [ i ] ; TypeBinding leafParameterType = parameter . leafComponentType ( ) ; if ( ( leafParameterType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { this . tagBits |= TagBits . ContainsNestedTypeReferences ; Util . recordNestedType ( classFile , leafParameterType ) ; } buffer . append ( parameter . signature ( ) ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; if ( this . returnType != null ) { TypeBinding ret = this . returnType . leafComponentType ( ) ; if ( ( ret . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { this . tagBits |= TagBits . ContainsNestedTypeReferences ; Util . recordNestedType ( classFile , ret ) ; } buffer . append ( this . returnType . signature ( ) ) ; } int nameLength = buffer . length ( ) ; this . signature = new char [ nameLength ] ; buffer . getChars ( <NUM_LIT:0> , nameLength , this . signature , <NUM_LIT:0> ) ; return this . signature ; } public final int sourceEnd ( ) { AbstractMethodDeclaration method = sourceMethod ( ) ; if ( method == null ) { if ( this . declaringClass instanceof SourceTypeBinding ) return ( ( SourceTypeBinding ) this . declaringClass ) . sourceEnd ( ) ; return <NUM_LIT:0> ; } return method . sourceEnd ; } public AbstractMethodDeclaration sourceMethod ( ) { if ( isSynthetic ( ) ) { return null ; } SourceTypeBinding sourceType ; try { sourceType = ( SourceTypeBinding ) this . declaringClass ; } catch ( ClassCastException e ) { return null ; } AbstractMethodDeclaration [ ] methods = sourceType . scope . referenceContext . methods ; if ( methods != null ) { for ( int i = methods . length ; -- i >= <NUM_LIT:0> ; ) if ( this == methods [ i ] . binding ) return methods [ i ] ; } return null ; } public final int sourceStart ( ) { AbstractMethodDeclaration method = sourceMethod ( ) ; if ( method == null ) { if ( this . declaringClass instanceof SourceTypeBinding ) return ( ( SourceTypeBinding ) this . declaringClass ) . sourceStart ( ) ; return <NUM_LIT:0> ; } return method . sourceStart ; } public MethodBinding tiebreakMethod ( ) { return this ; } public String toString ( ) { StringBuffer output = new StringBuffer ( <NUM_LIT:10> ) ; if ( ( this . modifiers & ExtraCompilerModifiers . AccUnresolved ) != <NUM_LIT:0> ) { output . append ( "<STR_LIT>" ) ; } ASTNode . printModifiers ( this . modifiers , output ) ; output . append ( this . returnType != null ? this . returnType . debugName ( ) : "<STR_LIT>" ) ; output . append ( "<STR_LIT:U+0020>" ) ; output . append ( this . selector != null ? new String ( this . selector ) : "<STR_LIT>" ) ; output . append ( "<STR_LIT:(>" ) ; if ( this . parameters != null ) { if ( this . parameters != Binding . NO_PARAMETERS ) { for ( int i = <NUM_LIT:0> , length = this . parameters . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; output . append ( this . parameters [ i ] != null ? this . parameters [ i ] . debugName ( ) : "<STR_LIT>" ) ; } } } else { output . append ( "<STR_LIT>" ) ; } output . append ( "<STR_LIT>" ) ; if ( this . thrownExceptions != null ) { if ( this . thrownExceptions != Binding . NO_EXCEPTIONS ) { output . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = this . thrownExceptions . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; output . append ( ( this . thrownExceptions [ i ] != null ) ? this . thrownExceptions [ i ] . debugName ( ) : "<STR_LIT>" ) ; } } } else { output . append ( "<STR_LIT>" ) ; } return output . toString ( ) ; } public TypeVariableBinding [ ] typeVariables ( ) { return this . typeVariables ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Argument ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeParameter ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObject ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; class MethodVerifier15 extends MethodVerifier { MethodVerifier15 ( LookupEnvironment environment ) { super ( environment ) ; } boolean areMethodsCompatible ( MethodBinding one , MethodBinding two ) { one = one . original ( ) ; two = one . findOriginalInheritedMethod ( two ) ; if ( two == null ) return false ; return isParameterSubsignature ( one , two ) ; } boolean areParametersEqual ( MethodBinding one , MethodBinding two ) { TypeBinding [ ] oneArgs = one . parameters ; TypeBinding [ ] twoArgs = two . parameters ; if ( oneArgs == twoArgs ) return true ; int length = oneArgs . length ; if ( length != twoArgs . length ) return false ; int i ; foundRAW : for ( i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ! areTypesEqual ( oneArgs [ i ] , twoArgs [ i ] ) ) { if ( oneArgs [ i ] . leafComponentType ( ) . isRawType ( ) ) { if ( oneArgs [ i ] . dimensions ( ) == twoArgs [ i ] . dimensions ( ) && oneArgs [ i ] . leafComponentType ( ) . isEquivalentTo ( twoArgs [ i ] . leafComponentType ( ) ) ) { if ( one . typeVariables != Binding . NO_TYPE_VARIABLES ) return false ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) if ( oneArgs [ j ] . leafComponentType ( ) . isParameterizedTypeWithActualArguments ( ) ) return false ; break foundRAW ; } } return false ; } } for ( i ++ ; i < length ; i ++ ) { if ( ! areTypesEqual ( oneArgs [ i ] , twoArgs [ i ] ) ) { if ( oneArgs [ i ] . leafComponentType ( ) . isRawType ( ) ) if ( oneArgs [ i ] . dimensions ( ) == twoArgs [ i ] . dimensions ( ) && oneArgs [ i ] . leafComponentType ( ) . isEquivalentTo ( twoArgs [ i ] . leafComponentType ( ) ) ) continue ; return false ; } else if ( oneArgs [ i ] . leafComponentType ( ) . isParameterizedTypeWithActualArguments ( ) ) { return false ; } } return true ; } boolean areReturnTypesCompatible ( MethodBinding one , MethodBinding two ) { if ( one . returnType == two . returnType ) return true ; if ( this . type . scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ) { return areReturnTypesCompatible0 ( one , two ) ; } else { return areTypesEqual ( one . returnType . erasure ( ) , two . returnType . erasure ( ) ) ; } } boolean areTypesEqual ( TypeBinding one , TypeBinding two ) { if ( one == two ) return true ; switch ( one . kind ( ) ) { case Binding . TYPE : switch ( two . kind ( ) ) { case Binding . PARAMETERIZED_TYPE : case Binding . RAW_TYPE : if ( one == two . erasure ( ) ) return true ; } break ; case Binding . RAW_TYPE : case Binding . PARAMETERIZED_TYPE : switch ( two . kind ( ) ) { case Binding . TYPE : if ( one . erasure ( ) == two ) return true ; } } if ( one . isParameterizedType ( ) && two . isParameterizedType ( ) ) return one . isEquivalentTo ( two ) && two . isEquivalentTo ( one ) ; return false ; } protected boolean canOverridingMethodDifferInErasure ( MethodBinding overridingMethod , MethodBinding inheritedMethod ) { if ( overridingMethod . areParameterErasuresEqual ( inheritedMethod ) ) return false ; if ( overridingMethod . declaringClass . isRawType ( ) ) return false ; return true ; } boolean canSkipInheritedMethods ( ) { if ( this . type . superclass ( ) != null ) if ( this . type . superclass ( ) . isAbstract ( ) || this . type . superclass ( ) . isParameterizedType ( ) ) return false ; return this . type . superInterfaces ( ) == Binding . NO_SUPERINTERFACES ; } boolean canSkipInheritedMethods ( MethodBinding one , MethodBinding two ) { return two == null || ( one . declaringClass == two . declaringClass && ! one . declaringClass . isParameterizedType ( ) ) ; } void checkConcreteInheritedMethod ( MethodBinding concreteMethod , MethodBinding [ ] abstractMethods ) { super . checkConcreteInheritedMethod ( concreteMethod , abstractMethods ) ; for ( int i = <NUM_LIT:0> , l = abstractMethods . length ; i < l ; i ++ ) { MethodBinding abstractMethod = abstractMethods [ i ] ; if ( concreteMethod . isVarargs ( ) != abstractMethod . isVarargs ( ) ) problemReporter ( ) . varargsConflict ( concreteMethod , abstractMethod , this . type ) ; MethodBinding originalInherited = abstractMethod . original ( ) ; if ( originalInherited . returnType != concreteMethod . returnType ) if ( ! isAcceptableReturnTypeOverride ( concreteMethod , abstractMethod ) ) problemReporter ( ) . unsafeReturnTypeOverride ( concreteMethod , originalInherited , this . type ) ; if ( originalInherited . declaringClass . isInterface ( ) ) { if ( ( concreteMethod . declaringClass == this . type . superclass && this . type . superclass . isParameterizedType ( ) && ! areMethodsCompatible ( concreteMethod , originalInherited ) ) || this . type . superclass . erasure ( ) . findSuperTypeOriginatingFrom ( originalInherited . declaringClass ) == null ) this . type . addSyntheticBridgeMethod ( originalInherited , concreteMethod . original ( ) ) ; } } } void checkForBridgeMethod ( MethodBinding currentMethod , MethodBinding inheritedMethod , MethodBinding [ ] allInheritedMethods ) { if ( currentMethod . isVarargs ( ) != inheritedMethod . isVarargs ( ) ) problemReporter ( currentMethod ) . varargsConflict ( currentMethod , inheritedMethod , this . type ) ; MethodBinding originalInherited = inheritedMethod . original ( ) ; if ( originalInherited . returnType != currentMethod . returnType ) if ( ! isAcceptableReturnTypeOverride ( currentMethod , inheritedMethod ) ) problemReporter ( currentMethod ) . unsafeReturnTypeOverride ( currentMethod , originalInherited , this . type ) ; MethodBinding bridge = this . type . addSyntheticBridgeMethod ( originalInherited , currentMethod . original ( ) ) ; if ( bridge != null ) { for ( int i = <NUM_LIT:0> , l = allInheritedMethods == null ? <NUM_LIT:0> : allInheritedMethods . length ; i < l ; i ++ ) { if ( allInheritedMethods [ i ] != null && detectInheritedNameClash ( originalInherited , allInheritedMethods [ i ] . original ( ) ) ) return ; } MethodBinding [ ] current = ( MethodBinding [ ] ) this . currentMethods . get ( bridge . selector ) ; for ( int i = current . length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; -- i ) { final MethodBinding thisMethod = current [ i ] ; if ( thisMethod . areParameterErasuresEqual ( bridge ) && thisMethod . returnType . erasure ( ) == bridge . returnType . erasure ( ) ) { problemReporter ( thisMethod ) . methodNameClash ( thisMethod , inheritedMethod . declaringClass . isRawType ( ) ? inheritedMethod : inheritedMethod . original ( ) , ProblemSeverities . Error ) ; return ; } } } } void checkForNameClash ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { if ( inheritedMethod . isStatic ( ) ) return ; if ( ! detectNameClash ( currentMethod , inheritedMethod , false ) ) { TypeBinding [ ] currentParams = currentMethod . parameters ; TypeBinding [ ] inheritedParams = inheritedMethod . parameters ; int length = currentParams . length ; if ( length != inheritedParams . length ) return ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( currentParams [ i ] != inheritedParams [ i ] ) if ( currentParams [ i ] . isBaseType ( ) != inheritedParams [ i ] . isBaseType ( ) || ! inheritedParams [ i ] . isCompatibleWith ( currentParams [ i ] ) ) return ; ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = <NUM_LIT:0> ; ReferenceBinding superType = inheritedMethod . declaringClass ; ReferenceBinding [ ] itsInterfaces = superType . superInterfaces ( ) ; if ( itsInterfaces != Binding . NO_SUPERINTERFACES ) { nextPosition = itsInterfaces . length ; interfacesToVisit = itsInterfaces ; } superType = superType . superclass ( ) ; while ( superType != null && superType . isValidBinding ( ) ) { MethodBinding [ ] methods = superType . getMethods ( currentMethod . selector ) ; for ( int m = <NUM_LIT:0> , n = methods . length ; m < n ; m ++ ) { MethodBinding substitute = computeSubstituteMethod ( methods [ m ] , currentMethod ) ; if ( substitute != null && ! isSubstituteParameterSubsignature ( currentMethod , substitute ) && detectNameClash ( currentMethod , substitute , true ) ) return ; } if ( ( itsInterfaces = superType . superInterfaces ( ) ) != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } superType = superType . superclass ( ) ; } for ( int i = <NUM_LIT:0> ; i < nextPosition ; i ++ ) { superType = interfacesToVisit [ i ] ; if ( superType . isValidBinding ( ) ) { MethodBinding [ ] methods = superType . getMethods ( currentMethod . selector ) ; for ( int m = <NUM_LIT:0> , n = methods . length ; m < n ; m ++ ) { MethodBinding substitute = computeSubstituteMethod ( methods [ m ] , currentMethod ) ; if ( substitute != null && ! isSubstituteParameterSubsignature ( currentMethod , substitute ) && detectNameClash ( currentMethod , substitute , true ) ) return ; } if ( ( itsInterfaces = superType . superInterfaces ( ) ) != Binding . NO_SUPERINTERFACES ) { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } } } } void checkInheritedMethods ( MethodBinding inheritedMethod , MethodBinding otherInheritedMethod ) { if ( inheritedMethod . declaringClass . isInterface ( ) || inheritedMethod . isStatic ( ) ) return ; detectInheritedNameClash ( inheritedMethod . original ( ) , otherInheritedMethod . original ( ) ) ; } void checkInheritedMethods ( MethodBinding [ ] methods , int length ) { boolean continueInvestigation = true ; MethodBinding concreteMethod = null ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ! methods [ i ] . isAbstract ( ) ) { if ( concreteMethod != null ) { problemReporter ( ) . duplicateInheritedMethods ( this . type , concreteMethod , methods [ i ] ) ; continueInvestigation = false ; } concreteMethod = methods [ i ] ; } } if ( continueInvestigation ) { super . checkInheritedMethods ( methods , length ) ; } } boolean checkInheritedReturnTypes ( MethodBinding method , MethodBinding otherMethod ) { if ( areReturnTypesCompatible ( method , otherMethod ) ) return true ; if ( isUnsafeReturnTypeOverride ( method , otherMethod ) ) { if ( ! method . declaringClass . implementsInterface ( otherMethod . declaringClass , false ) ) problemReporter ( method ) . unsafeReturnTypeOverride ( method , otherMethod , this . type ) ; return true ; } return false ; } void reportRawReferences ( ) { CompilerOptions compilerOptions = this . type . scope . compilerOptions ( ) ; if ( compilerOptions . sourceLevel < ClassFileConstants . JDK1_5 || compilerOptions . reportUnavoidableGenericTypeProblems ) { return ; } Object [ ] methodArray = this . currentMethods . valueTable ; for ( int s = methodArray . length ; -- s >= <NUM_LIT:0> ; ) { if ( methodArray [ s ] == null ) continue ; MethodBinding [ ] current = ( MethodBinding [ ] ) methodArray [ s ] ; for ( int i = <NUM_LIT:0> , length = current . length ; i < length ; i ++ ) { MethodBinding currentMethod = current [ i ] ; if ( ( currentMethod . modifiers & ( ExtraCompilerModifiers . AccImplementing | ExtraCompilerModifiers . AccOverriding ) ) == <NUM_LIT:0> ) { AbstractMethodDeclaration methodDecl = currentMethod . sourceMethod ( ) ; if ( methodDecl == null ) return ; TypeBinding [ ] parameterTypes = currentMethod . parameters ; Argument [ ] arguments = methodDecl . arguments ; for ( int j = <NUM_LIT:0> , size = currentMethod . parameters . length ; j < size ; j ++ ) { TypeBinding parameterType = parameterTypes [ j ] ; Argument arg = arguments [ j ] ; if ( parameterType . leafComponentType ( ) . isRawType ( ) && compilerOptions . getSeverity ( CompilerOptions . RawTypeReference ) != ProblemSeverities . Ignore && ( arg . type . bits & ASTNode . IgnoreRawTypeCheck ) == <NUM_LIT:0> ) { methodDecl . scope . problemReporter ( ) . rawTypeReference ( arg . type , parameterType ) ; } } if ( ! methodDecl . isConstructor ( ) && methodDecl instanceof MethodDeclaration ) { TypeReference returnType = ( ( MethodDeclaration ) methodDecl ) . returnType ; TypeBinding methodType = currentMethod . returnType ; if ( returnType != null ) { if ( methodType . leafComponentType ( ) . isRawType ( ) && compilerOptions . getSeverity ( CompilerOptions . RawTypeReference ) != ProblemSeverities . Ignore && ( returnType . bits & ASTNode . IgnoreRawTypeCheck ) == <NUM_LIT:0> ) { methodDecl . scope . problemReporter ( ) . rawTypeReference ( returnType , methodType ) ; } } } } } } } public void reportRawReferences ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { CompilerOptions compilerOptions = this . type . scope . compilerOptions ( ) ; if ( compilerOptions . sourceLevel < ClassFileConstants . JDK1_5 || compilerOptions . reportUnavoidableGenericTypeProblems ) { return ; } AbstractMethodDeclaration methodDecl = currentMethod . sourceMethod ( ) ; if ( methodDecl == null ) return ; TypeBinding [ ] parameterTypes = currentMethod . parameters ; TypeBinding [ ] inheritedParameterTypes = inheritedMethod . parameters ; Argument [ ] arguments = methodDecl . arguments ; for ( int j = <NUM_LIT:0> , size = currentMethod . parameters . length ; j < size ; j ++ ) { TypeBinding parameterType = parameterTypes [ j ] ; TypeBinding inheritedParameterType = inheritedParameterTypes [ j ] ; Argument arg = arguments [ j ] ; if ( parameterType . leafComponentType ( ) . isRawType ( ) ) { if ( inheritedParameterType . leafComponentType ( ) . isRawType ( ) ) { arg . binding . tagBits |= TagBits . ForcedToBeRawType ; } else { if ( compilerOptions . getSeverity ( CompilerOptions . RawTypeReference ) != ProblemSeverities . Ignore && ( arg . type . bits & ASTNode . IgnoreRawTypeCheck ) == <NUM_LIT:0> ) { methodDecl . scope . problemReporter ( ) . rawTypeReference ( arg . type , parameterType ) ; } } } } TypeReference returnType = null ; if ( ! methodDecl . isConstructor ( ) && methodDecl instanceof MethodDeclaration && ( returnType = ( ( MethodDeclaration ) methodDecl ) . returnType ) != null ) { final TypeBinding inheritedMethodType = inheritedMethod . returnType ; final TypeBinding methodType = currentMethod . returnType ; if ( methodType . leafComponentType ( ) . isRawType ( ) ) { if ( inheritedMethodType . leafComponentType ( ) . isRawType ( ) ) { } else { if ( ( returnType . bits & ASTNode . IgnoreRawTypeCheck ) == <NUM_LIT:0> && compilerOptions . getSeverity ( CompilerOptions . RawTypeReference ) != ProblemSeverities . Ignore ) { methodDecl . scope . problemReporter ( ) . rawTypeReference ( returnType , methodType ) ; } } } } } void checkMethods ( ) { boolean mustImplementAbstractMethods = mustImplementAbstractMethods ( ) ; boolean skipInheritedMethods = mustImplementAbstractMethods && canSkipInheritedMethods ( ) ; boolean isOrEnclosedByPrivateType = this . type . isOrEnclosedByPrivateType ( ) ; char [ ] [ ] methodSelectors = this . inheritedMethods . keyTable ; nextSelector : for ( int s = methodSelectors . length ; -- s >= <NUM_LIT:0> ; ) { if ( methodSelectors [ s ] == null ) continue nextSelector ; MethodBinding [ ] current = ( MethodBinding [ ] ) this . currentMethods . get ( methodSelectors [ s ] ) ; MethodBinding [ ] inherited = ( MethodBinding [ ] ) this . inheritedMethods . valueTable [ s ] ; if ( current == null && ! isOrEnclosedByPrivateType ) { int length = inherited . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { inherited [ i ] . original ( ) . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } if ( current == null && this . type . isPublic ( ) ) { int length = inherited . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { MethodBinding inheritedMethod = inherited [ i ] ; if ( inheritedMethod . isPublic ( ) && ! inheritedMethod . declaringClass . isPublic ( ) ) this . type . addSyntheticBridgeMethod ( inheritedMethod . original ( ) ) ; } } if ( current == null && skipInheritedMethods ) continue nextSelector ; if ( inherited . length == <NUM_LIT:1> && current == null ) { if ( mustImplementAbstractMethods && inherited [ <NUM_LIT:0> ] . isAbstract ( ) ) checkAbstractMethod ( inherited [ <NUM_LIT:0> ] ) ; continue nextSelector ; } int index = - <NUM_LIT:1> ; int inheritedLength = inherited . length ; MethodBinding [ ] matchingInherited = new MethodBinding [ inheritedLength ] ; MethodBinding [ ] foundMatch = new MethodBinding [ inheritedLength ] ; if ( current != null ) { for ( int i = <NUM_LIT:0> , length1 = current . length ; i < length1 ; i ++ ) { MethodBinding currentMethod = current [ i ] ; MethodBinding [ ] nonMatchingInherited = null ; for ( int j = <NUM_LIT:0> ; j < inheritedLength ; j ++ ) { MethodBinding inheritedMethod = computeSubstituteMethod ( inherited [ j ] , currentMethod ) ; if ( inheritedMethod != null ) { if ( foundMatch [ j ] == null && isSubstituteParameterSubsignature ( currentMethod , inheritedMethod ) ) { matchingInherited [ ++ index ] = inheritedMethod ; foundMatch [ j ] = currentMethod ; } else { checkForNameClash ( currentMethod , inheritedMethod ) ; if ( inheritedLength > <NUM_LIT:1> ) { if ( nonMatchingInherited == null ) nonMatchingInherited = new MethodBinding [ inheritedLength ] ; nonMatchingInherited [ j ] = inheritedMethod ; } } } } if ( index >= <NUM_LIT:0> ) { checkAgainstInheritedMethods ( currentMethod , matchingInherited , index + <NUM_LIT:1> , nonMatchingInherited ) ; while ( index >= <NUM_LIT:0> ) matchingInherited [ index -- ] = null ; } } } boolean [ ] skip = new boolean [ inheritedLength ] ; for ( int i = <NUM_LIT:0> ; i < inheritedLength ; i ++ ) { MethodBinding matchMethod = foundMatch [ i ] ; if ( matchMethod == null && current != null && this . type . isPublic ( ) ) { MethodBinding inheritedMethod = inherited [ i ] ; if ( inheritedMethod . isPublic ( ) && ! inheritedMethod . declaringClass . isPublic ( ) ) { this . type . addSyntheticBridgeMethod ( inheritedMethod . original ( ) ) ; } } if ( ! isOrEnclosedByPrivateType && matchMethod == null && current != null ) { inherited [ i ] . original ( ) . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } if ( skip [ i ] ) continue ; MethodBinding inheritedMethod = inherited [ i ] ; if ( matchMethod == null ) matchingInherited [ ++ index ] = inheritedMethod ; for ( int j = i + <NUM_LIT:1> ; j < inheritedLength ; j ++ ) { MethodBinding otherInheritedMethod = inherited [ j ] ; if ( matchMethod == foundMatch [ j ] && matchMethod != null ) continue ; if ( canSkipInheritedMethods ( inheritedMethod , otherInheritedMethod ) ) continue ; if ( inheritedMethod . declaringClass != otherInheritedMethod . declaringClass ) { if ( otherInheritedMethod . declaringClass . isInterface ( ) ) { if ( isInterfaceMethodImplemented ( otherInheritedMethod , inheritedMethod , otherInheritedMethod . declaringClass ) ) { skip [ j ] = true ; continue ; } } else if ( areMethodsCompatible ( inheritedMethod , otherInheritedMethod ) ) { skip [ j ] = true ; continue ; } } otherInheritedMethod = computeSubstituteMethod ( otherInheritedMethod , inheritedMethod ) ; if ( otherInheritedMethod != null ) { if ( isSubstituteParameterSubsignature ( inheritedMethod , otherInheritedMethod ) ) { if ( index == - <NUM_LIT:1> ) matchingInherited [ ++ index ] = inheritedMethod ; if ( foundMatch [ j ] == null ) matchingInherited [ ++ index ] = otherInheritedMethod ; skip [ j ] = true ; } else if ( matchMethod == null && foundMatch [ j ] == null ) { checkInheritedMethods ( inheritedMethod , otherInheritedMethod ) ; } } } if ( index == - <NUM_LIT:1> ) continue ; if ( index > <NUM_LIT:0> ) checkInheritedMethods ( matchingInherited , index + <NUM_LIT:1> ) ; else if ( mustImplementAbstractMethods && matchingInherited [ <NUM_LIT:0> ] . isAbstract ( ) && matchMethod == null ) checkAbstractMethod ( matchingInherited [ <NUM_LIT:0> ] ) ; while ( index >= <NUM_LIT:0> ) matchingInherited [ index -- ] = null ; } } } void checkTypeVariableMethods ( TypeParameter typeParameter ) { char [ ] [ ] methodSelectors = this . inheritedMethods . keyTable ; nextSelector : for ( int s = methodSelectors . length ; -- s >= <NUM_LIT:0> ; ) { if ( methodSelectors [ s ] == null ) continue nextSelector ; MethodBinding [ ] inherited = ( MethodBinding [ ] ) this . inheritedMethods . valueTable [ s ] ; if ( inherited . length == <NUM_LIT:1> ) continue nextSelector ; int index = - <NUM_LIT:1> ; MethodBinding [ ] matchingInherited = new MethodBinding [ inherited . length ] ; for ( int i = <NUM_LIT:0> , length = inherited . length ; i < length ; i ++ ) { while ( index >= <NUM_LIT:0> ) matchingInherited [ index -- ] = null ; MethodBinding inheritedMethod = inherited [ i ] ; if ( inheritedMethod != null ) { matchingInherited [ ++ index ] = inheritedMethod ; for ( int j = i + <NUM_LIT:1> ; j < length ; j ++ ) { MethodBinding otherInheritedMethod = inherited [ j ] ; if ( canSkipInheritedMethods ( inheritedMethod , otherInheritedMethod ) ) continue ; otherInheritedMethod = computeSubstituteMethod ( otherInheritedMethod , inheritedMethod ) ; if ( otherInheritedMethod != null && isSubstituteParameterSubsignature ( inheritedMethod , otherInheritedMethod ) ) { matchingInherited [ ++ index ] = otherInheritedMethod ; inherited [ j ] = null ; } } } if ( index > <NUM_LIT:0> ) { MethodBinding first = matchingInherited [ <NUM_LIT:0> ] ; int count = index + <NUM_LIT:1> ; while ( -- count > <NUM_LIT:0> ) { MethodBinding match = matchingInherited [ count ] ; MethodBinding interfaceMethod = null , implementation = null ; if ( first . declaringClass . isInterface ( ) ) { interfaceMethod = first ; } else if ( first . declaringClass . isClass ( ) ) { implementation = first ; } if ( match . declaringClass . isInterface ( ) ) { interfaceMethod = match ; } else if ( match . declaringClass . isClass ( ) ) { implementation = match ; } if ( interfaceMethod != null && implementation != null && ! isAsVisible ( implementation , interfaceMethod ) ) problemReporter ( ) . inheritedMethodReducesVisibility ( typeParameter , implementation , new MethodBinding [ ] { interfaceMethod } ) ; if ( areReturnTypesCompatible ( first , match ) ) continue ; if ( first . declaringClass . isInterface ( ) && match . declaringClass . isInterface ( ) && areReturnTypesCompatible ( match , first ) ) continue ; break ; } if ( count > <NUM_LIT:0> ) { problemReporter ( ) . inheritedMethodsHaveIncompatibleReturnTypes ( typeParameter , matchingInherited , index + <NUM_LIT:1> ) ; continue nextSelector ; } } } } } MethodBinding computeSubstituteMethod ( MethodBinding inheritedMethod , MethodBinding currentMethod ) { if ( inheritedMethod == null ) return null ; if ( currentMethod . parameters . length != inheritedMethod . parameters . length ) return null ; if ( currentMethod . declaringClass instanceof BinaryTypeBinding ) ( ( BinaryTypeBinding ) currentMethod . declaringClass ) . resolveTypesFor ( currentMethod ) ; if ( inheritedMethod . declaringClass instanceof BinaryTypeBinding ) ( ( BinaryTypeBinding ) inheritedMethod . declaringClass ) . resolveTypesFor ( inheritedMethod ) ; TypeVariableBinding [ ] inheritedTypeVariables = inheritedMethod . typeVariables ; int inheritedLength = inheritedTypeVariables . length ; if ( inheritedLength == <NUM_LIT:0> ) return inheritedMethod ; TypeVariableBinding [ ] typeVariables = currentMethod . typeVariables ; int length = typeVariables . length ; if ( length == <NUM_LIT:0> ) return inheritedMethod . asRawMethod ( this . environment ) ; if ( length != inheritedLength ) return inheritedMethod ; TypeBinding [ ] arguments = new TypeBinding [ length ] ; System . arraycopy ( typeVariables , <NUM_LIT:0> , arguments , <NUM_LIT:0> , length ) ; ParameterizedGenericMethodBinding substitute = this . environment . createParameterizedGenericMethod ( inheritedMethod , arguments ) ; for ( int i = <NUM_LIT:0> ; i < inheritedLength ; i ++ ) { TypeVariableBinding inheritedTypeVariable = inheritedTypeVariables [ i ] ; TypeBinding argument = arguments [ i ] ; if ( argument instanceof TypeVariableBinding ) { TypeVariableBinding typeVariable = ( TypeVariableBinding ) argument ; if ( typeVariable . firstBound == inheritedTypeVariable . firstBound ) { if ( typeVariable . firstBound == null ) continue ; } else if ( typeVariable . firstBound != null && inheritedTypeVariable . firstBound != null ) { if ( typeVariable . firstBound . isClass ( ) != inheritedTypeVariable . firstBound . isClass ( ) ) return inheritedMethod ; } if ( Scope . substitute ( substitute , inheritedTypeVariable . superclass ) != typeVariable . superclass ) return inheritedMethod ; int interfaceLength = inheritedTypeVariable . superInterfaces . length ; ReferenceBinding [ ] interfaces = typeVariable . superInterfaces ; if ( interfaceLength != interfaces . length ) return inheritedMethod ; next : for ( int j = <NUM_LIT:0> ; j < interfaceLength ; j ++ ) { TypeBinding superType = Scope . substitute ( substitute , inheritedTypeVariable . superInterfaces [ j ] ) ; for ( int k = <NUM_LIT:0> ; k < interfaceLength ; k ++ ) if ( superType == interfaces [ k ] ) continue next ; return inheritedMethod ; } } else if ( inheritedTypeVariable . boundCheck ( substitute , argument ) != TypeConstants . OK ) { return inheritedMethod ; } } return substitute ; } boolean detectInheritedNameClash ( MethodBinding inherited , MethodBinding otherInherited ) { if ( ! inherited . areParameterErasuresEqual ( otherInherited ) ) return false ; if ( inherited . returnType . erasure ( ) != otherInherited . returnType . erasure ( ) ) return false ; if ( inherited . declaringClass . erasure ( ) != otherInherited . declaringClass . erasure ( ) ) { if ( inherited . declaringClass . findSuperTypeOriginatingFrom ( otherInherited . declaringClass ) != null ) return false ; if ( otherInherited . declaringClass . findSuperTypeOriginatingFrom ( inherited . declaringClass ) != null ) return false ; } problemReporter ( ) . inheritedMethodsHaveNameClash ( this . type , inherited , otherInherited ) ; return true ; } boolean detectNameClash ( MethodBinding current , MethodBinding inherited , boolean treatAsSynthetic ) { MethodBinding methodToCheck = inherited ; MethodBinding original = methodToCheck . original ( ) ; if ( ! current . areParameterErasuresEqual ( original ) ) return false ; int severity = ProblemSeverities . Error ; if ( this . environment . globalOptions . complianceLevel == ClassFileConstants . JDK1_6 ) { if ( current . returnType . erasure ( ) != original . returnType . erasure ( ) ) severity = ProblemSeverities . Warning ; } if ( ! treatAsSynthetic ) { MethodBinding [ ] currentNamesakes = ( MethodBinding [ ] ) this . currentMethods . get ( inherited . selector ) ; if ( currentNamesakes . length > <NUM_LIT:1> ) { for ( int i = <NUM_LIT:0> , length = currentNamesakes . length ; i < length ; i ++ ) { MethodBinding currentMethod = currentNamesakes [ i ] ; if ( currentMethod != current && doesMethodOverride ( currentMethod , inherited ) ) { methodToCheck = currentMethod ; break ; } } } } original = methodToCheck . original ( ) ; if ( ! current . areParameterErasuresEqual ( original ) ) return false ; original = inherited . original ( ) ; problemReporter ( current ) . methodNameClash ( current , inherited . declaringClass . isRawType ( ) ? inherited : original , severity ) ; if ( severity == ProblemSeverities . Warning ) return false ; return true ; } public boolean doesMethodOverride ( MethodBinding method , MethodBinding inheritedMethod ) { return couldMethodOverride ( method , inheritedMethod ) && areMethodsCompatible ( method , inheritedMethod ) ; } boolean doTypeVariablesClash ( MethodBinding one , MethodBinding substituteTwo ) { return one . typeVariables != Binding . NO_TYPE_VARIABLES && ! ( substituteTwo instanceof ParameterizedGenericMethodBinding ) ; } SimpleSet findSuperinterfaceCollisions ( ReferenceBinding superclass , ReferenceBinding [ ] superInterfaces ) { ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = <NUM_LIT:0> ; ReferenceBinding [ ] itsInterfaces = superInterfaces ; if ( itsInterfaces != Binding . NO_SUPERINTERFACES ) { nextPosition = itsInterfaces . length ; interfacesToVisit = itsInterfaces ; } boolean isInconsistent = this . type . isHierarchyInconsistent ( ) ; ReferenceBinding superType = superclass ; while ( superType != null && superType . isValidBinding ( ) ) { isInconsistent |= superType . isHierarchyInconsistent ( ) ; if ( ( itsInterfaces = superType . superInterfaces ( ) ) != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } superType = superType . superclass ( ) ; } for ( int i = <NUM_LIT:0> ; i < nextPosition ; i ++ ) { superType = interfacesToVisit [ i ] ; if ( superType . isValidBinding ( ) ) { isInconsistent |= superType . isHierarchyInconsistent ( ) ; if ( ( itsInterfaces = superType . superInterfaces ( ) ) != Binding . NO_SUPERINTERFACES ) { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } } if ( ! isInconsistent ) return null ; SimpleSet copy = null ; for ( int i = <NUM_LIT:0> ; i < nextPosition ; i ++ ) { ReferenceBinding current = interfacesToVisit [ i ] ; if ( current . isValidBinding ( ) ) { TypeBinding erasure = current . erasure ( ) ; for ( int j = i + <NUM_LIT:1> ; j < nextPosition ; j ++ ) { ReferenceBinding next = interfacesToVisit [ j ] ; if ( next . isValidBinding ( ) && next . erasure ( ) == erasure ) { if ( copy == null ) copy = new SimpleSet ( nextPosition ) ; copy . add ( interfacesToVisit [ i ] ) ; copy . add ( interfacesToVisit [ j ] ) ; } } } } return copy ; } boolean hasGenericParameter ( MethodBinding method ) { if ( method . genericSignature ( ) == null ) return false ; TypeBinding [ ] params = method . parameters ; for ( int i = <NUM_LIT:0> , l = params . length ; i < l ; i ++ ) { TypeBinding param = params [ i ] . leafComponentType ( ) ; if ( param instanceof ReferenceBinding ) { int modifiers = ( ( ReferenceBinding ) param ) . modifiers ; if ( ( modifiers & ExtraCompilerModifiers . AccGenericSignature ) != <NUM_LIT:0> ) return true ; } } return false ; } boolean isAcceptableReturnTypeOverride ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { if ( inheritedMethod . declaringClass . isRawType ( ) ) return true ; MethodBinding originalInherited = inheritedMethod . original ( ) ; TypeBinding originalInheritedReturnType = originalInherited . returnType . leafComponentType ( ) ; if ( originalInheritedReturnType . isParameterizedTypeWithActualArguments ( ) ) return ! currentMethod . returnType . leafComponentType ( ) . isRawType ( ) ; TypeBinding currentReturnType = currentMethod . returnType . leafComponentType ( ) ; switch ( currentReturnType . kind ( ) ) { case Binding . TYPE_PARAMETER : if ( currentReturnType == inheritedMethod . returnType . leafComponentType ( ) ) return true ; default : if ( originalInheritedReturnType . isTypeVariable ( ) ) if ( ( ( TypeVariableBinding ) originalInheritedReturnType ) . declaringElement == originalInherited ) return false ; return true ; } } boolean isInterfaceMethodImplemented ( MethodBinding inheritedMethod , MethodBinding existingMethod , ReferenceBinding superType ) { if ( inheritedMethod . original ( ) != inheritedMethod && existingMethod . declaringClass . isInterface ( ) ) return false ; inheritedMethod = computeSubstituteMethod ( inheritedMethod , existingMethod ) ; return inheritedMethod != null && inheritedMethod . returnType == existingMethod . returnType && doesMethodOverride ( existingMethod , inheritedMethod ) ; } public boolean isMethodSubsignature ( MethodBinding method , MethodBinding inheritedMethod ) { if ( ! org . eclipse . jdt . core . compiler . CharOperation . equals ( method . selector , inheritedMethod . selector ) ) return false ; if ( method . declaringClass . isParameterizedType ( ) ) method = method . original ( ) ; MethodBinding inheritedOriginal = method . findOriginalInheritedMethod ( inheritedMethod ) ; return isParameterSubsignature ( method , inheritedOriginal == null ? inheritedMethod : inheritedOriginal ) ; } boolean isParameterSubsignature ( MethodBinding method , MethodBinding inheritedMethod ) { MethodBinding substitute = computeSubstituteMethod ( inheritedMethod , method ) ; return substitute != null && isSubstituteParameterSubsignature ( method , substitute ) ; } boolean isSubstituteParameterSubsignature ( MethodBinding method , MethodBinding substituteMethod ) { if ( ! areParametersEqual ( method , substituteMethod ) ) { if ( substituteMethod . hasSubstitutedParameters ( ) && method . areParameterErasuresEqual ( substituteMethod ) ) return method . typeVariables == Binding . NO_TYPE_VARIABLES && ! hasGenericParameter ( method ) ; if ( method . declaringClass . isRawType ( ) && substituteMethod . declaringClass . isRawType ( ) ) if ( method . hasSubstitutedParameters ( ) && substituteMethod . hasSubstitutedParameters ( ) ) return areMethodsCompatible ( method , substituteMethod ) ; return false ; } if ( substituteMethod instanceof ParameterizedGenericMethodBinding ) { if ( method . typeVariables != Binding . NO_TYPE_VARIABLES ) return ! ( ( ParameterizedGenericMethodBinding ) substituteMethod ) . isRaw ; return ! hasGenericParameter ( method ) ; } return method . typeVariables == Binding . NO_TYPE_VARIABLES ; } boolean isUnsafeReturnTypeOverride ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { if ( currentMethod . returnType == inheritedMethod . returnType . erasure ( ) ) { TypeBinding [ ] currentParams = currentMethod . parameters ; TypeBinding [ ] inheritedParams = inheritedMethod . parameters ; for ( int i = <NUM_LIT:0> , l = currentParams . length ; i < l ; i ++ ) if ( ! areTypesEqual ( currentParams [ i ] , inheritedParams [ i ] ) ) return true ; } if ( currentMethod . typeVariables == Binding . NO_TYPE_VARIABLES && inheritedMethod . original ( ) . typeVariables != Binding . NO_TYPE_VARIABLES && currentMethod . returnType . erasure ( ) . findSuperTypeOriginatingFrom ( inheritedMethod . returnType . erasure ( ) ) != null ) { return true ; } return false ; } boolean reportIncompatibleReturnTypeError ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { if ( isUnsafeReturnTypeOverride ( currentMethod , inheritedMethod ) ) { problemReporter ( currentMethod ) . unsafeReturnTypeOverride ( currentMethod , inheritedMethod , this . type ) ; return false ; } return super . reportIncompatibleReturnTypeError ( currentMethod , inheritedMethod ) ; } void verify ( ) { if ( this . type . isAnnotationType ( ) ) this . type . detectAnnotationCycle ( ) ; super . verify ( ) ; reportRawReferences ( ) ; for ( int i = this . type . typeVariables . length ; -- i >= <NUM_LIT:0> ; ) { TypeVariableBinding var = this . type . typeVariables [ i ] ; if ( var . superInterfaces == Binding . NO_SUPERINTERFACES ) continue ; if ( var . superInterfaces . length == <NUM_LIT:1> && var . superclass . id == TypeIds . T_JavaLangObject ) continue ; this . currentMethods = new HashtableOfObject ( <NUM_LIT:0> ) ; ReferenceBinding superclass = var . superclass ( ) ; if ( superclass . kind ( ) == Binding . TYPE_PARAMETER ) superclass = ( ReferenceBinding ) superclass . erasure ( ) ; ReferenceBinding [ ] itsInterfaces = var . superInterfaces ( ) ; ReferenceBinding [ ] superInterfaces = new ReferenceBinding [ itsInterfaces . length ] ; for ( int j = itsInterfaces . length ; -- j >= <NUM_LIT:0> ; ) { superInterfaces [ j ] = itsInterfaces [ j ] . kind ( ) == Binding . TYPE_PARAMETER ? ( ReferenceBinding ) itsInterfaces [ j ] . erasure ( ) : itsInterfaces [ j ] ; } computeInheritedMethods ( superclass , superInterfaces ) ; checkTypeVariableMethods ( this . type . scope . referenceContext . typeParameters [ i ] ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . internal . compiler . impl . Constant ; public class SyntheticFieldBinding extends FieldBinding { public int index ; public SyntheticFieldBinding ( char [ ] name , TypeBinding type , int modifiers , ReferenceBinding declaringClass , Constant constant , int index ) { super ( name , type , modifiers , declaringClass , constant ) ; this . index = index ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class MemberTypeBinding extends NestedTypeBinding { public MemberTypeBinding ( char [ ] [ ] compoundName , ClassScope scope , SourceTypeBinding enclosingType ) { super ( compoundName , scope , enclosingType ) ; this . tagBits |= TagBits . MemberTypeMask ; } void checkSyntheticArgsAndFields ( ) { if ( isStatic ( ) ) return ; if ( isInterface ( ) ) return ; this . addSyntheticArgumentAndField ( this . enclosingType ) ; } public char [ ] constantPoolName ( ) { if ( this . constantPoolName != null ) return this . constantPoolName ; return this . constantPoolName = CharOperation . concat ( enclosingType ( ) . constantPoolName ( ) , this . sourceName , '<CHAR_LIT>' ) ; } public void initializeDeprecatedAnnotationTagBits ( ) { if ( ( this . tagBits & TagBits . DeprecatedAnnotationResolved ) == <NUM_LIT:0> ) { super . initializeDeprecatedAnnotationTagBits ( ) ; if ( ( this . tagBits & TagBits . AnnotationDeprecated ) == <NUM_LIT:0> ) { ReferenceBinding enclosing ; if ( ( ( enclosing = enclosingType ( ) ) . tagBits & TagBits . DeprecatedAnnotationResolved ) == <NUM_LIT:0> ) { enclosing . initializeDeprecatedAnnotationTagBits ( ) ; } if ( enclosing . isViewedAsDeprecated ( ) ) { this . modifiers |= ExtraCompilerModifiers . AccDeprecatedImplicitly ; } } } } public String toString ( ) { return "<STR_LIT>" + new String ( sourceName ( ) ) + "<STR_LIT:U+0020>" + super . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; public class TypeVariableBinding extends ReferenceBinding { public Binding declaringElement ; public int rank ; public TypeBinding firstBound ; public ReferenceBinding superclass ; public ReferenceBinding [ ] superInterfaces ; public char [ ] genericTypeSignature ; LookupEnvironment environment ; public TypeVariableBinding ( char [ ] sourceName , Binding declaringElement , int rank , LookupEnvironment environment ) { this . sourceName = sourceName ; this . declaringElement = declaringElement ; this . rank = rank ; this . modifiers = ClassFileConstants . AccPublic | ExtraCompilerModifiers . AccGenericSignature ; this . tagBits |= TagBits . HasTypeVariable ; this . environment = environment ; } public int boundCheck ( Substitution substitution , TypeBinding argumentType ) { if ( argumentType == TypeBinding . NULL || argumentType == this ) { return TypeConstants . OK ; } boolean hasSubstitution = substitution != null ; if ( ! ( argumentType instanceof ReferenceBinding || argumentType . isArrayType ( ) ) ) return TypeConstants . MISMATCH ; if ( this . superclass == null ) return TypeConstants . OK ; if ( argumentType . kind ( ) == Binding . WILDCARD_TYPE ) { WildcardBinding wildcard = ( WildcardBinding ) argumentType ; switch ( wildcard . boundKind ) { case Wildcard . EXTENDS : TypeBinding wildcardBound = wildcard . bound ; if ( wildcardBound == this ) return TypeConstants . OK ; boolean isArrayBound = wildcardBound . isArrayType ( ) ; if ( ! wildcardBound . isInterface ( ) ) { TypeBinding substitutedSuperType = hasSubstitution ? Scope . substitute ( substitution , this . superclass ) : this . superclass ; if ( substitutedSuperType . id != TypeIds . T_JavaLangObject ) { if ( isArrayBound ) { if ( ! wildcardBound . isCompatibleWith ( substitutedSuperType ) ) return TypeConstants . MISMATCH ; } else { TypeBinding match = wildcardBound . findSuperTypeOriginatingFrom ( substitutedSuperType ) ; if ( match != null ) { if ( substitutedSuperType . isProvablyDistinct ( match ) ) { return TypeConstants . MISMATCH ; } } else { match = substitutedSuperType . findSuperTypeOriginatingFrom ( wildcardBound ) ; if ( match != null ) { if ( match . isProvablyDistinct ( wildcardBound ) ) { return TypeConstants . MISMATCH ; } } else { if ( ! wildcardBound . isTypeVariable ( ) && ! substitutedSuperType . isTypeVariable ( ) ) { return TypeConstants . MISMATCH ; } } } } } } boolean mustImplement = isArrayBound || ( ( ReferenceBinding ) wildcardBound ) . isFinal ( ) ; for ( int i = <NUM_LIT:0> , length = this . superInterfaces . length ; i < length ; i ++ ) { TypeBinding substitutedSuperType = hasSubstitution ? Scope . substitute ( substitution , this . superInterfaces [ i ] ) : this . superInterfaces [ i ] ; if ( isArrayBound ) { if ( ! wildcardBound . isCompatibleWith ( substitutedSuperType ) ) return TypeConstants . MISMATCH ; } else { TypeBinding match = wildcardBound . findSuperTypeOriginatingFrom ( substitutedSuperType ) ; if ( match != null ) { if ( substitutedSuperType . isProvablyDistinct ( match ) ) { return TypeConstants . MISMATCH ; } } else if ( mustImplement ) { return TypeConstants . MISMATCH ; } } } break ; case Wildcard . SUPER : if ( wildcard . bound . isTypeVariable ( ) && ( ( TypeVariableBinding ) wildcard . bound ) . superclass . id == TypeIds . T_JavaLangObject ) break ; return boundCheck ( substitution , wildcard . bound ) ; case Wildcard . UNBOUND : break ; } return TypeConstants . OK ; } boolean unchecked = false ; if ( this . superclass . id != TypeIds . T_JavaLangObject ) { TypeBinding substitutedSuperType = hasSubstitution ? Scope . substitute ( substitution , this . superclass ) : this . superclass ; if ( substitutedSuperType != argumentType ) { if ( ! argumentType . isCompatibleWith ( substitutedSuperType ) ) { return TypeConstants . MISMATCH ; } TypeBinding match = argumentType . findSuperTypeOriginatingFrom ( substitutedSuperType ) ; if ( match != null ) { if ( match . isRawType ( ) && substitutedSuperType . isBoundParameterizedType ( ) ) unchecked = true ; } } } for ( int i = <NUM_LIT:0> , length = this . superInterfaces . length ; i < length ; i ++ ) { TypeBinding substitutedSuperType = hasSubstitution ? Scope . substitute ( substitution , this . superInterfaces [ i ] ) : this . superInterfaces [ i ] ; if ( substitutedSuperType != argumentType ) { if ( ! argumentType . isCompatibleWith ( substitutedSuperType ) ) { return TypeConstants . MISMATCH ; } TypeBinding match = argumentType . findSuperTypeOriginatingFrom ( substitutedSuperType ) ; if ( match != null ) { if ( match . isRawType ( ) && substitutedSuperType . isBoundParameterizedType ( ) ) unchecked = true ; } } } return unchecked ? TypeConstants . UNCHECKED : TypeConstants . OK ; } public int boundsCount ( ) { if ( this . firstBound == null ) { return <NUM_LIT:0> ; } else if ( this . firstBound == this . superclass ) { return this . superInterfaces . length + <NUM_LIT:1> ; } else { return this . superInterfaces . length ; } } public boolean canBeInstantiated ( ) { return false ; } public void collectSubstitutes ( Scope scope , TypeBinding actualType , InferenceContext inferenceContext , int constraint ) { if ( this . declaringElement != inferenceContext . genericMethod ) return ; switch ( actualType . kind ( ) ) { case Binding . BASE_TYPE : if ( actualType == TypeBinding . NULL ) return ; TypeBinding boxedType = scope . environment ( ) . computeBoxingType ( actualType ) ; if ( boxedType == actualType ) return ; actualType = boxedType ; break ; case Binding . WILDCARD_TYPE : return ; } int variableConstraint ; switch ( constraint ) { case TypeConstants . CONSTRAINT_EQUAL : variableConstraint = TypeConstants . CONSTRAINT_EQUAL ; break ; case TypeConstants . CONSTRAINT_EXTENDS : variableConstraint = TypeConstants . CONSTRAINT_SUPER ; break ; default : variableConstraint = TypeConstants . CONSTRAINT_EXTENDS ; break ; } inferenceContext . recordSubstitute ( this , actualType , variableConstraint ) ; } public char [ ] computeUniqueKey ( boolean isLeaf ) { StringBuffer buffer = new StringBuffer ( ) ; Binding declaring = this . declaringElement ; if ( ! isLeaf && declaring . kind ( ) == Binding . METHOD ) { MethodBinding methodBinding = ( MethodBinding ) declaring ; ReferenceBinding declaringClass = methodBinding . declaringClass ; buffer . append ( declaringClass . computeUniqueKey ( false ) ) ; buffer . append ( '<CHAR_LIT::>' ) ; MethodBinding [ ] methods = declaringClass . methods ( ) ; if ( methods != null ) for ( int i = <NUM_LIT:0> , length = methods . length ; i < length ; i ++ ) { MethodBinding binding = methods [ i ] ; if ( binding == methodBinding ) { buffer . append ( i ) ; break ; } } } else { buffer . append ( declaring . computeUniqueKey ( false ) ) ; buffer . append ( '<CHAR_LIT::>' ) ; } buffer . append ( genericTypeSignature ( ) ) ; int length = buffer . length ( ) ; char [ ] uniqueKey = new char [ length ] ; buffer . getChars ( <NUM_LIT:0> , length , uniqueKey , <NUM_LIT:0> ) ; return uniqueKey ; } public char [ ] constantPoolName ( ) { if ( this . firstBound != null ) { return this . firstBound . constantPoolName ( ) ; } return this . superclass . constantPoolName ( ) ; } public String debugName ( ) { return new String ( this . sourceName ) ; } public TypeBinding erasure ( ) { if ( this . firstBound != null ) { return this . firstBound . erasure ( ) ; } return this . superclass ; } public char [ ] genericSignature ( ) { StringBuffer sig = new StringBuffer ( <NUM_LIT:10> ) ; sig . append ( this . sourceName ) . append ( '<CHAR_LIT::>' ) ; int interfaceLength = this . superInterfaces == null ? <NUM_LIT:0> : this . superInterfaces . length ; if ( interfaceLength == <NUM_LIT:0> || this . firstBound == this . superclass ) { if ( this . superclass != null ) sig . append ( this . superclass . genericTypeSignature ( ) ) ; } for ( int i = <NUM_LIT:0> ; i < interfaceLength ; i ++ ) { sig . append ( '<CHAR_LIT::>' ) . append ( this . superInterfaces [ i ] . genericTypeSignature ( ) ) ; } int sigLength = sig . length ( ) ; char [ ] genericSignature = new char [ sigLength ] ; sig . getChars ( <NUM_LIT:0> , sigLength , genericSignature , <NUM_LIT:0> ) ; return genericSignature ; } public char [ ] genericTypeSignature ( ) { if ( this . genericTypeSignature != null ) return this . genericTypeSignature ; return this . genericTypeSignature = CharOperation . concat ( '<CHAR_LIT>' , this . sourceName , '<CHAR_LIT:;>' ) ; } boolean hasOnlyRawBounds ( ) { if ( this . superclass != null && this . firstBound == this . superclass ) if ( ! this . superclass . isRawType ( ) ) return false ; if ( this . superInterfaces != null ) for ( int i = <NUM_LIT:0> , l = this . superInterfaces . length ; i < l ; i ++ ) if ( ! this . superInterfaces [ i ] . isRawType ( ) ) return false ; return true ; } public boolean isErasureBoundTo ( TypeBinding type ) { if ( this . superclass . erasure ( ) == type ) return true ; for ( int i = <NUM_LIT:0> , length = this . superInterfaces . length ; i < length ; i ++ ) { if ( this . superInterfaces [ i ] . erasure ( ) == type ) return true ; } return false ; } public boolean isHierarchyConnected ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccUnresolved ) == <NUM_LIT:0> ; } public boolean isInterchangeableWith ( TypeVariableBinding otherVariable , Substitution substitute ) { if ( this == otherVariable ) return true ; int length = this . superInterfaces . length ; if ( length != otherVariable . superInterfaces . length ) return false ; if ( this . superclass != Scope . substitute ( substitute , otherVariable . superclass ) ) return false ; next : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeBinding superType = Scope . substitute ( substitute , otherVariable . superInterfaces [ i ] ) ; for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) if ( superType == this . superInterfaces [ j ] ) continue next ; return false ; } return true ; } public boolean isTypeVariable ( ) { return true ; } public int kind ( ) { return Binding . TYPE_PARAMETER ; } public TypeBinding [ ] otherUpperBounds ( ) { if ( this . firstBound == null ) return Binding . NO_TYPES ; if ( this . firstBound == this . superclass ) return this . superInterfaces ; int otherLength = this . superInterfaces . length - <NUM_LIT:1> ; if ( otherLength > <NUM_LIT:0> ) { TypeBinding [ ] otherBounds ; System . arraycopy ( this . superInterfaces , <NUM_LIT:1> , otherBounds = new TypeBinding [ otherLength ] , <NUM_LIT:0> , otherLength ) ; return otherBounds ; } return Binding . NO_TYPES ; } public char [ ] readableName ( ) { return this . sourceName ; } ReferenceBinding resolve ( ) { if ( ( this . modifiers & ExtraCompilerModifiers . AccUnresolved ) == <NUM_LIT:0> ) return this ; TypeBinding oldSuperclass = this . superclass , oldFirstInterface = null ; if ( this . superclass != null ) { ReferenceBinding resolveType = ( ReferenceBinding ) BinaryTypeBinding . resolveType ( this . superclass , this . environment , true ) ; this . tagBits |= resolveType . tagBits & TagBits . ContainsNestedTypeReferences ; this . superclass = resolveType ; } ReferenceBinding [ ] interfaces = this . superInterfaces ; int length ; if ( ( length = interfaces . length ) != <NUM_LIT:0> ) { oldFirstInterface = interfaces [ <NUM_LIT:0> ] ; for ( int i = length ; -- i >= <NUM_LIT:0> ; ) { ReferenceBinding resolveType = ( ReferenceBinding ) BinaryTypeBinding . resolveType ( interfaces [ i ] , this . environment , true ) ; this . tagBits |= resolveType . tagBits & TagBits . ContainsNestedTypeReferences ; interfaces [ i ] = resolveType ; } } if ( this . firstBound != null ) { if ( this . firstBound == oldSuperclass ) { this . firstBound = this . superclass ; } else if ( this . firstBound == oldFirstInterface ) { this . firstBound = interfaces [ <NUM_LIT:0> ] ; } } this . modifiers &= ~ ExtraCompilerModifiers . AccUnresolved ; return this ; } public char [ ] shortReadableName ( ) { return readableName ( ) ; } public ReferenceBinding superclass ( ) { return this . superclass ; } public ReferenceBinding [ ] superInterfaces ( ) { return this . superInterfaces ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; buffer . append ( '<CHAR_LIT>' ) . append ( this . sourceName ) ; if ( this . superclass != null && this . firstBound == this . superclass ) { buffer . append ( "<STR_LIT>" ) . append ( this . superclass . debugName ( ) ) ; } if ( this . superInterfaces != null && this . superInterfaces != Binding . NO_SUPERINTERFACES ) { if ( this . firstBound != this . superclass ) { buffer . append ( "<STR_LIT>" ) ; } for ( int i = <NUM_LIT:0> , length = this . superInterfaces . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> || this . firstBound == this . superclass ) { buffer . append ( "<STR_LIT>" ) ; } buffer . append ( this . superInterfaces [ i ] . debugName ( ) ) ; } } buffer . append ( '<CHAR_LIT:>>' ) ; return buffer . toString ( ) ; } public TypeBinding upperBound ( ) { if ( this . firstBound != null ) { return this . firstBound ; } return this . superclass ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; public class BinaryTypeBinding extends ReferenceBinding { protected ReferenceBinding superclass ; protected ReferenceBinding enclosingType ; protected ReferenceBinding [ ] superInterfaces ; protected FieldBinding [ ] fields ; protected MethodBinding [ ] methods ; private boolean infraMethodsComplete = false ; protected MethodBinding [ ] infraMethods = Binding . NO_METHODS ; protected ReferenceBinding [ ] memberTypes ; protected TypeVariableBinding [ ] typeVariables ; protected LookupEnvironment environment ; protected SimpleLookupTable storedAnnotations = null ; static Object convertMemberValue ( Object binaryValue , LookupEnvironment env , char [ ] [ ] [ ] missingTypeNames ) { if ( binaryValue == null ) return null ; if ( binaryValue instanceof Constant ) return binaryValue ; if ( binaryValue instanceof ClassSignature ) return env . getTypeFromSignature ( ( ( ClassSignature ) binaryValue ) . getTypeName ( ) , <NUM_LIT:0> , - <NUM_LIT:1> , false , null , missingTypeNames ) ; if ( binaryValue instanceof IBinaryAnnotation ) return createAnnotation ( ( IBinaryAnnotation ) binaryValue , env , missingTypeNames ) ; if ( binaryValue instanceof EnumConstantSignature ) { EnumConstantSignature ref = ( EnumConstantSignature ) binaryValue ; ReferenceBinding enumType = ( ReferenceBinding ) env . getTypeFromSignature ( ref . getTypeName ( ) , <NUM_LIT:0> , - <NUM_LIT:1> , false , null , missingTypeNames ) ; enumType = ( ReferenceBinding ) resolveType ( enumType , env , false ) ; return enumType . getField ( ref . getEnumConstantName ( ) , false ) ; } if ( binaryValue instanceof Object [ ] ) { Object [ ] objects = ( Object [ ] ) binaryValue ; int length = objects . length ; if ( length == <NUM_LIT:0> ) return objects ; Object [ ] values = new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) values [ i ] = convertMemberValue ( objects [ i ] , env , missingTypeNames ) ; return values ; } throw new IllegalStateException ( ) ; } static AnnotationBinding createAnnotation ( IBinaryAnnotation annotationInfo , LookupEnvironment env , char [ ] [ ] [ ] missingTypeNames ) { IBinaryElementValuePair [ ] binaryPairs = annotationInfo . getElementValuePairs ( ) ; int length = binaryPairs == null ? <NUM_LIT:0> : binaryPairs . length ; ElementValuePair [ ] pairs = length == <NUM_LIT:0> ? Binding . NO_ELEMENT_VALUE_PAIRS : new ElementValuePair [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) pairs [ i ] = new ElementValuePair ( binaryPairs [ i ] . getName ( ) , convertMemberValue ( binaryPairs [ i ] . getValue ( ) , env , missingTypeNames ) , null ) ; char [ ] typeName = annotationInfo . getTypeName ( ) ; ReferenceBinding annotationType = env . getTypeFromConstantPoolName ( typeName , <NUM_LIT:1> , typeName . length - <NUM_LIT:1> , false , missingTypeNames ) ; return new UnresolvedAnnotationBinding ( annotationType , pairs , env ) ; } public static AnnotationBinding [ ] createAnnotations ( IBinaryAnnotation [ ] annotationInfos , LookupEnvironment env , char [ ] [ ] [ ] missingTypeNames ) { int length = annotationInfos == null ? <NUM_LIT:0> : annotationInfos . length ; AnnotationBinding [ ] result = length == <NUM_LIT:0> ? Binding . NO_ANNOTATIONS : new AnnotationBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) result [ i ] = createAnnotation ( annotationInfos [ i ] , env , missingTypeNames ) ; return result ; } public static TypeBinding resolveType ( TypeBinding type , LookupEnvironment environment , boolean convertGenericToRawType ) { switch ( type . kind ( ) ) { case Binding . PARAMETERIZED_TYPE : ( ( ParameterizedTypeBinding ) type ) . resolve ( ) ; break ; case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return ( ( WildcardBinding ) type ) . resolve ( ) ; case Binding . ARRAY_TYPE : resolveType ( ( ( ArrayBinding ) type ) . leafComponentType , environment , convertGenericToRawType ) ; break ; case Binding . TYPE_PARAMETER : ( ( TypeVariableBinding ) type ) . resolve ( ) ; break ; case Binding . GENERIC_TYPE : if ( convertGenericToRawType ) return environment . convertUnresolvedBinaryToRawType ( type ) ; break ; default : if ( type instanceof UnresolvedReferenceBinding ) return ( ( UnresolvedReferenceBinding ) type ) . resolve ( environment , convertGenericToRawType ) ; if ( convertGenericToRawType ) return environment . convertUnresolvedBinaryToRawType ( type ) ; break ; } return type ; } protected BinaryTypeBinding ( ) { } public BinaryTypeBinding ( PackageBinding packageBinding , IBinaryType binaryType , LookupEnvironment environment ) { this . compoundName = CharOperation . splitOn ( '<CHAR_LIT:/>' , binaryType . getName ( ) ) ; computeId ( ) ; this . tagBits |= TagBits . IsBinaryBinding ; this . environment = environment ; this . fPackage = packageBinding ; this . fileName = binaryType . getFileName ( ) ; char [ ] typeSignature = binaryType . getGenericSignature ( ) ; this . typeVariables = typeSignature != null && typeSignature . length > <NUM_LIT:0> && typeSignature [ <NUM_LIT:0> ] == '<CHAR_LIT>' ? null : Binding . NO_TYPE_VARIABLES ; this . sourceName = binaryType . getSourceName ( ) ; this . modifiers = binaryType . getModifiers ( ) ; if ( ( binaryType . getTagBits ( ) & TagBits . HierarchyHasProblems ) != <NUM_LIT:0> ) this . tagBits |= TagBits . HierarchyHasProblems ; if ( binaryType . isAnonymous ( ) ) { this . tagBits |= TagBits . AnonymousTypeMask ; } else if ( binaryType . isLocal ( ) ) { this . tagBits |= TagBits . LocalTypeMask ; } else if ( binaryType . isMember ( ) ) { this . tagBits |= TagBits . MemberTypeMask ; } char [ ] enclosingTypeName = binaryType . getEnclosingTypeName ( ) ; if ( enclosingTypeName != null ) { this . enclosingType = environment . getTypeFromConstantPoolName ( enclosingTypeName , <NUM_LIT:0> , - <NUM_LIT:1> , true , null ) ; this . tagBits |= TagBits . MemberTypeMask ; this . tagBits |= TagBits . HasUnresolvedEnclosingType ; if ( enclosingType ( ) . isStrictfp ( ) ) this . modifiers |= ClassFileConstants . AccStrictfp ; if ( enclosingType ( ) . isDeprecated ( ) ) this . modifiers |= ExtraCompilerModifiers . AccDeprecatedImplicitly ; } } public FieldBinding [ ] availableFields ( ) { if ( ( this . tagBits & TagBits . AreFieldsComplete ) != <NUM_LIT:0> ) return this . fields ; if ( ( this . tagBits & TagBits . AreFieldsSorted ) == <NUM_LIT:0> ) { int length = this . fields . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortFields ( this . fields , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreFieldsSorted ; } FieldBinding [ ] availableFields = new FieldBinding [ this . fields . length ] ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . fields . length ; i ++ ) { try { availableFields [ count ] = resolveTypeFor ( this . fields [ i ] ) ; count ++ ; } catch ( AbortCompilation a ) { } } if ( count < availableFields . length ) System . arraycopy ( availableFields , <NUM_LIT:0> , availableFields = new FieldBinding [ count ] , <NUM_LIT:0> , count ) ; return availableFields ; } private TypeVariableBinding [ ] addMethodTypeVariables ( TypeVariableBinding [ ] methodTypeVars ) { if ( this . typeVariables == null || this . typeVariables == Binding . NO_TYPE_VARIABLES ) { return methodTypeVars ; } if ( methodTypeVars == null || methodTypeVars == Binding . NO_TYPE_VARIABLES ) { return this . typeVariables ; } int total = this . typeVariables . length + methodTypeVars . length ; TypeVariableBinding [ ] combinedTypeVars = new TypeVariableBinding [ total ] ; System . arraycopy ( this . typeVariables , <NUM_LIT:0> , combinedTypeVars , <NUM_LIT:0> , this . typeVariables . length ) ; int size = this . typeVariables . length ; loop : for ( int i = <NUM_LIT:0> , len = methodTypeVars . length ; i < len ; i ++ ) { for ( int j = this . typeVariables . length - <NUM_LIT:1> ; j >= <NUM_LIT:0> ; j -- ) { if ( CharOperation . equals ( methodTypeVars [ i ] . sourceName , this . typeVariables [ j ] . sourceName ) ) continue loop ; } combinedTypeVars [ size ++ ] = methodTypeVars [ i ] ; } if ( size != total ) { System . arraycopy ( combinedTypeVars , <NUM_LIT:0> , combinedTypeVars = new TypeVariableBinding [ size ] , <NUM_LIT:0> , size ) ; } return combinedTypeVars ; } public MethodBinding [ ] availableMethods ( ) { if ( ( this . tagBits & TagBits . AreMethodsComplete ) != <NUM_LIT:0> ) return this . methods ; if ( ( this . tagBits & TagBits . AreMethodsSorted ) == <NUM_LIT:0> ) { int length = this . methods . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( this . methods , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreMethodsSorted ; } MethodBinding [ ] availableMethods = new MethodBinding [ this . methods . length ] ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . methods . length ; i ++ ) { try { availableMethods [ count ] = resolveTypesFor ( this . methods [ i ] ) ; count ++ ; } catch ( AbortCompilation a ) { } } if ( count < availableMethods . length ) System . arraycopy ( availableMethods , <NUM_LIT:0> , availableMethods = new MethodBinding [ count ] , <NUM_LIT:0> , count ) ; return availableMethods ; } void cachePartsFrom ( IBinaryType binaryType , boolean needFieldsAndMethods ) { try { this . typeVariables = Binding . NO_TYPE_VARIABLES ; this . superInterfaces = Binding . NO_SUPERINTERFACES ; this . memberTypes = Binding . NO_MEMBER_TYPES ; IBinaryNestedType [ ] memberTypeStructures = binaryType . getMemberTypes ( ) ; if ( memberTypeStructures != null ) { int size = memberTypeStructures . length ; if ( size > <NUM_LIT:0> ) { this . memberTypes = new ReferenceBinding [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) this . memberTypes [ i ] = this . environment . getTypeFromConstantPoolName ( memberTypeStructures [ i ] . getName ( ) , <NUM_LIT:0> , - <NUM_LIT:1> , false , null ) ; this . tagBits |= TagBits . HasUnresolvedMemberTypes ; } } long sourceLevel = this . environment . globalOptions . originalSourceLevel ; char [ ] typeSignature = binaryType . getGenericSignature ( ) ; this . tagBits |= binaryType . getTagBits ( ) ; char [ ] [ ] [ ] missingTypeNames = binaryType . getMissingTypeNames ( ) ; SignatureWrapper wrapper = null ; if ( typeSignature != null ) { wrapper = new SignatureWrapper ( typeSignature ) ; if ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT>' ) { wrapper . start ++ ; this . typeVariables = createTypeVariables ( wrapper , true , missingTypeNames ) ; wrapper . start ++ ; this . tagBits |= TagBits . HasUnresolvedTypeVariables ; this . modifiers |= ExtraCompilerModifiers . AccGenericSignature ; } } TypeVariableBinding [ ] typeVars = Binding . NO_TYPE_VARIABLES ; char [ ] methodDescriptor = binaryType . getEnclosingMethod ( ) ; if ( methodDescriptor != null ) { MethodBinding enclosingMethod = findMethod ( methodDescriptor , missingTypeNames ) ; if ( enclosingMethod != null ) { typeVars = enclosingMethod . typeVariables ; this . typeVariables = addMethodTypeVariables ( typeVars ) ; } } if ( typeSignature == null ) { char [ ] superclassName = binaryType . getSuperclassName ( ) ; if ( superclassName != null ) { this . superclass = this . environment . getTypeFromConstantPoolName ( superclassName , <NUM_LIT:0> , - <NUM_LIT:1> , false , missingTypeNames ) ; this . tagBits |= TagBits . HasUnresolvedSuperclass ; } this . superInterfaces = Binding . NO_SUPERINTERFACES ; char [ ] [ ] interfaceNames = binaryType . getInterfaceNames ( ) ; if ( interfaceNames != null ) { int size = interfaceNames . length ; if ( size > <NUM_LIT:0> ) { this . superInterfaces = new ReferenceBinding [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) this . superInterfaces [ i ] = this . environment . getTypeFromConstantPoolName ( interfaceNames [ i ] , <NUM_LIT:0> , - <NUM_LIT:1> , false , missingTypeNames ) ; this . tagBits |= TagBits . HasUnresolvedSuperinterfaces ; } } } else { this . superclass = ( ReferenceBinding ) this . environment . getTypeFromTypeSignature ( wrapper , typeVars , this , missingTypeNames ) ; this . tagBits |= TagBits . HasUnresolvedSuperclass ; this . superInterfaces = Binding . NO_SUPERINTERFACES ; if ( ! wrapper . atEnd ( ) ) { java . util . ArrayList types = new java . util . ArrayList ( <NUM_LIT:2> ) ; do { types . add ( this . environment . getTypeFromTypeSignature ( wrapper , typeVars , this , missingTypeNames ) ) ; } while ( ! wrapper . atEnd ( ) ) ; this . superInterfaces = new ReferenceBinding [ types . size ( ) ] ; types . toArray ( this . superInterfaces ) ; this . tagBits |= TagBits . HasUnresolvedSuperinterfaces ; } } if ( needFieldsAndMethods ) { createFields ( binaryType . getFields ( ) , sourceLevel , missingTypeNames ) ; createMethods ( binaryType . getMethods ( ) , sourceLevel , missingTypeNames ) ; boolean isViewedAsDeprecated = isViewedAsDeprecated ( ) ; if ( isViewedAsDeprecated ) { for ( int i = <NUM_LIT:0> , max = this . fields . length ; i < max ; i ++ ) { FieldBinding field = this . fields [ i ] ; if ( ! field . isDeprecated ( ) ) { field . modifiers |= ExtraCompilerModifiers . AccDeprecatedImplicitly ; } } for ( int i = <NUM_LIT:0> , max = this . methods . length ; i < max ; i ++ ) { MethodBinding method = this . methods [ i ] ; if ( ! method . isDeprecated ( ) ) { method . modifiers |= ExtraCompilerModifiers . AccDeprecatedImplicitly ; } } } } if ( this . environment . globalOptions . storeAnnotations ) setAnnotations ( createAnnotations ( binaryType . getAnnotations ( ) , this . environment , missingTypeNames ) ) ; } finally { if ( this . fields == null ) this . fields = Binding . NO_FIELDS ; if ( this . methods == null ) this . methods = Binding . NO_METHODS ; } } private void createFields ( IBinaryField [ ] iFields , long sourceLevel , char [ ] [ ] [ ] missingTypeNames ) { this . fields = Binding . NO_FIELDS ; if ( iFields != null ) { int size = iFields . length ; if ( size > <NUM_LIT:0> ) { this . fields = new FieldBinding [ size ] ; boolean use15specifics = sourceLevel >= ClassFileConstants . JDK1_5 ; boolean hasRestrictedAccess = hasRestrictedAccess ( ) ; int firstAnnotatedFieldIndex = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { IBinaryField binaryField = iFields [ i ] ; char [ ] fieldSignature = use15specifics ? binaryField . getGenericSignature ( ) : null ; TypeBinding type = fieldSignature == null ? this . environment . getTypeFromSignature ( binaryField . getTypeName ( ) , <NUM_LIT:0> , - <NUM_LIT:1> , false , this , missingTypeNames ) : this . environment . getTypeFromTypeSignature ( new SignatureWrapper ( fieldSignature ) , Binding . NO_TYPE_VARIABLES , this , missingTypeNames ) ; FieldBinding field = new FieldBinding ( binaryField . getName ( ) , type , binaryField . getModifiers ( ) | ExtraCompilerModifiers . AccUnresolved , this , binaryField . getConstant ( ) ) ; if ( firstAnnotatedFieldIndex < <NUM_LIT:0> && this . environment . globalOptions . storeAnnotations && binaryField . getAnnotations ( ) != null ) { firstAnnotatedFieldIndex = i ; } field . id = i ; if ( use15specifics ) field . tagBits |= binaryField . getTagBits ( ) ; if ( hasRestrictedAccess ) field . modifiers |= ExtraCompilerModifiers . AccRestrictedAccess ; if ( fieldSignature != null ) field . modifiers |= ExtraCompilerModifiers . AccGenericSignature ; this . fields [ i ] = field ; } if ( firstAnnotatedFieldIndex >= <NUM_LIT:0> ) { for ( int i = firstAnnotatedFieldIndex ; i < size ; i ++ ) { IBinaryField binaryField = iFields [ i ] ; this . fields [ i ] . setAnnotations ( createAnnotations ( binaryField . getAnnotations ( ) , this . environment , missingTypeNames ) ) ; } } } } } private MethodBinding createMethod ( IBinaryMethod method , long sourceLevel , char [ ] [ ] [ ] missingTypeNames ) { int methodModifiers = method . getModifiers ( ) | ExtraCompilerModifiers . AccUnresolved ; if ( sourceLevel < ClassFileConstants . JDK1_5 ) methodModifiers &= ~ ClassFileConstants . AccVarargs ; ReferenceBinding [ ] exceptions = Binding . NO_EXCEPTIONS ; TypeBinding [ ] parameters = Binding . NO_PARAMETERS ; TypeVariableBinding [ ] typeVars = Binding . NO_TYPE_VARIABLES ; AnnotationBinding [ ] [ ] paramAnnotations = null ; TypeBinding returnType = null ; final boolean use15specifics = sourceLevel >= ClassFileConstants . JDK1_5 ; char [ ] methodSignature = method . getGenericSignature ( ) ; if ( methodSignature == null ) { char [ ] methodDescriptor = method . getMethodDescriptor ( ) ; int numOfParams = <NUM_LIT:0> ; char nextChar ; int index = <NUM_LIT:0> ; while ( ( nextChar = methodDescriptor [ ++ index ] ) != '<CHAR_LIT:)>' ) { if ( nextChar != '<CHAR_LIT:[>' ) { numOfParams ++ ; if ( nextChar == '<CHAR_LIT>' ) while ( ( nextChar = methodDescriptor [ ++ index ] ) != '<CHAR_LIT:;>' ) { } } } int startIndex = <NUM_LIT:0> ; if ( method . isConstructor ( ) ) { if ( isMemberType ( ) && ! isStatic ( ) ) { startIndex ++ ; } if ( isEnum ( ) ) { startIndex += <NUM_LIT:2> ; } } int size = numOfParams - startIndex ; if ( size > <NUM_LIT:0> ) { parameters = new TypeBinding [ size ] ; if ( this . environment . globalOptions . storeAnnotations ) paramAnnotations = new AnnotationBinding [ size ] [ ] ; index = <NUM_LIT:1> ; int end = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < numOfParams ; i ++ ) { while ( ( nextChar = methodDescriptor [ ++ end ] ) == '<CHAR_LIT:[>' ) { } if ( nextChar == '<CHAR_LIT>' ) while ( ( nextChar = methodDescriptor [ ++ end ] ) != '<CHAR_LIT:;>' ) { } if ( i >= startIndex ) { parameters [ i - startIndex ] = this . environment . getTypeFromSignature ( methodDescriptor , index , end , false , this , missingTypeNames ) ; if ( paramAnnotations != null ) paramAnnotations [ i - startIndex ] = createAnnotations ( method . getParameterAnnotations ( i - startIndex ) , this . environment , missingTypeNames ) ; } index = end + <NUM_LIT:1> ; } } char [ ] [ ] exceptionTypes = method . getExceptionTypeNames ( ) ; if ( exceptionTypes != null ) { size = exceptionTypes . length ; if ( size > <NUM_LIT:0> ) { exceptions = new ReferenceBinding [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) exceptions [ i ] = this . environment . getTypeFromConstantPoolName ( exceptionTypes [ i ] , <NUM_LIT:0> , - <NUM_LIT:1> , false , missingTypeNames ) ; } } if ( ! method . isConstructor ( ) ) returnType = this . environment . getTypeFromSignature ( methodDescriptor , index + <NUM_LIT:1> , - <NUM_LIT:1> , false , this , missingTypeNames ) ; } else { methodModifiers |= ExtraCompilerModifiers . AccGenericSignature ; SignatureWrapper wrapper = new SignatureWrapper ( methodSignature , use15specifics ) ; if ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT>' ) { wrapper . start ++ ; typeVars = createTypeVariables ( wrapper , false , missingTypeNames ) ; wrapper . start ++ ; } if ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT:(>' ) { wrapper . start ++ ; if ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT:)>' ) { wrapper . start ++ ; } else { java . util . ArrayList types = new java . util . ArrayList ( <NUM_LIT:2> ) ; while ( wrapper . signature [ wrapper . start ] != '<CHAR_LIT:)>' ) types . add ( this . environment . getTypeFromTypeSignature ( wrapper , typeVars , this , missingTypeNames ) ) ; wrapper . start ++ ; int numParam = types . size ( ) ; parameters = new TypeBinding [ numParam ] ; types . toArray ( parameters ) ; if ( this . environment . globalOptions . storeAnnotations ) { paramAnnotations = new AnnotationBinding [ numParam ] [ ] ; for ( int i = <NUM_LIT:0> ; i < numParam ; i ++ ) paramAnnotations [ i ] = createAnnotations ( method . getParameterAnnotations ( i ) , this . environment , missingTypeNames ) ; } } } returnType = this . environment . getTypeFromTypeSignature ( wrapper , typeVars , this , missingTypeNames ) ; if ( ! wrapper . atEnd ( ) && wrapper . signature [ wrapper . start ] == '<CHAR_LIT>' ) { java . util . ArrayList types = new java . util . ArrayList ( <NUM_LIT:2> ) ; do { wrapper . start ++ ; types . add ( this . environment . getTypeFromTypeSignature ( wrapper , typeVars , this , missingTypeNames ) ) ; } while ( ! wrapper . atEnd ( ) && wrapper . signature [ wrapper . start ] == '<CHAR_LIT>' ) ; exceptions = new ReferenceBinding [ types . size ( ) ] ; types . toArray ( exceptions ) ; } else { char [ ] [ ] exceptionTypes = method . getExceptionTypeNames ( ) ; if ( exceptionTypes != null ) { int size = exceptionTypes . length ; if ( size > <NUM_LIT:0> ) { exceptions = new ReferenceBinding [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) exceptions [ i ] = this . environment . getTypeFromConstantPoolName ( exceptionTypes [ i ] , <NUM_LIT:0> , - <NUM_LIT:1> , false , missingTypeNames ) ; } } } } MethodBinding result = method . isConstructor ( ) ? new MethodBinding ( methodModifiers , parameters , exceptions , this ) : new MethodBinding ( methodModifiers , method . getSelector ( ) , returnType , parameters , exceptions , this ) ; if ( this . environment . globalOptions . storeAnnotations ) result . setAnnotations ( createAnnotations ( method . getAnnotations ( ) , this . environment , missingTypeNames ) , paramAnnotations , isAnnotationType ( ) ? convertMemberValue ( method . getDefaultValue ( ) , this . environment , missingTypeNames ) : null , this . environment ) ; if ( use15specifics ) result . tagBits |= method . getTagBits ( ) ; result . typeVariables = typeVars ; for ( int i = <NUM_LIT:0> , length = typeVars . length ; i < length ; i ++ ) typeVars [ i ] . declaringElement = result ; return result ; } private void createMethods ( IBinaryMethod [ ] iMethods , long sourceLevel , char [ ] [ ] [ ] missingTypeNames ) { int total = <NUM_LIT:0> , initialTotal = <NUM_LIT:0> , iClinit = - <NUM_LIT:1> ; int [ ] toSkip = null ; if ( iMethods != null ) { total = initialTotal = iMethods . length ; boolean keepBridgeMethods = sourceLevel < ClassFileConstants . JDK1_5 ; for ( int i = total ; -- i >= <NUM_LIT:0> ; ) { IBinaryMethod method = iMethods [ i ] ; if ( ( method . getModifiers ( ) & ClassFileConstants . AccSynthetic ) != <NUM_LIT:0> ) { if ( keepBridgeMethods && ( method . getModifiers ( ) & ClassFileConstants . AccBridge ) != <NUM_LIT:0> ) continue ; if ( toSkip == null ) toSkip = new int [ iMethods . length ] ; toSkip [ i ] = - <NUM_LIT:1> ; total -- ; } else if ( iClinit == - <NUM_LIT:1> ) { char [ ] methodName = method . getSelector ( ) ; if ( methodName . length == <NUM_LIT:8> && methodName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { iClinit = i ; total -- ; } } } } if ( total == <NUM_LIT:0> ) { this . methods = Binding . NO_METHODS ; return ; } boolean hasRestrictedAccess = hasRestrictedAccess ( ) ; this . methods = new MethodBinding [ total ] ; if ( total == initialTotal ) { for ( int i = <NUM_LIT:0> ; i < initialTotal ; i ++ ) { MethodBinding method = createMethod ( iMethods [ i ] , sourceLevel , missingTypeNames ) ; if ( hasRestrictedAccess ) method . modifiers |= ExtraCompilerModifiers . AccRestrictedAccess ; this . methods [ i ] = method ; } } else { for ( int i = <NUM_LIT:0> , index = <NUM_LIT:0> ; i < initialTotal ; i ++ ) { if ( iClinit != i && ( toSkip == null || toSkip [ i ] != - <NUM_LIT:1> ) ) { MethodBinding method = createMethod ( iMethods [ i ] , sourceLevel , missingTypeNames ) ; if ( hasRestrictedAccess ) method . modifiers |= ExtraCompilerModifiers . AccRestrictedAccess ; this . methods [ index ++ ] = method ; } } if ( this . environment . globalOptions . buildGroovyFiles == <NUM_LIT:2> ) { int skipped = initialTotal - this . methods . length - ( iClinit == - <NUM_LIT:1> ? <NUM_LIT:0> : <NUM_LIT:1> ) ; if ( skipped == <NUM_LIT:0> ) { this . infraMethods = Binding . NO_METHODS ; } else { this . infraMethods = new MethodBinding [ skipped ] ; for ( int i = <NUM_LIT:0> , index = <NUM_LIT:0> ; i < initialTotal ; i ++ ) { if ( iClinit != i && ( toSkip != null && toSkip [ i ] == - <NUM_LIT:1> ) ) { MethodBinding method = createMethod ( iMethods [ i ] , sourceLevel , missingTypeNames ) ; this . infraMethods [ index ++ ] = method ; } } } } } } private TypeVariableBinding [ ] createTypeVariables ( SignatureWrapper wrapper , boolean assignVariables , char [ ] [ ] [ ] missingTypeNames ) { char [ ] typeSignature = wrapper . signature ; int depth = <NUM_LIT:0> , length = typeSignature . length ; int rank = <NUM_LIT:0> ; ArrayList variables = new ArrayList ( <NUM_LIT:1> ) ; depth = <NUM_LIT:0> ; boolean pendingVariable = true ; createVariables : { for ( int i = <NUM_LIT:1> ; i < length ; i ++ ) { switch ( typeSignature [ i ] ) { case '<CHAR_LIT>' : depth ++ ; break ; case '<CHAR_LIT:>>' : if ( -- depth < <NUM_LIT:0> ) break createVariables ; break ; case '<CHAR_LIT:;>' : if ( ( depth == <NUM_LIT:0> ) && ( i + <NUM_LIT:1> < length ) && ( typeSignature [ i + <NUM_LIT:1> ] != '<CHAR_LIT::>' ) ) pendingVariable = true ; break ; default : if ( pendingVariable ) { pendingVariable = false ; int colon = CharOperation . indexOf ( '<CHAR_LIT::>' , typeSignature , i ) ; char [ ] variableName = CharOperation . subarray ( typeSignature , i , colon ) ; variables . add ( new TypeVariableBinding ( variableName , this , rank ++ , this . environment ) ) ; } } } } TypeVariableBinding [ ] result ; variables . toArray ( result = new TypeVariableBinding [ rank ] ) ; if ( assignVariables ) this . typeVariables = result ; for ( int i = <NUM_LIT:0> ; i < rank ; i ++ ) { initializeTypeVariable ( result [ i ] , result , wrapper , missingTypeNames ) ; } return result ; } public ReferenceBinding enclosingType ( ) { if ( ( this . tagBits & TagBits . HasUnresolvedEnclosingType ) == <NUM_LIT:0> ) return this . enclosingType ; this . enclosingType = ( ReferenceBinding ) resolveType ( this . enclosingType , this . environment , false ) ; this . tagBits &= ~ TagBits . HasUnresolvedEnclosingType ; return this . enclosingType ; } public FieldBinding [ ] fields ( ) { if ( ( this . tagBits & TagBits . AreFieldsComplete ) != <NUM_LIT:0> ) return this . fields ; if ( ( this . tagBits & TagBits . AreFieldsSorted ) == <NUM_LIT:0> ) { int length = this . fields . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortFields ( this . fields , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreFieldsSorted ; } for ( int i = this . fields . length ; -- i >= <NUM_LIT:0> ; ) resolveTypeFor ( this . fields [ i ] ) ; this . tagBits |= TagBits . AreFieldsComplete ; return this . fields ; } private MethodBinding findMethod ( char [ ] methodDescriptor , char [ ] [ ] [ ] missingTypeNames ) { int index = - <NUM_LIT:1> ; while ( methodDescriptor [ ++ index ] != '<CHAR_LIT:(>' ) { } char [ ] selector = new char [ index ] ; System . arraycopy ( methodDescriptor , <NUM_LIT:0> , selector , <NUM_LIT:0> , index ) ; TypeBinding [ ] parameters = Binding . NO_PARAMETERS ; int numOfParams = <NUM_LIT:0> ; char nextChar ; int paramStart = index ; while ( ( nextChar = methodDescriptor [ ++ index ] ) != '<CHAR_LIT:)>' ) { if ( nextChar != '<CHAR_LIT:[>' ) { numOfParams ++ ; if ( nextChar == '<CHAR_LIT>' ) while ( ( nextChar = methodDescriptor [ ++ index ] ) != '<CHAR_LIT:;>' ) { } } } if ( numOfParams > <NUM_LIT:0> ) { parameters = new TypeBinding [ numOfParams ] ; index = paramStart + <NUM_LIT:1> ; int end = paramStart ; for ( int i = <NUM_LIT:0> ; i < numOfParams ; i ++ ) { while ( ( nextChar = methodDescriptor [ ++ end ] ) == '<CHAR_LIT:[>' ) { } if ( nextChar == '<CHAR_LIT>' ) while ( ( nextChar = methodDescriptor [ ++ end ] ) != '<CHAR_LIT:;>' ) { } TypeBinding param = this . environment . getTypeFromSignature ( methodDescriptor , index , end , false , this , missingTypeNames ) ; if ( param instanceof UnresolvedReferenceBinding ) { param = resolveType ( param , this . environment , true ) ; } parameters [ i ] = param ; index = end + <NUM_LIT:1> ; } } int parameterLength = parameters . length ; MethodBinding [ ] methods2 = this . enclosingType . getMethods ( selector , parameterLength ) ; loop : for ( int i = <NUM_LIT:0> , max = methods2 . length ; i < max ; i ++ ) { MethodBinding currentMethod = methods2 [ i ] ; TypeBinding [ ] parameters2 = currentMethod . parameters ; int currentMethodParameterLength = parameters2 . length ; if ( parameterLength == currentMethodParameterLength ) { for ( int j = <NUM_LIT:0> ; j < currentMethodParameterLength ; j ++ ) { if ( parameters [ j ] != parameters2 [ j ] && parameters [ j ] . erasure ( ) != parameters2 [ j ] . erasure ( ) ) { continue loop ; } } return currentMethod ; } } return null ; } public char [ ] genericTypeSignature ( ) { return computeGenericTypeSignature ( this . typeVariables ) ; } public MethodBinding getExactConstructor ( TypeBinding [ ] argumentTypes ) { if ( ( this . tagBits & TagBits . AreMethodsSorted ) == <NUM_LIT:0> ) { int length = this . methods . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( this . methods , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreMethodsSorted ; } int argCount = argumentTypes . length ; long range ; if ( ( range = ReferenceBinding . binarySearch ( TypeConstants . INIT , this . methods ) ) >= <NUM_LIT:0> ) { nextMethod : for ( int imethod = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; imethod <= end ; imethod ++ ) { MethodBinding method = this . methods [ imethod ] ; if ( method . parameters . length == argCount ) { resolveTypesFor ( method ) ; TypeBinding [ ] toMatch = method . parameters ; for ( int iarg = <NUM_LIT:0> ; iarg < argCount ; iarg ++ ) if ( toMatch [ iarg ] != argumentTypes [ iarg ] ) continue nextMethod ; return method ; } } } return null ; } public MethodBinding getExactMethod ( char [ ] selector , TypeBinding [ ] argumentTypes , CompilationUnitScope refScope ) { if ( ( this . tagBits & TagBits . AreMethodsSorted ) == <NUM_LIT:0> ) { int length = this . methods . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( this . methods , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreMethodsSorted ; } int argCount = argumentTypes . length ; boolean foundNothing = true ; long range ; if ( ( range = ReferenceBinding . binarySearch ( selector , this . methods ) ) >= <NUM_LIT:0> ) { nextMethod : for ( int imethod = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; imethod <= end ; imethod ++ ) { MethodBinding method = this . methods [ imethod ] ; foundNothing = false ; if ( method . parameters . length == argCount ) { resolveTypesFor ( method ) ; TypeBinding [ ] toMatch = method . parameters ; for ( int iarg = <NUM_LIT:0> ; iarg < argCount ; iarg ++ ) if ( toMatch [ iarg ] != argumentTypes [ iarg ] ) continue nextMethod ; return method ; } } } if ( foundNothing ) { if ( isInterface ( ) ) { if ( superInterfaces ( ) . length == <NUM_LIT:1> ) { if ( refScope != null ) refScope . recordTypeReference ( this . superInterfaces [ <NUM_LIT:0> ] ) ; return this . superInterfaces [ <NUM_LIT:0> ] . getExactMethod ( selector , argumentTypes , refScope ) ; } } else if ( superclass ( ) != null ) { if ( refScope != null ) refScope . recordTypeReference ( this . superclass ) ; return this . superclass . getExactMethod ( selector , argumentTypes , refScope ) ; } } return null ; } public FieldBinding getField ( char [ ] fieldName , boolean needResolve ) { if ( ( this . tagBits & TagBits . AreFieldsSorted ) == <NUM_LIT:0> ) { int length = this . fields . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortFields ( this . fields , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreFieldsSorted ; } FieldBinding field = ReferenceBinding . binarySearch ( fieldName , this . fields ) ; return needResolve && field != null ? resolveTypeFor ( field ) : field ; } public ReferenceBinding getMemberType ( char [ ] typeName ) { for ( int i = this . memberTypes . length ; -- i >= <NUM_LIT:0> ; ) { ReferenceBinding memberType = this . memberTypes [ i ] ; if ( memberType instanceof UnresolvedReferenceBinding ) { char [ ] name = memberType . sourceName ; int prefixLength = this . compoundName [ this . compoundName . length - <NUM_LIT:1> ] . length + <NUM_LIT:1> ; if ( name . length == ( prefixLength + typeName . length ) ) if ( CharOperation . fragmentEquals ( typeName , name , prefixLength , true ) ) return this . memberTypes [ i ] = ( ReferenceBinding ) resolveType ( memberType , this . environment , false ) ; } else if ( CharOperation . equals ( typeName , memberType . sourceName ) ) { return memberType ; } } return null ; } public MethodBinding [ ] getMethods ( char [ ] selector ) { if ( ( this . tagBits & TagBits . AreMethodsComplete ) != <NUM_LIT:0> ) { long range ; if ( ( range = ReferenceBinding . binarySearch ( selector , this . methods ) ) >= <NUM_LIT:0> ) { int start = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; int length = end - start + <NUM_LIT:1> ; if ( ( this . tagBits & TagBits . AreMethodsComplete ) != <NUM_LIT:0> ) { MethodBinding [ ] result ; System . arraycopy ( this . methods , start , result = new MethodBinding [ length ] , <NUM_LIT:0> , length ) ; return result ; } } return Binding . NO_METHODS ; } if ( ( this . tagBits & TagBits . AreMethodsSorted ) == <NUM_LIT:0> ) { int length = this . methods . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( this . methods , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreMethodsSorted ; } long range ; if ( ( range = ReferenceBinding . binarySearch ( selector , this . methods ) ) >= <NUM_LIT:0> ) { int start = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; int length = end - start + <NUM_LIT:1> ; MethodBinding [ ] result = new MethodBinding [ length ] ; for ( int i = start , index = <NUM_LIT:0> ; i <= end ; i ++ , index ++ ) result [ index ] = resolveTypesFor ( this . methods [ i ] ) ; return result ; } return Binding . NO_METHODS ; } public MethodBinding [ ] getMethods ( char [ ] selector , int suggestedParameterLength ) { if ( ( this . tagBits & TagBits . AreMethodsComplete ) != <NUM_LIT:0> ) return getMethods ( selector ) ; if ( ( this . tagBits & TagBits . AreMethodsSorted ) == <NUM_LIT:0> ) { int length = this . methods . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( this . methods , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreMethodsSorted ; } long range ; if ( ( range = ReferenceBinding . binarySearch ( selector , this . methods ) ) >= <NUM_LIT:0> ) { int start = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; int length = end - start + <NUM_LIT:1> ; int count = <NUM_LIT:0> ; for ( int i = start ; i <= end ; i ++ ) { int len = this . methods [ i ] . parameters . length ; if ( len <= suggestedParameterLength || ( this . methods [ i ] . isVarargs ( ) && len == suggestedParameterLength + <NUM_LIT:1> ) ) count ++ ; } if ( count == <NUM_LIT:0> ) { MethodBinding [ ] result = new MethodBinding [ length ] ; for ( int i = start , index = <NUM_LIT:0> ; i <= end ; i ++ ) result [ index ++ ] = resolveTypesFor ( this . methods [ i ] ) ; return result ; } else { MethodBinding [ ] result = new MethodBinding [ count ] ; for ( int i = start , index = <NUM_LIT:0> ; i <= end ; i ++ ) { int len = this . methods [ i ] . parameters . length ; if ( len <= suggestedParameterLength || ( this . methods [ i ] . isVarargs ( ) && len == suggestedParameterLength + <NUM_LIT:1> ) ) result [ index ++ ] = resolveTypesFor ( this . methods [ i ] ) ; } return result ; } } return Binding . NO_METHODS ; } public boolean hasMemberTypes ( ) { return this . memberTypes . length > <NUM_LIT:0> ; } public TypeVariableBinding getTypeVariable ( char [ ] variableName ) { TypeVariableBinding variable = super . getTypeVariable ( variableName ) ; variable . resolve ( ) ; return variable ; } private void initializeTypeVariable ( TypeVariableBinding variable , TypeVariableBinding [ ] existingVariables , SignatureWrapper wrapper , char [ ] [ ] [ ] missingTypeNames ) { int colon = CharOperation . indexOf ( '<CHAR_LIT::>' , wrapper . signature , wrapper . start ) ; wrapper . start = colon + <NUM_LIT:1> ; ReferenceBinding type , firstBound = null ; if ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT::>' ) { type = this . environment . getResolvedType ( TypeConstants . JAVA_LANG_OBJECT , null ) ; } else { TypeBinding typeFromTypeSignature = this . environment . getTypeFromTypeSignature ( wrapper , existingVariables , this , missingTypeNames ) ; if ( typeFromTypeSignature instanceof ReferenceBinding ) { type = ( ReferenceBinding ) typeFromTypeSignature ; } else { type = this . environment . getResolvedType ( TypeConstants . JAVA_LANG_OBJECT , null ) ; } firstBound = type ; } variable . modifiers |= ExtraCompilerModifiers . AccUnresolved ; variable . superclass = type ; ReferenceBinding [ ] bounds = null ; if ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT::>' ) { java . util . ArrayList types = new java . util . ArrayList ( <NUM_LIT:2> ) ; do { wrapper . start ++ ; types . add ( this . environment . getTypeFromTypeSignature ( wrapper , existingVariables , this , missingTypeNames ) ) ; } while ( wrapper . signature [ wrapper . start ] == '<CHAR_LIT::>' ) ; bounds = new ReferenceBinding [ types . size ( ) ] ; types . toArray ( bounds ) ; } variable . superInterfaces = bounds == null ? Binding . NO_SUPERINTERFACES : bounds ; if ( firstBound == null ) { firstBound = variable . superInterfaces . length == <NUM_LIT:0> ? null : variable . superInterfaces [ <NUM_LIT:0> ] ; } variable . firstBound = firstBound ; } public boolean isEquivalentTo ( TypeBinding otherType ) { if ( this == otherType ) return true ; if ( otherType == null ) return false ; switch ( otherType . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return ( ( WildcardBinding ) otherType ) . boundCheck ( this ) ; case Binding . PARAMETERIZED_TYPE : case Binding . RAW_TYPE : return otherType . erasure ( ) == this ; } return false ; } public boolean isGenericType ( ) { return this . typeVariables != Binding . NO_TYPE_VARIABLES ; } public boolean isHierarchyConnected ( ) { return ( this . tagBits & ( TagBits . HasUnresolvedSuperclass | TagBits . HasUnresolvedSuperinterfaces ) ) == <NUM_LIT:0> ; } public int kind ( ) { if ( this . typeVariables != Binding . NO_TYPE_VARIABLES ) return Binding . GENERIC_TYPE ; return Binding . TYPE ; } public ReferenceBinding [ ] memberTypes ( ) { if ( ( this . tagBits & TagBits . HasUnresolvedMemberTypes ) == <NUM_LIT:0> ) return this . memberTypes ; for ( int i = this . memberTypes . length ; -- i >= <NUM_LIT:0> ; ) this . memberTypes [ i ] = ( ReferenceBinding ) resolveType ( this . memberTypes [ i ] , this . environment , false ) ; this . tagBits &= ~ TagBits . HasUnresolvedMemberTypes ; return this . memberTypes ; } public MethodBinding [ ] infraMethods ( ) { if ( ! this . infraMethodsComplete ) { for ( int i = this . infraMethods . length ; -- i >= <NUM_LIT:0> ; ) { resolveTypesFor ( this . infraMethods [ i ] ) ; } this . infraMethodsComplete = true ; } return this . infraMethods ; } public MethodBinding [ ] methods ( ) { if ( ( this . tagBits & TagBits . AreMethodsComplete ) != <NUM_LIT:0> ) return this . methods ; if ( ( this . tagBits & TagBits . AreMethodsSorted ) == <NUM_LIT:0> ) { int length = this . methods . length ; if ( length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( this . methods , <NUM_LIT:0> , length ) ; this . tagBits |= TagBits . AreMethodsSorted ; } for ( int i = this . methods . length ; -- i >= <NUM_LIT:0> ; ) resolveTypesFor ( this . methods [ i ] ) ; this . tagBits |= TagBits . AreMethodsComplete ; return this . methods ; } private FieldBinding resolveTypeFor ( FieldBinding field ) { if ( ( field . modifiers & ExtraCompilerModifiers . AccUnresolved ) == <NUM_LIT:0> ) return field ; TypeBinding resolvedType = resolveType ( field . type , this . environment , true ) ; field . type = resolvedType ; if ( ( resolvedType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { field . tagBits |= TagBits . HasMissingType ; } field . modifiers &= ~ ExtraCompilerModifiers . AccUnresolved ; return field ; } MethodBinding resolveTypesFor ( MethodBinding method ) { if ( ( method . modifiers & ExtraCompilerModifiers . AccUnresolved ) == <NUM_LIT:0> ) return method ; if ( ! method . isConstructor ( ) ) { TypeBinding resolvedType = resolveType ( method . returnType , this . environment , true ) ; method . returnType = resolvedType ; if ( ( resolvedType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { method . tagBits |= TagBits . HasMissingType ; } } for ( int i = method . parameters . length ; -- i >= <NUM_LIT:0> ; ) { TypeBinding resolvedType = resolveType ( method . parameters [ i ] , this . environment , true ) ; method . parameters [ i ] = resolvedType ; if ( ( resolvedType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { method . tagBits |= TagBits . HasMissingType ; } } for ( int i = method . thrownExceptions . length ; -- i >= <NUM_LIT:0> ; ) { ReferenceBinding resolvedType = ( ReferenceBinding ) resolveType ( method . thrownExceptions [ i ] , this . environment , true ) ; method . thrownExceptions [ i ] = resolvedType ; if ( ( resolvedType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { method . tagBits |= TagBits . HasMissingType ; } } for ( int i = method . typeVariables . length ; -- i >= <NUM_LIT:0> ; ) { method . typeVariables [ i ] . resolve ( ) ; } method . modifiers &= ~ ExtraCompilerModifiers . AccUnresolved ; return method ; } AnnotationBinding [ ] retrieveAnnotations ( Binding binding ) { return AnnotationBinding . addStandardAnnotations ( super . retrieveAnnotations ( binding ) , binding . getAnnotationTagBits ( ) , this . environment ) ; } SimpleLookupTable storedAnnotations ( boolean forceInitialize ) { if ( forceInitialize && this . storedAnnotations == null ) { if ( ! this . environment . globalOptions . storeAnnotations ) return null ; this . storedAnnotations = new SimpleLookupTable ( <NUM_LIT:3> ) ; } return this . storedAnnotations ; } public ReferenceBinding superclass ( ) { if ( ( this . tagBits & TagBits . HasUnresolvedSuperclass ) == <NUM_LIT:0> ) return this . superclass ; this . superclass = ( ReferenceBinding ) resolveType ( this . superclass , this . environment , true ) ; this . tagBits &= ~ TagBits . HasUnresolvedSuperclass ; if ( this . superclass . problemId ( ) == ProblemReasons . NotFound ) this . tagBits |= TagBits . HierarchyHasProblems ; return this . superclass ; } public ReferenceBinding [ ] superInterfaces ( ) { if ( ( this . tagBits & TagBits . HasUnresolvedSuperinterfaces ) == <NUM_LIT:0> ) return this . superInterfaces ; for ( int i = this . superInterfaces . length ; -- i >= <NUM_LIT:0> ; ) { this . superInterfaces [ i ] = ( ReferenceBinding ) resolveType ( this . superInterfaces [ i ] , this . environment , true ) ; if ( this . superInterfaces [ i ] . problemId ( ) == ProblemReasons . NotFound ) this . tagBits |= TagBits . HierarchyHasProblems ; } this . tagBits &= ~ TagBits . HasUnresolvedSuperinterfaces ; return this . superInterfaces ; } public TypeVariableBinding [ ] typeVariables ( ) { if ( ( this . tagBits & TagBits . HasUnresolvedTypeVariables ) == <NUM_LIT:0> ) return this . typeVariables ; for ( int i = this . typeVariables . length ; -- i >= <NUM_LIT:0> ; ) this . typeVariables [ i ] . resolve ( ) ; this . tagBits &= ~ TagBits . HasUnresolvedTypeVariables ; return this . typeVariables ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; if ( isDeprecated ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isPublic ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isProtected ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isPrivate ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isAbstract ( ) && isClass ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isStatic ( ) && isNestedType ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isFinal ( ) ) buffer . append ( "<STR_LIT>" ) ; if ( isEnum ( ) ) buffer . append ( "<STR_LIT>" ) ; else if ( isAnnotationType ( ) ) buffer . append ( "<STR_LIT>" ) ; else if ( isClass ( ) ) buffer . append ( "<STR_LIT>" ) ; else buffer . append ( "<STR_LIT>" ) ; buffer . append ( ( this . compoundName != null ) ? CharOperation . toString ( this . compoundName ) : "<STR_LIT>" ) ; if ( this . typeVariables == null ) { buffer . append ( "<STR_LIT>" ) ; } else if ( this . typeVariables != Binding . NO_TYPE_VARIABLES ) { buffer . append ( "<STR_LIT:<>" ) ; for ( int i = <NUM_LIT:0> , length = this . typeVariables . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; if ( this . typeVariables [ i ] == null ) { buffer . append ( "<STR_LIT>" ) ; continue ; } char [ ] varChars = this . typeVariables [ i ] . toString ( ) . toCharArray ( ) ; buffer . append ( varChars , <NUM_LIT:1> , varChars . length - <NUM_LIT:2> ) ; } buffer . append ( "<STR_LIT:>>" ) ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( ( this . superclass != null ) ? this . superclass . debugName ( ) : "<STR_LIT>" ) ; if ( this . superInterfaces != null ) { if ( this . superInterfaces != Binding . NO_SUPERINTERFACES ) { buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = this . superInterfaces . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; buffer . append ( ( this . superInterfaces [ i ] != null ) ? this . superInterfaces [ i ] . debugName ( ) : "<STR_LIT>" ) ; } } } else { buffer . append ( "<STR_LIT>" ) ; } if ( this . enclosingType != null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . enclosingType . debugName ( ) ) ; } if ( this . fields != null ) { if ( this . fields != Binding . NO_FIELDS ) { buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = this . fields . length ; i < length ; i ++ ) buffer . append ( ( this . fields [ i ] != null ) ? "<STR_LIT:n>" + this . fields [ i ] . toString ( ) : "<STR_LIT>" ) ; } } else { buffer . append ( "<STR_LIT>" ) ; } if ( this . methods != null ) { if ( this . methods != Binding . NO_METHODS ) { buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = this . methods . length ; i < length ; i ++ ) buffer . append ( ( this . methods [ i ] != null ) ? "<STR_LIT:n>" + this . methods [ i ] . toString ( ) : "<STR_LIT>" ) ; } } else { buffer . append ( "<STR_LIT>" ) ; } if ( this . memberTypes != null ) { if ( this . memberTypes != Binding . NO_MEMBER_TYPES ) { buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = this . memberTypes . length ; i < length ; i ++ ) buffer . append ( ( this . memberTypes [ i ] != null ) ? "<STR_LIT:n>" + this . memberTypes [ i ] . toString ( ) : "<STR_LIT>" ) ; } } else { buffer . append ( "<STR_LIT>" ) ; } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } MethodBinding [ ] unResolvedMethods ( ) { return this . methods ; } public FieldBinding [ ] unResolvedFields ( ) { return this . fields ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Annotation ; import org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . impl . ReferenceContext ; public class LocalVariableBinding extends VariableBinding { public int resolvedPosition ; public static final int UNUSED = <NUM_LIT:0> ; public static final int USED = <NUM_LIT:1> ; public static final int FAKE_USED = <NUM_LIT:2> ; public int useFlag ; public BlockScope declaringScope ; public LocalDeclaration declaration ; public int [ ] initializationPCs ; public int initializationCount = <NUM_LIT:0> ; public LocalVariableBinding ( char [ ] name , TypeBinding type , int modifiers , boolean isArgument ) { super ( name , type , modifiers , isArgument ? Constant . NotAConstant : null ) ; if ( isArgument ) this . tagBits |= TagBits . IsArgument ; this . tagBits |= TagBits . IsEffectivelyFinal ; } public LocalVariableBinding ( LocalDeclaration declaration , TypeBinding type , int modifiers , boolean isArgument ) { this ( declaration . name , type , modifiers , isArgument ) ; this . declaration = declaration ; this . tagBits |= TagBits . IsEffectivelyFinal ; } public final int kind ( ) { return LOCAL ; } public char [ ] computeUniqueKey ( boolean isLeaf ) { StringBuffer buffer = new StringBuffer ( ) ; BlockScope scope = this . declaringScope ; int occurenceCount = <NUM_LIT:0> ; if ( scope != null ) { MethodScope methodScope = scope instanceof MethodScope ? ( MethodScope ) scope : scope . enclosingMethodScope ( ) ; ReferenceContext referenceContext = methodScope . referenceContext ; if ( referenceContext instanceof AbstractMethodDeclaration ) { MethodBinding methodBinding = ( ( AbstractMethodDeclaration ) referenceContext ) . binding ; if ( methodBinding != null ) { buffer . append ( methodBinding . computeUniqueKey ( false ) ) ; } } else if ( referenceContext instanceof TypeDeclaration ) { TypeBinding typeBinding = ( ( TypeDeclaration ) referenceContext ) . binding ; if ( typeBinding != null ) { buffer . append ( typeBinding . computeUniqueKey ( false ) ) ; } } getScopeKey ( scope , buffer ) ; LocalVariableBinding [ ] locals = scope . locals ; for ( int i = <NUM_LIT:0> ; i < scope . localIndex ; i ++ ) { LocalVariableBinding local = locals [ i ] ; if ( CharOperation . equals ( this . name , local . name ) ) { if ( this == local ) break ; occurenceCount ++ ; } } } buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( this . name ) ; if ( occurenceCount > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( occurenceCount ) ; } int length = buffer . length ( ) ; char [ ] uniqueKey = new char [ length ] ; buffer . getChars ( <NUM_LIT:0> , length , uniqueKey , <NUM_LIT:0> ) ; return uniqueKey ; } public AnnotationBinding [ ] getAnnotations ( ) { if ( this . declaringScope == null ) { if ( ( this . tagBits & TagBits . AnnotationResolved ) != <NUM_LIT:0> ) { if ( this . declaration == null ) { return Binding . NO_ANNOTATIONS ; } Annotation [ ] annotations = this . declaration . annotations ; if ( annotations != null ) { int length = annotations . length ; AnnotationBinding [ ] annotationBindings = new AnnotationBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { AnnotationBinding compilerAnnotation = annotations [ i ] . getCompilerAnnotation ( ) ; if ( compilerAnnotation == null ) { return Binding . NO_ANNOTATIONS ; } annotationBindings [ i ] = compilerAnnotation ; } return annotationBindings ; } } return Binding . NO_ANNOTATIONS ; } SourceTypeBinding sourceType = this . declaringScope . enclosingSourceType ( ) ; if ( sourceType == null ) return Binding . NO_ANNOTATIONS ; AnnotationBinding [ ] annotations = sourceType . retrieveAnnotations ( this ) ; if ( ( this . tagBits & TagBits . AnnotationResolved ) == <NUM_LIT:0> ) { if ( ( ( this . tagBits & TagBits . IsArgument ) != <NUM_LIT:0> ) && this . declaration != null ) { Annotation [ ] annotationNodes = this . declaration . annotations ; if ( annotationNodes != null ) { int length = annotationNodes . length ; ASTNode . resolveAnnotations ( this . declaringScope , annotationNodes , this ) ; annotations = new AnnotationBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) annotations [ i ] = new AnnotationBinding ( annotationNodes [ i ] ) ; setAnnotations ( annotations ) ; } } } return annotations ; } private void getScopeKey ( BlockScope scope , StringBuffer buffer ) { int scopeIndex = scope . scopeIndex ( ) ; if ( scopeIndex != - <NUM_LIT:1> ) { getScopeKey ( ( BlockScope ) scope . parent , buffer ) ; buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( scopeIndex ) ; } } public boolean isSecret ( ) { return this . declaration == null && ( this . tagBits & TagBits . IsArgument ) == <NUM_LIT:0> ; } public void recordInitializationEndPC ( int pc ) { if ( this . initializationPCs [ ( ( this . initializationCount - <NUM_LIT:1> ) << <NUM_LIT:1> ) + <NUM_LIT:1> ] == - <NUM_LIT:1> ) this . initializationPCs [ ( ( this . initializationCount - <NUM_LIT:1> ) << <NUM_LIT:1> ) + <NUM_LIT:1> ] = pc ; } public void recordInitializationStartPC ( int pc ) { if ( this . initializationPCs == null ) { return ; } if ( this . initializationCount > <NUM_LIT:0> ) { int previousEndPC = this . initializationPCs [ ( ( this . initializationCount - <NUM_LIT:1> ) << <NUM_LIT:1> ) + <NUM_LIT:1> ] ; if ( previousEndPC == - <NUM_LIT:1> ) { return ; } if ( previousEndPC == pc ) { this . initializationPCs [ ( ( this . initializationCount - <NUM_LIT:1> ) << <NUM_LIT:1> ) + <NUM_LIT:1> ] = - <NUM_LIT:1> ; return ; } } int index = this . initializationCount << <NUM_LIT:1> ; if ( index == this . initializationPCs . length ) { System . arraycopy ( this . initializationPCs , <NUM_LIT:0> , ( this . initializationPCs = new int [ this . initializationCount << <NUM_LIT:2> ] ) , <NUM_LIT:0> , index ) ; } this . initializationPCs [ index ] = pc ; this . initializationPCs [ index + <NUM_LIT:1> ] = - <NUM_LIT:1> ; this . initializationCount ++ ; } public void setAnnotations ( AnnotationBinding [ ] annotations ) { if ( this . declaringScope == null ) return ; SourceTypeBinding sourceType = this . declaringScope . enclosingSourceType ( ) ; if ( sourceType != null ) sourceType . storeAnnotations ( this , annotations ) ; } public void resetInitializations ( ) { this . initializationCount = <NUM_LIT:0> ; this . initializationPCs = null ; } public String toString ( ) { String s = super . toString ( ) ; switch ( this . useFlag ) { case USED : s += "<STR_LIT>" + String . valueOf ( this . resolvedPosition ) + "<STR_LIT:]>" ; break ; case UNUSED : s += "<STR_LIT>" ; break ; case FAKE_USED : s += "<STR_LIT>" ; break ; } s += "<STR_LIT>" + String . valueOf ( this . id ) + "<STR_LIT:]>" ; if ( this . initializationCount > <NUM_LIT:0> ) { s += "<STR_LIT>" ; for ( int i = <NUM_LIT:0> ; i < this . initializationCount ; i ++ ) { if ( i > <NUM_LIT:0> ) s += "<STR_LIT:U+002CU+0020>" ; s += String . valueOf ( this . initializationPCs [ i << <NUM_LIT:1> ] ) + "<STR_LIT:->" + ( ( this . initializationPCs [ ( i << <NUM_LIT:1> ) + <NUM_LIT:1> ] == - <NUM_LIT:1> ) ? "<STR_LIT:?>" : String . valueOf ( this . initializationPCs [ ( i << <NUM_LIT:1> ) + <NUM_LIT:1> ] ) ) ; } s += "<STR_LIT:]>" ; } return s ; } public boolean isParameter ( ) { return ( ( this . tagBits & TagBits . IsArgument ) != <NUM_LIT:0> ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . util . HashtableOfPackage ; import org . eclipse . jdt . internal . compiler . util . HashtableOfType ; public class PackageBinding extends Binding implements TypeConstants { public long tagBits = <NUM_LIT:0> ; public char [ ] [ ] compoundName ; PackageBinding parent ; public LookupEnvironment environment ; HashtableOfType knownTypes ; HashtableOfPackage knownPackages ; protected PackageBinding ( ) { } public PackageBinding ( char [ ] topLevelPackageName , LookupEnvironment environment ) { this ( new char [ ] [ ] { topLevelPackageName } , null , environment ) ; } public PackageBinding ( char [ ] [ ] compoundName , PackageBinding parent , LookupEnvironment environment ) { this . compoundName = compoundName ; this . parent = parent ; this . environment = environment ; this . knownTypes = null ; this . knownPackages = new HashtableOfPackage ( <NUM_LIT:3> ) ; } public PackageBinding ( LookupEnvironment environment ) { this ( CharOperation . NO_CHAR_CHAR , null , environment ) ; } private void addNotFoundPackage ( char [ ] simpleName ) { this . knownPackages . put ( simpleName , LookupEnvironment . TheNotFoundPackage ) ; } private void addNotFoundType ( char [ ] simpleName ) { if ( this . knownTypes == null ) this . knownTypes = new HashtableOfType ( <NUM_LIT> ) ; this . knownTypes . put ( simpleName , LookupEnvironment . TheNotFoundType ) ; } void addPackage ( PackageBinding element ) { if ( ( element . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) clearMissingTagBit ( ) ; this . knownPackages . put ( element . compoundName [ element . compoundName . length - <NUM_LIT:1> ] , element ) ; } void addType ( ReferenceBinding element ) { if ( ( element . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) clearMissingTagBit ( ) ; if ( this . knownTypes == null ) this . knownTypes = new HashtableOfType ( <NUM_LIT> ) ; this . knownTypes . put ( element . compoundName [ element . compoundName . length - <NUM_LIT:1> ] , element ) ; } void clearMissingTagBit ( ) { PackageBinding current = this ; do { current . tagBits &= ~ TagBits . HasMissingType ; } while ( ( current = current . parent ) != null ) ; } public char [ ] computeUniqueKey ( boolean isLeaf ) { return CharOperation . concatWith ( this . compoundName , '<CHAR_LIT:/>' ) ; } private PackageBinding findPackage ( char [ ] name ) { if ( ! this . environment . isPackage ( this . compoundName , name ) ) return null ; char [ ] [ ] subPkgCompoundName = CharOperation . arrayConcat ( this . compoundName , name ) ; PackageBinding subPackageBinding = new PackageBinding ( subPkgCompoundName , this , this . environment ) ; addPackage ( subPackageBinding ) ; return subPackageBinding ; } PackageBinding getPackage ( char [ ] name ) { PackageBinding binding = getPackage0 ( name ) ; if ( binding != null ) { if ( binding == LookupEnvironment . TheNotFoundPackage ) return null ; else return binding ; } if ( ( binding = findPackage ( name ) ) != null ) return binding ; addNotFoundPackage ( name ) ; return null ; } PackageBinding getPackage0 ( char [ ] name ) { return this . knownPackages . get ( name ) ; } ReferenceBinding getType ( char [ ] name ) { ReferenceBinding referenceBinding = getType0 ( name ) ; if ( referenceBinding == null ) { if ( ( referenceBinding = this . environment . askForType ( this , name ) ) == null ) { addNotFoundType ( name ) ; return null ; } } if ( referenceBinding == LookupEnvironment . TheNotFoundType ) return null ; referenceBinding = ( ReferenceBinding ) BinaryTypeBinding . resolveType ( referenceBinding , this . environment , false ) ; if ( referenceBinding . isNestedType ( ) ) return new ProblemReferenceBinding ( new char [ ] [ ] { name } , referenceBinding , ProblemReasons . InternalNameProvided ) ; return referenceBinding ; } ReferenceBinding getType0 ( char [ ] name ) { if ( this . knownTypes == null ) return null ; return this . knownTypes . get ( name ) ; } public Binding getTypeOrPackage ( char [ ] name ) { ReferenceBinding referenceBinding = getType0 ( name ) ; if ( referenceBinding != null && referenceBinding != LookupEnvironment . TheNotFoundType ) { referenceBinding = ( ReferenceBinding ) BinaryTypeBinding . resolveType ( referenceBinding , this . environment , false ) ; if ( referenceBinding . isNestedType ( ) ) { return new ProblemReferenceBinding ( new char [ ] [ ] { name } , referenceBinding , ProblemReasons . InternalNameProvided ) ; } if ( ( referenceBinding . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) { return referenceBinding ; } } PackageBinding packageBinding = getPackage0 ( name ) ; if ( packageBinding != null && packageBinding != LookupEnvironment . TheNotFoundPackage ) { return packageBinding ; } if ( referenceBinding == null ) { if ( ( referenceBinding = this . environment . askForType ( this , name ) ) != null ) { if ( referenceBinding . isNestedType ( ) ) { return new ProblemReferenceBinding ( new char [ ] [ ] { name } , referenceBinding , ProblemReasons . InternalNameProvided ) ; } return referenceBinding ; } addNotFoundType ( name ) ; } if ( packageBinding == null ) { if ( ( packageBinding = findPackage ( name ) ) != null ) { return packageBinding ; } if ( referenceBinding != null && referenceBinding != LookupEnvironment . TheNotFoundType ) { return referenceBinding ; } addNotFoundPackage ( name ) ; } return null ; } public final boolean isViewedAsDeprecated ( ) { if ( ( this . tagBits & TagBits . DeprecatedAnnotationResolved ) == <NUM_LIT:0> ) { this . tagBits |= TagBits . DeprecatedAnnotationResolved ; if ( this . compoundName != CharOperation . NO_CHAR_CHAR ) { ReferenceBinding packageInfo = this . getType ( TypeConstants . PACKAGE_INFO_NAME ) ; if ( packageInfo != null ) { packageInfo . initializeDeprecatedAnnotationTagBits ( ) ; this . tagBits |= packageInfo . tagBits & TagBits . AllStandardAnnotationsMask ; } } } return ( this . tagBits & TagBits . AnnotationDeprecated ) != <NUM_LIT:0> ; } public final int kind ( ) { return Binding . PACKAGE ; } public int problemId ( ) { if ( ( this . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) return ProblemReasons . NotFound ; return ProblemReasons . NoError ; } public char [ ] readableName ( ) { return CharOperation . concatWith ( this . compoundName , '<CHAR_LIT:.>' ) ; } public String toString ( ) { String str ; if ( this . compoundName == CharOperation . NO_CHAR_CHAR ) { str = "<STR_LIT>" ; } else { str = "<STR_LIT>" + ( ( this . compoundName != null ) ? CharOperation . toString ( this . compoundName ) : "<STR_LIT>" ) ; } if ( ( this . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { str += "<STR_LIT>" ; } return str ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . flow . UnconditionalFlowInfo ; import org . eclipse . jdt . internal . compiler . impl . ReferenceContext ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; public class MethodScope extends BlockScope { public ReferenceContext referenceContext ; public boolean isStatic ; public boolean isConstructorCall = false ; public FieldBinding initializedField ; public int lastVisibleFieldID = - <NUM_LIT:1> ; public int analysisIndex ; public boolean isPropagatingInnerClassEmulation ; public int lastIndex = <NUM_LIT:0> ; public long [ ] definiteInits = new long [ <NUM_LIT:4> ] ; public long [ ] [ ] extraDefiniteInits = new long [ <NUM_LIT:4> ] [ ] ; public boolean insideTypeAnnotation = false ; public SyntheticArgumentBinding [ ] extraSyntheticArguments ; public MethodScope ( ClassScope parent , ReferenceContext context , boolean isStatic ) { super ( METHOD_SCOPE , parent ) ; this . locals = new LocalVariableBinding [ <NUM_LIT:5> ] ; this . referenceContext = context ; this . isStatic = isStatic ; this . startIndex = <NUM_LIT:0> ; } String basicToString ( int tab ) { String newLine = "<STR_LIT:n>" ; for ( int i = tab ; -- i >= <NUM_LIT:0> ; ) newLine += "<STR_LIT:t>" ; String s = newLine + "<STR_LIT>" ; newLine += "<STR_LIT:t>" ; s += newLine + "<STR_LIT>" ; for ( int i = <NUM_LIT:0> ; i < this . localIndex ; i ++ ) s += newLine + "<STR_LIT:t>" + this . locals [ i ] . toString ( ) ; s += newLine + "<STR_LIT>" + this . startIndex ; s += newLine + "<STR_LIT>" + this . isConstructorCall ; s += newLine + "<STR_LIT>" + this . initializedField ; s += newLine + "<STR_LIT>" + this . lastVisibleFieldID ; s += newLine + "<STR_LIT>" + this . referenceContext ; return s ; } private void checkAndSetModifiersForConstructor ( MethodBinding methodBinding ) { int modifiers = methodBinding . modifiers ; final ReferenceBinding declaringClass = methodBinding . declaringClass ; if ( ( modifiers & ExtraCompilerModifiers . AccAlternateModifierProblem ) != <NUM_LIT:0> ) problemReporter ( ) . duplicateModifierForMethod ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; if ( ( ( ( ConstructorDeclaration ) this . referenceContext ) . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) { final int DECLARING_FLAGS = ClassFileConstants . AccEnum | ClassFileConstants . AccPublic | ClassFileConstants . AccProtected ; final int VISIBILITY_FLAGS = ClassFileConstants . AccPrivate | ClassFileConstants . AccPublic | ClassFileConstants . AccProtected ; int flags ; if ( ( flags = declaringClass . modifiers & DECLARING_FLAGS ) != <NUM_LIT:0> ) { if ( ( flags & ClassFileConstants . AccEnum ) != <NUM_LIT:0> ) { modifiers &= ~ VISIBILITY_FLAGS ; modifiers |= ClassFileConstants . AccPrivate ; } else { modifiers &= ~ VISIBILITY_FLAGS ; modifiers |= flags ; } } } int realModifiers = modifiers & ExtraCompilerModifiers . AccJustFlag ; final int UNEXPECTED_MODIFIERS = ~ ( ClassFileConstants . AccPublic | ClassFileConstants . AccPrivate | ClassFileConstants . AccProtected | ClassFileConstants . AccStrictfp ) ; if ( declaringClass . isEnum ( ) && ( ( ( ConstructorDeclaration ) this . referenceContext ) . bits & ASTNode . IsDefaultConstructor ) == <NUM_LIT:0> ) { final int UNEXPECTED_ENUM_CONSTR_MODIFIERS = ~ ( ClassFileConstants . AccPrivate | ClassFileConstants . AccStrictfp ) ; if ( ( realModifiers & UNEXPECTED_ENUM_CONSTR_MODIFIERS ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalModifierForEnumConstructor ( ( AbstractMethodDeclaration ) this . referenceContext ) ; modifiers &= ~ ExtraCompilerModifiers . AccJustFlag | ~ UNEXPECTED_ENUM_CONSTR_MODIFIERS ; } else if ( ( ( ( AbstractMethodDeclaration ) this . referenceContext ) . modifiers & ClassFileConstants . AccStrictfp ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalModifierForMethod ( ( AbstractMethodDeclaration ) this . referenceContext ) ; } modifiers |= ClassFileConstants . AccPrivate ; } else if ( ( realModifiers & UNEXPECTED_MODIFIERS ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalModifierForMethod ( ( AbstractMethodDeclaration ) this . referenceContext ) ; modifiers &= ~ ExtraCompilerModifiers . AccJustFlag | ~ UNEXPECTED_MODIFIERS ; } else if ( ( ( ( AbstractMethodDeclaration ) this . referenceContext ) . modifiers & ClassFileConstants . AccStrictfp ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalModifierForMethod ( ( AbstractMethodDeclaration ) this . referenceContext ) ; } int accessorBits = realModifiers & ( ClassFileConstants . AccPublic | ClassFileConstants . AccProtected | ClassFileConstants . AccPrivate ) ; if ( ( accessorBits & ( accessorBits - <NUM_LIT:1> ) ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalVisibilityModifierCombinationForMethod ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; if ( ( accessorBits & ClassFileConstants . AccPublic ) != <NUM_LIT:0> ) { if ( ( accessorBits & ClassFileConstants . AccProtected ) != <NUM_LIT:0> ) modifiers &= ~ ClassFileConstants . AccProtected ; if ( ( accessorBits & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) modifiers &= ~ ClassFileConstants . AccPrivate ; } else if ( ( accessorBits & ClassFileConstants . AccProtected ) != <NUM_LIT:0> && ( accessorBits & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) { modifiers &= ~ ClassFileConstants . AccPrivate ; } } methodBinding . modifiers = modifiers ; } private void checkAndSetModifiersForMethod ( MethodBinding methodBinding ) { int modifiers = methodBinding . modifiers ; final ReferenceBinding declaringClass = methodBinding . declaringClass ; if ( ( modifiers & ExtraCompilerModifiers . AccAlternateModifierProblem ) != <NUM_LIT:0> ) problemReporter ( ) . duplicateModifierForMethod ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; int realModifiers = modifiers & ExtraCompilerModifiers . AccJustFlag ; if ( declaringClass . isInterface ( ) ) { if ( ( realModifiers & ~ ( ClassFileConstants . AccPublic | ClassFileConstants . AccAbstract ) ) != <NUM_LIT:0> ) { if ( ( declaringClass . modifiers & ClassFileConstants . AccAnnotation ) != <NUM_LIT:0> ) problemReporter ( ) . illegalModifierForAnnotationMember ( ( AbstractMethodDeclaration ) this . referenceContext ) ; else problemReporter ( ) . illegalModifierForInterfaceMethod ( ( AbstractMethodDeclaration ) this . referenceContext ) ; } return ; } final int UNEXPECTED_MODIFIERS = ~ ( ClassFileConstants . AccPublic | ClassFileConstants . AccPrivate | ClassFileConstants . AccProtected | ClassFileConstants . AccAbstract | ClassFileConstants . AccStatic | ClassFileConstants . AccFinal | ClassFileConstants . AccSynchronized | ClassFileConstants . AccNative | ClassFileConstants . AccStrictfp ) ; if ( ( realModifiers & UNEXPECTED_MODIFIERS ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalModifierForMethod ( ( AbstractMethodDeclaration ) this . referenceContext ) ; modifiers &= ~ ExtraCompilerModifiers . AccJustFlag | ~ UNEXPECTED_MODIFIERS ; } int accessorBits = realModifiers & ( ClassFileConstants . AccPublic | ClassFileConstants . AccProtected | ClassFileConstants . AccPrivate ) ; if ( ( accessorBits & ( accessorBits - <NUM_LIT:1> ) ) != <NUM_LIT:0> ) { problemReporter ( ) . illegalVisibilityModifierCombinationForMethod ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; if ( ( accessorBits & ClassFileConstants . AccPublic ) != <NUM_LIT:0> ) { if ( ( accessorBits & ClassFileConstants . AccProtected ) != <NUM_LIT:0> ) modifiers &= ~ ClassFileConstants . AccProtected ; if ( ( accessorBits & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) modifiers &= ~ ClassFileConstants . AccPrivate ; } else if ( ( accessorBits & ClassFileConstants . AccProtected ) != <NUM_LIT:0> && ( accessorBits & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) { modifiers &= ~ ClassFileConstants . AccPrivate ; } } if ( ( modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ) { int incompatibleWithAbstract = ClassFileConstants . AccPrivate | ClassFileConstants . AccStatic | ClassFileConstants . AccFinal | ClassFileConstants . AccSynchronized | ClassFileConstants . AccNative | ClassFileConstants . AccStrictfp ; if ( ( modifiers & incompatibleWithAbstract ) != <NUM_LIT:0> ) problemReporter ( ) . illegalAbstractModifierCombinationForMethod ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; if ( ! methodBinding . declaringClass . isAbstract ( ) ) problemReporter ( ) . abstractMethodInAbstractClass ( ( SourceTypeBinding ) declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; } if ( ( modifiers & ClassFileConstants . AccNative ) != <NUM_LIT:0> && ( modifiers & ClassFileConstants . AccStrictfp ) != <NUM_LIT:0> ) problemReporter ( ) . nativeMethodsCannotBeStrictfp ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; if ( ( ( realModifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ) && declaringClass . isNestedType ( ) && ! declaringClass . isStatic ( ) ) problemReporter ( ) . unexpectedStaticModifierForMethod ( declaringClass , ( AbstractMethodDeclaration ) this . referenceContext ) ; methodBinding . modifiers = modifiers ; } public void checkUnusedParameters ( MethodBinding method ) { if ( method . isAbstract ( ) || ( method . isImplementing ( ) && ! compilerOptions ( ) . reportUnusedParameterWhenImplementingAbstract ) || ( method . isOverriding ( ) && ! method . isImplementing ( ) && ! compilerOptions ( ) . reportUnusedParameterWhenOverridingConcrete ) || method . isMain ( ) ) { return ; } for ( int i = <NUM_LIT:0> , maxLocals = this . localIndex ; i < maxLocals ; i ++ ) { LocalVariableBinding local = this . locals [ i ] ; if ( local == null || ( ( local . tagBits & TagBits . IsArgument ) == <NUM_LIT:0> ) ) { break ; } if ( local . useFlag == LocalVariableBinding . UNUSED && ( ( local . declaration . bits & ASTNode . IsLocalDeclarationReachable ) != <NUM_LIT:0> ) ) { problemReporter ( ) . unusedArgument ( local . declaration ) ; } } } public void computeLocalVariablePositions ( int initOffset , CodeStream codeStream ) { this . offset = initOffset ; this . maxOffset = initOffset ; int ilocal = <NUM_LIT:0> , maxLocals = this . localIndex ; while ( ilocal < maxLocals ) { LocalVariableBinding local = this . locals [ ilocal ] ; if ( local == null || ( ( local . tagBits & TagBits . IsArgument ) == <NUM_LIT:0> ) ) break ; codeStream . record ( local ) ; local . resolvedPosition = this . offset ; if ( ( local . type == TypeBinding . LONG ) || ( local . type == TypeBinding . DOUBLE ) ) { this . offset += <NUM_LIT:2> ; } else { this . offset ++ ; } if ( this . offset > <NUM_LIT> ) { problemReporter ( ) . noMoreAvailableSpaceForArgument ( local , local . declaration ) ; } ilocal ++ ; } if ( this . extraSyntheticArguments != null ) { for ( int iarg = <NUM_LIT:0> , maxArguments = this . extraSyntheticArguments . length ; iarg < maxArguments ; iarg ++ ) { SyntheticArgumentBinding argument = this . extraSyntheticArguments [ iarg ] ; argument . resolvedPosition = this . offset ; if ( ( argument . type == TypeBinding . LONG ) || ( argument . type == TypeBinding . DOUBLE ) ) { this . offset += <NUM_LIT:2> ; } else { this . offset ++ ; } if ( this . offset > <NUM_LIT> ) { problemReporter ( ) . noMoreAvailableSpaceForArgument ( argument , ( ASTNode ) this . referenceContext ) ; } } } this . computeLocalVariablePositions ( ilocal , this . offset , codeStream ) ; } MethodBinding createMethod ( AbstractMethodDeclaration method ) { this . referenceContext = method ; method . scope = this ; SourceTypeBinding declaringClass = referenceType ( ) . binding ; int modifiers = method . modifiers | ExtraCompilerModifiers . AccUnresolved ; if ( method . isConstructor ( ) ) { if ( method . isDefaultConstructor ( ) ) modifiers |= ExtraCompilerModifiers . AccIsDefaultConstructor ; method . binding = new MethodBinding ( modifiers , null , null , declaringClass ) ; checkAndSetModifiersForConstructor ( method . binding ) ; } else { if ( declaringClass . isInterface ( ) ) modifiers |= ClassFileConstants . AccPublic | ClassFileConstants . AccAbstract ; method . binding = new MethodBinding ( modifiers , method . selector , null , null , null , declaringClass ) ; checkAndSetModifiersForMethod ( method . binding ) ; } this . isStatic = method . binding . isStatic ( ) ; Argument [ ] argTypes = method . arguments ; int argLength = argTypes == null ? <NUM_LIT:0> : argTypes . length ; if ( argLength > <NUM_LIT:0> && compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ) { if ( argTypes [ -- argLength ] . isVarArgs ( ) ) method . binding . modifiers |= ClassFileConstants . AccVarargs ; while ( -- argLength >= <NUM_LIT:0> ) { if ( argTypes [ argLength ] . isVarArgs ( ) ) problemReporter ( ) . illegalVararg ( argTypes [ argLength ] , method ) ; } } TypeParameter [ ] typeParameters = method . typeParameters ( ) ; if ( typeParameters == null || typeParameters . length == <NUM_LIT:0> ) { method . binding . typeVariables = Binding . NO_TYPE_VARIABLES ; } else { method . binding . typeVariables = createTypeVariables ( typeParameters , method . binding ) ; method . binding . modifiers |= ExtraCompilerModifiers . AccGenericSignature ; } return method . binding ; } public FieldBinding findField ( TypeBinding receiverType , char [ ] fieldName , InvocationSite invocationSite , boolean needResolve ) { FieldBinding field = super . findField ( receiverType , fieldName , invocationSite , needResolve ) ; if ( field == null ) return null ; if ( ! field . isValidBinding ( ) ) return field ; if ( field . isStatic ( ) ) return field ; if ( ! this . isConstructorCall || receiverType != enclosingSourceType ( ) ) return field ; if ( invocationSite instanceof SingleNameReference ) return new ProblemFieldBinding ( field , field . declaringClass , fieldName , ProblemReasons . NonStaticReferenceInConstructorInvocation ) ; if ( invocationSite instanceof QualifiedNameReference ) { QualifiedNameReference name = ( QualifiedNameReference ) invocationSite ; if ( name . binding == null ) return new ProblemFieldBinding ( field , field . declaringClass , fieldName , ProblemReasons . NonStaticReferenceInConstructorInvocation ) ; } return field ; } public boolean isInsideConstructor ( ) { return ( this . referenceContext instanceof ConstructorDeclaration ) ; } public boolean isInsideInitializer ( ) { return ( this . referenceContext instanceof TypeDeclaration ) ; } public boolean isInsideInitializerOrConstructor ( ) { return ( this . referenceContext instanceof TypeDeclaration ) || ( this . referenceContext instanceof ConstructorDeclaration ) ; } public ProblemReporter problemReporter ( ) { ProblemReporter problemReporter = referenceCompilationUnit ( ) . problemReporter ; problemReporter . referenceContext = this . referenceContext ; return problemReporter ; } public final int recordInitializationStates ( FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return - <NUM_LIT:1> ; UnconditionalFlowInfo unconditionalFlowInfo = flowInfo . unconditionalInitsWithoutSideEffect ( ) ; long [ ] extraInits = unconditionalFlowInfo . extra == null ? null : unconditionalFlowInfo . extra [ <NUM_LIT:0> ] ; long inits = unconditionalFlowInfo . definiteInits ; checkNextEntry : for ( int i = this . lastIndex ; -- i >= <NUM_LIT:0> ; ) { if ( this . definiteInits [ i ] == inits ) { long [ ] otherInits = this . extraDefiniteInits [ i ] ; if ( ( extraInits != null ) && ( otherInits != null ) ) { if ( extraInits . length == otherInits . length ) { int j , max ; for ( j = <NUM_LIT:0> , max = extraInits . length ; j < max ; j ++ ) { if ( extraInits [ j ] != otherInits [ j ] ) { continue checkNextEntry ; } } return i ; } } else { if ( ( extraInits == null ) && ( otherInits == null ) ) { return i ; } } } } if ( this . definiteInits . length == this . lastIndex ) { System . arraycopy ( this . definiteInits , <NUM_LIT:0> , ( this . definiteInits = new long [ this . lastIndex + <NUM_LIT:20> ] ) , <NUM_LIT:0> , this . lastIndex ) ; System . arraycopy ( this . extraDefiniteInits , <NUM_LIT:0> , ( this . extraDefiniteInits = new long [ this . lastIndex + <NUM_LIT:20> ] [ ] ) , <NUM_LIT:0> , this . lastIndex ) ; } this . definiteInits [ this . lastIndex ] = inits ; if ( extraInits != null ) { this . extraDefiniteInits [ this . lastIndex ] = new long [ extraInits . length ] ; System . arraycopy ( extraInits , <NUM_LIT:0> , this . extraDefiniteInits [ this . lastIndex ] , <NUM_LIT:0> , extraInits . length ) ; } return this . lastIndex ++ ; } public AbstractMethodDeclaration referenceMethod ( ) { if ( this . referenceContext instanceof AbstractMethodDeclaration ) return ( AbstractMethodDeclaration ) this . referenceContext ; return null ; } public TypeDeclaration referenceType ( ) { return ( ( ClassScope ) this . parent ) . referenceContext ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; public class SyntheticMethodBinding extends MethodBinding { public FieldBinding targetReadField ; public FieldBinding targetWriteField ; public MethodBinding targetMethod ; public TypeBinding targetEnumType ; public int purpose ; public int startIndex ; public int endIndex ; public final static int FieldReadAccess = <NUM_LIT:1> ; public final static int FieldWriteAccess = <NUM_LIT:2> ; public final static int SuperFieldReadAccess = <NUM_LIT:3> ; public final static int SuperFieldWriteAccess = <NUM_LIT:4> ; public final static int MethodAccess = <NUM_LIT:5> ; public final static int ConstructorAccess = <NUM_LIT:6> ; public final static int SuperMethodAccess = <NUM_LIT:7> ; public final static int BridgeMethod = <NUM_LIT:8> ; public final static int EnumValues = <NUM_LIT:9> ; public final static int EnumValueOf = <NUM_LIT:10> ; public final static int SwitchTable = <NUM_LIT:11> ; public final static int TooManyEnumsConstants = <NUM_LIT:12> ; public int sourceStart = <NUM_LIT:0> ; public int index ; public SyntheticMethodBinding ( FieldBinding targetField , boolean isReadAccess , boolean isSuperAccess , ReferenceBinding declaringClass ) { this . modifiers = ClassFileConstants . AccDefault | ClassFileConstants . AccStatic | ClassFileConstants . AccSynthetic ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; SourceTypeBinding declaringSourceType = ( SourceTypeBinding ) declaringClass ; SyntheticMethodBinding [ ] knownAccessMethods = declaringSourceType . syntheticMethods ( ) ; int methodId = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; this . index = methodId ; this . selector = CharOperation . concat ( TypeConstants . SYNTHETIC_ACCESS_METHOD_PREFIX , String . valueOf ( methodId ) . toCharArray ( ) ) ; if ( isReadAccess ) { this . returnType = targetField . type ; if ( targetField . isStatic ( ) ) { this . parameters = Binding . NO_PARAMETERS ; } else { this . parameters = new TypeBinding [ <NUM_LIT:1> ] ; this . parameters [ <NUM_LIT:0> ] = declaringSourceType ; } this . targetReadField = targetField ; this . purpose = isSuperAccess ? SyntheticMethodBinding . SuperFieldReadAccess : SyntheticMethodBinding . FieldReadAccess ; } else { this . returnType = TypeBinding . VOID ; if ( targetField . isStatic ( ) ) { this . parameters = new TypeBinding [ <NUM_LIT:1> ] ; this . parameters [ <NUM_LIT:0> ] = targetField . type ; } else { this . parameters = new TypeBinding [ <NUM_LIT:2> ] ; this . parameters [ <NUM_LIT:0> ] = declaringSourceType ; this . parameters [ <NUM_LIT:1> ] = targetField . type ; } this . targetWriteField = targetField ; this . purpose = isSuperAccess ? SyntheticMethodBinding . SuperFieldWriteAccess : SyntheticMethodBinding . FieldWriteAccess ; } this . thrownExceptions = Binding . NO_EXCEPTIONS ; this . declaringClass = declaringSourceType ; boolean needRename ; do { check : { needRename = false ; long range ; MethodBinding [ ] methods = declaringSourceType . methods ( ) ; if ( ( range = ReferenceBinding . binarySearch ( this . selector , methods ) ) >= <NUM_LIT:0> ) { int paramCount = this . parameters . length ; nextMethod : for ( int imethod = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; imethod <= end ; imethod ++ ) { MethodBinding method = methods [ imethod ] ; if ( method . parameters . length == paramCount ) { TypeBinding [ ] toMatch = method . parameters ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { if ( toMatch [ i ] != this . parameters [ i ] ) { continue nextMethod ; } } needRename = true ; break check ; } } } if ( knownAccessMethods != null ) { for ( int i = <NUM_LIT:0> , length = knownAccessMethods . length ; i < length ; i ++ ) { if ( knownAccessMethods [ i ] == null ) continue ; if ( CharOperation . equals ( this . selector , knownAccessMethods [ i ] . selector ) && areParametersEqual ( methods [ i ] ) ) { needRename = true ; break check ; } } } } if ( needRename ) { setSelector ( CharOperation . concat ( TypeConstants . SYNTHETIC_ACCESS_METHOD_PREFIX , String . valueOf ( ++ methodId ) . toCharArray ( ) ) ) ; } } while ( needRename ) ; FieldDeclaration [ ] fieldDecls = declaringSourceType . scope . referenceContext . fields ; if ( fieldDecls != null ) { for ( int i = <NUM_LIT:0> , max = fieldDecls . length ; i < max ; i ++ ) { if ( fieldDecls [ i ] . binding == targetField ) { this . sourceStart = fieldDecls [ i ] . sourceStart ; return ; } } } this . sourceStart = declaringSourceType . scope . referenceContext . sourceStart ; } public SyntheticMethodBinding ( FieldBinding targetField , ReferenceBinding declaringClass , TypeBinding enumBinding , char [ ] selector ) { this . modifiers = ClassFileConstants . AccDefault | ClassFileConstants . AccStatic | ClassFileConstants . AccSynthetic ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; SourceTypeBinding declaringSourceType = ( SourceTypeBinding ) declaringClass ; SyntheticMethodBinding [ ] knownAccessMethods = declaringSourceType . syntheticMethods ( ) ; int methodId = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; this . index = methodId ; this . selector = selector ; this . returnType = declaringSourceType . scope . createArrayType ( TypeBinding . INT , <NUM_LIT:1> ) ; this . parameters = Binding . NO_PARAMETERS ; this . targetReadField = targetField ; this . targetEnumType = enumBinding ; this . purpose = SyntheticMethodBinding . SwitchTable ; this . thrownExceptions = Binding . NO_EXCEPTIONS ; this . declaringClass = declaringSourceType ; if ( declaringSourceType . isStrictfp ( ) ) { this . modifiers |= ClassFileConstants . AccStrictfp ; } boolean needRename ; do { check : { needRename = false ; long range ; MethodBinding [ ] methods = declaringSourceType . methods ( ) ; if ( ( range = ReferenceBinding . binarySearch ( this . selector , methods ) ) >= <NUM_LIT:0> ) { int paramCount = this . parameters . length ; nextMethod : for ( int imethod = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; imethod <= end ; imethod ++ ) { MethodBinding method = methods [ imethod ] ; if ( method . parameters . length == paramCount ) { TypeBinding [ ] toMatch = method . parameters ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { if ( toMatch [ i ] != this . parameters [ i ] ) { continue nextMethod ; } } needRename = true ; break check ; } } } if ( knownAccessMethods != null ) { for ( int i = <NUM_LIT:0> , length = knownAccessMethods . length ; i < length ; i ++ ) { if ( knownAccessMethods [ i ] == null ) continue ; if ( CharOperation . equals ( this . selector , knownAccessMethods [ i ] . selector ) && areParametersEqual ( methods [ i ] ) ) { needRename = true ; break check ; } } } } if ( needRename ) { setSelector ( CharOperation . concat ( selector , String . valueOf ( ++ methodId ) . toCharArray ( ) ) ) ; } } while ( needRename ) ; this . sourceStart = declaringSourceType . scope . referenceContext . sourceStart ; } public SyntheticMethodBinding ( MethodBinding targetMethod , boolean isSuperAccess , ReferenceBinding declaringClass ) { if ( targetMethod . isConstructor ( ) ) { initializeConstructorAccessor ( targetMethod ) ; } else { initializeMethodAccessor ( targetMethod , isSuperAccess , declaringClass ) ; } } public SyntheticMethodBinding ( MethodBinding overridenMethodToBridge , MethodBinding targetMethod , SourceTypeBinding declaringClass ) { this . declaringClass = declaringClass ; this . selector = overridenMethodToBridge . selector ; this . modifiers = ( targetMethod . modifiers | ClassFileConstants . AccBridge | ClassFileConstants . AccSynthetic ) & ~ ( ClassFileConstants . AccSynchronized | ClassFileConstants . AccAbstract | ClassFileConstants . AccNative | ClassFileConstants . AccFinal | ExtraCompilerModifiers . AccGenericSignature ) ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; this . returnType = overridenMethodToBridge . returnType ; this . parameters = overridenMethodToBridge . parameters ; this . thrownExceptions = overridenMethodToBridge . thrownExceptions ; this . targetMethod = targetMethod ; this . purpose = SyntheticMethodBinding . BridgeMethod ; SyntheticMethodBinding [ ] knownAccessMethods = declaringClass . syntheticMethods ( ) ; int methodId = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; this . index = methodId ; } public SyntheticMethodBinding ( SourceTypeBinding declaringEnum , char [ ] selector ) { this . declaringClass = declaringEnum ; this . selector = selector ; this . modifiers = ClassFileConstants . AccPublic | ClassFileConstants . AccStatic ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; LookupEnvironment environment = declaringEnum . scope . environment ( ) ; this . thrownExceptions = Binding . NO_EXCEPTIONS ; if ( selector == TypeConstants . VALUES ) { this . returnType = environment . createArrayType ( environment . convertToParameterizedType ( declaringEnum ) , <NUM_LIT:1> ) ; this . parameters = Binding . NO_PARAMETERS ; this . purpose = SyntheticMethodBinding . EnumValues ; } else if ( selector == TypeConstants . VALUEOF ) { this . returnType = environment . convertToParameterizedType ( declaringEnum ) ; this . parameters = new TypeBinding [ ] { declaringEnum . scope . getJavaLangString ( ) } ; this . purpose = SyntheticMethodBinding . EnumValueOf ; } SyntheticMethodBinding [ ] knownAccessMethods = ( ( SourceTypeBinding ) this . declaringClass ) . syntheticMethods ( ) ; int methodId = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; this . index = methodId ; if ( declaringEnum . isStrictfp ( ) ) { this . modifiers |= ClassFileConstants . AccStrictfp ; } } public SyntheticMethodBinding ( SourceTypeBinding declaringEnum , int startIndex , int endIndex ) { this . declaringClass = declaringEnum ; SyntheticMethodBinding [ ] knownAccessMethods = declaringEnum . syntheticMethods ( ) ; this . index = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( TypeConstants . SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX ) . append ( this . index ) ; this . selector = String . valueOf ( buffer ) . toCharArray ( ) ; this . modifiers = ClassFileConstants . AccPrivate | ClassFileConstants . AccStatic ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; this . purpose = SyntheticMethodBinding . TooManyEnumsConstants ; this . thrownExceptions = Binding . NO_EXCEPTIONS ; this . returnType = TypeBinding . VOID ; this . parameters = Binding . NO_PARAMETERS ; this . startIndex = startIndex ; this . endIndex = endIndex ; } public SyntheticMethodBinding ( MethodBinding overridenMethodToBridge , SourceTypeBinding declaringClass ) { this . declaringClass = declaringClass ; this . selector = overridenMethodToBridge . selector ; this . modifiers = ( overridenMethodToBridge . modifiers | ClassFileConstants . AccBridge | ClassFileConstants . AccSynthetic ) & ~ ( ClassFileConstants . AccSynchronized | ClassFileConstants . AccAbstract | ClassFileConstants . AccNative | ClassFileConstants . AccFinal | ExtraCompilerModifiers . AccGenericSignature ) ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; this . returnType = overridenMethodToBridge . returnType ; this . parameters = overridenMethodToBridge . parameters ; this . thrownExceptions = overridenMethodToBridge . thrownExceptions ; this . targetMethod = overridenMethodToBridge ; this . purpose = SyntheticMethodBinding . SuperMethodAccess ; SyntheticMethodBinding [ ] knownAccessMethods = declaringClass . syntheticMethods ( ) ; int methodId = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; this . index = methodId ; } public void initializeConstructorAccessor ( MethodBinding accessedConstructor ) { this . targetMethod = accessedConstructor ; this . modifiers = ClassFileConstants . AccDefault | ClassFileConstants . AccSynthetic ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; SourceTypeBinding sourceType = ( SourceTypeBinding ) accessedConstructor . declaringClass ; SyntheticMethodBinding [ ] knownSyntheticMethods = sourceType . syntheticMethods ( ) ; this . index = knownSyntheticMethods == null ? <NUM_LIT:0> : knownSyntheticMethods . length ; this . selector = accessedConstructor . selector ; this . returnType = accessedConstructor . returnType ; this . purpose = SyntheticMethodBinding . ConstructorAccess ; final int parametersLength = accessedConstructor . parameters . length ; this . parameters = new TypeBinding [ parametersLength + <NUM_LIT:1> ] ; System . arraycopy ( accessedConstructor . parameters , <NUM_LIT:0> , this . parameters , <NUM_LIT:0> , parametersLength ) ; this . parameters [ parametersLength ] = accessedConstructor . declaringClass ; this . thrownExceptions = accessedConstructor . thrownExceptions ; this . declaringClass = sourceType ; boolean needRename ; do { check : { needRename = false ; MethodBinding [ ] methods = sourceType . methods ( ) ; for ( int i = <NUM_LIT:0> , length = methods . length ; i < length ; i ++ ) { if ( CharOperation . equals ( this . selector , methods [ i ] . selector ) && areParameterErasuresEqual ( methods [ i ] ) ) { needRename = true ; break check ; } } if ( knownSyntheticMethods != null ) { for ( int i = <NUM_LIT:0> , length = knownSyntheticMethods . length ; i < length ; i ++ ) { if ( knownSyntheticMethods [ i ] == null ) continue ; if ( CharOperation . equals ( this . selector , knownSyntheticMethods [ i ] . selector ) && areParameterErasuresEqual ( knownSyntheticMethods [ i ] ) ) { needRename = true ; break check ; } } } } if ( needRename ) { int length = this . parameters . length ; System . arraycopy ( this . parameters , <NUM_LIT:0> , this . parameters = new TypeBinding [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; this . parameters [ length ] = this . declaringClass ; } } while ( needRename ) ; AbstractMethodDeclaration [ ] methodDecls = sourceType . scope . referenceContext . methods ; if ( methodDecls != null ) { for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { if ( methodDecls [ i ] . binding == accessedConstructor ) { this . sourceStart = methodDecls [ i ] . sourceStart ; return ; } } } } public void initializeMethodAccessor ( MethodBinding accessedMethod , boolean isSuperAccess , ReferenceBinding receiverType ) { this . targetMethod = accessedMethod ; this . modifiers = ClassFileConstants . AccDefault | ClassFileConstants . AccStatic | ClassFileConstants . AccSynthetic ; this . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; SourceTypeBinding declaringSourceType = ( SourceTypeBinding ) receiverType ; SyntheticMethodBinding [ ] knownAccessMethods = declaringSourceType . syntheticMethods ( ) ; int methodId = knownAccessMethods == null ? <NUM_LIT:0> : knownAccessMethods . length ; this . index = methodId ; this . selector = CharOperation . concat ( TypeConstants . SYNTHETIC_ACCESS_METHOD_PREFIX , String . valueOf ( methodId ) . toCharArray ( ) ) ; this . returnType = accessedMethod . returnType ; this . purpose = isSuperAccess ? SyntheticMethodBinding . SuperMethodAccess : SyntheticMethodBinding . MethodAccess ; if ( accessedMethod . isStatic ( ) ) { this . parameters = accessedMethod . parameters ; } else { this . parameters = new TypeBinding [ accessedMethod . parameters . length + <NUM_LIT:1> ] ; this . parameters [ <NUM_LIT:0> ] = declaringSourceType ; System . arraycopy ( accessedMethod . parameters , <NUM_LIT:0> , this . parameters , <NUM_LIT:1> , accessedMethod . parameters . length ) ; } this . thrownExceptions = accessedMethod . thrownExceptions ; this . declaringClass = declaringSourceType ; boolean needRename ; do { check : { needRename = false ; MethodBinding [ ] methods = declaringSourceType . methods ( ) ; for ( int i = <NUM_LIT:0> , length = methods . length ; i < length ; i ++ ) { if ( CharOperation . equals ( this . selector , methods [ i ] . selector ) && areParameterErasuresEqual ( methods [ i ] ) ) { needRename = true ; break check ; } } if ( knownAccessMethods != null ) { for ( int i = <NUM_LIT:0> , length = knownAccessMethods . length ; i < length ; i ++ ) { if ( knownAccessMethods [ i ] == null ) continue ; if ( CharOperation . equals ( this . selector , knownAccessMethods [ i ] . selector ) && areParameterErasuresEqual ( knownAccessMethods [ i ] ) ) { needRename = true ; break check ; } } } } if ( needRename ) { setSelector ( CharOperation . concat ( TypeConstants . SYNTHETIC_ACCESS_METHOD_PREFIX , String . valueOf ( ++ methodId ) . toCharArray ( ) ) ) ; } } while ( needRename ) ; AbstractMethodDeclaration [ ] methodDecls = declaringSourceType . scope . referenceContext . methods ; if ( methodDecls != null ) { for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { if ( methodDecls [ i ] . binding == accessedMethod ) { this . sourceStart = methodDecls [ i ] . sourceStart ; return ; } } } } protected boolean isConstructorRelated ( ) { return this . purpose == SyntheticMethodBinding . ConstructorAccess ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . lookup ; import java . util . Arrays ; import java . util . Comparator ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; abstract public class ReferenceBinding extends TypeBinding { public char [ ] [ ] compoundName ; public char [ ] sourceName ; public int modifiers ; public PackageBinding fPackage ; char [ ] fileName ; char [ ] constantPoolName ; char [ ] signature ; private SimpleLookupTable compatibleCache ; public static final ReferenceBinding LUB_GENERIC = new ReferenceBinding ( ) { } ; private static final Comparator FIELD_COMPARATOR = new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { char [ ] n1 = ( ( FieldBinding ) o1 ) . name ; char [ ] n2 = ( ( FieldBinding ) o2 ) . name ; return ReferenceBinding . compare ( n1 , n2 , n1 . length , n2 . length ) ; } } ; private static final Comparator METHOD_COMPARATOR = new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { MethodBinding m1 = ( MethodBinding ) o1 ; MethodBinding m2 = ( MethodBinding ) o2 ; char [ ] s1 = m1 . selector ; char [ ] s2 = m2 . selector ; int c = ReferenceBinding . compare ( s1 , s2 , s1 . length , s2 . length ) ; return c == <NUM_LIT:0> ? m1 . parameters . length - m2 . parameters . length : c ; } } ; public static FieldBinding binarySearch ( char [ ] name , FieldBinding [ ] sortedFields ) { if ( sortedFields == null ) return null ; int max = sortedFields . length ; if ( max == <NUM_LIT:0> ) return null ; int left = <NUM_LIT:0> , right = max - <NUM_LIT:1> , nameLength = name . length ; int mid = <NUM_LIT:0> ; char [ ] midName ; while ( left <= right ) { mid = left + ( right - left ) / <NUM_LIT:2> ; int compare = compare ( name , midName = sortedFields [ mid ] . name , nameLength , midName . length ) ; if ( compare < <NUM_LIT:0> ) { right = mid - <NUM_LIT:1> ; } else if ( compare > <NUM_LIT:0> ) { left = mid + <NUM_LIT:1> ; } else { return sortedFields [ mid ] ; } } return null ; } public static long binarySearch ( char [ ] selector , MethodBinding [ ] sortedMethods ) { if ( sortedMethods == null ) return - <NUM_LIT:1> ; int max = sortedMethods . length ; if ( max == <NUM_LIT:0> ) return - <NUM_LIT:1> ; int left = <NUM_LIT:0> , right = max - <NUM_LIT:1> , selectorLength = selector . length ; int mid = <NUM_LIT:0> ; char [ ] midSelector ; while ( left <= right ) { mid = left + ( right - left ) / <NUM_LIT:2> ; int compare = compare ( selector , midSelector = sortedMethods [ mid ] . selector , selectorLength , midSelector . length ) ; if ( compare < <NUM_LIT:0> ) { right = mid - <NUM_LIT:1> ; } else if ( compare > <NUM_LIT:0> ) { left = mid + <NUM_LIT:1> ; } else { int start = mid , end = mid ; while ( start > left && CharOperation . equals ( sortedMethods [ start - <NUM_LIT:1> ] . selector , selector ) ) { start -- ; } while ( end < right && CharOperation . equals ( sortedMethods [ end + <NUM_LIT:1> ] . selector , selector ) ) { end ++ ; } return start + ( ( long ) end << <NUM_LIT:32> ) ; } } return - <NUM_LIT:1> ; } static int compare ( char [ ] str1 , char [ ] str2 , int len1 , int len2 ) { int n = Math . min ( len1 , len2 ) ; int i = <NUM_LIT:0> ; while ( n -- != <NUM_LIT:0> ) { char c1 = str1 [ i ] ; char c2 = str2 [ i ++ ] ; if ( c1 != c2 ) { return c1 - c2 ; } } return len1 - len2 ; } public static void sortFields ( FieldBinding [ ] sortedFields , int left , int right ) { Arrays . sort ( sortedFields , left , right , FIELD_COMPARATOR ) ; } public static void sortMethods ( MethodBinding [ ] sortedMethods , int left , int right ) { Arrays . sort ( sortedMethods , left , right , METHOD_COMPARATOR ) ; } public FieldBinding [ ] availableFields ( ) { return fields ( ) ; } public MethodBinding [ ] availableMethods ( ) { return methods ( ) ; } public boolean canBeInstantiated ( ) { return ( this . modifiers & ( ClassFileConstants . AccAbstract | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) == <NUM_LIT:0> ; } public final boolean canBeSeenBy ( PackageBinding invocationPackage ) { if ( isPublic ( ) ) return true ; if ( isPrivate ( ) ) return false ; return invocationPackage == this . fPackage ; } public final boolean canBeSeenBy ( ReferenceBinding receiverType , ReferenceBinding invocationType ) { if ( isPublic ( ) ) return true ; if ( invocationType == this && invocationType == receiverType ) return true ; if ( isProtected ( ) ) { if ( invocationType == this ) return true ; if ( invocationType . fPackage == this . fPackage ) return true ; TypeBinding currentType = invocationType . erasure ( ) ; TypeBinding declaringClass = enclosingType ( ) . erasure ( ) ; if ( declaringClass == invocationType ) return true ; if ( declaringClass == null ) return false ; do { if ( currentType . findSuperTypeOriginatingFrom ( declaringClass ) != null ) return true ; currentType = currentType . enclosingType ( ) ; } while ( currentType != null ) ; return false ; } if ( isPrivate ( ) ) { receiverCheck : { if ( ! ( receiverType == this || receiverType == enclosingType ( ) ) ) { if ( receiverType . isTypeVariable ( ) ) { TypeVariableBinding typeVariable = ( TypeVariableBinding ) receiverType ; if ( typeVariable . environment . globalOptions . complianceLevel <= ClassFileConstants . JDK1_6 && ( typeVariable . isErasureBoundTo ( erasure ( ) ) || typeVariable . isErasureBoundTo ( enclosingType ( ) . erasure ( ) ) ) ) break receiverCheck ; } return false ; } } if ( invocationType != this ) { ReferenceBinding outerInvocationType = invocationType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = ( ReferenceBinding ) erasure ( ) ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } if ( outerInvocationType != outerDeclaringClass ) return false ; } return true ; } if ( invocationType . fPackage != this . fPackage ) return false ; ReferenceBinding currentType = receiverType ; TypeBinding originalDeclaringClass = ( enclosingType ( ) == null ? this : enclosingType ( ) ) . original ( ) ; do { if ( currentType . isCapture ( ) ) { if ( originalDeclaringClass == currentType . erasure ( ) . original ( ) ) return true ; } else { if ( originalDeclaringClass == currentType . original ( ) ) return true ; } PackageBinding currentPackage = currentType . fPackage ; if ( currentPackage != null && currentPackage != this . fPackage ) return false ; } while ( ( currentType = currentType . superclass ( ) ) != null ) ; return false ; } public final boolean canBeSeenBy ( Scope scope ) { if ( scope . compilationUnitScope ( ) != null && scope . compilationUnitScope ( ) . canSeeEverything ( ) ) { return true ; } if ( isPublic ( ) ) return true ; SourceTypeBinding invocationType = scope . enclosingSourceType ( ) ; if ( invocationType == this ) return true ; if ( invocationType == null ) return ! isPrivate ( ) && scope . getCurrentPackage ( ) == this . fPackage ; if ( isProtected ( ) ) { if ( invocationType . fPackage == this . fPackage ) return true ; TypeBinding declaringClass = enclosingType ( ) ; if ( declaringClass == null ) return false ; declaringClass = declaringClass . erasure ( ) ; TypeBinding currentType = invocationType . erasure ( ) ; do { if ( declaringClass == invocationType ) return true ; if ( currentType . findSuperTypeOriginatingFrom ( declaringClass ) != null ) return true ; currentType = currentType . enclosingType ( ) ; } while ( currentType != null ) ; return false ; } if ( isPrivate ( ) ) { ReferenceBinding outerInvocationType = invocationType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = ( ReferenceBinding ) erasure ( ) ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } return outerInvocationType == outerDeclaringClass ; } return invocationType . fPackage == this . fPackage ; } public char [ ] computeGenericTypeSignature ( TypeVariableBinding [ ] typeVariables ) { boolean isMemberOfGeneric = isMemberType ( ) && ( enclosingType ( ) . modifiers & ExtraCompilerModifiers . AccGenericSignature ) != <NUM_LIT:0> ; if ( typeVariables == Binding . NO_TYPE_VARIABLES && ! isMemberOfGeneric ) { return signature ( ) ; } StringBuffer sig = new StringBuffer ( <NUM_LIT:10> ) ; if ( isMemberOfGeneric ) { char [ ] typeSig = enclosingType ( ) . genericTypeSignature ( ) ; sig . append ( typeSig , <NUM_LIT:0> , typeSig . length - <NUM_LIT:1> ) ; sig . append ( '<CHAR_LIT:.>' ) ; sig . append ( this . sourceName ) ; } else { char [ ] typeSig = signature ( ) ; sig . append ( typeSig , <NUM_LIT:0> , typeSig . length - <NUM_LIT:1> ) ; } if ( typeVariables == Binding . NO_TYPE_VARIABLES ) { sig . append ( '<CHAR_LIT:;>' ) ; } else { sig . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = typeVariables . length ; i < length ; i ++ ) { sig . append ( typeVariables [ i ] . genericTypeSignature ( ) ) ; } sig . append ( "<STR_LIT>" ) ; } int sigLength = sig . length ( ) ; char [ ] result = new char [ sigLength ] ; sig . getChars ( <NUM_LIT:0> , sigLength , result , <NUM_LIT:0> ) ; return result ; } public void computeId ( ) { switch ( this . compoundName . length ) { case <NUM_LIT:3> : if ( ! CharOperation . equals ( TypeConstants . JAVA , this . compoundName [ <NUM_LIT:0> ] ) ) return ; char [ ] packageName = this . compoundName [ <NUM_LIT:1> ] ; if ( packageName . length == <NUM_LIT:0> ) return ; char [ ] typeName = this . compoundName [ <NUM_LIT:2> ] ; if ( typeName . length == <NUM_LIT:0> ) return ; if ( ! CharOperation . equals ( TypeConstants . LANG , this . compoundName [ <NUM_LIT:1> ] ) ) { switch ( packageName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( packageName , TypeConstants . IO ) ) { switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_IO_EXTERNALIZABLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaIoExternalizable ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_IO_IOEXCEPTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaIoException ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_IO_OBJECTSTREAMEXCEPTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaIoObjectStreamException ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_IO_PRINTSTREAM [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaIoPrintStream ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_IO_SERIALIZABLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaIoSerializable ; return ; } } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( packageName , TypeConstants . UTIL ) ) { switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_UTIL_COLLECTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaUtilCollection ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_UTIL_ITERATOR [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaUtilIterator ; return ; } } return ; } return ; } switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:A>' : switch ( typeName . length ) { case <NUM_LIT> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_AUTOCLOSEABLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangAutoCloseable ; return ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ASSERTIONERROR [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangAssertionError ; return ; } return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:4> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_BYTE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangByte ; return ; case <NUM_LIT:7> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_BOOLEAN [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangBoolean ; return ; } return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:5> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_CLASS [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangClass ; return ; case <NUM_LIT:9> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_CHARACTER [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangCharacter ; else if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_CLONEABLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangCloneable ; return ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_CLASSNOTFOUNDEXCEPTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangClassNotFoundException ; return ; } return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:6> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_DOUBLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangDouble ; return ; case <NUM_LIT:10> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_DEPRECATED [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangDeprecated ; return ; } return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:4> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ENUM [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangEnum ; return ; case <NUM_LIT:5> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ERROR [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangError ; return ; case <NUM_LIT:9> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_EXCEPTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangException ; return ; } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_FLOAT [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangFloat ; return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:7> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_INTEGER [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangInteger ; return ; case <NUM_LIT:8> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ITERABLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangIterable ; return ; case <NUM_LIT:24> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ILLEGALARGUMENTEXCEPTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangIllegalArgumentException ; return ; } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_LONG [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangLong ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_NOCLASSDEFERROR [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangNoClassDefError ; return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:6> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_OBJECT [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangObject ; return ; case <NUM_LIT:8> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_OVERRIDE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangOverride ; return ; } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_RUNTIMEEXCEPTION [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangRuntimeException ; break ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:5> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_SHORT [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangShort ; return ; case <NUM_LIT:6> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_STRING [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangString ; else if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_SYSTEM [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangSystem ; return ; case <NUM_LIT:11> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_SAFEVARARGS [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangSafeVarargs ; return ; case <NUM_LIT:12> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_STRINGBUFFER [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangStringBuffer ; return ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_STRINGBUILDER [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangStringBuilder ; return ; case <NUM_LIT:16> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_SUPPRESSWARNINGS [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangSuppressWarnings ; return ; } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_THROWABLE [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangThrowable ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_VOID [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangVoid ; return ; } break ; case <NUM_LIT:4> : if ( ! CharOperation . equals ( TypeConstants . JAVA , this . compoundName [ <NUM_LIT:0> ] ) ) return ; packageName = this . compoundName [ <NUM_LIT:1> ] ; if ( packageName . length == <NUM_LIT:0> ) return ; packageName = this . compoundName [ <NUM_LIT:2> ] ; if ( packageName . length == <NUM_LIT:0> ) return ; typeName = this . compoundName [ <NUM_LIT:3> ] ; if ( typeName . length == <NUM_LIT:0> ) return ; switch ( packageName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:a>' : if ( CharOperation . equals ( packageName , TypeConstants . ANNOTATION ) ) { switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:A>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_ANNOTATION [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationAnnotation ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_DOCUMENTED [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationDocumented ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_ELEMENTTYPE [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationElementType ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_INHERITED [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationInherited ; return ; case '<CHAR_LIT>' : switch ( typeName . length ) { case <NUM_LIT:9> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_RETENTION [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationRetention ; return ; case <NUM_LIT:15> : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_RETENTIONPOLICY [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationRetentionPolicy ; return ; } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_ANNOTATION_TARGET [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangAnnotationTarget ; return ; } } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( packageName , TypeConstants . INVOKE ) ) { if ( typeName . length == <NUM_LIT:0> ) return ; switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE [ <NUM_LIT:3> ] ) ) this . id = TypeIds . T_JavaLangInvokeMethodHandlePolymorphicSignature ; return ; } } return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( packageName , TypeConstants . REFLECT ) ) { switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_REFLECT_CONSTRUCTOR [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangReflectConstructor ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_REFLECT_FIELD [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangReflectField ; return ; case '<CHAR_LIT>' : if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_REFLECT_METHOD [ <NUM_LIT:2> ] ) ) this . id = TypeIds . T_JavaLangReflectMethod ; return ; } } return ; } break ; case <NUM_LIT:5> : if ( ! CharOperation . equals ( TypeConstants . JAVA , this . compoundName [ <NUM_LIT:0> ] ) ) return ; packageName = this . compoundName [ <NUM_LIT:1> ] ; if ( packageName . length == <NUM_LIT:0> ) return ; if ( CharOperation . equals ( TypeConstants . LANG , packageName ) ) { packageName = this . compoundName [ <NUM_LIT:2> ] ; if ( packageName . length == <NUM_LIT:0> ) return ; switch ( packageName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( packageName , TypeConstants . INVOKE ) ) { typeName = this . compoundName [ <NUM_LIT:3> ] ; if ( typeName . length == <NUM_LIT:0> ) return ; switch ( typeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : char [ ] memberTypeName = this . compoundName [ <NUM_LIT:4> ] ; if ( memberTypeName . length == <NUM_LIT:0> ) return ; if ( CharOperation . equals ( typeName , TypeConstants . JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE [ <NUM_LIT:3> ] ) && CharOperation . equals ( memberTypeName , TypeConstants . JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE [ <NUM_LIT:4> ] ) ) this . id = TypeIds . T_JavaLangInvokeMethodHandlePolymorphicSignature ; return ; } } return ; } return ; } } } public char [ ] computeUniqueKey ( boolean isLeaf ) { if ( ! isLeaf ) return signature ( ) ; return genericTypeSignature ( ) ; } public char [ ] constantPoolName ( ) { if ( this . constantPoolName != null ) return this . constantPoolName ; return this . constantPoolName = CharOperation . concatWith ( this . compoundName , '<CHAR_LIT:/>' ) ; } public String debugName ( ) { return ( this . compoundName != null ) ? new String ( readableName ( ) ) : "<STR_LIT>" ; } public final int depth ( ) { int depth = <NUM_LIT:0> ; ReferenceBinding current = this ; while ( ( current = current . enclosingType ( ) ) != null ) depth ++ ; return depth ; } public boolean detectAnnotationCycle ( ) { if ( ( this . tagBits & TagBits . EndAnnotationCheck ) != <NUM_LIT:0> ) return false ; if ( ( this . tagBits & TagBits . BeginAnnotationCheck ) != <NUM_LIT:0> ) return true ; this . tagBits |= TagBits . BeginAnnotationCheck ; MethodBinding [ ] currentMethods = methods ( ) ; boolean inCycle = false ; for ( int i = <NUM_LIT:0> , l = currentMethods . length ; i < l ; i ++ ) { TypeBinding returnType = currentMethods [ i ] . returnType . leafComponentType ( ) . erasure ( ) ; if ( this == returnType ) { if ( this instanceof SourceTypeBinding ) { MethodDeclaration decl = ( MethodDeclaration ) currentMethods [ i ] . sourceMethod ( ) ; ( ( SourceTypeBinding ) this ) . scope . problemReporter ( ) . annotationCircularity ( this , this , decl != null ? decl . returnType : null ) ; } } else if ( returnType . isAnnotationType ( ) && ( ( ReferenceBinding ) returnType ) . detectAnnotationCycle ( ) ) { if ( this instanceof SourceTypeBinding ) { MethodDeclaration decl = ( MethodDeclaration ) currentMethods [ i ] . sourceMethod ( ) ; ( ( SourceTypeBinding ) this ) . scope . problemReporter ( ) . annotationCircularity ( this , returnType , decl != null ? decl . returnType : null ) ; } inCycle = true ; } } if ( inCycle ) return true ; this . tagBits |= TagBits . EndAnnotationCheck ; return false ; } public final ReferenceBinding enclosingTypeAt ( int relativeDepth ) { ReferenceBinding current = this ; while ( relativeDepth -- > <NUM_LIT:0> && current != null ) current = current . enclosingType ( ) ; return current ; } public int enumConstantCount ( ) { int count = <NUM_LIT:0> ; FieldBinding [ ] fields = fields ( ) ; for ( int i = <NUM_LIT:0> , length = fields . length ; i < length ; i ++ ) { if ( ( fields [ i ] . modifiers & ClassFileConstants . AccEnum ) != <NUM_LIT:0> ) count ++ ; } return count ; } public int fieldCount ( ) { return fields ( ) . length ; } public FieldBinding [ ] fields ( ) { return Binding . NO_FIELDS ; } public final int getAccessFlags ( ) { return this . modifiers & ExtraCompilerModifiers . AccJustFlag ; } public AnnotationBinding [ ] getAnnotations ( ) { return retrieveAnnotations ( this ) ; } public long getAnnotationTagBits ( ) { return this . tagBits ; } public int getEnclosingInstancesSlotSize ( ) { if ( isStatic ( ) ) return <NUM_LIT:0> ; return enclosingType ( ) == null ? <NUM_LIT:0> : <NUM_LIT:1> ; } public MethodBinding getExactConstructor ( TypeBinding [ ] argumentTypes ) { return null ; } public MethodBinding getExactMethod ( char [ ] selector , TypeBinding [ ] argumentTypes , CompilationUnitScope refScope ) { return null ; } public FieldBinding getField ( char [ ] fieldName , boolean needResolve ) { return null ; } public char [ ] getFileName ( ) { return this . fileName ; } public ReferenceBinding getMemberType ( char [ ] typeName ) { ReferenceBinding [ ] memberTypes = memberTypes ( ) ; for ( int i = memberTypes . length ; -- i >= <NUM_LIT:0> ; ) if ( CharOperation . equals ( memberTypes [ i ] . sourceName , typeName ) ) return memberTypes [ i ] ; return null ; } public MethodBinding [ ] getMethods ( char [ ] selector ) { return Binding . NO_METHODS ; } public MethodBinding [ ] getMethods ( char [ ] selector , int suggestedParameterLength ) { return getMethods ( selector ) ; } public int getOuterLocalVariablesSlotSize ( ) { return <NUM_LIT:0> ; } public PackageBinding getPackage ( ) { return this . fPackage ; } public TypeVariableBinding getTypeVariable ( char [ ] variableName ) { TypeVariableBinding [ ] typeVariables = typeVariables ( ) ; for ( int i = typeVariables . length ; -- i >= <NUM_LIT:0> ; ) if ( CharOperation . equals ( typeVariables [ i ] . sourceName , variableName ) ) return typeVariables [ i ] ; return null ; } public int hashCode ( ) { return ( this . compoundName == null || this . compoundName . length == <NUM_LIT:0> ) ? super . hashCode ( ) : CharOperation . hashCode ( this . compoundName [ this . compoundName . length - <NUM_LIT:1> ] ) ; } public boolean hasIncompatibleSuperType ( ReferenceBinding otherType ) { if ( this == otherType ) return false ; ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = <NUM_LIT:0> ; ReferenceBinding currentType = this ; TypeBinding match ; do { match = otherType . findSuperTypeOriginatingFrom ( currentType ) ; if ( match != null && match . isProvablyDistinct ( currentType ) ) return true ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } } while ( ( currentType = currentType . superclass ( ) ) != null ) ; for ( int i = <NUM_LIT:0> ; i < nextPosition ; i ++ ) { currentType = interfacesToVisit [ i ] ; if ( currentType == otherType ) return false ; match = otherType . findSuperTypeOriginatingFrom ( currentType ) ; if ( match != null && match . isProvablyDistinct ( currentType ) ) return true ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } return false ; } public boolean hasMemberTypes ( ) { return false ; } public final boolean hasRestrictedAccess ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccRestrictedAccess ) != <NUM_LIT:0> ; } public boolean implementsInterface ( ReferenceBinding anInterface , boolean searchHierarchy ) { if ( this == anInterface ) return true ; ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = <NUM_LIT:0> ; ReferenceBinding currentType = this ; do { ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } } while ( searchHierarchy && ( currentType = currentType . superclass ( ) ) != null ) ; for ( int i = <NUM_LIT:0> ; i < nextPosition ; i ++ ) { currentType = interfacesToVisit [ i ] ; if ( currentType . isEquivalentTo ( anInterface ) ) return true ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + <NUM_LIT:5> ] , <NUM_LIT:0> , nextPosition ) ; nextInterface : for ( int a = <NUM_LIT:0> ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = <NUM_LIT:0> ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } return false ; } boolean implementsMethod ( MethodBinding method ) { char [ ] selector = method . selector ; ReferenceBinding type = this ; while ( type != null ) { MethodBinding [ ] methods = type . methods ( ) ; long range ; if ( ( range = ReferenceBinding . binarySearch ( selector , methods ) ) >= <NUM_LIT:0> ) { int start = ( int ) range , end = ( int ) ( range > > <NUM_LIT:32> ) ; for ( int i = start ; i <= end ; i ++ ) { if ( methods [ i ] . areParametersEqual ( method ) ) return true ; } } type = type . superclass ( ) ; } return false ; } public final boolean isAbstract ( ) { return ( this . modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ; } public boolean isAnnotationType ( ) { return ( this . modifiers & ClassFileConstants . AccAnnotation ) != <NUM_LIT:0> ; } public final boolean isBinaryBinding ( ) { return ( this . tagBits & TagBits . IsBinaryBinding ) != <NUM_LIT:0> ; } public boolean isClass ( ) { return ( this . modifiers & ( ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation | ClassFileConstants . AccEnum ) ) == <NUM_LIT:0> ; } public boolean isCompatibleWith ( TypeBinding otherType ) { if ( otherType == this ) return true ; if ( otherType . id == TypeIds . T_JavaLangObject ) return true ; Object result ; if ( this . compatibleCache == null ) { this . compatibleCache = new SimpleLookupTable ( <NUM_LIT:3> ) ; result = null ; } else { result = this . compatibleCache . get ( otherType ) ; if ( result != null ) { return result == Boolean . TRUE ; } } this . compatibleCache . put ( otherType , Boolean . FALSE ) ; if ( isCompatibleWith0 ( otherType ) ) { this . compatibleCache . put ( otherType , Boolean . TRUE ) ; return true ; } return false ; } private boolean isCompatibleWith0 ( TypeBinding otherType ) { if ( otherType == this ) return true ; if ( otherType . id == TypeIds . T_JavaLangObject ) return true ; if ( isEquivalentTo ( otherType ) ) return true ; switch ( otherType . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return false ; case Binding . TYPE_PARAMETER : if ( otherType . isCapture ( ) ) { CaptureBinding otherCapture = ( CaptureBinding ) otherType ; TypeBinding otherLowerBound ; if ( ( otherLowerBound = otherCapture . lowerBound ) != null ) { if ( otherLowerBound . isArrayType ( ) ) return false ; return isCompatibleWith ( otherLowerBound ) ; } } case Binding . GENERIC_TYPE : case Binding . TYPE : case Binding . PARAMETERIZED_TYPE : case Binding . RAW_TYPE : switch ( kind ( ) ) { case Binding . GENERIC_TYPE : case Binding . PARAMETERIZED_TYPE : case Binding . RAW_TYPE : if ( erasure ( ) == otherType . erasure ( ) ) return false ; } ReferenceBinding otherReferenceType = ( ReferenceBinding ) otherType ; if ( otherReferenceType . isInterface ( ) ) return implementsInterface ( otherReferenceType , true ) ; if ( isInterface ( ) ) return false ; return otherReferenceType . isSuperclassOf ( this ) ; default : return false ; } } public final boolean isDefault ( ) { return ( this . modifiers & ( ClassFileConstants . AccPublic | ClassFileConstants . AccProtected | ClassFileConstants . AccPrivate ) ) == <NUM_LIT:0> ; } public final boolean isDeprecated ( ) { return ( this . modifiers & ClassFileConstants . AccDeprecated ) != <NUM_LIT:0> ; } public boolean isEnum ( ) { return ( this . modifiers & ClassFileConstants . AccEnum ) != <NUM_LIT:0> ; } public final boolean isFinal ( ) { return ( this . modifiers & ClassFileConstants . AccFinal ) != <NUM_LIT:0> ; } public boolean isHierarchyBeingConnected ( ) { return ( this . tagBits & TagBits . EndHierarchyCheck ) == <NUM_LIT:0> && ( this . tagBits & TagBits . BeginHierarchyCheck ) != <NUM_LIT:0> ; } public boolean isHierarchyBeingActivelyConnected ( ) { return ( this . tagBits & TagBits . EndHierarchyCheck ) == <NUM_LIT:0> && ( this . tagBits & TagBits . BeginHierarchyCheck ) != <NUM_LIT:0> && ( this . tagBits & TagBits . PauseHierarchyCheck ) == <NUM_LIT:0> ; } public boolean isHierarchyConnected ( ) { return true ; } public boolean isInterface ( ) { return ( this . modifiers & ClassFileConstants . AccInterface ) != <NUM_LIT:0> ; } public final boolean isPrivate ( ) { return ( this . modifiers & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ; } public final boolean isOrEnclosedByPrivateType ( ) { if ( isLocalType ( ) ) return true ; ReferenceBinding type = this ; while ( type != null ) { if ( ( type . modifiers & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) return true ; type = type . enclosingType ( ) ; } return false ; } public final boolean isProtected ( ) { return ( this . modifiers & ClassFileConstants . AccProtected ) != <NUM_LIT:0> ; } public final boolean isPublic ( ) { return ( this . modifiers & ClassFileConstants . AccPublic ) != <NUM_LIT:0> ; } public final boolean isStatic ( ) { return ( this . modifiers & ( ClassFileConstants . AccStatic | ClassFileConstants . AccInterface ) ) != <NUM_LIT:0> || ( this . tagBits & TagBits . IsNestedType ) == <NUM_LIT:0> ; } public final boolean isStrictfp ( ) { return ( this . modifiers & ClassFileConstants . AccStrictfp ) != <NUM_LIT:0> ; } public boolean isSuperclassOf ( ReferenceBinding otherType ) { while ( ( otherType = otherType . superclass ( ) ) != null ) { if ( otherType . isEquivalentTo ( this ) ) return true ; } return false ; } public boolean isThrowable ( ) { ReferenceBinding current = this ; do { switch ( current . id ) { case TypeIds . T_JavaLangThrowable : case TypeIds . T_JavaLangError : case TypeIds . T_JavaLangRuntimeException : case TypeIds . T_JavaLangException : return true ; } } while ( ( current = current . superclass ( ) ) != null ) ; return false ; } public boolean isUncheckedException ( boolean includeSupertype ) { switch ( this . id ) { case TypeIds . T_JavaLangError : case TypeIds . T_JavaLangRuntimeException : return true ; case TypeIds . T_JavaLangThrowable : case TypeIds . T_JavaLangException : return includeSupertype ; } ReferenceBinding current = this ; while ( ( current = current . superclass ( ) ) != null ) { switch ( current . id ) { case TypeIds . T_JavaLangError : case TypeIds . T_JavaLangRuntimeException : return true ; case TypeIds . T_JavaLangThrowable : case TypeIds . T_JavaLangException : return false ; } } return false ; } public final boolean isUsed ( ) { return ( this . modifiers & ExtraCompilerModifiers . AccLocallyUsed ) != <NUM_LIT:0> ; } public final boolean isViewedAsDeprecated ( ) { return ( this . modifiers & ( ClassFileConstants . AccDeprecated | ExtraCompilerModifiers . AccDeprecatedImplicitly ) ) != <NUM_LIT:0> || getPackage ( ) . isViewedAsDeprecated ( ) ; } public ReferenceBinding [ ] memberTypes ( ) { return Binding . NO_MEMBER_TYPES ; } public MethodBinding [ ] methods ( ) { return Binding . NO_METHODS ; } public final ReferenceBinding outermostEnclosingType ( ) { ReferenceBinding current = this ; while ( true ) { ReferenceBinding last = current ; if ( ( current = current . enclosingType ( ) ) == null ) return last ; } } public char [ ] qualifiedSourceName ( ) { if ( isMemberType ( ) ) return CharOperation . concat ( enclosingType ( ) . qualifiedSourceName ( ) , sourceName ( ) , '<CHAR_LIT:.>' ) ; return sourceName ( ) ; } public char [ ] readableName ( ) { char [ ] readableName ; if ( isMemberType ( ) ) { readableName = CharOperation . concat ( enclosingType ( ) . readableName ( ) , this . sourceName , '<CHAR_LIT:.>' ) ; } else { readableName = CharOperation . concatWith ( this . compoundName , '<CHAR_LIT:.>' ) ; } TypeVariableBinding [ ] typeVars ; if ( ( typeVars = typeVariables ( ) ) != Binding . NO_TYPE_VARIABLES ) { StringBuffer nameBuffer = new StringBuffer ( <NUM_LIT:10> ) ; nameBuffer . append ( readableName ) . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = typeVars . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) nameBuffer . append ( '<CHAR_LIT:U+002C>' ) ; nameBuffer . append ( typeVars [ i ] . readableName ( ) ) ; } nameBuffer . append ( '<CHAR_LIT:>>' ) ; int nameLength = nameBuffer . length ( ) ; readableName = new char [ nameLength ] ; nameBuffer . getChars ( <NUM_LIT:0> , nameLength , readableName , <NUM_LIT:0> ) ; } return readableName ; } public AnnotationHolder retrieveAnnotationHolder ( Binding binding , boolean forceInitialization ) { SimpleLookupTable store = storedAnnotations ( forceInitialization ) ; return store == null ? null : ( AnnotationHolder ) store . get ( binding ) ; } AnnotationBinding [ ] retrieveAnnotations ( Binding binding ) { AnnotationHolder holder = retrieveAnnotationHolder ( binding , true ) ; return holder == null ? Binding . NO_ANNOTATIONS : holder . getAnnotations ( ) ; } public void setAnnotations ( AnnotationBinding [ ] annotations ) { storeAnnotations ( this , annotations ) ; } public char [ ] shortReadableName ( ) { char [ ] shortReadableName ; if ( isMemberType ( ) ) { shortReadableName = CharOperation . concat ( enclosingType ( ) . shortReadableName ( ) , this . sourceName , '<CHAR_LIT:.>' ) ; } else { shortReadableName = this . sourceName ; } TypeVariableBinding [ ] typeVars ; if ( ( typeVars = typeVariables ( ) ) != Binding . NO_TYPE_VARIABLES ) { StringBuffer nameBuffer = new StringBuffer ( <NUM_LIT:10> ) ; nameBuffer . append ( shortReadableName ) . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = typeVars . length ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) nameBuffer . append ( '<CHAR_LIT:U+002C>' ) ; nameBuffer . append ( typeVars [ i ] . shortReadableName ( ) ) ; } nameBuffer . append ( '<CHAR_LIT:>>' ) ; int nameLength = nameBuffer . length ( ) ; shortReadableName = new char [ nameLength ] ; nameBuffer . getChars ( <NUM_LIT:0> , nameLength , shortReadableName , <NUM_LIT:0> ) ; } return shortReadableName ; } public char [ ] signature ( ) { if ( this . signature != null ) return this . signature ; return this . signature = CharOperation . concat ( '<CHAR_LIT>' , constantPoolName ( ) , '<CHAR_LIT:;>' ) ; } public char [ ] sourceName ( ) { return this . sourceName ; } void storeAnnotationHolder ( Binding binding , AnnotationHolder holder ) { if ( holder == null ) { SimpleLookupTable store = storedAnnotations ( false ) ; if ( store != null ) store . removeKey ( binding ) ; } else { SimpleLookupTable store = storedAnnotations ( true ) ; if ( store != null ) store . put ( binding , holder ) ; } } void storeAnnotations ( Binding binding , AnnotationBinding [ ] annotations ) { AnnotationHolder holder = null ; if ( annotations == null || annotations . length == <NUM_LIT:0> ) { SimpleLookupTable store = storedAnnotations ( false ) ; if ( store != null ) holder = ( AnnotationHolder ) store . get ( binding ) ; if ( holder == null ) return ; } else { SimpleLookupTable store = storedAnnotations ( true ) ; if ( store == null ) return ; holder = ( AnnotationHolder ) store . get ( binding ) ; if ( holder == null ) holder = new AnnotationHolder ( ) ; } storeAnnotationHolder ( binding , holder . setAnnotations ( annotations ) ) ; } SimpleLookupTable storedAnnotations ( boolean forceInitialize ) { return null ; } public ReferenceBinding superclass ( ) { return null ; } public ReferenceBinding [ ] superInterfaces ( ) { return Binding . NO_SUPERINTERFACES ; } public ReferenceBinding [ ] syntheticEnclosingInstanceTypes ( ) { if ( isStatic ( ) ) return null ; ReferenceBinding enclosingType = enclosingType ( ) ; if ( enclosingType == null ) return null ; return new ReferenceBinding [ ] { enclosingType } ; } public SyntheticArgumentBinding [ ] syntheticOuterLocalVariables ( ) { return null ; } MethodBinding [ ] unResolvedMethods ( ) { return methods ( ) ; } public FieldBinding [ ] unResolvedFields ( ) { return Binding . NO_FIELDS ; } public MethodBinding [ ] getAnyExtraMethods ( char [ ] selector ) { return null ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; public class DefaultErrorHandlingPolicies { public static IErrorHandlingPolicy exitAfterAllProblems ( ) { return new IErrorHandlingPolicy ( ) { public boolean stopOnFirstError ( ) { return false ; } public boolean proceedOnErrors ( ) { return false ; } } ; } public static IErrorHandlingPolicy exitOnFirstError ( ) { return new IErrorHandlingPolicy ( ) { public boolean stopOnFirstError ( ) { return true ; } public boolean proceedOnErrors ( ) { return false ; } } ; } public static IErrorHandlingPolicy proceedOnFirstError ( ) { return new IErrorHandlingPolicy ( ) { public boolean stopOnFirstError ( ) { return true ; } public boolean proceedOnErrors ( ) { return true ; } } ; } public static IErrorHandlingPolicy proceedWithAllProblems ( ) { return new IErrorHandlingPolicy ( ) { public boolean stopOnFirstError ( ) { return false ; } public boolean proceedOnErrors ( ) { return true ; } } ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; public interface IErrorHandlingPolicy { boolean proceedOnErrors ( ) ; boolean stopOnFirstError ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class HashtableOfLong { public long [ ] keyTable ; public Object [ ] valueTable ; public int elementSize ; int threshold ; public HashtableOfLong ( ) { this ( <NUM_LIT> ) ; } public HashtableOfLong ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new long [ extraRoom ] ; this . valueTable = new Object [ extraRoom ] ; } public boolean containsKey ( long key ) { int length = this . keyTable . length , index = ( ( int ) ( key > > > <NUM_LIT:32> ) ) % length ; long currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != <NUM_LIT:0> ) { if ( currentKey == key ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public Object get ( long key ) { int length = this . keyTable . length , index = ( ( int ) ( key > > > <NUM_LIT:32> ) ) % length ; long currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != <NUM_LIT:0> ) { if ( currentKey == key ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public Object put ( long key , Object value ) { int length = this . keyTable . length , index = ( ( int ) ( key > > > <NUM_LIT:32> ) ) % length ; long currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != <NUM_LIT:0> ) { if ( currentKey == key ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } private void rehash ( ) { HashtableOfLong newHashtable = new HashtableOfLong ( this . elementSize * <NUM_LIT:2> ) ; long currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != <NUM_LIT:0> ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; Object object ; for ( int i = <NUM_LIT:0> , length = this . valueTable . length ; i < length ; i ++ ) if ( ( object = this . valueTable [ i ] ) != null ) s += this . keyTable [ i ] + "<STR_LIT>" + object . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class SimpleLookupTable implements Cloneable { public Object [ ] keyTable ; public Object [ ] valueTable ; public int elementSize ; public int threshold ; public SimpleLookupTable ( ) { this ( <NUM_LIT> ) ; } public SimpleLookupTable ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new Object [ extraRoom ] ; this . valueTable = new Object [ extraRoom ] ; } public Object clone ( ) throws CloneNotSupportedException { SimpleLookupTable result = ( SimpleLookupTable ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new Object [ length ] ; System . arraycopy ( this . keyTable , <NUM_LIT:0> , result . keyTable , <NUM_LIT:0> , length ) ; length = this . valueTable . length ; result . valueTable = new Object [ length ] ; System . arraycopy ( this . valueTable , <NUM_LIT:0> , result . valueTable , <NUM_LIT:0> , length ) ; return result ; } public boolean containsKey ( Object key ) { int length = this . keyTable . length ; int index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return true ; if ( ++ index == length ) index = <NUM_LIT:0> ; } return false ; } public Object get ( Object key ) { int length = this . keyTable . length ; int index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) index = <NUM_LIT:0> ; } return null ; } public Object getKey ( Object key ) { int length = this . keyTable . length ; int index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return currentKey ; if ( ++ index == length ) index = <NUM_LIT:0> ; } return key ; } public Object keyForValue ( Object valueToMatch ) { if ( valueToMatch != null ) for ( int i = <NUM_LIT:0> , l = this . keyTable . length ; i < l ; i ++ ) if ( this . keyTable [ i ] != null && valueToMatch . equals ( this . valueTable [ i ] ) ) return this . keyTable [ i ] ; return null ; } public Object put ( Object key , Object value ) { int length = this . keyTable . length ; int index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } public Object removeKey ( Object key ) { int length = this . keyTable . length ; int index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) { this . elementSize -- ; Object oldValue = this . valueTable [ index ] ; this . keyTable [ index ] = null ; this . valueTable [ index ] = null ; if ( this . keyTable [ index + <NUM_LIT:1> == length ? <NUM_LIT:0> : index + <NUM_LIT:1> ] != null ) rehash ( ) ; return oldValue ; } if ( ++ index == length ) index = <NUM_LIT:0> ; } return null ; } public void removeValue ( Object valueToRemove ) { boolean rehash = false ; for ( int i = <NUM_LIT:0> , l = this . valueTable . length ; i < l ; i ++ ) { Object value = this . valueTable [ i ] ; if ( value != null && value . equals ( valueToRemove ) ) { this . elementSize -- ; this . keyTable [ i ] = null ; this . valueTable [ i ] = null ; if ( ! rehash && this . keyTable [ i + <NUM_LIT:1> == l ? <NUM_LIT:0> : i + <NUM_LIT:1> ] != null ) rehash = true ; } } if ( rehash ) rehash ( ) ; } private void rehash ( ) { SimpleLookupTable newLookupTable = new SimpleLookupTable ( this . elementSize * <NUM_LIT:2> ) ; Object currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newLookupTable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newLookupTable . keyTable ; this . valueTable = newLookupTable . valueTable ; this . elementSize = newLookupTable . elementSize ; this . threshold = newLookupTable . threshold ; } public String toString ( ) { String s = "<STR_LIT>" ; Object object ; for ( int i = <NUM_LIT:0> , l = this . valueTable . length ; i < l ; i ++ ) if ( ( object = this . valueTable [ i ] ) != null ) s += this . keyTable [ i ] . toString ( ) + "<STR_LIT>" + object . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class HashtableOfObjectToInt implements Cloneable { public Object [ ] keyTable ; public int [ ] valueTable ; public int elementSize ; int threshold ; public HashtableOfObjectToInt ( ) { this ( <NUM_LIT> ) ; } public HashtableOfObjectToInt ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new Object [ extraRoom ] ; this . valueTable = new int [ extraRoom ] ; } public Object clone ( ) throws CloneNotSupportedException { HashtableOfObjectToInt result = ( HashtableOfObjectToInt ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new Object [ length ] ; System . arraycopy ( this . keyTable , <NUM_LIT:0> , result . keyTable , <NUM_LIT:0> , length ) ; length = this . valueTable . length ; result . valueTable = new int [ length ] ; System . arraycopy ( this . valueTable , <NUM_LIT:0> , result . valueTable , <NUM_LIT:0> , length ) ; return result ; } public boolean containsKey ( Object key ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public int get ( Object key ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return - <NUM_LIT:1> ; } public void keysToArray ( Object [ ] array ) { int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . keyTable . length ; i < length ; i ++ ) { if ( this . keyTable [ i ] != null ) array [ index ++ ] = this . keyTable [ i ] ; } } public int put ( Object key , int value ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } public int removeKey ( Object key ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) { int value = this . valueTable [ index ] ; this . elementSize -- ; this . keyTable [ index ] = null ; rehash ( ) ; return value ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return - <NUM_LIT:1> ; } private void rehash ( ) { HashtableOfObjectToInt newHashtable = new HashtableOfObjectToInt ( this . elementSize * <NUM_LIT:2> ) ; Object currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; Object key ; for ( int i = <NUM_LIT:0> , length = this . keyTable . length ; i < length ; i ++ ) if ( ( key = this . keyTable [ i ] ) != null ) s += key + "<STR_LIT>" + this . valueTable [ i ] + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public interface SuffixConstants { public final static String EXTENSION_class = "<STR_LIT:class>" ; public final static String EXTENSION_CLASS = "<STR_LIT>" ; public final static String EXTENSION_java = "<STR_LIT>" ; public final static String EXTENSION_JAVA = "<STR_LIT>" ; public final static String SUFFIX_STRING_class = "<STR_LIT:.>" + EXTENSION_class ; public final static String SUFFIX_STRING_CLASS = "<STR_LIT:.>" + EXTENSION_CLASS ; public final static String SUFFIX_STRING_java = "<STR_LIT:.>" + EXTENSION_java ; public final static String SUFFIX_STRING_JAVA = "<STR_LIT:.>" + EXTENSION_JAVA ; public final static char [ ] SUFFIX_class = SUFFIX_STRING_class . toCharArray ( ) ; public final static char [ ] SUFFIX_CLASS = SUFFIX_STRING_CLASS . toCharArray ( ) ; public final static char [ ] SUFFIX_java = SUFFIX_STRING_java . toCharArray ( ) ; public final static char [ ] SUFFIX_JAVA = SUFFIX_STRING_JAVA . toCharArray ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import java . io . IOException ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . List ; public class ManifestAnalyzer { private static final int START = <NUM_LIT:0> , IN_CLASSPATH_HEADER = <NUM_LIT:1> , PAST_CLASSPATH_HEADER = <NUM_LIT:2> , SKIPPING_WHITESPACE = <NUM_LIT:3> , READING_JAR = <NUM_LIT:4> , CONTINUING = <NUM_LIT:5> , SKIP_LINE = <NUM_LIT:6> ; private static final char [ ] CLASSPATH_HEADER_TOKEN = "<STR_LIT>" . toCharArray ( ) ; private int classpathSectionsCount ; private ArrayList calledFilesNames ; public boolean analyzeManifestContents ( InputStream inputStream ) throws IOException { char [ ] chars = Util . getInputStreamAsCharArray ( inputStream , - <NUM_LIT:1> , Util . UTF_8 ) ; int state = START , substate = <NUM_LIT:0> ; StringBuffer currentJarToken = new StringBuffer ( ) ; int currentChar ; this . classpathSectionsCount = <NUM_LIT:0> ; this . calledFilesNames = null ; for ( int i = <NUM_LIT:0> , max = chars . length ; i < max ; ) { currentChar = chars [ i ++ ] ; if ( currentChar == '<STR_LIT>' ) { if ( i < max ) { currentChar = chars [ i ++ ] ; } } switch ( state ) { case START : if ( currentChar == CLASSPATH_HEADER_TOKEN [ <NUM_LIT:0> ] ) { state = IN_CLASSPATH_HEADER ; substate = <NUM_LIT:1> ; } else { state = SKIP_LINE ; } break ; case IN_CLASSPATH_HEADER : if ( currentChar == '<STR_LIT:\n>' ) { state = START ; } else if ( currentChar != CLASSPATH_HEADER_TOKEN [ substate ++ ] ) { state = SKIP_LINE ; } else if ( substate == CLASSPATH_HEADER_TOKEN . length ) { state = PAST_CLASSPATH_HEADER ; } break ; case PAST_CLASSPATH_HEADER : if ( currentChar == '<CHAR_LIT:U+0020>' ) { state = SKIPPING_WHITESPACE ; this . classpathSectionsCount ++ ; } else { return false ; } break ; case SKIPPING_WHITESPACE : if ( currentChar == '<STR_LIT:\n>' ) { state = CONTINUING ; } else if ( currentChar != '<CHAR_LIT:U+0020>' ) { currentJarToken . append ( ( char ) currentChar ) ; state = READING_JAR ; } else { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; } break ; case CONTINUING : if ( currentChar == '<STR_LIT:\n>' ) { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = START ; } else if ( currentChar == '<CHAR_LIT:U+0020>' ) { state = SKIPPING_WHITESPACE ; } else if ( currentChar == CLASSPATH_HEADER_TOKEN [ <NUM_LIT:0> ] ) { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = IN_CLASSPATH_HEADER ; substate = <NUM_LIT:1> ; } else if ( this . calledFilesNames == null ) { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = START ; } else { addCurrentTokenJarWhenNecessary ( currentJarToken ) ; state = SKIP_LINE ; } break ; case SKIP_LINE : if ( currentChar == '<STR_LIT:\n>' ) { state = START ; } break ; case READING_JAR : if ( currentChar == '<STR_LIT:\n>' ) { state = CONTINUING ; break ; } else if ( currentChar == '<CHAR_LIT:U+0020>' ) { state = SKIPPING_WHITESPACE ; } else { currentJarToken . append ( ( char ) currentChar ) ; break ; } addCurrentTokenJarWhenNecessary ( currentJarToken ) ; break ; } } switch ( state ) { case START : return true ; case IN_CLASSPATH_HEADER : return true ; case PAST_CLASSPATH_HEADER : return false ; case SKIPPING_WHITESPACE : addCurrentTokenJarWhenNecessary ( currentJarToken ) ; return true ; case CONTINUING : addCurrentTokenJarWhenNecessary ( currentJarToken ) ; return true ; case SKIP_LINE : if ( this . classpathSectionsCount != <NUM_LIT:0> ) { if ( this . calledFilesNames == null ) { return false ; } } return true ; case READING_JAR : return false ; } return true ; } private boolean addCurrentTokenJarWhenNecessary ( StringBuffer currentJarToken ) { if ( currentJarToken != null && currentJarToken . length ( ) > <NUM_LIT:0> ) { if ( this . calledFilesNames == null ) { this . calledFilesNames = new ArrayList ( ) ; } this . calledFilesNames . add ( currentJarToken . toString ( ) ) ; currentJarToken . setLength ( <NUM_LIT:0> ) ; return true ; } return false ; } public int getClasspathSectionsCount ( ) { return this . classpathSectionsCount ; } public List getCalledFileNames ( ) { return this . calledFilesNames ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class HashtableOfIntValues implements Cloneable { public static final int NO_VALUE = Integer . MIN_VALUE ; public char [ ] keyTable [ ] ; public int valueTable [ ] ; public int elementSize ; int threshold ; public HashtableOfIntValues ( ) { this ( <NUM_LIT> ) ; } public HashtableOfIntValues ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new char [ extraRoom ] [ ] ; this . valueTable = new int [ extraRoom ] ; } public Object clone ( ) throws CloneNotSupportedException { HashtableOfIntValues result = ( HashtableOfIntValues ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new char [ length ] [ ] ; System . arraycopy ( this . keyTable , <NUM_LIT:0> , result . keyTable , <NUM_LIT:0> , length ) ; length = this . valueTable . length ; result . valueTable = new int [ length ] ; System . arraycopy ( this . valueTable , <NUM_LIT:0> , result . valueTable , <NUM_LIT:0> , length ) ; return result ; } public boolean containsKey ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public int get ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return NO_VALUE ; } public int put ( char [ ] key , int value ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } public int removeKey ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) { int value = this . valueTable [ index ] ; this . elementSize -- ; this . keyTable [ index ] = null ; this . valueTable [ index ] = NO_VALUE ; rehash ( ) ; return value ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return NO_VALUE ; } private void rehash ( ) { HashtableOfIntValues newHashtable = new HashtableOfIntValues ( this . elementSize * <NUM_LIT:2> ) ; char [ ] currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; char [ ] key ; for ( int i = <NUM_LIT:0> , length = this . valueTable . length ; i < length ; i ++ ) if ( ( key = this . keyTable [ i ] ) != null ) s += new String ( key ) + "<STR_LIT>" + this . valueTable [ i ] + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public class FloatUtil { private static final int DOUBLE_FRACTION_WIDTH = <NUM_LIT> ; private static final int DOUBLE_PRECISION = <NUM_LIT> ; private static final int MAX_DOUBLE_EXPONENT = + <NUM_LIT> ; private static final int MIN_NORMALIZED_DOUBLE_EXPONENT = - <NUM_LIT> ; private static final int MIN_UNNORMALIZED_DOUBLE_EXPONENT = MIN_NORMALIZED_DOUBLE_EXPONENT - DOUBLE_PRECISION ; private static final int DOUBLE_EXPONENT_BIAS = + <NUM_LIT> ; private static final int DOUBLE_EXPONENT_SHIFT = <NUM_LIT> ; private static final int SINGLE_FRACTION_WIDTH = <NUM_LIT> ; private static final int SINGLE_PRECISION = <NUM_LIT:24> ; private static final int MAX_SINGLE_EXPONENT = + <NUM_LIT> ; private static final int MIN_NORMALIZED_SINGLE_EXPONENT = - <NUM_LIT> ; private static final int MIN_UNNORMALIZED_SINGLE_EXPONENT = MIN_NORMALIZED_SINGLE_EXPONENT - SINGLE_PRECISION ; private static final int SINGLE_EXPONENT_BIAS = + <NUM_LIT> ; private static final int SINGLE_EXPONENT_SHIFT = <NUM_LIT> ; public static float valueOfHexFloatLiteral ( char [ ] source ) { long bits = convertHexFloatingPointLiteralToBits ( source ) ; return Float . intBitsToFloat ( ( int ) bits ) ; } public static double valueOfHexDoubleLiteral ( char [ ] source ) { long bits = convertHexFloatingPointLiteralToBits ( source ) ; return Double . longBitsToDouble ( bits ) ; } private static long convertHexFloatingPointLiteralToBits ( char [ ] source ) { int length = source . length ; long mantissa = <NUM_LIT:0> ; int next = <NUM_LIT:0> ; char nextChar = source [ next ] ; nextChar = source [ next ] ; if ( nextChar == '<CHAR_LIT:0>' ) { next ++ ; } else { throw new NumberFormatException ( ) ; } nextChar = source [ next ] ; if ( nextChar == '<CHAR_LIT>' || nextChar == '<CHAR_LIT>' ) { next ++ ; } else { throw new NumberFormatException ( ) ; } int binaryPointPosition = - <NUM_LIT:1> ; loop : while ( true ) { nextChar = source [ next ] ; switch ( nextChar ) { case '<CHAR_LIT:0>' : next ++ ; continue loop ; case '<CHAR_LIT:.>' : binaryPointPosition = next ; next ++ ; continue loop ; default : break loop ; } } int mantissaBits = <NUM_LIT:0> ; int leadingDigitPosition = - <NUM_LIT:1> ; loop : while ( true ) { nextChar = source [ next ] ; int hexdigit ; switch ( nextChar ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : hexdigit = nextChar - '<CHAR_LIT:0>' ; break ; case '<CHAR_LIT:a>' : case '<CHAR_LIT:b>' : case '<CHAR_LIT:c>' : case '<CHAR_LIT>' : case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : hexdigit = ( nextChar - '<CHAR_LIT:a>' ) + <NUM_LIT:10> ; break ; case '<CHAR_LIT:A>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : hexdigit = ( nextChar - '<CHAR_LIT:A>' ) + <NUM_LIT:10> ; break ; case '<CHAR_LIT:.>' : binaryPointPosition = next ; next ++ ; continue loop ; default : if ( binaryPointPosition < <NUM_LIT:0> ) { binaryPointPosition = next ; } break loop ; } if ( mantissaBits == <NUM_LIT:0> ) { leadingDigitPosition = next ; mantissa = hexdigit ; mantissaBits = <NUM_LIT:4> ; } else if ( mantissaBits < <NUM_LIT> ) { mantissa <<= <NUM_LIT:4> ; mantissa |= hexdigit ; mantissaBits += <NUM_LIT:4> ; } else { } next ++ ; continue loop ; } nextChar = source [ next ] ; if ( nextChar == '<CHAR_LIT>' || nextChar == '<CHAR_LIT>' ) { next ++ ; } else { throw new NumberFormatException ( ) ; } int exponent = <NUM_LIT:0> ; int exponentSign = + <NUM_LIT:1> ; loop : while ( next < length ) { nextChar = source [ next ] ; switch ( nextChar ) { case '<CHAR_LIT>' : exponentSign = + <NUM_LIT:1> ; next ++ ; continue loop ; case '<CHAR_LIT:->' : exponentSign = - <NUM_LIT:1> ; next ++ ; continue loop ; case '<CHAR_LIT:0>' : case '<CHAR_LIT:1>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:9>' : int digit = nextChar - '<CHAR_LIT:0>' ; exponent = ( exponent * <NUM_LIT:10> ) + digit ; next ++ ; continue loop ; default : break loop ; } } boolean doublePrecision = true ; if ( next < length ) { nextChar = source [ next ] ; switch ( nextChar ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : doublePrecision = false ; next ++ ; break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : doublePrecision = true ; next ++ ; break ; default : throw new NumberFormatException ( ) ; } } if ( mantissa == <NUM_LIT:0> ) { return <NUM_LIT> ; } int scaleFactorCompensation = <NUM_LIT:0> ; long top = ( mantissa > > > ( mantissaBits - <NUM_LIT:4> ) ) ; if ( ( top & <NUM_LIT> ) == <NUM_LIT:0> ) { mantissaBits -- ; scaleFactorCompensation ++ ; if ( ( top & <NUM_LIT> ) == <NUM_LIT:0> ) { mantissaBits -- ; scaleFactorCompensation ++ ; if ( ( top & <NUM_LIT> ) == <NUM_LIT:0> ) { mantissaBits -- ; scaleFactorCompensation ++ ; } } } long result = <NUM_LIT> ; if ( doublePrecision ) { long fraction ; if ( mantissaBits > DOUBLE_PRECISION ) { int extraBits = mantissaBits - DOUBLE_PRECISION ; fraction = mantissa > > > ( extraBits - <NUM_LIT:1> ) ; long lowBit = fraction & <NUM_LIT> ; fraction += lowBit ; fraction = fraction > > > <NUM_LIT:1> ; if ( ( fraction & ( <NUM_LIT:1L> << DOUBLE_PRECISION ) ) != <NUM_LIT:0> ) { fraction = fraction > > > <NUM_LIT:1> ; scaleFactorCompensation -= <NUM_LIT:1> ; } } else { fraction = mantissa << ( DOUBLE_PRECISION - mantissaBits ) ; } int scaleFactor = <NUM_LIT:0> ; if ( mantissaBits > <NUM_LIT:0> ) { if ( leadingDigitPosition < binaryPointPosition ) { scaleFactor = <NUM_LIT:4> * ( binaryPointPosition - leadingDigitPosition ) ; scaleFactor -= scaleFactorCompensation ; } else { scaleFactor = - <NUM_LIT:4> * ( leadingDigitPosition - binaryPointPosition - <NUM_LIT:1> ) ; scaleFactor -= scaleFactorCompensation ; } } int e = ( exponentSign * exponent ) + scaleFactor ; if ( e - <NUM_LIT:1> > MAX_DOUBLE_EXPONENT ) { result = Double . doubleToLongBits ( Double . POSITIVE_INFINITY ) ; } else if ( e - <NUM_LIT:1> >= MIN_NORMALIZED_DOUBLE_EXPONENT ) { long biasedExponent = e - <NUM_LIT:1> + DOUBLE_EXPONENT_BIAS ; result = fraction & ~ ( <NUM_LIT:1L> << DOUBLE_FRACTION_WIDTH ) ; result |= ( biasedExponent << DOUBLE_EXPONENT_SHIFT ) ; } else if ( e - <NUM_LIT:1> > MIN_UNNORMALIZED_DOUBLE_EXPONENT ) { long biasedExponent = <NUM_LIT:0> ; result = fraction > > > ( MIN_NORMALIZED_DOUBLE_EXPONENT - e + <NUM_LIT:1> ) ; result |= ( biasedExponent << DOUBLE_EXPONENT_SHIFT ) ; } else { result = Double . doubleToLongBits ( Double . NaN ) ; } return result ; } long fraction ; if ( mantissaBits > SINGLE_PRECISION ) { int extraBits = mantissaBits - SINGLE_PRECISION ; fraction = mantissa > > > ( extraBits - <NUM_LIT:1> ) ; long lowBit = fraction & <NUM_LIT> ; fraction += lowBit ; fraction = fraction > > > <NUM_LIT:1> ; if ( ( fraction & ( <NUM_LIT:1L> << SINGLE_PRECISION ) ) != <NUM_LIT:0> ) { fraction = fraction > > > <NUM_LIT:1> ; scaleFactorCompensation -= <NUM_LIT:1> ; } } else { fraction = mantissa << ( SINGLE_PRECISION - mantissaBits ) ; } int scaleFactor = <NUM_LIT:0> ; if ( mantissaBits > <NUM_LIT:0> ) { if ( leadingDigitPosition < binaryPointPosition ) { scaleFactor = <NUM_LIT:4> * ( binaryPointPosition - leadingDigitPosition ) ; scaleFactor -= scaleFactorCompensation ; } else { scaleFactor = - <NUM_LIT:4> * ( leadingDigitPosition - binaryPointPosition - <NUM_LIT:1> ) ; scaleFactor -= scaleFactorCompensation ; } } int e = ( exponentSign * exponent ) + scaleFactor ; if ( e - <NUM_LIT:1> > MAX_SINGLE_EXPONENT ) { result = Float . floatToIntBits ( Float . POSITIVE_INFINITY ) ; } else if ( e - <NUM_LIT:1> >= MIN_NORMALIZED_SINGLE_EXPONENT ) { long biasedExponent = e - <NUM_LIT:1> + SINGLE_EXPONENT_BIAS ; result = fraction & ~ ( <NUM_LIT:1L> << SINGLE_FRACTION_WIDTH ) ; result |= ( biasedExponent << SINGLE_EXPONENT_SHIFT ) ; } else if ( e - <NUM_LIT:1> > MIN_UNNORMALIZED_SINGLE_EXPONENT ) { long biasedExponent = <NUM_LIT:0> ; result = fraction > > > ( MIN_NORMALIZED_SINGLE_EXPONENT - e + <NUM_LIT:1> ) ; result |= ( biasedExponent << SINGLE_EXPONENT_SHIFT ) ; } else { result = Float . floatToIntBits ( Float . NaN ) ; } return result ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class ObjectVector { static int INITIAL_SIZE = <NUM_LIT:10> ; public int size ; int maxSize ; Object [ ] elements ; public ObjectVector ( ) { this ( INITIAL_SIZE ) ; } public ObjectVector ( int initialSize ) { this . maxSize = initialSize > <NUM_LIT:0> ? initialSize : INITIAL_SIZE ; this . size = <NUM_LIT:0> ; this . elements = new Object [ this . maxSize ] ; } public void add ( Object newElement ) { if ( this . size == this . maxSize ) System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new Object [ this . maxSize *= <NUM_LIT:2> ] ) , <NUM_LIT:0> , this . size ) ; this . elements [ this . size ++ ] = newElement ; } public void addAll ( Object [ ] newElements ) { if ( this . size + newElements . length >= this . maxSize ) { this . maxSize = this . size + newElements . length ; System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new Object [ this . maxSize ] ) , <NUM_LIT:0> , this . size ) ; } System . arraycopy ( newElements , <NUM_LIT:0> , this . elements , this . size , newElements . length ) ; this . size += newElements . length ; } public void addAll ( ObjectVector newVector ) { if ( this . size + newVector . size >= this . maxSize ) { this . maxSize = this . size + newVector . size ; System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new Object [ this . maxSize ] ) , <NUM_LIT:0> , this . size ) ; } System . arraycopy ( newVector . elements , <NUM_LIT:0> , this . elements , this . size , newVector . size ) ; this . size += newVector . size ; } public boolean containsIdentical ( Object element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( element == this . elements [ i ] ) return true ; return false ; } public boolean contains ( Object element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( element . equals ( this . elements [ i ] ) ) return true ; return false ; } public void copyInto ( Object [ ] targetArray ) { this . copyInto ( targetArray , <NUM_LIT:0> ) ; } public void copyInto ( Object [ ] targetArray , int index ) { System . arraycopy ( this . elements , <NUM_LIT:0> , targetArray , index , this . size ) ; } public Object elementAt ( int index ) { return this . elements [ index ] ; } public Object find ( Object element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( element . equals ( this . elements [ i ] ) ) return this . elements [ i ] ; return null ; } public Object remove ( Object element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( element . equals ( this . elements [ i ] ) ) { System . arraycopy ( this . elements , i + <NUM_LIT:1> , this . elements , i , -- this . size - i ) ; this . elements [ this . size ] = null ; return element ; } return null ; } public void removeAll ( ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) this . elements [ i ] = null ; this . size = <NUM_LIT:0> ; } public int size ( ) { return this . size ; } public String toString ( ) { String s = "<STR_LIT>" ; for ( int i = <NUM_LIT:0> ; i < this . size ; i ++ ) s += this . elements [ i ] . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . lookup . PackageBinding ; public final class HashtableOfPackage { public char [ ] keyTable [ ] ; public PackageBinding valueTable [ ] ; public int elementSize ; int threshold ; public HashtableOfPackage ( ) { this ( <NUM_LIT:3> ) ; } public HashtableOfPackage ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new char [ extraRoom ] [ ] ; this . valueTable = new PackageBinding [ extraRoom ] ; } public boolean containsKey ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public PackageBinding get ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public PackageBinding put ( char [ ] key , PackageBinding value ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } private void rehash ( ) { HashtableOfPackage newHashtable = new HashtableOfPackage ( this . elementSize * <NUM_LIT:2> ) ; char [ ] currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; PackageBinding pkg ; for ( int i = <NUM_LIT:0> , length = this . valueTable . length ; i < length ; i ++ ) if ( ( pkg = this . valueTable [ i ] ) != null ) s += pkg . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class HashtableOfInt { public int [ ] keyTable ; public Object [ ] valueTable ; public int elementSize ; int threshold ; public HashtableOfInt ( ) { this ( <NUM_LIT> ) ; } public HashtableOfInt ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new int [ extraRoom ] ; this . valueTable = new Object [ extraRoom ] ; } public boolean containsKey ( int key ) { int length = this . keyTable . length , index = key % length ; int currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != <NUM_LIT:0> ) { if ( currentKey == key ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public Object get ( int key ) { int length = this . keyTable . length , index = key % length ; int currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != <NUM_LIT:0> ) { if ( currentKey == key ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public Object put ( int key , Object value ) { int length = this . keyTable . length , index = key % length ; int currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != <NUM_LIT:0> ) { if ( currentKey == key ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } private void rehash ( ) { HashtableOfInt newHashtable = new HashtableOfInt ( this . elementSize * <NUM_LIT:2> ) ; int currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != <NUM_LIT:0> ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; Object object ; for ( int i = <NUM_LIT:0> , length = this . valueTable . length ; i < length ; i ++ ) if ( ( object = this . valueTable [ i ] ) != null ) s += this . keyTable [ i ] + "<STR_LIT>" + object . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; public final class HashtableOfType { public char [ ] keyTable [ ] ; public ReferenceBinding valueTable [ ] ; public int elementSize ; int threshold ; public HashtableOfType ( ) { this ( <NUM_LIT:3> ) ; } public HashtableOfType ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new char [ extraRoom ] [ ] ; this . valueTable = new ReferenceBinding [ extraRoom ] ; } public boolean containsKey ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public ReferenceBinding get ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public ReferenceBinding put ( char [ ] key , ReferenceBinding value ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } private void rehash ( ) { HashtableOfType newHashtable = new HashtableOfType ( this . elementSize < <NUM_LIT:100> ? <NUM_LIT:100> : this . elementSize * <NUM_LIT:2> ) ; char [ ] currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; ReferenceBinding type ; for ( int i = <NUM_LIT:0> , length = this . valueTable . length ; i < length ; i ++ ) if ( ( type = this . valueTable [ i ] ) != null ) s += type . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class CompoundNameVector { static int INITIAL_SIZE = <NUM_LIT:10> ; public int size ; int maxSize ; char [ ] [ ] [ ] elements ; public CompoundNameVector ( ) { this . maxSize = INITIAL_SIZE ; this . size = <NUM_LIT:0> ; this . elements = new char [ this . maxSize ] [ ] [ ] ; } public void add ( char [ ] [ ] newElement ) { if ( this . size == this . maxSize ) System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new char [ this . maxSize *= <NUM_LIT:2> ] [ ] [ ] ) , <NUM_LIT:0> , this . size ) ; this . elements [ this . size ++ ] = newElement ; } public void addAll ( char [ ] [ ] [ ] newElements ) { if ( this . size + newElements . length >= this . maxSize ) { this . maxSize = this . size + newElements . length ; System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new char [ this . maxSize ] [ ] [ ] ) , <NUM_LIT:0> , this . size ) ; } System . arraycopy ( newElements , <NUM_LIT:0> , this . elements , this . size , newElements . length ) ; this . size += newElements . length ; } public boolean contains ( char [ ] [ ] element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( CharOperation . equals ( element , this . elements [ i ] ) ) return true ; return false ; } public char [ ] [ ] elementAt ( int index ) { return this . elements [ index ] ; } public char [ ] [ ] remove ( char [ ] [ ] element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( element == this . elements [ i ] ) { System . arraycopy ( this . elements , i + <NUM_LIT:1> , this . elements , i , -- this . size - i ) ; this . elements [ this . size ] = null ; return element ; } return null ; } public void removeAll ( ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) this . elements [ i ] = null ; this . size = <NUM_LIT:0> ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < this . size ; i ++ ) { buffer . append ( CharOperation . toString ( this . elements [ i ] ) ) . append ( "<STR_LIT:n>" ) ; } return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class HashSetOfInt implements Cloneable { public int [ ] set ; public int elementSize ; int threshold ; public HashSetOfInt ( ) { this ( <NUM_LIT> ) ; } public HashSetOfInt ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . set = new int [ extraRoom ] ; } public Object clone ( ) throws CloneNotSupportedException { HashSetOfInt result = ( HashSetOfInt ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . set . length ; result . set = new int [ length ] ; System . arraycopy ( this . set , <NUM_LIT:0> , result . set , <NUM_LIT:0> , length ) ; return result ; } public boolean contains ( int element ) { int length = this . set . length ; int index = element % length ; int currentElement ; while ( ( currentElement = this . set [ index ] ) != <NUM_LIT:0> ) { if ( currentElement == element ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public int add ( int element ) { int length = this . set . length ; int index = element % length ; int currentElement ; while ( ( currentElement = this . set [ index ] ) != <NUM_LIT:0> ) { if ( currentElement == element ) return this . set [ index ] = element ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . set [ index ] = element ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return element ; } public int remove ( int element ) { int length = this . set . length ; int index = element % length ; int currentElement ; while ( ( currentElement = this . set [ index ] ) != <NUM_LIT:0> ) { if ( currentElement == element ) { int existing = this . set [ index ] ; this . elementSize -- ; this . set [ index ] = <NUM_LIT:0> ; rehash ( ) ; return existing ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return <NUM_LIT:0> ; } private void rehash ( ) { HashSetOfInt newHashSet = new HashSetOfInt ( this . elementSize * <NUM_LIT:2> ) ; int currentElement ; for ( int i = this . set . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentElement = this . set [ i ] ) != <NUM_LIT:0> ) newHashSet . add ( currentElement ) ; this . set = newHashSet . set ; this . threshold = newHashSet . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; int element ; for ( int i = <NUM_LIT:0> , length = this . set . length ; i < length ; i ++ ) if ( ( element = this . set [ i ] ) != <NUM_LIT:0> ) { buffer . append ( element ) ; if ( i != length - <NUM_LIT:1> ) buffer . append ( '<STR_LIT:\n>' ) ; } return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . io . StringWriter ; import java . io . UnsupportedEncodingException ; import java . util . HashSet ; import java . util . List ; import java . util . StringTokenizer ; import java . util . zip . ZipEntry ; import java . util . zip . ZipFile ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . batch . FileSystem ; import org . eclipse . jdt . internal . compiler . batch . Main ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . WildcardBinding ; public class Util implements SuffixConstants { 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 interface Displayable { String displayString ( Object o ) ; } private static final int DEFAULT_READING_SIZE = <NUM_LIT> ; private static final int DEFAULT_WRITING_SIZE = <NUM_LIT> ; public final static String UTF_8 = "<STR_LIT:UTF-8>" ; public static final String LINE_SEPARATOR = System . getProperty ( "<STR_LIT>" ) ; public static final String EMPTY_STRING = new String ( CharOperation . NO_CHAR ) ; public static final int [ ] EMPTY_INT_ARRAY = new int [ <NUM_LIT:0> ] ; public static String buildAllDirectoriesInto ( String outputPath , String relativeFileName ) throws IOException { char fileSeparatorChar = File . separatorChar ; String fileSeparator = File . separator ; File f ; outputPath = outputPath . replace ( '<CHAR_LIT:/>' , fileSeparatorChar ) ; relativeFileName = relativeFileName . replace ( '<CHAR_LIT:/>' , fileSeparatorChar ) ; String outputDirPath , fileName ; int separatorIndex = relativeFileName . lastIndexOf ( fileSeparatorChar ) ; if ( separatorIndex == - <NUM_LIT:1> ) { if ( outputPath . endsWith ( fileSeparator ) ) { outputDirPath = outputPath . substring ( <NUM_LIT:0> , outputPath . length ( ) - <NUM_LIT:1> ) ; fileName = outputPath + relativeFileName ; } else { outputDirPath = outputPath ; fileName = outputPath + fileSeparator + relativeFileName ; } } else { if ( outputPath . endsWith ( fileSeparator ) ) { outputDirPath = outputPath + relativeFileName . substring ( <NUM_LIT:0> , separatorIndex ) ; fileName = outputPath + relativeFileName ; } else { outputDirPath = outputPath + fileSeparator + relativeFileName . substring ( <NUM_LIT:0> , separatorIndex ) ; fileName = outputPath + fileSeparator + relativeFileName ; } } f = new File ( outputDirPath ) ; f . mkdirs ( ) ; if ( f . isDirectory ( ) ) { return fileName ; } else { if ( outputPath . endsWith ( fileSeparator ) ) { outputPath = outputPath . substring ( <NUM_LIT:0> , outputPath . length ( ) - <NUM_LIT:1> ) ; } f = new File ( outputPath ) ; boolean checkFileType = false ; if ( f . exists ( ) ) { checkFileType = true ; } else { if ( ! f . mkdirs ( ) ) { if ( f . exists ( ) ) { checkFileType = true ; } else { throw new IOException ( Messages . bind ( Messages . output_notValidAll , f . getAbsolutePath ( ) ) ) ; } } } if ( checkFileType ) { if ( ! f . isDirectory ( ) ) { throw new IOException ( Messages . bind ( Messages . output_isFile , f . getAbsolutePath ( ) ) ) ; } } StringBuffer outDir = new StringBuffer ( outputPath ) ; outDir . append ( fileSeparator ) ; StringTokenizer tokenizer = new StringTokenizer ( relativeFileName , fileSeparator ) ; String token = tokenizer . nextToken ( ) ; while ( tokenizer . hasMoreTokens ( ) ) { f = new File ( outDir . append ( token ) . append ( fileSeparator ) . toString ( ) ) ; checkFileType = false ; if ( f . exists ( ) ) { checkFileType = true ; } else { if ( ! f . mkdir ( ) ) { if ( f . exists ( ) ) { checkFileType = true ; } else { throw new IOException ( Messages . bind ( Messages . output_notValid , outDir . substring ( outputPath . length ( ) + <NUM_LIT:1> , outDir . length ( ) - <NUM_LIT:1> ) , outputPath ) ) ; } } } if ( checkFileType ) { if ( ! f . isDirectory ( ) ) { throw new IOException ( Messages . bind ( Messages . output_isFile , f . getAbsolutePath ( ) ) ) ; } } token = tokenizer . nextToken ( ) ; } return outDir . append ( token ) . toString ( ) ; } } public static char [ ] bytesToChar ( byte [ ] bytes , String encoding ) throws IOException { return getInputStreamAsCharArray ( new ByteArrayInputStream ( bytes ) , bytes . length , encoding ) ; } public static int computeOuterMostVisibility ( TypeDeclaration typeDeclaration , int visibility ) { while ( typeDeclaration != null ) { switch ( typeDeclaration . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ) { case ClassFileConstants . AccPrivate : visibility = ClassFileConstants . AccPrivate ; break ; case ClassFileConstants . AccDefault : if ( visibility != ClassFileConstants . AccPrivate ) { visibility = ClassFileConstants . AccDefault ; } break ; case ClassFileConstants . AccProtected : if ( visibility == ClassFileConstants . AccPublic ) { visibility = ClassFileConstants . AccProtected ; } break ; } typeDeclaration = typeDeclaration . enclosingType ; } return visibility ; } public static byte [ ] getFileByteContent ( File file ) throws IOException { InputStream stream = null ; try { stream = new BufferedInputStream ( new FileInputStream ( file ) ) ; return getInputStreamAsByteArray ( stream , ( int ) file . length ( ) ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { } } } } public static char [ ] getFileCharContent ( File file , String encoding ) throws IOException { InputStream stream = null ; try { stream = new FileInputStream ( file ) ; return getInputStreamAsCharArray ( stream , ( int ) file . length ( ) , encoding ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { } } } } private static FileOutputStream getFileOutputStream ( boolean generatePackagesStructure , String outputPath , String relativeFileName ) throws IOException { if ( generatePackagesStructure ) { return new FileOutputStream ( new File ( buildAllDirectoriesInto ( outputPath , relativeFileName ) ) ) ; } else { String fileName = null ; char fileSeparatorChar = File . separatorChar ; String fileSeparator = File . separator ; outputPath = outputPath . replace ( '<CHAR_LIT:/>' , fileSeparatorChar ) ; int indexOfPackageSeparator = relativeFileName . lastIndexOf ( fileSeparatorChar ) ; if ( indexOfPackageSeparator == - <NUM_LIT:1> ) { if ( outputPath . endsWith ( fileSeparator ) ) { fileName = outputPath + relativeFileName ; } else { fileName = outputPath + fileSeparator + relativeFileName ; } } else { int length = relativeFileName . length ( ) ; if ( outputPath . endsWith ( fileSeparator ) ) { fileName = outputPath + relativeFileName . substring ( indexOfPackageSeparator + <NUM_LIT:1> , length ) ; } else { fileName = outputPath + fileSeparator + relativeFileName . substring ( indexOfPackageSeparator + <NUM_LIT:1> , length ) ; } } return new FileOutputStream ( new File ( fileName ) ) ; } } public static byte [ ] getInputStreamAsByteArray ( InputStream stream , int length ) throws IOException { byte [ ] contents ; if ( length == - <NUM_LIT:1> ) { contents = new byte [ <NUM_LIT:0> ] ; int contentsLength = <NUM_LIT:0> ; int amountRead = - <NUM_LIT:1> ; do { int amountRequested = Math . max ( stream . available ( ) , DEFAULT_READING_SIZE ) ; if ( contentsLength + amountRequested > contents . length ) { System . arraycopy ( contents , <NUM_LIT:0> , contents = new byte [ contentsLength + amountRequested ] , <NUM_LIT:0> , contentsLength ) ; } amountRead = stream . read ( contents , contentsLength , amountRequested ) ; if ( amountRead > <NUM_LIT:0> ) { contentsLength += amountRead ; } } while ( amountRead != - <NUM_LIT:1> ) ; if ( contentsLength < contents . length ) { System . arraycopy ( contents , <NUM_LIT:0> , contents = new byte [ contentsLength ] , <NUM_LIT:0> , contentsLength ) ; } } else { contents = new byte [ length ] ; int len = <NUM_LIT:0> ; int readSize = <NUM_LIT:0> ; while ( ( readSize != - <NUM_LIT:1> ) && ( len != length ) ) { len += readSize ; readSize = stream . read ( contents , len , length - len ) ; } } return contents ; } public static char [ ] getInputStreamAsCharArray ( InputStream stream , int length , String encoding ) throws IOException { BufferedReader reader = null ; try { reader = encoding == null ? new BufferedReader ( new InputStreamReader ( stream ) ) : new BufferedReader ( new InputStreamReader ( stream , encoding ) ) ; } catch ( UnsupportedEncodingException e ) { reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; } char [ ] contents ; int totalRead = <NUM_LIT:0> ; if ( length == - <NUM_LIT:1> ) { contents = CharOperation . NO_CHAR ; } else { contents = new char [ length ] ; } while ( true ) { int amountRequested ; if ( totalRead < length ) { amountRequested = length - totalRead ; } else { int current = reader . read ( ) ; if ( current < <NUM_LIT:0> ) break ; amountRequested = Math . max ( stream . available ( ) , DEFAULT_READING_SIZE ) ; if ( totalRead + <NUM_LIT:1> + amountRequested > contents . length ) System . arraycopy ( contents , <NUM_LIT:0> , contents = new char [ totalRead + <NUM_LIT:1> + amountRequested ] , <NUM_LIT:0> , totalRead ) ; contents [ totalRead ++ ] = ( char ) current ; } int amountRead = reader . read ( contents , totalRead , amountRequested ) ; if ( amountRead < <NUM_LIT:0> ) break ; totalRead += amountRead ; } int start = <NUM_LIT:0> ; if ( totalRead > <NUM_LIT:0> && UTF_8 . equals ( encoding ) ) { if ( contents [ <NUM_LIT:0> ] == <NUM_LIT> ) { totalRead -- ; start = <NUM_LIT:1> ; } } if ( totalRead < contents . length ) System . arraycopy ( contents , start , contents = new char [ totalRead ] , <NUM_LIT:0> , totalRead ) ; return contents ; } public static String getExceptionSummary ( Throwable exception ) { StringWriter stringWriter = new StringWriter ( ) ; exception . printStackTrace ( new PrintWriter ( stringWriter ) ) ; StringBuffer buffer = stringWriter . getBuffer ( ) ; StringBuffer exceptionBuffer = new StringBuffer ( <NUM_LIT> ) ; exceptionBuffer . append ( exception . toString ( ) ) ; lookupLine2 : for ( int i = <NUM_LIT:0> , lineSep = <NUM_LIT:0> , max = buffer . length ( ) , line2Start = <NUM_LIT:0> ; i < max ; i ++ ) { switch ( buffer . charAt ( i ) ) { case '<STR_LIT:\n>' : case '<STR_LIT>' : if ( line2Start > <NUM_LIT:0> ) { exceptionBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( buffer . substring ( line2Start , i ) ) ; break lookupLine2 ; } lineSep ++ ; break ; case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\t>' : break ; default : if ( lineSep > <NUM_LIT:0> ) { line2Start = i ; lineSep = <NUM_LIT:0> ; } break ; } } return exceptionBuffer . toString ( ) ; } public static int getLineNumber ( int position , int [ ] lineEnds , int g , int d ) { if ( lineEnds == null ) return <NUM_LIT:1> ; if ( d == - <NUM_LIT:1> ) return <NUM_LIT:1> ; int m = g , start ; while ( g <= d ) { m = g + ( d - g ) / <NUM_LIT:2> ; if ( position < ( start = lineEnds [ m ] ) ) { d = m - <NUM_LIT:1> ; } else if ( position > start ) { g = m + <NUM_LIT:1> ; } else { return m + <NUM_LIT:1> ; } } if ( position < lineEnds [ m ] ) { return m + <NUM_LIT:1> ; } return m + <NUM_LIT:2> ; } public static byte [ ] getZipEntryByteContent ( ZipEntry ze , ZipFile zip ) throws IOException { InputStream stream = null ; try { InputStream inputStream = zip . getInputStream ( ze ) ; if ( inputStream == null ) throw new IOException ( "<STR_LIT>" + ze . getName ( ) ) ; stream = new BufferedInputStream ( inputStream ) ; return getInputStreamAsByteArray ( stream , ( int ) ze . getSize ( ) ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { } } } } public static int hashCode ( Object [ ] array ) { int prime = <NUM_LIT:31> ; if ( array == null ) { return <NUM_LIT:0> ; } int result = <NUM_LIT:1> ; for ( int index = <NUM_LIT:0> ; index < array . length ; index ++ ) { result = prime * result + ( array [ index ] == null ? <NUM_LIT:0> : array [ index ] . hashCode ( ) ) ; } return result ; } public final static boolean isPotentialZipArchive ( String name ) { int lastDot = name . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( lastDot == - <NUM_LIT:1> ) return false ; if ( name . lastIndexOf ( File . separatorChar ) > lastDot ) return false ; int length = name . length ( ) ; int extensionLength = length - lastDot - <NUM_LIT:1> ; if ( extensionLength == EXTENSION_java . length ( ) ) { for ( int i = extensionLength - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { if ( Character . toLowerCase ( name . charAt ( length - extensionLength + i ) ) != EXTENSION_java . charAt ( i ) ) { break ; } if ( i == <NUM_LIT:0> ) { return false ; } } } if ( extensionLength == EXTENSION_class . length ( ) ) { for ( int i = extensionLength - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { if ( Character . toLowerCase ( name . charAt ( length - extensionLength + i ) ) != EXTENSION_class . charAt ( i ) ) { return true ; } } return false ; } return true ; } public final static boolean isClassFileName ( char [ ] name ) { int nameLength = name == null ? <NUM_LIT:0> : name . length ; int suffixLength = SUFFIX_CLASS . length ; if ( nameLength < suffixLength ) return false ; for ( int i = <NUM_LIT:0> , offset = nameLength - suffixLength ; i < suffixLength ; i ++ ) { char c = name [ offset + i ] ; if ( c != SUFFIX_class [ i ] && c != SUFFIX_CLASS [ i ] ) return false ; } return true ; } public final static boolean isClassFileName ( String name ) { int nameLength = name == null ? <NUM_LIT:0> : name . length ( ) ; int suffixLength = SUFFIX_CLASS . length ; if ( nameLength < suffixLength ) return false ; for ( int i = <NUM_LIT:0> ; i < suffixLength ; i ++ ) { char c = name . charAt ( nameLength - i - <NUM_LIT:1> ) ; int suffixIndex = suffixLength - i - <NUM_LIT:1> ; if ( c != SUFFIX_class [ suffixIndex ] && c != SUFFIX_CLASS [ suffixIndex ] ) return false ; } return true ; } public final static boolean isExcluded ( char [ ] path , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns , boolean isFolderPath ) { if ( inclusionPatterns == null && exclusionPatterns == null ) return false ; inclusionCheck : if ( inclusionPatterns != null ) { for ( int i = <NUM_LIT:0> , length = inclusionPatterns . length ; i < length ; i ++ ) { char [ ] pattern = inclusionPatterns [ i ] ; char [ ] folderPattern = pattern ; if ( isFolderPath ) { int lastSlash = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , pattern ) ; if ( lastSlash != - <NUM_LIT:1> && lastSlash != pattern . length - <NUM_LIT:1> ) { int star = CharOperation . indexOf ( '<CHAR_LIT>' , pattern , lastSlash ) ; if ( ( star == - <NUM_LIT:1> || star >= pattern . length - <NUM_LIT:1> || pattern [ star + <NUM_LIT:1> ] != '<CHAR_LIT>' ) ) { folderPattern = CharOperation . subarray ( pattern , <NUM_LIT:0> , lastSlash ) ; } } } if ( CharOperation . pathMatch ( folderPattern , path , true , '<CHAR_LIT:/>' ) ) { break inclusionCheck ; } } return true ; } if ( isFolderPath ) { path = CharOperation . concat ( path , new char [ ] { '<CHAR_LIT>' } , '<CHAR_LIT:/>' ) ; } if ( exclusionPatterns != null ) { for ( int i = <NUM_LIT:0> , length = exclusionPatterns . length ; i < length ; i ++ ) { if ( CharOperation . pathMatch ( exclusionPatterns [ i ] , path , true , '<CHAR_LIT:/>' ) ) { return true ; } } } return false ; } public final static boolean isJavaFileName ( char [ ] name ) { int nameLength = name == null ? <NUM_LIT:0> : name . length ; int suffixLength = SUFFIX_JAVA . length ; if ( nameLength < suffixLength ) return false ; for ( int i = <NUM_LIT:0> , offset = nameLength - suffixLength ; i < suffixLength ; i ++ ) { char c = name [ offset + i ] ; if ( c != SUFFIX_java [ i ] && c != SUFFIX_JAVA [ i ] ) return false ; } return true ; } public final static boolean isJavaFileName ( String name ) { int nameLength = name == null ? <NUM_LIT:0> : name . length ( ) ; int suffixLength = SUFFIX_JAVA . length ; if ( nameLength < suffixLength ) return false ; for ( int i = <NUM_LIT:0> ; i < suffixLength ; i ++ ) { char c = name . charAt ( nameLength - i - <NUM_LIT:1> ) ; int suffixIndex = suffixLength - i - <NUM_LIT:1> ; if ( c != SUFFIX_java [ suffixIndex ] && c != SUFFIX_JAVA [ suffixIndex ] ) return false ; } return true ; } public static void reverseQuickSort ( char [ ] [ ] list , int left , int right ) { int original_left = left ; int original_right = right ; char [ ] mid = list [ left + ( ( right - left ) / <NUM_LIT:2> ) ] ; do { while ( CharOperation . compareTo ( list [ left ] , mid ) > <NUM_LIT:0> ) { left ++ ; } while ( CharOperation . compareTo ( mid , list [ right ] ) > <NUM_LIT:0> ) { right -- ; } if ( left <= right ) { char [ ] tmp = list [ left ] ; list [ left ] = list [ right ] ; list [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { reverseQuickSort ( list , original_left , right ) ; } if ( left < original_right ) { reverseQuickSort ( list , left , original_right ) ; } } public static void reverseQuickSort ( char [ ] [ ] list , int left , int right , int [ ] result ) { int original_left = left ; int original_right = right ; char [ ] mid = list [ left + ( ( right - left ) / <NUM_LIT:2> ) ] ; do { while ( CharOperation . compareTo ( list [ left ] , mid ) > <NUM_LIT:0> ) { left ++ ; } while ( CharOperation . compareTo ( mid , list [ right ] ) > <NUM_LIT:0> ) { right -- ; } if ( left <= right ) { char [ ] tmp = list [ left ] ; list [ left ] = list [ right ] ; list [ right ] = tmp ; int temp = result [ left ] ; result [ left ] = result [ right ] ; result [ right ] = temp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { reverseQuickSort ( list , original_left , right , result ) ; } if ( left < original_right ) { reverseQuickSort ( list , left , original_right , result ) ; } } public static final int searchColumnNumber ( int [ ] startLineIndexes , int lineNumber , int position ) { switch ( lineNumber ) { case <NUM_LIT:1> : return position + <NUM_LIT:1> ; case <NUM_LIT:2> : return position - startLineIndexes [ <NUM_LIT:0> ] ; default : int line = lineNumber - <NUM_LIT:2> ; int length = startLineIndexes . length ; if ( line >= length ) { return position - startLineIndexes [ length - <NUM_LIT:1> ] ; } return position - startLineIndexes [ line ] ; } } public static Boolean toBoolean ( boolean bool ) { if ( bool ) { return Boolean . TRUE ; } else { return Boolean . FALSE ; } } public static String toString ( Object [ ] objects ) { return toString ( objects , new Displayable ( ) { public String displayString ( Object o ) { if ( o == null ) return "<STR_LIT:null>" ; return o . toString ( ) ; } } ) ; } public static String toString ( Object [ ] objects , Displayable renderer ) { if ( objects == null ) return "<STR_LIT>" ; StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; for ( int i = <NUM_LIT:0> ; i < objects . length ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; buffer . append ( renderer . displayString ( objects [ i ] ) ) ; } return buffer . toString ( ) ; } public static void writeToDisk ( boolean generatePackagesStructure , String outputPath , String relativeFileName , ClassFile classFile ) throws IOException { FileOutputStream file = getFileOutputStream ( generatePackagesStructure , outputPath , relativeFileName ) ; BufferedOutputStream output = new BufferedOutputStream ( file , DEFAULT_WRITING_SIZE ) ; try { output . write ( classFile . header , <NUM_LIT:0> , classFile . headerOffset ) ; output . write ( classFile . contents , <NUM_LIT:0> , classFile . contentsOffset ) ; output . flush ( ) ; } catch ( IOException e ) { throw e ; } finally { output . close ( ) ; } } public static void recordNestedType ( ClassFile classFile , TypeBinding typeBinding ) { if ( classFile . visitedTypes == null ) { classFile . visitedTypes = new HashSet ( <NUM_LIT:3> ) ; } else if ( classFile . visitedTypes . contains ( typeBinding ) ) { return ; } classFile . visitedTypes . add ( typeBinding ) ; if ( typeBinding . isParameterizedType ( ) && ( ( typeBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) ) { ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) typeBinding ; ReferenceBinding genericType = parameterizedTypeBinding . genericType ( ) ; if ( ( genericType . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { recordNestedType ( classFile , genericType ) ; } TypeBinding [ ] arguments = parameterizedTypeBinding . arguments ; if ( arguments != null ) { for ( int j = <NUM_LIT:0> , max2 = arguments . length ; j < max2 ; j ++ ) { TypeBinding argument = arguments [ j ] ; if ( argument . isWildcard ( ) ) { WildcardBinding wildcardBinding = ( WildcardBinding ) argument ; TypeBinding bound = wildcardBinding . bound ; if ( bound != null && ( ( bound . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) ) { recordNestedType ( classFile , bound ) ; } ReferenceBinding superclass = wildcardBinding . superclass ( ) ; if ( superclass != null && ( ( superclass . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) ) { recordNestedType ( classFile , superclass ) ; } ReferenceBinding [ ] superInterfaces = wildcardBinding . superInterfaces ( ) ; if ( superInterfaces != null ) { for ( int k = <NUM_LIT:0> , max3 = superInterfaces . length ; k < max3 ; k ++ ) { ReferenceBinding superInterface = superInterfaces [ k ] ; if ( ( superInterface . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { recordNestedType ( classFile , superInterface ) ; } } } } else if ( ( argument . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { recordNestedType ( classFile , argument ) ; } } } } else if ( typeBinding . isTypeVariable ( ) && ( ( typeBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) typeBinding ; TypeBinding upperBound = typeVariableBinding . upperBound ( ) ; if ( upperBound != null && ( ( upperBound . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) ) { recordNestedType ( classFile , upperBound ) ; } TypeBinding [ ] upperBounds = typeVariableBinding . otherUpperBounds ( ) ; if ( upperBounds != null ) { for ( int k = <NUM_LIT:0> , max3 = upperBounds . length ; k < max3 ; k ++ ) { TypeBinding otherUpperBound = upperBounds [ k ] ; if ( ( otherUpperBound . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { recordNestedType ( classFile , otherUpperBound ) ; } } } } else if ( typeBinding . isNestedType ( ) ) { classFile . recordInnerClasses ( typeBinding ) ; } } public static File getJavaHome ( ) { String javaHome = System . getProperty ( "<STR_LIT>" ) ; if ( javaHome != null ) { File javaHomeFile = new File ( javaHome ) ; if ( javaHomeFile . exists ( ) ) { return javaHomeFile ; } } return null ; } public static void collectRunningVMBootclasspath ( List bootclasspaths ) { String javaversion = System . getProperty ( "<STR_LIT>" ) ; if ( javaversion != null && javaversion . equalsIgnoreCase ( "<STR_LIT>" ) ) { throw new IllegalStateException ( ) ; } String bootclasspathProperty = System . getProperty ( "<STR_LIT>" ) ; if ( ( bootclasspathProperty == null ) || ( bootclasspathProperty . length ( ) == <NUM_LIT:0> ) ) { bootclasspathProperty = System . getProperty ( "<STR_LIT>" ) ; if ( ( bootclasspathProperty == null ) || ( bootclasspathProperty . length ( ) == <NUM_LIT:0> ) ) { bootclasspathProperty = System . getProperty ( "<STR_LIT>" ) ; } } if ( ( bootclasspathProperty != null ) && ( bootclasspathProperty . length ( ) != <NUM_LIT:0> ) ) { StringTokenizer tokenizer = new StringTokenizer ( bootclasspathProperty , File . pathSeparator ) ; String token ; while ( tokenizer . hasMoreTokens ( ) ) { token = tokenizer . nextToken ( ) ; FileSystem . Classpath currentClasspath = FileSystem . getClasspath ( token , null , null ) ; if ( currentClasspath != null ) { bootclasspaths . add ( currentClasspath ) ; } } } else { final File javaHome = getJavaHome ( ) ; if ( javaHome != null ) { File [ ] directoriesToCheck = null ; if ( System . getProperty ( "<STR_LIT>" ) . startsWith ( "<STR_LIT>" ) ) { directoriesToCheck = new File [ ] { new File ( javaHome , "<STR_LIT>" ) , } ; } else { directoriesToCheck = new File [ ] { new File ( javaHome , "<STR_LIT>" ) } ; } File [ ] [ ] systemLibrariesJars = Main . getLibrariesFiles ( directoriesToCheck ) ; if ( systemLibrariesJars != null ) { for ( int i = <NUM_LIT:0> , max = systemLibrariesJars . length ; i < max ; i ++ ) { File [ ] current = systemLibrariesJars [ i ] ; if ( current != null ) { for ( int j = <NUM_LIT:0> , max2 = current . length ; j < max2 ; j ++ ) { FileSystem . Classpath classpath = FileSystem . getClasspath ( current [ j ] . getAbsolutePath ( ) , null , false , null , null ) ; if ( classpath != null ) { bootclasspaths . add ( classpath ) ; } } } } } } } } public static int getParameterCount ( char [ ] methodSignature ) { 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 scanTypeSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case C_ARRAY : return scanArrayTypeSignature ( string , start ) ; case C_RESOLVED : case C_UNRESOLVED : return scanClassTypeSignature ( string , start ) ; case C_TYPE_VARIABLE : return scanTypeVariableSignature ( string , start ) ; 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 scanBaseTypeSignature ( string , start ) ; case C_CAPTURE : return scanCaptureTypeSignature ( string , start ) ; case C_EXTENDS : case C_SUPER : case C_STAR : return scanTypeBoundSignature ( string , start ) ; default : throw new IllegalArgumentException ( ) ; } } public static int scanBaseTypeSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( "<STR_LIT>" . indexOf ( c ) >= <NUM_LIT:0> ) { return start ; } else { throw new IllegalArgumentException ( ) ; } } public static int scanArrayTypeSignature ( char [ ] string , int start ) { int length = string . length ; if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_ARRAY ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ start ] ; while ( c == C_ARRAY ) { if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ start ] ; } return scanTypeSignature ( string , start ) ; } public static int scanCaptureTypeSignature ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_CAPTURE ) { throw new IllegalArgumentException ( ) ; } return scanTypeBoundSignature ( string , start + <NUM_LIT:1> ) ; } public static int scanTypeVariableSignature ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_TYPE_VARIABLE ) { throw new IllegalArgumentException ( ) ; } int id = scanIdentifier ( string , start + <NUM_LIT:1> ) ; c = string [ id + <NUM_LIT:1> ] ; if ( c == C_SEMICOLON ) { return id + <NUM_LIT:1> ; } else { throw new IllegalArgumentException ( ) ; } } public static int scanIdentifier ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } int p = start ; while ( true ) { char c = string [ p ] ; if ( c == '<CHAR_LIT>' || c == '<CHAR_LIT:>>' || c == '<CHAR_LIT::>' || c == '<CHAR_LIT:;>' || c == '<CHAR_LIT:.>' || c == '<CHAR_LIT:/>' ) { return p - <NUM_LIT:1> ; } p ++ ; if ( p == string . length ) { return p - <NUM_LIT:1> ; } } } public static int scanClassTypeSignature ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_RESOLVED && c != C_UNRESOLVED ) { return - <NUM_LIT:1> ; } int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; if ( c == C_SEMICOLON ) { return p ; } else if ( c == C_GENERIC_START ) { int e = scanTypeArgumentSignatures ( string , p ) ; p = e ; } else if ( c == C_DOT || c == '<CHAR_LIT:/>' ) { int id = scanIdentifier ( string , p + <NUM_LIT:1> ) ; p = id ; } p ++ ; } } public static int scanTypeBoundSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case C_STAR : return start ; case C_SUPER : case C_EXTENDS : if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } break ; default : throw new IllegalArgumentException ( ) ; } c = string [ ++ start ] ; switch ( c ) { case C_CAPTURE : return scanCaptureTypeSignature ( string , start ) ; case C_SUPER : case C_EXTENDS : return scanTypeBoundSignature ( string , start ) ; case C_RESOLVED : case C_UNRESOLVED : return scanClassTypeSignature ( string , start ) ; case C_TYPE_VARIABLE : return scanTypeVariableSignature ( string , start ) ; case C_ARRAY : return scanArrayTypeSignature ( string , start ) ; case C_STAR : return start ; default : throw new IllegalArgumentException ( ) ; } } public static int scanTypeArgumentSignatures ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_GENERIC_START ) { throw new IllegalArgumentException ( ) ; } int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; if ( c == C_GENERIC_END ) { return p ; } int e = scanTypeArgumentSignature ( string , p ) ; p = e + <NUM_LIT:1> ; } } public static int scanTypeArgumentSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case C_STAR : return start ; case C_EXTENDS : case C_SUPER : return scanTypeBoundSignature ( string , start ) ; default : return scanTypeSignature ( string , start ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class SimpleNameVector { static int INITIAL_SIZE = <NUM_LIT:10> ; public int size ; int maxSize ; char [ ] [ ] elements ; public SimpleNameVector ( ) { this . maxSize = INITIAL_SIZE ; this . size = <NUM_LIT:0> ; this . elements = new char [ this . maxSize ] [ ] ; } public void add ( char [ ] newElement ) { if ( this . size == this . maxSize ) System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new char [ this . maxSize *= <NUM_LIT:2> ] [ ] ) , <NUM_LIT:0> , this . size ) ; this . elements [ this . size ++ ] = newElement ; } public void addAll ( char [ ] [ ] newElements ) { if ( this . size + newElements . length >= this . maxSize ) { this . maxSize = this . size + newElements . length ; System . arraycopy ( this . elements , <NUM_LIT:0> , ( this . elements = new char [ this . maxSize ] [ ] ) , <NUM_LIT:0> , this . size ) ; } System . arraycopy ( newElements , <NUM_LIT:0> , this . elements , this . size , newElements . length ) ; this . size += newElements . length ; } public void copyInto ( Object [ ] targetArray ) { System . arraycopy ( this . elements , <NUM_LIT:0> , targetArray , <NUM_LIT:0> , this . size ) ; } public boolean contains ( char [ ] element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( CharOperation . equals ( element , this . elements [ i ] ) ) return true ; return false ; } public char [ ] elementAt ( int index ) { return this . elements [ index ] ; } public char [ ] remove ( char [ ] element ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) if ( element == this . elements [ i ] ) { System . arraycopy ( this . elements , i + <NUM_LIT:1> , this . elements , i , -- this . size - i ) ; this . elements [ this . size ] = null ; return element ; } return null ; } public void removeAll ( ) { for ( int i = this . size ; -- i >= <NUM_LIT:0> ; ) this . elements [ i ] = null ; this . size = <NUM_LIT:0> ; } public int size ( ) { return this . size ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < this . size ; i ++ ) { buffer . append ( this . elements [ i ] ) . append ( "<STR_LIT:n>" ) ; } return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . io . Writer ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Map ; public class GenericXMLWriter extends PrintWriter { private static final String XML_VERSION = "<STR_LIT>" ; private static void appendEscapedChar ( StringBuffer buffer , char c ) { String replacement = getReplacement ( c ) ; if ( replacement != null ) { buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( replacement ) ; buffer . append ( '<CHAR_LIT:;>' ) ; } else { buffer . append ( c ) ; } } private static String getEscaped ( String s ) { StringBuffer result = new StringBuffer ( s . length ( ) + <NUM_LIT:10> ) ; for ( int i = <NUM_LIT:0> ; i < s . length ( ) ; ++ i ) appendEscapedChar ( result , s . charAt ( i ) ) ; return result . toString ( ) ; } private static String getReplacement ( char c ) { switch ( c ) { case '<CHAR_LIT>' : return "<STR_LIT>" ; case '<CHAR_LIT:>>' : return "<STR_LIT>" ; case '<CHAR_LIT:">' : return "<STR_LIT>" ; case '<STR_LIT>' : return "<STR_LIT>" ; case '<CHAR_LIT>' : return "<STR_LIT>" ; } return null ; } private String lineSeparator ; private int tab ; public GenericXMLWriter ( OutputStream stream , String lineSeparator , boolean printXmlVersion ) { this ( new PrintWriter ( stream ) , lineSeparator , printXmlVersion ) ; } public GenericXMLWriter ( Writer writer , String lineSeparator , boolean printXmlVersion ) { super ( writer ) ; this . tab = <NUM_LIT:0> ; this . lineSeparator = lineSeparator ; if ( printXmlVersion ) { print ( XML_VERSION ) ; print ( this . lineSeparator ) ; } } public void endTag ( String name , boolean insertTab , boolean insertNewLine ) { this . tab -- ; printTag ( '<CHAR_LIT:/>' + name , null , insertTab , insertNewLine , false ) ; } public void printString ( String string , boolean insertTab , boolean insertNewLine ) { if ( insertTab ) { printTabulation ( ) ; } print ( string ) ; if ( insertNewLine ) { print ( this . lineSeparator ) ; } } private void printTabulation ( ) { for ( int i = <NUM_LIT:0> ; i < this . tab ; i ++ ) this . print ( '<STR_LIT:\t>' ) ; } public void printTag ( String name , HashMap parameters , boolean insertTab , boolean insertNewLine , boolean closeTag ) { if ( insertTab ) { printTabulation ( ) ; } this . print ( '<CHAR_LIT>' ) ; this . print ( name ) ; if ( parameters != null ) { int length = parameters . size ( ) ; Map . Entry [ ] entries = new Map . Entry [ length ] ; parameters . entrySet ( ) . toArray ( entries ) ; Arrays . sort ( entries , new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { Map . Entry entry1 = ( Map . Entry ) o1 ; Map . Entry entry2 = ( Map . Entry ) o2 ; return ( ( String ) entry1 . getKey ( ) ) . compareTo ( ( String ) entry2 . getKey ( ) ) ; } } ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . print ( '<CHAR_LIT:U+0020>' ) ; this . print ( entries [ i ] . getKey ( ) ) ; this . print ( "<STR_LIT>" ) ; this . print ( getEscaped ( String . valueOf ( entries [ i ] . getValue ( ) ) ) ) ; this . print ( '<STR_LIT:\">' ) ; } } if ( closeTag ) { this . print ( "<STR_LIT>" ) ; } else { this . print ( "<STR_LIT:>>" ) ; } if ( insertNewLine ) { print ( this . lineSeparator ) ; } if ( parameters != null && ! closeTag ) this . tab ++ ; } public void startTag ( String name , boolean insertTab ) { printTag ( name , null , insertTab , true , false ) ; this . tab ++ ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class HashtableOfObject implements Cloneable { public char [ ] keyTable [ ] ; public Object valueTable [ ] ; public int elementSize ; int threshold ; public HashtableOfObject ( ) { this ( <NUM_LIT> ) ; } public HashtableOfObject ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new char [ extraRoom ] [ ] ; this . valueTable = new Object [ extraRoom ] ; } public void clear ( ) { for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) { this . keyTable [ i ] = null ; this . valueTable [ i ] = null ; } this . elementSize = <NUM_LIT:0> ; } public Object clone ( ) throws CloneNotSupportedException { HashtableOfObject result = ( HashtableOfObject ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new char [ length ] [ ] ; System . arraycopy ( this . keyTable , <NUM_LIT:0> , result . keyTable , <NUM_LIT:0> , length ) ; length = this . valueTable . length ; result . valueTable = new Object [ length ] ; System . arraycopy ( this . valueTable , <NUM_LIT:0> , result . valueTable , <NUM_LIT:0> , length ) ; return result ; } public boolean containsKey ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public Object get ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public Object put ( char [ ] key , Object value ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } public void putUnsafely ( char [ ] key , Object value ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; while ( this . keyTable [ index ] != null ) { if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) { rehash ( ) ; } } public Object removeKey ( char [ ] key ) { int length = this . keyTable . length , index = CharOperation . hashCode ( key ) % length ; int keyLength = key . length ; char [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && CharOperation . equals ( currentKey , key ) ) { Object value = this . valueTable [ index ] ; this . elementSize -- ; this . keyTable [ index ] = null ; this . valueTable [ index ] = null ; rehash ( ) ; return value ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { HashtableOfObject newHashtable = new HashtableOfObject ( this . elementSize * <NUM_LIT:2> ) ; char [ ] currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . putUnsafely ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { String s = "<STR_LIT>" ; Object object ; for ( int i = <NUM_LIT:0> , length = this . valueTable . length ; i < length ; i ++ ) if ( ( object = this . valueTable [ i ] ) != null ) s += new String ( this . keyTable [ i ] ) + "<STR_LIT>" + object . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class SimpleSet implements Cloneable { public Object [ ] values ; public int elementSize ; public int threshold ; public SimpleSet ( ) { this ( <NUM_LIT> ) ; } public SimpleSet ( int size ) { if ( size < <NUM_LIT:3> ) size = <NUM_LIT:3> ; this . elementSize = <NUM_LIT:0> ; this . threshold = size + <NUM_LIT:1> ; this . values = new Object [ <NUM_LIT:2> * size + <NUM_LIT:1> ] ; } public Object add ( Object object ) { int length = this . values . length ; int index = ( object . hashCode ( ) & <NUM_LIT> ) % length ; Object current ; while ( ( current = this . values [ index ] ) != null ) { if ( current . equals ( object ) ) return this . values [ index ] = object ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . values [ index ] = object ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return object ; } public Object addIfNotIncluded ( Object object ) { int length = this . values . length ; int index = ( object . hashCode ( ) & <NUM_LIT> ) % length ; Object current ; while ( ( current = this . values [ index ] ) != null ) { if ( current . equals ( object ) ) return null ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . values [ index ] = object ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return object ; } public void asArray ( Object [ ] copy ) { if ( this . elementSize != copy . length ) throw new IllegalArgumentException ( ) ; int index = this . elementSize ; for ( int i = <NUM_LIT:0> , l = this . values . length ; i < l && index > <NUM_LIT:0> ; i ++ ) if ( this . values [ i ] != null ) copy [ -- index ] = this . values [ i ] ; } public void clear ( ) { for ( int i = this . values . length ; -- i >= <NUM_LIT:0> ; ) this . values [ i ] = null ; this . elementSize = <NUM_LIT:0> ; } public Object clone ( ) throws CloneNotSupportedException { SimpleSet result = ( SimpleSet ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . values . length ; result . values = new Object [ length ] ; System . arraycopy ( this . values , <NUM_LIT:0> , result . values , <NUM_LIT:0> , length ) ; return result ; } public boolean includes ( Object object ) { int length = this . values . length ; int index = ( object . hashCode ( ) & <NUM_LIT> ) % length ; Object current ; while ( ( current = this . values [ index ] ) != null ) { if ( current . equals ( object ) ) return true ; if ( ++ index == length ) index = <NUM_LIT:0> ; } return false ; } public Object remove ( Object object ) { int length = this . values . length ; int index = ( object . hashCode ( ) & <NUM_LIT> ) % length ; Object current ; while ( ( current = this . values [ index ] ) != null ) { if ( current . equals ( object ) ) { this . elementSize -- ; Object oldValue = this . values [ index ] ; this . values [ index ] = null ; if ( this . values [ index + <NUM_LIT:1> == length ? <NUM_LIT:0> : index + <NUM_LIT:1> ] != null ) rehash ( ) ; return oldValue ; } if ( ++ index == length ) index = <NUM_LIT:0> ; } return null ; } private void rehash ( ) { SimpleSet newSet = new SimpleSet ( this . elementSize * <NUM_LIT:2> ) ; Object current ; for ( int i = this . values . length ; -- i >= <NUM_LIT:0> ; ) if ( ( current = this . values [ i ] ) != null ) newSet . add ( current ) ; this . values = newSet . values ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } public String toString ( ) { String s = "<STR_LIT>" ; Object object ; for ( int i = <NUM_LIT:0> , l = this . values . length ; i < l ; i ++ ) if ( ( object = this . values [ i ] ) != null ) s += object . toString ( ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import java . io . IOException ; import java . io . InputStream ; import java . lang . reflect . Field ; import java . lang . reflect . Modifier ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Locale ; import java . util . Map ; import java . util . Properties ; public final class Messages { private static class MessagesProperties extends Properties { private static final int MOD_EXPECTED = Modifier . PUBLIC | Modifier . STATIC ; private static final int MOD_MASK = MOD_EXPECTED | Modifier . FINAL ; private static final long serialVersionUID = <NUM_LIT:1L> ; private final Map fields ; public MessagesProperties ( Field [ ] fieldArray , String bundleName ) { super ( ) ; final int len = fieldArray . length ; this . fields = new HashMap ( len * <NUM_LIT:2> ) ; for ( int i = <NUM_LIT:0> ; i < len ; i ++ ) { this . fields . put ( fieldArray [ i ] . getName ( ) , fieldArray [ i ] ) ; } } public synchronized Object put ( Object key , Object value ) { try { Field field = ( Field ) this . fields . get ( key ) ; if ( field == null ) { return null ; } if ( ( field . getModifiers ( ) & MOD_MASK ) != MOD_EXPECTED ) return null ; try { field . set ( null , value ) ; } catch ( Exception e ) { } } catch ( SecurityException e ) { } return null ; } } private static String [ ] nlSuffixes ; private static final String EXTENSION = "<STR_LIT>" ; private static final String BUNDLE_NAME = "<STR_LIT>" ; private Messages ( ) { } public static String compilation_unresolvedProblem ; public static String compilation_unresolvedProblems ; public static String compilation_request ; public static String compilation_loadBinary ; public static String compilation_process ; public static String compilation_write ; public static String compilation_done ; public static String compilation_units ; public static String compilation_unit ; public static String compilation_internalError ; public static String compilation_beginningToCompile ; public static String compilation_processing ; public static String output_isFile ; public static String output_notValidAll ; public static String output_notValid ; public static String problem_noSourceInformation ; public static String problem_atLine ; public static String abort_invalidAttribute ; public static String abort_invalidExceptionAttribute ; public static String abort_invalidOpcode ; public static String abort_missingCode ; public static String abort_againstSourceModel ; public static String accept_cannot ; public static String parser_incorrectPath ; public static String parser_moveFiles ; public static String parser_syntaxRecovery ; public static String parser_regularParse ; public static String parser_missingFile ; public static String parser_corruptedFile ; public static String parser_endOfFile ; public static String parser_endOfConstructor ; public static String parser_endOfMethod ; public static String parser_endOfInitializer ; public static String ast_missingCode ; public static String constant_cannotCastedInto ; public static String constant_cannotConvertedTo ; static { initializeMessages ( BUNDLE_NAME , Messages . class ) ; } public static String bind ( String message ) { return bind ( message , null ) ; } public static String bind ( String message , Object binding ) { return bind ( message , new Object [ ] { binding } ) ; } public static String bind ( String message , Object binding1 , Object binding2 ) { return bind ( message , new Object [ ] { binding1 , binding2 } ) ; } public static String bind ( String message , Object [ ] bindings ) { return MessageFormat . format ( message , bindings ) ; } private static String [ ] buildVariants ( String root ) { if ( nlSuffixes == null ) { String nl = Locale . getDefault ( ) . toString ( ) ; ArrayList result = new ArrayList ( <NUM_LIT:4> ) ; int lastSeparator ; while ( true ) { result . add ( '<CHAR_LIT:_>' + nl + EXTENSION ) ; lastSeparator = nl . lastIndexOf ( '<CHAR_LIT:_>' ) ; if ( lastSeparator == - <NUM_LIT:1> ) break ; nl = nl . substring ( <NUM_LIT:0> , lastSeparator ) ; } result . add ( EXTENSION ) ; nlSuffixes = ( String [ ] ) result . toArray ( new String [ result . size ( ) ] ) ; } root = root . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; String [ ] variants = new String [ nlSuffixes . length ] ; for ( int i = <NUM_LIT:0> ; i < variants . length ; i ++ ) variants [ i ] = root + nlSuffixes [ i ] ; return variants ; } public static void initializeMessages ( String bundleName , Class clazz ) { final Field [ ] fields = clazz . getDeclaredFields ( ) ; load ( bundleName , clazz . getClassLoader ( ) , fields ) ; final int MOD_EXPECTED = Modifier . PUBLIC | Modifier . STATIC ; final int MOD_MASK = MOD_EXPECTED | Modifier . FINAL ; final int numFields = fields . length ; for ( int i = <NUM_LIT:0> ; i < numFields ; i ++ ) { Field field = fields [ i ] ; if ( ( field . getModifiers ( ) & MOD_MASK ) != MOD_EXPECTED ) continue ; try { if ( field . get ( clazz ) == null ) { String value = "<STR_LIT>" + field . getName ( ) + "<STR_LIT>" + bundleName ; field . set ( null , value ) ; } } catch ( IllegalArgumentException e ) { } catch ( IllegalAccessException e ) { } } } public static void load ( final String bundleName , final ClassLoader loader , final Field [ ] fields ) { final String [ ] variants = buildVariants ( bundleName ) ; for ( int i = variants . length ; -- i >= <NUM_LIT:0> ; ) { InputStream input = ( loader == null ) ? ClassLoader . getSystemResourceAsStream ( variants [ i ] ) : loader . getResourceAsStream ( variants [ i ] ) ; if ( input == null ) continue ; try { final MessagesProperties properties = new MessagesProperties ( fields , bundleName ) ; properties . load ( input ) ; } catch ( IOException e ) { } finally { try { input . close ( ) ; } catch ( IOException e ) { } } } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; public final class HashtableOfObjectToIntArray implements Cloneable { public Object [ ] keyTable ; public int [ ] [ ] valueTable ; public int elementSize ; int threshold ; public HashtableOfObjectToIntArray ( ) { this ( <NUM_LIT> ) ; } public HashtableOfObjectToIntArray ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new Object [ extraRoom ] ; this . valueTable = new int [ extraRoom ] [ ] ; } public Object clone ( ) throws CloneNotSupportedException { HashtableOfObjectToIntArray result = ( HashtableOfObjectToIntArray ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new Object [ length ] ; System . arraycopy ( this . keyTable , <NUM_LIT:0> , result . keyTable , <NUM_LIT:0> , length ) ; length = this . valueTable . length ; result . valueTable = new int [ length ] [ ] ; System . arraycopy ( this . valueTable , <NUM_LIT:0> , result . valueTable , <NUM_LIT:0> , length ) ; return result ; } public boolean containsKey ( Object key ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public int [ ] get ( Object key ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public void keysToArray ( Object [ ] array ) { int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . keyTable . length ; i < length ; i ++ ) { if ( this . keyTable [ i ] != null ) array [ index ++ ] = this . keyTable [ i ] ; } } public int [ ] put ( Object key , int [ ] value ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } public int [ ] removeKey ( Object key ) { int length = this . keyTable . length , index = ( key . hashCode ( ) & <NUM_LIT> ) % length ; Object currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . equals ( key ) ) { int [ ] value = this . valueTable [ index ] ; this . elementSize -- ; this . keyTable [ index ] = null ; rehash ( ) ; return value ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { HashtableOfObjectToIntArray newHashtable = new HashtableOfObjectToIntArray ( this . elementSize * <NUM_LIT:2> ) ; Object currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; Object key ; for ( int i = <NUM_LIT:0> , length = this . keyTable . length ; i < length ; i ++ ) { if ( ( key = this . keyTable [ i ] ) != null ) { buffer . append ( key ) . append ( "<STR_LIT>" ) ; int [ ] ints = this . valueTable [ i ] ; buffer . append ( '<CHAR_LIT:[>' ) ; if ( ints != null ) { for ( int j = <NUM_LIT:0> , max = ints . length ; j < max ; j ++ ) { if ( j > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( ints [ j ] ) ; } } buffer . append ( "<STR_LIT>" ) ; } } return String . valueOf ( buffer ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class SimpleSetOfCharArray implements Cloneable { public char [ ] [ ] values ; public int elementSize ; public int threshold ; public SimpleSetOfCharArray ( ) { this ( <NUM_LIT> ) ; } public SimpleSetOfCharArray ( int size ) { if ( size < <NUM_LIT:3> ) size = <NUM_LIT:3> ; this . elementSize = <NUM_LIT:0> ; this . threshold = size + <NUM_LIT:1> ; this . values = new char [ <NUM_LIT:2> * size + <NUM_LIT:1> ] [ ] ; } public Object add ( char [ ] object ) { int length = this . values . length ; int index = ( CharOperation . hashCode ( object ) & <NUM_LIT> ) % length ; char [ ] current ; while ( ( current = this . values [ index ] ) != null ) { if ( CharOperation . equals ( current , object ) ) return this . values [ index ] = object ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . values [ index ] = object ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return object ; } public void asArray ( Object [ ] copy ) { if ( this . elementSize != copy . length ) throw new IllegalArgumentException ( ) ; int index = this . elementSize ; for ( int i = <NUM_LIT:0> , l = this . values . length ; i < l && index > <NUM_LIT:0> ; i ++ ) if ( this . values [ i ] != null ) copy [ -- index ] = this . values [ i ] ; } public void clear ( ) { for ( int i = this . values . length ; -- i >= <NUM_LIT:0> ; ) this . values [ i ] = null ; this . elementSize = <NUM_LIT:0> ; } public Object clone ( ) throws CloneNotSupportedException { SimpleSetOfCharArray result = ( SimpleSetOfCharArray ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . values . length ; result . values = new char [ length ] [ ] ; System . arraycopy ( this . values , <NUM_LIT:0> , result . values , <NUM_LIT:0> , length ) ; return result ; } public char [ ] get ( char [ ] object ) { int length = this . values . length ; int index = ( CharOperation . hashCode ( object ) & <NUM_LIT> ) % length ; char [ ] current ; while ( ( current = this . values [ index ] ) != null ) { if ( CharOperation . equals ( current , object ) ) return current ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . values [ index ] = object ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return object ; } public boolean includes ( char [ ] object ) { int length = this . values . length ; int index = ( CharOperation . hashCode ( object ) & <NUM_LIT> ) % length ; char [ ] current ; while ( ( current = this . values [ index ] ) != null ) { if ( CharOperation . equals ( current , object ) ) return true ; if ( ++ index == length ) index = <NUM_LIT:0> ; } return false ; } public char [ ] remove ( char [ ] object ) { int length = this . values . length ; int index = ( CharOperation . hashCode ( object ) & <NUM_LIT> ) % length ; char [ ] current ; while ( ( current = this . values [ index ] ) != null ) { if ( CharOperation . equals ( current , object ) ) { this . elementSize -- ; char [ ] oldValue = this . values [ index ] ; this . values [ index ] = null ; if ( this . values [ index + <NUM_LIT:1> == length ? <NUM_LIT:0> : index + <NUM_LIT:1> ] != null ) rehash ( ) ; return oldValue ; } if ( ++ index == length ) index = <NUM_LIT:0> ; } return null ; } private void rehash ( ) { SimpleSetOfCharArray newSet = new SimpleSetOfCharArray ( this . elementSize * <NUM_LIT:2> ) ; char [ ] current ; for ( int i = this . values . length ; -- i >= <NUM_LIT:0> ; ) if ( ( current = this . values [ i ] ) != null ) newSet . add ( current ) ; this . values = newSet . values ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } public String toString ( ) { String s = "<STR_LIT>" ; char [ ] object ; for ( int i = <NUM_LIT:0> , l = this . values . length ; i < l ; i ++ ) if ( ( object = this . values [ i ] ) != null ) s += new String ( object ) + "<STR_LIT:n>" ; return s ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; public abstract class ASTVisitor { public void acceptProblem ( IProblem problem ) { } public void endVisit ( AllocationExpression allocationExpression , BlockScope scope ) { } public void endVisit ( AND_AND_Expression and_and_Expression , BlockScope scope ) { } public void endVisit ( AnnotationMethodDeclaration annotationTypeDeclaration , ClassScope classScope ) { } public void endVisit ( Argument argument , BlockScope scope ) { } public void endVisit ( Argument argument , ClassScope scope ) { } public void endVisit ( ArrayAllocationExpression arrayAllocationExpression , BlockScope scope ) { } public void endVisit ( ArrayInitializer arrayInitializer , BlockScope scope ) { } public void endVisit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , BlockScope scope ) { } public void endVisit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , ClassScope scope ) { } public void endVisit ( ArrayReference arrayReference , BlockScope scope ) { } public void endVisit ( ArrayTypeReference arrayTypeReference , BlockScope scope ) { } public void endVisit ( ArrayTypeReference arrayTypeReference , ClassScope scope ) { } public void endVisit ( AssertStatement assertStatement , BlockScope scope ) { } public void endVisit ( Assignment assignment , BlockScope scope ) { } public void endVisit ( BinaryExpression binaryExpression , BlockScope scope ) { } public void endVisit ( Block block , BlockScope scope ) { } public void endVisit ( BreakStatement breakStatement , BlockScope scope ) { } public void endVisit ( CaseStatement caseStatement , BlockScope scope ) { } public void endVisit ( CastExpression castExpression , BlockScope scope ) { } public void endVisit ( CharLiteral charLiteral , BlockScope scope ) { } public void endVisit ( ClassLiteralAccess classLiteral , BlockScope scope ) { } public void endVisit ( Clinit clinit , ClassScope scope ) { } public void endVisit ( CompilationUnitDeclaration compilationUnitDeclaration , CompilationUnitScope scope ) { } public void endVisit ( CompoundAssignment compoundAssignment , BlockScope scope ) { } public void endVisit ( ConditionalExpression conditionalExpression , BlockScope scope ) { } public void endVisit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { } public void endVisit ( ContinueStatement continueStatement , BlockScope scope ) { } public void endVisit ( DoStatement doStatement , BlockScope scope ) { } public void endVisit ( DoubleLiteral doubleLiteral , BlockScope scope ) { } public void endVisit ( EmptyStatement emptyStatement , BlockScope scope ) { } public void endVisit ( EqualExpression equalExpression , BlockScope scope ) { } public void endVisit ( ExplicitConstructorCall explicitConstructor , BlockScope scope ) { } public void endVisit ( ExtendedStringLiteral extendedStringLiteral , BlockScope scope ) { } public void endVisit ( FalseLiteral falseLiteral , BlockScope scope ) { } public void endVisit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { } public void endVisit ( FieldReference fieldReference , BlockScope scope ) { } public void endVisit ( FieldReference fieldReference , ClassScope scope ) { } public void endVisit ( FloatLiteral floatLiteral , BlockScope scope ) { } public void endVisit ( ForeachStatement forStatement , BlockScope scope ) { } public void endVisit ( ForStatement forStatement , BlockScope scope ) { } public void endVisit ( IfStatement ifStatement , BlockScope scope ) { } public void endVisit ( ImportReference importRef , CompilationUnitScope scope ) { } public void endVisit ( Initializer initializer , MethodScope scope ) { } public void endVisit ( InstanceOfExpression instanceOfExpression , BlockScope scope ) { } public void endVisit ( IntLiteral intLiteral , BlockScope scope ) { } public void endVisit ( Javadoc javadoc , BlockScope scope ) { } public void endVisit ( Javadoc javadoc , ClassScope scope ) { } public void endVisit ( JavadocAllocationExpression expression , BlockScope scope ) { } public void endVisit ( JavadocAllocationExpression expression , ClassScope scope ) { } public void endVisit ( JavadocArgumentExpression expression , BlockScope scope ) { } public void endVisit ( JavadocArgumentExpression expression , ClassScope scope ) { } public void endVisit ( JavadocArrayQualifiedTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocArrayQualifiedTypeReference typeRef , ClassScope scope ) { } public void endVisit ( JavadocArraySingleTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocArraySingleTypeReference typeRef , ClassScope scope ) { } public void endVisit ( JavadocFieldReference fieldRef , BlockScope scope ) { } public void endVisit ( JavadocFieldReference fieldRef , ClassScope scope ) { } public void endVisit ( JavadocImplicitTypeReference implicitTypeReference , BlockScope scope ) { } public void endVisit ( JavadocImplicitTypeReference implicitTypeReference , ClassScope scope ) { } public void endVisit ( JavadocMessageSend messageSend , BlockScope scope ) { } public void endVisit ( JavadocMessageSend messageSend , ClassScope scope ) { } public void endVisit ( JavadocQualifiedTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocQualifiedTypeReference typeRef , ClassScope scope ) { } public void endVisit ( JavadocReturnStatement statement , BlockScope scope ) { } public void endVisit ( JavadocReturnStatement statement , ClassScope scope ) { } public void endVisit ( JavadocSingleNameReference argument , BlockScope scope ) { } public void endVisit ( JavadocSingleNameReference argument , ClassScope scope ) { } public void endVisit ( JavadocSingleTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocSingleTypeReference typeRef , ClassScope scope ) { } public void endVisit ( LabeledStatement labeledStatement , BlockScope scope ) { } public void endVisit ( LocalDeclaration localDeclaration , BlockScope scope ) { } public void endVisit ( LongLiteral longLiteral , BlockScope scope ) { } public void endVisit ( MarkerAnnotation annotation , BlockScope scope ) { } public void endVisit ( MemberValuePair pair , BlockScope scope ) { } public void endVisit ( MessageSend messageSend , BlockScope scope ) { } public void endVisit ( MethodDeclaration methodDeclaration , ClassScope scope ) { } public void endVisit ( StringLiteralConcatenation literal , BlockScope scope ) { } public void endVisit ( NormalAnnotation annotation , BlockScope scope ) { } public void endVisit ( NullLiteral nullLiteral , BlockScope scope ) { } public void endVisit ( OR_OR_Expression or_or_Expression , BlockScope scope ) { } public void endVisit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , BlockScope scope ) { } public void endVisit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , ClassScope scope ) { } public void endVisit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , BlockScope scope ) { } public void endVisit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , ClassScope scope ) { } public void endVisit ( PostfixExpression postfixExpression , BlockScope scope ) { } public void endVisit ( PrefixExpression prefixExpression , BlockScope scope ) { } public void endVisit ( QualifiedAllocationExpression qualifiedAllocationExpression , BlockScope scope ) { } public void endVisit ( QualifiedNameReference qualifiedNameReference , BlockScope scope ) { } public void endVisit ( QualifiedNameReference qualifiedNameReference , ClassScope scope ) { } public void endVisit ( QualifiedSuperReference qualifiedSuperReference , BlockScope scope ) { } public void endVisit ( QualifiedSuperReference qualifiedSuperReference , ClassScope scope ) { } public void endVisit ( QualifiedThisReference qualifiedThisReference , BlockScope scope ) { } public void endVisit ( QualifiedThisReference qualifiedThisReference , ClassScope scope ) { } public void endVisit ( QualifiedTypeReference qualifiedTypeReference , BlockScope scope ) { } public void endVisit ( QualifiedTypeReference qualifiedTypeReference , ClassScope scope ) { } public void endVisit ( ReturnStatement returnStatement , BlockScope scope ) { } public void endVisit ( SingleMemberAnnotation annotation , BlockScope scope ) { } public void endVisit ( SingleNameReference singleNameReference , BlockScope scope ) { } public void endVisit ( SingleNameReference singleNameReference , ClassScope scope ) { } public void endVisit ( SingleTypeReference singleTypeReference , BlockScope scope ) { } public void endVisit ( SingleTypeReference singleTypeReference , ClassScope scope ) { } public void endVisit ( StringLiteral stringLiteral , BlockScope scope ) { } public void endVisit ( SuperReference superReference , BlockScope scope ) { } public void endVisit ( SwitchStatement switchStatement , BlockScope scope ) { } public void endVisit ( SynchronizedStatement synchronizedStatement , BlockScope scope ) { } public void endVisit ( ThisReference thisReference , BlockScope scope ) { } public void endVisit ( ThisReference thisReference , ClassScope scope ) { } public void endVisit ( ThrowStatement throwStatement , BlockScope scope ) { } public void endVisit ( TrueLiteral trueLiteral , BlockScope scope ) { } public void endVisit ( TryStatement tryStatement , BlockScope scope ) { } public void endVisit ( TypeDeclaration localTypeDeclaration , BlockScope scope ) { } public void endVisit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { } public void endVisit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { } public void endVisit ( TypeParameter typeParameter , BlockScope scope ) { } public void endVisit ( TypeParameter typeParameter , ClassScope scope ) { } public void endVisit ( UnaryExpression unaryExpression , BlockScope scope ) { } public void endVisit ( UnionTypeReference unionTypeReference , BlockScope scope ) { } public void endVisit ( UnionTypeReference unionTypeReference , ClassScope scope ) { } public void endVisit ( WhileStatement whileStatement , BlockScope scope ) { } public void endVisit ( Wildcard wildcard , BlockScope scope ) { } public void endVisit ( Wildcard wildcard , ClassScope scope ) { } public boolean visit ( AllocationExpression allocationExpression , BlockScope scope ) { return true ; } public boolean visit ( AND_AND_Expression and_and_Expression , BlockScope scope ) { return true ; } public boolean visit ( AnnotationMethodDeclaration annotationTypeDeclaration , ClassScope classScope ) { return true ; } public boolean visit ( Argument argument , BlockScope scope ) { return true ; } public boolean visit ( Argument argument , ClassScope scope ) { return true ; } public boolean visit ( ArrayAllocationExpression arrayAllocationExpression , BlockScope scope ) { return true ; } public boolean visit ( ArrayInitializer arrayInitializer , BlockScope scope ) { return true ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , ClassScope scope ) { return true ; } public boolean visit ( ArrayReference arrayReference , BlockScope scope ) { return true ; } public boolean visit ( ArrayTypeReference arrayTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ArrayTypeReference arrayTypeReference , ClassScope scope ) { return true ; } public boolean visit ( AssertStatement assertStatement , BlockScope scope ) { return true ; } public boolean visit ( Assignment assignment , BlockScope scope ) { return true ; } public boolean visit ( BinaryExpression binaryExpression , BlockScope scope ) { return true ; } public boolean visit ( Block block , BlockScope scope ) { return true ; } public boolean visit ( BreakStatement breakStatement , BlockScope scope ) { return true ; } public boolean visit ( CaseStatement caseStatement , BlockScope scope ) { return true ; } public boolean visit ( CastExpression castExpression , BlockScope scope ) { return true ; } public boolean visit ( CharLiteral charLiteral , BlockScope scope ) { return true ; } public boolean visit ( ClassLiteralAccess classLiteral , BlockScope scope ) { return true ; } public boolean visit ( Clinit clinit , ClassScope scope ) { return true ; } public boolean visit ( CompilationUnitDeclaration compilationUnitDeclaration , CompilationUnitScope scope ) { return true ; } public boolean visit ( CompoundAssignment compoundAssignment , BlockScope scope ) { return true ; } public boolean visit ( ConditionalExpression conditionalExpression , BlockScope scope ) { return true ; } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { return true ; } public boolean visit ( ContinueStatement continueStatement , BlockScope scope ) { return true ; } public boolean visit ( DoStatement doStatement , BlockScope scope ) { return true ; } public boolean visit ( DoubleLiteral doubleLiteral , BlockScope scope ) { return true ; } public boolean visit ( EmptyStatement emptyStatement , BlockScope scope ) { return true ; } public boolean visit ( EqualExpression equalExpression , BlockScope scope ) { return true ; } public boolean visit ( ExplicitConstructorCall explicitConstructor , BlockScope scope ) { return true ; } public boolean visit ( ExtendedStringLiteral extendedStringLiteral , BlockScope scope ) { return true ; } public boolean visit ( FalseLiteral falseLiteral , BlockScope scope ) { return true ; } public boolean visit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { return true ; } public boolean visit ( FieldReference fieldReference , BlockScope scope ) { return true ; } public boolean visit ( FieldReference fieldReference , ClassScope scope ) { return true ; } public boolean visit ( FloatLiteral floatLiteral , BlockScope scope ) { return true ; } public boolean visit ( ForeachStatement forStatement , BlockScope scope ) { return true ; } public boolean visit ( ForStatement forStatement , BlockScope scope ) { return true ; } public boolean visit ( IfStatement ifStatement , BlockScope scope ) { return true ; } public boolean visit ( ImportReference importRef , CompilationUnitScope scope ) { return true ; } public boolean visit ( Initializer initializer , MethodScope scope ) { return true ; } public boolean visit ( InstanceOfExpression instanceOfExpression , BlockScope scope ) { return true ; } public boolean visit ( IntLiteral intLiteral , BlockScope scope ) { return true ; } public boolean visit ( Javadoc javadoc , BlockScope scope ) { return true ; } public boolean visit ( Javadoc javadoc , ClassScope scope ) { return true ; } public boolean visit ( JavadocAllocationExpression expression , BlockScope scope ) { return true ; } public boolean visit ( JavadocAllocationExpression expression , ClassScope scope ) { return true ; } public boolean visit ( JavadocArgumentExpression expression , BlockScope scope ) { return true ; } public boolean visit ( JavadocArgumentExpression expression , ClassScope scope ) { return true ; } public boolean visit ( JavadocArrayQualifiedTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocArrayQualifiedTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocArraySingleTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocArraySingleTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocFieldReference fieldRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocFieldReference fieldRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocImplicitTypeReference implicitTypeReference , BlockScope scope ) { return true ; } public boolean visit ( JavadocImplicitTypeReference implicitTypeReference , ClassScope scope ) { return true ; } public boolean visit ( JavadocMessageSend messageSend , BlockScope scope ) { return true ; } public boolean visit ( JavadocMessageSend messageSend , ClassScope scope ) { return true ; } public boolean visit ( JavadocQualifiedTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocQualifiedTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocReturnStatement statement , BlockScope scope ) { return true ; } public boolean visit ( JavadocReturnStatement statement , ClassScope scope ) { return true ; } public boolean visit ( JavadocSingleNameReference argument , BlockScope scope ) { return true ; } public boolean visit ( JavadocSingleNameReference argument , ClassScope scope ) { return true ; } public boolean visit ( JavadocSingleTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocSingleTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( LabeledStatement labeledStatement , BlockScope scope ) { return true ; } public boolean visit ( LocalDeclaration localDeclaration , BlockScope scope ) { return true ; } public boolean visit ( LongLiteral longLiteral , BlockScope scope ) { return true ; } public boolean visit ( MarkerAnnotation annotation , BlockScope scope ) { return true ; } public boolean visit ( MemberValuePair pair , BlockScope scope ) { return true ; } public boolean visit ( MessageSend messageSend , BlockScope scope ) { return true ; } public boolean visit ( MethodDeclaration methodDeclaration , ClassScope scope ) { return true ; } public boolean visit ( StringLiteralConcatenation literal , BlockScope scope ) { return true ; } public boolean visit ( NormalAnnotation annotation , BlockScope scope ) { return true ; } public boolean visit ( NullLiteral nullLiteral , BlockScope scope ) { return true ; } public boolean visit ( OR_OR_Expression or_or_Expression , BlockScope scope ) { return true ; } public boolean visit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , ClassScope scope ) { return true ; } public boolean visit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , ClassScope scope ) { return true ; } public boolean visit ( PostfixExpression postfixExpression , BlockScope scope ) { return true ; } public boolean visit ( PrefixExpression prefixExpression , BlockScope scope ) { return true ; } public boolean visit ( QualifiedAllocationExpression qualifiedAllocationExpression , BlockScope scope ) { return true ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , ClassScope scope ) { return true ; } public boolean visit ( QualifiedSuperReference qualifiedSuperReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedSuperReference qualifiedSuperReference , ClassScope scope ) { return true ; } public boolean visit ( QualifiedThisReference qualifiedThisReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedThisReference qualifiedThisReference , ClassScope scope ) { return true ; } public boolean visit ( QualifiedTypeReference qualifiedTypeReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedTypeReference qualifiedTypeReference , ClassScope scope ) { return true ; } public boolean visit ( ReturnStatement returnStatement , BlockScope scope ) { return true ; } public boolean visit ( SingleMemberAnnotation annotation , BlockScope scope ) { return true ; } public boolean visit ( SingleNameReference singleNameReference , BlockScope scope ) { return true ; } public boolean visit ( SingleNameReference singleNameReference , ClassScope scope ) { return true ; } public boolean visit ( SingleTypeReference singleTypeReference , BlockScope scope ) { return true ; } public boolean visit ( SingleTypeReference singleTypeReference , ClassScope scope ) { return true ; } public boolean visit ( StringLiteral stringLiteral , BlockScope scope ) { return true ; } public boolean visit ( SuperReference superReference , BlockScope scope ) { return true ; } public boolean visit ( SwitchStatement switchStatement , BlockScope scope ) { return true ; } public boolean visit ( SynchronizedStatement synchronizedStatement , BlockScope scope ) { return true ; } public boolean visit ( ThisReference thisReference , BlockScope scope ) { return true ; } public boolean visit ( ThisReference thisReference , ClassScope scope ) { return true ; } public boolean visit ( ThrowStatement throwStatement , BlockScope scope ) { return true ; } public boolean visit ( TrueLiteral trueLiteral , BlockScope scope ) { return true ; } public boolean visit ( TryStatement tryStatement , BlockScope scope ) { return true ; } public boolean visit ( TypeDeclaration localTypeDeclaration , BlockScope scope ) { return true ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { return true ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { return true ; } public boolean visit ( TypeParameter typeParameter , BlockScope scope ) { return true ; } public boolean visit ( TypeParameter typeParameter , ClassScope scope ) { return true ; } public boolean visit ( UnaryExpression unaryExpression , BlockScope scope ) { return true ; } public boolean visit ( UnionTypeReference unionTypeReference , BlockScope scope ) { return true ; } public boolean visit ( UnionTypeReference unionTypeReference , ClassScope scope ) { return true ; } public boolean visit ( WhileStatement whileStatement , BlockScope scope ) { return true ; } public boolean visit ( Wildcard wildcard , BlockScope scope ) { return true ; } public boolean visit ( Wildcard wildcard , ClassScope scope ) { return true ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; 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 abstract class AbstractVariableDeclaration extends Statement implements InvocationSite { public int declarationEnd ; public int declarationSourceEnd ; public int declarationSourceStart ; public int hiddenVariableDepth ; public Expression initialization ; public int modifiers ; public int modifiersSourceStart ; public Annotation [ ] annotations ; public char [ ] name ; public TypeReference type ; public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public static final int FIELD = <NUM_LIT:1> ; public static final int INITIALIZER = <NUM_LIT:2> ; public static final int ENUM_CONSTANT = <NUM_LIT:3> ; public static final int LOCAL_VARIABLE = <NUM_LIT:4> ; public static final int PARAMETER = <NUM_LIT:5> ; public static final int TYPE_PARAMETER = <NUM_LIT:6> ; public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public abstract int getKind ( ) ; public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return false ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printAsExpression ( indent , output ) ; switch ( getKind ( ) ) { case ENUM_CONSTANT : return output . append ( '<CHAR_LIT:U+002C>' ) ; default : return output . append ( '<CHAR_LIT:;>' ) ; } } public StringBuffer printAsExpression ( int indent , StringBuffer output ) { printIndent ( indent , output ) ; printModifiers ( this . modifiers , output ) ; if ( this . annotations != null ) printAnnotations ( this . annotations , output ) ; if ( this . type != null ) { this . type . print ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:U+0020>' ) ; } output . append ( this . name ) ; switch ( getKind ( ) ) { case ENUM_CONSTANT : if ( this . initialization != null ) { this . initialization . printExpression ( indent , output ) ; } break ; default : if ( this . initialization != null ) { output . append ( "<STR_LIT:U+0020=U+0020>" ) ; this . initialization . printExpression ( indent , output ) ; } } return output ; } public void resolve ( BlockScope scope ) { } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { this . hiddenVariableDepth = depth ; } public void setFieldIndex ( int depth ) { } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; public class StringLiteralConcatenation extends StringLiteral { private static final int INITIAL_SIZE = <NUM_LIT:5> ; public Expression [ ] literals ; public int counter ; public StringLiteralConcatenation ( StringLiteral str1 , StringLiteral str2 ) { super ( str1 . sourceStart , str1 . sourceEnd ) ; this . source = str1 . source ; this . literals = new StringLiteral [ INITIAL_SIZE ] ; this . counter = <NUM_LIT:0> ; this . literals [ this . counter ++ ] = str1 ; extendsWith ( str2 ) ; } public StringLiteralConcatenation extendsWith ( StringLiteral lit ) { this . sourceEnd = lit . sourceEnd ; final int literalsLength = this . literals . length ; if ( this . counter == literalsLength ) { System . arraycopy ( this . literals , <NUM_LIT:0> , this . literals = new StringLiteral [ literalsLength + INITIAL_SIZE ] , <NUM_LIT:0> , literalsLength ) ; } int length = this . source . length ; System . arraycopy ( this . source , <NUM_LIT:0> , this . source = new char [ length + lit . source . length ] , <NUM_LIT:0> , length ) ; System . arraycopy ( lit . source , <NUM_LIT:0> , this . source , length , lit . source . length ) ; this . literals [ this . counter ++ ] = lit ; return this ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { output . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , max = this . counter ; i < max ; i ++ ) { this . literals [ i ] . printExpression ( indent , output ) ; output . append ( "<STR_LIT>" ) ; } return output . append ( '<CHAR_LIT:}>' ) ; } public char [ ] source ( ) { return this . source ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { for ( int i = <NUM_LIT:0> , max = this . counter ; i < max ; i ++ ) { this . literals [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; public class QualifiedTypeReference extends TypeReference { public char [ ] [ ] tokens ; public long [ ] sourcePositions ; public QualifiedTypeReference ( char [ ] [ ] sources , long [ ] poss ) { this . tokens = sources ; this . sourcePositions = poss ; this . sourceStart = ( int ) ( this . sourcePositions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; this . sourceEnd = ( int ) ( this . sourcePositions [ this . sourcePositions . length - <NUM_LIT:1> ] & <NUM_LIT> ) ; } public TypeReference copyDims ( int dim ) { return new ArrayQualifiedTypeReference ( this . tokens , dim , this . sourcePositions ) ; } protected TypeBinding findNextTypeBinding ( int tokenIndex , Scope scope , PackageBinding packageBinding ) { LookupEnvironment env = scope . environment ( ) ; try { env . missingClassFileLocation = this ; if ( this . resolvedType == null ) { this . resolvedType = scope . getType ( this . tokens [ tokenIndex ] , packageBinding ) ; } else { this . resolvedType = scope . getMemberType ( this . tokens [ tokenIndex ] , ( ReferenceBinding ) this . resolvedType ) ; if ( ! this . resolvedType . isValidBinding ( ) ) { this . resolvedType = new ProblemReferenceBinding ( CharOperation . subarray ( this . tokens , <NUM_LIT:0> , tokenIndex + <NUM_LIT:1> ) , ( ReferenceBinding ) this . resolvedType . closestMatch ( ) , this . resolvedType . problemId ( ) ) ; } } return this . resolvedType ; } catch ( AbortCompilation e ) { e . updateContext ( this , scope . referenceCompilationUnit ( ) . compilationResult ) ; throw e ; } finally { env . missingClassFileLocation = null ; } } public char [ ] getLastToken ( ) { return this . tokens [ this . tokens . length - <NUM_LIT:1> ] ; } protected TypeBinding getTypeBinding ( Scope scope ) { if ( this . resolvedType != null ) { return this . resolvedType ; } Binding binding = scope . getPackage ( this . tokens ) ; if ( binding != null && ! binding . isValidBinding ( ) ) { if ( binding instanceof ProblemReferenceBinding && binding . problemId ( ) == ProblemReasons . NotFound ) { ProblemReferenceBinding problemBinding = ( ProblemReferenceBinding ) binding ; Binding pkg = scope . getTypeOrPackage ( this . tokens ) ; return new ProblemReferenceBinding ( problemBinding . compoundName , pkg instanceof PackageBinding ? null : scope . environment ( ) . createMissingType ( null , this . tokens ) , ProblemReasons . NotFound ) ; } return ( ReferenceBinding ) binding ; } PackageBinding packageBinding = binding == null ? null : ( PackageBinding ) binding ; boolean isClassScope = scope . kind == Scope . CLASS_SCOPE ; ReferenceBinding qualifiedType = null ; for ( int i = packageBinding == null ? <NUM_LIT:0> : packageBinding . compoundName . length , max = this . tokens . length , last = max - <NUM_LIT:1> ; i < max ; i ++ ) { findNextTypeBinding ( i , scope , packageBinding ) ; if ( ! this . resolvedType . isValidBinding ( ) ) return this . resolvedType ; if ( i == <NUM_LIT:0> && this . resolvedType . isTypeVariable ( ) && ( ( TypeVariableBinding ) this . resolvedType ) . firstBound == null ) { scope . problemReporter ( ) . illegalAccessFromTypeVariable ( ( TypeVariableBinding ) this . resolvedType , this ) ; return null ; } if ( i <= last && isTypeUseDeprecated ( this . resolvedType , scope ) ) { reportDeprecatedType ( this . resolvedType , scope , i ) ; } if ( isClassScope ) if ( ( ( ClassScope ) scope ) . detectHierarchyCycle ( this . resolvedType , this ) ) return null ; ReferenceBinding currentType = ( ReferenceBinding ) this . resolvedType ; if ( qualifiedType != null ) { ReferenceBinding enclosingType = currentType . enclosingType ( ) ; if ( enclosingType != null && enclosingType . erasure ( ) != qualifiedType . erasure ( ) ) { qualifiedType = enclosingType ; } boolean rawQualified ; if ( currentType . isGenericType ( ) ) { qualifiedType = scope . environment ( ) . createRawType ( currentType , qualifiedType ) ; } else if ( ( rawQualified = qualifiedType . isRawType ( ) ) && ! currentType . isStatic ( ) ) { qualifiedType = scope . environment ( ) . createRawType ( ( ReferenceBinding ) currentType . erasure ( ) , qualifiedType ) ; } else if ( ( rawQualified || qualifiedType . isParameterizedType ( ) ) && qualifiedType . erasure ( ) == currentType . enclosingType ( ) . erasure ( ) ) { qualifiedType = scope . environment ( ) . createParameterizedType ( ( ReferenceBinding ) currentType . erasure ( ) , null , qualifiedType ) ; } else { qualifiedType = currentType ; } } else { qualifiedType = currentType . isGenericType ( ) ? ( ReferenceBinding ) scope . environment ( ) . convertToRawType ( currentType , false ) : currentType ; } } this . resolvedType = qualifiedType ; return this . resolvedType ; } public char [ ] [ ] getTypeName ( ) { return this . tokens ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { for ( int i = <NUM_LIT:0> ; i < this . tokens . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( '<CHAR_LIT:.>' ) ; output . append ( this . tokens [ i ] ) ; } return output ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . flow . ExceptionHandlingFlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . flow . InitializationFlowContext ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . MemberTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . problem . AbortMethod ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; public class MethodDeclaration extends AbstractMethodDeclaration { public TypeReference returnType ; public TypeParameter [ ] typeParameters ; public MethodDeclaration ( CompilationResult compilationResult ) { super ( compilationResult ) ; } public void analyseCode ( ClassScope classScope , InitializationFlowContext initializationContext , FlowInfo flowInfo ) { if ( this . ignoreFurtherInvestigation ) return ; try { if ( this . binding == null ) return ; if ( ! this . binding . isUsed ( ) && ! this . binding . isAbstract ( ) ) { if ( this . binding . isPrivate ( ) || ( ( ( this . binding . modifiers & ( ExtraCompilerModifiers . AccOverriding | ExtraCompilerModifiers . AccImplementing ) ) == <NUM_LIT:0> ) && this . binding . isOrEnclosedByPrivateType ( ) ) ) { if ( ! classScope . referenceCompilationUnit ( ) . compilationResult . hasSyntaxError ) { this . scope . problemReporter ( ) . unusedPrivateMethod ( this ) ; } } } if ( this . binding . declaringClass . isEnum ( ) && ( this . selector == TypeConstants . VALUES || this . selector == TypeConstants . VALUEOF ) ) return ; if ( this . binding . isAbstract ( ) || this . binding . isNative ( ) ) return ; ExceptionHandlingFlowContext methodContext = new ExceptionHandlingFlowContext ( initializationContext , this , this . binding . thrownExceptions , null , this . scope , FlowInfo . DEAD_END ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { flowInfo . markAsDefinitelyAssigned ( this . arguments [ i ] . binding ) ; if ( this . arguments [ i ] . binding != null && ( this . arguments [ i ] . binding . type instanceof TypeVariableBinding ) ) { Binding declaringElement = ( ( TypeVariableBinding ) this . arguments [ i ] . binding . type ) . declaringElement ; if ( this . binding != null && this . binding . declaringClass == declaringElement ) this . bits &= ~ ASTNode . CanBeStatic ; } } } if ( this . binding . declaringClass instanceof MemberTypeBinding && ! this . binding . declaringClass . isStatic ( ) ) { this . bits &= ~ ASTNode . CanBeStatic ; } if ( this . statements != null ) { int complaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ? Statement . NOT_COMPLAINED : Statement . COMPLAINED_FAKE_REACHABLE ; for ( int i = <NUM_LIT:0> , count = this . statements . length ; i < count ; i ++ ) { Statement stat = this . statements [ i ] ; if ( ( complaintLevel = stat . complainIfUnreachable ( flowInfo , this . scope , complaintLevel ) ) < Statement . COMPLAINED_UNREACHABLE ) { flowInfo = stat . analyseCode ( this . scope , methodContext , flowInfo ) ; } } } else { this . bits &= ~ ASTNode . CanBeStatic ; } TypeBinding returnTypeBinding = this . binding . returnType ; if ( ( returnTypeBinding == TypeBinding . VOID ) || isAbstract ( ) ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . NeedFreeReturn ; } } else { if ( flowInfo != FlowInfo . DEAD_END ) { this . scope . problemReporter ( ) . shouldReturn ( returnTypeBinding , this ) ; } } methodContext . complainIfUnusedExceptionHandlers ( this ) ; this . scope . checkUnusedParameters ( this . binding ) ; if ( ! this . binding . isStatic ( ) && ( this . bits & ASTNode . CanBeStatic ) != <NUM_LIT:0> ) { if ( ! this . binding . isOverriding ( ) && ! this . binding . isImplementing ( ) ) { if ( this . binding . isPrivate ( ) || this . binding . isFinal ( ) || this . binding . declaringClass . isFinal ( ) ) { this . scope . problemReporter ( ) . methodCanBeDeclaredStatic ( this ) ; } else { this . scope . problemReporter ( ) . methodCanBePotentiallyDeclaredStatic ( this ) ; } } } } catch ( AbortMethod e ) { this . ignoreFurtherInvestigation = true ; } } public boolean isMethod ( ) { return true ; } public void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) { parser . parse ( this , unit ) ; } public StringBuffer printReturnType ( int indent , StringBuffer output ) { if ( this . returnType == null ) return output ; return this . returnType . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:U+0020>' ) ; } public void resolveStatements ( ) { if ( this . returnType != null && this . binding != null ) { this . returnType . resolvedType = this . binding . returnType ; } if ( CharOperation . equals ( this . scope . enclosingSourceType ( ) . sourceName , this . selector ) ) { this . scope . problemReporter ( ) . methodWithConstructorName ( this ) ; } boolean returnsUndeclTypeVar = false ; if ( this . returnType != null && this . returnType . resolvedType instanceof TypeVariableBinding ) { returnsUndeclTypeVar = true ; } if ( this . typeParameters != null ) { for ( int i = <NUM_LIT:0> , length = this . typeParameters . length ; i < length ; i ++ ) { this . typeParameters [ i ] . resolve ( this . scope ) ; if ( returnsUndeclTypeVar && this . typeParameters [ i ] . binding == this . returnType . resolvedType ) { returnsUndeclTypeVar = false ; } } } final CompilerOptions compilerOptions = this . scope . compilerOptions ( ) ; checkOverride : { if ( this . binding == null ) break checkOverride ; long complianceLevel = compilerOptions . complianceLevel ; if ( complianceLevel < ClassFileConstants . JDK1_5 ) break checkOverride ; int bindingModifiers = this . binding . modifiers ; boolean hasOverrideAnnotation = ( this . binding . tagBits & TagBits . AnnotationOverride ) != <NUM_LIT:0> ; boolean hasUnresolvedArguments = ( this . binding . tagBits & TagBits . HasUnresolvedArguments ) != <NUM_LIT:0> ; if ( hasOverrideAnnotation && ! hasUnresolvedArguments ) { if ( ( bindingModifiers & ( ClassFileConstants . AccStatic | ExtraCompilerModifiers . AccOverriding ) ) == ExtraCompilerModifiers . AccOverriding ) break checkOverride ; if ( complianceLevel >= ClassFileConstants . JDK1_6 && ( ( bindingModifiers & ( ClassFileConstants . AccStatic | ExtraCompilerModifiers . AccImplementing ) ) == ExtraCompilerModifiers . AccImplementing ) ) break checkOverride ; this . scope . problemReporter ( ) . methodMustOverride ( this , complianceLevel ) ; } else { if ( ! this . binding . declaringClass . isInterface ( ) ) { if ( ( bindingModifiers & ( ClassFileConstants . AccStatic | ExtraCompilerModifiers . AccOverriding ) ) == ExtraCompilerModifiers . AccOverriding ) { this . scope . problemReporter ( ) . missingOverrideAnnotation ( this ) ; } else { if ( complianceLevel >= ClassFileConstants . JDK1_6 && compilerOptions . reportMissingOverrideAnnotationForInterfaceMethodImplementation && this . binding . isImplementing ( ) ) { this . scope . problemReporter ( ) . missingOverrideAnnotationForInterfaceMethodImplementation ( this ) ; } } } else { if ( complianceLevel >= ClassFileConstants . JDK1_6 && compilerOptions . reportMissingOverrideAnnotationForInterfaceMethodImplementation && ( ( ( bindingModifiers & ( ClassFileConstants . AccStatic | ExtraCompilerModifiers . AccOverriding ) ) == ExtraCompilerModifiers . AccOverriding ) || this . binding . isImplementing ( ) ) ) { this . scope . problemReporter ( ) . missingOverrideAnnotationForInterfaceMethodImplementation ( this ) ; } } } } switch ( TypeDeclaration . kind ( this . scope . referenceType ( ) . modifiers ) ) { case TypeDeclaration . ENUM_DECL : if ( this . selector == TypeConstants . VALUES ) break ; if ( this . selector == TypeConstants . VALUEOF ) break ; case TypeDeclaration . CLASS_DECL : if ( ( this . modifiers & ExtraCompilerModifiers . AccSemicolonBody ) != <NUM_LIT:0> ) { if ( ( this . modifiers & ClassFileConstants . AccNative ) == <NUM_LIT:0> ) if ( ( this . modifiers & ClassFileConstants . AccAbstract ) == <NUM_LIT:0> ) this . scope . problemReporter ( ) . methodNeedBody ( this ) ; } else { if ( ( ( this . modifiers & ClassFileConstants . AccNative ) != <NUM_LIT:0> ) || ( ( this . modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ) ) this . scope . problemReporter ( ) . methodNeedingNoBody ( this ) ; else if ( this . binding != null && ! this . binding . isStatic ( ) && ! ( this . binding . declaringClass instanceof LocalTypeBinding ) && ! returnsUndeclTypeVar ) { this . bits |= ASTNode . CanBeStatic ; } } } super . resolveStatements ( ) ; if ( compilerOptions . getSeverity ( CompilerOptions . OverridingMethodWithoutSuperInvocation ) != ProblemSeverities . Ignore ) { if ( this . binding != null ) { int bindingModifiers = this . binding . modifiers ; if ( ( bindingModifiers & ( ExtraCompilerModifiers . AccOverriding | ExtraCompilerModifiers . AccImplementing ) ) == ExtraCompilerModifiers . AccOverriding && ( this . bits & ASTNode . OverridingMethodWithSupercall ) == <NUM_LIT:0> ) { this . scope . problemReporter ( ) . overridesMethodWithoutSuperInvocation ( this . binding ) ; } } } } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { if ( visitor . visit ( this , classScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int typeParametersLength = this . typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < typeParametersLength ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . returnType != null ) this . returnType . traverse ( visitor , this . scope ) ; if ( this . arguments != null ) { int argumentLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , this . scope ) ; } if ( this . thrownExceptions != null ) { int thrownExceptionsLength = this . thrownExceptions . length ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionsLength ; i ++ ) this . thrownExceptions [ i ] . traverse ( visitor , this . scope ) ; } if ( this . statements != null ) { int statementsLength = this . statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) this . statements [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , classScope ) ; } public TypeParameter [ ] typeParameters ( ) { return this . typeParameters ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import java . util . Arrays ; import java . util . Comparator ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . impl . IrritantSet ; import org . eclipse . jdt . internal . compiler . impl . ReferenceContext ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . ImportBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . parser . NLSTag ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilationUnit ; import org . eclipse . jdt . internal . compiler . problem . AbortMethod ; import org . eclipse . jdt . internal . compiler . problem . AbortType ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . util . HashSetOfInt ; public class CompilationUnitDeclaration extends ASTNode implements ProblemSeverities , ReferenceContext { private static final Comparator STRING_LITERAL_COMPARATOR = new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { StringLiteral literal1 = ( StringLiteral ) o1 ; StringLiteral literal2 = ( StringLiteral ) o2 ; return literal1 . sourceStart - literal2 . sourceStart ; } } ; private static final int STRING_LITERALS_INCREMENT = <NUM_LIT:10> ; public ImportReference currentPackage ; public ImportReference [ ] imports ; public TypeDeclaration [ ] types ; public int [ ] [ ] comments ; public boolean ignoreFurtherInvestigation = false ; public boolean ignoreMethodBodies = false ; public CompilationUnitScope scope ; public ProblemReporter problemReporter ; public CompilationResult compilationResult ; public LocalTypeBinding [ ] localTypes ; public int localTypeCount = <NUM_LIT:0> ; public boolean isPropagatingInnerClassEmulation ; public Javadoc javadoc ; public NLSTag [ ] nlsTags ; private StringLiteral [ ] stringLiterals ; private int stringLiteralsPtr ; private HashSetOfInt stringLiteralsStart ; IrritantSet [ ] suppressWarningIrritants ; Annotation [ ] suppressWarningAnnotations ; long [ ] suppressWarningScopePositions ; int suppressWarningsCount ; public CompilationUnitDeclaration ( ProblemReporter problemReporter , CompilationResult compilationResult , int sourceLength ) { this . problemReporter = problemReporter ; this . compilationResult = compilationResult ; this . sourceStart = <NUM_LIT:0> ; this . sourceEnd = sourceLength - <NUM_LIT:1> ; } public void abort ( int abortLevel , CategorizedProblem problem ) { switch ( abortLevel ) { case AbortType : throw new AbortType ( this . compilationResult , problem ) ; case AbortMethod : throw new AbortMethod ( this . compilationResult , problem ) ; default : throw new AbortCompilationUnit ( this . compilationResult , problem ) ; } } public void analyseCode ( ) { if ( this . ignoreFurtherInvestigation ) return ; try { if ( this . types != null ) { for ( int i = <NUM_LIT:0> , count = this . types . length ; i < count ; i ++ ) { this . types [ i ] . analyseCode ( this . scope ) ; } } propagateInnerEmulationForAllLocalTypes ( ) ; } catch ( AbortCompilationUnit e ) { this . ignoreFurtherInvestigation = true ; return ; } } public void cleanUp ( ) { if ( this . types != null ) { for ( int i = <NUM_LIT:0> , max = this . types . length ; i < max ; i ++ ) { cleanUp ( this . types [ i ] ) ; } for ( int i = <NUM_LIT:0> , max = this . localTypeCount ; i < max ; i ++ ) { LocalTypeBinding localType = this . localTypes [ i ] ; localType . scope = null ; localType . enclosingCase = null ; } } this . compilationResult . recoveryScannerData = null ; ClassFile [ ] classFiles = this . compilationResult . getClassFiles ( ) ; for ( int i = <NUM_LIT:0> , max = classFiles . length ; i < max ; i ++ ) { ClassFile classFile = classFiles [ i ] ; classFile . referenceBinding = null ; classFile . innerClassesBindings = null ; classFile . missingTypes = null ; classFile . visitedTypes = null ; } this . suppressWarningAnnotations = null ; } private void cleanUp ( TypeDeclaration type ) { if ( type . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = type . memberTypes . length ; i < max ; i ++ ) { cleanUp ( type . memberTypes [ i ] ) ; } } if ( type . binding != null && type . binding . isAnnotationType ( ) ) this . compilationResult . hasAnnotations = true ; if ( type . binding != null ) { type . binding . scope = null ; } } public void checkUnusedImports ( ) { if ( this . scope . imports != null ) { for ( int i = <NUM_LIT:0> , max = this . scope . imports . length ; i < max ; i ++ ) { ImportBinding importBinding = this . scope . imports [ i ] ; ImportReference importReference = importBinding . reference ; if ( importReference != null && ( ( importReference . bits & ASTNode . Used ) == <NUM_LIT:0> ) ) { this . scope . problemReporter ( ) . unusedImport ( importReference ) ; } } } } public CompilationResult compilationResult ( ) { return this . compilationResult ; } public void createPackageInfoType ( ) { TypeDeclaration declaration = new TypeDeclaration ( this . compilationResult ) ; declaration . name = TypeConstants . PACKAGE_INFO_NAME ; declaration . modifiers = ClassFileConstants . AccDefault | ClassFileConstants . AccInterface ; declaration . javadoc = this . javadoc ; this . types [ <NUM_LIT:0> ] = declaration ; } public TypeDeclaration declarationOfType ( char [ ] [ ] typeName ) { for ( int i = <NUM_LIT:0> ; i < this . types . length ; i ++ ) { TypeDeclaration typeDecl = this . types [ i ] . declarationOfType ( typeName ) ; if ( typeDecl != null ) { return typeDecl ; } } return null ; } public void finalizeProblems ( ) { if ( this . suppressWarningsCount == <NUM_LIT:0> ) return ; int removed = <NUM_LIT:0> ; CategorizedProblem [ ] problems = this . compilationResult . problems ; int problemCount = this . compilationResult . problemCount ; IrritantSet [ ] foundIrritants = new IrritantSet [ this . suppressWarningsCount ] ; CompilerOptions options = this . scope . compilerOptions ( ) ; boolean hasMandatoryErrors = false ; nextProblem : for ( int iProblem = <NUM_LIT:0> , length = problemCount ; iProblem < length ; iProblem ++ ) { CategorizedProblem problem = problems [ iProblem ] ; int problemID = problem . getID ( ) ; int irritant = ProblemReporter . getIrritant ( problemID ) ; boolean isError = problem . isError ( ) ; if ( isError ) { if ( irritant == <NUM_LIT:0> ) { hasMandatoryErrors = true ; continue ; } if ( ! options . suppressOptionalErrors ) { continue ; } } int start = problem . getSourceStart ( ) ; int end = problem . getSourceEnd ( ) ; nextSuppress : for ( int iSuppress = <NUM_LIT:0> , suppressCount = this . suppressWarningsCount ; iSuppress < suppressCount ; iSuppress ++ ) { long position = this . suppressWarningScopePositions [ iSuppress ] ; int startSuppress = ( int ) ( position > > > <NUM_LIT:32> ) ; int endSuppress = ( int ) position ; if ( start < startSuppress ) continue nextSuppress ; if ( end > endSuppress ) continue nextSuppress ; if ( ! this . suppressWarningIrritants [ iSuppress ] . isSet ( irritant ) ) continue nextSuppress ; removed ++ ; problems [ iProblem ] = null ; this . compilationResult . removeProblem ( problem ) ; if ( foundIrritants [ iSuppress ] == null ) { foundIrritants [ iSuppress ] = new IrritantSet ( irritant ) ; } else { foundIrritants [ iSuppress ] . set ( irritant ) ; } continue nextProblem ; } } if ( removed > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> , index = <NUM_LIT:0> ; i < problemCount ; i ++ ) { CategorizedProblem problem ; if ( ( problem = problems [ i ] ) != null ) { if ( i > index ) { problems [ index ++ ] = problem ; } else { index ++ ; } } } } if ( ! hasMandatoryErrors ) { int severity = options . getSeverity ( CompilerOptions . UnusedWarningToken ) ; if ( severity != ProblemSeverities . Ignore ) { boolean unusedWarningTokenIsWarning = ( severity & ProblemSeverities . Error ) == <NUM_LIT:0> ; for ( int iSuppress = <NUM_LIT:0> , suppressCount = this . suppressWarningsCount ; iSuppress < suppressCount ; iSuppress ++ ) { Annotation annotation = this . suppressWarningAnnotations [ iSuppress ] ; if ( annotation == null ) continue ; IrritantSet irritants = this . suppressWarningIrritants [ iSuppress ] ; if ( unusedWarningTokenIsWarning && irritants . areAllSet ( ) ) continue ; if ( irritants != foundIrritants [ iSuppress ] ) { MemberValuePair [ ] pairs = annotation . memberValuePairs ( ) ; pairLoop : for ( int iPair = <NUM_LIT:0> , pairCount = pairs . length ; iPair < pairCount ; iPair ++ ) { MemberValuePair pair = pairs [ iPair ] ; if ( CharOperation . equals ( pair . name , TypeConstants . VALUE ) ) { Expression value = pair . value ; if ( value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) value ; Expression [ ] inits = initializer . expressions ; if ( inits != null ) { for ( int iToken = <NUM_LIT:0> , tokenCount = inits . length ; iToken < tokenCount ; iToken ++ ) { Constant cst = inits [ iToken ] . constant ; if ( cst != Constant . NotAConstant && cst . typeID ( ) == TypeIds . T_JavaLangString ) { IrritantSet tokenIrritants = CompilerOptions . warningTokenToIrritants ( cst . stringValue ( ) ) ; if ( tokenIrritants != null && ! tokenIrritants . areAllSet ( ) && options . isAnyEnabled ( tokenIrritants ) && ( foundIrritants [ iSuppress ] == null || ! foundIrritants [ iSuppress ] . isAnySet ( tokenIrritants ) ) ) { if ( unusedWarningTokenIsWarning ) { int start = value . sourceStart , end = value . sourceEnd ; nextSuppress : for ( int jSuppress = iSuppress - <NUM_LIT:1> ; jSuppress >= <NUM_LIT:0> ; jSuppress -- ) { long position = this . suppressWarningScopePositions [ jSuppress ] ; int startSuppress = ( int ) ( position > > > <NUM_LIT:32> ) ; int endSuppress = ( int ) position ; if ( start < startSuppress ) continue nextSuppress ; if ( end > endSuppress ) continue nextSuppress ; if ( this . suppressWarningIrritants [ jSuppress ] . areAllSet ( ) ) break pairLoop ; } } this . scope . problemReporter ( ) . unusedWarningToken ( inits [ iToken ] ) ; } } } } } else { Constant cst = value . constant ; if ( cst != Constant . NotAConstant && cst . typeID ( ) == T_JavaLangString ) { IrritantSet tokenIrritants = CompilerOptions . warningTokenToIrritants ( cst . stringValue ( ) ) ; if ( tokenIrritants != null && ! tokenIrritants . areAllSet ( ) && options . isAnyEnabled ( tokenIrritants ) && ( foundIrritants [ iSuppress ] == null || ! foundIrritants [ iSuppress ] . isAnySet ( tokenIrritants ) ) ) { if ( unusedWarningTokenIsWarning ) { int start = value . sourceStart , end = value . sourceEnd ; nextSuppress : for ( int jSuppress = iSuppress - <NUM_LIT:1> ; jSuppress >= <NUM_LIT:0> ; jSuppress -- ) { long position = this . suppressWarningScopePositions [ jSuppress ] ; int startSuppress = ( int ) ( position > > > <NUM_LIT:32> ) ; int endSuppress = ( int ) position ; if ( start < startSuppress ) continue nextSuppress ; if ( end > endSuppress ) continue nextSuppress ; if ( this . suppressWarningIrritants [ jSuppress ] . areAllSet ( ) ) break pairLoop ; } } this . scope . problemReporter ( ) . unusedWarningToken ( value ) ; } } } break pairLoop ; } } } } } } } public void generateCode ( ) { if ( this . ignoreFurtherInvestigation ) { if ( this . types != null ) { for ( int i = <NUM_LIT:0> , count = this . types . length ; i < count ; i ++ ) { this . types [ i ] . ignoreFurtherInvestigation = true ; this . types [ i ] . generateCode ( this . scope ) ; } } return ; } try { if ( this . types != null ) { for ( int i = <NUM_LIT:0> , count = this . types . length ; i < count ; i ++ ) this . types [ i ] . generateCode ( this . scope ) ; } } catch ( AbortCompilationUnit e ) { } } public char [ ] getFileName ( ) { return this . compilationResult . getFileName ( ) ; } public char [ ] getMainTypeName ( ) { if ( this . compilationResult . compilationUnit == null ) { char [ ] fileName = this . compilationResult . getFileName ( ) ; int start = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , fileName ) + <NUM_LIT:1> ; if ( start == <NUM_LIT:0> || start < CharOperation . lastIndexOf ( '<STR_LIT:\\>' , fileName ) ) start = CharOperation . lastIndexOf ( '<STR_LIT:\\>' , fileName ) + <NUM_LIT:1> ; int end = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , fileName ) ; if ( end == - <NUM_LIT:1> ) end = fileName . length ; return CharOperation . subarray ( fileName , start , end ) ; } else { return this . compilationResult . compilationUnit . getMainTypeName ( ) ; } } public boolean isEmpty ( ) { return ( this . currentPackage == null ) && ( this . imports == null ) && ( this . types == null ) ; } public boolean isPackageInfo ( ) { return CharOperation . equals ( getMainTypeName ( ) , TypeConstants . PACKAGE_INFO_NAME ) ; } public boolean hasErrors ( ) { return this . ignoreFurtherInvestigation ; } public StringBuffer print ( int indent , StringBuffer output ) { if ( this . currentPackage != null ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; this . currentPackage . print ( <NUM_LIT:0> , output , false ) . append ( "<STR_LIT>" ) ; } if ( this . imports != null ) for ( int i = <NUM_LIT:0> ; i < this . imports . length ; i ++ ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; ImportReference currentImport = this . imports [ i ] ; if ( currentImport . isStatic ( ) ) { output . append ( "<STR_LIT>" ) ; } currentImport . print ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; } if ( this . types != null ) { for ( int i = <NUM_LIT:0> ; i < this . types . length ; i ++ ) { this . types [ i ] . print ( indent , output ) . append ( "<STR_LIT:n>" ) ; } } return output ; } public void propagateInnerEmulationForAllLocalTypes ( ) { this . isPropagatingInnerClassEmulation = true ; for ( int i = <NUM_LIT:0> , max = this . localTypeCount ; i < max ; i ++ ) { LocalTypeBinding localType = this . localTypes [ i ] ; if ( ( localType . scope . referenceType ( ) . bits & IsReachable ) != <NUM_LIT:0> ) { localType . updateInnerEmulationDependents ( ) ; } } } public void recordStringLiteral ( StringLiteral literal , boolean fromRecovery ) { if ( this . stringLiteralsStart != null ) { if ( this . stringLiteralsStart . contains ( literal . sourceStart ) ) return ; this . stringLiteralsStart . add ( literal . sourceStart ) ; } else if ( fromRecovery ) { this . stringLiteralsStart = new HashSetOfInt ( this . stringLiteralsPtr + STRING_LITERALS_INCREMENT ) ; for ( int i = <NUM_LIT:0> ; i < this . stringLiteralsPtr ; i ++ ) { this . stringLiteralsStart . add ( this . stringLiterals [ i ] . sourceStart ) ; } if ( this . stringLiteralsStart . contains ( literal . sourceStart ) ) return ; this . stringLiteralsStart . add ( literal . sourceStart ) ; } if ( this . stringLiterals == null ) { this . stringLiterals = new StringLiteral [ STRING_LITERALS_INCREMENT ] ; this . stringLiteralsPtr = <NUM_LIT:0> ; } else { int stackLength = this . stringLiterals . length ; if ( this . stringLiteralsPtr == stackLength ) { System . arraycopy ( this . stringLiterals , <NUM_LIT:0> , this . stringLiterals = new StringLiteral [ stackLength + STRING_LITERALS_INCREMENT ] , <NUM_LIT:0> , stackLength ) ; } } this . stringLiterals [ this . stringLiteralsPtr ++ ] = literal ; } public void recordSuppressWarnings ( IrritantSet irritants , Annotation annotation , int scopeStart , int scopeEnd ) { if ( this . suppressWarningIrritants == null ) { this . suppressWarningIrritants = new IrritantSet [ <NUM_LIT:3> ] ; this . suppressWarningAnnotations = new Annotation [ <NUM_LIT:3> ] ; this . suppressWarningScopePositions = new long [ <NUM_LIT:3> ] ; } else if ( this . suppressWarningIrritants . length == this . suppressWarningsCount ) { System . arraycopy ( this . suppressWarningIrritants , <NUM_LIT:0> , this . suppressWarningIrritants = new IrritantSet [ <NUM_LIT:2> * this . suppressWarningsCount ] , <NUM_LIT:0> , this . suppressWarningsCount ) ; System . arraycopy ( this . suppressWarningAnnotations , <NUM_LIT:0> , this . suppressWarningAnnotations = new Annotation [ <NUM_LIT:2> * this . suppressWarningsCount ] , <NUM_LIT:0> , this . suppressWarningsCount ) ; System . arraycopy ( this . suppressWarningScopePositions , <NUM_LIT:0> , this . suppressWarningScopePositions = new long [ <NUM_LIT:2> * this . suppressWarningsCount ] , <NUM_LIT:0> , this . suppressWarningsCount ) ; } final long scopePositions = ( ( long ) scopeStart << <NUM_LIT:32> ) + scopeEnd ; for ( int i = <NUM_LIT:0> , max = this . suppressWarningsCount ; i < max ; i ++ ) { if ( this . suppressWarningAnnotations [ i ] == annotation && this . suppressWarningScopePositions [ i ] == scopePositions && this . suppressWarningIrritants [ i ] . hasSameIrritants ( irritants ) ) { return ; } } this . suppressWarningIrritants [ this . suppressWarningsCount ] = irritants ; this . suppressWarningAnnotations [ this . suppressWarningsCount ] = annotation ; this . suppressWarningScopePositions [ this . suppressWarningsCount ++ ] = scopePositions ; } public void record ( LocalTypeBinding localType ) { if ( this . localTypeCount == <NUM_LIT:0> ) { this . localTypes = new LocalTypeBinding [ <NUM_LIT:5> ] ; } else if ( this . localTypeCount == this . localTypes . length ) { System . arraycopy ( this . localTypes , <NUM_LIT:0> , ( this . localTypes = new LocalTypeBinding [ this . localTypeCount * <NUM_LIT:2> ] ) , <NUM_LIT:0> , this . localTypeCount ) ; } this . localTypes [ this . localTypeCount ++ ] = localType ; } public void resolve ( ) { int startingTypeIndex = <NUM_LIT:0> ; boolean isPackageInfo = isPackageInfo ( ) ; if ( this . types != null && isPackageInfo ) { final TypeDeclaration syntheticTypeDeclaration = this . types [ <NUM_LIT:0> ] ; if ( syntheticTypeDeclaration . javadoc == null ) { syntheticTypeDeclaration . javadoc = new Javadoc ( syntheticTypeDeclaration . declarationSourceStart , syntheticTypeDeclaration . declarationSourceStart ) ; } syntheticTypeDeclaration . resolve ( this . scope ) ; if ( this . javadoc != null && syntheticTypeDeclaration . staticInitializerScope != null ) { this . javadoc . resolve ( syntheticTypeDeclaration . staticInitializerScope ) ; } startingTypeIndex = <NUM_LIT:1> ; } else { if ( this . javadoc != null ) { this . javadoc . resolve ( this . scope ) ; } } if ( this . currentPackage != null && this . currentPackage . annotations != null && ! isPackageInfo ) { this . scope . problemReporter ( ) . invalidFileNameForPackageAnnotations ( this . currentPackage . annotations [ <NUM_LIT:0> ] ) ; } try { if ( this . types != null ) { for ( int i = startingTypeIndex , count = this . types . length ; i < count ; i ++ ) { this . types [ i ] . resolve ( this . scope ) ; } } if ( ! this . compilationResult . hasErrors ( ) ) checkUnusedImports ( ) ; reportNLSProblems ( ) ; } catch ( AbortCompilationUnit e ) { this . ignoreFurtherInvestigation = true ; return ; } } private void reportNLSProblems ( ) { if ( this . nlsTags != null || this . stringLiterals != null ) { final int stringLiteralsLength = this . stringLiteralsPtr ; final int nlsTagsLength = this . nlsTags == null ? <NUM_LIT:0> : this . nlsTags . length ; if ( stringLiteralsLength == <NUM_LIT:0> ) { if ( nlsTagsLength != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < nlsTagsLength ; i ++ ) { NLSTag tag = this . nlsTags [ i ] ; if ( tag != null ) { this . scope . problemReporter ( ) . unnecessaryNLSTags ( tag . start , tag . end ) ; } } } } else if ( nlsTagsLength == <NUM_LIT:0> ) { if ( this . stringLiterals . length != stringLiteralsLength ) { System . arraycopy ( this . stringLiterals , <NUM_LIT:0> , ( this . stringLiterals = new StringLiteral [ stringLiteralsLength ] ) , <NUM_LIT:0> , stringLiteralsLength ) ; } Arrays . sort ( this . stringLiterals , STRING_LITERAL_COMPARATOR ) ; for ( int i = <NUM_LIT:0> ; i < stringLiteralsLength ; i ++ ) { this . scope . problemReporter ( ) . nonExternalizedStringLiteral ( this . stringLiterals [ i ] ) ; } } else { if ( this . stringLiterals . length != stringLiteralsLength ) { System . arraycopy ( this . stringLiterals , <NUM_LIT:0> , ( this . stringLiterals = new StringLiteral [ stringLiteralsLength ] ) , <NUM_LIT:0> , stringLiteralsLength ) ; } Arrays . sort ( this . stringLiterals , STRING_LITERAL_COMPARATOR ) ; int indexInLine = <NUM_LIT:1> ; int lastLineNumber = - <NUM_LIT:1> ; StringLiteral literal = null ; int index = <NUM_LIT:0> ; int i = <NUM_LIT:0> ; stringLiteralsLoop : for ( ; i < stringLiteralsLength ; i ++ ) { literal = this . stringLiterals [ i ] ; final int literalLineNumber = literal . lineNumber ; if ( lastLineNumber != literalLineNumber ) { indexInLine = <NUM_LIT:1> ; lastLineNumber = literalLineNumber ; } else { indexInLine ++ ; } if ( index < nlsTagsLength ) { nlsTagsLoop : for ( ; index < nlsTagsLength ; index ++ ) { NLSTag tag = this . nlsTags [ index ] ; if ( tag == null ) continue nlsTagsLoop ; int tagLineNumber = tag . lineNumber ; if ( literalLineNumber < tagLineNumber ) { this . scope . problemReporter ( ) . nonExternalizedStringLiteral ( literal ) ; continue stringLiteralsLoop ; } else if ( literalLineNumber == tagLineNumber ) { if ( tag . index == indexInLine ) { this . nlsTags [ index ] = null ; index ++ ; continue stringLiteralsLoop ; } else { nlsTagsLoop2 : for ( int index2 = index + <NUM_LIT:1> ; index2 < nlsTagsLength ; index2 ++ ) { NLSTag tag2 = this . nlsTags [ index2 ] ; if ( tag2 == null ) continue nlsTagsLoop2 ; int tagLineNumber2 = tag2 . lineNumber ; if ( literalLineNumber == tagLineNumber2 ) { if ( tag2 . index == indexInLine ) { this . nlsTags [ index2 ] = null ; continue stringLiteralsLoop ; } else { continue nlsTagsLoop2 ; } } else { this . scope . problemReporter ( ) . nonExternalizedStringLiteral ( literal ) ; continue stringLiteralsLoop ; } } this . scope . problemReporter ( ) . nonExternalizedStringLiteral ( literal ) ; continue stringLiteralsLoop ; } } else { this . scope . problemReporter ( ) . unnecessaryNLSTags ( tag . start , tag . end ) ; continue nlsTagsLoop ; } } } break stringLiteralsLoop ; } for ( ; i < stringLiteralsLength ; i ++ ) { this . scope . problemReporter ( ) . nonExternalizedStringLiteral ( this . stringLiterals [ i ] ) ; } if ( index < nlsTagsLength ) { for ( ; index < nlsTagsLength ; index ++ ) { NLSTag tag = this . nlsTags [ index ] ; if ( tag != null ) { this . scope . problemReporter ( ) . unnecessaryNLSTags ( tag . start , tag . end ) ; } } } } } } public void tagAsHavingErrors ( ) { this . ignoreFurtherInvestigation = true ; } public void traverse ( ASTVisitor visitor , CompilationUnitScope unitScope ) { if ( this . ignoreFurtherInvestigation ) return ; try { if ( visitor . visit ( this , this . scope ) ) { if ( this . types != null && isPackageInfo ( ) ) { final TypeDeclaration syntheticTypeDeclaration = this . types [ <NUM_LIT:0> ] ; final MethodScope methodScope = syntheticTypeDeclaration . staticInitializerScope ; if ( this . javadoc != null && methodScope != null ) { this . javadoc . traverse ( visitor , methodScope ) ; } if ( this . currentPackage != null && methodScope != null ) { final Annotation [ ] annotations = this . currentPackage . annotations ; if ( annotations != null ) { int annotationsLength = annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) { annotations [ i ] . traverse ( visitor , methodScope ) ; } } } } if ( this . currentPackage != null ) { this . currentPackage . traverse ( visitor , this . scope ) ; } if ( this . imports != null ) { int importLength = this . imports . length ; for ( int i = <NUM_LIT:0> ; i < importLength ; i ++ ) { this . imports [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . types != null ) { int typesLength = this . types . length ; for ( int i = <NUM_LIT:0> ; i < typesLength ; i ++ ) { this . types [ i ] . traverse ( visitor , this . scope ) ; } } } visitor . endVisit ( this , this . scope ) ; } catch ( AbortCompilationUnit e ) { } } public CompilationUnitScope buildCompilationUnitScope ( LookupEnvironment lookupEnvironment ) { return new CompilationUnitScope ( this , lookupEnvironment ) ; } public org . eclipse . jdt . core . dom . CompilationUnit getSpecialDomCompilationUnit ( org . eclipse . jdt . core . dom . AST ast ) { return null ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import java . util . Arrays ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; public class SwitchStatement extends Statement { public Expression expression ; public Statement [ ] statements ; public BlockScope scope ; public int explicitDeclarations ; public BranchLabel breakLabel ; public CaseStatement [ ] cases ; public CaseStatement defaultCase ; public int blockStart ; public int caseCount ; int [ ] constants ; String [ ] stringConstants ; public final static int CASE = <NUM_LIT:0> ; public final static int FALLTHROUGH = <NUM_LIT:1> ; public final static int ESCAPING = <NUM_LIT:2> ; private static final char [ ] SecretStringVariableName = "<STR_LIT>" . toCharArray ( ) ; public SyntheticMethodBinding synthetic ; int preSwitchInitStateIndex = - <NUM_LIT:1> ; int mergedInitStateIndex = - <NUM_LIT:1> ; CaseStatement [ ] duplicateCaseStatements = null ; int duplicateCaseStatementsCounter = <NUM_LIT:0> ; private LocalVariableBinding dispatchStringCopy = null ; public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { try { flowInfo = this . expression . analyseCode ( currentScope , flowContext , flowInfo ) ; if ( ( this . expression . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> || ( this . expression . resolvedType != null && this . expression . resolvedType . id == T_JavaLangString ) ) { this . expression . checkNPE ( currentScope , flowContext , flowInfo ) ; } SwitchFlowContext switchContext = new SwitchFlowContext ( flowContext , this , ( this . breakLabel = new BranchLabel ( ) ) ) ; FlowInfo caseInits = FlowInfo . DEAD_END ; this . preSwitchInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; int caseIndex = <NUM_LIT:0> ; if ( this . statements != null ) { int initialComplaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? Statement . COMPLAINED_FAKE_REACHABLE : Statement . NOT_COMPLAINED ; int complaintLevel = initialComplaintLevel ; int fallThroughState = CASE ; for ( int i = <NUM_LIT:0> , max = this . statements . length ; i < max ; i ++ ) { Statement statement = this . statements [ i ] ; if ( ( caseIndex < this . caseCount ) && ( statement == this . cases [ caseIndex ] ) ) { this . scope . enclosingCase = this . cases [ caseIndex ] ; caseIndex ++ ; if ( fallThroughState == FALLTHROUGH && ( statement . bits & ASTNode . DocumentedFallthrough ) == <NUM_LIT:0> ) { this . scope . problemReporter ( ) . possibleFallThroughCase ( this . scope . enclosingCase ) ; } caseInits = caseInits . mergedWith ( flowInfo . unconditionalInits ( ) ) ; complaintLevel = initialComplaintLevel ; fallThroughState = CASE ; } else if ( statement == this . defaultCase ) { this . scope . enclosingCase = this . defaultCase ; if ( fallThroughState == FALLTHROUGH && ( statement . bits & ASTNode . DocumentedFallthrough ) == <NUM_LIT:0> ) { this . scope . problemReporter ( ) . possibleFallThroughCase ( this . scope . enclosingCase ) ; } caseInits = caseInits . mergedWith ( flowInfo . unconditionalInits ( ) ) ; complaintLevel = initialComplaintLevel ; fallThroughState = CASE ; } else { fallThroughState = FALLTHROUGH ; } if ( ( complaintLevel = statement . complainIfUnreachable ( caseInits , this . scope , complaintLevel ) ) < Statement . COMPLAINED_UNREACHABLE ) { caseInits = statement . analyseCode ( this . scope , switchContext , caseInits ) ; if ( caseInits == FlowInfo . DEAD_END ) { fallThroughState = ESCAPING ; } } } } final TypeBinding resolvedTypeBinding = this . expression . resolvedType ; if ( resolvedTypeBinding . isEnum ( ) ) { final SourceTypeBinding sourceTypeBinding = currentScope . classScope ( ) . referenceContext . binding ; this . synthetic = sourceTypeBinding . addSyntheticMethodForSwitchEnum ( resolvedTypeBinding ) ; } if ( this . defaultCase == null ) { flowInfo . addPotentialInitializationsFrom ( caseInits . mergedWith ( switchContext . initsOnBreak ) ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; return flowInfo ; } FlowInfo mergedInfo = caseInits . mergedWith ( switchContext . initsOnBreak ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } finally { if ( this . scope != null ) this . scope . enclosingCase = null ; } } public void generateCodeForStringSwitch ( BlockScope currentScope , CodeStream codeStream ) { try { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; class StringSwitchCase implements Comparable { int hashCode ; String string ; BranchLabel label ; public StringSwitchCase ( int hashCode , String string , BranchLabel label ) { this . hashCode = hashCode ; this . string = string ; this . label = label ; } public int compareTo ( Object o ) { StringSwitchCase that = ( StringSwitchCase ) o ; if ( this . hashCode == that . hashCode ) { return <NUM_LIT:0> ; } if ( this . hashCode > that . hashCode ) { return <NUM_LIT:1> ; } return - <NUM_LIT:1> ; } public String toString ( ) { return "<STR_LIT>" + "<STR_LIT>" + this . hashCode + "<STR_LIT>" + this . string + "<STR_LIT>" ; } } final boolean hasCases = this . caseCount != <NUM_LIT:0> ; StringSwitchCase [ ] stringCases = new StringSwitchCase [ this . caseCount ] ; BranchLabel [ ] sourceCaseLabels = new BranchLabel [ this . caseCount ] ; CaseLabel [ ] hashCodeCaseLabels = new CaseLabel [ this . caseCount ] ; this . constants = new int [ this . caseCount ] ; for ( int i = <NUM_LIT:0> , max = this . caseCount ; i < max ; i ++ ) { this . cases [ i ] . targetLabel = ( sourceCaseLabels [ i ] = new BranchLabel ( codeStream ) ) ; sourceCaseLabels [ i ] . tagBits |= BranchLabel . USED ; stringCases [ i ] = new StringSwitchCase ( this . stringConstants [ i ] . hashCode ( ) , this . stringConstants [ i ] , sourceCaseLabels [ i ] ) ; hashCodeCaseLabels [ i ] = new CaseLabel ( codeStream ) ; hashCodeCaseLabels [ i ] . tagBits |= BranchLabel . USED ; } Arrays . sort ( stringCases ) ; int uniqHashCount = <NUM_LIT:0> ; int lastHashCode = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . caseCount ; i < length ; ++ i ) { int hashCode = stringCases [ i ] . hashCode ; if ( i == <NUM_LIT:0> || hashCode != lastHashCode ) { lastHashCode = this . constants [ uniqHashCount ++ ] = hashCode ; } } if ( uniqHashCount != this . caseCount ) { System . arraycopy ( this . constants , <NUM_LIT:0> , this . constants = new int [ uniqHashCount ] , <NUM_LIT:0> , uniqHashCount ) ; System . arraycopy ( hashCodeCaseLabels , <NUM_LIT:0> , hashCodeCaseLabels = new CaseLabel [ uniqHashCount ] , <NUM_LIT:0> , uniqHashCount ) ; } int [ ] sortedIndexes = new int [ uniqHashCount ] ; for ( int i = <NUM_LIT:0> ; i < uniqHashCount ; i ++ ) { sortedIndexes [ i ] = i ; } CaseLabel defaultCaseLabel = new CaseLabel ( codeStream ) ; defaultCaseLabel . tagBits |= BranchLabel . USED ; this . breakLabel . initialize ( codeStream ) ; BranchLabel defaultBranchLabel = new BranchLabel ( codeStream ) ; if ( hasCases ) defaultBranchLabel . tagBits |= BranchLabel . USED ; if ( this . defaultCase != null ) { this . defaultCase . targetLabel = defaultBranchLabel ; } this . expression . generateCode ( currentScope , codeStream , true ) ; codeStream . store ( this . dispatchStringCopy , true ) ; codeStream . addVariable ( this . dispatchStringCopy ) ; codeStream . invokeStringHashCode ( ) ; if ( hasCases ) { codeStream . lookupswitch ( defaultCaseLabel , this . constants , sortedIndexes , hashCodeCaseLabels ) ; for ( int i = <NUM_LIT:0> , j = <NUM_LIT:0> , max = this . caseCount ; i < max ; i ++ ) { int hashCode = stringCases [ i ] . hashCode ; if ( i == <NUM_LIT:0> || hashCode != lastHashCode ) { lastHashCode = hashCode ; if ( i != <NUM_LIT:0> ) { codeStream . goto_ ( defaultBranchLabel ) ; } hashCodeCaseLabels [ j ++ ] . place ( ) ; } codeStream . load ( this . dispatchStringCopy ) ; codeStream . ldc ( stringCases [ i ] . string ) ; codeStream . invokeStringEquals ( ) ; codeStream . ifne ( stringCases [ i ] . label ) ; } codeStream . goto_ ( defaultBranchLabel ) ; } else { codeStream . pop ( ) ; } int caseIndex = <NUM_LIT:0> ; if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , maxCases = this . statements . length ; i < maxCases ; i ++ ) { Statement statement = this . statements [ i ] ; if ( ( caseIndex < this . caseCount ) && ( statement == this . cases [ caseIndex ] ) ) { this . scope . enclosingCase = this . cases [ caseIndex ] ; if ( this . preSwitchInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preSwitchInitStateIndex ) ; } caseIndex ++ ; } else { if ( statement == this . defaultCase ) { defaultCaseLabel . place ( ) ; this . scope . enclosingCase = this . defaultCase ; if ( this . preSwitchInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preSwitchInitStateIndex ) ; } } } statement . generateCode ( this . scope , codeStream ) ; } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . removeVariable ( this . dispatchStringCopy ) ; if ( this . scope != currentScope ) { codeStream . exitUserScope ( this . scope ) ; } this . breakLabel . place ( ) ; if ( this . defaultCase == null ) { codeStream . recordPositionsFrom ( codeStream . position , this . sourceEnd , true ) ; defaultCaseLabel . place ( ) ; defaultBranchLabel . place ( ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } finally { if ( this . scope != null ) this . scope . enclosingCase = null ; } } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( this . expression . resolvedType . id == TypeIds . T_JavaLangString ) { generateCodeForStringSwitch ( currentScope , codeStream ) ; return ; } try { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; this . breakLabel . initialize ( codeStream ) ; CaseLabel [ ] caseLabels = new CaseLabel [ this . caseCount ] ; for ( int i = <NUM_LIT:0> , max = this . caseCount ; i < max ; i ++ ) { this . cases [ i ] . targetLabel = ( caseLabels [ i ] = new CaseLabel ( codeStream ) ) ; caseLabels [ i ] . tagBits |= BranchLabel . USED ; } CaseLabel defaultLabel = new CaseLabel ( codeStream ) ; final boolean hasCases = this . caseCount != <NUM_LIT:0> ; if ( hasCases ) defaultLabel . tagBits |= BranchLabel . USED ; if ( this . defaultCase != null ) { this . defaultCase . targetLabel = defaultLabel ; } final TypeBinding resolvedType = this . expression . resolvedType ; boolean valueRequired = false ; if ( resolvedType . isEnum ( ) ) { codeStream . invoke ( Opcodes . OPC_invokestatic , this . synthetic , null ) ; this . expression . generateCode ( currentScope , codeStream , true ) ; codeStream . invokeEnumOrdinal ( resolvedType . constantPoolName ( ) ) ; codeStream . iaload ( ) ; if ( ! hasCases ) { codeStream . pop ( ) ; } } else { valueRequired = this . expression . constant == Constant . NotAConstant || hasCases ; this . expression . generateCode ( currentScope , codeStream , valueRequired ) ; } if ( hasCases ) { int [ ] sortedIndexes = new int [ this . caseCount ] ; for ( int i = <NUM_LIT:0> ; i < this . caseCount ; i ++ ) { sortedIndexes [ i ] = i ; } int [ ] localKeysCopy ; System . arraycopy ( this . constants , <NUM_LIT:0> , ( localKeysCopy = new int [ this . caseCount ] ) , <NUM_LIT:0> , this . caseCount ) ; CodeStream . sort ( localKeysCopy , <NUM_LIT:0> , this . caseCount - <NUM_LIT:1> , sortedIndexes ) ; int max = localKeysCopy [ this . caseCount - <NUM_LIT:1> ] ; int min = localKeysCopy [ <NUM_LIT:0> ] ; if ( ( long ) ( this . caseCount * <NUM_LIT> ) > ( ( long ) max - ( long ) min ) ) { if ( max > <NUM_LIT> && currentScope . compilerOptions ( ) . complianceLevel < ClassFileConstants . JDK1_4 ) { codeStream . lookupswitch ( defaultLabel , this . constants , sortedIndexes , caseLabels ) ; } else { codeStream . tableswitch ( defaultLabel , min , max , this . constants , sortedIndexes , caseLabels ) ; } } else { codeStream . lookupswitch ( defaultLabel , this . constants , sortedIndexes , caseLabels ) ; } codeStream . updateLastRecordedEndPC ( this . scope , codeStream . position ) ; } else if ( valueRequired ) { codeStream . pop ( ) ; } int caseIndex = <NUM_LIT:0> ; if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , maxCases = this . statements . length ; i < maxCases ; i ++ ) { Statement statement = this . statements [ i ] ; if ( ( caseIndex < this . caseCount ) && ( statement == this . cases [ caseIndex ] ) ) { this . scope . enclosingCase = this . cases [ caseIndex ] ; if ( this . preSwitchInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preSwitchInitStateIndex ) ; } caseIndex ++ ; } else { if ( statement == this . defaultCase ) { this . scope . enclosingCase = this . defaultCase ; if ( this . preSwitchInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preSwitchInitStateIndex ) ; } } } statement . generateCode ( this . scope , codeStream ) ; } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } if ( this . scope != currentScope ) { codeStream . exitUserScope ( this . scope ) ; } this . breakLabel . place ( ) ; if ( this . defaultCase == null ) { codeStream . recordPositionsFrom ( codeStream . position , this . sourceEnd , true ) ; defaultLabel . place ( ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } finally { if ( this . scope != null ) this . scope . enclosingCase = null ; } } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; this . expression . printExpression ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; if ( this . statements != null ) { for ( int i = <NUM_LIT:0> ; i < this . statements . length ; i ++ ) { output . append ( '<STR_LIT:\n>' ) ; if ( this . statements [ i ] instanceof CaseStatement ) { this . statements [ i ] . printStatement ( indent , output ) ; } else { this . statements [ i ] . printStatement ( indent + <NUM_LIT:2> , output ) ; } } } output . append ( "<STR_LIT:n>" ) ; return printIndent ( indent , output ) . append ( '<CHAR_LIT:}>' ) ; } public void resolve ( BlockScope upperScope ) { try { boolean isEnumSwitch = false ; boolean isStringSwitch = false ; TypeBinding expressionType = this . expression . resolveType ( upperScope ) ; if ( expressionType != null ) { this . expression . computeConversion ( upperScope , expressionType , expressionType ) ; checkType : { if ( ! expressionType . isValidBinding ( ) ) { expressionType = null ; break checkType ; } else if ( expressionType . isBaseType ( ) ) { if ( this . expression . isConstantValueOfTypeAssignableToType ( expressionType , TypeBinding . INT ) ) break checkType ; if ( expressionType . isCompatibleWith ( TypeBinding . INT ) ) break checkType ; } else if ( expressionType . isEnum ( ) ) { isEnumSwitch = true ; break checkType ; } else if ( upperScope . isBoxingCompatibleWith ( expressionType , TypeBinding . INT ) ) { this . expression . computeConversion ( upperScope , TypeBinding . INT , expressionType ) ; break checkType ; } else if ( upperScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_7 && expressionType . id == TypeIds . T_JavaLangString ) { isStringSwitch = true ; break checkType ; } upperScope . problemReporter ( ) . incorrectSwitchType ( this . expression , expressionType ) ; expressionType = null ; } } if ( isStringSwitch ) { this . dispatchStringCopy = new LocalVariableBinding ( SecretStringVariableName , upperScope . getJavaLangString ( ) , ClassFileConstants . AccDefault , false ) ; upperScope . addLocalVariable ( this . dispatchStringCopy ) ; this . dispatchStringCopy . setConstant ( Constant . NotAConstant ) ; this . dispatchStringCopy . useFlag = LocalVariableBinding . USED ; } if ( this . statements != null ) { this . scope = new BlockScope ( upperScope ) ; int length ; this . cases = new CaseStatement [ length = this . statements . length ] ; if ( ! isStringSwitch ) { this . constants = new int [ length ] ; } else { this . stringConstants = new String [ length ] ; } int counter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Constant constant ; final Statement statement = this . statements [ i ] ; if ( ( constant = statement . resolveCase ( this . scope , expressionType , this ) ) != Constant . NotAConstant ) { if ( ! isStringSwitch ) { int key = constant . intValue ( ) ; for ( int j = <NUM_LIT:0> ; j < counter ; j ++ ) { if ( this . constants [ j ] == key ) { reportDuplicateCase ( ( CaseStatement ) statement , this . cases [ j ] , length ) ; } } this . constants [ counter ++ ] = key ; } else { String key = constant . stringValue ( ) ; for ( int j = <NUM_LIT:0> ; j < counter ; j ++ ) { if ( this . stringConstants [ j ] . equals ( key ) ) { reportDuplicateCase ( ( CaseStatement ) statement , this . cases [ j ] , length ) ; } } this . stringConstants [ counter ++ ] = key ; } } } if ( length != counter ) { if ( ! isStringSwitch ) { System . arraycopy ( this . constants , <NUM_LIT:0> , this . constants = new int [ counter ] , <NUM_LIT:0> , counter ) ; } else { System . arraycopy ( this . stringConstants , <NUM_LIT:0> , this . stringConstants = new String [ counter ] , <NUM_LIT:0> , counter ) ; } } } else { if ( ( this . bits & UndocumentedEmptyBlock ) != <NUM_LIT:0> ) { upperScope . problemReporter ( ) . undocumentedEmptyBlock ( this . blockStart , this . sourceEnd ) ; } } if ( isEnumSwitch && this . defaultCase == null && upperScope . compilerOptions ( ) . getSeverity ( CompilerOptions . IncompleteEnumSwitch ) != ProblemSeverities . Ignore ) { int constantCount = this . constants == null ? <NUM_LIT:0> : this . constants . length ; if ( constantCount == this . caseCount && this . caseCount != ( ( ReferenceBinding ) expressionType ) . enumConstantCount ( ) ) { FieldBinding [ ] enumFields = ( ( ReferenceBinding ) expressionType . erasure ( ) ) . fields ( ) ; for ( int i = <NUM_LIT:0> , max = enumFields . length ; i < max ; i ++ ) { FieldBinding enumConstant = enumFields [ i ] ; if ( ( enumConstant . modifiers & ClassFileConstants . AccEnum ) == <NUM_LIT:0> ) continue ; findConstant : { for ( int j = <NUM_LIT:0> ; j < this . caseCount ; j ++ ) { if ( ( enumConstant . id + <NUM_LIT:1> ) == this . constants [ j ] ) break findConstant ; } upperScope . problemReporter ( ) . missingEnumConstantCase ( this , enumConstant ) ; } } } } } finally { if ( this . scope != null ) this . scope . enclosingCase = null ; } } private void reportDuplicateCase ( final CaseStatement duplicate , final CaseStatement original , int length ) { if ( this . duplicateCaseStatements == null ) { this . scope . problemReporter ( ) . duplicateCase ( original ) ; this . scope . problemReporter ( ) . duplicateCase ( duplicate ) ; this . duplicateCaseStatements = new CaseStatement [ length ] ; this . duplicateCaseStatements [ this . duplicateCaseStatementsCounter ++ ] = original ; this . duplicateCaseStatements [ this . duplicateCaseStatementsCounter ++ ] = duplicate ; } else { boolean found = false ; searchReportedDuplicate : for ( int k = <NUM_LIT:2> ; k < this . duplicateCaseStatementsCounter ; k ++ ) { if ( this . duplicateCaseStatements [ k ] == duplicate ) { found = true ; break searchReportedDuplicate ; } } if ( ! found ) { this . scope . problemReporter ( ) . duplicateCase ( duplicate ) ; this . duplicateCaseStatements [ this . duplicateCaseStatementsCounter ++ ] = duplicate ; } } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . expression . traverse ( visitor , blockScope ) ; if ( this . statements != null ) { int statementsLength = this . statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) this . statements [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , blockScope ) ; } public void branchChainTo ( BranchLabel label ) { if ( this . breakLabel . forwardReferenceCount ( ) > <NUM_LIT:0> ) { label . becomeDelegateFor ( this . breakLabel ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; public interface OperatorIds { public static final int AND_AND = <NUM_LIT:0> ; public static final int OR_OR = <NUM_LIT:1> ; public static final int AND = <NUM_LIT:2> ; public static final int OR = <NUM_LIT:3> ; public static final int LESS = <NUM_LIT:4> ; public static final int LESS_EQUAL = <NUM_LIT:5> ; public static final int GREATER = <NUM_LIT:6> ; public static final int GREATER_EQUAL = <NUM_LIT:7> ; public static final int XOR = <NUM_LIT:8> ; public static final int DIVIDE = <NUM_LIT:9> ; public static final int LEFT_SHIFT = <NUM_LIT:10> ; public static final int NOT = <NUM_LIT:11> ; public static final int TWIDDLE = <NUM_LIT:12> ; public static final int MINUS = <NUM_LIT> ; public static final int PLUS = <NUM_LIT> ; public static final int MULTIPLY = <NUM_LIT:15> ; public static final int REMAINDER = <NUM_LIT:16> ; public static final int RIGHT_SHIFT = <NUM_LIT> ; public static final int EQUAL_EQUAL = <NUM_LIT> ; public static final int UNSIGNED_RIGHT_SHIFT = <NUM_LIT> ; public static final int NumberOfTables = <NUM_LIT:20> ; public static final int QUESTIONCOLON = <NUM_LIT> ; public static final int NOT_EQUAL = <NUM_LIT> ; public static final int EQUAL = <NUM_LIT:30> ; public static final int INSTANCEOF = <NUM_LIT:31> ; public static final int PLUS_PLUS = <NUM_LIT:32> ; public static final int MINUS_MINUS = <NUM_LIT> ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; public class EmptyStatement extends Statement { public EmptyStatement ( int startPosition , int endPosition ) { this . sourceStart = startPosition ; this . sourceEnd = endPosition ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public int complainIfUnreachable ( FlowInfo flowInfo , BlockScope scope , int complaintLevel ) { if ( scope . compilerOptions ( ) . complianceLevel < ClassFileConstants . JDK1_4 ) { return complaintLevel ; } return super . complainIfUnreachable ( flowInfo , scope , complaintLevel ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { } public StringBuffer printStatement ( int tab , StringBuffer output ) { return printIndent ( tab , output ) . append ( '<CHAR_LIT:;>' ) ; } public void resolve ( BlockScope scope ) { if ( ( this . bits & IsUsefulEmptyStatement ) == <NUM_LIT:0> ) { scope . problemReporter ( ) . superfluousSemicolon ( this . sourceStart , this . sourceEnd ) ; } else { scope . problemReporter ( ) . emptyControlFlowStatement ( this . sourceStart , this . sourceEnd ) ; } } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class PostfixExpression extends CompoundAssignment { public PostfixExpression ( Expression lhs , Expression expression , int operator , int pos ) { super ( lhs , expression , operator , pos ) ; this . sourceStart = lhs . sourceStart ; this . sourceEnd = pos ; } public boolean checkCastCompatibility ( ) { return false ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; ( ( Reference ) this . lhs ) . generatePostIncrement ( currentScope , codeStream , this , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public String operatorToString ( ) { switch ( this . operator ) { case PLUS : return "<STR_LIT>" ; case MINUS : return "<STR_LIT:-->" ; } return "<STR_LIT>" ; } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { return this . lhs . printExpression ( indent , output ) . append ( '<CHAR_LIT:U+0020>' ) . append ( operatorToString ( ) ) ; } public boolean restrainUsageToNumericTypes ( ) { return true ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . lhs . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class UnionTypeReference extends TypeReference { public TypeReference [ ] typeReferences ; public UnionTypeReference ( TypeReference [ ] typeReferences ) { this . bits |= ASTNode . IsUnionType ; this . typeReferences = typeReferences ; this . sourceStart = typeReferences [ <NUM_LIT:0> ] . sourceStart ; int length = typeReferences . length ; this . sourceEnd = typeReferences [ length - <NUM_LIT:1> ] . sourceEnd ; } public TypeReference copyDims ( int dim ) { return this ; } public char [ ] getLastToken ( ) { return null ; } protected TypeBinding getTypeBinding ( Scope scope ) { return null ; } public TypeBinding resolveType ( BlockScope scope , boolean checkBounds ) { int length = this . typeReferences . length ; TypeBinding [ ] allExceptionTypes = new TypeBinding [ length ] ; boolean hasError = false ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeBinding exceptionType = this . typeReferences [ i ] . resolveType ( scope , checkBounds ) ; if ( exceptionType == null ) { return null ; } switch ( exceptionType . kind ( ) ) { case Binding . PARAMETERIZED_TYPE : if ( exceptionType . isBoundParameterizedType ( ) ) { hasError = true ; scope . problemReporter ( ) . invalidParameterizedExceptionType ( exceptionType , this . typeReferences [ i ] ) ; } break ; case Binding . TYPE_PARAMETER : scope . problemReporter ( ) . invalidTypeVariableAsException ( exceptionType , this . typeReferences [ i ] ) ; hasError = true ; break ; } if ( exceptionType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaLangThrowable , true ) == null && exceptionType . isValidBinding ( ) ) { scope . problemReporter ( ) . cannotThrowType ( this . typeReferences [ i ] , exceptionType ) ; hasError = true ; } allExceptionTypes [ i ] = exceptionType ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { if ( allExceptionTypes [ j ] . isCompatibleWith ( exceptionType ) ) { scope . problemReporter ( ) . wrongSequenceOfExceptionTypes ( this . typeReferences [ j ] , allExceptionTypes [ j ] , exceptionType ) ; hasError = true ; } else if ( exceptionType . isCompatibleWith ( allExceptionTypes [ j ] ) ) { scope . problemReporter ( ) . wrongSequenceOfExceptionTypes ( this . typeReferences [ i ] , exceptionType , allExceptionTypes [ j ] ) ; hasError = true ; } } } if ( hasError ) { return null ; } return ( this . resolvedType = scope . lowerUpperBound ( allExceptionTypes ) ) ; } public char [ ] [ ] getTypeName ( ) { return this . typeReferences [ <NUM_LIT:0> ] . getTypeName ( ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { int length = this . typeReferences == null ? <NUM_LIT:0> : this . typeReferences . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . typeReferences [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { if ( visitor . visit ( this , scope ) ) { int length = this . typeReferences == null ? <NUM_LIT:0> : this . typeReferences . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . typeReferences [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { int length = this . typeReferences == null ? <NUM_LIT:0> : this . typeReferences . length ; printIndent ( indent , output ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . typeReferences [ i ] . printExpression ( <NUM_LIT:0> , output ) ; if ( i != length - <NUM_LIT:1> ) { output . append ( "<STR_LIT>" ) ; } } return output ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . impl . IntConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; public class IntLiteral extends NumberLiteral { private static final char [ ] HEXA_MIN_VALUE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] HEXA_MINUS_ONE_VALUE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] OCTAL_MIN_VALUE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] OCTAL_MINUS_ONE_VALUE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] DECIMAL_MIN_VALUE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] DECIMAL_MAX_VALUE = "<STR_LIT>" . toCharArray ( ) ; private char [ ] reducedForm ; public int value ; public static final IntLiteral One = new IntLiteral ( new char [ ] { '<CHAR_LIT:1>' } , null , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , IntConstant . fromValue ( <NUM_LIT:1> ) ) ; public static IntLiteral buildIntLiteral ( char [ ] token , int s , int e ) { char [ ] intReducedToken = removePrefixZerosAndUnderscores ( token , false ) ; return new IntLiteral ( token , intReducedToken != token ? intReducedToken : null , s , e ) ; } IntLiteral ( char [ ] token , char [ ] reducedForm , int start , int end ) { super ( token , start , end ) ; this . reducedForm = reducedForm ; } IntLiteral ( char [ ] token , char [ ] reducedForm , int start , int end , int value , Constant constant ) { super ( token , start , end ) ; this . reducedForm = reducedForm ; this . value = value ; this . constant = constant ; } public void computeConstant ( ) { char [ ] token = this . reducedForm != null ? this . reducedForm : this . source ; int tokenLength = token . length ; int radix = <NUM_LIT:10> ; int j = <NUM_LIT:0> ; if ( token [ <NUM_LIT:0> ] == '<CHAR_LIT:0>' ) { if ( tokenLength == <NUM_LIT:1> ) { this . constant = IntConstant . fromValue ( <NUM_LIT:0> ) ; return ; } if ( ( token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) || ( token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { radix = <NUM_LIT:16> ; j = <NUM_LIT:2> ; } else if ( ( token [ <NUM_LIT:1> ] == '<CHAR_LIT:b>' ) || ( token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { radix = <NUM_LIT:2> ; j = <NUM_LIT:2> ; } else { radix = <NUM_LIT:8> ; j = <NUM_LIT:1> ; } } switch ( radix ) { case <NUM_LIT:2> : if ( ( tokenLength - <NUM_LIT:2> ) > <NUM_LIT:32> ) { return ; } computeValue ( token , tokenLength , radix , j ) ; return ; case <NUM_LIT:16> : if ( tokenLength <= <NUM_LIT:10> ) { if ( CharOperation . equals ( token , HEXA_MINUS_ONE_VALUE ) ) { this . constant = IntConstant . fromValue ( - <NUM_LIT:1> ) ; return ; } computeValue ( token , tokenLength , radix , j ) ; return ; } break ; case <NUM_LIT:10> : if ( tokenLength > DECIMAL_MAX_VALUE . length || ( tokenLength == DECIMAL_MAX_VALUE . length && CharOperation . compareTo ( token , DECIMAL_MAX_VALUE ) > <NUM_LIT:0> ) ) { return ; } computeValue ( token , tokenLength , radix , j ) ; break ; case <NUM_LIT:8> : if ( tokenLength <= <NUM_LIT:12> ) { if ( tokenLength == <NUM_LIT:12> && token [ j ] > '<CHAR_LIT>' ) { return ; } if ( CharOperation . equals ( token , OCTAL_MINUS_ONE_VALUE ) ) { this . constant = IntConstant . fromValue ( - <NUM_LIT:1> ) ; return ; } computeValue ( token , tokenLength , radix , j ) ; return ; } break ; } } private void computeValue ( char [ ] token , int tokenLength , int radix , int j ) { int digitValue ; int computedValue = <NUM_LIT:0> ; while ( j < tokenLength ) { if ( ( digitValue = ScannerHelper . digit ( token [ j ++ ] , radix ) ) < <NUM_LIT:0> ) { return ; } computedValue = ( computedValue * radix ) + digitValue ; } this . constant = IntConstant . fromValue ( computedValue ) ; } public IntLiteral convertToMinValue ( ) { if ( ( ( this . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ) != <NUM_LIT:0> ) { return this ; } char [ ] token = this . reducedForm != null ? this . reducedForm : this . source ; switch ( token . length ) { case <NUM_LIT:10> : if ( CharOperation . equals ( token , DECIMAL_MIN_VALUE ) ) { return new IntLiteralMinValue ( this . source , this . reducedForm , this . sourceStart , this . sourceEnd ) ; } break ; } return this ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . INT ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class Assignment extends Expression { public Expression lhs ; public Expression expression ; public Assignment ( Expression lhs , Expression expression , int sourceEnd ) { this . lhs = lhs ; lhs . bits |= IsStrictlyAssigned ; this . expression = expression ; this . sourceStart = lhs . sourceStart ; this . sourceEnd = sourceEnd ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { LocalVariableBinding local = this . lhs . localVariableBinding ( ) ; if ( ( this . expression . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . expression . checkNPE ( currentScope , flowContext , flowInfo ) ; } flowInfo = ( ( Reference ) this . lhs ) . analyseAssignment ( currentScope , flowContext , flowInfo , this , false ) . unconditionalInits ( ) ; int nullStatus = this . expression . nullStatus ( flowInfo ) ; if ( local != null && ( local . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { if ( nullStatus == FlowInfo . NULL ) { flowContext . recordUsingNullReference ( currentScope , local , this . lhs , FlowContext . CAN_ONLY_NULL | FlowContext . IN_ASSIGNMENT , flowInfo ) ; } } nullStatus = checkAgainstNullAnnotation ( currentScope , local , nullStatus ) ; if ( local != null && ( local . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { flowInfo . markNullStatus ( local , nullStatus ) ; if ( flowContext . initsOnFinally != null ) flowContext . initsOnFinally . markNullStatus ( local , nullStatus ) ; } return flowInfo ; } void checkAssignment ( BlockScope scope , TypeBinding lhsType , TypeBinding rhsType ) { FieldBinding leftField = getLastField ( this . lhs ) ; if ( leftField != null && rhsType != TypeBinding . NULL && ( lhsType . kind ( ) == Binding . WILDCARD_TYPE ) && ( ( WildcardBinding ) lhsType ) . boundKind != Wildcard . SUPER ) { scope . problemReporter ( ) . wildcardAssignment ( lhsType , rhsType , this . expression ) ; } else if ( leftField != null && ! leftField . isStatic ( ) && leftField . declaringClass != null && leftField . declaringClass . isRawType ( ) ) { scope . problemReporter ( ) . unsafeRawFieldAssignment ( leftField , rhsType , this . lhs ) ; } else if ( rhsType . needsUncheckedConversion ( lhsType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( this . expression , rhsType , lhsType ) ; } } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; ( ( Reference ) this . lhs ) . generateAssignment ( currentScope , codeStream , this , valueRequired ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } FieldBinding getLastField ( Expression someExpression ) { if ( someExpression instanceof SingleNameReference ) { if ( ( someExpression . bits & RestrictiveFlagMASK ) == Binding . FIELD ) { return ( FieldBinding ) ( ( SingleNameReference ) someExpression ) . binding ; } } else if ( someExpression instanceof FieldReference ) { return ( ( FieldReference ) someExpression ) . binding ; } else if ( someExpression instanceof QualifiedNameReference ) { QualifiedNameReference qName = ( QualifiedNameReference ) someExpression ; if ( qName . otherBindings == null ) { if ( ( someExpression . bits & RestrictiveFlagMASK ) == Binding . FIELD ) { return ( FieldBinding ) qName . binding ; } } else { return qName . otherBindings [ qName . otherBindings . length - <NUM_LIT:1> ] ; } } return null ; } public int nullStatus ( FlowInfo flowInfo ) { return this . expression . nullStatus ( flowInfo ) ; } public StringBuffer print ( int indent , StringBuffer output ) { printIndent ( indent , output ) ; return printExpressionNoParenthesis ( indent , output ) ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { output . append ( '<CHAR_LIT:(>' ) ; return printExpressionNoParenthesis ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:)>' ) ; } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { this . lhs . printExpression ( indent , output ) . append ( "<STR_LIT:U+0020=U+0020>" ) ; return this . expression . printExpression ( <NUM_LIT:0> , output ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { return print ( indent , output ) . append ( '<CHAR_LIT:;>' ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; if ( ! ( this . lhs instanceof Reference ) || this . lhs . isThis ( ) ) { scope . problemReporter ( ) . expressionShouldBeAVariable ( this . lhs ) ; return null ; } TypeBinding lhsType = this . lhs . resolveType ( scope ) ; this . expression . setExpectedType ( lhsType ) ; if ( lhsType != null ) { this . resolvedType = lhsType . capture ( scope , this . sourceEnd ) ; } LocalVariableBinding localVariableBinding = this . lhs . localVariableBinding ( ) ; if ( localVariableBinding != null ) { localVariableBinding . tagBits &= ~ TagBits . IsEffectivelyFinal ; } TypeBinding rhsType = this . expression . resolveType ( scope ) ; if ( lhsType == null || rhsType == null ) { return null ; } Binding left = getDirectBinding ( this . lhs ) ; if ( left != null && ! left . isVolatile ( ) && left == getDirectBinding ( this . expression ) ) { scope . problemReporter ( ) . assignmentHasNoEffect ( this , left . shortReadableName ( ) ) ; } if ( lhsType != rhsType ) { scope . compilationUnitScope ( ) . recordTypeConversion ( lhsType , rhsType ) ; } if ( this . expression . isConstantValueOfTypeAssignableToType ( rhsType , lhsType ) || rhsType . isCompatibleWith ( lhsType ) ) { this . expression . computeConversion ( scope , lhsType , rhsType ) ; checkAssignment ( scope , lhsType , rhsType ) ; if ( this . expression instanceof CastExpression && ( this . expression . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , lhsType , ( CastExpression ) this . expression ) ; } return this . resolvedType ; } else if ( isBoxingCompatible ( rhsType , lhsType , this . expression , scope ) ) { this . expression . computeConversion ( scope , lhsType , rhsType ) ; if ( this . expression instanceof CastExpression && ( this . expression . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , lhsType , ( CastExpression ) this . expression ) ; } return this . resolvedType ; } scope . problemReporter ( ) . typeMismatchError ( rhsType , lhsType , this . expression , this . lhs ) ; return lhsType ; } public TypeBinding resolveTypeExpecting ( BlockScope scope , TypeBinding expectedType ) { TypeBinding type = super . resolveTypeExpecting ( scope , expectedType ) ; if ( type == null ) return null ; TypeBinding lhsType = this . resolvedType ; TypeBinding rhsType = this . expression . resolvedType ; if ( expectedType == TypeBinding . BOOLEAN && lhsType == TypeBinding . BOOLEAN && ( this . lhs . bits & IsStrictlyAssigned ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . possibleAccidentalBooleanAssignment ( this ) ; } checkAssignment ( scope , lhsType , rhsType ) ; return type ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . lhs . traverse ( visitor , scope ) ; this . expression . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } public LocalVariableBinding localVariableBinding ( ) { return this . lhs . localVariableBinding ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class SynchronizedStatement extends SubRoutineStatement { public Expression expression ; public Block block ; public BlockScope scope ; public LocalVariableBinding synchroVariable ; static final char [ ] SecretLocalDeclarationName = "<STR_LIT>" . toCharArray ( ) ; int preSynchronizedInitStateIndex = - <NUM_LIT:1> ; int mergedSynchronizedInitStateIndex = - <NUM_LIT:1> ; public SynchronizedStatement ( Expression expression , Block statement , int s , int e ) { this . expression = expression ; this . block = statement ; this . sourceEnd = e ; this . sourceStart = s ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . preSynchronizedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; this . synchroVariable . useFlag = LocalVariableBinding . USED ; flowInfo = this . block . analyseCode ( this . scope , new InsideSubRoutineFlowContext ( flowContext , this ) , this . expression . analyseCode ( this . scope , flowContext , flowInfo ) ) ; this . mergedSynchronizedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) { this . bits |= ASTNode . BlockExit ; } return flowInfo ; } public boolean isSubRoutineEscaping ( ) { return false ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } this . anyExceptionLabel = null ; int pc = codeStream . position ; this . expression . generateCode ( this . scope , codeStream , true ) ; if ( this . block . isEmptyBlock ( ) ) { switch ( this . synchroVariable . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } codeStream . monitorenter ( ) ; codeStream . monitorexit ( ) ; if ( this . scope != currentScope ) { codeStream . exitUserScope ( this . scope ) ; } } else { codeStream . store ( this . synchroVariable , true ) ; codeStream . addVariable ( this . synchroVariable ) ; codeStream . monitorenter ( ) ; enterAnyExceptionHandler ( codeStream ) ; this . block . generateCode ( this . scope , codeStream ) ; if ( this . scope != currentScope ) { codeStream . exitUserScope ( this . scope , this . synchroVariable ) ; } BranchLabel endLabel = new BranchLabel ( codeStream ) ; if ( ( this . bits & ASTNode . BlockExit ) == <NUM_LIT:0> ) { codeStream . load ( this . synchroVariable ) ; codeStream . monitorexit ( ) ; exitAnyExceptionHandler ( ) ; codeStream . goto_ ( endLabel ) ; enterAnyExceptionHandler ( codeStream ) ; } codeStream . pushExceptionOnStack ( this . scope . getJavaLangThrowable ( ) ) ; if ( this . preSynchronizedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preSynchronizedInitStateIndex ) ; } placeAllAnyExceptionHandler ( ) ; codeStream . load ( this . synchroVariable ) ; codeStream . monitorexit ( ) ; exitAnyExceptionHandler ( ) ; codeStream . athrow ( ) ; if ( this . mergedSynchronizedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedSynchronizedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedSynchronizedInitStateIndex ) ; } if ( this . scope != currentScope ) { codeStream . removeVariable ( this . synchroVariable ) ; } if ( ( this . bits & ASTNode . BlockExit ) == <NUM_LIT:0> ) { endLabel . place ( ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public boolean generateSubRoutineInvocation ( BlockScope currentScope , CodeStream codeStream , Object targetLocation , int stateIndex , LocalVariableBinding secretLocal ) { codeStream . load ( this . synchroVariable ) ; codeStream . monitorexit ( ) ; exitAnyExceptionHandler ( ) ; return false ; } public void resolve ( BlockScope upperScope ) { this . scope = new BlockScope ( upperScope ) ; TypeBinding type = this . expression . resolveType ( this . scope ) ; if ( type == null ) return ; switch ( type . id ) { case T_boolean : case T_char : case T_float : case T_double : case T_byte : case T_short : case T_int : case T_long : this . scope . problemReporter ( ) . invalidTypeToSynchronize ( this . expression , type ) ; break ; case T_void : this . scope . problemReporter ( ) . illegalVoidExpression ( this . expression ) ; break ; case T_null : this . scope . problemReporter ( ) . invalidNullToSynchronize ( this . expression ) ; break ; } this . synchroVariable = new LocalVariableBinding ( SecretLocalDeclarationName , type , ClassFileConstants . AccDefault , false ) ; this . scope . addLocalVariable ( this . synchroVariable ) ; this . synchroVariable . setConstant ( Constant . NotAConstant ) ; this . expression . computeConversion ( this . scope , type , type ) ; this . block . resolveUsing ( this . scope ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) ; output . append ( "<STR_LIT>" ) ; this . expression . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:)>' ) ; output . append ( '<STR_LIT:\n>' ) ; return this . block . printStatement ( indent + <NUM_LIT:1> , output ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . expression . traverse ( visitor , this . scope ) ; this . block . traverse ( visitor , this . scope ) ; } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; public abstract class ASTNode implements TypeConstants , TypeIds { public int sourceStart , sourceEnd ; public final static int Bit1 = <NUM_LIT> ; public final static int Bit2 = <NUM_LIT> ; public final static int Bit3 = <NUM_LIT> ; public final static int Bit4 = <NUM_LIT> ; public final static int Bit5 = <NUM_LIT> ; public final static int Bit6 = <NUM_LIT> ; public final static int Bit7 = <NUM_LIT> ; public final static int Bit8 = <NUM_LIT> ; public final static int Bit9 = <NUM_LIT> ; public final static int Bit10 = <NUM_LIT> ; public final static int Bit11 = <NUM_LIT> ; public final static int Bit12 = <NUM_LIT> ; public final static int Bit13 = <NUM_LIT> ; public final static int Bit14 = <NUM_LIT> ; public final static int Bit15 = <NUM_LIT> ; public final static int Bit16 = <NUM_LIT> ; public final static int Bit17 = <NUM_LIT> ; public final static int Bit18 = <NUM_LIT> ; public final static int Bit19 = <NUM_LIT> ; public final static int Bit20 = <NUM_LIT> ; public final static int Bit21 = <NUM_LIT> ; public final static int Bit22 = <NUM_LIT> ; public final static int Bit23 = <NUM_LIT> ; public final static int Bit24 = <NUM_LIT> ; public final static int Bit25 = <NUM_LIT> ; public final static int Bit26 = <NUM_LIT> ; public final static int Bit27 = <NUM_LIT> ; public final static int Bit28 = <NUM_LIT> ; public final static int Bit29 = <NUM_LIT> ; public final static int Bit30 = <NUM_LIT> ; public final static int Bit31 = <NUM_LIT> ; public final static int Bit32 = <NUM_LIT> ; public final static long Bit32L = <NUM_LIT> ; public final static long Bit33L = <NUM_LIT> ; public final static long Bit34L = <NUM_LIT> ; public final static long Bit35L = <NUM_LIT> ; public final static long Bit36L = <NUM_LIT> ; public final static long Bit37L = <NUM_LIT> ; public final static long Bit38L = <NUM_LIT> ; public final static long Bit39L = <NUM_LIT> ; public final static long Bit40L = <NUM_LIT> ; public final static long Bit41L = <NUM_LIT> ; public final static long Bit42L = <NUM_LIT> ; public final static long Bit43L = <NUM_LIT> ; public final static long Bit44L = <NUM_LIT> ; public final static long Bit45L = <NUM_LIT> ; public final static long Bit46L = <NUM_LIT> ; public final static long Bit47L = <NUM_LIT> ; public final static long Bit48L = <NUM_LIT> ; public final static long Bit49L = <NUM_LIT> ; public final static long Bit50L = <NUM_LIT> ; public final static long Bit51L = <NUM_LIT> ; public final static long Bit52L = <NUM_LIT> ; public final static long Bit53L = <NUM_LIT> ; public final static long Bit54L = <NUM_LIT> ; public final static long Bit55L = <NUM_LIT> ; public final static long Bit56L = <NUM_LIT> ; public final static long Bit57L = <NUM_LIT> ; public final static long Bit58L = <NUM_LIT> ; public final static long Bit59L = <NUM_LIT> ; public final static long Bit60L = <NUM_LIT> ; public final static long Bit61L = <NUM_LIT> ; public final static long Bit62L = <NUM_LIT> ; public final static long Bit63L = <NUM_LIT> ; public final static long Bit64L = <NUM_LIT> ; public int bits = IsReachable ; public static final int ReturnTypeIDMASK = Bit1 | Bit2 | Bit3 | Bit4 ; public static final int OperatorSHIFT = <NUM_LIT:6> ; public static final int OperatorMASK = Bit7 | Bit8 | Bit9 | Bit10 | Bit11 | Bit12 ; public static final int IsReturnedValue = Bit5 ; public static final int UnnecessaryCast = Bit15 ; public static final int DisableUnnecessaryCastCheck = Bit6 ; public static final int GenerateCheckcast = Bit7 ; public static final int UnsafeCast = Bit8 ; public static final int RestrictiveFlagMASK = Bit1 | Bit2 | Bit3 ; public static final int IsArgument = Bit3 ; public static final int FirstAssignmentToLocal = Bit4 ; public static final int NeedReceiverGenericCast = Bit19 ; public static final int IsImplicitThis = Bit3 ; public static final int DepthSHIFT = <NUM_LIT:5> ; public static final int DepthMASK = Bit6 | Bit7 | Bit8 | Bit9 | Bit10 | Bit11 | Bit12 | Bit13 ; public static final int IsReachable = Bit32 ; public static final int LabelUsed = Bit7 ; public static final int DocumentedFallthrough = Bit30 ; public static final int IsLocalDeclarationReachable = Bit31 ; public static final int IsSubRoutineEscaping = Bit15 ; public static final int IsTryBlockExiting = Bit30 ; public static final int ContainsAssertion = Bit1 ; public static final int IsLocalType = Bit9 ; public static final int IsAnonymousType = Bit10 ; public static final int IsMemberType = Bit11 ; public static final int HasAbstractMethods = Bit12 ; public static final int IsSecondaryType = Bit13 ; public static final int HasBeenGenerated = Bit14 ; public static final int HasLocalType = Bit2 ; public static final int HasBeenResolved = Bit5 ; public static final int ParenthesizedSHIFT = <NUM_LIT> ; public static final int ParenthesizedMASK = Bit22 | Bit23 | Bit24 | Bit25 | Bit26 | Bit27 | Bit28 | Bit29 ; public static final int IgnoreNoEffectAssignCheck = Bit30 ; public static final int IsStrictlyAssigned = Bit14 ; public static final int IsCompoundAssigned = Bit17 ; public static final int DiscardEnclosingInstance = Bit14 ; public static final int Unchecked = Bit17 ; public static final int ResolveJavadoc = Bit17 ; public static final int IsUsefulEmptyStatement = Bit1 ; public static final int UndocumentedEmptyBlock = Bit4 ; public static final int OverridingMethodWithSupercall = Bit5 ; public static final int CanBeStatic = Bit9 ; public static final int ErrorInSignature = Bit6 ; public static final int NeedFreeReturn = Bit7 ; public static final int IsDefaultConstructor = Bit8 ; public static final int HasAllMethodBodies = Bit5 ; public static final int IsImplicitUnit = Bit1 ; public static final int InsideJavadoc = Bit16 ; public static final int SuperAccess = Bit15 ; public static final int Empty = Bit19 ; public static final int IsElseIfStatement = Bit30 ; public static final int ThenExit = Bit31 ; public static final int IsElseStatementUnreachable = Bit8 ; public static final int IsThenStatementUnreachable = Bit9 ; public static final int IsSuperType = Bit5 ; public static final int IsVarArgs = Bit15 ; public static final int IgnoreRawTypeCheck = Bit31 ; public static final int IsAnnotationDefaultValue = Bit1 ; public static final int IsNonNull = Bit18 ; public static final int NeededScope = Bit30 ; public static final int OnDemand = Bit18 ; public static final int Used = Bit2 ; public static final int DidResolve = Bit19 ; public static final int IsAnySubRoutineEscaping = Bit30 ; public static final int IsSynchronized = Bit31 ; public static final int BlockExit = Bit30 ; public static final int IsRecovered = Bit6 ; public static final int HasSyntaxErrors = Bit20 ; public static final int INVOCATION_ARGUMENT_OK = <NUM_LIT:0> ; public static final int INVOCATION_ARGUMENT_UNCHECKED = <NUM_LIT:1> ; public static final int INVOCATION_ARGUMENT_WILDCARD = <NUM_LIT:2> ; public static final int IsUnionType = Bit30 ; public static final int IsDiamond = Bit20 ; public static final int InsideExpressionStatement = Bit5 ; public ASTNode ( ) { super ( ) ; } private static int checkInvocationArgument ( BlockScope scope , Expression argument , TypeBinding parameterType , TypeBinding argumentType , TypeBinding originalParameterType ) { argument . computeConversion ( scope , parameterType , argumentType ) ; if ( argumentType != TypeBinding . NULL && parameterType . kind ( ) == Binding . WILDCARD_TYPE ) { WildcardBinding wildcard = ( WildcardBinding ) parameterType ; if ( wildcard . boundKind != Wildcard . SUPER ) { return INVOCATION_ARGUMENT_WILDCARD ; } } TypeBinding checkedParameterType = parameterType ; if ( argumentType != checkedParameterType && argumentType . needsUncheckedConversion ( checkedParameterType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( argument , argumentType , checkedParameterType ) ; return INVOCATION_ARGUMENT_UNCHECKED ; } return INVOCATION_ARGUMENT_OK ; } public static boolean checkInvocationArguments ( BlockScope scope , Expression receiver , TypeBinding receiverType , MethodBinding method , Expression [ ] arguments , TypeBinding [ ] argumentTypes , boolean argsContainCast , InvocationSite invocationSite ) { boolean is1_7 = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_7 ; if ( is1_7 && method . isPolymorphic ( ) ) { return false ; } TypeBinding [ ] params = method . parameters ; int paramLength = params . length ; boolean isRawMemberInvocation = ! method . isStatic ( ) && ! receiverType . isUnboundWildcard ( ) && method . declaringClass . isRawType ( ) && method . hasSubstitutedParameters ( ) ; boolean uncheckedBoundCheck = ( method . tagBits & TagBits . HasUncheckedTypeArgumentForBoundCheck ) != <NUM_LIT:0> ; MethodBinding rawOriginalGenericMethod = null ; if ( ! isRawMemberInvocation ) { if ( method instanceof ParameterizedGenericMethodBinding ) { ParameterizedGenericMethodBinding paramMethod = ( ParameterizedGenericMethodBinding ) method ; if ( paramMethod . isRaw && method . hasSubstitutedParameters ( ) ) { rawOriginalGenericMethod = method . original ( ) ; } } } int invocationStatus = INVOCATION_ARGUMENT_OK ; if ( arguments == null ) { if ( method . isVarargs ( ) ) { TypeBinding parameterType = ( ( ArrayBinding ) params [ paramLength - <NUM_LIT:1> ] ) . elementsType ( ) ; if ( ! parameterType . isReifiable ( ) && ( ! is1_7 || ( ( method . tagBits & TagBits . AnnotationSafeVarargs ) == <NUM_LIT:0> ) ) ) { scope . problemReporter ( ) . unsafeGenericArrayForVarargs ( parameterType , ( ASTNode ) invocationSite ) ; } } } else { if ( method . isVarargs ( ) ) { int lastIndex = paramLength - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < lastIndex ; i ++ ) { TypeBinding originalRawParam = rawOriginalGenericMethod == null ? null : rawOriginalGenericMethod . parameters [ i ] ; invocationStatus |= checkInvocationArgument ( scope , arguments [ i ] , params [ i ] , argumentTypes [ i ] , originalRawParam ) ; } int argLength = arguments . length ; if ( lastIndex <= argLength ) { TypeBinding parameterType = params [ lastIndex ] ; TypeBinding originalRawParam = null ; if ( paramLength != argLength || parameterType . dimensions ( ) != argumentTypes [ lastIndex ] . dimensions ( ) ) { parameterType = ( ( ArrayBinding ) parameterType ) . elementsType ( ) ; if ( ! parameterType . isReifiable ( ) && ( ! is1_7 || ( ( method . tagBits & TagBits . AnnotationSafeVarargs ) == <NUM_LIT:0> ) ) ) { scope . problemReporter ( ) . unsafeGenericArrayForVarargs ( parameterType , ( ASTNode ) invocationSite ) ; } originalRawParam = rawOriginalGenericMethod == null ? null : ( ( ArrayBinding ) rawOriginalGenericMethod . parameters [ lastIndex ] ) . elementsType ( ) ; } for ( int i = lastIndex ; i < argLength ; i ++ ) { invocationStatus |= checkInvocationArgument ( scope , arguments [ i ] , parameterType , argumentTypes [ i ] , originalRawParam ) ; } } if ( paramLength == argLength ) { int varargsIndex = paramLength - <NUM_LIT:1> ; ArrayBinding varargsType = ( ArrayBinding ) params [ varargsIndex ] ; TypeBinding lastArgType = argumentTypes [ varargsIndex ] ; int dimensions ; if ( lastArgType == TypeBinding . NULL ) { if ( ! ( varargsType . leafComponentType ( ) . isBaseType ( ) && varargsType . dimensions ( ) == <NUM_LIT:1> ) ) scope . problemReporter ( ) . varargsArgumentNeedCast ( method , lastArgType , invocationSite ) ; } else if ( varargsType . dimensions <= ( dimensions = lastArgType . dimensions ( ) ) ) { if ( lastArgType . leafComponentType ( ) . isBaseType ( ) ) { dimensions -- ; } if ( varargsType . dimensions < dimensions ) { scope . problemReporter ( ) . varargsArgumentNeedCast ( method , lastArgType , invocationSite ) ; } else if ( varargsType . dimensions == dimensions && lastArgType != varargsType && lastArgType . leafComponentType ( ) . erasure ( ) != varargsType . leafComponentType . erasure ( ) && lastArgType . isCompatibleWith ( varargsType . elementsType ( ) ) && lastArgType . isCompatibleWith ( varargsType ) ) { scope . problemReporter ( ) . varargsArgumentNeedCast ( method , lastArgType , invocationSite ) ; } } } } else { for ( int i = <NUM_LIT:0> ; i < paramLength ; i ++ ) { TypeBinding originalRawParam = rawOriginalGenericMethod == null ? null : rawOriginalGenericMethod . parameters [ i ] ; invocationStatus |= checkInvocationArgument ( scope , arguments [ i ] , params [ i ] , argumentTypes [ i ] , originalRawParam ) ; } } if ( argsContainCast ) { CastExpression . checkNeedForArgumentCasts ( scope , receiver , receiverType , method , arguments , argumentTypes , invocationSite ) ; } } if ( ( invocationStatus & INVOCATION_ARGUMENT_WILDCARD ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . wildcardInvocation ( ( ASTNode ) invocationSite , receiverType , method , argumentTypes ) ; } else if ( ! method . isStatic ( ) && ! receiverType . isUnboundWildcard ( ) && method . declaringClass . isRawType ( ) && method . hasSubstitutedParameters ( ) ) { if ( scope . compilerOptions ( ) . reportUnavoidableGenericTypeProblems || receiver == null || ! receiver . forcedToBeRaw ( scope . referenceContext ( ) ) ) { scope . problemReporter ( ) . unsafeRawInvocation ( ( ASTNode ) invocationSite , method ) ; } } else if ( rawOriginalGenericMethod != null || uncheckedBoundCheck || ( ( invocationStatus & INVOCATION_ARGUMENT_UNCHECKED ) != <NUM_LIT:0> && method instanceof ParameterizedGenericMethodBinding ) ) { scope . problemReporter ( ) . unsafeRawGenericMethodInvocation ( ( ASTNode ) invocationSite , method , argumentTypes ) ; return true ; } return false ; } public ASTNode concreteStatement ( ) { return this ; } public final boolean isFieldUseDeprecated ( FieldBinding field , Scope scope , int filteredBits ) { if ( ( this . bits & ASTNode . InsideJavadoc ) == <NUM_LIT:0> && ( filteredBits & IsStrictlyAssigned ) == <NUM_LIT:0> && field . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInField ( field ) ) { if ( ( ( filteredBits & IsCompoundAssigned ) != <NUM_LIT:0> ) ) field . original ( ) . compoundUseFlag ++ ; else field . original ( ) . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } if ( ( field . modifiers & ExtraCompilerModifiers . AccRestrictedAccess ) != <NUM_LIT:0> ) { AccessRestriction restriction = scope . environment ( ) . getAccessRestriction ( field . declaringClass . erasure ( ) ) ; if ( restriction != null ) { scope . problemReporter ( ) . forbiddenReference ( field , this , restriction . classpathEntryType , restriction . classpathEntryName , restriction . getProblemId ( ) ) ; } } if ( ! field . isViewedAsDeprecated ( ) ) return false ; if ( scope . isDefinedInSameUnit ( field . declaringClass ) ) return false ; if ( ! scope . compilerOptions ( ) . reportDeprecationInsideDeprecatedCode && scope . isInsideDeprecatedCode ( ) ) return false ; return true ; } public boolean isImplicitThis ( ) { return false ; } public final boolean isMethodUseDeprecated ( MethodBinding method , Scope scope , boolean isExplicitUse ) { if ( ( this . bits & ASTNode . InsideJavadoc ) == <NUM_LIT:0> && method . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInMethod ( method ) ) { method . original ( ) . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } if ( isExplicitUse && ( method . modifiers & ExtraCompilerModifiers . AccRestrictedAccess ) != <NUM_LIT:0> ) { AccessRestriction restriction = scope . environment ( ) . getAccessRestriction ( method . declaringClass . erasure ( ) ) ; if ( restriction != null ) { scope . problemReporter ( ) . forbiddenReference ( method , this , restriction . classpathEntryType , restriction . classpathEntryName , restriction . getProblemId ( ) ) ; } } if ( ! method . isViewedAsDeprecated ( ) ) return false ; if ( scope . isDefinedInSameUnit ( method . declaringClass ) ) return false ; if ( ! isExplicitUse && ( method . modifiers & ClassFileConstants . AccDeprecated ) == <NUM_LIT:0> ) { return false ; } if ( ! scope . compilerOptions ( ) . reportDeprecationInsideDeprecatedCode && scope . isInsideDeprecatedCode ( ) ) return false ; return true ; } public boolean isSuper ( ) { return false ; } public boolean isThis ( ) { return false ; } public final boolean isTypeUseDeprecated ( TypeBinding type , Scope scope ) { if ( type . isArrayType ( ) ) { type = ( ( ArrayBinding ) type ) . leafComponentType ; } if ( type . isBaseType ( ) ) return false ; ReferenceBinding refType = ( ReferenceBinding ) type ; if ( ( this . bits & ASTNode . InsideJavadoc ) == <NUM_LIT:0> && refType . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInType ( refType ) ) { ( ( ReferenceBinding ) refType . erasure ( ) ) . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } if ( refType . hasRestrictedAccess ( ) ) { AccessRestriction restriction = scope . environment ( ) . getAccessRestriction ( type . erasure ( ) ) ; if ( restriction != null ) { scope . problemReporter ( ) . forbiddenReference ( type , this , restriction . classpathEntryType , restriction . classpathEntryName , restriction . getProblemId ( ) ) ; } } refType . initializeDeprecatedAnnotationTagBits ( ) ; if ( ! refType . isViewedAsDeprecated ( ) ) return false ; if ( scope . isDefinedInSameUnit ( refType ) ) return false ; if ( ! scope . compilerOptions ( ) . reportDeprecationInsideDeprecatedCode && scope . isInsideDeprecatedCode ( ) ) return false ; return true ; } public abstract StringBuffer print ( int indent , StringBuffer output ) ; public static StringBuffer printAnnotations ( Annotation [ ] annotations , StringBuffer output ) { int length = annotations . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { annotations [ i ] . print ( <NUM_LIT:0> , output ) ; output . append ( "<STR_LIT:U+0020>" ) ; } return output ; } public static StringBuffer printIndent ( int indent , StringBuffer output ) { for ( int i = indent ; i > <NUM_LIT:0> ; i -- ) output . append ( "<STR_LIT:U+0020U+0020>" ) ; return output ; } public static StringBuffer printModifiers ( int modifiers , StringBuffer output ) { if ( ( modifiers & ClassFileConstants . AccPublic ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccProtected ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccFinal ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccSynchronized ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccVolatile ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccTransient ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccNative ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ) output . append ( "<STR_LIT>" ) ; return output ; } public static void resolveAnnotations ( BlockScope scope , Annotation [ ] sourceAnnotations , Binding recipient ) { AnnotationBinding [ ] annotations = null ; int length = sourceAnnotations == null ? <NUM_LIT:0> : sourceAnnotations . length ; if ( recipient != null ) { switch ( recipient . kind ( ) ) { case Binding . PACKAGE : PackageBinding packageBinding = ( PackageBinding ) recipient ; if ( ( packageBinding . tagBits & TagBits . AnnotationResolved ) != <NUM_LIT:0> ) return ; packageBinding . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; break ; case Binding . TYPE : case Binding . GENERIC_TYPE : ReferenceBinding type = ( ReferenceBinding ) recipient ; if ( ( type . tagBits & TagBits . AnnotationResolved ) != <NUM_LIT:0> ) return ; type . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; if ( length > <NUM_LIT:0> ) { annotations = new AnnotationBinding [ length ] ; type . setAnnotations ( annotations ) ; } break ; case Binding . METHOD : MethodBinding method = ( MethodBinding ) recipient ; if ( ( method . tagBits & TagBits . AnnotationResolved ) != <NUM_LIT:0> ) return ; method . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; if ( length > <NUM_LIT:0> ) { annotations = new AnnotationBinding [ length ] ; method . setAnnotations ( annotations ) ; } break ; case Binding . FIELD : FieldBinding field = ( FieldBinding ) recipient ; if ( ( field . tagBits & TagBits . AnnotationResolved ) != <NUM_LIT:0> ) return ; field . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; if ( length > <NUM_LIT:0> ) { annotations = new AnnotationBinding [ length ] ; field . setAnnotations ( annotations ) ; } break ; case Binding . LOCAL : LocalVariableBinding local = ( LocalVariableBinding ) recipient ; if ( ( local . tagBits & TagBits . AnnotationResolved ) != <NUM_LIT:0> ) return ; local . tagBits |= ( TagBits . AnnotationResolved | TagBits . DeprecatedAnnotationResolved ) ; if ( length > <NUM_LIT:0> ) { annotations = new AnnotationBinding [ length ] ; local . setAnnotations ( annotations ) ; } break ; default : return ; } } if ( sourceAnnotations == null ) return ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Annotation annotation = sourceAnnotations [ i ] ; final Binding annotationRecipient = annotation . recipient ; if ( annotationRecipient != null && recipient != null ) { switch ( recipient . kind ( ) ) { case Binding . FIELD : FieldBinding field = ( FieldBinding ) recipient ; field . tagBits = ( ( FieldBinding ) annotationRecipient ) . tagBits ; if ( annotations != null ) { for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) { Annotation annot = sourceAnnotations [ j ] ; annotations [ j ] = annot . getCompilerAnnotation ( ) ; } } break ; case Binding . LOCAL : LocalVariableBinding local = ( LocalVariableBinding ) recipient ; long otherLocalTagBits = ( ( LocalVariableBinding ) annotationRecipient ) . tagBits ; local . tagBits = otherLocalTagBits ; if ( ( otherLocalTagBits & TagBits . AnnotationSuppressWarnings ) == <NUM_LIT:0> ) { if ( annotations != null ) { for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) { Annotation annot = sourceAnnotations [ j ] ; annotations [ j ] = annot . getCompilerAnnotation ( ) ; } } } else if ( annotations != null ) { LocalDeclaration localDeclaration = local . declaration ; int declarationSourceEnd = localDeclaration . declarationSourceEnd ; int declarationSourceStart = localDeclaration . declarationSourceStart ; for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) { Annotation annot = sourceAnnotations [ j ] ; AnnotationBinding annotationBinding = annot . getCompilerAnnotation ( ) ; annotations [ j ] = annotationBinding ; if ( annotationBinding != null ) { final ReferenceBinding annotationType = annotationBinding . getAnnotationType ( ) ; if ( annotationType != null && annotationType . id == TypeIds . T_JavaLangSuppressWarnings ) { annot . recordSuppressWarnings ( scope , declarationSourceStart , declarationSourceEnd , scope . compilerOptions ( ) . suppressWarnings ) ; } } } } break ; } return ; } else { annotation . recipient = recipient ; annotation . resolveType ( scope ) ; if ( annotations != null ) { annotations [ i ] = annotation . getCompilerAnnotation ( ) ; } } } if ( annotations != null ) { AnnotationBinding [ ] distinctAnnotations = annotations ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { AnnotationBinding annotation = distinctAnnotations [ i ] ; if ( annotation == null ) continue ; TypeBinding annotationType = annotation . getAnnotationType ( ) ; boolean foundDuplicate = false ; for ( int j = i + <NUM_LIT:1> ; j < length ; j ++ ) { AnnotationBinding otherAnnotation = distinctAnnotations [ j ] ; if ( otherAnnotation == null ) continue ; if ( otherAnnotation . getAnnotationType ( ) == annotationType ) { foundDuplicate = true ; if ( distinctAnnotations == annotations ) { System . arraycopy ( distinctAnnotations , <NUM_LIT:0> , distinctAnnotations = new AnnotationBinding [ length ] , <NUM_LIT:0> , length ) ; } distinctAnnotations [ j ] = null ; scope . problemReporter ( ) . duplicateAnnotation ( sourceAnnotations [ j ] ) ; } } if ( foundDuplicate ) { scope . problemReporter ( ) . duplicateAnnotation ( sourceAnnotations [ i ] ) ; } } } } public static void resolveDeprecatedAnnotations ( BlockScope scope , Annotation [ ] annotations , Binding recipient ) { if ( recipient != null ) { int kind = recipient . kind ( ) ; if ( annotations != null ) { int length ; if ( ( length = annotations . length ) >= <NUM_LIT:0> ) { switch ( kind ) { case Binding . PACKAGE : PackageBinding packageBinding = ( PackageBinding ) recipient ; if ( ( packageBinding . tagBits & TagBits . DeprecatedAnnotationResolved ) != <NUM_LIT:0> ) return ; break ; case Binding . TYPE : case Binding . GENERIC_TYPE : ReferenceBinding type = ( ReferenceBinding ) recipient ; if ( ( type . tagBits & TagBits . DeprecatedAnnotationResolved ) != <NUM_LIT:0> ) return ; break ; case Binding . METHOD : MethodBinding method = ( MethodBinding ) recipient ; if ( ( method . tagBits & TagBits . DeprecatedAnnotationResolved ) != <NUM_LIT:0> ) return ; break ; case Binding . FIELD : FieldBinding field = ( FieldBinding ) recipient ; if ( ( field . tagBits & TagBits . DeprecatedAnnotationResolved ) != <NUM_LIT:0> ) return ; break ; case Binding . LOCAL : LocalVariableBinding local = ( LocalVariableBinding ) recipient ; if ( ( local . tagBits & TagBits . DeprecatedAnnotationResolved ) != <NUM_LIT:0> ) return ; break ; default : return ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeReference annotationTypeRef = annotations [ i ] . type ; if ( ! CharOperation . equals ( TypeConstants . JAVA_LANG_DEPRECATED [ <NUM_LIT:2> ] , annotationTypeRef . getLastToken ( ) ) ) return ; TypeBinding annotationType = annotations [ i ] . type . resolveType ( scope ) ; if ( annotationType != null && annotationType . isValidBinding ( ) && annotationType . id == TypeIds . T_JavaLangDeprecated ) { switch ( kind ) { case Binding . PACKAGE : PackageBinding packageBinding = ( PackageBinding ) recipient ; packageBinding . tagBits |= ( TagBits . AnnotationDeprecated | TagBits . DeprecatedAnnotationResolved ) ; return ; case Binding . TYPE : case Binding . GENERIC_TYPE : case Binding . TYPE_PARAMETER : ReferenceBinding type = ( ReferenceBinding ) recipient ; type . tagBits |= ( TagBits . AnnotationDeprecated | TagBits . DeprecatedAnnotationResolved ) ; return ; case Binding . METHOD : MethodBinding method = ( MethodBinding ) recipient ; method . tagBits |= ( TagBits . AnnotationDeprecated | TagBits . DeprecatedAnnotationResolved ) ; return ; case Binding . FIELD : FieldBinding field = ( FieldBinding ) recipient ; field . tagBits |= ( TagBits . AnnotationDeprecated | TagBits . DeprecatedAnnotationResolved ) ; return ; case Binding . LOCAL : LocalVariableBinding local = ( LocalVariableBinding ) recipient ; local . tagBits |= ( TagBits . AnnotationDeprecated | TagBits . DeprecatedAnnotationResolved ) ; return ; default : return ; } } } } } switch ( kind ) { case Binding . PACKAGE : PackageBinding packageBinding = ( PackageBinding ) recipient ; packageBinding . tagBits |= TagBits . DeprecatedAnnotationResolved ; return ; case Binding . TYPE : case Binding . GENERIC_TYPE : case Binding . TYPE_PARAMETER : ReferenceBinding type = ( ReferenceBinding ) recipient ; type . tagBits |= TagBits . DeprecatedAnnotationResolved ; return ; case Binding . METHOD : MethodBinding method = ( MethodBinding ) recipient ; method . tagBits |= TagBits . DeprecatedAnnotationResolved ; return ; case Binding . FIELD : FieldBinding field = ( FieldBinding ) recipient ; field . tagBits |= TagBits . DeprecatedAnnotationResolved ; return ; case Binding . LOCAL : LocalVariableBinding local = ( LocalVariableBinding ) recipient ; local . tagBits |= TagBits . DeprecatedAnnotationResolved ; return ; default : return ; } } } public int sourceStart ( ) { return this . sourceStart ; } public int sourceEnd ( ) { return this . sourceEnd ; } public String toString ( ) { return print ( <NUM_LIT:0> , new StringBuffer ( <NUM_LIT:30> ) ) . toString ( ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class JavadocReturnStatement extends ReturnStatement { public JavadocReturnStatement ( int s , int e ) { super ( null , s , e ) ; this . bits |= ( ASTNode . InsideJavadoc | ASTNode . Empty ) ; } public void resolve ( BlockScope scope ) { MethodScope methodScope = scope . methodScope ( ) ; MethodBinding methodBinding = null ; TypeBinding methodType = ( methodScope . referenceContext instanceof AbstractMethodDeclaration ) ? ( ( methodBinding = ( ( AbstractMethodDeclaration ) methodScope . referenceContext ) . binding ) == null ? null : methodBinding . returnType ) : TypeBinding . VOID ; if ( methodType == null || methodType == TypeBinding . VOID ) { scope . problemReporter ( ) . javadocUnexpectedTag ( this . sourceStart , this . sourceEnd ) ; } else if ( ( this . bits & ASTNode . Empty ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . javadocEmptyReturnTag ( this . sourceStart , this . sourceEnd , scope . getDeclarationModifiers ( ) ) ; } } public StringBuffer printStatement ( int tab , StringBuffer output ) { printIndent ( tab , output ) . append ( "<STR_LIT>" ) ; if ( ( this . bits & ASTNode . Empty ) == <NUM_LIT:0> ) output . append ( '<CHAR_LIT:U+0020>' ) . append ( "<STR_LIT>" ) ; return output ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . BranchLabel ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . flow . LoopingFlowContext ; import org . eclipse . jdt . internal . compiler . flow . UnconditionalFlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class ForeachStatement extends Statement { public LocalDeclaration elementVariable ; public int elementVariableImplicitWidening = - <NUM_LIT:1> ; public Expression collection ; public Statement action ; private int kind ; private static final int ARRAY = <NUM_LIT:0> ; private static final int RAW_ITERABLE = <NUM_LIT:1> ; private static final int GENERIC_ITERABLE = <NUM_LIT:2> ; private TypeBinding iteratorReceiverType ; private TypeBinding collectionElementType ; private BranchLabel breakLabel ; private BranchLabel continueLabel ; public BlockScope scope ; public LocalVariableBinding indexVariable ; public LocalVariableBinding collectionVariable ; public LocalVariableBinding maxVariable ; private static final char [ ] SecretIteratorVariableName = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] SecretIndexVariableName = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] SecretCollectionVariableName = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] SecretMaxVariableName = "<STR_LIT>" . toCharArray ( ) ; int postCollectionInitStateIndex = - <NUM_LIT:1> ; int mergedInitStateIndex = - <NUM_LIT:1> ; public ForeachStatement ( LocalDeclaration elementVariable , int start ) { this . elementVariable = elementVariable ; this . sourceStart = start ; this . kind = - <NUM_LIT:1> ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . breakLabel = new BranchLabel ( ) ; this . continueLabel = new BranchLabel ( ) ; int initialComplaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? Statement . COMPLAINED_FAKE_REACHABLE : Statement . NOT_COMPLAINED ; this . collection . checkNPE ( currentScope , flowContext , flowInfo ) ; flowInfo = this . elementVariable . analyseCode ( this . scope , flowContext , flowInfo ) ; FlowInfo condInfo = this . collection . analyseCode ( this . scope , flowContext , flowInfo . copy ( ) ) ; condInfo . markAsDefinitelyAssigned ( this . elementVariable . binding ) ; this . postCollectionInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( condInfo ) ; LoopingFlowContext loopingContext = new LoopingFlowContext ( flowContext , flowInfo , this , this . breakLabel , this . continueLabel , this . scope ) ; UnconditionalFlowInfo actionInfo = condInfo . nullInfoLessUnconditionalCopy ( ) ; actionInfo . markAsDefinitelyUnknown ( this . elementVariable . binding ) ; FlowInfo exitBranch ; if ( ! ( this . action == null || ( this . action . isEmptyBlock ( ) && currentScope . compilerOptions ( ) . complianceLevel <= ClassFileConstants . JDK1_3 ) ) ) { if ( this . action . complainIfUnreachable ( actionInfo , this . scope , initialComplaintLevel ) < Statement . COMPLAINED_UNREACHABLE ) { actionInfo = this . action . analyseCode ( this . scope , loopingContext , actionInfo ) . unconditionalCopy ( ) ; } exitBranch = flowInfo . unconditionalCopy ( ) . addNullInfoFrom ( condInfo . initsWhenFalse ( ) ) ; if ( ( actionInfo . tagBits & loopingContext . initsOnContinue . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) { this . continueLabel = null ; } else { actionInfo = actionInfo . mergedWith ( loopingContext . initsOnContinue ) ; loopingContext . complainOnDeferredFinalChecks ( this . scope , actionInfo ) ; exitBranch . addPotentialInitializationsFrom ( actionInfo ) ; } } else { exitBranch = condInfo . initsWhenFalse ( ) ; } final boolean hasEmptyAction = this . action == null || this . action . isEmptyBlock ( ) || ( ( this . action . bits & IsUsefulEmptyStatement ) != <NUM_LIT:0> ) ; switch ( this . kind ) { case ARRAY : if ( ! hasEmptyAction || this . elementVariable . binding . resolvedPosition != - <NUM_LIT:1> ) { this . collectionVariable . useFlag = LocalVariableBinding . USED ; if ( this . continueLabel != null ) { this . indexVariable . useFlag = LocalVariableBinding . USED ; this . maxVariable . useFlag = LocalVariableBinding . USED ; } } break ; case RAW_ITERABLE : case GENERIC_ITERABLE : this . indexVariable . useFlag = LocalVariableBinding . USED ; break ; } loopingContext . complainOnDeferredNullChecks ( currentScope , actionInfo ) ; FlowInfo mergedInfo = FlowInfo . mergedOptimizedBranches ( ( loopingContext . initsOnBreak . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? loopingContext . initsOnBreak : flowInfo . addInitializationsFrom ( loopingContext . initsOnBreak ) , false , exitBranch , false , true ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; final boolean hasEmptyAction = this . action == null || this . action . isEmptyBlock ( ) || ( ( this . action . bits & IsUsefulEmptyStatement ) != <NUM_LIT:0> ) ; if ( hasEmptyAction && this . elementVariable . binding . resolvedPosition == - <NUM_LIT:1> && this . kind == ARRAY ) { this . collection . generateCode ( this . scope , codeStream , false ) ; codeStream . exitUserScope ( this . scope ) ; if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } switch ( this . kind ) { case ARRAY : this . collection . generateCode ( this . scope , codeStream , true ) ; codeStream . store ( this . collectionVariable , true ) ; codeStream . addVariable ( this . collectionVariable ) ; if ( this . continueLabel != null ) { codeStream . arraylength ( ) ; codeStream . store ( this . maxVariable , false ) ; codeStream . addVariable ( this . maxVariable ) ; codeStream . iconst_0 ( ) ; codeStream . store ( this . indexVariable , false ) ; codeStream . addVariable ( this . indexVariable ) ; } else { } break ; case RAW_ITERABLE : case GENERIC_ITERABLE : this . collection . generateCode ( this . scope , codeStream , true ) ; codeStream . invokeIterableIterator ( this . iteratorReceiverType ) ; codeStream . store ( this . indexVariable , false ) ; codeStream . addVariable ( this . indexVariable ) ; break ; } BranchLabel actionLabel = new BranchLabel ( codeStream ) ; actionLabel . tagBits |= BranchLabel . USED ; BranchLabel conditionLabel = new BranchLabel ( codeStream ) ; conditionLabel . tagBits |= BranchLabel . USED ; this . breakLabel . initialize ( codeStream ) ; if ( this . continueLabel == null ) { conditionLabel . place ( ) ; int conditionPC = codeStream . position ; switch ( this . kind ) { case ARRAY : codeStream . arraylength ( ) ; codeStream . ifeq ( this . breakLabel ) ; break ; case RAW_ITERABLE : case GENERIC_ITERABLE : codeStream . load ( this . indexVariable ) ; codeStream . invokeJavaUtilIteratorHasNext ( ) ; codeStream . ifeq ( this . breakLabel ) ; break ; } codeStream . recordPositionsFrom ( conditionPC , this . elementVariable . sourceStart ) ; } else { this . continueLabel . initialize ( codeStream ) ; this . continueLabel . tagBits |= BranchLabel . USED ; codeStream . goto_ ( conditionLabel ) ; } actionLabel . place ( ) ; switch ( this . kind ) { case ARRAY : if ( this . elementVariable . binding . resolvedPosition != - <NUM_LIT:1> ) { codeStream . load ( this . collectionVariable ) ; if ( this . continueLabel == null ) { codeStream . iconst_0 ( ) ; } else { codeStream . load ( this . indexVariable ) ; } codeStream . arrayAt ( this . collectionElementType . id ) ; if ( this . elementVariableImplicitWidening != - <NUM_LIT:1> ) { codeStream . generateImplicitConversion ( this . elementVariableImplicitWidening ) ; } codeStream . store ( this . elementVariable . binding , false ) ; codeStream . addVisibleLocalVariable ( this . elementVariable . binding ) ; if ( this . postCollectionInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . postCollectionInitStateIndex ) ; } } break ; case RAW_ITERABLE : case GENERIC_ITERABLE : codeStream . load ( this . indexVariable ) ; codeStream . invokeJavaUtilIteratorNext ( ) ; if ( this . elementVariable . binding . type . id != T_JavaLangObject ) { if ( this . elementVariableImplicitWidening != - <NUM_LIT:1> ) { codeStream . checkcast ( this . collectionElementType ) ; codeStream . generateImplicitConversion ( this . elementVariableImplicitWidening ) ; } else { codeStream . checkcast ( this . elementVariable . binding . type ) ; } } if ( this . elementVariable . binding . resolvedPosition == - <NUM_LIT:1> ) { codeStream . pop ( ) ; } else { codeStream . store ( this . elementVariable . binding , false ) ; codeStream . addVisibleLocalVariable ( this . elementVariable . binding ) ; if ( this . postCollectionInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . postCollectionInitStateIndex ) ; } } break ; } if ( ! hasEmptyAction ) { this . action . generateCode ( this . scope , codeStream ) ; } codeStream . removeVariable ( this . elementVariable . binding ) ; if ( this . postCollectionInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . postCollectionInitStateIndex ) ; } if ( this . continueLabel != null ) { this . continueLabel . place ( ) ; int continuationPC = codeStream . position ; switch ( this . kind ) { case ARRAY : if ( ! hasEmptyAction || this . elementVariable . binding . resolvedPosition >= <NUM_LIT:0> ) { codeStream . iinc ( this . indexVariable . resolvedPosition , <NUM_LIT:1> ) ; } conditionLabel . place ( ) ; codeStream . load ( this . indexVariable ) ; codeStream . load ( this . maxVariable ) ; codeStream . if_icmplt ( actionLabel ) ; break ; case RAW_ITERABLE : case GENERIC_ITERABLE : conditionLabel . place ( ) ; codeStream . load ( this . indexVariable ) ; codeStream . invokeJavaUtilIteratorHasNext ( ) ; codeStream . ifne ( actionLabel ) ; break ; } codeStream . recordPositionsFrom ( continuationPC , this . elementVariable . sourceStart ) ; } switch ( this . kind ) { case ARRAY : codeStream . removeVariable ( this . indexVariable ) ; codeStream . removeVariable ( this . maxVariable ) ; codeStream . removeVariable ( this . collectionVariable ) ; break ; case RAW_ITERABLE : case GENERIC_ITERABLE : codeStream . removeVariable ( this . indexVariable ) ; break ; } codeStream . exitUserScope ( this . scope ) ; if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } this . breakLabel . place ( ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; this . elementVariable . printAsExpression ( <NUM_LIT:0> , output ) ; output . append ( "<STR_LIT:U+0020:U+0020>" ) ; if ( this . collection != null ) { this . collection . print ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; } else { output . append ( '<CHAR_LIT:)>' ) ; } if ( this . action == null ) { output . append ( '<CHAR_LIT:;>' ) ; } else { output . append ( '<STR_LIT:\n>' ) ; this . action . printStatement ( indent + <NUM_LIT:1> , output ) ; } return output ; } public void resolve ( BlockScope upperScope ) { this . scope = new BlockScope ( upperScope ) ; this . elementVariable . resolve ( this . scope ) ; TypeBinding elementType = this . elementVariable . type . resolvedType ; TypeBinding collectionType = this . collection == null ? null : this . collection . resolveType ( this . scope ) ; TypeBinding expectedCollectionType = null ; if ( elementType != null && collectionType != null ) { boolean isTargetJsr14 = this . scope . compilerOptions ( ) . targetJDK == ClassFileConstants . JDK1_4 ; if ( collectionType . isArrayType ( ) ) { this . kind = ARRAY ; this . collectionElementType = ( ( ArrayBinding ) collectionType ) . elementsType ( ) ; if ( ! this . collectionElementType . isCompatibleWith ( elementType ) && ! this . scope . isBoxingCompatibleWith ( this . collectionElementType , elementType ) ) { this . scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( this . collection , this . collectionElementType , elementType ) ; } else if ( this . collectionElementType . needsUncheckedConversion ( elementType ) ) { this . scope . problemReporter ( ) . unsafeTypeConversion ( this . collection , collectionType , upperScope . createArrayType ( elementType , <NUM_LIT:1> ) ) ; } int compileTimeTypeID = this . collectionElementType . id ; if ( elementType . isBaseType ( ) ) { this . collection . computeConversion ( this . scope , collectionType , collectionType ) ; if ( ! this . collectionElementType . isBaseType ( ) ) { compileTimeTypeID = this . scope . environment ( ) . computeBoxingType ( this . collectionElementType ) . id ; this . elementVariableImplicitWidening = UNBOXING ; if ( elementType . isBaseType ( ) ) { this . elementVariableImplicitWidening |= ( elementType . id << <NUM_LIT:4> ) + compileTimeTypeID ; this . scope . problemReporter ( ) . autoboxing ( this . collection , this . collectionElementType , elementType ) ; } } else { this . elementVariableImplicitWidening = ( elementType . id << <NUM_LIT:4> ) + compileTimeTypeID ; } } else if ( this . collectionElementType . isBaseType ( ) ) { this . collection . computeConversion ( this . scope , collectionType , collectionType ) ; int boxedID = this . scope . environment ( ) . computeBoxingType ( this . collectionElementType ) . id ; this . elementVariableImplicitWidening = BOXING | ( compileTimeTypeID << <NUM_LIT:4> ) | compileTimeTypeID ; compileTimeTypeID = boxedID ; this . scope . problemReporter ( ) . autoboxing ( this . collection , this . collectionElementType , elementType ) ; } else { expectedCollectionType = upperScope . createArrayType ( elementType , <NUM_LIT:1> ) ; this . collection . computeConversion ( this . scope , expectedCollectionType , collectionType ) ; } } else if ( collectionType instanceof ReferenceBinding ) { ReferenceBinding iterableType = ( ( ReferenceBinding ) collectionType ) . findSuperTypeOriginatingFrom ( T_JavaLangIterable , false ) ; if ( iterableType == null && isTargetJsr14 ) { iterableType = ( ( ReferenceBinding ) collectionType ) . findSuperTypeOriginatingFrom ( T_JavaUtilCollection , false ) ; } checkIterable : { if ( iterableType == null ) break checkIterable ; this . iteratorReceiverType = collectionType . erasure ( ) ; if ( isTargetJsr14 ) { if ( ( ( ReferenceBinding ) this . iteratorReceiverType ) . findSuperTypeOriginatingFrom ( T_JavaUtilCollection , false ) == null ) { this . iteratorReceiverType = iterableType ; this . collection . computeConversion ( this . scope , iterableType , collectionType ) ; } else { this . collection . computeConversion ( this . scope , collectionType , collectionType ) ; } } else if ( ( ( ReferenceBinding ) this . iteratorReceiverType ) . findSuperTypeOriginatingFrom ( T_JavaLangIterable , false ) == null ) { this . iteratorReceiverType = iterableType ; this . collection . computeConversion ( this . scope , iterableType , collectionType ) ; } else { this . collection . computeConversion ( this . scope , collectionType , collectionType ) ; } TypeBinding [ ] arguments = null ; switch ( iterableType . kind ( ) ) { case Binding . RAW_TYPE : this . kind = RAW_ITERABLE ; this . collectionElementType = this . scope . getJavaLangObject ( ) ; if ( ! this . collectionElementType . isCompatibleWith ( elementType ) && ! this . scope . isBoxingCompatibleWith ( this . collectionElementType , elementType ) ) { this . scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( this . collection , this . collectionElementType , elementType ) ; } break checkIterable ; case Binding . GENERIC_TYPE : arguments = iterableType . typeVariables ( ) ; break ; case Binding . PARAMETERIZED_TYPE : arguments = ( ( ParameterizedTypeBinding ) iterableType ) . arguments ; break ; default : break checkIterable ; } if ( arguments . length != <NUM_LIT:1> ) break checkIterable ; this . kind = GENERIC_ITERABLE ; this . collectionElementType = arguments [ <NUM_LIT:0> ] ; if ( ! this . collectionElementType . isCompatibleWith ( elementType ) && ! this . scope . isBoxingCompatibleWith ( this . collectionElementType , elementType ) ) { this . scope . problemReporter ( ) . notCompatibleTypesErrorInForeach ( this . collection , this . collectionElementType , elementType ) ; } int compileTimeTypeID = this . collectionElementType . id ; if ( elementType . isBaseType ( ) ) { if ( ! this . collectionElementType . isBaseType ( ) ) { compileTimeTypeID = this . scope . environment ( ) . computeBoxingType ( this . collectionElementType ) . id ; this . elementVariableImplicitWidening = UNBOXING ; if ( elementType . isBaseType ( ) ) { this . elementVariableImplicitWidening |= ( elementType . id << <NUM_LIT:4> ) + compileTimeTypeID ; } } else { this . elementVariableImplicitWidening = ( elementType . id << <NUM_LIT:4> ) + compileTimeTypeID ; } } else { if ( this . collectionElementType . isBaseType ( ) ) { this . elementVariableImplicitWidening = BOXING | ( compileTimeTypeID << <NUM_LIT:4> ) | compileTimeTypeID ; } } } } switch ( this . kind ) { case ARRAY : this . indexVariable = new LocalVariableBinding ( SecretIndexVariableName , TypeBinding . INT , ClassFileConstants . AccDefault , false ) ; this . scope . addLocalVariable ( this . indexVariable ) ; this . indexVariable . setConstant ( Constant . NotAConstant ) ; this . maxVariable = new LocalVariableBinding ( SecretMaxVariableName , TypeBinding . INT , ClassFileConstants . AccDefault , false ) ; this . scope . addLocalVariable ( this . maxVariable ) ; this . maxVariable . setConstant ( Constant . NotAConstant ) ; if ( expectedCollectionType == null ) { this . collectionVariable = new LocalVariableBinding ( SecretCollectionVariableName , collectionType , ClassFileConstants . AccDefault , false ) ; } else { this . collectionVariable = new LocalVariableBinding ( SecretCollectionVariableName , expectedCollectionType , ClassFileConstants . AccDefault , false ) ; } this . scope . addLocalVariable ( this . collectionVariable ) ; this . collectionVariable . setConstant ( Constant . NotAConstant ) ; break ; case RAW_ITERABLE : case GENERIC_ITERABLE : this . indexVariable = new LocalVariableBinding ( SecretIteratorVariableName , this . scope . getJavaUtilIterator ( ) , ClassFileConstants . AccDefault , false ) ; this . scope . addLocalVariable ( this . indexVariable ) ; this . indexVariable . setConstant ( Constant . NotAConstant ) ; break ; default : if ( isTargetJsr14 ) { this . scope . problemReporter ( ) . invalidTypeForCollectionTarget14 ( this . collection ) ; } else { this . scope . problemReporter ( ) . invalidTypeForCollection ( this . collection ) ; } } } if ( this . action != null ) { this . action . resolve ( this . scope ) ; } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . elementVariable . traverse ( visitor , this . scope ) ; if ( this . collection != null ) { this . collection . traverse ( visitor , this . scope ) ; } if ( this . action != null ) { this . action . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; public class AllocationExpression extends Expression implements InvocationSite { public TypeReference type ; public Expression [ ] arguments ; public MethodBinding binding ; MethodBinding syntheticAccessor ; public TypeReference [ ] typeArguments ; public TypeBinding [ ] genericTypeArguments ; public FieldDeclaration enumConstant ; protected TypeBinding typeExpected ; public boolean inferredReturnType ; public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { checkCapturedLocalInitializationIfNecessary ( ( ReferenceBinding ) this . binding . declaringClass . erasure ( ) , currentScope , flowInfo ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { flowInfo = this . arguments [ i ] . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; if ( ( this . arguments [ i ] . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . arguments [ i ] . checkNPE ( currentScope , flowContext , flowInfo ) ; } } } ReferenceBinding [ ] thrownExceptions ; if ( ( ( thrownExceptions = this . binding . thrownExceptions ) . length ) != <NUM_LIT:0> ) { if ( ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) { thrownExceptions = currentScope . environment ( ) . convertToRawTypes ( this . binding . thrownExceptions , true , true ) ; } flowContext . checkExceptionHandlers ( thrownExceptions , this , flowInfo . unconditionalCopy ( ) , currentScope ) ; } if ( this . binding . declaringClass . isMemberType ( ) && ! this . binding . declaringClass . isStatic ( ) ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; manageSyntheticAccessIfNecessary ( currentScope , flowInfo ) ; return flowInfo ; } public void checkCapturedLocalInitializationIfNecessary ( ReferenceBinding checkedType , BlockScope currentScope , FlowInfo flowInfo ) { if ( ( ( checkedType . tagBits & ( TagBits . AnonymousTypeMask | TagBits . LocalTypeMask ) ) == TagBits . LocalTypeMask ) && ! currentScope . isDefinedInType ( checkedType ) ) { NestedTypeBinding nestedType = ( NestedTypeBinding ) checkedType ; SyntheticArgumentBinding [ ] syntheticArguments = nestedType . syntheticOuterLocalVariables ( ) ; if ( syntheticArguments != null ) for ( int i = <NUM_LIT:0> , count = syntheticArguments . length ; i < count ; i ++ ) { SyntheticArgumentBinding syntheticArgument = syntheticArguments [ i ] ; LocalVariableBinding targetLocal ; if ( ( targetLocal = syntheticArgument . actualOuterLocalVariable ) == null ) continue ; if ( targetLocal . declaration != null && ! flowInfo . isDefinitelyAssigned ( targetLocal ) ) { currentScope . problemReporter ( ) . uninitializedLocalVariable ( targetLocal , this ) ; } } } } public Expression enclosingInstance ( ) { return null ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { if ( ! valueRequired ) currentScope . problemReporter ( ) . unusedObjectAllocation ( this ) ; int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding allocatedType = codegenBinding . declaringClass ; codeStream . new_ ( allocatedType ) ; boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( valueRequired || isUnboxing ) { codeStream . dup ( ) ; } if ( this . type != null ) { codeStream . recordPositionsFrom ( pc , this . type . sourceStart ) ; } else { codeStream . ldc ( String . valueOf ( this . enumConstant . name ) ) ; codeStream . generateInlinedValue ( this . enumConstant . binding . id ) ; } if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticEnclosingInstanceValues ( currentScope , allocatedType , enclosingInstance ( ) , this ) ; } generateArguments ( this . binding , this . arguments , currentScope , codeStream ) ; if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticOuterArgumentValues ( currentScope , allocatedType , this ) ; } if ( this . syntheticAccessor == null ) { codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , null ) ; } else { for ( int i = <NUM_LIT:0> , max = this . syntheticAccessor . parameters . length - codegenBinding . parameters . length ; i < max ; i ++ ) { codeStream . aconst_null ( ) ; } codeStream . invoke ( Opcodes . OPC_invokespecial , this . syntheticAccessor , null ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else if ( isUnboxing ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( postConversionType ( currentScope ) . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return this . genericTypeArguments ; } public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return true ; } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return ; ReferenceBinding allocatedTypeErasure = ( ReferenceBinding ) this . binding . declaringClass . erasure ( ) ; if ( allocatedTypeErasure . isNestedType ( ) && currentScope . enclosingSourceType ( ) . isLocalType ( ) ) { if ( allocatedTypeErasure . isLocalType ( ) ) { ( ( LocalTypeBinding ) allocatedTypeErasure ) . addInnerEmulationDependent ( currentScope , false ) ; } else { currentScope . propagateInnerEmulation ( allocatedTypeErasure , false ) ; } } } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding declaringClass ; if ( codegenBinding . isPrivate ( ) && currentScope . enclosingSourceType ( ) != ( declaringClass = codegenBinding . declaringClass ) ) { if ( ( declaringClass . tagBits & TagBits . IsLocalType ) != <NUM_LIT:0> && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ) { codegenBinding . tagBits |= TagBits . ClearPrivateModifier ; } else { this . syntheticAccessor = ( ( SourceTypeBinding ) declaringClass ) . addSyntheticMethod ( codegenBinding , isSuperAccess ( ) ) ; currentScope . problemReporter ( ) . needToEmulateMethodAccess ( codegenBinding , this ) ; } } } public StringBuffer printExpression ( int indent , StringBuffer output ) { if ( this . type != null ) { output . append ( "<STR_LIT>" ) ; } if ( this . typeArguments != null ) { output . append ( '<CHAR_LIT>' ) ; int max = this . typeArguments . length - <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < max ; j ++ ) { this . typeArguments [ j ] . print ( <NUM_LIT:0> , output ) ; output . append ( "<STR_LIT:U+002CU+0020>" ) ; } this . typeArguments [ max ] . print ( <NUM_LIT:0> , output ) ; output . append ( '<CHAR_LIT:>>' ) ; } if ( this . type != null ) { this . type . printExpression ( <NUM_LIT:0> , output ) ; } output . append ( '<CHAR_LIT:(>' ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> ; i < this . arguments . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . arguments [ i ] . printExpression ( <NUM_LIT:0> , output ) ; } } return output . append ( '<CHAR_LIT:)>' ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; if ( this . type == null ) { this . resolvedType = scope . enclosingReceiverType ( ) ; } else { 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 ; } } } } } final boolean isDiamond = this . type != null && ( this . type . bits & ASTNode . IsDiamond ) != <NUM_LIT:0> ; 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 ( isDiamond ) { scope . problemReporter ( ) . diamondNotWithExplicitTypeArguments ( this . typeArguments ) ; return null ; } 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 ) { if ( isDiamond ) { return null ; } if ( this . resolvedType instanceof ReferenceBinding ) { TypeBinding [ ] pseudoArgs = new TypeBinding [ length ] ; for ( int i = length ; -- i >= <NUM_LIT:0> ; ) { pseudoArgs [ i ] = argumentTypes [ i ] == null ? TypeBinding . NULL : argumentTypes [ i ] ; } this . binding = scope . findMethod ( ( ReferenceBinding ) this . resolvedType , TypeConstants . INIT , pseudoArgs , this ) ; if ( this . binding != null && ! this . binding . isValidBinding ( ) ) { MethodBinding closestMatch = ( ( ProblemMethodBinding ) this . binding ) . closestMatch ; if ( closestMatch != null ) { if ( closestMatch . original ( ) . typeVariables != Binding . NO_TYPE_VARIABLES ) { closestMatch = scope . environment ( ) . createParameterizedGenericMethod ( closestMatch . original ( ) , ( RawTypeBinding ) null ) ; } this . binding = closestMatch ; MethodBinding closestMatchOriginal = closestMatch . original ( ) ; if ( closestMatchOriginal . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInMethod ( closestMatchOriginal ) ) { closestMatchOriginal . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } } } return this . resolvedType ; } } if ( this . resolvedType == null || ! this . resolvedType . isValidBinding ( ) ) { return null ; } if ( this . type != null && ! this . resolvedType . canBeInstantiated ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , this . resolvedType ) ; return this . resolvedType ; } if ( isDiamond ) { TypeBinding [ ] inferredTypes = inferElidedTypes ( ( ( ParameterizedTypeBinding ) this . resolvedType ) . genericType ( ) , null , argumentTypes , scope ) ; if ( inferredTypes == null ) { scope . problemReporter ( ) . cannotInferElidedTypes ( this ) ; return this . resolvedType = null ; } this . resolvedType = this . type . resolvedType = scope . environment ( ) . createParameterizedType ( ( ( ParameterizedTypeBinding ) this . resolvedType ) . genericType ( ) , inferredTypes , ( ( ParameterizedTypeBinding ) this . resolvedType ) . enclosingType ( ) ) ; } ReferenceBinding allocationType = ( ReferenceBinding ) this . resolvedType ; if ( ! ( this . binding = scope . getConstructor ( allocationType , argumentTypes , this ) ) . isValidBinding ( ) ) { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocationType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } if ( ( this . binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . missingTypeInConstructor ( this , this . binding ) ; } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; if ( checkInvocationArguments ( scope , null , allocationType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } if ( this . typeArguments != null && this . binding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( this . binding , this . genericTypeArguments , this . typeArguments ) ; } if ( ! isDiamond && this . resolvedType . isParameterizedTypeWithActualArguments ( ) ) { checkTypeArgumentRedundancy ( ( ParameterizedTypeBinding ) this . resolvedType , null , argumentTypes , scope ) ; } return allocationType ; } public TypeBinding [ ] inferElidedTypes ( ReferenceBinding allocationType , ReferenceBinding enclosingType , TypeBinding [ ] argumentTypes , final BlockScope scope ) { MethodBinding factory = scope . getStaticFactory ( allocationType , enclosingType , argumentTypes , this ) ; if ( factory instanceof ParameterizedGenericMethodBinding && factory . isValidBinding ( ) ) { ParameterizedGenericMethodBinding genericFactory = ( ParameterizedGenericMethodBinding ) factory ; this . inferredReturnType = genericFactory . inferredReturnType ; return ( ( ParameterizedTypeBinding ) factory . returnType ) . arguments ; } return null ; } public void checkTypeArgumentRedundancy ( ParameterizedTypeBinding allocationType , ReferenceBinding enclosingType , TypeBinding [ ] argumentTypes , final BlockScope scope ) { ProblemReporter reporter = scope . problemReporter ( ) ; if ( ( reporter . computeSeverity ( IProblem . RedundantSpecificationOfTypeArguments ) == ProblemSeverities . Ignore ) || scope . compilerOptions ( ) . sourceLevel < ClassFileConstants . JDK1_7 ) return ; if ( allocationType . arguments == null ) return ; if ( this . genericTypeArguments != null ) return ; if ( argumentTypes == Binding . NO_PARAMETERS && this . typeExpected instanceof ParameterizedTypeBinding ) { ParameterizedTypeBinding expected = ( ParameterizedTypeBinding ) this . typeExpected ; if ( expected . arguments != null && allocationType . arguments . length == expected . arguments . length ) { int i ; for ( i = <NUM_LIT:0> ; i < allocationType . arguments . length ; i ++ ) { if ( allocationType . arguments [ i ] != expected . arguments [ i ] ) break ; } if ( i == allocationType . arguments . length ) { reporter . redundantSpecificationOfTypeArguments ( this . type , allocationType . arguments ) ; return ; } } } TypeBinding [ ] inferredTypes = inferElidedTypes ( allocationType . genericType ( ) , enclosingType , argumentTypes , scope ) ; if ( inferredTypes == null ) { return ; } for ( int i = <NUM_LIT:0> ; i < inferredTypes . length ; i ++ ) { if ( inferredTypes [ i ] != allocationType . arguments [ i ] ) return ; } reporter . redundantSpecificationOfTypeArguments ( this . type , allocationType . arguments ) ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int i ) { } public void setFieldIndex ( int i ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , typeArgumentsLength = this . typeArguments . length ; i < typeArgumentsLength ; i ++ ) { this . typeArguments [ i ] . traverse ( visitor , scope ) ; } } if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , argumentsLength = this . arguments . length ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } public void setExpectedType ( TypeBinding expectedType ) { this . typeExpected = expectedType ; } public TypeBinding expectedType ( ) { return this . typeExpected ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class ForStatement extends Statement { public Statement [ ] initializations ; public Expression condition ; public Statement [ ] increments ; public Statement action ; public BlockScope scope ; private BranchLabel breakLabel , continueLabel ; int preCondInitStateIndex = - <NUM_LIT:1> ; int preIncrementsInitStateIndex = - <NUM_LIT:1> ; int condIfTrueInitStateIndex = - <NUM_LIT:1> ; int mergedInitStateIndex = - <NUM_LIT:1> ; public ForStatement ( Statement [ ] initializations , Expression condition , Statement [ ] increments , Statement action , boolean neededScope , int s , int e ) { this . sourceStart = s ; this . sourceEnd = e ; this . initializations = initializations ; this . condition = condition ; this . increments = increments ; this . action = action ; if ( action instanceof EmptyStatement ) action . bits |= ASTNode . IsUsefulEmptyStatement ; if ( neededScope ) { this . bits |= ASTNode . NeededScope ; } } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . breakLabel = new BranchLabel ( ) ; this . continueLabel = new BranchLabel ( ) ; int initialComplaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? Statement . COMPLAINED_FAKE_REACHABLE : Statement . NOT_COMPLAINED ; if ( this . initializations != null ) { for ( int i = <NUM_LIT:0> , count = this . initializations . length ; i < count ; i ++ ) { flowInfo = this . initializations [ i ] . analyseCode ( this . scope , flowContext , flowInfo ) ; } } this . preCondInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; Constant cst = this . condition == null ? null : this . condition . constant ; boolean isConditionTrue = cst == null || ( cst != Constant . NotAConstant && cst . booleanValue ( ) == true ) ; boolean isConditionFalse = cst != null && ( cst != Constant . NotAConstant && cst . booleanValue ( ) == false ) ; cst = this . condition == null ? null : this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedTrue = cst == null || ( cst != Constant . NotAConstant && cst . booleanValue ( ) == true ) ; boolean isConditionOptimizedFalse = cst != null && ( cst != Constant . NotAConstant && cst . booleanValue ( ) == false ) ; LoopingFlowContext condLoopContext = null ; FlowInfo condInfo = flowInfo . nullInfoLessUnconditionalCopy ( ) ; if ( this . condition != null ) { if ( ! isConditionTrue ) { condInfo = this . condition . analyseCode ( this . scope , ( condLoopContext = new LoopingFlowContext ( flowContext , flowInfo , this , null , null , this . scope ) ) , condInfo ) ; if ( ( this . condition . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . condition . checkNPE ( currentScope , flowContext , flowInfo ) ; } } } LoopingFlowContext loopingContext ; UnconditionalFlowInfo actionInfo ; if ( this . action == null || ( this . action . isEmptyBlock ( ) && currentScope . compilerOptions ( ) . complianceLevel <= ClassFileConstants . JDK1_3 ) ) { if ( condLoopContext != null ) condLoopContext . complainOnDeferredFinalChecks ( this . scope , condInfo ) ; if ( isConditionTrue ) { if ( condLoopContext != null ) { condLoopContext . complainOnDeferredNullChecks ( currentScope , condInfo ) ; } return FlowInfo . DEAD_END ; } else { if ( isConditionFalse ) { this . continueLabel = null ; } actionInfo = condInfo . initsWhenTrue ( ) . unconditionalCopy ( ) ; loopingContext = new LoopingFlowContext ( flowContext , flowInfo , this , this . breakLabel , this . continueLabel , this . scope ) ; } } else { loopingContext = new LoopingFlowContext ( flowContext , flowInfo , this , this . breakLabel , this . continueLabel , this . scope ) ; FlowInfo initsWhenTrue = condInfo . initsWhenTrue ( ) ; this . condIfTrueInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( initsWhenTrue ) ; if ( isConditionFalse ) { actionInfo = FlowInfo . DEAD_END ; } else { actionInfo = initsWhenTrue . unconditionalCopy ( ) ; if ( isConditionOptimizedFalse ) { actionInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } if ( this . action . complainIfUnreachable ( actionInfo , this . scope , initialComplaintLevel ) < Statement . COMPLAINED_UNREACHABLE ) { actionInfo = this . action . analyseCode ( this . scope , loopingContext , actionInfo ) . unconditionalInits ( ) ; } if ( ( actionInfo . tagBits & loopingContext . initsOnContinue . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) { this . continueLabel = null ; } else { if ( condLoopContext != null ) { condLoopContext . complainOnDeferredFinalChecks ( this . scope , condInfo ) ; } actionInfo = actionInfo . mergedWith ( loopingContext . initsOnContinue ) ; loopingContext . complainOnDeferredFinalChecks ( this . scope , actionInfo ) ; } } FlowInfo exitBranch = flowInfo . copy ( ) ; LoopingFlowContext incrementContext = null ; if ( this . continueLabel != null ) { if ( this . increments != null ) { incrementContext = new LoopingFlowContext ( flowContext , flowInfo , this , null , null , this . scope ) ; FlowInfo incrementInfo = actionInfo ; this . preIncrementsInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( incrementInfo ) ; for ( int i = <NUM_LIT:0> , count = this . increments . length ; i < count ; i ++ ) { incrementInfo = this . increments [ i ] . analyseCode ( this . scope , incrementContext , incrementInfo ) ; } incrementContext . complainOnDeferredFinalChecks ( this . scope , actionInfo = incrementInfo . unconditionalInits ( ) ) ; } exitBranch . addPotentialInitializationsFrom ( actionInfo ) . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) ; } else { exitBranch . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) ; if ( this . increments != null ) { if ( initialComplaintLevel == Statement . NOT_COMPLAINED ) { currentScope . problemReporter ( ) . fakeReachable ( this . increments [ <NUM_LIT:0> ] ) ; } } } if ( condLoopContext != null ) { condLoopContext . complainOnDeferredNullChecks ( currentScope , actionInfo ) ; } loopingContext . complainOnDeferredNullChecks ( currentScope , actionInfo ) ; if ( incrementContext != null ) { incrementContext . complainOnDeferredNullChecks ( currentScope , actionInfo ) ; } if ( loopingContext . hasEscapingExceptions ( ) ) { FlowInfo loopbackFlowInfo = flowInfo . copy ( ) ; if ( this . continueLabel != null ) { loopbackFlowInfo . mergedWith ( actionInfo . unconditionalCopy ( ) ) ; } loopingContext . simulateThrowAfterLoopBack ( loopbackFlowInfo ) ; } FlowInfo mergedInfo = FlowInfo . mergedOptimizedBranches ( ( loopingContext . initsOnBreak . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? loopingContext . initsOnBreak : flowInfo . addInitializationsFrom ( loopingContext . initsOnBreak ) , isConditionOptimizedTrue , exitBranch , isConditionOptimizedFalse , ! isConditionTrue ) ; if ( this . initializations != null ) { for ( int i = <NUM_LIT:0> ; i < this . initializations . length ; i ++ ) { Statement init = this . initializations [ i ] ; if ( init instanceof LocalDeclaration ) { LocalVariableBinding binding = ( ( LocalDeclaration ) init ) . binding ; mergedInfo . resetAssignmentInfo ( binding ) ; } } } this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; if ( this . initializations != null ) { for ( int i = <NUM_LIT:0> , max = this . initializations . length ; i < max ; i ++ ) { this . initializations [ i ] . generateCode ( this . scope , codeStream ) ; } } Constant cst = this . condition == null ? null : this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedFalse = cst != null && ( cst != Constant . NotAConstant && cst . booleanValue ( ) == false ) ; if ( isConditionOptimizedFalse ) { this . condition . generateCode ( this . scope , codeStream , false ) ; if ( ( this . bits & ASTNode . NeededScope ) != <NUM_LIT:0> ) { codeStream . exitUserScope ( this . scope ) ; } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } BranchLabel actionLabel = new BranchLabel ( codeStream ) ; actionLabel . tagBits |= BranchLabel . USED ; BranchLabel conditionLabel = new BranchLabel ( codeStream ) ; this . breakLabel . initialize ( codeStream ) ; if ( this . continueLabel == null ) { conditionLabel . place ( ) ; if ( ( this . condition != null ) && ( this . condition . constant == Constant . NotAConstant ) ) { this . condition . generateOptimizedBoolean ( this . scope , codeStream , null , this . breakLabel , true ) ; } } else { this . continueLabel . initialize ( codeStream ) ; if ( ( this . condition != null ) && ( this . condition . constant == Constant . NotAConstant ) && ! ( ( this . action == null || this . action . isEmptyBlock ( ) ) && ( this . increments == null ) ) ) { conditionLabel . tagBits |= BranchLabel . USED ; int jumpPC = codeStream . position ; codeStream . goto_ ( conditionLabel ) ; codeStream . recordPositionsFrom ( jumpPC , this . condition . sourceStart ) ; } } if ( this . action != null ) { if ( this . condIfTrueInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . condIfTrueInitStateIndex ) ; } actionLabel . place ( ) ; this . action . generateCode ( this . scope , codeStream ) ; } else { actionLabel . place ( ) ; } if ( this . preIncrementsInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preIncrementsInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . preIncrementsInitStateIndex ) ; } if ( this . continueLabel != null ) { this . continueLabel . place ( ) ; if ( this . increments != null ) { for ( int i = <NUM_LIT:0> , max = this . increments . length ; i < max ; i ++ ) { this . increments [ i ] . generateCode ( this . scope , codeStream ) ; } } if ( this . preCondInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preCondInitStateIndex ) ; } conditionLabel . place ( ) ; if ( ( this . condition != null ) && ( this . condition . constant == Constant . NotAConstant ) ) { this . condition . generateOptimizedBoolean ( this . scope , codeStream , actionLabel , null , true ) ; } else { codeStream . goto_ ( actionLabel ) ; } } else { if ( this . preCondInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preCondInitStateIndex ) ; } } if ( ( this . bits & ASTNode . NeededScope ) != <NUM_LIT:0> ) { codeStream . exitUserScope ( this . scope ) ; } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } this . breakLabel . place ( ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public StringBuffer printStatement ( int tab , StringBuffer output ) { printIndent ( tab , output ) . append ( "<STR_LIT>" ) ; if ( this . initializations != null ) { for ( int i = <NUM_LIT:0> ; i < this . initializations . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . initializations [ i ] . print ( <NUM_LIT:0> , output ) ; } } output . append ( "<STR_LIT:;U+0020>" ) ; if ( this . condition != null ) this . condition . printExpression ( <NUM_LIT:0> , output ) ; output . append ( "<STR_LIT:;U+0020>" ) ; if ( this . increments != null ) { for ( int i = <NUM_LIT:0> ; i < this . increments . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . increments [ i ] . print ( <NUM_LIT:0> , output ) ; } } output . append ( "<STR_LIT>" ) ; if ( this . action == null ) output . append ( '<CHAR_LIT:;>' ) ; else { output . append ( '<STR_LIT:\n>' ) ; this . action . printStatement ( tab + <NUM_LIT:1> , output ) ; } return output ; } public void resolve ( BlockScope upperScope ) { this . scope = ( this . bits & ASTNode . NeededScope ) != <NUM_LIT:0> ? new BlockScope ( upperScope ) : upperScope ; if ( this . initializations != null ) for ( int i = <NUM_LIT:0> , length = this . initializations . length ; i < length ; i ++ ) this . initializations [ i ] . resolve ( this . scope ) ; if ( this . condition != null ) { TypeBinding type = this . condition . resolveTypeExpecting ( this . scope , TypeBinding . BOOLEAN ) ; this . condition . computeConversion ( this . scope , type , type ) ; } if ( this . increments != null ) for ( int i = <NUM_LIT:0> , length = this . increments . length ; i < length ; i ++ ) this . increments [ i ] . resolve ( this . scope ) ; if ( this . action != null ) this . action . resolve ( this . scope ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { if ( this . initializations != null ) { int initializationsLength = this . initializations . length ; for ( int i = <NUM_LIT:0> ; i < initializationsLength ; i ++ ) this . initializations [ i ] . traverse ( visitor , this . scope ) ; } if ( this . condition != null ) this . condition . traverse ( visitor , this . scope ) ; if ( this . increments != null ) { int incrementsLength = this . increments . length ; for ( int i = <NUM_LIT:0> ; i < incrementsLength ; i ++ ) this . increments [ i ] . traverse ( visitor , this . scope ) ; } if ( this . action != null ) this . action . traverse ( visitor , this . scope ) ; } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class AND_AND_Expression extends BinaryExpression { int rightInitStateIndex = - <NUM_LIT:1> ; int mergedInitStateIndex = - <NUM_LIT:1> ; public AND_AND_Expression ( Expression left , Expression right , int operator ) { super ( left , right , operator ) ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { Constant cst = this . left . optimizedBooleanConstant ( ) ; boolean isLeftOptimizedTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isLeftOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; if ( isLeftOptimizedTrue ) { FlowInfo mergedInfo = this . left . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; mergedInfo = this . right . analyseCode ( currentScope , flowContext , mergedInfo ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } FlowInfo leftInfo = this . left . analyseCode ( currentScope , flowContext , flowInfo ) ; FlowInfo rightInfo = leftInfo . initsWhenTrue ( ) . unconditionalCopy ( ) ; this . rightInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( rightInfo ) ; int previousMode = rightInfo . reachMode ( ) ; if ( isLeftOptimizedFalse ) { if ( ( rightInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { currentScope . problemReporter ( ) . fakeReachable ( this . right ) ; rightInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } rightInfo = this . right . analyseCode ( currentScope , flowContext , rightInfo ) ; if ( ( this . left . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . left . checkNPE ( currentScope , flowContext , flowInfo ) ; } if ( ( this . right . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . right . checkNPE ( currentScope , flowContext , flowInfo ) ; } FlowInfo mergedInfo = FlowInfo . conditional ( rightInfo . safeInitsWhenTrue ( ) , leftInfo . initsWhenFalse ( ) . unconditionalInits ( ) . mergedWith ( rightInfo . initsWhenFalse ( ) . setReachMode ( previousMode ) . unconditionalInits ( ) ) ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } 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 ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } Constant cst = this . right . constant ; if ( cst != Constant . NotAConstant ) { if ( cst . booleanValue ( ) == true ) { this . left . generateCode ( currentScope , codeStream , valueRequired ) ; } else { this . left . generateCode ( currentScope , codeStream , false ) ; if ( valueRequired ) codeStream . iconst_0 ( ) ; } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } BranchLabel falseLabel = new BranchLabel ( codeStream ) , endLabel ; cst = this . left . optimizedBooleanConstant ( ) ; boolean leftIsConst = cst != Constant . NotAConstant ; boolean leftIsTrue = leftIsConst && cst . booleanValue ( ) == true ; cst = this . right . optimizedBooleanConstant ( ) ; boolean rightIsConst = cst != Constant . NotAConstant ; boolean rightIsTrue = rightIsConst && cst . booleanValue ( ) == true ; generateOperands : { if ( leftIsConst ) { this . left . generateCode ( currentScope , codeStream , false ) ; if ( ! leftIsTrue ) { break generateOperands ; } } else { this . left . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , true ) ; } if ( this . rightInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . rightInitStateIndex ) ; } if ( rightIsConst ) { this . right . generateCode ( currentScope , codeStream , false ) ; } else { this . right . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , valueRequired ) ; } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } if ( valueRequired ) { if ( leftIsConst && ! leftIsTrue ) { codeStream . iconst_0 ( ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } else { if ( rightIsConst && ! rightIsTrue ) { codeStream . iconst_0 ( ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } else { codeStream . iconst_1 ( ) ; } if ( falseLabel . forwardReferenceCount ( ) > <NUM_LIT:0> ) { if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { codeStream . goto_ ( endLabel = new BranchLabel ( codeStream ) ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } else { falseLabel . place ( ) ; } } codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } else { falseLabel . place ( ) ; } } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { if ( this . constant != Constant . NotAConstant ) { super . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; return ; } Constant cst = this . right . constant ; if ( cst != Constant . NotAConstant && cst . booleanValue ( ) == true ) { int pc = codeStream . position ; this . left . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } cst = this . left . optimizedBooleanConstant ( ) ; boolean leftIsConst = cst != Constant . NotAConstant ; boolean leftIsTrue = leftIsConst && cst . booleanValue ( ) == true ; cst = this . right . optimizedBooleanConstant ( ) ; boolean rightIsConst = cst != Constant . NotAConstant ; boolean rightIsTrue = rightIsConst && cst . booleanValue ( ) == true ; generateOperands : { if ( falseLabel == null ) { if ( trueLabel != null ) { BranchLabel internalFalseLabel = new BranchLabel ( codeStream ) ; this . left . generateOptimizedBoolean ( currentScope , codeStream , null , internalFalseLabel , ! leftIsConst ) ; if ( leftIsConst && ! leftIsTrue ) { internalFalseLabel . place ( ) ; break generateOperands ; } if ( this . rightInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . rightInitStateIndex ) ; } this . right . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , null , valueRequired && ! rightIsConst ) ; if ( valueRequired && rightIsConst && rightIsTrue ) { codeStream . goto_ ( trueLabel ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } internalFalseLabel . place ( ) ; } } else { if ( trueLabel == null ) { this . left . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , ! leftIsConst ) ; if ( leftIsConst && ! leftIsTrue ) { if ( valueRequired ) codeStream . goto_ ( falseLabel ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; break generateOperands ; } if ( this . rightInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . rightInitStateIndex ) ; } this . right . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , valueRequired && ! rightIsConst ) ; if ( valueRequired && rightIsConst && ! rightIsTrue ) { codeStream . goto_ ( falseLabel ) ; codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } } else { } } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } } public boolean isCompactableOperation ( ) { return false ; } public TypeBinding resolveType ( BlockScope scope ) { TypeBinding result = super . resolveType ( scope ) ; Binding leftDirect = Expression . getDirectBinding ( this . left ) ; if ( leftDirect != null && leftDirect == Expression . getDirectBinding ( this . right ) ) { if ( ! ( this . right instanceof Assignment ) ) scope . problemReporter ( ) . comparingIdenticalExpressions ( this ) ; } return result ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . left . traverse ( visitor , scope ) ; this . right . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class QualifiedThisReference extends ThisReference { public TypeReference qualification ; ReferenceBinding currentCompatibleType ; public QualifiedThisReference ( TypeReference name , int sourceStart , int sourceEnd ) { super ( sourceStart , sourceEnd ) ; this . qualification = name ; name . bits |= IgnoreRawTypeCheck ; this . sourceStart = name . sourceStart ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , boolean valueRequired ) { return flowInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { Object [ ] emulationPath = currentScope . getEmulationPath ( this . currentCompatibleType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , this . currentCompatibleType , currentScope ) ; } else { codeStream . aload_0 ( ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; TypeBinding type = this . qualification . resolveType ( scope , true ) ; if ( type == null || ! type . isValidBinding ( ) ) return null ; type = type . erasure ( ) ; if ( type instanceof ReferenceBinding ) { this . resolvedType = scope . environment ( ) . convertToParameterizedType ( ( ReferenceBinding ) type ) ; } else { this . resolvedType = type ; } int depth = <NUM_LIT:0> ; this . currentCompatibleType = scope . referenceType ( ) . binding ; while ( this . currentCompatibleType != null && this . currentCompatibleType != type ) { depth ++ ; this . currentCompatibleType = this . currentCompatibleType . isStatic ( ) ? null : this . currentCompatibleType . enclosingType ( ) ; } this . bits &= ~ DepthMASK ; this . bits |= ( depth & <NUM_LIT> ) << DepthSHIFT ; if ( this . currentCompatibleType == null ) { scope . problemReporter ( ) . noSuchEnclosingInstance ( type , this , false ) ; return this . resolvedType ; } if ( depth == <NUM_LIT:0> ) { checkAccess ( scope . methodScope ( ) ) ; } return this . resolvedType ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { return this . qualification . print ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . qualification . traverse ( visitor , blockScope ) ; } visitor . endVisit ( this , blockScope ) ; } public void traverse ( ASTVisitor visitor , ClassScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . qualification . traverse ( visitor , blockScope ) ; } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . BranchLabel ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; 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 . impl . ReferenceContext ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . BaseTypeBinding ; 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 . 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 . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . WildcardBinding ; import org . eclipse . jdt . internal . compiler . problem . ShouldNotImplement ; import org . eclipse . jdt . internal . compiler . util . Messages ; public abstract class Expression extends Statement { public Constant constant ; public int statementEnd = - <NUM_LIT:1> ; public int implicitConversion ; public TypeBinding resolvedType ; public static final boolean isConstantValueRepresentable ( Constant constant , int constantTypeID , int targetTypeID ) { if ( targetTypeID == constantTypeID ) return true ; switch ( targetTypeID ) { case T_char : switch ( constantTypeID ) { case T_char : return true ; case T_double : return constant . doubleValue ( ) == constant . charValue ( ) ; case T_float : return constant . floatValue ( ) == constant . charValue ( ) ; case T_int : return constant . intValue ( ) == constant . charValue ( ) ; case T_short : return constant . shortValue ( ) == constant . charValue ( ) ; case T_byte : return constant . byteValue ( ) == constant . charValue ( ) ; case T_long : return constant . longValue ( ) == constant . charValue ( ) ; default : return false ; } case T_float : switch ( constantTypeID ) { case T_char : return constant . charValue ( ) == constant . floatValue ( ) ; case T_double : return constant . doubleValue ( ) == constant . floatValue ( ) ; case T_float : return true ; case T_int : return constant . intValue ( ) == constant . floatValue ( ) ; case T_short : return constant . shortValue ( ) == constant . floatValue ( ) ; case T_byte : return constant . byteValue ( ) == constant . floatValue ( ) ; case T_long : return constant . longValue ( ) == constant . floatValue ( ) ; default : return false ; } case T_double : switch ( constantTypeID ) { case T_char : return constant . charValue ( ) == constant . doubleValue ( ) ; case T_double : return true ; case T_float : return constant . floatValue ( ) == constant . doubleValue ( ) ; case T_int : return constant . intValue ( ) == constant . doubleValue ( ) ; case T_short : return constant . shortValue ( ) == constant . doubleValue ( ) ; case T_byte : return constant . byteValue ( ) == constant . doubleValue ( ) ; case T_long : return constant . longValue ( ) == constant . doubleValue ( ) ; default : return false ; } case T_byte : switch ( constantTypeID ) { case T_char : return constant . charValue ( ) == constant . byteValue ( ) ; case T_double : return constant . doubleValue ( ) == constant . byteValue ( ) ; case T_float : return constant . floatValue ( ) == constant . byteValue ( ) ; case T_int : return constant . intValue ( ) == constant . byteValue ( ) ; case T_short : return constant . shortValue ( ) == constant . byteValue ( ) ; case T_byte : return true ; case T_long : return constant . longValue ( ) == constant . byteValue ( ) ; default : return false ; } case T_short : switch ( constantTypeID ) { case T_char : return constant . charValue ( ) == constant . shortValue ( ) ; case T_double : return constant . doubleValue ( ) == constant . shortValue ( ) ; case T_float : return constant . floatValue ( ) == constant . shortValue ( ) ; case T_int : return constant . intValue ( ) == constant . shortValue ( ) ; case T_short : return true ; case T_byte : return constant . byteValue ( ) == constant . shortValue ( ) ; case T_long : return constant . longValue ( ) == constant . shortValue ( ) ; default : return false ; } case T_int : switch ( constantTypeID ) { case T_char : return constant . charValue ( ) == constant . intValue ( ) ; case T_double : return constant . doubleValue ( ) == constant . intValue ( ) ; case T_float : return constant . floatValue ( ) == constant . intValue ( ) ; case T_int : return true ; case T_short : return constant . shortValue ( ) == constant . intValue ( ) ; case T_byte : return constant . byteValue ( ) == constant . intValue ( ) ; case T_long : return constant . longValue ( ) == constant . intValue ( ) ; default : return false ; } case T_long : switch ( constantTypeID ) { case T_char : return constant . charValue ( ) == constant . longValue ( ) ; case T_double : return constant . doubleValue ( ) == constant . longValue ( ) ; case T_float : return constant . floatValue ( ) == constant . longValue ( ) ; case T_int : return constant . intValue ( ) == constant . longValue ( ) ; case T_short : return constant . shortValue ( ) == constant . longValue ( ) ; case T_byte : return constant . byteValue ( ) == constant . longValue ( ) ; case T_long : return true ; default : return false ; } default : return false ; } } public Expression ( ) { super ( ) ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , boolean valueRequired ) { return analyseCode ( currentScope , flowContext , flowInfo ) ; } public final boolean checkCastTypesCompatibility ( Scope scope , TypeBinding castType , TypeBinding expressionType , Expression expression ) { if ( castType == null || expressionType == null ) return true ; boolean use15specifics = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ; boolean use17specifics = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_7 ; if ( castType . isBaseType ( ) ) { if ( expressionType . isBaseType ( ) ) { if ( expressionType == castType ) { if ( expression != null ) { this . constant = expression . constant ; } tagAsUnnecessaryCast ( scope , castType ) ; return true ; } boolean necessary = false ; if ( expressionType . isCompatibleWith ( castType ) || ( necessary = BaseTypeBinding . isNarrowing ( castType . id , expressionType . id ) ) ) { if ( expression != null ) { expression . implicitConversion = ( castType . id << <NUM_LIT:4> ) + expressionType . id ; if ( expression . constant != Constant . NotAConstant ) { this . constant = expression . constant . castTo ( expression . implicitConversion ) ; } } if ( ! necessary ) tagAsUnnecessaryCast ( scope , castType ) ; return true ; } } else if ( use17specifics && expressionType . id == TypeIds . T_JavaLangObject ) { return true ; } else if ( use15specifics && scope . environment ( ) . computeBoxingType ( expressionType ) . isCompatibleWith ( castType ) ) { tagAsUnnecessaryCast ( scope , castType ) ; return true ; } return false ; } else if ( use15specifics && expressionType . isBaseType ( ) && scope . environment ( ) . computeBoxingType ( expressionType ) . isCompatibleWith ( castType ) ) { tagAsUnnecessaryCast ( scope , castType ) ; return true ; } switch ( expressionType . kind ( ) ) { case Binding . BASE_TYPE : if ( expressionType == TypeBinding . NULL ) { tagAsUnnecessaryCast ( scope , castType ) ; return true ; } return false ; case Binding . ARRAY_TYPE : if ( castType == expressionType ) { tagAsUnnecessaryCast ( scope , castType ) ; return true ; } switch ( castType . kind ( ) ) { case Binding . ARRAY_TYPE : TypeBinding castElementType = ( ( ArrayBinding ) castType ) . elementsType ( ) ; TypeBinding exprElementType = ( ( ArrayBinding ) expressionType ) . elementsType ( ) ; if ( exprElementType . isBaseType ( ) || castElementType . isBaseType ( ) ) { if ( castElementType == exprElementType ) { tagAsNeedCheckCast ( ) ; return true ; } return false ; } return checkCastTypesCompatibility ( scope , castElementType , exprElementType , expression ) ; case Binding . TYPE_PARAMETER : TypeBinding match = expressionType . findSuperTypeOriginatingFrom ( castType ) ; if ( match == null ) { checkUnsafeCast ( scope , castType , expressionType , null , true ) ; } return checkCastTypesCompatibility ( scope , ( ( TypeVariableBinding ) castType ) . upperBound ( ) , expressionType , expression ) ; default : switch ( castType . id ) { case T_JavaLangCloneable : case T_JavaIoSerializable : tagAsNeedCheckCast ( ) ; return true ; case T_JavaLangObject : tagAsUnnecessaryCast ( scope , castType ) ; return true ; default : return false ; } } case Binding . TYPE_PARAMETER : TypeBinding match = expressionType . findSuperTypeOriginatingFrom ( castType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , expressionType , match , false ) ; } return checkCastTypesCompatibility ( scope , castType , ( ( TypeVariableBinding ) expressionType ) . upperBound ( ) , expression ) ; case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : match = expressionType . findSuperTypeOriginatingFrom ( castType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , expressionType , match , false ) ; } return checkCastTypesCompatibility ( scope , castType , ( ( WildcardBinding ) expressionType ) . bound , expression ) ; default : if ( expressionType . isInterface ( ) ) { switch ( castType . kind ( ) ) { case Binding . ARRAY_TYPE : switch ( expressionType . id ) { case T_JavaLangCloneable : case T_JavaIoSerializable : tagAsNeedCheckCast ( ) ; return true ; default : return false ; } case Binding . TYPE_PARAMETER : match = expressionType . findSuperTypeOriginatingFrom ( castType ) ; if ( match == null ) { checkUnsafeCast ( scope , castType , expressionType , null , true ) ; } return checkCastTypesCompatibility ( scope , ( ( TypeVariableBinding ) castType ) . upperBound ( ) , expressionType , expression ) ; default : if ( castType . isInterface ( ) ) { ReferenceBinding interfaceType = ( ReferenceBinding ) expressionType ; match = interfaceType . findSuperTypeOriginatingFrom ( castType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , interfaceType , match , false ) ; } tagAsNeedCheckCast ( ) ; match = castType . findSuperTypeOriginatingFrom ( interfaceType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , interfaceType , match , true ) ; } if ( use15specifics ) { checkUnsafeCast ( scope , castType , expressionType , null , true ) ; if ( scope . compilerOptions ( ) . complianceLevel < ClassFileConstants . JDK1_7 ) { if ( interfaceType . hasIncompatibleSuperType ( ( ReferenceBinding ) castType ) ) { return false ; } } else if ( ! castType . isRawType ( ) && interfaceType . hasIncompatibleSuperType ( ( ReferenceBinding ) castType ) ) { return false ; } } else { MethodBinding [ ] castTypeMethods = getAllOriginalInheritedMethods ( ( ReferenceBinding ) castType ) ; MethodBinding [ ] expressionTypeMethods = getAllOriginalInheritedMethods ( ( ReferenceBinding ) expressionType ) ; int exprMethodsLength = expressionTypeMethods . length ; for ( int i = <NUM_LIT:0> , castMethodsLength = castTypeMethods . length ; i < castMethodsLength ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < exprMethodsLength ; j ++ ) { if ( ( castTypeMethods [ i ] . returnType != expressionTypeMethods [ j ] . returnType ) && ( CharOperation . equals ( castTypeMethods [ i ] . selector , expressionTypeMethods [ j ] . selector ) ) && castTypeMethods [ i ] . areParametersEqual ( expressionTypeMethods [ j ] ) ) { return false ; } } } } return true ; } else { if ( castType . id == TypeIds . T_JavaLangObject ) { tagAsUnnecessaryCast ( scope , castType ) ; return true ; } tagAsNeedCheckCast ( ) ; match = castType . findSuperTypeOriginatingFrom ( expressionType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , expressionType , match , true ) ; } if ( ( ( ReferenceBinding ) castType ) . isFinal ( ) ) { return false ; } if ( use15specifics ) { checkUnsafeCast ( scope , castType , expressionType , null , true ) ; if ( scope . compilerOptions ( ) . complianceLevel < ClassFileConstants . JDK1_7 ) { if ( ( ( ReferenceBinding ) castType ) . hasIncompatibleSuperType ( ( ReferenceBinding ) expressionType ) ) { return false ; } } else if ( ! castType . isRawType ( ) && ( ( ReferenceBinding ) castType ) . hasIncompatibleSuperType ( ( ReferenceBinding ) expressionType ) ) { return false ; } } return true ; } } } else { switch ( castType . kind ( ) ) { case Binding . ARRAY_TYPE : if ( expressionType . id == TypeIds . T_JavaLangObject ) { if ( use15specifics ) checkUnsafeCast ( scope , castType , expressionType , expressionType , true ) ; tagAsNeedCheckCast ( ) ; return true ; } return false ; case Binding . TYPE_PARAMETER : match = expressionType . findSuperTypeOriginatingFrom ( castType ) ; if ( match == null ) { checkUnsafeCast ( scope , castType , expressionType , null , true ) ; } return checkCastTypesCompatibility ( scope , ( ( TypeVariableBinding ) castType ) . upperBound ( ) , expressionType , expression ) ; default : if ( castType . isInterface ( ) ) { ReferenceBinding refExprType = ( ReferenceBinding ) expressionType ; match = refExprType . findSuperTypeOriginatingFrom ( castType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , expressionType , match , false ) ; } if ( refExprType . isFinal ( ) ) { return false ; } tagAsNeedCheckCast ( ) ; match = castType . findSuperTypeOriginatingFrom ( expressionType ) ; if ( match != null ) { return checkUnsafeCast ( scope , castType , expressionType , match , true ) ; } if ( use15specifics ) { checkUnsafeCast ( scope , castType , expressionType , null , true ) ; if ( scope . compilerOptions ( ) . complianceLevel < ClassFileConstants . JDK1_7 ) { if ( refExprType . hasIncompatibleSuperType ( ( ReferenceBinding ) castType ) ) { return false ; } } else if ( ! castType . isRawType ( ) && refExprType . hasIncompatibleSuperType ( ( ReferenceBinding ) castType ) ) { return false ; } } return true ; } else { match = expressionType . findSuperTypeOriginatingFrom ( castType ) ; if ( match != null ) { if ( expression != null && castType . id == TypeIds . T_JavaLangString ) this . constant = expression . constant ; return checkUnsafeCast ( scope , castType , expressionType , match , false ) ; } match = castType . findSuperTypeOriginatingFrom ( expressionType ) ; if ( match != null ) { tagAsNeedCheckCast ( ) ; return checkUnsafeCast ( scope , castType , expressionType , match , true ) ; } return false ; } } } } } public void checkNPE ( BlockScope scope , FlowContext flowContext , FlowInfo flowInfo ) { LocalVariableBinding local = localVariableBinding ( ) ; if ( local != null && ( local . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { if ( ( this . bits & ASTNode . IsNonNull ) == <NUM_LIT:0> ) { flowContext . recordUsingNullReference ( scope , local , this , FlowContext . MAY_NULL , flowInfo ) ; } flowInfo . markAsComparedEqualToNonNull ( local ) ; if ( ( flowContext . tagBits & FlowContext . HIDE_NULL_COMPARISON_WARNING ) != <NUM_LIT:0> ) { flowInfo . markedAsNullOrNonNullInAssertExpression ( local ) ; } if ( flowContext . initsOnFinally != null ) { flowContext . initsOnFinally . markAsComparedEqualToNonNull ( local ) ; if ( ( flowContext . tagBits & FlowContext . HIDE_NULL_COMPARISON_WARNING ) != <NUM_LIT:0> ) { flowContext . initsOnFinally . markedAsNullOrNonNullInAssertExpression ( local ) ; } } } } public boolean checkUnsafeCast ( Scope scope , TypeBinding castType , TypeBinding expressionType , TypeBinding match , boolean isNarrowing ) { if ( match == castType ) { if ( ! isNarrowing ) tagAsUnnecessaryCast ( scope , castType ) ; return true ; } if ( match != null && ( ! castType . isReifiable ( ) || ! expressionType . isReifiable ( ) ) ) { if ( isNarrowing ? match . isProvablyDistinct ( expressionType ) : castType . isProvablyDistinct ( match ) ) { return false ; } } if ( ! isNarrowing ) tagAsUnnecessaryCast ( scope , castType ) ; return true ; } public void computeConversion ( Scope scope , TypeBinding runtimeType , TypeBinding compileTimeType ) { if ( runtimeType == null || compileTimeType == null ) return ; if ( this . implicitConversion != <NUM_LIT:0> ) return ; if ( runtimeType != TypeBinding . NULL && runtimeType . isBaseType ( ) ) { if ( ! compileTimeType . isBaseType ( ) ) { TypeBinding unboxedType = scope . environment ( ) . computeBoxingType ( compileTimeType ) ; this . implicitConversion = TypeIds . UNBOXING ; scope . problemReporter ( ) . autoboxing ( this , compileTimeType , runtimeType ) ; compileTimeType = unboxedType ; } } else if ( compileTimeType != TypeBinding . NULL && compileTimeType . isBaseType ( ) ) { TypeBinding boxedType = scope . environment ( ) . computeBoxingType ( runtimeType ) ; if ( boxedType == runtimeType ) boxedType = compileTimeType ; this . implicitConversion = TypeIds . BOXING | ( boxedType . id << <NUM_LIT:4> ) + compileTimeType . id ; scope . problemReporter ( ) . autoboxing ( this , compileTimeType , scope . environment ( ) . computeBoxingType ( boxedType ) ) ; return ; } else if ( this . constant != Constant . NotAConstant && this . constant . typeID ( ) != TypeIds . T_JavaLangString ) { this . implicitConversion = TypeIds . BOXING ; return ; } int compileTimeTypeID , runtimeTypeID ; if ( ( compileTimeTypeID = compileTimeType . id ) == TypeIds . NoId ) { compileTimeTypeID = compileTimeType . erasure ( ) . id == TypeIds . T_JavaLangString ? TypeIds . T_JavaLangString : TypeIds . T_JavaLangObject ; } switch ( runtimeTypeID = runtimeType . id ) { case T_byte : case T_short : case T_char : if ( compileTimeTypeID == TypeIds . T_JavaLangObject ) { this . implicitConversion |= ( runtimeTypeID << <NUM_LIT:4> ) + compileTimeTypeID ; } else { this . implicitConversion |= ( TypeIds . T_int << <NUM_LIT:4> ) + compileTimeTypeID ; } break ; case T_JavaLangString : case T_float : case T_boolean : case T_double : case T_int : case T_long : this . implicitConversion |= ( runtimeTypeID << <NUM_LIT:4> ) + compileTimeTypeID ; break ; default : } } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } generateCode ( currentScope , codeStream , false ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { if ( this . constant != Constant . NotAConstant ) { int pc = codeStream . position ; codeStream . generateConstant ( this . constant , this . implicitConversion ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } else { throw new ShouldNotImplement ( Messages . ast_missingCode ) ; } } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { Constant cst = optimizedBooleanConstant ( ) ; generateCode ( currentScope , codeStream , valueRequired && cst == Constant . NotAConstant ) ; if ( ( cst != Constant . NotAConstant ) && ( cst . typeID ( ) == TypeIds . T_boolean ) ) { int pc = codeStream . position ; if ( cst . booleanValue ( ) == true ) { if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . goto_ ( trueLabel ) ; } } } } else { if ( valueRequired ) { if ( falseLabel != null ) { if ( trueLabel == null ) { codeStream . goto_ ( falseLabel ) ; } } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } int position = codeStream . position ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . ifne ( trueLabel ) ; } } else { if ( trueLabel == null ) { codeStream . ifeq ( falseLabel ) ; } else { } } } codeStream . updateLastRecordedEndPC ( currentScope , position ) ; } public void generateOptimizedStringConcatenation ( BlockScope blockScope , CodeStream codeStream , int typeID ) { if ( typeID == TypeIds . T_JavaLangString && this . constant != Constant . NotAConstant && this . constant . stringValue ( ) . length ( ) == <NUM_LIT:0> ) { return ; } generateCode ( blockScope , codeStream , true ) ; codeStream . invokeStringConcatenationAppendForType ( typeID ) ; } public void generateOptimizedStringConcatenationCreation ( BlockScope blockScope , CodeStream codeStream , int typeID ) { codeStream . newStringContatenation ( ) ; codeStream . dup ( ) ; switch ( typeID ) { case T_JavaLangObject : case T_undefined : codeStream . invokeStringConcatenationDefaultConstructor ( ) ; generateCode ( blockScope , codeStream , true ) ; codeStream . invokeStringConcatenationAppendForType ( TypeIds . T_JavaLangObject ) ; return ; case T_JavaLangString : case T_null : if ( this . constant != Constant . NotAConstant ) { String stringValue = this . constant . stringValue ( ) ; if ( stringValue . length ( ) == <NUM_LIT:0> ) { codeStream . invokeStringConcatenationDefaultConstructor ( ) ; return ; } codeStream . ldc ( stringValue ) ; } else { generateCode ( blockScope , codeStream , true ) ; codeStream . invokeStringValueOf ( TypeIds . T_JavaLangObject ) ; } break ; default : generateCode ( blockScope , codeStream , true ) ; codeStream . invokeStringValueOf ( typeID ) ; } codeStream . invokeStringConcatenationStringConstructor ( ) ; } private MethodBinding [ ] getAllOriginalInheritedMethods ( ReferenceBinding binding ) { ArrayList collector = new ArrayList ( ) ; getAllInheritedMethods0 ( binding , collector ) ; for ( int i = <NUM_LIT:0> , len = collector . size ( ) ; i < len ; i ++ ) { collector . set ( i , ( ( MethodBinding ) collector . get ( i ) ) . original ( ) ) ; } return ( MethodBinding [ ] ) collector . toArray ( new MethodBinding [ collector . size ( ) ] ) ; } private void getAllInheritedMethods0 ( ReferenceBinding binding , ArrayList collector ) { if ( ! binding . isInterface ( ) ) return ; MethodBinding [ ] methodBindings = binding . methods ( ) ; for ( int i = <NUM_LIT:0> , max = methodBindings . length ; i < max ; i ++ ) { collector . add ( methodBindings [ i ] ) ; } ReferenceBinding [ ] superInterfaces = binding . superInterfaces ( ) ; for ( int i = <NUM_LIT:0> , max = superInterfaces . length ; i < max ; i ++ ) { getAllInheritedMethods0 ( superInterfaces [ i ] , collector ) ; } } public static Binding getDirectBinding ( Expression someExpression ) { if ( ( someExpression . bits & ASTNode . IgnoreNoEffectAssignCheck ) != <NUM_LIT:0> ) { return null ; } if ( someExpression instanceof SingleNameReference ) { return ( ( SingleNameReference ) someExpression ) . binding ; } else if ( someExpression instanceof FieldReference ) { FieldReference fieldRef = ( FieldReference ) someExpression ; if ( fieldRef . receiver . isThis ( ) && ! ( fieldRef . receiver instanceof QualifiedThisReference ) ) { return fieldRef . binding ; } } else if ( someExpression instanceof Assignment ) { Expression lhs = ( ( Assignment ) someExpression ) . lhs ; if ( ( lhs . bits & ASTNode . IsStrictlyAssigned ) != <NUM_LIT:0> ) { return getDirectBinding ( ( ( Assignment ) someExpression ) . lhs ) ; } else if ( someExpression instanceof PrefixExpression ) { return getDirectBinding ( ( ( Assignment ) someExpression ) . lhs ) ; } } else if ( someExpression instanceof QualifiedNameReference ) { QualifiedNameReference qualifiedNameReference = ( QualifiedNameReference ) someExpression ; if ( qualifiedNameReference . indexOfFirstFieldBinding != <NUM_LIT:1> && qualifiedNameReference . otherBindings == null ) { return qualifiedNameReference . binding ; } } else if ( someExpression . isThis ( ) ) { return someExpression . resolvedType ; } return null ; } public boolean isCompactableOperation ( ) { return false ; } public boolean isConstantValueOfTypeAssignableToType ( TypeBinding constantType , TypeBinding targetType ) { if ( this . constant == Constant . NotAConstant ) return false ; if ( constantType == targetType ) return true ; if ( BaseTypeBinding . isWidening ( TypeIds . T_int , constantType . id ) && ( BaseTypeBinding . isNarrowing ( targetType . id , TypeIds . T_int ) ) ) { return isConstantValueRepresentable ( this . constant , constantType . id , targetType . id ) ; } return false ; } public boolean isTypeReference ( ) { return false ; } public LocalVariableBinding localVariableBinding ( ) { return null ; } public void markAsNonNull ( ) { this . bits |= ASTNode . IsNonNull ; } public int nullStatus ( FlowInfo flowInfo ) { if ( this . constant != null && this . constant != Constant . NotAConstant ) return FlowInfo . NON_NULL ; LocalVariableBinding local = localVariableBinding ( ) ; if ( local != null ) return flowInfo . nullStatus ( local ) ; return FlowInfo . NON_NULL ; } public Constant optimizedBooleanConstant ( ) { return this . constant ; } public TypeBinding postConversionType ( Scope scope ) { TypeBinding convertedType = this . resolvedType ; int runtimeType = ( this . implicitConversion & TypeIds . IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ; switch ( runtimeType ) { case T_boolean : convertedType = TypeBinding . BOOLEAN ; break ; case T_byte : convertedType = TypeBinding . BYTE ; break ; case T_short : convertedType = TypeBinding . SHORT ; break ; case T_char : convertedType = TypeBinding . CHAR ; break ; case T_int : convertedType = TypeBinding . INT ; break ; case T_float : convertedType = TypeBinding . FLOAT ; break ; case T_long : convertedType = TypeBinding . LONG ; break ; case T_double : convertedType = TypeBinding . DOUBLE ; break ; default : } if ( ( this . implicitConversion & TypeIds . BOXING ) != <NUM_LIT:0> ) { convertedType = scope . environment ( ) . computeBoxingType ( convertedType ) ; } return convertedType ; } public StringBuffer print ( int indent , StringBuffer output ) { printIndent ( indent , output ) ; return printExpression ( indent , output ) ; } public abstract StringBuffer printExpression ( int indent , StringBuffer output ) ; public StringBuffer printStatement ( int indent , StringBuffer output ) { return print ( indent , output ) . append ( "<STR_LIT:;>" ) ; } public void resolve ( BlockScope scope ) { this . resolveType ( scope ) ; return ; } public TypeBinding resolveType ( BlockScope scope ) { return null ; } public TypeBinding resolveType ( ClassScope scope ) { return null ; } public TypeBinding resolveTypeExpecting ( BlockScope scope , TypeBinding expectedType ) { setExpectedType ( expectedType ) ; TypeBinding expressionType = this . resolveType ( scope ) ; if ( expressionType == null ) return null ; if ( expressionType == expectedType ) return expressionType ; if ( ! expressionType . isCompatibleWith ( expectedType ) ) { if ( scope . isBoxingCompatibleWith ( expressionType , expectedType ) ) { computeConversion ( scope , expectedType , expressionType ) ; } else { scope . problemReporter ( ) . typeMismatchError ( expressionType , expectedType , this , null ) ; return null ; } } return expressionType ; } public boolean forcedToBeRaw ( ReferenceContext referenceContext ) { if ( this instanceof NameReference ) { final Binding receiverBinding = ( ( NameReference ) this ) . binding ; if ( receiverBinding . isParameter ( ) && ( ( ( LocalVariableBinding ) receiverBinding ) . tagBits & TagBits . ForcedToBeRawType ) != <NUM_LIT:0> ) { return true ; } else if ( receiverBinding instanceof FieldBinding ) { FieldBinding field = ( FieldBinding ) receiverBinding ; if ( field . type . isRawType ( ) ) { if ( referenceContext instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDecl = ( AbstractMethodDeclaration ) referenceContext ; if ( field . declaringClass != methodDecl . binding . declaringClass ) { return true ; } } else if ( referenceContext instanceof TypeDeclaration ) { TypeDeclaration type = ( TypeDeclaration ) referenceContext ; if ( field . declaringClass != type . binding ) { return true ; } } } } } else if ( this instanceof MessageSend ) { if ( ! CharOperation . equals ( ( ( MessageSend ) this ) . binding . declaringClass . getFileName ( ) , referenceContext . compilationResult ( ) . getFileName ( ) ) ) { return true ; } } else if ( this instanceof FieldReference ) { FieldBinding field = ( ( FieldReference ) this ) . binding ; if ( ! CharOperation . equals ( field . declaringClass . getFileName ( ) , referenceContext . compilationResult ( ) . getFileName ( ) ) ) { return true ; } if ( field . type . isRawType ( ) ) { if ( referenceContext instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDecl = ( AbstractMethodDeclaration ) referenceContext ; if ( field . declaringClass != methodDecl . binding . declaringClass ) { return true ; } } else if ( referenceContext instanceof TypeDeclaration ) { TypeDeclaration type = ( TypeDeclaration ) referenceContext ; if ( field . declaringClass != type . binding ) { return true ; } } } } else if ( this instanceof ConditionalExpression ) { ConditionalExpression ternary = ( ConditionalExpression ) this ; if ( ternary . valueIfTrue . forcedToBeRaw ( referenceContext ) || ternary . valueIfFalse . forcedToBeRaw ( referenceContext ) ) { return true ; } } return false ; } public Object reusableJSRTarget ( ) { if ( this . constant != Constant . NotAConstant ) return this . constant ; return null ; } public void setExpectedType ( TypeBinding expectedType ) { } public void tagAsNeedCheckCast ( ) { } public void tagAsUnnecessaryCast ( Scope scope , TypeBinding castType ) { } public Expression toTypeReference ( ) { return this ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { } public void traverse ( ASTVisitor visitor , ClassScope scope ) { } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . ElementValuePair ; 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 . TypeBinding ; public class MemberValuePair extends ASTNode { public char [ ] name ; public Expression value ; public MethodBinding binding ; public ElementValuePair compilerElementPair = null ; public MemberValuePair ( char [ ] token , int sourceStart , int sourceEnd , Expression value ) { this . name = token ; this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; this . value = value ; if ( value instanceof ArrayInitializer ) { value . bits |= IsAnnotationDefaultValue ; } } public StringBuffer print ( int indent , StringBuffer output ) { output . append ( this . name ) . append ( "<STR_LIT:U+0020=U+0020>" ) ; this . value . print ( <NUM_LIT:0> , output ) ; return output ; } public void resolveTypeExpecting ( BlockScope scope , TypeBinding requiredType ) { if ( this . value == null ) { this . compilerElementPair = new ElementValuePair ( this . name , this . value , this . binding ) ; return ; } if ( requiredType == null ) { if ( this . value instanceof ArrayInitializer ) { this . value . resolveTypeExpecting ( scope , null ) ; } else { this . value . resolveType ( scope ) ; } this . compilerElementPair = new ElementValuePair ( this . name , this . value , this . binding ) ; return ; } this . value . setExpectedType ( requiredType ) ; TypeBinding valueType ; if ( this . value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) this . value ; valueType = initializer . resolveTypeExpecting ( scope , this . binding . returnType ) ; } else if ( this . value instanceof ArrayAllocationExpression ) { scope . problemReporter ( ) . annotationValueMustBeArrayInitializer ( this . binding . declaringClass , this . name , this . value ) ; this . value . resolveType ( scope ) ; valueType = null ; } else { valueType = this . value . resolveType ( scope ) ; ASTVisitor visitor = new ASTVisitor ( ) { public boolean visit ( SingleNameReference reference , BlockScope scop ) { if ( reference . binding instanceof LocalVariableBinding ) { ( ( LocalVariableBinding ) reference . binding ) . useFlag = LocalVariableBinding . USED ; } return true ; } } ; this . value . traverse ( visitor , scope ) ; } this . compilerElementPair = new ElementValuePair ( this . name , this . value , this . binding ) ; if ( valueType == null ) return ; TypeBinding leafType = requiredType . leafComponentType ( ) ; if ( ! ( this . value . isConstantValueOfTypeAssignableToType ( valueType , requiredType ) || valueType . isCompatibleWith ( requiredType ) ) ) { if ( ! ( requiredType . isArrayType ( ) && requiredType . dimensions ( ) == <NUM_LIT:1> && ( this . value . isConstantValueOfTypeAssignableToType ( valueType , leafType ) || valueType . isCompatibleWith ( leafType ) ) ) ) { if ( leafType . isAnnotationType ( ) && ! valueType . isAnnotationType ( ) ) { scope . problemReporter ( ) . annotationValueMustBeAnnotation ( this . binding . declaringClass , this . name , this . value , leafType ) ; } else { scope . problemReporter ( ) . typeMismatchError ( valueType , requiredType , this . value , null ) ; } return ; } } else { scope . compilationUnitScope ( ) . recordTypeConversion ( requiredType . leafComponentType ( ) , valueType . leafComponentType ( ) ) ; this . value . computeConversion ( scope , requiredType , valueType ) ; } checkAnnotationMethodType : { switch ( leafType . erasure ( ) . id ) { case T_byte : case T_short : case T_char : case T_int : case T_long : case T_float : case T_double : case T_boolean : case T_JavaLangString : if ( this . value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) this . value ; final Expression [ ] expressions = initializer . expressions ; if ( expressions != null ) { for ( int i = <NUM_LIT:0> , max = expressions . length ; i < max ; i ++ ) { Expression expression = expressions [ i ] ; if ( expression . resolvedType == null ) continue ; if ( expression . constant == Constant . NotAConstant ) { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , expressions [ i ] , false ) ; } } } } else if ( this . value . constant == Constant . NotAConstant ) { if ( valueType . isArrayType ( ) ) { scope . problemReporter ( ) . annotationValueMustBeArrayInitializer ( this . binding . declaringClass , this . name , this . value ) ; } else { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , this . value , false ) ; } } break checkAnnotationMethodType ; case T_JavaLangClass : if ( this . value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) this . value ; final Expression [ ] expressions = initializer . expressions ; if ( expressions != null ) { for ( int i = <NUM_LIT:0> , max = expressions . length ; i < max ; i ++ ) { Expression currentExpression = expressions [ i ] ; if ( ! ( currentExpression instanceof ClassLiteralAccess ) ) { scope . problemReporter ( ) . annotationValueMustBeClassLiteral ( this . binding . declaringClass , this . name , currentExpression ) ; } } } } else if ( ! ( this . value instanceof ClassLiteralAccess ) ) { scope . problemReporter ( ) . annotationValueMustBeClassLiteral ( this . binding . declaringClass , this . name , this . value ) ; } break checkAnnotationMethodType ; } if ( leafType . isEnum ( ) ) { if ( this . value instanceof NullLiteral ) { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , this . value , true ) ; } else if ( this . value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) this . value ; final Expression [ ] expressions = initializer . expressions ; if ( expressions != null ) { for ( int i = <NUM_LIT:0> , max = expressions . length ; i < max ; i ++ ) { Expression currentExpression = expressions [ i ] ; if ( currentExpression instanceof NullLiteral ) { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , currentExpression , true ) ; } else if ( currentExpression instanceof NameReference ) { NameReference nameReference = ( NameReference ) currentExpression ; final Binding nameReferenceBinding = nameReference . binding ; if ( nameReferenceBinding . kind ( ) == Binding . FIELD ) { FieldBinding fieldBinding = ( FieldBinding ) nameReferenceBinding ; if ( ! fieldBinding . declaringClass . isEnum ( ) ) { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , currentExpression , true ) ; } } } } } } else if ( this . value instanceof NameReference ) { NameReference nameReference = ( NameReference ) this . value ; final Binding nameReferenceBinding = nameReference . binding ; if ( nameReferenceBinding . kind ( ) == Binding . FIELD ) { FieldBinding fieldBinding = ( FieldBinding ) nameReferenceBinding ; if ( ! fieldBinding . declaringClass . isEnum ( ) ) { if ( ! fieldBinding . type . isArrayType ( ) ) { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , this . value , true ) ; } else { scope . problemReporter ( ) . annotationValueMustBeArrayInitializer ( this . binding . declaringClass , this . name , this . value ) ; } } } } else { scope . problemReporter ( ) . annotationValueMustBeConstant ( this . binding . declaringClass , this . name , this . value , true ) ; } break checkAnnotationMethodType ; } if ( leafType . isAnnotationType ( ) ) { if ( ! valueType . leafComponentType ( ) . isAnnotationType ( ) ) { scope . problemReporter ( ) . annotationValueMustBeAnnotation ( this . binding . declaringClass , this . name , this . value , leafType ) ; } else if ( this . value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) this . value ; final Expression [ ] expressions = initializer . expressions ; if ( expressions != null ) { for ( int i = <NUM_LIT:0> , max = expressions . length ; i < max ; i ++ ) { Expression currentExpression = expressions [ i ] ; if ( currentExpression instanceof NullLiteral || ! ( currentExpression instanceof Annotation ) ) { scope . problemReporter ( ) . annotationValueMustBeAnnotation ( this . binding . declaringClass , this . name , currentExpression , leafType ) ; } } } } else if ( ! ( this . value instanceof Annotation ) ) { scope . problemReporter ( ) . annotationValueMustBeAnnotation ( this . binding . declaringClass , this . name , this . value , leafType ) ; } break checkAnnotationMethodType ; } } } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . value != null ) { this . value . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; public class AssertStatement extends Statement { public Expression assertExpression , exceptionArgument ; int preAssertInitStateIndex = - <NUM_LIT:1> ; private FieldBinding assertionSyntheticFieldBinding ; public AssertStatement ( Expression exceptionArgument , Expression assertExpression , int startPosition ) { this . assertExpression = assertExpression ; this . exceptionArgument = exceptionArgument ; this . sourceStart = startPosition ; this . sourceEnd = exceptionArgument . sourceEnd ; } public AssertStatement ( Expression assertExpression , int startPosition ) { this . assertExpression = assertExpression ; this . sourceStart = startPosition ; this . sourceEnd = assertExpression . sourceEnd ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . preAssertInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; Constant cst = this . assertExpression . optimizedBooleanConstant ( ) ; if ( ( this . assertExpression . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . assertExpression . checkNPE ( currentScope , flowContext , flowInfo ) ; } boolean isOptimizedTrueAssertion = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isOptimizedFalseAssertion = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; flowContext . tagBits |= FlowContext . HIDE_NULL_COMPARISON_WARNING ; FlowInfo conditionFlowInfo = this . assertExpression . analyseCode ( currentScope , flowContext , flowInfo . copy ( ) ) ; flowContext . tagBits &= ~ FlowContext . HIDE_NULL_COMPARISON_WARNING ; UnconditionalFlowInfo assertWhenTrueInfo = conditionFlowInfo . initsWhenTrue ( ) . unconditionalInits ( ) ; FlowInfo assertInfo = conditionFlowInfo . initsWhenFalse ( ) ; if ( isOptimizedTrueAssertion ) { assertInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } if ( this . exceptionArgument != null ) { FlowInfo exceptionInfo = this . exceptionArgument . analyseCode ( currentScope , flowContext , assertInfo . copy ( ) ) ; if ( isOptimizedTrueAssertion ) { currentScope . problemReporter ( ) . fakeReachable ( this . exceptionArgument ) ; } else { flowContext . checkExceptionHandlers ( currentScope . getJavaLangAssertionError ( ) , this , exceptionInfo , currentScope ) ; } } if ( ! isOptimizedTrueAssertion ) { manageSyntheticAccessIfNecessary ( currentScope , flowInfo ) ; } if ( isOptimizedFalseAssertion ) { return flowInfo ; } else { CompilerOptions compilerOptions = currentScope . compilerOptions ( ) ; if ( ! compilerOptions . includeNullInfoFromAsserts ) { return ( ( flowInfo . nullInfoLessUnconditionalCopy ( ) ) . mergedWith ( assertInfo . nullInfoLessUnconditionalCopy ( ) ) ) . addNullInfoFrom ( flowInfo ) ; } return flowInfo . mergedWith ( assertInfo . nullInfoLessUnconditionalCopy ( ) ) . addInitializationsFrom ( assertWhenTrueInfo . discardInitializationInfo ( ) ) ; } } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; if ( this . assertionSyntheticFieldBinding != null ) { BranchLabel assertionActivationLabel = new BranchLabel ( codeStream ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , this . assertionSyntheticFieldBinding , null ) ; codeStream . ifne ( assertionActivationLabel ) ; BranchLabel falseLabel ; this . assertExpression . generateOptimizedBoolean ( currentScope , codeStream , ( falseLabel = new BranchLabel ( codeStream ) ) , null , true ) ; codeStream . newJavaLangAssertionError ( ) ; codeStream . dup ( ) ; if ( this . exceptionArgument != null ) { this . exceptionArgument . generateCode ( currentScope , codeStream , true ) ; codeStream . invokeJavaLangAssertionErrorConstructor ( this . exceptionArgument . implicitConversion & <NUM_LIT> ) ; } else { codeStream . invokeJavaLangAssertionErrorDefaultConstructor ( ) ; } codeStream . athrow ( ) ; if ( this . preAssertInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preAssertInitStateIndex ) ; } falseLabel . place ( ) ; assertionActivationLabel . place ( ) ; } else { if ( this . preAssertInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preAssertInitStateIndex ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void resolve ( BlockScope scope ) { this . assertExpression . resolveTypeExpecting ( scope , TypeBinding . BOOLEAN ) ; if ( this . exceptionArgument != null ) { TypeBinding exceptionArgumentType = this . exceptionArgument . resolveType ( scope ) ; if ( exceptionArgumentType != null ) { int id = exceptionArgumentType . id ; switch ( id ) { case T_void : scope . problemReporter ( ) . illegalVoidExpression ( this . exceptionArgument ) ; default : id = T_JavaLangObject ; case T_boolean : case T_byte : case T_char : case T_short : case T_double : case T_float : case T_int : case T_long : case T_JavaLangString : this . exceptionArgument . implicitConversion = ( id << <NUM_LIT:4> ) + id ; } } } } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . assertExpression . traverse ( visitor , scope ) ; if ( this . exceptionArgument != null ) { this . exceptionArgument . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { SourceTypeBinding outerMostClass = currentScope . enclosingSourceType ( ) ; while ( outerMostClass . isLocalType ( ) ) { ReferenceBinding enclosing = outerMostClass . enclosingType ( ) ; if ( enclosing == null || enclosing . isInterface ( ) ) break ; outerMostClass = ( SourceTypeBinding ) enclosing ; } this . assertionSyntheticFieldBinding = outerMostClass . addSyntheticFieldForAssert ( currentScope ) ; TypeDeclaration typeDeclaration = outerMostClass . scope . referenceType ( ) ; AbstractMethodDeclaration [ ] methods = typeDeclaration . methods ; for ( int i = <NUM_LIT:0> , max = methods . length ; i < max ; i ++ ) { AbstractMethodDeclaration method = methods [ i ] ; if ( method . isClinit ( ) ) { ( ( Clinit ) method ) . setAssertionSupport ( this . assertionSyntheticFieldBinding , currentScope . compilerOptions ( ) . sourceLevel < ClassFileConstants . JDK1_5 ) ; break ; } } } } public StringBuffer printStatement ( int tab , StringBuffer output ) { printIndent ( tab , output ) ; output . append ( "<STR_LIT>" ) ; this . assertExpression . printExpression ( <NUM_LIT:0> , output ) ; if ( this . exceptionArgument != null ) { output . append ( "<STR_LIT::U+0020>" ) ; this . exceptionArgument . printExpression ( <NUM_LIT:0> , output ) ; } return output . append ( '<CHAR_LIT:;>' ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class ImportReference extends ASTNode { public char [ ] [ ] tokens ; public long [ ] sourcePositions ; public int declarationEnd ; public int declarationSourceStart ; public int declarationSourceEnd ; public int modifiers ; public Annotation [ ] annotations ; public int trailingStarPosition ; public ImportReference ( char [ ] [ ] tokens , long [ ] sourcePositions , boolean onDemand , int modifiers ) { this . tokens = tokens ; this . sourcePositions = sourcePositions ; if ( onDemand ) { this . bits |= ASTNode . OnDemand ; } this . sourceEnd = ( int ) ( sourcePositions [ sourcePositions . length - <NUM_LIT:1> ] & <NUM_LIT> ) ; this . sourceStart = ( int ) ( sourcePositions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; this . modifiers = modifiers ; } public boolean isStatic ( ) { return ( this . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ; } public char [ ] [ ] getImportName ( ) { return this . tokens ; } public StringBuffer print ( int indent , StringBuffer output ) { return print ( indent , output , true ) ; } public StringBuffer print ( int tab , StringBuffer output , boolean withOnDemand ) { for ( int i = <NUM_LIT:0> ; i < this . tokens . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( '<CHAR_LIT:.>' ) ; output . append ( this . tokens [ i ] ) ; } if ( withOnDemand && ( ( this . bits & ASTNode . OnDemand ) != <NUM_LIT:0> ) ) { output . append ( "<STR_LIT>" ) ; } return output ; } public void traverse ( ASTVisitor visitor , CompilationUnitScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } public char [ ] getSimpleName ( ) { return this . tokens [ this . tokens . length - <NUM_LIT:1> ] ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . PackageBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class JavadocQualifiedTypeReference extends QualifiedTypeReference { public int tagSourceStart , tagSourceEnd ; public PackageBinding packageBinding ; public JavadocQualifiedTypeReference ( char [ ] [ ] sources , long [ ] pos , int tagStart , int tagEnd ) { super ( sources , pos ) ; this . tagSourceStart = tagStart ; this . tagSourceEnd = tagEnd ; this . bits |= ASTNode . InsideJavadoc ; } private TypeBinding internalResolveType ( Scope scope , boolean checkBounds ) { this . constant = Constant . NotAConstant ; if ( this . resolvedType != null ) return this . resolvedType . isValidBinding ( ) ? this . resolvedType : this . resolvedType . closestMatch ( ) ; TypeBinding type = this . resolvedType = getTypeBinding ( scope ) ; if ( type == null ) return null ; if ( ! type . isValidBinding ( ) ) { Binding binding = scope . getTypeOrPackage ( this . tokens ) ; if ( binding instanceof PackageBinding ) { this . packageBinding = ( PackageBinding ) binding ; } else { reportInvalidType ( scope ) ; } return null ; } if ( type . isGenericType ( ) || type . isParameterizedType ( ) ) { this . resolvedType = scope . environment ( ) . convertToRawType ( type , true ) ; } return this . resolvedType ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope ) { scope . problemReporter ( ) . javadocDeprecatedType ( type , this , scope . getDeclarationModifiers ( ) ) ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope , int index ) { scope . problemReporter ( ) . javadocDeprecatedType ( type , this , scope . getDeclarationModifiers ( ) , index ) ; } protected void reportInvalidType ( Scope scope ) { scope . problemReporter ( ) . javadocInvalidType ( this , this . resolvedType , scope . getDeclarationModifiers ( ) ) ; } public TypeBinding resolveType ( BlockScope blockScope , boolean checkBounds ) { return internalResolveType ( blockScope , checkBounds ) ; } public TypeBinding resolveType ( ClassScope classScope ) { return internalResolveType ( classScope , false ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class NormalAnnotation extends Annotation { public MemberValuePair [ ] memberValuePairs ; public NormalAnnotation ( TypeReference type , int sourceStart ) { this . type = type ; this . sourceStart = sourceStart ; this . sourceEnd = type . sourceEnd ; } public ElementValuePair [ ] computeElementValuePairs ( ) { int numberOfPairs = this . memberValuePairs == null ? <NUM_LIT:0> : this . memberValuePairs . length ; if ( numberOfPairs == <NUM_LIT:0> ) return Binding . NO_ELEMENT_VALUE_PAIRS ; ElementValuePair [ ] pairs = new ElementValuePair [ numberOfPairs ] ; for ( int i = <NUM_LIT:0> ; i < numberOfPairs ; i ++ ) pairs [ i ] = this . memberValuePairs [ i ] . compilerElementPair ; return pairs ; } public MemberValuePair [ ] memberValuePairs ( ) { return this . memberValuePairs == null ? NoValuePairs : this . memberValuePairs ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { super . printExpression ( indent , output ) ; output . append ( '<CHAR_LIT:(>' ) ; if ( this . memberValuePairs != null ) { for ( int i = <NUM_LIT:0> , max = this . memberValuePairs . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) { output . append ( '<CHAR_LIT:U+002C>' ) ; } this . memberValuePairs [ i ] . print ( indent , output ) ; } } output . append ( '<CHAR_LIT:)>' ) ; return output ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . memberValuePairs != null ) { int memberValuePairsLength = this . memberValuePairs . length ; for ( int i = <NUM_LIT:0> ; i < memberValuePairsLength ; i ++ ) this . memberValuePairs [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class ConditionalExpression extends OperatorExpression { public Expression condition , valueIfTrue , valueIfFalse ; public Constant optimizedBooleanConstant ; public Constant optimizedIfTrueConstant ; public Constant optimizedIfFalseConstant ; int trueInitStateIndex = - <NUM_LIT:1> ; int falseInitStateIndex = - <NUM_LIT:1> ; int mergedInitStateIndex = - <NUM_LIT:1> ; private int nullStatus = FlowInfo . UNKNOWN ; public ConditionalExpression ( Expression condition , Expression valueIfTrue , Expression valueIfFalse ) { this . condition = condition ; this . valueIfTrue = valueIfTrue ; this . valueIfFalse = valueIfFalse ; this . sourceStart = condition . sourceStart ; this . sourceEnd = valueIfFalse . sourceEnd ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { int initialComplaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? Statement . COMPLAINED_FAKE_REACHABLE : Statement . NOT_COMPLAINED ; Constant cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; int mode = flowInfo . reachMode ( ) ; flowInfo = this . condition . analyseCode ( currentScope , flowContext , flowInfo , cst == Constant . NotAConstant ) ; FlowInfo trueFlowInfo = flowInfo . initsWhenTrue ( ) . copy ( ) ; if ( isConditionOptimizedFalse ) { if ( ( mode & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { trueFlowInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } if ( ! isKnowDeadCodePattern ( this . condition ) || currentScope . compilerOptions ( ) . reportDeadCodeInTrivialIfStatement ) { this . valueIfTrue . complainIfUnreachable ( trueFlowInfo , currentScope , initialComplaintLevel ) ; } } this . trueInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( trueFlowInfo ) ; trueFlowInfo = this . valueIfTrue . analyseCode ( currentScope , flowContext , trueFlowInfo ) ; FlowInfo falseFlowInfo = flowInfo . initsWhenFalse ( ) . copy ( ) ; if ( isConditionOptimizedTrue ) { if ( ( mode & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { falseFlowInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } if ( ! isKnowDeadCodePattern ( this . condition ) || currentScope . compilerOptions ( ) . reportDeadCodeInTrivialIfStatement ) { this . valueIfFalse . complainIfUnreachable ( falseFlowInfo , currentScope , initialComplaintLevel ) ; } } this . falseInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( falseFlowInfo ) ; falseFlowInfo = this . valueIfFalse . analyseCode ( currentScope , flowContext , falseFlowInfo ) ; FlowInfo mergedInfo ; if ( isConditionOptimizedTrue ) { mergedInfo = trueFlowInfo . addPotentialInitializationsFrom ( falseFlowInfo ) ; this . nullStatus = this . valueIfTrue . nullStatus ( trueFlowInfo ) ; } else if ( isConditionOptimizedFalse ) { mergedInfo = falseFlowInfo . addPotentialInitializationsFrom ( trueFlowInfo ) ; this . nullStatus = this . valueIfFalse . nullStatus ( falseFlowInfo ) ; } else { computeNullStatus ( trueFlowInfo , falseFlowInfo ) ; cst = this . optimizedIfTrueConstant ; boolean isValueIfTrueOptimizedTrue = cst != null && cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isValueIfTrueOptimizedFalse = cst != null && cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; cst = this . optimizedIfFalseConstant ; boolean isValueIfFalseOptimizedTrue = cst != null && cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isValueIfFalseOptimizedFalse = cst != null && cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; UnconditionalFlowInfo trueFlowTowardsTrue = trueFlowInfo . initsWhenTrue ( ) . unconditionalCopy ( ) ; UnconditionalFlowInfo falseFlowTowardsTrue = falseFlowInfo . initsWhenTrue ( ) . unconditionalCopy ( ) ; UnconditionalFlowInfo trueFlowTowardsFalse = trueFlowInfo . initsWhenFalse ( ) . unconditionalInits ( ) ; UnconditionalFlowInfo falseFlowTowardsFalse = falseFlowInfo . initsWhenFalse ( ) . unconditionalInits ( ) ; if ( isValueIfTrueOptimizedFalse ) { trueFlowTowardsTrue . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } if ( isValueIfFalseOptimizedFalse ) { falseFlowTowardsTrue . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } if ( isValueIfTrueOptimizedTrue ) { trueFlowTowardsFalse . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } if ( isValueIfFalseOptimizedTrue ) { falseFlowTowardsFalse . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } mergedInfo = FlowInfo . conditional ( trueFlowTowardsTrue . mergedWith ( falseFlowTowardsTrue ) , trueFlowTowardsFalse . mergedWith ( falseFlowTowardsFalse ) ) ; } this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; mergedInfo . setReachMode ( mode ) ; return mergedInfo ; } private void computeNullStatus ( FlowInfo trueBranchInfo , FlowInfo falseBranchInfo ) { int ifTrueNullStatus = this . valueIfTrue . nullStatus ( trueBranchInfo ) ; int ifFalseNullStatus = this . valueIfFalse . nullStatus ( falseBranchInfo ) ; if ( ifTrueNullStatus == ifFalseNullStatus ) { this . nullStatus = ifTrueNullStatus ; return ; } int status = <NUM_LIT:0> ; int combinedStatus = ifTrueNullStatus | ifFalseNullStatus ; if ( ( combinedStatus & ( FlowInfo . NULL | FlowInfo . POTENTIALLY_NULL ) ) != <NUM_LIT:0> ) status |= FlowInfo . POTENTIALLY_NULL ; if ( ( combinedStatus & ( FlowInfo . NON_NULL | FlowInfo . POTENTIALLY_NON_NULL ) ) != <NUM_LIT:0> ) status |= FlowInfo . POTENTIALLY_NON_NULL ; if ( ( combinedStatus & ( FlowInfo . UNKNOWN | FlowInfo . POTENTIALLY_UNKNOWN ) ) != <NUM_LIT:0> ) status |= FlowInfo . POTENTIALLY_UNKNOWN ; if ( status > <NUM_LIT:0> ) this . nullStatus = status ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; BranchLabel endifLabel , falseLabel ; if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) codeStream . generateConstant ( this . constant , this . implicitConversion ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } Constant cst = this . condition . optimizedBooleanConstant ( ) ; boolean needTruePart = ! ( cst != Constant . NotAConstant && cst . booleanValue ( ) == false ) ; boolean needFalsePart = ! ( cst != Constant . NotAConstant && cst . booleanValue ( ) == true ) ; endifLabel = new BranchLabel ( codeStream ) ; falseLabel = new BranchLabel ( codeStream ) ; falseLabel . tagBits |= BranchLabel . USED ; this . condition . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , cst == Constant . NotAConstant ) ; if ( this . trueInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . trueInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . trueInitStateIndex ) ; } if ( needTruePart ) { this . valueIfTrue . generateCode ( currentScope , codeStream , valueRequired ) ; if ( needFalsePart ) { int position = codeStream . position ; codeStream . goto_ ( endifLabel ) ; codeStream . updateLastRecordedEndPC ( currentScope , position ) ; if ( valueRequired ) { switch ( this . resolvedType . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . decrStackSize ( <NUM_LIT:2> ) ; break ; default : codeStream . decrStackSize ( <NUM_LIT:1> ) ; break ; } } } } if ( needFalsePart ) { if ( this . falseInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . falseInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . falseInitStateIndex ) ; } if ( falseLabel . forwardReferenceCount ( ) > <NUM_LIT:0> ) { falseLabel . place ( ) ; } this . valueIfFalse . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { codeStream . recordExpressionType ( this . resolvedType ) ; } if ( needTruePart ) { endifLabel . place ( ) ; } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } if ( valueRequired ) codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { if ( ( this . constant != Constant . NotAConstant ) && ( this . constant . typeID ( ) == T_boolean ) || ( ( this . valueIfTrue . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) != T_boolean ) { super . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; return ; } Constant cst = this . condition . constant ; Constant condCst = this . condition . optimizedBooleanConstant ( ) ; boolean needTruePart = ! ( ( ( cst != Constant . NotAConstant ) && ( cst . booleanValue ( ) == false ) ) || ( ( condCst != Constant . NotAConstant ) && ( condCst . booleanValue ( ) == false ) ) ) ; boolean needFalsePart = ! ( ( ( cst != Constant . NotAConstant ) && ( cst . booleanValue ( ) == true ) ) || ( ( condCst != Constant . NotAConstant ) && ( condCst . booleanValue ( ) == true ) ) ) ; BranchLabel internalFalseLabel , endifLabel = new BranchLabel ( codeStream ) ; boolean needConditionValue = ( cst == Constant . NotAConstant ) && ( condCst == Constant . NotAConstant ) ; this . condition . generateOptimizedBoolean ( currentScope , codeStream , null , internalFalseLabel = new BranchLabel ( codeStream ) , needConditionValue ) ; if ( this . trueInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . trueInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . trueInitStateIndex ) ; } if ( needTruePart ) { this . valueIfTrue . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; if ( needFalsePart ) { JumpEndif : { if ( falseLabel == null ) { if ( trueLabel != null ) { cst = this . optimizedIfTrueConstant ; boolean isValueIfTrueOptimizedTrue = cst != null && cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; if ( isValueIfTrueOptimizedTrue ) break JumpEndif ; } } else { if ( trueLabel == null ) { cst = this . optimizedIfTrueConstant ; boolean isValueIfTrueOptimizedFalse = cst != null && cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; if ( isValueIfTrueOptimizedFalse ) break JumpEndif ; } else { } } int position = codeStream . position ; codeStream . goto_ ( endifLabel ) ; codeStream . updateLastRecordedEndPC ( currentScope , position ) ; } } } if ( needFalsePart ) { internalFalseLabel . place ( ) ; if ( this . falseInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . falseInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . falseInitStateIndex ) ; } this . valueIfFalse . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; endifLabel . place ( ) ; } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } public int nullStatus ( FlowInfo flowInfo ) { return this . nullStatus ; } public Constant optimizedBooleanConstant ( ) { return this . optimizedBooleanConstant == null ? this . constant : this . optimizedBooleanConstant ; } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { this . condition . printExpression ( indent , output ) . append ( "<STR_LIT>" ) ; this . valueIfTrue . printExpression ( <NUM_LIT:0> , output ) . append ( "<STR_LIT:U+0020:U+0020>" ) ; return this . valueIfFalse . printExpression ( <NUM_LIT:0> , output ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; LookupEnvironment env = scope . environment ( ) ; boolean use15specifics = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ; TypeBinding conditionType = this . condition . resolveTypeExpecting ( scope , TypeBinding . BOOLEAN ) ; this . condition . computeConversion ( scope , TypeBinding . BOOLEAN , conditionType ) ; if ( this . valueIfTrue instanceof CastExpression ) this . valueIfTrue . bits |= DisableUnnecessaryCastCheck ; TypeBinding originalValueIfTrueType = this . valueIfTrue . resolveType ( scope ) ; if ( this . valueIfFalse instanceof CastExpression ) this . valueIfFalse . bits |= DisableUnnecessaryCastCheck ; TypeBinding originalValueIfFalseType = this . valueIfFalse . resolveType ( scope ) ; if ( conditionType == null || originalValueIfTrueType == null || originalValueIfFalseType == null ) return null ; TypeBinding valueIfTrueType = originalValueIfTrueType ; TypeBinding valueIfFalseType = originalValueIfFalseType ; if ( use15specifics && valueIfTrueType != valueIfFalseType ) { if ( valueIfTrueType . isBaseType ( ) ) { if ( valueIfFalseType . isBaseType ( ) ) { if ( valueIfTrueType == TypeBinding . NULL ) { valueIfFalseType = env . computeBoxingType ( valueIfFalseType ) ; } else if ( valueIfFalseType == TypeBinding . NULL ) { valueIfTrueType = env . computeBoxingType ( valueIfTrueType ) ; } } else { TypeBinding unboxedIfFalseType = valueIfFalseType . isBaseType ( ) ? valueIfFalseType : env . computeBoxingType ( valueIfFalseType ) ; if ( valueIfTrueType . isNumericType ( ) && unboxedIfFalseType . isNumericType ( ) ) { valueIfFalseType = unboxedIfFalseType ; } else if ( valueIfTrueType != TypeBinding . NULL ) { valueIfFalseType = env . computeBoxingType ( valueIfFalseType ) ; } } } else if ( valueIfFalseType . isBaseType ( ) ) { TypeBinding unboxedIfTrueType = valueIfTrueType . isBaseType ( ) ? valueIfTrueType : env . computeBoxingType ( valueIfTrueType ) ; if ( unboxedIfTrueType . isNumericType ( ) && valueIfFalseType . isNumericType ( ) ) { valueIfTrueType = unboxedIfTrueType ; } else if ( valueIfFalseType != TypeBinding . NULL ) { valueIfTrueType = env . computeBoxingType ( valueIfTrueType ) ; } } else { TypeBinding unboxedIfTrueType = env . computeBoxingType ( valueIfTrueType ) ; TypeBinding unboxedIfFalseType = env . computeBoxingType ( valueIfFalseType ) ; if ( unboxedIfTrueType . isNumericType ( ) && unboxedIfFalseType . isNumericType ( ) ) { valueIfTrueType = unboxedIfTrueType ; valueIfFalseType = unboxedIfFalseType ; } } } Constant condConstant , trueConstant , falseConstant ; if ( ( condConstant = this . condition . constant ) != Constant . NotAConstant && ( trueConstant = this . valueIfTrue . constant ) != Constant . NotAConstant && ( falseConstant = this . valueIfFalse . constant ) != Constant . NotAConstant ) { this . constant = condConstant . booleanValue ( ) ? trueConstant : falseConstant ; } if ( valueIfTrueType == valueIfFalseType ) { this . valueIfTrue . computeConversion ( scope , valueIfTrueType , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , valueIfFalseType , originalValueIfFalseType ) ; if ( valueIfTrueType == TypeBinding . BOOLEAN ) { this . optimizedIfTrueConstant = this . valueIfTrue . optimizedBooleanConstant ( ) ; this . optimizedIfFalseConstant = this . valueIfFalse . optimizedBooleanConstant ( ) ; if ( this . optimizedIfTrueConstant != Constant . NotAConstant && this . optimizedIfFalseConstant != Constant . NotAConstant && this . optimizedIfTrueConstant . booleanValue ( ) == this . optimizedIfFalseConstant . booleanValue ( ) ) { this . optimizedBooleanConstant = this . optimizedIfTrueConstant ; } else if ( ( condConstant = this . condition . optimizedBooleanConstant ( ) ) != Constant . NotAConstant ) { this . optimizedBooleanConstant = condConstant . booleanValue ( ) ? this . optimizedIfTrueConstant : this . optimizedIfFalseConstant ; } } return this . resolvedType = valueIfTrueType ; } if ( valueIfTrueType . isNumericType ( ) && valueIfFalseType . isNumericType ( ) ) { if ( ( valueIfTrueType == TypeBinding . BYTE && valueIfFalseType == TypeBinding . SHORT ) || ( valueIfTrueType == TypeBinding . SHORT && valueIfFalseType == TypeBinding . BYTE ) ) { this . valueIfTrue . computeConversion ( scope , TypeBinding . SHORT , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , TypeBinding . SHORT , originalValueIfFalseType ) ; return this . resolvedType = TypeBinding . SHORT ; } if ( ( valueIfTrueType == TypeBinding . BYTE || valueIfTrueType == TypeBinding . SHORT || valueIfTrueType == TypeBinding . CHAR ) && ( valueIfFalseType == TypeBinding . INT && this . valueIfFalse . isConstantValueOfTypeAssignableToType ( valueIfFalseType , valueIfTrueType ) ) ) { this . valueIfTrue . computeConversion ( scope , valueIfTrueType , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , valueIfTrueType , originalValueIfFalseType ) ; return this . resolvedType = valueIfTrueType ; } if ( ( valueIfFalseType == TypeBinding . BYTE || valueIfFalseType == TypeBinding . SHORT || valueIfFalseType == TypeBinding . CHAR ) && ( valueIfTrueType == TypeBinding . INT && this . valueIfTrue . isConstantValueOfTypeAssignableToType ( valueIfTrueType , valueIfFalseType ) ) ) { this . valueIfTrue . computeConversion ( scope , valueIfFalseType , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , valueIfFalseType , originalValueIfFalseType ) ; return this . resolvedType = valueIfFalseType ; } if ( BaseTypeBinding . isNarrowing ( valueIfTrueType . id , T_int ) && BaseTypeBinding . isNarrowing ( valueIfFalseType . id , T_int ) ) { this . valueIfTrue . computeConversion ( scope , TypeBinding . INT , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , TypeBinding . INT , originalValueIfFalseType ) ; return this . resolvedType = TypeBinding . INT ; } if ( BaseTypeBinding . isNarrowing ( valueIfTrueType . id , T_long ) && BaseTypeBinding . isNarrowing ( valueIfFalseType . id , T_long ) ) { this . valueIfTrue . computeConversion ( scope , TypeBinding . LONG , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , TypeBinding . LONG , originalValueIfFalseType ) ; return this . resolvedType = TypeBinding . LONG ; } if ( BaseTypeBinding . isNarrowing ( valueIfTrueType . id , T_float ) && BaseTypeBinding . isNarrowing ( valueIfFalseType . id , T_float ) ) { this . valueIfTrue . computeConversion ( scope , TypeBinding . FLOAT , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , TypeBinding . FLOAT , originalValueIfFalseType ) ; return this . resolvedType = TypeBinding . FLOAT ; } this . valueIfTrue . computeConversion ( scope , TypeBinding . DOUBLE , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , TypeBinding . DOUBLE , originalValueIfFalseType ) ; return this . resolvedType = TypeBinding . DOUBLE ; } if ( valueIfTrueType . isBaseType ( ) && valueIfTrueType != TypeBinding . NULL ) { if ( use15specifics ) { valueIfTrueType = env . computeBoxingType ( valueIfTrueType ) ; } else { scope . problemReporter ( ) . conditionalArgumentsIncompatibleTypes ( this , valueIfTrueType , valueIfFalseType ) ; return null ; } } if ( valueIfFalseType . isBaseType ( ) && valueIfFalseType != TypeBinding . NULL ) { if ( use15specifics ) { valueIfFalseType = env . computeBoxingType ( valueIfFalseType ) ; } else { scope . problemReporter ( ) . conditionalArgumentsIncompatibleTypes ( this , valueIfTrueType , valueIfFalseType ) ; return null ; } } if ( use15specifics ) { TypeBinding commonType = null ; if ( valueIfTrueType == TypeBinding . NULL ) { commonType = valueIfFalseType ; } else if ( valueIfFalseType == TypeBinding . NULL ) { commonType = valueIfTrueType ; } else { commonType = scope . lowerUpperBound ( new TypeBinding [ ] { valueIfTrueType , valueIfFalseType } ) ; } if ( commonType != null ) { this . valueIfTrue . computeConversion ( scope , commonType , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , commonType , originalValueIfFalseType ) ; return this . resolvedType = commonType . capture ( scope , this . sourceEnd ) ; } } else { if ( valueIfFalseType . isCompatibleWith ( valueIfTrueType ) ) { this . valueIfTrue . computeConversion ( scope , valueIfTrueType , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , valueIfTrueType , originalValueIfFalseType ) ; return this . resolvedType = valueIfTrueType ; } else if ( valueIfTrueType . isCompatibleWith ( valueIfFalseType ) ) { this . valueIfTrue . computeConversion ( scope , valueIfFalseType , originalValueIfTrueType ) ; this . valueIfFalse . computeConversion ( scope , valueIfFalseType , originalValueIfFalseType ) ; return this . resolvedType = valueIfFalseType ; } } scope . problemReporter ( ) . conditionalArgumentsIncompatibleTypes ( this , valueIfTrueType , valueIfFalseType ) ; return null ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . condition . traverse ( visitor , scope ) ; this . valueIfTrue . traverse ( visitor , scope ) ; this . valueIfFalse . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class Block extends Statement { public Statement [ ] statements ; public int explicitDeclarations ; public BlockScope scope ; public Block ( int explicitDeclarations ) { this . explicitDeclarations = explicitDeclarations ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . statements == null ) return flowInfo ; int complaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? Statement . COMPLAINED_FAKE_REACHABLE : Statement . NOT_COMPLAINED ; for ( int i = <NUM_LIT:0> , max = this . statements . length ; i < max ; i ++ ) { Statement stat = this . statements [ i ] ; if ( ( complaintLevel = stat . complainIfUnreachable ( flowInfo , this . scope , complaintLevel ) ) < Statement . COMPLAINED_UNREACHABLE ) { flowInfo = stat . analyseCode ( this . scope , flowContext , flowInfo ) ; } } return flowInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , max = this . statements . length ; i < max ; i ++ ) { this . statements [ i ] . generateCode ( this . scope , codeStream ) ; } } if ( this . scope != currentScope ) { codeStream . exitUserScope ( this . scope ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public boolean isEmptyBlock ( ) { return this . statements == null ; } public StringBuffer printBody ( int indent , StringBuffer output ) { if ( this . statements == null ) return output ; for ( int i = <NUM_LIT:0> ; i < this . statements . length ; i ++ ) { this . statements [ i ] . printStatement ( indent + <NUM_LIT:1> , output ) ; output . append ( '<STR_LIT:\n>' ) ; } return output ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) ; output . append ( "<STR_LIT>" ) ; printBody ( indent , output ) ; return printIndent ( indent , output ) . append ( '<CHAR_LIT:}>' ) ; } public void resolve ( BlockScope upperScope ) { if ( ( this . bits & UndocumentedEmptyBlock ) != <NUM_LIT:0> ) { upperScope . problemReporter ( ) . undocumentedEmptyBlock ( this . sourceStart , this . sourceEnd ) ; } if ( this . statements != null ) { this . scope = this . explicitDeclarations == <NUM_LIT:0> ? upperScope : new BlockScope ( upperScope , this . explicitDeclarations ) ; for ( int i = <NUM_LIT:0> , length = this . statements . length ; i < length ; i ++ ) { this . statements [ i ] . resolve ( this . scope ) ; } } } public void resolveUsing ( BlockScope givenScope ) { if ( ( this . bits & UndocumentedEmptyBlock ) != <NUM_LIT:0> ) { givenScope . problemReporter ( ) . undocumentedEmptyBlock ( this . sourceStart , this . sourceEnd ) ; } this . scope = givenScope ; if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , length = this . statements . length ; i < length ; i ++ ) { this . statements [ i ] . resolve ( this . scope ) ; } } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , length = this . statements . length ; i < length ; i ++ ) this . statements [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , blockScope ) ; } public void branchChainTo ( BranchLabel label ) { if ( this . statements != null ) { this . statements [ this . statements . length - <NUM_LIT:1> ] . branchChainTo ( label ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; 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 . * ; public class ThisReference extends Reference { public static ThisReference implicitThis ( ) { ThisReference implicitThis = new ThisReference ( <NUM_LIT:0> , <NUM_LIT:0> ) ; implicitThis . bits |= IsImplicitThis ; return implicitThis ; } public ThisReference ( int sourceStart , int sourceEnd ) { this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; } public FlowInfo analyseAssignment ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , Assignment assignment , boolean isCompound ) { return flowInfo ; } public boolean checkAccess ( MethodScope methodScope ) { if ( methodScope . isConstructorCall ) { methodScope . problemReporter ( ) . fieldsOrThisBeforeConstructorInvocation ( this ) ; return false ; } if ( methodScope . isStatic ) { methodScope . problemReporter ( ) . errorThisSuperInStatic ( this ) ; return false ; } return true ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) codeStream . aload_0 ( ) ; if ( ( this . bits & IsImplicitThis ) == <NUM_LIT:0> ) codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { } public boolean isImplicitThis ( ) { return ( this . bits & IsImplicitThis ) != <NUM_LIT:0> ; } public boolean isThis ( ) { return true ; } public int nullStatus ( FlowInfo flowInfo ) { return FlowInfo . NON_NULL ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { if ( isImplicitThis ( ) ) return output ; return output . append ( "<STR_LIT>" ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; if ( ! isImplicitThis ( ) && ! checkAccess ( scope . methodScope ( ) ) ) { return null ; } return this . resolvedType = scope . enclosingReceiverType ( ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { visitor . visit ( this , blockScope ) ; visitor . endVisit ( this , blockScope ) ; } public void traverse ( ASTVisitor visitor , ClassScope blockScope ) { visitor . visit ( this , blockScope ) ; visitor . endVisit ( this , blockScope ) ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( ! isImplicitThis ( ) ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } return super . analyseCode ( currentScope , flowContext , flowInfo ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . ExceptionLabel ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; public abstract class SubRoutineStatement extends Statement { public static void reenterAllExceptionHandlers ( SubRoutineStatement [ ] subroutines , int max , CodeStream codeStream ) { if ( subroutines == null ) return ; if ( max < <NUM_LIT:0> ) max = subroutines . length ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { SubRoutineStatement sub = subroutines [ i ] ; sub . enterAnyExceptionHandler ( codeStream ) ; sub . enterDeclaredExceptionHandlers ( codeStream ) ; } } ExceptionLabel anyExceptionLabel ; public ExceptionLabel enterAnyExceptionHandler ( CodeStream codeStream ) { if ( this . anyExceptionLabel == null ) { this . anyExceptionLabel = new ExceptionLabel ( codeStream , null ) ; } this . anyExceptionLabel . placeStart ( ) ; return this . anyExceptionLabel ; } public void enterDeclaredExceptionHandlers ( CodeStream codeStream ) { } public void exitAnyExceptionHandler ( ) { if ( this . anyExceptionLabel != null ) { this . anyExceptionLabel . placeEnd ( ) ; } } public void exitDeclaredExceptionHandlers ( CodeStream codeStream ) { } public abstract boolean generateSubRoutineInvocation ( BlockScope currentScope , CodeStream codeStream , Object targetLocation , int stateIndex , LocalVariableBinding secretLocal ) ; public abstract boolean isSubRoutineEscaping ( ) ; public void placeAllAnyExceptionHandler ( ) { this . anyExceptionLabel . place ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class EqualExpression extends BinaryExpression { public EqualExpression ( Expression left , Expression right , int operator ) { super ( left , right , operator ) ; } private void checkNullComparison ( BlockScope scope , FlowContext flowContext , FlowInfo flowInfo , FlowInfo initsWhenTrue , FlowInfo initsWhenFalse ) { LocalVariableBinding local = this . left . localVariableBinding ( ) ; if ( local != null && ( local . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { checkVariableComparison ( scope , flowContext , flowInfo , initsWhenTrue , initsWhenFalse , local , this . right . nullStatus ( flowInfo ) , this . left ) ; } local = this . right . localVariableBinding ( ) ; if ( local != null && ( local . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { checkVariableComparison ( scope , flowContext , flowInfo , initsWhenTrue , initsWhenFalse , local , this . left . nullStatus ( flowInfo ) , this . right ) ; } } private void checkVariableComparison ( BlockScope scope , FlowContext flowContext , FlowInfo flowInfo , FlowInfo initsWhenTrue , FlowInfo initsWhenFalse , LocalVariableBinding local , int nullStatus , Expression reference ) { switch ( nullStatus ) { case FlowInfo . NULL : if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == EQUAL_EQUAL ) { flowContext . recordUsingNullReference ( scope , local , reference , FlowContext . CAN_ONLY_NULL_NON_NULL | FlowContext . IN_COMPARISON_NULL , flowInfo ) ; initsWhenTrue . markAsComparedEqualToNull ( local ) ; initsWhenFalse . markAsComparedEqualToNonNull ( local ) ; } else { flowContext . recordUsingNullReference ( scope , local , reference , FlowContext . CAN_ONLY_NULL_NON_NULL | FlowContext . IN_COMPARISON_NON_NULL , flowInfo ) ; initsWhenTrue . markAsComparedEqualToNonNull ( local ) ; initsWhenFalse . markAsComparedEqualToNull ( local ) ; } if ( ( flowContext . tagBits & FlowContext . HIDE_NULL_COMPARISON_WARNING ) != <NUM_LIT:0> ) { flowInfo . markedAsNullOrNonNullInAssertExpression ( local ) ; } break ; case FlowInfo . NON_NULL : if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == EQUAL_EQUAL ) { flowContext . recordUsingNullReference ( scope , local , reference , FlowContext . CAN_ONLY_NULL | FlowContext . IN_COMPARISON_NON_NULL , flowInfo ) ; initsWhenTrue . markAsComparedEqualToNonNull ( local ) ; if ( ( flowContext . tagBits & FlowContext . HIDE_NULL_COMPARISON_WARNING ) != <NUM_LIT:0> ) { initsWhenTrue . markedAsNullOrNonNullInAssertExpression ( local ) ; } } else { flowContext . recordUsingNullReference ( scope , local , reference , FlowContext . CAN_ONLY_NULL | FlowContext . IN_COMPARISON_NULL , flowInfo ) ; } break ; } } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { FlowInfo result ; if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == EQUAL_EQUAL ) { if ( ( this . left . constant != Constant . NotAConstant ) && ( this . left . constant . typeID ( ) == T_boolean ) ) { if ( this . left . constant . booleanValue ( ) ) { result = this . right . analyseCode ( currentScope , flowContext , flowInfo ) ; } else { result = this . right . analyseCode ( currentScope , flowContext , flowInfo ) . asNegatedCondition ( ) ; } } else if ( ( this . right . constant != Constant . NotAConstant ) && ( this . right . constant . typeID ( ) == T_boolean ) ) { if ( this . right . constant . booleanValue ( ) ) { result = this . left . analyseCode ( currentScope , flowContext , flowInfo ) ; } else { result = this . left . analyseCode ( currentScope , flowContext , flowInfo ) . asNegatedCondition ( ) ; } } else { result = this . right . analyseCode ( currentScope , flowContext , this . left . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ) . unconditionalInits ( ) ; } } else { if ( ( this . left . constant != Constant . NotAConstant ) && ( this . left . constant . typeID ( ) == T_boolean ) ) { if ( ! this . left . constant . booleanValue ( ) ) { result = this . right . analyseCode ( currentScope , flowContext , flowInfo ) ; } else { result = this . right . analyseCode ( currentScope , flowContext , flowInfo ) . asNegatedCondition ( ) ; } } else if ( ( this . right . constant != Constant . NotAConstant ) && ( this . right . constant . typeID ( ) == T_boolean ) ) { if ( ! this . right . constant . booleanValue ( ) ) { result = this . left . analyseCode ( currentScope , flowContext , flowInfo ) ; } else { result = this . left . analyseCode ( currentScope , flowContext , flowInfo ) . asNegatedCondition ( ) ; } } else { result = this . right . analyseCode ( currentScope , flowContext , this . left . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ) . unconditionalInits ( ) ; } } if ( result instanceof UnconditionalFlowInfo && ( result . tagBits & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { result = FlowInfo . conditional ( result . copy ( ) , result . copy ( ) ) ; } checkNullComparison ( currentScope , flowContext , result , result . initsWhenTrue ( ) , result . initsWhenFalse ( ) ) ; return result ; } public final void computeConstant ( TypeBinding leftType , TypeBinding rightType ) { if ( ( this . left . constant != Constant . NotAConstant ) && ( this . right . constant != Constant . NotAConstant ) ) { this . constant = Constant . computeConstantOperationEQUAL_EQUAL ( this . left . constant , leftType . id , this . right . constant , rightType . id ) ; if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == NOT_EQUAL ) this . constant = BooleanConstant . fromValue ( ! this . constant . booleanValue ( ) ) ; } else { this . constant = Constant . NotAConstant ; } } 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 ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } if ( ( this . left . implicitConversion & COMPILE_TYPE_MASK ) == T_boolean ) { generateBooleanEqual ( currentScope , codeStream , valueRequired ) ; } else { generateNonBooleanEqual ( currentScope , codeStream , valueRequired ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { if ( this . constant != Constant . NotAConstant ) { super . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; return ; } if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == EQUAL_EQUAL ) { if ( ( this . left . implicitConversion & COMPILE_TYPE_MASK ) == T_boolean ) { generateOptimizedBooleanEqual ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; } else { generateOptimizedNonBooleanEqual ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; } } else { if ( ( this . left . implicitConversion & COMPILE_TYPE_MASK ) == T_boolean ) { generateOptimizedBooleanEqual ( currentScope , codeStream , falseLabel , trueLabel , valueRequired ) ; } else { generateOptimizedNonBooleanEqual ( currentScope , codeStream , falseLabel , trueLabel , valueRequired ) ; } } } public void generateBooleanEqual ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { boolean isEqualOperator = ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == EQUAL_EQUAL ; Constant cst = this . left . optimizedBooleanConstant ( ) ; if ( cst != Constant . NotAConstant ) { Constant rightCst = this . right . optimizedBooleanConstant ( ) ; if ( rightCst != Constant . NotAConstant ) { this . left . generateCode ( currentScope , codeStream , false ) ; this . right . generateCode ( currentScope , codeStream , false ) ; if ( valueRequired ) { boolean leftBool = cst . booleanValue ( ) ; boolean rightBool = rightCst . booleanValue ( ) ; if ( isEqualOperator ) { if ( leftBool == rightBool ) { codeStream . iconst_1 ( ) ; } else { codeStream . iconst_0 ( ) ; } } else { if ( leftBool != rightBool ) { codeStream . iconst_1 ( ) ; } else { codeStream . iconst_0 ( ) ; } } } } else if ( cst . booleanValue ( ) == isEqualOperator ) { this . left . generateCode ( currentScope , codeStream , false ) ; this . right . generateCode ( currentScope , codeStream , valueRequired ) ; } else { if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; this . left . generateCode ( currentScope , codeStream , false ) ; this . right . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , valueRequired ) ; codeStream . iconst_0 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_1 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_1 ( ) ; endLabel . place ( ) ; } } else { this . left . generateCode ( currentScope , codeStream , false ) ; this . right . generateCode ( currentScope , codeStream , false ) ; } } return ; } cst = this . right . optimizedBooleanConstant ( ) ; if ( cst != Constant . NotAConstant ) { if ( cst . booleanValue ( ) == isEqualOperator ) { this . left . generateCode ( currentScope , codeStream , valueRequired ) ; this . right . generateCode ( currentScope , codeStream , false ) ; } else { if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; this . left . generateOptimizedBoolean ( currentScope , codeStream , null , falseLabel , valueRequired ) ; this . right . generateCode ( currentScope , codeStream , false ) ; codeStream . iconst_0 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_1 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_1 ( ) ; endLabel . place ( ) ; } } else { this . left . generateCode ( currentScope , codeStream , false ) ; this . right . generateCode ( currentScope , codeStream , false ) ; } } return ; } this . left . generateCode ( currentScope , codeStream , valueRequired ) ; this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( isEqualOperator ) { BranchLabel falseLabel ; codeStream . if_icmpne ( falseLabel = new BranchLabel ( codeStream ) ) ; codeStream . iconst_1 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } else { codeStream . ixor ( ) ; } } } public void generateOptimizedBooleanEqual ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { if ( this . left . constant != Constant . NotAConstant ) { boolean inline = this . left . constant . booleanValue ( ) ; this . right . generateOptimizedBoolean ( currentScope , codeStream , ( inline ? trueLabel : falseLabel ) , ( inline ? falseLabel : trueLabel ) , valueRequired ) ; return ; } if ( this . right . constant != Constant . NotAConstant ) { boolean inline = this . right . constant . booleanValue ( ) ; this . left . generateOptimizedBoolean ( currentScope , codeStream , ( inline ? trueLabel : falseLabel ) , ( inline ? falseLabel : trueLabel ) , valueRequired ) ; return ; } this . left . generateCode ( currentScope , codeStream , valueRequired ) ; this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . if_icmpeq ( trueLabel ) ; } } else { if ( trueLabel == null ) { codeStream . if_icmpne ( falseLabel ) ; } else { } } } codeStream . updateLastRecordedEndPC ( currentScope , codeStream . position ) ; } public void generateNonBooleanEqual ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { boolean isEqualOperator = ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == EQUAL_EQUAL ; if ( ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_int ) { Constant cst ; if ( ( cst = this . left . constant ) != Constant . NotAConstant && cst . intValue ( ) == <NUM_LIT:0> ) { this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; if ( isEqualOperator ) { codeStream . ifne ( falseLabel ) ; } else { codeStream . ifeq ( falseLabel ) ; } codeStream . iconst_1 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } return ; } if ( ( cst = this . right . constant ) != Constant . NotAConstant && cst . intValue ( ) == <NUM_LIT:0> ) { this . left . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; if ( isEqualOperator ) { codeStream . ifne ( falseLabel ) ; } else { codeStream . ifeq ( falseLabel ) ; } codeStream . iconst_1 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } return ; } } if ( this . right instanceof NullLiteral ) { if ( this . left instanceof NullLiteral ) { if ( valueRequired ) { if ( isEqualOperator ) { codeStream . iconst_1 ( ) ; } else { codeStream . iconst_0 ( ) ; } } } else { this . left . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; if ( isEqualOperator ) { codeStream . ifnonnull ( falseLabel ) ; } else { codeStream . ifnull ( falseLabel ) ; } codeStream . iconst_1 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } } return ; } else if ( this . left instanceof NullLiteral ) { this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; if ( isEqualOperator ) { codeStream . ifnonnull ( falseLabel ) ; } else { codeStream . ifnull ( falseLabel ) ; } codeStream . iconst_1 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } return ; } this . left . generateCode ( currentScope , codeStream , valueRequired ) ; this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { BranchLabel falseLabel = new BranchLabel ( codeStream ) ; if ( isEqualOperator ) { switch ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : codeStream . if_icmpne ( falseLabel ) ; break ; case T_float : codeStream . fcmpl ( ) ; codeStream . ifne ( falseLabel ) ; break ; case T_long : codeStream . lcmp ( ) ; codeStream . ifne ( falseLabel ) ; break ; case T_double : codeStream . dcmpl ( ) ; codeStream . ifne ( falseLabel ) ; break ; default : codeStream . if_acmpne ( falseLabel ) ; } } else { switch ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : codeStream . if_icmpeq ( falseLabel ) ; break ; case T_float : codeStream . fcmpl ( ) ; codeStream . ifeq ( falseLabel ) ; break ; case T_long : codeStream . lcmp ( ) ; codeStream . ifeq ( falseLabel ) ; break ; case T_double : codeStream . dcmpl ( ) ; codeStream . ifeq ( falseLabel ) ; break ; default : codeStream . if_acmpeq ( falseLabel ) ; } } codeStream . iconst_1 ( ) ; if ( ( this . bits & IsReturnedValue ) != <NUM_LIT:0> ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateReturnBytecode ( this ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; } else { BranchLabel endLabel = new BranchLabel ( codeStream ) ; codeStream . goto_ ( endLabel ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; endLabel . place ( ) ; } } } public void generateOptimizedNonBooleanEqual ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { int pc = codeStream . position ; Constant inline ; if ( ( inline = this . right . constant ) != Constant . NotAConstant ) { if ( ( ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_int ) && ( inline . intValue ( ) == <NUM_LIT:0> ) ) { this . left . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . ifeq ( trueLabel ) ; } } else { if ( trueLabel == null ) { codeStream . ifne ( falseLabel ) ; } else { } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } } if ( ( inline = this . left . constant ) != Constant . NotAConstant ) { if ( ( ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_int ) && ( inline . intValue ( ) == <NUM_LIT:0> ) ) { this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . ifeq ( trueLabel ) ; } } else { if ( trueLabel == null ) { codeStream . ifne ( falseLabel ) ; } else { } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } } if ( this . right instanceof NullLiteral ) { if ( this . left instanceof NullLiteral ) { if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . goto_ ( trueLabel ) ; } } } } else { this . left . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . ifnull ( trueLabel ) ; } } else { if ( trueLabel == null ) { codeStream . ifnonnull ( falseLabel ) ; } else { } } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } else if ( this . left instanceof NullLiteral ) { this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . ifnull ( trueLabel ) ; } } else { if ( trueLabel == null ) { codeStream . ifnonnull ( falseLabel ) ; } else { } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } this . left . generateCode ( currentScope , codeStream , valueRequired ) ; this . right . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { switch ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : codeStream . if_icmpeq ( trueLabel ) ; break ; case T_float : codeStream . fcmpl ( ) ; codeStream . ifeq ( trueLabel ) ; break ; case T_long : codeStream . lcmp ( ) ; codeStream . ifeq ( trueLabel ) ; break ; case T_double : codeStream . dcmpl ( ) ; codeStream . ifeq ( trueLabel ) ; break ; default : codeStream . if_acmpeq ( trueLabel ) ; } } } else { if ( trueLabel == null ) { switch ( ( this . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : codeStream . if_icmpne ( falseLabel ) ; break ; case T_float : codeStream . fcmpl ( ) ; codeStream . ifne ( falseLabel ) ; break ; case T_long : codeStream . lcmp ( ) ; codeStream . ifne ( falseLabel ) ; break ; case T_double : codeStream . dcmpl ( ) ; codeStream . ifne ( falseLabel ) ; break ; default : codeStream . if_acmpne ( falseLabel ) ; } } else { } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public boolean isCompactableOperation ( ) { return false ; } public TypeBinding resolveType ( BlockScope scope ) { boolean leftIsCast , rightIsCast ; if ( ( leftIsCast = this . left instanceof CastExpression ) == true ) this . left . bits |= DisableUnnecessaryCastCheck ; TypeBinding originalLeftType = this . left . resolveType ( scope ) ; if ( ( rightIsCast = this . right instanceof CastExpression ) == true ) this . right . bits |= DisableUnnecessaryCastCheck ; TypeBinding originalRightType = this . right . resolveType ( scope ) ; if ( originalLeftType == null || originalRightType == null ) { this . constant = Constant . NotAConstant ; return null ; } boolean use15specifics = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ; TypeBinding leftType = originalLeftType , rightType = originalRightType ; if ( use15specifics ) { if ( leftType != TypeBinding . NULL && leftType . isBaseType ( ) ) { if ( ! rightType . isBaseType ( ) ) { rightType = scope . environment ( ) . computeBoxingType ( rightType ) ; } } else { if ( rightType != TypeBinding . NULL && rightType . isBaseType ( ) ) { leftType = scope . environment ( ) . computeBoxingType ( leftType ) ; } } } if ( leftType . isBaseType ( ) && rightType . isBaseType ( ) ) { int leftTypeID = leftType . id ; int rightTypeID = rightType . id ; int operatorSignature = OperatorSignatures [ EQUAL_EQUAL ] [ ( leftTypeID << <NUM_LIT:4> ) + rightTypeID ] ; this . left . computeConversion ( scope , TypeBinding . wellKnownType ( scope , ( operatorSignature > > > <NUM_LIT:16> ) & <NUM_LIT> ) , originalLeftType ) ; this . right . computeConversion ( scope , TypeBinding . wellKnownType ( scope , ( operatorSignature > > > <NUM_LIT:8> ) & <NUM_LIT> ) , originalRightType ) ; this . bits |= operatorSignature & <NUM_LIT> ; if ( ( operatorSignature & <NUM_LIT> ) == T_undefined ) { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidOperator ( this , leftType , rightType ) ; return null ; } if ( leftIsCast || rightIsCast ) { CastExpression . checkNeedForArgumentCasts ( scope , EQUAL_EQUAL , operatorSignature , this . left , leftType . id , leftIsCast , this . right , rightType . id , rightIsCast ) ; } computeConstant ( leftType , rightType ) ; Binding leftDirect = Expression . getDirectBinding ( this . left ) ; if ( leftDirect != null && leftDirect == Expression . getDirectBinding ( this . right ) ) { if ( leftTypeID != TypeIds . T_double && leftTypeID != TypeIds . T_float && ( ! ( this . right instanceof Assignment ) ) ) scope . problemReporter ( ) . comparingIdenticalExpressions ( this ) ; } else if ( this . constant != Constant . NotAConstant ) { int operator = ( this . bits & OperatorMASK ) > > OperatorSHIFT ; if ( ( operator == EQUAL_EQUAL && this . constant == BooleanConstant . fromValue ( true ) ) || ( operator == NOT_EQUAL && this . constant == BooleanConstant . fromValue ( false ) ) ) scope . problemReporter ( ) . comparingIdenticalExpressions ( this ) ; } return this . resolvedType = TypeBinding . BOOLEAN ; } if ( ( ! leftType . isBaseType ( ) || leftType == TypeBinding . NULL ) && ( ! rightType . isBaseType ( ) || rightType == TypeBinding . NULL ) && ( checkCastTypesCompatibility ( scope , leftType , rightType , null ) || checkCastTypesCompatibility ( scope , rightType , leftType , null ) ) ) { if ( ( rightType . id == T_JavaLangString ) && ( leftType . id == T_JavaLangString ) ) { computeConstant ( leftType , rightType ) ; } else { this . constant = Constant . NotAConstant ; } TypeBinding objectType = scope . getJavaLangObject ( ) ; this . left . computeConversion ( scope , objectType , leftType ) ; this . right . computeConversion ( scope , objectType , rightType ) ; boolean unnecessaryLeftCast = ( this . left . bits & UnnecessaryCast ) != <NUM_LIT:0> ; boolean unnecessaryRightCast = ( this . right . bits & UnnecessaryCast ) != <NUM_LIT:0> ; if ( unnecessaryLeftCast || unnecessaryRightCast ) { TypeBinding alternateLeftType = unnecessaryLeftCast ? ( ( CastExpression ) this . left ) . expression . resolvedType : leftType ; TypeBinding alternateRightType = unnecessaryRightCast ? ( ( CastExpression ) this . right ) . expression . resolvedType : rightType ; if ( checkCastTypesCompatibility ( scope , alternateLeftType , alternateRightType , null ) || checkCastTypesCompatibility ( scope , alternateRightType , alternateLeftType , null ) ) { if ( unnecessaryLeftCast ) scope . problemReporter ( ) . unnecessaryCast ( ( CastExpression ) this . left ) ; if ( unnecessaryRightCast ) scope . problemReporter ( ) . unnecessaryCast ( ( CastExpression ) this . right ) ; } } Binding leftDirect = Expression . getDirectBinding ( this . left ) ; if ( leftDirect != null && leftDirect == Expression . getDirectBinding ( this . right ) ) { if ( ! ( this . right instanceof Assignment ) ) { scope . problemReporter ( ) . comparingIdenticalExpressions ( this ) ; } } return this . resolvedType = TypeBinding . BOOLEAN ; } this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . notCompatibleTypesError ( this , leftType , rightType ) ; return null ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . left . traverse ( visitor , scope ) ; this . right . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; 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 . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; public class TypeParameter extends AbstractVariableDeclaration { public TypeVariableBinding binding ; public TypeReference [ ] bounds ; public int getKind ( ) { return TYPE_PARAMETER ; } public void checkBounds ( Scope scope ) { if ( this . type != null ) { this . type . checkBounds ( scope ) ; } if ( this . bounds != null ) { for ( int i = <NUM_LIT:0> , length = this . bounds . length ; i < length ; i ++ ) { this . bounds [ i ] . checkBounds ( scope ) ; } } } private void internalResolve ( Scope scope , boolean staticContext ) { if ( this . binding != null ) { Binding existingType = scope . parent . getBinding ( this . name , Binding . TYPE , this , false ) ; if ( existingType != null && this . binding != existingType && existingType . isValidBinding ( ) && ( existingType . kind ( ) != Binding . TYPE_PARAMETER || ! staticContext ) ) { scope . problemReporter ( ) . typeHiding ( this , existingType ) ; } } } public void resolve ( BlockScope scope ) { internalResolve ( scope , scope . methodScope ( ) . isStatic ) ; } public void resolve ( ClassScope scope ) { internalResolve ( scope , scope . enclosingSourceType ( ) . isStatic ( ) ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { output . append ( this . name ) ; if ( this . type != null ) { output . append ( "<STR_LIT>" ) ; this . type . print ( <NUM_LIT:0> , output ) ; } if ( this . bounds != null ) { for ( int i = <NUM_LIT:0> ; i < this . bounds . length ; i ++ ) { output . append ( "<STR_LIT>" ) ; this . bounds [ i ] . print ( <NUM_LIT:0> , output ) ; } } return output ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . bounds != null ) { int boundsLength = this . bounds . length ; for ( int i = <NUM_LIT:0> ; i < boundsLength ; i ++ ) { this . bounds [ i ] . traverse ( visitor , scope ) ; } } } visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . bounds != null ) { int boundsLength = this . bounds . length ; for ( int i = <NUM_LIT:0> ; i < boundsLength ; i ++ ) { this . bounds [ i ] . traverse ( visitor , scope ) ; } } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class JavadocMessageSend extends MessageSend { public int tagSourceStart , tagSourceEnd ; public int tagValue ; public JavadocMessageSend ( char [ ] name , long pos ) { this . selector = name ; this . nameSourcePosition = pos ; this . sourceStart = ( int ) ( this . nameSourcePosition > > > <NUM_LIT:32> ) ; this . sourceEnd = ( int ) this . nameSourcePosition ; this . bits |= InsideJavadoc ; } public JavadocMessageSend ( char [ ] name , long pos , JavadocArgumentExpression [ ] arguments ) { this ( name , pos ) ; this . arguments = arguments ; } private TypeBinding internalResolveType ( Scope scope ) { this . constant = Constant . NotAConstant ; if ( this . receiver == null ) { this . actualReceiverType = scope . enclosingReceiverType ( ) ; } else if ( scope . kind == Scope . CLASS_SCOPE ) { this . actualReceiverType = this . receiver . resolveType ( ( ClassScope ) scope ) ; } else { this . actualReceiverType = this . receiver . resolveType ( ( BlockScope ) scope ) ; } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; boolean hasArgsTypeVar = false ; 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 ( scope . kind == Scope . CLASS_SCOPE ) { argumentTypes [ i ] = argument . resolveType ( ( ClassScope ) scope ) ; } else { argumentTypes [ i ] = argument . resolveType ( ( BlockScope ) scope ) ; } if ( argumentTypes [ i ] == null ) { argHasError = true ; } else if ( ! hasArgsTypeVar ) { hasArgsTypeVar = argumentTypes [ i ] . isTypeVariable ( ) ; } } if ( argHasError ) { return null ; } } if ( this . actualReceiverType == null ) { return null ; } this . actualReceiverType = scope . environment ( ) . convertToRawType ( this . receiver . resolvedType , true ) ; ReferenceBinding enclosingType = scope . enclosingReceiverType ( ) ; if ( enclosingType == null ? false : enclosingType . isCompatibleWith ( this . actualReceiverType ) ) { this . bits |= ASTNode . SuperAccess ; } if ( this . actualReceiverType . isBaseType ( ) ) { scope . problemReporter ( ) . javadocErrorNoMethodFor ( this , this . actualReceiverType , argumentTypes , scope . getDeclarationModifiers ( ) ) ; return null ; } this . binding = scope . getMethod ( this . actualReceiverType , this . selector , argumentTypes , this ) ; if ( ! this . binding . isValidBinding ( ) ) { TypeBinding enclosingTypeBinding = this . actualReceiverType ; MethodBinding methodBinding = this . binding ; while ( ! methodBinding . isValidBinding ( ) && ( enclosingTypeBinding . isMemberType ( ) || enclosingTypeBinding . isLocalType ( ) ) ) { enclosingTypeBinding = enclosingTypeBinding . enclosingType ( ) ; methodBinding = scope . getMethod ( enclosingTypeBinding , this . selector , argumentTypes , this ) ; } if ( methodBinding . isValidBinding ( ) ) { this . binding = methodBinding ; } else { enclosingTypeBinding = this . actualReceiverType ; MethodBinding contructorBinding = this . binding ; while ( ! contructorBinding . isValidBinding ( ) && ( enclosingTypeBinding . isMemberType ( ) || enclosingTypeBinding . isLocalType ( ) ) ) { enclosingTypeBinding = enclosingTypeBinding . enclosingType ( ) ; if ( CharOperation . equals ( this . selector , enclosingTypeBinding . shortReadableName ( ) ) ) { contructorBinding = scope . getConstructor ( ( ReferenceBinding ) enclosingTypeBinding , argumentTypes , this ) ; } } if ( contructorBinding . isValidBinding ( ) ) { this . binding = contructorBinding ; } } } if ( ! this . binding . isValidBinding ( ) ) { switch ( this . binding . problemId ( ) ) { case ProblemReasons . NonStaticReferenceInConstructorInvocation : case ProblemReasons . NonStaticReferenceInStaticContext : case ProblemReasons . InheritedNameHidesEnclosingName : case ProblemReasons . Ambiguous : MethodBinding closestMatch = ( ( ProblemMethodBinding ) this . binding ) . closestMatch ; if ( closestMatch != null ) { this . binding = closestMatch ; } } } if ( ! this . binding . isValidBinding ( ) ) { if ( this . receiver . resolvedType instanceof ProblemReferenceBinding ) { return null ; } if ( this . binding . declaringClass == null ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding . declaringClass = ( ReferenceBinding ) this . actualReceiverType ; } else { scope . problemReporter ( ) . javadocErrorNoMethodFor ( this , this . actualReceiverType , argumentTypes , scope . getDeclarationModifiers ( ) ) ; return null ; } } scope . problemReporter ( ) . javadocInvalidMethod ( this , this . binding , scope . getDeclarationModifiers ( ) ) ; if ( this . binding instanceof ProblemMethodBinding ) { MethodBinding closestMatch = ( ( ProblemMethodBinding ) this . binding ) . closestMatch ; if ( closestMatch != null ) this . binding = closestMatch ; } return this . resolvedType = this . binding == null ? null : this . binding . returnType ; } else if ( hasArgsTypeVar ) { MethodBinding problem = new ProblemMethodBinding ( this . binding , this . selector , argumentTypes , ProblemReasons . NotFound ) ; scope . problemReporter ( ) . javadocInvalidMethod ( this , problem , scope . getDeclarationModifiers ( ) ) ; } else if ( this . binding . isVarargs ( ) ) { int length = argumentTypes . length ; if ( ! ( this . binding . parameters . length == length && argumentTypes [ length - <NUM_LIT:1> ] . isArrayType ( ) ) ) { MethodBinding problem = new ProblemMethodBinding ( this . binding , this . selector , argumentTypes , ProblemReasons . NotFound ) ; scope . problemReporter ( ) . javadocInvalidMethod ( this , problem , scope . getDeclarationModifiers ( ) ) ; } } else { int length = argumentTypes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( this . binding . parameters [ i ] . erasure ( ) != argumentTypes [ i ] . erasure ( ) ) { MethodBinding problem = new ProblemMethodBinding ( this . binding , this . selector , argumentTypes , ProblemReasons . NotFound ) ; scope . problemReporter ( ) . javadocInvalidMethod ( this , problem , scope . getDeclarationModifiers ( ) ) ; break ; } } } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) { scope . problemReporter ( ) . javadocDeprecatedMethod ( this . binding , this , scope . getDeclarationModifiers ( ) ) ; } return this . resolvedType = this . binding . returnType ; } public boolean isSuperAccess ( ) { return ( this . bits & ASTNode . SuperAccess ) != <NUM_LIT:0> ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { if ( this . receiver != null ) { this . receiver . printExpression ( <NUM_LIT:0> , output ) ; } output . append ( '<CHAR_LIT>' ) . append ( this . selector ) . append ( '<CHAR_LIT:(>' ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> ; i < this . arguments . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . arguments [ i ] . printExpression ( <NUM_LIT:0> , output ) ; } } return output . append ( '<CHAR_LIT:)>' ) ; } public TypeBinding resolveType ( BlockScope scope ) { return internalResolveType ( scope ) ; } public TypeBinding resolveType ( ClassScope scope ) { return internalResolveType ( scope ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { if ( this . receiver != null ) { this . receiver . traverse ( visitor , blockScope ) ; } if ( this . arguments != null ) { int argumentsLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , blockScope ) ; } } visitor . endVisit ( this , blockScope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . receiver != null ) { this . receiver . traverse ( visitor , scope ) ; } if ( this . arguments != null ) { int argumentsLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; 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 . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; public class ExplicitConstructorCall extends Statement implements InvocationSite { public Expression [ ] arguments ; public Expression qualification ; public MethodBinding binding ; MethodBinding syntheticAccessor ; public int accessMode ; public TypeReference [ ] typeArguments ; public TypeBinding [ ] genericTypeArguments ; public final static int ImplicitSuper = <NUM_LIT:1> ; public final static int Super = <NUM_LIT:2> ; public final static int This = <NUM_LIT:3> ; public VariableBinding [ ] [ ] implicitArguments ; public int typeArgumentsSourceStart ; public ExplicitConstructorCall ( int accessMode ) { this . accessMode = accessMode ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { try { ( ( MethodScope ) currentScope ) . isConstructorCall = true ; if ( this . qualification != null ) { flowInfo = this . qualification . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { flowInfo = this . arguments [ i ] . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; if ( ( this . arguments [ i ] . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . arguments [ i ] . checkNPE ( currentScope , flowContext , flowInfo ) ; } } } ReferenceBinding [ ] thrownExceptions ; if ( ( thrownExceptions = this . binding . thrownExceptions ) != Binding . NO_EXCEPTIONS ) { if ( ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) { thrownExceptions = currentScope . environment ( ) . convertToRawTypes ( this . binding . thrownExceptions , true , true ) ; } flowContext . checkExceptionHandlers ( thrownExceptions , ( this . accessMode == ExplicitConstructorCall . ImplicitSuper ) ? ( ASTNode ) currentScope . methodScope ( ) . referenceContext : ( ASTNode ) this , flowInfo , currentScope ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; manageSyntheticAccessIfNecessary ( currentScope , flowInfo ) ; return flowInfo ; } finally { ( ( MethodScope ) currentScope ) . isConstructorCall = false ; } } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } try { ( ( MethodScope ) currentScope ) . isConstructorCall = true ; int pc = codeStream . position ; codeStream . aload_0 ( ) ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding targetType = codegenBinding . declaringClass ; if ( targetType . erasure ( ) . id == TypeIds . T_JavaLangEnum || targetType . isEnum ( ) ) { codeStream . aload_1 ( ) ; codeStream . iload_2 ( ) ; } if ( targetType . isNestedType ( ) ) { codeStream . generateSyntheticEnclosingInstanceValues ( currentScope , targetType , ( this . bits & ASTNode . DiscardEnclosingInstance ) != <NUM_LIT:0> ? null : this . qualification , this ) ; } generateArguments ( this . binding , this . arguments , currentScope , codeStream ) ; if ( targetType . isNestedType ( ) ) { codeStream . generateSyntheticOuterArgumentValues ( currentScope , targetType , this ) ; } if ( this . syntheticAccessor != null ) { for ( int i = <NUM_LIT:0> , max = this . syntheticAccessor . parameters . length - codegenBinding . parameters . length ; i < max ; i ++ ) { codeStream . aconst_null ( ) ; } codeStream . invoke ( Opcodes . OPC_invokespecial , this . syntheticAccessor , null ) ; } else { codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , null ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } finally { ( ( MethodScope ) currentScope ) . isConstructorCall = false ; } } public TypeBinding [ ] genericTypeArguments ( ) { return this . genericTypeArguments ; } public boolean isImplicitSuper ( ) { return ( this . accessMode == ExplicitConstructorCall . ImplicitSuper ) ; } public boolean isSuperAccess ( ) { return this . accessMode != ExplicitConstructorCall . This ; } public boolean isTypeAccess ( ) { return true ; } void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { ReferenceBinding superTypeErasure = ( ReferenceBinding ) this . binding . declaringClass . erasure ( ) ; if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { if ( superTypeErasure . isNestedType ( ) && currentScope . enclosingSourceType ( ) . isLocalType ( ) ) { if ( superTypeErasure . isLocalType ( ) ) { ( ( LocalTypeBinding ) superTypeErasure ) . addInnerEmulationDependent ( currentScope , this . qualification != null ) ; } else { currentScope . propagateInnerEmulation ( superTypeErasure , this . qualification != null ) ; } } } } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { MethodBinding codegenBinding = this . binding . original ( ) ; if ( this . binding . isPrivate ( ) && this . accessMode != ExplicitConstructorCall . This ) { ReferenceBinding declaringClass = codegenBinding . declaringClass ; if ( ( declaringClass . tagBits & TagBits . IsLocalType ) != <NUM_LIT:0> && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ) { codegenBinding . tagBits |= TagBits . ClearPrivateModifier ; } else { this . syntheticAccessor = ( ( SourceTypeBinding ) declaringClass ) . addSyntheticMethod ( codegenBinding , isSuperAccess ( ) ) ; currentScope . problemReporter ( ) . needToEmulateMethodAccess ( codegenBinding , this ) ; } } } } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) ; if ( this . qualification != null ) this . qualification . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:.>' ) ; if ( this . typeArguments != null ) { output . append ( '<CHAR_LIT>' ) ; int max = this . typeArguments . length - <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < max ; j ++ ) { this . typeArguments [ j ] . print ( <NUM_LIT:0> , output ) ; output . append ( "<STR_LIT:U+002CU+0020>" ) ; } this . typeArguments [ max ] . print ( <NUM_LIT:0> , output ) ; output . append ( '<CHAR_LIT:>>' ) ; } if ( this . accessMode == ExplicitConstructorCall . This ) { output . append ( "<STR_LIT>" ) ; } else { output . append ( "<STR_LIT>" ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> ; i < this . arguments . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . arguments [ i ] . printExpression ( <NUM_LIT:0> , output ) ; } } return output . append ( "<STR_LIT>" ) ; } public void resolve ( BlockScope scope ) { MethodScope methodScope = scope . methodScope ( ) ; try { AbstractMethodDeclaration methodDeclaration = methodScope . referenceMethod ( ) ; if ( methodDeclaration == null || ! methodDeclaration . isConstructor ( ) || ( ( ConstructorDeclaration ) methodDeclaration ) . constructorCall != this ) { scope . problemReporter ( ) . invalidExplicitConstructorCall ( this ) ; if ( this . qualification != null ) { this . qualification . resolveType ( scope ) ; } if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , max = this . typeArguments . length ; i < max ; i ++ ) { this . typeArguments [ i ] . resolveType ( scope , true ) ; } } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { this . arguments [ i ] . resolveType ( scope ) ; } } return ; } methodScope . isConstructorCall = true ; ReferenceBinding receiverType = scope . enclosingReceiverType ( ) ; boolean rcvHasError = false ; if ( this . accessMode != ExplicitConstructorCall . This ) { receiverType = receiverType . superclass ( ) ; TypeReference superclassRef = scope . referenceType ( ) . superclass ; if ( superclassRef != null && superclassRef . resolvedType != null && ! superclassRef . resolvedType . isValidBinding ( ) ) { rcvHasError = true ; } } if ( receiverType != null ) { if ( this . accessMode == ExplicitConstructorCall . Super && receiverType . erasure ( ) . id == TypeIds . T_JavaLangEnum ) { scope . problemReporter ( ) . cannotInvokeSuperConstructorInEnum ( this , methodScope . referenceMethod ( ) . binding ) ; } if ( this . qualification != null ) { if ( this . accessMode != ExplicitConstructorCall . Super ) { scope . problemReporter ( ) . unnecessaryEnclosingInstanceSpecification ( this . qualification , receiverType ) ; } if ( ! rcvHasError ) { ReferenceBinding enclosingType = receiverType . enclosingType ( ) ; if ( enclosingType == null ) { scope . problemReporter ( ) . unnecessaryEnclosingInstanceSpecification ( this . qualification , receiverType ) ; this . bits |= ASTNode . DiscardEnclosingInstance ; } else { TypeBinding qTb = this . qualification . resolveTypeExpecting ( scope , enclosingType ) ; this . qualification . computeConversion ( scope , qTb , qTb ) ; } } } } if ( this . typeArguments != null ) { boolean argHasError = scope . compilerOptions ( ) . sourceLevel < ClassFileConstants . JDK1_5 ; int length = this . typeArguments . length ; 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 ; } } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; boolean argsContainCast = false ; 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 |= ASTNode . DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = argument . resolveType ( scope ) ) == null ) { argHasError = true ; } } if ( argHasError ) { if ( receiverType == null ) { return ; } TypeBinding [ ] pseudoArgs = new TypeBinding [ length ] ; for ( int i = length ; -- i >= <NUM_LIT:0> ; ) { pseudoArgs [ i ] = argumentTypes [ i ] == null ? TypeBinding . NULL : argumentTypes [ i ] ; } this . binding = scope . findMethod ( receiverType , TypeConstants . INIT , pseudoArgs , this ) ; if ( this . binding != null && ! this . binding . isValidBinding ( ) ) { MethodBinding closestMatch = ( ( ProblemMethodBinding ) this . binding ) . closestMatch ; if ( closestMatch != null ) { if ( closestMatch . original ( ) . typeVariables != Binding . NO_TYPE_VARIABLES ) { closestMatch = scope . environment ( ) . createParameterizedGenericMethod ( closestMatch . original ( ) , ( RawTypeBinding ) null ) ; } this . binding = closestMatch ; MethodBinding closestMatchOriginal = closestMatch . original ( ) ; if ( closestMatchOriginal . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInMethod ( closestMatchOriginal ) ) { closestMatchOriginal . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } } return ; } } else if ( receiverType . erasure ( ) . id == TypeIds . T_JavaLangEnum ) { argumentTypes = new TypeBinding [ ] { scope . getJavaLangString ( ) , TypeBinding . INT } ; } if ( receiverType == null ) { return ; } if ( ( this . binding = scope . getConstructor ( receiverType , argumentTypes , this ) ) . isValidBinding ( ) ) { if ( ( this . binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { if ( ! methodScope . enclosingSourceType ( ) . isAnonymousType ( ) ) { scope . problemReporter ( ) . missingTypeInConstructor ( this , this . binding ) ; } } if ( isMethodUseDeprecated ( this . binding , scope , this . accessMode != ExplicitConstructorCall . ImplicitSuper ) ) { scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; } if ( checkInvocationArguments ( scope , null , receiverType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } if ( this . binding . isOrEnclosedByPrivateType ( ) ) { this . binding . original ( ) . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } if ( this . typeArguments != null && this . binding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( this . binding , this . genericTypeArguments , this . typeArguments ) ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = receiverType ; } if ( rcvHasError ) return ; scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; } } finally { methodScope . isConstructorCall = false ; } } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int depth ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . qualification != null ) { this . qualification . traverse ( visitor , scope ) ; } if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , typeArgumentsLength = this . typeArguments . length ; i < typeArgumentsLength ; i ++ ) { this . typeArguments [ i ] . traverse ( visitor , scope ) ; } } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , argumentLength = this . arguments . length ; i < argumentLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class JavadocAllocationExpression extends AllocationExpression { public int tagSourceStart , tagSourceEnd ; public int tagValue , memberStart ; public char [ ] [ ] qualification ; public JavadocAllocationExpression ( int start , int end ) { this . sourceStart = start ; this . sourceEnd = end ; this . bits |= InsideJavadoc ; } public JavadocAllocationExpression ( long pos ) { this ( ( int ) ( pos > > > <NUM_LIT:32> ) , ( int ) pos ) ; } TypeBinding internalResolveType ( Scope scope ) { this . constant = Constant . NotAConstant ; if ( this . type == null ) { this . resolvedType = scope . enclosingSourceType ( ) ; } else if ( scope . kind == Scope . CLASS_SCOPE ) { this . resolvedType = this . type . resolveType ( ( ClassScope ) scope ) ; } else { this . resolvedType = this . type . resolveType ( ( BlockScope ) scope , true ) ; } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; boolean hasTypeVarArgs = false ; 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 ( scope . kind == Scope . CLASS_SCOPE ) { argumentTypes [ i ] = argument . resolveType ( ( ClassScope ) scope ) ; } else { argumentTypes [ i ] = argument . resolveType ( ( BlockScope ) scope ) ; } if ( argumentTypes [ i ] == null ) { argHasError = true ; } else if ( ! hasTypeVarArgs ) { hasTypeVarArgs = argumentTypes [ i ] . isTypeVariable ( ) ; } } if ( argHasError ) { return null ; } } if ( this . resolvedType == null ) { return null ; } this . resolvedType = scope . environment ( ) . convertToRawType ( this . type . resolvedType , true ) ; SourceTypeBinding enclosingType = scope . enclosingSourceType ( ) ; if ( enclosingType == null ? false : enclosingType . isCompatibleWith ( this . resolvedType ) ) { this . bits |= ASTNode . SuperAccess ; } ReferenceBinding allocationType = ( ReferenceBinding ) this . resolvedType ; this . binding = scope . getConstructor ( allocationType , argumentTypes , this ) ; if ( ! this . binding . isValidBinding ( ) ) { ReferenceBinding enclosingTypeBinding = allocationType ; MethodBinding contructorBinding = this . binding ; while ( ! contructorBinding . isValidBinding ( ) && ( enclosingTypeBinding . isMemberType ( ) || enclosingTypeBinding . isLocalType ( ) ) ) { enclosingTypeBinding = enclosingTypeBinding . enclosingType ( ) ; contructorBinding = scope . getConstructor ( enclosingTypeBinding , argumentTypes , this ) ; } if ( contructorBinding . isValidBinding ( ) ) { this . binding = contructorBinding ; } } if ( ! this . binding . isValidBinding ( ) ) { MethodBinding methodBinding = scope . getMethod ( this . resolvedType , this . resolvedType . sourceName ( ) , argumentTypes , this ) ; if ( methodBinding . isValidBinding ( ) ) { this . binding = methodBinding ; } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocationType ; } scope . problemReporter ( ) . javadocInvalidConstructor ( this , this . binding , scope . getDeclarationModifiers ( ) ) ; } return this . resolvedType ; } else if ( this . binding . isVarargs ( ) ) { int length = argumentTypes . length ; if ( ! ( this . binding . parameters . length == length && argumentTypes [ length - <NUM_LIT:1> ] . isArrayType ( ) ) ) { MethodBinding problem = new ProblemMethodBinding ( this . binding , this . binding . selector , argumentTypes , ProblemReasons . NotFound ) ; scope . problemReporter ( ) . javadocInvalidConstructor ( this , problem , scope . getDeclarationModifiers ( ) ) ; } } else if ( hasTypeVarArgs ) { MethodBinding problem = new ProblemMethodBinding ( this . binding , this . binding . selector , argumentTypes , ProblemReasons . NotFound ) ; scope . problemReporter ( ) . javadocInvalidConstructor ( this , problem , scope . getDeclarationModifiers ( ) ) ; } else if ( this . binding instanceof ParameterizedMethodBinding ) { ParameterizedMethodBinding paramMethodBinding = ( ParameterizedMethodBinding ) this . binding ; if ( paramMethodBinding . hasSubstitutedParameters ( ) ) { int length = argumentTypes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( paramMethodBinding . parameters [ i ] != argumentTypes [ i ] && paramMethodBinding . parameters [ i ] . erasure ( ) != argumentTypes [ i ] . erasure ( ) ) { MethodBinding problem = new ProblemMethodBinding ( this . binding , this . binding . selector , argumentTypes , ProblemReasons . NotFound ) ; scope . problemReporter ( ) . javadocInvalidConstructor ( this , problem , scope . getDeclarationModifiers ( ) ) ; break ; } } } } else if ( this . resolvedType . isMemberType ( ) ) { int length = this . qualification . length ; if ( length > <NUM_LIT:1> ) { ReferenceBinding enclosingTypeBinding = allocationType ; if ( this . type instanceof JavadocQualifiedTypeReference && ( ( JavadocQualifiedTypeReference ) this . type ) . tokens . length != length ) { scope . problemReporter ( ) . javadocInvalidMemberTypeQualification ( this . memberStart + <NUM_LIT:1> , this . sourceEnd , scope . getDeclarationModifiers ( ) ) ; } else { int idx = length ; while ( idx > <NUM_LIT:0> && CharOperation . equals ( this . qualification [ -- idx ] , enclosingTypeBinding . sourceName ) && ( enclosingTypeBinding = enclosingTypeBinding . enclosingType ( ) ) != null ) { } if ( idx > <NUM_LIT:0> || enclosingTypeBinding != null ) { scope . problemReporter ( ) . javadocInvalidMemberTypeQualification ( this . memberStart + <NUM_LIT:1> , this . sourceEnd , scope . getDeclarationModifiers ( ) ) ; } } } } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) { scope . problemReporter ( ) . javadocDeprecatedMethod ( this . binding , this , scope . getDeclarationModifiers ( ) ) ; } return allocationType ; } public boolean isSuperAccess ( ) { return ( this . bits & ASTNode . SuperAccess ) != <NUM_LIT:0> ; } public TypeBinding resolveType ( BlockScope scope ) { return internalResolveType ( scope ) ; } public TypeBinding resolveType ( ClassScope scope ) { return internalResolveType ( scope ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , typeArgumentsLength = this . typeArguments . length ; i < typeArgumentsLength ; i ++ ) { this . typeArguments [ i ] . traverse ( visitor , scope ) ; } } if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , argumentsLength = this . arguments . length ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , typeArgumentsLength = this . typeArguments . length ; i < typeArgumentsLength ; i ++ ) { this . typeArguments [ i ] . traverse ( visitor , scope ) ; } } if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , argumentsLength = this . arguments . length ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class ArrayTypeReference extends SingleTypeReference { public int dimensions ; public int originalSourceEnd ; public ArrayTypeReference ( char [ ] source , int dimensions , long pos ) { super ( source , pos ) ; this . originalSourceEnd = this . sourceEnd ; this . dimensions = dimensions ; } public int dimensions ( ) { return this . dimensions ; } public char [ ] [ ] getParameterizedTypeName ( ) { int dim = this . dimensions ; char [ ] dimChars = new char [ dim * <NUM_LIT:2> ] ; for ( int i = <NUM_LIT:0> ; i < dim ; i ++ ) { int index = i * <NUM_LIT:2> ; dimChars [ index ] = '<CHAR_LIT:[>' ; dimChars [ index + <NUM_LIT:1> ] = '<CHAR_LIT:]>' ; } return new char [ ] [ ] { CharOperation . concat ( this . token , dimChars ) } ; } protected TypeBinding getTypeBinding ( Scope scope ) { if ( this . resolvedType != null ) { return this . resolvedType ; } if ( this . dimensions > <NUM_LIT:255> ) { scope . problemReporter ( ) . tooManyDimensions ( this ) ; } TypeBinding leafComponentType = scope . getType ( this . token ) ; return scope . createArrayType ( leafComponentType , this . dimensions ) ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { super . printExpression ( indent , output ) ; if ( ( this . bits & IsVarArgs ) != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < this . dimensions - <NUM_LIT:1> ; i ++ ) { output . append ( "<STR_LIT:[]>" ) ; } output . append ( "<STR_LIT:...>" ) ; } else { for ( int i = <NUM_LIT:0> ; i < this . dimensions ; i ++ ) { output . append ( "<STR_LIT:[]>" ) ; } } return output ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . PackageBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class JavadocSingleTypeReference extends SingleTypeReference { public int tagSourceStart , tagSourceEnd ; public PackageBinding packageBinding ; public JavadocSingleTypeReference ( char [ ] source , long pos , int tagStart , int tagEnd ) { super ( source , pos ) ; this . tagSourceStart = tagStart ; this . tagSourceEnd = tagEnd ; this . bits |= ASTNode . InsideJavadoc ; } protected TypeBinding internalResolveType ( Scope scope ) { this . constant = Constant . NotAConstant ; if ( this . resolvedType != null ) { if ( this . resolvedType . isValidBinding ( ) ) { return this . resolvedType ; } else { switch ( this . resolvedType . problemId ( ) ) { case ProblemReasons . NotFound : case ProblemReasons . NotVisible : case ProblemReasons . InheritedNameHidesEnclosingName : TypeBinding type = this . resolvedType . closestMatch ( ) ; return type ; default : return null ; } } } this . resolvedType = getTypeBinding ( scope ) ; if ( this . resolvedType == null ) return null ; if ( ! this . resolvedType . isValidBinding ( ) ) { char [ ] [ ] tokens = { this . token } ; Binding binding = scope . getTypeOrPackage ( tokens ) ; if ( binding instanceof PackageBinding ) { this . packageBinding = ( PackageBinding ) binding ; } else { if ( this . resolvedType . problemId ( ) == ProblemReasons . NonStaticReferenceInStaticContext ) { TypeBinding closestMatch = this . resolvedType . closestMatch ( ) ; if ( closestMatch != null && closestMatch . isTypeVariable ( ) ) { this . resolvedType = closestMatch ; return this . resolvedType ; } } reportInvalidType ( scope ) ; } return null ; } if ( isTypeUseDeprecated ( this . resolvedType , scope ) ) reportDeprecatedType ( this . resolvedType , scope ) ; if ( this . resolvedType . isGenericType ( ) || this . resolvedType . isParameterizedType ( ) ) { this . resolvedType = scope . environment ( ) . convertToRawType ( this . resolvedType , true ) ; } return this . resolvedType ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope ) { scope . problemReporter ( ) . javadocDeprecatedType ( type , this , scope . getDeclarationModifiers ( ) ) ; } protected void reportInvalidType ( Scope scope ) { scope . problemReporter ( ) . javadocInvalidType ( this , this . resolvedType , scope . getDeclarationModifiers ( ) ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . parser . * ; public class Initializer extends FieldDeclaration { public Block block ; public int lastVisibleFieldID ; public int bodyStart ; public int bodyEnd ; public Initializer ( Block block , int modifiers ) { this . block = block ; this . modifiers = modifiers ; if ( block != null ) { this . declarationSourceStart = this . sourceStart = block . sourceStart ; } } public FlowInfo analyseCode ( MethodScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . block != null ) { return this . block . analyseCode ( currentScope , flowContext , flowInfo ) ; } return flowInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; if ( this . block != null ) this . block . generateCode ( currentScope , codeStream ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public int getKind ( ) { return INITIALIZER ; } public boolean isStatic ( ) { return ( this . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ; } public void parseStatements ( Parser parser , TypeDeclaration typeDeclaration , CompilationUnitDeclaration unit ) { parser . parse ( this , typeDeclaration , unit ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { if ( this . modifiers != <NUM_LIT:0> ) { printIndent ( indent , output ) ; printModifiers ( this . modifiers , output ) ; if ( this . annotations != null ) printAnnotations ( this . annotations , output ) ; output . append ( "<STR_LIT>" ) ; if ( this . block != null ) { this . block . printBody ( indent , output ) ; } printIndent ( indent , output ) . append ( '<CHAR_LIT:}>' ) ; return output ; } else if ( this . block != null ) { this . block . printStatement ( indent , output ) ; } else { printIndent ( indent , output ) . append ( "<STR_LIT:{}>" ) ; } return output ; } public void resolve ( MethodScope scope ) { FieldBinding previousField = scope . initializedField ; int previousFieldID = scope . lastVisibleFieldID ; try { scope . initializedField = null ; scope . lastVisibleFieldID = this . lastVisibleFieldID ; if ( isStatic ( ) ) { ReferenceBinding declaringType = scope . enclosingSourceType ( ) ; if ( declaringType . isNestedType ( ) && ! declaringType . isStatic ( ) ) scope . problemReporter ( ) . innerTypesCannotDeclareStaticInitializers ( declaringType , this ) ; } if ( this . block != null ) this . block . resolve ( scope ) ; } finally { scope . initializedField = previousField ; scope . lastVisibleFieldID = previousFieldID ; } } public void traverse ( ASTVisitor visitor , MethodScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . block != null ) this . block . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class ContinueStatement extends BranchStatement { public ContinueStatement ( char [ ] label , int sourceStart , int sourceEnd ) { super ( label , sourceStart , sourceEnd ) ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { FlowContext targetContext = ( this . label == null ) ? flowContext . getTargetContextForDefaultContinue ( ) : flowContext . getTargetContextForContinueLabel ( this . label ) ; if ( targetContext == null ) { if ( this . label == null ) { currentScope . problemReporter ( ) . invalidContinue ( this ) ; } else { currentScope . problemReporter ( ) . undefinedLabel ( this ) ; } return flowInfo ; } if ( targetContext == FlowContext . NotContinuableContext ) { currentScope . problemReporter ( ) . invalidContinue ( this ) ; return flowInfo ; } this . initStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; this . targetLabel = targetContext . continueLabel ( ) ; FlowContext traversedContext = flowContext ; int subCount = <NUM_LIT:0> ; this . subroutines = new SubRoutineStatement [ <NUM_LIT:5> ] ; do { SubRoutineStatement sub ; if ( ( sub = traversedContext . subroutine ( ) ) != null ) { if ( subCount == this . subroutines . length ) { System . arraycopy ( this . subroutines , <NUM_LIT:0> , this . subroutines = new SubRoutineStatement [ subCount * <NUM_LIT:2> ] , <NUM_LIT:0> , subCount ) ; } this . subroutines [ subCount ++ ] = sub ; if ( sub . isSubRoutineEscaping ( ) ) { break ; } } traversedContext . recordReturnFrom ( flowInfo . unconditionalInits ( ) ) ; if ( traversedContext instanceof InsideSubRoutineFlowContext ) { ASTNode node = traversedContext . associatedNode ; if ( node instanceof TryStatement ) { TryStatement tryStatement = ( TryStatement ) node ; flowInfo . addInitializationsFrom ( tryStatement . subRoutineInits ) ; } } else if ( traversedContext == targetContext ) { targetContext . recordContinueFrom ( flowContext , flowInfo ) ; break ; } } while ( ( traversedContext = traversedContext . parent ) != null ) ; if ( subCount != this . subroutines . length ) { System . arraycopy ( this . subroutines , <NUM_LIT:0> , this . subroutines = new SubRoutineStatement [ subCount ] , <NUM_LIT:0> , subCount ) ; } return FlowInfo . DEAD_END ; } public StringBuffer printStatement ( int tab , StringBuffer output ) { printIndent ( tab , output ) . append ( "<STR_LIT>" ) ; if ( this . label != null ) output . append ( this . label ) ; return output . append ( '<CHAR_LIT:;>' ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { visitor . visit ( this , blockScope ) ; visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class PrefixExpression extends CompoundAssignment { public PrefixExpression ( Expression lhs , Expression expression , int operator , int pos ) { super ( lhs , expression , operator , lhs . sourceEnd ) ; this . sourceStart = pos ; this . sourceEnd = lhs . sourceEnd ; } public boolean checkCastCompatibility ( ) { return false ; } public String operatorToString ( ) { switch ( this . operator ) { case PLUS : return "<STR_LIT>" ; case MINUS : return "<STR_LIT:-->" ; } return "<STR_LIT>" ; } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { output . append ( operatorToString ( ) ) . append ( '<CHAR_LIT:U+0020>' ) ; return this . lhs . printExpression ( <NUM_LIT:0> , output ) ; } public boolean restrainUsageToNumericTypes ( ) { return true ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . lhs . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class CompoundAssignment extends Assignment implements OperatorIds { public int operator ; public int preAssignImplicitConversion ; public CompoundAssignment ( Expression lhs , Expression expression , int operator , int sourceEnd ) { super ( lhs , expression , sourceEnd ) ; lhs . bits &= ~ IsStrictlyAssigned ; lhs . bits |= IsCompoundAssigned ; this . operator = operator ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . resolvedType . id != T_JavaLangString ) { this . lhs . checkNPE ( currentScope , flowContext , flowInfo ) ; } flowInfo = ( ( Reference ) this . lhs ) . analyseAssignment ( currentScope , flowContext , flowInfo , this , true ) . unconditionalInits ( ) ; if ( this . resolvedType . id == T_JavaLangString ) { LocalVariableBinding local = this . lhs . localVariableBinding ( ) ; if ( local != null ) { flowInfo . markAsDefinitelyNonNull ( local ) ; if ( flowContext . initsOnFinally != null ) flowContext . initsOnFinally . markAsDefinitelyNonNull ( local ) ; } } return flowInfo ; } public boolean checkCastCompatibility ( ) { return true ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; ( ( Reference ) this . lhs ) . generateCompoundAssignment ( currentScope , codeStream , this . expression , this . operator , this . preAssignImplicitConversion , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public int nullStatus ( FlowInfo flowInfo ) { return FlowInfo . NON_NULL ; } public String operatorToString ( ) { switch ( this . operator ) { case PLUS : return "<STR_LIT>" ; case MINUS : return "<STR_LIT>" ; case MULTIPLY : return "<STR_LIT>" ; case DIVIDE : return "<STR_LIT>" ; case AND : return "<STR_LIT>" ; case OR : return "<STR_LIT>" ; case XOR : return "<STR_LIT>" ; case REMAINDER : return "<STR_LIT>" ; case LEFT_SHIFT : return "<STR_LIT>" ; case RIGHT_SHIFT : return "<STR_LIT>" ; case UNSIGNED_RIGHT_SHIFT : return "<STR_LIT>" ; } return "<STR_LIT>" ; } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { this . lhs . printExpression ( indent , output ) . append ( '<CHAR_LIT:U+0020>' ) . append ( operatorToString ( ) ) . append ( '<CHAR_LIT:U+0020>' ) ; return this . expression . printExpression ( <NUM_LIT:0> , output ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; if ( ! ( this . lhs instanceof Reference ) || this . lhs . isThis ( ) ) { scope . problemReporter ( ) . expressionShouldBeAVariable ( this . lhs ) ; return null ; } boolean expressionIsCast = this . expression instanceof CastExpression ; if ( expressionIsCast ) this . expression . bits |= ASTNode . DisableUnnecessaryCastCheck ; TypeBinding originalLhsType = this . lhs . resolveType ( scope ) ; TypeBinding originalExpressionType = this . expression . resolveType ( scope ) ; if ( originalLhsType == null || originalExpressionType == null ) return null ; LocalVariableBinding localVariableBinding = this . lhs . localVariableBinding ( ) ; if ( localVariableBinding != null ) { localVariableBinding . tagBits &= ~ TagBits . IsEffectivelyFinal ; } LookupEnvironment env = scope . environment ( ) ; TypeBinding lhsType = originalLhsType , expressionType = originalExpressionType ; boolean use15specifics = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ; boolean unboxedLhs = false ; if ( use15specifics ) { if ( ! lhsType . isBaseType ( ) && expressionType . id != T_JavaLangString && expressionType . id != T_null ) { TypeBinding unboxedType = env . computeBoxingType ( lhsType ) ; if ( unboxedType != lhsType ) { lhsType = unboxedType ; unboxedLhs = true ; } } if ( ! expressionType . isBaseType ( ) && lhsType . id != T_JavaLangString && lhsType . id != T_null ) { expressionType = env . computeBoxingType ( expressionType ) ; } } if ( restrainUsageToNumericTypes ( ) && ! lhsType . isNumericType ( ) ) { scope . problemReporter ( ) . operatorOnlyValidOnNumericType ( this , lhsType , expressionType ) ; return null ; } int lhsID = lhsType . id ; int expressionID = expressionType . id ; if ( lhsID > <NUM_LIT:15> || expressionID > <NUM_LIT:15> ) { if ( lhsID != T_JavaLangString ) { scope . problemReporter ( ) . invalidOperator ( this , lhsType , expressionType ) ; return null ; } expressionID = T_JavaLangObject ; } int result = OperatorExpression . OperatorSignatures [ this . operator ] [ ( lhsID << <NUM_LIT:4> ) + expressionID ] ; if ( result == T_undefined ) { scope . problemReporter ( ) . invalidOperator ( this , lhsType , expressionType ) ; return null ; } if ( this . operator == PLUS ) { if ( lhsID == T_JavaLangObject && ( scope . compilerOptions ( ) . complianceLevel < ClassFileConstants . JDK1_7 ) ) { scope . problemReporter ( ) . invalidOperator ( this , lhsType , expressionType ) ; return null ; } else { if ( ( lhsType . isNumericType ( ) || lhsID == T_boolean ) && ! expressionType . isNumericType ( ) ) { scope . problemReporter ( ) . invalidOperator ( this , lhsType , expressionType ) ; return null ; } } } TypeBinding resultType = TypeBinding . wellKnownType ( scope , result & <NUM_LIT> ) ; if ( checkCastCompatibility ( ) ) { if ( originalLhsType . id != T_JavaLangString && resultType . id != T_JavaLangString ) { if ( ! checkCastTypesCompatibility ( scope , originalLhsType , resultType , null ) ) { scope . problemReporter ( ) . invalidOperator ( this , originalLhsType , expressionType ) ; return null ; } } } this . lhs . computeConversion ( scope , TypeBinding . wellKnownType ( scope , ( result > > > <NUM_LIT:16> ) & <NUM_LIT> ) , originalLhsType ) ; this . expression . computeConversion ( scope , TypeBinding . wellKnownType ( scope , ( result > > > <NUM_LIT:8> ) & <NUM_LIT> ) , originalExpressionType ) ; this . preAssignImplicitConversion = ( unboxedLhs ? BOXING : <NUM_LIT:0> ) | ( lhsID << <NUM_LIT:4> ) | ( result & <NUM_LIT> ) ; if ( unboxedLhs ) scope . problemReporter ( ) . autoboxing ( this , lhsType , originalLhsType ) ; if ( expressionIsCast ) CastExpression . checkNeedForArgumentCasts ( scope , this . operator , result , this . lhs , originalLhsType . id , false , this . expression , originalExpressionType . id , true ) ; return this . resolvedType = originalLhsType ; } public boolean restrainUsageToNumericTypes ( ) { return false ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . lhs . traverse ( visitor , scope ) ; this . expression . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . BranchLabel ; import org . eclipse . jdt . internal . compiler . impl . BooleanConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class TrueLiteral extends MagicLiteral { static final char [ ] source = { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT:e>' } ; public TrueLiteral ( int s , int e ) { super ( s , e ) ; } public void computeConstant ( ) { this . constant = BooleanConstant . fromValue ( true ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . goto_ ( trueLabel ) ; } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . BOOLEAN ; } public char [ ] source ( ) { return source ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; public abstract class NumberLiteral extends Literal { char [ ] source ; public NumberLiteral ( char [ ] token , int s , int e ) { this ( s , e ) ; this . source = token ; } public NumberLiteral ( int s , int e ) { super ( s , e ) ; } public boolean isValidJavaStatement ( ) { return false ; } public char [ ] source ( ) { return this . source ; } protected static char [ ] removePrefixZerosAndUnderscores ( char [ ] token , boolean isLong ) { int max = token . length ; int start = <NUM_LIT:0> ; int end = max - <NUM_LIT:1> ; if ( isLong ) { end -- ; } if ( max > <NUM_LIT:1> && token [ <NUM_LIT:0> ] == '<CHAR_LIT:0>' ) { if ( max > <NUM_LIT:2> && ( token [ <NUM_LIT:1> ] == '<CHAR_LIT>' || token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { start = <NUM_LIT:2> ; } else if ( max > <NUM_LIT:2> && ( token [ <NUM_LIT:1> ] == '<CHAR_LIT:b>' || token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { start = <NUM_LIT:2> ; } else { start = <NUM_LIT:1> ; } } boolean modified = false ; boolean ignore = true ; loop : for ( int i = start ; i < max ; i ++ ) { char currentChar = token [ i ] ; switch ( currentChar ) { case '<CHAR_LIT:0>' : if ( ignore && ! modified && ( i < end ) ) { modified = true ; } break ; case '<CHAR_LIT:_>' : modified = true ; break loop ; default : ignore = false ; } } if ( ! modified ) { return token ; } ignore = true ; StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( token , <NUM_LIT:0> , start ) ; loop : for ( int i = start ; i < max ; i ++ ) { char currentChar = token [ i ] ; switch ( currentChar ) { case '<CHAR_LIT:0>' : if ( ignore && ( i < end ) ) { continue loop ; } break ; case '<CHAR_LIT:_>' : continue loop ; default : ignore = false ; } buffer . append ( currentChar ) ; } return buffer . toString ( ) . toCharArray ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . 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 . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class QualifiedAllocationExpression extends AllocationExpression { public Expression enclosingInstance ; public TypeDeclaration anonymousType ; public QualifiedAllocationExpression ( ) { } public QualifiedAllocationExpression ( TypeDeclaration anonymousType ) { this . anonymousType = anonymousType ; anonymousType . allocation = this ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . enclosingInstance != null ) { flowInfo = this . enclosingInstance . analyseCode ( currentScope , flowContext , flowInfo ) ; } checkCapturedLocalInitializationIfNecessary ( ( ReferenceBinding ) ( this . anonymousType == null ? this . binding . declaringClass . erasure ( ) : this . binding . declaringClass . superclass ( ) . erasure ( ) ) , currentScope , flowInfo ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { flowInfo = this . arguments [ i ] . analyseCode ( currentScope , flowContext , flowInfo ) ; if ( ( this . arguments [ i ] . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . arguments [ i ] . checkNPE ( currentScope , flowContext , flowInfo ) ; } } } if ( this . anonymousType != null ) { flowInfo = this . anonymousType . analyseCode ( currentScope , flowContext , flowInfo ) ; } ReferenceBinding [ ] thrownExceptions ; if ( ( ( thrownExceptions = this . binding . thrownExceptions ) . length ) != <NUM_LIT:0> ) { if ( ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) { thrownExceptions = currentScope . environment ( ) . convertToRawTypes ( this . binding . thrownExceptions , true , true ) ; } flowContext . checkExceptionHandlers ( thrownExceptions , this , flowInfo . unconditionalCopy ( ) , currentScope ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; manageSyntheticAccessIfNecessary ( currentScope , flowInfo ) ; return flowInfo ; } public Expression enclosingInstance ( ) { return this . enclosingInstance ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { if ( ! valueRequired ) currentScope . problemReporter ( ) . unusedObjectAllocation ( this ) ; int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding allocatedType = codegenBinding . declaringClass ; codeStream . new_ ( allocatedType ) ; boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( valueRequired || isUnboxing ) { codeStream . dup ( ) ; } if ( this . type != null ) { codeStream . recordPositionsFrom ( pc , this . type . sourceStart ) ; } else { codeStream . ldc ( String . valueOf ( this . enumConstant . name ) ) ; codeStream . generateInlinedValue ( this . enumConstant . binding . id ) ; } if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticEnclosingInstanceValues ( currentScope , allocatedType , enclosingInstance ( ) , this ) ; } generateArguments ( this . binding , this . arguments , currentScope , codeStream ) ; if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticOuterArgumentValues ( currentScope , allocatedType , this ) ; } if ( this . syntheticAccessor == null ) { codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , null ) ; } else { for ( int i = <NUM_LIT:0> , max = this . syntheticAccessor . parameters . length - codegenBinding . parameters . length ; i < max ; i ++ ) { codeStream . aconst_null ( ) ; } codeStream . invoke ( Opcodes . OPC_invokespecial , this . syntheticAccessor , null ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else if ( isUnboxing ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( postConversionType ( currentScope ) . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; if ( this . anonymousType != null ) { this . anonymousType . generateCode ( currentScope , codeStream ) ; } } public boolean isSuperAccess ( ) { return this . anonymousType != null ; } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { ReferenceBinding allocatedTypeErasure = ( ReferenceBinding ) this . binding . declaringClass . erasure ( ) ; if ( allocatedTypeErasure . isNestedType ( ) && currentScope . enclosingSourceType ( ) . isLocalType ( ) ) { if ( allocatedTypeErasure . isLocalType ( ) ) { ( ( LocalTypeBinding ) allocatedTypeErasure ) . addInnerEmulationDependent ( currentScope , this . enclosingInstance != null ) ; } else { currentScope . propagateInnerEmulation ( allocatedTypeErasure , this . enclosingInstance != null ) ; } } } } public StringBuffer printExpression ( int indent , StringBuffer output ) { if ( this . enclosingInstance != null ) this . enclosingInstance . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:.>' ) ; super . printExpression ( <NUM_LIT:0> , output ) ; if ( this . anonymousType != null ) { this . anonymousType . print ( indent , output ) ; } return output ; } public TypeBinding resolveType ( BlockScope scope ) { if ( this . anonymousType == null && this . enclosingInstance == null ) { return super . resolveType ( scope ) ; } this . constant = Constant . NotAConstant ; TypeBinding enclosingInstanceType = null ; ReferenceBinding enclosingInstanceReference = null ; TypeBinding receiverType = null ; boolean hasError = false ; boolean enclosingInstanceContainsCast = false ; boolean argsContainCast = false ; if ( this . enclosingInstance != null ) { if ( this . enclosingInstance instanceof CastExpression ) { this . enclosingInstance . bits |= ASTNode . DisableUnnecessaryCastCheck ; enclosingInstanceContainsCast = true ; } if ( ( enclosingInstanceType = this . enclosingInstance . resolveType ( scope ) ) == null ) { hasError = true ; } else if ( enclosingInstanceType . isBaseType ( ) || enclosingInstanceType . isArrayType ( ) ) { scope . problemReporter ( ) . illegalPrimitiveOrArrayTypeForEnclosingInstance ( enclosingInstanceType , this . enclosingInstance ) ; hasError = true ; } else if ( this . type instanceof QualifiedTypeReference ) { scope . problemReporter ( ) . illegalUsageOfQualifiedTypeReference ( ( QualifiedTypeReference ) this . type ) ; hasError = true ; } else if ( ! ( enclosingInstanceReference = ( ReferenceBinding ) enclosingInstanceType ) . canBeSeenBy ( scope ) ) { enclosingInstanceType = new ProblemReferenceBinding ( enclosingInstanceReference . compoundName , enclosingInstanceReference , ProblemReasons . NotVisible ) ; scope . problemReporter ( ) . invalidType ( this . enclosingInstance , enclosingInstanceType ) ; hasError = true ; } else { receiverType = ( ( SingleTypeReference ) this . type ) . resolveTypeEnclosing ( scope , ( ReferenceBinding ) enclosingInstanceType ) ; if ( receiverType != null && enclosingInstanceContainsCast ) { CastExpression . checkNeedForEnclosingInstanceCast ( scope , this . enclosingInstance , enclosingInstanceType , receiverType ) ; } } } else { if ( this . type == null ) { receiverType = scope . enclosingSourceType ( ) ; } else { receiverType = this . type . resolveType ( scope , true ) ; checkParameterizedAllocation : { if ( receiverType == null || ! receiverType . isValidBinding ( ) ) break checkParameterizedAllocation ; if ( this . type instanceof ParameterizedQualifiedTypeReference ) { ReferenceBinding currentType = ( ReferenceBinding ) receiverType ; 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 , receiverType ) ; break ; } } } } } } if ( receiverType == null || ! receiverType . isValidBinding ( ) ) { hasError = true ; } final boolean isDiamond = this . type != null && ( this . type . bits & ASTNode . IsDiamond ) != <NUM_LIT:0> ; 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 ( isDiamond ) { scope . problemReporter ( ) . diamondNotWithExplicitTypeArguments ( this . typeArguments ) ; return null ; } 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 ; } } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; if ( this . arguments != null ) { 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 |= ASTNode . DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = argument . resolveType ( scope ) ) == null ) { hasError = true ; } } } if ( hasError ) { if ( isDiamond ) { return null ; } if ( receiverType instanceof ReferenceBinding ) { ReferenceBinding referenceReceiver = ( ReferenceBinding ) receiverType ; if ( receiverType . isValidBinding ( ) ) { int length = this . arguments == null ? <NUM_LIT:0> : this . arguments . length ; TypeBinding [ ] pseudoArgs = new TypeBinding [ length ] ; for ( int i = length ; -- i >= <NUM_LIT:0> ; ) { pseudoArgs [ i ] = argumentTypes [ i ] == null ? TypeBinding . NULL : argumentTypes [ i ] ; } this . binding = scope . findMethod ( referenceReceiver , TypeConstants . INIT , pseudoArgs , this ) ; if ( this . binding != null && ! this . binding . isValidBinding ( ) ) { MethodBinding closestMatch = ( ( ProblemMethodBinding ) this . binding ) . closestMatch ; if ( closestMatch != null ) { if ( closestMatch . original ( ) . typeVariables != Binding . NO_TYPE_VARIABLES ) { closestMatch = scope . environment ( ) . createParameterizedGenericMethod ( closestMatch . original ( ) , ( RawTypeBinding ) null ) ; } this . binding = closestMatch ; MethodBinding closestMatchOriginal = closestMatch . original ( ) ; if ( closestMatchOriginal . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInMethod ( closestMatchOriginal ) ) { closestMatchOriginal . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } } } if ( this . anonymousType != null ) { scope . addAnonymousType ( this . anonymousType , referenceReceiver ) ; this . anonymousType . resolve ( scope ) ; return this . resolvedType = this . anonymousType . binding ; } } return this . resolvedType = receiverType ; } if ( this . anonymousType == null ) { if ( ! receiverType . canBeInstantiated ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , receiverType ) ; return this . resolvedType = receiverType ; } if ( isDiamond ) { TypeBinding [ ] inferredTypes = inferElidedTypes ( ( ( ParameterizedTypeBinding ) receiverType ) . genericType ( ) , receiverType . enclosingType ( ) , argumentTypes , scope ) ; if ( inferredTypes == null ) { scope . problemReporter ( ) . cannotInferElidedTypes ( this ) ; return this . resolvedType = null ; } receiverType = this . type . resolvedType = scope . environment ( ) . createParameterizedType ( ( ( ParameterizedTypeBinding ) receiverType ) . genericType ( ) , inferredTypes , ( ( ParameterizedTypeBinding ) receiverType ) . enclosingType ( ) ) ; } ReferenceBinding allocationType = ( ReferenceBinding ) receiverType ; if ( ( this . binding = scope . getConstructor ( allocationType , argumentTypes , this ) ) . isValidBinding ( ) ) { if ( isMethodUseDeprecated ( this . binding , scope , true ) ) { scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; } if ( checkInvocationArguments ( scope , null , allocationType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } if ( this . typeArguments != null && this . binding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( this . binding , this . genericTypeArguments , this . typeArguments ) ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocationType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType = receiverType ; } if ( ( this . binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . missingTypeInConstructor ( this , this . binding ) ; } if ( ! isDiamond && receiverType . isParameterizedTypeWithActualArguments ( ) ) { checkTypeArgumentRedundancy ( ( ParameterizedTypeBinding ) receiverType , receiverType . enclosingType ( ) , argumentTypes , scope ) ; } ReferenceBinding expectedType = this . binding . declaringClass . enclosingType ( ) ; if ( expectedType != enclosingInstanceType ) scope . compilationUnitScope ( ) . recordTypeConversion ( expectedType , enclosingInstanceType ) ; if ( enclosingInstanceType . isCompatibleWith ( expectedType ) || scope . isBoxingCompatibleWith ( enclosingInstanceType , expectedType ) ) { this . enclosingInstance . computeConversion ( scope , expectedType , enclosingInstanceType ) ; return this . resolvedType = receiverType ; } scope . problemReporter ( ) . typeMismatchError ( enclosingInstanceType , expectedType , this . enclosingInstance , null ) ; return this . resolvedType = receiverType ; } else { if ( isDiamond ) { scope . problemReporter ( ) . diamondNotWithAnoymousClasses ( this . type ) ; return null ; } } ReferenceBinding superType = ( ReferenceBinding ) receiverType ; if ( superType . isTypeVariable ( ) ) { superType = new ProblemReferenceBinding ( new char [ ] [ ] { superType . sourceName ( ) } , superType , ProblemReasons . IllegalSuperTypeVariable ) ; scope . problemReporter ( ) . invalidType ( this , superType ) ; return null ; } else if ( this . type != null && superType . isEnum ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , superType ) ; return this . resolvedType = superType ; } ReferenceBinding anonymousSuperclass = superType . isInterface ( ) ? scope . getJavaLangObject ( ) : superType ; scope . addAnonymousType ( this . anonymousType , superType ) ; this . anonymousType . resolve ( scope ) ; this . resolvedType = this . anonymousType . binding ; if ( ( this . resolvedType . tagBits & TagBits . HierarchyHasProblems ) != <NUM_LIT:0> ) { return null ; } MethodBinding inheritedBinding = scope . getConstructor ( anonymousSuperclass , argumentTypes , this ) ; if ( ! inheritedBinding . isValidBinding ( ) ) { if ( inheritedBinding . declaringClass == null ) { inheritedBinding . declaringClass = anonymousSuperclass ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , inheritedBinding ) ; return this . resolvedType ; } if ( ( inheritedBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . missingTypeInConstructor ( this , inheritedBinding ) ; } if ( this . enclosingInstance != null ) { ReferenceBinding targetEnclosing = inheritedBinding . declaringClass . enclosingType ( ) ; if ( targetEnclosing == null ) { scope . problemReporter ( ) . unnecessaryEnclosingInstanceSpecification ( this . enclosingInstance , superType ) ; return this . resolvedType ; } else if ( ! enclosingInstanceType . isCompatibleWith ( targetEnclosing ) && ! scope . isBoxingCompatibleWith ( enclosingInstanceType , targetEnclosing ) ) { scope . problemReporter ( ) . typeMismatchError ( enclosingInstanceType , targetEnclosing , this . enclosingInstance , null ) ; return this . resolvedType ; } this . enclosingInstance . computeConversion ( scope , targetEnclosing , enclosingInstanceType ) ; } if ( this . arguments != null ) { if ( checkInvocationArguments ( scope , null , anonymousSuperclass , inheritedBinding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } } if ( this . typeArguments != null && inheritedBinding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( inheritedBinding , this . genericTypeArguments , this . typeArguments ) ; } this . binding = this . anonymousType . createDefaultConstructorWithBinding ( inheritedBinding , ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) ; return this . resolvedType ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . enclosingInstance != null ) this . enclosingInstance . traverse ( visitor , scope ) ; if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , typeArgumentsLength = this . typeArguments . length ; i < typeArgumentsLength ; i ++ ) { this . typeArguments [ i ] . traverse ( visitor , scope ) ; } } if ( this . type != null ) this . type . traverse ( visitor , scope ) ; if ( this . arguments != null ) { int argumentsLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } if ( this . anonymousType != null ) this . anonymousType . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class DoStatement extends Statement { public Expression condition ; public Statement action ; private BranchLabel breakLabel , continueLabel ; int mergedInitStateIndex = - <NUM_LIT:1> ; int preConditionInitStateIndex = - <NUM_LIT:1> ; public DoStatement ( Expression condition , Statement action , int sourceStart , int sourceEnd ) { this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; this . condition = condition ; this . action = action ; if ( action instanceof EmptyStatement ) action . bits |= ASTNode . IsUsefulEmptyStatement ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . breakLabel = new BranchLabel ( ) ; this . continueLabel = new BranchLabel ( ) ; LoopingFlowContext loopingContext = new LoopingFlowContext ( flowContext , flowInfo , this , this . breakLabel , this . continueLabel , currentScope ) ; Constant cst = this . condition . constant ; boolean isConditionTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; int previousMode = flowInfo . reachMode ( ) ; FlowInfo initsOnCondition = flowInfo ; UnconditionalFlowInfo actionInfo = flowInfo . nullInfoLessUnconditionalCopy ( ) ; if ( ( this . action != null ) && ! this . action . isEmptyBlock ( ) ) { actionInfo = this . action . analyseCode ( currentScope , loopingContext , actionInfo ) . unconditionalInits ( ) ; if ( ( actionInfo . tagBits & loopingContext . initsOnContinue . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) { this . continueLabel = null ; } if ( ( this . condition . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { initsOnCondition = flowInfo . unconditionalInits ( ) . addInitializationsFrom ( actionInfo . mergedWith ( loopingContext . initsOnContinue ) ) ; } } if ( ( this . condition . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . condition . checkNPE ( currentScope , flowContext , initsOnCondition ) ; } actionInfo . setReachMode ( previousMode ) ; LoopingFlowContext condLoopContext ; FlowInfo condInfo = this . condition . analyseCode ( currentScope , ( condLoopContext = new LoopingFlowContext ( flowContext , flowInfo , this , null , null , currentScope ) ) , ( this . action == null ? actionInfo : ( actionInfo . mergedWith ( loopingContext . initsOnContinue ) ) ) . copy ( ) ) ; this . preConditionInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( actionInfo . mergedWith ( loopingContext . initsOnContinue ) ) ; if ( ! isConditionOptimizedFalse && this . continueLabel != null ) { loopingContext . complainOnDeferredFinalChecks ( currentScope , condInfo ) ; condLoopContext . complainOnDeferredFinalChecks ( currentScope , condInfo ) ; loopingContext . complainOnDeferredNullChecks ( currentScope , flowInfo . unconditionalCopy ( ) . addPotentialNullInfoFrom ( condInfo . initsWhenTrue ( ) . unconditionalInits ( ) ) ) ; condLoopContext . complainOnDeferredNullChecks ( currentScope , actionInfo . addPotentialNullInfoFrom ( condInfo . initsWhenTrue ( ) . unconditionalInits ( ) ) ) ; } if ( loopingContext . hasEscapingExceptions ( ) ) { FlowInfo loopbackFlowInfo = flowInfo . copy ( ) ; loopbackFlowInfo . mergedWith ( condInfo . initsWhenTrue ( ) . unconditionalCopy ( ) ) ; loopingContext . simulateThrowAfterLoopBack ( loopbackFlowInfo ) ; } FlowInfo mergedInfo = FlowInfo . mergedOptimizedBranches ( ( loopingContext . initsOnBreak . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? loopingContext . initsOnBreak : flowInfo . unconditionalCopy ( ) . addInitializationsFrom ( loopingContext . initsOnBreak ) , isConditionOptimizedTrue , ( condInfo . tagBits & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ? flowInfo . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) : condInfo , false , ! isConditionTrue ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; BranchLabel actionLabel = new BranchLabel ( codeStream ) ; if ( this . action != null ) actionLabel . tagBits |= BranchLabel . USED ; actionLabel . place ( ) ; this . breakLabel . initialize ( codeStream ) ; boolean hasContinueLabel = this . continueLabel != null ; if ( hasContinueLabel ) { this . continueLabel . initialize ( codeStream ) ; } if ( this . action != null ) { this . action . generateCode ( currentScope , codeStream ) ; } if ( hasContinueLabel ) { this . continueLabel . place ( ) ; if ( this . preConditionInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preConditionInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . preConditionInitStateIndex ) ; } Constant cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; if ( isConditionOptimizedFalse ) { this . condition . generateCode ( currentScope , codeStream , false ) ; } else { this . condition . generateOptimizedBoolean ( currentScope , codeStream , actionLabel , null , true ) ; } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } if ( this . breakLabel . forwardReferenceCount ( ) > <NUM_LIT:0> ) { this . breakLabel . place ( ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; if ( this . action == null ) output . append ( "<STR_LIT>" ) ; else { output . append ( '<STR_LIT:\n>' ) ; this . action . printStatement ( indent + <NUM_LIT:1> , output ) . append ( '<STR_LIT:\n>' ) ; } output . append ( "<STR_LIT>" ) ; return this . condition . printExpression ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; } public void resolve ( BlockScope scope ) { TypeBinding type = this . condition . resolveTypeExpecting ( scope , TypeBinding . BOOLEAN ) ; this . condition . computeConversion ( scope , type , type ) ; if ( this . action != null ) this . action . resolve ( scope ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . action != null ) { this . action . traverse ( visitor , scope ) ; } this . condition . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; 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 . problem . ProblemSeverities ; public abstract class TypeReference extends Expression { public static final TypeReference [ ] NO_TYPE_ARGUMENTS = new TypeReference [ <NUM_LIT:0> ] ; public static final TypeReference baseTypeReference ( int baseType , int dim ) { if ( dim == <NUM_LIT:0> ) { switch ( baseType ) { case ( TypeIds . T_void ) : return new SingleTypeReference ( TypeBinding . VOID . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_boolean ) : return new SingleTypeReference ( TypeBinding . BOOLEAN . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_char ) : return new SingleTypeReference ( TypeBinding . CHAR . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_float ) : return new SingleTypeReference ( TypeBinding . FLOAT . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_double ) : return new SingleTypeReference ( TypeBinding . DOUBLE . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_byte ) : return new SingleTypeReference ( TypeBinding . BYTE . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_short ) : return new SingleTypeReference ( TypeBinding . SHORT . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_int ) : return new SingleTypeReference ( TypeBinding . INT . simpleName , <NUM_LIT:0> ) ; default : return new SingleTypeReference ( TypeBinding . LONG . simpleName , <NUM_LIT:0> ) ; } } switch ( baseType ) { case ( TypeIds . T_void ) : return new ArrayTypeReference ( TypeBinding . VOID . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_boolean ) : return new ArrayTypeReference ( TypeBinding . BOOLEAN . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_char ) : return new ArrayTypeReference ( TypeBinding . CHAR . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_float ) : return new ArrayTypeReference ( TypeBinding . FLOAT . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_double ) : return new ArrayTypeReference ( TypeBinding . DOUBLE . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_byte ) : return new ArrayTypeReference ( TypeBinding . BYTE . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_short ) : return new ArrayTypeReference ( TypeBinding . SHORT . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_int ) : return new ArrayTypeReference ( TypeBinding . INT . simpleName , dim , <NUM_LIT:0> ) ; default : return new ArrayTypeReference ( TypeBinding . LONG . simpleName , dim , <NUM_LIT:0> ) ; } } public void aboutToResolve ( Scope scope ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public void checkBounds ( Scope scope ) { } public abstract TypeReference copyDims ( int dim ) ; public int dimensions ( ) { return <NUM_LIT:0> ; } public abstract char [ ] getLastToken ( ) ; public char [ ] [ ] getParameterizedTypeName ( ) { return getTypeName ( ) ; } protected abstract TypeBinding getTypeBinding ( Scope scope ) ; public abstract char [ ] [ ] getTypeName ( ) ; protected TypeBinding internalResolveType ( Scope scope ) { this . constant = Constant . NotAConstant ; if ( this . resolvedType != null ) { if ( this . resolvedType . isValidBinding ( ) ) { return this . resolvedType ; } else { switch ( this . resolvedType . problemId ( ) ) { case ProblemReasons . NotFound : case ProblemReasons . NotVisible : case ProblemReasons . InheritedNameHidesEnclosingName : TypeBinding type = this . resolvedType . closestMatch ( ) ; if ( type == null ) return null ; return scope . environment ( ) . convertToRawType ( type , false ) ; default : return null ; } } } boolean hasError ; TypeBinding type = this . resolvedType = getTypeBinding ( scope ) ; if ( type == null ) { return null ; } else if ( ( hasError = ! type . isValidBinding ( ) ) == true ) { reportInvalidType ( scope ) ; switch ( type . problemId ( ) ) { case ProblemReasons . NotFound : case ProblemReasons . NotVisible : case ProblemReasons . InheritedNameHidesEnclosingName : type = type . closestMatch ( ) ; if ( type == null ) return null ; break ; default : return null ; } } if ( type . isArrayType ( ) && ( ( ArrayBinding ) type ) . leafComponentType == TypeBinding . VOID ) { scope . problemReporter ( ) . cannotAllocateVoidArray ( this ) ; return null ; } if ( ! ( this instanceof QualifiedTypeReference ) && isTypeUseDeprecated ( type , scope ) ) { reportDeprecatedType ( type , scope ) ; } type = scope . environment ( ) . convertToRawType ( type , false ) ; if ( type . leafComponentType ( ) . isRawType ( ) && ( this . bits & ASTNode . IgnoreRawTypeCheck ) == <NUM_LIT:0> && scope . compilerOptions ( ) . getSeverity ( CompilerOptions . RawTypeReference ) != ProblemSeverities . Ignore ) { scope . problemReporter ( ) . rawTypeReference ( this , type ) ; } if ( hasError ) { return type ; } return this . resolvedType = type ; } public boolean isTypeReference ( ) { return true ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope , int index ) { scope . problemReporter ( ) . deprecatedType ( type , this , index ) ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope ) { scope . problemReporter ( ) . deprecatedType ( type , this , Integer . MAX_VALUE ) ; } protected void reportInvalidType ( Scope scope ) { if ( scope != null ) { CompilationUnitScope cuScope = scope . compilationUnitScope ( ) ; if ( ! cuScope . reportInvalidType ( this , this . resolvedType ) ) { return ; } } scope . problemReporter ( ) . invalidType ( this , this . resolvedType ) ; } public TypeBinding resolveSuperType ( ClassScope scope ) { TypeBinding superType = resolveType ( scope ) ; if ( superType == null ) return null ; if ( superType . isTypeVariable ( ) ) { if ( this . resolvedType . isValidBinding ( ) ) { this . resolvedType = new ProblemReferenceBinding ( getTypeName ( ) , ( ReferenceBinding ) this . resolvedType , ProblemReasons . IllegalSuperTypeVariable ) ; reportInvalidType ( scope ) ; } return null ; } return superType ; } public final TypeBinding resolveType ( BlockScope blockScope ) { return resolveType ( blockScope , true ) ; } public TypeBinding resolveType ( BlockScope scope , boolean checkBounds ) { return internalResolveType ( scope ) ; } public TypeBinding resolveType ( ClassScope scope ) { return internalResolveType ( scope ) ; } public TypeBinding resolveTypeArgument ( BlockScope blockScope , ReferenceBinding genericType , int rank ) { return resolveType ( blockScope , true ) ; } public TypeBinding resolveTypeArgument ( ClassScope classScope , ReferenceBinding genericType , int rank ) { ReferenceBinding ref = classScope . referenceContext . binding ; boolean pauseHierarchyCheck = false ; try { if ( ref . isHierarchyBeingConnected ( ) ) { ref . tagBits |= TagBits . PauseHierarchyCheck ; pauseHierarchyCheck = true ; } return resolveType ( classScope ) ; } finally { if ( pauseHierarchyCheck ) { ref . tagBits &= ~ TagBits . PauseHierarchyCheck ; } } } public abstract void traverse ( ASTVisitor visitor , BlockScope scope ) ; public abstract void traverse ( ASTVisitor visitor , ClassScope scope ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class MarkerAnnotation extends Annotation { public MarkerAnnotation ( TypeReference type , int sourceStart ) { this . type = type ; this . sourceStart = sourceStart ; this . sourceEnd = type . sourceEnd ; } public MemberValuePair [ ] memberValuePairs ( ) { return NoValuePairs ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . parser . * ; import org . eclipse . jdt . internal . compiler . problem . * ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ConstructorDeclaration extends AbstractMethodDeclaration { public ExplicitConstructorCall constructorCall ; public TypeParameter [ ] typeParameters ; public ConstructorDeclaration ( CompilationResult compilationResult ) { super ( compilationResult ) ; } public void analyseCode ( ClassScope classScope , InitializationFlowContext initializerFlowContext , FlowInfo flowInfo ) { analyseCode ( classScope , initializerFlowContext , flowInfo , FlowInfo . REACHABLE ) ; } public void analyseCode ( ClassScope classScope , InitializationFlowContext initializerFlowContext , FlowInfo flowInfo , int initialReachMode ) { if ( this . ignoreFurtherInvestigation ) return ; int nonStaticFieldInfoReachMode = flowInfo . reachMode ( ) ; flowInfo . setReachMode ( initialReachMode ) ; checkUnused : { MethodBinding constructorBinding ; if ( ( constructorBinding = this . binding ) == null ) break checkUnused ; if ( ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) break checkUnused ; if ( constructorBinding . isUsed ( ) ) break checkUnused ; if ( constructorBinding . isPrivate ( ) ) { if ( ( this . binding . declaringClass . tagBits & TagBits . HasNonPrivateConstructor ) == <NUM_LIT:0> ) break checkUnused ; } else if ( ! constructorBinding . isOrEnclosedByPrivateType ( ) ) { break checkUnused ; } if ( this . constructorCall == null ) break checkUnused ; if ( this . constructorCall . accessMode != ExplicitConstructorCall . This ) { ReferenceBinding superClass = constructorBinding . declaringClass . superclass ( ) ; if ( superClass == null ) break checkUnused ; MethodBinding methodBinding = superClass . getExactConstructor ( Binding . NO_PARAMETERS ) ; if ( methodBinding == null ) break checkUnused ; if ( ! methodBinding . canBeSeenBy ( SuperReference . implicitSuperConstructorCall ( ) , this . scope ) ) break checkUnused ; } this . scope . problemReporter ( ) . unusedPrivateConstructor ( this ) ; } if ( isRecursive ( null ) ) { this . scope . problemReporter ( ) . recursiveConstructorInvocation ( this . constructorCall ) ; } try { ExceptionHandlingFlowContext constructorContext = new ExceptionHandlingFlowContext ( initializerFlowContext . parent , this , this . binding . thrownExceptions , initializerFlowContext , this . scope , FlowInfo . DEAD_END ) ; initializerFlowContext . checkInitializerExceptions ( this . scope , constructorContext , flowInfo ) ; if ( this . binding . declaringClass . isAnonymousType ( ) ) { ArrayList computedExceptions = constructorContext . extendedExceptions ; if ( computedExceptions != null ) { int size ; if ( ( size = computedExceptions . size ( ) ) > <NUM_LIT:0> ) { ReferenceBinding [ ] actuallyThrownExceptions ; computedExceptions . toArray ( actuallyThrownExceptions = new ReferenceBinding [ size ] ) ; this . binding . thrownExceptions = actuallyThrownExceptions ; } } } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { flowInfo . markAsDefinitelyAssigned ( this . arguments [ i ] . binding ) ; } } if ( this . constructorCall != null ) { if ( this . constructorCall . accessMode == ExplicitConstructorCall . This ) { FieldBinding [ ] fields = this . binding . declaringClass . fields ( ) ; for ( int i = <NUM_LIT:0> , count = fields . length ; i < count ; i ++ ) { FieldBinding field ; if ( ! ( field = fields [ i ] ) . isStatic ( ) ) { flowInfo . markAsDefinitelyAssigned ( field ) ; } } } flowInfo = this . constructorCall . analyseCode ( this . scope , constructorContext , flowInfo ) ; } flowInfo . setReachMode ( nonStaticFieldInfoReachMode ) ; if ( this . statements != null ) { int complaintLevel = ( nonStaticFieldInfoReachMode & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ? Statement . NOT_COMPLAINED : Statement . COMPLAINED_FAKE_REACHABLE ; for ( int i = <NUM_LIT:0> , count = this . statements . length ; i < count ; i ++ ) { Statement stat = this . statements [ i ] ; if ( ( complaintLevel = stat . complainIfUnreachable ( flowInfo , this . scope , complaintLevel ) ) < Statement . COMPLAINED_UNREACHABLE ) { flowInfo = stat . analyseCode ( this . scope , constructorContext , flowInfo ) ; } } } if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . NeedFreeReturn ; } if ( ( this . constructorCall != null ) && ( this . constructorCall . accessMode != ExplicitConstructorCall . This ) ) { flowInfo = flowInfo . mergedWith ( constructorContext . initsOnReturn ) ; FieldBinding [ ] fields = this . binding . declaringClass . fields ( ) ; for ( int i = <NUM_LIT:0> , count = fields . length ; i < count ; i ++ ) { FieldBinding field ; if ( ( ! ( field = fields [ i ] ) . isStatic ( ) ) && field . isFinal ( ) && ( ! flowInfo . isDefinitelyAssigned ( fields [ i ] ) ) ) { this . scope . problemReporter ( ) . uninitializedBlankFinalField ( field , ( ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) ? ( ASTNode ) this . scope . referenceType ( ) : this ) ; } } } constructorContext . complainIfUnusedExceptionHandlers ( this ) ; this . scope . checkUnusedParameters ( this . binding ) ; } catch ( AbortMethod e ) { this . ignoreFurtherInvestigation = true ; } } public void generateCode ( ClassScope classScope , ClassFile classFile ) { int problemResetPC = <NUM_LIT:0> ; if ( this . ignoreFurtherInvestigation ) { if ( this . binding == null ) return ; int problemsLength ; CategorizedProblem [ ] problems = this . scope . referenceCompilationUnit ( ) . compilationResult . getProblems ( ) ; CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; classFile . addProblemConstructor ( this , this . binding , problemsCopy ) ; return ; } boolean restart = false ; boolean abort = false ; do { try { problemResetPC = classFile . contentsOffset ; internalGenerateCode ( classScope , classFile ) ; restart = false ; } catch ( AbortMethod e ) { if ( e . compilationResult == CodeStream . RESTART_IN_WIDE_MODE ) { classFile . contentsOffset = problemResetPC ; classFile . methodCount -- ; classFile . codeStream . resetInWideMode ( ) ; restart = true ; } else if ( e . compilationResult == CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE ) { classFile . contentsOffset = problemResetPC ; classFile . methodCount -- ; classFile . codeStream . resetForCodeGenUnusedLocals ( ) ; restart = true ; } else { restart = false ; abort = true ; } } } while ( restart ) ; if ( abort ) { int problemsLength ; CategorizedProblem [ ] problems = this . scope . referenceCompilationUnit ( ) . compilationResult . getAllProblems ( ) ; CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; classFile . addProblemConstructor ( this , this . binding , problemsCopy , problemResetPC ) ; } } public void generateSyntheticFieldInitializationsIfNecessary ( MethodScope methodScope , CodeStream codeStream , ReferenceBinding declaringClass ) { if ( ! declaringClass . isNestedType ( ) ) return ; NestedTypeBinding nestedType = ( NestedTypeBinding ) declaringClass ; SyntheticArgumentBinding [ ] syntheticArgs = nestedType . syntheticEnclosingInstances ( ) ; if ( syntheticArgs != null ) { for ( int i = <NUM_LIT:0> , max = syntheticArgs . length ; i < max ; i ++ ) { SyntheticArgumentBinding syntheticArg ; if ( ( syntheticArg = syntheticArgs [ i ] ) . matchingField != null ) { codeStream . aload_0 ( ) ; codeStream . load ( syntheticArg ) ; codeStream . fieldAccess ( Opcodes . OPC_putfield , syntheticArg . matchingField , null ) ; } } } syntheticArgs = nestedType . syntheticOuterLocalVariables ( ) ; if ( syntheticArgs != null ) { for ( int i = <NUM_LIT:0> , max = syntheticArgs . length ; i < max ; i ++ ) { SyntheticArgumentBinding syntheticArg ; if ( ( syntheticArg = syntheticArgs [ i ] ) . matchingField != null ) { codeStream . aload_0 ( ) ; codeStream . load ( syntheticArg ) ; codeStream . fieldAccess ( Opcodes . OPC_putfield , syntheticArg . matchingField , null ) ; } } } } private void internalGenerateCode ( ClassScope classScope , ClassFile classFile ) { classFile . generateMethodInfoHeader ( this . binding ) ; int methodAttributeOffset = classFile . contentsOffset ; int attributeNumber = classFile . generateMethodInfoAttributes ( this . binding ) ; if ( ( ! this . binding . isNative ( ) ) && ( ! this . binding . isAbstract ( ) ) ) { TypeDeclaration declaringType = classScope . referenceContext ; int codeAttributeOffset = classFile . contentsOffset ; classFile . generateCodeAttributeHeader ( ) ; CodeStream codeStream = classFile . codeStream ; codeStream . reset ( this , classFile ) ; ReferenceBinding declaringClass = this . binding . declaringClass ; int enumOffset = declaringClass . isEnum ( ) ? <NUM_LIT:2> : <NUM_LIT:0> ; int argSlotSize = <NUM_LIT:1> + enumOffset ; if ( declaringClass . isNestedType ( ) ) { this . scope . extraSyntheticArguments = declaringClass . syntheticOuterLocalVariables ( ) ; this . scope . computeLocalVariablePositions ( declaringClass . getEnclosingInstancesSlotSize ( ) + <NUM_LIT:1> + enumOffset , codeStream ) ; argSlotSize += declaringClass . getEnclosingInstancesSlotSize ( ) ; argSlotSize += declaringClass . getOuterLocalVariablesSlotSize ( ) ; } else { this . scope . computeLocalVariablePositions ( <NUM_LIT:1> + enumOffset , codeStream ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { LocalVariableBinding argBinding ; codeStream . addVisibleLocalVariable ( argBinding = this . arguments [ i ] . binding ) ; argBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; switch ( argBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : argSlotSize += <NUM_LIT:2> ; break ; default : argSlotSize ++ ; break ; } } } MethodScope initializerScope = declaringType . initializerScope ; initializerScope . computeLocalVariablePositions ( argSlotSize , codeStream ) ; boolean needFieldInitializations = this . constructorCall == null || this . constructorCall . accessMode != ExplicitConstructorCall . This ; boolean preInitSyntheticFields = this . scope . compilerOptions ( ) . targetJDK >= ClassFileConstants . JDK1_4 ; if ( needFieldInitializations && preInitSyntheticFields ) { generateSyntheticFieldInitializationsIfNecessary ( this . scope , codeStream , declaringClass ) ; codeStream . recordPositionsFrom ( <NUM_LIT:0> , this . bodyStart ) ; } if ( this . constructorCall != null ) { this . constructorCall . generateCode ( this . scope , codeStream ) ; } if ( needFieldInitializations ) { if ( ! preInitSyntheticFields ) { generateSyntheticFieldInitializationsIfNecessary ( this . scope , codeStream , declaringClass ) ; } if ( declaringType . fields != null ) { for ( int i = <NUM_LIT:0> , max = declaringType . fields . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl ; if ( ! ( fieldDecl = declaringType . fields [ i ] ) . isStatic ( ) ) { fieldDecl . generateCode ( initializerScope , codeStream ) ; } } } } if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , max = this . statements . length ; i < max ; i ++ ) { this . statements [ i ] . generateCode ( this . scope , codeStream ) ; } } if ( this . ignoreFurtherInvestigation ) { throw new AbortMethod ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } if ( ( this . bits & ASTNode . NeedFreeReturn ) != <NUM_LIT:0> ) { codeStream . return_ ( ) ; } codeStream . exitUserScope ( this . scope ) ; codeStream . recordPositionsFrom ( <NUM_LIT:0> , this . bodyEnd ) ; try { classFile . completeCodeAttribute ( codeAttributeOffset ) ; } catch ( NegativeArraySizeException e ) { throw new AbortMethod ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } attributeNumber ++ ; if ( ( codeStream instanceof StackMapFrameCodeStream ) && needFieldInitializations && declaringType . fields != null ) { ( ( StackMapFrameCodeStream ) codeStream ) . resetSecretLocals ( ) ; } } classFile . completeMethodInfo ( this . binding , methodAttributeOffset , attributeNumber ) ; } public boolean isConstructor ( ) { return true ; } public boolean isDefaultConstructor ( ) { return ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ; } public boolean isInitializationMethod ( ) { return true ; } public boolean isRecursive ( ArrayList visited ) { if ( this . binding == null || this . constructorCall == null || this . constructorCall . binding == null || this . constructorCall . isSuperAccess ( ) || ! this . constructorCall . binding . isValidBinding ( ) ) { return false ; } ConstructorDeclaration targetConstructor = ( ( ConstructorDeclaration ) this . scope . referenceType ( ) . declarationOf ( this . constructorCall . binding . original ( ) ) ) ; if ( this == targetConstructor ) return true ; if ( visited == null ) { visited = new ArrayList ( <NUM_LIT:1> ) ; } else { int index = visited . indexOf ( this ) ; if ( index >= <NUM_LIT:0> ) return index == <NUM_LIT:0> ; } visited . add ( this ) ; return targetConstructor . isRecursive ( visited ) ; } public void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) { if ( ( ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) && this . constructorCall == null ) { this . constructorCall = SuperReference . implicitSuperConstructorCall ( ) ; this . constructorCall . sourceStart = this . sourceStart ; this . constructorCall . sourceEnd = this . sourceEnd ; return ; } parser . parse ( this , unit , false ) ; } public StringBuffer printBody ( int indent , StringBuffer output ) { output . append ( "<STR_LIT>" ) ; if ( this . constructorCall != null ) { output . append ( '<STR_LIT:\n>' ) ; this . constructorCall . printStatement ( indent , output ) ; } if ( this . statements != null ) { for ( int i = <NUM_LIT:0> ; i < this . statements . length ; i ++ ) { output . append ( '<STR_LIT:\n>' ) ; this . statements [ i ] . printStatement ( indent , output ) ; } } output . append ( '<STR_LIT:\n>' ) ; printIndent ( indent == <NUM_LIT:0> ? <NUM_LIT:0> : indent - <NUM_LIT:1> , output ) . append ( '<CHAR_LIT:}>' ) ; return output ; } public void resolveJavadoc ( ) { if ( this . binding == null || this . javadoc != null ) { super . resolveJavadoc ( ) ; } else if ( ( this . bits & ASTNode . IsDefaultConstructor ) == <NUM_LIT:0> ) { if ( this . binding . declaringClass != null && ! this . binding . declaringClass . isLocalType ( ) ) { int javadocVisibility = this . binding . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; ClassScope classScope = this . scope . classScope ( ) ; ProblemReporter reporter = this . scope . problemReporter ( ) ; int severity = reporter . computeSeverity ( IProblem . JavadocMissing ) ; if ( severity != ProblemSeverities . Ignore ) { if ( classScope != null ) { javadocVisibility = Util . computeOuterMostVisibility ( classScope . referenceType ( ) , javadocVisibility ) ; } int javadocModifiers = ( this . binding . modifiers & ~ ExtraCompilerModifiers . AccVisibilityMASK ) | javadocVisibility ; reporter . javadocMissing ( this . sourceStart , this . sourceEnd , severity , javadocModifiers ) ; } } } } public void resolveStatements ( ) { SourceTypeBinding sourceType = this . scope . enclosingSourceType ( ) ; if ( ! CharOperation . equals ( sourceType . sourceName , this . selector ) ) { this . scope . problemReporter ( ) . missingReturnType ( this ) ; } if ( this . typeParameters != null ) { for ( int i = <NUM_LIT:0> , length = this . typeParameters . length ; i < length ; i ++ ) { this . typeParameters [ i ] . resolve ( this . scope ) ; } } if ( this . binding != null && ! this . binding . isPrivate ( ) ) { sourceType . tagBits |= TagBits . HasNonPrivateConstructor ; } if ( this . constructorCall != null ) { if ( sourceType . id == TypeIds . T_JavaLangObject && this . constructorCall . accessMode != ExplicitConstructorCall . This ) { if ( this . constructorCall . accessMode == ExplicitConstructorCall . Super ) { this . scope . problemReporter ( ) . cannotUseSuperInJavaLangObject ( this . constructorCall ) ; } this . constructorCall = null ; } else { this . constructorCall . resolve ( this . scope ) ; } } if ( ( this . modifiers & ExtraCompilerModifiers . AccSemicolonBody ) != <NUM_LIT:0> ) { this . scope . problemReporter ( ) . methodNeedBody ( this ) ; } super . resolveStatements ( ) ; } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { if ( visitor . visit ( this , classScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int typeParametersLength = this . typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < typeParametersLength ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . arguments != null ) { int argumentLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , this . scope ) ; } if ( this . thrownExceptions != null ) { int thrownExceptionsLength = this . thrownExceptions . length ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionsLength ; i ++ ) this . thrownExceptions [ i ] . traverse ( visitor , this . scope ) ; } if ( this . constructorCall != null ) this . constructorCall . traverse ( visitor , this . scope ) ; if ( this . statements != null ) { int statementsLength = this . statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) this . statements [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , classScope ) ; } public TypeParameter [ ] typeParameters ( ) { return this . typeParameters ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; 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 . 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 . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . MissingTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class FieldReference extends Reference implements InvocationSite { public static final int READ = <NUM_LIT:0> ; public static final int WRITE = <NUM_LIT:1> ; public Expression receiver ; public char [ ] token ; public FieldBinding binding ; public MethodBinding [ ] syntheticAccessors ; public long nameSourcePosition ; public TypeBinding actualReceiverType ; public TypeBinding genericCast ; public FieldReference ( char [ ] source , long pos ) { this . token = source ; this . nameSourcePosition = pos ; this . sourceStart = ( int ) ( pos > > > <NUM_LIT:32> ) ; this . sourceEnd = ( int ) ( pos & <NUM_LIT> ) ; this . bits |= Binding . FIELD ; } public FlowInfo analyseAssignment ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , Assignment assignment , boolean isCompound ) { if ( isCompound ) { if ( this . binding . isBlankFinal ( ) && this . receiver . isThis ( ) && currentScope . needBlankFinalFieldInitializationCheck ( this . binding ) ) { FlowInfo fieldInits = flowContext . getInitsForFinalBlankInitializationCheck ( this . binding . declaringClass . original ( ) , flowInfo ) ; if ( ! fieldInits . isDefinitelyAssigned ( this . binding ) ) { currentScope . problemReporter ( ) . uninitializedBlankFinalField ( this . binding , this ) ; } } manageSyntheticAccessIfNecessary ( currentScope , flowInfo , true ) ; } flowInfo = this . receiver . analyseCode ( currentScope , flowContext , flowInfo , ! this . binding . isStatic ( ) ) . unconditionalInits ( ) ; if ( assignment . expression != null ) { flowInfo = assignment . expression . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; } manageSyntheticAccessIfNecessary ( currentScope , flowInfo , false ) ; if ( this . binding . isFinal ( ) ) { if ( this . binding . isBlankFinal ( ) && ! isCompound && this . receiver . isThis ( ) && ! ( this . receiver instanceof QualifiedThisReference ) && ( ( this . receiver . bits & ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) && currentScope . allowBlankFinalFieldAssignment ( this . binding ) ) { if ( flowInfo . isPotentiallyAssigned ( this . binding ) ) { currentScope . problemReporter ( ) . duplicateInitializationOfBlankFinalField ( this . binding , this ) ; } else { flowContext . recordSettingFinal ( this . binding , this , flowInfo ) ; } flowInfo . markAsDefinitelyAssigned ( this . binding ) ; } else { currentScope . problemReporter ( ) . cannotAssignToFinalField ( this . binding , this ) ; } } if ( ! this . binding . isStatic ( ) ) { if ( this . receiver . isThis ( ) ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } } else if ( this . receiver . isThis ( ) ) { if ( ( this . receiver . bits & ASTNode . IsImplicitThis ) == <NUM_LIT:0> ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } } return flowInfo ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return analyseCode ( currentScope , flowContext , flowInfo , true ) ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , boolean valueRequired ) { boolean nonStatic = ! this . binding . isStatic ( ) ; this . receiver . analyseCode ( currentScope , flowContext , flowInfo , nonStatic ) ; if ( nonStatic ) { this . receiver . checkNPE ( currentScope , flowContext , flowInfo ) ; if ( this . receiver . isThis ( ) ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } } else if ( this . receiver . isThis ( ) ) { if ( ( this . receiver . bits & ASTNode . IsImplicitThis ) == <NUM_LIT:0> ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } } if ( valueRequired || currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ) { manageSyntheticAccessIfNecessary ( currentScope , flowInfo , true ) ; } return flowInfo ; } public void computeConversion ( Scope scope , TypeBinding runtimeTimeType , TypeBinding compileTimeType ) { if ( runtimeTimeType == null || compileTimeType == null ) return ; if ( this . binding != null && this . binding . isValidBinding ( ) ) { FieldBinding originalBinding = this . binding . original ( ) ; TypeBinding originalType = originalBinding . type ; if ( originalType . leafComponentType ( ) . isTypeVariable ( ) ) { TypeBinding targetType = ( ! compileTimeType . isBaseType ( ) && runtimeTimeType . isBaseType ( ) ) ? compileTimeType : runtimeTimeType ; this . genericCast = originalBinding . type . genericCast ( targetType ) ; if ( this . genericCast instanceof ReferenceBinding ) { ReferenceBinding referenceCast = ( ReferenceBinding ) this . genericCast ; if ( ! referenceCast . canBeSeenBy ( scope ) ) { scope . problemReporter ( ) . invalidType ( this , new ProblemReferenceBinding ( CharOperation . splitOn ( '<CHAR_LIT:.>' , referenceCast . shortReadableName ( ) ) , referenceCast , ProblemReasons . NotVisible ) ) ; } } } } super . computeConversion ( scope , runtimeTimeType , compileTimeType ) ; } public FieldBinding fieldBinding ( ) { return this . binding ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { int pc = codeStream . position ; FieldBinding codegenBinding = this . binding . original ( ) ; this . receiver . generateCode ( currentScope , codeStream , ! codegenBinding . isStatic ( ) ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; assignment . expression . generateCode ( currentScope , codeStream , true ) ; fieldStore ( currentScope , codeStream , codegenBinding , this . syntheticAccessors == null ? null : this . syntheticAccessors [ FieldReference . WRITE ] , this . actualReceiverType , this . receiver . isImplicitThis ( ) , valueRequired ) ; 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 ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } FieldBinding codegenBinding = this . binding . original ( ) ; boolean isStatic = codegenBinding . isStatic ( ) ; boolean isThisReceiver = this . receiver instanceof ThisReference ; Constant fieldConstant = codegenBinding . constant ( ) ; if ( fieldConstant != Constant . NotAConstant ) { if ( ! isThisReceiver ) { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } } if ( valueRequired ) { codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } if ( valueRequired || ( ! isThisReceiver && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ) || ( ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) || ( this . genericCast != null ) ) { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ( this . bits & NeedReceiverGenericCast ) != <NUM_LIT:0> ) { codeStream . checkcast ( this . actualReceiverType ) ; } pc = codeStream . position ; if ( codegenBinding . declaringClass == null ) { codeStream . arraylength ( ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { codeStream . pop ( ) ; } } else { if ( this . syntheticAccessors == null || this . syntheticAccessors [ FieldReference . READ ] == null ) { 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 { codeStream . invoke ( Opcodes . OPC_invokestatic , this . syntheticAccessors [ FieldReference . READ ] , null ) ; } if ( this . genericCast != null ) codeStream . checkcast ( this . genericCast ) ; 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 . type . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } } } else { if ( isThisReceiver ) { if ( isStatic ) { if ( this . binding . original ( ) . declaringClass != this . actualReceiverType . erasure ( ) ) { MethodBinding accessor = this . syntheticAccessors == null ? null : this . syntheticAccessors [ FieldReference . READ ] ; if ( accessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , accessor , null ) ; } switch ( codegenBinding . type . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } } } else { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } } } codeStream . recordPositionsFrom ( pc , this . sourceEnd ) ; } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { boolean isStatic ; reportOnlyUselesslyReadPrivateField ( currentScope , this . binding , valueRequired ) ; FieldBinding codegenBinding = this . binding . original ( ) ; this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; if ( isStatic ) { if ( this . syntheticAccessors == null || this . syntheticAccessors [ FieldReference . READ ] == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , this . syntheticAccessors [ FieldReference . READ ] , null ) ; } } else { codeStream . dup ( ) ; if ( this . syntheticAccessors == null || this . syntheticAccessors [ FieldReference . READ ] == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , this . syntheticAccessors [ FieldReference . READ ] , null ) ; } } int operationTypeID ; switch ( operationTypeID = ( this . implicitConversion & TypeIds . IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_JavaLangString : case T_JavaLangObject : case T_undefined : codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; break ; default : if ( this . genericCast != null ) codeStream . checkcast ( this . genericCast ) ; 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 , this . syntheticAccessors == null ? null : this . syntheticAccessors [ FieldReference . WRITE ] , this . actualReceiverType , this . receiver . isImplicitThis ( ) , valueRequired ) ; } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { boolean isStatic ; reportOnlyUselesslyReadPrivateField ( currentScope , this . binding , valueRequired ) ; FieldBinding codegenBinding = this . binding . original ( ) ; this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; if ( isStatic ) { if ( this . syntheticAccessors == null || this . syntheticAccessors [ FieldReference . READ ] == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , this . syntheticAccessors [ FieldReference . READ ] , null ) ; } } else { codeStream . dup ( ) ; if ( this . syntheticAccessors == null || this . syntheticAccessors [ FieldReference . READ ] == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , this . syntheticAccessors [ FieldReference . READ ] , null ) ; } } TypeBinding operandType ; if ( this . genericCast != null ) { codeStream . checkcast ( this . genericCast ) ; operandType = this . genericCast ; } else { operandType = codegenBinding . type ; } if ( valueRequired ) { if ( isStatic ) { switch ( operandType . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } else { switch ( operandType . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x1 ( ) ; break ; default : codeStream . dup_x1 ( ) ; break ; } } } codeStream . generateImplicitConversion ( this . implicitConversion ) ; codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , this . implicitConversion & TypeIds . COMPILE_TYPE_MASK ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; fieldStore ( currentScope , codeStream , codegenBinding , this . syntheticAccessors == null ? null : this . syntheticAccessors [ FieldReference . WRITE ] , this . actualReceiverType , this . receiver . isImplicitThis ( ) , false ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public boolean isSuperAccess ( ) { return this . receiver . isSuper ( ) ; } public boolean isTypeAccess ( ) { return this . receiver != null && this . receiver . isTypeReference ( ) ; } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo , boolean isReadAccess ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return ; FieldBinding codegenBinding = this . binding . original ( ) ; if ( this . binding . isPrivate ( ) ) { if ( ( currentScope . enclosingSourceType ( ) != codegenBinding . declaringClass ) && this . binding . constant ( ) == Constant . NotAConstant ) { if ( this . syntheticAccessors == null ) this . syntheticAccessors = new MethodBinding [ <NUM_LIT:2> ] ; this . syntheticAccessors [ isReadAccess ? FieldReference . READ : FieldReference . WRITE ] = ( ( SourceTypeBinding ) codegenBinding . declaringClass ) . addSyntheticMethod ( codegenBinding , isReadAccess , false ) ; currentScope . problemReporter ( ) . needToEmulateFieldAccess ( codegenBinding , this , isReadAccess ) ; return ; } } else if ( this . receiver instanceof QualifiedSuperReference ) { SourceTypeBinding destinationType = ( SourceTypeBinding ) ( ( ( QualifiedSuperReference ) this . receiver ) . currentCompatibleType ) ; if ( this . syntheticAccessors == null ) this . syntheticAccessors = new MethodBinding [ <NUM_LIT:2> ] ; this . syntheticAccessors [ isReadAccess ? FieldReference . READ : FieldReference . WRITE ] = destinationType . addSyntheticMethod ( codegenBinding , isReadAccess , isSuperAccess ( ) ) ; currentScope . problemReporter ( ) . needToEmulateFieldAccess ( codegenBinding , this , isReadAccess ) ; return ; } else if ( this . binding . isProtected ( ) ) { SourceTypeBinding enclosingSourceType ; if ( ( ( this . bits & ASTNode . DepthMASK ) != <NUM_LIT:0> ) && this . binding . declaringClass . getPackage ( ) != ( enclosingSourceType = currentScope . enclosingSourceType ( ) ) . getPackage ( ) ) { SourceTypeBinding currentCompatibleType = ( SourceTypeBinding ) enclosingSourceType . enclosingTypeAt ( ( this . bits & ASTNode . DepthMASK ) > > ASTNode . DepthSHIFT ) ; if ( this . syntheticAccessors == null ) this . syntheticAccessors = new MethodBinding [ <NUM_LIT:2> ] ; this . syntheticAccessors [ isReadAccess ? FieldReference . READ : FieldReference . WRITE ] = currentCompatibleType . addSyntheticMethod ( codegenBinding , isReadAccess , isSuperAccess ( ) ) ; currentScope . problemReporter ( ) . needToEmulateFieldAccess ( codegenBinding , this , isReadAccess ) ; return ; } } } public int nullStatus ( FlowInfo flowInfo ) { return FlowInfo . UNKNOWN ; } public Constant optimizedBooleanConstant ( ) { switch ( this . resolvedType . id ) { case T_boolean : case T_JavaLangBoolean : return this . constant != Constant . NotAConstant ? this . constant : this . binding . constant ( ) ; default : return Constant . NotAConstant ; } } public TypeBinding postConversionType ( Scope scope ) { TypeBinding convertedType = this . resolvedType ; if ( this . genericCast != null ) convertedType = this . genericCast ; int runtimeType = ( this . implicitConversion & TypeIds . IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ; switch ( runtimeType ) { case T_boolean : convertedType = TypeBinding . BOOLEAN ; break ; case T_byte : convertedType = TypeBinding . BYTE ; break ; case T_short : convertedType = TypeBinding . SHORT ; break ; case T_char : convertedType = TypeBinding . CHAR ; break ; case T_int : convertedType = TypeBinding . INT ; break ; case T_float : convertedType = TypeBinding . FLOAT ; break ; case T_long : convertedType = TypeBinding . LONG ; break ; case T_double : convertedType = TypeBinding . DOUBLE ; break ; default : } if ( ( this . implicitConversion & TypeIds . BOXING ) != <NUM_LIT:0> ) { convertedType = scope . environment ( ) . computeBoxingType ( convertedType ) ; } return convertedType ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { return this . receiver . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:.>' ) . append ( this . token ) ; } public TypeBinding resolveType ( BlockScope scope ) { boolean receiverCast = false ; if ( this . receiver instanceof CastExpression ) { this . receiver . bits |= ASTNode . DisableUnnecessaryCastCheck ; receiverCast = true ; } this . actualReceiverType = this . receiver . resolveType ( scope ) ; if ( this . actualReceiverType == null ) { this . constant = Constant . NotAConstant ; return null ; } if ( receiverCast ) { if ( ( ( CastExpression ) this . receiver ) . expression . resolvedType == this . actualReceiverType ) { scope . problemReporter ( ) . unnecessaryCast ( ( CastExpression ) this . receiver ) ; } } FieldBinding fieldBinding = this . binding = scope . getField ( this . actualReceiverType , this . token , this ) ; if ( ! fieldBinding . isValidBinding ( ) ) { this . constant = Constant . NotAConstant ; if ( this . receiver . resolvedType instanceof ProblemReferenceBinding ) { return null ; } ReferenceBinding declaringClass = fieldBinding . declaringClass ; boolean avoidSecondary = declaringClass != null && declaringClass . isAnonymousType ( ) && declaringClass . superclass ( ) instanceof MissingTypeBinding ; if ( ! avoidSecondary ) { scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; } if ( fieldBinding instanceof ProblemFieldBinding ) { ProblemFieldBinding problemFieldBinding = ( ProblemFieldBinding ) fieldBinding ; FieldBinding closestMatch = problemFieldBinding . closestMatch ; switch ( problemFieldBinding . problemId ( ) ) { case ProblemReasons . InheritedNameHidesEnclosingName : case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInConstructorInvocation : case ProblemReasons . NonStaticReferenceInStaticContext : if ( closestMatch != null ) { fieldBinding = closestMatch ; } } } if ( ! fieldBinding . isValidBinding ( ) ) { return null ; } } TypeBinding oldReceiverType = this . actualReceiverType ; this . actualReceiverType = this . actualReceiverType . getErasureCompatibleType ( fieldBinding . declaringClass ) ; this . receiver . computeConversion ( scope , this . actualReceiverType , this . actualReceiverType ) ; if ( this . actualReceiverType != oldReceiverType && this . receiver . postConversionType ( scope ) != this . actualReceiverType ) { this . bits |= NeedReceiverGenericCast ; } if ( isFieldUseDeprecated ( fieldBinding , scope , this . bits ) ) { scope . problemReporter ( ) . deprecatedField ( fieldBinding , this ) ; } boolean isImplicitThisRcv = this . receiver . isImplicitThis ( ) ; this . constant = isImplicitThisRcv ? fieldBinding . constant ( ) : Constant . NotAConstant ; if ( fieldBinding . isStatic ( ) ) { if ( ! ( isImplicitThisRcv || ( this . receiver instanceof NameReference && ( ( ( NameReference ) this . receiver ) . bits & Binding . TYPE ) != <NUM_LIT:0> ) ) ) { scope . problemReporter ( ) . nonStaticAccessToStaticField ( this , fieldBinding ) ; } ReferenceBinding declaringClass = this . binding . declaringClass ; if ( ! isImplicitThisRcv && declaringClass != this . actualReceiverType && declaringClass . canBeSeenBy ( scope ) ) { scope . problemReporter ( ) . indirectAccessToStaticField ( this , fieldBinding ) ; } if ( declaringClass . isEnum ( ) ) { MethodScope methodScope = scope . methodScope ( ) ; SourceTypeBinding sourceType = scope . enclosingSourceType ( ) ; if ( this . constant == Constant . NotAConstant && ! methodScope . isStatic && ( sourceType == declaringClass || sourceType . superclass == declaringClass ) && methodScope . isInsideInitializerOrConstructor ( ) ) { scope . problemReporter ( ) . enumStaticFieldUsedDuringInitialization ( this . binding , this ) ; } } } TypeBinding fieldType = fieldBinding . type ; if ( fieldType != null ) { if ( ( this . bits & ASTNode . IsStrictlyAssigned ) == <NUM_LIT:0> ) { fieldType = fieldType . capture ( scope , this . sourceEnd ) ; } this . resolvedType = fieldType ; if ( ( fieldType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . invalidType ( this , fieldType ) ; return null ; } } return fieldType ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { this . actualReceiverType = receiverType ; } public void setDepth ( int depth ) { this . bits &= ~ ASTNode . DepthMASK ; if ( depth > <NUM_LIT:0> ) { this . bits |= ( depth & <NUM_LIT> ) << ASTNode . DepthSHIFT ; } } public void setFieldIndex ( int index ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { this . receiver . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . impl . FloatConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . util . FloatUtil ; public class FloatLiteral extends NumberLiteral { float value ; public FloatLiteral ( char [ ] token , int s , int e ) { super ( token , s , e ) ; } public void computeConstant ( ) { Float computedValue ; boolean containsUnderscores = CharOperation . indexOf ( '<CHAR_LIT:_>' , this . source ) > <NUM_LIT:0> ; if ( containsUnderscores ) { this . source = CharOperation . remove ( this . source , '<CHAR_LIT:_>' ) ; } try { computedValue = Float . valueOf ( String . valueOf ( this . source ) ) ; } catch ( NumberFormatException e ) { try { float v = FloatUtil . valueOfHexFloatLiteral ( this . source ) ; if ( v == Float . POSITIVE_INFINITY ) { return ; } if ( Float . isNaN ( v ) ) { return ; } this . value = v ; this . constant = FloatConstant . fromValue ( v ) ; } catch ( NumberFormatException e1 ) { } return ; } final float floatValue = computedValue . floatValue ( ) ; if ( floatValue > Float . MAX_VALUE ) { return ; } if ( floatValue < Float . MIN_VALUE ) { boolean isHexaDecimal = false ; label : for ( int i = <NUM_LIT:0> ; i < this . source . length ; i ++ ) { switch ( this . source [ i ] ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:.>' : break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : isHexaDecimal = true ; break ; case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : if ( isHexaDecimal ) { return ; } break label ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : break label ; default : return ; } } } this . value = floatValue ; this . constant = FloatConstant . fromValue ( this . value ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . FLOAT ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; 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 . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; 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 . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public abstract class Reference extends Expression { public Reference ( ) { super ( ) ; } public abstract FlowInfo analyseAssignment ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , Assignment assignment , boolean isCompound ) ; public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public FieldBinding fieldBinding ( ) { return null ; } public void fieldStore ( Scope currentScope , CodeStream codeStream , FieldBinding fieldBinding , MethodBinding syntheticWriteAccessor , TypeBinding receiverType , boolean isImplicitThisReceiver , boolean valueRequired ) { int pc = codeStream . position ; if ( fieldBinding . isStatic ( ) ) { if ( valueRequired ) { switch ( fieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } if ( syntheticWriteAccessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , fieldBinding , receiverType , isImplicitThisReceiver ) ; codeStream . fieldAccess ( Opcodes . OPC_putstatic , fieldBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , syntheticWriteAccessor , null ) ; } } else { if ( valueRequired ) { switch ( fieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x1 ( ) ; break ; default : codeStream . dup_x1 ( ) ; break ; } } if ( syntheticWriteAccessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , fieldBinding , receiverType , isImplicitThisReceiver ) ; codeStream . fieldAccess ( Opcodes . OPC_putfield , fieldBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , syntheticWriteAccessor , null ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public abstract void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) ; public abstract void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) ; public abstract void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) ; void reportOnlyUselesslyReadPrivateField ( BlockScope currentScope , FieldBinding fieldBinding , boolean valueRequired ) { if ( valueRequired ) { fieldBinding . compoundUseFlag = <NUM_LIT:0> ; fieldBinding . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } else { if ( fieldBinding . isUsedOnlyInCompound ( ) ) { fieldBinding . compoundUseFlag -- ; if ( fieldBinding . compoundUseFlag == <NUM_LIT:0> && fieldBinding . isOrEnclosedByPrivateType ( ) && ( this . implicitConversion & TypeIds . UNBOXING ) == <NUM_LIT:0> ) { currentScope . problemReporter ( ) . unusedPrivateField ( fieldBinding . sourceField ( ) ) ; fieldBinding . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } } } static void reportOnlyUselesslyReadLocal ( BlockScope currentScope , LocalVariableBinding localBinding , boolean valueRequired ) { if ( localBinding . declaration == null ) return ; if ( ( localBinding . declaration . bits & ASTNode . IsLocalDeclarationReachable ) == <NUM_LIT:0> ) return ; if ( localBinding . useFlag >= LocalVariableBinding . USED ) return ; if ( valueRequired ) { localBinding . useFlag = LocalVariableBinding . USED ; return ; } else { localBinding . useFlag ++ ; if ( localBinding . useFlag != LocalVariableBinding . UNUSED ) return ; } if ( localBinding . declaration instanceof Argument ) { MethodScope methodScope = currentScope . methodScope ( ) ; if ( methodScope != null ) { MethodBinding method = ( ( AbstractMethodDeclaration ) methodScope . referenceContext ( ) ) . binding ; boolean shouldReport = ! method . isMain ( ) ; if ( method . isImplementing ( ) ) { shouldReport &= currentScope . compilerOptions ( ) . reportUnusedParameterWhenImplementingAbstract ; } else if ( method . isOverriding ( ) ) { shouldReport &= currentScope . compilerOptions ( ) . reportUnusedParameterWhenOverridingConcrete ; } if ( shouldReport ) { currentScope . problemReporter ( ) . unusedArgument ( localBinding . declaration ) ; } } } else { currentScope . problemReporter ( ) . unusedLocalVariable ( localBinding . declaration ) ; } localBinding . useFlag = LocalVariableBinding . USED ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class LocalDeclaration extends AbstractVariableDeclaration { public LocalVariableBinding binding ; public LocalDeclaration ( char [ ] name , int sourceStart , int sourceEnd ) { this . name = name ; this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; this . declarationEnd = sourceEnd ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . IsLocalDeclarationReachable ; } if ( this . binding != null && this . type . resolvedType instanceof TypeVariableBinding ) { MethodScope methodScope = this . binding . declaringScope . methodScope ( ) ; AbstractMethodDeclaration methodDeclaration = methodScope . referenceMethod ( ) ; if ( methodDeclaration != null && ( ( methodDeclaration . bits & ASTNode . CanBeStatic ) != <NUM_LIT:0> ) && methodDeclaration . binding != null ) { TypeVariableBinding [ ] typeVariables = methodDeclaration . binding . typeVariables ( ) ; if ( typeVariables == Binding . NO_TYPE_VARIABLES ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } else { boolean usesEnclosingTypeVar = false ; for ( int i = <NUM_LIT:0> ; i < typeVariables . length ; i ++ ) { if ( typeVariables [ i ] == this . type . resolvedType ) { usesEnclosingTypeVar = true ; break ; } } if ( ! usesEnclosingTypeVar ) { currentScope . resetEnclosingMethodStaticFlag ( ) ; } } } } if ( this . initialization == null ) { return flowInfo ; } if ( ( this . initialization . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . initialization . checkNPE ( currentScope , flowContext , flowInfo ) ; } flowInfo = this . initialization . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; int nullStatus = this . initialization . nullStatus ( flowInfo ) ; if ( ! flowInfo . isDefinitelyAssigned ( this . binding ) ) { this . bits |= FirstAssignmentToLocal ; } else { this . bits &= ~ FirstAssignmentToLocal ; } flowInfo . markAsDefinitelyAssigned ( this . binding ) ; nullStatus = checkAgainstNullAnnotation ( currentScope , this . binding , nullStatus ) ; if ( ( this . binding . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { flowInfo . markNullStatus ( this . binding , nullStatus ) ; } return flowInfo ; } public void checkModifiers ( ) { if ( ( ( this . modifiers & ExtraCompilerModifiers . AccJustFlag ) & ~ ClassFileConstants . AccFinal ) != <NUM_LIT:0> ) this . modifiers = ( this . modifiers & ~ ExtraCompilerModifiers . AccAlternateModifierProblem ) | ExtraCompilerModifiers . AccModifierProblem ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( this . binding . resolvedPosition != - <NUM_LIT:1> ) { codeStream . addVisibleLocalVariable ( this . binding ) ; } if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; generateInit : { if ( this . initialization == null ) break generateInit ; if ( this . binding . resolvedPosition < <NUM_LIT:0> ) { if ( this . initialization . constant != Constant . NotAConstant ) break generateInit ; this . initialization . generateCode ( currentScope , codeStream , false ) ; break generateInit ; } this . initialization . generateCode ( currentScope , codeStream , true ) ; if ( this . binding . type . isArrayType ( ) && ( this . initialization . resolvedType == TypeBinding . NULL || ( ( this . initialization instanceof CastExpression ) && ( ( ( CastExpression ) this . initialization ) . innermostCastedExpression ( ) . resolvedType == TypeBinding . NULL ) ) ) ) { codeStream . checkcast ( this . binding . type ) ; } codeStream . store ( this . binding , false ) ; if ( ( this . bits & ASTNode . FirstAssignmentToLocal ) != <NUM_LIT:0> ) { this . binding . recordInitializationStartPC ( codeStream . position ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public int getKind ( ) { return LOCAL_VARIABLE ; } public void resolve ( BlockScope scope ) { TypeBinding variableType = this . type . resolveType ( scope , true ) ; checkModifiers ( ) ; if ( variableType != null ) { if ( variableType == TypeBinding . VOID ) { scope . problemReporter ( ) . variableTypeCannotBeVoid ( this ) ; return ; } if ( variableType . isArrayType ( ) && ( ( ArrayBinding ) variableType ) . leafComponentType == TypeBinding . VOID ) { scope . problemReporter ( ) . variableTypeCannotBeVoidArray ( this ) ; return ; } } Binding existingVariable = scope . getBinding ( this . name , Binding . VARIABLE , this , false ) ; if ( existingVariable != null && existingVariable . isValidBinding ( ) ) { if ( existingVariable instanceof LocalVariableBinding && this . hiddenVariableDepth == <NUM_LIT:0> ) { scope . problemReporter ( ) . redefineLocal ( this ) ; } else { scope . problemReporter ( ) . localVariableHiding ( this , existingVariable , false ) ; } } if ( ( this . modifiers & ClassFileConstants . AccFinal ) != <NUM_LIT:0> && this . initialization == null ) { this . modifiers |= ExtraCompilerModifiers . AccBlankFinal ; } this . binding = new LocalVariableBinding ( this , variableType , this . modifiers , false ) ; scope . addLocalVariable ( this . binding ) ; this . binding . setConstant ( Constant . NotAConstant ) ; if ( variableType == null ) { if ( this . initialization != null ) this . initialization . resolveType ( scope ) ; return ; } if ( this . initialization != null ) { if ( this . initialization instanceof ArrayInitializer ) { TypeBinding initializationType = this . initialization . resolveTypeExpecting ( scope , variableType ) ; if ( initializationType != null ) { ( ( ArrayInitializer ) this . initialization ) . binding = ( ArrayBinding ) initializationType ; this . initialization . computeConversion ( scope , variableType , initializationType ) ; } } else { this . initialization . setExpectedType ( variableType ) ; TypeBinding initializationType = this . initialization . resolveType ( scope ) ; if ( initializationType != null ) { if ( variableType != initializationType ) scope . compilationUnitScope ( ) . recordTypeConversion ( variableType , initializationType ) ; if ( this . initialization . isConstantValueOfTypeAssignableToType ( initializationType , variableType ) || initializationType . isCompatibleWith ( variableType ) ) { this . initialization . computeConversion ( scope , variableType , initializationType ) ; if ( initializationType . needsUncheckedConversion ( variableType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( this . initialization , initializationType , variableType ) ; } if ( this . initialization instanceof CastExpression && ( this . initialization . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , variableType , ( CastExpression ) this . initialization ) ; } } else if ( isBoxingCompatible ( initializationType , variableType , this . initialization , scope ) ) { this . initialization . computeConversion ( scope , variableType , initializationType ) ; if ( this . initialization instanceof CastExpression && ( this . initialization . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , variableType , ( CastExpression ) this . initialization ) ; } } else { if ( ( variableType . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) { scope . problemReporter ( ) . typeMismatchError ( initializationType , variableType , this . initialization , null ) ; } } } } if ( this . binding == Expression . getDirectBinding ( this . initialization ) ) { scope . problemReporter ( ) . assignmentHasNoEffect ( this , this . name ) ; } this . binding . setConstant ( this . binding . isFinal ( ) ? this . initialization . constant . castTo ( ( variableType . id << <NUM_LIT:4> ) + this . initialization . constant . typeID ( ) ) : Constant . NotAConstant ) ; } resolveAnnotations ( scope , this . annotations , this . binding ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , scope ) ; } this . type . traverse ( visitor , scope ) ; if ( this . initialization != null ) this . initialization . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . BranchLabel ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . impl . BooleanConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class FalseLiteral extends MagicLiteral { static final char [ ] source = { '<CHAR_LIT>' , '<CHAR_LIT:a>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT:e>' } ; public FalseLiteral ( int s , int e ) { super ( s , e ) ; } public void computeConstant ( ) { this . constant = BooleanConstant . fromValue ( false ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { if ( falseLabel != null ) { if ( trueLabel == null ) { codeStream . goto_ ( falseLabel ) ; } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . BOOLEAN ; } public char [ ] source ( ) { return source ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class ThrowStatement extends Statement { public Expression exception ; public TypeBinding exceptionType ; public ThrowStatement ( Expression exception , int sourceStart , int sourceEnd ) { this . exception = exception ; this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . exception . analyseCode ( currentScope , flowContext , flowInfo ) ; this . exception . checkNPE ( currentScope , flowContext , flowInfo ) ; flowContext . checkExceptionHandlers ( this . exceptionType , this , flowInfo , currentScope ) ; return FlowInfo . DEAD_END ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) return ; int pc = codeStream . position ; this . exception . generateCode ( currentScope , codeStream , true ) ; codeStream . athrow ( ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; this . exception . printExpression ( <NUM_LIT:0> , output ) ; return output . append ( '<CHAR_LIT:;>' ) ; } public void resolve ( BlockScope scope ) { this . exceptionType = this . exception . resolveType ( scope ) ; if ( this . exceptionType != null && this . exceptionType . isValidBinding ( ) ) { if ( this . exceptionType == TypeBinding . NULL ) { if ( scope . compilerOptions ( ) . complianceLevel <= ClassFileConstants . JDK1_3 ) { scope . problemReporter ( ) . cannotThrowNull ( this . exception ) ; } } else if ( this . exceptionType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaLangThrowable , true ) == null ) { scope . problemReporter ( ) . cannotThrowType ( this . exception , this . exceptionType ) ; } this . exception . computeConversion ( scope , this . exceptionType , this . exceptionType ) ; } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) this . exception . traverse ( visitor , blockScope ) ; visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public abstract class BranchStatement extends Statement { public char [ ] label ; public BranchLabel targetLabel ; public SubRoutineStatement [ ] subroutines ; public int initStateIndex = - <NUM_LIT:1> ; public BranchStatement ( char [ ] label , int sourceStart , int sourceEnd ) { this . label = label ; this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; if ( this . subroutines != null ) { for ( int i = <NUM_LIT:0> , max = this . subroutines . length ; i < max ; i ++ ) { SubRoutineStatement sub = this . subroutines [ i ] ; boolean didEscape = sub . generateSubRoutineInvocation ( currentScope , codeStream , this . targetLabel , this . initStateIndex , null ) ; if ( didEscape ) { codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; SubRoutineStatement . reenterAllExceptionHandlers ( this . subroutines , i , codeStream ) ; if ( this . initStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . initStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . initStateIndex ) ; } return ; } } } codeStream . goto_ ( this . targetLabel ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; SubRoutineStatement . reenterAllExceptionHandlers ( this . subroutines , - <NUM_LIT:1> , codeStream ) ; if ( this . initStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . initStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . initStateIndex ) ; } } public void resolve ( BlockScope scope ) { } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class ReturnStatement extends Statement { public Expression expression ; public SubRoutineStatement [ ] subroutines ; public LocalVariableBinding saveValueVariable ; public int initStateIndex = - <NUM_LIT:1> ; public ReturnStatement ( Expression expression , int sourceStart , int sourceEnd ) { this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; this . expression = expression ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . expression != null ) { flowInfo = this . expression . analyseCode ( currentScope , flowContext , flowInfo ) ; if ( ( this . expression . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . expression . checkNPE ( currentScope , flowContext , flowInfo ) ; } } this . initStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; FlowContext traversedContext = flowContext ; int subCount = <NUM_LIT:0> ; boolean saveValueNeeded = false ; boolean hasValueToSave = needValueStore ( ) ; boolean noAutoCloseables = true ; do { SubRoutineStatement sub ; if ( ( sub = traversedContext . subroutine ( ) ) != null ) { if ( this . subroutines == null ) { this . subroutines = new SubRoutineStatement [ <NUM_LIT:5> ] ; } if ( subCount == this . subroutines . length ) { System . arraycopy ( this . subroutines , <NUM_LIT:0> , ( this . subroutines = new SubRoutineStatement [ subCount * <NUM_LIT:2> ] ) , <NUM_LIT:0> , subCount ) ; } this . subroutines [ subCount ++ ] = sub ; if ( sub . isSubRoutineEscaping ( ) ) { saveValueNeeded = false ; this . bits |= ASTNode . IsAnySubRoutineEscaping ; break ; } if ( sub instanceof TryStatement ) { if ( ( ( TryStatement ) sub ) . resources . length > <NUM_LIT:0> ) { noAutoCloseables = false ; } } } traversedContext . recordReturnFrom ( flowInfo . unconditionalInits ( ) ) ; if ( traversedContext instanceof InsideSubRoutineFlowContext ) { ASTNode node = traversedContext . associatedNode ; if ( node instanceof SynchronizedStatement ) { this . bits |= ASTNode . IsSynchronized ; } else if ( node instanceof TryStatement ) { TryStatement tryStatement = ( TryStatement ) node ; flowInfo . addInitializationsFrom ( tryStatement . subRoutineInits ) ; if ( hasValueToSave ) { if ( this . saveValueVariable == null ) { prepareSaveValueLocation ( tryStatement ) ; } saveValueNeeded = true ; this . initStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; } } } else if ( traversedContext instanceof InitializationFlowContext ) { currentScope . problemReporter ( ) . cannotReturnInInitializer ( this ) ; return FlowInfo . DEAD_END ; } } while ( ( traversedContext = traversedContext . parent ) != null ) ; if ( ( this . subroutines != null ) && ( subCount != this . subroutines . length ) ) { System . arraycopy ( this . subroutines , <NUM_LIT:0> , ( this . subroutines = new SubRoutineStatement [ subCount ] ) , <NUM_LIT:0> , subCount ) ; } if ( saveValueNeeded ) { if ( this . saveValueVariable != null ) { this . saveValueVariable . useFlag = LocalVariableBinding . USED ; } } else { this . saveValueVariable = null ; if ( ( ( this . bits & ASTNode . IsSynchronized ) == <NUM_LIT:0> ) && this . expression != null && this . expression . resolvedType == TypeBinding . BOOLEAN ) { if ( noAutoCloseables ) { this . expression . bits |= ASTNode . IsReturnedValue ; } } } return FlowInfo . DEAD_END ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; boolean alreadyGeneratedExpression = false ; if ( needValueStore ( ) ) { alreadyGeneratedExpression = true ; this . expression . generateCode ( currentScope , codeStream , needValue ( ) ) ; generateStoreSaveValueIfNecessary ( codeStream ) ; } if ( this . subroutines != null ) { Object reusableJSRTarget = this . expression == null ? ( Object ) TypeBinding . VOID : this . expression . reusableJSRTarget ( ) ; for ( int i = <NUM_LIT:0> , max = this . subroutines . length ; i < max ; i ++ ) { SubRoutineStatement sub = this . subroutines [ i ] ; boolean didEscape = sub . generateSubRoutineInvocation ( currentScope , codeStream , reusableJSRTarget , this . initStateIndex , this . saveValueVariable ) ; if ( didEscape ) { codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; SubRoutineStatement . reenterAllExceptionHandlers ( this . subroutines , i , codeStream ) ; return ; } } } if ( this . saveValueVariable != null ) { codeStream . load ( this . saveValueVariable ) ; } if ( this . expression != null && ! alreadyGeneratedExpression ) { this . expression . generateCode ( currentScope , codeStream , true ) ; generateStoreSaveValueIfNecessary ( codeStream ) ; } generateReturnBytecode ( codeStream ) ; if ( this . saveValueVariable != null ) { codeStream . removeVariable ( this . saveValueVariable ) ; } if ( this . initStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . initStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . initStateIndex ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; SubRoutineStatement . reenterAllExceptionHandlers ( this . subroutines , - <NUM_LIT:1> , codeStream ) ; } public void generateReturnBytecode ( CodeStream codeStream ) { codeStream . generateReturnBytecode ( this . expression ) ; } public void generateStoreSaveValueIfNecessary ( CodeStream codeStream ) { if ( this . saveValueVariable != null ) { codeStream . store ( this . saveValueVariable , false ) ; codeStream . addVariable ( this . saveValueVariable ) ; } } private boolean needValueStore ( ) { return this . expression != null && ( this . expression . constant == Constant . NotAConstant || ( this . expression . implicitConversion & TypeIds . BOXING ) != <NUM_LIT:0> ) && ! ( this . expression instanceof NullLiteral ) ; } public boolean needValue ( ) { return this . saveValueVariable != null || ( this . bits & ASTNode . IsSynchronized ) != <NUM_LIT:0> || ( ( this . bits & ASTNode . IsAnySubRoutineEscaping ) == <NUM_LIT:0> ) ; } public void prepareSaveValueLocation ( TryStatement targetTryStatement ) { this . saveValueVariable = targetTryStatement . secretReturnValue ; } public StringBuffer printStatement ( int tab , StringBuffer output ) { printIndent ( tab , output ) . append ( "<STR_LIT>" ) ; if ( this . expression != null ) this . expression . printExpression ( <NUM_LIT:0> , output ) ; return output . append ( '<CHAR_LIT:;>' ) ; } public void resolve ( BlockScope scope ) { MethodScope methodScope = scope . methodScope ( ) ; MethodBinding methodBinding ; TypeBinding methodType = ( methodScope . referenceContext instanceof AbstractMethodDeclaration ) ? ( ( methodBinding = ( ( AbstractMethodDeclaration ) methodScope . referenceContext ) . binding ) == null ? null : methodBinding . returnType ) : TypeBinding . VOID ; TypeBinding expressionType ; if ( methodType == TypeBinding . VOID ) { if ( this . expression == null ) return ; if ( ( expressionType = this . expression . resolveType ( scope ) ) != null ) scope . problemReporter ( ) . attemptToReturnNonVoidExpression ( this , expressionType ) ; return ; } if ( this . expression == null ) { if ( methodType != null ) scope . problemReporter ( ) . shouldReturn ( methodType , this ) ; return ; } this . expression . setExpectedType ( methodType ) ; if ( ( expressionType = this . expression . resolveType ( scope ) ) == null ) return ; if ( expressionType == TypeBinding . VOID ) { scope . problemReporter ( ) . attemptToReturnVoidValue ( this ) ; return ; } if ( methodType == null ) return ; if ( methodType != expressionType ) scope . compilationUnitScope ( ) . recordTypeConversion ( methodType , expressionType ) ; if ( this . expression . isConstantValueOfTypeAssignableToType ( expressionType , methodType ) || expressionType . isCompatibleWith ( methodType ) ) { this . expression . computeConversion ( scope , methodType , expressionType ) ; if ( expressionType . needsUncheckedConversion ( methodType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( this . expression , expressionType , methodType ) ; } if ( this . expression instanceof CastExpression && ( this . expression . bits & ( ASTNode . UnnecessaryCast | ASTNode . DisableUnnecessaryCastCheck ) ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , methodType , ( CastExpression ) this . expression ) ; } return ; } else if ( isBoxingCompatible ( expressionType , methodType , this . expression , scope ) ) { this . expression . computeConversion ( scope , methodType , expressionType ) ; if ( this . expression instanceof CastExpression && ( this . expression . bits & ( ASTNode . UnnecessaryCast | ASTNode . DisableUnnecessaryCastCheck ) ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , methodType , ( CastExpression ) this . expression ) ; } return ; } if ( ( methodType . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) { scope . problemReporter ( ) . typeMismatchError ( expressionType , methodType , this . expression , null ) ; } } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . expression != null ) this . expression . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class NullLiteral extends MagicLiteral { static final char [ ] source = { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' } ; public NullLiteral ( int s , int e ) { super ( s , e ) ; } public void computeConstant ( ) { this . constant = Constant . NotAConstant ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . aconst_null ( ) ; codeStream . generateImplicitConversion ( this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . NULL ; } public int nullStatus ( FlowInfo flowInfo ) { return FlowInfo . NULL ; } public Object reusableJSRTarget ( ) { return TypeBinding . NULL ; } public char [ ] source ( ) { return source ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . util . Util ; public class FieldDeclaration extends AbstractVariableDeclaration { public FieldBinding binding ; public Javadoc javadoc ; public int endPart1Position ; public int endPart2Position ; public FieldDeclaration ( ) { } public FieldDeclaration ( char [ ] name , int sourceStart , int sourceEnd ) { this . name = name ; this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; } public FlowInfo analyseCode ( MethodScope initializationScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . binding != null && ! this . binding . isUsed ( ) && this . binding . isOrEnclosedByPrivateType ( ) ) { if ( ! initializationScope . referenceCompilationUnit ( ) . compilationResult . hasSyntaxError ) { initializationScope . problemReporter ( ) . unusedPrivateField ( this ) ; } } if ( this . binding != null && this . binding . isValidBinding ( ) && this . binding . isStatic ( ) && this . binding . constant ( ) == Constant . NotAConstant && this . binding . declaringClass . isNestedType ( ) && ! this . binding . declaringClass . isStatic ( ) ) { initializationScope . problemReporter ( ) . unexpectedStaticModifierForField ( ( SourceTypeBinding ) this . binding . declaringClass , this ) ; } if ( this . initialization != null ) { flowInfo = this . initialization . analyseCode ( initializationScope , flowContext , flowInfo ) . unconditionalInits ( ) ; flowInfo . markAsDefinitelyAssigned ( this . binding ) ; } return flowInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; boolean isStatic ; if ( this . initialization != null && ! ( ( isStatic = this . binding . isStatic ( ) ) && this . binding . constant ( ) != Constant . NotAConstant ) ) { if ( ! isStatic ) codeStream . aload_0 ( ) ; this . initialization . generateCode ( currentScope , codeStream , true ) ; if ( isStatic ) { codeStream . fieldAccess ( Opcodes . OPC_putstatic , this . binding , null ) ; } else { codeStream . fieldAccess ( Opcodes . OPC_putfield , this . binding , null ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public int getKind ( ) { return this . type == null ? ENUM_CONSTANT : FIELD ; } public boolean isStatic ( ) { if ( this . binding != null ) return this . binding . isStatic ( ) ; return ( this . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { if ( this . javadoc != null ) { this . javadoc . print ( indent , output ) ; } return super . printStatement ( indent , output ) ; } public void resolve ( MethodScope initializationScope ) { if ( ( this . bits & ASTNode . HasBeenResolved ) != <NUM_LIT:0> ) return ; if ( this . binding == null || ! this . binding . isValidBinding ( ) ) return ; this . bits |= ASTNode . HasBeenResolved ; ClassScope classScope = initializationScope . enclosingClassScope ( ) ; if ( classScope != null ) { checkHiding : { SourceTypeBinding declaringType = classScope . enclosingSourceType ( ) ; checkHidingSuperField : { if ( declaringType . superclass == null ) break checkHidingSuperField ; FieldBinding existingVariable = classScope . findField ( declaringType . superclass , this . name , this , false , true ) ; if ( existingVariable == null ) break checkHidingSuperField ; if ( ! existingVariable . isValidBinding ( ) ) break checkHidingSuperField ; if ( existingVariable . original ( ) == this . binding ) break checkHidingSuperField ; if ( ! existingVariable . canBeSeenBy ( declaringType , this , initializationScope ) ) break checkHidingSuperField ; initializationScope . problemReporter ( ) . fieldHiding ( this , existingVariable ) ; break checkHiding ; } Scope outerScope = classScope . parent ; if ( outerScope . kind == Scope . COMPILATION_UNIT_SCOPE ) break checkHiding ; Binding existingVariable = outerScope . getBinding ( this . name , Binding . VARIABLE , this , false ) ; if ( existingVariable == null ) break checkHiding ; if ( ! existingVariable . isValidBinding ( ) ) break checkHiding ; if ( existingVariable == this . binding ) break checkHiding ; if ( existingVariable instanceof FieldBinding ) { FieldBinding existingField = ( FieldBinding ) existingVariable ; if ( existingField . original ( ) == this . binding ) break checkHiding ; if ( ! existingField . isStatic ( ) && declaringType . isStatic ( ) ) break checkHiding ; } initializationScope . problemReporter ( ) . fieldHiding ( this , existingVariable ) ; } } if ( this . type != null ) { this . type . resolvedType = this . binding . type ; } FieldBinding previousField = initializationScope . initializedField ; int previousFieldID = initializationScope . lastVisibleFieldID ; try { initializationScope . initializedField = this . binding ; initializationScope . lastVisibleFieldID = this . binding . id ; resolveAnnotations ( initializationScope , this . annotations , this . binding ) ; if ( ( this . binding . getAnnotationTagBits ( ) & TagBits . AnnotationDeprecated ) == <NUM_LIT:0> && ( this . binding . modifiers & ClassFileConstants . AccDeprecated ) != <NUM_LIT:0> && initializationScope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ) { initializationScope . problemReporter ( ) . missingDeprecatedAnnotationForField ( this ) ; } if ( this . initialization == null ) { this . binding . setConstant ( Constant . NotAConstant ) ; } else { this . binding . setConstant ( Constant . NotAConstant ) ; TypeBinding fieldType = this . binding . type ; TypeBinding initializationType ; this . initialization . setExpectedType ( fieldType ) ; if ( this . initialization instanceof ArrayInitializer ) { if ( ( initializationType = this . initialization . resolveTypeExpecting ( initializationScope , fieldType ) ) != null ) { ( ( ArrayInitializer ) this . initialization ) . binding = ( ArrayBinding ) initializationType ; this . initialization . computeConversion ( initializationScope , fieldType , initializationType ) ; } } else if ( ( initializationType = this . initialization . resolveType ( initializationScope ) ) != null ) { if ( fieldType != initializationType ) initializationScope . compilationUnitScope ( ) . recordTypeConversion ( fieldType , initializationType ) ; if ( this . initialization . isConstantValueOfTypeAssignableToType ( initializationType , fieldType ) || initializationType . isCompatibleWith ( fieldType ) ) { this . initialization . computeConversion ( initializationScope , fieldType , initializationType ) ; if ( initializationType . needsUncheckedConversion ( fieldType ) ) { initializationScope . problemReporter ( ) . unsafeTypeConversion ( this . initialization , initializationType , fieldType ) ; } if ( this . initialization instanceof CastExpression && ( this . initialization . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( initializationScope , fieldType , ( CastExpression ) this . initialization ) ; } } else if ( isBoxingCompatible ( initializationType , fieldType , this . initialization , initializationScope ) ) { this . initialization . computeConversion ( initializationScope , fieldType , initializationType ) ; if ( this . initialization instanceof CastExpression && ( this . initialization . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( initializationScope , fieldType , ( CastExpression ) this . initialization ) ; } } else { if ( ( fieldType . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) { initializationScope . problemReporter ( ) . typeMismatchError ( initializationType , fieldType , this . initialization , null ) ; } } if ( this . binding . isFinal ( ) ) { this . binding . setConstant ( this . initialization . constant . castTo ( ( this . binding . type . id << <NUM_LIT:4> ) + this . initialization . constant . typeID ( ) ) ) ; } } else { this . binding . setConstant ( Constant . NotAConstant ) ; } if ( this . binding == Expression . getDirectBinding ( this . initialization ) ) { initializationScope . problemReporter ( ) . assignmentHasNoEffect ( this , this . name ) ; } } if ( this . javadoc != null ) { this . javadoc . resolve ( initializationScope ) ; } else if ( this . binding != null && this . binding . declaringClass != null && ! this . binding . declaringClass . isLocalType ( ) ) { int javadocVisibility = this . binding . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; ProblemReporter reporter = initializationScope . problemReporter ( ) ; int severity = reporter . computeSeverity ( IProblem . JavadocMissing ) ; if ( severity != ProblemSeverities . Ignore ) { if ( classScope != null ) { javadocVisibility = Util . computeOuterMostVisibility ( classScope . referenceType ( ) , javadocVisibility ) ; } int javadocModifiers = ( this . binding . modifiers & ~ ExtraCompilerModifiers . AccVisibilityMASK ) | javadocVisibility ; reporter . javadocMissing ( this . sourceStart , this . sourceEnd , severity , javadocModifiers ) ; } } } finally { initializationScope . initializedField = previousField ; initializationScope . lastVisibleFieldID = previousFieldID ; if ( this . binding . constant ( ) == null ) this . binding . setConstant ( Constant . NotAConstant ) ; } } public void traverse ( ASTVisitor visitor , MethodScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , scope ) ; } if ( this . type != null ) { this . type . traverse ( visitor , scope ) ; } if ( this . initialization != null ) this . initialization . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class WhileStatement extends Statement { public Expression condition ; public Statement action ; private BranchLabel breakLabel , continueLabel ; int preCondInitStateIndex = - <NUM_LIT:1> ; int condIfTrueInitStateIndex = - <NUM_LIT:1> ; int mergedInitStateIndex = - <NUM_LIT:1> ; public WhileStatement ( Expression condition , Statement action , int s , int e ) { this . condition = condition ; this . action = action ; if ( action instanceof EmptyStatement ) action . bits |= IsUsefulEmptyStatement ; this . sourceStart = s ; this . sourceEnd = e ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . breakLabel = new BranchLabel ( ) ; this . continueLabel = new BranchLabel ( ) ; int initialComplaintLevel = ( flowInfo . reachMode ( ) & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? Statement . COMPLAINED_FAKE_REACHABLE : Statement . NOT_COMPLAINED ; Constant cst = this . condition . constant ; boolean isConditionTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isConditionFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; this . preCondInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( flowInfo ) ; LoopingFlowContext condLoopContext ; FlowInfo condInfo = flowInfo . nullInfoLessUnconditionalCopy ( ) ; condInfo = this . condition . analyseCode ( currentScope , ( condLoopContext = new LoopingFlowContext ( flowContext , flowInfo , this , null , null , currentScope ) ) , condInfo ) ; if ( ( this . condition . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . condition . checkNPE ( currentScope , flowContext , flowInfo ) ; } LoopingFlowContext loopingContext ; FlowInfo actionInfo ; FlowInfo exitBranch ; if ( this . action == null || ( this . action . isEmptyBlock ( ) && currentScope . compilerOptions ( ) . complianceLevel <= ClassFileConstants . JDK1_3 ) ) { condLoopContext . complainOnDeferredFinalChecks ( currentScope , condInfo ) ; condLoopContext . complainOnDeferredNullChecks ( currentScope , condInfo . unconditionalInits ( ) ) ; if ( isConditionTrue ) { return FlowInfo . DEAD_END ; } else { FlowInfo mergedInfo = flowInfo . copy ( ) . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) ; if ( isConditionOptimizedTrue ) { mergedInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } } else { loopingContext = new LoopingFlowContext ( flowContext , flowInfo , this , this . breakLabel , this . continueLabel , currentScope ) ; if ( isConditionFalse ) { actionInfo = FlowInfo . DEAD_END ; } else { actionInfo = condInfo . initsWhenTrue ( ) . copy ( ) ; if ( isConditionOptimizedFalse ) { actionInfo . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } this . condIfTrueInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( condInfo . initsWhenTrue ( ) ) ; if ( this . action . complainIfUnreachable ( actionInfo , currentScope , initialComplaintLevel ) < Statement . COMPLAINED_UNREACHABLE ) { actionInfo = this . action . analyseCode ( currentScope , loopingContext , actionInfo ) ; } exitBranch = flowInfo . copy ( ) ; int combinedTagBits = actionInfo . tagBits & loopingContext . initsOnContinue . tagBits ; if ( ( combinedTagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ) { if ( ( combinedTagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) this . continueLabel = null ; exitBranch . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) ; } else { condLoopContext . complainOnDeferredFinalChecks ( currentScope , condInfo ) ; actionInfo = actionInfo . mergedWith ( loopingContext . initsOnContinue . unconditionalInits ( ) ) ; condLoopContext . complainOnDeferredNullChecks ( currentScope , actionInfo ) ; loopingContext . complainOnDeferredFinalChecks ( currentScope , actionInfo ) ; loopingContext . complainOnDeferredNullChecks ( currentScope , actionInfo ) ; exitBranch . addPotentialInitializationsFrom ( actionInfo . unconditionalInits ( ) ) . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) ; } if ( loopingContext . hasEscapingExceptions ( ) ) { FlowInfo loopbackFlowInfo = flowInfo . copy ( ) ; if ( this . continueLabel != null ) { loopbackFlowInfo . mergedWith ( actionInfo . unconditionalCopy ( ) ) ; } loopingContext . simulateThrowAfterLoopBack ( loopbackFlowInfo ) ; } } FlowInfo mergedInfo = FlowInfo . mergedOptimizedBranches ( ( loopingContext . initsOnBreak . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? loopingContext . initsOnBreak : flowInfo . addInitializationsFrom ( loopingContext . initsOnBreak ) , isConditionOptimizedTrue , exitBranch , isConditionOptimizedFalse , ! isConditionTrue ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; Constant cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; if ( isConditionOptimizedFalse ) { this . condition . generateCode ( currentScope , codeStream , false ) ; if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } this . breakLabel . initialize ( codeStream ) ; if ( this . continueLabel == null ) { if ( this . condition . constant == Constant . NotAConstant ) { this . condition . generateOptimizedBoolean ( currentScope , codeStream , null , this . breakLabel , true ) ; } } else { this . continueLabel . initialize ( codeStream ) ; if ( ! ( ( ( this . condition . constant != Constant . NotAConstant ) && ( this . condition . constant . booleanValue ( ) == true ) ) || ( this . action == null ) || this . action . isEmptyBlock ( ) ) ) { int jumpPC = codeStream . position ; codeStream . goto_ ( this . continueLabel ) ; codeStream . recordPositionsFrom ( jumpPC , this . condition . sourceStart ) ; } } BranchLabel actionLabel = new BranchLabel ( codeStream ) ; if ( this . action != null ) { actionLabel . tagBits |= BranchLabel . USED ; if ( this . condIfTrueInitStateIndex != - <NUM_LIT:1> ) { codeStream . addDefinitelyAssignedVariables ( currentScope , this . condIfTrueInitStateIndex ) ; } actionLabel . place ( ) ; this . action . generateCode ( currentScope , codeStream ) ; if ( this . preCondInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preCondInitStateIndex ) ; } } else { actionLabel . place ( ) ; } if ( this . continueLabel != null ) { this . continueLabel . place ( ) ; this . condition . generateOptimizedBoolean ( currentScope , codeStream , actionLabel , null , true ) ; } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } this . breakLabel . place ( ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void resolve ( BlockScope scope ) { TypeBinding type = this . condition . resolveTypeExpecting ( scope , TypeBinding . BOOLEAN ) ; this . condition . computeConversion ( scope , type , type ) ; if ( this . action != null ) this . action . resolve ( scope ) ; } public StringBuffer printStatement ( int tab , StringBuffer output ) { printIndent ( tab , output ) . append ( "<STR_LIT>" ) ; this . condition . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:)>' ) ; if ( this . action == null ) output . append ( '<CHAR_LIT:;>' ) ; else this . action . printStatement ( tab + <NUM_LIT:1> , output ) ; return output ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . condition . traverse ( visitor , blockScope ) ; if ( this . action != null ) this . action . traverse ( visitor , blockScope ) ; } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class Wildcard extends SingleTypeReference { public static final int UNBOUND = <NUM_LIT:0> ; public static final int EXTENDS = <NUM_LIT:1> ; public static final int SUPER = <NUM_LIT:2> ; public TypeReference bound ; public int kind ; public Wildcard ( int kind ) { super ( WILDCARD_NAME , <NUM_LIT:0> ) ; this . kind = kind ; } public char [ ] [ ] getParameterizedTypeName ( ) { switch ( this . kind ) { case Wildcard . UNBOUND : return new char [ ] [ ] { WILDCARD_NAME } ; case Wildcard . EXTENDS : return new char [ ] [ ] { CharOperation . concat ( WILDCARD_NAME , WILDCARD_EXTENDS , CharOperation . concatWith ( this . bound . getParameterizedTypeName ( ) , '<CHAR_LIT:.>' ) ) } ; default : return new char [ ] [ ] { CharOperation . concat ( WILDCARD_NAME , WILDCARD_SUPER , CharOperation . concatWith ( this . bound . getParameterizedTypeName ( ) , '<CHAR_LIT:.>' ) ) } ; } } public char [ ] [ ] getTypeName ( ) { switch ( this . kind ) { case Wildcard . UNBOUND : return new char [ ] [ ] { WILDCARD_NAME } ; case Wildcard . EXTENDS : return new char [ ] [ ] { CharOperation . concat ( WILDCARD_NAME , WILDCARD_EXTENDS , CharOperation . concatWith ( this . bound . getTypeName ( ) , '<CHAR_LIT:.>' ) ) } ; default : return new char [ ] [ ] { CharOperation . concat ( WILDCARD_NAME , WILDCARD_SUPER , CharOperation . concatWith ( this . bound . getTypeName ( ) , '<CHAR_LIT:.>' ) ) } ; } } private TypeBinding internalResolveType ( Scope scope , ReferenceBinding genericType , int rank ) { TypeBinding boundType = null ; if ( this . bound != null ) { boundType = scope . kind == Scope . CLASS_SCOPE ? this . bound . resolveType ( ( ClassScope ) scope ) : this . bound . resolveType ( ( BlockScope ) scope , true ) ; if ( boundType == null ) { return null ; } } WildcardBinding wildcard = scope . environment ( ) . createWildcard ( genericType , rank , boundType , null , this . kind ) ; return this . resolvedType = wildcard ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { switch ( this . kind ) { case Wildcard . UNBOUND : output . append ( WILDCARD_NAME ) ; break ; case Wildcard . EXTENDS : output . append ( WILDCARD_NAME ) . append ( WILDCARD_EXTENDS ) ; this . bound . printExpression ( <NUM_LIT:0> , output ) ; break ; default : output . append ( WILDCARD_NAME ) . append ( WILDCARD_SUPER ) ; this . bound . printExpression ( <NUM_LIT:0> , output ) ; break ; } return output ; } public TypeBinding resolveType ( BlockScope scope , boolean checkBounds ) { if ( this . bound != null ) { this . bound . resolveType ( scope , checkBounds ) ; } return null ; } public TypeBinding resolveType ( ClassScope scope ) { if ( this . bound != null ) { this . bound . resolveType ( scope ) ; } return null ; } public TypeBinding resolveTypeArgument ( BlockScope blockScope , ReferenceBinding genericType , int rank ) { return internalResolveType ( blockScope , genericType , rank ) ; } public TypeBinding resolveTypeArgument ( ClassScope classScope , ReferenceBinding genericType , int rank ) { return internalResolveType ( classScope , genericType , rank ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . bound != null ) { this . bound . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } public void traverse ( ASTVisitor visitor , ClassScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . bound != null ) { this . bound . traverse ( visitor , scope ) ; } } visitor . endVisit ( this , scope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . impl . IrritantSet ; import org . eclipse . jdt . internal . compiler . lookup . * ; public abstract class Annotation extends Expression { final static MemberValuePair [ ] NoValuePairs = new MemberValuePair [ <NUM_LIT:0> ] ; public int declarationSourceEnd ; public Binding recipient ; public TypeReference type ; private AnnotationBinding compilerAnnotation = null ; public static long getRetentionPolicy ( char [ ] policyName ) { if ( policyName == null || policyName . length == <NUM_LIT:0> ) return <NUM_LIT:0> ; switch ( policyName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( policyName , TypeConstants . UPPER_CLASS ) ) return TagBits . AnnotationClassRetention ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( policyName , TypeConstants . UPPER_SOURCE ) ) return TagBits . AnnotationSourceRetention ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( policyName , TypeConstants . UPPER_RUNTIME ) ) return TagBits . AnnotationRuntimeRetention ; break ; } return <NUM_LIT:0> ; } public static long getTargetElementType ( char [ ] elementName ) { if ( elementName == null || elementName . length == <NUM_LIT:0> ) return <NUM_LIT:0> ; switch ( elementName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:A>' : if ( CharOperation . equals ( elementName , TypeConstants . UPPER_ANNOTATION_TYPE ) ) return TagBits . AnnotationForAnnotationType ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( elementName , TypeConstants . UPPER_CONSTRUCTOR ) ) return TagBits . AnnotationForConstructor ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( elementName , TypeConstants . UPPER_FIELD ) ) return TagBits . AnnotationForField ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( elementName , TypeConstants . UPPER_LOCAL_VARIABLE ) ) return TagBits . AnnotationForLocalVariable ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( elementName , TypeConstants . UPPER_METHOD ) ) return TagBits . AnnotationForMethod ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( elementName , TypeConstants . UPPER_PARAMETER ) ) return TagBits . AnnotationForParameter ; else if ( CharOperation . equals ( elementName , TypeConstants . UPPER_PACKAGE ) ) return TagBits . AnnotationForPackage ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( elementName , TypeConstants . TYPE ) ) return TagBits . AnnotationForType ; break ; } return <NUM_LIT:0> ; } public ElementValuePair [ ] computeElementValuePairs ( ) { return Binding . NO_ELEMENT_VALUE_PAIRS ; } private long detectStandardAnnotation ( Scope scope , ReferenceBinding annotationType , MemberValuePair valueAttribute ) { long tagBits = <NUM_LIT:0> ; switch ( annotationType . id ) { case TypeIds . T_JavaLangAnnotationRetention : if ( valueAttribute != null ) { Expression expr = valueAttribute . value ; if ( ( expr . bits & Binding . VARIABLE ) == Binding . FIELD ) { FieldBinding field = ( ( Reference ) expr ) . fieldBinding ( ) ; if ( field != null && field . declaringClass . id == T_JavaLangAnnotationRetentionPolicy ) { tagBits |= getRetentionPolicy ( field . name ) ; } } } break ; case TypeIds . T_JavaLangAnnotationTarget : tagBits |= TagBits . AnnotationTarget ; if ( valueAttribute != null ) { Expression expr = valueAttribute . value ; if ( expr instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) expr ; final Expression [ ] expressions = initializer . expressions ; if ( expressions != null ) { for ( int i = <NUM_LIT:0> , length = expressions . length ; i < length ; i ++ ) { Expression initExpr = expressions [ i ] ; if ( ( initExpr . bits & Binding . VARIABLE ) == Binding . FIELD ) { FieldBinding field = ( ( Reference ) initExpr ) . fieldBinding ( ) ; if ( field != null && field . declaringClass . id == T_JavaLangAnnotationElementType ) { long element = getTargetElementType ( field . name ) ; if ( ( tagBits & element ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . duplicateTargetInTargetAnnotation ( annotationType , ( NameReference ) initExpr ) ; } else { tagBits |= element ; } } } } } } else if ( ( expr . bits & Binding . VARIABLE ) == Binding . FIELD ) { FieldBinding field = ( ( Reference ) expr ) . fieldBinding ( ) ; if ( field != null && field . declaringClass . id == T_JavaLangAnnotationElementType ) { tagBits |= getTargetElementType ( field . name ) ; } } } break ; case TypeIds . T_JavaLangDeprecated : tagBits |= TagBits . AnnotationDeprecated ; break ; case TypeIds . T_JavaLangAnnotationDocumented : tagBits |= TagBits . AnnotationDocumented ; break ; case TypeIds . T_JavaLangAnnotationInherited : tagBits |= TagBits . AnnotationInherited ; break ; case TypeIds . T_JavaLangOverride : tagBits |= TagBits . AnnotationOverride ; break ; case TypeIds . T_JavaLangSuppressWarnings : tagBits |= TagBits . AnnotationSuppressWarnings ; break ; case TypeIds . T_JavaLangSafeVarargs : tagBits |= TagBits . AnnotationSafeVarargs ; break ; case TypeIds . T_JavaLangInvokeMethodHandlePolymorphicSignature : tagBits |= TagBits . AnnotationPolymorphicSignature ; break ; } return tagBits ; } public AnnotationBinding getCompilerAnnotation ( ) { return this . compilerAnnotation ; } public boolean isRuntimeInvisible ( ) { final TypeBinding annotationBinding = this . resolvedType ; if ( annotationBinding == null ) { return false ; } long metaTagBits = annotationBinding . getAnnotationTagBits ( ) ; if ( ( metaTagBits & TagBits . AnnotationRetentionMASK ) == <NUM_LIT:0> ) return true ; return ( metaTagBits & TagBits . AnnotationRetentionMASK ) == TagBits . AnnotationClassRetention ; } public boolean isRuntimeVisible ( ) { final TypeBinding annotationBinding = this . resolvedType ; if ( annotationBinding == null ) { return false ; } long metaTagBits = annotationBinding . getAnnotationTagBits ( ) ; if ( ( metaTagBits & TagBits . AnnotationRetentionMASK ) == <NUM_LIT:0> ) return false ; return ( metaTagBits & TagBits . AnnotationRetentionMASK ) == TagBits . AnnotationRuntimeRetention ; } public abstract MemberValuePair [ ] memberValuePairs ( ) ; public StringBuffer printExpression ( int indent , StringBuffer output ) { output . append ( '<CHAR_LIT>' ) ; this . type . printExpression ( <NUM_LIT:0> , output ) ; return output ; } public void recordSuppressWarnings ( Scope scope , int startSuppresss , int endSuppress , boolean isSuppressingWarnings ) { IrritantSet suppressWarningIrritants = null ; MemberValuePair [ ] pairs = memberValuePairs ( ) ; pairLoop : for ( int i = <NUM_LIT:0> , length = pairs . length ; i < length ; i ++ ) { MemberValuePair pair = pairs [ i ] ; if ( CharOperation . equals ( pair . name , TypeConstants . VALUE ) ) { Expression value = pair . value ; if ( value instanceof ArrayInitializer ) { ArrayInitializer initializer = ( ArrayInitializer ) value ; Expression [ ] inits = initializer . expressions ; if ( inits != null ) { for ( int j = <NUM_LIT:0> , initsLength = inits . length ; j < initsLength ; j ++ ) { Constant cst = inits [ j ] . constant ; if ( cst != Constant . NotAConstant && cst . typeID ( ) == T_JavaLangString ) { IrritantSet irritants = CompilerOptions . warningTokenToIrritants ( cst . stringValue ( ) ) ; if ( irritants != null ) { if ( suppressWarningIrritants == null ) { suppressWarningIrritants = new IrritantSet ( irritants ) ; } else if ( suppressWarningIrritants . set ( irritants ) == null ) { scope . problemReporter ( ) . unusedWarningToken ( inits [ j ] ) ; } } else { scope . problemReporter ( ) . unhandledWarningToken ( inits [ j ] ) ; } } } } } else { Constant cst = value . constant ; if ( cst != Constant . NotAConstant && cst . typeID ( ) == T_JavaLangString ) { IrritantSet irritants = CompilerOptions . warningTokenToIrritants ( cst . stringValue ( ) ) ; if ( irritants != null ) { suppressWarningIrritants = new IrritantSet ( irritants ) ; } else { scope . problemReporter ( ) . unhandledWarningToken ( value ) ; } } } break pairLoop ; } } if ( isSuppressingWarnings && suppressWarningIrritants != null ) { scope . referenceCompilationUnit ( ) . recordSuppressWarnings ( suppressWarningIrritants , this , startSuppresss , endSuppress ) ; } } public TypeBinding resolveType ( BlockScope scope ) { if ( this . compilerAnnotation != null ) return this . resolvedType ; this . constant = Constant . NotAConstant ; TypeBinding typeBinding = this . type . resolveType ( scope ) ; if ( typeBinding == null ) { return null ; } this . resolvedType = typeBinding ; if ( ! typeBinding . isAnnotationType ( ) && typeBinding . isValidBinding ( ) ) { scope . problemReporter ( ) . typeMismatchError ( typeBinding , scope . getJavaLangAnnotationAnnotation ( ) , this . type , null ) ; return null ; } ReferenceBinding annotationType = ( ReferenceBinding ) this . resolvedType ; MethodBinding [ ] methods = annotationType . methods ( ) ; MemberValuePair [ ] originalValuePairs = memberValuePairs ( ) ; MemberValuePair valueAttribute = null ; MemberValuePair [ ] pairs ; int pairsLength = originalValuePairs . length ; if ( pairsLength > <NUM_LIT:0> ) { System . arraycopy ( originalValuePairs , <NUM_LIT:0> , pairs = new MemberValuePair [ pairsLength ] , <NUM_LIT:0> , pairsLength ) ; } else { pairs = originalValuePairs ; } nextMember : for ( int i = <NUM_LIT:0> , requiredLength = methods . length ; i < requiredLength ; i ++ ) { MethodBinding method = methods [ i ] ; char [ ] selector = method . selector ; boolean foundValue = false ; nextPair : for ( int j = <NUM_LIT:0> ; j < pairsLength ; j ++ ) { MemberValuePair pair = pairs [ j ] ; if ( pair == null ) continue nextPair ; char [ ] name = pair . name ; if ( CharOperation . equals ( name , selector ) ) { if ( valueAttribute == null && CharOperation . equals ( name , TypeConstants . VALUE ) ) { valueAttribute = pair ; } pair . binding = method ; pair . resolveTypeExpecting ( scope , method . returnType ) ; pairs [ j ] = null ; foundValue = true ; boolean foundDuplicate = false ; for ( int k = j + <NUM_LIT:1> ; k < pairsLength ; k ++ ) { MemberValuePair otherPair = pairs [ k ] ; if ( otherPair == null ) continue ; if ( CharOperation . equals ( otherPair . name , selector ) ) { foundDuplicate = true ; scope . problemReporter ( ) . duplicateAnnotationValue ( annotationType , otherPair ) ; otherPair . binding = method ; otherPair . resolveTypeExpecting ( scope , method . returnType ) ; pairs [ k ] = null ; } } if ( foundDuplicate ) { scope . problemReporter ( ) . duplicateAnnotationValue ( annotationType , pair ) ; continue nextMember ; } } } if ( ! foundValue && ( method . modifiers & ClassFileConstants . AccAnnotationDefault ) == <NUM_LIT:0> && ( this . bits & IsRecovered ) == <NUM_LIT:0> ) { scope . problemReporter ( ) . missingValueForAnnotationMember ( this , selector ) ; } } for ( int i = <NUM_LIT:0> ; i < pairsLength ; i ++ ) { if ( pairs [ i ] != null ) { scope . problemReporter ( ) . undefinedAnnotationValue ( annotationType , pairs [ i ] ) ; pairs [ i ] . resolveTypeExpecting ( scope , null ) ; } } this . compilerAnnotation = scope . environment ( ) . createAnnotation ( ( ReferenceBinding ) this . resolvedType , computeElementValuePairs ( ) ) ; long tagBits = detectStandardAnnotation ( scope , annotationType , valueAttribute ) ; scope . referenceCompilationUnit ( ) . recordSuppressWarnings ( IrritantSet . NLS , null , this . sourceStart , this . declarationSourceEnd ) ; if ( this . recipient != null ) { if ( tagBits != <NUM_LIT:0> ) { switch ( this . recipient . kind ( ) ) { case Binding . PACKAGE : ( ( PackageBinding ) this . recipient ) . tagBits |= tagBits ; break ; case Binding . TYPE : case Binding . GENERIC_TYPE : SourceTypeBinding sourceType = ( SourceTypeBinding ) this . recipient ; sourceType . tagBits |= tagBits ; if ( ( tagBits & TagBits . AnnotationSuppressWarnings ) != <NUM_LIT:0> ) { TypeDeclaration typeDeclaration = sourceType . scope . referenceContext ; int start ; if ( scope . referenceCompilationUnit ( ) . types [ <NUM_LIT:0> ] == typeDeclaration ) { start = <NUM_LIT:0> ; } else { start = typeDeclaration . declarationSourceStart ; } recordSuppressWarnings ( scope , start , typeDeclaration . declarationSourceEnd , scope . compilerOptions ( ) . suppressWarnings ) ; } break ; case Binding . METHOD : MethodBinding sourceMethod = ( MethodBinding ) this . recipient ; sourceMethod . tagBits |= tagBits ; if ( ( tagBits & TagBits . AnnotationSuppressWarnings ) != <NUM_LIT:0> ) { sourceType = ( SourceTypeBinding ) sourceMethod . declaringClass ; AbstractMethodDeclaration methodDeclaration = sourceType . scope . referenceContext . declarationOf ( sourceMethod ) ; recordSuppressWarnings ( scope , methodDeclaration . declarationSourceStart , methodDeclaration . declarationSourceEnd , scope . compilerOptions ( ) . suppressWarnings ) ; } break ; case Binding . FIELD : FieldBinding sourceField = ( FieldBinding ) this . recipient ; sourceField . tagBits |= tagBits ; if ( ( tagBits & TagBits . AnnotationSuppressWarnings ) != <NUM_LIT:0> ) { sourceType = ( SourceTypeBinding ) sourceField . declaringClass ; FieldDeclaration fieldDeclaration = sourceType . scope . referenceContext . declarationOf ( sourceField ) ; recordSuppressWarnings ( scope , fieldDeclaration . declarationSourceStart , fieldDeclaration . declarationSourceEnd , scope . compilerOptions ( ) . suppressWarnings ) ; } break ; case Binding . LOCAL : LocalVariableBinding variable = ( LocalVariableBinding ) this . recipient ; variable . tagBits |= tagBits ; if ( ( tagBits & TagBits . AnnotationSuppressWarnings ) != <NUM_LIT:0> ) { LocalDeclaration localDeclaration = variable . declaration ; recordSuppressWarnings ( scope , localDeclaration . declarationSourceStart , localDeclaration . declarationSourceEnd , scope . compilerOptions ( ) . suppressWarnings ) ; } break ; } } if ( scope . compilationUnitScope ( ) . checkTargetCompatibility ( ) ) { checkTargetCompatibility : { long metaTagBits = annotationType . getAnnotationTagBits ( ) ; if ( ( metaTagBits & TagBits . AnnotationTargetMASK ) == <NUM_LIT:0> ) break checkTargetCompatibility ; switch ( this . recipient . kind ( ) ) { case Binding . PACKAGE : if ( ( metaTagBits & TagBits . AnnotationForPackage ) != <NUM_LIT:0> ) break checkTargetCompatibility ; break ; case Binding . TYPE : case Binding . GENERIC_TYPE : if ( ( ( ReferenceBinding ) this . recipient ) . isAnnotationType ( ) ) { if ( ( metaTagBits & ( TagBits . AnnotationForAnnotationType | TagBits . AnnotationForType ) ) != <NUM_LIT:0> ) break checkTargetCompatibility ; } else if ( ( metaTagBits & TagBits . AnnotationForType ) != <NUM_LIT:0> ) { break checkTargetCompatibility ; } else if ( ( metaTagBits & TagBits . AnnotationForPackage ) != <NUM_LIT:0> ) { if ( CharOperation . equals ( ( ( ReferenceBinding ) this . recipient ) . sourceName , TypeConstants . PACKAGE_INFO_NAME ) ) break checkTargetCompatibility ; } break ; case Binding . METHOD : if ( ( ( MethodBinding ) this . recipient ) . isConstructor ( ) ) { if ( ( metaTagBits & TagBits . AnnotationForConstructor ) != <NUM_LIT:0> ) break checkTargetCompatibility ; } else if ( ( metaTagBits & TagBits . AnnotationForMethod ) != <NUM_LIT:0> ) break checkTargetCompatibility ; break ; case Binding . FIELD : if ( ( metaTagBits & TagBits . AnnotationForField ) != <NUM_LIT:0> ) break checkTargetCompatibility ; break ; case Binding . LOCAL : if ( ( ( ( LocalVariableBinding ) this . recipient ) . tagBits & TagBits . IsArgument ) != <NUM_LIT:0> ) { if ( ( metaTagBits & TagBits . AnnotationForParameter ) != <NUM_LIT:0> ) break checkTargetCompatibility ; } else if ( ( annotationType . tagBits & TagBits . AnnotationForLocalVariable ) != <NUM_LIT:0> ) break checkTargetCompatibility ; break ; } scope . problemReporter ( ) . disallowedTargetForAnnotation ( this ) ; } } } return this . resolvedType ; } public abstract void traverse ( ASTVisitor visitor , BlockScope scope ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . impl . * ; public class IntLiteralMinValue extends IntLiteral { final static char [ ] CharValue = new char [ ] { '<CHAR_LIT:->' , '<CHAR_LIT>' , '<CHAR_LIT:1>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' } ; public IntLiteralMinValue ( char [ ] token , char [ ] reducedToken , int start , int end ) { super ( token , reducedToken , start , end , Integer . MIN_VALUE , IntConstant . fromValue ( Integer . MIN_VALUE ) ) ; } public void computeConstant ( ) { } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class QualifiedSuperReference extends QualifiedThisReference { public QualifiedSuperReference ( TypeReference name , int pos , int sourceEnd ) { super ( name , pos , sourceEnd ) ; } public boolean isSuper ( ) { return true ; } public boolean isThis ( ) { return false ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { return this . qualification . print ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; } public TypeBinding resolveType ( BlockScope scope ) { if ( ( this . bits & ParenthesizedMASK ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . invalidParenthesizedExpression ( this ) ; return null ; } super . resolveType ( scope ) ; if ( this . currentCompatibleType == null ) return null ; if ( this . currentCompatibleType . id == T_JavaLangObject ) { scope . problemReporter ( ) . cannotUseSuperInJavaLangObject ( this ) ; return null ; } return this . resolvedType = this . currentCompatibleType . superclass ( ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . qualification . traverse ( visitor , blockScope ) ; } visitor . endVisit ( this , blockScope ) ; } public void traverse ( ASTVisitor visitor , ClassScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . qualification . traverse ( visitor , blockScope ) ; } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class UnaryExpression extends OperatorExpression { public Expression expression ; public Constant optimizedBooleanConstant ; public UnaryExpression ( Expression expression , int operator ) { this . expression = expression ; this . bits |= operator << OperatorSHIFT ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . expression . checkNPE ( currentScope , flowContext , flowInfo ) ; if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == NOT ) { return this . expression . analyseCode ( currentScope , flowContext , flowInfo ) . asNegatedCondition ( ) ; } else { return this . expression . analyseCode ( currentScope , flowContext , flowInfo ) ; } } public Constant optimizedBooleanConstant ( ) { return this . optimizedBooleanConstant == null ? this . constant : this . optimizedBooleanConstant ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; BranchLabel falseLabel , endifLabel ; if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } switch ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) { case NOT : switch ( ( this . expression . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_boolean : this . expression . generateOptimizedBoolean ( currentScope , codeStream , null , ( falseLabel = new BranchLabel ( codeStream ) ) , valueRequired ) ; if ( valueRequired ) { codeStream . iconst_0 ( ) ; if ( falseLabel . forwardReferenceCount ( ) > <NUM_LIT:0> ) { codeStream . goto_ ( endifLabel = new BranchLabel ( codeStream ) ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; falseLabel . place ( ) ; codeStream . iconst_1 ( ) ; endifLabel . place ( ) ; } } else { falseLabel . place ( ) ; } break ; } break ; case TWIDDLE : switch ( ( this . expression . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : this . expression . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { codeStream . iconst_m1 ( ) ; codeStream . ixor ( ) ; } break ; case T_long : this . expression . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { codeStream . ldc2_w ( - <NUM_LIT:1L> ) ; codeStream . lxor ( ) ; } } break ; case MINUS : if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) { switch ( ( this . expression . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : codeStream . generateInlinedValue ( this . constant . intValue ( ) * - <NUM_LIT:1> ) ; break ; case T_float : codeStream . generateInlinedValue ( this . constant . floatValue ( ) * - <NUM_LIT:1.0f> ) ; break ; case T_long : codeStream . generateInlinedValue ( this . constant . longValue ( ) * - <NUM_LIT:1L> ) ; break ; case T_double : codeStream . generateInlinedValue ( this . constant . doubleValue ( ) * - <NUM_LIT:1.0> ) ; } } } else { this . expression . generateCode ( currentScope , codeStream , valueRequired ) ; if ( valueRequired ) { switch ( ( this . expression . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_int : codeStream . ineg ( ) ; break ; case T_float : codeStream . fneg ( ) ; break ; case T_long : codeStream . lneg ( ) ; break ; case T_double : codeStream . dneg ( ) ; } } } break ; case PLUS : this . expression . generateCode ( currentScope , codeStream , valueRequired ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { if ( ( this . constant != Constant . NotAConstant ) && ( this . constant . typeID ( ) == T_boolean ) ) { super . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; return ; } if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == NOT ) { this . expression . generateOptimizedBoolean ( currentScope , codeStream , falseLabel , trueLabel , valueRequired ) ; } else { super . generateOptimizedBoolean ( currentScope , codeStream , trueLabel , falseLabel , valueRequired ) ; } } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { output . append ( operatorToString ( ) ) . append ( '<CHAR_LIT:U+0020>' ) ; return this . expression . printExpression ( <NUM_LIT:0> , output ) ; } public TypeBinding resolveType ( BlockScope scope ) { boolean expressionIsCast ; if ( ( expressionIsCast = this . expression instanceof CastExpression ) == true ) this . expression . bits |= DisableUnnecessaryCastCheck ; TypeBinding expressionType = this . expression . resolveType ( scope ) ; if ( expressionType == null ) { this . constant = Constant . NotAConstant ; return null ; } int expressionTypeID = expressionType . id ; boolean use15specifics = scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ; if ( use15specifics ) { if ( ! expressionType . isBaseType ( ) ) { expressionTypeID = scope . environment ( ) . computeBoxingType ( expressionType ) . id ; } } if ( expressionTypeID > <NUM_LIT:15> ) { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidOperator ( this , expressionType ) ; return null ; } int tableId ; switch ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) { case NOT : tableId = AND_AND ; break ; case TWIDDLE : tableId = LEFT_SHIFT ; break ; default : tableId = MINUS ; } int operatorSignature = OperatorSignatures [ tableId ] [ ( expressionTypeID << <NUM_LIT:4> ) + expressionTypeID ] ; this . expression . computeConversion ( scope , TypeBinding . wellKnownType ( scope , ( operatorSignature > > > <NUM_LIT:16> ) & <NUM_LIT> ) , expressionType ) ; this . bits |= operatorSignature & <NUM_LIT> ; switch ( operatorSignature & <NUM_LIT> ) { case T_boolean : this . resolvedType = TypeBinding . BOOLEAN ; break ; case T_byte : this . resolvedType = TypeBinding . BYTE ; break ; case T_char : this . resolvedType = TypeBinding . CHAR ; break ; case T_double : this . resolvedType = TypeBinding . DOUBLE ; break ; case T_float : this . resolvedType = TypeBinding . FLOAT ; break ; case T_int : this . resolvedType = TypeBinding . INT ; break ; case T_long : this . resolvedType = TypeBinding . LONG ; break ; default : this . constant = Constant . NotAConstant ; if ( expressionTypeID != T_undefined ) scope . problemReporter ( ) . invalidOperator ( this , expressionType ) ; return null ; } if ( this . expression . constant != Constant . NotAConstant ) { this . constant = Constant . computeConstantOperation ( this . expression . constant , expressionTypeID , ( this . bits & OperatorMASK ) > > OperatorSHIFT ) ; } else { this . constant = Constant . NotAConstant ; if ( ( ( this . bits & OperatorMASK ) > > OperatorSHIFT ) == NOT ) { Constant cst = this . expression . optimizedBooleanConstant ( ) ; if ( cst != Constant . NotAConstant ) this . optimizedBooleanConstant = BooleanConstant . fromValue ( ! cst . booleanValue ( ) ) ; } } if ( expressionIsCast ) { CastExpression . checkNeedForArgumentCast ( scope , tableId , operatorSignature , this . expression , expressionTypeID ) ; } return this . resolvedType ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { if ( visitor . visit ( this , blockScope ) ) { this . expression . traverse ( visitor , blockScope ) ; } visitor . endVisit ( this , blockScope ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . parser . * ; import org . eclipse . jdt . internal . compiler . problem . * ; import org . eclipse . jdt . internal . compiler . util . Util ; public class TypeDeclaration extends Statement implements ProblemSeverities , ReferenceContext { public static final int CLASS_DECL = <NUM_LIT:1> ; public static final int INTERFACE_DECL = <NUM_LIT:2> ; public static final int ENUM_DECL = <NUM_LIT:3> ; public static final int ANNOTATION_TYPE_DECL = <NUM_LIT:4> ; public int modifiers = ClassFileConstants . AccDefault ; public int modifiersSourceStart ; public Annotation [ ] annotations ; public char [ ] name ; public TypeReference superclass ; public TypeReference [ ] superInterfaces ; public FieldDeclaration [ ] fields ; public AbstractMethodDeclaration [ ] methods ; public TypeDeclaration [ ] memberTypes ; public SourceTypeBinding binding ; public ClassScope scope ; public MethodScope initializerScope ; public MethodScope staticInitializerScope ; public boolean ignoreFurtherInvestigation = false ; public int maxFieldCount ; public int declarationSourceStart ; public int declarationSourceEnd ; public int bodyStart ; public int bodyEnd ; public CompilationResult compilationResult ; public MethodDeclaration [ ] missingAbstractMethods ; public Javadoc javadoc ; public QualifiedAllocationExpression allocation ; public TypeDeclaration enclosingType ; public FieldBinding enumValuesSyntheticfield ; public int enumConstantsCounter ; public TypeParameter [ ] typeParameters ; public TypeDeclaration ( CompilationResult compilationResult ) { this . compilationResult = compilationResult ; } public void abort ( int abortLevel , CategorizedProblem problem ) { switch ( abortLevel ) { case AbortCompilation : throw new AbortCompilation ( this . compilationResult , problem ) ; case AbortCompilationUnit : throw new AbortCompilationUnit ( this . compilationResult , problem ) ; case AbortMethod : throw new AbortMethod ( this . compilationResult , problem ) ; default : throw new AbortType ( this . compilationResult , problem ) ; } } public final void addClinit ( ) { if ( needClassInitMethod ( ) ) { int length ; AbstractMethodDeclaration [ ] methodDeclarations ; if ( ( methodDeclarations = this . methods ) == null ) { length = <NUM_LIT:0> ; methodDeclarations = new AbstractMethodDeclaration [ <NUM_LIT:1> ] ; } else { length = methodDeclarations . length ; System . arraycopy ( methodDeclarations , <NUM_LIT:0> , ( methodDeclarations = new AbstractMethodDeclaration [ length + <NUM_LIT:1> ] ) , <NUM_LIT:1> , length ) ; } Clinit clinit = new Clinit ( this . compilationResult ) ; methodDeclarations [ <NUM_LIT:0> ] = clinit ; clinit . declarationSourceStart = clinit . sourceStart = this . sourceStart ; clinit . declarationSourceEnd = clinit . sourceEnd = this . sourceEnd ; clinit . bodyEnd = this . sourceEnd ; this . methods = methodDeclarations ; } } public MethodDeclaration addMissingAbstractMethodFor ( MethodBinding methodBinding ) { TypeBinding [ ] argumentTypes = methodBinding . parameters ; int argumentsLength = argumentTypes . length ; MethodDeclaration methodDeclaration = new MethodDeclaration ( this . compilationResult ) ; methodDeclaration . selector = methodBinding . selector ; methodDeclaration . sourceStart = this . sourceStart ; methodDeclaration . sourceEnd = this . sourceEnd ; methodDeclaration . modifiers = methodBinding . getAccessFlags ( ) & ~ ClassFileConstants . AccAbstract ; if ( argumentsLength > <NUM_LIT:0> ) { String baseName = "<STR_LIT>" ; Argument [ ] arguments = ( methodDeclaration . arguments = new Argument [ argumentsLength ] ) ; for ( int i = argumentsLength ; -- i >= <NUM_LIT:0> ; ) { arguments [ i ] = new Argument ( ( baseName + i ) . toCharArray ( ) , <NUM_LIT> , null , ClassFileConstants . AccDefault ) ; } } if ( this . missingAbstractMethods == null ) { this . missingAbstractMethods = new MethodDeclaration [ ] { methodDeclaration } ; } else { MethodDeclaration [ ] newMethods ; System . arraycopy ( this . missingAbstractMethods , <NUM_LIT:0> , newMethods = new MethodDeclaration [ this . missingAbstractMethods . length + <NUM_LIT:1> ] , <NUM_LIT:1> , this . missingAbstractMethods . length ) ; newMethods [ <NUM_LIT:0> ] = methodDeclaration ; this . missingAbstractMethods = newMethods ; } methodDeclaration . binding = new MethodBinding ( methodDeclaration . modifiers | ClassFileConstants . AccSynthetic , methodBinding . selector , methodBinding . returnType , argumentsLength == <NUM_LIT:0> ? Binding . NO_PARAMETERS : argumentTypes , methodBinding . thrownExceptions , this . binding ) ; methodDeclaration . scope = new MethodScope ( this . scope , methodDeclaration , true ) ; methodDeclaration . bindArguments ( ) ; return methodDeclaration ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . ignoreFurtherInvestigation ) return flowInfo ; try { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . IsReachable ; LocalTypeBinding localType = ( LocalTypeBinding ) this . binding ; localType . setConstantPoolName ( currentScope . compilationUnitScope ( ) . computeConstantPoolName ( localType ) ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; updateMaxFieldCount ( ) ; internalAnalyseCode ( flowContext , flowInfo ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } return flowInfo ; } public void analyseCode ( ClassScope enclosingClassScope ) { if ( this . ignoreFurtherInvestigation ) return ; try { updateMaxFieldCount ( ) ; internalAnalyseCode ( null , FlowInfo . initial ( this . maxFieldCount ) ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } } public void analyseCode ( ClassScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . ignoreFurtherInvestigation ) return ; try { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . IsReachable ; LocalTypeBinding localType = ( LocalTypeBinding ) this . binding ; localType . setConstantPoolName ( currentScope . compilationUnitScope ( ) . computeConstantPoolName ( localType ) ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; updateMaxFieldCount ( ) ; internalAnalyseCode ( flowContext , flowInfo ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } } public void analyseCode ( CompilationUnitScope unitScope ) { if ( this . ignoreFurtherInvestigation ) return ; try { internalAnalyseCode ( null , FlowInfo . initial ( this . maxFieldCount ) ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } } public boolean checkConstructors ( Parser parser ) { boolean hasConstructor = false ; if ( this . methods != null ) { for ( int i = this . methods . length ; -- i >= <NUM_LIT:0> ; ) { AbstractMethodDeclaration am ; if ( ( am = this . methods [ i ] ) . isConstructor ( ) ) { if ( ! CharOperation . equals ( am . selector , this . name ) ) { ConstructorDeclaration c = ( ConstructorDeclaration ) am ; if ( c . constructorCall == null || c . constructorCall . isImplicitSuper ( ) ) { MethodDeclaration m = parser . convertToMethodDeclaration ( c , this . compilationResult ) ; this . methods [ i ] = m ; } } else { switch ( kind ( this . modifiers ) ) { case TypeDeclaration . INTERFACE_DECL : parser . problemReporter ( ) . interfaceCannotHaveConstructors ( ( ConstructorDeclaration ) am ) ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : parser . problemReporter ( ) . annotationTypeDeclarationCannotHaveConstructor ( ( ConstructorDeclaration ) am ) ; break ; } hasConstructor = true ; } } } } return hasConstructor ; } public CompilationResult compilationResult ( ) { return this . compilationResult ; } public ConstructorDeclaration createDefaultConstructor ( boolean needExplicitConstructorCall , boolean needToInsert ) { ConstructorDeclaration constructor = new ConstructorDeclaration ( this . compilationResult ) ; constructor . bits |= ASTNode . IsDefaultConstructor ; constructor . selector = this . name ; constructor . modifiers = this . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; constructor . declarationSourceStart = constructor . sourceStart = this . sourceStart ; constructor . declarationSourceEnd = constructor . sourceEnd = constructor . bodyEnd = this . sourceEnd ; if ( needExplicitConstructorCall ) { constructor . constructorCall = SuperReference . implicitSuperConstructorCall ( ) ; constructor . constructorCall . sourceStart = this . sourceStart ; constructor . constructorCall . sourceEnd = this . sourceEnd ; } if ( needToInsert ) { if ( this . methods == null ) { this . methods = new AbstractMethodDeclaration [ ] { constructor } ; } else { AbstractMethodDeclaration [ ] newMethods ; System . arraycopy ( this . methods , <NUM_LIT:0> , newMethods = new AbstractMethodDeclaration [ this . methods . length + <NUM_LIT:1> ] , <NUM_LIT:1> , this . methods . length ) ; newMethods [ <NUM_LIT:0> ] = constructor ; this . methods = newMethods ; } } return constructor ; } public MethodBinding createDefaultConstructorWithBinding ( MethodBinding inheritedConstructorBinding , boolean eraseThrownExceptions ) { String baseName = "<STR_LIT>" ; TypeBinding [ ] argumentTypes = inheritedConstructorBinding . parameters ; int argumentsLength = argumentTypes . length ; ConstructorDeclaration constructor = new ConstructorDeclaration ( this . compilationResult ) ; constructor . selector = new char [ ] { '<CHAR_LIT>' } ; constructor . sourceStart = this . sourceStart ; constructor . sourceEnd = this . sourceEnd ; int newModifiers = this . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; if ( inheritedConstructorBinding . isVarargs ( ) ) { newModifiers |= ClassFileConstants . AccVarargs ; } constructor . modifiers = newModifiers ; constructor . bits |= ASTNode . IsDefaultConstructor ; if ( argumentsLength > <NUM_LIT:0> ) { Argument [ ] arguments = ( constructor . arguments = new Argument [ argumentsLength ] ) ; for ( int i = argumentsLength ; -- i >= <NUM_LIT:0> ; ) { arguments [ i ] = new Argument ( ( baseName + i ) . toCharArray ( ) , <NUM_LIT> , null , ClassFileConstants . AccDefault ) ; } } constructor . constructorCall = SuperReference . implicitSuperConstructorCall ( ) ; constructor . constructorCall . sourceStart = this . sourceStart ; constructor . constructorCall . sourceEnd = this . sourceEnd ; if ( argumentsLength > <NUM_LIT:0> ) { Expression [ ] args ; args = constructor . constructorCall . arguments = new Expression [ argumentsLength ] ; for ( int i = argumentsLength ; -- i >= <NUM_LIT:0> ; ) { args [ i ] = new SingleNameReference ( ( baseName + i ) . toCharArray ( ) , <NUM_LIT> ) ; } } if ( this . methods == null ) { this . methods = new AbstractMethodDeclaration [ ] { constructor } ; } else { AbstractMethodDeclaration [ ] newMethods ; System . arraycopy ( this . methods , <NUM_LIT:0> , newMethods = new AbstractMethodDeclaration [ this . methods . length + <NUM_LIT:1> ] , <NUM_LIT:1> , this . methods . length ) ; newMethods [ <NUM_LIT:0> ] = constructor ; this . methods = newMethods ; } ReferenceBinding [ ] thrownExceptions = eraseThrownExceptions ? this . scope . environment ( ) . convertToRawTypes ( inheritedConstructorBinding . thrownExceptions , true , true ) : inheritedConstructorBinding . thrownExceptions ; SourceTypeBinding sourceType = this . binding ; constructor . binding = new MethodBinding ( constructor . modifiers , argumentsLength == <NUM_LIT:0> ? Binding . NO_PARAMETERS : argumentTypes , thrownExceptions , sourceType ) ; constructor . binding . tagBits |= ( inheritedConstructorBinding . tagBits & TagBits . HasMissingType ) ; constructor . binding . modifiers |= ExtraCompilerModifiers . AccIsDefaultConstructor ; constructor . scope = new MethodScope ( this . scope , constructor , true ) ; constructor . bindArguments ( ) ; constructor . constructorCall . resolve ( constructor . scope ) ; MethodBinding [ ] methodBindings = sourceType . methods ( ) ; int length ; System . arraycopy ( methodBindings , <NUM_LIT:0> , methodBindings = new MethodBinding [ ( length = methodBindings . length ) + <NUM_LIT:1> ] , <NUM_LIT:1> , length ) ; methodBindings [ <NUM_LIT:0> ] = constructor . binding ; if ( ++ length > <NUM_LIT:1> ) ReferenceBinding . sortMethods ( methodBindings , <NUM_LIT:0> , length ) ; sourceType . setMethods ( methodBindings ) ; return constructor . binding ; } public FieldDeclaration declarationOf ( FieldBinding fieldBinding ) { if ( fieldBinding != null && this . fields != null ) { for ( int i = <NUM_LIT:0> , max = this . fields . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl ; if ( ( fieldDecl = this . fields [ i ] ) . binding == fieldBinding ) return fieldDecl ; } } return null ; } public TypeDeclaration declarationOf ( MemberTypeBinding memberTypeBinding ) { if ( memberTypeBinding != null && this . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = this . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberTypeDecl ; if ( ( memberTypeDecl = this . memberTypes [ i ] ) . binding == memberTypeBinding ) return memberTypeDecl ; } } return null ; } public AbstractMethodDeclaration declarationOf ( MethodBinding methodBinding ) { if ( methodBinding != null && this . methods != null ) { for ( int i = <NUM_LIT:0> , max = this . methods . length ; i < max ; i ++ ) { AbstractMethodDeclaration methodDecl ; if ( ( methodDecl = this . methods [ i ] ) . binding == methodBinding ) return methodDecl ; } } return null ; } public TypeDeclaration declarationOfType ( char [ ] [ ] typeName ) { int typeNameLength = typeName . length ; if ( typeNameLength < <NUM_LIT:1> || ! CharOperation . equals ( typeName [ <NUM_LIT:0> ] , this . name ) ) { return null ; } if ( typeNameLength == <NUM_LIT:1> ) { return this ; } char [ ] [ ] subTypeName = new char [ typeNameLength - <NUM_LIT:1> ] [ ] ; System . arraycopy ( typeName , <NUM_LIT:1> , subTypeName , <NUM_LIT:0> , typeNameLength - <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> ; i < this . memberTypes . length ; i ++ ) { TypeDeclaration typeDecl = this . memberTypes [ i ] . declarationOfType ( subTypeName ) ; if ( typeDecl != null ) { return typeDecl ; } } return null ; } 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 ; ClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; return ; } try { ClassFile classFile = ClassFile . getNewInstance ( this . binding ) ; classFile . initialize ( this . binding , enclosingClassFile , false ) ; 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 ) ; } } classFile . addFieldInfos ( ) ; 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 ; ClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; } } public void generateCode ( BlockScope blockScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } if ( ( this . bits & ASTNode . HasBeenGenerated ) != <NUM_LIT:0> ) return ; int pc = codeStream . position ; if ( this . binding != null ) { SyntheticArgumentBinding [ ] enclosingInstances = ( ( NestedTypeBinding ) this . binding ) . syntheticEnclosingInstances ( ) ; for ( int i = <NUM_LIT:0> , slotSize = <NUM_LIT:0> , count = enclosingInstances == null ? <NUM_LIT:0> : enclosingInstances . length ; i < count ; i ++ ) { SyntheticArgumentBinding enclosingInstance = enclosingInstances [ i ] ; enclosingInstance . resolvedPosition = ++ slotSize ; if ( slotSize > <NUM_LIT> ) { blockScope . problemReporter ( ) . noMoreAvailableSpaceForArgument ( enclosingInstance , blockScope . referenceType ( ) ) ; } } } generateCode ( codeStream . classFile ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCode ( ClassScope classScope , ClassFile enclosingClassFile ) { if ( ( this . bits & ASTNode . HasBeenGenerated ) != <NUM_LIT:0> ) return ; if ( this . binding != null ) { SyntheticArgumentBinding [ ] enclosingInstances = ( ( NestedTypeBinding ) this . binding ) . syntheticEnclosingInstances ( ) ; for ( int i = <NUM_LIT:0> , slotSize = <NUM_LIT:0> , count = enclosingInstances == null ? <NUM_LIT:0> : enclosingInstances . length ; i < count ; i ++ ) { SyntheticArgumentBinding enclosingInstance = enclosingInstances [ i ] ; enclosingInstance . resolvedPosition = ++ slotSize ; if ( slotSize > <NUM_LIT> ) { classScope . problemReporter ( ) . noMoreAvailableSpaceForArgument ( enclosingInstance , classScope . referenceType ( ) ) ; } } } generateCode ( enclosingClassFile ) ; } public void generateCode ( CompilationUnitScope unitScope ) { generateCode ( ( ClassFile ) null ) ; } public boolean hasErrors ( ) { return this . ignoreFurtherInvestigation ; } private void internalAnalyseCode ( FlowContext flowContext , FlowInfo flowInfo ) { if ( ! this . binding . isUsed ( ) && this . binding . isOrEnclosedByPrivateType ( ) ) { if ( ! this . scope . referenceCompilationUnit ( ) . compilationResult . hasSyntaxError ) { this . scope . problemReporter ( ) . unusedPrivateType ( this ) ; } } InitializationFlowContext initializerContext = new InitializationFlowContext ( null , this , flowInfo , flowContext , this . initializerScope ) ; InitializationFlowContext staticInitializerContext = new InitializationFlowContext ( null , this , flowInfo , flowContext , this . staticInitializerScope ) ; FlowInfo nonStaticFieldInfo = flowInfo . unconditionalFieldLessCopy ( ) ; FlowInfo staticFieldInfo = flowInfo . unconditionalFieldLessCopy ( ) ; if ( this . fields != null ) { for ( int i = <NUM_LIT:0> , count = this . fields . length ; i < count ; i ++ ) { FieldDeclaration field = this . fields [ i ] ; if ( field . isStatic ( ) ) { if ( ( staticFieldInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) field . bits &= ~ ASTNode . IsReachable ; staticInitializerContext . handledExceptions = Binding . ANY_EXCEPTION ; staticFieldInfo = field . analyseCode ( this . staticInitializerScope , staticInitializerContext , staticFieldInfo ) ; if ( staticFieldInfo == FlowInfo . DEAD_END ) { this . staticInitializerScope . problemReporter ( ) . initializerMustCompleteNormally ( field ) ; staticFieldInfo = FlowInfo . initial ( this . maxFieldCount ) . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } else { if ( ( nonStaticFieldInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) field . bits &= ~ ASTNode . IsReachable ; initializerContext . handledExceptions = Binding . ANY_EXCEPTION ; nonStaticFieldInfo = field . analyseCode ( this . initializerScope , initializerContext , nonStaticFieldInfo ) ; if ( nonStaticFieldInfo == FlowInfo . DEAD_END ) { this . initializerScope . problemReporter ( ) . initializerMustCompleteNormally ( field ) ; nonStaticFieldInfo = FlowInfo . initial ( this . maxFieldCount ) . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } } } if ( this . memberTypes != null ) { for ( int i = <NUM_LIT:0> , count = this . memberTypes . length ; i < count ; i ++ ) { if ( flowContext != null ) { this . memberTypes [ i ] . analyseCode ( this . scope , flowContext , nonStaticFieldInfo . copy ( ) . setReachMode ( flowInfo . reachMode ( ) ) ) ; } else { this . memberTypes [ i ] . analyseCode ( this . scope ) ; } } } if ( this . methods != null ) { UnconditionalFlowInfo outerInfo = flowInfo . unconditionalFieldLessCopy ( ) ; FlowInfo constructorInfo = nonStaticFieldInfo . unconditionalInits ( ) . discardNonFieldInitializations ( ) . addInitializationsFrom ( outerInfo ) ; for ( int i = <NUM_LIT:0> , count = this . methods . length ; i < count ; i ++ ) { AbstractMethodDeclaration method = this . methods [ i ] ; if ( method . ignoreFurtherInvestigation ) continue ; if ( method . isInitializationMethod ( ) ) { if ( method . isStatic ( ) ) { method . analyseCode ( this . scope , staticInitializerContext , staticFieldInfo . unconditionalInits ( ) . discardNonFieldInitializations ( ) . addInitializationsFrom ( outerInfo ) ) ; } else { ( ( ConstructorDeclaration ) method ) . analyseCode ( this . scope , initializerContext , constructorInfo . copy ( ) , flowInfo . reachMode ( ) ) ; } } else { method . analyseCode ( this . scope , null , flowInfo . copy ( ) ) ; } } } if ( this . binding . isEnum ( ) && ! this . binding . isAnonymousType ( ) ) { this . enumValuesSyntheticfield = this . binding . addSyntheticFieldForEnumValues ( ) ; } } public final static int kind ( int flags ) { switch ( flags & ( ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation | ClassFileConstants . AccEnum ) ) { case ClassFileConstants . AccInterface : return TypeDeclaration . INTERFACE_DECL ; case ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation : return TypeDeclaration . ANNOTATION_TYPE_DECL ; case ClassFileConstants . AccEnum : return TypeDeclaration . ENUM_DECL ; default : return TypeDeclaration . CLASS_DECL ; } } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return ; NestedTypeBinding nestedType = ( NestedTypeBinding ) this . binding ; MethodScope methodScope = currentScope . methodScope ( ) ; if ( ! methodScope . isStatic && ! methodScope . isConstructorCall ) { nestedType . addSyntheticArgumentAndField ( nestedType . enclosingType ( ) ) ; } if ( nestedType . isAnonymousType ( ) ) { ReferenceBinding superclassBinding = ( ReferenceBinding ) nestedType . superclass . erasure ( ) ; if ( superclassBinding . enclosingType ( ) != null && ! superclassBinding . isStatic ( ) ) { if ( ! superclassBinding . isLocalType ( ) || ( ( NestedTypeBinding ) superclassBinding ) . getSyntheticField ( superclassBinding . enclosingType ( ) , true ) != null ) { nestedType . addSyntheticArgument ( superclassBinding . enclosingType ( ) ) ; } } if ( ! methodScope . isStatic && methodScope . isConstructorCall && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_5 ) { ReferenceBinding enclosing = nestedType . enclosingType ( ) ; if ( enclosing . isNestedType ( ) ) { NestedTypeBinding nestedEnclosing = ( NestedTypeBinding ) enclosing ; SyntheticArgumentBinding syntheticEnclosingInstanceArgument = nestedEnclosing . getSyntheticArgument ( nestedEnclosing . enclosingType ( ) , true ) ; if ( syntheticEnclosingInstanceArgument != null ) { nestedType . addSyntheticArgumentAndField ( syntheticEnclosingInstanceArgument ) ; } } } } } public void manageEnclosingInstanceAccessIfNecessary ( ClassScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { NestedTypeBinding nestedType = ( NestedTypeBinding ) this . binding ; nestedType . addSyntheticArgumentAndField ( this . binding . enclosingType ( ) ) ; } } public final boolean needClassInitMethod ( ) { if ( ( this . bits & ASTNode . ContainsAssertion ) != <NUM_LIT:0> ) return true ; switch ( kind ( this . modifiers ) ) { case TypeDeclaration . INTERFACE_DECL : case TypeDeclaration . ANNOTATION_TYPE_DECL : return this . fields != null ; case TypeDeclaration . ENUM_DECL : return true ; } if ( this . fields != null ) { for ( int i = this . fields . length ; -- i >= <NUM_LIT:0> ; ) { FieldDeclaration field = this . fields [ i ] ; if ( ( field . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ) return true ; } } return false ; } public void parseMethods ( Parser parser , CompilationUnitDeclaration unit ) { if ( unit . ignoreMethodBodies ) return ; if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeDeclaration typeDeclaration = this . memberTypes [ i ] ; typeDeclaration . parseMethods ( parser , unit ) ; this . bits |= ( typeDeclaration . bits & ASTNode . HasSyntaxErrors ) ; } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { AbstractMethodDeclaration abstractMethodDeclaration = this . methods [ i ] ; abstractMethodDeclaration . parseStatements ( parser , unit ) ; this . bits |= ( abstractMethodDeclaration . bits & ASTNode . HasSyntaxErrors ) ; } } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { final FieldDeclaration fieldDeclaration = this . fields [ i ] ; switch ( fieldDeclaration . getKind ( ) ) { case AbstractVariableDeclaration . INITIALIZER : ( ( Initializer ) fieldDeclaration ) . parseStatements ( parser , this , unit ) ; this . bits |= ( fieldDeclaration . bits & ASTNode . HasSyntaxErrors ) ; break ; } } } } public StringBuffer print ( int indent , StringBuffer output ) { if ( this . javadoc != null ) { this . javadoc . print ( indent , output ) ; } if ( ( this . bits & ASTNode . IsAnonymousType ) == <NUM_LIT:0> ) { printIndent ( indent , output ) ; printHeader ( <NUM_LIT:0> , output ) ; } return printBody ( indent , output ) ; } public StringBuffer printBody ( int indent , StringBuffer output ) { output . append ( "<STR_LIT>" ) ; if ( this . memberTypes != null ) { for ( int i = <NUM_LIT:0> ; i < this . memberTypes . length ; i ++ ) { if ( this . memberTypes [ i ] != null ) { output . append ( '<STR_LIT:\n>' ) ; this . memberTypes [ i ] . print ( indent + <NUM_LIT:1> , output ) ; } } } if ( this . fields != null ) { for ( int fieldI = <NUM_LIT:0> ; fieldI < this . fields . length ; fieldI ++ ) { if ( this . fields [ fieldI ] != null ) { output . append ( '<STR_LIT:\n>' ) ; this . fields [ fieldI ] . print ( indent + <NUM_LIT:1> , output ) ; } } } if ( this . methods != null ) { for ( int i = <NUM_LIT:0> ; i < this . methods . length ; i ++ ) { if ( this . methods [ i ] != null ) { output . append ( '<STR_LIT:\n>' ) ; this . methods [ i ] . print ( indent + <NUM_LIT:1> , output ) ; } } } output . append ( '<STR_LIT:\n>' ) ; return printIndent ( indent , output ) . append ( '<CHAR_LIT:}>' ) ; } public StringBuffer printHeader ( int indent , StringBuffer output ) { printModifiers ( this . modifiers , output ) ; if ( this . annotations != null ) printAnnotations ( this . annotations , output ) ; switch ( kind ( this . modifiers ) ) { case TypeDeclaration . CLASS_DECL : output . append ( "<STR_LIT>" ) ; break ; case TypeDeclaration . INTERFACE_DECL : output . append ( "<STR_LIT>" ) ; break ; case TypeDeclaration . ENUM_DECL : output . append ( "<STR_LIT>" ) ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : output . append ( "<STR_LIT>" ) ; break ; } output . append ( this . name ) ; if ( this . typeParameters != null ) { output . append ( "<STR_LIT:<>" ) ; for ( int i = <NUM_LIT:0> ; i < this . typeParameters . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . typeParameters [ i ] . print ( <NUM_LIT:0> , output ) ; } output . append ( "<STR_LIT:>>" ) ; } if ( this . superclass != null ) { output . append ( "<STR_LIT>" ) ; this . superclass . print ( <NUM_LIT:0> , output ) ; } if ( this . superInterfaces != null && this . superInterfaces . length > <NUM_LIT:0> ) { switch ( kind ( this . modifiers ) ) { case TypeDeclaration . CLASS_DECL : case TypeDeclaration . ENUM_DECL : output . append ( "<STR_LIT>" ) ; break ; case TypeDeclaration . INTERFACE_DECL : case TypeDeclaration . ANNOTATION_TYPE_DECL : output . append ( "<STR_LIT>" ) ; break ; } for ( int i = <NUM_LIT:0> ; i < this . superInterfaces . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . superInterfaces [ i ] . print ( <NUM_LIT:0> , output ) ; } } return output ; } public StringBuffer printStatement ( int tab , StringBuffer output ) { return print ( tab , output ) ; } public void resolve ( ) { SourceTypeBinding sourceType = this . binding ; if ( sourceType == null ) { this . ignoreFurtherInvestigation = true ; return ; } try { boolean old = this . staticInitializerScope . insideTypeAnnotation ; try { this . staticInitializerScope . insideTypeAnnotation = true ; resolveAnnotations ( this . staticInitializerScope , this . annotations , sourceType ) ; } finally { this . staticInitializerScope . insideTypeAnnotation = old ; } if ( ( sourceType . getAnnotationTagBits ( ) & TagBits . AnnotationDeprecated ) == <NUM_LIT:0> && ( sourceType . modifiers & ClassFileConstants . AccDeprecated ) != <NUM_LIT:0> && this . scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ) { this . scope . problemReporter ( ) . missingDeprecatedAnnotationForType ( this ) ; } if ( ( this . bits & ASTNode . UndocumentedEmptyBlock ) != <NUM_LIT:0> ) { this . scope . problemReporter ( ) . undocumentedEmptyBlock ( this . bodyStart - <NUM_LIT:1> , this . bodyEnd ) ; } boolean needSerialVersion = this . scope . compilerOptions ( ) . getSeverity ( CompilerOptions . MissingSerialVersion ) != ProblemSeverities . Ignore && sourceType . isClass ( ) && sourceType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaIoExternalizable , false ) == null && sourceType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaIoSerializable , false ) != null ; if ( needSerialVersion ) { CompilationUnitScope compilationUnitScope = this . scope . compilationUnitScope ( ) ; MethodBinding methodBinding = sourceType . getExactMethod ( TypeConstants . WRITEREPLACE , Binding . NO_TYPES , compilationUnitScope ) ; ReferenceBinding [ ] throwsExceptions ; needSerialVersion = methodBinding == null || ! methodBinding . isValidBinding ( ) || methodBinding . returnType . id != TypeIds . T_JavaLangObject || ( throwsExceptions = methodBinding . thrownExceptions ) . length != <NUM_LIT:1> || throwsExceptions [ <NUM_LIT:0> ] . id != TypeIds . T_JavaIoObjectStreamException ; if ( needSerialVersion ) { boolean hasWriteObjectMethod = false ; boolean hasReadObjectMethod = false ; TypeBinding argumentTypeBinding = this . scope . getType ( TypeConstants . JAVA_IO_OBJECTOUTPUTSTREAM , <NUM_LIT:3> ) ; if ( argumentTypeBinding . isValidBinding ( ) ) { methodBinding = sourceType . getExactMethod ( TypeConstants . WRITEOBJECT , new TypeBinding [ ] { argumentTypeBinding } , compilationUnitScope ) ; hasWriteObjectMethod = methodBinding != null && methodBinding . isValidBinding ( ) && methodBinding . modifiers == ClassFileConstants . AccPrivate && methodBinding . returnType == TypeBinding . VOID && ( throwsExceptions = methodBinding . thrownExceptions ) . length == <NUM_LIT:1> && throwsExceptions [ <NUM_LIT:0> ] . id == TypeIds . T_JavaIoException ; } argumentTypeBinding = this . scope . getType ( TypeConstants . JAVA_IO_OBJECTINPUTSTREAM , <NUM_LIT:3> ) ; if ( argumentTypeBinding . isValidBinding ( ) ) { methodBinding = sourceType . getExactMethod ( TypeConstants . READOBJECT , new TypeBinding [ ] { argumentTypeBinding } , compilationUnitScope ) ; hasReadObjectMethod = methodBinding != null && methodBinding . isValidBinding ( ) && methodBinding . modifiers == ClassFileConstants . AccPrivate && methodBinding . returnType == TypeBinding . VOID && ( throwsExceptions = methodBinding . thrownExceptions ) . length == <NUM_LIT:1> && throwsExceptions [ <NUM_LIT:0> ] . id == TypeIds . T_JavaIoException ; } needSerialVersion = ! hasWriteObjectMethod || ! hasReadObjectMethod ; } } if ( sourceType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaLangThrowable , true ) != null ) { ReferenceBinding current = sourceType ; checkEnclosedInGeneric : do { if ( current . isGenericType ( ) ) { this . scope . problemReporter ( ) . genericTypeCannotExtendThrowable ( this ) ; break checkEnclosedInGeneric ; } if ( current . isStatic ( ) ) break checkEnclosedInGeneric ; if ( current . isLocalType ( ) ) { NestedTypeBinding nestedType = ( NestedTypeBinding ) current . erasure ( ) ; if ( nestedType . scope . methodScope ( ) . isStatic ) break checkEnclosedInGeneric ; } } while ( ( current = current . enclosingType ( ) ) != null ) ; } int localMaxFieldCount = <NUM_LIT:0> ; int lastVisibleFieldID = - <NUM_LIT:1> ; boolean hasEnumConstants = false ; FieldDeclaration [ ] enumConstantsWithoutBody = null ; if ( this . typeParameters != null ) { for ( int i = <NUM_LIT:0> , count = this . typeParameters . length ; i < count ; i ++ ) { this . typeParameters [ i ] . resolve ( this . scope ) ; } } if ( this . memberTypes != null ) { for ( int i = <NUM_LIT:0> , count = this . memberTypes . length ; i < count ; i ++ ) { this . memberTypes [ i ] . resolve ( this . scope ) ; } } if ( this . fields != null ) { for ( int i = <NUM_LIT:0> , count = this . fields . length ; i < count ; i ++ ) { FieldDeclaration field = this . fields [ i ] ; switch ( field . getKind ( ) ) { case AbstractVariableDeclaration . ENUM_CONSTANT : hasEnumConstants = true ; if ( ! ( field . initialization instanceof QualifiedAllocationExpression ) ) { if ( enumConstantsWithoutBody == null ) enumConstantsWithoutBody = new FieldDeclaration [ count ] ; enumConstantsWithoutBody [ i ] = field ; } case AbstractVariableDeclaration . FIELD : FieldBinding fieldBinding = field . binding ; if ( fieldBinding == null ) { if ( field . initialization != null ) field . initialization . resolve ( field . isStatic ( ) ? this . staticInitializerScope : this . initializerScope ) ; this . ignoreFurtherInvestigation = true ; continue ; } if ( needSerialVersion && ( ( fieldBinding . modifiers & ( ClassFileConstants . AccStatic | ClassFileConstants . AccFinal ) ) == ( ClassFileConstants . AccStatic | ClassFileConstants . AccFinal ) ) && CharOperation . equals ( TypeConstants . SERIALVERSIONUID , fieldBinding . name ) && TypeBinding . LONG == fieldBinding . type ) { needSerialVersion = false ; } localMaxFieldCount ++ ; lastVisibleFieldID = field . binding . id ; break ; case AbstractVariableDeclaration . INITIALIZER : ( ( Initializer ) field ) . lastVisibleFieldID = lastVisibleFieldID + <NUM_LIT:1> ; break ; } field . resolve ( field . isStatic ( ) ? this . staticInitializerScope : this . initializerScope ) ; } } if ( this . maxFieldCount < localMaxFieldCount ) { this . maxFieldCount = localMaxFieldCount ; } if ( needSerialVersion ) { TypeBinding javaxRmiCorbaStub = this . scope . getType ( TypeConstants . JAVAX_RMI_CORBA_STUB , <NUM_LIT:4> ) ; if ( javaxRmiCorbaStub . isValidBinding ( ) ) { ReferenceBinding superclassBinding = this . binding . superclass ; loop : while ( superclassBinding != null ) { if ( superclassBinding == javaxRmiCorbaStub ) { needSerialVersion = false ; break loop ; } superclassBinding = superclassBinding . superclass ( ) ; } } if ( needSerialVersion ) { this . scope . problemReporter ( ) . missingSerialVersion ( this ) ; } } switch ( kind ( this . modifiers ) ) { case TypeDeclaration . ANNOTATION_TYPE_DECL : if ( this . superclass != null ) { this . scope . problemReporter ( ) . annotationTypeDeclarationCannotHaveSuperclass ( this ) ; } if ( this . superInterfaces != null ) { this . scope . problemReporter ( ) . annotationTypeDeclarationCannotHaveSuperinterfaces ( this ) ; } break ; case TypeDeclaration . ENUM_DECL : if ( this . binding . isAbstract ( ) ) { if ( ! hasEnumConstants ) { for ( int i = <NUM_LIT:0> , count = this . methods . length ; i < count ; i ++ ) { final AbstractMethodDeclaration methodDeclaration = this . methods [ i ] ; if ( methodDeclaration . isAbstract ( ) && methodDeclaration . binding != null ) this . scope . problemReporter ( ) . enumAbstractMethodMustBeImplemented ( methodDeclaration ) ; } } else if ( enumConstantsWithoutBody != null ) { for ( int i = <NUM_LIT:0> , count = this . methods . length ; i < count ; i ++ ) { final AbstractMethodDeclaration methodDeclaration = this . methods [ i ] ; if ( methodDeclaration . isAbstract ( ) && methodDeclaration . binding != null ) { for ( int f = <NUM_LIT:0> , l = enumConstantsWithoutBody . length ; f < l ; f ++ ) if ( enumConstantsWithoutBody [ f ] != null ) this . scope . problemReporter ( ) . enumConstantMustImplementAbstractMethod ( methodDeclaration , enumConstantsWithoutBody [ f ] ) ; } } } } break ; } int missingAbstractMethodslength = this . missingAbstractMethods == null ? <NUM_LIT:0> : this . missingAbstractMethods . length ; int methodsLength = this . methods == null ? <NUM_LIT:0> : this . methods . length ; if ( ( methodsLength + missingAbstractMethodslength ) > <NUM_LIT> ) { this . scope . problemReporter ( ) . tooManyMethods ( this ) ; } if ( this . methods != null ) { for ( int i = <NUM_LIT:0> , count = this . methods . length ; i < count ; i ++ ) { this . methods [ i ] . resolve ( this . scope ) ; } } if ( this . javadoc != null ) { if ( this . scope != null && ( this . name != TypeConstants . PACKAGE_INFO_NAME ) ) { this . javadoc . resolve ( this . scope ) ; } } else if ( ! sourceType . isLocalType ( ) ) { int visibility = sourceType . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; ProblemReporter reporter = this . scope . problemReporter ( ) ; int severity = reporter . computeSeverity ( IProblem . JavadocMissing ) ; if ( severity != ProblemSeverities . Ignore ) { if ( this . enclosingType != null ) { visibility = Util . computeOuterMostVisibility ( this . enclosingType , visibility ) ; } int javadocModifiers = ( this . binding . modifiers & ~ ExtraCompilerModifiers . AccVisibilityMASK ) | visibility ; reporter . javadocMissing ( this . sourceStart , this . sourceEnd , severity , javadocModifiers ) ; } } } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; return ; } } public void resolve ( BlockScope blockScope ) { if ( ( this . bits & ASTNode . IsAnonymousType ) == <NUM_LIT:0> ) { Binding existing = blockScope . getType ( this . name ) ; if ( existing instanceof ReferenceBinding && existing != this . binding && existing . isValidBinding ( ) ) { ReferenceBinding existingType = ( ReferenceBinding ) existing ; if ( existingType instanceof TypeVariableBinding ) { blockScope . problemReporter ( ) . typeHiding ( this , ( TypeVariableBinding ) existingType ) ; Scope outerScope = blockScope . parent ; checkOuterScope : while ( outerScope != null ) { Binding existing2 = outerScope . getType ( this . name ) ; if ( existing2 instanceof TypeVariableBinding && existing2 . isValidBinding ( ) ) { TypeVariableBinding tvb = ( TypeVariableBinding ) existingType ; Binding declaringElement = tvb . declaringElement ; if ( declaringElement instanceof ReferenceBinding && CharOperation . equals ( ( ( ReferenceBinding ) declaringElement ) . sourceName ( ) , this . name ) ) { blockScope . problemReporter ( ) . typeCollidesWithEnclosingType ( this ) ; break checkOuterScope ; } } else if ( existing2 instanceof ReferenceBinding && existing2 . isValidBinding ( ) && outerScope . isDefinedInType ( ( ReferenceBinding ) existing2 ) ) { blockScope . problemReporter ( ) . typeCollidesWithEnclosingType ( this ) ; break checkOuterScope ; } else if ( existing2 == null ) { break checkOuterScope ; } outerScope = outerScope . parent ; } } else if ( existingType instanceof LocalTypeBinding && ( ( LocalTypeBinding ) existingType ) . scope . methodScope ( ) == blockScope . methodScope ( ) ) { blockScope . problemReporter ( ) . duplicateNestedType ( this ) ; } else if ( blockScope . isDefinedInType ( existingType ) ) { blockScope . problemReporter ( ) . typeCollidesWithEnclosingType ( this ) ; } else if ( blockScope . isDefinedInSameUnit ( existingType ) ) { blockScope . problemReporter ( ) . typeHiding ( this , existingType ) ; } } blockScope . addLocalType ( this ) ; } if ( this . binding != null ) { blockScope . referenceCompilationUnit ( ) . record ( ( LocalTypeBinding ) this . binding ) ; resolve ( ) ; updateMaxFieldCount ( ) ; } } public void resolve ( ClassScope upperScope ) { if ( this . binding != null && this . binding instanceof LocalTypeBinding ) { upperScope . referenceCompilationUnit ( ) . record ( ( LocalTypeBinding ) this . binding ) ; } resolve ( ) ; updateMaxFieldCount ( ) ; } public void resolve ( CompilationUnitScope upperScope ) { resolve ( ) ; updateMaxFieldCount ( ) ; } public void tagAsHavingErrors ( ) { this . ignoreFurtherInvestigation = true ; } public void traverse ( ASTVisitor visitor , CompilationUnitScope unitScope ) { try { if ( visitor . visit ( this , unitScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . staticInitializerScope ) ; } if ( this . superclass != null ) this . superclass . traverse ( visitor , this . scope ) ; if ( this . superInterfaces != null ) { int length = this . superInterfaces . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . superInterfaces [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int length = this . typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . memberTypes [ i ] . traverse ( visitor , this . scope ) ; } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FieldDeclaration field ; if ( ( field = this . fields [ i ] ) . isStatic ( ) ) { field . traverse ( visitor , this . staticInitializerScope ) ; } else { field . traverse ( visitor , this . initializerScope ) ; } } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . methods [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , unitScope ) ; } catch ( AbortType e ) { } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { try { if ( visitor . visit ( this , blockScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . staticInitializerScope ) ; } if ( this . superclass != null ) this . superclass . traverse ( visitor , this . scope ) ; if ( this . superInterfaces != null ) { int length = this . superInterfaces . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . superInterfaces [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int length = this . typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . memberTypes [ i ] . traverse ( visitor , this . scope ) ; } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FieldDeclaration field ; if ( ( field = this . fields [ i ] ) . isStatic ( ) ) { } else { field . traverse ( visitor , this . initializerScope ) ; } } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . methods [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , blockScope ) ; } catch ( AbortType e ) { } } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { try { if ( visitor . visit ( this , classScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . staticInitializerScope ) ; } if ( this . superclass != null ) this . superclass . traverse ( visitor , this . scope ) ; if ( this . superInterfaces != null ) { int length = this . superInterfaces . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . superInterfaces [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int length = this . typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . memberTypes [ i ] . traverse ( visitor , this . scope ) ; } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FieldDeclaration field ; if ( ( field = this . fields [ i ] ) . isStatic ( ) ) { field . traverse ( visitor , this . staticInitializerScope ) ; } else { field . traverse ( visitor , this . initializerScope ) ; } } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) this . methods [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , classScope ) ; } catch ( AbortType e ) { } } void updateMaxFieldCount ( ) { if ( this . binding == null ) return ; TypeDeclaration outerMostType = this . scope . outerMostClassScope ( ) . referenceType ( ) ; if ( this . maxFieldCount > outerMostType . maxFieldCount ) { outerMostType . maxFieldCount = this . maxFieldCount ; } else { this . maxFieldCount = outerMostType . maxFieldCount ; } } public boolean isSecondary ( ) { return ( this . bits & ASTNode . IsSecondaryType ) != <NUM_LIT:0> ; } public boolean isScannerUsableOnThisDeclaration ( ) { return true ; } } </s>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.