IDEA-127533 int field is displayed as char - show \n etc as chars

master
Egor.Ushakov 7 years ago
parent 844177d33e
commit bbc76e7cb4
  1. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
  2. BIN
      testData/classes/pkg/TestPrimitives.class
  3. 46
      testData/results/TestPrimitives.dec
  4. 6
      testData/src/pkg/TestPrimitives.java

@ -371,7 +371,8 @@ public class ConstExprent extends Exprent {
// BYTECHAR and SHORTCHAR => CHAR in the CHAR context
if (expectedType.equals(VarType.VARTYPE_CHAR) &&
(constType.equals(VarType.VARTYPE_BYTECHAR) || constType.equals(VarType.VARTYPE_SHORTCHAR))) {
if (isPrintableAscii(getIntValue())) {
int intValue = getIntValue();
if (isPrintableAscii(intValue) || CHAR_ESCAPES.containsKey(intValue)) {
setConstType(VarType.VARTYPE_CHAR);
}
}

@ -74,11 +74,17 @@ public class TestPrimitives {
boolean res = c > -1;// 77
res = c > 0;// 78
res = c > 1;// 79
res = c > 'a';// 80
res = c > 'Z';// 81
res = c > 127;// 82
res = c > 255;// 83
return res;// 84
res = c > '\b';// 80
res = c > '\t';// 81
res = c > '\n';// 82
res = c > '\f';// 83
res = c > '\r';// 84
res = c > ' ';// 85
res = c > 'a';// 86
res = c > 'Z';// 87
res = c > 127;// 88
res = c > 255;// 89
return res;// 90
}
}
@ -241,9 +247,27 @@ class 'pkg/TestPrimitives' {
3b 78
43 78
45 79
48 79
50 79
52 80
47 79
4f 79
51 80
53 80
5b 80
5d 81
5f 81
67 81
69 82
6b 82
73 82
75 83
77 83
7f 83
81 84
83 84
8b 84
8d 85
90 85
98 85
9a 86
}
}
@ -291,3 +315,9 @@ Lines mapping:
82 <-> 79
83 <-> 80
84 <-> 81
85 <-> 82
86 <-> 83
87 <-> 84
88 <-> 85
89 <-> 86
90 <-> 87

@ -77,6 +77,12 @@ public class TestPrimitives {
boolean res = (c > -1);
res = (c > 0);
res = (c > 1);
res = (c > '\b');
res = (c > '\t');
res = (c > '\n');
res = (c > '\f');
res = (c > '\r');
res = (c > ' ');
res = (c > 'a');
res = (c > 'Z');
res = (c > 127);

Loading…
Cancel
Save