157 String As = "@A", Bs = "@B", Ds = "@D"; 158 if(Arepeats) As = "@A @A"; 159 if(BDrepeats) { 160 Bs = "@B @B"; 161 Ds = "@D @D"; 162 } 163 if(ABmix) { As = "@A @B"; Bs = "@A @B"; Ds = "@D @D"; } 164 165 // Source to check for TYPE_USE and TYPE_PARAMETER annotations. 166 // Source base (annotations) is same for all test cases. 167 String source = new String(); 168 String imports = new String("import java.lang.annotation.*; \n" + 169 "import static java.lang.annotation.RetentionPolicy.*; \n" + 170 "import static java.lang.annotation.ElementType.*; \n" + 171 "import java.util.List; \n" + 172 "import java.util.HashMap; \n" + 173 "import java.util.Map; \n\n"); 174 175 String sourceBase = new String("@Retention("+retentn+")\n" + 176 "@Target({TYPE_USE,_OTHER_})\n" + 177 "@ContainedBy( AC.class )\n" + 178 "@interface A { }\n\n" + 179 180 "@Retention("+retentn+")\n" + 181 "@Target({TYPE_USE,_OTHER_})\n" + 182 "@ContainerFor(A.class)\n" + 183 "@interface AC { A[] value(); }\n\n" + 184 185 "@Retention("+retentn+")\n" + 186 "@Target({TYPE_USE,_OTHER_})\n" + 187 "@ContainedBy( BC.class )\n" + 188 "@interface B { }\n\n" + 189 190 "@Retention("+retentn+")\n" + 191 "@Target({TYPE_USE,_OTHER_})\n" + 192 "@ContainerFor(B.class)\n" + 193 "@interface BC { B[] value(); } \n\n" + 194 195 "@Retention("+retentn+")\n" + 196 "@Target({TYPE_PARAMETER,_OTHER_})\n" + 197 "@interface C { }\n\n" + 198 199 "@Retention("+retentn+")\n" + 200 "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" + 201 "@ContainedBy(DC.class)\n" + 202 "@interface D { }\n\n" + 203 204 "@Retention("+retentn+")\n" + 205 "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" + 206 "@ContainerFor(D.class) \n" + 207 "@interface DC { D[] value(); }\n\n"); 208 209 // Test case sources with sample generated source. 210 switch(src) { 211 case 1: // repeating type annotations at class level 212 /* 213 * @A @B class Test1 { 214 * @A @B Test1(){} 215 * @A @B Integer i1 = 0; 216 * String @A @B [] @A @B [] sa = null; 217 * // type usage in method body 218 * String test(Test1 this, String param, String ... vararg) { 219 * Object o = new String [3]; 220 * return (String) null; 221 * }} 222 */ 223 source = new String( 224 "// (repeating) type annotations at class level. \n" + 225 "_As_ _Bs_ class " + testname + " {\n" + 226 "_As_ _Bs_ " + testname +"(){} \n" + | 157 String As = "@A", Bs = "@B", Ds = "@D"; 158 if(Arepeats) As = "@A @A"; 159 if(BDrepeats) { 160 Bs = "@B @B"; 161 Ds = "@D @D"; 162 } 163 if(ABmix) { As = "@A @B"; Bs = "@A @B"; Ds = "@D @D"; } 164 165 // Source to check for TYPE_USE and TYPE_PARAMETER annotations. 166 // Source base (annotations) is same for all test cases. 167 String source = new String(); 168 String imports = new String("import java.lang.annotation.*; \n" + 169 "import static java.lang.annotation.RetentionPolicy.*; \n" + 170 "import static java.lang.annotation.ElementType.*; \n" + 171 "import java.util.List; \n" + 172 "import java.util.HashMap; \n" + 173 "import java.util.Map; \n\n"); 174 175 String sourceBase = new String("@Retention("+retentn+")\n" + 176 "@Target({TYPE_USE,_OTHER_})\n" + 177 "@Repeatable( AC.class )\n" + 178 "@interface A { }\n\n" + 179 180 "@Retention("+retentn+")\n" + 181 "@Target({TYPE_USE,_OTHER_})\n" + 182 "@interface AC { A[] value(); }\n\n" + 183 184 "@Retention("+retentn+")\n" + 185 "@Target({TYPE_USE,_OTHER_})\n" + 186 "@Repeatable( BC.class )\n" + 187 "@interface B { }\n\n" + 188 189 "@Retention("+retentn+")\n" + 190 "@Target({TYPE_USE,_OTHER_})\n" + 191 "@interface BC { B[] value(); } \n\n" + 192 193 "@Retention("+retentn+")\n" + 194 "@Target({TYPE_PARAMETER,_OTHER_})\n" + 195 "@interface C { }\n\n" + 196 197 "@Retention("+retentn+")\n" + 198 "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" + 199 "@Repeatable(DC.class)\n" + 200 "@interface D { }\n\n" + 201 202 "@Retention("+retentn+")\n" + 203 "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" + 204 "@interface DC { D[] value(); }\n\n"); 205 206 // Test case sources with sample generated source. 207 switch(src) { 208 case 1: // repeating type annotations at class level 209 /* 210 * @A @B class Test1 { 211 * @A @B Test1(){} 212 * @A @B Integer i1 = 0; 213 * String @A @B [] @A @B [] sa = null; 214 * // type usage in method body 215 * String test(Test1 this, String param, String ... vararg) { 216 * Object o = new String [3]; 217 * return (String) null; 218 * }} 219 */ 220 source = new String( 221 "// (repeating) type annotations at class level. \n" + 222 "_As_ _Bs_ class " + testname + " {\n" + 223 "_As_ _Bs_ " + testname +"(){} \n" + |