| 1 |
import testlib.wholeprograminference.qual.*; |
| 2 |
|
| 3 |
public class AnnotationWithFieldTest { |
| 4 |
|
| 5 |
private String fields; |
| 6 |
|
| 7 |
private String emptyFields; |
| 8 |
|
| 9 |
void testAnnotationWithFields() { |
| 10 |
fields = getSiblingWithFields(); |
| 11 |
// :: error: (argument.type.incompatible) |
| 12 |
expectsSiblingWithFields(fields); |
| 13 |
} |
| 14 |
|
| 15 |
void testAnnotationWithEmptyFields() { |
| 16 |
emptyFields = getSiblingWithFieldsEmpty(); |
| 17 |
// :: error: (argument.type.incompatible) |
| 18 |
expectsSiblingWithEmptyFields(emptyFields); |
| 19 |
} |
| 20 |
|
| 21 |
void expectsSiblingWithFields( |
| 22 |
@SiblingWithFields( |
| 23 |
value = {"test", "test2"}, |
| 24 |
value2 = "test3") |
| 25 |
String s) {} |
| 26 |
|
| 27 |
void expectsSiblingWithEmptyFields( |
| 28 |
@SiblingWithFields( |
| 29 |
value = {}, |
| 30 |
value2 = "") |
| 31 |
String s) {} |
| 32 |
|
| 33 |
String getSiblingWithFields() { |
| 34 |
// :: warning: (cast.unsafe) |
| 35 |
return (@SiblingWithFields( |
| 36 |
value = {"test", "test2"}, |
| 37 |
value2 = "test3") |
| 38 |
String) |
| 39 |
""; |
| 40 |
} |
| 41 |
|
| 42 |
String getSiblingWithFieldsEmpty() { |
| 43 |
// :: warning: (cast.unsafe) |
| 44 |
return (@SiblingWithFields( |
| 45 |
value = {}, |
| 46 |
value2 = "") |
| 47 |
String) |
| 48 |
""; |
| 49 |
} |
| 50 |
} |