Lines Matching refs:refc

351      * documented as a parameter named {@code refc} in the lookup methods.
547 * {@code refc} as the containing class in which the member
551 * the {@code refc} and {@code defc} values are the class itself.)
559 * the same as or an ancestor of the class loader of {@code refc},
562 * where {@code refcPkg} is the package of {@code refc}.
576 * and if {@code defc} and {@code refc} are different,
1089 * @param refc the class from which the method is accessed
1103 MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
1104 MemberName method = resolveOrFail(REF_invokeStatic, refc, name, type);
1105 return getDirectMethod(REF_invokeStatic, refc, method, findBoundCallerClass(method));
1111 * with the receiver type (usually {@code refc}) prepended.
1120 * The first argument will be of type {@code refc} if the lookup
1173 * @param refc the class or interface from which the method is accessed
1187 public MethodHandle findVirtual(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
1188 if (refc == MethodHandle.class) {
1191 } else if (refc == VarHandle.class) {
1195 byte refKind = (refc.isInterface() ? REF_invokeInterface : REF_invokeVirtual);
1196 MemberName method = resolveOrFail(refKind, refc, name, type);
1197 return getDirectMethod(refKind, refc, method, findBoundCallerClass(method));
1250 * @param refc the class or interface from which the method is accessed
1261 public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuchMethodException, IllegalAccessException {
1262 if (refc.isArray()) {
1263 throw new NoSuchMethodException("no constructor for array class: " + refc.getName());
1266 MemberName ctor = resolveOrFail(REF_newInvokeSpecial, refc, name, type);
1267 return getDirectConstructor(refc, ctor);
1379 * @param refc the class or interface from which the method is accessed
1393 public MethodHandle findSpecial(Class<?> refc, String name, MethodType type,
1395 checkSpecialCaller(specialCaller, refc);
1397 MemberName method = specialLookup.resolveOrFail(REF_invokeSpecial, refc, name, type);
1398 return specialLookup.getDirectMethod(REF_invokeSpecial, refc, method, findBoundCallerClass(method));
1408 * @param refc the class or interface from which the method is accessed
1419 public MethodHandle findGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
1420 MemberName field = resolveOrFail(REF_getField, refc, name, type);
1421 return getDirectField(REF_getField, refc, field);
1431 * @param refc the class or interface from which the method is accessed
1442 public MethodHandle findSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
1443 MemberName field = resolveOrFail(REF_putField, refc, name, type);
1444 return getDirectField(REF_putField, refc, field);
1530 * @param refc the class or interface from which the method is accessed
1540 public MethodHandle findStaticGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
1541 MemberName field = resolveOrFail(REF_getStatic, refc, name, type);
1542 return getDirectField(REF_getStatic, refc, field);
1554 * @param refc the class or interface from which the method is accessed
1564 public MethodHandle findStaticSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
1565 MemberName field = resolveOrFail(REF_putStatic, refc, name, type);
1566 return getDirectField(REF_putStatic, refc, field);
1695 Class<? extends Object> refc = receiver.getClass(); // may get NPE
1696 MemberName method = resolveOrFail(REF_invokeSpecial, refc, name, type);
1697 MethodHandle mh = getDirectMethodNoRestrictInvokeSpecial(refc, method, findBoundCallerClass(method));
2019 MemberName resolveOrFail(byte refKind, Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
2020 checkSymbolicClass(refc); // do this before attempting to resolve
2023 return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
2027 MemberName resolveOrFail(byte refKind, Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
2028 checkSymbolicClass(refc); // do this before attempting to resolve
2032 return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
2044 void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
2045 Objects.requireNonNull(refc);
2047 if (caller != null && !VerifyAccess.isClassAccessible(refc, caller, allowedModes))
2048 throw new MemberName(refc).makeAccessException("symbolic reference class is not accessible", this);
2087 * Determines a trustable caller class to compare with refc, the symbolic reference class.
2090 void checkSecurityManager(Class<?> refc, MemberName m) {
2098 !VerifyAccess.classLoaderIsAncestor(lookupClass, refc)) {
2099 ReflectUtil.checkPackageAccess(refc);
2118 if (!fullPowerLookup && defc != refc) {
2123 void checkMethod(byte refKind, Class<?> refc, MemberName m) throws IllegalAccessException {
2133 { checkAccess(refKind, refc, m); return; }
2137 void checkField(byte refKind, Class<?> refc, MemberName m) throws IllegalAccessException {
2143 { checkAccess(refKind, refc, m); return; }
2148 void checkAccess(byte refKind, Class<?> refc, MemberName m) throws IllegalAccessException {
2159 refc.isArray()) {
2184 if (VerifyAccess.isMemberAccessible(refc, m.getDeclaringClass(),
2193 throw m.makeAccessException(accessFailedMessage(refc, m), this);
2196 String accessFailedMessage(Class<?> refc, MemberName m) {
2201 (defc == refc ||
2202 Modifier.isPublic(refc.getModifiers())));
2205 (defc == refc ||
2206 VerifyAccess.isClassAccessible(refc, lookupClass(), FULL_POWER_MODES)));
2221 private void checkSpecialCaller(Class<?> specialCaller, Class<?> refc) throws IllegalAccessException {
2227 && !(refc != null && refc.isInterface() && refc.isAssignableFrom(specialCaller))
2261 private MethodHandle getDirectMethod(byte refKind, Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
2264 return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass);
2267 private MethodHandle getDirectMethodNoRestrictInvokeSpecial(Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
2270 return getDirectMethodCommon(REF_invokeSpecial, refc, method, checkSecurity, doRestrict, callerClass);
2273 private MethodHandle getDirectMethodNoSecurityManager(byte refKind, Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
2276 return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass);
2279 private MethodHandle getDirectMethodCommon(byte refKind, Class<?> refc, MemberName method,
2282 checkMethod(refKind, refc, method);
2285 checkSecurityManager(refc, method);
2289 refc != lookupClass() &&
2290 !refc.isInterface() &&
2291 refc != lookupClass().getSuperclass() &&
2292 refc.isAssignableFrom(lookupClass())) {
2311 refc != refcAsSuper); // search up to refc
2314 refc = refcAsSuper;
2316 checkMethod(refKind, refc, method);
2319 DirectMethodHandle dmh = DirectMethodHandle.make(refKind, refc, method);
2321 // Optionally narrow the receiver argument to refc using restrictReceiver.
2343 private MethodHandle getDirectField(byte refKind, Class<?> refc, MemberName field) throws IllegalAccessException {
2345 return getDirectFieldCommon(refKind, refc, field, checkSecurity);
2348 private MethodHandle getDirectFieldNoSecurityManager(byte refKind, Class<?> refc, MemberName field) throws IllegalAccessException {
2350 return getDirectFieldCommon(refKind, refc, field, checkSecurity);
2353 private MethodHandle getDirectFieldCommon(byte refKind, Class<?> refc, MemberName field,
2355 checkField(refKind, refc, field);
2358 checkSecurityManager(refc, field);
2359 DirectMethodHandle dmh = DirectMethodHandle.make(refc, field);
2367 Class<?> refc, MemberName getField, MemberName putField)
2370 return getFieldVarHandleCommon(getRefKind, putRefKind, refc, getField, putField, checkSecurity);
2373 Class<?> refc, MemberName getField, MemberName putField)
2376 return getFieldVarHandleCommon(getRefKind, putRefKind, refc, getField, putField, checkSecurity);
2379 Class<?> refc, MemberName getField, MemberName putField,
2386 checkField(getRefKind, refc, getField);
2388 checkSecurityManager(refc, getField);
2395 checkField(putRefKind, refc, putField);
2397 checkSecurityManager(refc, putField);
2408 refc = lookupClass();
2410 return VarHandles.makeFieldHandle(getField, refc, getField.getFieldType(), this.allowedModes == TRUSTED);
2413 private MethodHandle getDirectConstructor(Class<?> refc, MemberName ctor) throws IllegalAccessException {
2415 return getDirectConstructorCommon(refc, ctor, checkSecurity);
2418 private MethodHandle getDirectConstructorNoSecurityManager(Class<?> refc, MemberName ctor) throws IllegalAccessException {
2420 return getDirectConstructorCommon(refc, ctor, checkSecurity);
2423 private MethodHandle getDirectConstructorCommon(Class<?> refc, MemberName ctor,
2426 checkAccess(REF_newInvokeSpecial, refc, ctor);
2429 checkSecurityManager(refc, ctor);