Community
Participate
Working Groups
I found a regression bug with the Eclipse compiler causing an falsely ambiguous method error. This error did not show up with Neon but arises with Oxygen. > Eclipse IDE for Java Developers > Version: Oxygen Release (4.7.0) > Build id: 20170620-1800 > Eclipse Java Development Tools 3.13.0.v20170612-0950 As a workaround I had to remove an overridden method from an interface while the overridden method did not change the signature but was just for the purpose to extend the JavaDoc. However with the overridden method being present, I get the error. This is the commit where I removed the method: https://github.com/m-m-m/util/commit/95d2b9ea5ac8d9ce2959a0becae429bca4353b5c Here is the super-interface that initially declares the method: https://github.com/m-m-m/util/blob/95d2b9ea5ac8d9ce2959a0becae429bca4353b5c/core/src/main/java/net/sf/mmm/util/value/api/SimpleValueConverter.java Here is the line of code that is causing the error when the method is overridden: https://github.com/m-m-m/util/blob/95d2b9ea5ac8d9ce2959a0becae429bca4353b5c/core/src/main/java/net/sf/mmm/util/lang/base/StringUtilImpl.java#L482 The exact error message from Eclipse compiler in this line 482 is: The method convert(capture#3-of ? super String, Object, Class<E>) is ambiguous for the type ValueConverter<capture#3-of ? super String,capture#4-of ? super E> This is obviously an error in the Eclipse compiler. I started the discussion at https://www.eclipse.org/forums/index.php/m/1772504/#msg_1772504 but as always the users have present the bugs on the silver dish. I hope you will not request an isolated test case integrated via JUnit as pull request to the Eclipse compiler project to proceed :)
Thanks for the report, but without a self-contained example I simply can't make a promise when we will have the time to investigate.
I searched for related issues and this one comes close: https://bugs.eclipse.org/bugs/show_bug.cgi?id=480541 In case it would be a real duplicate then the fact of overriding does not actually matter but only that two methods with the same name and the same number or arguments that only differ in the raw type of an argument may cause the problem.
> differ in the raw type of an argument that is a ParameterizedType. In my case Class<T> vs. GenericType<T> in case of bug #480541 Predicate<? super SUB> vs. Function<? super SUB, T>. For matching methods of course one would expect the raw type to be more relevant than the type parameters.
Hi Guys, some news about this BUG, I have the same issue. Tks...
Reduced example: //--- import java.lang.reflect.Type; interface GenericType<T> extends Type { } interface SimpleValueConverter<SOURCE, TARGET> { <T extends TARGET> T convert(SOURCE value, Object valueSource, Class<T> targetClass); } interface ValueConverter<SOURCE, TARGET> extends SimpleValueConverter<SOURCE, TARGET> { @Override <T extends TARGET> T convert(SOURCE value, Object valueSource, Class<T> targetClass); <T extends TARGET> T convert(SOURCE value, Object valueSource, GenericType<T> targetType); } public class StringUtilImpl { public <E> void fromSeparatedString(CharSequence separatedString, ValueConverter<? super String, ? super E> converter, Class<E> type) { String elementString = ""; E element = converter.convert(elementString, separatedString, type); } } //--- This is accepted by current ecj at compliance 1.8 or greater History: - was accepted at 1.7+ up until 4.7M6 - rejected since 4.7M7 - accepted at 1.8+ starting from 4.8M5, but still rejected at 1.7 To be honest the know-how about overloading with type inference in Java 7 is dwindling in the JDT team. I could help if the bug exists still at compliance 1.8, but it doesn't. Ergo: please consider upgrading your project to a recent version. (In reply to Jörg Hohwiller from comment #0) > This is obviously an error in the Eclipse compiler. Please never use the word "obvious" in the context of type inference plus overloading (unless you can within a few minutes pin point the rule in JLS which is violated by our implementation). Marking as 'helpwanted'.
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. If you have further information on the current state of the bug, please add it. 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.
Works at 1.8 compliance or later. Issue with 1.7 compliance. Checked again on Version: 2021-06 (4.20) Build id: I20210602-1800