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

The JDK 21 compiler linter flags potential this-escape violations in DGS generated code #651

Open
Badbond opened this issue Feb 1, 2024 · 0 comments

Comments

@Badbond
Copy link

Badbond commented Feb 1, 2024

When compiling code generated by dgs-codegen using JDK 21 and having all linters enabled using the -Xlint:all compiler argument, then the compiler will raise a warning of a potential this-escape in some generated code.

I've created a minimal reproduction case for a violation in the constructor of a Mutation query, see: https://github.com/Badbond/dgs-codegen-reproduction-case-this-escape. We have also seen the issue being raised for a similar case in a Projection using a static initializer:

public class StateMachineFragmentProjection<PARENT extends BaseSubProjectionNode<?, ?>, ROOT extends BaseSubProjectionNode<?, ?>> extends BaseSubProjectionNode<PARENT, ROOT> {
  {
    getFields().put("__typename", null);
  }

  public StateMachineFragmentProjection(PARENT parent, ROOT root) {
    super(parent, root, java.util.Optional.of("StateMachine"));
  }

See also JDK-8299995.

Environment:

  • Maven 3.9.5.
  • JDK 21.0.2-tem.
  • DGS codegen 6.1.3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant