spring-projects / spring-projects/spring-data-commons
MappingContextTypeInformationMapper: No initialization and verification performed on construction [DATACMNS-1627]
Open
@odrotbohm is already working on this.
Since Dec 30, 2020.
in: core
status: feedback-provided
type: bug
- Dominant language
- Java
- Stars
- 838
- Forks
- 730
- PR merge metrics
- No merged PRs in 30d
Description
shimikano opened DATACMNS-1627 and commented
While debugging some issues with type aliases, we noticed that MappingContextTypeInformationMapper is not actually initialized with the aliases of the PersistentEntities in the MappingContext given to the constructor:
public MappingContextTypeInformationMapper(MappingContext<? extends PersistentEntity<?, ?>, ?> mappingContext) {
Assert.notNull(mappingContext, "MappingContext must not be null!");
this.typeMap = new ConcurrentHashMap<>();
this.mappingContext = mappingContext;
for (PersistentEntity<?, ?> entity : mappingContext.getPersistentEntities()) {
verify(entity.getTypeInformation().getRawTypeInformation(), entity.getTypeAlias());
}
}
verify(), contradictory to its javadoc, does not modify this.typeMap. Hence, neither verification nor initialization of the map is actually done.
Is this intended or am I missing something?
Affects: 2.2.2 (Moore SR2)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.