1 /*
  2  * Copyright (c) 2003, 2022, 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 package nsk.jvmti.GetClassModifiers;
 25 
 26 import java.io.PrintStream;
 27 import java.lang.reflect.Modifier;
 28 
 29 public class getclmdf006 {
 30 
 31     final static int JCK_STATUS_BASE = 95;
 32 
 33     static {
 34         try {
 35             System.loadLibrary("getclmdf006");
 36         } catch (UnsatisfiedLinkError ule) {
 37             System.err.println("Could not load getclmdf006 library");
 38             System.err.println("java.library.path:"
 39                 + System.getProperty("java.library.path"));
 40             throw ule;
 41         }
 42     }
 43 
 44     native static void check(Class cls, int mod);
 45     native static int getRes();
 46 
 47     public static void main(String args[]) {
 48         args = nsk.share.jvmti.JVMTITest.commonInit(args);
 49 
 50         // produce JCK-like exit status.
 51         System.exit(run(args, System.out) + JCK_STATUS_BASE);
 52     }
 53 
 54     public static int run(String args[], PrintStream out) {
 55         check(getclmdf006a.class, 0);
 56         check(getclmdf006b.class, Modifier.FINAL);
 57         check(getclmdf006c.class, Modifier.ABSTRACT | Modifier.PERMITS_VALUE);
 58         check(getclmdf006d.class, Modifier.INTERFACE | Modifier.ABSTRACT);
 59         check(getclmdf006e.class, Modifier.PUBLIC | Modifier.INTERFACE |
 60                                   Modifier.ABSTRACT);
 61         check(Inner01.class, Modifier.PUBLIC);
 62         check(Inner02.class, Modifier.PUBLIC | Modifier.FINAL);
 63         check(Inner03.class, Modifier.PUBLIC | Modifier.ABSTRACT);
 64         check(Inner04.class, Modifier.PRIVATE);
 65         check(Inner05.class, Modifier.PRIVATE | Modifier.FINAL);
 66         check(Inner06.class, Modifier.PRIVATE | Modifier.ABSTRACT);
 67         check(Inner07.class, Modifier.PROTECTED);
 68         check(Inner08.class, Modifier.PROTECTED | Modifier.FINAL);
 69         check(Inner09.class, Modifier.PROTECTED | Modifier.ABSTRACT);
 70         check(Inner10.class, Modifier.STATIC);
 71         check(Inner11.class, Modifier.STATIC | Modifier.FINAL);
 72         check(Inner12.class, Modifier.STATIC | Modifier.ABSTRACT |
 73                              Modifier.PERMITS_VALUE);
 74         check(Inner13.class, Modifier.PUBLIC | Modifier.STATIC);
 75         check(Inner14.class, Modifier.PUBLIC | Modifier.STATIC |
 76                              Modifier.FINAL);
 77         check(Inner15.class, Modifier.PUBLIC | Modifier.STATIC |
 78                              Modifier.ABSTRACT | Modifier.PERMITS_VALUE);
 79         check(Inner16.class, Modifier.PRIVATE | Modifier.STATIC);
 80         check(Inner17.class, Modifier.PRIVATE | Modifier.STATIC |
 81                              Modifier.FINAL);
 82         check(Inner18.class, Modifier.PRIVATE | Modifier.STATIC |
 83                              Modifier.ABSTRACT | Modifier.PERMITS_VALUE);
 84         check(Inner19.class, Modifier.PROTECTED | Modifier.STATIC);
 85         check(Inner20.class, Modifier.PROTECTED | Modifier.STATIC |
 86                              Modifier.FINAL);
 87         check(Inner21.class, Modifier.PROTECTED | Modifier.STATIC |
 88                              Modifier.ABSTRACT | Modifier.PERMITS_VALUE);
 89         check(Inner22.class, Modifier.STATIC | Modifier.INTERFACE |
 90                              Modifier.ABSTRACT);
 91         check(Inner23.class, Modifier.PUBLIC | Modifier.STATIC |
 92                              Modifier.INTERFACE | Modifier.ABSTRACT);
 93         check(Inner24.class, Modifier.PRIVATE | Modifier.STATIC |
 94                              Modifier.INTERFACE | Modifier.ABSTRACT);
 95         check(Inner25.class, Modifier.PROTECTED | Modifier.STATIC |
 96                              Modifier.INTERFACE | Modifier.ABSTRACT);
 97         return getRes();
 98     }
 99 
100     public class Inner01 {}
101     public final class Inner02 {}
102     public abstract class Inner03 {}
103     private class Inner04 {}
104     private final class Inner05 {}
105     private abstract class Inner06 {}
106     protected class Inner07 {}
107     protected final class Inner08 {}
108     protected abstract class Inner09 {}
109     static class Inner10 {}
110     static final class Inner11 {}
111     static abstract class Inner12 {}
112     public static class Inner13 {}
113     public static final class Inner14 {}
114     public static abstract class Inner15 {}
115     private static class Inner16 {}
116     private static final class Inner17 {}
117     private static abstract class Inner18 {}
118     protected static class Inner19 {}
119     protected static final class Inner20 {}
120     protected static abstract class Inner21 {}
121 
122     interface Inner22 {}
123     public interface Inner23 {}
124     private interface Inner24 {}
125     protected interface Inner25 {}
126 }
127 
128 class getclmdf006a {}
129 final class getclmdf006b {}
130 abstract class getclmdf006c {}
131 interface getclmdf006d {}