Skip to content

Commit

Permalink
endpoints - Provided test reproducing issue on annotation processing …
Browse files Browse the repository at this point in the history
…when annotation provides default value
  • Loading branch information
fcamblor committed Feb 10, 2018
1 parent d9f75ff commit 0745a78
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
55 changes: 29 additions & 26 deletions restx-samplest/src/main/java/samplest/annotations/MyAnnotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,40 @@
// (https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.6.1)
public @interface MyAnnotation {
// primitive types
byte aByte();
short aShort();
int anInt();
long aLong();
float aFloat();
double aDouble();
boolean aBool();
char aChar();
byte aByte() default 121;
short aShort() default 321;
int anInt() default 321;
long aLong() default 321;
float aFloat() default 564.321f;
double aDouble() default 564.321;
boolean aBool() default false;
char aChar() default 'B';

// Complex types
String aString();
Class aClass();
Class<? extends Number> aParameterizedTypeClass();
MyEnum anEnum();
String aString() default "BBB";
Class aClass() default String.class;
Class<? extends Number> aParameterizedTypeClass() default Integer.class;
MyEnum anEnum() default MyEnum.B;

// Another annotation
MyNestedAnnotation anAnnotation();
MyNestedAnnotation anAnnotation() default @MyNestedAnnotation({ "AAA" });

byte[] severalBytes();
short[] severalShorts();
int[] severalInts();
long[] severalLongs();
float[] severalFloats();
double[] severalDoubles();
boolean[] severalBools();
char[] severalChars();
byte[] severalBytes() default { 121, 121 };
short[] severalShorts() default { 654, 321 };
int[] severalInts() default { 654, 321 };
long[] severalLongs() default { 654, 321 };
float[] severalFloats() default { 654.321f, 123.456f};
double[] severalDoubles() default { 654.321, 123.456};
boolean[] severalBools() default { false, true };
char[] severalChars() default { 'C', 'B', 'A' };

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

MyNestedAnnotation[] severalAnnotations();
MyNestedAnnotation[] severalAnnotations() default {
@MyNestedAnnotation(value={ "AAA", "CCC" }),
@MyNestedAnnotation(value={ "BBB", "DDD" })
};
}
6 changes: 6 additions & 0 deletions restx-samplest/src/main/java/samplest/core/CoreResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,10 @@ public String deleteHello(String who) {
public String testingAnnotations() {
return "hello blah";
}

@GET("/testingAnnotationsWithDefaultValues")
@MyAnnotation
public String testingAnnotationsWithDefaultValues() {
return "hello blah";
}
}

0 comments on commit 0745a78

Please sign in to comment.