< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
Print this page
*** 1297,1309 ****
}
/** 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.
*/
private long implicitEnumFinalFlag(JCTree tree) {
if (!tree.hasTag(CLASSDEF)) return 0;
class SpecialTreeVisitor extends JCTree.Visitor {
--- 1297,1309 ----
}
/** Determine if this enum should be implicitly final.
*
! * If the enum has no specialized enum constants, it is final.
*
! * If the enum does have specialized enum constants, it is
* <i>not</i> final.
*/
private long implicitEnumFinalFlag(JCTree tree) {
if (!tree.hasTag(CLASSDEF)) return 0;
class SpecialTreeVisitor extends JCTree.Visitor {
*** 1859,1869 ****
// 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
ClassSymbol mc = m.enclClass();
Type st = types.supertype(origin.type);
if (!st.hasTag(CLASS))
return true;
--- 1859,1869 ----
// 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 implementation: any other
// case, we will have dealt with when examining the supertype classes
ClassSymbol mc = m.enclClass();
Type st = types.supertype(origin.type);
if (!st.hasTag(CLASS))
return true;
*** 1980,1990 ****
for (Type i : types.interfaces(t))
closure(i, typeMap);
}
}
! /** Compute all the supertypes of t, indexed by type symbol (except thise in typesSkip). */
private void closure(Type t, Map<TypeSymbol,Type> typesSkip, Map<TypeSymbol,Type> typeMap) {
if (!t.hasTag(CLASS)) return;
if (typesSkip.get(t.tsym) != null) return;
if (typeMap.put(t.tsym, t) == null) {
closure(types.supertype(t), typesSkip, typeMap);
--- 1980,1990 ----
for (Type i : types.interfaces(t))
closure(i, typeMap);
}
}
! /** Compute all the supertypes of t, indexed by type symbol (except this in typesSkip). */
private void closure(Type t, Map<TypeSymbol,Type> typesSkip, Map<TypeSymbol,Type> typeMap) {
if (!t.hasTag(CLASS)) return;
if (typesSkip.get(t.tsym) != null) return;
if (typeMap.put(t.tsym, t) == null) {
closure(types.supertype(t), typesSkip, typeMap);
*** 2676,2686 ****
args1 = args1.tail;
args2 = args2.tail;
}
if (potentiallyAmbiguous) {
//we found two incompatible functional interfaces with same arity
! //this means a call site passing an implicit lambda would be ambigiuous
msym1.flags_field |= POTENTIALLY_AMBIGUOUS;
msym2.flags_field |= POTENTIALLY_AMBIGUOUS;
log.warning(LintCategory.OVERLOADS, pos,
Warnings.PotentiallyAmbiguousOverload(msym1, msym1.location(),
msym2, msym2.location()));
--- 2676,2686 ----
args1 = args1.tail;
args2 = args2.tail;
}
if (potentiallyAmbiguous) {
//we found two incompatible functional interfaces with same arity
! //this means a call site passing an implicit lambda would be ambiguous
msym1.flags_field |= POTENTIALLY_AMBIGUOUS;
msym2.flags_field |= POTENTIALLY_AMBIGUOUS;
log.warning(LintCategory.OVERLOADS, pos,
Warnings.PotentiallyAmbiguousOverload(msym1, msym1.location(),
msym2, msym2.location()));
*** 3274,3284 ****
} else if (target == names.PACKAGE) {
if (s.kind == PCK)
return true;
} else if (target == names.TYPE_USE) {
if (s.kind == VAR && s.owner.kind == MTH && s.type.hasTag(NONE)) {
! //cannot type annotate implictly typed locals
return false;
} else if (s.kind == TYP || s.kind == VAR ||
(s.kind == MTH && !s.isConstructor() &&
!s.type.getReturnType().hasTag(VOID)) ||
(s.kind == MTH && s.isConstructor())) {
--- 3274,3284 ----
} else if (target == names.PACKAGE) {
if (s.kind == PCK)
return true;
} else if (target == names.TYPE_USE) {
if (s.kind == VAR && s.owner.kind == MTH && s.type.hasTag(NONE)) {
! //cannot type annotate implicitly typed locals
return false;
} else if (s.kind == TYP || s.kind == VAR ||
(s.kind == MTH && !s.isConstructor() &&
!s.type.getReturnType().hasTag(VOID)) ||
(s.kind == MTH && s.isConstructor())) {
*** 3605,3615 ****
sym.flags_field |= CLASH;
return true;
} else if ((sym.flags() & MATCH_BINDING) != 0 &&
(byName.flags() & MATCH_BINDING) != 0 &&
(byName.flags() & MATCH_BINDING_TO_OUTER) == 0) {
! //this error will be reported separatelly in MatchBindingsComputer
return false;
} else {
duplicateError(pos, byName);
return false;
}
--- 3605,3615 ----
sym.flags_field |= CLASH;
return true;
} else if ((sym.flags() & MATCH_BINDING) != 0 &&
(byName.flags() & MATCH_BINDING) != 0 &&
(byName.flags() & MATCH_BINDING_TO_OUTER) == 0) {
! //this error will be reported separately in MatchBindingsComputer
return false;
} else {
duplicateError(pos, byName);
return false;
}
< prev index next >