I am trying to use the Google Guava ImmutableSet class to create a set of immutable classes with temporary properties (java.util.Date and org.joda.time.DateTime).
private static final ImmutableSet<Class<?>> timeLikeObjects = ImmutableSet.of(Date.class, DateTime.class);
I am completely at a dead end why I get this compiler error (Java 1.6 in eclipse).
Type mismatch: cannot convert from ImmutableSet<Class<? extends Object&Serializable&Comparable<? extends Comparable<?>>>> to ImmutableSet<Class<?>>
Please note that this works:
private static final ImmutableSet<?> timeLikeObjects = ImmutableSet.of(Date.class, DateTime.class);
However, I have clearly lost some of the general description of type timeLikeObjects.
I have never come across the ampersand symbol in the general description, and it does not seem to be valid syntax.
Is there a way to specify multiple inheritance in Java Generics that I just miss?
source share