Home » openjdk-7 » com.sun.tools » javac » comp » [javadoc | source]
com.sun.tools.javac.comp
public class: Check [javadoc | source]
java.lang.Object
   com.sun.tools.javac.comp.Check
Type checking helper class for the attribution phase.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Nested Class Summary:
class  Check.Validator  A visitor class for type validation. 
class  Check.CycleChecker   
Field Summary
protected static final  Key<Check> checkKey     
 boolean allowGenerics    Switch: generics enabled? 
 boolean allowAnnotations    Switch: annotations enabled? 
 boolean allowCovariantReturns    Switch: covariant returns enabled? 
 boolean allowSimplifiedVarargs    Switch: simplified varargs enabled? 
 boolean complexInference    Switch: -complexinference option set? 
 char syntheticNameChar    Character for synthetic names 
public  Map<Name, ClassSymbol> compiled    A table mapping flat names of all compiled classes in this run to their symbols; maintained from outside. 
 UnaryVisitor<Boolean> isTypeArgErroneous     
 Warner overrideWarner     
Constructor:
 protected Check(Context context) 
Method from com.sun.tools.javac.comp.Check Summary:
annotationApplicable,   cannotOverride,   castWarner,   checkAllDefined,   checkAnnotationResType,   checkCanonical,   checkCastable,   checkClassBounds,   checkClassBounds,   checkClassType,   checkClassType,   checkCommonOverriderIn,   checkCompatibleAbstracts,   checkCompatibleAbstracts,   checkCompatibleConcretes,   checkCompatibleSupertypes,   checkConflicts,   checkCyclicConstructors,   checkDeprecated,   checkDeprecatedAnnotation,   checkDiamond,   checkDisjoint,   checkDivZero,   checkEmptyIf,   checkFlags,   checkHideClashes,   checkImplementations,   checkImplementations,   checkNonCyclic,   checkNonCyclic,   checkNonCyclicDecl,   checkNonCyclicElements,   checkNonCyclicElementsInternal,   checkNonVoid,   checkNotRepeated,   checkNullOrRefType,   checkOperator,   checkOverride,   checkOverride,   checkOverride,   checkOverrideClashes,   checkRefType,   checkRefTypes,   checkReifiableReferenceType,   checkSunAPI,   checkTransparentClass,   checkTransparentVar,   checkType,   checkType,   checkUnique,   checkUniqueClassName,   checkUniqueImport,   checkUniqueStaticImport,   checkValidGenericType,   checkVararg,   checkVarargsMethodDecl,   completionError,   convertWarner,   diff,   duplicateErasureError,   duplicateError,   earlyRefError,   excl,   incl,   instance,   instantiatePoly,   intersect,   intersects,   isHandled,   isOverrider,   isTypeArgErroneous,   isTypeVar,   isUnchecked,   isUnchecked,   isUnchecked,   localClassName,   protection,   reportDeferredDiagnostics,   setDeferredLintHandler,   setLint,   setMethod,   subset,   typeError,   typeError,   typeTagError,   uncheckedOverrides,   unhandled,   union,   validate,   validate,   validate,   validateAnnotation,   validateAnnotation,   validateAnnotationMethod,   validateAnnotationTree,   validateAnnotationType,   validateAnnotationType,   validateAnnotations,   varargsDuplicateError,   varargsOverrides,   warnDeprecated,   warnStatic,   warnSunApi,   warnUnchecked,   warnUnsafeVararg
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.tools.javac.comp.Check Detail:
 boolean annotationApplicable(JCAnnotation a,
    Symbol s) 
    Is the annotation applicable to the symbol?
 Object cannotOverride(MethodSymbol m,
    MethodSymbol other) 
    A customized "cannot override" error message.
 public Warner castWarner(DiagnosticPosition pos,
    Type found,
    Type expected) 
  void checkAllDefined(DiagnosticPosition pos,
    ClassSymbol c) 
    Check that all abstract members of given class have definitions.
  void checkAnnotationResType(DiagnosticPosition pos,
    Type type) 
 public  void checkCanonical(JCTree tree) 
    Check that a qualified name is in canonical form (for import decls).
 Type checkCastable(DiagnosticPosition pos,
    Type found,
    Type req) 
    Check that a given type can be cast to a given target type. Return the result of the cast.
  void checkClassBounds(DiagnosticPosition pos,
    Type type) 
    Check that class c does not implement directly or indirectly the same parameterized interface with two different argument lists.
  void checkClassBounds(DiagnosticPosition pos,
    Map<TypeSymbol, Type> seensofar,
    Type type) 
    Enter all interfaces of type `type' into the hash table `seensofar' with their class symbol as key and their type as value. Make sure no class is entered with two different types.
 Type checkClassType(DiagnosticPosition pos,
    Type t) 
    Check that type is a class or interface type.
 Type checkClassType(DiagnosticPosition pos,
    Type t,
    boolean noBounds) 
    Check that type is a class or interface type.
 boolean checkCommonOverriderIn(Symbol s1,
    Symbol s2,
    Type site) 
 public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
    Type t1,
    Type t2) 
    Check that classes (or interfaces) do not each define an abstract method with same name and arguments but incompatible return types.
 public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
    Type t1,
    Type t2,
    Type site) 
 public  void checkCompatibleConcretes(DiagnosticPosition pos,
    Type site) 
    Check that a class does not inherit two concrete methods with the same signature.
  void checkCompatibleSupertypes(DiagnosticPosition pos,
    Type c) 
    Check that all abstract methods implemented by a class are mutually compatible.
  void checkConflicts(DiagnosticPosition pos,
    Symbol sym,
    TypeSymbol c) 
  void checkCyclicConstructors(JCClassDecl tree) 
    Check for cycles in the graph of constructors calling other constructors.
  void checkDeprecated(DiagnosticPosition pos,
    Symbol other,
    Symbol s) 
  void checkDeprecatedAnnotation(DiagnosticPosition pos,
    Symbol s) 
 Type checkDiamond(JCNewClass tree,
    Type t) 
    Check that usage of diamond operator is correct (i.e. diamond should not be used with non-generic classes or in anonymous class creation expressions)
 boolean checkDisjoint(DiagnosticPosition pos,
    long flags,
    long set1,
    long set2) 
    Check that flag set does not contain elements of two conflicting sets. s Return true if it doesn't.
  void checkDivZero(DiagnosticPosition pos,
    Symbol operator,
    Type operand) 
    Check for division by integer constant zero
  void checkEmptyIf(JCIf tree) 
    Check for empty statements after if
 long checkFlags(DiagnosticPosition pos,
    long flags,
    Symbol sym,
    JCTree tree) 
    Check that given modifiers are legal for given symbol and return modifiers together with any implicit modififiers for that symbol. Warning: we can't use flags() here since this method is called during class enter, when flags() would cause a premature completion.
  void checkHideClashes(DiagnosticPosition pos,
    Type site,
    MethodSymbol sym) 
    Check that all static methods accessible from 'site' are mutually compatible (JLS 8.4.8).
  void checkImplementations(JCClassDecl tree) 
    Check that all methods which implement some method conform to the method they implement.
  void checkImplementations(JCClassDecl tree,
    ClassSymbol ic) 
    Check that all methods which implement some method in `ic' conform to the method they implement.
  void checkNonCyclic(DiagnosticPosition pos,
    Type t) 
    Check for cyclic references. Issue an error if the symbol of the type referred to has a LOCKED flag set.
  void checkNonCyclic(DiagnosticPosition pos,
    TypeVar t) 
  void checkNonCyclicDecl(JCClassDecl tree) 
  void checkNonCyclicElements(JCClassDecl tree) 
    Check for cycles in the graph of annotation elements.
  void checkNonCyclicElementsInternal(DiagnosticPosition pos,
    TypeSymbol tsym) 
 Type checkNonVoid(DiagnosticPosition pos,
    Type t) 
    Check that type is different from 'void'.
  void checkNotRepeated(DiagnosticPosition pos,
    Type it,
    Set<Type> its) 
    Enter interface into into set. If it existed already, issue a "repeated interface" error.
 Type checkNullOrRefType(DiagnosticPosition pos,
    Type t) 
    Check that type is a null or reference type.
 int checkOperator(DiagnosticPosition pos,
    OperatorSymbol operator,
    int tag,
    Type left,
    Type right) 
    Return the opcode of the operator but emit an error if it is an error.
  void checkOverride(JCTree tree,
    MethodSymbol m) 
    Check that a given method conforms with any method it overrides.
  void checkOverride(JCTree tree,
    MethodSymbol m,
    MethodSymbol other,
    ClassSymbol origin) 
    Check that this method conforms with overridden method 'other'. where `origin' is the class where checking started. Complications: (1) Do not check overriding of synthetic methods (reason: they might be final). todo: check whether this is still necessary. (2) Admit the case where an interface proxy throws fewer exceptions than the method it implements. Augment the proxy methods with the undeclared exceptions in this case. (3) When generics are enabled, admit the case where an interface proxy has a result type extended by the result type of the method it implements. Change the proxies result type to the smaller type in this case.
  void checkOverride(JCTree tree,
    Type site,
    ClassSymbol origin,
    MethodSymbol m) 
  void checkOverrideClashes(DiagnosticPosition pos,
    Type site,
    MethodSymbol sym) 
    Check that all non-override equivalent methods accessible from 'site' are mutually compatible (JLS 8.4.8/9.4.1).
 Type checkRefType(DiagnosticPosition pos,
    Type t) 
    Check that type is a reference type, i.e. a class, interface or array type or a type variable.
 List<Type> checkRefTypes(List<JCExpression> trees,
    List<Type> types) 
    Check that each type is a reference type, i.e. a class, interface or array type or a type variable.
 Type checkReifiableReferenceType(DiagnosticPosition pos,
    Type t) 
    Check that type is a reifiable class, interface or array type.
  void checkSunAPI(DiagnosticPosition pos,
    Symbol s) 
  void checkTransparentClass(DiagnosticPosition pos,
    ClassSymbol c,
    Scope s) 
    Check that a class or interface does not hide a class or interface with same name in immediately enclosing local scope.
  void checkTransparentVar(DiagnosticPosition pos,
    VarSymbol v,
    Scope s) 
    Check that variable does not hide variable with same name in immediately enclosing local scope.
 Type checkType(DiagnosticPosition pos,
    Type found,
    Type req) 
    Check that a given type is assignable to a given proto-type. If it is, return the type, otherwise return errType.
 Type checkType(DiagnosticPosition pos,
    Type found,
    Type req,
    String errKey) 
 boolean checkUnique(DiagnosticPosition pos,
    Symbol sym,
    Scope s) 
    Check that symbol is unique in given scope.
 boolean checkUniqueClassName(DiagnosticPosition pos,
    Name name,
    Scope s) 
    Check that class does not have the same name as one of its enclosing classes, or as a class defined in its enclosing scope. return true if class is unique in its enclosing scope.
 boolean checkUniqueImport(DiagnosticPosition pos,
    Symbol sym,
    Scope s) 
    Check that single-type import is not already imported or top-level defined, but make an exception for two single-type imports which denote the same type.
 boolean checkUniqueStaticImport(DiagnosticPosition pos,
    Symbol sym,
    Scope s) 
    Check that static single-type import is not already imported or top-level defined, but make an exception for two single-type imports which denote the same type.
 public boolean checkValidGenericType(Type t) 
    Check that type 't' is a valid instantiation of a generic class (see JLS 4.5)
  void checkVararg(DiagnosticPosition pos,
    List<Type> argtypes,
    Symbol msym) 
    Check that vararg method call is sound
  void checkVarargsMethodDecl(Env<AttrContext> env,
    JCMethodDecl tree) 
 public Type completionError(DiagnosticPosition pos,
    CompletionFailure ex) 
    Report a failure to complete a class.
 public Warner convertWarner(DiagnosticPosition pos,
    Type found,
    Type expected) 
 List<Type> diff(List<Type> ts1,
    List<Type> ts2) 
    Form the difference of two type lists.
  void duplicateErasureError(DiagnosticPosition pos,
    Symbol sym1,
    Symbol sym2) 
    Report duplicate declaration error.
  void duplicateError(DiagnosticPosition pos,
    Symbol sym) 
    Report duplicate declaration error.
  void earlyRefError(DiagnosticPosition pos,
    Symbol sym) 
    Report an error that symbol cannot be referenced before super has been called.
 List<Type> excl(Type t,
    List<Type> ts) 
    Remove type set from type set list.
 List<Type> incl(Type t,
    List<Type> ts) 
    Add type set to given type list, unless it is a subclass of some class in the list.
 public static Check instance(Context context) 
 Type instantiatePoly(DiagnosticPosition pos,
    ForAll t,
    Type pt,
    Warner warn) throws NoInstanceException 
    Instantiate polymorphic type to some prototype, unless prototype is `anyPoly' in which case polymorphic type is returned unchanged.
 public List<Type> intersect(List<Type> ts1,
    List<Type> ts2) 
    Form the intersection of two type lists.
 boolean intersects(Type t,
    List<Type> ts) 
    Is given type a subtype or supertype of some of the types in given list?
 boolean isHandled(Type exc,
    List<Type> handled) 
    Is exc handled by given exception list?
 boolean isOverrider(Symbol s) 
    Is s a method symbol that overrides a method in a superclass?
 boolean isTypeArgErroneous(Type t) 
 boolean isTypeVar(Type t) 
    Is type a type variable, or a (possibly multi-dimensional) array of type variables?
 boolean isUnchecked(ClassSymbol exc) 
    Is exc an exception symbol that need not be declared?
 boolean isUnchecked(Type exc) 
    Is exc an exception type that need not be declared?
 boolean isUnchecked(DiagnosticPosition pos,
    Type exc) 
    Same, but handling completion failures.
 Name localClassName(ClassSymbol c) 
    Return name of local class. This is of the form $ n where enclClass is the flat name of the enclosing class, classname is the simple name of the local class
 static int protection(long flags) 
    The level of access protection given by a flag set, where PRIVATE is highest and PUBLIC is lowest.
 public  void reportDeferredDiagnostics() 
    Report any deferred diagnostics.
 DeferredLintHandler setDeferredLintHandler(DeferredLintHandler newDeferredLintHandler) 
 Lint setLint(Lint newLint) 
 MethodSymbol setMethod(MethodSymbol newMethod) 
 boolean subset(Type t,
    List<Type> ts) 
    Is given type a subtype of some of the types in given list?
 Type typeError(DiagnosticPosition pos,
    Object problem,
    Type found,
    Type req) 
    Report a type error.
 Type typeError(DiagnosticPosition pos,
    String problem,
    Type found,
    Type req,
    Object explanation) 
 Type typeTagError(DiagnosticPosition pos,
    Object required,
    Object found) 
    Report an error that wrong type tag was found.
 Object uncheckedOverrides(MethodSymbol m,
    MethodSymbol other) 
    A customized "override" warning message.
 List<Type> unhandled(List<Type> thrown,
    List<Type> handled) 
    Return all exceptions in thrown list that are not in handled list.
 List<Type> union(List<Type> ts1,
    List<Type> ts2) 
    Form the union of two type set lists.
  void validate(JCTree tree,
    Env<AttrContext> env) 
  void validate(List<JCTree> trees,
    Env<AttrContext> env) 
    Visitor method: Validate a list of type expressions.
  void validate(JCTree tree,
    Env<AttrContext> env,
    boolean checkRaw) 
 public  void validateAnnotation(JCAnnotation a) 
    Check an annotation value.
 public  void validateAnnotation(JCAnnotation a,
    Symbol s) 
    Check an annotation of a symbol.
  void validateAnnotationMethod(DiagnosticPosition pos,
    MethodSymbol m) 
    "It is also a compile-time error if any method declared in an annotation type has a signature that is override-equivalent to that of any public or protected method declared in class Object or in the interface annotation.Annotation."
  void validateAnnotationTree(JCTree tree) 
    Recursively validate annotations values
  void validateAnnotationType(JCTree restype) 
    Annotation types are restricted to primitives, String, an enum, an annotation, Class, Class, Class, arrays of the preceding.
  void validateAnnotationType(DiagnosticPosition pos,
    Type type) 
 public  void validateAnnotations(List<JCAnnotation> annotations,
    Symbol s) 
    Check the annotations of a symbol.
  void varargsDuplicateError(DiagnosticPosition pos,
    Symbol sym1,
    Symbol sym2) 
    Report array/varargs duplicate declaration
 Object varargsOverrides(MethodSymbol m,
    MethodSymbol other) 
    A customized "override" warning message.
  void warnDeprecated(DiagnosticPosition pos,
    Symbol sym) 
    Warn about deprecated symbol.
 public  void warnStatic(DiagnosticPosition pos,
    String msg,
    Object args) 
 public  void warnSunApi(DiagnosticPosition pos,
    String msg,
    Object args) 
    Warn about using proprietary API.
 public  void warnUnchecked(DiagnosticPosition pos,
    String msg,
    Object args) 
    Warn about unchecked operation.
  void warnUnsafeVararg(DiagnosticPosition pos,
    String key,
    Object args) 
    Warn about unsafe vararg method decl.