org.aspectj.org.eclipse.jdt.internal.compiler.lookup
Class BlockScope

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope
      extended by org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope
Direct Known Subclasses:
CodeSnippetScope, MethodScope

public class BlockScope
extends Scope


Nested Class Summary
 
Nested classes/interfaces inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope
Scope.Substitutor
 
Field Summary
static VariableBinding[] EmulationPathToImplicitThis
           
 CaseStatement enclosingCase
           
 FlowInfo finallyInfo
          Used only during analyseCode and only for checking if a resource was closed in a finallyBlock.
 boolean insideTypeAnnotation
           
 int localIndex
           
 LocalVariableBinding[] locals
           
 int maxOffset
           
static VariableBinding[] NoEnclosingInstanceInConstructorCall
           
static VariableBinding[] NoEnclosingInstanceInStaticContext
           
 int offset
           
 BlockScope[] shiftScopes
           
 int startIndex
           
 int subscopeCount
           
 Scope[] subscopes
           
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope
APPLICABILITY, AUTOBOX_COMPATIBLE, BLOCK_SCOPE, CLASS_SCOPE, COMPATIBLE, COMPILATION_UNIT_SCOPE, EQUAL_OR_MORE_SPECIFIC, FULL_INFERENCE, INVOCATION_TYPE, kind, METHOD_SCOPE, MORE_GENERIC, NOT_COMPATIBLE, NOT_RELATED, parent, VARARGS_COMPATIBLE
 
Constructor Summary
  BlockScope(BlockScope parent)
           
  BlockScope(BlockScope parent, boolean addToParentScope)
           
  BlockScope(BlockScope parent, int variableCount)
           
