View Javadoc
1   package mockit.asm.constantPool;
2   
3   import edu.umd.cs.findbugs.annotations.NonNull;
4   
5   import mockit.asm.jvmConstants.ConstantPoolTypes;
6   
7   import org.checkerframework.checker.index.qual.NonNegative;
8   
9   public final class DynamicItem extends TypeOrMemberItem {
10      @NonNegative
11      int bsmIndex;
12  
13      public DynamicItem(@NonNegative int index) {
14          super(index);
15      }
16  
17      DynamicItem(@NonNegative int index, @NonNull DynamicItem item) {
18          super(index, item);
19          bsmIndex = item.bsmIndex;
20      }
21  
22      /**
23       * Sets the type, name, desc, and index of the constant or invoke dynamic item.
24       *
25       * @param type
26       *            one of {@link ConstantPoolTypes#INVOKE_DYNAMIC} or {@link ConstantPoolTypes#DYNAMIC}, for invoke or
27       *            constant dynamic, respectively
28       * @param name
29       *            the item name
30       * @param desc
31       *            the item type descriptor
32       * @param index
33       *            zero based index into the class attribute "BootstrapMethods".
34       */
35      public void set(int type, @NonNull String name, @NonNull String desc, @NonNegative int index) {
36          super.type = type;
37          bsmIndex = index;
38          setValuesAndHashcode(name, desc, index);
39      }
40  
41      @Override
42      boolean isEqualTo(@NonNull Item item) {
43          DynamicItem other = (DynamicItem) item;
44          return other.bsmIndex == bsmIndex && isEqualTo(other);
45      }
46  }