org.eclipse.jdt.internal.compiler.lookup
类 Scope

java.lang.Object
  继承者 org.eclipse.jdt.internal.compiler.lookup.Scope
直接已知子类:
BlockScope, ClassScope, CompilationUnitScope

public abstract class Scope
extends Object


字段摘要
static int AUTOBOX_COMPATIBLE
           
static int BLOCK_SCOPE
           
static int CLASS_SCOPE
           
static int COMPATIBLE
           
static int COMPILATION_UNIT_SCOPE
           
static int EQUAL_OR_MORE_SPECIFIC
           
 int kind
           
static int METHOD_SCOPE
           
static int MORE_GENERIC
           
static int NOT_COMPATIBLE
           
static int NOT_RELATED
           
 Scope parent
           
static int VARARGS_COMPATIBLE
           
 
构造方法摘要
protected Scope(int kind, Scope parent)
           
 
方法摘要
 TypeBinding boxing(TypeBinding type)
           
 ClassScope classScope()
           
static int compareTypes(TypeBinding left, TypeBinding right)
           
 CompilationUnitScope compilationUnitScope()
           
 CompilerOptions compilerOptions()
          Finds the most specific compiler options
protected  MethodBinding computeCompatibleMethod(MethodBinding method, TypeBinding[] arguments, InvocationSite invocationSite)
          Internal use only Given a method, returns null if arguments cannot be converted to parameters.
protected  boolean connectTypeVariables(TypeParameter[] typeParameters, boolean checkForErasedCandidateCollisions)
          Connect type variable supertypes, and returns true if no problem was detected
static TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables)
          Returns a type where either all variables or specific ones got discarded.
 ArrayBinding createArrayType(TypeBinding type, int dimension)
           
 TypeVariableBinding[] createTypeVariables(TypeParameter[] typeParameters, Binding declaringElement)
           
 void deferBoundCheck(TypeReference typeRef)
           
 ClassScope enclosingClassScope()
           
 MethodScope enclosingMethodScope()
           
 ReferenceBinding enclosingReceiverType()
           
 ReferenceContext enclosingReferenceContext()
          Returns the immediately enclosing reference context, starting from current scope parent.
 SourceTypeBinding enclosingSourceType()
           
 LookupEnvironment environment()
           
protected  MethodBinding findDefaultAbstractMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, ReferenceBinding classHierarchyStart, ObjectVector found, MethodBinding concreteMatch)
           
 ReferenceBinding findDirectMemberType(char[] typeName, ReferenceBinding enclosingType)
           
 MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite)
           
 FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve)
           
 FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve, boolean invisibleFieldsOk)
           
 ReferenceBinding findMemberType(char[] typeName, ReferenceBinding enclosingType)
           
 MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite)
           
 MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext)
           
 MethodBinding findMethodForArray(ArrayBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite)
           
protected  void findMethodInSuperInterfaces(ReferenceBinding currentType, char[] selector, ObjectVector found, InvocationSite invocationSite)
           
 ReferenceBinding findType(char[] typeName, PackageBinding declarationPackage, PackageBinding invocationPackage)
           
 LocalVariableBinding findVariable(char[] variable)
           
static TypeBinding getBaseType(char[] name)
           
 Binding getBinding(char[] name, int mask, InvocationSite invocationSite, boolean needResolve)
           
 MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite)
           
 PackageBinding getCurrentPackage()
           
 int getDeclarationModifiers()
          Returns the modifiers of the innermost enclosing declaration.
 FieldBinding getField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite)
           
 MethodBinding getImplicitMethod(char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite)
           
 ReferenceBinding getJavaIoSerializable()
           
 ReferenceBinding getJavaLangAnnotationAnnotation()
           
 ReferenceBinding getJavaLangAssertionError()
           
 ReferenceBinding getJavaLangClass()
           
 ReferenceBinding getJavaLangCloneable()
           
 ReferenceBinding getJavaLangEnum()
           
 ReferenceBinding getJavaLangIterable()
           
 ReferenceBinding getJavaLangObject()
           
 ReferenceBinding getJavaLangString()
           
 ReferenceBinding getJavaLangThrowable()
           
 ReferenceBinding getJavaUtilIterator()
           
 ReferenceBinding getMemberType(char[] typeName, ReferenceBinding enclosingType)
           
 MethodBinding getMethod(TypeBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite)
           
 Binding getPackage(char[][] compoundName)
           
 MethodBinding getStaticFactory(ReferenceBinding allocationType, ReferenceBinding originalEnclosingType, TypeBinding[] argumentTypes, InvocationSite allocationSite)
           
 TypeBinding getType(char[] name)
           
 TypeBinding getType(char[][] compoundName, int typeNameLength)
           
 TypeBinding getType(char[] name, PackageBinding packageBinding)
           
 Binding getTypeOrPackage(char[][] compoundName)
           
