| Summary: | [1.8][compiler][inference] method not applicable for arguments, goes away on simple refactor to local variable (in an expression which javac 1.8 allows) | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Michael Vorburger <mike> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, stephan.herrmann |
| Version: | 4.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | stalebug | ||
|
Description
Michael Vorburger
> reproduce this in a complete WS quite easily (...) > Check out current git revision 31d5ed0c664e8fbd793538c4e4546204847c779e careful, https://git.opendaylight.org/gerrit/#/c/38289/ will work around this. (In reply to Michael Vorburger from comment #0) > Stephan I recall your "javac is known to have long standing bugs in this > area, and reverse engineering these bugs will get us nowhere. The goal in > implementing a Java compiler is to be compliant with JLS." from bug 490001, thanks for the quotation, so I don't have to repeat myself :) > BUT here is the interesting twist on this one: > > If you mark "StmtContextUtils.buildEffective()" and do a Refactor > Extract > Local Variable, it will turn the above into this below, and on this it > doesn't choke anymore: > > Function<StmtContext<?, ?, ? extends EffectiveStatement<?, ?>>, > EffectiveStatement<?, ?>> buildEffective = StmtContextUtils.buildEffective(); > this.substatements = > ImmutableList.copyOf(Collections2.transform(substatementsToBuild, > buildEffective)); This may not be your main point, but: It is a known effect of Java 8 target typing, that additional type hints from declaring an intermediate local variable can push inference towards the intended solution, where otherwise it fails. > My point being: If Refactoring "knows" about the correct (horrible...) > generic here, shouldn't & couldn't the type inference that's underlying the > generics stuff be smart enough to also dig this, without requiring factoring > out to an explicit variable ? "could", yes, probably. "should" is to be decided by JLS authors, not Eclipse committers. This doesn't yet rule out that ecj has a bug here. To prove a bug, it will require to demonstrate *how* exactly inference is supposed to find a valid solution based on JLS chap. 18. Unfortunately, such demonstration is a painfully complex task. Showing the opposite - that not finding a solution is correct - is even harder. Just saying ... This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |