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

jooby-apt: should NOT generate metadata for defaults annotation attributes #3526

Closed
jknack opened this issue Sep 14, 2024 · 0 comments
Closed

Comments

@jknack
Copy link
Member

jknack commented Sep 14, 2024

Given:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Role {
  String value();

  String level() default "one";
}

With:

@GET
  @Path("/secure")
  @Role("User")
  public String secured() {
    return "OK!";
  }

The Role.level: one was accesible from filter:

String level = ctx.getRoute().attribute("Role.level");

This generate a lot of garbage making javac to fail/hung see #3525. Next release default values won't be generated any more so previous code must be replaced (when needed) with:

String level = (String) ctx.getRoute().getAttributes().getOrDefault("Role.level", "one");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant