flankerhqd / type-inference

Automatically exported from code.google.com/p/type-inference
2 stars 1 forks source link

Reim-Infer chokes on static or block initializers #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Java file blah.java with the following contents:
public class blah {
  int a;
  {
    a = 1;
  }
}
2. Run binary/javai-reim blah.java

What is the expected output? What do you see instead?
java.lang.Error: Reim processor threw unexpected exception when processing 
blah.java

What version of the product are you using? On what operating system?
trunk from svn. Linux (Fedora 19) OpenJDK 1.7.0_51

Please provide any additional information below.
The reason is in checkers/inference/reim/ReimVisitor.java, checkMutable calls 
TreeUtils.enclosingMethod(getCurrentPath()).
Unfortunately, getCurrentPath() will not contain a METHOD element in case of 
static and non-static block initializers. The nesting will be
EXPRESSION > BLOCK > CLASS.

Original issue reported on code.google.com by darioush...@gmail.com on 6 Mar 2014 at 10:53

GoogleCodeExporter commented 9 years ago
Reim processor would not throw the exception under JDK 6.
Please run binary/javai-reim2 under JDK 7.
Thanks!

Original comment by dongya...@gmail.com on 8 Mar 2015 at 12:08

GoogleCodeExporter commented 9 years ago

Original comment by dongya...@gmail.com on 8 Mar 2015 at 3:52