test/jdk/java/beans/Performance/Test7122740.java
author pli
Tue, 16 Jul 2019 00:57:00 +0000
changeset 55689 8c5c9d86e1d6
parent 47216 71c04702a3d5
permissions -rw-r--r--
8227512: [TESTBUG] Fix JTReg javac test failures with Graal Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13356
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 20094
diff changeset
     2
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
13356
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     4
 *
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     8
 *
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    13
 * accompanied this code).
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    14
 *
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    18
 *
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    21
 * questions.
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    22
 */
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    23
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    24
/*
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    25
 * @test
20094
462e588b8284 8023536: Some regression tests have a wrong header
malenkov
parents: 13356
diff changeset
    26
 * @bug 7187618 7122740
13356
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    27
 * @summary Tests just a benchmark of PropertyDescriptor(String, Class) performance
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    28
 * @author Sergey Malenkov
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    29
 * @run main/manual Test7122740
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    30
 */
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    31
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    32
import java.beans.PropertyDescriptor;
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    33
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    34
public class Test7122740 {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    35
    public static void main(String[] args) throws Exception {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    36
        long time = System.nanoTime();
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    37
        for (int i = 0; i < 1000; i++) {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    38
            new PropertyDescriptor("name", PropertyDescriptor.class);
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    39
            new PropertyDescriptor("value", Concrete.class);
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    40
        }
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    41
        time -= System.nanoTime();
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    42
        System.out.println("Time (ms): " + (-time / 1000000));
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    43
    }
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    44
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    45
    public static class Abstract<T> {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    46
        private T value;
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    47
        public T getValue() {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    48
            return this.value;
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    49
        }
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    50
        public void setValue(T value) {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    51
            this.value = value;
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    52
        }
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    53
    }
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    54
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    55
    private static class Concrete extends Abstract<String> {
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    56
    }
89a34c00fd8c 7187618: PropertyDescriptor Performance Slow
malenkov
parents:
diff changeset
    57
}