IDEA-138441 Methods named like getters are wrongly treated as pure

don't track state for primitive get* methods
for reference-typed methods, track state only inside "if (getX() != null) ..."
flush dfa variables on non-pure getter-like calls
This commit is contained in:
peter
2015-05-18 17:02:51 +02:00
parent 069adff3dd
commit d27b4997b9
6 changed files with 45 additions and 17 deletions
@@ -0,0 +1,21 @@
class A {
private String s;
private int next = 0;
public A(final String s) {
this.s = s;
}
private char getChar() {
return s.charAt(next++);
}
private void foo() {
char c = getChar();
if (c == 'a') {
if (getChar() == 'b') {
System.out.println("ab");
}
}
}
}