1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  */
18 
19 /**
20  * @author Aleksey V. Yantsen
21  */
22 
23 /**
24  * Created on 10.25.2004
25  */
26 package org.apache.harmony.jpda.tests.framework.jdwp;
27 
28 /**
29  * This class defines various constants from JDWP specifications.
30  * Each class has getName function to convert a constant value
31  * to string equivalent.
32  */
33 public class JDWPConstants {
34 
35     /**
36      * JDWP ThreadStatus constants
37      */
38     public static class ThreadStatus {
39 
40         public static final byte ZOMBIE = 0;
41 
42         public static final byte RUNNING = 1;
43 
44         public static final byte SLEEPING = 2;
45 
46         public static final byte MONITOR = 3;
47 
48         public static final byte WAIT = 4;
49 
50         /**
51          * Gets name for corresponding constant value.
52          *
53          * @param status
54          *            a constant from ones declared in this class
55          * @return String
56          */
getName(int status)57         public static String getName(int status) {
58             switch (status) {
59             case ZOMBIE:
60                 return "ZOMBIE";
61             case RUNNING:
62                 return "RUNNING";
63             case SLEEPING:
64                 return "SLEEPING";
65             case MONITOR:
66                 return "MONITOR";
67             case WAIT:
68                 return "WAIT";
69             default:
70                 return "<unknown>";
71             }
72         }
73     }
74 
75     /**
76      * JDWP SuspendStatus constants
77      */
78     public static class SuspendStatus {
79 
80         public static final byte SUSPEND_STATUS_SUSPENDED = 1;
81 
82         /**
83          * Gets name for corresponding constant value.
84          *
85          * @param status
86          *            a constant from ones declared in this class
87          * @return String
88          */
getName(int status)89         public static String getName(int status) {
90             if (status == SUSPEND_STATUS_SUSPENDED)
91                 return "SUSPENDED";
92             return "NONE";
93         }
94     }
95 
96     /**
97      * JDWP ClassStatus constants
98      */
99     public static class ClassStatus {
100 
101         public static final byte VERIFIED = 1;
102 
103         public static final byte PREPARED = 2;
104 
105         public static final byte INITIALIZED = 4;
106 
107         public static final byte ERROR = 8;
108 
109         // it looks like JDWP spec becomes out of date
110         // see JVMTI specification for GetClassStatus:
111         //
112         public static final byte ARRAY = 16;
113 
114         public static final byte PRIMITIVE = 32;
115 
116         /**
117          * Gets name for corresponding constant value.
118          *
119          * @param status
120          *            a constant from ones declared in this class
121          * @return String
122          */
getName(int status)123         public static String getName(int status) {
124 
125             String returnValue = "";
126             if ((status & VERIFIED) == VERIFIED)
127                 returnValue += "|VERIFIED";
128             if ((status & PREPARED) == PREPARED)
129                 returnValue += "|PREPARED";
130             if ((status & INITIALIZED) == INITIALIZED)
131                 returnValue += "|INITIALIZED";
132             if ((status & ERROR) == ERROR)
133                 returnValue += "|ERROR";
134             if ((status & ARRAY) == ARRAY)
135                 returnValue += "|ARRAY";
136             if ((status & PRIMITIVE) == PRIMITIVE)
137                 returnValue += "|PRIMITIVE";
138 
139             if (returnValue.equals("")) {
140                 returnValue = "NONE";
141             } else {
142                 returnValue = returnValue.substring(1);
143             }
144 
145             return returnValue;
146         }
147     }
148 
149     /**
150      * JDWP TypeTag constants
151      */
152     public static class TypeTag {
153 
154         public static final byte CLASS = 1;
155 
156         public static final byte INTERFACE = 2;
157 
158         public static final byte ARRAY = 3;
159 
160         /**
161          * Gets name for corresponding constant value.
162          *
163          * @param refTypeTag
164          *            a constant from ones declared in this class
165          * @return String
166          */
getName(byte refTypeTag)167         public static String getName(byte refTypeTag) {
168             switch (refTypeTag) {
169             case CLASS:
170                 return "CLASS";
171             case INTERFACE:
172                 return "INTERFACE";
173             case ARRAY:
174                 return "ARRAY";
175             default:
176                 return "<unknown>";
177             }
178         }
179     }
180 
181     /**
182      * JDWP Tag constants
183      */
184     public static class Tag {
185 
186         public static final byte ARRAY_TAG = 91;
187 
188         public static final byte BYTE_TAG = 66;
189 
190         public static final byte CHAR_TAG = 67;
191 
192         public static final byte OBJECT_TAG = 76;
193 
194         public static final byte FLOAT_TAG = 70;
195 
196         public static final byte DOUBLE_TAG = 68;
197 
198         public static final byte INT_TAG = 73;
199 
200         public static final byte LONG_TAG = 74;
201 
202         public static final byte SHORT_TAG = 83;
203 
204         public static final byte VOID_TAG = 86;
205 
206         public static final byte BOOLEAN_TAG = 90;
207 
208         public static final byte STRING_TAG = 115;
209 
210         public static final byte THREAD_TAG = 116;
211 
212         public static final byte THREAD_GROUP_TAG = 103;
213 
214         public static final byte CLASS_LOADER_TAG = 108;
215 
216         public static final byte CLASS_OBJECT_TAG = 99;
217 
218         public static final byte NO_TAG = 0;
219 
220         /**
221          * Gets name for corresponding constant value.
222          *
223          * @param tag
224          *            a constant from ones declared in this class
225          * @return String
226          */
getName(byte tag)227         public static String getName(byte tag) {
228             switch (tag) {
229             case ARRAY_TAG:
230                 return "ARRAY_TAG";
231             case BYTE_TAG:
232                 return "BYTE_TAG";
233             case CHAR_TAG:
234                 return "CHAR_TAG";
235             case OBJECT_TAG:
236                 return "OBJECT_TAG";
237             case FLOAT_TAG:
238                 return "FLOAT_TAG";
239             case DOUBLE_TAG:
240                 return "DOUBLE_TAG";
241             case INT_TAG:
242                 return "INT_TAG";
243             case LONG_TAG:
244                 return "LONG_TAG";
245             case SHORT_TAG:
246                 return "SHORT_TAG";
247             case VOID_TAG:
248                 return "VOID_TAG";
249             case BOOLEAN_TAG:
250                 return "BOOLEAN_TAG";
251             case STRING_TAG:
252                 return "STRING_TAG";
253             case THREAD_TAG:
254                 return "THREAD_TAG";
255             case THREAD_GROUP_TAG:
256                 return "THREAD_GROUP_TAG";
257             case CLASS_LOADER_TAG:
258                 return "CLASS_LOADER_TAG";
259             case CLASS_OBJECT_TAG:
260                 return "CLASS_OBJECT_TAG";
261             case NO_TAG:
262                 return "NO_TAG";
263             default:
264                 return "<unknown>";
265             }
266         }
267     }
268 
269     /**
270      * JDWP EventKind constants
271      */
272     public static class EventKind {
273 
274         public static final byte SINGLE_STEP = 1;
275 
276         public static final byte BREAKPOINT = 2;
277 
278         public static final byte FRAME_POP = 3;
279 
280         public static final byte EXCEPTION = 4;
281 
282         public static final byte USER_DEFINED = 5;
283 
284         public static final byte THREAD_START = 6;
285 
286         public static final byte THREAD_END = 7;
287 
288         public static final byte THREAD_DEATH = THREAD_END;
289 
290         public static final byte CLASS_PREPARE = 8;
291 
292         public static final byte CLASS_UNLOAD = 9;
293 
294         public static final byte CLASS_LOAD = 10;
295 
296         public static final byte FIELD_ACCESS = 20;
297 
298         public static final byte FIELD_MODIFICATION = 21;
299 
300         public static final byte EXCEPTION_CATCH = 30;
301 
302         public static final byte METHOD_ENTRY = 40;
303 
304         public static final byte METHOD_EXIT = 41;
305 
306         // METHOD_EXIT_WITH_RETURN_VALUE
307         // MONITOR_CONTENDED_ENTER,MONITOR_CONTENDED_ENTER
308         // MONITOR_WAIT, MONITOR_WAITED are new events for Java 6
309         public static final byte METHOD_EXIT_WITH_RETURN_VALUE = 42;
310 
311         public static final byte MONITOR_CONTENDED_ENTER = 43;
312 
313         public static final byte MONITOR_CONTENDED_ENTERED = 44;
314 
315         public static final byte MONITOR_WAIT = 45;
316 
317         public static final byte MONITOR_WAITED = 46;
318 
319         public static final byte VM_INIT = 90;
320 
321         public static final byte VM_START = VM_INIT;
322 
323         public static final byte VM_DEATH = 99;
324 
325         public static final byte VM_DISCONNECTED = 100;
326 
327         /**
328          * Gets name for corresponding constant value.
329          *
330          * @param eventKind
331          *            a constant from ones declared in this class
332          * @return String
333          */
getName(byte eventKind)334         public static String getName(byte eventKind) {
335             switch (eventKind) {
336             case SINGLE_STEP:
337                 return "SINGLE_STEP";
338             case BREAKPOINT:
339                 return "BREAKPOINT";
340             case FRAME_POP:
341                 return "FRAME_POP";
342             case EXCEPTION:
343                 return "EXCEPTION";
344             case USER_DEFINED:
345                 return "USER_DEFINED";
346             case THREAD_START:
347                 return "THREAD_START";
348             case THREAD_END:
349                 return "THREAD_END";
350             case CLASS_PREPARE:
351                 return "CLASS_PREPARE";
352             case CLASS_UNLOAD:
353                 return "CLASS_UNLOAD";
354             case CLASS_LOAD:
355                 return "CLASS_LOAD";
356             case FIELD_ACCESS:
357                 return "FIELD_ACCESS";
358             case FIELD_MODIFICATION:
359                 return "FIELD_MODIFICATION";
360             case EXCEPTION_CATCH:
361                 return "EXCEPTION_CATCH";
362             case METHOD_ENTRY:
363                 return "METHOD_ENTRY";
364             case METHOD_EXIT:
365                 return "METHOD_EXIT";
366             case METHOD_EXIT_WITH_RETURN_VALUE:
367                 return "METHOD_EXIT_WITH_RETURN_VALUE";
368             case MONITOR_CONTENDED_ENTER:
369                 return "MONITOR_CONTENDED_ENTER";
370             case MONITOR_CONTENDED_ENTERED:
371                 return "MONITOR_CONTENDED_ENTERED";
372             case MONITOR_WAIT:
373                 return "MONITOR_WAIT";
374             case MONITOR_WAITED:
375                 return "MONITOR_WAITED";
376             case VM_INIT:
377                 return "VM_INIT";
378             case VM_DEATH:
379                 return "VM_DEATH";
380             case VM_DISCONNECTED:
381                 return "VM_DISCONNECTED";
382             default:
383                 return "<unknown>";
384             }
385         }
386     }
387 
388     /**
389      * JDWP Error constants
390      */
391     public static class Error {
392 
393         public static final int NONE = 0;
394 
395         public static final int INVALID_THREAD = 10;
396 
397         public static final int INVALID_THREAD_GROUP = 11;
398 
399         public static final int INVALID_PRIORITY = 12;
400 
401         public static final int THREAD_NOT_SUSPENDED = 13;
402 
403         public static final int THREAD_SUSPENDED = 14;
404 
405         public static final int THREAD_NOT_ALIVE = 15;
406 
407         public static final int INVALID_OBJECT = 20;
408 
409         public static final int INVALID_CLASS = 21;
410 
411         public static final int CLASS_NOT_PREPARED = 22;
412 
413         public static final int INVALID_METHODID = 23;
414 
415         public static final int INVALID_LOCATION = 24;
416 
417         public static final int INVALID_FIELDID = 25;
418 
419         public static final int INVALID_FRAMEID = 30;
420 
421         public static final int NO_MORE_FRAMES = 31;
422 
423         public static final int OPAQUE_FRAME = 32;
424 
425         public static final int NOT_CURRENT_FRAME = 33;
426 
427         public static final int TYPE_MISMATCH = 34;
428 
429         public static final int INVALID_SLOT = 35;
430 
431         public static final int DUPLICATE = 40;
432 
433         public static final int NOT_FOUND = 41;
434 
435         public static final int INVALID_MONITOR = 50;
436 
437         public static final int NOT_MONITOR_OWNER = 51;
438 
439         public static final int INTERRUPT = 52;
440 
441         public static final int INVALID_CLASS_FORMAT = 60;
442 
443         public static final int CIRCULAR_CLASS_DEFENITION = 61;
444 
445         public static final int FAILS_VERIFICATION = 62;
446 
447         public static final int ADD_METHOD_NOT_IMPLEMENTED = 63;
448 
449         public static final int SCHEMA_CHANGE_NOT_IMPLEMENTED = 64;
450 
451         public static final int INVALID_TYPESTATE = 65;
452 
453         public static final int HIERARCHY_CHANGE_NOT_IMPLEMENTED = 66;
454 
455         public static final int DELETE_METHOD_NOT_IMPLEMENTED = 67;
456 
457         public static final int UNSUPPORTED_VERSION = 68;
458 
459         public static final int NAMES_DONT_MATCH = 69;
460 
461         public static final int CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 70;
462 
463         public static final int METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 71;
464 
465         public static final int NOT_IMPLEMENTED = 99;
466 
467         public static final int NULL_POINTER = 100;
468 
469         public static final int ABSENT_INFORMATION = 101;
470 
471         public static final int INVALID_EVENT_TYPE = 102;
472 
473         public static final int ILLEGAL_ARGUMENT = 103;
474 
475         public static final int OUT_OF_MEMORY = 110;
476 
477         public static final int ACCESS_DENIED = 111;
478 
479         public static final int VM_DEAD = 112;
480 
481         public static final int INTERNAL = 113;
482 
483         public static final int UNATTACHED_THREAD = 115;
484 
485         public static final int INVALID_TAG = 500;
486 
487         public static final int ALREADY_INVOKING = 502;
488 
489         public static final int INVALID_INDEX = 503;
490 
491         public static final int INVALID_LENGTH = 504;
492 
493         public static final int INVALID_STRING = 506;
494 
495         public static final int INVALID_CLASS_LOADER = 507;
496 
497         public static final int INVALID_ARRAY = 508;
498 
499         public static final int TRANSPORT_LOAD = 509;
500 
501         public static final int TRANSPORT_INIT = 510;
502 
503         public static final int NATIVE_METHOD = 511;
504 
505         public static final int INVALID_COUNT = 512;
506 
507         /**
508          * Gets name for corresponding constant value.
509          *
510          * @param errorCode
511          *            a constant from ones declared in this class
512          * @return String
513          */
getName(int errorCode)514         public static String getName(int errorCode) {
515             switch (errorCode) {
516             case NONE:
517                 return "NONE";
518             case INVALID_THREAD:
519                 return "INVALID_THREAD";
520             case INVALID_THREAD_GROUP:
521                 return "INVALID_THREAD_GROUP";
522             case INVALID_PRIORITY:
523                 return "INVALID_PRIORITY";
524             case THREAD_NOT_SUSPENDED:
525                 return "THREAD_NOT_SUSPENDED";
526             case THREAD_SUSPENDED:
527                 return "THREAD_SUSPENDED";
528             case THREAD_NOT_ALIVE:
529                 return "THREAD_NOT_ALIVE";
530             case INVALID_OBJECT:
531                 return "INVALID_OBJECT";
532             case INVALID_CLASS:
533                 return "INVALID_CLASS";
534             case CLASS_NOT_PREPARED:
535                 return "CLASS_NOT_PREPARED";
536             case INVALID_METHODID:
537                 return "INVALID_METHODID";
538             case INVALID_LOCATION:
539                 return "INVALID_LOCATION";
540             case INVALID_FIELDID:
541                 return "INVALID_FIELDID";
542             case INVALID_FRAMEID:
543                 return "INVALID_FRAMEID";
544             case NO_MORE_FRAMES:
545                 return "NO_MORE_FRAMES";
546             case OPAQUE_FRAME:
547                 return "OPAQUE_FRAME";
548             case NOT_CURRENT_FRAME:
549                 return "NOT_CURRENT_FRAME";
550             case TYPE_MISMATCH:
551                 return "TYPE_MISMATCH";
552             case INVALID_SLOT:
553                 return "INVALID_SLOT";
554             case DUPLICATE:
555                 return "DUPLICATE";
556             case NOT_FOUND:
557                 return "NOT_FOUND";
558             case INVALID_MONITOR:
559                 return "INVALID_MONITOR";
560             case NOT_MONITOR_OWNER:
561                 return "NOT_MONITOR_OWNER";
562             case INTERRUPT:
563                 return "INTERRUPT";
564             case INVALID_CLASS_FORMAT:
565                 return "INVALID_CLASS_FORMAT";
566             case CIRCULAR_CLASS_DEFENITION:
567                 return "CIRCULAR_CLASS_DEFENITION";
568             case FAILS_VERIFICATION:
569                 return "FAILS_VERIFICATION";
570             case ADD_METHOD_NOT_IMPLEMENTED:
571                 return "ADD_METHOD_NOT_IMPLEMENTED";
572             case SCHEMA_CHANGE_NOT_IMPLEMENTED:
573                 return "SCHEMA_CHANGE_NOT_IMPLEMENTED";
574             case INVALID_TYPESTATE:
575                 return "INVALID_TYPESTATE";
576             case HIERARCHY_CHANGE_NOT_IMPLEMENTED:
577                 return "HIERARCHY_CHANGE_NOT_IMPLEMENTED";
578             case DELETE_METHOD_NOT_IMPLEMENTED:
579                 return "DELETE_METHOD_NOT_IMPLEMENTED";
580             case UNSUPPORTED_VERSION:
581                 return "UNSUPPORTED_VERSION";
582             case NAMES_DONT_MATCH:
583                 return "NAMES_DONT_MATCH";
584             case CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED:
585                 return "CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED";
586             case METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED:
587                 return "METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED";
588             case NOT_IMPLEMENTED:
589                 return "NOT_IMPLEMENTED";
590             case NULL_POINTER:
591                 return "NULL_POINTER";
592             case ABSENT_INFORMATION:
593                 return "ABSENT_INFORMATION";
594             case INVALID_EVENT_TYPE:
595                 return "INVALID_EVENT_TYPE";
596             case ILLEGAL_ARGUMENT:
597                 return "ILLEGAL_ARGUMENT";
598             case OUT_OF_MEMORY:
599                 return "OUT_OF_MEMORY";
600             case ACCESS_DENIED:
601                 return "ACCESS_DENIED";
602             case VM_DEAD:
603                 return "VM_DEAD";
604             case INTERNAL:
605                 return "INTERNAL";
606             case UNATTACHED_THREAD:
607                 return "UNATTACHED_THREAD";
608             case INVALID_TAG:
609                 return "INVALID_TAG";
610             case ALREADY_INVOKING:
611                 return "ALREADY_INVOKING";
612             case INVALID_INDEX:
613                 return "INVALID_INDEX";
614             case INVALID_LENGTH:
615                 return "INVALID_LENGTH";
616             case INVALID_STRING:
617                 return "INVALID_STRING";
618             case INVALID_CLASS_LOADER:
619                 return "INVALID_CLASS_LOADER";
620             case INVALID_ARRAY:
621                 return "INVALID_ARRAY";
622             case TRANSPORT_LOAD:
623                 return "TRANSPORT_LOAD";
624             case TRANSPORT_INIT:
625                 return "TRANSPORT_INIT";
626             case NATIVE_METHOD:
627                 return "NATIVE_METHOD";
628             case INVALID_COUNT:
629                 return "INVALID_COUNT";
630             default:
631                 return "<unknown>";
632             }
633         }
634     }
635 
636     /**
637      * JDWP StepDepth constants
638      */
639     public static class StepDepth {
640 
641         public static final byte INTO = 0;
642 
643         public static final byte OVER = 1;
644 
645         public static final byte OUT = 2;
646 
647         /**
648          * Gets name for corresponding constant value.
649          *
650          * @param code
651          *            a constant from ones declared in this class
652          * @return String
653          */
getName(int code)654         public static String getName(int code) {
655             switch (code) {
656             case INTO:
657                 return "INTO";
658             case OVER:
659                 return "OVER";
660             case OUT:
661                 return "OUT";
662             default:
663                 return "<unknown>";
664             }
665         }
666     }
667 
668     /**
669      * JDWP StepSize constants
670      */
671     public static class StepSize {
672 
673         public static final byte MIN = 0;
674 
675         public static final byte LINE = 1;
676 
677         /**
678          * Gets name for corresponding constant value.
679          *
680          * @param code
681          *            a constant from ones declared in this class
682          * @return String
683          */
getName(int code)684         public static String getName(int code) {
685             switch (code) {
686             case MIN:
687                 return "MIN";
688             case LINE:
689                 return "LINE";
690             default:
691                 return "<unknown>";
692             }
693         }
694     }
695 
696     /**
697      * JDWP SuspendPolicy constants
698      */
699     public static class SuspendPolicy {
700 
701         public static final byte NONE = 0;
702 
703         public static final byte EVENT_THREAD = 1;
704 
705         public static final byte ALL = 2;
706 
707         /**
708          * Gets name for corresponding constant value.
709          *
710          * @param code
711          *            a constant from ones declared in this class
712          * @return String
713          */
getName(int code)714         public static String getName(int code) {
715             switch (code) {
716             case NONE:
717                 return "NONE";
718             case EVENT_THREAD:
719                 return "EVENT_THREAD";
720             case ALL:
721                 return "ALL";
722             default:
723                 return "<unknown>";
724             }
725         }
726     }
727 
728     /**
729      * JDWP InvokeOptions constants
730      */
731     public static class InvokeOptions {
732         public static final byte INVOKE_SINGLE_THREADED = 0x01;
733 
734         public static final byte INVOKE_NONVIRTUAL = 0x02;
735 
736         /**
737          * Gets name for corresponding constant value.
738          *
739          * @param code
740          *            a constant from ones declared in this class
741          * @return String
742          */
getName(int code)743         public static String getName(int code) {
744             String buf = "NONE";
745             if ((code & INVOKE_SINGLE_THREADED) != 0) {
746                 buf += "|INVOKE_SINGLE_THREADED";
747             }
748             if ((code & INVOKE_NONVIRTUAL) != 0) {
749                 buf += "|INVOKE_NONVIRTUAL";
750             }
751             if ((code & ~(INVOKE_SINGLE_THREADED | INVOKE_NONVIRTUAL)) != 0) {
752                 buf += "|<unknown>";
753             }
754             return buf;
755         }
756     }
757 
758     /**
759      * Field access flags
760      */
761     public static class FieldAccess {
762 
763         /**
764          * Is public; may be accessed from outside its package; Any field.
765          */
766         public static final int ACC_PUBLIC = 0x0001;
767 
768         /**
769          * Is private; usable only within the defining class; Class field.
770          */
771         public static final int ACC_PRIVATE = 0x0002;
772 
773         /**
774          * Is protected; may be accessed within subclasses; Class field.
775          */
776         public static final int ACC_PROTECTED = 0x0004;
777 
778         /**
779          * Is static; Any field.
780          */
781         public static final int ACC_STATIC = 0x0008;
782 
783         /**
784          * Is final; no further overriding or assignment after initialization;
785          * Any field.
786          */
787         public static final int ACC_FINAL = 0x0010;
788 
789         /**
790          * Is volatile; cannot be cached; Class field.
791          */
792         public static final int ACC_VOLATILE = 0x0040;
793 
794         /**
795          * Is transient; not written or read by a persistent object manager;
796          * Class field.
797          */
798         public static final int ACC_TRANSIENT = 0x0080;
799 
800         /**
801          * Gets name for corresponding constant value.
802          *
803          * @param code
804          *            a constant from ones declared in this class
805          * @return String
806          */
getName(int code)807         public static String getName(int code) {
808             switch (code) {
809             case ACC_PUBLIC:
810                 return "ACC_PUBLIC";
811             case ACC_PRIVATE:
812                 return "ACC_PRIVATE";
813             case ACC_PROTECTED:
814                 return "ACC_PROTECTED";
815             case ACC_STATIC:
816                 return "ACC_STATIC";
817             case ACC_FINAL:
818                 return "ACC_FINAL";
819             case ACC_VOLATILE:
820                 return "ACC_VOLATILE";
821             case ACC_TRANSIENT:
822                 return "ACC_TRANSIENT";
823             default:
824                 return "<unknown>";
825             }
826         }
827     }
828 }
829