Backport javadoc fixes from upstream

Fixes issue seen in RHBZ 1107273
This commit is contained in:
Omair Majid 2014-06-11 15:45:41 -04:00
parent 9a96c8a8d0
commit e9e0f6d58e
3 changed files with 275 additions and 1 deletions

View File

@ -135,7 +135,7 @@
Name: java-%{javaver}-%{origin} Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever} Version: %{javaver}.%{updatever}
Release: 10.%{buildver}%{?dist} Release: 11.%{buildver}%{?dist}
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons, # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons,
# and this change was brought into RHEL-4. java-1.5.0-ibm packages # and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a # also included the epoch in their virtual provides. This created a
@ -205,6 +205,10 @@ Patch6: disable-doclint-by-default.patch
Patch7: include-all-srcs.patch Patch7: include-all-srcs.patch
# Fix window activation in gnome-shell # Fix window activation in gnome-shell
Patch8: set-active-window.patch Patch8: set-active-window.patch
# Fix javadoc. Backport from upstream.
Patch9: javadoc-error-jdk-8029145.patch
# More javadoc. Backport from upstream.
Patch10: javadoc-error-jdk-8037484.patch
# #
# OpenJDK specific patches # OpenJDK specific patches
@ -440,6 +444,8 @@ sh %{SOURCE12}
%patch6 %patch6
%patch7 %patch7
%patch8 %patch8
%patch9
%patch10
%patch99 %patch99
@ -1127,6 +1133,10 @@ exit 0
%{_jvmdir}/%{jredir}/lib/accessibility.properties %{_jvmdir}/%{jredir}/lib/accessibility.properties
%changelog %changelog
* Wed Jun 11 2014 Omair Majid <omajid@redhat.com> - 1:1.8.0.5-11.b13
- Backport javadoc fixes from upstream
- Related: rhbz#1107273
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.8.0.5-10.b13 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.8.0.5-10.b13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

View File

@ -0,0 +1,93 @@
# 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();

View File

@ -0,0 +1,171 @@
# HG changeset patch
# User ksrini
# Date 1397697348 25200
# Node ID 6acecb34d1bc345579b4ddb8c38ddbe7df27ca2c
# Parent 3d8d9f0df99909403f5edfeb33804f704d228f0f
8037484: [javadoc] fails with java.lang.IllegalStateException: endPosTable already set
Reviewed-by: jjg
diff -r 3d8d9f0df999 -r 6acecb34d1bc src/share/classes/com/sun/tools/javadoc/JavadocTool.java
--- jdk8/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Wed Apr 16 18:36:43 2014 -0700
+++ jdk8/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Wed Apr 16 18:15:48 2014 -0700
@@ -68,6 +68,7 @@
final Messager messager;
final JavadocClassReader javadocReader;
final JavadocEnter javadocEnter;
+ final Set<JavaFileObject> uniquefiles;
/**
* Construct a new JavaCompiler processor, using appropriately
@@ -78,6 +79,7 @@
messager = Messager.instance0(context);
javadocReader = JavadocClassReader.instance0(context);
javadocEnter = JavadocEnter.instance0(context);
+ uniquefiles = new HashSet<>();
}
/**
@@ -148,9 +150,7 @@
String name = it.head;
if (!docClasses && fm != null && name.endsWith(".java") && new File(name).exists()) {
JavaFileObject fo = fm.getJavaFileObjects(name).iterator().next();
- docenv.notice("main.Loading_source_file", name);
- JCCompilationUnit tree = parse(fo);
- classTrees.append(tree);
+ parse(fo, classTrees, true);
} else if (isValidPackageName(name)) {
names = names.append(name);
} else if (name.endsWith(".java")) {
@@ -163,9 +163,7 @@
}
}
for (JavaFileObject fo: fileObjects) {
- docenv.notice("main.Loading_source_file", fo.getName());
- JCCompilationUnit tree = parse(fo);
- classTrees.append(tree);
+ parse(fo, classTrees, true);
}
if (!docClasses) {
@@ -213,7 +211,7 @@
* .java files found in such a directory to args.
*/
private void parsePackageClasses(String name,
- Iterable<JavaFileObject> files,
+ List<JavaFileObject> files,
ListBuffer<JCCompilationUnit> trees,
List<String> excludedPackages)
throws IOException {
@@ -221,7 +219,6 @@
return;
}
- boolean hasFiles = false;
docenv.notice("main.Loading_source_files_for_package", name);
if (files == null) {
@@ -238,19 +235,22 @@
}
files = lb.toList();
}
+ if (files.nonEmpty()) {
+ for (JavaFileObject fo : files) {
+ parse(fo, trees, false);
+ }
+ } else {
+ messager.warning(Messager.NOPOS, "main.no_source_files_for_package",
+ name.replace(File.separatorChar, '.'));
+ }
+ }
- Set<JavaFileObject> ufiles = new HashSet<>();
- for (JavaFileObject fo : files) {
- if (ufiles.add(fo)) { // ignore duplicates
- // messager.notice("main.Loading_source_file", fn);
- trees.append(parse(fo));
- hasFiles = true;
- }
- }
-
- if (!hasFiles) {
- messager.warning(Messager.NOPOS, "main.no_source_files_for_package",
- name.replace(File.separatorChar, '.'));
+ private void parse(JavaFileObject fo, ListBuffer<JCCompilationUnit> trees,
+ boolean trace) {
+ if (uniquefiles.add(fo)) { // ignore duplicates
+ if (trace)
+ docenv.notice("main.Loading_source_file", fo.getName());
+ trees.append(parse(fo));
}
}
diff -r 3d8d9f0df999 -r 6acecb34d1bc test/tools/javadoc/parser/7091528/T7091528.java
--- jdk8/langtools/test/tools/javadoc/parser/7091528/T7091528.java Wed Apr 16 18:36:43 2014 -0700
+++ jdk8/langtools/test/tools/javadoc/parser/7091528/T7091528.java Wed Apr 16 18:15:48 2014 -0700
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 7091528 8029145
+ * @bug 7091528 8029145 8037484
* @summary ensures javadoc parses unique source files and ignores all class files
* @compile p/C1.java p/q/C2.java
* @run main T7091528
@@ -50,6 +50,16 @@
"-sourcepath", testSrc.getAbsolutePath(),
"-subpackages",
"p:p.q");
+ File testPkgDir = new File(testSrc, "p");
+ File testFile = new File(testPkgDir, "C3.java");
+ runTest("-d", ".",
+ "-sourcepath", testSrc.getAbsolutePath(),
+ testFile.getAbsolutePath(),
+ "p");
+ runTest("-d", ".",
+ "-classpath", testSrc.getAbsolutePath(),
+ testFile.getAbsolutePath(),
+ "p");
}
void runTest(String... args) {
@@ -65,7 +75,7 @@
}
if (rc != 0)
- System.err.println("javadoc failed: exit code = " + rc);
+ throw new Error("javadoc failed: exit code = " + rc);
if (out.matches("(?s).*p/[^ ]+\\.class.*"))
throw new Error("reading .class files");
diff -r 3d8d9f0df999 -r 6acecb34d1bc test/tools/javadoc/parser/7091528/p/C3.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ jdk8/langtools/test/tools/javadoc/parser/7091528/p/C3.java Wed Apr 16 18:15:48 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/** This is class C3, and no package for me please */
+public class C3 {}
+