1 /*
   2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.BufferedReader;
  25 import java.io.InputStreamReader;
  26 import java.lang.Class;
  27 import java.lang.String;
  28 import java.lang.System;
  29 import java.lang.management.ManagementFactory;
  30 import java.lang.management.RuntimeMXBean;
  31 import java.util.ArrayList;
  32 import java.util.List;
  33 import java.util.concurrent.CyclicBarrier;
  34 import java.util.regex.Matcher;
  35 import java.util.regex.Pattern;
  36 import java.lang.reflect.Field;
  37 import java.lang.reflect.Modifier;
  38 import sun.misc.Unsafe;
  39 import jdk.internal.vm.annotation.Contended;
  40 
  41 /*
  42  * @test
  43  * @bug     8015270
  44  * @summary \@Contended: fix multiple issues in the layout code
  45  *
  46  * @modules java.base/sun.misc
  47  * @run main/othervm -XX:-RestrictContended HasNonStatic
  48  */
  49 public class HasNonStatic {
  50 
  51     public static void main(String[] args) throws Exception {
  52         R1 r1 = new R1();
  53         R2 r2 = new R2();
  54         R3 r3 = new R3();
  55         R4 r4 = new R4();
  56     }
  57 
  58     public static class R1 {
  59         @Contended
  60         Object o;
  61     }
  62 
  63     @Contended
  64     public static class R2 {
  65         Object o;
  66     }
  67 
  68     @Contended
  69     public static class R3 {
  70     }
  71 
  72     public static class R4 extends R3 {
  73     }
  74 
  75 }
  76