changeset 7416:e822b4d50a5b

Merge
author lana
date Thu, 31 Jan 2013 14:10:14 -0800
parents 771551bc9e02 cff8d7768d72
children a09a37cff333
files src/share/classes/java/lang/annotation/ContainedBy.java src/share/classes/java/lang/annotation/ContainerFor.java
diffstat 13 files changed, 295 insertions(+), 290 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/netbeans/common/architectures/arch-x86_64.properties	Thu Jan 31 14:10:14 2013 -0800
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   - Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#
+#   - Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+#   - Neither the name of Oracle nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+arch=x86_64
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/netbeans/common/architectures/name-Macosx.properties	Thu Jan 31 14:10:14 2013 -0800
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   - Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#
+#   - Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+#   - Neither the name of Oracle nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+platform=macosx
--- a/make/netbeans/common/java-data-native.ent	Thu Jan 31 10:22:25 2013 -0800
+++ b/make/netbeans/common/java-data-native.ent	Thu Jan 31 14:10:14 2013 -0800
@@ -39,11 +39,11 @@
         <classpath mode="boot">${bootstrap.jdk}/jre/lib/rt.jar</classpath>
         <built-to>${root}/build/${platform}-${arch}/classes</built-to>
         <javadoc-built-to>${root}/build/${platform}-${arch}/docs/api</javadoc-built-to>
-        <source-level>1.7</source-level>
+        <source-level>1.8</source-level>
     </compilation-unit>
     <compilation-unit>
         <package-root>${root}/test</package-root>
         <unit-tests/>
-        <source-level>1.7</source-level>
+        <source-level>1.8</source-level>
     </compilation-unit>
 </java-data>
--- a/make/netbeans/common/java-data-no-native.ent	Thu Jan 31 10:22:25 2013 -0800
+++ b/make/netbeans/common/java-data-no-native.ent	Thu Jan 31 14:10:14 2013 -0800
@@ -37,11 +37,11 @@
         <classpath mode="boot">${bootstrap.jdk}/jre/lib/rt.jar</classpath>
         <built-to>${root}/build/${platform}-${arch}/classes</built-to>
         <javadoc-built-to>${root}/build/${platform}-${arch}/docs/api</javadoc-built-to>
-        <source-level>1.7</source-level>
+        <source-level>1.8</source-level>
     </compilation-unit>
     <compilation-unit>
         <package-root>${root}/test</package-root>
         <unit-tests/>
-        <source-level>1.7</source-level>
+        <source-level>1.8</source-level>
     </compilation-unit>
 </java-data>
--- a/make/netbeans/common/make.xml	Thu Jan 31 10:22:25 2013 -0800
+++ b/make/netbeans/common/make.xml	Thu Jan 31 14:10:14 2013 -0800
@@ -33,7 +33,7 @@
 
 <project name="make" basedir="..">
     
-    <target name="-make.init" depends="-init,-pre-init.linux,-pre-init.solaris,-pre-init.windows">
+    <target name="-make.init" depends="-init,-pre-init.linux,-pre-init.macosx,-pre-init.solaris,-pre-init.windows,-pre-init.macosx">
         <property name="make.options" value=""/> <!-- default, can be overridden per user or per project -->
     </target>
     
@@ -42,6 +42,11 @@
         <property name="make" value="make"/>
     </target>
 
+    <target name="-pre-init.macosx" if="os.macosx">
+        <property name="platform" value="macosx"/>
+        <property name="make" value="make"/>
+    </target>
+
     <target name="-pre-init.solaris" if="os.solaris">
         <property name="platform" value="solaris"/>
         <property name="make" value="gmake"/>
--- a/make/netbeans/common/shared.xml	Thu Jan 31 10:22:25 2013 -0800
+++ b/make/netbeans/common/shared.xml	Thu Jan 31 14:10:14 2013 -0800
@@ -85,6 +85,9 @@
         <property name="includes" value="(nothing)"/>
         <property name="excludes" value=""/>
         <property name="javadoc.dir" location="${build.dir}/javadoc/${ant.project.name}"/>
+        <condition property="os.macosx">
+            <os family="mac"/>
+        </condition>
         <condition property="os.linux">
             <os name="linux"/>
         </condition>
@@ -126,10 +129,6 @@
                 <javac srcdir="@{srcdir}" includes="@{includes}" excludes="@{excludes}" sourcepath="" 
                     destdir="@{classesdir}" fork="true" executable="${bootstrap.javac}"
                     debug="${javac.debug}" debuglevel="${javac.debuglevel}">
