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

[java] UnsynchronizedStaticFormatter false-positive in static constructor #1895

Open
boris-petrov opened this issue Jun 30, 2019 · 0 comments
Labels
a:false-positive PMD flags a piece of code that is not problematic

Comments

@boris-petrov
Copy link
Contributor

boris-petrov commented Jun 30, 2019

PMD version:
6.16.0+
7.0.0

Thank you for fixing the other issue with UnsynchronizedStaticFormatter!

However, the new version has a bug:

public class Foo {
	private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance();

	static {
		NUMBER_FORMAT.setGroupingUsed(false);
	}

...

This raises a warning while it shouldn't as using the variable unsynchronized in the static constructor is totally fine.

@adangel adangel changed the title [java] UnsynchronizedStaticFormatter false-negative in static constructor [java] UnsynchronizedStaticFormatter false-positive in static constructor Jul 1, 2019
@adangel adangel added the a:false-positive PMD flags a piece of code that is not problematic label Jul 1, 2019
@jsotuyod jsotuyod added the needs:pmd7-revalidation The issue hasn't yet been retested vs PMD 7 and may be stale label Mar 17, 2024
@jsotuyod jsotuyod removed the needs:pmd7-revalidation The issue hasn't yet been retested vs PMD 7 and may be stale label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
None yet
Development

No branches or pull requests

3 participants