protected BlockScope(int kind, Scope parent)
           
 
Method Summary
 void addAnonymousType(TypeDeclaration anonymousType, ReferenceBinding superBinding)
           
 void addLocalType(TypeDeclaration localType)
           
 void addLocalVariable(LocalVariableBinding binding)
           
 void addSubscope(Scope childScope)
           
 boolean allowBlankFinalFieldAssignment(FieldBinding binding)
          Answer true if the receiver is suitable for assigning final blank fields.
 void checkAppropriateMethodAgainstSupers(char[] selector, MethodBinding compileTimeMethod, TypeBinding[] parameters, InvocationSite site)
          15.12.3 (Java 8) "Compile-Time Step 3: Is the Chosen Method Appropriate?"
 void checkUnclosedCloseables(FlowInfo flowInfo, FlowContext flowContext, ASTNode location, BlockScope locationScope)
          At the end of a block check the closing-status of all tracked closeables that are declared in this block.
 void correlateTrackingVarsIfElse(FlowInfo thenFlowInfo, FlowInfo elseFlowInfo)
          If one branch of an if-else closes any AutoCloseable resource, and if the same resource is known to be null on the other branch mark it as closed, too, so that merging both branches indicates that the resource is always closed.
 void emulateOuterAccess(LocalVariableBinding outerLocalVariable)
           
 ReferenceBinding findLocalType(char[] name)
           
 LocalDeclaration[] findLocalVariableDeclarations(int position)
          Returns all declarations of most specific locals containing a given position in their source range.
 LocalVariableBinding findVariable(char[] variableName)
           
 Binding getBinding(char[][] compoundName, int mask, InvocationSite invocationSite, boolean needResolve)
           
 Binding getBinding(char[][] compoundName, InvocationSite invocationSite)
           
 VariableBinding[] getEmulationPath(LocalVariableBinding outerLocalVariable)
           
 java.lang.Object[] getEmulationPath(ReferenceBinding targetEnclosingType, boolean onlyExactMatch, boolean denyEnclosingArgInConstructorCall)
           
 boolean hasDefaultNullnessFor(int location)
          Answer a defaultNullness defined for the closest enclosing scope, using bits from Binding.NullnessDefaultMASK.
 boolean isDuplicateLocalVariable(char[] name)
           
 int maxShiftedOffset()
           
 boolean needBlankFinalFieldInitializationCheck(FieldBinding binding)
          Returns true if the context requires to check initialization of final blank fields.
 ProblemReporter problemReporter()
           
 void propagateInnerEmulation(ReferenceBinding targetType, boolean isEnclosingInstanceSupplied)
           
 void pruneWrapperTrackingVar(FakedTrackingVariable trackingVariable)
          Unregister a wrapper resource without affecting its inner.
 TypeDeclaration referenceType()
           
 int registerTrackingVariable(FakedTrackingVariable fakedTrackingVariable)
          Register a tracking variable and compute its id.
 void removeTrackingVar(FakedTrackingVariable trackingVariable)
          When are no longer interested in this tracking variable - remove it.
 int scopeIndex()
           
 java.lang.String toString()
           
 java.lang.String toString(int tab)
           
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope
boxing, classScope, compareTypes, compilationUnitScope, compilerOptions, computeCompatibleMethod, computeCompatibleMethod, connectTypeVariables, convertEliminatingTypeVariables, createArrayType, createArrayType, createTypeVariables, deferBoundCheck, deferCheck, enclosingClassScope, enclosingLambdaScope, enclosingMethodScope, enclosingReceiverType, enclosingReferenceContext, enclosingSourceType, environment, findDefaultAbstractMethod, findDirectMemberType, findExactMethod, findField, findField, findMemberType, findMethod, findMethod0, findMethodForArray, findMethodInSuperInterfaces, findPrivilegedHandler, findType, findTypeVariable, getBaseType, getBinding, getConstructor, getConstructor0, getCurrentPackage, getDeclarationModifiers, getExactConstructor, getExactMethod, getField, getImplicitMethod, getJavaIoSerializable, getJavaLangAnnotationAnnotation, getJavaLangAssertionError, getJavaLangClass, getJavaLangCloneable, getJavaLangEnum, getJavaLangIllegalArgumentException, getJavaLangInvokeLambdaMetafactory, getJavaLangInvokeMethodHandlesLookup, getJavaLangInvokeSerializedLambda, getJavaLangIterable, getJavaLangObject, getJavaLangString, getJavaLangThrowable, getJavaUtilIterator, getMemberType, getMethod, getOnlyPackage, getPackage, getStaticFactory, getType, getType, getType, getTypeOrPackage, greaterLowerBound, greaterLowerBound, hasErasedCandidatesCollisions, inferInvocationType, innermostSwitchCase, invocationType, isAcceptableMethod, isBoxingCompatibleWith, isDefinedInField, isDefinedInMethod, isDefinedInSameUnit, isDefinedInType, isInsideCase, isInsideDeprecatedCode, isLambdaScope, isLambdaSubscope, isPossibleSubtypeOfRawType, lowerUpperBound, methodScope, minimalErasedCandidates, mostSpecificClassMethodBinding, mostSpecificInterfaceMethodBinding, mostSpecificMethodBinding, namedMethodScope, originalReferenceContext, outerMostClassScope, outerMostMethodScope, parameterCompatibilityLevel, parameterCompatibilityLevel, parameterCompatibilityLevel, referenceCompilationUnit, referenceContext, substitute, substitute, substitute, tagAsAccessingEnclosingInstanceStateOf, typeAnnotationsResolutionScope, validateNullAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

locals

public LocalVariableBinding[] locals

localIndex

public int localIndex

startIndex

public int startIndex

offset

public int offset

maxOffset

public int maxOffset

shiftScopes

public BlockScope[] shiftScopes

subscopes

public Scope[] subscopes

subscopeCount

public int subscopeCount

enclosingCase

public CaseStatement enclosingCase

EmulationPathToImplicitThis

public static final VariableBinding[] EmulationPathToImplicitThis

NoEnclosingInstanceInConstructorCall

public static final VariableBinding[] NoEnclosingInstanceInConstructorCall

NoEnclosingInstanceInStaticContext

public static final VariableBinding[] NoEnclosingInstanceInStaticContext

insideTypeAnnotation

public boolean insideTypeAnnotation

finallyInfo

public FlowInfo finallyInfo
Used only during analyseCode and only for checking if a resource was closed in a finallyBlock.

Constructor Detail

BlockScope

public BlockScope(BlockScope parent)

BlockScope

public BlockScope(BlockScope parent,
                  boolean addToParentScope)

BlockScope

public BlockScope(BlockScope parent,
                  int variableCount)

BlockScope

protected BlockScope(int kind,
                     Scope parent)
Method Detail

addAnonymousType

public final void addAnonymousType(TypeDeclaration anonymousType,
                                   ReferenceBinding superBinding)

