From dbeeb59fe7f530284c0c97236b2602dcdb8521c3 Mon Sep 17 00:00:00 2001 From: Thiago Hora Date: Fri, 10 Jan 2025 11:44:09 +0100 Subject: [PATCH] Use compiler args --- apps/opik-backend/pom.xml | 8 +++----- .../comet/opik/infrastructure/cache/CacheInterceptor.java | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/opik-backend/pom.xml b/apps/opik-backend/pom.xml index 3b8afc6fb7..4b8bc16a09 100644 --- a/apps/opik-backend/pom.xml +++ b/apps/opik-backend/pom.xml @@ -203,11 +203,6 @@ mvel2 2.5.2.Final - - com.thoughtworks.paranamer - paranamer - 2.8 - org.mapstruct mapstruct @@ -452,6 +447,9 @@ 21 21 + -parameters + true + -parameters org.projectlombok diff --git a/apps/opik-backend/src/main/java/com/comet/opik/infrastructure/cache/CacheInterceptor.java b/apps/opik-backend/src/main/java/com/comet/opik/infrastructure/cache/CacheInterceptor.java index ba214b6fac..fc23715bd6 100644 --- a/apps/opik-backend/src/main/java/com/comet/opik/infrastructure/cache/CacheInterceptor.java +++ b/apps/opik-backend/src/main/java/com/comet/opik/infrastructure/cache/CacheInterceptor.java @@ -3,7 +3,6 @@ import com.comet.opik.infrastructure.CacheConfiguration; import com.comet.opik.utils.TypeReferenceUtils; import com.fasterxml.jackson.core.type.TypeReference; -import com.thoughtworks.paranamer.BytecodeReadingParanamer; import jakarta.inject.Provider; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -13,6 +12,7 @@ import reactor.core.publisher.Mono; import java.lang.reflect.Method; +import java.lang.reflect.Parameter; import java.time.Duration; import java.util.Collection; import java.util.HashMap; @@ -25,7 +25,6 @@ @RequiredArgsConstructor public class CacheInterceptor implements MethodInterceptor { - private static final BytecodeReadingParanamer PARANAMER = new BytecodeReadingParanamer(); private final Provider cacheManager; private final CacheConfiguration cacheConfiguration; @@ -189,13 +188,13 @@ private String getKeyName(String name, String key, MethodInvocation invocation) Map params = new HashMap<>(); // Use Paranamer to resolve parameter names - String[] parameters = PARANAMER.lookupParameterNames(invocation.getMethod()); + Parameter[] parameters = invocation.getMethod().getParameters(); Object[] args = invocation.getArguments(); // Populate the context map with parameter names and values for (int i = 0; i < invocation.getMethod().getParameterCount(); i++) { Object value = args[i]; - params.put("$" + parameters[i], value != null ? value : ""); // Null safety + params.put("$" + parameters[i].getName(), value != null ? value : ""); // Null safety } try {