--- a/langtools/src/share/classes/com/sun/source/tree/MethodTree.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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
--- a/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Aug 29 16:34:12 2013 -0700
@@ -36,6 +36,8 @@
* <em>name</em>
*
* <em>name</em> extends <em>bounds</em>
+ *
+ * <em>annotations</em> <em>name</em>
* </pre>
*
* @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();
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/Comment.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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");
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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");
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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,
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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");
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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;
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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");
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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");
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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());
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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();
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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");
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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, "#");
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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 <a href="http://www.w3.org/TR/REC-html40/">HTML 4.01 Specification</a>
+ * @see <a href="http://www.w3.org/TR/html5/">HTML 5 Specification</a>
* @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);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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(' ');
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<VarSymbol> extraParams = List.nil();
+ /** The captured local variables in an anonymous class */
+ public List<VarSymbol> capturedLocals = List.nil();
+
/** The parameters of the method. */
public List<VarSymbol> params = null;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<AttrContext> 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;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<Type> 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<Type> 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<Type> thrown1 = thrown;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Aug 29 16:34:12 2013 -0700
@@ -2735,9 +2735,9 @@
for (List<VarSymbol> 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));
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<AttrContext> 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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<AttrContext> env,
- Type site,
- Name name,
- TypeSymbol c) {
- Symbol bestSoFar = typeNotFound;
- Symbol sym;
+ Symbol findImmediateMemberType(Env<AttrContext> 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<AttrContext> 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<AttrContext> 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<AttrContext> 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<AttrContext> 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) &&
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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.</b>
*/
public class JavacProcessingEnvironment implements ProcessingEnvironment, Closeable {
- Options options;
+ private final Options options;
private final boolean printProcessorInfo;
private final boolean printRounds;
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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=\
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<String, Package> packages = new TreeMap<String, Package>();
+ final Map<String, Package> packages = new TreeMap<String, Package>();
final int maxProfile = 4; // Three compact profiles plus full JRE
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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<List<JCAnnotation>> da = tree.dimAnnotations;
for (List<JCExpression> 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);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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.
+ */
}
}
}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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;
+ }
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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",
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"},
+ {BUG_ID + FS + "pkg" + FS + "Foo.html",
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"}
+ };
+
+ private static final String[][] NEGATED_TEST = {
+ {BUG_ID + FS + "index.html",
+ "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"},
+ {BUG_ID + FS + "pkg" + FS + "Foo.html",
+ "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"}
+ };
+
+ /**
+ * 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 {}
--- a/langtools/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", "<li>Prev Class</li>"},
- {BUG_ID + FS + "pkg" + FS + "A.html",
- "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Next Class</span></a>"},
- {BUG_ID + FS + "pkg" + FS + "C.html",
- "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">Prev Class</span></a>"},
- {BUG_ID + FS + "pkg" + FS + "C.html",
- "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Next Class</span></a>"},
- {BUG_ID + FS + "pkg" + FS + "E.html",
- "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Prev Class</span></a>"},
- {BUG_ID + FS + "pkg" + FS + "E.html",
- "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">Next Class</span></a>"},
- {BUG_ID + FS + "pkg" + FS + "I.html",
- "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Prev Class</span></a>"},
- {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
- // Test for 4664607
- {BUG_ID + FS + "pkg" + FS + "I.html",
- "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL +
- "<!-- -->" + NL + "</a>"}
- };
- 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();
- }
-}
--- a/langtools/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 {}
--- a/langtools/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 {}
--- a/langtools/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 {}
--- a/langtools/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 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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", "<li>Prev Class</li>"},
+ {BUG_ID + FS + "pkg" + FS + "A.html",
+ "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Next Class</span></a>"},
+ {BUG_ID + FS + "pkg" + FS + "C.html",
+ "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+ {BUG_ID + FS + "pkg" + FS + "C.html",
+ "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Next Class</span></a>"},
+ {BUG_ID + FS + "pkg" + FS + "E.html",
+ "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+ {BUG_ID + FS + "pkg" + FS + "E.html",
+ "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">Next Class</span></a>"},
+ {BUG_ID + FS + "pkg" + FS + "I.html",
+ "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+ {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
+ // Test for 4664607
+ {BUG_ID + FS + "pkg" + FS + "I.html",
+ "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL +
+ "<!-- -->" + NL + "</a>"}
+ };
+ 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 {}
--- a/langtools/test/tools/doclint/html/ListTagsTest.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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 @@
* <ol> <li value="1"> abc </ol>
* <ol> <li value> bad </ol>
* <ol> <li value="a"> bad </ol>
+ * <ol type="a"> <li> bad </ol>
* <ul> <li> abc </ul>
*/
public void supportedTags() { }
--- a/langtools/test/tools/doclint/html/OtherTagsTest.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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 @@
* <frame>
* <frameset> </frameset>
* <head> </head>
+ * <hr width="50%">
* <link>
* <meta>
* <noframes> </noframes>
--- a/langtools/test/tools/doclint/html/OtherTagsTest.out Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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: <head>
* <head> </head>
^
-OtherTagsTest.java:17: error: element not allowed in documentation comments: <link>
+OtherTagsTest.java:18: error: element not allowed in documentation comments: <link>
* <link>
^
-OtherTagsTest.java:18: error: element not allowed in documentation comments: <meta>
+OtherTagsTest.java:19: error: element not allowed in documentation comments: <meta>
* <meta>
^
-OtherTagsTest.java:19: error: element not allowed in documentation comments: <noframes>
+OtherTagsTest.java:20: error: element not allowed in documentation comments: <noframes>
* <noframes> </noframes>
^
-OtherTagsTest.java:20: error: element not allowed in documentation comments: <script>
+OtherTagsTest.java:21: error: element not allowed in documentation comments: <script>
* <script> </script>
^
-OtherTagsTest.java:21: error: element not allowed in documentation comments: <title>
+OtherTagsTest.java:22: error: element not allowed in documentation comments: <title>
* <title> </title>
^
9 errors
--- a/langtools/test/tools/doclint/html/TableTagsTest.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/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 @@
* <table summary="abc"> <thead> <tr> </thead> <tr> <td> </table>
* <table summary="abc"> <tbody> <tr> <td> </tbody> </table>
* <table summary="abc"> <tr> <td> <tfoot> <tr> </tfoot></table>
+ * <table summary="abc" width="50%"> <tr> <td> <tfoot> <tr> </tfoot></table>
*/
public void supportedTags() { }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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.<something,
+ // depending on the value of MethodCall>. 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("<T extends Number> ");
+
+ 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("<T extends Collection>");
+
+ 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();
+ }
+
+}
--- a/langtools/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<String> makeInner(final String message) {
- return new Callable<String>() {
- 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());
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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;
+ }
+ };
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 <E extends Throwable> 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.<Exception>foo();
+ s1.<RuntimeException>foo();
+ }
+
+ interface SAM21 {
+ <E extends Exception> void m(E arg) throws E;
+ }
+
+ interface SAM22 {
+ <F extends Exception> void m(F arg) throws F;
+ }
+
+ interface SAM23 extends SAM21, SAM22 {}
+
+ public <E extends Exception> void bar(E e) throws E {}
+
+ static <E extends Exception> void test3(E e) {
+ try {
+ SAM23 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::bar;
+ s2.m(e);
+ } catch(Exception ex) {}
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<Q>::<T>new
+ * @compile SkipLazyConstantCreationForMethodRefTest.java
+ */
+
+public class SkipLazyConstantCreationForMethodRefTest<T> {
+ SkipLazyConstantCreationForMethodRefTest(int a, boolean b) {}
+ SkipLazyConstantCreationForMethodRefTest() {}
+}
+
+class SubClass<T> extends SkipLazyConstantCreationForMethodRefTest {
+ SubClass(int a, boolean b) {}
+}
+
+interface SAM {
+ SubClass<SkipLazyConstantCreationForMethodRefTest> m(int a, boolean b);
+}
+
+interface Tester1 {
+ SAM s11 = SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new;
+ SAM s12 = (SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new);
+ SAM s13 = (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new;
+ SAM s14 = true ? s11 : s12;
+ SAM s15 = true ? s11 : (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new;
+ SAM s16 = true ? (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new : s12;
+}
+
+interface Tester2 {
+ SAM s21 = Tester1.s11;
+}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Thu Aug 29 16:34:12 2013 -0700
@@ -35,13 +35,16 @@
// Test count helps identify test case in event of failure.
int testcount = 0;
- // Base test case template descriptions
+ // Base test case template descriptions;true==annotations in code attribute.
enum srce {
src1("(repeating) type annotations on on field in method body",true),
src2("(repeating) type annotations on type parameters, bounds and type arguments", true),
src3("(repeating) type annotations on type parameters of class, method return value in method", true),
src4("(repeating) type annotations on field in anonymous class", false),
- src5("(repeating) type annotations on field in anonymous class", false);
+ src5("(repeating) type annotations on field in anonymous class", false),
+ src6("(repeating) type annotations on void method declaration", false),
+ src7("(repeating) type annotations in use of instanceof", true),
+ src8("(repeating) type annotations in use of instanceof in method", true);
String description;
Boolean local;
@@ -84,6 +87,12 @@
test( 0, 8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src1);
test( 2, 0, 2, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src5);
test( 0, 2, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src5);
+ test( 0, 0, 2, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src6);
+ test( 0, 0, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src6);
+ test( 2, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src7);
+ test( 0, 2, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src7);
+ test( 4, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src8);
+ test( 0, 4, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src8);
break;
case "FIELD":
test( 8, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src1);
@@ -121,18 +130,6 @@
", ABmix=" + ABmix + ", retention: " + rtn + ", anno2: " +
et2 + ", src=" + source + "\n " + source.description;
- if(
-// 8005681 - src1,2,3 - skip cases with repeated annotations on new, array, cast.
- (( source.equals(srce.src1) || source.equals(srce.src2) ||
- source.equals(srce.src3)) && (ABmix || (Arepeats && BDrepeats)))
- // 8008928 - src4,5 - this change cause crash with t-a on anon class)
- || (source.equals(srce.src4) || source.equals(srce.src5))
- ) {
- System.out.println(testDef +
- "\n 8005681-skip repeated annotations on new,array,cast");
- return;
- }
-
println(testDef);
// Create test source and File.
String sourceString = sourceString(tname, rtn, et2, Arepeats,
@@ -178,9 +175,7 @@
println("Pass");
}
- //
// Source for test cases
- //
String sourceString(String testname, String retentn, String annot2,
Boolean Arepeats, Boolean BDrepeats, Boolean ABmix,
srce src) {
@@ -359,6 +354,63 @@
hasInnerClass=true;
innerClassname="$1";
break;
+ case src6: // (repeating)annotations on void method declaration
+ /*
+ * class Test95{
+ * @A @A @B @B public void test() { };
+ * }
+ */
+ source = new String( source +
+ "// " + src.description + "\n" +
+ "class "+ testname + "{\n" +
+ " _As_ _Bs_ public void test() { }\n" +
+ "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+ "\n\n";
+ hasInnerClass=false;
+ break;
+ case src7: // (repeating) type annotations in use of instanceof
+ /*
+ * class Test10{
+ * String data = "test";
+ * boolean dataIsString = ( data instanceof @A @B @A @B String);
+ * }
+ */
+ source = new String( source +
+ "// " + src.description + "\n" +
+ "class "+ testname + "{\n" +
+ " String data = \"test\";\n" +
+ " boolean dataIsString = ( data instanceof _As_ _Bs_ String);\n" +
+ "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+ "\n\n";
+ hasInnerClass=false;
+ break;
+ case src8: // (repeating) type annotations in use of instanceof
+ /*
+ * class Test20{
+ * String data = "test";
+ * Boolean isString() {
+ * if( data instanceof @A @B @A @B String )
+ * return true;
+ * else
+ * return( data instanceof @A @B @A @B String );
+ * }
+ * }
+ */
+ source = new String( source +
+ "// " + src.description + "\n" +
+ "class "+ testname + "{\n" +
+ " String data = \"test\";\n" +
+ " Boolean isString() { \n" +
+ " if( data instanceof _As_ _Bs_ String )\n" +
+ " return true;\n" +
+ " else\n" +
+ " return( data instanceof _As_ _Bs_ String );\n" +
+ " }\n" +
+ "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+ "\n\n";
+ hasInnerClass=false;
+ break;
+
}
return imports + source;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/DummyProcessor.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+
+import java.util.Set;
+
+/* A simple annotation processor. */
+@SupportedAnnotationTypes("*")
+public class DummyProcessor extends AbstractProcessor {
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
+ @Override
+ public final boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnv) {
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/T8020715.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,49 @@
+/*
+ * 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
+ * @summary Regression: compiling program with lambda crashed compiler
+ * @bug 8020715
+ * @compile T8020715.java
+ */
+class T8020715 {
+ // This crashed.
+ private static void makeTask1() {
+ class LocalClass {
+ private Runnable r = () -> {};
+ }
+ }
+
+ // This crashed, too.
+ private void makeTask2() {
+ class LocalClass {
+ private Runnable r = () -> {};
+ }
+ }
+
+ // This is fine.
+ private class InnerClass {
+ private Runnable r = () -> {};
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,44 @@
+/*
+ * 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 8023768
+ * @summary Type annotations on a type variable, where the bound of
+ * the type variable is an annotated type variable,
+ * need to be processed correctly.
+ * @author Werner Dietl
+ * @compile TypeVariableCycleTest.java
+ */
+
+import java.lang.annotation.*;
+
+class TypeVariableCycleTest<CTV> {
+ <MTV extends @TA CTV> MTV cast(CTV p) {
+ return (@TA MTV) p;
+ }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA {}
+
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Aug 29 16:34:12 2013 -0700
@@ -85,4 +85,24 @@
" } } }";
}
+ @TADescriptions({
+ @TADescription(annotation = "TA", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,
+ typeIndex = 0, offset = 4),
+ @TADescription(annotation = "TB", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,
+ typeIndex = 0, offset = 0)
+ })
+ public String generic1() {
+ return "class Test { <T> Test(int i) { new <@TA T>Test(); }" +
+ " <T> Test() { <@TB String>this(0); } }";
+ }
+
+ @TADescriptions({
+ @TADescription(annotation = "TA", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,
+ typeIndex = 0, offset = 0)
+ })
+ public String generic2() {
+ return "class Super { <T> Super(int i) { } } " +
+ "class Test extends Super { <T> Test() { <@TA String>super(0); } }";
+ }
+
}
--- a/langtools/test/tools/javac/lambda/MethodReference66.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/test/tools/javac/lambda/MethodReference66.java Thu Aug 29 16:34:12 2013 -0700
@@ -24,7 +24,6 @@
/*
* @test
* @bug 8009299
- * @ignore 8013875: Incorrect vtable index being set during methodHandle creation for static
* @summary Javac crashes when compiling method reference to static interface method
* @run main/othervm -Xverify:none MethodReference66
*/
--- a/langtools/test/tools/javac/lambda/lambdaExecution/InInterface.java Thu Aug 29 09:42:12 2013 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaExecution/InInterface.java Thu Aug 29 16:34:12 2013 -0700
@@ -26,7 +26,6 @@
/**
* @test
* @bug 8003639
- * @ignore 8013875: Incorrect vtable index being set during methodHandle creation for static
* @summary convert lambda testng tests to jtreg and add them
* @run testng InInterface
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/profiles/ProfileTest.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,114 @@
+/*
+ * 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 8022287
+ * @summary javac.sym.Profiles uses a static Map when it should not
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import com.sun.tools.javac.sym.Profiles;
+
+public class ProfileTest {
+ public static void main(String... args) throws Exception {
+ new ProfileTest().run();
+ }
+
+ public void run() throws Exception {
+ test("A");
+ test("B");
+
+ if (errors > 0)
+ throw new Exception(errors + " occurred");
+ }
+
+ void test(String base) throws IOException {
+ System.err.println("test " + base);
+ File profileDesc = createFiles(base);
+ checkProfile(profileDesc, base);
+ }
+
+ void checkProfile(File profileDesc, String base) throws IOException {
+ Profiles p = Profiles.read(profileDesc);
+ for (int i = 0; i < p.getProfileCount(); i++) {
+ System.err.println(p.getPackages(i));
+ for (String pkg: p.getPackages(i)) {
+ if (!pkg.endsWith(base))
+ error("unexpected package " + pkg + " for profile " + i);
+ }
+ }
+ }
+
+ File createFiles(String base) throws IOException {
+ File baseDir = new File(base);
+ baseDir.mkdirs();
+ for (int p = 1; p <= 4; p++) {
+ String pkg = "pkg" + p + base;
+ File pkgDir = new File(baseDir, pkg);
+ pkgDir.mkdirs();
+ File clssFile = new File(pkgDir, pkg + "Class.java");
+ try (PrintWriter out = new PrintWriter(new FileWriter(clssFile))) {
+ out.println("package " + pkgDir.getName() + ";");
+ out.println("class " + clssFile.getName().replace(".java", ""));
+ }
+ }
+
+ File profileDesc = new File(baseDir, "profiles" + base + ".txt");
+ try (PrintWriter out = new PrintWriter(new FileWriter(profileDesc))) {
+ for (int p = 1; p <= 4; p++) {
+ String pkg = "pkg" + p + base;
+ createPackage(baseDir, pkg, "Pkg" + p + base + "Class");
+ out.println("PROFILE_" + p + "_RTJAR_INCLUDE_PACKAGES := " + pkg);
+ out.println("PROFILE_" + p + "_RTJAR_INCLUDE_TYPES :=");
+ out.println("PROFILE_" + p + "_RTJAR_EXCLUDE_TYPES :=");
+ out.println("PROFILE_" + p + "_INCLUDE_METAINF_SERVICES := ");
+ }
+ }
+
+ return profileDesc;
+ }
+
+ void createPackage(File baseDir, String pkg, String... classNames) throws IOException {
+ File pkgDir = new File(baseDir, pkg);
+ pkgDir.mkdirs();
+ for (String className: classNames) {
+ File clssFile = new File(pkgDir, className + ".java");
+ try (PrintWriter out = new PrintWriter(new FileWriter(clssFile))) {
+ out.println("package " + pkg + ";");
+ out.println("public class " + className + " { }");
+ }
+ }
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/TypeAnnotationsPretty.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,169 @@
+/*
+ * 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 8023522
+ * @summary test Pretty print of type annotations
+ * @author wmdietl
+ */
+
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.tree.JCTree;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+import java.util.LinkedList;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class TypeAnnotationsPretty {
+ private final JavaCompiler tool;
+
+ TypeAnnotationsPretty() {
+ tool = ToolProvider.getSystemJavaCompiler();
+ }
+
+ private List<String> matches = new LinkedList<String>();
+ private List<String> mismatches = new LinkedList<String>();
+
+ public static void main(String... args) throws Exception {
+ TypeAnnotationsPretty tap = new TypeAnnotationsPretty();
+
+ tap.runField("@TA()\nObject cls = null");
+ tap.runField("@TA()\nObject cls = new @TA() Object()");
+
+ tap.runField("@TA()\nList<@TB() Object> cls = null");
+ tap.runField("@TA()\nList<@TB() Object> cls = new @TA() LinkedList<@TB() Object>()");
+
+ tap.runField("Class[] cls = null");
+ tap.runField("@TA()\nClass[] cls = null");
+ tap.runField("Class @TA() [] cls = null");
+ tap.runField("@TA()\nClass @TB() [] cls = null");
+
+ tap.runField("Class[] cls = new Class[]{Object.class}");
+ tap.runField("@TA()\nClass[] cls = new @TA() Class[]{Object.class}");
+ tap.runField("Class @TB() [] cls = new Class @TB() []{Object.class}");
+ tap.runField("@TA()\nClass @TB() [] cls = new @TA() Class @TB() []{Object.class}");
+ tap.runField("@TA()\nClass @TB() [] @TC() [] cls = new @TA() Class @TB() [10] @TC() []");
+ tap.runField("Class @TB() [] @TC() [] cls = new Class @TB() [10] @TC() []");
+ tap.runField("@TA()\nClass @TB() [] @TC() [] @TD() [] cls = new @TA() Class @TB() [10] @TC() [] @TD() []");
+
+ tap.runMethod("\n@TA()\nObject test(@TB()\nList<@TC() String> p) {\n" +
+ " return null;\n" +
+ "}");
+
+
+ if (!tap.matches.isEmpty()) {
+ for (String m : tap.matches)
+ System.out.println(m);
+ }
+ if (!tap.mismatches.isEmpty()) {
+ for (String mm : tap.mismatches)
+ System.err.println(mm + NL);
+ throw new RuntimeException("Tests failed!");
+ }
+ }
+
+ private static final String prefix =
+ "import java.lang.annotation.*;" +
+ "import java.util.*;" +
+ "public class Test {";
+
+ private static final String postfix =
+ "@Target(ElementType.TYPE_USE)" +
+ "@interface TA {}" +
+ "@Target(ElementType.TYPE_USE)" +
+ "@interface TB {}" +
+ "@Target(ElementType.TYPE_USE)" +
+ "@interface TC {}" +
+ "@Target(ElementType.TYPE_USE)" +
+ "@interface TD {}";
+
+ private static final String NL = System.getProperty("line.separator");
+
+ private void runField(String code) throws IOException {
+ String src = prefix +
+ code + "; }" +
+ postfix;
+
+ JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+ null, Arrays.asList(new MyFileObject(src)));
+
+ for (CompilationUnitTree cut : ct.parse()) {
+ JCTree.JCVariableDecl var =
+ (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
+ checkMatch(code, var);
+ }
+ }
+
+ private void runMethod(String code) throws IOException {
+ String src = prefix +
+ code + "}" +
+ postfix;
+
+ JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+ null, Arrays.asList(new MyFileObject(src)));
+
+
+ for (CompilationUnitTree cut : ct.parse()) {
+ JCTree.JCMethodDecl meth =
+ (JCTree.JCMethodDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
+ checkMatch(code, meth);
+ }
+ }
+
+ void checkMatch(String code, JCTree tree) {
+ String expect = code.replace("\n", NL);
+ String found = tree.toString();
+ if (!expect.equals(found)) {
+ mismatches.add("Expected: " + expect + NL +
+ "Obtained: " + found);
+ } else {
+ matches.add("Passed: " + expect);
+ }
+ }
+}
+
+
+class MyFileObject extends SimpleJavaFileObject {
+
+ private String text;
+
+ public MyFileObject(String text) {
+ super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+ this.text = text;
+ }
+
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+ return text;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javadoc/nonConstExprs/Test.java Thu Aug 29 16:34:12 2013 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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 8010310
+ * @summary Error processing sources with -private
+ */
+
+import java.io.File;
+
+public class Test {
+ public static void main(String... args) throws Exception {
+ File testSrc = new File(System.getProperty("test.src"));
+ String[] jdoc_args = {
+ "-d", "out",
+ new File(testSrc, Test.class.getSimpleName() + ".java").getPath()
+ };
+ int rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
+ if (rc != 0)
+ throw new Exception("unexpected return code from javadoc: " + rc);
+ }
+
+ static int array[] = { 1, 2, 3};
+ static int method(int p) { return p; }
+ static int value = 0;
+
+ public int not_static_not_final = 1;
+ public static int static_not_final = 2;
+ public final int not_static_final = 3;
+ public static final int static_final = 4;
+
+ public static final int array_index = array[0];
+ public static final int method_call = method(0);
+ public static final int inner_class = new Test() { }.method(0);
+ public static final int new_class = new Test().method(0);
+ public static final int pre_inc = ++value;
+ public static final int pre_dec = --value;
+ public static final int post_inc = value++;
+ public static final int post_dec = value--;
+}
+