Bug 499261 - [compiler] compiler error with invocation of overridden method in interface with method generic
Summary: [compiler] compiler error with invocation of overridden method in interface w...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-08-06 07:38 EDT by Jörg Hohwiller CLA
Modified: 2022-06-12 12:46 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Hohwiller CLA 2016-08-06 07:38:29 EDT
In ValueConverter:
https://github.com/m-m-m/util/blob/master/core/src/main/java/net/sf/mmm/util/value/api/ValueConverter.java#L22

I had to remove this method:

  /**
   * {@inheritDoc}
   *
   * @see #convert(Object, Object, GenericType)
   */
  @Override
  <T extends TARGET> T convert(SOURCE value, Object valueSource, Class<T> targetClass) throws ValueException;

In order to make this line compile in Eclipse:
https://github.com/m-m-m/util/blob/master/core/src/main/java/net/sf/mmm/util/lang/base/StringUtilImpl.java#L483

It worked with Oracle Compiler using maven but failed in Eclipse.
As a workaround I removed the overridden method that only adds a JavaDoc hint.
However, this is IMHO a bug in Eclipse (with Neon Build id: 20160613-1800 when 1.8 is active).

https://github.com/m-m-m/util/commit/4f6594388c09c54488a22e7e22726ee96170785a

In case you really care: I discovered a lot of problems and differences in Oracle and Eclipse compliler here:
https://github.com/m-m-m/util/issues/166

Oracle does not care and just ignores my bug reports even though I created isolated tests that prove the bug. Hopefully Eclipse community cares better...
Comment 1 Stephan Herrmann CLA 2016-08-07 06:57:50 EDT
Minimal example:

//---
import java.lang.reflect.Type;

interface SimpleValueConverter<SOURCE, TARGET> {
	<T extends TARGET> T convert(SOURCE value, Class<T> targetClass);
}

interface ValueConverter<SOURCE, TARGET> extends SimpleValueConverter<SOURCE, TARGET> {
	@Override
	<T extends TARGET> T convert(SOURCE value, Class<T> targetClass);
}

interface GenericType<T> extends Type { }

public class StringUtilImpl {
	public <E> E fromSeparatedString(ValueConverter<? super String, ? super E> converter, Class<E> type) {
		return converter.convert("", type);
	}
}
//---

Reports:----------
1. ERROR in /tmp/bug/repro/src/StringUtilImpl.java (at line 16)
        return converter.convert("", type);
                         ^^^^^^^
The method convert(capture#1-of ? super String, Class<E>) is ambiguous for the type ValueConverter<capture#1-of ? super String,capture#2-of ? super E>
----------
1 problem (1 error)

Only happens at -1.8.


What's particularly strange: a method conflicts with its own override.
Comment 2 Manoj N Palat CLA 2018-05-17 03:23:25 EDT
bulk move out of 4.8
Comment 3 Manoj N Palat CLA 2018-08-16 00:07:58 EDT
Bulk move out of 4.9
Comment 4 Eclipse Genie CLA 2022-06-12 12:46:02 EDT
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.