001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.classloader;
014
015public final class ClassLoaderConstants {
016  // Attribute modifiers for class-, method-, and field- descriptions.
017  //
018  //                                      applicability
019  //           name        value       class  field  method
020  //    ---------------   --------     -----  -----  ------
021  public static final short ACC_PUBLIC       = 0x0001;  //   X      X      X
022  public static final short ACC_PRIVATE      = 0x0002;  //   X      X      X (applicable to inner classes)
023  public static final short ACC_PROTECTED    = 0x0004;  //   X      X      X (applicable to inner classes)
024  public static final short ACC_STATIC       = 0x0008;  //   X      X      X (applicable to inner classes)
025  public static final short ACC_FINAL        = 0x0010;  //   X      X      X
026  public static final short ACC_SYNCHRONIZED = 0x0020;  //   -      -      X  <- same value as ACC_SUPER
027  public static final short ACC_SUPER        = 0x0020;  //   X      -      -  <- same value as ACC_SYNCHRONIZED
028  public static final short ACC_VOLATILE     = 0x0040;  //   -      X      -
029  public static final short BRIDGE           = 0x0040;  //   -      -      X  <- same value as ACC_VOLATILE
030  public static final short ACC_TRANSIENT    = 0x0080;  //   -      X      -
031  public static final short VARARGS          = 0x0080;  //   -      -      X  <- same value as ACC_TRANSIENT
032  public static final short ACC_NATIVE       = 0x0100;  //   -      -      X
033  public static final short ACC_INTERFACE    = 0x0200;  //   X      -      -
034  public static final short ACC_ABSTRACT     = 0x0400;  //   X      -      X
035  public static final short ACC_STRICT       = 0x0800;  //   -      -      X
036  public static final short ACC_SYNTHETIC    = 0x1000;  //   X      X      X
037  public static final short ACC_ANNOTATION   = 0x2000;  //   X      -      -
038  public static final short ACC_ENUM         = 0x4000;  //   X      X      -
039
040  public static final short APPLICABLE_TO_FIELDS =
041      (ACC_PUBLIC |
042       ACC_PRIVATE |
043       ACC_PROTECTED |
044       ACC_STATIC |
045       ACC_FINAL |
046       ACC_VOLATILE |
047       ACC_TRANSIENT |
048       ACC_SYNTHETIC |
049       ACC_ENUM);
050
051  public static final short APPLICABLE_TO_METHODS =
052      (ACC_PUBLIC |
053       ACC_PRIVATE |
054       ACC_PROTECTED |
055       ACC_STATIC |
056       ACC_FINAL |
057       ACC_SYNCHRONIZED |
058       BRIDGE |
059       VARARGS |
060       ACC_NATIVE |
061       ACC_ABSTRACT |
062       ACC_STRICT |
063       ACC_SYNTHETIC);
064
065  public static final short APPLICABLE_TO_CLASSES =
066      (ACC_PUBLIC |
067       ACC_PRIVATE |
068       ACC_STATIC |
069       ACC_FINAL |
070       ACC_SUPER |
071       ACC_INTERFACE |
072       ACC_ABSTRACT |
073       ACC_SYNTHETIC |
074       ACC_ANNOTATION |
075       ACC_ENUM);
076
077  /* Possible states of a class description. */
078  /** nothing present yet */
079  public static final byte CLASS_VACANT = 0;
080  /** .class file contents read successfully */
081  public static final byte CLASS_LOADED = 1;
082  /** fields &amp; methods laid out, tib &amp; statics allocated */
083  public static final byte CLASS_RESOLVED = 2;
084  /** tib and jtoc populated */
085  public static final byte CLASS_INSTANTIATED = 3;
086  /** &lt;clinit&gt; running (allocations possible) */
087  public static final byte CLASS_INITIALIZING = 4;
088  /** exception occurred while running &lt;clinit&gt; class cannot be initialized successfully */
089  public static final byte CLASS_INITIALIZER_FAILED = 5;
090  /** statics initialized */
091  public static final byte CLASS_INITIALIZED = 6;
092
093  // Constant pool entry tags.
094  //
095  public static final byte TAG_UTF = 1;
096  public static final byte TAG_UNUSED = 2;
097  public static final byte TAG_INT = 3;
098  public static final byte TAG_FLOAT = 4;
099  public static final byte TAG_LONG = 5;
100  public static final byte TAG_DOUBLE = 6;
101  public static final byte TAG_TYPEREF = 7;
102  public static final byte TAG_STRING = 8;
103  public static final byte TAG_FIELDREF = 9;
104  public static final byte TAG_METHODREF = 10;
105  public static final byte TAG_INTERFACE_METHODREF = 11;
106  public static final byte TAG_MEMBERNAME_AND_DESCRIPTOR = 12;
107
108  // Type codes for class, array, and primitive types.
109  //
110  public static final byte ClassTypeCode = (byte) 'L';
111  public static final byte ArrayTypeCode = (byte) '[';
112  public static final byte VoidTypeCode = (byte) 'V';
113  public static final byte BooleanTypeCode = (byte) 'Z';
114  public static final byte ByteTypeCode = (byte) 'B';
115  public static final byte ShortTypeCode = (byte) 'S';
116  public static final byte IntTypeCode = (byte) 'I';
117  public static final byte LongTypeCode = (byte) 'J';
118  public static final byte FloatTypeCode = (byte) 'F';
119  public static final byte DoubleTypeCode = (byte) 'D';
120  public static final byte CharTypeCode = (byte) 'C';
121
122  // Constants for our internal encoding of constant pools.
123  /** Constant pool entry for a UTF-8 encoded atom */
124  public static final byte CP_UTF = 0;
125  /** Constant pool entry for int literal */
126  public static final byte CP_INT = 1;
127  /** Constant pool entry for long literal */
128  public static final byte CP_LONG = 2;
129  /** Constant pool entry for float literal */
130  public static final byte CP_FLOAT = 3;
131  /** Constant pool entry for double literal */
132  public static final byte CP_DOUBLE = 4;
133  /** Constant pool entry for string literal (for annotations, may be other objects) */
134  public static final byte CP_STRING = 5;
135  /** Constant pool entry for member (field or method) reference */
136  public static final byte CP_MEMBER = 6;
137  /** Constant pool entry for type reference or class literal */
138  public static final byte CP_CLASS = 7;
139
140  private ClassLoaderConstants() {
141    // prevent instantiation
142  }
143
144}