Skip to content

Commit

Permalink
Simplify pattern used introduced in #46284
Browse files Browse the repository at this point in the history
There is one reason for doing that: this way, we are sure the value of
the boolean is not dependent of anything contextual to the Consumer
invocation.
I think it's a lot safer this way.

(cherry picked from commit c534f77)
  • Loading branch information
gsmet committed Feb 18, 2025
1 parent 5f3abf6 commit cec051a
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ public void setupEndpoints(ApplicationIndexBuildItem applicationIndexBuildItem,
return false;
};

final boolean filtersAccessResourceMethod = filtersAccessResourceMethod(
resourceInterceptorsBuildItem.getResourceInterceptors());

BiConsumer<String, BiFunction<String, ClassVisitor, ClassVisitor>> transformationConsumer = (name,
function) -> bytecodeTransformerBuildItemBuildProducer
.produce(new BytecodeTransformerBuildItem(name, function));
Expand Down Expand Up @@ -562,8 +565,6 @@ public void setupEndpoints(ApplicationIndexBuildItem applicationIndexBuildItem,
classLevelExceptionMappers.isPresent() ? classLevelExceptionMappers.get().getMappers()
: Collections.emptyMap())
.setResourceMethodCallback(new Consumer<>() {
Boolean filtersAccessResourceMethod;

@Override
public void accept(EndpointIndexer.ResourceMethodCallbackEntry entry) {
MethodInfo method = entry.getMethodInfo();
Expand All @@ -590,11 +591,6 @@ public void accept(EndpointIndexer.ResourceMethodCallbackEntry entry) {
.build());
}

if (filtersAccessResourceMethod == null) {
filtersAccessResourceMethod = filtersAccessResourceMethod(
resourceInterceptorsBuildItem.getResourceInterceptors());
}

boolean paramsRequireReflection = false;
for (short i = 0; i < method.parametersCount(); i++) {
Type parameterType = method.parameterType(i);
Expand Down

0 comments on commit cec051a

Please sign in to comment.