Conversation
|
@timtebeek I believe this will cause some test failures, but I do believe that there is currently something missing in the type attribution, which causes the test from #4423 to fail. This is WIP and I am not sure when I will be able to pick this up. Maybe you find the time 😉 |
|
Indeed seeing three new falures; quick link to one of them here for reference. diff --git a/Test.java b/Test.java
index b025685..8109464 100644
--- a/Test.java
+++ b/Test.java
@@ -1,6 +1,6 @@
import java.util.Map;
class Test {
void test(Map<String, ?> map) {
- System.out.println(map.get("test"));
+ System.out.println(__P__.<error> << captured wildcard>>/*__p0__*/p();
}
} |
|
@timtebeek I pushed another commit. Let's see if this helps. Got any idea if any recipes have bugs which can be explained by this? |
Thanks a lot! I don't recall us using There had been a few earlier attempts at recipes that failed to match that could now be reevaluated:
Would you need me to apply the same fixes to the other versions of Java parsers? |
|
Yes, I believe we should apply the same fix to the other Java parsers. |
|
Also note that the bug could affect any recipes which direcly or indirectly use TypeUtils.isAssignableTo(). So this isn't restricted to Refaster or JavaTemplate.matches(), but it is still an uncommon corner case. |
timtebeek
left a comment
There was a problem hiding this comment.
Thanks a lot for finding some time to squeeze this in! Should make those matchers a lot more effective, and unlocks more reuse through Refaster.
|
Seeing one downstream test failure (so far) in rewrite-static-analysis |
|
Looks like it requires slightly more work. |
The change in the recent PR #4427 was a bit overly cautious. We should be able to use `?` as the name in the signature for all captured types.
Try to fix #4423 by correcting the type attribution for some generics and the corresponding type assignability check.
JavaTemplateSemanticallyEqualfails to match AssertJ'sassertThat("foo").isEqualTo("")#4423