< prev index next >
src/java.base/share/classes/java/lang/invoke/MemberName.java
Print this page
rev 55090 : secret-sfac
*** 683,694 ****
Objects.requireNonNull(ctor);
// fill in vmtarget, vmindex while we have ctor in hand:
MethodHandleNatives.init(this, ctor);
assert(isResolved() && this.clazz != null);
this.name = CONSTRUCTOR_NAME;
! if (this.type == null)
! this.type = new Object[] { void.class, ctor.getParameterTypes() };
}
/** Create a name for the given reflected field. The resulting name will be in a resolved state.
*/
public MemberName(Field fld) {
this(fld, false);
--- 683,700 ----
Objects.requireNonNull(ctor);
// fill in vmtarget, vmindex while we have ctor in hand:
MethodHandleNatives.init(this, ctor);
assert(isResolved() && this.clazz != null);
this.name = CONSTRUCTOR_NAME;
! if (this.type == null) {
! Class<?> rtype = void.class;
! if (isStatic()) { // a static init factory, not a true constructor
! rtype = getDeclaringClass();
! // FIXME: If it's a hidden class, this sig won't work.
! }
! this.type = new Object[] { rtype, ctor.getParameterTypes() };
! }
}
/** Create a name for the given reflected field. The resulting name will be in a resolved state.
*/
public MemberName(Field fld) {
this(fld, false);
*** 825,835 ****
* The declaring class may be supplied as null if this is to be a bare name and type.
* The last argument is optional, a boolean which requests REF_invokeSpecial.
* The resulting name will in an unresolved state.
*/
public MemberName(Class<?> defClass, String name, MethodType type, byte refKind) {
! int initFlags = (name != null && name.equals(CONSTRUCTOR_NAME) ? IS_CONSTRUCTOR : IS_METHOD);
init(defClass, name, type, flagsMods(initFlags, 0, refKind));
initResolved(false);
}
/** Create a method, constructor, or field name from the given components:
* Reference kind, declaring class, name, type.
--- 831,841 ----
* The declaring class may be supplied as null if this is to be a bare name and type.
* The last argument is optional, a boolean which requests REF_invokeSpecial.
* The resulting name will in an unresolved state.
*/
public MemberName(Class<?> defClass, String name, MethodType type, byte refKind) {
! int initFlags = (name != null && name.equals(CONSTRUCTOR_NAME) && type.returnType() == void.class ? IS_CONSTRUCTOR : IS_METHOD);
init(defClass, name, type, flagsMods(initFlags, 0, refKind));
initResolved(false);
}
/** Create a method, constructor, or field name from the given components:
* Reference kind, declaring class, name, type.
< prev index next >