Fri, 14 Feb 2014 17:28:07 -0800
8029145: javadoc fails with java.lang.IllegalStateException: endPosTable already set
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Wed Feb 19 15:07:47 2014 +0400 1.2 +++ b/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Fri Feb 14 17:28:07 2014 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -30,6 +30,7 @@ 1.11 import java.util.Collection; 1.12 import java.util.EnumSet; 1.13 import java.util.HashMap; 1.14 +import java.util.HashSet; 1.15 import java.util.Map; 1.16 import java.util.Set; 1.17 import javax.tools.JavaFileManager.Location; 1.18 @@ -238,10 +239,13 @@ 1.19 files = lb.toList(); 1.20 } 1.21 1.22 + Set<JavaFileObject> ufiles = new HashSet<>(); 1.23 for (JavaFileObject fo : files) { 1.24 - // messager.notice("main.Loading_source_file", fn); 1.25 - trees.append(parse(fo)); 1.26 - hasFiles = true; 1.27 + if (ufiles.add(fo)) { // ignore duplicates 1.28 + // messager.notice("main.Loading_source_file", fn); 1.29 + trees.append(parse(fo)); 1.30 + hasFiles = true; 1.31 + } 1.32 } 1.33 1.34 if (!hasFiles) {
2.1 --- a/test/tools/javadoc/parser/7091528/T7091528.java Wed Feb 19 15:07:47 2014 +0400 2.2 +++ b/test/tools/javadoc/parser/7091528/T7091528.java Fri Feb 14 17:28:07 2014 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -23,8 +23,8 @@ 2.11 2.12 /** 2.13 * @test 2.14 - * @bug 7091528 2.15 - * @summary javadoc attempts to parse .class files 2.16 + * @bug 7091528 8029145 2.17 + * @summary ensures javadoc parses unique source files and ignores all class files 2.18 * @compile p/C1.java p/q/C2.java 2.19 * @run main T7091528 2.20 */ 2.21 @@ -37,17 +37,22 @@ 2.22 public static void main(String... args) { 2.23 new T7091528().run(); 2.24 } 2.25 - 2.26 void run() { 2.27 File testSrc = new File(System.getProperty("test.src")); 2.28 File testClasses = new File(System.getProperty("test.classes")); 2.29 - String[] args = { 2.30 - "-d", ".", 2.31 + // 7091528, tests if class files are being ignored 2.32 + runTest("-d", ".", 2.33 "-sourcepath", testClasses + File.pathSeparator + testSrc, 2.34 "-subpackages", 2.35 - "p" 2.36 - }; 2.37 + "p"); 2.38 + // 8029145, tests if unique source files are parsed 2.39 + runTest("-d", ".", 2.40 + "-sourcepath", testSrc.getAbsolutePath(), 2.41 + "-subpackages", 2.42 + "p:p.q"); 2.43 2.44 + } 2.45 + void runTest(String... args) { 2.46 StringWriter sw = new StringWriter(); 2.47 PrintWriter pw = new PrintWriter(sw); 2.48 String doclet = com.sun.tools.doclets.standard.Standard.class.getName();