Bug 470849 - ECJ fails to associate call using bounded wildcard parameter with bounded generic method
Summary: ECJ fails to associate call using bounded wildcard parameter with bounded gen...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-23 17:48 EDT by Clifford Johnson CLA
Modified: 2022-08-24 14:34 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Clifford Johnson CLA 2015-06-23 17:48:03 EDT
The following code compiles successfully with javac 1.8.0_31 but does not compile with Eclipse 4.5 (Mars) or the update published in org.eclipse.jdt.core_3.11.0.v20150602-1242.jar.

package net.codefool.wildcard;

public class EcjVsWildcardMethodParameter {

  public static void main(String[] args) {
    final Parameter<String, ? extends Comparable<?>> parameter = getParameter();
    final Result<String> result = getResult(parameter);
//    final Result<String> result = getResult((Parameter) parameter);
  }

  private static Parameter<String, ? extends Comparable<?>> getParameter() {
    return null;
  }

  private static <K extends Comparable<K>, V extends Comparable<V>> Result<K> getResult(final Parameter<K, V> parameter) {
    return new Result<>();
  }

  private static class Result<K extends Comparable<K>> {
  }

  private static class Parameter<K extends Comparable<K>, V extends Comparable<V>> {
  }
}


Casting parameter using the raw type permits compilation with a number of warnings.


********:ecjFault $ java -jar ~/Downloads/Eclipse/Mars/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.jdt.core_3.11.0.v20150602-1242.jar -1.8 src/net/codefool/wildcard/EcjVsWildcardMethodParameter.java 
----------
1. ERROR in ********/ecjFault/src/net/codefool/wildcard/EcjVsWildcardMethodParameter.java (at line 10)
	final Result<String> result = getResult(parameter);
	                              ^^^^^^^^^
The method getResult(EcjVsWildcardMethodParameter.Parameter<K,V>) in the type EcjVsWildcardMethodParameter is not applicable for the arguments (EcjVsWildcardMethodParameter.Parameter<String,capture#3-of ? extends Comparable<?>>)
----------
1 problem (1 error)
Comment 1 Eclipse Genie CLA 2020-05-20 17:32:37 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.
Comment 2 Eclipse Genie CLA 2022-08-24 14:34:45 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.