1 /* 2 * Copyright (c) 2003, 2018, 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); 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 check(Inner13.class, Modifier.PUBLIC | Modifier.STATIC); 74 check(Inner14.class, Modifier.PUBLIC | Modifier.STATIC | 75 Modifier.FINAL); 76 check(Inner15.class, Modifier.PUBLIC | Modifier.STATIC | 77 Modifier.ABSTRACT); 78 check(Inner16.class, Modifier.PRIVATE | Modifier.STATIC); 79 check(Inner17.class, Modifier.PRIVATE | Modifier.STATIC | 80 Modifier.FINAL); 81 check(Inner18.class, Modifier.PRIVATE | Modifier.STATIC | 82 Modifier.ABSTRACT); 83 check(Inner19.class, Modifier.PROTECTED | Modifier.STATIC); 84 check(Inner20.class, Modifier.PROTECTED | Modifier.STATIC | 85 Modifier.FINAL); 86 check(Inner21.class, Modifier.PROTECTED | Modifier.STATIC | 87 Modifier.ABSTRACT); 88 check(Inner22.class, Modifier.STATIC | Modifier.INTERFACE | 89 Modifier.ABSTRACT); 90 check(Inner23.class, Modifier.PUBLIC | Modifier.STATIC | 91 Modifier.INTERFACE | Modifier.ABSTRACT); 92 check(Inner24.class, Modifier.PRIVATE | Modifier.STATIC | 93 Modifier.INTERFACE | Modifier.ABSTRACT); 94 check(Inner25.class, Modifier.PROTECTED | Modifier.STATIC | 95 Modifier.INTERFACE | Modifier.ABSTRACT); 96 return getRes(); 97 } 98 99 public class Inner01 {} 100 public final class Inner02 {} 101 public abstract class Inner03 {} 102 private class Inner04 {} 103 private final class Inner05 {} 104 private abstract class Inner06 {} 105 protected class Inner07 {} 106 protected final class Inner08 {} 107 protected abstract class Inner09 {} 108 static class Inner10 {} 109 static final class Inner11 {} 110 static abstract class Inner12 {} 111 public static class Inner13 {} 112 public static final class Inner14 {} 113 public static abstract class Inner15 {} 114 private static class Inner16 {} 115 private static final class Inner17 {} 116 private static abstract class Inner18 {} 117 protected static class Inner19 {} 118 protected static final class Inner20 {} 119 protected static abstract class Inner21 {} 120 121 interface Inner22 {} 122 public interface Inner23 {} 123 private interface Inner24 {} 124 protected interface Inner25 {} 125 } 126 127 class getclmdf006a {} 128 final class getclmdf006b {} 129 abstract class getclmdf006c {} 130 interface getclmdf006d {}