[Soot-list] Problems with jimple parser

Bernhard Berger berber at tzi.de
Tue Oct 2 01:09:50 EDT 2012


Hi Eric,

this is an interesting point. Since I did not look at the original
source file I did not recognize that it just exists for the package
annotation. The original source file:

@javax.xml.bind.annotation.XmlSchema(namespace = "...")
package com.example;

This file is translated into a java source file by javac without
warnings or errors. The bytecode contains the interface unparsed by soot
and it is marked synthetic. Javap prints the following output:

> $ javap -c -s com.example.package-info
interface com.example.package-info{
}

This code does not compile at all since  package-info is not a valid
class name. 

Perhaps I should use class files as output format.

Bernhard

@Eric: The first mail was sent accidentally to your address. Sorry.

On Mo, 2012-10-01 at 18:20 -0400, Eric Bodden wrote:
> Hi Bernhard.
> 
> I wonder: What does javac do with package-info.java files? Does it
> compile them to .class files at all? If not, then maybe Soot should
> not even output those files in the first place. After all, those files
> do not actually contain class definitions.
> 
> Eric
> 
> On 1 October 2012 10:22, Bernhard Berger <berber at tzi.de> wrote:
> > 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
> >
> >
> > _______________________________________________
> > Soot-list mailing list
> > Soot-list at sable.mcgill.ca
> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 
> 
> 

-- 
Dipl. Inf. Bernhard Berger

TZI – Universität Bremen, AG Softwaretechnik
E-Mail  berber at tzi.de
Telefon +49 421 218-64472



More information about the Soot-list mailing list