View Javadoc
1   package mockit.asm.constantPool;
2   
3   import static mockit.asm.constantPool.TypeTableItem.SpecialType.UNINIT;
4   
5   import edu.umd.cs.findbugs.annotations.NonNull;
6   
7   import org.checkerframework.checker.index.qual.NonNegative;
8   
9   public final class UninitializedTypeTableItem extends TypeTableItem {
10      @NonNegative
11      int offset;
12  
13      UninitializedTypeTableItem() {
14          type = UNINIT;
15      }
16  
17      UninitializedTypeTableItem(@NonNegative int index, @NonNull UninitializedTypeTableItem item) {
18          super(index, item);
19          offset = item.offset;
20      }
21  
22      @NonNegative
23      public int getOffset() {
24          return offset;
25      }
26  
27      /**
28       * Sets the type and bytecode offset of this uninitialized type table item.
29       *
30       * @param type
31       *            the internal name to be added to the type table.
32       * @param offset
33       *            the bytecode offset of the NEW instruction that created the UNINITIALIZED type value.
34       */
35      void set(@NonNull String type, @NonNegative int offset) {
36          typeDesc = type;
37          this.offset = offset;
38          setHashCode(type.hashCode() + offset);
39      }
40  
41      @Override
42      boolean isEqualTo(@NonNull Item item) {
43          UninitializedTypeTableItem other = (UninitializedTypeTableItem) item;
44          return other.offset == offset && other.typeDesc.equals(typeDesc);
45      }
46  }