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.NAME_TYPE;
9   
10  import edu.umd.cs.findbugs.annotations.NonNull;
11  
12  import org.checkerframework.checker.index.qual.NonNegative;
13  
14  public final class NameAndTypeItem extends TypeOrMemberItem {
15      public NameAndTypeItem(@NonNegative int index) {
16          super(index);
17          type = NAME_TYPE;
18      }
19  
20      NameAndTypeItem(@NonNegative int index, @NonNull NameAndTypeItem item) {
21          super(index, item);
22      }
23  
24      /**
25       * Sets the name and type descriptor of this item.
26       */
27      public void set(@NonNull String name, @NonNull String desc) {
28          setValuesAndHashcode(name, desc, 1);
29      }
30  }