langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java
author mchung
Wed, 27 May 2015 13:25:18 -0700
changeset 30846 2b3f379840f0
parent 30730 d3ce7619db2c
child 35359 f04501964016
permissions -rw-r--r--
8074432: Move jdeps and javap to jdk.jdeps module Reviewed-by: jjg, alanb, erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30010
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 30010
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
30010
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     4
 *
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     8
 *
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    13
 * accompanied this code).
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    14
 *
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    18
 *
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    21
 * questions.
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    22
 */
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    23
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    24
/*
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    25
 * @test
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    26
 * @bug 8042947
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    27
 * @summary Checking AnnotationDefault attribute.
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    28
 * @library /tools/lib /tools/javac/lib ../lib
30846
2b3f379840f0 8074432: Move jdeps and javap to jdk.jdeps module
mchung
parents: 30730
diff changeset
    29
 * @modules jdk.jdeps/com.sun.tools.classfile
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 30010
diff changeset
    30
 *          jdk.compiler/com.sun.tools.javac.api
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 30010
diff changeset
    31
 *          jdk.compiler/com.sun.tools.javac.file
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 30010
diff changeset
    32
 *          jdk.compiler/com.sun.tools.javac.main
30010
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    33
 * @build AnnotationDefaultTest TestBase TestResult InMemoryFileManager ToolBox AnnotationDefaultVerifier
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    34
 * @run main AnnotationDefaultTest
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    35
 */
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    36
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    37
import com.sun.tools.classfile.*;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    38
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    39
import java.io.File;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    40
import java.io.IOException;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    41
import java.lang.annotation.RetentionPolicy;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    42
import java.nio.file.Files;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    43
import java.util.HashMap;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    44
import java.util.Map;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    45
import java.util.Objects;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    46
import java.util.function.Function;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    47
import java.util.stream.Collectors;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    48
import java.util.stream.Stream;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    49
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    50
public class AnnotationDefaultTest extends TestResult {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    51
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    52
    private final static String templateFileName = "AnnotationDefault.java.template";
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    53
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    54
    private final AnnotationDefaultVerifier verifier;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    55
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    56
    public AnnotationDefaultTest() {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    57
        verifier = new AnnotationDefaultVerifier();
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    58
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    59
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    60
    private void test(String template, Map<String, String> replacements, boolean hasDefault) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    61
        String source = replace(template, replacements);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    62
        addTestCase(source);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    63
        try {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    64
            printf("Testing source:\n%s\n", source);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    65
            String className = "AnnotationDefault";
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    66
            InMemoryFileManager fileManager = compile(source);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    67
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    68
            // Map <method-name, expected-annotation-default-values>
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    69
            Map<String, ExpectedValues> expectedValues =
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    70
                    getExpectedValues(forName(className, fileManager));
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    71
            ClassFile classFile = readClassFile(fileManager.getClasses().get(className));
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    72
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    73
            for (Method method : classFile.methods) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    74
                String methodName = method.getName(classFile.constant_pool);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    75
                printf("Testing method : %s\n", methodName);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    76
                AnnotationDefault_attribute attr =
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    77
                        (AnnotationDefault_attribute) method.attributes
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    78
                                .get(Attribute.AnnotationDefault);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    79
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    80
                if (hasDefault && !checkNotNull(attr, "Attribute is not null")
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    81
                        || !hasDefault && checkNull(attr, "Attribute is null")) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    82
                    // stop checking, attr is null
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    83
                    continue;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    84
                }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    85
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    86
                checkEquals(countNumberOfAttributes(method.attributes.attrs),
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    87
                        1l,
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    88
                        "Number of AnnotationDefault attribute");
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    89
                checkEquals(classFile.constant_pool
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    90
                        .getUTF8Value(attr.attribute_name_index),
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    91
                        "AnnotationDefault", "attribute_name_index");
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    92
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    93
                ExpectedValues expectedValue = expectedValues.get(methodName);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    94
                checkEquals((char) attr.default_value.tag, expectedValue.tag(),
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    95
                        String.format("check tag : %c %s", expectedValue.tag(), expectedValue.name()));
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    96
                verifier.testElementValue(attr.default_value.tag,
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    97
                        this, classFile, attr.default_value,
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    98
                        expectedValue.values());
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
    99
                verifier.testLength(attr.default_value.tag, this, attr);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   100
            }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   101
        } catch (Exception e) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   102
            addFailure(e);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   103
        }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   104
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   105
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   106
    private Class<?> forName(String className, InMemoryFileManager fileManager) throws ClassNotFoundException {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   107
        return fileManager.getClassLoader(null).loadClass(className);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   108
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   109
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   110
    private Map<String, ExpectedValues> getExpectedValues(Class<?> clazz) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   111
        return Stream.of(clazz.getMethods())
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   112
                .map(method -> method.getAnnotation(ExpectedValues.class))
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   113
                .filter(Objects::nonNull)
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   114
                .collect(Collectors.toMap(
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   115
                        ExpectedValues::name,
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   116
                        Function.identity()));
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   117
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   118
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   119
    private String replace(String template, Map<String, String> replacements) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   120
        String ans = template;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   121
        for (Map.Entry<String, String> replace : replacements.entrySet()) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   122
            ans = ans.replaceAll(replace.getKey(), replace.getValue());
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   123
        }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   124
        return ans;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   125
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   126
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   127
    private long countNumberOfAttributes(Attribute[] attrs) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   128
        return Stream.of(attrs)
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   129
                .filter(x -> x instanceof AnnotationDefault_attribute)
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   130
                .count();
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   131
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   132
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   133
    public String getSource(File templateFileName) throws IOException {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   134
        return Files.lines(templateFileName.toPath())
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   135
                .filter(str -> !str.startsWith("/*") && !str.startsWith(" *"))
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   136
                .collect(Collectors.joining("\n"));
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   137
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   138
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   139
    public void test() throws TestFailedException {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   140
        try {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   141
            String template = getSource(getSourceFile(templateFileName));
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   142
            for (int i = 0; i < 2; ++i) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   143
                for (String repeatable : new String[] {"", "@Repeatable(Container.class)"}) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   144
                    for (RetentionPolicy policy : RetentionPolicy.values()) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   145
                        final int finalI = i;
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   146
                        Map<String, String> replacements = new HashMap<String, String>(){{
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   147
                            put("%POLICY%", policy.toString());
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   148
                            if (finalI != 0) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   149
                                put("default.*\n", ";\n");
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   150
                            }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   151
                            put("%REPEATABLE%", repeatable);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   152
                        }};
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   153
                        test(template, replacements, i == 0);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   154
                    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   155
                }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   156
            }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   157
        } catch (Throwable e) {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   158
            addFailure(e);
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   159
        } finally {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   160
            checkStatus();
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   161
        }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   162
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   163
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   164
    public static void main(String[] args) throws TestFailedException {
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   165
        new AnnotationDefaultTest().test();
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   166
    }
319ded3e820a 8042947: Implement classfile tests for AnnotationDefault attribute
aeremeev
parents:
diff changeset
   167
}