提交 d08209f9 编写于 作者: K ksrini

8029145: javadoc fails with java.lang.IllegalStateException: endPosTable already set

Reviewed-by: jjg
上级 16d08832
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,6 +30,7 @@ import java.io.IOException; ...@@ -30,6 +30,7 @@ import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.tools.JavaFileManager.Location; import javax.tools.JavaFileManager.Location;
...@@ -238,10 +239,13 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -238,10 +239,13 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
files = lb.toList(); files = lb.toList();
} }
Set<JavaFileObject> ufiles = new HashSet<>();
for (JavaFileObject fo : files) { for (JavaFileObject fo : files) {
// messager.notice("main.Loading_source_file", fn); if (ufiles.add(fo)) { // ignore duplicates
trees.append(parse(fo)); // messager.notice("main.Loading_source_file", fn);
hasFiles = true; trees.append(parse(fo));
hasFiles = true;
}
} }
if (!hasFiles) { if (!hasFiles) {
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
/** /**
* @test * @test
* @bug 7091528 * @bug 7091528 8029145
* @summary javadoc attempts to parse .class files * @summary ensures javadoc parses unique source files and ignores all class files
* @compile p/C1.java p/q/C2.java * @compile p/C1.java p/q/C2.java
* @run main T7091528 * @run main T7091528
*/ */
...@@ -37,17 +37,22 @@ public class T7091528 { ...@@ -37,17 +37,22 @@ public class T7091528 {
public static void main(String... args) { public static void main(String... args) {
new T7091528().run(); new T7091528().run();
} }
void run() { void run() {
File testSrc = new File(System.getProperty("test.src")); File testSrc = new File(System.getProperty("test.src"));
File testClasses = new File(System.getProperty("test.classes")); File testClasses = new File(System.getProperty("test.classes"));
String[] args = { // 7091528, tests if class files are being ignored
"-d", ".", runTest("-d", ".",
"-sourcepath", testClasses + File.pathSeparator + testSrc, "-sourcepath", testClasses + File.pathSeparator + testSrc,
"-subpackages", "-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(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);
String doclet = com.sun.tools.doclets.standard.Standard.class.getName(); String doclet = com.sun.tools.doclets.standard.Standard.class.getName();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册