# HG changeset patch
# User lana
# Date 1377819252 25200
# Node ID fcd768844b9926c5f994292ec6350c20cc7c0f76
# Parent e431c9bfb171317e55095207887cbd17f6a5e139# Parent 96b6865eda949646586d187a6658c32b036e75f2
Merge
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/source/tree/MethodTree.java
--- a/src/share/classes/com/sun/source/tree/MethodTree.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/source/tree/MethodTree.java Thu Aug 29 16:34:12 2013 -0700
@@ -53,7 +53,15 @@
Tree getReturnType();
List extends TypeParameterTree> getTypeParameters();
List extends VariableTree> getParameters();
+
+ /**
+ * Return an explicit receiver parameter ("this" parameter).
+ *
+ * @return an explicit receiver parameter ("this" parameter)
+ * @since 1.8
+ */
VariableTree getReceiverParameter();
+
List extends ExpressionTree> getThrows();
BlockTree getBody();
Tree getDefaultValue(); // for annotation types
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/source/tree/TypeParameterTree.java
--- a/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Aug 29 16:34:12 2013 -0700
@@ -36,6 +36,8 @@
* name
*
* name extends bounds
+ *
+ * annotationsname
*
*
* @jls section 4.4
@@ -48,5 +50,17 @@
public interface TypeParameterTree extends Tree {
Name getName();
List extends Tree> getBounds();
+
+ /**
+ * Return annotations on the type parameter declaration.
+ *
+ * Annotations need Target meta-annotations of
+ * {@link java.lang.annotation.ElementType#TYPE_PARAMETER} or
+ * {@link java.lang.annotation.ElementType#TYPE_USE}
+ * to appear in this position.
+ *
+ * @return annotations on the type parameter declaration
+ * @since 1.8
+ */
List extends AnnotationTree> getAnnotations();
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -102,7 +102,7 @@
configuration.standardmessage.
error("doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 29 16:34:12 2013 -0700
@@ -304,7 +304,7 @@
subDiv.addContent(div);
} catch (Exception e) {
e.printStackTrace();
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -218,7 +218,7 @@
configuration.standardmessage.
error("doclet.exception_encountered",
exc.toString(), path.getPath());
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Aug 29 16:34:12 2013 -0700
@@ -610,7 +610,7 @@
subDiv.addContent(div);
} catch (Exception e) {
e.printStackTrace();
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -127,7 +127,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -87,7 +87,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -72,7 +72,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Aug 29 16:34:12 2013 -0700
@@ -196,7 +196,7 @@
}
} catch (Exception e) {
e.printStackTrace();
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
}
@@ -332,7 +332,7 @@
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered",
exc.toString());
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -411,7 +411,7 @@
head.addContent(headComment);
}
if (configuration.charset.length() > 0) {
- Content meta = HtmlTree.META("Content-Type", "text/html",
+ Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
configuration.charset);
head.addContent(meta);
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -109,7 +109,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -71,7 +71,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -98,7 +98,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -105,7 +105,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), path.getPath());
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -106,7 +106,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -74,7 +74,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -115,7 +115,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -75,7 +75,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename.getPath());
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
* is not supported.
*/
public void addContent(Content content) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
@@ -75,7 +75,7 @@
* is not supported.
*/
public void addContent(String stringContent) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@
* is not supported.
*/
public void addContent(Content content) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
@@ -82,7 +82,7 @@
* is not supported.
*/
public void addContent(String stringContent) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java Thu Aug 29 16:34:12 2013 -0700
@@ -40,7 +40,6 @@
BORDER,
CELLPADDING,
CELLSPACING,
- CHARSET,
CLASS,
CLEAR,
COLS,
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -53,6 +53,8 @@
*/
public abstract class HtmlDocWriter extends HtmlWriter {
+ public static final String CONTENT_TYPE = "text/html";
+
/**
* Constructor. Initializes the destination file name through the super
* class HtmlWriter.
@@ -194,7 +196,7 @@
head.addContent(headComment);
}
if (configuration.charset.length() > 0) {
- Content meta = HtmlTree.META("Content-Type", "text/html",
+ Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
configuration.charset);
head.addContent(meta);
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -91,7 +91,7 @@
* is not supported.
*/
public void addContent(String stringContent) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Aug 29 16:34:12 2013 -0700
@@ -456,9 +456,9 @@
*/
public static HtmlTree META(String httpEquiv, String content, String charSet) {
HtmlTree htmltree = new HtmlTree(HtmlTag.META);
+ String contentCharset = content + "; charset=" + charSet;
htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
- htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
- htmltree.addAttr(HtmlAttr.CHARSET, nullCheck(charSet));
+ htmltree.addAttr(HtmlAttr.CONTENT, contentCharset);
return htmltree;
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Thu Aug 29 16:34:12 2013 -0700
@@ -65,7 +65,7 @@
* is not supported.
*/
public void addContent(Content content) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
@@ -77,7 +77,7 @@
* is not supported.
*/
public void addContent(String stringContent) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Thu Aug 29 16:34:12 2013 -0700
@@ -72,7 +72,7 @@
*/
@Override
public void addContent(Content content) {
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
/**
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Aug 29 16:34:12 2013 -0700
@@ -539,7 +539,7 @@
initProfiles();
initProfilePackages();
} catch (Exception e) {
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
setSpecificDocletOptions(root.options());
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Thu Aug 29 16:34:12 2013 -0700
@@ -55,7 +55,7 @@
write(out, true);
} catch (IOException e) {
// cannot happen from StringWriter
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
return out.toString();
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -138,7 +138,7 @@
} catch (NoSuchMethodException e) {
e.printStackTrace();
configuration.root.printError("Unknown element: " + component);
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
} catch (InvocationTargetException e) {
e.getCause().printStackTrace();
} catch (Exception e) {
@@ -146,7 +146,7 @@
configuration.root.printError("Exception " +
e.getClass().getName() +
" thrown while processing element: " + component);
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@
*/
public void build() throws DocletAbortException {
//You may not call the build method in a subbuilder.
- throw new DocletAbortException();
+ throw new DocletAbortException("not supported");
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
return xmlElementsMap.get(root);
} catch (Throwable t) {
t.printStackTrace();
- throw new DocletAbortException();
+ throw new DocletAbortException(t);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
return;
}
} catch (Exception e) {
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
build(layoutParser.parseXML(NAME), contentTree);
writer.close();
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java Thu Aug 29 16:34:12 2013 -0700
@@ -126,7 +126,7 @@
return (FieldDoc) tag.holder();
} else {
//This should never ever happen.
- throw new DocletAbortException();
+ throw new DocletAbortException("should not happen");
}
}
StringTokenizer st = new StringTokenizer(name, "#");
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -452,7 +452,7 @@
} else if (doc instanceof Parameter) {
annotations = ((Parameter) doc).annotations();
} else {
- throw new DocletAbortException();
+ throw new DocletAbortException("should not happen");
}
for (int i = 0; i < annotations.length; i++) {
AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -197,7 +197,7 @@
}
} catch (IOException e) {
e.printStackTrace(System.err);
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,11 @@
public class DocletAbortException extends RuntimeException {
private static final long serialVersionUID = -9131058909576418984L;
- public DocletAbortException() {
+ public DocletAbortException(String message) {
+ super(message);
+ }
+
+ public DocletAbortException(Throwable cause) {
+ super(cause);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
} catch (IOException exc) {
configuration.message.error("doclet.exception_encountered",
exc.toString(), DocPaths.PACKAGE_LIST);
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
Path dir = fileManager.getDefaultFileSystem().getPath(dirName);
fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
} catch (IOException e) {
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -269,7 +269,7 @@
configuration.message.error(
"doclet.Unable_to_create_directory_0", dir.getPath());
- throw new DocletAbortException();
+ throw new DocletAbortException("can't create directory");
}
/** Return a string to identify the contents of this object,
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@
File dir = new File(dirName);
fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
} catch (IOException e) {
- throw new DocletAbortException();
+ throw new DocletAbortException(e);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Thu Aug 29 16:34:12 2013 -0700
@@ -241,9 +241,9 @@
first = false;
}
} catch (SecurityException exc) {
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
} catch (IOException exc) {
- throw new DocletAbortException();
+ throw new DocletAbortException(exc);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/doclint/HtmlTag.java
--- a/src/share/classes/com/sun/tools/doclint/HtmlTag.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclint/HtmlTag.java Thu Aug 29 16:34:12 2013 -0700
@@ -42,12 +42,14 @@
*
* The intent of this class is to embody the semantics of W3C HTML 4.01
* to the extent supported/used by javadoc.
+ * In time, we may wish to transition javadoc and doclint to using HTML 5.
*
* This is derivative of com.sun.tools.doclets.formats.html.markup.HtmlTag.
* Eventually, these two should be merged back together, and possibly made
* public.
*
* @see HTML 4.01 Specification
+ * @see HTML 5 Specification
* @author Bhavesh Patel
* @author Jonathan Gibbons (revised)
*/
@@ -119,7 +121,8 @@
HEAD(BlockType.OTHER, EndKind.REQUIRED),
- HR(BlockType.BLOCK, EndKind.NONE),
+ HR(BlockType.BLOCK, EndKind.NONE,
+ attrs(AttrKind.OK, WIDTH)), // OK in 4.01; not allowed in 5
HTML(BlockType.OTHER, EndKind.REQUIRED),
@@ -152,7 +155,7 @@
OL(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
- attrs(AttrKind.USE_CSS, START, TYPE)){
+ attrs(AttrKind.OK, START, TYPE)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == LI);
@@ -196,8 +199,8 @@
TABLE(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER,
- CELLPADDING, CELLSPACING),
- attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)) {
+ CELLPADDING, CELLSPACING, WIDTH), // width OK in 4.01; not allowed in 5
+ attrs(AttrKind.USE_CSS, ALIGN, BGCOLOR)) {
@Override
public boolean accepts(HtmlTag t) {
switch (t) {
@@ -267,7 +270,7 @@
UL(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
- attrs(AttrKind.USE_CSS, COMPACT, TYPE)){
+ attrs(AttrKind.OK, COMPACT, TYPE)) { // OK in 4.01; not allowed in 5
@Override
public boolean accepts(HtmlTag t) {
return (t == LI);
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/code/Printer.java
--- a/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Aug 29 16:34:12 2013 -0700
@@ -27,8 +27,6 @@
import java.util.Locale;
-import javax.lang.model.type.TypeKind;
-
import com.sun.tools.javac.api.Messages;
import com.sun.tools.javac.code.Type.AnnotatedType;
import com.sun.tools.javac.code.Type.ArrayType;
@@ -191,7 +189,7 @@
void printBaseElementType(Type t, StringBuilder sb, Locale locale) {
Type arrel = t;
- while (arrel.getKind() == TypeKind.ARRAY) {
+ while (arrel.hasTag(TypeTag.ARRAY)) {
arrel = arrel.unannotatedType();
arrel = ((ArrayType) arrel).elemtype;
}
@@ -200,7 +198,7 @@
void printBrackets(Type t, StringBuilder sb, Locale locale) {
Type arrel = t;
- while (arrel.getKind() == TypeKind.ARRAY) {
+ while (arrel.hasTag(TypeTag.ARRAY)) {
if (arrel.isAnnotated()) {
sb.append(' ');
sb.append(arrel.getAnnotationMirrors());
@@ -264,12 +262,12 @@
public String visitAnnotatedType(AnnotatedType t, Locale locale) {
if (t.typeAnnotations != null &&
t.typeAnnotations.nonEmpty()) {
- if (t.underlyingType.getKind() == TypeKind.ARRAY) {
+ if (t.underlyingType.hasTag(TypeTag.ARRAY)) {
StringBuilder res = new StringBuilder();
printBaseElementType(t, res, locale);
printBrackets(t, res, locale);
return res.toString();
- } else if (t.underlyingType.getKind() == TypeKind.DECLARED &&
+ } else if (t.underlyingType.hasTag(TypeTag.CLASS) &&
t.underlyingType.getEnclosingType() != Type.noType) {
return visit(t.underlyingType.getEnclosingType(), locale) +
". " +
@@ -348,7 +346,7 @@
args = args.tail;
buf.append(',');
}
- if (args.head.unannotatedType().getKind() == TypeKind.ARRAY) {
+ if (args.head.unannotatedType().hasTag(TypeTag.ARRAY)) {
buf.append(visit(((ArrayType) args.head.unannotatedType()).elemtype, locale));
if (args.head.getAnnotationMirrors().nonEmpty()) {
buf.append(' ');
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/code/Symbol.java
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Aug 29 16:34:12 2013 -0700
@@ -1179,7 +1179,7 @@
/**
* The variable's constant value, if this is a constant.
* Before the constant value is evaluated, it points to an
- * initalizer environment. If this is not a constant, it can
+ * initializer environment. If this is not a constant, it can
* be used for other stuff.
*/
private Object data;
@@ -1231,6 +1231,9 @@
/** The extra (synthetic/mandated) parameters of the method. */
public List extraParams = List.nil();
+ /** The captured local variables in an anonymous class */
+ public List capturedLocals = List.nil();
+
/** The parameters of the method. */
public List params = null;
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Aug 29 16:34:12 2013 -0700
@@ -29,6 +29,8 @@
import javax.lang.model.element.ElementKind;
import javax.lang.model.type.TypeKind;
+import javax.tools.JavaFileObject;
+
import com.sun.tools.javac.code.Attribute;
import com.sun.tools.javac.code.Attribute.TypeCompound;
import com.sun.tools.javac.code.Flags;
@@ -52,12 +54,16 @@
import com.sun.tools.javac.code.Symbol.MethodSymbol;
import com.sun.tools.javac.comp.Annotate;
import com.sun.tools.javac.comp.Annotate.Annotator;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.TreeInfo;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCLambda;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
import com.sun.tools.javac.tree.JCTree.JCNewClass;
import com.sun.tools.javac.tree.JCTree.JCTypeApply;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
@@ -90,11 +96,17 @@
* later processing.
*/
public static void organizeTypeAnnotationsSignatures(final Symtab syms, final Names names,
- final Log log, final JCClassDecl tree, Annotate annotate) {
+ final Log log, final Env env, final JCClassDecl tree, final Annotate annotate) {
annotate.afterRepeated( new Annotator() {
@Override
public void enterAnnotation() {
- new TypeAnnotationPositions(syms, names, log, true).scan(tree);
+ JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
+
+ try {
+ new TypeAnnotationPositions(syms, names, log, true).scan(tree);
+ } finally {
+ log.useSource(oldSource);
+ }
}
} );
}
@@ -906,7 +918,14 @@
if (!invocation.typeargs.contains(tree)) {
Assert.error("{" + tree + "} is not an argument in the invocation: " + invocation);
}
- p.type = TargetType.METHOD_INVOCATION_TYPE_ARGUMENT;
+ MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect());
+ if (exsym == null) {
+ Assert.error("could not determine symbol for {" + invocation + "}");
+ } else if (exsym.isConstructor()) {
+ p.type = TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
+ } else {
+ p.type = TargetType.METHOD_INVOCATION_TYPE_ARGUMENT;
+ }
p.pos = invocation.pos;
p.type_index = invocation.typeargs.indexOf(tree);
return;
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/code/Types.java
--- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java Thu Aug 29 16:34:12 2013 -0700
@@ -505,12 +505,27 @@
//merge thrown types - form the intersection of all the thrown types in
//all the signatures in the list
+ boolean toErase = !bestSoFar.type.hasTag(FORALL);
List thrown = null;
- for (Symbol msym1 : methodSyms) {
- Type mt1 = memberType(origin.type, msym1);
+ Type mt1 = memberType(origin.type, bestSoFar);
+ for (Symbol msym2 : methodSyms) {
+ Type mt2 = memberType(origin.type, msym2);
+ List thrown_mt2 = mt2.getThrownTypes();
+ if (toErase) {
+ thrown_mt2 = erasure(thrown_mt2);
+ } else {
+ /* If bestSoFar is generic then all the methods are generic.
+ * The opposite is not true: a non generic method can override
+ * a generic method (raw override) so it's safe to cast mt1 and
+ * mt2 to ForAll.
+ */
+ ForAll fa1 = (ForAll)mt1;
+ ForAll fa2 = (ForAll)mt2;
+ thrown_mt2 = subst(thrown_mt2, fa2.tvars, fa1.tvars);
+ }
thrown = (thrown == null) ?
- mt1.getThrownTypes() :
- chk.intersect(mt1.getThrownTypes(), thrown);
+ thrown_mt2 :
+ chk.intersect(thrown_mt2, thrown);
}
final List thrown1 = thrown;
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/comp/Attr.java
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 29 16:34:12 2013 -0700
@@ -1063,9 +1063,7 @@
if (tree.init != null) {
if ((v.flags_field & FINAL) != 0 &&
- !tree.init.hasTag(NEWCLASS) &&
- !tree.init.hasTag(LAMBDA) &&
- !tree.init.hasTag(REFERENCE)) {
+ memberEnter.needsLazyConstValue(tree.init)) {
// In this case, `v' is final. Ensure that it's initializer is
// evaluated.
v.getConstValue(); // ensure initializer is evaluated
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/comp/Check.java
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Aug 29 16:34:12 2013 -0700
@@ -2216,11 +2216,11 @@
if (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0)
return;
if (seen.contains(t)) {
- tv = (TypeVar)t;
+ tv = (TypeVar)t.unannotatedType();
tv.bound = types.createErrorType(t);
log.error(pos, "cyclic.inheritance", t);
} else if (t.hasTag(TYPEVAR)) {
- tv = (TypeVar)t;
+ tv = (TypeVar)t.unannotatedType();
seen = seen.prepend(tv);
for (Type b : types.getBounds(tv))
checkNonCyclic1(pos, b, seen);
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Aug 29 16:34:12 2013 -0700
@@ -249,7 +249,7 @@
MethodType lambdaType = (MethodType) sym.type;
{
- MethodSymbol owner = (MethodSymbol) localContext.owner;
+ Symbol owner = localContext.owner;
ListBuffer ownerTypeAnnos = new ListBuffer();
ListBuffer lambdaTypeAnnos = new ListBuffer();
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/comp/Lower.java
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Aug 29 16:34:12 2013 -0700
@@ -2735,9 +2735,9 @@
for (List l = fvs; l.nonEmpty(); l = l.tail) {
if (TreeInfo.isInitialConstructor(tree)) {
final Name pName = proxyName(l.head.name);
- m.extraParams =
- m.extraParams.append((VarSymbol)
- (proxies.lookup(pName).sym));
+ m.capturedLocals =
+ m.capturedLocals.append((VarSymbol)
+ (proxies.lookup(pName).sym));
added = added.prepend(
initField(tree.body.pos, pName));
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
--- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Aug 29 16:34:12 2013 -0700
@@ -677,8 +677,7 @@
if (tree.init != null) {
v.flags_field |= HASINIT;
if ((v.flags_field & FINAL) != 0 &&
- !tree.init.hasTag(NEWCLASS) &&
- !tree.init.hasTag(LAMBDA)) {
+ needsLazyConstValue(tree.init)) {
Env initEnv = getInitEnv(tree, env);
initEnv.info.enclVar = v;
v.setLazyConstValue(initEnv(tree, initEnv), attr, tree.init);
@@ -700,6 +699,59 @@
}
}
+ public boolean needsLazyConstValue(JCTree tree) {
+ InitTreeVisitor initTreeVisitor = new InitTreeVisitor();
+ tree.accept(initTreeVisitor);
+ return initTreeVisitor.result;
+ }
+
+ /** Visitor class for expressions which might be constant expressions.
+ */
+ static class InitTreeVisitor extends JCTree.Visitor {
+
+ private boolean result = true;
+
+ @Override
+ public void visitTree(JCTree tree) {}
+
+ @Override
+ public void visitNewClass(JCNewClass that) {
+ result = false;
+ }
+
+ @Override
+ public void visitLambda(JCLambda that) {
+ result = false;
+ }
+
+ @Override
+ public void visitReference(JCMemberReference that) {
+ result = false;
+ }
+
+ @Override
+ public void visitSelect(JCFieldAccess tree) {
+ tree.selected.accept(this);
+ }
+
+ @Override
+ public void visitConditional(JCConditional tree) {
+ tree.cond.accept(this);
+ tree.truepart.accept(this);
+ tree.falsepart.accept(this);
+ }
+
+ @Override
+ public void visitParens(JCParens tree) {
+ tree.expr.accept(this);
+ }
+
+ @Override
+ public void visitTypeCast(JCTypeCast tree) {
+ tree.expr.accept(this);
+ }
+ }
+
/** Create a fresh environment for a variable's initializer.
* If the variable is a field, the owner of the environment's scope
* is be the variable itself, otherwise the owner is the method
@@ -1089,7 +1141,7 @@
}
}
if (allowTypeAnnos) {
- TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate);
+ TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, env, tree, annotate);
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/comp/Resolve.java
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Aug 29 16:34:12 2013 -0700
@@ -1859,7 +1859,10 @@
}
}
- /** Find qualified member type.
+
+ /**
+ * Find a type declared in a scope (not inherited). Return null
+ * if none is found.
* @param env The current environment.
* @param site The original type from where the selection takes
* place.
@@ -1868,12 +1871,10 @@
* always a superclass or implemented interface of
* site's class.
*/
- Symbol findMemberType(Env env,
- Type site,
- Name name,
- TypeSymbol c) {
- Symbol bestSoFar = typeNotFound;
- Symbol sym;
+ Symbol findImmediateMemberType(Env env,
+ Type site,
+ Name name,
+ TypeSymbol c) {
Scope.Entry e = c.members().lookup(name);
while (e.scope != null) {
if (e.sym.kind == TYP) {
@@ -1883,6 +1884,24 @@
}
e = e.next();
}
+ return typeNotFound;
+ }
+
+ /** Find a member type inherited from a superclass or interface.
+ * @param env The current environment.
+ * @param site The original type from where the selection takes
+ * place.
+ * @param name The type's name.
+ * @param c The class to search for the member type. This is
+ * always a superclass or implemented interface of
+ * site's class.
+ */
+ Symbol findInheritedMemberType(Env env,
+ Type site,
+ Name name,
+ TypeSymbol c) {
+ Symbol bestSoFar = typeNotFound;
+ Symbol sym;
Type st = types.supertype(c.type);
if (st != null && st.hasTag(CLASS)) {
sym = findMemberType(env, site, name, st.tsym);
@@ -1901,6 +1920,28 @@
return bestSoFar;
}
+ /** Find qualified member type.
+ * @param env The current environment.
+ * @param site The original type from where the selection takes
+ * place.
+ * @param name The type's name.
+ * @param c The class to search for the member type. This is
+ * always a superclass or implemented interface of
+ * site's class.
+ */
+ Symbol findMemberType(Env env,
+ Type site,
+ Name name,
+ TypeSymbol c) {
+ Symbol sym = findImmediateMemberType(env, site, name, c);
+
+ if (sym != typeNotFound)
+ return sym;
+
+ return findInheritedMemberType(env, site, name, c);
+
+ }
+
/** Find a global type in given scope and load corresponding class.
* @param env The current environment.
* @param scope The scope in which to look for the type.
@@ -1919,6 +1960,21 @@
return bestSoFar;
}
+ Symbol findTypeVar(Env env, Name name, boolean staticOnly) {
+ for (Scope.Entry e = env.info.scope.lookup(name);
+ e.scope != null;
+ e = e.next()) {
+ if (e.sym.kind == TYP) {
+ if (staticOnly &&
+ e.sym.type.hasTag(TYPEVAR) &&
+ e.sym.owner.kind == TYP)
+ return new StaticError(e.sym);
+ return e.sym;
+ }
+ }
+ return typeNotFound;
+ }
+
/** Find an unqualified type symbol.
* @param env The current environment.
* @param name The type's name.
@@ -1929,19 +1985,26 @@
boolean staticOnly = false;
for (Env env1 = env; env1.outer != null; env1 = env1.outer) {
if (isStatic(env1)) staticOnly = true;
- for (Scope.Entry e = env1.info.scope.lookup(name);
- e.scope != null;
- e = e.next()) {
- if (e.sym.kind == TYP) {
- if (staticOnly &&
- e.sym.type.hasTag(TYPEVAR) &&
- e.sym.owner.kind == TYP) return new StaticError(e.sym);
- return e.sym;
- }
+ // First, look for a type variable and the first member type
+ final Symbol tyvar = findTypeVar(env1, name, staticOnly);
+ sym = findImmediateMemberType(env1, env1.enclClass.sym.type,
+ name, env1.enclClass.sym);
+
+ // Return the type variable if we have it, and have no
+ // immediate member, OR the type variable is for a method.
+ if (tyvar != typeNotFound) {
+ if (sym == typeNotFound ||
+ (tyvar.kind == TYP && tyvar.exists() &&
+ tyvar.owner.kind == MTH))
+ return tyvar;
}
- sym = findMemberType(env1, env1.enclClass.sym.type, name,
- env1.enclClass.sym);
+ // If the environment is a class def, finish up,
+ // otherwise, do the entire findMemberType
+ if (sym == typeNotFound)
+ sym = findInheritedMemberType(env1, env1.enclClass.sym.type,
+ name, env1.enclClass.sym);
+
if (staticOnly && sym.kind == TYP &&
sym.type.hasTag(CLASS) &&
sym.type.getEnclosingType().hasTag(CLASS) &&
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Aug 29 16:34:12 2013 -0700
@@ -657,6 +657,14 @@
databuf.appendChar(pool.put(s.name));
databuf.appendChar(flags);
}
+ // Now write the captured locals
+ for (VarSymbol s : m.capturedLocals) {
+ final int flags =
+ ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
+ ((int) m.flags() & SYNTHETIC);
+ databuf.appendChar(pool.put(s.name));
+ databuf.appendChar(flags);
+ }
endAttr(attrIndex);
return 1;
} else
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Aug 29 16:34:12 2013 -0700
@@ -446,7 +446,7 @@
}
if (target.compareTo(Target.JDK1_5) <= 0) {
- log.warning(LintCategory.OPTIONS, "option.obsolete.target", source.name);
+ log.warning(LintCategory.OPTIONS, "option.obsolete.target", target.name);
obsoleteOptionFound = true;
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/main/Option.java
--- a/src/share/classes/com/sun/tools/javac/main/Option.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/main/Option.java Thu Aug 29 16:34:12 2013 -0700
@@ -389,6 +389,7 @@
XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"),
+ // see enum PkgInfo
XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"),
/* -O is a no-op, accepted for backward compatibility. */
@@ -686,7 +687,28 @@
// For -XpkgInfo:value
public enum PkgInfo {
- ALWAYS, LEGACY, NONEMPTY;
+ /**
+ * Always generate package-info.class for every package-info.java file.
+ * The file may be empty if there annotations with a RetentionPolicy
+ * of CLASS or RUNTIME. This option may be useful in conjunction with
+ * build systems (such as Ant) that expect javac to generate at least
+ * one .class file for every .java file.
+ */
+ ALWAYS,
+ /**
+ * Generate a package-info.class file if package-info.java contains
+ * annotations. The file may be empty if all the annotations have
+ * a RetentionPolicy of SOURCE.
+ * This value is just for backwards compatibility with earlier behavior.
+ * Either of the other two values are to be preferred to using this one.
+ */
+ LEGACY,
+ /**
+ * Generate a package-info.class file if and only if there are annotations
+ * in package-info.java to be written into it.
+ */
+ NONEMPTY;
+
public static PkgInfo get(Options options) {
String v = options.get(XPKGINFO);
return (v == null
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
--- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Aug 29 16:34:12 2013 -0700
@@ -89,7 +89,7 @@
* deletion without notice.
*/
public class JavacProcessingEnvironment implements ProcessingEnvironment, Closeable {
- Options options;
+ private final Options options;
private final boolean printProcessorInfo;
private final boolean printRounds;
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/resources/compiler.properties
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Aug 29 16:34:12 2013 -0700
@@ -2248,7 +2248,7 @@
# TODO 308: make a better error message
# 0: unused
compiler.err.cant.annotate.nested.type=\
- nested type cannot be annotated
+ scoping construct for static nested type cannot be annotated
# 0: type, 1: type
compiler.err.incorrect.receiver.name=\
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/sym/Profiles.java
--- a/src/share/classes/com/sun/tools/javac/sym/Profiles.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/sym/Profiles.java Thu Aug 29 16:34:12 2013 -0700
@@ -148,7 +148,7 @@
}
}
- final static Map packages = new TreeMap();
+ final Map packages = new TreeMap();
final int maxProfile = 4; // Three compact profiles plus full JRE
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javac/tree/Pretty.java
--- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Aug 29 16:34:12 2013 -0700
@@ -944,10 +944,17 @@
try {
if (tree.elemtype != null) {
print("new ");
- printTypeAnnotations(tree.annotations);
JCTree elem = tree.elemtype;
printBaseElementType(elem);
- boolean isElemAnnoType = elem instanceof JCAnnotatedType;
+
+ if (!tree.annotations.isEmpty()) {
+ print(' ');
+ printTypeAnnotations(tree.annotations);
+ }
+ if (tree.elems != null) {
+ print("[]");
+ }
+
int i = 0;
List> da = tree.dimAnnotations;
for (List l = tree.dims; l.nonEmpty(); l = l.tail) {
@@ -960,17 +967,7 @@
printExpr(l.head);
print("]");
}
- if (tree.elems != null) {
- if (isElemAnnoType) {
- print(' ');
- printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations);
- }
- print("[]");
- }
- if (isElemAnnoType)
- elem = ((JCAnnotatedType)elem).underlyingType;
- if (elem instanceof JCArrayTypeTree)
- printBrackets((JCArrayTypeTree) elem);
+ printBrackets(elem);
}
if (tree.elems != null) {
print("{");
@@ -1260,20 +1257,24 @@
}
// prints the brackets of a nested array in reverse order
- private void printBrackets(JCArrayTypeTree tree) throws IOException {
- JCTree elem;
+ // tree is either JCArrayTypeTree or JCAnnotatedTypeTree
+ private void printBrackets(JCTree tree) throws IOException {
+ JCTree elem = tree;
while (true) {
- elem = tree.elemtype;
if (elem.hasTag(ANNOTATED_TYPE)) {
JCAnnotatedType atype = (JCAnnotatedType) elem;
elem = atype.underlyingType;
- if (!elem.hasTag(TYPEARRAY)) break;
- print(' ');
- printTypeAnnotations(atype.annotations);
+ if (elem.hasTag(TYPEARRAY)) {
+ print(' ');
+ printTypeAnnotations(atype.annotations);
+ }
}
- print("[]");
- if (!elem.hasTag(TYPEARRAY)) break;
- tree = (JCArrayTypeTree) elem;
+ if (elem.hasTag(TYPEARRAY)) {
+ print("[]");
+ elem = ((JCArrayTypeTree)elem).elemtype;
+ } else {
+ break;
+ }
}
}
@@ -1378,22 +1379,15 @@
public void visitAnnotatedType(JCAnnotatedType tree) {
try {
- if (tree.underlyingType.getKind() == JCTree.Kind.MEMBER_SELECT) {
+ if (tree.underlyingType.hasTag(SELECT)) {
JCFieldAccess access = (JCFieldAccess) tree.underlyingType;
printExpr(access.selected, TreeInfo.postfixPrec);
print(".");
printTypeAnnotations(tree.annotations);
print(access.name);
- } else if (tree.underlyingType.getKind() == JCTree.Kind.ARRAY_TYPE) {
- JCArrayTypeTree array = (JCArrayTypeTree) tree.underlyingType;
+ } else if (tree.underlyingType.hasTag(TYPEARRAY)) {
printBaseElementType(tree);
- print(' ');
- printTypeAnnotations(tree.annotations);
- print("[]");
- JCExpression elem = array.elemtype;
- if (elem.hasTag(TYPEARRAY)) {
- printBrackets((JCArrayTypeTree) elem);
- }
+ printBrackets(tree);
} else {
printTypeAnnotations(tree.annotations);
printExpr(tree.underlyingType);
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
--- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Aug 29 16:34:12 2013 -0700
@@ -128,7 +128,14 @@
try {
return clazz.flags();
} catch (CompletionFailure ex) {
- // quietly ignore completion failures
+ /* Quietly ignore completion failures.
+ * Note that a CompletionFailure can only
+ * occur as a result of calling complete(),
+ * which will always remove the current
+ * completer, leaving it to be null or
+ * follow-up completer. Thus the loop
+ * is guaranteed to eventually terminate.
+ */
}
}
}
diff -r e431c9bfb171 -r fcd768844b99 src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java
--- a/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Thu Aug 29 16:34:12 2013 -0700
@@ -30,9 +30,12 @@
import com.sun.tools.javac.code.Kinds;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.comp.MemberEnter;
+import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.Context;
+import static com.sun.tools.javac.code.Flags.*;
+
/**
* Javadoc's own memberEnter phase does a few things above and beyond that
* done by javac.
@@ -86,6 +89,17 @@
@Override
public void visitVarDef(JCVariableDecl tree) {
+ if (tree.init != null) {
+ boolean isFinal = (tree.mods.flags & FINAL) != 0
+ || (env.enclClass.mods.flags & INTERFACE) != 0;
+ if (!isFinal || containsNonConstantExpression(tree.init)) {
+ // Avoid unnecessary analysis and release resources.
+ // In particular, remove non-constant expressions
+ // which may trigger Attr.attribClass, since
+ // method bodies are also removed, in visitMethodDef.
+ tree.init = null;
+ }
+ }
super.visitVarDef(tree);
if (tree.sym != null &&
tree.sym.kind == Kinds.VAR &&
@@ -101,4 +115,95 @@
private static boolean isParameter(VarSymbol var) {
return (var.flags() & Flags.PARAMETER) != 0;
}
+
+ /**
+ * Simple analysis of an expression tree to see if it contains tree nodes
+ * for any non-constant expression. This does not include checking references
+ * to other fields which may or may not be constant.
+ */
+ private static boolean containsNonConstantExpression(JCExpression tree) {
+ return new MaybeConstantExpressionScanner().containsNonConstantExpression(tree);
+ }
+
+ /**
+ * See JLS 15.18, Constant Expression
+ */
+ private static class MaybeConstantExpressionScanner extends JCTree.Visitor {
+ boolean maybeConstantExpr = true;
+
+ public boolean containsNonConstantExpression(JCExpression tree) {
+ scan(tree);
+ return !maybeConstantExpr;
+ }
+
+ public void scan(JCTree tree) {
+ // short circuit scan when end result is definitely false
+ if (maybeConstantExpr && tree != null)
+ tree.accept(this);
+ }
+
+ @Override
+ /** default for any non-overridden visit method. */
+ public void visitTree(JCTree tree) {
+ maybeConstantExpr = false;
+ }
+
+ @Override
+ public void visitBinary(JCBinary tree) {
+ switch (tree.getTag()) {
+ case MUL: case DIV: case MOD:
+ case PLUS: case MINUS:
+ case SL: case SR: case USR:
+ case LT: case LE: case GT: case GE:
+ case EQ: case NE:
+ case BITAND: case BITXOR: case BITOR:
+ case AND: case OR:
+ break;
+ default:
+ maybeConstantExpr = false;
+ }
+ }
+
+ @Override
+ public void visitConditional(JCConditional tree) {
+ scan(tree.cond);
+ scan(tree.truepart);
+ scan(tree.falsepart);
+ }
+
+ @Override
+ public void visitIdent(JCIdent tree) { }
+
+ @Override
+ public void visitLiteral(JCLiteral tree) { }
+
+ @Override
+ public void visitParens(JCParens tree) {
+ scan(tree.expr);
+ }
+
+ @Override
+ public void visitSelect(JCTree.JCFieldAccess tree) {
+ scan(tree.selected);
+ }
+
+ @Override
+ public void visitTypeCast(JCTypeCast tree) {
+ scan(tree.clazz);
+ scan(tree.expr);
+ }
+
+ @Override
+ public void visitTypeIdent(JCPrimitiveTypeTree tree) { }
+
+ @Override
+ public void visitUnary(JCUnary tree) {
+ switch (tree.getTag()) {
+ case POS: case NEG: case COMPL: case NOT:
+ break;
+ default:
+ maybeConstantExpr = false;
+ }
+ }
+ }
}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testCharset/TestCharset.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testCharset/TestCharset.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7052170
+ * @summary Run a test on -charset to make sure the charset gets generated as a
+ * part of the meta tag.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestCharset
+ * @run main TestCharset
+ */
+
+public class TestCharset extends JavadocTester {
+
+ //Test information.
+ private static final String BUG_ID = "7052170";
+
+ //Javadoc arguments.
+ private static final String[] ARGS = new String[] {
+ "-d", BUG_ID, "-charset", "UTF-8", "-sourcepath", SRC_DIR, "pkg"
+ };
+
+ private static final String[][] TEST = {
+ {BUG_ID + FS + "index.html",
+ ""},
+ {BUG_ID + FS + "pkg" + FS + "Foo.html",
+ ""}
+ };
+
+ private static final String[][] NEGATED_TEST = {
+ {BUG_ID + FS + "index.html",
+ ""},
+ {BUG_ID + FS + "pkg" + FS + "Foo.html",
+ ""}
+ };
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestCharset tester = new TestCharset();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testCharset/pkg/Foo.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testCharset/pkg/Foo.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class Foo {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavagation/TestNavagation.java
--- a/test/com/sun/javadoc/testNavagation/TestNavagation.java Thu Aug 29 09:42:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4131628 4664607 7025314
- * @summary Make sure the Next/Prev Class links iterate through all types.
- * Make sure the navagation is 2 columns, not 3.
- * @author jamieh
- * @library ../lib/
- * @build JavadocTester
- * @build TestNavagation
- * @run main TestNavagation
- */
-
-public class TestNavagation extends JavadocTester {
-
- //Test information.
- private static final String BUG_ID = "4131628-4664607";
-
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- {BUG_ID + FS + "pkg" + FS + "A.html", "
"},
- // Test for 4664607
- {BUG_ID + FS + "pkg" + FS + "I.html",
- "" + NL +
- "" + NL + ""}
- };
- private static final String[][] NEGATED_TEST = NO_TEST;
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNavagation tester = new TestNavagation();
- run(tester, ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getBugId() {
- return BUG_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getBugName() {
- return getClass().getName();
- }
-}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavagation/pkg/A.java
--- a/test/com/sun/javadoc/testNavagation/pkg/A.java Thu Aug 29 09:42:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-/**
- * Sample Annotation Type.
- */
-public @interface A {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavagation/pkg/C.java
--- a/test/com/sun/javadoc/testNavagation/pkg/C.java Thu Aug 29 09:42:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-/**
- * Sample Class.
- */
-public class C {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavagation/pkg/E.java
--- a/test/com/sun/javadoc/testNavagation/pkg/E.java Thu Aug 29 09:42:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-/**
- * Sample Enum.
- */
-public enum E {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavagation/pkg/I.java
--- a/test/com/sun/javadoc/testNavagation/pkg/I.java Thu Aug 29 09:42:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-/**
- * Sample Interface.
- */
-public interface I {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavigation/TestNavigation.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/TestNavigation.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4131628 4664607 7025314
+ * @summary Make sure the Next/Prev Class links iterate through all types.
+ * Make sure the navagation is 2 columns, not 3.
+ * @author jamieh
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestNavigation
+ * @run main TestNavigation
+ */
+
+public class TestNavigation extends JavadocTester {
+
+ //Test information.
+ private static final String BUG_ID = "4131628-4664607";
+
+ //Javadoc arguments.
+ private static final String[] ARGS = new String[] {
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+ };
+
+ //Input for string search tests.
+ private static final String[][] TEST = {
+ {BUG_ID + FS + "pkg" + FS + "A.html", "
"},
+ // Test for 4664607
+ {BUG_ID + FS + "pkg" + FS + "I.html",
+ "" + NL +
+ "" + NL + ""}
+ };
+ private static final String[][] NEGATED_TEST = NO_TEST;
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestNavigation tester = new TestNavigation();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavigation/pkg/A.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/A.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Sample Annotation Type.
+ */
+public @interface A {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavigation/pkg/C.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/C.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Sample Class.
+ */
+public class C {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavigation/pkg/E.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/E.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Sample Enum.
+ */
+public enum E {}
diff -r e431c9bfb171 -r fcd768844b99 test/com/sun/javadoc/testNavigation/pkg/I.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/I.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Sample Interface.
+ */
+public interface I {}
diff -r e431c9bfb171 -r fcd768844b99 test/tools/doclint/html/ListTagsTest.java
--- a/test/tools/doclint/html/ListTagsTest.java Thu Aug 29 09:42:12 2013 -0700
+++ b/test/tools/doclint/html/ListTagsTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 8006251 8013405
+ * @bug 8006251 8013405 8022173
* @summary test list tags
* @library ..
* @build DocLintTester
@@ -15,6 +15,7 @@
*
abc
*
bad
*
bad
+ *
bad
*
abc
*/
public void supportedTags() { }
diff -r e431c9bfb171 -r fcd768844b99 test/tools/doclint/html/OtherTagsTest.java
--- a/test/tools/doclint/html/OtherTagsTest.java Thu Aug 29 09:42:12 2013 -0700
+++ b/test/tools/doclint/html/OtherTagsTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 8006251
+ * @bug 8006251 8022173
* @summary test other tags
* @library ..
* @build DocLintTester
@@ -14,6 +14,7 @@
*
*
*
+ *
*
*
*
diff -r e431c9bfb171 -r fcd768844b99 test/tools/doclint/html/OtherTagsTest.out
--- a/test/tools/doclint/html/OtherTagsTest.out Thu Aug 29 09:42:12 2013 -0700
+++ b/test/tools/doclint/html/OtherTagsTest.out Thu Aug 29 16:34:12 2013 -0700
@@ -10,19 +10,19 @@
OtherTagsTest.java:16: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:17: error: element not allowed in documentation comments:
+OtherTagsTest.java:18: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:18: error: element not allowed in documentation comments:
+OtherTagsTest.java:19: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:19: error: element not allowed in documentation comments:
+OtherTagsTest.java:20: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:20: error: element not allowed in documentation comments:
^
-OtherTagsTest.java:21: error: element not allowed in documentation comments:
+OtherTagsTest.java:22: error: element not allowed in documentation comments:
*
^
9 errors
diff -r e431c9bfb171 -r fcd768844b99 test/tools/doclint/html/TableTagsTest.java
--- a/test/tools/doclint/html/TableTagsTest.java Thu Aug 29 09:42:12 2013 -0700
+++ b/test/tools/doclint/html/TableTagsTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8006251
+ * @bug 8006251 8022173
* @summary test table tags
* @library ..
* @build DocLintTester
@@ -39,6 +39,7 @@
*
*
*
+ *
*/
public void supportedTags() { }
}
diff -r e431c9bfb171 -r fcd768844b99 test/tools/javac/7118412/ShadowingTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7118412/ShadowingTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7118412
+ * @summary Shadowing of type-variables vs. member types
+ */
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class ShadowingTest {
+
+ // We generate a method "test" that tries to call T.. This controls whether
+ // "test" is static or not.
+ private enum MethodContext {
+ STATIC("static "),
+ INSTANCE("");
+
+ public final String methodcontext;
+
+ MethodContext(final String methodcontext) {
+ this.methodcontext = methodcontext;
+ }
+ }
+
+ // These control whether or not a type parameter, method type
+ // parameter, or inner class get declared (and in the case of
+ // inner classes, whether it's static or not.
+
+ private enum MethodTypeParameterDecl {
+ NO(""),
+ YES(" ");
+
+ public final String tyvar;
+
+ MethodTypeParameterDecl(final String tyvar) {
+ this.tyvar = tyvar;
+ }
+ }
+
+ private enum InsideDef {
+ NONE(""),
+ STATIC("static class T { public void inner() {} }\n"),
+ INSTANCE("class T { public void inner() {} }\n");
+
+ public final String instancedef;
+
+ InsideDef(final String instancedef) {
+ this.instancedef = instancedef;
+ }
+ }
+
+ private enum TypeParameterDecl {
+ NO(""),
+ YES("");
+
+ public final String tyvar;
+
+ TypeParameterDecl(final String tyvar) {
+ this.tyvar = tyvar;
+ }
+ }
+
+ // Represents what method we try to call. This is a way of
+ // checking which T we're seeing.
+ private enum MethodCall {
+ // Method type variables extend Number, so we have intValue
+ METHOD_TYPEVAR("intValue"),
+ // The inner class declaration has a method called "inner"
+ INNER_CLASS("inner"),
+ // The class type variables extend Collection, so we call iterator
+ TYPEVAR("iterator"),
+ // The outer class declaration has a method called "outer"
+ OUTER_CLASS("outer");
+
+ public final String methodcall;
+
+ MethodCall(final String methodcall) {
+ this.methodcall = methodcall;
+ }
+
+ }
+
+ public boolean succeeds(final MethodCall call,
+ final MethodTypeParameterDecl mtyvar,
+ final MethodContext ctx,
+ final InsideDef inside,
+ final TypeParameterDecl tyvar) {
+ switch(call) {
+ // We want to resolve to the method type variable
+ case METHOD_TYPEVAR: switch(mtyvar) {
+ // If the method type variable exists, then T will
+ // resolve to it, and we'll have intValue.
+ case YES: return true;
+ // Otherwise, this cannot succeed.
+ default: return false;
+ }
+ // We want to resolve to the inner class
+ case INNER_CLASS: switch(mtyvar) {
+ // The method type parameter will shadow the inner
+ // class, so there can't be one.
+ case NO: switch(ctx) {
+ // If we're not static, then either one should succeed.
+ case INSTANCE: switch(inside) {
+ case INSTANCE:
+ case STATIC:
+ return true;
+ default: return false;
+ }
+ case STATIC: switch(inside) {
+ // If we are static, and the inner class is
+ // static, then we also succeed, because we
+ // can't see the type variable.
+ case STATIC: return true;
+ case INSTANCE: switch(tyvar) {
+ // If we're calling from a non-static
+ // context, there can't be a class type
+ // variable, because that will shadow the
+ // static inner class definition.
+ case NO: return true;
+ default: return false;
+ }
+ // If the inner class isn't declared, we can't
+ // see it.
+ default: return false;
+ }
+ // Can't get here.
+ default: return false;
+ }
+ default: return false;
+ }
+ // We want to resolve to the class type parameter
+ case TYPEVAR: switch(mtyvar) {
+ // We can't have a method type parameter, as that would
+ // shadow the class type parameter
+ case NO: switch(ctx) {
+ case INSTANCE: switch(inside) {
+ // We have to be in an instance context. If
+ // we're static, we can't see the type
+ // variable.
+ case NONE: switch(tyvar) {
+ // Obviously, the type parameter has to be declared.
+ case YES: return true;
+ default: return false;
+ }
+ default: return false;
+ }
+ default: return false;
+ }
+ default: return false;
+ }
+ // We want to resolve to the outer class
+ case OUTER_CLASS: switch(mtyvar) {
+ case NO: switch(inside) {
+ case NONE: switch(tyvar) {
+ // Basically, nothing else can be declared, or
+ // else we can't see it. Even if our context
+ // is static, the compiler will complain if
+ // non-static T's exist, because they will
+ // shadow the outer class.
+ case NO: return true;
+ default: return false;
+ }
+ default: return false;
+ }
+ default: return false;
+ }
+ }
+ return false;
+ }
+
+ private static final File classesdir = new File("7118412");
+
+ private int errors = 0;
+
+ private int dirnum = 0;
+
+ private void doTest(final MethodTypeParameterDecl mtyvar,
+ final TypeParameterDecl tyvar,
+ final InsideDef insidedef, final MethodContext ctx,
+ final MethodCall call)
+ throws IOException {
+ final String content = "import java.util.Collection;\n" +
+ "class Test" + tyvar.tyvar + " {\n" +
+ " " + insidedef.instancedef +
+ " " + ctx.methodcontext + mtyvar.tyvar + "void test(T t) { t." +
+ call.methodcall + "(); }\n" +
+ "}\n" +
+ "class T { void outer() {} }\n";
+ final File dir = new File(classesdir, "" + dirnum);
+ final File Test_java = writeFile(dir, "Test.java", content);
+ dirnum++;
+ if(succeeds(call, mtyvar, ctx, insidedef, tyvar)) {
+ if(!assert_compile_succeed(Test_java))
+ System.err.println("Failed file:\n" + content);
+ }
+ else {
+ if(!assert_compile_fail(Test_java))
+ System.err.println("Failed file:\n" + content);
+ }
+ }
+
+ private void run() throws Exception {
+ classesdir.mkdir();
+ for(MethodTypeParameterDecl mtyvar : MethodTypeParameterDecl.values())
+ for(TypeParameterDecl tyvar : TypeParameterDecl.values())
+ for(InsideDef insidedef : InsideDef.values())
+ for(MethodContext ctx : MethodContext.values())
+ for(MethodCall methodcall : MethodCall.values())
+ doTest(mtyvar, tyvar, insidedef, ctx, methodcall);
+ if (errors != 0)
+ throw new Exception("ShadowingTest test failed with " +
+ errors + " errors.");
+ }
+
+ private boolean assert_compile_fail(final File file) {
+ final String filename = file.getPath();
+ final String[] args = { filename };
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final int rc = com.sun.tools.javac.Main.compile(args, pw);
+ pw.close();
+ if (rc == 0) {
+ System.err.println("Compilation of " + file.getName() +
+ " didn't fail as expected.");
+ errors++;
+ return false;
+ } else return true;
+ }
+
+ private boolean assert_compile_succeed(final File file) {
+ final String filename = file.getPath();
+ final String[] args = { filename };
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final int rc = com.sun.tools.javac.Main.compile(args, pw);
+ pw.close();
+ if (rc != 0) {
+ System.err.println("Compilation of " + file.getName() +
+ " didn't succeed as expected. Output:");
+ System.err.println(sw.toString());
+ errors++;
+ return false;
+ } else return true;
+ }
+
+ private File writeFile(final File dir,
+ final String path,
+ final String body) throws IOException {
+ final File f = new File(dir, path);
+ f.getParentFile().mkdirs();
+ final FileWriter out = new FileWriter(f);
+ out.write(body);
+ out.close();
+ return f;
+ }
+
+ public static void main(String... args) throws Exception {
+ new ShadowingTest().run();
+ }
+
+}
diff -r e431c9bfb171 -r fcd768844b99 test/tools/javac/8015701/AnonymousParameters.java
--- a/test/tools/javac/8015701/AnonymousParameters.java Thu Aug 29 09:42:12 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8015701
- * @summary javac should generate method parameters correctly.
- * @compile -parameters AnonymousParameters.java
- * @run main AnonymousParameters
- */
-import java.lang.Class;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Parameter;
-import java.util.concurrent.Callable;
-
-public class AnonymousParameters {
-
- String[] names = {
- "this$0",
- "val$message"
- };
-
- public static void main(String... args) throws Exception {
- new AnonymousParameters().run();
- }
-
- void run() throws Exception {
- Class> cls = new ParameterNames().makeInner("hello").getClass();
- Constructor> ctor = cls.getDeclaredConstructors()[0];
- Parameter[] params = ctor.getParameters();
-
- if(params.length == 2) {
- for(int i = 0; i < 2; i++) {
- System.err.println("Testing parameter " + params[i].getName());
- if(!params[i].getName().equals(names[i]))
- error("Expected parameter name " + names[i] +
- " got " + params[i].getName());
- }
- } else
- error("Expected 2 parameters");
-
- if(0 != errors)
- throw new Exception("MethodParameters test failed with " +
- errors + " errors");
- }
-
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- int errors;
-}
-
-class ParameterNames {
-
- public Callable makeInner(final String message) {
- return new Callable() {
- public String call() throws Exception {
- return message;
- }
- };
- }
-
- public static void main(String... args) throws Exception {
- ParameterNames test = new ParameterNames();
- System.out.println(test.makeInner("Hello").call());
- }
-}
diff -r e431c9bfb171 -r fcd768844b99 test/tools/javac/MethodParameters/CaptureTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/CaptureTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8015701
+ * @summary Test method parameter attribute generation with captured locals.
+ * @compile -parameters CaptureTest.java
+ * @run main CaptureTest
+ */
+import java.lang.Class;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Parameter;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import java.util.ArrayList;
+
+public class CaptureTest {
+
+ private static final int SYNTHETIC = 0x1000;
+ private static final int MANDATED = 0x8000;
+
+ public static void main(String... args) throws Exception {
+ new CaptureTest().run();
+ }
+
+
+ private void run() throws Exception {
+ final Encloser pn = new Encloser();
+
+ /* Cases covered here:
+ *
+ * - Local class
+ * - Inner class
+ * - Anonymous class
+ * - Anonymous class extending a local
+ * - Anonymous class extending an inner
+ */
+ pn.makeLocal("hello").check();
+ pn.makeInner("hello").check();
+ pn.makeAnon("hello").check();
+ pn.makeAnonExtendsLocal("hello").check();
+ pn.makeAnonExtendsInner("hello").check();
+
+ if (0 != errors)
+ throw new Exception("MethodParameters test failed with " +
+ errors + " errors");
+ }
+
+ private void error(final String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+
+ abstract class Tester {
+
+ public Tester(final int param) {}
+
+ protected abstract String[] names();
+ protected abstract int[] modifiers();
+ protected abstract Class[] types();
+
+ public void check() {
+ final Class> cls = this.getClass();
+ final Constructor> ctor = cls.getDeclaredConstructors()[0];
+ final Parameter[] params = ctor.getParameters();
+ final String[] names = names();
+ final int[] modifiers = modifiers();
+ final Class[] types = types();
+
+ System.err.println("Testing class " + cls);
+
+ if (params.length == names.length) {
+ for (int i = 0; i < names.length; i++) {
+ System.err.println("Testing parameter " + params[i].getName());
+ if (!params[i].getName().equals(names[i]))
+ error("Expected parameter name " + names[i] +
+ " got " + params[i].getName());
+ if (params[i].getModifiers() != modifiers[i])
+ error("Expected parameter modifiers " +
+ modifiers[i] + " got " +
+ params[i].getModifiers());
+ if (!params[i].getType().equals(types[i]))
+ error("Expected parameter type " + types[i] +
+ " got " + params[i].getType());
+ }
+ } else
+ error("Expected " + names.length + " parameters");
+
+ }
+
+ }
+
+ class Encloser {
+ private class InnerTester extends Tester {
+ public InnerTester(final int innerparam) {
+ super(innerparam);
+ }
+
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "innerparam"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | SYNTHETIC,
+ Modifier.FINAL
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class
+ };
+ }
+ }
+
+ public Tester makeInner(final String message) {
+ return new InnerTester(2);
+ }
+
+ public Tester makeLocal(final String message) {
+ class LocalTester extends Tester {
+ public LocalTester(final int localparam) {
+ super(localparam);
+ }
+
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "localparam",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ public String message() {
+ return message;
+ }
+ }
+
+ return new LocalTester(2);
+ }
+
+ public Tester makeAnonExtendsLocal(final String message) {
+ abstract class LocalTester extends Tester {
+ public LocalTester(final int localparam) {
+ super(localparam);
+ }
+
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "localparam",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ }
+
+ return new LocalTester(2) {
+ public String message() {
+ return message;
+ }
+ };
+ }
+
+ public Tester makeAnonExtendsInner(final String message) {
+ return new InnerTester(2) {
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "innerparam",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ public String message() {
+ return message;
+ }
+ };
+ }
+
+ public Tester makeAnon(final String message) {
+ return new Tester(2) {
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "param",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ public String message() {
+ return message;
+ }
+ };
+ }
+ }
+}
diff -r e431c9bfb171 -r fcd768844b99 test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8022316
+ * @summary Generic throws, overriding and method reference
+ * @compile/fail/ref=CompilerErrorGenericThrowPlusMethodRefTest.out -XDrawDiagnostics CompilerErrorGenericThrowPlusMethodRefTest.java
+ */
+
+@SuppressWarnings("unchecked")
+public class CompilerErrorGenericThrowPlusMethodRefTest {
+ interface SAM11 {
+ public void foo() throws E ;
+ }
+
+ interface SAM12 extends SAM11{
+ @Override
+ public void foo() throws Throwable;
+ }
+
+ public void boo() throws RuntimeException {}
+
+ static void test1() {
+ try {
+ SAM12 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::boo;
+ s2.foo();
+ } catch(Throwable ex) {}
+ }
+
+ static void test2() {
+ SAM11 s1 = null;
+ s1.foo();
+ s1.foo();
+ }
+
+ interface SAM21 {
+ void m(E arg) throws E;
+ }
+
+ interface SAM22 {
+ void m(F arg) throws F;
+ }
+
+ interface SAM23 extends SAM21, SAM22 {}
+
+ public void bar(E e) throws E {}
+
+ static void test3(E e) {
+ try {
+ SAM23 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::bar;
+ s2.m(e);
+ } catch(Exception ex) {}
+ }
+
+}
diff -r e431c9bfb171 -r fcd768844b99 test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,2 @@
+CompilerErrorGenericThrowPlusMethodRefTest.java:55:26: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+1 error
diff -r e431c9bfb171 -r fcd768844b99 test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8023112
+ * @summary Mixing up the method type argument with the class type for method
+ * reference ClassType::new
+ * @compile SkipLazyConstantCreationForMethodRefTest.java
+ */
+
+public class SkipLazyConstantCreationForMethodRefTest {
+ SkipLazyConstantCreationForMethodRefTest(int a, boolean b) {}
+ SkipLazyConstantCreationForMethodRefTest() {}
+}
+
+class SubClass extends SkipLazyConstantCreationForMethodRefTest {
+ SubClass(int a, boolean b) {}
+}
+
+interface SAM {
+ SubClass m(int a, boolean b);
+}
+
+interface Tester1 {
+ SAM s11 = SubClass::