LambdaCollections - compile error "is ambiguous for the type LambdaCollections"

18 views
Skip to first unread message

Slavus

unread,
Jul 21, 2010, 9:18:47 AM7/21/10
to lambdaj
Hi,
I have seen the new fluent collection interfaces, and it look cool,
so tried it out.
But it does not work for me for simple example like this

List<Integer> result = LambdaCollections.with(Arrays.asList(1, 2, 3,
4, 5)).retain(Matchers.greaterThan(3));

I get an

The method with(List<? extends Integer>) is ambiguous for the type
LambdaCollections Application.java.

I am doing something wrong because I successfully compiled and run
test from trunk using maven,
but when I import whole project into Eclipse I get same error as
above, even for Lambdaj source.

I am using Jdk 1.6.0u21, and Eclipse 3.6. Does anybody know what is
the problem.

Mario Fusco

unread,
Jul 21, 2010, 4:12:55 PM7/21/10
to lambdaj
Hi,

I normally use Intellij so I never experienced this problem. Anyway it
should be something in the last release of Eclipse since I am using
the same JVM version.
Is there somebody else who is using Eclipse 3.6 and is having the same
problem? Did somebody figure out which is the cause?

Thanks a lot
Mario

McHalls

unread,
Aug 1, 2010, 8:37:03 AM8/1/10
to lambdaj
Hi,

at least I can confirm. I am also using Eclipse Galileo and having the
exact same problem with the "with" keyword. No resolution yet, but
will try with another release too.

McHalls

Gian Carlo Pace

unread,
Aug 2, 2010, 2:29:11 AM8/2/10
to lam...@googlegroups.com
I'm using IntelliJ but a colleague of mine using eclipse experienced the same problem on sonething I committed while IJ didn't complained at all neither maven.

Together with my colleague we checked out the compiler version (sun 1.6) and some compiler option although he didn't set anything fancy.
That's is really weird.
As soon as we can we'll continue with some investigation.
Cheers,
--
Gian Carlo

McHalls

unread,
Aug 2, 2010, 7:19:29 AM8/2/10
to lambdaj
Hi,

same result with Eclipse Helios, but no problems with JDK compiler
based IDEs like Netbeans or IntelliJ, so I submitted a bug report for
Eclipse, we'll see how far they go with the investigation:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=321485

McHalls

Mario Fusco

unread,
Aug 7, 2010, 9:00:30 AM8/7/10
to lambdaj
Hi,

thanks a lot for submitting the bug report. It seems an Eclipse issue
indeed, but it seems I also made a small mistake on my side.

In particular a colleague made me notice that I defined the with()
methods accepting a Collection and a List in an inconsistent way since
they are declared as it follows:

with(Collection<T> collection)
with(List<? extends T> list)

I will fix this inconsistency with the next patch release, but now I
am also wondering if it could be in some way related with the
Eclipse's problem.
Did somebody notice some similar problem? Could somebody quickly try
to reproduce a similar situation in Eclipse?
Should I report this detail on the Eclipse bug report?

Bye,
Mario

McHalls

unread,
Aug 7, 2010, 10:36:45 AM8/7/10
to lambdaj
Hi,

I suggest that you should fix your inconsistency and then you could
try it under Eclipse with the very simple example I provided in the
Eclipse bug report, so you will see if this makes the error disappear
or not:
- If not, I guess then we are still happy that we have one
inconsistency less. :-)
- If yes, then it is worth to let them know the issue, so they will be
able to find their bug easier. But still they have to find and fix
their bug, since Eclipse compiler behaves differently than other
compilers, so I am sure they would like to know why.

In case you can't add comments to the bug report, let me know, I can
forward the information.

McHalls

Mario Fusco

unread,
Aug 7, 2010, 12:59:01 PM8/7/10
to lam...@googlegroups.com
Hi,

I am sending in attachment a jar file with a fix on the inconsistency I mentioned (plus an important performance improvement).

I suppose that you (or somebody else using Eclipse) could check if my fix solves also the Eclipse issue by just replacing the old jar, faster than I will take to install (and learn how it works) a new IDE.

If so (as I hope) all the Eclipse users interested in it, could finally start experimenting with the fluent interface collections, by using the same jar. In this case you could also update the Eclipse bug report accordingly.

Thanks a lot for your help with it.

Bye
Mario

lambdaj-2.3.1-SNAPSHOT-with-dependencies.jar

McHalls

unread,
Aug 7, 2010, 1:21:27 PM8/7/10
to lambdaj
Hi,

yes, it solved the compile error problem in Eclipse. I am using this
simple program below. With the official 2.3, it gives the compile
error as mentioned before. With your posted snapshot, it compiles and
runs clean, checked twice. :-)

I will try to include this snapshot file to the bugreport for Eclipse,
so they will have a clue about their bug.

import static ch.lambdaj.collection.LambdaCollections.with;
import java.util.ArrayList;
import java.util.List;

public class Boss {
public static void main(String[] args) {
ArrayList<Integer> mylist = new ArrayList<Integer>();
mylist.add(100);
mylist.add(110);
List<Integer> containsList = with(mylist).clone();
for (Integer i : containsList) {
System.out.println(i);
}
}
}

McHalls
>  lambdaj-2.3.1-SNAPSHOT-with-dependencies.jar
> 1046KMegtekintésNézet

Gian Carlo Pace

unread,
Aug 10, 2010, 5:38:16 AM8/10/10
to lam...@googlegroups.com
Hi Mario,
I just want to let you know that your patch has fixed the problem to my colleague as well.
Thanks a lot,
--
Gian Carlo

> <lambdaj-2.3.1-SNAPSHOT-with-dependencies.jar>

Mario Fusco

unread,
Aug 10, 2010, 12:36:49 PM8/10/10
to lam...@googlegroups.com
Hi Mario,
I just want to let you know that your patch has fixed the problem to my colleague as well.
Thanks a lot,

Thank you for confirming this.
I was seriously worried that Eclipse users couldn't use lambdaj.

I will drop a formal patch release with this and other important fixes as soon as possible.

If you or anyone else have any suggestion to enrich/improve the fluent collections API feel free to send it.

Bye,
Mario
 
Reply all
Reply to author
Forward
0 new messages