jdk/test/java/lang/invoke/ClassValueTest.java
author jrose
Wed, 18 Jan 2012 17:34:32 -0800
changeset 11536 5be4f16d98bc
parent 11534 9949ffb8eb3a
child 14342 8435a30053c1
permissions -rw-r--r--
7030453: JSR 292 ClassValue.get method is too slow Summary: Implement ClassValue cooperatively with Class like ThreadLocal with Thread. Reviewed-by: twisti, mduigou
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     1
/*
8822
8145ab9f5f86 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 7562
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     4
 *
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    10
 *
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    15
 * accompanied this code).
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    16
 *
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    20
 *
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    23
 * questions.
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    24
 */
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    25
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    26
/* @test
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    27
 * @summary tests for class-specific values
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    28
 * @compile ClassValueTest.java
8822
8145ab9f5f86 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 7562
diff changeset
    29
 * @run junit/othervm test.java.lang.invoke.ClassValueTest
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    30
 */
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    31
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    32
/*
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    33
  Manually:
8822
8145ab9f5f86 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 7562
diff changeset
    34
   $ $JAVA7X_HOME/bin/javac -d foo -cp $JUNIT4_JAR test/java/lang/invoke/ClassValueTest.java
8145ab9f5f86 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 7562
diff changeset
    35
   $ $JAVA7X_HOME/bin/java -cp foo:$JUNIT4_JAR org.junit.runner.JUnitCore test.java.lang.invoke.ClassValueTest
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    36
  Output: .testAdd => 1000 : Integer
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    37
 */
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    38
8822
8145ab9f5f86 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 7562
diff changeset
    39
package test.java.lang.invoke;
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    40
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    41
import org.junit.*;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    42
import static org.junit.Assert.*;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    43
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    44
/**
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    45
 * @author jrose
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    46
 */
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    47
public class ClassValueTest {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    48
    static String nameForCV1(Class<?> type) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    49
        return "CV1:" + type.getName();
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    50
    }
9146
8f574b2bae87 7019529: JSR292: java/dyn/ClassValueTest.java depends on sub-test execution order
jrose
parents: 8822
diff changeset
    51
    int countForCV1;
8f574b2bae87 7019529: JSR292: java/dyn/ClassValueTest.java depends on sub-test execution order
jrose
parents: 8822
diff changeset
    52
    final ClassValue<String> CV1 = new CV1();
8f574b2bae87 7019529: JSR292: java/dyn/ClassValueTest.java depends on sub-test execution order
jrose
parents: 8822
diff changeset
    53
    private class CV1 extends ClassValue<String> {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    54
        protected String computeValue(Class<?> type) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    55
            countForCV1++;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    56
            return nameForCV1(type);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    57
        }
7562
a0ad195efe2c 7001424: implement JSR 292 EG adjustments, November 2010
jrose
parents: 7054
diff changeset
    58
    }
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    59
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
    60
    static final Class<?>[] CLASSES = {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    61
        String.class,
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    62
        Integer.class,
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    63
        int.class,
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    64
        boolean[].class,
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    65
        char[][].class,
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    66
        ClassValueTest.class
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    67
    };
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    68
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    69
    @Test
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    70
    public void testGet() {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    71
        countForCV1 = 0;
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
    72
        for (Class<?> c : CLASSES) {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    73
            assertEquals(nameForCV1(c), CV1.get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    74
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    75
        assertEquals(CLASSES.length, countForCV1);
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
    76
        for (Class<?> c : CLASSES) {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    77
            assertEquals(nameForCV1(c), CV1.get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    78
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    79
        assertEquals(CLASSES.length, countForCV1);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    80
    }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    81
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    82
    @Test
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    83
    public void testRemove() {
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
    84
        for (Class<?> c : CLASSES) {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    85
            CV1.get(c);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    86
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    87
        countForCV1 = 0;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    88
        int REMCOUNT = 3;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    89
        for (int i = 0; i < REMCOUNT; i++) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    90
            CV1.remove(CLASSES[i]);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    91
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    92
        assertEquals(0, countForCV1);  // no change
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
    93
        for (Class<?> c : CLASSES) {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    94
            assertEquals(nameForCV1(c), CV1.get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    95
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    96
        assertEquals(REMCOUNT, countForCV1);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    97
    }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    98
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
    99
    static String nameForCVN(Class<?> type, int n) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   100
        return "CV[" + n + "]" + type.getName();
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   101
    }
9146
8f574b2bae87 7019529: JSR292: java/dyn/ClassValueTest.java depends on sub-test execution order
jrose
parents: 8822
diff changeset
   102
    int countForCVN;
8f574b2bae87 7019529: JSR292: java/dyn/ClassValueTest.java depends on sub-test execution order
jrose
parents: 8822
diff changeset
   103
    class CVN extends ClassValue<String> {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   104
        final int n;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   105
        CVN(int n) { this.n = n; }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   106
        protected String computeValue(Class<?> type) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   107
            countForCVN++;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   108
            return nameForCVN(type, n);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   109
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   110
    };
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   111
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   112
    @Test
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   113
    public void testGetMany() {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   114
        int CVN_COUNT1 = 100, CVN_COUNT2 = 100;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   115
        CVN cvns[] = new CVN[CVN_COUNT1 * CVN_COUNT2];
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   116
        for (int n = 0; n < cvns.length; n++) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   117
            cvns[n] = new CVN(n);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   118
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   119
        countForCVN = 0;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   120
        for (int pass = 0; pass <= 2; pass++) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   121
            for (int i1 = 0; i1 < CVN_COUNT1; i1++) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   122
                eachClass:
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
   123
                for (Class<?> c : CLASSES) {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   124
                    for (int i2 = 0; i2 < CVN_COUNT2; i2++) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   125
                        int n = i1*CVN_COUNT2 + i2;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   126
                        assertEquals(0, countForCVN);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   127
                        assertEquals(nameForCVN(c, n), cvns[n].get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   128
                        cvns[n].get(c);  //get it again
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   129
                        //System.out.println("getting "+n+":"+cvns[n].get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   130
                        boolean doremove = (((i1 + i2) & 3) == 0);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   131
                        switch (pass) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   132
                        case 0:
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   133
                            assertEquals(1, countForCVN);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   134
                            break;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   135
                        case 1:
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   136
                            // remove on middle pass
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   137
                            assertEquals(0, countForCVN);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   138
                            if (doremove) {
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   139
                                //System.out.println("removing "+n+":"+cvns[n].get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   140
                                cvns[n].remove(c);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   141
                                assertEquals(0, countForCVN);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   142
                            }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   143
                            break;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   144
                        case 2:
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   145
                            assertEquals(doremove ? 1 : 0, countForCVN);
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   146
                            break;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   147
                        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   148
                        countForCVN = 0;
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   149
                        if (i1 > i2 && i1 < i2+5)  continue eachClass;  // leave diagonal gap
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   150
                    }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   151
                }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   152
            }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   153
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   154
        assertEquals(countForCVN, 0);
11536
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
   155
        System.out.println("[rechecking values]");
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
   156
        for (int i = 0; i < cvns.length * 10; i++) {
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
   157
            int n = i % cvns.length;
5be4f16d98bc 7030453: JSR 292 ClassValue.get method is too slow
jrose
parents: 11534
diff changeset
   158
            for (Class<?> c : CLASSES) {
7054
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   159
                assertEquals(nameForCVN(c, n), cvns[n].get(c));
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   160
            }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   161
        }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   162
    }
fee2fbaf3293 6982752: dynamic languages need to decorate types with runtime information
jrose
parents:
diff changeset
   163
}