static ReferenceBinding[] greaterLowerBound(ReferenceBinding[] types)
           
static TypeBinding[] greaterLowerBound(TypeBinding[] types)
           
protected  boolean hasErasedCandidatesCollisions(TypeBinding one, TypeBinding two, Map invocations, ReferenceBinding type, ASTNode typeRef)
           
 CaseStatement innermostSwitchCase()
          Returns the immediately enclosing switchCase statement (carried by closest blockScope),
protected  boolean isAcceptableMethod(MethodBinding one, MethodBinding two)
           
 boolean isBoxingCompatibleWith(TypeBinding expressionType, TypeBinding targetType)
           
 boolean isDefinedInField(FieldBinding field)
           
 boolean isDefinedInMethod(MethodBinding method)
           
 boolean isDefinedInSameUnit(ReferenceBinding type)
           
 boolean isDefinedInType(ReferenceBinding type)
           
 boolean isInsideCase(CaseStatement caseStatement)
          Returns true if the scope or one of its parent is associated to a given caseStatement, denoting being part of a given switch case statement.
 boolean isInsideDeprecatedCode()
           
 boolean isPossibleSubtypeOfRawType(TypeBinding paramType)
           
 TypeBinding lowerUpperBound(TypeBinding[] types)
          Returns VoidBinding if types have no intersection (e.g. 2 unrelated interfaces), or null if no common supertype (e.g.
 MethodScope methodScope()
           
protected  TypeBinding[] minimalErasedCandidates(TypeBinding[] types, Map allInvocations)
          Returns the most specific set of types compatible with all given types.
protected  MethodBinding mostSpecificClassMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite)
           
protected  MethodBinding mostSpecificInterfaceMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite)
           
protected  MethodBinding mostSpecificMethodBinding(MethodBinding[] visible, int visibleSize, TypeBinding[] argumentTypes, InvocationSite invocationSite, ReferenceBinding receiverType)
           
 ClassScope outerMostClassScope()
           
 MethodScope outerMostMethodScope()
           
 int parameterCompatibilityLevel(MethodBinding method, TypeBinding[] arguments)
           
abstract  ProblemReporter problemReporter()
           
 CompilationUnitDeclaration referenceCompilationUnit()
           
 ReferenceContext referenceContext()
          Returns the nearest reference context, starting from current scope.
static ReferenceBinding[] substitute(Substitution substitution, ReferenceBinding[] originalTypes)
          Returns an array of types, where original types got substituted given a substitution.
static TypeBinding substitute(Substitution substitution, TypeBinding originalType)
          Returns a type, where original type was substituted using the receiver parameterized type.
static TypeBinding[] substitute(Substitution substitution, TypeBinding[] originalTypes)
          Returns an array of types, where original types got substituted given a substitution.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

BLOCK_SCOPE

public static final int BLOCK_SCOPE
另请参见:
常量字段值

CLASS_SCOPE

public static final int CLASS_SCOPE
另请参见:
常量字段值

COMPILATION_UNIT_SCOPE

public static final int COMPILATION_UNIT_SCOPE
另请参见:
常量字段值

METHOD_SCOPE

public static final int METHOD_SCOPE
另请参见:
常量字段值

NOT_COMPATIBLE

