You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ GuardedBy is used is wrong apparently to get rid of violations which indicate concurrency bugs, so high risk. Related to rule: NotProperlySynchronizingOnFieldWhileUsingGuardedBy
Example 1:
class Foo {
@GuardedBy("lock")
private Map<String, Product> cachedData = new HashMap<>();
}
And no lock field exists.
Example 2:
@Component
@ConfigurationProperties(prefix = "my-application")
@Getter
@Setter
public class MyApplicationConfig {
@GuardedBy("this")
private String bannerText;
@GuardedBy("this")
private String buttonText;
}
There is no synchronized on "this" involved. Used to get rid of the violation, it this case because of the @Component annotation. Proper fix is to make it @Configuration instead of @Component.
The text was updated successfully, but these errors were encountered:
@ GuardedBy is used is wrong apparently to get rid of violations which indicate concurrency bugs, so high risk. Related to rule: NotProperlySynchronizingOnFieldWhileUsingGuardedBy
Example 1:
And no
lock
field exists.Example 2:
There is no synchronized on "this" involved. Used to get rid of the violation, it this case because of the
@Component
annotation. Proper fix is to make it@Configuration
instead of@Component
.The text was updated successfully, but these errors were encountered: