mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] IDEA-378586 Impossible to compute constant for '\''
GitOrigin-RevId: ba58288dab3e558c1a1fe4529e8abe4ef26482fa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5991c4a01e
commit
ab51e442f6
@@ -162,7 +162,7 @@ public final class ConstantExpressionInspection extends AbstractBaseJavaLocalIns
|
||||
newExpression = '"' + StringUtil.escapeStringCharacters(string) + '"';
|
||||
}
|
||||
else if (value instanceof Character) {
|
||||
newExpression = '\'' + StringUtil.escapeStringCharacters(value.toString()) + '\'';
|
||||
newExpression = '\'' + StringUtil.escapeCharCharacters(value.toString()) + '\'';
|
||||
}
|
||||
else if (value instanceof Long) {
|
||||
newExpression = value.toString() + 'L';
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Compute constant value of 'SINGLE_QUOTE'" "true-preview"
|
||||
|
||||
class ConstantCast {
|
||||
public static final char SINGLE_QUOTE = '\'';
|
||||
|
||||
static void doSomething(Object o) {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
doSomething('\'');
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Compute constant value of 'SINGLE_QUOTE'" "true-preview"
|
||||
|
||||
class ConstantCast {
|
||||
public static final char SINGLE_QUOTE = '\'';
|
||||
|
||||
static void doSomething(Object o) {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
doSomething(SINGLE_QUOTE<caret>);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user