< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandles.java
Print this page
@@ -1176,22 +1176,22 @@
public MethodHandle unreflect(Method m) throws IllegalAccessException {
if (m.getDeclaringClass() == MethodHandle.class) {
MethodHandle mh = unreflectForMH(m);
if (mh != null) return mh;
}
- MemberName method = new MemberName(m);
+ MemberName method = MemberName.make(m);
byte refKind = method.getReferenceKind();
if (refKind == REF_invokeSpecial)
refKind = REF_invokeVirtual;
assert(method.isMethod());
Lookup lookup = m.isAccessible() ? IMPL_LOOKUP : this;
return lookup.getDirectMethodNoSecurityManager(refKind, method.getDeclaringClass(), method, findBoundCallerClass(method));
}
private MethodHandle unreflectForMH(Method m) {
// these names require special lookups because they throw UnsupportedOperationException
if (MemberName.isMethodHandleInvokeName(m.getName()))
- return MethodHandleImpl.fakeMethodHandleInvoke(new MemberName(m));
+ return MethodHandleImpl.fakeMethodHandleInvoke(MemberName.make(m));
return null;
}
/**
* Produces a method handle for a reflected method.
@@ -1223,11 +1223,11 @@
* @throws NullPointerException if any argument is null
*/
public MethodHandle unreflectSpecial(Method m, Class<?> specialCaller) throws IllegalAccessException {
checkSpecialCaller(specialCaller);
Lookup specialLookup = this.in(specialCaller);
- MemberName method = new MemberName(m, true);
+ MemberName method = MemberName.make(m, true);
assert(method.isMethod());
// ignore m.isAccessible: this is a new kind of access
return specialLookup.getDirectMethodNoSecurityManager(REF_invokeSpecial, method.getDeclaringClass(), method, findBoundCallerClass(method));
}
@@ -1254,11 +1254,11 @@
* or if the method's variable arity modifier bit
* is set and {@code asVarargsCollector} fails
* @throws NullPointerException if the argument is null
*/
public MethodHandle unreflectConstructor(Constructor<?> c) throws IllegalAccessException {
- MemberName ctor = new MemberName(c);
+ MemberName ctor = MemberName.make(c);
assert(ctor.isConstructor());
Lookup lookup = c.isAccessible() ? IMPL_LOOKUP : this;
return lookup.getDirectConstructorNoSecurityManager(ctor.getDeclaringClass(), ctor);
}
@@ -1282,11 +1282,11 @@
*/
public MethodHandle unreflectGetter(Field f) throws IllegalAccessException {
return unreflectField(f, false);
}
private MethodHandle unreflectField(Field f, boolean isSetter) throws IllegalAccessException {
- MemberName field = new MemberName(f, isSetter);
+ MemberName field = MemberName.make(f, isSetter);
assert(isSetter
? MethodHandleNatives.refKindIsSetter(field.getReferenceKind())
: MethodHandleNatives.refKindIsGetter(field.getReferenceKind()));
Lookup lookup = f.isAccessible() ? IMPL_LOOKUP : this;
return lookup.getDirectFieldNoSecurityManager(field.getReferenceKind(), f.getDeclaringClass(), field);
< prev index next >