Skip to content

Invalid parent parameter provided to static inner class constructors #3038

Closed
@G0dC0der

Description

@G0dC0der

This is a document in collection, exported via MongoDB Compass:

{
  "_id": {
    "$numberLong": "24"
  },
  "name": "attr",
  "storageFormat": {
    "elementFormat": {
      "elementFormat": {
        "elementFormat": {
          "datatype": "DOUBLE",
          "_class": "com.company.cms.persistence.entity.StorageFormatEntity$DataTypeEntity"
        },
        "_class": "com.company.cms.persistence.entity.StorageFormatEntity$ArrayFormatEntity"
      },
      "_class": "com.company.cms.persistence.entity.StorageFormatEntity$ArrayFormatEntity"
    },
    "_class": "com.company.cms.persistence.entity.StorageFormatEntity$ArrayFormatEntity"
  },
  "_class": "com.company.cms.persistence.entity.AttributeEntity"
}

At this point, everything looks correct. However, when I read it, storageFormat.elementFormat is null.
This is the class:

public sealed interface StorageFormatEntity {

    record DataTypeEntity(String datatype) implements StorageFormatEntity {}

    record ContentRefEntity(List<Long> templates) implements StorageFormatEntity {}

    record ArrayFormatEntity(StorageFormatEntity elementFormat) implements StorageFormatEntity {}
}

I have temporarily solved this by registering a custom read converter, but I feel like this shouldn't be necessary. I feel like this is a bug in the framework.

I am using Spring Boot 3.2.1.

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructuretype: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions