/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/** Type checking helper class for the attribution phase.
*
* <p><b>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.</b>
*/
public class Check {
private final boolean skipAnnotations;
private boolean warnOnSyntheticConflicts;
private boolean suppressAbortOnBadClassFile;
private boolean enableSunApiLintControl;
// The set of lint options currently in effect. It is initialized
// visits all the various parts of the trees during attribution.
// Attr as it visits new method declarations.
return instance;
}
}
/** Switch: generics enabled?
*/
boolean allowGenerics;
/** Switch: annotations enabled?
*/
boolean allowAnnotations;
/** Switch: covariant returns enabled?
*/
boolean allowCovariantReturns;
/** Switch: simplified varargs enabled?
*/
boolean allowSimplifiedVarargs;
/** Switch: -complexinference option set?
*/
boolean complexInference;
/** Character for synthetic names
*/
char syntheticNameChar;
/** A table mapping flat names of all compiled classes in this run to their
* symbols; maintained from outside.
*/
/** A handler for messages about deprecated usage.
*/
/** A handler for messages about unchecked or unsafe usage.
*/
/** A handler for messages about using proprietary API.
*/
/** A handler for deferred lint warnings.
*/
/* *************************************************************************
* Errors and Warnings
**************************************************************************/
return prev;
}
return prev;
}
return prev;
}
/** Warn about deprecated symbol.
* @param pos Position to be used for error reporting.
* @param sym The deprecated symbol.
*/
}
/** Warn about unchecked operation.
* @param pos Position to be used for error reporting.
* @param msg A string describing the problem.
*/
}
/** Warn about unsafe vararg method decl.
* @param pos Position to be used for error reporting.
* @param sym The deprecated symbol.
*/
}
/** Warn about using proprietary API.
* @param pos Position to be used for error reporting.
* @param msg A string describing the problem.
*/
}
}
/**
* Report any deferred diagnostics.
*/
public void reportDeferredDiagnostics() {
}
/** Report a failure to complete a class.
* @param pos Position to be used for error reporting.
* @param ex The failure to report.
*/
&& !suppressAbortOnBadClassFile) throw new Abort();
}
/** Report a type error.
* @param pos Position to be used for error reporting.
* @param problem A string describing the error.
* @param found The type that was found.
* @param req The type that was required.
*/
}
}
/** Report an error that wrong type tag was found.
* @param pos Position to be used for error reporting.
* @param required An internationalized string describing the type tag
* required.
* @param found The type that was found.
*/
// this error used to be raised by the parser,
// but has been delayed to this point:
}
}
/** Report an error that symbol cannot be referenced before super
* has been called.
* @param pos Position to be used for error reporting.
* @param sym The referenced symbol.
*/
}
/** Report duplicate declaration error.
*/
} else {
}
}
}
*/
}
}
/* ************************************************************************
* duplicate declaration checking
*************************************************************************/
/** Check that variable does not hide variable with same name in
* immediately enclosing local scope.
* @param pos Position for error reporting.
* @param v The symbol.
* @param s The scope.
*/
e = e.next()) {
return;
}
}
}
}
/** Check that a class or interface does not hide a class or
* interface with same name in immediately enclosing local scope.
* @param pos Position for error reporting.
* @param c The symbol.
* @param s The scope.
*/
e = e.next()) {
return;
}
}
}
}
/** 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.
* @param pos Position for error reporting.
* @param name The class name.
* @param s The enclosing scope.
*/
return false;
}
}
return true;
}
}
return true;
}
/* *************************************************************************
* Class name generation
**************************************************************************/
/** Return name of local class.
* This is of the form <enclClass> $ n <classname>
* where
* enclClass is the flat name of the enclosing class,
* classname is the simple name of the local class
*/
for (int i=1; ; i++) {
syntheticNameChar + i +
c.name);
}
}
/* *************************************************************************
* Type Checking
**************************************************************************/
/** Check that a given type is assignable to a given proto-type.
* If it is, return the type, otherwise return errType.
* @param pos Position to be used for error reporting.
* @param found The type that was found.
* @param req The type that was required.
*/
}
return req;
return found;
return found;
if (found.isSuperBound()) {
}
if (req.isExtendsBound()) {
}
}
/** Instantiate polymorphic type to some prototype, unless
* prototype is `anyPoly' in which case polymorphic type
* is returned unchanged.
*/
Type instantiatePoly(DiagnosticPosition pos, ForAll t, Type pt, Warner warn) throws Infer.NoInstanceException {
return t;
return pt;
} else {
try {
if (ex.isAmbiguous) {
t, d);
} else {
t, pt);
}
}
}
}
/** Check that a given type can be cast to a given target type.
* Return the result of the cast.
* @param pos Position to be used for error reporting.
* @param found The type that is being cast.
* @param req The target type of the cast.
*/
return req;
return req;
} else {
}
}
//where
/** Is type a type variable, or a (possibly multi-dimensional) array of
* type variables?
*/
}
/** Check that a type is within some bounds.
*
* Used in TypeApply to verify that, e.g., X in V<X> is a valid
* type argument.
* @param pos Position to be used for error reporting.
* @param a The type that should be bounded by bs.
* @param bs The bound.
*/
if (a.isUnbound()) {
return true;
a = types.upperBound(a);
} else if (a.isExtendsBound()) {
} else if (a.isSuperBound()) {
}
return true;
}
/** Check that type is different from 'void'.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
return types.createErrorType(t);
} else {
return t;
}
}
/** Check that type is a class or interface type.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
return typeTagError(pos,
: t);
else
return t;
}
/** Check that type is a class or interface type.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
* @param noBounds True if type bounds are illegal here.
*/
t = checkClassType(pos, t);
if (noBounds && t.isParameterized()) {
return typeTagError(pos,
}
}
return t;
}
/** Check that type is a reifiable class, interface or array type.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
return typeTagError(pos,
t);
} else if (!types.isReifiable(t)) {
return types.createErrorType(t);
} else {
return t;
}
}
/** Check that type is a reference type, i.e. a class, interface or array type
* or a type variable.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
switch (t.tag) {
case CLASS:
case ARRAY:
case TYPEVAR:
case WILDCARD:
case ERROR:
return t;
default:
return typeTagError(pos,
t);
}
}
/** Check that each type is a reference type, i.e. a class, interface or array type
* or a type variable.
* @param trees Original trees, used for error reporting.
* @param types The types to be checked.
*/
}
return types;
}
/** Check that type is a null or reference type.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
switch (t.tag) {
case CLASS:
case ARRAY:
case TYPEVAR:
case WILDCARD:
case BOT:
case ERROR:
return t;
default:
return typeTagError(pos,
t);
}
}
/** Check that flag set does not contain elements of two conflicting sets. s
* Return true if it doesn't.
* @param pos Position to be used for error reporting.
* @param flags The set of flags to be checked.
* @param set1 Conflicting flags set #1.
* @param set2 Conflicting flags set #2.
*/
"illegal.combination.of.modifiers",
return false;
} else
return true;
}
/** 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)
*/
t.isErroneous()) {
"cant.apply.diamond.1",
return types.createErrorType(t);
"cant.apply.diamond.1",
return types.createErrorType(t);
"cant.apply.diamond.1",
return types.createErrorType(t);
} else {
return t;
}
}
if (!allowSimplifiedVarargs) return;
if (m.isVarArgs()) {
}
if (hasTrustMeAnno && !isTrustMeAllowedOnMethod(m)) {
if (varargElemType != null) {
"varargs.invalid.trustme.anno",
} else {
"varargs.invalid.trustme.anno",
}
"varargs.redundant.trustme.anno",
}
}
}
//where
(s.isConstructor() ||
}
/**
* Check that vararg method call is sound
* @param pos Position to be used for error reporting.
* @param argtypes Actual arguments supplied to vararg method.
*/
!isTrustMeAllowedOnMethod(msym))) {
"unchecked.generic.array.creation",
argtype);
}
}
/**
* Check that type 't' is a valid instantiation of a generic class
* (see JLS 4.5)
*
* @param t class type to be checked
* @return true if 't' is well-formed
*/
return firstIncompatibleTypeArg(t) == null;
}
//WHERE
// For matching pairs of actual argument types `a' and
// formal type parameters with declared bound `b' ...
// exact type arguments needs to know their
// bounds (for upper and lower bound
// calculations). So we create new bounds where
// type-parameters are replaced with actuals argument types.
}
// Let the actual arguments know their bound
}
if (!isTypeArgErroneous(actual) &&
}
}
}
}
return null;
}
//where
return isTypeArgErroneous.visit(t);
}
return t.isErroneous();
}
return visit(t.getUpperBound());
}
return visit(t.getUpperBound()) ||
visit(t.getLowerBound());
}
}
};
/** 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.
* @param pos Position to be used for error reporting.
* @param flags The set of modifiers given in a definition.
* @param sym The defined symbol.
*/
long mask;
long implicit = 0;
case VAR:
else
break;
case MTH:
// enum constructors cannot be declared public or
// protected and must be implicitly or explicitly
// private
} else
else {
mask = MethodFlags;
}
// Imply STRICTFP if owner has STRICTFP set.
break;
case TYP:
// Anonymous classes in static methods are themselves static;
// that's why we admit STATIC here.
// JLS: Anonymous classes are final.
}
// Nested interfaces and enums are always STATIC (Spec ???)
} else {
mask = ClassFlags;
}
// Interfaces are always ABSTRACT
// enums can't be declared abstract or final
}
// Imply STRICTFP if owner has STRICTFP set.
break;
default:
throw new AssertionError();
}
if (illegal != 0) {
}
else {
}
}
// ISSUE: Disallowing abstract&private is no longer appropriate
// in the presence of inner classes. Should it be deleted here?
&&
&&
&&
&&
&&
STRICTFP))) {
// skip
}
}
/** Determine if this enum should be implicitly final.
*
* If the enum has no specialized enum contants, it is final.
*
* If the enum does have specialized enum contants, it is
* <i>not</i> final.
*/
boolean specialized;
this.specialized = false;
};
specialized = true;
}
}
}
}
}
return FINAL;
}
/* *************************************************************************
* Type Validation
**************************************************************************/
/** Validate a type expression. That is,
* check that all type arguments of a parametric type are within
* their bounds. This must be done in a second phase after type attributon
* since a class might have a subclass as type parameter bound. E.g:
*
* class B<A extends C> { ... }
* class C extends B<C> { ... }
*
* and we can't make sure that the bound is already attributed because
* of possible cycles.
*
* Visitor method: Validate a type expression, if it is not null, catching
* and reporting any completion failures.
*/
}
}
/** Visitor method: Validate a list of type expressions.
*/
}
/** A visitor class for type validation.
*/
boolean isOuter;
}
}
if (incompatibleArg != null) {
}
}
}
// For matching pairs of actual argument types `a' and
// formal type parameters with declared bound `b' ...
!(isOuter && is_java_lang_Class),
false);
}
// Check that this type is either fully parameterized, or
// not parameterized at all.
}
}
}
}
// Check that this type is either fully parameterized, or
// not parameterized at all.
}
}
// The enclosing type is not a class, so we are
// looking at a static member type. However, the
// qualifying expression is parameterized.
} else {
// otherwise validate the rest of the expression
}
}
/** Default visitor method: do nothing.
*/
}
try {
if (checkRaw)
}
} catch (CompletionFailure ex) {
}
}
}
}
}
}
/* *************************************************************************
* Exception checking
**************************************************************************/
/* The following methods treat classes as sets that contain
* the class itself and all their subclasses
*/
/** Is given type a subtype of some of the types in given list?
*/
return false;
}
/** Is given type a subtype or supertype of
* some of the types in given list?
*/
return false;
}
/** Add type set to given type list, unless it is a subclass of some class
* in the list.
*/
}
/** Remove type set from type set list.
*/
return ts;
} else {
}
}
/** Form the union of two type set lists.
*/
return ts;
}
/** Form the difference of two type lists.
*/
return ts;
}
/** Form the intersection of two type lists.
*/
return ts;
}
/** Is exc an exception symbol that need not be declared?
*/
return
}
/** Is exc an exception type that need not be declared?
*/
return
}
/** Same, but handling completion failures.
*/
try {
return isUnchecked(exc);
} catch (CompletionFailure ex) {
return true;
}
}
/** Is exc handled by given exception list?
*/
}
/** Return all exceptions in thrown list that are not in handled list.
* @param thrown The list of thrown exceptions.
* @param handled The list of handled exceptions.
*/
return unhandled;
}
/* *************************************************************************
* Overriding/Implementation checking
**************************************************************************/
/** The level of access protection given by a flag set,
* where PRIVATE is highest and PUBLIC is lowest.
*/
switch ((short)(flags & AccessFlags)) {
case PRIVATE: return 3;
case PROTECTED: return 1;
default:
case PUBLIC: return 0;
case 0: return 2;
}
}
/** A customized "cannot override" error message.
* @param m The overriding method.
* @param other The overridden method.
* @return An internationalized string.
*/
key = "cant.override";
key = "cant.implement";
else
key = "clashes.with";
}
/** A customized "override" warning message.
* @param m The overriding method.
* @param other The overridden method.
* @return An internationalized string.
*/
key = "unchecked.override";
key = "unchecked.implement";
else
key = "unchecked.clash.with";
}
/** A customized "override" warning message.
* @param m The overriding method.
* @param other The overridden method.
* @return An internationalized string.
*/
key = "varargs.override";
key = "varargs.implement";
else
key = "varargs.clash.with";
}
/** 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.
*
* @param tree The tree from which positions
* are extracted for errors.
* @param m The overriding method.
* @param other The overridden method.
* @param origin The class of which the overriding method
* is a member.
*/
MethodSymbol m,
// Don't check overriding of synthetic methods or by bridge methods.
return;
}
// Error if static method overrides instance method (JLS 8.4.6.2).
cannotOverride(m, other));
return;
}
// Error if instance method overrides static or final
// method (JLS 8.4.6.1).
cannotOverride(m, other),
return;
}
// handled in validateAnnotationMethod
return;
}
// Error if overriding method has weaker access (JLS 8.4.6.3).
cannotOverride(m, other),
return;
}
// Error if overriding result type is different
// (or, in the case of generics mode, not a subtype) of
// overridden result type. We have to rename any type parameters
// before comparing types.
boolean resultTypesOK =
if (!resultTypesOK) {
if (!allowCovariantReturns &&
// allow limited interoperability with covariant returns
} else {
"override.incompatible.ret",
cannotOverride(m, other),
return;
}
"override.unchecked.ret",
uncheckedOverrides(m, other),
}
// Error if overriding method throws an exception not reported
// by overridden method.
if (unhandledErased.nonEmpty()) {
"override.meth.doesnt.throw",
cannotOverride(m, other),
return;
}
else if (unhandledUnerased.nonEmpty()) {
"override.unchecked.thrown",
cannotOverride(m, other),
return;
}
// Optional warning if varargs don't agree
? "override.varargs.missing"
: "override.varargs.extra",
varargsOverrides(m, other));
}
// Warn if instance method overrides bridge method (compiler spec ??)
uncheckedOverrides(m, other));
}
// Warn if a deprecated method overridden by a non-deprecated one.
}
}
// where
// If the method, m, is defined in an interface, then ignore the issue if the method
// is only inherited via a supertype and also implemented in the supertype,
// because in that case, we will rediscover the issue when examining the method
// in the supertype.
// If the method, m, is not defined in an interface, then the only time we need to
// address the issue is when the method is the supertype implemementation: any other
// case, we will have dealt with when examining the supertype classes
return true;
}
else
return (stimpl != m);
}
// used to check if there were any unchecked conversions
/** Check that a class does not inherit two concrete methods
* with the same signature.
* @param pos Position to be used for error reporting.
* @param site The class type to be checked.
*/
true) != s1)
continue;
true) != s2)
continue;
}
}
}
}
}
/** Check that classes (or interfaces) do not each define an abstract
* method with same name and arguments but incompatible return types.
* @param pos Position to be used for error reporting.
* @param t1 The first argument type.
* @param t2 The second argument type.
*/
}
}
/** Return the first method which is defined with same args
* but different return types in two given interfaces, or null if none
* exists.
* @param t1 The first type.
* @param t2 The second type.
* @param site The most derived type.
* @returns symbol from t2 that conflicts with one in t1.
*/
else
if (s != null) return s;
}
}
return null;
}
/** Compute all the supertypes of t, indexed by type symbol. */
}
}
/** Compute all the supertypes of t, indexed by type symbol (except thise in typesSkip). */
}
}
/** Return the first method in t2 that conflicts with a method from t1. */
boolean compat =
if (!compat) {
return s2;
}
"name.clash.same.erasure.no.override",
return s2;
}
}
}
return null;
}
//WHERE
return true;
}
boolean compat =
if (compat)
return true;
}
}
}
return false;
}
/** Check that a given method conforms with any method it overrides.
* @param tree The tree from which positions are extracted
* for errors.
* @param m The overriding method.
*/
return;
}
}
}
}
}
}
}
e = e.next();
}
}
}
/** Check that all abstract members of given class have definitions.
* @param pos Position to be used for error reporting.
* @param c The class.
*/
try {
// add the ABSTRACT flag to an enum
c.flags_field |= ABSTRACT;
} else {
}
}
} catch (CompletionFailure ex) {
}
}
//where
/** Return first abstract member of class `c' that is not defined
* in `impl', null if there is none.
*/
// Do not bother to search in classes that are not abstract,
// since they cannot have abstract members.
e = e.sibling) {
}
}
}
l = l.tail) {
}
}
return undef;
}
}
}
boolean errorFound = false;
boolean partialCheck = false;
try {
}
finally {
}
}
} else {
//not completed yet
partialCheck = true;
}
}
super.visitSelect(tree);
}
}
}
}
}
}
}
}
return;
if (seenClasses.contains(c)) {
errorFound = true;
} else if (!c.type.isErroneous()) {
try {
if (supertypes.nonEmpty()) {
}
else {
//not completed yet
partialCheck = true;
return;
}
}
}
}
}
} finally {
}
}
}
}
/** Check for cyclic references. Issue an error if the
* symbol of the type referred to has a LOCKED flag set.
*
* @param pos Position to be used for error reporting.
* @param t The type referred to.
*/
}
}
return;
}
}
/** Check for cyclic references. Issue an error if the
* symbol of the type referred to has a LOCKED flag set.
*
* @param pos Position to be used for error reporting.
* @param t The type referred to.
* @returns True if the check completed on all attributed classes
*/
boolean complete = true; // was the check complete?
//- System.err.println("checkNonCyclicInternal("+t+");");//DEBUG
} else if (!c.type.isErroneous()) {
try {
c.flags_field |= LOCKED;
}
}
} finally {
c.flags_field &= ~LOCKED;
}
}
if (complete)
return complete;
}
/** Note that we found an inheritance cycle. */
c.flags_field |= ACYCLIC;
}
/** Check that all methods which implement some
* method conform to the method they implement.
* @param tree The class definition whose members are checked.
*/
}
//where
/** Check that all methods which implement some
* method in `ic' conform to the method they implement.
*/
// don't check if implmeth is in a class, yet
// origin is an interface. This case arises only
// if implmeth is declared in Object. The reason is
// that interfaces really don't inherit from
// Object it's just that the compiler represents
// things that way.
}
}
}
}
}
}
/** Check that all abstract methods implemented by a class are
* mutually compatible.
* @param pos Position to be used for error reporting.
* @param c The class whose interfaces are checked.
*/
return;
return;
}
}
for (Scope.Entry e = ct.tsym.members().lookup(sym.name); e.scope == ct.tsym.members(); e = e.next()) {
// VM allows methods and variables with differing types
return;
}
}
}
}
/** Check that all non-override equivalent methods accessible from 'site'
* are mutually compatible (JLS 8.4.8/9.4.1).
*
* @param pos Position to be used for error reporting.
* @param site The class whose methods are checked.
* @param sym The method symbol to be checked.
*/
//for each method m1 that is overridden (directly or indirectly)
//by method 'sym' in 'site'...
//...check each method m2 that is a member of 'site'
//if (i) the signature of 'sym' is not a subsignature of m1 (seen as
//a member of 'site') and (ii) m1 has the same erasure as m2, issue an error
"name.clash.same.erasure.no.override" :
"name.clash.same.erasure.no.override.1";
key,
return;
}
}
}
}
/** Check that all static methods accessible from 'site' are
* mutually compatible (JLS 8.4.8).
*
* @param pos Position to be used for error reporting.
* @param site The class whose methods are checked.
* @param sym The method symbol to be checked.
*/
//for each method m1 that is a member of 'site'...
//if (i) the signature of 'sym' is not a subsignature of m1 (seen as
//a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error
"name.clash.same.erasure.no.hide",
s, s.location());
return;
}
}
}
//where
}
}
!shouldSkip(s) &&
!s.isConstructor();
}
}
/** Report a conflict between a user symbol and a synthetic symbol.
*/
if (warnOnSyntheticConflicts) {
}
else {
}
}
}
/** Check that class c does not implement directly or indirectly
* the same parameterized interface with two different argument lists.
* @param pos Position to be used for error reporting.
* @param type The type whose interfaces are checked.
*/
}
//where
/** 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.
*/
if (type.isErroneous()) return;
}
}
}
/** Enter interface into into set.
* If it existed already, issue a "repeated interface" error.
*/
else {
}
}
/* *************************************************************************
* Check annotations
**************************************************************************/
/**
* Recursively validate annotations values
*/
class AnnotationValidator extends TreeScanner {
super.visitAnnotation(tree);
}
}
}
}
/** Annotation types are restricted to primitives, String, an
* enum, an annotation, Class, Class<?>, Class<? extends
* Anything>, arrays of the preceding.
*/
// restype may be null if an error occurred, so don't bother validating it
}
}
if (type.isPrimitive()) return;
return;
}
}
/**
* "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."
*
* @jls 9.6 Annotation Types
*/
}
}
}
/** Check the annotations of a symbol.
*/
if (skipAnnotations) return;
for (JCAnnotation a : annotations)
validateAnnotation(a, s);
}
/** Check an annotation of a symbol.
*/
if (!annotationApplicable(a, s))
if (!isOverrider(s))
}
}
/** Is s a method symbol that overrides a method in a superclass? */
return false;
MethodSymbol m = (MethodSymbol)s;
continue; // skip "this"
return true;
}
}
return false;
}
/** Is the annotation applicable to the symbol? */
return true;
}
return true;
}
return true;
}
return true;
}
else
return true; // recovery
}
return false;
}
/** Check an annotation value.
*/
// collect an inventory of the members (sorted alphabetically)
}
});
e != null;
e = e.sibling)
// count them off as they're annotated
}
// all the remaining ones better have default values
for (MethodSymbol m : members) {
}
}
if (missingDefaults.nonEmpty()) {
? "annotation.missing.default.value.1"
: "annotation.missing.default.value";
}
// special case: java.lang.annotation.Target must not have
// repeated values in its value member
return;
}
}
}
if (allowAnnotations &&
pos, "missing.deprecated.annotation");
}
}
public void report() {
warnDeprecated(pos, s);
}
});
};
}
public void report() {
else
}
});
}
}
/* *************************************************************************
* Check for recursive annotation elements.
**************************************************************************/
/** Check for cycles in the graph of annotation elements.
*/
try {
}
} finally {
}
}
return;
return;
}
try {
continue;
}
} finally {
}
}
break;
break;
default:
break; // int etc
}
}
/* *************************************************************************
* Check for cycles in the constructor call graph.
**************************************************************************/
/** Check for cycles in the graph of constructors calling other
* constructors.
*/
// enter each constructor this-call into the map
} else {
}
}
// Check for cycles in the map
}
}
/** Look in the map to see if the given constructor is part of a
* call cycle.
*/
"recursive.ctor.invocation");
} else {
}
}
}
/* *************************************************************************
* Miscellaneous
**************************************************************************/
/**
* Return the opcode of the operator but emit an error if it is an
* error.
* @param pos position for error reporting.
* @param operator an operator
* @param tag a tree tag
* @param left type of left hand side
* @param right type of right hand side
*/
int tag,
"operator.cant.be.applied.1",
}
}
/**
* Check for division by integer constant zero
* @param pos Position for error reporting.
* @param operator The operator for the expression
* @param operand The right hand operand for the expression
*/
}
}
}
/**
* Check for empty statements after if
*/
if (tree.thenpart.getTag() == JCTree.SKIP && tree.elsepart == null && lint.isEnabled(LintCategory.EMPTY))
}
/** Check that symbol is unique in given scope.
* @param pos Position for error reporting.
* @param sym The symbol.
* @param s The scope.
*/
return true;
return true;
return true;
} else {
return false;
}
}
}
return true;
}
/** Report duplicate declaration error.
*/
}
}
/** 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.
* @param pos Position for error reporting.
* @param sym The symbol.
* @param s The scope
*/
}
/** 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.
* @param pos Position for error reporting.
* @param sym The symbol.
* @param s The scope
* @param staticImport Whether or not this was a static import
*/
}
/** 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.
* @param pos Position for error reporting.
* @param sym The symbol.
* @param s The scope.
* @param staticImport Whether or not this was a static import
*/
private boolean checkUniqueImport(DiagnosticPosition pos, Symbol sym, Scope s, boolean staticImport) {
// is encountered class entered via a class declaration?
boolean isClassDecl = e.scope == s;
if (!isClassDecl) {
if (staticImport)
else
}
}
return false;
}
}
return true;
}
/** Check that a qualified name is in canonical form (for import decls).
*/
if (!isCanonical(tree))
}
// where
return false;
}
return true;
}
super(pos);
this.uncheckedKey = uncheckedKey;
}
if (warned) return; // suppress redundant diagnostics
switch (lint) {
case UNCHECKED:
break;
case VARARGS:
}
break;
default:
}
}
}
}
}
}