1 /*
 2  * Copyright (c) 1999, 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  *
23  */
24 
25 #include "ci/ciFlags.hpp"
26 
27 // ciFlags
28 //
29 // This class represents klass or method flags
30 
31 // ------------------------------------------------------------------
32 // ciFlags::print_klass_flags
33 void ciFlags::print_klass_flags(outputStream* st) {
34   if (is_public()) {
35     st->print("public");
36   } else {
37     st->print("DEFAULT_ACCESS");
38   }
39 
40   if (is_final()) {
41     st->print(",final");
42   }
43   if (is_interface()) {
44     st->print(",interface");
45   }
46   if (is_abstract()) {
47     st->print(",abstract");
48   }
49 }
50 
51 // ------------------------------------------------------------------
52 // ciFlags::print_member_flags
53 void ciFlags::print_member_flags(outputStream* st) {
54   if (is_public()) {
55     st->print("public");
56   } else if (is_private()) {
57     st->print("private");
58   } else if (is_protected()) {
59     st->print("protected");
60   } else {
61     st->print("DEFAULT_ACCESS");
62   }
63 
64   if (is_static()) {
65     st->print(",static");
66   }
67   if (is_final()) {
68     st->print(",final");
69   }
70   if (is_synchronized()) {
71     st->print(",synchronized");
72   }
73   if (is_volatile()) {
74     st->print(",volatile");
75   }
76   if (is_transient()) {
77     st->print(",transient");
78   }
79   if (is_native()) {
80     st->print(",native");
81   }
82   if (is_abstract()) {
83     st->print(",abstract");
84   }
85 
86 }
87 
88 // ------------------------------------------------------------------
89 // ciFlags::print
90 void ciFlags::print(outputStream* st) {
91   st->print(" flags=%x", _flags.as_unsigned_short());
92 }