Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 427477

Summary: [1.7-][compiler] Error : method is not applicable for arguments with generics
Product: [Eclipse Project] JDT Reporter: Stephane Meny <stephane.meny>
Component: CoreAssignee: Sasikanth Bharadwaj <sasikanth.bharadwaj>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, srikanth_sankaran, stephan.herrmann
Version: 4.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Example to reproduce bug with Eclipse none

Description Stephane Meny CLA 2014-02-05 10:18:33 EST
Created attachment 239663 [details]
Example to reproduce bug with Eclipse

Hello JDT Core team,

I had a particular code causing a compiler error on Eclipse when I got no errors on Oracle Java Compiler side.

Please review the following code example attached, the exact error I got is :

The method myFunction(Iterable<E>) in the type MyClass is not applicable for the arguments (Collection)

In this particular case, the parameter is not the problem but the return type (List<List<E>> to List<List>).

This code example has been compiled successfully with Oracle javac on version 6 and 7.

Regards.
Comment 1 Srikanth Sankaran CLA 2014-02-05 10:37:18 EST
What is the version of eclipse and what is your project source/compliance levels ?
Comment 2 Stephan Herrmann CLA 2014-02-05 14:16:58 EST
Recommendation until we analyzed the example:

Don't use raw types ("Collection") in calls to a generic method.

Compilers currently accept more programs than they actually should. Eventually, type checks will become stricter in this area - so updating your code to become type safe is time well invested :)
Comment 3 Stephane Meny CLA 2014-02-05 15:01:46 EST
@Srikanth Sankaran
Project compliance level is Java 6 with a JDK 6u45.
The eclipse version is the JEE build available beginning of February 2014, I will give you the exact version tomorrow. In the meantime, could you please tell me which component version do you want specifically ?
(Eclipse platform is 4.3.1)

@Stephan Herrmann
I appreciate the advice, but please also consider that we may have to deal with software having legacy code, not using generics in a "standard" way. Obviously this is no excuse to not refactor such code when possible.

Cheers.
Comment 4 Stephan Herrmann CLA 2014-02-05 18:14:11 EST
Interestingly, the error is reported only by ecj since 3.5, but not at compliance 1.8 using BETA_JAVA8.
Comment 5 Jay Arthanareeswaran CLA 2014-02-26 22:25:53 EST
Srikanth/Stephan, is one of you going to be able to look at this for 4.4? If not, please change the target accordingly.
Comment 6 Stephan Herrmann CLA 2014-02-27 05:33:25 EST
I take it, but subject to deferring once I looked at it.
Is rescheduling after J8 GA OK?
Comment 7 Jay Arthanareeswaran CLA 2014-02-27 05:39:06 EST
(In reply to Stephan Herrmann from comment #6)
> I take it, but subject to deferring once I looked at it.
> Is rescheduling after J8 GA OK?

Sure, that should be okay. Thanks!
Comment 8 Stephan Herrmann CLA 2014-05-13 18:27:02 EDT
Deferring since it's unlikely that I will find a quick and safe solution for handling of raw types / unchecked conversions at 1.7 (at 1.8 both compilers agree).
Comment 9 Sasikanth Bharadwaj CLA 2015-04-20 01:21:52 EDT
Moving out of 4.5, couldn't get to it during Mars
Comment 10 Sasikanth Bharadwaj CLA 2016-04-04 04:24:24 EDT
Not for 4.6, moving out
Comment 11 Eclipse Genie CLA 2020-03-26 08:06:25 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. 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.