public static final int NOT_COMPATIBLE
另请参见:
常量字段值

COMPATIBLE

public static final int COMPATIBLE
另请参见:
常量字段值

AUTOBOX_COMPATIBLE

public static final int AUTOBOX_COMPATIBLE
另请参见:
常量字段值

VARARGS_COMPATIBLE

public static final int VARARGS_COMPATIBLE
另请参见:
常量字段值

EQUAL_OR_MORE_SPECIFIC

public static final int EQUAL_OR_MORE_SPECIFIC
另请参见:
常量字段值

NOT_RELATED

public static final int NOT_RELATED
另请参见:
常量字段值

MORE_GENERIC

public static final int MORE_GENERIC
另请参见:
常量字段值

kind

public int kind

parent

public Scope parent
构造方法详细信息

Scope

protected Scope(int kind,
                Scope parent)
方法详细信息

compareTypes

public static int compareTypes(TypeBinding left,
                               TypeBinding right)

convertEliminatingTypeVariables

public static TypeBinding convertEliminatingTypeVariables(TypeBinding originalType,
                                                          ReferenceBinding genericType,
                                                          int rank,
                                                          Set eliminatedVariables)
Returns a type where either all variables or specific ones got discarded. e.g. List (discarding ) will return: List>


getBaseType

public static TypeBinding getBaseType(char[] name)

greaterLowerBound

public static ReferenceBinding[] greaterLowerBound(ReferenceBinding[] types)

greaterLowerBound

public static TypeBinding[] greaterLowerBound(TypeBinding[] types)

substitute

public static ReferenceBinding[] substitute(Substitution substitution,
                                            ReferenceBinding[] originalTypes)
Returns an array of types, where original types got substituted given a substitution. Only allocate an array if anything is different.


substitute

public static TypeBinding substitute(Substitution substitution,
                                     TypeBinding originalType)
Returns a type, where original type was substituted using the receiver parameterized type. In raw mode, all parameterized type denoting same original type are converted to raw types. e.g. class X { X foo; X bar; } when used in raw fashion, then type of both foo and bar is raw type X.


substitute

public static TypeBinding[] substitute(Substitution substitution,
                                       TypeBinding[] originalTypes)
Returns an array of types, where original types got substituted given a substitution. Only allocate an array if anything is different.


boxing

public TypeBinding boxing(TypeBinding type)

classScope

public final ClassScope classScope()

compilationUnitScope

public final CompilationUnitScope compilationUnitScope()

compilerOptions

public final CompilerOptions compilerOptions()
Finds the most specific compiler options


computeCompatibleMethod

protected final MethodBinding computeCompatibleMethod(MethodBinding method,
                                                      TypeBinding[] arguments,
                                                      InvocationSite invocationSite)
Internal use only Given a method, returns null if arguments cannot be converted to parameters. Will answer a substituted method in case the method was generic and type inference got triggered; in case the method was originally compatible, then simply answer it back.


connectTypeVariables

protected boolean connectTypeVariables(TypeParameter[] typeParameters,
                                       boolean checkForErasedCandidateCollisions)
Connect type variable supertypes, and returns true if no problem was detected

参数:
typeParameters -
checkForErasedCandidateCollisions -

createArrayType

public ArrayBinding createArrayType(TypeBinding type,
                                    int dimension)

createTypeVariables

public TypeVariableBinding[] createTypeVariables(TypeParameter[] typeParameters,
                                                 Binding declaringElement)

enclosingClassScope

public final ClassScope enclosingClassScope()

enclosingMethodScope

public final MethodScope enclosingMethodScope()

enclosingReceiverType

public final ReferenceBinding enclosingReceiverType()

enclosingReferenceContext

public ReferenceContext enclosingReferenceContext()
Returns the immediately enclosing reference context, starting from current scope parent. If starting on a class, it will skip current class. If starting on unitScope, returns null.


enclosingSourceType

public final SourceTypeBinding enclosingSourceType()

environment

public final LookupEnvironment environment()

findDefaultAbstractMethod

