Skip to content

Stop mutating shared ParsedPersistenceXmlDescriptor in build steps - #51628

Open
Pepo48 wants to merge 1 commit into
keycloak:mainfrom
Pepo48:issue-47482
Open

Stop mutating shared ParsedPersistenceXmlDescriptor in build steps#51628
Pepo48 wants to merge 1 commit into
keycloak:mainfrom
Pepo48:issue-47482

Conversation

@Pepo48

@Pepo48 Pepo48 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #47482

Closes keycloak#47482

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
@Pepo48
Pepo48 requested review from ahus1 and shawkins August 11, 2026 15:15
@Pepo48
Pepo48 requested review from a team as code owners August 11, 2026 15:15
Copilot AI balanced review requested due to automatic review settings August 11, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Stops mutating the shared ParsedPersistenceXmlDescriptor during Quarkus build steps by switching entity registration to Quarkus’ JPA model contribution mechanism (closes #47482).

Changes:

  • Introduces JpaModelPersistenceUnitContributionBuildItem to contribute entities instead of mutating the parsed persistence unit descriptor.
  • Refactors default PU entity discovery to collect entities and emit a contribution build item.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +637 to +652
List<String> additionalEntities = new ArrayList<>();
for (AnnotationInstance annotation : annotations) {
AnnotationTarget target = annotation.target();
String targetName = target.asClass().name().toString();

if (!userManagedEntities.contains(targetName)
&& (!targetName.startsWith("org.keycloak") || targetName.startsWith("org.keycloak.testsuite"))) {
descriptor.addClasses(targetName);
additionalEntities.add(targetName);
}
}

if (!additionalEntities.isEmpty()) {
jpaModelPuContributions.produce(new JpaModelPersistenceUnitContributionBuildItem(
descriptor.getName(), descriptor.getPersistenceUnitRootUrl(),
additionalEntities, Collections.emptyList()));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not valid - it doesn't account for the constructor's defensive copy into a TreeSet.

@michalvavrik michalvavrik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shawkins shawkins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shawkins
shawkins enabled auto-merge (squash) August 11, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quarkus-next] ConcurrentModificationException in parallel Quarkus build steps

4 participants