Skip to content

Reim-Infer chokes on static or block initializers #6

@GoogleCodeExporter

Description

@GoogleCodeExporter
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions