Skip to content

Commit 0745a78

Browse files
committed
endpoints - Provided test reproducing issue on annotation processing when annotation provides default value
1 parent d9f75ff commit 0745a78

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

restx-samplest/src/main/java/samplest/annotations/MyAnnotation.java

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,40 @@
44
// (https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.6.1)
55
public @interface MyAnnotation {
66
// primitive types
7-
byte aByte();
8-
short aShort();
9-
int anInt();
10-
long aLong();
11-
float aFloat();
12-
double aDouble();
13-
boolean aBool();
14-
char aChar();
7+
byte aByte() default 121;
8+
short aShort() default 321;
9+
int anInt() default 321;
10+
long aLong() default 321;
11+
float aFloat() default 564.321f;
12+
double aDouble() default 564.321;
13+
boolean aBool() default false;
14+
char aChar() default 'B';
1515

1616
// Complex types
17-
String aString();
18-
Class aClass();
19-
Class<? extends Number> aParameterizedTypeClass();
20-
MyEnum anEnum();
17+
String aString() default "BBB";
18+
Class aClass() default String.class;
19+
Class<? extends Number> aParameterizedTypeClass() default Integer.class;
20+
MyEnum anEnum() default MyEnum.B;
2121

2222
// Another annotation
23-
MyNestedAnnotation anAnnotation();
23+
MyNestedAnnotation anAnnotation() default @MyNestedAnnotation({ "AAA" });
2424

25-
byte[] severalBytes();
26-
short[] severalShorts();
27-
int[] severalInts();
28-
long[] severalLongs();
29-
float[] severalFloats();
30-
double[] severalDoubles();
31-
boolean[] severalBools();
32-
char[] severalChars();
25+
byte[] severalBytes() default { 121, 121 };
26+
short[] severalShorts() default { 654, 321 };
27+
int[] severalInts() default { 654, 321 };
28+
long[] severalLongs() default { 654, 321 };
29+
float[] severalFloats() default { 654.321f, 123.456f};
30+
double[] severalDoubles() default { 654.321, 123.456};
31+
boolean[] severalBools() default { false, true };
32+
char[] severalChars() default { 'C', 'B', 'A' };
3333

34-
String[] severalStrings();
35-
Class[] severalClasses();
36-
Class<? extends Number>[] severalParameterizedTypeClasses();
37-
MyEnum[] severalEnums();
34+
String[] severalStrings() default { "CCC", "BBB", "AAA" };
35+
Class[] severalClasses() default { String.class, Integer.class };
36+
Class<? extends Number>[] severalParameterizedTypeClasses() default { Integer.class, Long.class, Double.class };
37+
MyEnum[] severalEnums() default { MyEnum.B, MyEnum.A };
3838

39-
MyNestedAnnotation[] severalAnnotations();
39+
MyNestedAnnotation[] severalAnnotations() default {
40+
@MyNestedAnnotation(value={ "AAA", "CCC" }),
41+
@MyNestedAnnotation(value={ "BBB", "DDD" })
42+
};
4043
}

restx-samplest/src/main/java/samplest/core/CoreResource.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,10 @@ public String deleteHello(String who) {
103103
public String testingAnnotations() {
104104
return "hello blah";
105105
}
106+
107+
@GET("/testingAnnotationsWithDefaultValues")
108+
@MyAnnotation
109+
public String testingAnnotationsWithDefaultValues() {
110+
return "hello blah";
111+
}
106112
}

0 commit comments

Comments
 (0)