@Nullable public static TypeProto getSuperclassAsTypeProto(@Nonnull TypeProto type) { try { String next = type.getSuperclass(); if (next != null) { return type.getClassPath().getClass(next); } else { return null; } } catch (UnresolvedClassException ex) { return type.getClassPath().getUnknownClass(); } }
@Nullable public static TypeProto getSuperclassAsTypeProto(@Nonnull TypeProto type) { try { String next = type.getSuperclass(); if (next != null) { return type.getClassPath().getClass(next); } else { return null; } } catch (UnresolvedClassException ex) { return type.getClassPath().getUnknownClass(); } }
@Nullable public static TypeProto getSuperclassAsTypeProto(@Nonnull TypeProto type) { try { String next = type.getSuperclass(); if (next != null) { return type.getClassPath().getClass(next); } else { return null; } } catch (UnresolvedClassException ex) { return type.getClassPath().getUnknownClass(); } } }
public static boolean canAccess(@Nonnull TypeProto type, @Nonnull Method virtualMethod, boolean checkPackagePrivate, boolean checkProtected, boolean checkClass) { if (checkPackagePrivate && MethodUtil.isPackagePrivate(virtualMethod)) { String otherPackage = TypeUtils.getPackage(virtualMethod.getDefiningClass()); String thisPackage = TypeUtils.getPackage(type.getType()); if (!otherPackage.equals(thisPackage)) { return false; } } if (checkProtected && (virtualMethod.getAccessFlags() & AccessFlags.PROTECTED.getValue()) != 0) { if (!TypeProtoUtils.extendsFrom(type, virtualMethod.getDefiningClass())) { return false; } } if (checkClass) { ClassPath classPath = type.getClassPath(); ClassDef methodClassDef = classPath.getClassDef(virtualMethod.getDefiningClass()); if (!TypeUtils.canAccessClass(type.getType(), methodClassDef)) { return false; } } return true; } }
public static boolean canAccess(@Nonnull TypeProto type, @Nonnull Method virtualMethod, boolean checkPackagePrivate, boolean checkProtected, boolean checkClass) { if (checkPackagePrivate && MethodUtil.isPackagePrivate(virtualMethod)) { String otherPackage = TypeUtils.getPackage(virtualMethod.getDefiningClass()); String thisPackage = TypeUtils.getPackage(type.getType()); if (!otherPackage.equals(thisPackage)) { return false; } } if (checkProtected && (virtualMethod.getAccessFlags() & AccessFlags.PROTECTED.getValue()) != 0) { if (!TypeProtoUtils.extendsFrom(type, virtualMethod.getDefiningClass())) { return false; } } if (checkClass) { ClassPath classPath = type.getClassPath(); ClassDef methodClassDef = classPath.getClassDef(virtualMethod.getDefiningClass()); if (!TypeUtils.canAccessClass(type.getType(), methodClassDef)) { return false; } } return true; } }