[abc-dev] Problems using abc

From: Chris Allan <mrchrisallan_at_googlemail.com>
Date: Wed, 3 Sep 2008 16:11:04 +0100

[I'm resending this message as I don't think it got through the first time
as I wasn't subscribed to the mailing list - apologies if anyone gets it
twice]

Hi,

I've recently been experimenting using abc and Tracematches for some work
I'm doing, and I ran into a couple of issues which are stopping me from
successfully weaving into my code. I don't know whether they're issues in
abc, in one of the components it uses, or just that I'm doing something
wrong, but I thought you guys might be interested in knowing about them (and
any help working around them would be very useful!).

Both are problems seen when using the abc-ja extension to weave into class
files (as opposed to source files), using release 1.3.0.

The first is to do with anonymous inner classes. If I take the following
class, compile it to a .class file (or a jar file), and then feed it to abc
(using options -ext abc.ja -source 1.5) , I get an error.

public class Test
{
  public Object t = new Object(){};
}

The error is

Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
exception during compilation
        at abc.main.CompileSequence.runSequence(CompileSequence.java:110)
        at abc.main.Main.run(Main.java:406)
        at abc.main.Main.main(Main.java:144)
Caused by: java.lang.RuntimeException: couldn't find class: Test.1 (is your
soot-class-path set properly?)
        at soot.SootResolver.bringToHierarchy(SootResolver.java:133)
        at soot.SootResolver.bringToSignatures(SootResolver.java:166)
        at soot.SootResolver.bringToBodies(SootResolver.java:207)
        at soot.SootResolver.processResolveWorklist(SootResolver.java:97)
        at soot.SootResolver.resolveClass(SootResolver.java:83)
        at soot.Scene.loadClass(Scene.java:390)
        at
abc.ja.jrag.TypeDecl.refined_AspectJCodegen_getSootClassDecl(TypeDecl.java:1593)
        at abc.ja.jrag.TypeDecl.getSootClassDecl_compute(TypeDecl.java:4337)
        at abc.ja.jrag.TypeDecl.getSootClassDecl(TypeDecl.java:4331)
        at abc.ja.jrag.ClassDecl.abcClass_compute(ClassDecl.java:1879)
        at abc.ja.jrag.ClassDecl.abcClass(ClassDecl.java:1873)
        at abc.ja.jrag.ClassDecl.jimplify1phase1(ClassDecl.java:431)
        at abc.ja.jrag.ASTNode.jimplify1phase1(ASTNode.java:601)
        at abc.ja.jrag.ASTNode.jimplify1phase1(ASTNode.java:601)
        at abc.ja.jrag.Program.jimplify1(Program.java:940)
        at abc.ja.CompileSequence.compile(CompileSequence.java:189)
        at abc.main.CompileSequence.runSequence(CompileSequence.java:100)
        ... 2 more

I also got a similar error when compiling against my code-base, but have
been unable to reproduce it exactly using smaller test input:

Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
exception during
 compilation
        at abc.main.CompileSequence.runSequence(CompileSequence.java:110)
        at abc.main.Main.run(Main.java:406)
        at abc.main.Main.main(Main.java:144)
Caused by: java.lang.NullPointerException
        at abc.ja.CompileSequence.compile(CompileSequence.java:147)
        at abc.main.CompileSequence.runSequence(CompileSequence.java:100)
        ... 2 more

(a debugger shows that CompileSequence.compile() calls

CompilationUnit u = program.getCompilationUnit(name);

where name is an anonymous inner class or interface, and gets a null pointer
returned.)

The second problem I'm seeing is to do with enumerations. When I compile a
Java enum via javac (version 1.6.0_02), and then run abc on the output with
the same options as above, I get the error

Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
exception during compilation
        at abc.main.CompileSequence.runSequence(CompileSequence.java:110)
        at abc.main.Main.run(Main.java:406)
        at abc.main.Main.main(Main.java:144)
Caused by: java.lang.RuntimeException: Attempting to add method void
<clinit>() to class A, but the class already has a method with that
signature.
        at soot.SootClass.addMethod(SootClass.java:580)
        at abc.ja.tm.jrag.TypeDecl.jimplify2(TypeDecl.java:1058)
        at abc.ja.tm.jrag.ASTNode.jimplify2(ASTNode.java:616)
        at abc.ja.tm.jrag.ASTNode.jimplify2(ASTNode.java:616)
        at abc.ja.tm.jrag.Program.jimplify2(Program.java:956)
        at abc.ja.tm.CompileSequence.compile(CompileSequence.java:163)
        at abc.main.CompileSequence.runSequence(CompileSequence.java:100)
        ... 2 more

Example input that causes the problem:

public enum A{A,B,C}

As I say, if anyone can point me in the direction of fixing or working
around these problems, that'd be great!

Thanks,

Chris
Received on Wed Sep 03 2008 - 16:11:08 BST

This archive was generated by hypermail 2.2.0 : Thu Sep 04 2008 - 21:40:11 BST