[Soot-list] Problems with jimple parser

Bernhard Berger berber at tzi.de
Mon Oct 1 09:22:05 EDT 2012


Hi folks,

I came across a problem in the Jimple parser when I loaded jimple files
that were unparsed in a previous run of soot. In particular, there is a
class called package-info in my code base that triggers the problem.

> interface com.example.xml.package-info extends java.lang.Object
> {
> }

The parser is not able to parse the file because of the - in the class
name. The location of the parser error gives the hint that the - is not
expected at this point.

> Exception in thread "main" soot.jimple.parser.parser.ParserException: 
> [1,34] expecting: 'extends', 'implements', '{'
> at soot.jimple.parser.parser.Parser.parse(Parser.java:1454)
> at soot.jimple.parser.Parse.main(Parse.java:138)

There are different solutions for this problem but I think the easiest
one would be to surround the class name with quotes. Currently class
names are just quoted if they are equally to one of jimple's keywords.
Therefore, each class name is passed to Scene.quotedNameOf(). The
easiest solution would be to quote every class name (this leads to
larger jimple files). Does someone know a better solution? My first idea
was to change the parser but I did not find an easy way to fix this
problem.

Bernhard




More information about the Soot-list mailing list