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