-                    <compilerarg value="-source"/>
-                    <compilerarg value="1.5"/>
-                    <compilerarg value="-target"/>
-                    <compilerarg value="1.6"/> <!-- for usability of JDK 6 as snapshot; change to 1.7 when JSR 294 put back -->
                     <!-- Mandatory for compiling partial JDK sources against a snapshot; should NEVER be used for any other purpose: -->
                     <compilerarg value="-XDignore.symbol.file=true"/>
                     <compilerarg line="${javac.options}"/>
--- a/src/share/classes/java/lang/annotation/ContainedBy.java	Thu Jan 31 10:22:25 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * 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 java.lang.annotation;
-
-/**
- * The annotation type {@code java.lang.annotation.ContainedBy} is
- * used to indicate that the annotation type whose declaration it
- * (meta-)annotates is <em>repeatable</em>. The value of
- * {@code @ContainedBy} indicates the <em>containing annotation
- * type</em> for the repeatable annotation type.
- *
- * <p>The pair of annotation types {@code @ContainedBy} and
- * {@link java.lang.annotation.ContainerFor @ContainerFor} are used to
- * indicate that annotation types are repeatable. Specifically:
- *
- * <ul>
- * <li>The annotation type {@code @ContainedBy} is used on the
- * declaration of a repeatable annotation type (JLS 9.6) to indicate
- * its containing annotation type.
- *
- * <li>The annotation type {@code @ContainerFor} is used on the
- * declaration of a containing annotation type (JLS 9.6) to indicate
- * the repeatable annotation type for which it serves as the
- * containing annotation type.
- * </ul>
- *
- * <p>
- * An inconsistent pair of {@code @ContainedBy} and
- * {@code @ContainerFor} annotations on a repeatable annotation type
- * and its containing annotation type (JLS 9.6) will lead to
- * compile-time errors and runtime exceptions when using reflection to
- * read annotations of a repeatable type.
- *
- * @see java.lang.annotation.ContainerFor
- * @since 1.8
- * @jls 9.6 Annotation Types
- * @jls 9.7 Annotations
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.ANNOTATION_TYPE)
-public @interface ContainedBy {
-    /**
-     * Indicates the <em>containing annotation type</em> for the
-     * repeatable annotation type.
-     */
-    Class<? extends Annotation> value();
-}
--- a/src/share/classes/java/lang/annotation/ContainerFor.java	Thu Jan 31 10:22:25 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * 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 java.lang.annotation;
-
-/**
- * The annotation type {@code java.lang.annotation.ContainerFor} is
- * used to indicate that the annotation type whose declaration it
- * (meta-)annotates is a <em>containing annotation type</em>. The
- * value of {@code @ContainerFor} indicates the <em>repeatable
- * annotation type</em> for the containing annotation type.
- *
- * <p>The pair of annotation types {@link
- * java.lang.annotation.ContainedBy @ContainedBy} and
- * {@code @ContainerFor} are used to indicate that annotation types
- * are repeatable. Specifically:
- *
- * <ul>
- * <li>The annotation type {@code @ContainedBy} is used on the
- * declaration of a repeatable annotation type (JLS 9.6) to indicate
- * its containing annotation type.
- *
- * <li>The annotation type {@code @ContainerFor} is used on the
- * declaration of a containing annotation type (JLS 9.6) to indicate
- * the repeatable annotation type for which it serves as the
- * containing annotation type.
- * </ul>
- *
- * <p>
- * An inconsistent pair of {@code @ContainedBy} and
- * {@code @ContainerFor} annotations on a repeatable annotation type
- * and its containing annotation type (JLS 9.6) will lead to
- * compile-time errors and runtime exceptions when using reflection to
- * read annotations of a repeatable type.
- *
- * @see java.lang.annotation.ContainedBy
- * @since 1.8
- * @jls 9.6 Annotation Types
- * @jls 9.7 Annotations
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.ANNOTATION_TYPE)
-public @interface ContainerFor {
-
-    /**
-     * Indicates the repeatable annotation type for the containing
-     * annotation type.
-     */
-    Class<? extends Annotation> value();
-}
--- a/src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java	Thu Jan 31 10:22:25 2013 -0800
+++ b/src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java	Thu Jan 31 14:10:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,10 +27,9 @@
 import java.util.Objects;
 
 /**
- * Thrown to indicate that an annotation type whose declaration is
- * (meta-)annotated with a {@link ContainerFor} annotation is not, in
- * fact, the <em>containing annotation type of the type named by {@link
- * ContainerFor}</em>.
+ * Thrown to indicate that an annotation type expected to act as a
+ * container for another annotation type by virture of an @Repeatable
+ * annotation, does not act as a container.
  *
  * @see   java.lang.reflect.AnnotatedElement
  * @since 1.8
--- a/src/share/classes/java/util/Base64.java	Thu Jan 31 10:22:25 2013 -0800
+++ b/src/share/classes/java/util/Base64.java	Thu Jan 31 14:10:14 2013 -0800
@@ -413,6 +413,7 @@
          *          specified Base64 encoded format
          */
         public OutputStream wrap(OutputStream os) {
+            Objects.requireNonNull(os);
             return new EncOutputStream(os, isURL ? toBase64URL : toBase64,
                                        newline, linemax);
         }
