mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
java: convert to atomic: workaround for AtomicBoolean api (IDEA-268471)
GitOrigin-RevId: e5476aeac6558b3ce43cb9039673af88cf06a2dc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
47579c0891
commit
a03762b5eb
@@ -218,7 +218,7 @@ public class AtomicConversionRule extends TypeConversionRule {
|
||||
}
|
||||
return new TypeConversionDescriptor("$qualifier$ = $val$", "$qualifier$.set($val$)");
|
||||
}
|
||||
if (PsiUtil.isLanguageLevel8OrHigher(context)) {
|
||||
if (PsiUtil.isLanguageLevel8OrHigher(context) && !PsiType.BOOLEAN.equals(from)) {
|
||||
final String name =
|
||||
JavaCodeStyleManager.getInstance(context.getProject()).suggestUniqueVariableName("v", context, false);
|
||||
return new TypeConversionDescriptor("$qualifier$" + sign + "$val$",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
// "Convert to atomic" "true"
|
||||
class A {
|
||||
final AtomicBoolean bool = new AtomicBoolean(false);
|
||||
void testAtomicBool() {
|
||||
bool.set(bool.get() | Math.random() > 0.5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Convert to atomic" "true"
|
||||
class A {
|
||||
boolean bo<caret>ol = false;
|
||||
void testAtomicBool() {
|
||||
bool |= Math.random() > 0.5;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user