I am following Domain Driven Design and Clean/ Hexagonal architecture in my Java microservice. I have domain events declared in my aggregate root class as non-static nested classes. My question is whether these classes should be static nested classes or non-static nested classes(inner classes)?
I used non-static nested classes but IntelliJ IDEA suggests to make them static. According to the Hardcore Java book by Robert Simmons,
an inner class is instance-scoped and a static nested class is class-scoped.
As I understood in the Domain Driven Design, without an aggregate instance, it doesn't make any sense to have domain events instances. This is the reason why I chose to go with non-static nested classes. Can someone explain this? Thanks.