jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
changeset 29094 a4fd2b5e49f8
parent 26467 d69abed3a07d
child 32276 2d5fcc89e099
equal deleted inserted replaced
29057:d6224d602145 29094:a4fd2b5e49f8
   519     public MemberName(Method m) {
   519     public MemberName(Method m) {
   520         this(m, false);
   520         this(m, false);
   521     }
   521     }
   522     @SuppressWarnings("LeakingThisInConstructor")
   522     @SuppressWarnings("LeakingThisInConstructor")
   523     public MemberName(Method m, boolean wantSpecial) {
   523     public MemberName(Method m, boolean wantSpecial) {
   524         m.getClass();  // NPE check
   524         Objects.requireNonNull(m);
   525         // fill in vmtarget, vmindex while we have m in hand:
   525         // fill in vmtarget, vmindex while we have m in hand:
   526         MethodHandleNatives.init(this, m);
   526         MethodHandleNatives.init(this, m);
   527         if (clazz == null) {  // MHN.init failed
   527         if (clazz == null) {  // MHN.init failed
   528             if (m.getDeclaringClass() == MethodHandle.class &&
   528             if (m.getDeclaringClass() == MethodHandle.class &&
   529                 isMethodHandleInvokeName(m.getName())) {
   529                 isMethodHandleInvokeName(m.getName())) {
   598         return result;
   598         return result;
   599     }
   599     }
   600     /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
   600     /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
   601     @SuppressWarnings("LeakingThisInConstructor")
   601     @SuppressWarnings("LeakingThisInConstructor")
   602     public MemberName(Constructor<?> ctor) {
   602     public MemberName(Constructor<?> ctor) {
   603         ctor.getClass();  // NPE check
   603         Objects.requireNonNull(ctor);
   604         // fill in vmtarget, vmindex while we have ctor in hand:
   604         // fill in vmtarget, vmindex while we have ctor in hand:
   605         MethodHandleNatives.init(this, ctor);
   605         MethodHandleNatives.init(this, ctor);
   606         assert(isResolved() && this.clazz != null);
   606         assert(isResolved() && this.clazz != null);
   607         this.name = CONSTRUCTOR_NAME;
   607         this.name = CONSTRUCTOR_NAME;
   608         if (this.type == null)
   608         if (this.type == null)
   613     public MemberName(Field fld) {
   613     public MemberName(Field fld) {
   614         this(fld, false);
   614         this(fld, false);
   615     }
   615     }
   616     @SuppressWarnings("LeakingThisInConstructor")
   616     @SuppressWarnings("LeakingThisInConstructor")
   617     public MemberName(Field fld, boolean makeSetter) {
   617     public MemberName(Field fld, boolean makeSetter) {
   618         fld.getClass();  // NPE check
   618         Objects.requireNonNull(fld);
   619         // fill in vmtarget, vmindex while we have fld in hand:
   619         // fill in vmtarget, vmindex while we have fld in hand:
   620         MethodHandleNatives.init(this, fld);
   620         MethodHandleNatives.init(this, fld);
   621         assert(isResolved() && this.clazz != null);
   621         assert(isResolved() && this.clazz != null);
   622         this.name = fld.getName();
   622         this.name = fld.getName();
   623         this.type = fld.getType();
   623         this.type = fld.getType();