summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2015-08-10 14:17:22 +0100
committerSteve Kondik <steve@cyngn.com>2016-03-31 15:41:04 -0700
commit6aba40a1ace9f31b3df0f98f41c70c754f3383b0 (patch)
tree5b865f0e398c5543aa7721090427e4100b75575d
parent77cd5e5e5065038ab04a8dee21012d42a81458a4 (diff)
downloadandroid_external_doclava-cm-13.0.tar.gz
android_external_doclava-cm-13.0.tar.bz2
android_external_doclava-cm-13.0.zip
This should only affect behavior when using the OpenJDK 8 version of javadoc. ConstructorDoc.name() is supposed to return the unqualified name for a constructor. It is left ambiguous as to what this means for constructors of inner classes. e.g. package foo; class Bar { static class Baz { public Baz() {} } } For OpenJDK 7, the method returns "Bar.Baz" as the name of the constructor. i.e. it is qualified with the name of the outer class, but not the package For OpenJDK 8, the method returns "Baz" as the name of the constructor. i.e. it is not qualified at all In Android this affects both what doclava is willing to accept in @link tags, but also the content of the API files like current.txt. This change retains the old behavior under both OpenJDK 7 and OpenJDK 8. If later Android wants to adopt the new semantics that can be done once OpenJDK 7 is no longer supported. Bug: 18051133 Change-Id: Ic753a8d308e5d773cca13bd44ba3463481881779
-rw-r--r--src/com/google/doclava/Converter.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/com/google/doclava/Converter.java b/src/com/google/doclava/Converter.java
index 3153b41..555fc39 100644
--- a/src/com/google/doclava/Converter.java
+++ b/src/com/google/doclava/Converter.java
@@ -439,9 +439,23 @@ public class Converter {
return result;
} else {
ConstructorDoc m = (ConstructorDoc) o;
+ // Workaround for a JavaDoc behavior change introduced in OpenJDK 8 that breaks
+ // links in documentation and the content of API files like current.txt.
+ // http://b/18051133.
+ String name = m.name();
+ ClassDoc containingClass = m.containingClass();
+ if (containingClass.containingClass() != null) {
+ // This should detect the new behavior and be bypassed otherwise.
+ if (!name.contains(".")) {
+ // Constructors of inner classes do not contain the name of the enclosing class
+ // with OpenJDK 8. This simulates the old behavior:
+ name = containingClass.name();
+ }
+ }
+ // End of workaround.
MethodInfo result =
- new MethodInfo(m.getRawCommentText(), new ArrayList<TypeInfo>(Arrays.asList(Converter.convertTypes(m.typeParameters()))), m
- .name(), m.signature(), Converter.obtainClass(m.containingClass()), Converter
+ new MethodInfo(m.getRawCommentText(), new ArrayList<TypeInfo>(Arrays.asList(Converter.convertTypes(m.typeParameters()))),
+ name, m.signature(), Converter.obtainClass(m.containingClass()), Converter
.obtainClass(m.containingClass()), m.isPublic(), m.isProtected(), m
.isPackagePrivate(), m.isPrivate(), m.isFinal(), m.isStatic(), m.isSynthetic(),
false, m.isSynchronized(), m.isNative(), false, "constructor", m.flatSignature(),