summaryrefslogtreecommitdiffstats
path: root/tests/java5/generics/GenericMethods.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java5/generics/GenericMethods.java')
-rw-r--r--tests/java5/generics/GenericMethods.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/java5/generics/GenericMethods.java b/tests/java5/generics/GenericMethods.java
new file mode 100644
index 000000000..78ef49212
--- /dev/null
+++ b/tests/java5/generics/GenericMethods.java
@@ -0,0 +1,51 @@
+import java.util.*;
+/*
+ * test case fodder for basic generic signature matching
+ */
+public class GenericMethods {
+
+ public List<Integer> returningListOfInteger() {
+ return new LinkedList<Integer>();
+ }
+
+ public List<Object> returningListOfObject() {
+ return new LinkedList<Object>();
+ }
+
+ public List returningRawList() { return new ArrayList(); }
+
+ public LinkedList<Integer> returningSubtypeOfListOfInteger() {
+ return new LinkedList<Integer>();
+ }
+
+ public void takesAMap(Map<Double,Short> aMap) {}
+
+ public void takesAHashmap(HashMap<Double,Short> aMap) {}
+
+ public static void staticTakesAMap(Map<Double,Short> aMap) {}
+
+ public void collectionOfAnything(Collection<?> aCollection) {}
+
+ public void collectionOfAnyNumber(Collection<? extends Number> aNumberCollection) {}
+
+ public void collectionOfAnythingTakingADouble(Collection<? super Double> aDoubleHandlingCollection) {}
+
+ // now some fun with statics
+ static <T> T findMax(List<T> ts) { return ts.get(0); }
+
+ static <T extends Comparable<T>> T betterMax(Collection<T> collection) {
+ return null;
+ }
+
+ static <T extends Comparable<? super T>> T evenBetterMax(Collection<T> coll) {
+ return null;
+ }
+
+ static <T extends Object & Comparable<? super T>> T jdkMax(Collection<? extends T> coll) {
+ return null;
+ }
+
+ static <T> void copy(List<T> dest, List<? extends T> src) {}
+
+ static <T,S extends T> copyv2(List<T> dest, List<S> src) {}
+} \ No newline at end of file