1 package annotator.tests; 2 3 import java.io.Closeable; 4 import java.io.IOException; 5 6 public class Receivers { m()7 public void m() {} 8 spaces()9 public void spaces() {} 10 m(int i)11 public void m(int i) {} 12 spaces(int i)13 public void spaces(int i) {} 14 m(@nno) String s)15 public void m(@Anno() String s) {} 16 } 17 18 class Receivers2 { m(Receivers2 this)19 public void m(Receivers2 this) {} 20 spaces(Receivers2 this)21 public void spaces(Receivers2 this) {} 22 m(Receivers2 this, int i)23 public void m(Receivers2 this, int i) {} 24 spaces(Receivers2 this, int i)25 public void spaces(Receivers2 this, int i) {} 26 } 27 28 class Receivers3<K, V> { m()29 public void m() {} 30 m(int i)31 public void m(int i) {} 32 } 33 34 class Receivers4<K, V> { m(Receivers4<K, V> this)35 public void m(Receivers4<K, V> this) {} 36 m(Receivers4<K, V> this, int i)37 public void m(Receivers4<K, V> this, int i) {} 38 } 39 40 interface Receivers5 { m()41 public void m(); 42 } 43 44 enum Receivers6 { 45 TEST; m()46 public void m() {} 47 } 48 49 class Receivers7<K extends Object, V> { m()50 public void m() {} 51 } 52 53 class Receivers8<K extends Object> { m(Receivers8<K> this)54 public void m(Receivers8<K> this) {} 55 } 56 57 class Receivers9 { m()58 public void m() {} 59 } 60 61 class Receivers10<K, V> { m(Receivers10<K, V> this)62 public void m(Receivers10<K, V> this) {} 63 m(Receivers10<K, V> this, Receivers10<K, V> other)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> { map(T toMap)77 public T map(T toMap); 78 } 79 class GenericArray<Z extends Object> implements GenericInterface<String []> { 80 private Z z; setZ(Z z)81 public void setZ(Z z) { 82 this.z = z; 83 } map(String [] toMap)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 initialize(S s, T t)98 protected void initialize(S s, T t) { 99 this.s = s; 100 this.t = t; 101 } 102 Inner(S s, T t)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 { get(String param)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 close()119 public void close() throws IOException { 120 proxyProvider.close(); 121 } 122 } 123