Skip to content

Commit

Permalink
Fix debug logs in ConfigProxyFactory
Browse files Browse the repository at this point in the history
Fix debug logs in createInterfaceProperty / createScalarProperty to actually log
the relevant types, instead of always logging "Class" and "Proxy".
  • Loading branch information
kilink committed Aug 31, 2023
1 parent cbe48a7 commit 3765b3c
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import javax.inject.Inject;
import java.lang.invoke.CallSite;
import java.lang.invoke.LambdaConversionException;
import java.lang.invoke.LambdaMetafactory;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -282,7 +281,7 @@ else if ("toString".equals(method.getName())) {
propertyNames.put(m, propName);

if (!knownCollections.containsKey(returnType) && returnType.isInterface()) {
invoker = createInterfaceProperty(propName, newProxy(returnType, propName, immutable));
invoker = createInterfaceProperty(propName, newProxy(returnType, propName, immutable), type);
} else if (m.getParameterCount() > 0) {
if (nameAnnot == null) {
throw new IllegalArgumentException("Missing @PropertyName annotation on " + m.getDeclaringClass().getName() + "#" + m.getName());
Expand Down Expand Up @@ -377,13 +376,13 @@ private static <T> Function<Object[], T> createDefaultMethodSupplier(Method meth
};
}

protected <T> MethodInvoker<T> createInterfaceProperty(String propName, final T proxy) {
LOG.debug("Creating interface property `{}` for type `{}`", propName, proxy.getClass());
protected <T> MethodInvoker<T> createInterfaceProperty(String propName, final T proxy, Class<?> targetClass) {
LOG.debug("Creating interface property `{}` for type `{}`", propName, targetClass);
return (args) -> proxy;
}

protected <T> MethodInvoker<T> createScalarProperty(final Type type, final String propName, Function<Object[], T> next) {
LOG.debug("Creating scalar property `{}` for type `{}`", propName, type.getClass());
LOG.debug("Creating scalar property `{}` for type `{}`", propName, type);
final Property<T> prop = propertyRepository.get(propName, type);
return args -> {
T value = prop.get();
Expand Down

0 comments on commit 3765b3c

Please sign in to comment.