protected MethodBinding findDefaultAbstractMethod(ReferenceBinding receiverType,
                                                  char[] selector,
                                                  TypeBinding[] argumentTypes,
                                                  InvocationSite invocationSite,
                                                  ReferenceBinding classHierarchyStart,
                                                  ObjectVector found,
                                                  MethodBinding concreteMatch)

findDirectMemberType

public ReferenceBinding findDirectMemberType(char[] typeName,
                                             ReferenceBinding enclosingType)

findExactMethod

public MethodBinding findExactMethod(ReferenceBinding receiverType,
                                     char[] selector,
                                     TypeBinding[] argumentTypes,
                                     InvocationSite invocationSite)

findField

public FieldBinding findField(TypeBinding receiverType,
                              char[] fieldName,
                              InvocationSite invocationSite,
                              boolean needResolve)

findField

public FieldBinding findField(TypeBinding receiverType,
                              char[] fieldName,
                              InvocationSite invocationSite,
                              boolean needResolve,
                              boolean invisibleFieldsOk)

findMemberType

public ReferenceBinding findMemberType(char[] typeName,
                                       ReferenceBinding enclosingType)

findMethod

public MethodBinding findMethod(ReferenceBinding receiverType,
                                char[] selector,
                                TypeBinding[] argumentTypes,
                                InvocationSite invocationSite)

findMethod

public MethodBinding findMethod(ReferenceBinding receiverType,
                                char[] selector,
                                TypeBinding[] argumentTypes,
                                InvocationSite invocationSite,
                                boolean inStaticContext)

findMethodForArray

public MethodBinding findMethodForArray(ArrayBinding receiverType,
                                        char[] selector,
                                        TypeBinding[] argumentTypes,
                                        InvocationSite invocationSite)

findMethodInSuperInterfaces

protected void findMethodInSuperInterfaces(ReferenceBinding currentType,
                                           char[] selector,
                                           ObjectVector found,
                                           InvocationSite invocationSite)

findType

public ReferenceBinding findType(char[] typeName,
                                 PackageBinding declarationPackage,
                                 PackageBinding invocationPackage)

findVariable

public LocalVariableBinding findVariable(char[] variable)

getBinding

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

getConstructor

public MethodBinding getConstructor(ReferenceBinding receiverType,
                                    TypeBinding[] argumentTypes,
                                    InvocationSite invocationSite)

getCurrentPackage

public final PackageBinding getCurrentPackage()

getDeclarationModifiers

public int getDeclarationModifiers()
Returns the modifiers of the innermost enclosing declaration.

返回:
modifiers

getField

public FieldBinding getField(TypeBinding receiverType,
                             char[] fieldName,
                             InvocationSite invocationSite)

getImplicitMethod

public MethodBinding getImplicitMethod(char[] selector,
                                       TypeBinding[] argumentTypes,
                                       InvocationSite invocationSite)

getJavaIoSerializable

public final ReferenceBinding getJavaIoSerializable()

getJavaLangAnnotationAnnotation

public final ReferenceBinding getJavaLangAnnotationAnnotation()

getJavaLangAssertionError

public final ReferenceBinding getJavaLangAssertionError()

getJavaLangClass

public final ReferenceBinding getJavaLangClass()

getJavaLangCloneable

public final ReferenceBinding getJavaLangCloneable()

getJavaLangEnum

public final ReferenceBinding getJavaLangEnum()

getJavaLangIterable

public final ReferenceBinding getJavaLangIterable()

getJavaLangObject

public final ReferenceBinding getJavaLangObject()

getJavaLangString

public final ReferenceBinding getJavaLangString()

getJavaLangThrowable

public final ReferenceBinding getJavaLangThrowable()

getJavaUtilIterator

public final ReferenceBinding getJavaUtilIterator()

getMemberType

public final ReferenceBinding getMemberType(char[] typeName,
                                            ReferenceBinding enclosingType)

getMethod

public MethodBinding getMethod(TypeBinding receiverType,
                               char[] selector,
                               TypeBinding[] argumentTypes,
                               InvocationSite invocationSite)

getPackage

