Thu, 29 Aug 2013 16:34:12 -0700
Merge
test/com/sun/javadoc/testNavagation/TestNavagation.java | file | annotate | diff | comparison | revisions | |
test/com/sun/javadoc/testNavagation/pkg/A.java | file | annotate | diff | comparison | revisions | |
test/com/sun/javadoc/testNavagation/pkg/C.java | file | annotate | diff | comparison | revisions | |
test/com/sun/javadoc/testNavagation/pkg/E.java | file | annotate | diff | comparison | revisions | |
test/com/sun/javadoc/testNavagation/pkg/I.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/8015701/AnonymousParameters.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/classes/com/sun/source/tree/MethodTree.java Thu Aug 29 09:42:12 2013 -0700 1.2 +++ b/src/share/classes/com/sun/source/tree/MethodTree.java Thu Aug 29 16:34:12 2013 -0700 1.3 @@ -53,7 +53,15 @@ 1.4 Tree getReturnType(); 1.5 List<? extends TypeParameterTree> getTypeParameters(); 1.6 List<? extends VariableTree> getParameters(); 1.7 + 1.8 + /** 1.9 + * Return an explicit receiver parameter ("this" parameter). 1.10 + * 1.11 + * @return an explicit receiver parameter ("this" parameter) 1.12 + * @since 1.8 1.13 + */ 1.14 VariableTree getReceiverParameter(); 1.15 + 1.16 List<? extends ExpressionTree> getThrows(); 1.17 BlockTree getBody(); 1.18 Tree getDefaultValue(); // for annotation types
2.1 --- a/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Aug 29 09:42:12 2013 -0700 2.2 +++ b/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Aug 29 16:34:12 2013 -0700 2.3 @@ -36,6 +36,8 @@ 2.4 * <em>name</em> 2.5 * 2.6 * <em>name</em> extends <em>bounds</em> 2.7 + * 2.8 + * <em>annotations</em> <em>name</em> 2.9 * </pre> 2.10 * 2.11 * @jls section 4.4 2.12 @@ -48,5 +50,17 @@ 2.13 public interface TypeParameterTree extends Tree { 2.14 Name getName(); 2.15 List<? extends Tree> getBounds(); 2.16 + 2.17 + /** 2.18 + * Return annotations on the type parameter declaration. 2.19 + * 2.20 + * Annotations need Target meta-annotations of 2.21 + * {@link java.lang.annotation.ElementType#TYPE_PARAMETER} or 2.22 + * {@link java.lang.annotation.ElementType#TYPE_USE} 2.23 + * to appear in this position. 2.24 + * 2.25 + * @return annotations on the type parameter declaration 2.26 + * @since 1.8 2.27 + */ 2.28 List<? extends AnnotationTree> getAnnotations(); 2.29 }
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Thu Aug 29 09:42:12 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Thu Aug 29 16:34:12 2013 -0700 3.3 @@ -102,7 +102,7 @@ 3.4 configuration.standardmessage. 3.5 error("doclet.exception_encountered", 3.6 exc.toString(), filename); 3.7 - throw new DocletAbortException(); 3.8 + throw new DocletAbortException(exc); 3.9 } 3.10 } 3.11
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 29 09:42:12 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 29 16:34:12 2013 -0700 4.3 @@ -304,7 +304,7 @@ 4.4 subDiv.addContent(div); 4.5 } catch (Exception e) { 4.6 e.printStackTrace(); 4.7 - throw new DocletAbortException(); 4.8 + throw new DocletAbortException(e); 4.9 } 4.10 } 4.11
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Aug 29 09:42:12 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Aug 29 16:34:12 2013 -0700 5.3 @@ -218,7 +218,7 @@ 5.4 configuration.standardmessage. 5.5 error("doclet.exception_encountered", 5.6 exc.toString(), path.getPath()); 5.7 - throw new DocletAbortException(); 5.8 + throw new DocletAbortException(exc); 5.9 } 5.10 } 5.11
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Aug 29 09:42:12 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Aug 29 16:34:12 2013 -0700 6.3 @@ -610,7 +610,7 @@ 6.4 subDiv.addContent(div); 6.5 } catch (Exception e) { 6.6 e.printStackTrace(); 6.7 - throw new DocletAbortException(); 6.8 + throw new DocletAbortException(e); 6.9 } 6.10 } 6.11
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Thu Aug 29 09:42:12 2013 -0700 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Thu Aug 29 16:34:12 2013 -0700 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -127,7 +127,7 @@ 7.11 configuration.standardmessage.error( 7.12 "doclet.exception_encountered", 7.13 exc.toString(), filename); 7.14 - throw new DocletAbortException(); 7.15 + throw new DocletAbortException(exc); 7.16 } 7.17 } 7.18
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Aug 29 09:42:12 2013 -0700 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Aug 29 16:34:12 2013 -0700 8.3 @@ -87,7 +87,7 @@ 8.4 configuration.standardmessage.error( 8.5 "doclet.exception_encountered", 8.6 exc.toString(), filename); 8.7 - throw new DocletAbortException(); 8.8 + throw new DocletAbortException(exc); 8.9 } 8.10 } 8.11
9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Aug 29 09:42:12 2013 -0700 9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Aug 29 16:34:12 2013 -0700 9.3 @@ -72,7 +72,7 @@ 9.4 configuration.standardmessage.error( 9.5 "doclet.exception_encountered", 9.6 exc.toString(), filename); 9.7 - throw new DocletAbortException(); 9.8 + throw new DocletAbortException(exc); 9.9 } 9.10 } 9.11
10.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Aug 29 09:42:12 2013 -0700 10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Aug 29 16:34:12 2013 -0700 10.3 @@ -196,7 +196,7 @@ 10.4 } 10.5 } catch (Exception e) { 10.6 e.printStackTrace(); 10.7 - throw new DocletAbortException(); 10.8 + throw new DocletAbortException(e); 10.9 } 10.10 } 10.11 } 10.12 @@ -332,7 +332,7 @@ 10.13 configuration.message.error((SourcePosition) null, 10.14 "doclet.perform_copy_exception_encountered", 10.15 exc.toString()); 10.16 - throw new DocletAbortException(); 10.17 + throw new DocletAbortException(exc); 10.18 } 10.19 } 10.20 }
11.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Aug 29 09:42:12 2013 -0700 11.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Aug 29 16:34:12 2013 -0700 11.3 @@ -411,7 +411,7 @@ 11.4 head.addContent(headComment); 11.5 } 11.6 if (configuration.charset.length() > 0) { 11.7 - Content meta = HtmlTree.META("Content-Type", "text/html", 11.8 + Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, 11.9 configuration.charset); 11.10 head.addContent(meta); 11.11 }
12.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Aug 29 09:42:12 2013 -0700 12.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Aug 29 16:34:12 2013 -0700 12.3 @@ -109,7 +109,7 @@ 12.4 configuration.standardmessage.error( 12.5 "doclet.exception_encountered", 12.6 exc.toString(), DocPaths.PACKAGE_FRAME.getPath()); 12.7 - throw new DocletAbortException(); 12.8 + throw new DocletAbortException(exc); 12.9 } 12.10 } 12.11
13.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700 13.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Thu Aug 29 16:34:12 2013 -0700 13.3 @@ -71,7 +71,7 @@ 13.4 configuration.standardmessage.error( 13.5 "doclet.exception_encountered", 13.6 exc.toString(), filename); 13.7 - throw new DocletAbortException(); 13.8 + throw new DocletAbortException(exc); 13.9 } 13.10 } 13.11
14.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Aug 29 09:42:12 2013 -0700 14.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Aug 29 16:34:12 2013 -0700 14.3 @@ -98,7 +98,7 @@ 14.4 configuration.standardmessage.error( 14.5 "doclet.exception_encountered", 14.6 exc.toString(), filename); 14.7 - throw new DocletAbortException(); 14.8 + throw new DocletAbortException(exc); 14.9 } 14.10 } 14.11
15.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Aug 29 09:42:12 2013 -0700 15.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Aug 29 16:34:12 2013 -0700 15.3 @@ -105,7 +105,7 @@ 15.4 configuration.standardmessage.error( 15.5 "doclet.exception_encountered", 15.6 exc.toString(), path.getPath()); 15.7 - throw new DocletAbortException(); 15.8 + throw new DocletAbortException(exc); 15.9 } 15.10 } 15.11
16.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Thu Aug 29 09:42:12 2013 -0700 16.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Thu Aug 29 16:34:12 2013 -0700 16.3 @@ -106,7 +106,7 @@ 16.4 configuration.standardmessage.error( 16.5 "doclet.exception_encountered", 16.6 exc.toString(), filename); 16.7 - throw new DocletAbortException(); 16.8 + throw new DocletAbortException(exc); 16.9 } 16.10 } 16.11
17.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700 17.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Aug 29 16:34:12 2013 -0700 17.3 @@ -74,7 +74,7 @@ 17.4 configuration.standardmessage.error( 17.5 "doclet.exception_encountered", 17.6 exc.toString(), filename); 17.7 - throw new DocletAbortException(); 17.8 + throw new DocletAbortException(exc); 17.9 } 17.10 } 17.11
18.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Aug 29 09:42:12 2013 -0700 18.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Aug 29 16:34:12 2013 -0700 18.3 @@ -115,7 +115,7 @@ 18.4 configuration.standardmessage.error( 18.5 "doclet.exception_encountered", 18.6 exc.toString(), DocPaths.PACKAGE_FRAME.getPath()); 18.7 - throw new DocletAbortException(); 18.8 + throw new DocletAbortException(exc); 18.9 } 18.10 } 18.11
19.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700 19.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Thu Aug 29 16:34:12 2013 -0700 19.3 @@ -75,7 +75,7 @@ 19.4 configuration.standardmessage.error( 19.5 "doclet.exception_encountered", 19.6 exc.toString(), filename); 19.7 - throw new DocletAbortException(); 19.8 + throw new DocletAbortException(exc); 19.9 } 19.10 } 19.11
20.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Thu Aug 29 09:42:12 2013 -0700 20.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Thu Aug 29 16:34:12 2013 -0700 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -79,7 +79,7 @@ 20.11 configuration.standardmessage.error( 20.12 "doclet.exception_encountered", 20.13 exc.toString(), filename); 20.14 - throw new DocletAbortException(); 20.15 + throw new DocletAbortException(exc); 20.16 } 20.17 } 20.18
21.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Thu Aug 29 09:42:12 2013 -0700 21.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Thu Aug 29 16:34:12 2013 -0700 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -102,7 +102,7 @@ 21.11 configuration.standardmessage.error( 21.12 "doclet.exception_encountered", 21.13 exc.toString(), filename.getPath()); 21.14 - throw new DocletAbortException(); 21.15 + throw new DocletAbortException(exc); 21.16 } 21.17 } 21.18
22.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Aug 29 09:42:12 2013 -0700 22.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Aug 29 16:34:12 2013 -0700 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -93,7 +93,7 @@ 22.11 configuration.standardmessage.error( 22.12 "doclet.exception_encountered", 22.13 exc.toString(), filename); 22.14 - throw new DocletAbortException(); 22.15 + throw new DocletAbortException(exc); 22.16 } 22.17 } 22.18
23.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java Thu Aug 29 09:42:12 2013 -0700 23.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java Thu Aug 29 16:34:12 2013 -0700 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 23.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -63,7 +63,7 @@ 23.11 * is not supported. 23.12 */ 23.13 public void addContent(Content content) { 23.14 - throw new DocletAbortException(); 23.15 + throw new DocletAbortException("not supported"); 23.16 } 23.17 23.18 /** 23.19 @@ -75,7 +75,7 @@ 23.20 * is not supported. 23.21 */ 23.22 public void addContent(String stringContent) { 23.23 - throw new DocletAbortException(); 23.24 + throw new DocletAbortException("not supported"); 23.25 } 23.26 23.27 /**
24.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Aug 29 09:42:12 2013 -0700 24.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Aug 29 16:34:12 2013 -0700 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -70,7 +70,7 @@ 24.11 * is not supported. 24.12 */ 24.13 public void addContent(Content content) { 24.14 - throw new DocletAbortException(); 24.15 + throw new DocletAbortException("not supported"); 24.16 } 24.17 24.18 /** 24.19 @@ -82,7 +82,7 @@ 24.20 * is not supported. 24.21 */ 24.22 public void addContent(String stringContent) { 24.23 - throw new DocletAbortException(); 24.24 + throw new DocletAbortException("not supported"); 24.25 } 24.26 24.27 /**
25.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java Thu Aug 29 09:42:12 2013 -0700 25.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java Thu Aug 29 16:34:12 2013 -0700 25.3 @@ -40,7 +40,6 @@ 25.4 BORDER, 25.5 CELLPADDING, 25.6 CELLSPACING, 25.7 - CHARSET, 25.8 CLASS, 25.9 CLEAR, 25.10 COLS,
26.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Aug 29 09:42:12 2013 -0700 26.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Aug 29 16:34:12 2013 -0700 26.3 @@ -53,6 +53,8 @@ 26.4 */ 26.5 public abstract class HtmlDocWriter extends HtmlWriter { 26.6 26.7 + public static final String CONTENT_TYPE = "text/html"; 26.8 + 26.9 /** 26.10 * Constructor. Initializes the destination file name through the super 26.11 * class HtmlWriter. 26.12 @@ -194,7 +196,7 @@ 26.13 head.addContent(headComment); 26.14 } 26.15 if (configuration.charset.length() > 0) { 26.16 - Content meta = HtmlTree.META("Content-Type", "text/html", 26.17 + Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, 26.18 configuration.charset); 26.19 head.addContent(meta); 26.20 }
27.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Thu Aug 29 09:42:12 2013 -0700 27.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Thu Aug 29 16:34:12 2013 -0700 27.3 @@ -1,5 +1,5 @@ 27.4 /* 27.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 27.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 27.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.8 * 27.9 * This code is free software; you can redistribute it and/or modify it 27.10 @@ -91,7 +91,7 @@ 27.11 * is not supported. 27.12 */ 27.13 public void addContent(String stringContent) { 27.14 - throw new DocletAbortException(); 27.15 + throw new DocletAbortException("not supported"); 27.16 } 27.17 27.18 /**
28.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Aug 29 09:42:12 2013 -0700 28.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Aug 29 16:34:12 2013 -0700 28.3 @@ -456,9 +456,9 @@ 28.4 */ 28.5 public static HtmlTree META(String httpEquiv, String content, String charSet) { 28.6 HtmlTree htmltree = new HtmlTree(HtmlTag.META); 28.7 + String contentCharset = content + "; charset=" + charSet; 28.8 htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv)); 28.9 - htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content)); 28.10 - htmltree.addAttr(HtmlAttr.CHARSET, nullCheck(charSet)); 28.11 + htmltree.addAttr(HtmlAttr.CONTENT, contentCharset); 28.12 return htmltree; 28.13 } 28.14
29.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Thu Aug 29 09:42:12 2013 -0700 29.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Thu Aug 29 16:34:12 2013 -0700 29.3 @@ -65,7 +65,7 @@ 29.4 * is not supported. 29.5 */ 29.6 public void addContent(Content content) { 29.7 - throw new DocletAbortException(); 29.8 + throw new DocletAbortException("not supported"); 29.9 } 29.10 29.11 /** 29.12 @@ -77,7 +77,7 @@ 29.13 * is not supported. 29.14 */ 29.15 public void addContent(String stringContent) { 29.16 - throw new DocletAbortException(); 29.17 + throw new DocletAbortException("not supported"); 29.18 } 29.19 29.20 /**
30.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Thu Aug 29 09:42:12 2013 -0700 30.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Thu Aug 29 16:34:12 2013 -0700 30.3 @@ -72,7 +72,7 @@ 30.4 */ 30.5 @Override 30.6 public void addContent(Content content) { 30.7 - throw new DocletAbortException(); 30.8 + throw new DocletAbortException("not supported"); 30.9 } 30.10 30.11 /**
31.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Aug 29 09:42:12 2013 -0700 31.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Aug 29 16:34:12 2013 -0700 31.3 @@ -539,7 +539,7 @@ 31.4 initProfiles(); 31.5 initProfilePackages(); 31.6 } catch (Exception e) { 31.7 - throw new DocletAbortException(); 31.8 + throw new DocletAbortException(e); 31.9 } 31.10 } 31.11 setSpecificDocletOptions(root.options());
32.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Thu Aug 29 09:42:12 2013 -0700 32.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Thu Aug 29 16:34:12 2013 -0700 32.3 @@ -55,7 +55,7 @@ 32.4 write(out, true); 32.5 } catch (IOException e) { 32.6 // cannot happen from StringWriter 32.7 - throw new DocletAbortException(); 32.8 + throw new DocletAbortException(e); 32.9 } 32.10 return out.toString(); 32.11 }
33.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Thu Aug 29 09:42:12 2013 -0700 33.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Thu Aug 29 16:34:12 2013 -0700 33.3 @@ -1,5 +1,5 @@ 33.4 /* 33.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 33.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 33.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.8 * 33.9 * This code is free software; you can redistribute it and/or modify it 33.10 @@ -138,7 +138,7 @@ 33.11 } catch (NoSuchMethodException e) { 33.12 e.printStackTrace(); 33.13 configuration.root.printError("Unknown element: " + component); 33.14 - throw new DocletAbortException(); 33.15 + throw new DocletAbortException(e); 33.16 } catch (InvocationTargetException e) { 33.17 e.getCause().printStackTrace(); 33.18 } catch (Exception e) { 33.19 @@ -146,7 +146,7 @@ 33.20 configuration.root.printError("Exception " + 33.21 e.getClass().getName() + 33.22 " thrown while processing element: " + component); 33.23 - throw new DocletAbortException(); 33.24 + throw new DocletAbortException(e); 33.25 } 33.26 } 33.27
34.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java Thu Aug 29 09:42:12 2013 -0700 34.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java Thu Aug 29 16:34:12 2013 -0700 34.3 @@ -1,5 +1,5 @@ 34.4 /* 34.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 34.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 34.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.8 * 34.9 * This code is free software; you can redistribute it and/or modify it 34.10 @@ -62,7 +62,7 @@ 34.11 */ 34.12 public void build() throws DocletAbortException { 34.13 //You may not call the build method in a subbuilder. 34.14 - throw new DocletAbortException(); 34.15 + throw new DocletAbortException("not supported"); 34.16 } 34.17 34.18
35.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Thu Aug 29 09:42:12 2013 -0700 35.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Thu Aug 29 16:34:12 2013 -0700 35.3 @@ -1,5 +1,5 @@ 35.4 /* 35.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 35.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 35.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.8 * 35.9 * This code is free software; you can redistribute it and/or modify it 35.10 @@ -93,7 +93,7 @@ 35.11 return xmlElementsMap.get(root); 35.12 } catch (Throwable t) { 35.13 t.printStackTrace(); 35.14 - throw new DocletAbortException(); 35.15 + throw new DocletAbortException(t); 35.16 } 35.17 } 35.18
36.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Thu Aug 29 09:42:12 2013 -0700 36.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Thu Aug 29 16:34:12 2013 -0700 36.3 @@ -1,5 +1,5 @@ 36.4 /* 36.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 36.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 36.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.8 * 36.9 * This code is free software; you can redistribute it and/or modify it 36.10 @@ -125,7 +125,7 @@ 36.11 return; 36.12 } 36.13 } catch (Exception e) { 36.14 - throw new DocletAbortException(); 36.15 + throw new DocletAbortException(e); 36.16 } 36.17 build(layoutParser.parseXML(NAME), contentTree); 36.18 writer.close();
37.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java Thu Aug 29 09:42:12 2013 -0700 37.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java Thu Aug 29 16:34:12 2013 -0700 37.3 @@ -126,7 +126,7 @@ 37.4 return (FieldDoc) tag.holder(); 37.5 } else { 37.6 //This should never ever happen. 37.7 - throw new DocletAbortException(); 37.8 + throw new DocletAbortException("should not happen"); 37.9 } 37.10 } 37.11 StringTokenizer st = new StringTokenizer(name, "#");
38.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Thu Aug 29 09:42:12 2013 -0700 38.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Thu Aug 29 16:34:12 2013 -0700 38.3 @@ -1,5 +1,5 @@ 38.4 /* 38.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 38.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 38.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.8 * 38.9 * This code is free software; you can redistribute it and/or modify it 38.10 @@ -452,7 +452,7 @@ 38.11 } else if (doc instanceof Parameter) { 38.12 annotations = ((Parameter) doc).annotations(); 38.13 } else { 38.14 - throw new DocletAbortException(); 38.15 + throw new DocletAbortException("should not happen"); 38.16 } 38.17 for (int i = 0; i < annotations.length; i++) { 38.18 AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
39.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java Thu Aug 29 09:42:12 2013 -0700 39.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java Thu Aug 29 16:34:12 2013 -0700 39.3 @@ -1,5 +1,5 @@ 39.4 /* 39.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 39.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 39.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.8 * 39.9 * This code is free software; you can redistribute it and/or modify it 39.10 @@ -197,7 +197,7 @@ 39.11 } 39.12 } catch (IOException e) { 39.13 e.printStackTrace(System.err); 39.14 - throw new DocletAbortException(); 39.15 + throw new DocletAbortException(e); 39.16 } 39.17 } 39.18
40.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Thu Aug 29 09:42:12 2013 -0700 40.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Thu Aug 29 16:34:12 2013 -0700 40.3 @@ -1,5 +1,5 @@ 40.4 /* 40.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 40.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 40.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.8 * 40.9 * This code is free software; you can redistribute it and/or modify it 40.10 @@ -34,6 +34,11 @@ 40.11 public class DocletAbortException extends RuntimeException { 40.12 private static final long serialVersionUID = -9131058909576418984L; 40.13 40.14 - public DocletAbortException() { 40.15 + public DocletAbortException(String message) { 40.16 + super(message); 40.17 + } 40.18 + 40.19 + public DocletAbortException(Throwable cause) { 40.20 + super(cause); 40.21 } 40.22 }
41.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Thu Aug 29 09:42:12 2013 -0700 41.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Thu Aug 29 16:34:12 2013 -0700 41.3 @@ -1,5 +1,5 @@ 41.4 /* 41.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 41.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 41.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.8 * 41.9 * This code is free software; you can redistribute it and/or modify it 41.10 @@ -71,7 +71,7 @@ 41.11 } catch (IOException exc) { 41.12 configuration.message.error("doclet.exception_encountered", 41.13 exc.toString(), DocPaths.PACKAGE_LIST); 41.14 - throw new DocletAbortException(); 41.15 + throw new DocletAbortException(exc); 41.16 } 41.17 } 41.18
42.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700 42.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Thu Aug 29 16:34:12 2013 -0700 42.3 @@ -1,5 +1,5 @@ 42.4 /* 42.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 42.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 42.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.8 * 42.9 * This code is free software; you can redistribute it and/or modify it 42.10 @@ -77,7 +77,7 @@ 42.11 Path dir = fileManager.getDefaultFileSystem().getPath(dirName); 42.12 fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir)); 42.13 } catch (IOException e) { 42.14 - throw new DocletAbortException(); 42.15 + throw new DocletAbortException(e); 42.16 } 42.17 } 42.18
43.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700 43.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Thu Aug 29 16:34:12 2013 -0700 43.3 @@ -1,5 +1,5 @@ 43.4 /* 43.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 43.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 43.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.8 * 43.9 * This code is free software; you can redistribute it and/or modify it 43.10 @@ -269,7 +269,7 @@ 43.11 43.12 configuration.message.error( 43.13 "doclet.Unable_to_create_directory_0", dir.getPath()); 43.14 - throw new DocletAbortException(); 43.15 + throw new DocletAbortException("can't create directory"); 43.16 } 43.17 43.18 /** Return a string to identify the contents of this object,
44.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700 44.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Aug 29 16:34:12 2013 -0700 44.3 @@ -1,5 +1,5 @@ 44.4 /* 44.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 44.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 44.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.8 * 44.9 * This code is free software; you can redistribute it and/or modify it 44.10 @@ -79,7 +79,7 @@ 44.11 File dir = new File(dirName); 44.12 fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir)); 44.13 } catch (IOException e) { 44.14 - throw new DocletAbortException(); 44.15 + throw new DocletAbortException(e); 44.16 } 44.17 } 44.18
45.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Thu Aug 29 09:42:12 2013 -0700 45.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Thu Aug 29 16:34:12 2013 -0700 45.3 @@ -241,9 +241,9 @@ 45.4 first = false; 45.5 } 45.6 } catch (SecurityException exc) { 45.7 - throw new DocletAbortException(); 45.8 + throw new DocletAbortException(exc); 45.9 } catch (IOException exc) { 45.10 - throw new DocletAbortException(); 45.11 + throw new DocletAbortException(exc); 45.12 } 45.13 } 45.14
46.1 --- a/src/share/classes/com/sun/tools/doclint/HtmlTag.java Thu Aug 29 09:42:12 2013 -0700 46.2 +++ b/src/share/classes/com/sun/tools/doclint/HtmlTag.java Thu Aug 29 16:34:12 2013 -0700 46.3 @@ -42,12 +42,14 @@ 46.4 * 46.5 * The intent of this class is to embody the semantics of W3C HTML 4.01 46.6 * to the extent supported/used by javadoc. 46.7 + * In time, we may wish to transition javadoc and doclint to using HTML 5. 46.8 * 46.9 * This is derivative of com.sun.tools.doclets.formats.html.markup.HtmlTag. 46.10 * Eventually, these two should be merged back together, and possibly made 46.11 * public. 46.12 * 46.13 * @see <a href="http://www.w3.org/TR/REC-html40/">HTML 4.01 Specification</a> 46.14 + * @see <a href="http://www.w3.org/TR/html5/">HTML 5 Specification</a> 46.15 * @author Bhavesh Patel 46.16 * @author Jonathan Gibbons (revised) 46.17 */ 46.18 @@ -119,7 +121,8 @@ 46.19 46.20 HEAD(BlockType.OTHER, EndKind.REQUIRED), 46.21 46.22 - HR(BlockType.BLOCK, EndKind.NONE), 46.23 + HR(BlockType.BLOCK, EndKind.NONE, 46.24 + attrs(AttrKind.OK, WIDTH)), // OK in 4.01; not allowed in 5 46.25 46.26 HTML(BlockType.OTHER, EndKind.REQUIRED), 46.27 46.28 @@ -152,7 +155,7 @@ 46.29 46.30 OL(BlockType.BLOCK, EndKind.REQUIRED, 46.31 EnumSet.of(Flag.EXPECT_CONTENT), 46.32 - attrs(AttrKind.USE_CSS, START, TYPE)){ 46.33 + attrs(AttrKind.OK, START, TYPE)) { 46.34 @Override 46.35 public boolean accepts(HtmlTag t) { 46.36 return (t == LI); 46.37 @@ -196,8 +199,8 @@ 46.38 TABLE(BlockType.BLOCK, EndKind.REQUIRED, 46.39 EnumSet.of(Flag.EXPECT_CONTENT), 46.40 attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER, 46.41 - CELLPADDING, CELLSPACING), 46.42 - attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)) { 46.43 + CELLPADDING, CELLSPACING, WIDTH), // width OK in 4.01; not allowed in 5 46.44 + attrs(AttrKind.USE_CSS, ALIGN, BGCOLOR)) { 46.45 @Override 46.46 public boolean accepts(HtmlTag t) { 46.47 switch (t) { 46.48 @@ -267,7 +270,7 @@ 46.49 46.50 UL(BlockType.BLOCK, EndKind.REQUIRED, 46.51 EnumSet.of(Flag.EXPECT_CONTENT), 46.52 - attrs(AttrKind.USE_CSS, COMPACT, TYPE)){ 46.53 + attrs(AttrKind.OK, COMPACT, TYPE)) { // OK in 4.01; not allowed in 5 46.54 @Override 46.55 public boolean accepts(HtmlTag t) { 46.56 return (t == LI);
47.1 --- a/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Aug 29 09:42:12 2013 -0700 47.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Aug 29 16:34:12 2013 -0700 47.3 @@ -27,8 +27,6 @@ 47.4 47.5 import java.util.Locale; 47.6 47.7 -import javax.lang.model.type.TypeKind; 47.8 - 47.9 import com.sun.tools.javac.api.Messages; 47.10 import com.sun.tools.javac.code.Type.AnnotatedType; 47.11 import com.sun.tools.javac.code.Type.ArrayType; 47.12 @@ -191,7 +189,7 @@ 47.13 47.14 void printBaseElementType(Type t, StringBuilder sb, Locale locale) { 47.15 Type arrel = t; 47.16 - while (arrel.getKind() == TypeKind.ARRAY) { 47.17 + while (arrel.hasTag(TypeTag.ARRAY)) { 47.18 arrel = arrel.unannotatedType(); 47.19 arrel = ((ArrayType) arrel).elemtype; 47.20 } 47.21 @@ -200,7 +198,7 @@ 47.22 47.23 void printBrackets(Type t, StringBuilder sb, Locale locale) { 47.24 Type arrel = t; 47.25 - while (arrel.getKind() == TypeKind.ARRAY) { 47.26 + while (arrel.hasTag(TypeTag.ARRAY)) { 47.27 if (arrel.isAnnotated()) { 47.28 sb.append(' '); 47.29 sb.append(arrel.getAnnotationMirrors()); 47.30 @@ -264,12 +262,12 @@ 47.31 public String visitAnnotatedType(AnnotatedType t, Locale locale) { 47.32 if (t.typeAnnotations != null && 47.33 t.typeAnnotations.nonEmpty()) { 47.34 - if (t.underlyingType.getKind() == TypeKind.ARRAY) { 47.35 + if (t.underlyingType.hasTag(TypeTag.ARRAY)) { 47.36 StringBuilder res = new StringBuilder(); 47.37 printBaseElementType(t, res, locale); 47.38 printBrackets(t, res, locale); 47.39 return res.toString(); 47.40 - } else if (t.underlyingType.getKind() == TypeKind.DECLARED && 47.41 + } else if (t.underlyingType.hasTag(TypeTag.CLASS) && 47.42 t.underlyingType.getEnclosingType() != Type.noType) { 47.43 return visit(t.underlyingType.getEnclosingType(), locale) + 47.44 ". " + 47.45 @@ -348,7 +346,7 @@ 47.46 args = args.tail; 47.47 buf.append(','); 47.48 } 47.49 - if (args.head.unannotatedType().getKind() == TypeKind.ARRAY) { 47.50 + if (args.head.unannotatedType().hasTag(TypeTag.ARRAY)) { 47.51 buf.append(visit(((ArrayType) args.head.unannotatedType()).elemtype, locale)); 47.52 if (args.head.getAnnotationMirrors().nonEmpty()) { 47.53 buf.append(' ');
48.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Aug 29 09:42:12 2013 -0700 48.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Aug 29 16:34:12 2013 -0700 48.3 @@ -1179,7 +1179,7 @@ 48.4 /** 48.5 * The variable's constant value, if this is a constant. 48.6 * Before the constant value is evaluated, it points to an 48.7 - * initalizer environment. If this is not a constant, it can 48.8 + * initializer environment. If this is not a constant, it can 48.9 * be used for other stuff. 48.10 */ 48.11 private Object data; 48.12 @@ -1231,6 +1231,9 @@ 48.13 /** The extra (synthetic/mandated) parameters of the method. */ 48.14 public List<VarSymbol> extraParams = List.nil(); 48.15 48.16 + /** The captured local variables in an anonymous class */ 48.17 + public List<VarSymbol> capturedLocals = List.nil(); 48.18 + 48.19 /** The parameters of the method. */ 48.20 public List<VarSymbol> params = null; 48.21
49.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Aug 29 09:42:12 2013 -0700 49.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Aug 29 16:34:12 2013 -0700 49.3 @@ -29,6 +29,8 @@ 49.4 import javax.lang.model.element.ElementKind; 49.5 import javax.lang.model.type.TypeKind; 49.6 49.7 +import javax.tools.JavaFileObject; 49.8 + 49.9 import com.sun.tools.javac.code.Attribute; 49.10 import com.sun.tools.javac.code.Attribute.TypeCompound; 49.11 import com.sun.tools.javac.code.Flags; 49.12 @@ -52,12 +54,16 @@ 49.13 import com.sun.tools.javac.code.Symbol.MethodSymbol; 49.14 import com.sun.tools.javac.comp.Annotate; 49.15 import com.sun.tools.javac.comp.Annotate.Annotator; 49.16 +import com.sun.tools.javac.comp.AttrContext; 49.17 +import com.sun.tools.javac.comp.Env; 49.18 import com.sun.tools.javac.tree.JCTree; 49.19 +import com.sun.tools.javac.tree.TreeInfo; 49.20 import com.sun.tools.javac.tree.JCTree.JCBlock; 49.21 import com.sun.tools.javac.tree.JCTree.JCClassDecl; 49.22 import com.sun.tools.javac.tree.JCTree.JCExpression; 49.23 import com.sun.tools.javac.tree.JCTree.JCLambda; 49.24 import com.sun.tools.javac.tree.JCTree.JCMethodDecl; 49.25 +import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; 49.26 import com.sun.tools.javac.tree.JCTree.JCNewClass; 49.27 import com.sun.tools.javac.tree.JCTree.JCTypeApply; 49.28 import com.sun.tools.javac.tree.JCTree.JCVariableDecl; 49.29 @@ -90,11 +96,17 @@ 49.30 * later processing. 49.31 */ 49.32 public static void organizeTypeAnnotationsSignatures(final Symtab syms, final Names names, 49.33 - final Log log, final JCClassDecl tree, Annotate annotate) { 49.34 + final Log log, final Env<AttrContext> env, final JCClassDecl tree, final Annotate annotate) { 49.35 annotate.afterRepeated( new Annotator() { 49.36 @Override 49.37 public void enterAnnotation() { 49.38 - new TypeAnnotationPositions(syms, names, log, true).scan(tree); 49.39 + JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); 49.40 + 49.41 + try { 49.42 + new TypeAnnotationPositions(syms, names, log, true).scan(tree); 49.43 + } finally { 49.44 + log.useSource(oldSource); 49.45 + } 49.46 } 49.47 } ); 49.48 } 49.49 @@ -906,7 +918,14 @@ 49.50 if (!invocation.typeargs.contains(tree)) { 49.51 Assert.error("{" + tree + "} is not an argument in the invocation: " + invocation); 49.52 } 49.53 - p.type = TargetType.METHOD_INVOCATION_TYPE_ARGUMENT; 49.54 + MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect()); 49.55 + if (exsym == null) { 49.56 + Assert.error("could not determine symbol for {" + invocation + "}"); 49.57 + } else if (exsym.isConstructor()) { 49.58 + p.type = TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT; 49.59 + } else { 49.60 + p.type = TargetType.METHOD_INVOCATION_TYPE_ARGUMENT; 49.61 + } 49.62 p.pos = invocation.pos; 49.63 p.type_index = invocation.typeargs.indexOf(tree); 49.64 return;
50.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu Aug 29 09:42:12 2013 -0700 50.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Thu Aug 29 16:34:12 2013 -0700 50.3 @@ -505,12 +505,27 @@ 50.4 50.5 //merge thrown types - form the intersection of all the thrown types in 50.6 //all the signatures in the list 50.7 + boolean toErase = !bestSoFar.type.hasTag(FORALL); 50.8 List<Type> thrown = null; 50.9 - for (Symbol msym1 : methodSyms) { 50.10 - Type mt1 = memberType(origin.type, msym1); 50.11 + Type mt1 = memberType(origin.type, bestSoFar); 50.12 + for (Symbol msym2 : methodSyms) { 50.13 + Type mt2 = memberType(origin.type, msym2); 50.14 + List<Type> thrown_mt2 = mt2.getThrownTypes(); 50.15 + if (toErase) { 50.16 + thrown_mt2 = erasure(thrown_mt2); 50.17 + } else { 50.18 + /* If bestSoFar is generic then all the methods are generic. 50.19 + * The opposite is not true: a non generic method can override 50.20 + * a generic method (raw override) so it's safe to cast mt1 and 50.21 + * mt2 to ForAll. 50.22 + */ 50.23 + ForAll fa1 = (ForAll)mt1; 50.24 + ForAll fa2 = (ForAll)mt2; 50.25 + thrown_mt2 = subst(thrown_mt2, fa2.tvars, fa1.tvars); 50.26 + } 50.27 thrown = (thrown == null) ? 50.28 - mt1.getThrownTypes() : 50.29 - chk.intersect(mt1.getThrownTypes(), thrown); 50.30 + thrown_mt2 : 50.31 + chk.intersect(thrown_mt2, thrown); 50.32 } 50.33 50.34 final List<Type> thrown1 = thrown;
51.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 29 09:42:12 2013 -0700 51.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 29 16:34:12 2013 -0700 51.3 @@ -1063,9 +1063,7 @@ 51.4 51.5 if (tree.init != null) { 51.6 if ((v.flags_field & FINAL) != 0 && 51.7 - !tree.init.hasTag(NEWCLASS) && 51.8 - !tree.init.hasTag(LAMBDA) && 51.9 - !tree.init.hasTag(REFERENCE)) { 51.10 + memberEnter.needsLazyConstValue(tree.init)) { 51.11 // In this case, `v' is final. Ensure that it's initializer is 51.12 // evaluated. 51.13 v.getConstValue(); // ensure initializer is evaluated
52.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Aug 29 09:42:12 2013 -0700 52.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Aug 29 16:34:12 2013 -0700 52.3 @@ -2216,11 +2216,11 @@ 52.4 if (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0) 52.5 return; 52.6 if (seen.contains(t)) { 52.7 - tv = (TypeVar)t; 52.8 + tv = (TypeVar)t.unannotatedType(); 52.9 tv.bound = types.createErrorType(t); 52.10 log.error(pos, "cyclic.inheritance", t); 52.11 } else if (t.hasTag(TYPEVAR)) { 52.12 - tv = (TypeVar)t; 52.13 + tv = (TypeVar)t.unannotatedType(); 52.14 seen = seen.prepend(tv); 52.15 for (Type b : types.getBounds(tv)) 52.16 checkNonCyclic1(pos, b, seen);
53.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Aug 29 09:42:12 2013 -0700 53.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Aug 29 16:34:12 2013 -0700 53.3 @@ -249,7 +249,7 @@ 53.4 MethodType lambdaType = (MethodType) sym.type; 53.5 53.6 { 53.7 - MethodSymbol owner = (MethodSymbol) localContext.owner; 53.8 + Symbol owner = localContext.owner; 53.9 ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<Attribute.TypeCompound>(); 53.10 ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<Attribute.TypeCompound>(); 53.11
54.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Aug 29 09:42:12 2013 -0700 54.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Aug 29 16:34:12 2013 -0700 54.3 @@ -2735,9 +2735,9 @@ 54.4 for (List<VarSymbol> l = fvs; l.nonEmpty(); l = l.tail) { 54.5 if (TreeInfo.isInitialConstructor(tree)) { 54.6 final Name pName = proxyName(l.head.name); 54.7 - m.extraParams = 54.8 - m.extraParams.append((VarSymbol) 54.9 - (proxies.lookup(pName).sym)); 54.10 + m.capturedLocals = 54.11 + m.capturedLocals.append((VarSymbol) 54.12 + (proxies.lookup(pName).sym)); 54.13 added = added.prepend( 54.14 initField(tree.body.pos, pName)); 54.15 }
55.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Aug 29 09:42:12 2013 -0700 55.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Aug 29 16:34:12 2013 -0700 55.3 @@ -677,8 +677,7 @@ 55.4 if (tree.init != null) { 55.5 v.flags_field |= HASINIT; 55.6 if ((v.flags_field & FINAL) != 0 && 55.7 - !tree.init.hasTag(NEWCLASS) && 55.8 - !tree.init.hasTag(LAMBDA)) { 55.9 + needsLazyConstValue(tree.init)) { 55.10 Env<AttrContext> initEnv = getInitEnv(tree, env); 55.11 initEnv.info.enclVar = v; 55.12 v.setLazyConstValue(initEnv(tree, initEnv), attr, tree.init); 55.13 @@ -700,6 +699,59 @@ 55.14 } 55.15 } 55.16 55.17 + public boolean needsLazyConstValue(JCTree tree) { 55.18 + InitTreeVisitor initTreeVisitor = new InitTreeVisitor(); 55.19 + tree.accept(initTreeVisitor); 55.20 + return initTreeVisitor.result; 55.21 + } 55.22 + 55.23 + /** Visitor class for expressions which might be constant expressions. 55.24 + */ 55.25 + static class InitTreeVisitor extends JCTree.Visitor { 55.26 + 55.27 + private boolean result = true; 55.28 + 55.29 + @Override 55.30 + public void visitTree(JCTree tree) {} 55.31 + 55.32 + @Override 55.33 + public void visitNewClass(JCNewClass that) { 55.34 + result = false; 55.35 + } 55.36 + 55.37 + @Override 55.38 + public void visitLambda(JCLambda that) { 55.39 + result = false; 55.40 + } 55.41 + 55.42 + @Override 55.43 + public void visitReference(JCMemberReference that) { 55.44 + result = false; 55.45 + } 55.46 + 55.47 + @Override 55.48 + public void visitSelect(JCFieldAccess tree) { 55.49 + tree.selected.accept(this); 55.50 + } 55.51 + 55.52 + @Override 55.53 + public void visitConditional(JCConditional tree) { 55.54 + tree.cond.accept(this); 55.55 + tree.truepart.accept(this); 55.56 + tree.falsepart.accept(this); 55.57 + } 55.58 + 55.59 + @Override 55.60 + public void visitParens(JCParens tree) { 55.61 + tree.expr.accept(this); 55.62 + } 55.63 + 55.64 + @Override 55.65 + public void visitTypeCast(JCTypeCast tree) { 55.66 + tree.expr.accept(this); 55.67 + } 55.68 + } 55.69 + 55.70 /** Create a fresh environment for a variable's initializer. 55.71 * If the variable is a field, the owner of the environment's scope 55.72 * is be the variable itself, otherwise the owner is the method 55.73 @@ -1089,7 +1141,7 @@ 55.74 } 55.75 } 55.76 if (allowTypeAnnos) { 55.77 - TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate); 55.78 + TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, env, tree, annotate); 55.79 } 55.80 } 55.81
56.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Aug 29 09:42:12 2013 -0700 56.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Aug 29 16:34:12 2013 -0700 56.3 @@ -1859,7 +1859,10 @@ 56.4 } 56.5 } 56.6 56.7 - /** Find qualified member type. 56.8 + 56.9 + /** 56.10 + * Find a type declared in a scope (not inherited). Return null 56.11 + * if none is found. 56.12 * @param env The current environment. 56.13 * @param site The original type from where the selection takes 56.14 * place. 56.15 @@ -1868,12 +1871,10 @@ 56.16 * always a superclass or implemented interface of 56.17 * site's class. 56.18 */ 56.19 - Symbol findMemberType(Env<AttrContext> env, 56.20 - Type site, 56.21 - Name name, 56.22 - TypeSymbol c) { 56.23 - Symbol bestSoFar = typeNotFound; 56.24 - Symbol sym; 56.25 + Symbol findImmediateMemberType(Env<AttrContext> env, 56.26 + Type site, 56.27 + Name name, 56.28 + TypeSymbol c) { 56.29 Scope.Entry e = c.members().lookup(name); 56.30 while (e.scope != null) { 56.31 if (e.sym.kind == TYP) { 56.32 @@ -1883,6 +1884,24 @@ 56.33 } 56.34 e = e.next(); 56.35 } 56.36 + return typeNotFound; 56.37 + } 56.38 + 56.39 + /** Find a member type inherited from a superclass or interface. 56.40 + * @param env The current environment. 56.41 + * @param site The original type from where the selection takes 56.42 + * place. 56.43 + * @param name The type's name. 56.44 + * @param c The class to search for the member type. This is 56.45 + * always a superclass or implemented interface of 56.46 + * site's class. 56.47 + */ 56.48 + Symbol findInheritedMemberType(Env<AttrContext> env, 56.49 + Type site, 56.50 + Name name, 56.51 + TypeSymbol c) { 56.52 + Symbol bestSoFar = typeNotFound; 56.53 + Symbol sym; 56.54 Type st = types.supertype(c.type); 56.55 if (st != null && st.hasTag(CLASS)) { 56.56 sym = findMemberType(env, site, name, st.tsym); 56.57 @@ -1901,6 +1920,28 @@ 56.58 return bestSoFar; 56.59 } 56.60 56.61 + /** Find qualified member type. 56.62 + * @param env The current environment. 56.63 + * @param site The original type from where the selection takes 56.64 + * place. 56.65 + * @param name The type's name. 56.66 + * @param c The class to search for the member type. This is 56.67 + * always a superclass or implemented interface of 56.68 + * site's class. 56.69 + */ 56.70 + Symbol findMemberType(Env<AttrContext> env, 56.71 + Type site, 56.72 + Name name, 56.73 + TypeSymbol c) { 56.74 + Symbol sym = findImmediateMemberType(env, site, name, c); 56.75 + 56.76 + if (sym != typeNotFound) 56.77 + return sym; 56.78 + 56.79 + return findInheritedMemberType(env, site, name, c); 56.80 + 56.81 + } 56.82 + 56.83 /** Find a global type in given scope and load corresponding class. 56.84 * @param env The current environment. 56.85 * @param scope The scope in which to look for the type. 56.86 @@ -1919,6 +1960,21 @@ 56.87 return bestSoFar; 56.88 } 56.89 56.90 + Symbol findTypeVar(Env<AttrContext> env, Name name, boolean staticOnly) { 56.91 + for (Scope.Entry e = env.info.scope.lookup(name); 56.92 + e.scope != null; 56.93 + e = e.next()) { 56.94 + if (e.sym.kind == TYP) { 56.95 + if (staticOnly && 56.96 + e.sym.type.hasTag(TYPEVAR) && 56.97 + e.sym.owner.kind == TYP) 56.98 + return new StaticError(e.sym); 56.99 + return e.sym; 56.100 + } 56.101 + } 56.102 + return typeNotFound; 56.103 + } 56.104 + 56.105 /** Find an unqualified type symbol. 56.106 * @param env The current environment. 56.107 * @param name The type's name. 56.108 @@ -1929,19 +1985,26 @@ 56.109 boolean staticOnly = false; 56.110 for (Env<AttrContext> env1 = env; env1.outer != null; env1 = env1.outer) { 56.111 if (isStatic(env1)) staticOnly = true; 56.112 - for (Scope.Entry e = env1.info.scope.lookup(name); 56.113 - e.scope != null; 56.114 - e = e.next()) { 56.115 - if (e.sym.kind == TYP) { 56.116 - if (staticOnly && 56.117 - e.sym.type.hasTag(TYPEVAR) && 56.118 - e.sym.owner.kind == TYP) return new StaticError(e.sym); 56.119 - return e.sym; 56.120 - } 56.121 + // First, look for a type variable and the first member type 56.122 + final Symbol tyvar = findTypeVar(env1, name, staticOnly); 56.123 + sym = findImmediateMemberType(env1, env1.enclClass.sym.type, 56.124 + name, env1.enclClass.sym); 56.125 + 56.126 + // Return the type variable if we have it, and have no 56.127 + // immediate member, OR the type variable is for a method. 56.128 + if (tyvar != typeNotFound) { 56.129 + if (sym == typeNotFound || 56.130 + (tyvar.kind == TYP && tyvar.exists() && 56.131 + tyvar.owner.kind == MTH)) 56.132 + return tyvar; 56.133 } 56.134 56.135 - sym = findMemberType(env1, env1.enclClass.sym.type, name, 56.136 - env1.enclClass.sym); 56.137 + // If the environment is a class def, finish up, 56.138 + // otherwise, do the entire findMemberType 56.139 + if (sym == typeNotFound) 56.140 + sym = findInheritedMemberType(env1, env1.enclClass.sym.type, 56.141 + name, env1.enclClass.sym); 56.142 + 56.143 if (staticOnly && sym.kind == TYP && 56.144 sym.type.hasTag(CLASS) && 56.145 sym.type.getEnclosingType().hasTag(CLASS) &&
57.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Aug 29 09:42:12 2013 -0700 57.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Aug 29 16:34:12 2013 -0700 57.3 @@ -657,6 +657,14 @@ 57.4 databuf.appendChar(pool.put(s.name)); 57.5 databuf.appendChar(flags); 57.6 } 57.7 + // Now write the captured locals 57.8 + for (VarSymbol s : m.capturedLocals) { 57.9 + final int flags = 57.10 + ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) | 57.11 + ((int) m.flags() & SYNTHETIC); 57.12 + databuf.appendChar(pool.put(s.name)); 57.13 + databuf.appendChar(flags); 57.14 + } 57.15 endAttr(attrIndex); 57.16 return 1; 57.17 } else
58.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Aug 29 09:42:12 2013 -0700 58.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Aug 29 16:34:12 2013 -0700 58.3 @@ -446,7 +446,7 @@ 58.4 } 58.5 58.6 if (target.compareTo(Target.JDK1_5) <= 0) { 58.7 - log.warning(LintCategory.OPTIONS, "option.obsolete.target", source.name); 58.8 + log.warning(LintCategory.OPTIONS, "option.obsolete.target", target.name); 58.9 obsoleteOptionFound = true; 58.10 } 58.11
59.1 --- a/src/share/classes/com/sun/tools/javac/main/Option.java Thu Aug 29 09:42:12 2013 -0700 59.2 +++ b/src/share/classes/com/sun/tools/javac/main/Option.java Thu Aug 29 16:34:12 2013 -0700 59.3 @@ -389,6 +389,7 @@ 59.4 59.5 XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"), 59.6 59.7 + // see enum PkgInfo 59.8 XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"), 59.9 59.10 /* -O is a no-op, accepted for backward compatibility. */ 59.11 @@ -686,7 +687,28 @@ 59.12 59.13 // For -XpkgInfo:value 59.14 public enum PkgInfo { 59.15 - ALWAYS, LEGACY, NONEMPTY; 59.16 + /** 59.17 + * Always generate package-info.class for every package-info.java file. 59.18 + * The file may be empty if there annotations with a RetentionPolicy 59.19 + * of CLASS or RUNTIME. This option may be useful in conjunction with 59.20 + * build systems (such as Ant) that expect javac to generate at least 59.21 + * one .class file for every .java file. 59.22 + */ 59.23 + ALWAYS, 59.24 + /** 59.25 + * Generate a package-info.class file if package-info.java contains 59.26 + * annotations. The file may be empty if all the annotations have 59.27 + * a RetentionPolicy of SOURCE. 59.28 + * This value is just for backwards compatibility with earlier behavior. 59.29 + * Either of the other two values are to be preferred to using this one. 59.30 + */ 59.31 + LEGACY, 59.32 + /** 59.33 + * Generate a package-info.class file if and only if there are annotations 59.34 + * in package-info.java to be written into it. 59.35 + */ 59.36 + NONEMPTY; 59.37 + 59.38 public static PkgInfo get(Options options) { 59.39 String v = options.get(XPKGINFO); 59.40 return (v == null
60.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Aug 29 09:42:12 2013 -0700 60.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Aug 29 16:34:12 2013 -0700 60.3 @@ -89,7 +89,7 @@ 60.4 * deletion without notice.</b> 60.5 */ 60.6 public class JavacProcessingEnvironment implements ProcessingEnvironment, Closeable { 60.7 - Options options; 60.8 + private final Options options; 60.9 60.10 private final boolean printProcessorInfo; 60.11 private final boolean printRounds;
61.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Aug 29 09:42:12 2013 -0700 61.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Aug 29 16:34:12 2013 -0700 61.3 @@ -2248,7 +2248,7 @@ 61.4 # TODO 308: make a better error message 61.5 # 0: unused 61.6 compiler.err.cant.annotate.nested.type=\ 61.7 - nested type cannot be annotated 61.8 + scoping construct for static nested type cannot be annotated 61.9 61.10 # 0: type, 1: type 61.11 compiler.err.incorrect.receiver.name=\
62.1 --- a/src/share/classes/com/sun/tools/javac/sym/Profiles.java Thu Aug 29 09:42:12 2013 -0700 62.2 +++ b/src/share/classes/com/sun/tools/javac/sym/Profiles.java Thu Aug 29 16:34:12 2013 -0700 62.3 @@ -148,7 +148,7 @@ 62.4 } 62.5 } 62.6 62.7 - final static Map<String, Package> packages = new TreeMap<String, Package>(); 62.8 + final Map<String, Package> packages = new TreeMap<String, Package>(); 62.9 62.10 final int maxProfile = 4; // Three compact profiles plus full JRE 62.11
63.1 --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Aug 29 09:42:12 2013 -0700 63.2 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Aug 29 16:34:12 2013 -0700 63.3 @@ -944,10 +944,17 @@ 63.4 try { 63.5 if (tree.elemtype != null) { 63.6 print("new "); 63.7 - printTypeAnnotations(tree.annotations); 63.8 JCTree elem = tree.elemtype; 63.9 printBaseElementType(elem); 63.10 - boolean isElemAnnoType = elem instanceof JCAnnotatedType; 63.11 + 63.12 + if (!tree.annotations.isEmpty()) { 63.13 + print(' '); 63.14 + printTypeAnnotations(tree.annotations); 63.15 + } 63.16 + if (tree.elems != null) { 63.17 + print("[]"); 63.18 + } 63.19 + 63.20 int i = 0; 63.21 List<List<JCAnnotation>> da = tree.dimAnnotations; 63.22 for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) { 63.23 @@ -960,17 +967,7 @@ 63.24 printExpr(l.head); 63.25 print("]"); 63.26 } 63.27 - if (tree.elems != null) { 63.28 - if (isElemAnnoType) { 63.29 - print(' '); 63.30 - printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations); 63.31 - } 63.32 - print("[]"); 63.33 - } 63.34 - if (isElemAnnoType) 63.35 - elem = ((JCAnnotatedType)elem).underlyingType; 63.36 - if (elem instanceof JCArrayTypeTree) 63.37 - printBrackets((JCArrayTypeTree) elem); 63.38 + printBrackets(elem); 63.39 } 63.40 if (tree.elems != null) { 63.41 print("{"); 63.42 @@ -1260,20 +1257,24 @@ 63.43 } 63.44 63.45 // prints the brackets of a nested array in reverse order 63.46 - private void printBrackets(JCArrayTypeTree tree) throws IOException { 63.47 - JCTree elem; 63.48 + // tree is either JCArrayTypeTree or JCAnnotatedTypeTree 63.49 + private void printBrackets(JCTree tree) throws IOException { 63.50 + JCTree elem = tree; 63.51 while (true) { 63.52 - elem = tree.elemtype; 63.53 if (elem.hasTag(ANNOTATED_TYPE)) { 63.54 JCAnnotatedType atype = (JCAnnotatedType) elem; 63.55 elem = atype.underlyingType; 63.56 - if (!elem.hasTag(TYPEARRAY)) break; 63.57 - print(' '); 63.58 - printTypeAnnotations(atype.annotations); 63.59 + if (elem.hasTag(TYPEARRAY)) { 63.60 + print(' '); 63.61 + printTypeAnnotations(atype.annotations); 63.62 + } 63.63 } 63.64 - print("[]"); 63.65 - if (!elem.hasTag(TYPEARRAY)) break; 63.66 - tree = (JCArrayTypeTree) elem; 63.67 + if (elem.hasTag(TYPEARRAY)) { 63.68 + print("[]"); 63.69 + elem = ((JCArrayTypeTree)elem).elemtype; 63.70 + } else { 63.71 + break; 63.72 + } 63.73 } 63.74 } 63.75 63.76 @@ -1378,22 +1379,15 @@ 63.77 63.78 public void visitAnnotatedType(JCAnnotatedType tree) { 63.79 try { 63.80 - if (tree.underlyingType.getKind() == JCTree.Kind.MEMBER_SELECT) { 63.81 + if (tree.underlyingType.hasTag(SELECT)) { 63.82 JCFieldAccess access = (JCFieldAccess) tree.underlyingType; 63.83 printExpr(access.selected, TreeInfo.postfixPrec); 63.84 print("."); 63.85 printTypeAnnotations(tree.annotations); 63.86 print(access.name); 63.87 - } else if (tree.underlyingType.getKind() == JCTree.Kind.ARRAY_TYPE) { 63.88 - JCArrayTypeTree array = (JCArrayTypeTree) tree.underlyingType; 63.89 + } else if (tree.underlyingType.hasTag(TYPEARRAY)) { 63.90 printBaseElementType(tree); 63.91 - print(' '); 63.92 - printTypeAnnotations(tree.annotations); 63.93 - print("[]"); 63.94 - JCExpression elem = array.elemtype; 63.95 - if (elem.hasTag(TYPEARRAY)) { 63.96 - printBrackets((JCArrayTypeTree) elem); 63.97 - } 63.98 + printBrackets(tree); 63.99 } else { 63.100 printTypeAnnotations(tree.annotations); 63.101 printExpr(tree.underlyingType);
64.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Aug 29 09:42:12 2013 -0700 64.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Aug 29 16:34:12 2013 -0700 64.3 @@ -128,7 +128,14 @@ 64.4 try { 64.5 return clazz.flags(); 64.6 } catch (CompletionFailure ex) { 64.7 - // quietly ignore completion failures 64.8 + /* Quietly ignore completion failures. 64.9 + * Note that a CompletionFailure can only 64.10 + * occur as a result of calling complete(), 64.11 + * which will always remove the current 64.12 + * completer, leaving it to be null or 64.13 + * follow-up completer. Thus the loop 64.14 + * is guaranteed to eventually terminate. 64.15 + */ 64.16 } 64.17 } 64.18 }
65.1 --- a/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Thu Aug 29 09:42:12 2013 -0700 65.2 +++ b/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Thu Aug 29 16:34:12 2013 -0700 65.3 @@ -30,9 +30,12 @@ 65.4 import com.sun.tools.javac.code.Kinds; 65.5 import com.sun.tools.javac.code.Symbol.*; 65.6 import com.sun.tools.javac.comp.MemberEnter; 65.7 +import com.sun.tools.javac.tree.JCTree; 65.8 import com.sun.tools.javac.tree.JCTree.*; 65.9 import com.sun.tools.javac.util.Context; 65.10 65.11 +import static com.sun.tools.javac.code.Flags.*; 65.12 + 65.13 /** 65.14 * Javadoc's own memberEnter phase does a few things above and beyond that 65.15 * done by javac. 65.16 @@ -86,6 +89,17 @@ 65.17 65.18 @Override 65.19 public void visitVarDef(JCVariableDecl tree) { 65.20 + if (tree.init != null) { 65.21 + boolean isFinal = (tree.mods.flags & FINAL) != 0 65.22 + || (env.enclClass.mods.flags & INTERFACE) != 0; 65.23 + if (!isFinal || containsNonConstantExpression(tree.init)) { 65.24 + // Avoid unnecessary analysis and release resources. 65.25 + // In particular, remove non-constant expressions 65.26 + // which may trigger Attr.attribClass, since 65.27 + // method bodies are also removed, in visitMethodDef. 65.28 + tree.init = null; 65.29 + } 65.30 + } 65.31 super.visitVarDef(tree); 65.32 if (tree.sym != null && 65.33 tree.sym.kind == Kinds.VAR && 65.34 @@ -101,4 +115,95 @@ 65.35 private static boolean isParameter(VarSymbol var) { 65.36 return (var.flags() & Flags.PARAMETER) != 0; 65.37 } 65.38 + 65.39 + /** 65.40 + * Simple analysis of an expression tree to see if it contains tree nodes 65.41 + * for any non-constant expression. This does not include checking references 65.42 + * to other fields which may or may not be constant. 65.43 + */ 65.44 + private static boolean containsNonConstantExpression(JCExpression tree) { 65.45 + return new MaybeConstantExpressionScanner().containsNonConstantExpression(tree); 65.46 + } 65.47 + 65.48 + /** 65.49 + * See JLS 15.18, Constant Expression 65.50 + */ 65.51 + private static class MaybeConstantExpressionScanner extends JCTree.Visitor { 65.52 + boolean maybeConstantExpr = true; 65.53 + 65.54 + public boolean containsNonConstantExpression(JCExpression tree) { 65.55 + scan(tree); 65.56 + return !maybeConstantExpr; 65.57 + } 65.58 + 65.59 + public void scan(JCTree tree) { 65.60 + // short circuit scan when end result is definitely false 65.61 + if (maybeConstantExpr && tree != null) 65.62 + tree.accept(this); 65.63 + } 65.64 + 65.65 + @Override 65.66 + /** default for any non-overridden visit method. */ 65.67 + public void visitTree(JCTree tree) { 65.68 + maybeConstantExpr = false; 65.69 + } 65.70 + 65.71 + @Override 65.72 + public void visitBinary(JCBinary tree) { 65.73 + switch (tree.getTag()) { 65.74 + case MUL: case DIV: case MOD: 65.75 + case PLUS: case MINUS: 65.76 + case SL: case SR: case USR: 65.77 + case LT: case LE: case GT: case GE: 65.78 + case EQ: case NE: 65.79 + case BITAND: case BITXOR: case BITOR: 65.80 + case AND: case OR: 65.81 + break; 65.82 + default: 65.83 + maybeConstantExpr = false; 65.84 + } 65.85 + } 65.86 + 65.87 + @Override 65.88 + public void visitConditional(JCConditional tree) { 65.89 + scan(tree.cond); 65.90 + scan(tree.truepart); 65.91 + scan(tree.falsepart); 65.92 + } 65.93 + 65.94 + @Override 65.95 + public void visitIdent(JCIdent tree) { } 65.96 + 65.97 + @Override 65.98 + public void visitLiteral(JCLiteral tree) { } 65.99 + 65.100 + @Override 65.101 + public void visitParens(JCParens tree) { 65.102 + scan(tree.expr); 65.103 + } 65.104 + 65.105 + @Override 65.106 + public void visitSelect(JCTree.JCFieldAccess tree) { 65.107 + scan(tree.selected); 65.108 + } 65.109 + 65.110 + @Override 65.111 + public void visitTypeCast(JCTypeCast tree) { 65.112 + scan(tree.clazz); 65.113 + scan(tree.expr); 65.114 + } 65.115 + 65.116 + @Override 65.117 + public void visitTypeIdent(JCPrimitiveTypeTree tree) { } 65.118 + 65.119 + @Override 65.120 + public void visitUnary(JCUnary tree) { 65.121 + switch (tree.getTag()) { 65.122 + case POS: case NEG: case COMPL: case NOT: 65.123 + break; 65.124 + default: 65.125 + maybeConstantExpr = false; 65.126 + } 65.127 + } 65.128 + } 65.129 }
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/test/com/sun/javadoc/testCharset/TestCharset.java Thu Aug 29 16:34:12 2013 -0700 66.3 @@ -0,0 +1,82 @@ 66.4 +/* 66.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 66.7 + * 66.8 + * This code is free software; you can redistribute it and/or modify it 66.9 + * under the terms of the GNU General Public License version 2 only, as 66.10 + * published by the Free Software Foundation. 66.11 + * 66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 66.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 66.15 + * version 2 for more details (a copy is included in the LICENSE file that 66.16 + * accompanied this code). 66.17 + * 66.18 + * You should have received a copy of the GNU General Public License version 66.19 + * 2 along with this work; if not, write to the Free Software Foundation, 66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 66.21 + * 66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 66.23 + * or visit www.oracle.com if you need additional information or have any 66.24 + * questions. 66.25 + */ 66.26 + 66.27 +/* 66.28 + * @test 66.29 + * @bug 7052170 66.30 + * @summary Run a test on -charset to make sure the charset gets generated as a 66.31 + * part of the meta tag. 66.32 + * @author Bhavesh Patel 66.33 + * @library ../lib/ 66.34 + * @build JavadocTester TestCharset 66.35 + * @run main TestCharset 66.36 + */ 66.37 + 66.38 +public class TestCharset extends JavadocTester { 66.39 + 66.40 + //Test information. 66.41 + private static final String BUG_ID = "7052170"; 66.42 + 66.43 + //Javadoc arguments. 66.44 + private static final String[] ARGS = new String[] { 66.45 + "-d", BUG_ID, "-charset", "UTF-8", "-sourcepath", SRC_DIR, "pkg" 66.46 + }; 66.47 + 66.48 + private static final String[][] TEST = { 66.49 + {BUG_ID + FS + "index.html", 66.50 + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"}, 66.51 + {BUG_ID + FS + "pkg" + FS + "Foo.html", 66.52 + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"} 66.53 + }; 66.54 + 66.55 + private static final String[][] NEGATED_TEST = { 66.56 + {BUG_ID + FS + "index.html", 66.57 + "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"}, 66.58 + {BUG_ID + FS + "pkg" + FS + "Foo.html", 66.59 + "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"} 66.60 + }; 66.61 + 66.62 + /** 66.63 + * The entry point of the test. 66.64 + * @param args the array of command line arguments. 66.65 + */ 66.66 + public static void main(String[] args) { 66.67 + TestCharset tester = new TestCharset(); 66.68 + run(tester, ARGS, TEST, NEGATED_TEST); 66.69 + tester.printSummary(); 66.70 + } 66.71 + 66.72 + /** 66.73 + * {@inheritDoc} 66.74 + */ 66.75 + public String getBugId() { 66.76 + return BUG_ID; 66.77 + } 66.78 + 66.79 + /** 66.80 + * {@inheritDoc} 66.81 + */ 66.82 + public String getBugName() { 66.83 + return getClass().getName(); 66.84 + } 66.85 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/test/com/sun/javadoc/testCharset/pkg/Foo.java Thu Aug 29 16:34:12 2013 -0700 67.3 @@ -0,0 +1,26 @@ 67.4 +/* 67.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 67.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 67.7 + * 67.8 + * This code is free software; you can redistribute it and/or modify it 67.9 + * under the terms of the GNU General Public License version 2 only, as 67.10 + * published by the Free Software Foundation. 67.11 + * 67.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 67.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 67.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 67.15 + * version 2 for more details (a copy is included in the LICENSE file that 67.16 + * accompanied this code). 67.17 + * 67.18 + * You should have received a copy of the GNU General Public License version 67.19 + * 2 along with this work; if not, write to the Free Software Foundation, 67.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 67.21 + * 67.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 67.23 + * or visit www.oracle.com if you need additional information or have any 67.24 + * questions. 67.25 + */ 67.26 + 67.27 +package pkg; 67.28 + 67.29 +public class Foo {}
68.1 --- a/test/com/sun/javadoc/testNavagation/TestNavagation.java Thu Aug 29 09:42:12 2013 -0700 68.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 68.3 @@ -1,92 +0,0 @@ 68.4 -/* 68.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 68.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 68.7 - * 68.8 - * This code is free software; you can redistribute it and/or modify it 68.9 - * under the terms of the GNU General Public License version 2 only, as 68.10 - * published by the Free Software Foundation. 68.11 - * 68.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 68.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 68.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 68.15 - * version 2 for more details (a copy is included in the LICENSE file that 68.16 - * accompanied this code). 68.17 - * 68.18 - * You should have received a copy of the GNU General Public License version 68.19 - * 2 along with this work; if not, write to the Free Software Foundation, 68.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 68.21 - * 68.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 68.23 - * or visit www.oracle.com if you need additional information or have any 68.24 - * questions. 68.25 - */ 68.26 - 68.27 -/* 68.28 - * @test 68.29 - * @bug 4131628 4664607 7025314 68.30 - * @summary Make sure the Next/Prev Class links iterate through all types. 68.31 - * Make sure the navagation is 2 columns, not 3. 68.32 - * @author jamieh 68.33 - * @library ../lib/ 68.34 - * @build JavadocTester 68.35 - * @build TestNavagation 68.36 - * @run main TestNavagation 68.37 - */ 68.38 - 68.39 -public class TestNavagation extends JavadocTester { 68.40 - 68.41 - //Test information. 68.42 - private static final String BUG_ID = "4131628-4664607"; 68.43 - 68.44 - //Javadoc arguments. 68.45 - private static final String[] ARGS = new String[] { 68.46 - "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg" 68.47 - }; 68.48 - 68.49 - //Input for string search tests. 68.50 - private static final String[][] TEST = { 68.51 - {BUG_ID + FS + "pkg" + FS + "A.html", "<li>Prev Class</li>"}, 68.52 - {BUG_ID + FS + "pkg" + FS + "A.html", 68.53 - "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Next Class</span></a>"}, 68.54 - {BUG_ID + FS + "pkg" + FS + "C.html", 68.55 - "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">Prev Class</span></a>"}, 68.56 - {BUG_ID + FS + "pkg" + FS + "C.html", 68.57 - "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Next Class</span></a>"}, 68.58 - {BUG_ID + FS + "pkg" + FS + "E.html", 68.59 - "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Prev Class</span></a>"}, 68.60 - {BUG_ID + FS + "pkg" + FS + "E.html", 68.61 - "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">Next Class</span></a>"}, 68.62 - {BUG_ID + FS + "pkg" + FS + "I.html", 68.63 - "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Prev Class</span></a>"}, 68.64 - {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"}, 68.65 - // Test for 4664607 68.66 - {BUG_ID + FS + "pkg" + FS + "I.html", 68.67 - "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL + 68.68 - "<!-- -->" + NL + "</a>"} 68.69 - }; 68.70 - private static final String[][] NEGATED_TEST = NO_TEST; 68.71 - 68.72 - /** 68.73 - * The entry point of the test. 68.74 - * @param args the array of command line arguments. 68.75 - */ 68.76 - public static void main(String[] args) { 68.77 - TestNavagation tester = new TestNavagation(); 68.78 - run(tester, ARGS, TEST, NEGATED_TEST); 68.79 - tester.printSummary(); 68.80 - } 68.81 - 68.82 - /** 68.83 - * {@inheritDoc} 68.84 - */ 68.85 - public String getBugId() { 68.86 - return BUG_ID; 68.87 - } 68.88 - 68.89 - /** 68.90 - * {@inheritDoc} 68.91 - */ 68.92 - public String getBugName() { 68.93 - return getClass().getName(); 68.94 - } 68.95 -}
69.1 --- a/test/com/sun/javadoc/testNavagation/pkg/A.java Thu Aug 29 09:42:12 2013 -0700 69.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 69.3 @@ -1,29 +0,0 @@ 69.4 -/* 69.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 69.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 69.7 - * 69.8 - * This code is free software; you can redistribute it and/or modify it 69.9 - * under the terms of the GNU General Public License version 2 only, as 69.10 - * published by the Free Software Foundation. 69.11 - * 69.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 69.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 69.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 69.15 - * version 2 for more details (a copy is included in the LICENSE file that 69.16 - * accompanied this code). 69.17 - * 69.18 - * You should have received a copy of the GNU General Public License version 69.19 - * 2 along with this work; if not, write to the Free Software Foundation, 69.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 69.21 - * 69.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 69.23 - * or visit www.oracle.com if you need additional information or have any 69.24 - * questions. 69.25 - */ 69.26 - 69.27 -package pkg; 69.28 - 69.29 -/** 69.30 - * Sample Annotation Type. 69.31 - */ 69.32 -public @interface A {}
70.1 --- a/test/com/sun/javadoc/testNavagation/pkg/C.java Thu Aug 29 09:42:12 2013 -0700 70.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 70.3 @@ -1,29 +0,0 @@ 70.4 -/* 70.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 70.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 70.7 - * 70.8 - * This code is free software; you can redistribute it and/or modify it 70.9 - * under the terms of the GNU General Public License version 2 only, as 70.10 - * published by the Free Software Foundation. 70.11 - * 70.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 70.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 70.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 70.15 - * version 2 for more details (a copy is included in the LICENSE file that 70.16 - * accompanied this code). 70.17 - * 70.18 - * You should have received a copy of the GNU General Public License version 70.19 - * 2 along with this work; if not, write to the Free Software Foundation, 70.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 70.21 - * 70.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 70.23 - * or visit www.oracle.com if you need additional information or have any 70.24 - * questions. 70.25 - */ 70.26 - 70.27 -package pkg; 70.28 - 70.29 -/** 70.30 - * Sample Class. 70.31 - */ 70.32 -public class C {}
71.1 --- a/test/com/sun/javadoc/testNavagation/pkg/E.java Thu Aug 29 09:42:12 2013 -0700 71.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 71.3 @@ -1,29 +0,0 @@ 71.4 -/* 71.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 71.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 71.7 - * 71.8 - * This code is free software; you can redistribute it and/or modify it 71.9 - * under the terms of the GNU General Public License version 2 only, as 71.10 - * published by the Free Software Foundation. 71.11 - * 71.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 71.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 71.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 71.15 - * version 2 for more details (a copy is included in the LICENSE file that 71.16 - * accompanied this code). 71.17 - * 71.18 - * You should have received a copy of the GNU General Public License version 71.19 - * 2 along with this work; if not, write to the Free Software Foundation, 71.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 71.21 - * 71.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 71.23 - * or visit www.oracle.com if you need additional information or have any 71.24 - * questions. 71.25 - */ 71.26 - 71.27 -package pkg; 71.28 - 71.29 -/** 71.30 - * Sample Enum. 71.31 - */ 71.32 -public enum E {}
72.1 --- a/test/com/sun/javadoc/testNavagation/pkg/I.java Thu Aug 29 09:42:12 2013 -0700 72.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 72.3 @@ -1,29 +0,0 @@ 72.4 -/* 72.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 72.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 72.7 - * 72.8 - * This code is free software; you can redistribute it and/or modify it 72.9 - * under the terms of the GNU General Public License version 2 only, as 72.10 - * published by the Free Software Foundation. 72.11 - * 72.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 72.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 72.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 72.15 - * version 2 for more details (a copy is included in the LICENSE file that 72.16 - * accompanied this code). 72.17 - * 72.18 - * You should have received a copy of the GNU General Public License version 72.19 - * 2 along with this work; if not, write to the Free Software Foundation, 72.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 72.21 - * 72.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 72.23 - * or visit www.oracle.com if you need additional information or have any 72.24 - * questions. 72.25 - */ 72.26 - 72.27 -package pkg; 72.28 - 72.29 -/** 72.30 - * Sample Interface. 72.31 - */ 72.32 -public interface I {}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 73.2 +++ b/test/com/sun/javadoc/testNavigation/TestNavigation.java Thu Aug 29 16:34:12 2013 -0700 73.3 @@ -0,0 +1,92 @@ 73.4 +/* 73.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 73.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 73.7 + * 73.8 + * This code is free software; you can redistribute it and/or modify it 73.9 + * under the terms of the GNU General Public License version 2 only, as 73.10 + * published by the Free Software Foundation. 73.11 + * 73.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 73.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 73.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 73.15 + * version 2 for more details (a copy is included in the LICENSE file that 73.16 + * accompanied this code). 73.17 + * 73.18 + * You should have received a copy of the GNU General Public License version 73.19 + * 2 along with this work; if not, write to the Free Software Foundation, 73.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 73.21 + * 73.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 73.23 + * or visit www.oracle.com if you need additional information or have any 73.24 + * questions. 73.25 + */ 73.26 + 73.27 +/* 73.28 + * @test 73.29 + * @bug 4131628 4664607 7025314 73.30 + * @summary Make sure the Next/Prev Class links iterate through all types. 73.31 + * Make sure the navagation is 2 columns, not 3. 73.32 + * @author jamieh 73.33 + * @library ../lib/ 73.34 + * @build JavadocTester 73.35 + * @build TestNavigation 73.36 + * @run main TestNavigation 73.37 + */ 73.38 + 73.39 +public class TestNavigation extends JavadocTester { 73.40 + 73.41 + //Test information. 73.42 + private static final String BUG_ID = "4131628-4664607"; 73.43 + 73.44 + //Javadoc arguments. 73.45 + private static final String[] ARGS = new String[] { 73.46 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg" 73.47 + }; 73.48 + 73.49 + //Input for string search tests. 73.50 + private static final String[][] TEST = { 73.51 + {BUG_ID + FS + "pkg" + FS + "A.html", "<li>Prev Class</li>"}, 73.52 + {BUG_ID + FS + "pkg" + FS + "A.html", 73.53 + "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Next Class</span></a>"}, 73.54 + {BUG_ID + FS + "pkg" + FS + "C.html", 73.55 + "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">Prev Class</span></a>"}, 73.56 + {BUG_ID + FS + "pkg" + FS + "C.html", 73.57 + "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Next Class</span></a>"}, 73.58 + {BUG_ID + FS + "pkg" + FS + "E.html", 73.59 + "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Prev Class</span></a>"}, 73.60 + {BUG_ID + FS + "pkg" + FS + "E.html", 73.61 + "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">Next Class</span></a>"}, 73.62 + {BUG_ID + FS + "pkg" + FS + "I.html", 73.63 + "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Prev Class</span></a>"}, 73.64 + {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"}, 73.65 + // Test for 4664607 73.66 + {BUG_ID + FS + "pkg" + FS + "I.html", 73.67 + "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL + 73.68 + "<!-- -->" + NL + "</a>"} 73.69 + }; 73.70 + private static final String[][] NEGATED_TEST = NO_TEST; 73.71 + 73.72 + /** 73.73 + * The entry point of the test. 73.74 + * @param args the array of command line arguments. 73.75 + */ 73.76 + public static void main(String[] args) { 73.77 + TestNavigation tester = new TestNavigation(); 73.78 + run(tester, ARGS, TEST, NEGATED_TEST); 73.79 + tester.printSummary(); 73.80 + } 73.81 + 73.82 + /** 73.83 + * {@inheritDoc} 73.84 + */ 73.85 + public String getBugId() { 73.86 + return BUG_ID; 73.87 + } 73.88 + 73.89 + /** 73.90 + * {@inheritDoc} 73.91 + */ 73.92 + public String getBugName() { 73.93 + return getClass().getName(); 73.94 + } 73.95 +}
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/test/com/sun/javadoc/testNavigation/pkg/A.java Thu Aug 29 16:34:12 2013 -0700 74.3 @@ -0,0 +1,29 @@ 74.4 +/* 74.5 + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 74.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 74.7 + * 74.8 + * This code is free software; you can redistribute it and/or modify it 74.9 + * under the terms of the GNU General Public License version 2 only, as 74.10 + * published by the Free Software Foundation. 74.11 + * 74.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 74.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 74.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 74.15 + * version 2 for more details (a copy is included in the LICENSE file that 74.16 + * accompanied this code). 74.17 + * 74.18 + * You should have received a copy of the GNU General Public License version 74.19 + * 2 along with this work; if not, write to the Free Software Foundation, 74.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 74.21 + * 74.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 74.23 + * or visit www.oracle.com if you need additional information or have any 74.24 + * questions. 74.25 + */ 74.26 + 74.27 +package pkg; 74.28 + 74.29 +/** 74.30 + * Sample Annotation Type. 74.31 + */ 74.32 +public @interface A {}
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 75.2 +++ b/test/com/sun/javadoc/testNavigation/pkg/C.java Thu Aug 29 16:34:12 2013 -0700 75.3 @@ -0,0 +1,29 @@ 75.4 +/* 75.5 + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 75.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 75.7 + * 75.8 + * This code is free software; you can redistribute it and/or modify it 75.9 + * under the terms of the GNU General Public License version 2 only, as 75.10 + * published by the Free Software Foundation. 75.11 + * 75.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 75.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 75.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 75.15 + * version 2 for more details (a copy is included in the LICENSE file that 75.16 + * accompanied this code). 75.17 + * 75.18 + * You should have received a copy of the GNU General Public License version 75.19 + * 2 along with this work; if not, write to the Free Software Foundation, 75.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 75.21 + * 75.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 75.23 + * or visit www.oracle.com if you need additional information or have any 75.24 + * questions. 75.25 + */ 75.26 + 75.27 +package pkg; 75.28 + 75.29 +/** 75.30 + * Sample Class. 75.31 + */ 75.32 +public class C {}
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 76.2 +++ b/test/com/sun/javadoc/testNavigation/pkg/E.java Thu Aug 29 16:34:12 2013 -0700 76.3 @@ -0,0 +1,29 @@ 76.4 +/* 76.5 + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 76.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 76.7 + * 76.8 + * This code is free software; you can redistribute it and/or modify it 76.9 + * under the terms of the GNU General Public License version 2 only, as 76.10 + * published by the Free Software Foundation. 76.11 + * 76.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 76.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 76.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 76.15 + * version 2 for more details (a copy is included in the LICENSE file that 76.16 + * accompanied this code). 76.17 + * 76.18 + * You should have received a copy of the GNU General Public License version 76.19 + * 2 along with this work; if not, write to the Free Software Foundation, 76.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 76.21 + * 76.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 76.23 + * or visit www.oracle.com if you need additional information or have any 76.24 + * questions. 76.25 + */ 76.26 + 76.27 +package pkg; 76.28 + 76.29 +/** 76.30 + * Sample Enum. 76.31 + */ 76.32 +public enum E {}
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 77.2 +++ b/test/com/sun/javadoc/testNavigation/pkg/I.java Thu Aug 29 16:34:12 2013 -0700 77.3 @@ -0,0 +1,29 @@ 77.4 +/* 77.5 + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 77.7 + * 77.8 + * This code is free software; you can redistribute it and/or modify it 77.9 + * under the terms of the GNU General Public License version 2 only, as 77.10 + * published by the Free Software Foundation. 77.11 + * 77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 77.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 77.15 + * version 2 for more details (a copy is included in the LICENSE file that 77.16 + * accompanied this code). 77.17 + * 77.18 + * You should have received a copy of the GNU General Public License version 77.19 + * 2 along with this work; if not, write to the Free Software Foundation, 77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 77.21 + * 77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 77.23 + * or visit www.oracle.com if you need additional information or have any 77.24 + * questions. 77.25 + */ 77.26 + 77.27 +package pkg; 77.28 + 77.29 +/** 77.30 + * Sample Interface. 77.31 + */ 77.32 +public interface I {}
78.1 --- a/test/tools/doclint/html/ListTagsTest.java Thu Aug 29 09:42:12 2013 -0700 78.2 +++ b/test/tools/doclint/html/ListTagsTest.java Thu Aug 29 16:34:12 2013 -0700 78.3 @@ -1,6 +1,6 @@ 78.4 /* 78.5 * @test /nodynamiccopyright/ 78.6 - * @bug 8006251 8013405 78.7 + * @bug 8006251 8013405 8022173 78.8 * @summary test list tags 78.9 * @library .. 78.10 * @build DocLintTester 78.11 @@ -15,6 +15,7 @@ 78.12 * <ol> <li value="1"> abc </ol> 78.13 * <ol> <li value> bad </ol> 78.14 * <ol> <li value="a"> bad </ol> 78.15 + * <ol type="a"> <li> bad </ol> 78.16 * <ul> <li> abc </ul> 78.17 */ 78.18 public void supportedTags() { }
79.1 --- a/test/tools/doclint/html/OtherTagsTest.java Thu Aug 29 09:42:12 2013 -0700 79.2 +++ b/test/tools/doclint/html/OtherTagsTest.java Thu Aug 29 16:34:12 2013 -0700 79.3 @@ -1,6 +1,6 @@ 79.4 /* 79.5 * @test /nodynamiccopyright/ 79.6 - * @bug 8006251 79.7 + * @bug 8006251 8022173 79.8 * @summary test other tags 79.9 * @library .. 79.10 * @build DocLintTester 79.11 @@ -14,6 +14,7 @@ 79.12 * <frame> 79.13 * <frameset> </frameset> 79.14 * <head> </head> 79.15 + * <hr width="50%"> 79.16 * <link> 79.17 * <meta> 79.18 * <noframes> </noframes>
80.1 --- a/test/tools/doclint/html/OtherTagsTest.out Thu Aug 29 09:42:12 2013 -0700 80.2 +++ b/test/tools/doclint/html/OtherTagsTest.out Thu Aug 29 16:34:12 2013 -0700 80.3 @@ -10,19 +10,19 @@ 80.4 OtherTagsTest.java:16: error: element not allowed in documentation comments: <head> 80.5 * <head> </head> 80.6 ^ 80.7 -OtherTagsTest.java:17: error: element not allowed in documentation comments: <link> 80.8 +OtherTagsTest.java:18: error: element not allowed in documentation comments: <link> 80.9 * <link> 80.10 ^ 80.11 -OtherTagsTest.java:18: error: element not allowed in documentation comments: <meta> 80.12 +OtherTagsTest.java:19: error: element not allowed in documentation comments: <meta> 80.13 * <meta> 80.14 ^ 80.15 -OtherTagsTest.java:19: error: element not allowed in documentation comments: <noframes> 80.16 +OtherTagsTest.java:20: error: element not allowed in documentation comments: <noframes> 80.17 * <noframes> </noframes> 80.18 ^ 80.19 -OtherTagsTest.java:20: error: element not allowed in documentation comments: <script> 80.20 +OtherTagsTest.java:21: error: element not allowed in documentation comments: <script> 80.21 * <script> </script> 80.22 ^ 80.23 -OtherTagsTest.java:21: error: element not allowed in documentation comments: <title> 80.24 +OtherTagsTest.java:22: error: element not allowed in documentation comments: <title> 80.25 * <title> </title> 80.26 ^ 80.27 9 errors
81.1 --- a/test/tools/doclint/html/TableTagsTest.java Thu Aug 29 09:42:12 2013 -0700 81.2 +++ b/test/tools/doclint/html/TableTagsTest.java Thu Aug 29 16:34:12 2013 -0700 81.3 @@ -23,7 +23,7 @@ 81.4 81.5 /* 81.6 * @test 81.7 - * @bug 8006251 81.8 + * @bug 8006251 8022173 81.9 * @summary test table tags 81.10 * @library .. 81.11 * @build DocLintTester 81.12 @@ -39,6 +39,7 @@ 81.13 * <table summary="abc"> <thead> <tr> </thead> <tr> <td> </table> 81.14 * <table summary="abc"> <tbody> <tr> <td> </tbody> </table> 81.15 * <table summary="abc"> <tr> <td> <tfoot> <tr> </tfoot></table> 81.16 + * <table summary="abc" width="50%"> <tr> <td> <tfoot> <tr> </tfoot></table> 81.17 */ 81.18 public void supportedTags() { } 81.19 }
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/test/tools/javac/7118412/ShadowingTest.java Thu Aug 29 16:34:12 2013 -0700 82.3 @@ -0,0 +1,287 @@ 82.4 +/* 82.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 82.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 82.7 + * 82.8 + * This code is free software; you can redistribute it and/or modify it 82.9 + * under the terms of the GNU General Public License version 2 only, as 82.10 + * published by the Free Software Foundation. 82.11 + * 82.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 82.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 82.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 82.15 + * version 2 for more details (a copy is included in the LICENSE file that 82.16 + * accompanied this code). 82.17 + * 82.18 + * You should have received a copy of the GNU General Public License version 82.19 + * 2 along with this work; if not, write to the Free Software Foundation, 82.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 82.21 + * 82.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 82.23 + * or visit www.oracle.com if you need additional information or have any 82.24 + * questions. 82.25 + */ 82.26 + 82.27 +/* 82.28 + * @test 82.29 + * @bug 7118412 82.30 + * @summary Shadowing of type-variables vs. member types 82.31 + */ 82.32 +import java.io.File; 82.33 +import java.io.FileWriter; 82.34 +import java.io.IOException; 82.35 +import java.io.PrintWriter; 82.36 +import java.io.StringWriter; 82.37 + 82.38 +public class ShadowingTest { 82.39 + 82.40 + // We generate a method "test" that tries to call T.<something, 82.41 + // depending on the value of MethodCall>. This controls whether 82.42 + // "test" is static or not. 82.43 + private enum MethodContext { 82.44 + STATIC("static "), 82.45 + INSTANCE(""); 82.46 + 82.47 + public final String methodcontext; 82.48 + 82.49 + MethodContext(final String methodcontext) { 82.50 + this.methodcontext = methodcontext; 82.51 + } 82.52 + } 82.53 + 82.54 + // These control whether or not a type parameter, method type 82.55 + // parameter, or inner class get declared (and in the case of 82.56 + // inner classes, whether it's static or not. 82.57 + 82.58 + private enum MethodTypeParameterDecl { 82.59 + NO(""), 82.60 + YES("<T extends Number> "); 82.61 + 82.62 + public final String tyvar; 82.63 + 82.64 + MethodTypeParameterDecl(final String tyvar) { 82.65 + this.tyvar = tyvar; 82.66 + } 82.67 + } 82.68 + 82.69 + private enum InsideDef { 82.70 + NONE(""), 82.71 + STATIC("static class T { public void inner() {} }\n"), 82.72 + INSTANCE("class T { public void inner() {} }\n"); 82.73 + 82.74 + public final String instancedef; 82.75 + 82.76 + InsideDef(final String instancedef) { 82.77 + this.instancedef = instancedef; 82.78 + } 82.79 + } 82.80 + 82.81 + private enum TypeParameterDecl { 82.82 + NO(""), 82.83 + YES("<T extends Collection>"); 82.84 + 82.85 + public final String tyvar; 82.86 + 82.87 + TypeParameterDecl(final String tyvar) { 82.88 + this.tyvar = tyvar; 82.89 + } 82.90 + } 82.91 + 82.92 + // Represents what method we try to call. This is a way of 82.93 + // checking which T we're seeing. 82.94 + private enum MethodCall { 82.95 + // Method type variables extend Number, so we have intValue 82.96 + METHOD_TYPEVAR("intValue"), 82.97 + // The inner class declaration has a method called "inner" 82.98 + INNER_CLASS("inner"), 82.99 + // The class type variables extend Collection, so we call iterator 82.100 + TYPEVAR("iterator"), 82.101 + // The outer class declaration has a method called "outer" 82.102 + OUTER_CLASS("outer"); 82.103 + 82.104 + public final String methodcall; 82.105 + 82.106 + MethodCall(final String methodcall) { 82.107 + this.methodcall = methodcall; 82.108 + } 82.109 + 82.110 + } 82.111 + 82.112 + public boolean succeeds(final MethodCall call, 82.113 + final MethodTypeParameterDecl mtyvar, 82.114 + final MethodContext ctx, 82.115 + final InsideDef inside, 82.116 + final TypeParameterDecl tyvar) { 82.117 + switch(call) { 82.118 + // We want to resolve to the method type variable 82.119 + case METHOD_TYPEVAR: switch(mtyvar) { 82.120 + // If the method type variable exists, then T will 82.121 + // resolve to it, and we'll have intValue. 82.122 + case YES: return true; 82.123 + // Otherwise, this cannot succeed. 82.124 + default: return false; 82.125 + } 82.126 + // We want to resolve to the inner class 82.127 + case INNER_CLASS: switch(mtyvar) { 82.128 + // The method type parameter will shadow the inner 82.129 + // class, so there can't be one. 82.130 + case NO: switch(ctx) { 82.131 + // If we're not static, then either one should succeed. 82.132 + case INSTANCE: switch(inside) { 82.133 + case INSTANCE: 82.134 + case STATIC: 82.135 + return true; 82.136 + default: return false; 82.137 + } 82.138 + case STATIC: switch(inside) { 82.139 + // If we are static, and the inner class is 82.140 + // static, then we also succeed, because we 82.141 + // can't see the type variable. 82.142 + case STATIC: return true; 82.143 + case INSTANCE: switch(tyvar) { 82.144 + // If we're calling from a non-static 82.145 + // context, there can't be a class type 82.146 + // variable, because that will shadow the 82.147 + // static inner class definition. 82.148 + case NO: return true; 82.149 + default: return false; 82.150 + } 82.151 + // If the inner class isn't declared, we can't 82.152 + // see it. 82.153 + default: return false; 82.154 + } 82.155 + // Can't get here. 82.156 + default: return false; 82.157 + } 82.158 + default: return false; 82.159 + } 82.160 + // We want to resolve to the class type parameter 82.161 + case TYPEVAR: switch(mtyvar) { 82.162 + // We can't have a method type parameter, as that would 82.163 + // shadow the class type parameter 82.164 + case NO: switch(ctx) { 82.165 + case INSTANCE: switch(inside) { 82.166 + // We have to be in an instance context. If 82.167 + // we're static, we can't see the type 82.168 + // variable. 82.169 + case NONE: switch(tyvar) { 82.170 + // Obviously, the type parameter has to be declared. 82.171 + case YES: return true; 82.172 + default: return false; 82.173 + } 82.174 + default: return false; 82.175 + } 82.176 + default: return false; 82.177 + } 82.178 + default: return false; 82.179 + } 82.180 + // We want to resolve to the outer class 82.181 + case OUTER_CLASS: switch(mtyvar) { 82.182 + case NO: switch(inside) { 82.183 + case NONE: switch(tyvar) { 82.184 + // Basically, nothing else can be declared, or 82.185 + // else we can't see it. Even if our context 82.186 + // is static, the compiler will complain if 82.187 + // non-static T's exist, because they will 82.188 + // shadow the outer class. 82.189 + case NO: return true; 82.190 + default: return false; 82.191 + } 82.192 + default: return false; 82.193 + } 82.194 + default: return false; 82.195 + } 82.196 + } 82.197 + return false; 82.198 + } 82.199 + 82.200 + private static final File classesdir = new File("7118412"); 82.201 + 82.202 + private int errors = 0; 82.203 + 82.204 + private int dirnum = 0; 82.205 + 82.206 + private void doTest(final MethodTypeParameterDecl mtyvar, 82.207 + final TypeParameterDecl tyvar, 82.208 + final InsideDef insidedef, final MethodContext ctx, 82.209 + final MethodCall call) 82.210 + throws IOException { 82.211 + final String content = "import java.util.Collection;\n" + 82.212 + "class Test" + tyvar.tyvar + " {\n" + 82.213 + " " + insidedef.instancedef + 82.214 + " " + ctx.methodcontext + mtyvar.tyvar + "void test(T t) { t." + 82.215 + call.methodcall + "(); }\n" + 82.216 + "}\n" + 82.217 + "class T { void outer() {} }\n"; 82.218 + final File dir = new File(classesdir, "" + dirnum); 82.219 + final File Test_java = writeFile(dir, "Test.java", content); 82.220 + dirnum++; 82.221 + if(succeeds(call, mtyvar, ctx, insidedef, tyvar)) { 82.222 + if(!assert_compile_succeed(Test_java)) 82.223 + System.err.println("Failed file:\n" + content); 82.224 + } 82.225 + else { 82.226 + if(!assert_compile_fail(Test_java)) 82.227 + System.err.println("Failed file:\n" + content); 82.228 + } 82.229 + } 82.230 + 82.231 + private void run() throws Exception { 82.232 + classesdir.mkdir(); 82.233 + for(MethodTypeParameterDecl mtyvar : MethodTypeParameterDecl.values()) 82.234 + for(TypeParameterDecl tyvar : TypeParameterDecl.values()) 82.235 + for(InsideDef insidedef : InsideDef.values()) 82.236 + for(MethodContext ctx : MethodContext.values()) 82.237 + for(MethodCall methodcall : MethodCall.values()) 82.238 + doTest(mtyvar, tyvar, insidedef, ctx, methodcall); 82.239 + if (errors != 0) 82.240 + throw new Exception("ShadowingTest test failed with " + 82.241 + errors + " errors."); 82.242 + } 82.243 + 82.244 + private boolean assert_compile_fail(final File file) { 82.245 + final String filename = file.getPath(); 82.246 + final String[] args = { filename }; 82.247 + final StringWriter sw = new StringWriter(); 82.248 + final PrintWriter pw = new PrintWriter(sw); 82.249 + final int rc = com.sun.tools.javac.Main.compile(args, pw); 82.250 + pw.close(); 82.251 + if (rc == 0) { 82.252 + System.err.println("Compilation of " + file.getName() + 82.253 + " didn't fail as expected."); 82.254 + errors++; 82.255 + return false; 82.256 + } else return true; 82.257 + } 82.258 + 82.259 + private boolean assert_compile_succeed(final File file) { 82.260 + final String filename = file.getPath(); 82.261 + final String[] args = { filename }; 82.262 + final StringWriter sw = new StringWriter(); 82.263 + final PrintWriter pw = new PrintWriter(sw); 82.264 + final int rc = com.sun.tools.javac.Main.compile(args, pw); 82.265 + pw.close(); 82.266 + if (rc != 0) { 82.267 + System.err.println("Compilation of " + file.getName() + 82.268 + " didn't succeed as expected. Output:"); 82.269 + System.err.println(sw.toString()); 82.270 + errors++; 82.271 + return false; 82.272 + } else return true; 82.273 + } 82.274 + 82.275 + private File writeFile(final File dir, 82.276 + final String path, 82.277 + final String body) throws IOException { 82.278 + final File f = new File(dir, path); 82.279 + f.getParentFile().mkdirs(); 82.280 + final FileWriter out = new FileWriter(f); 82.281 + out.write(body); 82.282 + out.close(); 82.283 + return f; 82.284 + } 82.285 + 82.286 + public static void main(String... args) throws Exception { 82.287 + new ShadowingTest().run(); 82.288 + } 82.289 + 82.290 +}
83.1 --- a/test/tools/javac/8015701/AnonymousParameters.java Thu Aug 29 09:42:12 2013 -0700 83.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 83.3 @@ -1,89 +0,0 @@ 83.4 -/* 83.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 83.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 83.7 - * 83.8 - * This code is free software; you can redistribute it and/or modify it 83.9 - * under the terms of the GNU General Public License version 2 only, as 83.10 - * published by the Free Software Foundation. 83.11 - * 83.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 83.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 83.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 83.15 - * version 2 for more details (a copy is included in the LICENSE file that 83.16 - * accompanied this code). 83.17 - * 83.18 - * You should have received a copy of the GNU General Public License version 83.19 - * 2 along with this work; if not, write to the Free Software Foundation, 83.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 83.21 - * 83.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 83.23 - * or visit www.oracle.com if you need additional information or have any 83.24 - * questions. 83.25 - */ 83.26 - 83.27 -/* 83.28 - * @test 83.29 - * @bug 8015701 83.30 - * @summary javac should generate method parameters correctly. 83.31 - * @compile -parameters AnonymousParameters.java 83.32 - * @run main AnonymousParameters 83.33 - */ 83.34 -import java.lang.Class; 83.35 -import java.lang.reflect.Constructor; 83.36 -import java.lang.reflect.Parameter; 83.37 -import java.util.concurrent.Callable; 83.38 - 83.39 -public class AnonymousParameters { 83.40 - 83.41 - String[] names = { 83.42 - "this$0", 83.43 - "val$message" 83.44 - }; 83.45 - 83.46 - public static void main(String... args) throws Exception { 83.47 - new AnonymousParameters().run(); 83.48 - } 83.49 - 83.50 - void run() throws Exception { 83.51 - Class<?> cls = new ParameterNames().makeInner("hello").getClass(); 83.52 - Constructor<?> ctor = cls.getDeclaredConstructors()[0]; 83.53 - Parameter[] params = ctor.getParameters(); 83.54 - 83.55 - if(params.length == 2) { 83.56 - for(int i = 0; i < 2; i++) { 83.57 - System.err.println("Testing parameter " + params[i].getName()); 83.58 - if(!params[i].getName().equals(names[i])) 83.59 - error("Expected parameter name " + names[i] + 83.60 - " got " + params[i].getName()); 83.61 - } 83.62 - } else 83.63 - error("Expected 2 parameters"); 83.64 - 83.65 - if(0 != errors) 83.66 - throw new Exception("MethodParameters test failed with " + 83.67 - errors + " errors"); 83.68 - } 83.69 - 83.70 - void error(String msg) { 83.71 - System.err.println("Error: " + msg); 83.72 - errors++; 83.73 - } 83.74 - 83.75 - int errors; 83.76 -} 83.77 - 83.78 -class ParameterNames { 83.79 - 83.80 - public Callable<String> makeInner(final String message) { 83.81 - return new Callable<String>() { 83.82 - public String call() throws Exception { 83.83 - return message; 83.84 - } 83.85 - }; 83.86 - } 83.87 - 83.88 - public static void main(String... args) throws Exception { 83.89 - ParameterNames test = new ParameterNames(); 83.90 - System.out.println(test.makeInner("Hello").call()); 83.91 - } 83.92 -}
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 84.2 +++ b/test/tools/javac/MethodParameters/CaptureTest.java Thu Aug 29 16:34:12 2013 -0700 84.3 @@ -0,0 +1,289 @@ 84.4 +/* 84.5 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 84.7 + * 84.8 + * This code is free software; you can redistribute it and/or modify it 84.9 + * under the terms of the GNU General Public License version 2 only, as 84.10 + * published by the Free Software Foundation. 84.11 + * 84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 84.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 84.15 + * version 2 for more details (a copy is included in the LICENSE file that 84.16 + * accompanied this code). 84.17 + * 84.18 + * You should have received a copy of the GNU General Public License version 84.19 + * 2 along with this work; if not, write to the Free Software Foundation, 84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 84.21 + * 84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 84.23 + * or visit www.oracle.com if you need additional information or have any 84.24 + * questions. 84.25 + */ 84.26 + 84.27 +/* 84.28 + * @test 84.29 + * @bug 8015701 84.30 + * @summary Test method parameter attribute generation with captured locals. 84.31 + * @compile -parameters CaptureTest.java 84.32 + * @run main CaptureTest 84.33 + */ 84.34 +import java.lang.Class; 84.35 +import java.lang.reflect.Constructor; 84.36 +import java.lang.reflect.Parameter; 84.37 +import java.lang.reflect.Modifier; 84.38 +import java.util.List; 84.39 +import java.util.ArrayList; 84.40 + 84.41 +public class CaptureTest { 84.42 + 84.43 + private static final int SYNTHETIC = 0x1000; 84.44 + private static final int MANDATED = 0x8000; 84.45 + 84.46 + public static void main(String... args) throws Exception { 84.47 + new CaptureTest().run(); 84.48 + } 84.49 + 84.50 + 84.51 + private void run() throws Exception { 84.52 + final Encloser pn = new Encloser(); 84.53 + 84.54 + /* Cases covered here: 84.55 + * 84.56 + * - Local class 84.57 + * - Inner class 84.58 + * - Anonymous class 84.59 + * - Anonymous class extending a local 84.60 + * - Anonymous class extending an inner 84.61 + */ 84.62 + pn.makeLocal("hello").check(); 84.63 + pn.makeInner("hello").check(); 84.64 + pn.makeAnon("hello").check(); 84.65 + pn.makeAnonExtendsLocal("hello").check(); 84.66 + pn.makeAnonExtendsInner("hello").check(); 84.67 + 84.68 + if (0 != errors) 84.69 + throw new Exception("MethodParameters test failed with " + 84.70 + errors + " errors"); 84.71 + } 84.72 + 84.73 + private void error(final String msg) { 84.74 + System.err.println("Error: " + msg); 84.75 + errors++; 84.76 + } 84.77 + 84.78 + int errors; 84.79 + 84.80 + abstract class Tester { 84.81 + 84.82 + public Tester(final int param) {} 84.83 + 84.84 + protected abstract String[] names(); 84.85 + protected abstract int[] modifiers(); 84.86 + protected abstract Class[] types(); 84.87 + 84.88 + public void check() { 84.89 + final Class<?> cls = this.getClass(); 84.90 + final Constructor<?> ctor = cls.getDeclaredConstructors()[0]; 84.91 + final Parameter[] params = ctor.getParameters(); 84.92 + final String[] names = names(); 84.93 + final int[] modifiers = modifiers(); 84.94 + final Class[] types = types(); 84.95 + 84.96 + System.err.println("Testing class " + cls); 84.97 + 84.98 + if (params.length == names.length) { 84.99 + for (int i = 0; i < names.length; i++) { 84.100 + System.err.println("Testing parameter " + params[i].getName()); 84.101 + if (!params[i].getName().equals(names[i])) 84.102 + error("Expected parameter name " + names[i] + 84.103 + " got " + params[i].getName()); 84.104 + if (params[i].getModifiers() != modifiers[i]) 84.105 + error("Expected parameter modifiers " + 84.106 + modifiers[i] + " got " + 84.107 + params[i].getModifiers()); 84.108 + if (!params[i].getType().equals(types[i])) 84.109 + error("Expected parameter type " + types[i] + 84.110 + " got " + params[i].getType()); 84.111 + } 84.112 + } else 84.113 + error("Expected " + names.length + " parameters"); 84.114 + 84.115 + } 84.116 + 84.117 + } 84.118 + 84.119 + class Encloser { 84.120 + private class InnerTester extends Tester { 84.121 + public InnerTester(final int innerparam) { 84.122 + super(innerparam); 84.123 + } 84.124 + 84.125 + protected String[] names() { 84.126 + return new String[] { 84.127 + "this$1", 84.128 + "innerparam" 84.129 + }; 84.130 + } 84.131 + 84.132 + protected int[] modifiers() { 84.133 + return new int[] { 84.134 + Modifier.FINAL | SYNTHETIC, 84.135 + Modifier.FINAL 84.136 + }; 84.137 + } 84.138 + 84.139 + protected Class[] types() { 84.140 + return new Class[] { 84.141 + Encloser.class, 84.142 + int.class 84.143 + }; 84.144 + } 84.145 + } 84.146 + 84.147 + public Tester makeInner(final String message) { 84.148 + return new InnerTester(2); 84.149 + } 84.150 + 84.151 + public Tester makeLocal(final String message) { 84.152 + class LocalTester extends Tester { 84.153 + public LocalTester(final int localparam) { 84.154 + super(localparam); 84.155 + } 84.156 + 84.157 + protected String[] names() { 84.158 + return new String[] { 84.159 + "this$1", 84.160 + "localparam", 84.161 + "val$message" 84.162 + }; 84.163 + } 84.164 + 84.165 + protected int[] modifiers() { 84.166 + return new int[] { 84.167 + Modifier.FINAL | MANDATED, 84.168 + Modifier.FINAL, 84.169 + Modifier.FINAL | SYNTHETIC 84.170 + }; 84.171 + } 84.172 + 84.173 + protected Class[] types() { 84.174 + return new Class[] { 84.175 + Encloser.class, 84.176 + int.class, 84.177 + String.class 84.178 + }; 84.179 + } 84.180 + 84.181 + public String message() { 84.182 + return message; 84.183 + } 84.184 + } 84.185 + 84.186 + return new LocalTester(2); 84.187 + } 84.188 + 84.189 + public Tester makeAnonExtendsLocal(final String message) { 84.190 + abstract class LocalTester extends Tester { 84.191 + public LocalTester(final int localparam) { 84.192 + super(localparam); 84.193 + } 84.194 + 84.195 + protected String[] names() { 84.196 + return new String[] { 84.197 + "this$1", 84.198 + "localparam", 84.199 + "val$message" 84.200 + }; 84.201 + } 84.202 + 84.203 + protected int[] modifiers() { 84.204 + return new int[] { 84.205 + Modifier.FINAL | MANDATED, 84.206 + Modifier.FINAL, 84.207 + Modifier.FINAL | SYNTHETIC 84.208 + }; 84.209 + } 84.210 + 84.211 + protected Class[] types() { 84.212 + return new Class[] { 84.213 + Encloser.class, 84.214 + int.class, 84.215 + String.class 84.216 + }; 84.217 + } 84.218 + 84.219 + } 84.220 + 84.221 + return new LocalTester(2) { 84.222 + public String message() { 84.223 + return message; 84.224 + } 84.225 + }; 84.226 + } 84.227 + 84.228 + public Tester makeAnonExtendsInner(final String message) { 84.229 + return new InnerTester(2) { 84.230 + protected String[] names() { 84.231 + return new String[] { 84.232 + "this$1", 84.233 + "innerparam", 84.234 + "val$message" 84.235 + }; 84.236 + } 84.237 + 84.238 + protected int[] modifiers() { 84.239 + return new int[] { 84.240 + Modifier.FINAL | MANDATED, 84.241 + Modifier.FINAL, 84.242 + Modifier.FINAL | SYNTHETIC 84.243 + }; 84.244 + } 84.245 + 84.246 + protected Class[] types() { 84.247 + return new Class[] { 84.248 + Encloser.class, 84.249 + int.class, 84.250 + String.class 84.251 + }; 84.252 + } 84.253 + 84.254 + public String message() { 84.255 + return message; 84.256 + } 84.257 + }; 84.258 + } 84.259 + 84.260 + public Tester makeAnon(final String message) { 84.261 + return new Tester(2) { 84.262 + protected String[] names() { 84.263 + return new String[] { 84.264 + "this$1", 84.265 + "param", 84.266 + "val$message" 84.267 + }; 84.268 + } 84.269 + 84.270 + protected int[] modifiers() { 84.271 + return new int[] { 84.272 + Modifier.FINAL | MANDATED, 84.273 + Modifier.FINAL, 84.274 + Modifier.FINAL | SYNTHETIC 84.275 + }; 84.276 + } 84.277 + 84.278 + protected Class[] types() { 84.279 + return new Class[] { 84.280 + Encloser.class, 84.281 + int.class, 84.282 + String.class 84.283 + }; 84.284 + } 84.285 + 84.286 + public String message() { 84.287 + return message; 84.288 + } 84.289 + }; 84.290 + } 84.291 + } 84.292 +}
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 85.2 +++ b/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java Thu Aug 29 16:34:12 2013 -0700 85.3 @@ -0,0 +1,78 @@ 85.4 +/* 85.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 85.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 85.7 + * 85.8 + * This code is free software; you can redistribute it and/or modify it 85.9 + * under the terms of the GNU General Public License version 2 only, as 85.10 + * published by the Free Software Foundation. Oracle designates this 85.11 + * particular file as subject to the "Classpath" exception as provided 85.12 + * by Oracle in the LICENSE file that accompanied this code. 85.13 + * 85.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 85.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 85.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 85.17 + * version 2 for more details (a copy is included in the LICENSE file that 85.18 + * accompanied this code). 85.19 + * 85.20 + * You should have received a copy of the GNU General Public License version 85.21 + * 2 along with this work; if not, write to the Free Software Foundation, 85.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 85.23 + * 85.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 85.25 + * or visit www.oracle.com if you need additional information or have any 85.26 + * questions. 85.27 + */ 85.28 + 85.29 +/* 85.30 + * @test 85.31 + * @bug 8022316 85.32 + * @summary Generic throws, overriding and method reference 85.33 + * @compile/fail/ref=CompilerErrorGenericThrowPlusMethodRefTest.out -XDrawDiagnostics CompilerErrorGenericThrowPlusMethodRefTest.java 85.34 + */ 85.35 + 85.36 +@SuppressWarnings("unchecked") 85.37 +public class CompilerErrorGenericThrowPlusMethodRefTest { 85.38 + interface SAM11 { 85.39 + public <E extends Throwable> void foo() throws E ; 85.40 + } 85.41 + 85.42 + interface SAM12 extends SAM11{ 85.43 + @Override 85.44 + public void foo() throws Throwable; 85.45 + } 85.46 + 85.47 + public void boo() throws RuntimeException {} 85.48 + 85.49 + static void test1() { 85.50 + try { 85.51 + SAM12 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::boo; 85.52 + s2.foo(); 85.53 + } catch(Throwable ex) {} 85.54 + } 85.55 + 85.56 + static void test2() { 85.57 + SAM11 s1 = null; 85.58 + s1.<Exception>foo(); 85.59 + s1.<RuntimeException>foo(); 85.60 + } 85.61 + 85.62 + interface SAM21 { 85.63 + <E extends Exception> void m(E arg) throws E; 85.64 + } 85.65 + 85.66 + interface SAM22 { 85.67 + <F extends Exception> void m(F arg) throws F; 85.68 + } 85.69 + 85.70 + interface SAM23 extends SAM21, SAM22 {} 85.71 + 85.72 + public <E extends Exception> void bar(E e) throws E {} 85.73 + 85.74 + static <E extends Exception> void test3(E e) { 85.75 + try { 85.76 + SAM23 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::bar; 85.77 + s2.m(e); 85.78 + } catch(Exception ex) {} 85.79 + } 85.80 + 85.81 +}
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 86.2 +++ b/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out Thu Aug 29 16:34:12 2013 -0700 86.3 @@ -0,0 +1,2 @@ 86.4 +CompilerErrorGenericThrowPlusMethodRefTest.java:55:26: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception 86.5 +1 error
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java Thu Aug 29 16:34:12 2013 -0700 87.3 @@ -0,0 +1,58 @@ 87.4 +/* 87.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 87.7 + * 87.8 + * This code is free software; you can redistribute it and/or modify it 87.9 + * under the terms of the GNU General Public License version 2 only, as 87.10 + * published by the Free Software Foundation. Oracle designates this 87.11 + * particular file as subject to the "Classpath" exception as provided 87.12 + * by Oracle in the LICENSE file that accompanied this code. 87.13 + * 87.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 87.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 87.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 87.17 + * version 2 for more details (a copy is included in the LICENSE file that 87.18 + * accompanied this code). 87.19 + * 87.20 + * You should have received a copy of the GNU General Public License version 87.21 + * 2 along with this work; if not, write to the Free Software Foundation, 87.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 87.23 + * 87.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 87.25 + * or visit www.oracle.com if you need additional information or have any 87.26 + * questions. 87.27 + */ 87.28 + 87.29 +/* 87.30 + * @test 87.31 + * @bug 8023112 87.32 + * @summary Mixing up the method type argument with the class type for method 87.33 + * reference ClassType<Q>::<T>new 87.34 + * @compile SkipLazyConstantCreationForMethodRefTest.java 87.35 + */ 87.36 + 87.37 +public class SkipLazyConstantCreationForMethodRefTest<T> { 87.38 + SkipLazyConstantCreationForMethodRefTest(int a, boolean b) {} 87.39 + SkipLazyConstantCreationForMethodRefTest() {} 87.40 +} 87.41 + 87.42 +class SubClass<T> extends SkipLazyConstantCreationForMethodRefTest { 87.43 + SubClass(int a, boolean b) {} 87.44 +} 87.45 + 87.46 +interface SAM { 87.47 + SubClass<SkipLazyConstantCreationForMethodRefTest> m(int a, boolean b); 87.48 +} 87.49 + 87.50 +interface Tester1 { 87.51 + SAM s11 = SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new; 87.52 + SAM s12 = (SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new); 87.53 + SAM s13 = (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new; 87.54 + SAM s14 = true ? s11 : s12; 87.55 + SAM s15 = true ? s11 : (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new; 87.56 + SAM s16 = true ? (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new : s12; 87.57 +} 87.58 + 87.59 +interface Tester2 { 87.60 + SAM s21 = Tester1.s11; 87.61 +}
88.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Thu Aug 29 09:42:12 2013 -0700 88.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Thu Aug 29 16:34:12 2013 -0700 88.3 @@ -35,13 +35,16 @@ 88.4 // Test count helps identify test case in event of failure. 88.5 int testcount = 0; 88.6 88.7 - // Base test case template descriptions 88.8 + // Base test case template descriptions;true==annotations in code attribute. 88.9 enum srce { 88.10 src1("(repeating) type annotations on on field in method body",true), 88.11 src2("(repeating) type annotations on type parameters, bounds and type arguments", true), 88.12 src3("(repeating) type annotations on type parameters of class, method return value in method", true), 88.13 src4("(repeating) type annotations on field in anonymous class", false), 88.14 - src5("(repeating) type annotations on field in anonymous class", false); 88.15 + src5("(repeating) type annotations on field in anonymous class", false), 88.16 + src6("(repeating) type annotations on void method declaration", false), 88.17 + src7("(repeating) type annotations in use of instanceof", true), 88.18 + src8("(repeating) type annotations in use of instanceof in method", true); 88.19 88.20 String description; 88.21 Boolean local; 88.22 @@ -84,6 +87,12 @@ 88.23 test( 0, 8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src1); 88.24 test( 2, 0, 2, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src5); 88.25 test( 0, 2, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src5); 88.26 + test( 0, 0, 2, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src6); 88.27 + test( 0, 0, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src6); 88.28 + test( 2, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src7); 88.29 + test( 0, 2, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src7); 88.30 + test( 4, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src8); 88.31 + test( 0, 4, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src8); 88.32 break; 88.33 case "FIELD": 88.34 test( 8, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src1); 88.35 @@ -121,18 +130,6 @@ 88.36 ", ABmix=" + ABmix + ", retention: " + rtn + ", anno2: " + 88.37 et2 + ", src=" + source + "\n " + source.description; 88.38 88.39 - if( 88.40 -// 8005681 - src1,2,3 - skip cases with repeated annotations on new, array, cast. 88.41 - (( source.equals(srce.src1) || source.equals(srce.src2) || 88.42 - source.equals(srce.src3)) && (ABmix || (Arepeats && BDrepeats))) 88.43 - // 8008928 - src4,5 - this change cause crash with t-a on anon class) 88.44 - || (source.equals(srce.src4) || source.equals(srce.src5)) 88.45 - ) { 88.46 - System.out.println(testDef + 88.47 - "\n 8005681-skip repeated annotations on new,array,cast"); 88.48 - return; 88.49 - } 88.50 - 88.51 println(testDef); 88.52 // Create test source and File. 88.53 String sourceString = sourceString(tname, rtn, et2, Arepeats, 88.54 @@ -178,9 +175,7 @@ 88.55 println("Pass"); 88.56 } 88.57 88.58 - // 88.59 // Source for test cases 88.60 - // 88.61 String sourceString(String testname, String retentn, String annot2, 88.62 Boolean Arepeats, Boolean BDrepeats, Boolean ABmix, 88.63 srce src) { 88.64 @@ -359,6 +354,63 @@ 88.65 hasInnerClass=true; 88.66 innerClassname="$1"; 88.67 break; 88.68 + case src6: // (repeating)annotations on void method declaration 88.69 + /* 88.70 + * class Test95{ 88.71 + * @A @A @B @B public void test() { }; 88.72 + * } 88.73 + */ 88.74 + source = new String( source + 88.75 + "// " + src.description + "\n" + 88.76 + "class "+ testname + "{\n" + 88.77 + " _As_ _Bs_ public void test() { }\n" + 88.78 + "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) + 88.79 + "\n\n"; 88.80 + hasInnerClass=false; 88.81 + break; 88.82 + case src7: // (repeating) type annotations in use of instanceof 88.83 + /* 88.84 + * class Test10{ 88.85 + * String data = "test"; 88.86 + * boolean dataIsString = ( data instanceof @A @B @A @B String); 88.87 + * } 88.88 + */ 88.89 + source = new String( source + 88.90 + "// " + src.description + "\n" + 88.91 + "class "+ testname + "{\n" + 88.92 + " String data = \"test\";\n" + 88.93 + " boolean dataIsString = ( data instanceof _As_ _Bs_ String);\n" + 88.94 + "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) + 88.95 + "\n\n"; 88.96 + hasInnerClass=false; 88.97 + break; 88.98 + case src8: // (repeating) type annotations in use of instanceof 88.99 + /* 88.100 + * class Test20{ 88.101 + * String data = "test"; 88.102 + * Boolean isString() { 88.103 + * if( data instanceof @A @B @A @B String ) 88.104 + * return true; 88.105 + * else 88.106 + * return( data instanceof @A @B @A @B String ); 88.107 + * } 88.108 + * } 88.109 + */ 88.110 + source = new String( source + 88.111 + "// " + src.description + "\n" + 88.112 + "class "+ testname + "{\n" + 88.113 + " String data = \"test\";\n" + 88.114 + " Boolean isString() { \n" + 88.115 + " if( data instanceof _As_ _Bs_ String )\n" + 88.116 + " return true;\n" + 88.117 + " else\n" + 88.118 + " return( data instanceof _As_ _Bs_ String );\n" + 88.119 + " }\n" + 88.120 + "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) + 88.121 + "\n\n"; 88.122 + hasInnerClass=false; 88.123 + break; 88.124 + 88.125 } 88.126 return imports + source; 88.127 }
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/DummyProcessor.java Thu Aug 29 16:34:12 2013 -0700 89.3 @@ -0,0 +1,43 @@ 89.4 +/* 89.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 89.7 + * 89.8 + * This code is free software; you can redistribute it and/or modify it 89.9 + * under the terms of the GNU General Public License version 2 only, as 89.10 + * published by the Free Software Foundation. 89.11 + * 89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 89.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 89.15 + * version 2 for more details (a copy is included in the LICENSE file that 89.16 + * accompanied this code). 89.17 + * 89.18 + * You should have received a copy of the GNU General Public License version 89.19 + * 2 along with this work; if not, write to the Free Software Foundation, 89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 89.21 + * 89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 89.23 + * or visit www.oracle.com if you need additional information or have any 89.24 + * questions. 89.25 + */ 89.26 + 89.27 +import javax.annotation.processing.*; 89.28 +import javax.lang.model.SourceVersion; 89.29 +import javax.lang.model.element.TypeElement; 89.30 + 89.31 +import java.util.Set; 89.32 + 89.33 +/* A simple annotation processor. */ 89.34 +@SupportedAnnotationTypes("*") 89.35 +public class DummyProcessor extends AbstractProcessor { 89.36 + @Override 89.37 + public SourceVersion getSupportedSourceVersion() { 89.38 + return SourceVersion.latest(); 89.39 + } 89.40 + 89.41 + @Override 89.42 + public final boolean process(Set<? extends TypeElement> annotations, 89.43 + RoundEnvironment roundEnv) { 89.44 + return false; 89.45 + } 89.46 +}
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 90.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/T8020715.java Thu Aug 29 16:34:12 2013 -0700 90.3 @@ -0,0 +1,49 @@ 90.4 +/* 90.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 90.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 90.7 + * 90.8 + * This code is free software; you can redistribute it and/or modify it 90.9 + * under the terms of the GNU General Public License version 2 only, as 90.10 + * published by the Free Software Foundation. 90.11 + * 90.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 90.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 90.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 90.15 + * version 2 for more details (a copy is included in the LICENSE file that 90.16 + * accompanied this code). 90.17 + * 90.18 + * You should have received a copy of the GNU General Public License version 90.19 + * 2 along with this work; if not, write to the Free Software Foundation, 90.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 90.21 + * 90.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 90.23 + * or visit www.oracle.com if you need additional information or have any 90.24 + * questions. 90.25 + */ 90.26 + 90.27 +/* 90.28 + * @test 90.29 + * @summary Regression: compiling program with lambda crashed compiler 90.30 + * @bug 8020715 90.31 + * @compile T8020715.java 90.32 + */ 90.33 +class T8020715 { 90.34 + // This crashed. 90.35 + private static void makeTask1() { 90.36 + class LocalClass { 90.37 + private Runnable r = () -> {}; 90.38 + } 90.39 + } 90.40 + 90.41 + // This crashed, too. 90.42 + private void makeTask2() { 90.43 + class LocalClass { 90.44 + private Runnable r = () -> {}; 90.45 + } 90.46 + } 90.47 + 90.48 + // This is fine. 90.49 + private class InnerClass { 90.50 + private Runnable r = () -> {}; 90.51 + } 90.52 +}
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 91.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java Thu Aug 29 16:34:12 2013 -0700 91.3 @@ -0,0 +1,44 @@ 91.4 +/* 91.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 91.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 91.7 + * 91.8 + * This code is free software; you can redistribute it and/or modify it 91.9 + * under the terms of the GNU General Public License version 2 only, as 91.10 + * published by the Free Software Foundation. 91.11 + * 91.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 91.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 91.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 91.15 + * version 2 for more details (a copy is included in the LICENSE file that 91.16 + * accompanied this code). 91.17 + * 91.18 + * You should have received a copy of the GNU General Public License version 91.19 + * 2 along with this work; if not, write to the Free Software Foundation, 91.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 91.21 + * 91.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 91.23 + * or visit www.oracle.com if you need additional information or have any 91.24 + * questions. 91.25 + */ 91.26 + 91.27 +/* 91.28 + * @test 91.29 + * @bug 8023768 91.30 + * @summary Type annotations on a type variable, where the bound of 91.31 + * the type variable is an annotated type variable, 91.32 + * need to be processed correctly. 91.33 + * @author Werner Dietl 91.34 + * @compile TypeVariableCycleTest.java 91.35 + */ 91.36 + 91.37 +import java.lang.annotation.*; 91.38 + 91.39 +class TypeVariableCycleTest<CTV> { 91.40 + <MTV extends @TA CTV> MTV cast(CTV p) { 91.41 + return (@TA MTV) p; 91.42 + } 91.43 +} 91.44 + 91.45 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 91.46 +@interface TA {} 91.47 +
92.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Aug 29 09:42:12 2013 -0700 92.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Aug 29 16:34:12 2013 -0700 92.3 @@ -85,4 +85,24 @@ 92.4 " } } }"; 92.5 } 92.6 92.7 + @TADescriptions({ 92.8 + @TADescription(annotation = "TA", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, 92.9 + typeIndex = 0, offset = 4), 92.10 + @TADescription(annotation = "TB", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, 92.11 + typeIndex = 0, offset = 0) 92.12 + }) 92.13 + public String generic1() { 92.14 + return "class Test { <T> Test(int i) { new <@TA T>Test(); }" + 92.15 + " <T> Test() { <@TB String>this(0); } }"; 92.16 + } 92.17 + 92.18 + @TADescriptions({ 92.19 + @TADescription(annotation = "TA", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, 92.20 + typeIndex = 0, offset = 0) 92.21 + }) 92.22 + public String generic2() { 92.23 + return "class Super { <T> Super(int i) { } } " + 92.24 + "class Test extends Super { <T> Test() { <@TA String>super(0); } }"; 92.25 + } 92.26 + 92.27 }
93.1 --- a/test/tools/javac/lambda/MethodReference66.java Thu Aug 29 09:42:12 2013 -0700 93.2 +++ b/test/tools/javac/lambda/MethodReference66.java Thu Aug 29 16:34:12 2013 -0700 93.3 @@ -24,7 +24,6 @@ 93.4 /* 93.5 * @test 93.6 * @bug 8009299 93.7 - * @ignore 8013875: Incorrect vtable index being set during methodHandle creation for static 93.8 * @summary Javac crashes when compiling method reference to static interface method 93.9 * @run main/othervm -Xverify:none MethodReference66 93.10 */
94.1 --- a/test/tools/javac/lambda/lambdaExecution/InInterface.java Thu Aug 29 09:42:12 2013 -0700 94.2 +++ b/test/tools/javac/lambda/lambdaExecution/InInterface.java Thu Aug 29 16:34:12 2013 -0700 94.3 @@ -26,7 +26,6 @@ 94.4 /** 94.5 * @test 94.6 * @bug 8003639 94.7 - * @ignore 8013875: Incorrect vtable index being set during methodHandle creation for static 94.8 * @summary convert lambda testng tests to jtreg and add them 94.9 * @run testng InInterface 94.10 */
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 95.2 +++ b/test/tools/javac/profiles/ProfileTest.java Thu Aug 29 16:34:12 2013 -0700 95.3 @@ -0,0 +1,114 @@ 95.4 +/* 95.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 95.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 95.7 + * 95.8 + * This code is free software; you can redistribute it and/or modify it 95.9 + * under the terms of the GNU General Public License version 2 only, as 95.10 + * published by the Free Software Foundation. 95.11 + * 95.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 95.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 95.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 95.15 + * version 2 for more details (a copy is included in the LICENSE file that 95.16 + * accompanied this code). 95.17 + * 95.18 + * You should have received a copy of the GNU General Public License version 95.19 + * 2 along with this work; if not, write to the Free Software Foundation, 95.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 95.21 + * 95.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 95.23 + * or visit www.oracle.com if you need additional information or have any 95.24 + * questions. 95.25 + */ 95.26 + 95.27 +/* 95.28 + * @test 95.29 + * @bug 8022287 95.30 + * @summary javac.sym.Profiles uses a static Map when it should not 95.31 + */ 95.32 + 95.33 +import java.io.File; 95.34 +import java.io.FileWriter; 95.35 +import java.io.IOException; 95.36 +import java.io.PrintWriter; 95.37 + 95.38 +import com.sun.tools.javac.sym.Profiles; 95.39 + 95.40 +public class ProfileTest { 95.41 + public static void main(String... args) throws Exception { 95.42 + new ProfileTest().run(); 95.43 + } 95.44 + 95.45 + public void run() throws Exception { 95.46 + test("A"); 95.47 + test("B"); 95.48 + 95.49 + if (errors > 0) 95.50 + throw new Exception(errors + " occurred"); 95.51 + } 95.52 + 95.53 + void test(String base) throws IOException { 95.54 + System.err.println("test " + base); 95.55 + File profileDesc = createFiles(base); 95.56 + checkProfile(profileDesc, base); 95.57 + } 95.58 + 95.59 + void checkProfile(File profileDesc, String base) throws IOException { 95.60 + Profiles p = Profiles.read(profileDesc); 95.61 + for (int i = 0; i < p.getProfileCount(); i++) { 95.62 + System.err.println(p.getPackages(i)); 95.63 + for (String pkg: p.getPackages(i)) { 95.64 + if (!pkg.endsWith(base)) 95.65 + error("unexpected package " + pkg + " for profile " + i); 95.66 + } 95.67 + } 95.68 + } 95.69 + 95.70 + File createFiles(String base) throws IOException { 95.71 + File baseDir = new File(base); 95.72 + baseDir.mkdirs(); 95.73 + for (int p = 1; p <= 4; p++) { 95.74 + String pkg = "pkg" + p + base; 95.75 + File pkgDir = new File(baseDir, pkg); 95.76 + pkgDir.mkdirs(); 95.77 + File clssFile = new File(pkgDir, pkg + "Class.java"); 95.78 + try (PrintWriter out = new PrintWriter(new FileWriter(clssFile))) { 95.79 + out.println("package " + pkgDir.getName() + ";"); 95.80 + out.println("class " + clssFile.getName().replace(".java", "")); 95.81 + } 95.82 + } 95.83 + 95.84 + File profileDesc = new File(baseDir, "profiles" + base + ".txt"); 95.85 + try (PrintWriter out = new PrintWriter(new FileWriter(profileDesc))) { 95.86 + for (int p = 1; p <= 4; p++) { 95.87 + String pkg = "pkg" + p + base; 95.88 + createPackage(baseDir, pkg, "Pkg" + p + base + "Class"); 95.89 + out.println("PROFILE_" + p + "_RTJAR_INCLUDE_PACKAGES := " + pkg); 95.90 + out.println("PROFILE_" + p + "_RTJAR_INCLUDE_TYPES :="); 95.91 + out.println("PROFILE_" + p + "_RTJAR_EXCLUDE_TYPES :="); 95.92 + out.println("PROFILE_" + p + "_INCLUDE_METAINF_SERVICES := "); 95.93 + } 95.94 + } 95.95 + 95.96 + return profileDesc; 95.97 + } 95.98 + 95.99 + void createPackage(File baseDir, String pkg, String... classNames) throws IOException { 95.100 + File pkgDir = new File(baseDir, pkg); 95.101 + pkgDir.mkdirs(); 95.102 + for (String className: classNames) { 95.103 + File clssFile = new File(pkgDir, className + ".java"); 95.104 + try (PrintWriter out = new PrintWriter(new FileWriter(clssFile))) { 95.105 + out.println("package " + pkg + ";"); 95.106 + out.println("public class " + className + " { }"); 95.107 + } 95.108 + } 95.109 + } 95.110 + 95.111 + void error(String msg) { 95.112 + System.err.println("Error: " + msg); 95.113 + errors++; 95.114 + } 95.115 + 95.116 + int errors; 95.117 +}
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 96.2 +++ b/test/tools/javac/tree/TypeAnnotationsPretty.java Thu Aug 29 16:34:12 2013 -0700 96.3 @@ -0,0 +1,169 @@ 96.4 +/* 96.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 96.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 96.7 + * 96.8 + * This code is free software; you can redistribute it and/or modify it 96.9 + * under the terms of the GNU General Public License version 2 only, as 96.10 + * published by the Free Software Foundation. 96.11 + * 96.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 96.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 96.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 96.15 + * version 2 for more details (a copy is included in the LICENSE file that 96.16 + * accompanied this code). 96.17 + * 96.18 + * You should have received a copy of the GNU General Public License version 96.19 + * 2 along with this work; if not, write to the Free Software Foundation, 96.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 96.21 + * 96.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 96.23 + * or visit www.oracle.com if you need additional information or have any 96.24 + * questions. 96.25 + */ 96.26 + 96.27 +/* 96.28 + * @test 96.29 + * @bug 8023522 96.30 + * @summary test Pretty print of type annotations 96.31 + * @author wmdietl 96.32 + */ 96.33 + 96.34 +import com.sun.source.tree.ClassTree; 96.35 +import com.sun.source.tree.CompilationUnitTree; 96.36 +import com.sun.tools.javac.api.JavacTaskImpl; 96.37 +import com.sun.tools.javac.tree.JCTree; 96.38 + 96.39 +import java.io.IOException; 96.40 +import java.net.URI; 96.41 +import java.util.Arrays; 96.42 +import java.util.List; 96.43 +import java.util.LinkedList; 96.44 + 96.45 +import javax.tools.JavaCompiler; 96.46 +import javax.tools.JavaFileObject; 96.47 +import javax.tools.SimpleJavaFileObject; 96.48 +import javax.tools.ToolProvider; 96.49 + 96.50 +public class TypeAnnotationsPretty { 96.51 + private final JavaCompiler tool; 96.52 + 96.53 + TypeAnnotationsPretty() { 96.54 + tool = ToolProvider.getSystemJavaCompiler(); 96.55 + } 96.56 + 96.57 + private List<String> matches = new LinkedList<String>(); 96.58 + private List<String> mismatches = new LinkedList<String>(); 96.59 + 96.60 + public static void main(String... args) throws Exception { 96.61 + TypeAnnotationsPretty tap = new TypeAnnotationsPretty(); 96.62 + 96.63 + tap.runField("@TA()\nObject cls = null"); 96.64 + tap.runField("@TA()\nObject cls = new @TA() Object()"); 96.65 + 96.66 + tap.runField("@TA()\nList<@TB() Object> cls = null"); 96.67 + tap.runField("@TA()\nList<@TB() Object> cls = new @TA() LinkedList<@TB() Object>()"); 96.68 + 96.69 + tap.runField("Class[] cls = null"); 96.70 + tap.runField("@TA()\nClass[] cls = null"); 96.71 + tap.runField("Class @TA() [] cls = null"); 96.72 + tap.runField("@TA()\nClass @TB() [] cls = null"); 96.73 + 96.74 + tap.runField("Class[] cls = new Class[]{Object.class}"); 96.75 + tap.runField("@TA()\nClass[] cls = new @TA() Class[]{Object.class}"); 96.76 + tap.runField("Class @TB() [] cls = new Class @TB() []{Object.class}"); 96.77 + tap.runField("@TA()\nClass @TB() [] cls = new @TA() Class @TB() []{Object.class}"); 96.78 + tap.runField("@TA()\nClass @TB() [] @TC() [] cls = new @TA() Class @TB() [10] @TC() []"); 96.79 + tap.runField("Class @TB() [] @TC() [] cls = new Class @TB() [10] @TC() []"); 96.80 + tap.runField("@TA()\nClass @TB() [] @TC() [] @TD() [] cls = new @TA() Class @TB() [10] @TC() [] @TD() []"); 96.81 + 96.82 + tap.runMethod("\n@TA()\nObject test(@TB()\nList<@TC() String> p) {\n" + 96.83 + " return null;\n" + 96.84 + "}"); 96.85 + 96.86 + 96.87 + if (!tap.matches.isEmpty()) { 96.88 + for (String m : tap.matches) 96.89 + System.out.println(m); 96.90 + } 96.91 + if (!tap.mismatches.isEmpty()) { 96.92 + for (String mm : tap.mismatches) 96.93 + System.err.println(mm + NL); 96.94 + throw new RuntimeException("Tests failed!"); 96.95 + } 96.96 + } 96.97 + 96.98 + private static final String prefix = 96.99 + "import java.lang.annotation.*;" + 96.100 + "import java.util.*;" + 96.101 + "public class Test {"; 96.102 + 96.103 + private static final String postfix = 96.104 + "@Target(ElementType.TYPE_USE)" + 96.105 + "@interface TA {}" + 96.106 + "@Target(ElementType.TYPE_USE)" + 96.107 + "@interface TB {}" + 96.108 + "@Target(ElementType.TYPE_USE)" + 96.109 + "@interface TC {}" + 96.110 + "@Target(ElementType.TYPE_USE)" + 96.111 + "@interface TD {}"; 96.112 + 96.113 + private static final String NL = System.getProperty("line.separator"); 96.114 + 96.115 + private void runField(String code) throws IOException { 96.116 + String src = prefix + 96.117 + code + "; }" + 96.118 + postfix; 96.119 + 96.120 + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null, 96.121 + null, Arrays.asList(new MyFileObject(src))); 96.122 + 96.123 + for (CompilationUnitTree cut : ct.parse()) { 96.124 + JCTree.JCVariableDecl var = 96.125 + (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0); 96.126 + checkMatch(code, var); 96.127 + } 96.128 + } 96.129 + 96.130 + private void runMethod(String code) throws IOException { 96.131 + String src = prefix + 96.132 + code + "}" + 96.133 + postfix; 96.134 + 96.135 + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null, 96.136 + null, Arrays.asList(new MyFileObject(src))); 96.137 + 96.138 + 96.139 + for (CompilationUnitTree cut : ct.parse()) { 96.140 + JCTree.JCMethodDecl meth = 96.141 + (JCTree.JCMethodDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0); 96.142 + checkMatch(code, meth); 96.143 + } 96.144 + } 96.145 + 96.146 + void checkMatch(String code, JCTree tree) { 96.147 + String expect = code.replace("\n", NL); 96.148 + String found = tree.toString(); 96.149 + if (!expect.equals(found)) { 96.150 + mismatches.add("Expected: " + expect + NL + 96.151 + "Obtained: " + found); 96.152 + } else { 96.153 + matches.add("Passed: " + expect); 96.154 + } 96.155 + } 96.156 +} 96.157 + 96.158 + 96.159 +class MyFileObject extends SimpleJavaFileObject { 96.160 + 96.161 + private String text; 96.162 + 96.163 + public MyFileObject(String text) { 96.164 + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); 96.165 + this.text = text; 96.166 + } 96.167 + 96.168 + @Override 96.169 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 96.170 + return text; 96.171 + } 96.172 +}
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 97.2 +++ b/test/tools/javadoc/nonConstExprs/Test.java Thu Aug 29 16:34:12 2013 -0700 97.3 @@ -0,0 +1,62 @@ 97.4 +/* 97.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 97.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 97.7 + * 97.8 + * This code is free software; you can redistribute it and/or modify it 97.9 + * under the terms of the GNU General Public License version 2 only, as 97.10 + * published by the Free Software Foundation. 97.11 + * 97.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 97.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 97.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 97.15 + * version 2 for more details (a copy is included in the LICENSE file that 97.16 + * accompanied this code). 97.17 + * 97.18 + * You should have received a copy of the GNU General Public License version 97.19 + * 2 along with this work; if not, write to the Free Software Foundation, 97.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 97.21 + * 97.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 97.23 + * or visit www.oracle.com if you need additional information or have any 97.24 + * questions. 97.25 + */ 97.26 + 97.27 +/** 97.28 + * @test 97.29 + * @bug 8010310 97.30 + * @summary Error processing sources with -private 97.31 + */ 97.32 + 97.33 +import java.io.File; 97.34 + 97.35 +public class Test { 97.36 + public static void main(String... args) throws Exception { 97.37 + File testSrc = new File(System.getProperty("test.src")); 97.38 + String[] jdoc_args = { 97.39 + "-d", "out", 97.40 + new File(testSrc, Test.class.getSimpleName() + ".java").getPath() 97.41 + }; 97.42 + int rc = com.sun.tools.javadoc.Main.execute(jdoc_args); 97.43 + if (rc != 0) 97.44 + throw new Exception("unexpected return code from javadoc: " + rc); 97.45 + } 97.46 + 97.47 + static int array[] = { 1, 2, 3}; 97.48 + static int method(int p) { return p; } 97.49 + static int value = 0; 97.50 + 97.51 + public int not_static_not_final = 1; 97.52 + public static int static_not_final = 2; 97.53 + public final int not_static_final = 3; 97.54 + public static final int static_final = 4; 97.55 + 97.56 + public static final int array_index = array[0]; 97.57 + public static final int method_call = method(0); 97.58 + public static final int inner_class = new Test() { }.method(0); 97.59 + public static final int new_class = new Test().method(0); 97.60 + public static final int pre_inc = ++value; 97.61 + public static final int pre_dec = --value; 97.62 + public static final int post_inc = value++; 97.63 + public static final int post_dec = value--; 97.64 +} 97.65 +