View Javadoc
1   package mockit.asm.types;
2   
3   import edu.umd.cs.findbugs.annotations.NonNull;
4   
5   import org.checkerframework.checker.index.qual.NonNegative;
6   
7   public final class ObjectType extends ReferenceType {
8       @NonNull
9       public static ObjectType create(@NonNull String internalName) {
10          return new ObjectType(internalName.toCharArray());
11      }
12  
13      /**
14       * Initializes an object reference type.
15       *
16       * @param typeDesc
17       *            a buffer containing the descriptor of the type
18       * @param off
19       *            the offset of the descriptor in the buffer
20       */
21      @NonNull
22      static ObjectType create(@NonNull char[] typeDesc, @NonNegative int off) {
23          int len = findTypeNameLength(typeDesc, off, 0);
24          return new ObjectType(typeDesc, off + 1, len - 1);
25      }
26  
27      private ObjectType(@NonNull char[] typeDesc, @NonNegative int off, @NonNegative int len) {
28          super(typeDesc, off, len);
29      }
30  
31      ObjectType(@NonNull char[] internalName) {
32          super(internalName);
33      }
34  
35      @Override
36      void getDescriptor(@NonNull StringBuilder typeDesc) {
37          typeDesc.append('L');
38          super.getDescriptor(typeDesc);
39          typeDesc.append(';');
40      }
41  
42      @NonNull
43      @Override
44      public String getClassName() {
45          return getInternalName().replace('/', '.');
46      }
47  }