mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
changes for IDEA-CR-7640
This commit is contained in:
+3
-3
@@ -21,6 +21,7 @@ import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.psiutils.ClassUtils;
|
||||
import com.siyeh.ig.psiutils.ExpressionUtils;
|
||||
import com.siyeh.ig.psiutils.ParenthesesUtils;
|
||||
import com.siyeh.ig.psiutils.TypeUtils;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -40,8 +41,7 @@ public class AtomicFieldUpdaterIssuesInspection extends BaseInspection {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String buildErrorString(Object... infos) {
|
||||
final String message = (String)infos[0];
|
||||
return message;
|
||||
return (String)infos[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@ public class AtomicFieldUpdaterIssuesInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final String fieldName = (String)value;
|
||||
final PsiExpression firstArgument = arguments[0];
|
||||
final PsiExpression firstArgument = ParenthesesUtils.stripParentheses(arguments[0]);
|
||||
if (!(firstArgument instanceof PsiClassObjectAccessExpression)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<html>
|
||||
<body>
|
||||
Reports issues on fields of type <b>java.util.concurrent.atomic.AtomicLongFieldUpdater</b>,
|
||||
<b>java.util.concurrent.atomic.AtomicIntegerFieldUpdater</b> or <b>java.util.concurrent.atomic.AtomicReferenceFieldUpdater</b>.
|
||||
The issues reported are identical to the runtime problems that can happen with atomic field updaters:
|
||||
@@ -11,6 +9,4 @@ specified field not found, specified field not accessible, specified field of th
|
||||
<p>
|
||||
<small>New in 16</small>
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
+15
-1
@@ -38,7 +38,7 @@ public class AtomicFieldUpdaterIssuesInspectionTest extends LightInspectionTestC
|
||||
"class A {" +
|
||||
" private static volatile int value = 0;" +
|
||||
" private static final AtomicIntegerFieldUpdater updater = " +
|
||||
" AtomicIntegerFieldUpdater.newUpdater(A.class, /*Field 'value' has 'static' modifier*/\"value\"/**/);" +
|
||||
" AtomicIntegerFieldUpdater.newUpdater((A.class), /*Field 'value' has 'static' modifier*/(\"value\")/**/);" +
|
||||
"}");
|
||||
}
|
||||
|
||||
@@ -100,6 +100,20 @@ public class AtomicFieldUpdaterIssuesInspectionTest extends LightInspectionTestC
|
||||
"}");
|
||||
}
|
||||
|
||||
/**
|
||||
* private fields are not accessible at runtime even from inner classes.
|
||||
*/
|
||||
public void testNotAccessible2() {
|
||||
doTest("import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;" +
|
||||
"class Z {" +
|
||||
" private volatile int value = 0;" +
|
||||
" static class A {\n" +
|
||||
" private static final AtomicIntegerFieldUpdater updater = \n" +
|
||||
" AtomicIntegerFieldUpdater.newUpdater(Z.class, /*'private' field 'value' is not accessible from here*/\"value\"/**/);\n" +
|
||||
" }" +
|
||||
"}");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
|
||||
Reference in New Issue
Block a user