>
> I was pretty surprised to find that Guava doesn't compile for 1.8:
>
> https://github.com/google/guava/issues/1738
>
> But not at all for the reason/compile errors I was getting (which were
> related to, mostly AFAICT, Predicates.and method missing).
>
> The Guava issue is pretty old and doesn't seem very active. Kind of
> disturbing, although I understand setting up separate builds for them
> is likely a PITA.
>
I am not sure if the Predicates.and() error is a Guava problem. I checked
out guava and fixed the issue you have linked to by implementing the
required methods as no-op methods. Once I have done that Guava builds fine
with Java 8. So the linked issue is the only thing that prevents
compilation of Guava with Java 8.
Predicates.and() itself works fine in GWT with Java 8. Problems start when
you use Collections2 or Multimaps in GWT which both use Predicates.and()
and Predicates.in() internally. I have taken a look how they used
Predicates and tried a bit with the following results:
// also tried explicit anonymous class instead of lambda. No difference.
Predicate<? super String> alwaysTrue = input -> true;
void onModuleLoad() {
Collection<String> collection = Arrays.asList("a");
test(collection);
test2(collection);
test3(collection);
}
private void test(Collection<?> collection) {
Predicate<String> and = Predicates.and(alwaysTrue,
Predicates.in(collection));
GWT.log("" + and);
}
private void test2(Collection<? super String> collection) {
Predicate<String> and = Predicates.and(alwaysTrue,
Predicates.in(collection));
GWT.log("" + and);
}
private void test3(Collection<String> collection) {
Predicate<String> and = Predicates.and(alwaysTrue,
Predicates.in(collection));
GWT.log("" + and);
}
(only kept one method active while the others are commented)
*test() fails with:*
The method and(Predicate<capture#1-of ? super String>,
Predicate<capture#2-of ?>) is undefined for the type Predicates
*test2() fails with:*
The method and(Predicate<capture#1-of ? super String>,
Predicate<capture#2-of ? super String>) is undefined for the type Predicates
*test3() works!*
The Guava methods itself are defined as
public static <T> Predicate<T> and(Predicate<? super T> first, Predicate<?
super T> second)
public static <T> Predicate<T> in(Collection<? extends T> target)
Doing the same in a normal Java Main class everything works with Java8.
So I think we really have a GWT issue.
-- J.
--
You received this message because you are subscribed to the Google Groups "GWT
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit-contributors/5b6d4440-f2e5-4290-bf84-869de02f84d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.