Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling annotations metadata generation unsupported cases #286

Merged
merged 6 commits into from May 4, 2018

Conversation

Projects
None yet
2 participants
@fcamblor
Copy link
Contributor

fcamblor commented Feb 10, 2018

0.35 has introduced a new feature allowing to provide endpoint annotation metadata on RestxResources

However, some special cases are not currently handled by annotation processor and result into compilation errors in generated code.

This PR aims at fixing these special cases, particularly :

  • Annotation values having a default value defined, and relying upon this default value on its declaration (I mean, not re-defining this value when declaring the annotation), for instance :
public @interface MyAnnotation {
    int anInt() default 321;
    String aString() default "BBB";
    Class aClass() default String.class;
}

... then used that way :

@RestxResource("/core") @Component
public class CoreResource {
    @GET("/testingAnnotationsWithDefaultValues")
    @MyAnnotation // Relying upon at least 1 default value here
    public String testingAnnotationsWithDefaultValues() {
        return "hello blah";
    }
}
  • Annotation values having Parameterized types : the only case I identified is having an annotation field of type Class<WhateverHere>, for instance :
public @interface MyAnnotation {
    Class<? extends Number> aParameterizedTypeClass();
}
  • Annotation values having a Parameterized array type : here again, the only case I identified is having an annotation field of type Class<WhateverHere>[] (but implementation should not be Class-specific), for instance :
public @interface MyAnnotation {
    Class<? extends Number>[] severalParameterizedTypeClasses();
}

@fcamblor fcamblor added the bug label Feb 10, 2018

@fcamblor fcamblor self-assigned this Feb 10, 2018

@fcamblor fcamblor requested review from xhanin and a-peyrard Feb 10, 2018

@xhanin

xhanin approved these changes Feb 13, 2018

Copy link
Contributor

xhanin left a comment

Sounds good to me, good job!

@fcamblor fcamblor changed the base branch from master to 0.35-fixes May 4, 2018

@fcamblor fcamblor merged commit 830010b into restx:0.35-fixes May 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.