New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite Stack Trace Loop for Invocation Exception with Abstract Mapper #1819
Comments
Removing the self referring INSTANCE takes care of the problem. So either those should not be allowed inside abstract mappers or whatever is causing the invocation exception should be fixed. |
So.. without any code your issue is a bit hard to grasp.. Can you add some reproducer? |
Run |
Let me know if the documentation is clear. If not, let us know of alternatively file a PR to enhance it.. I'm going to close this issue as it is documented. |
You mean In an (abstract) class the variable must be declared as static, otherwise it will be evaluated everytime the class will be instantiated. |
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at jdk.internal.reflect.GeneratedConstructorAccessor4.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) at org.mapstruct.factory.Mappers.doGetMapper(Mappers.java:85) at org.mapstruct.factory.Mappers.getMapper(Mappers.java:69) at org.mapstruct.factory.Mappers.getMapper(Mappers.java:58) at com.____.OutboundRequestMapper.<init>(OutboundRequestMapper.java:19) at com.______.OutboundRequestMapperImpl.<init>(OutboundRequestMapperImpl.java:28) at jdk.internal.reflect.GeneratedConstructorAccessor4.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) at org.mapstruct.factory.Mappers.doGetMapper(Mappers.java:85) at org.mapstruct.factory.Mappers.getMapper(Mappers.java:69) at org.mapstruct.factory.Mappers.getMapper(Mappers.java:58) ... Same lines just keep repeating until memory is full ...
The line 19 for the OutboundRequestMapper is this:
OutboundRequestMapper INSTANCE = Mappers.getMapper(OutboundRequestMapper.class);
The line mentioned for the Impl class is just the class declaration itself. The rest are all from default libraries.
The text was updated successfully, but these errors were encountered: