< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/Handle.java

Print this page




  76      * {@link Opcodes#H_INVOKEINTERFACE}.
  77      */
  78     final int tag;
  79 
  80     /**
  81      * The internal name of the class that owns the field or method designated
  82      * by this handle.
  83      */
  84     final String owner;
  85 
  86     /**
  87      * The name of the field or method designated by this handle.
  88      */
  89     final String name;
  90 
  91     /**
  92      * The descriptor of the field or method designated by this handle.
  93      */
  94     final String desc;
  95 





  96     /**
  97      * Constructs a new field or method handle.
  98      *
  99      * @param tag
 100      *            the kind of field or method designated by this Handle. Must be
 101      *            {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
 102      *            {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
 103      *            {@link Opcodes#H_INVOKEVIRTUAL},
 104      *            {@link Opcodes#H_INVOKESTATIC},
 105      *            {@link Opcodes#H_INVOKESPECIAL},
 106      *            {@link Opcodes#H_NEWINVOKESPECIAL} or
 107      *            {@link Opcodes#H_INVOKEINTERFACE}.
 108      * @param owner
 109      *            the internal name of the class that owns the field or method
 110      *            designated by this handle.
 111      * @param name
 112      *            the name of the field or method designated by this handle.
 113      * @param desc
 114      *            the descriptor of the field or method designated by this
 115      *            handle.
 116      */

 117     public Handle(int tag, String owner, String name, String desc) {
 118         this.tag = tag;
 119         this.owner = owner;
 120         this.name = name;
 121         this.desc = desc;





































 122     }
 123 
 124     /**
 125      * Returns the kind of field or method designated by this handle.
 126      *
 127      * @return {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
 128      *         {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
 129      *         {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC},
 130      *         {@link Opcodes#H_INVOKESPECIAL},
 131      *         {@link Opcodes#H_NEWINVOKESPECIAL} or
 132      *         {@link Opcodes#H_INVOKEINTERFACE}.
 133      */
 134     public int getTag() {
 135         return tag;
 136     }
 137 
 138     /**
 139      * Returns the internal name of the class that owns the field or method
 140      * designated by this handle.
 141      *


 147     }
 148 
 149     /**
 150      * Returns the name of the field or method designated by this handle.
 151      *
 152      * @return the name of the field or method designated by this handle.
 153      */
 154     public String getName() {
 155         return name;
 156     }
 157 
 158     /**
 159      * Returns the descriptor of the field or method designated by this handle.
 160      *
 161      * @return the descriptor of the field or method designated by this handle.
 162      */
 163     public String getDesc() {
 164         return desc;
 165     }
 166 







 167     @Override
 168     public boolean equals(Object obj) {
 169         if (obj == this) {
 170             return true;
 171         }
 172         if (!(obj instanceof Handle)) {
 173             return false;
 174         }
 175         Handle h = (Handle) obj;
 176         return tag == h.tag && owner.equals(h.owner) && name.equals(h.name)
 177                 && desc.equals(h.desc);
 178     }
 179 
 180     @Override
 181     public int hashCode() {
 182         return tag + owner.hashCode() * name.hashCode() * desc.hashCode();
 183     }
 184 
 185     /**
 186      * Returns the textual representation of this handle. The textual


  76      * {@link Opcodes#H_INVOKEINTERFACE}.
  77      */
  78     final int tag;
  79 
  80     /**
  81      * The internal name of the class that owns the field or method designated
  82      * by this handle.
  83      */
  84     final String owner;
  85 
  86     /**
  87      * The name of the field or method designated by this handle.
  88      */
  89     final String name;
  90 
  91     /**
  92      * The descriptor of the field or method designated by this handle.
  93      */
  94     final String desc;
  95 
  96     /*
  97      * indicator of static method of interface
  98      */
  99     final boolean intfs;
 100 
 101     /**
 102      * Constructs a new field or method handle.
 103      *
 104      * @param tag
 105      *            the kind of field or method designated by this Handle. Must be
 106      *            {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
 107      *            {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
 108      *            {@link Opcodes#H_INVOKEVIRTUAL},
 109      *            {@link Opcodes#H_INVOKESTATIC},
 110      *            {@link Opcodes#H_INVOKESPECIAL},
 111      *            {@link Opcodes#H_NEWINVOKESPECIAL} or
 112      *            {@link Opcodes#H_INVOKEINTERFACE}.
 113      * @param owner
 114      *            the internal name of the class that owns the field or method
 115      *            designated by this handle.
 116      * @param name
 117      *            the name of the field or method designated by this handle.
 118      * @param desc
 119      *            the descriptor of the field or method designated by this
 120      *            handle.
 121      */
 122 
 123     public Handle(int tag, String owner, String name, String desc) {
 124         this.tag = tag;
 125         this.owner = owner;
 126         this.name = name;
 127         this.desc = desc;
 128         this.intfs = false;
 129     }
 130 
 131     /**
 132      * Returns the kind of field or method designated by this handle.
 133      *
 134      * @return {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
 135     /**
 136      * Constructs a new field or method handle.
 137      *
 138      * @param tag
 139      *            the kind of field or method designated by this Handle. Must be
 140      *            {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
 141      *            {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
 142      *            {@link Opcodes#H_INVOKEVIRTUAL},
 143      *            {@link Opcodes#H_INVOKESTATIC},
 144      *            {@link Opcodes#H_INVOKESPECIAL},
 145      *            {@link Opcodes#H_NEWINVOKESPECIAL} or
 146      *            {@link Opcodes#H_INVOKEINTERFACE}.
 147      * @param owner
 148      *            the internal name of the class that owns the field or method
 149      *            designated by this handle.
 150      * @param name
 151      *            the name of the field or method designated by this handle.
 152      * @param desc
 153      *            the descriptor of the field or method designated by this
 154      *            handle.
 155      * @param intfs
 156      *            the indicator of static method in interface
 157      */
 158 
 159     public Handle(int tag, String owner, String name, String desc, boolean intfs) {
 160         this.tag = tag;
 161         this.owner = owner;
 162         this.name = name;
 163         this.desc = desc;
 164         this.intfs = (tag == Opcodes.H_INVOKESTATIC) && intfs;
 165     }
 166 
 167     /**
 168      * Returns the kind of field or method designated by this handle.
 169      *
 170      * @return {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC},
 171      *         {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC},
 172      *         {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC},
 173      *         {@link Opcodes#H_INVOKESPECIAL},
 174      *         {@link Opcodes#H_NEWINVOKESPECIAL} or
 175      *         {@link Opcodes#H_INVOKEINTERFACE}.
 176      */
 177     public int getTag() {
 178         return tag;
 179     }
 180 
 181     /**
 182      * Returns the internal name of the class that owns the field or method
 183      * designated by this handle.
 184      *


 190     }
 191 
 192     /**
 193      * Returns the name of the field or method designated by this handle.
 194      *
 195      * @return the name of the field or method designated by this handle.
 196      */
 197     public String getName() {
 198         return name;
 199     }
 200 
 201     /**
 202      * Returns the descriptor of the field or method designated by this handle.
 203      *
 204      * @return the descriptor of the field or method designated by this handle.
 205      */
 206     public String getDesc() {
 207         return desc;
 208     }
 209 
 210     /**
 211      * Return if it is pointing to interface static method
 212      */
 213     public boolean getIntfs() {
 214         return intfs;
 215     }
 216 
 217     @Override
 218     public boolean equals(Object obj) {
 219         if (obj == this) {
 220             return true;
 221         }
 222         if (!(obj instanceof Handle)) {
 223             return false;
 224         }
 225         Handle h = (Handle) obj;
 226         return tag == h.tag && owner.equals(h.owner) && name.equals(h.name)
 227                 && desc.equals(h.desc);
 228     }
 229 
 230     @Override
 231     public int hashCode() {
 232         return tag + owner.hashCode() * name.hashCode() * desc.hashCode();
 233     }
 234 
 235     /**
 236      * Returns the textual representation of this handle. The textual
< prev index next >