View Javadoc
1   /*
2    * MIT License
3    * Copyright (c) 2006-2025 JMockit developers
4    * See LICENSE file for full license text.
5    */
6   package mockit.asm.constantPool;
7   
8   import static mockit.asm.jvmConstants.ConstantPoolTypes.BSM;
9   
10  import edu.umd.cs.findbugs.annotations.NonNull;
11  
12  import org.checkerframework.checker.index.qual.NonNegative;
13  
14  public final class BootstrapMethodItem extends Item {
15      @NonNegative
16      final int position;
17  
18      /**
19       * Initializes the new item with the given index, position and hash code.
20       *
21       * @param position
22       *            position in byte in the class attribute "BootstrapMethods"
23       * @param hashCode
24       *            hashcode of the item, which is processed from the hashcode of the bootstrap method and the hashcode of
25       *            all bootstrap arguments
26       */
27      public BootstrapMethodItem(@NonNegative int index, @NonNegative int position, int hashCode) {
28          super(index);
29          this.position = position;
30          setHashCode(hashCode);
31          type = BSM;
32      }
33  
34      @Override
35      boolean isEqualTo(@NonNull Item item) {
36          return ((BootstrapMethodItem) item).position == position;
37      }
38  }