| Summary: | Error in JDT Core during AST creation | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Philippe Marschall <philippe.marschall> | ||||||||||
| Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | amj87.iitr, daniel_megert, jarthana, pradeepb, srikanth_sankaran | ||||||||||
| Version: | 3.7.1 | ||||||||||||
| Target Milestone: | 3.6.2+J7 | ||||||||||||
| Hardware: | Macintosh | ||||||||||||
| OS: | Mac OS X | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Philippe Marschall
Created attachment 205551 [details]
A simple class that reproduces the bug
Happens because of incorrect problem reason found during org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(MethodBinding, TypeBinding[], InvocationSite).
We just assume that since invocation site is generified with type parameters and we couldn't find a matching method, the type parameters are to be blamed. But as shown in this case, this is not so. We should report an error here saying that there's no matching method corresponding to the given arguments URI and Collection<object,object>. javac 7 gives:
error: no suitable method found for newFileSystem(URI,Map<Object,Object>)
FileSystems.<String, Object>newFileSystem(uri, Collections.emptyMap());
^
method FileSystems.newFileSystem(Path,ClassLoader) is not applicable
(actual argument URI cannot be converted to Path by method invocation conv
ersion)
method FileSystems.newFileSystem(URI,Map<String,?>,ClassLoader) is not appli
cable
(actual and formal argument lists differ in length)
method FileSystems.newFileSystem(URI,Map<String,?>) is not applicable
(actual argument Map<Object,Object> cannot be converted to Map<String,?> b
y method invocation conversion)
1 error
Basically javac7 allows us to specify type arguments for even a non-generic method, so the second last line of computeCompatibleMethod(MethodBinding, TypeBinding[], InvocationSite) method should be removed, because type arguments in invocation site when the actual method is non generic is not the real problem. I'll follow up. Created attachment 205585 [details]
proposed fix
Passes compiler tests. Haven't run the full suite yet. But looks reasonable that we should only report a problem as having been caused by a parameterized method, not when type args have been specified at invocation site, but when this is done for an actually generic method.
Created attachment 205587 [details]
proposed fix
Git messed the above patch.
Created attachment 206718 [details]
proposed fix v1.0 + regression tests
Added a test in the above patch.
Released in HEAD via commit 23a0c6bd4ce9391b9f82ed7b1662678a44429de5 Srikanth, this is a regression over 3.6.2. Do we want to backport to 3.7.2? (In reply to comment #9) > Srikanth, this is a regression over 3.6.2. Do we want to backport to 3.7.2? Agree with analysis and fix. Yes, let us backport this to 3.7.2 and 3.6.2+java7 after a bit more testing. Dani, this is being considered for backport to 3.7.2 and 3.6.2+java7 after a bit more testing. Fix is small and safe and this is a regression since 3.6.2 - FYI. (In reply to comment #11) > Dani, this is being considered for backport to 3.7.2 and 3.6.2+java7 > after a bit more testing. > > Fix is small and safe and this is a regression since 3.6.2 - FYI. +1. I just wanted to let you guys know that you rock. Whenever I report a bug against JDT it gets fixed and back ported quickly. Thank you. (In reply to comment #13) > I just wanted to let you guys know that you rock. Whenever I report a bug > against JDT it gets fixed and back ported quickly. Thank you. Thank you ! For the record the fix hasn't been backported yet, we like the fix to get some exposure on HEAD before backporting, but it us surely in plan for 3.7.2. Released in R3_7_maintenance via commit 27bdb27668bb0d28026a2d0298321059115dd9db Jay confirmed release of this patch in 362+java7 branch via commit d36704d1542f1e9fe5510cf4bbc33793ec815d34 Verified for 3.8M4 with build I20111202-0800. Verified for 3.7.2RC2 using build M20120118-0800. |