java-1.8.0-openjdk/javadoc-error-jdk-8029145.patch
Omair Majid e9e0f6d58e Backport javadoc fixes from upstream
Fixes issue seen in RHBZ 1107273
2014-06-11 15:50:15 -04:00

94 lines
3.5 KiB
Diff

# HG changeset patch
# User ksrini
# Date 1392427687 28800
# Node ID 4c09a8dd09b37f17f186e575978e0dc5de6c84d3
# Parent 37cf13ea5cf99b04638660d6c91038f2ce210885
8029145: javadoc fails with java.lang.IllegalStateException: endPosTable already set
Reviewed-by: jjg
diff -r 37cf13ea5cf9 -r 4c09a8dd09b3 src/share/classes/com/sun/tools/javadoc/JavadocTool.java
--- jdk8/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Thu Feb 13 14:58:10 2014 +0100
+++ jdk8/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Fri Feb 14 17:28:07 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.tools.JavaFileManager.Location;
@@ -238,10 +239,13 @@
files = lb.toList();
}
+ Set<JavaFileObject> ufiles = new HashSet<>();
for (JavaFileObject fo : files) {
- // messager.notice("main.Loading_source_file", fn);
- trees.append(parse(fo));
- hasFiles = true;
+ if (ufiles.add(fo)) { // ignore duplicates
+ // messager.notice("main.Loading_source_file", fn);
+ trees.append(parse(fo));
+ hasFiles = true;
+ }
}
if (!hasFiles) {
diff -r 37cf13ea5cf9 -r 4c09a8dd09b3 test/tools/javadoc/parser/7091528/T7091528.java
--- jdk8/langtools/test/tools/javadoc/parser/7091528/T7091528.java Thu Feb 13 14:58:10 2014 +0100
+++ jdk8/langtools/test/tools/javadoc/parser/7091528/T7091528.java Fri Feb 14 17:28:07 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
/**
* @test
- * @bug 7091528
- * @summary javadoc attempts to parse .class files
+ * @bug 7091528 8029145
+ * @summary ensures javadoc parses unique source files and ignores all class files
* @compile p/C1.java p/q/C2.java
* @run main T7091528
*/
@@ -37,17 +37,22 @@
public static void main(String... args) {
new T7091528().run();
}
-
void run() {
File testSrc = new File(System.getProperty("test.src"));
File testClasses = new File(System.getProperty("test.classes"));
- String[] args = {
- "-d", ".",
+ // 7091528, tests if class files are being ignored
+ runTest("-d", ".",
"-sourcepath", testClasses + File.pathSeparator + testSrc,
"-subpackages",
- "p"
- };
+ "p");
+ // 8029145, tests if unique source files are parsed
+ runTest("-d", ".",
+ "-sourcepath", testSrc.getAbsolutePath(),
+ "-subpackages",
+ "p:p.q");
+ }
+ void runTest(String... args) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String doclet = com.sun.tools.doclets.standard.Standard.class.getName();