Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeChecker crashes when foreach variable has a final modifier #23

Closed
mernst opened this issue Jun 14, 2015 · 1 comment
Closed

RuntimeChecker crashes when foreach variable has a final modifier #23

mernst opened this issue Jun 14, 2015 · 1 comment

Comments

@mernst
Copy link
Member

mernst commented Jun 14, 2015

Originally reported on Google Code with ID 23

What steps will reproduce the problem?
1. javac -g -d bin src/com/example/ForStmt.java 
2. java -cp bin:daikon.jar daikon.Chicory --daikon com.example.ForStmt
3. java -cp daikon.jar:bin daikon.tools.runtimechecker.Main  instrument ForStmt.inv.gz
src/com/example/ForStmt.java

What is the expected output? What do you see instead?
Reading invariant file: ForStmt.inv.gz
Parsing file src/com/example/ForStmt.java
jtb.ParseException: Parse error at line 21, column 46.  Encountered: :
    at jtb.JavaParser.generateParseException(JavaParser.java:8606)
    at jtb.JavaParser.jj_consume_token(JavaParser.java:8556)
    at jtb.JavaParser.ForStatement(JavaParser.java:4513)
    at jtb.JavaParser.Statement(JavaParser.java:3785)
    at jtb.JavaParser.BlockStatement(JavaParser.java:3991)
    at jtb.JavaParser.Block(JavaParser.java:3926)
    at jtb.JavaParser.MethodDeclaration(JavaParser.java:1312)
    at jtb.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1011)
    at jtb.JavaParser.ClassOrInterfaceBody(JavaParser.java:919)
    at jtb.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:529)
    at jtb.JavaParser.TypeDeclaration(JavaParser.java:437)
    at jtb.JavaParser.CompilationUnit(JavaParser.java:206)
    at daikon.tools.jtb.ParseResults.parse(ParseResults.java:77)
    at daikon.tools.jtb.ParseResults.parse(ParseResults.java:50)
    at daikon.tools.runtimechecker.InstrumentHandler.handle(InstrumentHandler.java:109)
    at daikon.tools.runtimechecker.Main.nonStaticMain(Main.java:45)
    at daikon.tools.runtimechecker.Main.main(Main.java:71)
Throwable thrown while handling command:java.lang.Error: jtb.ParseException: Parse
error at line 21, column 46.  Encountered: :
java.lang.Error: jtb.ParseException: Parse error at line 21, column 46.  Encountered:
:
    at daikon.tools.jtb.ParseResults.parse(ParseResults.java:99)
    at daikon.tools.jtb.ParseResults.parse(ParseResults.java:50)
    at daikon.tools.runtimechecker.InstrumentHandler.handle(InstrumentHandler.java:109)
    at daikon.tools.runtimechecker.Main.nonStaticMain(Main.java:45)
    at daikon.tools.runtimechecker.Main.main(Main.java:71)
Caused by: jtb.ParseException: Parse error at line 21, column 46.  Encountered: :
    at jtb.JavaParser.generateParseException(JavaParser.java:8606)
    at jtb.JavaParser.jj_consume_token(JavaParser.java:8556)
    at jtb.JavaParser.ForStatement(JavaParser.java:4513)
    at jtb.JavaParser.Statement(JavaParser.java:3785)
    at jtb.JavaParser.BlockStatement(JavaParser.java:3991)
    at jtb.JavaParser.Block(JavaParser.java:3926)
    at jtb.JavaParser.MethodDeclaration(JavaParser.java:1312)
    at jtb.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1011)
    at jtb.JavaParser.ClassOrInterfaceBody(JavaParser.java:919)
    at jtb.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:529)
    at jtb.JavaParser.TypeDeclaration(JavaParser.java:437)
    at jtb.JavaParser.CompilationUnit(JavaParser.java:206)
    at daikon.tools.jtb.ParseResults.parse(ParseResults.java:77)
    ... 4 more
The instrumenter failed.

What version of the product are you using? On what operating system?
Revision 27b35b7e3299   (Nov 27th) on a MAC OS

Please provide any additional information below.
I think that the problem is triggered when a "final" modifier is used in a forach enumeration.
Like:
        ForStmt iterable = new ForStmt(x);
        int count = 0;
        for (final ForStmt myForStmt : iterable) {
            count += myForStmt.getValue();
        }

Reported by jgaleotti on 2013-12-05 13:51:09


- _Attachment: [daikon_bug9.zip](https://storage.googleapis.com/google-code-attachments/daikon/issue-23/comment-0/daikon_bug9.zip)_
@mernst
Copy link
Member Author

mernst commented Jun 14, 2015

WE have updated parser grammar and regenerated the parser .java files.  The runtimechecker
now parses this file correctly.

Reported by markro@cs.washington.edu on 2015-04-10 18:12:30

  • Status changed: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant