1 import java.util.List; 2 3 class MethodCalls { 4 5 public int member; 6 7 public MethodCalls getSelf() 8 { 9 return this; 10 } 11 12 13 public void foo() 14 { 15 } 16 17 void bar1() 18 { 19 getSelf().getSelf().foo(); 20 } 21 22 int bar2() 23 { 24 return getSelf().m; 25 } 26 27 void inheritedInterfaceMethod(){ 28 List<Integer> list; 29 list.toString(); 30 } 31 32 void variadicTest(){ 33 String[] varArg = new String[2]; 34 foobar("a"); 35 foobar(varArg); 36 } 37 38 int foobar(String s){ 39 return 1; 40 } 41 42 void foobar(String... s){ 43 return; 44 } 45 46 void variadicMethod(String... s) 47 { 48 this.variadicMethod("test"); 49 } 50 51 <T> T genericMethod0() { return null; } 52 <T> T genericMethod1(T x) { return x; } 53 54 static <T> T staticGenericMethod0() { return null; } 55 static <T> T staticGenericMethod1(T x) { return x; } 56 57 static class GenericClass<T> {} 58 59 static void variadicWithGenericArg(int i, GenericClass<?>... c) {} 60 61 void genericMethodTest() { 62 this.<Integer>genericMethod0(); 63 this.genericMethod1("Hello"); 64 65 MethodCalls.<Integer>staticGenericMethod0(); 66 MethodCalls.staticGenericMethod1("Hello"); 67 68 MethodCalls.variadicWithGenericArg(1, new GenericClass<Long>()); 69 } 70 } 71