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

Avoid SuppressWarnings of "this-escape" in Java Setting hierarchy #16542

Open
andsel opened this issue Oct 11, 2024 · 1 comment · May be fixed by #16543
Open

Avoid SuppressWarnings of "this-escape" in Java Setting hierarchy #16542

andsel opened this issue Oct 11, 2024 · 1 comment · May be fixed by #16543

Comments

@andsel
Copy link
Contributor

andsel commented Oct 11, 2024

With #16496 and commit 5ca0686 in #16490 were introduced some @SupressWarning annotations to avoid errors with JDK 21 like:

/buildkite/builds/bk-agent-prod-k8s-1728654414425952824/elastic/logstash-pull-request-pipeline/logstash-core/src/main/java/org/logstash/settings/BaseSetting.java:105: warning: [this-escape] possible 'this' escape before subclass is fully initialized
--
  | validate(defaultValue);
  | ^pileJava
  | error: warnings found and -Werror specified
  | 1 error
  | 1 warning
  |  
  | > Task :logstash-core:compileJava FAILED
  |  
  | FAILURE: Build failed with an exception.


As per comment #16490 (review) this issue is to ask for removal of such annotations and leverage static method instead of calling instance methods on non-completely initialised instances.

@andsel
Copy link
Contributor Author

andsel commented Oct 11, 2024

Shaped the rough idea in #16543 but still coerce method is harder to avoid

T coercedDefault = coerce(defaultValue);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant