diff options
author | C. Sean Young <csyoung@google.com> | 2015-05-20 16:28:36 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-20 16:28:36 +0000 |
commit | 552b5f6628ed74d95e87e2a72e5d1a0aaa926fda (patch) | |
tree | ee61e063954caec2c7947dbc1abc14d0777f30e1 | |
parent | 6375c32993ca44863669cce02d9c05c95c9fec4f (diff) | |
parent | 6904e0369dbf0d4875368cc29cea3cdc7d993cba (diff) | |
download | android_external_doclava-552b5f6628ed74d95e87e2a72e5d1a0aaa926fda.tar.gz android_external_doclava-552b5f6628ed74d95e87e2a72e5d1a0aaa926fda.tar.bz2 android_external_doclava-552b5f6628ed74d95e87e2a72e5d1a0aaa926fda.zip |
am 6904e036: Merge "Make CheckApi error messages more consisent and informative." into lmp-mr1-app-dev
* commit '6904e0369dbf0d4875368cc29cea3cdc7d993cba':
Make CheckApi error messages more consisent and informative.
-rw-r--r-- | src/com/google/doclava/ClassInfo.java | 10 | ||||
-rw-r--r-- | src/com/google/doclava/FieldInfo.java | 4 | ||||
-rw-r--r-- | src/com/google/doclava/MethodInfo.java | 51 |
3 files changed, 38 insertions, 27 deletions
diff --git a/src/com/google/doclava/ClassInfo.java b/src/com/google/doclava/ClassInfo.java index a5ee7d4..616cf23 100644 --- a/src/com/google/doclava/ClassInfo.java +++ b/src/com/google/doclava/ClassInfo.java @@ -2082,7 +2082,7 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco } if (mi == null) { Errors.error(Errors.REMOVED_METHOD, mInfo.position(), "Removed public method " - + mInfo.qualifiedName()); + + mInfo.prettyQualifiedSignature()); consistent = false; } } @@ -2096,7 +2096,7 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco MethodInfo mi = ClassInfo.overriddenMethod(mInfo, this); if (mi == null) { Errors.error(Errors.ADDED_METHOD, mInfo.position(), "Added public method " - + mInfo.qualifiedName()); + + mInfo.prettyQualifiedSignature()); consistent = false; } } @@ -2109,14 +2109,14 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco } } else { Errors.error(Errors.REMOVED_METHOD, mInfo.position(), "Removed public constructor " - + mInfo.prettySignature()); + + mInfo.prettyQualifiedSignature()); consistent = false; } } for (MethodInfo mInfo : cl.mApiCheckConstructors.values()) { if (!mApiCheckConstructors.containsKey(mInfo.getHashableName())) { Errors.error(Errors.ADDED_METHOD, mInfo.position(), "Added public constructor " - + mInfo.prettySignature()); + + mInfo.prettyQualifiedSignature()); consistent = false; } } @@ -2201,7 +2201,7 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco if (!isDeprecated() == cl.isDeprecated()) { consistent = false; Errors.error(Errors.CHANGED_DEPRECATED, cl.position(), "Class " + cl.qualifiedName() - + " has changed deprecation state"); + + " has changed deprecation state " + isDeprecated() + " --> " + cl.isDeprecated()); } if (superclassName() != null) { // java.lang.Object can't have a superclass. diff --git a/src/com/google/doclava/FieldInfo.java b/src/com/google/doclava/FieldInfo.java index ce80e9e..83d748a 100644 --- a/src/com/google/doclava/FieldInfo.java +++ b/src/com/google/doclava/FieldInfo.java @@ -423,7 +423,7 @@ public class FieldInfo extends MemberInfo { boolean consistent = true; if (!mType.equals(fInfo.mType)) { Errors.error(Errors.CHANGED_TYPE, fInfo.position(), "Field " + fInfo.qualifiedName() - + " has changed type"); + + " has changed type from " + mType + " to " + fInfo.mType); consistent = false; } else if (!this.valueEquals(fInfo)) { Errors.error(Errors.CHANGED_VALUE, fInfo.position(), "Field " + fInfo.qualifiedName() @@ -467,7 +467,7 @@ public class FieldInfo extends MemberInfo { if (isDeprecated() != fInfo.isDeprecated()) { Errors.error(Errors.CHANGED_DEPRECATED, fInfo.position(), "Field " + fInfo.qualifiedName() - + " has changed deprecation state"); + + " has changed deprecation state " + isDeprecated() + " --> " + fInfo.isDeprecated()); consistent = false; } diff --git a/src/com/google/doclava/MethodInfo.java b/src/com/google/doclava/MethodInfo.java index cf98d0f..5dc217c 100644 --- a/src/com/google/doclava/MethodInfo.java +++ b/src/com/google/doclava/MethodInfo.java @@ -333,6 +333,10 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv public String prettySignature() { return name() + prettyParameters(); } + + public String prettyQualifiedSignature() { + return qualifiedName() + prettyParameters(); + } /** * Returns a printable version of the parameters of this method's signature. @@ -728,6 +732,8 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv public String qualifiedName() { String parentQName = (containingClass() != null) ? (containingClass().qualifiedName() + ".") : ""; + // TODO: This logic doesn't work well with constructors, as name() for constructors already + // contains the containingClass's name, leading to things like A.B.B() being rendered as A.B.A.B() return parentQName + name(); } @@ -776,21 +782,22 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv } if (!consistent) { - Errors.error(Errors.CHANGED_TYPE, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has changed return type from " + mReturnType + " to " + mInfo.mReturnType); + Errors.error(Errors.CHANGED_TYPE, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has changed return type from " + mReturnType + + " to " + mInfo.mReturnType); } } if (mIsAbstract != mInfo.mIsAbstract) { consistent = false; - Errors.error(Errors.CHANGED_ABSTRACT, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has changed 'abstract' qualifier"); + Errors.error(Errors.CHANGED_ABSTRACT, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has changed 'abstract' qualifier"); } if (mIsNative != mInfo.mIsNative) { consistent = false; - Errors.error(Errors.CHANGED_NATIVE, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has changed 'native' qualifier"); + Errors.error(Errors.CHANGED_NATIVE, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has changed 'native' qualifier"); } if (!mIsStatic) { @@ -800,30 +807,32 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv // and (b) the method is not already inferred to be 'final' by virtue of its class. if (!isEffectivelyFinal() && mInfo.isEffectivelyFinal()) { consistent = false; - Errors.error(Errors.ADDED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has added 'final' qualifier"); + Errors.error(Errors.ADDED_FINAL, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has added 'final' qualifier"); } else if (isEffectivelyFinal() && !mInfo.isEffectivelyFinal()) { consistent = false; - Errors.error(Errors.REMOVED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has removed 'final' qualifier"); + Errors.error(Errors.REMOVED_FINAL, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has removed 'final' qualifier"); } } if (mIsStatic != mInfo.mIsStatic) { consistent = false; - Errors.error(Errors.CHANGED_STATIC, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has changed 'static' qualifier"); + Errors.error(Errors.CHANGED_STATIC, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has changed 'static' qualifier"); } if (!scope().equals(mInfo.scope())) { consistent = false; - Errors.error(Errors.CHANGED_SCOPE, mInfo.position(), "Method " + mInfo.qualifiedName() - + " changed scope from " + scope() + " to " + mInfo.scope()); + Errors.error(Errors.CHANGED_SCOPE, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " changed scope from " + scope() + + " to " + mInfo.scope()); } if (!isDeprecated() == mInfo.isDeprecated()) { - Errors.error(Errors.CHANGED_DEPRECATED, mInfo.position(), "Method " + mInfo.qualifiedName() - + " has changed deprecation state " + isDeprecated() + " --> " + mInfo.isDeprecated()); + Errors.error(Errors.CHANGED_DEPRECATED, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " has changed deprecation state " + isDeprecated() + + " --> " + mInfo.isDeprecated()); consistent = false; } @@ -842,8 +851,9 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv if (!mInfo.throwsException(exception)) { // exclude 'throws' changes to finalize() overrides with no arguments if (!name().equals("finalize") || (!mParameters.isEmpty())) { - Errors.error(Errors.CHANGED_THROWS, mInfo.position(), "Method " + mInfo.qualifiedName() - + " no longer throws exception " + exception.qualifiedName()); + Errors.error(Errors.CHANGED_THROWS, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " no longer throws exception " + + exception.qualifiedName()); consistent = false; } } @@ -853,8 +863,9 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv // exclude 'throws' changes to finalize() overrides with no arguments if (!throwsException(exec)) { if (!name().equals("finalize") || (!mParameters.isEmpty())) { - Errors.error(Errors.CHANGED_THROWS, mInfo.position(), "Method " + mInfo.qualifiedName() - + " added thrown exception " + exec.qualifiedName()); + Errors.error(Errors.CHANGED_THROWS, mInfo.position(), "Method " + + mInfo.prettyQualifiedSignature() + " added thrown exception " + + exec.qualifiedName()); consistent = false; } } |