8049238: Implement classfile tests for Signature attribute
authoraeremeev
Wed, 25 Mar 2015 10:29:14 +0300
changeset 29637 c03745b71c70
parent 29559 47544495db2d
child 29638 155062c00bfa
child 29772 4e4e74b99d27
8049238: Implement classfile tests for Signature attribute Reviewed-by: jjg, shurailine, anazarov
langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/Driver.java
langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/ExpectedSignature.java
langtools/test/tools/javac/classfiles/attributes/Signature/ExpectedSignatureContainer.java
langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java
langtools/test/tools/javac/classfiles/attributes/lib/TestResult.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for constructors.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build ConstructorTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver ConstructorTest
+ */
+
+import java.lang.ref.ReferenceQueue;
+import java.util.*;
+
+@ExpectedSignature(descriptor = "ConstructorTest", signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;")
+public class ConstructorTest<T> {
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, boolean)", signature = "(TT;Z)V")
+    ConstructorTest(T a, boolean b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, byte)", signature = "(TT;B)V")
+    ConstructorTest(T a, byte b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, char)", signature = "(TT;C)V")
+    ConstructorTest(T a, char b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, short)", signature = "(TT;S)V")
+    ConstructorTest(T a, short b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, int)", signature = "(TT;I)V")
+    ConstructorTest(T a, int b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, long)", signature = "(TT;J)V")
+    ConstructorTest(T a, long b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, float)", signature = "(TT;F)V")
+    ConstructorTest(T a, float b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, double)", signature = "(TT;D)V")
+    ConstructorTest(T a, double b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, java.lang.Runnable)", signature = "(TT;Ljava/lang/Runnable;)V")
+    ConstructorTest(T a, Runnable r) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, boolean[])", signature = "(TT;[Z)V")
+    ConstructorTest(T a, boolean[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, byte[])", signature = "(TT;[B)V")
+    ConstructorTest(T a, byte[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, char[])", signature = "(TT;[C)V")
+    ConstructorTest(T a, char[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, short[])", signature = "(TT;[S)V")
+    ConstructorTest(T a, short[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, int[])", signature = "(TT;[I)V")
+    ConstructorTest(T a, int[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, long[])", signature = "(TT;[J)V")
+    ConstructorTest(T a, long[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, float[])", signature = "(TT;[F)V")
+    ConstructorTest(T a, float[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, double[])", signature = "(TT;[D)V")
+    ConstructorTest(T a, double[] b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, java.lang.Runnable[])", signature = "(TT;[Ljava/lang/Runnable;)V")
+    ConstructorTest(T a, Runnable[] r) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object[])", signature = "([TT;)V")
+    ConstructorTest(T[] a) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Runnable[])",
+            signature = "<T::Ljava/lang/Runnable;>([TT;)V")
+    <T extends Runnable> ConstructorTest(T...a) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.util.Map)", signature = "(Ljava/util/Map<**>;)V")
+    ConstructorTest(Map<?, ?> a) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object)", signature = "(TT;)V")
+    ConstructorTest(T a) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.util.Set, java.util.Set)",
+            signature = "<E::Ljava/util/Set<+TT;>;>(TE;TE;)V")
+    <E extends Set<? extends T>> ConstructorTest(E a, E b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.ref.ReferenceQueue, java.lang.ref.ReferenceQueue)",
+            signature = "<E:Ljava/lang/ref/ReferenceQueue<-TT;>;:Ljava/util/Map<-TT;+TT;>;>(TE;TE;)V")
+    <E extends ReferenceQueue<? super T> & Map<? super T, ? extends T>> ConstructorTest(E a, E b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.util.List)", signature = "(Ljava/util/List<+TT;>;)V")
+    ConstructorTest(List<? extends T> b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.util.Set)", signature = "(Ljava/util/Set<-TT;>;)V")
+    ConstructorTest(Set<? super T> b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Runnable)", signature = "<E::Ljava/lang/Runnable;>(TE;)V")
+    <E extends Runnable> ConstructorTest(E a) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, java.lang.Object)", signature = "<E:TT;>(TT;TE;)V")
+    <E extends T> ConstructorTest(T a, E b) {
+    }
+
+    // no Signature attribute
+    ConstructorTest(boolean b) {
+    }
+
+    // no Signature attribute
+    ConstructorTest(HashMap a) {
+    }
+
+    // no Signature attribute
+    ConstructorTest(boolean[] b) {
+    }
+
+    // no Signature attribute
+    ConstructorTest(HashMap[] a) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/Driver.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2015, 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 com.sun.tools.classfile.*;
+import com.sun.tools.classfile.Field;
+import com.sun.tools.classfile.Method;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * The main class of Signature tests.
+ * Driver reads golden data of each class member that must have a Signature attribute,
+ * after that the class compares expected data with actual one.
+ *
+ * Example of usage Driver:
+ * java Driver Test
+ *
+ * Each member of the class Test should have @ExpectedSignature annotations
+ * if it must have the Signature attribute. Anonymous class cannot be annotated.
+ * So its enclosing class should be annotated and method isAnonymous
+ * of ExpectedSignature must return true.
+ */
+public class Driver extends TestResult {
+
+    private final static String ACC_BRIDGE = "ACC_BRIDGE";
+
+    private final String topLevelClassName;
+    private final File[] files;
+
+    public Driver(String topLevelClassName) {
+        this.topLevelClassName = topLevelClassName;
+        // Get top level class and all inner classes.
+        FilenameFilter filter = (dir, file) ->
+                file.equals(topLevelClassName + ".class")
+                        || file.matches(topLevelClassName + "\\$.*\\.class");
+        files = getClassDir().listFiles(filter);
+    }
+
+    private boolean isAnonymous(String className) {
+        return className.matches(".*\\$\\d+$");
+    }
+
+    private Class<?> getEnclosingClass(String className) throws ClassNotFoundException {
+        return Class.forName(className.replaceFirst("\\$\\d+$", ""));
+    }
+
+    private ExpectedSignature getExpectedClassSignature(String className, Class<?> clazz)
+            throws ClassNotFoundException {
+        // anonymous class cannot be annotated, so information about anonymous class
+        // is located in its enclosing class.
+        boolean isAnonymous = isAnonymous(className);
+        clazz = isAnonymous ? getEnclosingClass(className) : clazz;
+        return Stream.of(clazz.getAnnotationsByType(ExpectedSignature.class))
+                .filter(s -> s.isAnonymous() == isAnonymous)
+                .collect(Collectors.toMap(ExpectedSignature::descriptor, Function.identity()))
+                .get(className);
+    }
+
+    // Class.getName() cannot be used here, because the method can rely on signature attribute.
+    private Map<String, ExpectedSignature> getClassExpectedSignature(String className, Class<?> clazz)
+            throws ClassNotFoundException {
+        Map<String, ExpectedSignature> classSignatures = new HashMap<>();
+        ExpectedSignature classSignature = getExpectedClassSignature(className, clazz);
+        if (classSignature != null) {
+            classSignatures.put(className, classSignature);
+        }
+        return classSignatures;
+    }
+
+    private Map<String, ExpectedSignature> getExpectedExecutableSignatures(Executable[] executables,
+                                                                           Predicate<Executable> filterBridge) {
+        return Stream.of(executables)
+                .filter(filterBridge)
+                .map(e -> e.getAnnotation(ExpectedSignature.class))
+                .filter(Objects::nonNull)
+                .collect(Collectors.toMap(ExpectedSignature::descriptor, Function.identity()));
+    }
+
+    private Map<String, ExpectedSignature> getExpectedMethodSignatures(Class<?> clazz) {
+        Map<String, ExpectedSignature> methodSignatures =
+                getExpectedExecutableSignatures(clazz.getDeclaredMethods(),
+                        m -> !((java.lang.reflect.Method) m).isBridge());
+        methodSignatures.putAll(
+                getExpectedExecutableSignatures(clazz.getDeclaredConstructors(),
+                        m -> true));
+        return methodSignatures;
+    }
+
+    private Map<String, ExpectedSignature> getExpectedFieldSignatures(Class<?> clazz) {
+        return Stream.of(clazz.getDeclaredFields())
+                .map(f -> f.getAnnotation(ExpectedSignature.class))
+                .filter(Objects::nonNull)
+                .collect(Collectors.toMap(ExpectedSignature::descriptor, Function.identity()));
+    }
+
+    public void test() throws TestFailedException {
+        try {
+            addTestCase("Source is " + topLevelClassName + ".java");
+            assertTrue(files.length > 0, "No class files found");
+            for (File file : files) {
+                try {
+                    String className = file.getName().replace(".class", "");
+                    Class<?> clazz = Class.forName(className);
+                    printf("Testing class %s\n", className);
+                    ClassFile classFile = readClassFile(file);
+
+                    // test class signature
+                    testAttribute(
+                            className,
+                            classFile,
+                            () -> (Signature_attribute) classFile.getAttribute(Attribute.Signature),
+                            getClassExpectedSignature(className, clazz).get(className));
+
+                    testFields(getExpectedFieldSignatures(clazz), classFile);
+
+                    testMethods(getExpectedMethodSignatures(clazz), classFile);
+                } catch (Exception e) {
+                    addFailure(e);
+                }
+            }
+        } catch (Exception e) {
+            addFailure(e);
+        } finally {
+            checkStatus();
+        }
+    }
+
+    private void checkAllMembersFound(Set<String> found, Map<String, ExpectedSignature> signatures, String message) {
+        if (signatures != null) {
+            checkContains(found,
+                    signatures.values().stream()
+                            .map(ExpectedSignature::descriptor)
+                            .collect(Collectors.toSet()),
+                    message);
+        }
+    }
+
+    private void testMethods(Map<String, ExpectedSignature> expectedSignatures, ClassFile classFile)
+            throws ConstantPoolException, Descriptor.InvalidDescriptor {
+        String className = classFile.getName();
+        Set<String> foundMethods = new HashSet<>();
+        for (Method method : classFile.methods) {
+            String methodName = getMethodName(classFile, method);
+            printf("Testing method %s\n", methodName);
+            if (method.access_flags.getMethodFlags().contains(ACC_BRIDGE)) {
+                printf("Bridge method is skipped : %s\n", methodName);
+                continue;
+            }
+            testAttribute(
+                    methodName,
+                    classFile,
+                    () -> (Signature_attribute) method.attributes.get(Attribute.Signature),
+                    expectedSignatures.get(methodName));
+            foundMethods.add(methodName);
+        }
+        checkAllMembersFound(foundMethods, expectedSignatures,
+                "Checking that all methods of class " + className + " with Signature attribute found");
+    }
+
+    private String getMethodName(ClassFile classFile, Method method)
+            throws ConstantPoolException, Descriptor.InvalidDescriptor {
+        return String.format("%s%s",
+                method.getName(classFile.constant_pool),
+                method.descriptor.getParameterTypes(classFile.constant_pool));
+    }
+
+    private void testFields(Map<String, ExpectedSignature> expectedSignatures, ClassFile classFile)
+            throws ConstantPoolException {
+        String className = classFile.getName();
+        Set<String> foundFields = new HashSet<>();
+        for (Field field : classFile.fields) {
+            String fieldName = field.getName(classFile.constant_pool);
+            printf("Testing field %s\n", fieldName);
+            testAttribute(
+                    fieldName,
+                    classFile,
+                    () -> (Signature_attribute) field.attributes.get(Attribute.Signature),
+                    expectedSignatures.get(fieldName));
+            foundFields.add(fieldName);
+        }
+        checkAllMembersFound(foundFields, expectedSignatures,
+                "Checking that all fields of class " + className + " with Signature attribute found");
+    }
+
+    private void testAttribute(
+            String memberName,
+            ClassFile classFile,
+            Supplier<Signature_attribute> sup,
+            ExpectedSignature expectedSignature)
+            throws ConstantPoolException {
+
+        Signature_attribute attribute = sup.get();
+        if (expectedSignature != null && checkNotNull(attribute, memberName + " must have attribute")) {
+            checkEquals(classFile.constant_pool.getUTF8Value(attribute.attribute_name_index),
+                    "Signature", "Attribute's name : " + memberName);
+            checkEquals(attribute.attribute_length, 2, "Attribute's length : " + memberName);
+            checkEquals(attribute.getSignature(classFile.constant_pool),
+                    expectedSignature.signature(),
+                    "Testing signature of : " + memberName);
+        } else {
+            checkNull(attribute, memberName + " must not have attribute");
+        }
+    }
+
+    public static void main(String[] args) throws TestFailedException {
+        if (args.length != 1) {
+            throw new IllegalArgumentException("Usage: Driver <class-name>");
+        }
+        new Driver(args[0]).test();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for enum.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build EnumTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver EnumTest
+ */
+
+@ExpectedSignature(descriptor = "EnumTest", signature = "Ljava/lang/Enum<LEnumTest;>;")
+public enum EnumTest {;
+    // see 8026480
+    @ExpectedSignature(descriptor = "<init>(java.lang.String, int)", signature = "()V")
+    private EnumTest() {}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for methods which throw exceptions.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build ExceptionTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver ExceptionTest
+ */
+
+import java.io.IOError;
+import java.io.IOException;
+
+@ExpectedSignature(descriptor = "ExceptionTest",
+        signature = "<Exc:Ljava/lang/RuntimeException;:Ljava/lang/Runnable;>Ljava/lang/Object;")
+public class ExceptionTest<Exc extends RuntimeException & Runnable> {
+
+    @ExpectedSignature(descriptor = "<init>()", signature = "<E:Ljava/lang/Exception;>()V^TE;")
+    <E extends Exception> ExceptionTest() throws E {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(int)",
+            signature = "<E:Ljava/lang/Exception;>(I)V^Ljava/io/IOException;^TE;^Ljava/io/IOError;")
+    <E extends Exception> ExceptionTest(int a) throws IOException, E, IOError {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(long)", signature = "(J)V^TExc;")
+    ExceptionTest(long a) throws Exc {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(byte)", signature = "(B)V^Ljava/io/IOError;^TExc;^Ljava/io/IOException;")
+    ExceptionTest(byte a) throws IOError, Exc, IOException {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.RuntimeException)", signature = "(TExc;)V")
+    ExceptionTest(Exc a) throws IOException {
+    }
+
+    // no Signature attribute
+    ExceptionTest(String a) throws IOError {
+    }
+
+    void noSignatureAttributeMethod() throws IOException {
+    }
+
+    @ExpectedSignature(descriptor = "genericMethod(int)", signature = "(I)V^TExc;")
+    void genericMethod(int a) throws Exc {
+    }
+
+    @ExpectedSignature(descriptor = "genericMethod(long)", signature = "(J)V^TExc;^Ljava/io/IOException;")
+    void genericMethod(long a) throws Exc, IOException {
+    }
+
+    @ExpectedSignature(descriptor = "genericMethod(java.lang.RuntimeException)", signature = "(TExc;)V")
+    void genericMethod(Exc a) throws IOError {
+    }
+
+    static void staticNoSignatureAttributeMethod() throws IOException {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericMethod(int)",
+            signature = "<E:Ljava/lang/Exception;:Ljava/lang/Runnable;>(I)V^TE;")
+    static <E extends Exception & Runnable> void staticGenericMethod(int a) throws E {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericMethod(long)",
+            signature = "<E:Ljava/lang/Exception;>(J)V^Ljava/io/IOError;^TE;^Ljava/io/IOException;")
+    static <E extends Exception> void staticGenericMethod(long a) throws IOError, E, IOException {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericMethod(java.lang.Exception)",
+            signature = "<E:Ljava/lang/Exception;>(TE;)V")
+    static <E extends Exception> void staticGenericMethod(E a) throws IOError {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ExpectedSignature.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015, 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 java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Repeatable(ExpectedSignatureContainer.class)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedSignature {
+    boolean isAnonymous() default false;
+    String descriptor();
+    String signature();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ExpectedSignatureContainer.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, 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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedSignatureContainer {
+    ExpectedSignature[] value();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for fields.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build FieldTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver FieldTest
+ */
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+@ExpectedSignature(descriptor = "FieldTest", signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;")
+public class FieldTest<T> {
+
+    @ExpectedSignature(descriptor = "typeInList", signature = "Ljava/util/List<TT;>;")
+    List<T> typeInList;
+
+    @ExpectedSignature(descriptor = "boundsType", signature = "Ljava/util/List<Ljava/util/Map<+TT;-TT;>;>;")
+    List<Map<? extends T, ? super T>> boundsType;
+
+    @ExpectedSignature(descriptor = "type", signature = "TT;")
+    T type;
+
+    @ExpectedSignature(descriptor = "typeInArray", signature = "[TT;")
+    T[] typeInArray;
+
+    @ExpectedSignature(descriptor = "byteArrayInList", signature = "Ljava/util/List<[B>;")
+    List<byte[]> byteArrayInList;
+
+    @ExpectedSignature(descriptor = "shortArrayInList", signature = "Ljava/util/List<[S>;")
+    List<short[]> shortArrayInList;
+
+    @ExpectedSignature(descriptor = "intArrayInList", signature = "Ljava/util/List<[I>;")
+    List<int[]> intArrayInList;
+
+    @ExpectedSignature(descriptor = "longArrayInList", signature = "Ljava/util/List<[J>;")
+    List<long[]> longArrayInList;
+
+    @ExpectedSignature(descriptor = "charArrayInList", signature = "Ljava/util/List<[C>;")
+    List<char[]> charArrayInList;
+
+    @ExpectedSignature(descriptor = "booleanArrayInList", signature = "Ljava/util/List<[Z>;")
+    List<boolean[]> booleanArrayInList;
+
+    @ExpectedSignature(descriptor = "floatArrayInList", signature = "Ljava/util/List<[F>;")
+    List<float[]> floatArrayInList;
+
+    @ExpectedSignature(descriptor = "doubleArrayInList", signature = "Ljava/util/List<[D>;")
+    List<double[]> doubleArrayInList;
+
+    @ExpectedSignature(descriptor = "integerInList", signature = "Ljava/util/List<Ljava/lang/Integer;>;")
+    List<Integer> integerInList;
+
+    @ExpectedSignature(descriptor = "typeInMultiArray", signature = "[[TT;")
+    T[][] typeInMultiArray;
+
+    @ExpectedSignature(descriptor = "arrayOfClasses", signature = "[Ljava/util/List<TT;>;")
+    List<T>[] arrayOfClasses;
+
+    @ExpectedSignature(descriptor = "extendsWildCard", signature = "Ljava/util/List<+TT;>;")
+    List<? extends T> extendsWildCard;
+
+    @ExpectedSignature(descriptor = "superWildCard", signature = "Ljava/util/Comparator<-TT;>;")
+    Comparator<? super T> superWildCard;
+
+    @ExpectedSignature(descriptor = "extendsSuperWildCard",
+            signature = "Ljava/util/List<+Ljava/util/Comparator<-TT;>;>;")
+    List<? extends Comparator<? super T>> extendsSuperWildCard;
+
+    @ExpectedSignature(descriptor = "wildCard", signature = "Ljava/util/Comparator<*>;")
+    Comparator<?> wildCard;
+
+    @ExpectedSignature(descriptor = "boundsBooleanArray", signature = "Ljava/util/Map<+[Z-[Z>;")
+    Map<? extends boolean[], ? super boolean[]> boundsBooleanArray;
+
+    @ExpectedSignature(descriptor = "boundsByteArray", signature = "Ljava/util/Map<+[B-[B>;")
+    Map<? extends byte[], ? super byte[]> boundsByteArray;
+
+    @ExpectedSignature(descriptor = "boundsShortArray", signature = "Ljava/util/Map<+[S-[S>;")
+    Map<? extends short[], ? super short[]> boundsShortArray;
+
+    @ExpectedSignature(descriptor = "boundsIntArray", signature = "Ljava/util/Map<+[I-[I>;")
+    Map<? extends int[], ? super int[]> boundsIntArray;
+
+    @ExpectedSignature(descriptor = "boundsLongArray", signature = "Ljava/util/Map<+[J-[J>;")
+    Map<? extends long[], ? super long[]> boundsLongArray;
+
+    @ExpectedSignature(descriptor = "boundsCharArray", signature = "Ljava/util/Map<+[C-[C>;")
+    Map<? extends char[], ? super char[]> boundsCharArray;
+
+    @ExpectedSignature(descriptor = "boundsFloatArray", signature = "Ljava/util/Map<+[F-[F>;")
+    Map<? extends float[], ? super float[]> boundsFloatArray;
+
+    @ExpectedSignature(descriptor = "boundsDoubleArray", signature = "Ljava/util/Map<+[D-[D>;")
+    Map<? extends double[], ? super double[]> boundsDoubleArray;
+
+    @ExpectedSignature(descriptor = "boundsObjectArray",
+            signature = "Ljava/util/Map<+[Ljava/lang/Object;-[Ljava/lang/Object;>;")
+    Map<? extends Object[], ? super Object[]> boundsObjectArray;
+
+    boolean booleanNoSignatureAttribute;
+    byte byteNoSignatureAttribute;
+    char charNoSignatureAttribute;
+    short shortNoSignatureAttribute;
+    int intNoSignatureAttribute;
+    long longNoSignatureAttribute;
+    float floatNoSignatureAttribute;
+    double doubleNoSignatureAttribute;
+
+    List listNoSignatureAttribute;
+
+    @ExpectedSignature(descriptor = "staticByteArrayInList", signature = "Ljava/util/List<[B>;")
+    static List<byte[]> staticByteArrayInList;
+
+    @ExpectedSignature(descriptor = "staticShortArrayInList", signature = "Ljava/util/List<[S>;")
+    static List<short[]> staticShortArrayInList;
+
+    @ExpectedSignature(descriptor = "staticIntArrayInList", signature = "Ljava/util/List<[I>;")
+    static List<int[]> staticIntArrayInList;
+
+    @ExpectedSignature(descriptor = "staticLongArrayInList", signature = "Ljava/util/List<[J>;")
+    static List<long[]> staticLongArrayInList;
+
+    @ExpectedSignature(descriptor = "staticCharArrayInList", signature = "Ljava/util/List<[C>;")
+    static List<char[]> staticCharArrayInList;
+
+    @ExpectedSignature(descriptor = "staticBooleanArrayInList", signature = "Ljava/util/List<[Z>;")
+    static List<boolean[]> staticBooleanArrayInList;
+
+    @ExpectedSignature(descriptor = "staticFloatArrayInList", signature = "Ljava/util/List<[F>;")
+    static List<float[]> staticFloatArrayInList;
+
+    @ExpectedSignature(descriptor = "staticDoubleArrayInList", signature = "Ljava/util/List<[D>;")
+    static List<double[]> staticDoubleArrayInList;
+
+    @ExpectedSignature(descriptor = "staticIntegerInList", signature = "Ljava/util/List<Ljava/lang/Integer;>;")
+    static List<Integer> staticIntegerInList;
+
+    @ExpectedSignature(descriptor = "staticWildCard", signature = "Ljava/util/Comparator<*>;")
+    static Comparator<?> staticWildCard;
+
+    @ExpectedSignature(descriptor = "staticBoundsBooleanArray", signature = "Ljava/util/Map<+[Z-[Z>;")
+    static Map<? extends boolean[], ? super boolean[]> staticBoundsBooleanArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsByteArray", signature = "Ljava/util/Map<+[B-[B>;")
+    static Map<? extends byte[], ? super byte[]> staticBoundsByteArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsShortArray", signature = "Ljava/util/Map<+[S-[S>;")
+    static Map<? extends short[], ? super short[]> staticBoundsShortArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsIntArray", signature = "Ljava/util/Map<+[I-[I>;")
+    static Map<? extends int[], ? super int[]> staticBoundsIntArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsLongArray", signature = "Ljava/util/Map<+[J-[J>;")
+    static Map<? extends long[], ? super long[]> staticBoundsLongArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsCharArray", signature = "Ljava/util/Map<+[C-[C>;")
+    static Map<? extends char[], ? super char[]> staticBoundsCharArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsFloatArray", signature = "Ljava/util/Map<+[F-[F>;")
+    static Map<? extends float[], ? super float[]> staticBoundsFloatArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsDoubleArray", signature = "Ljava/util/Map<+[D-[D>;")
+    static Map<? extends double[], ? super double[]> staticBoundsDoubleArray;
+
+    @ExpectedSignature(descriptor = "staticBoundsObjectArray",
+            signature = "Ljava/util/Map<+[Ljava/lang/Object;-[Ljava/lang/Object;>;")
+    static Map<? extends Object[], ? super Object[]> staticBoundsObjectArray;
+
+    static boolean staticBooleanNoSignatureAttribute;
+    static byte staticByteNoSignatureAttribute;
+    static char staticCharNoSignatureAttribute;
+    static short staticShortNoSignatureAttribute;
+    static int staticIntNoSignatureAttribute;
+    static long staticLongNoSignatureAttribute;
+    static float staticFloatNoSignatureAttribute;
+    static double staticDoubleNoSignatureAttribute;
+
+    static List staticListNoSignatureAttribute;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for inner classes.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build InnerClassTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver InnerClassTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+@ExpectedSignature(descriptor = "InnerClassTest",
+        signature = "<T:Ljava/util/ArrayList<TT;>;:Ljava/lang/Runnable;>Ljava/lang/Object;")
+@ExpectedSignature(descriptor = "InnerClassTest$1",
+        signature = "LInnerClassTest$1Local1;", isAnonymous = true)
+@ExpectedSignature(descriptor = "InnerClassTest$2",
+        signature = "LInnerClassTest$1Local2<Ljava/util/ArrayList<TT;>;" +
+                "Ljava/util/Map<Ljava/util/ArrayList<TT;>;Ljava/util/ArrayList<TT;>;>;>;", isAnonymous = true)
+public class InnerClassTest<T extends ArrayList<T> & Runnable> {
+
+    {
+        class Local1 {
+            // no Signature attribute
+            Local1() {
+            }
+
+            @ExpectedSignature(descriptor = "genericType", signature = "TT;")
+            T genericType;
+
+            @ExpectedSignature(descriptor = "genericTypeArray", signature = "[TT;")
+            T[] genericTypeArray;
+        }
+
+        @ExpectedSignature(descriptor = "InnerClassTest$1Local2",
+                signature = "<T:Ljava/lang/Object;U::Ljava/util/Map<+TT;-TT;>;>Ljava/lang/Object;")
+        class Local2<T, U extends Map<? extends T, ? super T>> {
+            // no Signature attribute
+            Local2() {
+            }
+
+            @ExpectedSignature(descriptor = "<init>(InnerClassTest, java.lang.Object, java.util.Map)",
+                    signature = "(TT;TU;)V")
+            Local2(T a, U b) {
+            }
+
+            @ExpectedSignature(descriptor = "genericMethod(java.lang.Object[])",
+                    signature = "([TT;)[TU;")
+            U[] genericMethod(T...a) {
+                return null;
+            }
+        }
+
+        @ExpectedSignature(descriptor = "InnerClassTest$1Local3",
+                signature = "LInnerClassTest$1Local2<Ljava/util/ArrayList<TT;>;" +
+                        "Ljava/util/Map<Ljava/util/ArrayList<TT;>;Ljava/util/ArrayList<TT;>;>;>;")
+        class Local3 extends Local2<ArrayList<T>, Map<ArrayList<T>, ArrayList<T>>> {
+        }
+
+        new Local1() {
+            @ExpectedSignature(descriptor = "genericType", signature = "TT;")
+            T genericType;
+
+            @ExpectedSignature(descriptor = "genericTypeArray", signature = "[TT;")
+            T[] genericTypeArray;
+        };
+
+        new Local2<ArrayList<T>, Map<ArrayList<T>, ArrayList<T>>>() {
+        };
+    }
+
+    @ExpectedSignature(descriptor = "InnerClassTest$InnerClass1",
+            signature = "<E:TT;U::Ljava/util/Set<-TE;>;>Ljava/lang/Object;")
+    class InnerClass1<E extends T, U extends Set<? super E>> {
+        @ExpectedSignature(descriptor = "genericTypeArray", signature = "[TT;")
+        T[] genericTypeArray;
+
+        @ExpectedSignature(descriptor = "genericListExtendsBound", signature = "Ljava/util/List<+TT;>;")
+        List<? extends T> genericListExtendsBound;
+
+        @ExpectedSignature(descriptor = "genericListSuperBound", signature = "Ljava/util/List<-TU;>;")
+        List<? super U> genericListSuperBound;
+
+        @ExpectedSignature(descriptor = "genericListWildCard", signature = "Ljava/util/List<*>;")
+        List<?> genericListWildCard;
+
+        @ExpectedSignature(descriptor = "genericListExactType", signature = "Ljava/util/List<Ljava/lang/Integer;>;")
+        List<Integer> genericListExactType;
+
+        @ExpectedSignature(descriptor = "listWithGenericType", signature = "Ljava/util/List<TE;>;")
+        List<E> listWithGenericType;
+
+        List listNoSignatureAttribute;
+
+        // no Signature attribute
+        InnerClass1(List a) {
+        }
+
+        @ExpectedSignature(descriptor = "<init>(InnerClassTest, java.util.ArrayList)",
+                signature = "(TT;)V")
+        InnerClass1(T a) {
+        }
+
+        @ExpectedSignature(descriptor = "<init>(InnerClassTest, java.util.ArrayList, java.util.ArrayList)",
+                signature = "(TT;TE;)V")
+        InnerClass1(T a, E b) {
+        }
+
+        @ExpectedSignature(descriptor = "genericMethod(java.util.ArrayList)",
+                signature = "(TT;)TE;")
+        E genericMethod(T a) {
+            return null;
+        }
+    }
+
+    @ExpectedSignature(descriptor = "InnerClassTest$InnerInterface",
+            signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;")
+    interface InnerInterface<T> {
+        @ExpectedSignature(descriptor = "genericMethod(java.lang.Object)", signature = "(TT;)TT;")
+        T genericMethod(T a);
+
+        @ExpectedSignature(descriptor = "genericListExtendsBound", signature = "Ljava/util/List<+Ljava/lang/Number;>;")
+        List<? extends Number> genericListExtendsBound = null;
+
+        @ExpectedSignature(descriptor = "genericListSuperBound", signature = "Ljava/util/List<-Ljava/lang/Number;>;")
+        List<? super Number> genericListSuperBound = null;
+
+        @ExpectedSignature(descriptor = "genericListWildCard", signature = "Ljava/util/List<*>;")
+        List<?> genericListWildCard = null;
+
+        @ExpectedSignature(descriptor = "genericListExactType", signature = "Ljava/util/List<Ljava/lang/Integer;>;")
+        List<Integer> genericListExactType = null;
+
+        List listNoSignatureAttribute = null;
+
+        @ExpectedSignature(descriptor = "genericBoundsMethod1(java.util.List)",
+                signature = "(Ljava/util/List<-TT;>;)Ljava/util/List<+TT;>;")
+        List<? extends T> genericBoundsMethod1(List<? super T> a);
+
+        @ExpectedSignature(descriptor = "genericBoundsMethod2(java.util.List)",
+                signature = "(Ljava/util/List<+TT;>;)Ljava/util/List<-TT;>;")
+        List<? super T> genericBoundsMethod2(List<? extends T> a);
+
+        @ExpectedSignature(descriptor = "genericWildCardMethod(java.util.Map)",
+                signature = "(Ljava/util/Map<**>;)Ljava/util/Map<**>;")
+        Map<?, ?> genericWildCardMethod(Map<?, ?> a);
+
+        @ExpectedSignature(descriptor = "defaultGenericMethod(java.util.List, java.util.List, java.util.Map)",
+                signature = "(Ljava/util/List<+TT;>;Ljava/util/List<-TT;>;Ljava/util/Map<**>;)Ljava/util/List<*>;")
+        default List<?> defaultGenericMethod(List<? extends T> list1, List<? super T> list2, Map<?, ?> map) { return null; }
+
+
+        default List defaultNoSignatureAttributeMethod(List list1, List list2, Map list3) { return null; }
+
+        @ExpectedSignature(descriptor = "staticGenericMethod(java.util.List, java.util.List, java.util.Map)",
+                signature = "<T::Ljava/lang/Runnable;>(Ljava/util/List<+TT;>;Ljava/util/List<-TT;>;Ljava/util/Map<**>;)Ljava/util/List<*>;")
+        static <T extends Runnable> List<?> staticGenericMethod(List<? extends T> list1, List<? super T> list2, Map<?, ?> map) { return null; }
+
+
+        static List staticNoSignatureAttributeMethod(List list1, List list2, Map list3) { return null; }
+    }
+
+    @ExpectedSignature(descriptor = "InnerClassTest$InnerClass2",
+            signature = "LInnerClassTest<TT;>.InnerClass1<TT;Ljava/util/Set<TT;>;>;LInnerClassTest$InnerInterface<TT;>;")
+    class InnerClass2 extends InnerClass1<T, Set<T>> implements InnerInterface<T> {
+
+        // no Signature attribute
+        InnerClass2() {
+            super(null);
+        }
+
+        @ExpectedSignature(descriptor = "<init>(InnerClassTest, java.util.ArrayList)",
+                signature = "(TT;)V")
+        InnerClass2(T a) {
+            super(a);
+        }
+
+        @ExpectedSignature(descriptor = "<init>(InnerClassTest, java.util.ArrayList, java.util.ArrayList)",
+                signature = "(TT;TT;)V")
+        InnerClass2(T a, T b) {
+            super(a, b);
+        }
+
+        @ExpectedSignature(descriptor = "genericMethod(java.util.ArrayList)", signature = "(TT;)TT;")
+        @Override
+        public T genericMethod(T a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "genericBoundsMethod1(java.util.List)",
+                signature = "(Ljava/util/List<-TT;>;)Ljava/util/List<+TT;>;")
+        @Override
+        public List<? extends T> genericBoundsMethod1(List<? super T> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "genericBoundsMethod2(java.util.List)",
+                signature = "(Ljava/util/List<+TT;>;)Ljava/util/List<-TT;>;")
+        @Override
+        public List<? super T> genericBoundsMethod2(List<? extends T> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "genericWildCardMethod(java.util.Map)",
+                signature = "(Ljava/util/Map<**>;)Ljava/util/Map<**>;")
+        @Override
+        public Map<?, ?> genericWildCardMethod(Map<?, ?> a) {
+            return null;
+        }
+    }
+
+    @ExpectedSignature(descriptor = "InnerClassTest$StaticInnerClass",
+            signature = "<T:Ljava/lang/String;E::Ljava/util/Set<TT;>;>" +
+                    "Ljava/lang/Object;LInnerClassTest$InnerInterface<TE;>;")
+    static class StaticInnerClass<T extends String, E extends Set<T>> implements InnerInterface<E> {
+        // no Signature attribute
+        StaticInnerClass(List a) {
+        }
+
+        @ExpectedSignature(descriptor = "<init>(java.lang.Runnable)",
+                signature = "<E::Ljava/lang/Runnable;>(TE;)V")
+        <E extends Runnable> StaticInnerClass(E a) {
+        }
+
+        @ExpectedSignature(descriptor = "<init>(java.lang.String)",
+                signature = "(TT;)V")
+        StaticInnerClass(T a) {
+        }
+
+        @ExpectedSignature(descriptor = "<init>(java.lang.String, java.util.Set)",
+                signature = "(TT;TE;)V")
+        StaticInnerClass(T a, E b) {
+        }
+
+        @ExpectedSignature(descriptor = "genericListExtendsBound", signature = "Ljava/util/List<+Ljava/lang/Number;>;")
+        static List<? extends Number> genericListExtendsBound;
+
+        @ExpectedSignature(descriptor = "genericListSuperBound", signature = "Ljava/util/List<-Ljava/lang/Number;>;")
+        static List<? super Number> genericListSuperBound;
+
+        @ExpectedSignature(descriptor = "genericListWildCard", signature = "Ljava/util/List<*>;")
+        static List<?> genericListWildCard;
+
+        @ExpectedSignature(descriptor = "genericListExactType", signature = "Ljava/util/List<Ljava/lang/Integer;>;")
+        static List<Integer> genericListExactType;
+
+        static List listNoSignatureAttribute;
+
+        @ExpectedSignature(descriptor = "genericMethod(java.util.Set)",
+                signature = "(TE;)TE;")
+        @Override
+        public E genericMethod(E a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "genericBoundsMethod1(java.util.List)",
+                signature = "(Ljava/util/List<-TE;>;)Ljava/util/List<+TE;>;")
+        @Override
+        public List<? extends E> genericBoundsMethod1(List<? super E> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "genericBoundsMethod2(java.util.List)",
+                signature = "(Ljava/util/List<+TE;>;)Ljava/util/List<-TE;>;")
+        @Override
+        public List<? super E> genericBoundsMethod2(List<? extends E> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "genericWildCardMethod(java.util.Map)",
+                signature = "(Ljava/util/Map<**>;)Ljava/util/Map<**>;")
+        @Override
+        public Map<?, ?> genericWildCardMethod(Map<?, ?> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "staticGenericMethod(java.lang.Object)",
+                signature = "<E:Ljava/lang/Object;>(TE;)TE;")
+        public static <E> E staticGenericMethod(E a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "staticGenericBoundsMethod1(java.util.List)",
+                signature = "<E:Ljava/lang/Object;>(Ljava/util/List<-TE;>;)Ljava/util/List<+TE;>;")
+        public static <E> List<? extends E> staticGenericBoundsMethod1(List<? super E> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "staticGenericBoundsMethod2(java.util.List)",
+                signature = "<E:Ljava/lang/Object;>(Ljava/util/List<+TE;>;)Ljava/util/List<-TE;>;")
+        public static <E> List<? super E> staticGenericBoundsMethod2(List<? extends E> a) {
+            return null;
+        }
+
+        @ExpectedSignature(descriptor = "staticGenericWildCardMethod(java.util.Map)",
+                signature = "<E:Ljava/lang/Object;>(Ljava/util/Map<**>;)Ljava/util/Map<**>;")
+        public static <E> Map<?, ?> staticGenericWildCardMethod(Map<?, ?> a) {
+            return null;
+        }
+    }
+
+    @ExpectedSignature(descriptor = "InnerClassTest$InnerClass3",
+            signature = "Ljava/lang/Object;LInnerClassTest$ExceptionHolder" +
+                    "<Ljava/lang/RuntimeException;>;Ljava/util/concurrent/Callable<Ljava/util/Map<**>;>;")
+    public static class InnerClass3 implements  ExceptionHolder<RuntimeException>, Callable<Map<?, ?>> {
+        @ExpectedSignature(descriptor = "call()", signature = "()Ljava/util/Map<**>;")
+        @Override
+        public Map<?, ?> call() throws Exception {
+            return null;
+        }
+
+        @Override
+        public void Throw() throws RuntimeException {
+        }
+
+        @Override
+        public RuntimeException Return() {
+            return null;
+        }
+    }
+
+    /**
+     * Class is for checking that the Signature attribute is not generated
+     * for overridden methods despite of the appropriate methods in the parent class
+     * have the Signature attribute.
+     */
+    @ExpectedSignature(descriptor = "InnerClassTest$ExceptionHolder",
+            signature = "<E:Ljava/lang/Exception;>Ljava/lang/Object;")
+    interface ExceptionHolder<E extends Exception> {
+        @ExpectedSignature(descriptor = "Throw()", signature = "()V^TE;")
+        void Throw() throws E;
+        @ExpectedSignature(descriptor = "Return()", signature = "()TE;")
+        E Return();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for method parameters.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build MethodParameterTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver MethodParameterTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@ExpectedSignature(descriptor = "MethodParameterTest", signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;")
+public class MethodParameterTest<T> {
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, java.util.Set, java.util.ArrayList)",
+            signature = "<E:TT;U::Ljava/util/List<TE;>;:Ljava/lang/Runnable;>" +
+                    "(TT;Ljava/util/Set<-TE;>;Ljava/util/ArrayList<+Ljava/util/Set<TU;>;>;)V")
+    <E extends T, U extends List<E> & Runnable>
+    MethodParameterTest(T a, Set<? super E> b, ArrayList<? extends Set<U>> c) {
+    }
+
+    @ExpectedSignature(descriptor = "method(java.lang.Object, java.util.List, java.util.ArrayList)",
+            signature = "<E:TT;U::Ljava/util/List<TE;>;:Ljava/lang/Runnable;>" +
+                    "(TT;TU;Ljava/util/ArrayList<+Ljava/util/Set<TU;>;>;)V")
+    <E extends T, U extends List<E> & Runnable>
+    void method(T a, U b, ArrayList<? extends Set<U>> c) {
+    }
+
+    @ExpectedSignature(descriptor = "staticMethod(java.util.Set, java.util.List[], java.util.Map)",
+            signature = "<T::Ljava/util/List<*>;E::Ljava/util/Set<-TT;>;>(TE;[TT;Ljava/util/Map<*+TE;>;)TE;")
+    static <T extends List<?>, E extends Set<? super T>> E staticMethod(E a, T[] b, Map<?, ? extends E> c) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, boolean[])", signature = "(TT;[Z)V")
+    MethodParameterTest(T a, boolean...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, char[])", signature = "(TT;[C)V")
+    MethodParameterTest(T a, char...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, byte[])", signature = "(TT;[B)V")
+    MethodParameterTest(T a, byte...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, short[])", signature = "(TT;[S)V")
+    MethodParameterTest(T a, short...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, int[])", signature = "(TT;[I)V")
+    MethodParameterTest(T a, int...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, long[])", signature = "(TT;[J)V")
+    MethodParameterTest(T a, long...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, float[])", signature = "(TT;[F)V")
+    MethodParameterTest(T a, float...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, double[])", signature = "(TT;[D)V")
+    MethodParameterTest(T a, double...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object, java.lang.Object[])",
+            signature = "(TT;[Ljava/lang/Object;)V")
+    MethodParameterTest(T a, Object...b) {
+    }
+
+    @ExpectedSignature(descriptor = "<init>(java.lang.Object[])", signature = "([TT;)V")
+    MethodParameterTest(T...a) {
+    }
+
+    // no Signature attribute
+    MethodParameterTest(int...a) {
+    }
+
+    @ExpectedSignature(descriptor = "genericBooleanMethod(java.lang.Object, boolean[])", signature = "(TT;[Z)V")
+    void genericBooleanMethod(T a, boolean...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericCharMethod(java.lang.Object, char[])", signature = "(TT;[C)V")
+    void genericCharMethod(T a, char...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericByteMethod(java.lang.Object, byte[])", signature = "(TT;[B)V")
+    void genericByteMethod(T a, byte...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericShortMethod(java.lang.Object, short[])", signature = "(TT;[S)V")
+    void genericShortMethod(T a, short...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericIntMethod(java.lang.Object, int[])", signature = "(TT;[I)V")
+    void genericIntMethod(T a, int...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericLongMethod(java.lang.Object, long[])", signature = "(TT;[J)V")
+    void genericLongMethod(T a, long...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericFloatMethod(java.lang.Object, float[])", signature = "(TT;[F)V")
+    void genericFloatMethod(T a, float...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericDoubleMethod(java.lang.Object, double[])", signature = "(TT;[D)V")
+    void genericDoubleMethod(T a, double...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericObjectMethod(java.lang.Object, java.lang.Object[])",
+            signature = "(TT;[Ljava/lang/Object;)V")
+    void genericObjectMethod(T a, Object...b) {
+    }
+
+    @ExpectedSignature(descriptor = "genericMethod(java.lang.Object[])", signature = "([TT;)V")
+    void genericMethod(T...a) {
+    }
+
+    void noSignature(int...a) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericBooleanMethod(java.lang.Object, boolean[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[Z)V")
+    static <T> void staticGenericBooleanMethod(T a, boolean...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericCharMethod(java.lang.Object, char[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[C)V")
+    static <T> void staticGenericCharMethod(T a, char...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericByteMethod(java.lang.Object, byte[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[B)V")
+    static <T> void staticGenericByteMethod(T a, byte...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericShortMethod(java.lang.Object, short[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[S)V")
+    static <T> void staticGenericShortMethod(T a, short...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericIntMethod(java.lang.Object, int[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[I)V")
+    static <T> void staticGenericIntMethod(T a, int...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericLongMethod(java.lang.Object, long[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[J)V")
+    static <T> void staticGenericLongMethod(T a, long...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericFloatMethod(java.lang.Object, float[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[F)V")
+    static <T> void staticGenericFloatMethod(T a, float...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericDoubleMethod(java.lang.Object, double[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[D)V")
+    static <T> void staticGenericDoubleMethod(T a, double...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericObjectMethod(java.lang.Object, java.lang.Object[])",
+            signature = "<T:Ljava/lang/Object;>(TT;[Ljava/lang/Object;)V")
+    static <T> void staticGenericObjectMethod(T a, Object...b) {
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericMethod(java.lang.Object[])",
+            signature = "<T:Ljava/lang/Object;>([TT;)V")
+    static <T> void staticGenericMethod(T...a) {
+    }
+
+    static void staticNoSignatureAttribute(int...a) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for type bounds.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build MethodTypeBoundTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver MethodTypeBoundTest
+ */
+
+import java.util.*;
+
+@ExpectedSignature(descriptor = "MethodTypeBoundTest", signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;")
+public class MethodTypeBoundTest<T> {
+
+    @ExpectedSignature(descriptor = "method1(java.lang.String)",
+            signature = "<E:Ljava/lang/String;:Ljava/lang/Runnable;:Ljava/util/Collection<+TT;>;>(TE;)TE;")
+    <E extends String & Runnable & Collection<? extends T>> E method1(E a) {
+        return a;
+    }
+
+    @ExpectedSignature(descriptor = "method2(java.lang.Runnable)",
+            signature = "<E::Ljava/lang/Runnable;:Ljava/util/Collection<-TT;>;>(TE;)TE;")
+    <E extends Runnable & Collection<? super T>> E method2(E a) {
+        return a;
+    }
+
+    @ExpectedSignature(descriptor = "method3(java.util.ArrayList)",
+            signature = "<E:Ljava/util/ArrayList<+TT;>;>(TE;)TE;")
+    <E extends ArrayList<? extends T>> E method3(E a) {
+        return a;
+    }
+
+    @ExpectedSignature(descriptor = "method4(java.util.LinkedList)",
+            signature = "<E:Ljava/util/LinkedList<TE;>;:Ljava/util/List<TE;>;>(TE;)TE;")
+    <E extends LinkedList<E> & List<E>> E method4(E a) {
+        return a;
+    }
+
+    @ExpectedSignature(descriptor = "method5(java.util.Iterator)",
+            signature = "<E:Ljava/util/LinkedList<TE;>;:Ljava/util/List<TE;>;" +
+                    "U::Ljava/util/Iterator<-LMethodTypeBoundTest<TT;>.InnerClass<TE;>;>;>(TU;)TE;")
+    <E extends LinkedList<E> & List<E>, U extends Iterator<? super InnerClass<E>>> E method5(U a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "method6()",
+            signature = "<E:Ljava/util/LinkedList<TT;>;U:TE;>()V")
+    <E extends LinkedList<T>, U extends E> void method6() {
+    }
+
+    @ExpectedSignature(descriptor = "MethodTypeBoundTest$InnerClass",
+            signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;")
+    class InnerClass<T> {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java	Wed Mar 25 10:29:14 2015 +0300
@@ -0,0 +1,549 @@
+/*
+ * Copyright (c) 2015, 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 8049238
+ * @summary Checks Signature attribute for array return type of method.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build ReturnTypeTest Driver ExpectedSignature ExpectedSignatureContainer
+ * @run main Driver ReturnTypeTest
+ */
+
+import java.awt.Frame;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+@ExpectedSignature(descriptor = "ReturnTypeTest",
+        signature = "<T:Ljava/awt/Frame;:Ljava/lang/Runnable;:Ljava/util/concurrent/Callable<[TT;>;>Ljava/lang/Object;")
+public class ReturnTypeTest<T extends Frame & Runnable & Callable<T[]>> {
+
+    @ExpectedSignature(descriptor = "byteArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[B")
+    byte[] byteArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "shortArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[S")
+    short[] shortArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "charArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[C")
+    char[] charArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "intArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[I")
+    int[] intArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "longArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[J")
+    long[] longArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "booleanArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[Z")
+    boolean[] booleanArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "floatArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[F")
+    float[] floatArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "doubleArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[D")
+    double[] doubleArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "objectArrayReturnType(java.awt.Frame)",
+            signature = "(TT;)[Ljava/lang/Object;")
+    Object[] objectArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticByteArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[B")
+    static <T> byte[] staticByteArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticShortArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[S")
+    static <T> short[] staticShortArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticCharArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[C")
+    static <T> char[] staticCharArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticIntArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[I")
+    static <T> int[] staticIntArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticLongArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[J")
+    static <T> long[] staticLongArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticBooleanArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[Z")
+    static <T> boolean[] staticBooleanArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticFloatArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[F")
+    static <T> float[] staticFloatArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticDoubleArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[D")
+    static <T> double[] staticDoubleArrayReturnType(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticObjectArrayReturnType(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)[Ljava/lang/Object;")
+    static <T> Object[] staticObjectArrayReturnType(T a) {
+        return null;
+    }
+
+    byte[] byteArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    short[] shortArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    char[] charArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    int[] intArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    long[] longArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    boolean[] booleanArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    float[] floatArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    double[] doubleArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    Object[] objectArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static byte[] staticByteArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static short[] staticShortArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static char[] staticCharArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static int[] staticIntArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static long[] staticLongArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static boolean[] staticBooleanArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static float[] staticFloatArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static double[] staticDoubleArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    static Object[] staticObjectArrayReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "typeReturnType()",
+            signature = "()TT;")
+    T typeReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "typeArrayReturnType()",
+            signature = "()[TT;")
+    T[] typeArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "extendsReturnType()",
+            signature = "<E:TT;>()TE;")
+    <E extends T> E extendsReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "extendsArrayReturnType()",
+            signature = "<E:TT;>()[TE;")
+    <E extends T> E[] extendsArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "genericListReturnType()",
+            signature = "()Ljava/util/List<TT;>;")
+    List<T> genericListReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "genericListArrayReturnType()",
+            signature = "()[Ljava/util/List<TT;>;")
+    List<T>[] genericListArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "extendsBoundReturnType()",
+            signature = "()Ljava/util/List<+TT;>;")
+    List<? extends T> extendsBoundReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "extendsBoundArrayReturnType()",
+            signature = "()[Ljava/util/List<+TT;>;")
+    List<? extends T>[] extendsBoundArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "superBoundReturnType()",
+            signature = "()Ljava/util/List<-TT;>;")
+    List<? super T> superBoundReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "superBoundArrayReturnType()",
+            signature = "()[Ljava/util/List<-TT;>;")
+    List<? super T>[] superBoundArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "wildcardReturnType()",
+            signature = "()Ljava/util/Map<**>;")
+    Map<?, ?> wildcardReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "wildcardArrayReturnType()",
+            signature = "()[Ljava/util/Map<**>;")
+    Map<?, ?>[] wildcardArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticTypeReturnType()",
+            signature = "<T:Ljava/lang/Object;>()TT;")
+    static <T> T staticTypeReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticTypeArrayReturnType()",
+            signature = "<T:Ljava/lang/Object;>()[TT;")
+    static <T> T[] staticTypeArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticExtendsReturnType()",
+            signature = "<T:Ljava/lang/Object;E:TT;>()TE;")
+    static <T, E extends T> E staticExtendsReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticExtendsArrayReturnType()",
+            signature = "<T:Ljava/lang/Object;E:TT;>()[TE;")
+    static <T, E extends T> E[] staticExtendsArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericListReturnType()",
+            signature = "<T:Ljava/lang/Object;>()Ljava/util/List<TT;>;")
+    static <T> List<T> staticGenericListReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticGenericListArrayReturnType()",
+            signature = "<T:Ljava/lang/Object;>()[Ljava/util/List<TT;>;")
+    static <T> List<T>[] staticGenericListArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticExtendsBoundReturnType()",
+            signature = "<T:Ljava/lang/Object;>()Ljava/util/List<+TT;>;")
+    static <T> List<? extends T> staticExtendsBoundReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticExtendsBoundArrayReturnType()",
+            signature = "<T:Ljava/lang/Object;>()[Ljava/util/List<+TT;>;")
+    static <T> List<? extends T>[] staticExtendsBoundArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticSuperBoundReturnType()",
+            signature = "<T:Ljava/lang/Object;>()Ljava/util/List<-TT;>;")
+    static <T> List<? super T> staticSuperBoundReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticSuperBoundArrayReturnType()",
+            signature = "<T:Ljava/lang/Object;>()[Ljava/util/List<-TT;>;")
+    static <T> List<? super T>[] staticSuperBoundArrayReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticWildcardReturnType()",
+            signature = "()Ljava/util/Map<**>;")
+    static Map<?, ?> staticWildcardReturnType() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticWildcardArrayReturnType()",
+            signature = "()[Ljava/util/Map<**>;")
+    static Map<?, ?>[] staticWildcardArrayReturnType() {
+        return null;
+    }
+
+    List noSignature() {
+        return null;
+    }
+
+    static List staticNoSignatureAttribute() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsBooleanArray()",
+            signature = "()Ljava/util/Map<+[Z-[Z>;")
+    Map<? extends boolean[], ? super boolean[]> boundsBooleanArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsByteArray()",
+            signature = "()Ljava/util/Map<+[B-[B>;")
+    Map<? extends byte[], ? super byte[]> boundsByteArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsShortArray()",
+            signature = "()Ljava/util/Map<+[S-[S>;")
+    Map<? extends short[], ? super short[]> boundsShortArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsIntArray()",
+            signature = "()Ljava/util/Map<+[I-[I>;")
+    Map<? extends int[], ? super int[]> boundsIntArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsLongArray()",
+            signature = "()Ljava/util/Map<+[J-[J>;")
+    Map<? extends long[], ? super long[]> boundsLongArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsCharArray()",
+            signature = "()Ljava/util/Map<+[C-[C>;")
+    Map<? extends char[], ? super char[]> boundsCharArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsFloatArray()",
+            signature = "()Ljava/util/Map<+[F-[F>;")
+    Map<? extends float[], ? super float[]> boundsFloatArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsDoubleArray()",
+            signature = "()Ljava/util/Map<+[D-[D>;")
+    Map<? extends double[], ? super double[]> boundsDoubleArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "boundsObjectArray()",
+            signature = "()Ljava/util/Map<+[Ljava/lang/Object;-[Ljava/lang/Object;>;")
+    Map<? extends Object[], ? super Object[]> boundsObjectArray() {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "voidMethod(java.awt.Frame)", signature = "(TT;)V")
+    void voidMethod(T a) {
+    }
+
+    @ExpectedSignature(descriptor = "byteMethod(java.awt.Frame)", signature = "(TT;)B")
+    byte byteMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "shortMethod(java.awt.Frame)", signature = "(TT;)S")
+    short shortMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "charMethod(java.awt.Frame)", signature = "(TT;)C")
+    char charMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "intMethod(java.awt.Frame)", signature = "(TT;)I")
+    int intMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "longMethod(java.awt.Frame)", signature = "(TT;)J")
+    long longMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "booleanMethod(java.awt.Frame)", signature = "(TT;)Z")
+    boolean booleanMethod(T a) {
+        return false;
+    }
+
+    @ExpectedSignature(descriptor = "floatMethod(java.awt.Frame)", signature = "(TT;)F")
+    float floatMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "doubleMethod(java.awt.Frame)", signature = "(TT;)D")
+    double doubleMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "objectMethod(java.awt.Frame)", signature = "(TT;)Ljava/lang/Object;")
+    Object objectMethod(T a) {
+        return null;
+    }
+
+    @ExpectedSignature(descriptor = "staticVoidMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)V")
+    static <T> void staticVoidMethod(T a) {
+    }
+
+    @ExpectedSignature(descriptor = "staticByteMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)B")
+    static <T> byte staticByteMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticShortMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)S")
+    static <T> short staticShortMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticCharMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)C")
+    static <T> char staticCharMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticIntMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)I")
+    static <T> int staticIntMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticLongMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)J")
+    static <T> long staticLongMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticBooleanMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)Z")
+    static <T> boolean staticBooleanMethod(T a) {
+        return false;
+    }
+
+    @ExpectedSignature(descriptor = "staticFloatMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)F")
+    static <T> float staticFloatMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticDoubleMethod(java.lang.Object)", signature = "<T:Ljava/lang/Object;>(TT;)D")
+    static <T> double staticDoubleMethod(T a) {
+        return 0;
+    }
+
+    @ExpectedSignature(descriptor = "staticObjectMethod(java.lang.Object)",
+            signature = "<T:Ljava/lang/Object;>(TT;)Ljava/lang/Object;")
+    static <T> Object staticObjectMethod(T a) {
+        return null;
+    }
+
+    void voidReturnTypeNoSignatureAttribute() {
+    }
+
+    byte byteReturnTypeNoSignatureAttribute() {
+        return 0;
+    }
+
+    Object objectReturnNoSignatureAttribute() {
+        return null;
+    }
+
+    static void staticVoidReturnTypeNoSignatureAttribute() {
+    }
+
+    static byte staticByteReturnTypeNoSignatureAttribute() {
+        return 0;
+    }
+
+    static Object staticObjectReturnTypeNoSignatureAttribute() {
+        return null;
+    }
+}
--- a/langtools/test/tools/javac/classfiles/attributes/lib/TestResult.java	Wed Jul 05 20:25:16 2017 +0200
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestResult.java	Wed Mar 25 10:29:14 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -56,8 +56,9 @@
     public boolean checkEquals(Object actual, Object expected, String message) {
         echo("Testing : " + message);
         if (!Objects.equals(actual, expected)) {
-            getLastTestCase().addAssert(new AssertionFailedException(
-                    String.format("%s%nGot: %s, Expected: %s", message, actual, expected)));
+            getLastTestCase().addAssert(String.format("%s\n" +
+                            "Expected: %s,\n" +
+                            "     Got: %s", message, expected, actual));
             return false;
         }
         return true;
@@ -70,8 +71,7 @@
     public boolean checkNotNull(Object actual, String message) {
         echo("Testing : " + message);
         if (Objects.isNull(actual)) {
-            getLastTestCase().addAssert(new AssertionFailedException(
-                    message + " : Expected not null value"));
+            getLastTestCase().addAssert(message + " : Expected not null value");
             return false;
         }
         return true;
@@ -88,7 +88,11 @@
     public boolean checkContains(Set<?> found, Set<?> expected, String message) {
         Set<?> copy = new HashSet<>(expected);
         copy.removeAll(found);
-        return checkTrue(found.containsAll(expected), message + " : " + copy);
+        if (!found.containsAll(expected)) {
+            return checkTrue(false, message + " FAIL : not found elements : " + copy);
+        } else {
+            return checkTrue(true, message + " PASS : all elements found");
+        }
     }
 
     public void addFailure(Throwable th) {
@@ -119,7 +123,7 @@
     private class Info {
 
         private final String info;
-        private final List<AssertionFailedException> asserts;
+        private final List<String> asserts;
         private final List<Throwable> errors;
 
         private Info(String info) {
@@ -141,19 +145,25 @@
             printf("[ERROR] : %s\n", getStackTrace(th));
         }
 
-        public void addAssert(AssertionFailedException e) {
+        public void addAssert(String e) {
             asserts.add(e);
-            printf("[ASSERT] : %s\n", getStackTrace(e));
+            printf("[ASSERT] : %s\n", e);
         }
 
         public String getMessage() {
-            return (asserts.size() > 0 ? getErrorMessage("[ASSERT]", asserts) + "\n" : "")
-                    + getErrorMessage("[ERROR]", errors);
+            return (asserts.size() > 0 ? getAssertMessages(asserts) + "\n" : "")
+                    + getErrorMessages(errors);
         }
 
-        public String getErrorMessage(String header, List<? extends Throwable> list) {
+        public String getAssertMessages(List<String> list) {
             return list.stream()
-                    .map(throwable -> String.format("%s : %s", header, getStackTrace(throwable)))
+                    .map(message -> String.format("[ASSERT] : %s", message))
+                    .collect(Collectors.joining("\n"));
+        }
+
+        public String getErrorMessages(List<? extends Throwable> list) {
+            return list.stream()
+                    .map(throwable -> String.format("[ERROR] : %s", getStackTrace(throwable)))
                     .collect(Collectors.joining("\n"));
         }