Making our code slightly less typesafe to work around a bug in javac.
I couldn't reproduce the specific bug on various versions of javac (1.6.0,
1.6.0 r1, 1.6.0 r13, 1.6.0r16, 1.6.0 r15 on Mac, 1.5.0 r20 on Mac) so I'm
just hoping this change works.
diff --git a/src/com/google/common/collect/ImmutableList.java b/src/com/google/common/collect/ImmutableList.java
index 0aa2501..b408874 100644
--- a/src/com/google/common/collect/ImmutableList.java
+++ b/src/com/google/common/collect/ImmutableList.java
@@ -62,7 +62,7 @@
// Casting to any type is safe because the list will never hold any elements.
@SuppressWarnings("unchecked")
public static <E> ImmutableList<E> of() {
- return (ImmutableList<E>) EmptyImmutableList.INSTANCE;
+ return (ImmutableList) EmptyImmutableList.INSTANCE;
}
/**
diff --git a/src/com/google/common/collect/ImmutableListMultimap.java b/src/com/google/common/collect/ImmutableListMultimap.java
index b71b47a..93ef898 100644
--- a/src/com/google/common/collect/ImmutableListMultimap.java
+++ b/src/com/google/common/collect/ImmutableListMultimap.java
@@ -54,7 +54,7 @@
// Casting is safe because the multimap will never hold any elements.
@SuppressWarnings("unchecked")
public static <K, V> ImmutableListMultimap<K, V> of() {
- return (ImmutableListMultimap<K, V>) EmptyImmutableListMultimap.INSTANCE;
+ return (ImmutableListMultimap) EmptyImmutableListMultimap.INSTANCE;
}
/**
diff --git a/src/com/google/common/collect/ImmutableMap.java b/src/com/google/common/collect/ImmutableMap.java
index 65a0022..8fad466 100644
--- a/src/com/google/common/collect/ImmutableMap.java
+++ b/src/com/google/common/collect/ImmutableMap.java
@@ -58,7 +58,7 @@
// Casting to any type is safe because the set will never hold any elements.
@SuppressWarnings("unchecked")
public static <K, V> ImmutableMap<K, V> of() {
- return (ImmutableMap<K, V>) EmptyImmutableMap.INSTANCE;
+ return (ImmutableMap) EmptyImmutableMap.INSTANCE;
}
/**
diff --git a/src/com/google/common/collect/ImmutableMultiset.java b/src/com/google/common/collect/ImmutableMultiset.java
index cd78905..fe33d50 100644
--- a/src/com/google/common/collect/ImmutableMultiset.java
+++ b/src/com/google/common/collect/ImmutableMultiset.java
@@ -50,7 +50,7 @@
*/
@SuppressWarnings("unchecked") // all supported methods are covariant
public static <E> ImmutableMultiset<E> of() {
- return (ImmutableMultiset<E>) EmptyImmutableMultiset.INSTANCE;
+ return (ImmutableMultiset) EmptyImmutableMultiset.INSTANCE;
}
/**
diff --git a/src/com/google/common/collect/ImmutableSet.java b/src/com/google/common/collect/ImmutableSet.java
index 8410a79..20de3b6 100644
--- a/src/com/google/common/collect/ImmutableSet.java
+++ b/src/com/google/common/collect/ImmutableSet.java
@@ -73,7 +73,7 @@
// Casting to any type is safe because the set will never hold any elements.
@SuppressWarnings({"unchecked"})
public static <E> ImmutableSet<E> of() {
- return (ImmutableSet<E>) EmptyImmutableSet.INSTANCE;
+ return (ImmutableSet) EmptyImmutableSet.INSTANCE;
}
/**
diff --git a/src/com/google/common/collect/ImmutableSetMultimap.java b/src/com/google/common/collect/ImmutableSetMultimap.java
index af3ca84..88f286a 100644
--- a/src/com/google/common/collect/ImmutableSetMultimap.java
+++ b/src/com/google/common/collect/ImmutableSetMultimap.java
@@ -57,7 +57,7 @@
// Casting is safe because the multimap will never hold any elements.
@SuppressWarnings("unchecked")
public static <K, V> ImmutableSetMultimap<K, V> of() {
- return (ImmutableSetMultimap<K, V>) EmptyImmutableSetMultimap.INSTANCE;
+ return (ImmutableSetMultimap) EmptyImmutableSetMultimap.INSTANCE;
}
/**