addLocalType

public final void addLocalType(TypeDeclaration localType)

addLocalVariable

public final void addLocalVariable(LocalVariableBinding binding)

addSubscope

public void addSubscope(Scope childScope)

allowBlankFinalFieldAssignment

public final boolean allowBlankFinalFieldAssignment(FieldBinding binding)
Answer true if the receiver is suitable for assigning final blank fields. in other words, it is inside an initializer, a constructor or a clinit


emulateOuterAccess

public void emulateOuterAccess(LocalVariableBinding outerLocalVariable)

findLocalType

public final ReferenceBinding findLocalType(char[] name)

findLocalVariableDeclarations

public LocalDeclaration[] findLocalVariableDeclarations(int position)
Returns all declarations of most specific locals containing a given position in their source range. This code does not recurse in nested types. Returned array may have null values at trailing indexes.


findVariable

public LocalVariableBinding findVariable(char[] variableName)
Overrides:
findVariable in class Scope

getBinding

public Binding getBinding(char[][] compoundName,
                          int mask,
                          InvocationSite invocationSite,
                          boolean needResolve)

getBinding

public final Binding getBinding(char[][] compoundName,
                                InvocationSite invocationSite)

getEmulationPath

public VariableBinding[] getEmulationPath(LocalVariableBinding outerLocalVariable)

getEmulationPath

public java.lang.Object[] getEmulationPath(ReferenceBinding targetEnclosingType,
                                           boolean onlyExactMatch,
                                           boolean denyEnclosingArgInConstructorCall)

isDuplicateLocalVariable

public final boolean isDuplicateLocalVariable(char[] name)

maxShiftedOffset

public int maxShiftedOffset()

needBlankFinalFieldInitializationCheck

public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding)
Returns true if the context requires to check initialization of final blank fields. in other words, it is inside an initializer, a constructor or a clinit


problemReporter

public ProblemReporter problemReporter()
Specified by:
problemReporter in class Scope

propagateInnerEmulation

public void propagateInnerEmulation(ReferenceBinding targetType,
                                    boolean isEnclosingInstanceSupplied)

referenceType

public TypeDeclaration referenceType()

scopeIndex

public int scopeIndex()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(int tab)

registerTrackingVariable

public int registerTrackingVariable(FakedTrackingVariable fakedTrackingVariable)
Register a tracking variable and compute its id.


removeTrackingVar

public void removeTrackingVar(FakedTrackingVariable trackingVariable)
When are no longer interested in this tracking variable - remove it.


pruneWrapperTrackingVar

public void pruneWrapperTrackingVar(FakedTrackingVariable trackingVariable)
Unregister a wrapper resource without affecting its inner.


checkUnclosedCloseables

public void checkUnclosedCloseables(FlowInfo flowInfo,
                                    FlowContext flowContext,
                                    ASTNode location,
                                    BlockScope locationScope)
At the end of a block check the closing-status of all tracked closeables that are declared in this block. Also invoked when entering unreachable code.


correlateTrackingVarsIfElse

public void correlateTrackingVarsIfElse(FlowInfo thenFlowInfo,
                                        FlowInfo elseFlowInfo)
If one branch of an if-else closes any AutoCloseable resource, and if the same resource is known to be null on the other branch mark it as closed, too, so that merging both branches indicates that the resource is always closed. Example: FileReader fr1 = null; try {\n" + fr1 = new FileReader(someFile);" + fr1.read(buf);\n" + } finally {\n" + if (fr1 != null)\n" + try {\n" + fr1.close();\n" + } catch (IOException e) { // do nothing } // after this if statement fr1 is definitely not leaked }


checkAppropriateMethodAgainstSupers

public void checkAppropriateMethodAgainstSupers(char[] selector,
                                                MethodBinding compileTimeMethod,
                                                TypeBinding[] parameters,
                                                InvocationSite site)
15.12.3 (Java 8) "Compile-Time Step 3: Is the Chosen Method Appropriate?"


hasDefaultNullnessFor

public boolean hasDefaultNullnessFor(int location)
Description copied from class: Scope
Answer a defaultNullness defined for the closest enclosing scope, using bits from Binding.NullnessDefaultMASK.

Specified by:
hasDefaultNullnessFor in class Scope