1 package annotator.tests; 2 3 import java.io.Closeable; 4 import java.io.IOException; 5 6 public class Receivers { 7 public void m() {} 8 9 public void spaces() {} 10 11 public void m(int i) {} 12 13 public void spaces(int i) {} 14 15 public void m(@Anno() String s) {} 16 } 17 18 class Receivers2 { 19 public void m(Receivers2 this) {} 20 21 public void spaces(Receivers2 this) {} 22 23 public void m(Receivers2 this, int i) {} 24 25 public void spaces(Receivers2 this, int i) {} 26 } 27 28 class Receivers3<K, V> { 29 public void m() {} 30 31 public void m(int i) {} 32 } 33 34 class Receivers4<K, V> { 35 public void m(Receivers4<K, V> this) {} 36 37 public void m(Receivers4<K, V> this, int i) {} 38 } 39 40 interface Receivers5 { 41 public void m(); 42 } 43 44 enum Receivers6 { 45 TEST; 46 public void m() {} 47 } 48 49 class Receivers7<K extends Object, V> { 50 public void m() {} 51 } 52 53 class Receivers8<K extends Object> { 54 public void m(Receivers8<K> this) {} 55 } 56 57 class Receivers9 { 58 public void m() {} 59 } 60 61 class Receivers10<K, V> { 62 public void m(Receivers10<K, V> this) {} 63 64 public void m(Receivers10<K, V> this, Receivers10<K, V> other) {} 65 } 66 67 @interface Anno {} 68 69 // Test receiver insertion on inner class's default constructor. 70 final class ScriptBasedMapping { 71 private final class RawScriptBasedMapping { 72 } 73 } 74 75 // Test receiver insertion before first parameter annotation. 76 interface GenericInterface<T extends Object> { 77 public T map(T toMap); 78 } 79 class GenericArray<Z extends Object> implements GenericInterface<String []> { 80 private Z z; 81 public void setZ(Z z) { 82 this.z = z; 83 } 84 public String [] map(String [] toMap) { 85 return toMap; 86 } 87 } 88 class GenericFields { 89 private GenericArray<String> genArray; 90 } 91 92 // Test inner receiver insertion before first parameter annotation. 93 class Outer<T, S> { 94 class Inner<T2 extends T> { 95 private S s; 96 private T t; 97 98 protected void initialize(S s, T t) { 99 this.s = s; 100 this.t = t; 101 } 102 103 public Inner(S s, T t) { 104 initialize(s, t); 105 } 106 } 107 } 108 109 // Test that parameters inside an anonymous class get annotated. 110 interface Interface { 111 String get(String param); 112 } 113 114 // Test for infinite loop bug. 115 class Closer<T> implements Closeable { 116 private final Closeable proxyProvider = System.out; 117 118 @Override 119 public void close() throws IOException { 120 proxyProvider.close(); 121 } 122 } 123