Skip to content

Commit

Permalink
Ensure Panache class transformers run before Arc's static method tran…
Browse files Browse the repository at this point in the history
…sformers

Fixes quarkusio#34005

Because static method transformers end up essentially changing the name
of static methods (renaming them to *_orig and generating another method
in their place), which can cause issues when Panache looks up the new
name of transformed methods in Jandex (*_orig methods won't be in the
index).
  • Loading branch information
yrodiere committed Jun 13, 2023
1 parent 33d742b commit 9981677
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.arc.deployment.ValidationPhaseBuildItem;
import io.quarkus.arc.deployment.staticmethods.InterceptedStaticMethodsTransformersRegisteredBuildItem;
import io.quarkus.builder.BuildException;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
Expand Down Expand Up @@ -92,6 +93,7 @@ void collectEntityClasses(CombinedIndexBuildItem index, BuildProducer<PanacheEnt

@BuildStep
@Consume(HibernateEnhancersRegisteredBuildItem.class)
@Consume(InterceptedStaticMethodsTransformersRegisteredBuildItem.class)
void build(
CombinedIndexBuildItem index,
BuildProducer<BytecodeTransformerBuildItem> transformers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import io.quarkus.arc.deployment.staticmethods.InterceptedStaticMethodsTransformersRegisteredBuildItem;
import jakarta.persistence.Id;

import org.hibernate.reactive.mutiny.Mutiny;
Expand Down Expand Up @@ -90,6 +91,7 @@ void collectEntityClasses(CombinedIndexBuildItem index, BuildProducer<PanacheEnt

@BuildStep
@Consume(HibernateEnhancersRegisteredBuildItem.class)
@Consume(InterceptedStaticMethodsTransformersRegisteredBuildItem.class)
void build(CombinedIndexBuildItem index,
BuildProducer<BytecodeTransformerBuildItem> transformers,
List<PanacheEntityClassBuildItem> entityClasses,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

import io.quarkus.arc.deployment.staticmethods.InterceptedStaticMethodsTransformersRegisteredBuildItem;
import io.quarkus.deployment.annotations.Consume;
import org.bson.codecs.pojo.annotations.BsonId;
import org.bson.codecs.pojo.annotations.BsonIgnore;
import org.bson.codecs.pojo.annotations.BsonProperty;
Expand Down Expand Up @@ -76,6 +78,7 @@ public abstract class BasePanacheMongoResourceProcessor {
public static final String BSON_PACKAGE = "org.bson.";

@BuildStep
@Consume(InterceptedStaticMethodsTransformersRegisteredBuildItem.class)
public void buildImperative(CombinedIndexBuildItem index,
BuildProducer<BytecodeTransformerBuildItem> transformers,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
Expand All @@ -94,6 +97,7 @@ public void buildImperative(CombinedIndexBuildItem index,
}

@BuildStep
@Consume(InterceptedStaticMethodsTransformersRegisteredBuildItem.class)
public void buildReactive(CombinedIndexBuildItem index,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Optional;
import java.util.Set;

import io.quarkus.arc.deployment.staticmethods.InterceptedStaticMethodsTransformersRegisteredBuildItem;
import jakarta.persistence.Transient;

import org.jboss.jandex.ClassInfo;
Expand Down Expand Up @@ -81,6 +82,7 @@ void findEntityClasses(CombinedIndexBuildItem index,

@BuildStep
@Consume(HibernateEnhancersRegisteredBuildItem.class)
@Consume(InterceptedStaticMethodsTransformersRegisteredBuildItem.class)
void replaceFieldAccesses(CombinedIndexBuildItem index,
ApplicationArchivesBuildItem applicationArchivesBuildItem,
Optional<HibernateMetamodelForFieldAccessBuildItem> modelInfoBuildItem,
Expand Down

0 comments on commit 9981677

Please sign in to comment.