diff options
Diffstat (limited to 'src/com/google')
-rw-r--r-- | src/com/google/doclava/ClassInfo.java | 4 | ||||
-rw-r--r-- | src/com/google/doclava/MethodInfo.java | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/com/google/doclava/ClassInfo.java b/src/com/google/doclava/ClassInfo.java index f3993eb..d3ed434 100644 --- a/src/com/google/doclava/ClassInfo.java +++ b/src/com/google/doclava/ClassInfo.java @@ -247,6 +247,10 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco return mIsFinal; } + public boolean isEffectivelyFinal() { + return mIsFinal || mApiCheckConstructors.isEmpty(); + } + public boolean isIncluded() { return mIsIncluded; } diff --git a/src/com/google/doclava/MethodInfo.java b/src/com/google/doclava/MethodInfo.java index b6a5cc3..fc8959f 100644 --- a/src/com/google/doclava/MethodInfo.java +++ b/src/com/google/doclava/MethodInfo.java @@ -624,8 +624,15 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv return mIsVarargs; } - public boolean isFinalOrBelongsToFinalClass() { - return mIsFinal || (containingClass() != null && containingClass().isFinal()); + public boolean isEffectivelyFinal() { + if (mIsFinal) { + return true; + } + ClassInfo containingClass = containingClass(); + if (containingClass != null && containingClass.isEffectivelyFinal()) { + return true; + } + return false; } @Override @@ -738,11 +745,11 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv // the compiler, so this check needs to be quite narrow. A change in 'final' // status of a method is only relevant if (a) the method is not declared 'static' // and (b) the method is not already inferred to be 'final' by virtue of its class. - if (!isFinalOrBelongsToFinalClass() && mInfo.isFinalOrBelongsToFinalClass()) { + if (!isEffectivelyFinal() && mInfo.isEffectivelyFinal()) { consistent = false; Errors.error(Errors.ADDED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName() + " has added 'final' qualifier"); - } else if (isFinalOrBelongsToFinalClass() && !mInfo.isFinalOrBelongsToFinalClass()) { + } else if (isEffectivelyFinal() && !mInfo.isEffectivelyFinal()) { consistent = false; Errors.error(Errors.REMOVED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName() + " has removed 'final' qualifier"); |