@@ -695,7 +696,7 @@
          * using the {@link Base64} encoding scheme.
          *
          * <p> An invocation of this method has exactly the same effect as invoking
-         * {@code return decode(src.getBytes(StandardCharsets.ISO_8859_1))}
+         * {@code decode(src.getBytes(StandardCharsets.ISO_8859_1))}
          *
          * @param   src
          *          the string to decode
@@ -866,6 +867,7 @@
          *          byte stream
          */
         public InputStream wrap(InputStream is) {
+            Objects.requireNonNull(is);
             return new DecInputStream(is, isURL ? fromBase64URL : fromBase64, isMIME);
         }
 
@@ -1012,9 +1014,12 @@
             int len = sl - sp;
             if (len == 0)
                 return 0;
-            if (len < 2)
+            if (len < 2) {
+                if (isMIME && base64[0] == -1)
+                    return 0;
                 throw new IllegalArgumentException(
                     "Input byte[] should at least have 2 bytes for base64 bytes");
+            }
             if (src[sl - 1] == '=') {
                 paddings++;
                 if (src[sl - 2] == '=')
--- a/test/java/lang/reflect/Parameter/WithoutParameters.java	Thu Jan 31 10:22:25 2013 -0800
+++ b/test/java/lang/reflect/Parameter/WithoutParameters.java	Thu Jan 31 14:10:14 2013 -0800
@@ -23,163 +23,152 @@
 
 /*
  * @test
+ * @bug 8004729
  * @summary javac should generate method parameters correctly.
  */
 
 import java.lang.*;
 import java.lang.reflect.*;
+import java.lang.annotation.*;
 import java.util.List;
+import java.util.Objects;
+
+import static java.lang.annotation.ElementType.*;
 
 public class WithoutParameters {
+    int errors = 0;
 
-    private static final Class<?>[] qux_types = {
-        int.class,
-        Foo.class,
-        List.class,
-        List.class,
-        List.class,
-        String[].class
-    };
+    private WithoutParameters() {}
 
     public static void main(String argv[]) throws Exception {
-        int error = 0;
-        Method[] methods = Foo.class.getMethods();
-        for(Method m : methods) {
-            System.err.println("Inspecting method " + m);
-            Parameter[] parameters = m.getParameters();
-            if(parameters == null)
-                throw new Exception("getParameters should never be null");
-            for(int i = 0; i < parameters.length; i++) {
-                    Parameter p = parameters[i];
-                    if(!p.getDeclaringExecutable().equals(m)) {
-                        System.err.println(p + ".getDeclaringExecutable != " + m);
-                        error++;
-                    }
-                    if(null == p.getType()) {
-                        System.err.println(p + ".getType() == null");
-                        error++;
-                    }
-                    if(null == p.getParameterizedType()) {
-                        System.err.println(p + ".getParameterizedType == null");
-                        error++;
-                    }
-            }
-            if(m.getName().equals("qux")) {
-                if(6 != parameters.length) {
-                    System.err.println("Wrong number of parameters for qux");
-                    error++;
-                }
-                for(int i = 0; i < parameters.length; i++) {
-                    Parameter p = parameters[i];
-                    // The getType family work with or without
-                    // parameter attributes compiled in.
-                    if(!parameters[i].getType().equals(qux_types[i])) {
-                        System.err.println("Wrong parameter type for " + parameters[0] + ": expected " + qux_types[i] + ", but got " + parameters[i].getType());
-                        error++;
+        WithoutParameters wp = new WithoutParameters();
+        wp.runTests(Foo.class.getMethods());
+        wp.runTests(Foo.Inner.class.getConstructors());
+        wp.checkForErrors();
+    }
+
+    void runTests(Method[] methods) throws Exception {
+        for(Method m : methods) {runTest(m);}
+    }
+
+    void runTests(Constructor[] constructors) throws Exception {
+        for(Constructor c : constructors) {runTest(c);}
+    }
+
+    void runTest(Executable e) throws Exception {
+        System.err.println("Inspecting executable " + e);
+        Parameter[] parameters = e.getParameters();
+        Objects.requireNonNull(parameters, "getParameters should never be null");
+
+        ExpectedParameterInfo epi = e.getAnnotation(ExpectedParameterInfo.class);
+        if (epi != null) {
+            abortIfTrue(epi.parameterCount() != e.getParameterCount(), "Bad parameter count for "+ e);
+            abortIfTrue(epi.isVarArgs() != e.isVarArgs(),"Bad varargs value for "+ e);
+        }
+        abortIfTrue(e.getParameterCount() != parameters.length, "Mismatched of parameter counts.");
+
+        for(int i = 0; i < parameters.length; i++) {
+            Parameter p = parameters[i];
+            errorIfTrue(!p.getDeclaringExecutable().equals(e), p + ".getDeclaringExecutable != " + e);
+            Objects.requireNonNull(p.getType(), "getType() should not be null");
+            Objects.requireNonNull(p.getParameterizedType(), "getParameterizedType() should not be null");
+
+            if (epi != null) {
+                Class<?> expectedParameterType = epi.parameterTypes()[i];
+                errorIfTrue(!p.getType().equals(expectedParameterType),
+                            "Wrong parameter type for " + p + ": expected " + expectedParameterType  +
+                            ", but got " + p.getType());
+
+                ParameterizedInfo[] expectedParameterizedTypes = epi.parameterizedTypes();
+                if (expectedParameterizedTypes.length > 0) {
+                    Type parameterizedType = p.getParameterizedType();
+                    Class<? extends Type> expectedParameterziedTypeType = expectedParameterizedTypes[i].value();
+                    errorIfTrue(!expectedParameterziedTypeType.isAssignableFrom(parameterizedType.getClass()),
+                                "Wrong class of parameteried type of " + p + ": expected " + expectedParameterziedTypeType  +
+                                ", but got " + parameterizedType.getClass());
+
+                    if (expectedParameterziedTypeType.equals(Class.class)) {
+                        errorIfTrue(!parameterizedType.equals(expectedParameterType),
+                                    "Wrong parameteried type for " + p + ": expected " + expectedParameterType  +
+                                    ", but got " + parameterizedType);
+                    } else {
+                        if (expectedParameterziedTypeType.equals(ParameterizedType.class)) {
+                            ParameterizedType ptype = (ParameterizedType)parameterizedType;
+                            errorIfTrue(!ptype.getRawType().equals(expectedParameterType),
+                                        "Wrong raw type for " + p + ": expected " + expectedParameterType  +
+                                        ", but got " + ptype.getRawType());
+                        }
+
+                        // Check string representation
+                        String expectedStringOfType = epi.parameterizedTypes()[i].string();
+                        errorIfTrue(!expectedStringOfType.equals(parameterizedType.toString()),
+                                    "Bad type string" + p + ": expected " + expectedStringOfType  +
+                                    ", but got " + parameterizedType.toString());
                     }
                 }
-                if(!parameters[0].getParameterizedType().equals(int.class)) {
-                    System.err.println("getParameterizedType for quux is wrong");
-                    error++;
-                }
-                if(!parameters[1].getParameterizedType().equals(Foo.class)) {
-                    System.err.println("getParameterizedType for quux is wrong");
-                    error++;
-                }
-                if(!(parameters[2].getParameterizedType() instanceof
-                     ParameterizedType)) {
-                    System.err.println("getParameterizedType for l is wrong");
-                    error++;
-                } else {
-                    ParameterizedType pt =
-                        (ParameterizedType) parameters[2].getParameterizedType();
-                    if(!pt.getRawType().equals(List.class)) {
-                        System.err.println("Raw type for l is wrong");
-                        error++;
-                    }
-                    if(1 != pt.getActualTypeArguments().length) {
-                        System.err.println("Number of type parameters for l is wrong");
-                        error++;
-                    }
-                    if(!(pt.getActualTypeArguments()[0] instanceof WildcardType)) {
-                        System.err.println("Type parameter for l is wrong");
-                        error++;
-                    }
-                }
-                if(!(parameters[3].getParameterizedType() instanceof
-                     ParameterizedType)) {
-                    System.err.println("getParameterizedType for l2 is wrong");
-                    error++;
-                } else {
-                    ParameterizedType pt =
-                        (ParameterizedType) parameters[3].getParameterizedType();
-                    if(!pt.getRawType().equals(List.class)) {
-                        System.err.println("Raw type for l2 is wrong");
-                        error++;
-                    }
-                    if(1 != pt.getActualTypeArguments().length) {
-                        System.err.println("Number of type parameters for l2 is wrong");
-                        error++;
-                    }
-                    if(!(pt.getActualTypeArguments()[0].equals(Foo.class))) {
-                        System.err.println("Type parameter for l2 is wrong");
-                        error++;
-                    }
-                }
-                if(!(parameters[4].getParameterizedType() instanceof
-                     ParameterizedType)) {
-                    System.err.println("getParameterizedType for l3 is wrong");
-                    error++;
-                } else {
-                    ParameterizedType pt =
-                        (ParameterizedType) parameters[4].getParameterizedType();
-                    if(!pt.getRawType().equals(List.class)) {
-                        System.err.println("Raw type for l3 is wrong");
-                        error++;
-                    }
-                    if(1 != pt.getActualTypeArguments().length) {
-                        System.err.println("Number of type parameters for l3 is wrong");
-                        error++;
-                    }
-                    if(!(pt.getActualTypeArguments()[0] instanceof WildcardType)) {
-                        System.err.println("Type parameter for l3 is wrong");
-                        error++;
-                    } else {
-                        WildcardType wt = (WildcardType)
-                            pt.getActualTypeArguments()[0];
-                        if(!wt.getUpperBounds()[0].equals(Foo.class)) {
-                            System.err.println("Upper bounds on type parameter fol l3 is wrong");
-                            error++;
-                        }
-                    }
-                }
-                if(!parameters[5].isVarArgs()) {
-                    System.err.println("isVarArg for rest is wrong");
-                    error++;
-                }
-                if(!(parameters[5].getParameterizedType().equals(String[].class))) {
-                    System.err.println("getParameterizedType for rest is wrong");
-                    error++;
-                }
-
             }
         }
-        if(0 != error)
-            throw new Exception("Failed " + error + " tests");
+    }
+
+    private void checkForErrors() {
+        if (errors > 0)
+            throw new RuntimeException("Failed " + errors + " tests");
+    }
+
+    private void errorIfTrue(boolean predicate, String errMessage) {
+        if (predicate) {
+            errors++;
+            System.err.println(errMessage);
+        }
+    }
+
+    private void abortIfTrue(boolean predicate, String errMessage) {
+        if (predicate) {
+            throw new RuntimeException(errMessage);
+        }
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({METHOD, CONSTRUCTOR})
+    @interface ExpectedParameterInfo {
+        int parameterCount() default 0;
+        Class<?>[] parameterTypes() default {};
+        ParameterizedInfo[] parameterizedTypes() default {};
+        boolean isVarArgs() default false;
+    }
+
+    @Target({})
+    @interface ParameterizedInfo {
+        Class<? extends Type> value() default Class.class;
+        String string() default "";
     }
 
     public class Foo {
         int thing;
+        @ExpectedParameterInfo(parameterCount = 6,
+                               parameterTypes =
+                               {int.class, Foo.class,
+                                List.class, List.class,
+                                List.class, String[].class},
+                               parameterizedTypes =
+                                {@ParameterizedInfo(Class.class),
+                                 @ParameterizedInfo(Class.class),
+                                 @ParameterizedInfo(value=ParameterizedType.class, string="java.util.List<?>"),
+                                 @ParameterizedInfo(value=ParameterizedType.class, string="java.util.List<WithoutParameters$Foo>"),
+                                 @ParameterizedInfo(value=ParameterizedType.class, string="java.util.List<? extends WithoutParameters$Foo>"),
+                                 @ParameterizedInfo(Class.class)},
+                               isVarArgs = true)
         public void qux(int quux, Foo quuux,
                         List<?> l, List<Foo> l2,
                         List<? extends Foo> l3,
                         String... rest) {}
         public class Inner {
             int thang;
+            @ExpectedParameterInfo(parameterCount = 2,
+                                   parameterTypes = {Foo.class, int.class})
             public Inner(int theng) {
                 thang = theng + thing;
             }
         }
     }
-
 }
--- a/test/java/util/Base64/TestBase64.java	Thu Jan 31 10:22:25 2013 -0800
+++ b/test/java/util/Base64/TestBase64.java	Thu Jan 31 14:10:14 2013 -0800
@@ -22,7 +22,7 @@
  */
 
 /**
- * @test 4235519 8004212
+ * @test 4235519 8004212 8005394 8007298
  * @summary tests java.util.Base64
  */
 
@@ -109,6 +109,9 @@
 
         // test return value from decode(ByteBuffer, ByteBuffer)
         testDecBufRet();
+
+        // test single-non-base64 character for mime decoding
+        testSingleNonBase64MimeDec();
     }
 
     private static sun.misc.BASE64Encoder sunmisc = new sun.misc.BASE64Encoder();
@@ -295,6 +298,7 @@
         checkNull(new Runnable() { public void run() { enc.encode(bb_null); }});
         checkNull(new Runnable() { public void run() { enc.encode(bb_null, ByteBuffer.allocate(10), 0); }});
         checkNull(new Runnable() { public void run() { enc.encode(ByteBuffer.allocate(10), bb_null, 0); }});
+        checkNull(new Runnable() { public void run() { enc.wrap(null); }});
     }
 
     private static void testNull(final Base64.Decoder dec) {
@@ -305,6 +309,7 @@
         checkNull(new Runnable() { public void run() { dec.decode(bb_null); }});
         checkNull(new Runnable() { public void run() { dec.decode(bb_null, ByteBuffer.allocate(10)); }});
         checkNull(new Runnable() { public void run() { dec.decode(ByteBuffer.allocate(10), bb_null); }});
+        checkNull(new Runnable() { public void run() { dec.wrap(null); }});
     }
 
     private static interface Testable {
@@ -354,6 +359,19 @@
         } catch (IllegalArgumentException iae) {}
     }
 
+    // single-non-base64-char should be ignored for mime decoding, but
+    // iae for basic decoding
+    private static void testSingleNonBase64MimeDec() throws Throwable {
+        for (String nonBase64 : new String[] {"#", "(", "!", "\\", "-", "_"}) {
+            if (Base64.getMimeDecoder().decode(nonBase64).length != 0) {
+                throw new RuntimeException("non-base64 char is not ignored");
+            }
+            try {
+                Base64.getDecoder().decode(nonBase64);
+                throw new RuntimeException("No IAE for single non-base64 char");
+            } catch (IllegalArgumentException iae) {}
+        }
+    }
 
     private static void testDecBufRet() throws Throwable {
         Random rnd = new java.util.Random();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/HashMap/HashMapCloneLeak.java	Thu Jan 31 14:10:14 2013 -0800
@@ -0,0 +1,70 @@
+/*
+ * 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 7042126
+ * @summary Verify that we do not leak contents when we clone a HashMap
+ * @author david.buck@oracle.com
+ * @run main/othervm HashMapCloneLeak
+ * @run main/othervm -XX:+AggressiveOpts HashMapCloneLeak
+ */
+
+import java.util.HashMap;
+import java.lang.ref.WeakReference;
+
+public class HashMapCloneLeak {
+
+    static WeakReference<Object> wr = null;
+
+    // helper method to keep testObject and map out of main method's scope
+    private static HashMap<Integer, Object> makeMap() {
+        HashMap<Integer, Object> map = new HashMap<Integer, Object>();
+        Object testObject = new Object();
+        wr = new WeakReference<Object>(testObject);
+        map.put(42, testObject);
+        return map;
+    }
+
+    public static void main(String[] args) throws Exception {
+        HashMap<Integer, Object> hm = makeMap();
+        hm = (HashMap<Integer, Object>)hm.clone();
+        hm.clear();
+        // There should no longer be a strong reference to testObject
+        // the WeakReference should be nulled out by GC. If not,
+        // we will hang here until timed out by the test harness.
+        Object[] chain = null;
+        while (wr.get() != null) {
+            try {
+                Object[] allocate = new Object[1000000];
+                allocate[0] = chain;
+                chain = allocate;
+            } catch (OutOfMemoryError oome) {
+                chain = null;
+            }
+            System.gc();
+            Thread.sleep(100);
+        }
+    }
+
+}