Skip to content

Commit

Permalink
Added workaround for Java 8 javac's bug re: package doc-comments (fix…
Browse files Browse the repository at this point in the history
…ed in Java 9).

	Change on 2017/05/08 by tball <[email protected]>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155396077
  • Loading branch information
tomball committed May 8, 2017
1 parent 01cf043 commit 3b1a465
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,11 @@ private PackageDeclaration convertPackage(PackageElement pkg, Trees trees) {
newNode.addAnnotation((Annotation) convert(pkgAnnotation));
}
if (unit.sourcefile.toUri().getPath().endsWith("package-info.java")) {
if (node == null) {
// Java 8 javac bug, fixed in Java 9. Doc-comments in package-info.java
// sources are keyed to their compilation unit, not their package node.
node = unit;
}
newNode.setJavadoc((Javadoc) getAssociatedJavaDoc(node, pkg));
}
return (PackageDeclaration) newNode.setName(convertName((PackageSymbol) pkg, getPosition(node)))
Expand Down

0 comments on commit 3b1a465

Please sign in to comment.