public final Binding getPackage(char[][] compoundName)

getType

public final TypeBinding getType(char[] name)

getType

public final TypeBinding getType(char[] name,
                                 PackageBinding packageBinding)

getType

public final TypeBinding getType(char[][] compoundName,
                                 int typeNameLength)

getTypeOrPackage

public final Binding getTypeOrPackage(char[][] compoundName)

hasErasedCandidatesCollisions

protected boolean hasErasedCandidatesCollisions(TypeBinding one,
                                                TypeBinding two,
                                                Map invocations,
                                                ReferenceBinding type,
                                                ASTNode typeRef)

innermostSwitchCase

public CaseStatement innermostSwitchCase()
Returns the immediately enclosing switchCase statement (carried by closest blockScope),


isAcceptableMethod

protected boolean isAcceptableMethod(MethodBinding one,
                                     MethodBinding two)

isBoxingCompatibleWith

public boolean isBoxingCompatibleWith(TypeBinding expressionType,
                                      TypeBinding targetType)

isDefinedInField

public final boolean isDefinedInField(FieldBinding field)

isDefinedInMethod

public final boolean isDefinedInMethod(MethodBinding method)

isDefinedInSameUnit

public final boolean isDefinedInSameUnit(ReferenceBinding type)

isDefinedInType

public final boolean isDefinedInType(ReferenceBinding type)

isInsideCase

public boolean isInsideCase(CaseStatement caseStatement)
Returns true if the scope or one of its parent is associated to a given caseStatement, denoting being part of a given switch case statement.


isInsideDeprecatedCode

public boolean isInsideDeprecatedCode()

isPossibleSubtypeOfRawType

public boolean isPossibleSubtypeOfRawType(TypeBinding paramType)

lowerUpperBound

public TypeBinding lowerUpperBound(TypeBinding[] types)
Returns VoidBinding if types have no intersection (e.g. 2 unrelated interfaces), or null if no common supertype (e.g. List and List), or the intersection type if possible


methodScope

public final MethodScope methodScope()

minimalErasedCandidates

protected TypeBinding[] minimalErasedCandidates(TypeBinding[] types,
                                                Map allInvocations)
Returns the most specific set of types compatible with all given types. (i.e. most specific common super types) If no types is given, will return an empty array. If not compatible reference type is found, returns null. In other cases, will return an array of minimal erased types, where some nulls may appear (and must simply be ignored).


mostSpecificClassMethodBinding

protected final MethodBinding mostSpecificClassMethodBinding(MethodBinding[] visible,
                                                             int visibleSize,
                                                             InvocationSite invocationSite)

mostSpecificInterfaceMethodBinding

protected final MethodBinding mostSpecificInterfaceMethodBinding(MethodBinding[] visible,
                                                                 int visibleSize,
                                                                 InvocationSite invocationSite)

mostSpecificMethodBinding

protected final MethodBinding mostSpecificMethodBinding(MethodBinding[] visible,
                                                        int visibleSize,
                                                        TypeBinding[] argumentTypes,
                                                        InvocationSite invocationSite,
                                                        ReferenceBinding receiverType)

outerMostClassScope

public final ClassScope outerMostClassScope()

outerMostMethodScope

public final MethodScope outerMostMethodScope()

parameterCompatibilityLevel

public int parameterCompatibilityLevel(MethodBinding method,
                                       TypeBinding[] arguments)

problemReporter

public abstract ProblemReporter problemReporter()

referenceCompilationUnit

public final CompilationUnitDeclaration referenceCompilationUnit()

referenceContext

public ReferenceContext referenceContext()
Returns the nearest reference context, starting from current scope. If starting on a class, it will return current class. If starting on unitScope, returns unit.


deferBoundCheck

public void deferBoundCheck(TypeReference typeRef)

getStaticFactory

public MethodBinding getStaticFactory(ReferenceBinding allocationType,
                                      ReferenceBinding originalEnclosingType,
                                      TypeBinding[] argumentTypes,
                                      InvocationSite allocationSite)


Copyright © 2013. All Rights Reserved.