-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Improve Java expression injector both for better code completion and for more useable inspections, #89
Conversation
Thanks for this PR @unshare, I think that I understand the problem you are trying to solve. Had a look at the code and it makes sense. Can you please have a look at the failing build and use the MapStruct code style guide? In addition to that, can you have a look whether you can add a test case that will solve some of the problems that you've encountered. You can add the test in |
…for more useable inspections, primary enhancements being around generics.
@filiphr Build failure: can't reproduce, hence not sure. Tests: this is a tough one. First of all, I'm not really familiar with IntelliJ code base and inner workings. As for the testing strategy, I'd rather find a way to emulate I do appreciate test-driven development, but at the moment the requirement for tests is too hard. |
Thanks for applying the code style.
I am aware about that. However, we would like to have the same code style here as in the MapStruct core repo. This means that if we need to change something it will need to be applied to multiple places. However, changing something might mean that other people won't pick it up as well. We need to see whether we should change this.
I mentioned this because I was not sure how you came up with the problem. However, after your explanation (using |
I've added some tests for this @unshare and I also played around with the I came up with something like: import java.util.function.BiFunction;
import org.mapstruct.example.dto.CustomerDto;
import org.mapstruct.example.dto.Wrapper;
import org.mapstruct.example.mapper.CustomerMapper;
@SuppressWarnings("unused")
abstract class CustomerMapperImpl<T, U>
implements CustomerMapper<T, U> {
void __test__(
CustomerDto customerDto,
Wrapper<BiFunction<String, Number, CustomerDto>> wrapper
) {
String __target__ = ;
}
} What do you think about this structure? |
Aside from code style, it's essentially the same. Therefore, looks good to me. I've added a commit that showcases how to use language injections to brighten up writing and handling test cases. (I do such stuff regularly, but mostly for SQL, HQL, JPQL, ...) With regard to test cases, I see you didn't find the way to access generated fragments. |
Yes I saw the commit. Really nice. Thanks for doing that.
I found the action that generates the test fragment. It is |
I've managed to get hold of the generated "Java Fragment" in 3a196f8. Good with the proper distinction, I was thinking about it as well |
I am now quite happy with the improvements. Thanks a lot for the I've also added a test case for the I will try to merge this tomorrow and do a release with this improvement. |
primary enhancements being around generics.