Skip to content

[OPENJPA-2955] Do not remove schema generation keys from the caller's properties map - #161

Open
rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2955
Open

[OPENJPA-2955] Do not remove schema generation keys from the caller's properties map#161
rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2955

Conversation

@rzo1

@rzo1 rzo1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

extractSchemaGenObjects now records which of the four script keys held a Writer/Reader and strips them from a copy, so the map handed to fromProperties is left untouched — see https://issues.apache.org/jira/browse/OPENJPA-2955. The copy is only made when one of the keys is actually an object, so the common all-strings case allocates nothing.

Both halves of the report reproduce. Map.of(...) really does throw UnsupportedOperationException, and there is an in-tree victim of the mutation as well: DistributedJDBCConfigurationImpl.fromProperties calls super.fromProperties(original) and then keeps using original to build every slice, so each slice silently lost its script Writer/Reader.

New TestSchemaGenObjectProperties covers capture, caller-map immutability, an unmodifiable input map and the plain string path. Three of its four tests fail against master (2 failures plus the UnsupportedOperationException); all four pass here, as do TestSchemaGenDrop, TestSchemaGenAnnotations, TestSchemaGenerationScripts and TestSchemaGenerationProperties (34 tests). The test lives in openjpa-jdbc rather than openjpa-kernel because constructing an OpenJPAConfigurationImpl needs a ProductDerivation on the classpath, and openjpa-kernel has none in its own test scope.

@rzo1 rzo1 self-assigned this Aug 21, 2026
@rzo1
rzo1 requested a review from solomax August 21, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant