< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/AccessFlags.java

Print this page

 1 /*
 2  * Copyright (c) 2000, 2025, 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  *

34 
35   private long flags;
36 
37   // Java access flags
38   public boolean isPublic      () { return (flags & JVM_ACC_PUBLIC      ) != 0; }
39   public boolean isPrivate     () { return (flags & JVM_ACC_PRIVATE     ) != 0; }
40   public boolean isProtected   () { return (flags & JVM_ACC_PROTECTED   ) != 0; }
41   public boolean isStatic      () { return (flags & JVM_ACC_STATIC      ) != 0; }
42   public boolean isFinal       () { return (flags & JVM_ACC_FINAL       ) != 0; }
43   public boolean isSynchronized() { return (flags & JVM_ACC_SYNCHRONIZED) != 0; }
44   public boolean isSuper       () { return (flags & JVM_ACC_SUPER       ) != 0; }
45   public boolean isVolatile    () { return (flags & JVM_ACC_VOLATILE    ) != 0; }
46   public boolean isBridge      () { return (flags & JVM_ACC_BRIDGE      ) != 0; }
47   public boolean isTransient   () { return (flags & JVM_ACC_TRANSIENT   ) != 0; }
48   public boolean isVarArgs     () { return (flags & JVM_ACC_VARARGS     ) != 0; }
49   public boolean isNative      () { return (flags & JVM_ACC_NATIVE      ) != 0; }
50   public boolean isEnum        () { return (flags & JVM_ACC_ENUM        ) != 0; }
51   public boolean isAnnotation  () { return (flags & JVM_ACC_ANNOTATION  ) != 0; }
52   public boolean isInterface   () { return (flags & JVM_ACC_INTERFACE   ) != 0; }
53   public boolean isAbstract    () { return (flags & JVM_ACC_ABSTRACT    ) != 0; }
54   public boolean isStrict      () { return (flags & JVM_ACC_STRICT      ) != 0; }
55   public boolean isSynthetic   () { return (flags & JVM_ACC_SYNTHETIC   ) != 0; }
56 
57   public long getValue         () { return flags; }
58 
59   public void printOn(PrintStream tty) {
60     // prints only .class flags and not the hotspot internal flags
61     if (isPublic      ()) tty.print("public "      );
62     if (isPrivate     ()) tty.print("private "     );
63     if (isProtected   ()) tty.print("protected "   );
64     if (isStatic      ()) tty.print("static "      );
65     if (isFinal       ()) tty.print("final "       );
66     if (isSynchronized()) tty.print("synchronized ");
67     if (isVolatile    ()) tty.print("volatile "    );
68     if (isBridge      ()) tty.print("bridge "      );
69     if (isTransient   ()) tty.print("transient "   );
70     if (isVarArgs     ()) tty.print("varargs "     );
71     if (isNative      ()) tty.print("native "      );
72     if (isEnum        ()) tty.print("enum "        );
73     if (isInterface   ()) tty.print("interface "   );
74     if (isAbstract    ()) tty.print("abstract "    );

 1 /*
 2  * Copyright (c) 2000, 2026, 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  *

34 
35   private long flags;
36 
37   // Java access flags
38   public boolean isPublic      () { return (flags & JVM_ACC_PUBLIC      ) != 0; }
39   public boolean isPrivate     () { return (flags & JVM_ACC_PRIVATE     ) != 0; }
40   public boolean isProtected   () { return (flags & JVM_ACC_PROTECTED   ) != 0; }
41   public boolean isStatic      () { return (flags & JVM_ACC_STATIC      ) != 0; }
42   public boolean isFinal       () { return (flags & JVM_ACC_FINAL       ) != 0; }
43   public boolean isSynchronized() { return (flags & JVM_ACC_SYNCHRONIZED) != 0; }
44   public boolean isSuper       () { return (flags & JVM_ACC_SUPER       ) != 0; }
45   public boolean isVolatile    () { return (flags & JVM_ACC_VOLATILE    ) != 0; }
46   public boolean isBridge      () { return (flags & JVM_ACC_BRIDGE      ) != 0; }
47   public boolean isTransient   () { return (flags & JVM_ACC_TRANSIENT   ) != 0; }
48   public boolean isVarArgs     () { return (flags & JVM_ACC_VARARGS     ) != 0; }
49   public boolean isNative      () { return (flags & JVM_ACC_NATIVE      ) != 0; }
50   public boolean isEnum        () { return (flags & JVM_ACC_ENUM        ) != 0; }
51   public boolean isAnnotation  () { return (flags & JVM_ACC_ANNOTATION  ) != 0; }
52   public boolean isInterface   () { return (flags & JVM_ACC_INTERFACE   ) != 0; }
53   public boolean isAbstract    () { return (flags & JVM_ACC_ABSTRACT    ) != 0; }
54   public boolean isStrict      () { return (flags & JVM_ACC_STRICT_INIT ) != 0; }
55   public boolean isSynthetic   () { return (flags & JVM_ACC_SYNTHETIC   ) != 0; }
56 
57   public long getValue         () { return flags; }
58 
59   public void printOn(PrintStream tty) {
60     // prints only .class flags and not the hotspot internal flags
61     if (isPublic      ()) tty.print("public "      );
62     if (isPrivate     ()) tty.print("private "     );
63     if (isProtected   ()) tty.print("protected "   );
64     if (isStatic      ()) tty.print("static "      );
65     if (isFinal       ()) tty.print("final "       );
66     if (isSynchronized()) tty.print("synchronized ");
67     if (isVolatile    ()) tty.print("volatile "    );
68     if (isBridge      ()) tty.print("bridge "      );
69     if (isTransient   ()) tty.print("transient "   );
70     if (isVarArgs     ()) tty.print("varargs "     );
71     if (isNative      ()) tty.print("native "      );
72     if (isEnum        ()) tty.print("enum "        );
73     if (isInterface   ()) tty.print("interface "   );
74     if (isAbstract    ()) tty.print("abstract "    );
< prev index next >