test/jdk/javax/swing/UIDefaults/6795356/TableTest.java
author serb
Sun, 09 Sep 2018 19:07:34 -0700
changeset 51920 26a17d160081
parent 47216 71c04702a3d5
permissions -rw-r--r--
8205537: Drop of sun.applet package Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4272
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     1
/*
51920
26a17d160081 8205537: Drop of sun.applet package
serb
parents: 47216
diff changeset
     2
 * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
4272
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     4
 *
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     8
 *
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    13
 * accompanied this code).
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    14
 *
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4272
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4272
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4272
diff changeset
    21
 * questions.
4272
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    22
 */
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    23
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    24
/*
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    25
 * @test
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    26
 * @bug 6795356
51920
26a17d160081 8205537: Drop of sun.applet package
serb
parents: 47216
diff changeset
    27
 * @summary Checks that SwingLazyValue class works correctly
4272
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    28
 * @author Alexander Potochkin
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    29
 * @run main/othervm TableTest
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    30
 */
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    31
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    32
import javax.swing.*;
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    33
import javax.swing.table.TableCellEditor;
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    34
import java.awt.*;
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    35
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    36
public class TableTest {
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    37
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    38
    public static void main(String[] args) throws Exception {
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    39
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    40
        KeyboardFocusManager.getCurrentKeyboardFocusManager();
51920
26a17d160081 8205537: Drop of sun.applet package
serb
parents: 47216
diff changeset
    41
        System.setSecurityManager(new SecurityManager());
4272
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    42
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    43
        JTable table = new JTable();
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    44
        TableCellEditor de = table.getDefaultEditor(Double.class);
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    45
        if (de == null) {
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    46
            throw new RuntimeException("Table default editor is null");
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    47
        }
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    48
    }
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    49
}
f4742294ef29 6795356: Leak caused by javax.swing.UIDefaults.ProxyLazyValue.acc
alexp
parents:
diff changeset
    50