Skip to content

Commit

Permalink
Allow Panache bytecode enhancers to benefit from class transformers c…
Browse files Browse the repository at this point in the history
…aches
  • Loading branch information
Sanne committed May 3, 2024
1 parent 8832fa8 commit c73fc8c
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ void replaceFieldAccesses(CombinedIndexBuildItem index,
PanacheJpaEntityAccessorsEnhancer entityAccessorsEnhancer = new PanacheJpaEntityAccessorsEnhancer(index.getIndex(),
modelInfo);
for (String entityClassName : entitiesWithExternallyAccessibleFields) {
transformers.produce(new BytecodeTransformerBuildItem(entityClassName, entityAccessorsEnhancer));
final BytecodeTransformerBuildItem transformation = new BytecodeTransformerBuildItem.Builder()
.setClassToTransform(entityClassName)
.setCacheable(true)
.setVisitorFunction(entityAccessorsEnhancer)
.build();
transformers.produce(transformation);
}

// Replace field access in application code with calls to accessors
Expand All @@ -125,8 +130,13 @@ void replaceFieldAccesses(CombinedIndexBuildItem index,
continue;
}
produced.add(cn);
transformers.produce(
new BytecodeTransformerBuildItem(cn, panacheFieldAccessEnhancer, entityClassNamesInternal));
final BytecodeTransformerBuildItem transformation = new BytecodeTransformerBuildItem.Builder()
.setClassToTransform(cn)
.setCacheable(true)
.setVisitorFunction(panacheFieldAccessEnhancer)
.setRequireConstPoolEntry(entityClassNamesInternal)
.build();
transformers.produce(transformation);
}
}
}
Expand Down

0 comments on commit c73fc8c

Please sign in to comment.