From ef6de52cfee0e558c5d4d70bad53e769192a2a48 Mon Sep 17 00:00:00 2001 From: hduelme Date: Mon, 11 May 2026 12:02:52 +0200 Subject: [PATCH] remove reflection from isDefaultMethod --- .../ap/internal/util/Executables.java | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/processor/src/main/java/org/mapstruct/ap/internal/util/Executables.java b/processor/src/main/java/org/mapstruct/ap/internal/util/Executables.java index 1592a39fda..c845450e13 100644 --- a/processor/src/main/java/org/mapstruct/ap/internal/util/Executables.java +++ b/processor/src/main/java/org/mapstruct/ap/internal/util/Executables.java @@ -5,8 +5,6 @@ */ package org.mapstruct.ap.internal.util; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Modifier; @@ -21,19 +19,6 @@ */ public class Executables { - private static final Method DEFAULT_METHOD; - - static { - Method method; - try { - method = ExecutableElement.class.getMethod( "isDefault" ); - } - catch ( NoSuchMethodException e ) { - method = null; - } - DEFAULT_METHOD = method; - } - private Executables() { } @@ -54,12 +39,7 @@ public static boolean isFinal(Accessor accessor) { } public static boolean isDefaultMethod(ExecutableElement method) { - try { - return DEFAULT_METHOD != null && Boolean.TRUE.equals( DEFAULT_METHOD.invoke( method ) ); - } - catch ( IllegalAccessException | InvocationTargetException e ) { - return false; - } + return method.isDefault(); } /**