Mercurial > hg > release > icedtea7-forest-2.6 > langtools
changeset 1315:1801674f6b0f
Merge
author | lana |
---|---|
date | Wed, 12 Sep 2012 12:32:55 -0700 |
parents | cd18b83736af (current diff) fdbdbf39564d (diff) |
children | 3204f355a32d |
files | |
diffstat | 16 files changed, 535 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Sep 12 12:32:55 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, 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 @@ -227,46 +227,44 @@ String[] os = options[oi]; String opt = os[0].toLowerCase(); if (opt.equals("-footer")) { - footer = os[1]; - } else if (opt.equals("-header")) { - header = os[1]; - } else if (opt.equals("-packagesheader")) { - packagesheader = os[1]; - } else if (opt.equals("-doctitle")) { - doctitle = os[1]; - } else if (opt.equals("-windowtitle")) { - windowtitle = os[1]; - } else if (opt.equals("-top")) { - top = os[1]; - } else if (opt.equals("-bottom")) { - bottom = os[1]; - } else if (opt.equals("-helpfile")) { - helpfile = os[1]; - } else if (opt.equals("-stylesheetfile")) { - stylesheetfile = os[1]; - } else if (opt.equals("-charset")) { - charset = os[1]; + footer = os[1]; + } else if (opt.equals("-header")) { + header = os[1]; + } else if (opt.equals("-packagesheader")) { + packagesheader = os[1]; + } else if (opt.equals("-doctitle")) { + doctitle = os[1]; + } else if (opt.equals("-windowtitle")) { + windowtitle = os[1]; + } else if (opt.equals("-top")) { + top = os[1]; + } else if (opt.equals("-bottom")) { + bottom = os[1]; + } else if (opt.equals("-helpfile")) { + helpfile = os[1]; + } else if (opt.equals("-stylesheetfile")) { + stylesheetfile = os[1]; + } else if (opt.equals("-charset")) { + charset = os[1]; } else if (opt.equals("-xdocrootparent")) { docrootparent = os[1]; - } else if (opt.equals("-nohelp")) { + } else if (opt.equals("-nohelp")) { nohelp = true; - } else if (opt.equals("-splitindex")) { + } else if (opt.equals("-splitindex")) { splitindex = true; - } else if (opt.equals("-noindex")) { + } else if (opt.equals("-noindex")) { createindex = false; - } else if (opt.equals("-use")) { + } else if (opt.equals("-use")) { classuse = true; - } else if (opt.equals("-notree")) { + } else if (opt.equals("-notree")) { createtree = false; - } else if (opt.equals("-nodeprecatedlist")) { + } else if (opt.equals("-nodeprecatedlist")) { nodeprecatedlist = true; - } else if (opt.equals("-nosince")) { - nosince = true; - } else if (opt.equals("-nonavbar")) { + } else if (opt.equals("-nonavbar")) { nonavbar = true; - } else if (opt.equals("-nooverview")) { + } else if (opt.equals("-nooverview")) { nooverview = true; - } else if (opt.equals("-overview")) { + } else if (opt.equals("-overview")) { overview = true; } }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Sep 12 12:32:55 2012 -0700 @@ -364,19 +364,21 @@ if (opt.equals("-d")) { destDirName = addTrailingFileSep(os[1]); docFileDestDirName = destDirName; - } else if (opt.equals("-docfilessubdirs")) { + } else if (opt.equals("-docfilessubdirs")) { copydocfilesubdirs = true; - } else if (opt.equals("-docencoding")) { + } else if (opt.equals("-docencoding")) { docencoding = os[1]; - } else if (opt.equals("-encoding")) { + } else if (opt.equals("-encoding")) { encoding = os[1]; - } else if (opt.equals("-author")) { + } else if (opt.equals("-author")) { showauthor = true; - } else if (opt.equals("-version")) { + } else if (opt.equals("-nosince")) { + nosince = true; + } else if (opt.equals("-version")) { showversion = true; - } else if (opt.equals("-nodeprecated")) { + } else if (opt.equals("-nodeprecated")) { nodeprecated = true; - } else if (opt.equals("-sourcepath")) { + } else if (opt.equals("-sourcepath")) { sourcepath = os[1]; } else if (opt.equals("-classpath") && sourcepath.length() == 0) { @@ -400,17 +402,17 @@ message.warning("doclet.sourcetab_warning"); sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH; } - } else if (opt.equals("-notimestamp")) { + } else if (opt.equals("-notimestamp")) { notimestamp = true; - } else if (opt.equals("-nocomment")) { + } else if (opt.equals("-nocomment")) { nocomment = true; } else if (opt.equals("-tag") || opt.equals("-taglet")) { customTagStrs.add(os); } else if (opt.equals("-tagletpath")) { tagletpath = os[1]; - } else if (opt.equals("-keywords")) { + } else if (opt.equals("-keywords")) { keywords = true; - } else if (opt.equals("-serialwarn")) { + } else if (opt.equals("-serialwarn")) { serialwarn = true; } else if (opt.equals("-group")) { group.checkPackageGroups(os[1], os[2]);
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Wed Sep 12 12:32:55 2012 -0700 @@ -600,6 +600,7 @@ ArrayList<Taglet> mTags = new ArrayList<Taglet>(customTags.size()); ArrayList<Taglet> iTags = new ArrayList<Taglet>(customTags.size()); ArrayList<Taglet> oTags = new ArrayList<Taglet>(customTags.size()); + ArrayList<Taglet> sTags = new ArrayList<Taglet>(); Taglet current; while (it.hasNext()) { current = it.next(); @@ -634,11 +635,12 @@ inlineTags = iTags.toArray(new Taglet[] {}); //Init the serialized form tags - serializedFormTags = new Taglet[4]; - serializedFormTags[0] = customTags.get("serialData"); - serializedFormTags[1] = customTags.get("throws"); - serializedFormTags[2] = customTags.get("since"); - serializedFormTags[3] = customTags.get("see"); + sTags.add(customTags.get("serialData")); + sTags.add(customTags.get("throws")); + if (!nosince) + sTags.add(customTags.get("since")); + sTags.add(customTags.get("see")); + serializedFormTags = sTags.toArray(new Taglet[] {}); } /**
--- a/src/share/classes/com/sun/tools/javac/code/Types.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Wed Sep 12 12:32:55 2012 -0700 @@ -1616,9 +1616,14 @@ * type parameters in t are deleted. */ public Type erasure(Type t) { - return erasure(t, false); + return eraseNotNeeded(t)? t : erasure(t, false); } //where + private boolean eraseNotNeeded(Type t) { + return (t.tag <= lastBaseTag) || (syms.stringType.tsym == t.tsym); + } + + //where private Type erasure(Type t, boolean recurse) { if (t.tag <= lastBaseTag) return t; /* fast special case */
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Sep 12 12:32:55 2012 -0700 @@ -3458,7 +3458,6 @@ JCExpression expression = oneCase.getExpression(); if (expression != null) { // expression for a "default" case is null - expression = TreeInfo.skipParens(expression); String labelExpr = (String) expression.type.constValue(); Integer mapping = caseLabelToPosition.put(labelExpr, casePosition); Assert.checkNull(mapping);
--- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Sep 12 12:32:55 2012 -0700 @@ -247,7 +247,7 @@ JCTry t = (JCTry) tree; return endPos((t.finalizer != null) ? t.finalizer - : t.catchers.last().body); + : (t.catchers.isEmpty()? t.body : t.catchers.last().body)); } else return tree.pos; }
--- a/src/share/classes/com/sun/tools/javah/JavahTask.java Wed Sep 05 15:19:58 2012 -0700 +++ b/src/share/classes/com/sun/tools/javah/JavahTask.java Wed Sep 12 12:32:55 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -506,7 +506,7 @@ List<String> opts = new ArrayList<String>(); opts.add("-proc:only"); opts.addAll(javac_extras); - CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, internalize(classes), null); + CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null); JavahProcessor p = new JavahProcessor(g); t.setProcessors(Collections.singleton(p)); @@ -516,14 +516,6 @@ return ok; } - private List<String> internalize(List<String> classes) { - List<String> l = new ArrayList<String>(); - for (String c: classes) { - l.add(c.replace('$', '.')); - } - return l; - } - private List<File> pathToFiles(String path) { List<File> files = new ArrayList<File>(); for (String f: path.split(File.pathSeparator)) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testSinceTag/TestSinceTag.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2012, 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 7180906 + * @summary Test to make sure that the since tag works correctly + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestSinceTag + * @run main TestSinceTag + */ + +public class TestSinceTag extends JavadocTester { + + //Test information. + private static final String BUG_ID = "7180906"; + + //Javadoc arguments. + private static final String[] ARGS1 = new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1" + }; + + private static final String[] ARGS2 = new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-nosince", "pkg1" + }; + + //Input for string search tests. + private static final String[][] TEST = { + {BUG_ID + FS + "pkg1" + FS + "C1.html", + "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL + + " <dd>JDK1.0</dd>" + }, + {BUG_ID + FS + "serialized-form.html", + "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL + + " <dd>1.4</dd>" + } + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestSinceTag tester = new TestSinceTag(); + run(tester, ARGS1, TEST, NO_TEST); + run(tester, ARGS2, NO_TEST, 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/test/com/sun/javadoc/testSinceTag/pkg1/C1.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2012, 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. + */ +package pkg1; + +import java.io.IOException; +import java.io.Serializable; + +/** + * A class comment for testing. + * + * @author Bhavesh Patel + * @since JDK1.0 + */ +public class C1 implements Serializable { + + /** + * This field indicates whether the C1 is undecorated. + * + * @see #setUndecorated(boolean) + * @since 1.4 + * @serial + * @deprecated As of JDK version 1.5, replaced by + * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}. + */ + @Deprecated + public boolean undecorated = false; + + /** + * This enum specifies the possible modal exclusion types. + * + * @since 1.6 + */ + public static enum ModalExclusionType { + + /** + * No modal exclusion. + */ + NO_EXCLUDE, + /** + * <code>APPLICATION_EXCLUDE</code> indicates that a top-level window + * won't be blocked by any application-modal dialogs. Also, it isn't + * blocked by document-modal dialogs from outside of its child hierarchy. + */ + APPLICATION_EXCLUDE + }; + + /** + * Constructor. + * + * @param title the title + * @param test boolean value + * @exception IllegalArgumentException if the <code>owner</code>'s + * <code>GraphicsConfiguration</code> is not from a screen device + * @exception HeadlessException + */ + public C1(String title, boolean test) { + } + + public C1(String title) { + } + + /** + * Method comments. + * @param undecorated <code>true</code> if no decorations are + * to be enabled; + * <code>false</code> if decorations are to be enabled. + * @see #readObject() + * @since 1.4 + */ + public void setUndecorated(boolean undecorated) { + /* Make sure we don't run in the middle of peer creation.*/ + } + + /** + * @see #setUndecorated(boolean) + */ + public void readObject() throws IOException { + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/StringsInSwitch/7181320/BinOpInCaseLabel.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2012, 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 7181320 + * @summary javac NullPointerException for switch labels with cast to String expressions + * @compile BinOpInCaseLabel.java + */ + +public class BinOpInCaseLabel { + public static void main(String [] args) { + switch (args[0]) { + case "hello" + "world": + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/StringsInSwitch/7181320/CastInCaseLabel.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2012, 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 7181320 + * @summary javac NullPointerException for switch labels with cast to String expressions + * @compile CastInCaseLabel.java + */ + +public class CastInCaseLabel { + public static void main(String [] args) { + switch (args[0]) { + case (String)"hello": + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/StringsInSwitch/7181320/CondExprInCaseLabel.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2012, 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 7181320 + * @summary javac NullPointerException for switch labels with cast to String expressions + * @compile CondExprInCaseLabel.java + */ + +public class CondExprInCaseLabel { + public static void main(String [] args) { + final boolean cond = true; + switch (args[0]) { + case cond ? "hello" : "world": + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/StringsInSwitch/7181320/CondExprInCaseLabel1.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2012, 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 7181320 + * @summary javac NullPointerException for switch labels with cast to String expressions + * @compile CondExprInCaseLabel1.java + */ + +public class CondExprInCaseLabel1 { + public static void main(String [] args) { + final boolean cond = true; + switch (args[0]) { + case cond ? (String)"hello" : "world": + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/StringsInSwitch/7181320/CondExprInCaseLabel2.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2012, 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 7181320 + * @summary javac NullPointerException for switch labels with cast to String expressions + * @compile CondExprInCaseLabel2.java + */ + +public class CondExprInCaseLabel2 { + public static void main(String [] args) { + final boolean cond = true; + switch (args[0]) { + case cond ? "hello" : (String)"world": + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/TryWithResources/T7178324.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012, 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 7178324 + * @summary Crash when compiling for(i : x) try(AutoCloseable x = ...) {} + * @compile T7178324.java + */ + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + +class T7178324 { + public static void main(String[] args) throws Exception { + List<File> files = new ArrayList<>(); + for (File f : files) + try (FileInputStream is = new FileInputStream(f)) { + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javah/T7185778.java Wed Sep 12 12:32:55 2012 -0700 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2012, 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 7185778 + * @summary javah error "Not a valid class name" on class names with dollar signs + * The first two tests are on an inner class name whose name does not contain $. + * The second two tests are on an inner class name whose name does contain $. + * The last test is on an outer class whose name contains $. + * @run main T7185778 T7185778$inner + * @run main T7185778 T7185778.inner + * @run main T7185778 T7185778$inner$ + * @run main T7185778 T7185778.inner$ + * @run main T7185778 xx$yy + */ + +public class T7185778 { + class inner { + native byte[] xxxxx(String name); + } + class inner$ { + native byte[] xxxxx(String name); + } + + static public void main(String[] args) { + int rc = com.sun.tools.javah.Main.run(args, null); + if ( rc != 0) { + throw new Error("javah returned non zero: " + rc); + } + } +} + +class xx$yy { + native byte[] xxxxx(String name); +}