Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/AccessFlags.java
41161 views
1
/*
2
* Copyright (c) 2000, 2012, 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
25
package sun.jvm.hotspot.oops;
26
27
import sun.jvm.hotspot.runtime.ClassConstants;
28
import java.io.*;
29
30
public class AccessFlags implements /* imports */ ClassConstants {
31
public AccessFlags(long flags) {
32
this.flags = flags;
33
}
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
// Hotspot internal flags
60
// Method* flags
61
public boolean isMonitorMatching () { return (flags & JVM_ACC_MONITOR_MATCH ) != 0; }
62
public boolean hasMonitorBytecodes () { return (flags & JVM_ACC_HAS_MONITOR_BYTECODES ) != 0; }
63
public boolean hasLoops () { return (flags & JVM_ACC_HAS_LOOPS ) != 0; }
64
public boolean loopsFlagInit () { return (flags & JVM_ACC_LOOPS_FLAG_INIT ) != 0; }
65
public boolean queuedForCompilation() { return (flags & JVM_ACC_QUEUED ) != 0; }
66
public boolean isNotOsrCompilable () { return (flags & JVM_ACC_NOT_OSR_COMPILABLE ) != 0; }
67
public boolean hasLineNumberTable () { return (flags & JVM_ACC_HAS_LINE_NUMBER_TABLE ) != 0; }
68
public boolean hasCheckedExceptions() { return (flags & JVM_ACC_HAS_CHECKED_EXCEPTIONS ) != 0; }
69
public boolean hasJsrs () { return (flags & JVM_ACC_HAS_JSRS ) != 0; }
70
public boolean isObsolete () { return (flags & JVM_ACC_IS_OBSOLETE ) != 0; }
71
72
// Klass* flags
73
public boolean hasMirandaMethods () { return (flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
74
public boolean hasVanillaConstructor() { return (flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
75
public boolean hasFinalizer () { return (flags & JVM_ACC_HAS_FINALIZER ) != 0; }
76
public boolean isCloneable () { return (flags & JVM_ACC_IS_CLONEABLE ) != 0; }
77
78
// Klass* and Method* flags
79
public boolean hasLocalVariableTable() { return (flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE ) != 0; }
80
81
// field flags
82
public boolean fieldAccessWatched () { return (flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
83
public boolean fieldModificationWatched() { return (flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
84
public boolean fieldHasGenericSignature() { return (flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE)!= 0; }
85
86
public void printOn(PrintStream tty) {
87
// prints only .class flags and not the hotspot internal flags
88
if (isPublic ()) tty.print("public " );
89
if (isPrivate ()) tty.print("private " );
90
if (isProtected ()) tty.print("protected " );
91
if (isStatic ()) tty.print("static " );
92
if (isFinal ()) tty.print("final " );
93
if (isSynchronized()) tty.print("synchronized ");
94
if (isVolatile ()) tty.print("volatile " );
95
if (isBridge ()) tty.print("bridge " );
96
if (isTransient ()) tty.print("transient " );
97
if (isVarArgs ()) tty.print("varargs " );
98
if (isNative ()) tty.print("native " );
99
if (isEnum ()) tty.print("enum " );
100
if (isInterface ()) tty.print("interface " );
101
if (isAbstract ()) tty.print("abstract " );
102
if (isStrict ()) tty.print("strict " );
103
if (isSynthetic ()) tty.print("synthetic " );
104
}
105
106
// get flags written to .class files
107
public int getStandardFlags() {
108
return (int) (flags & JVM_ACC_WRITTEN_FLAGS);
109
}
110
}
111
112