Add generics support - #273
Conversation
| "testData", | ||
| "build/test-libs" | ||
| ); | ||
|
|
There was a problem hiding this comment.
Why did you changes this code? I think this could break building on other OS (Windows)
There was a problem hiding this comment.
I added this specifically to ensure the tests run correctly on Windows. Without these configurations, the testing framework is unable to access packages
There was a problem hiding this comment.
For example, before fix
14:52:40,037 FINE .intellij.openapi.command.impl - finishCommand: name = Renaming method setTestName(String) of class org.mapstruct.intellij.test.examples.SimpleMapper.Target to setNewName, groupId = null
14:52:40,039 SEVERE #TestFramework - Test failed
com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess$VfsRootAccessNotAllowedError: File accessed outside allowed roots: file://D:/projects/github/mapstruct-idea/testData/usages/RenameTargetReferenceAfter.java; | else if ( element instanceof PsiParameter psiParameter ) { | ||
| return psiParameter.getType(); | ||
| } |
There was a problem hiding this comment.
How is it with PsiParameter (constructor target parameter)?
There was a problem hiding this comment.
Good point – I fixed it
Added tests for:
GenericConstructorCarMapper.javaGenericConstructorMappingTargetUpdateMapper.javaGenericTwoTypeParamsConstructorTargetMapper.javaGenericRecordConstructorTargetMapper.java
| else if ( element instanceof PsiParameter psiParameter ) { | ||
| return psiParameter.getType(); | ||
| } |
There was a problem hiding this comment.
What if the source is named e.g. entity.id?
There was a problem hiding this comment.
Sorry, I'm not sure I understand. Do you mean a nested source path like this?
@Mapping(source = "entity.id", target = "entityId")
Dto map(Entity entity, Other other);19196bd to
30b3520
Compare
|
|
||
| checkstyle { | ||
| toolVersion = '8.36.1' | ||
| toolVersion = '10.12.0' |
There was a problem hiding this comment.
Checkstyle 8.36.1 cannot parse Java pattern-matching switch expressions (used in resolvedType()), e.g.:
Output before up version
MapstructSourceReference.java:138:17: unexpected token: psiType30b3520 to
d781aa0
Compare
d781aa0 to
f9e342b
Compare
Hi!☺️ I noticed that the MapStruct IDEA plugin didn't support generics properly in some cases.
This PR adds support for generic types. I'd appreciate it if you could review and merge these changes!
Before
After