private BlockBuilder<?> createProxyMethodDeclaration(final ClassStructureBuilder<?> proxyImpl, final MetaMethod method) { final MethodCommentBuilder<?> methodBuilder; if (method.isPublic()) { methodBuilder = proxyImpl.publicMethod(method.getReturnType().getErased(), method.getName(), getParametersForDeclaration(method)); } else if (method.isProtected()) { methodBuilder = proxyImpl.protectedMethod(method.getReturnType().getErased(), method.getName(), getParametersForDeclaration(method)); } else { final String methodType = (method.isProtected()) ? "private" : "package private"; throw new RuntimeException( "Cannot proxy " + methodType + " method from " + method.getDeclaringClassName()); } if (method.isPublic() || method.isProtected()) { return methodBuilder.annotatedWith(new Override() { @Override public Class<? extends Annotation> annotationType() { return Override.class; } }).throws_(method.getCheckedExceptions()).body(); } else { return methodBuilder.throws_(method.getCheckedExceptions()).body(); } }
private boolean shouldProxyMethod(final MetaMethod method, final Multimap<String, MetaMethod> proxiedMethodsByName) { return (method.getDeclaringClass() != null && method.getDeclaringClass().isInterface()) || !method.isStatic() && (method.isPublic() || method.isProtected()) && !method.isFinal() && methodIsNotFromObjectUnlessHashCode(method) && typesInSignatureAreVisible(method) && isNotAlreadyProxied(method, proxiedMethodsByName); }
if ((!method.isPublic() && !method.isProtected()) || method.isSynthetic() || method.isFinal() ||
if ((!method.isPublic() && !method.isProtected()) || method.isSynthetic() || method.isFinal() ||
nonInitializedCase = throw_(RuntimeException.class, "Cannot invoke public method on proxied interface before constructor completes."); nonInitializedReturns = false; } else if (!(method.isPublic() || method.isPrivate() || method.isProtected())) { nonInitializedCase = throw_(RuntimeException.class, "Cannot invoke proxied package private method before constructor completes."); nonInitializedReturns = false; else if (!(method.isPublic() || method.isPrivate() || method.isProtected()) && injectable.requiresProxy()) { logger.warn("The normal scoped type, " + injectable.getInjectedType().getFullyQualifiedName() + ", has a package-private method, " + method.getName()