Re: [abc-dev] Fwd:

From: Chris Allan <mrchrisallan_at_googlemail.com>
Date: Thu, 11 Sep 2008 13:08:47 +0100

Hi Pavel,

Thanks for looking at the problems I'm having. I'll try to provide more
information on the problem you couldn't reproduce:

I've got a single source file, Test.java, containing
public class Test
{
  @B
  int i;
}
public @interface B
{
}

I run the source through abc, which generates two class files, as expected.
If I run these through abc, I get an exception. I've pasted the full output
for the commands below, using the -verbose flag. I got the latest abc code
this morning:

C:\abc-latest\abc-full\abc-ja\lib>java -jar abc-ja-complete.jar -source 1.5
-ext abc.ja -sourceroots c:\temp\test-src -d c:\temp\test-target -verbose
abc started on Thu Sep 11 13:01:16 BST 2008
Loading .java file: c:\temp\test-src\Test.java in 813 ms
Warning: Could not use c:\jdk1.6.0_02\jre\lib\sunrsasign.jar as class path
Warning: Could not use c:\jdk1.6.0_02\jre\classes as class path
Warning: Could not use C:\WINDOWS\Sun\Java\lib\ext as class path
Error checking
Loading .class file: java.lang.Object from c:\jdk1.6.0_02\jre\lib\rt.jar in
16 ms
Loading .class file: java.lang.annotation.Target from
c:\jdk1.6.0_02\jre\lib\rt.jar in 0 ms
Loading .class file: java.lang.Deprecated from c:\jdk1.6.0_02\jre\lib\rt.jar
in 16 ms
Loading .class file: java.lang.Throwable from c:\jdk1.6.0_02\jre\lib\rt.jar
in 0 ms
Loading .class file: java.lang.annotation.Annotation from
c:\jdk1.6.0_02\jre\lib\rt.jar in 0 ms
Weaving inter-type declarations
Flattening Nested Classes
Jimplify1
Creating from source Test
Loading .class file java.lang.Object
Creating from source B
Loading .class file: java.lang.annotation.Retention from
c:\jdk1.6.0_02\jre\lib\rt.jar in 0 ms
Loading .class file java.lang.annotation.Annotation
Jimplify2
Transforming Test...
Transforming B...
Writing to c:\temp\test-target\Test.class
Writing to c:\temp\test-target\B.class
abc finished on Thu Sep 11 13:01:20 BST 2008. ( 0 min. 4 sec. )

C:\abc-latest\abc-full\abc-ja\lib>java -jar abc-ja-complete.jar -source 1.5
-ext abc.ja -inpath c:\temp\test-target -d c:\temp\test-target1 -verbose
abc started on Thu Sep 11 13:01:27 BST 2008
Warning: Could not use c:\jdk1.6.0_02\jre\lib\sunrsasign.jar as class path
Warning: Could not use c:\jdk1.6.0_02\jre\classes as class path
Warning: Could not use C:\WINDOWS\Sun\Java\lib\ext as class path
Loading .class file: B from c:\temp\test-target\B.class in 16 ms
Loading .class file: Test from c:\temp\test-target\Test.class in 16 ms
Error checking
Weaving inter-type declarations
Loading .class file: java.lang.Object from c:\jdk1.6.0_02\jre\lib\rt.jar in
15 ms
Flattening Nested Classes
Jimplify1
Loading .class file B
Loading .class file Test
Loading .class file java.lang.Object
Loading .class file: java.lang.annotation.Annotation from
c:\jdk1.6.0_02\jre\lib\rt.jar in 0 ms
Loading .class file: java.lang.annotation.Retention from
c:\jdk1.6.0_02\jre\lib\rt.jar in 15 ms
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.jrag.FieldDeclaration.addAttributes(FieldDeclaration.java:364)
        at
abc.ja.jrag.FieldDeclaration.jimplify1phase2(FieldDeclaration.java:346)
        at abc.ja.jrag.TypeDecl.jimplify1phase2(TypeDecl.java:1061)
        at abc.ja.jrag.ClassDecl.jimplify1phase2(ClassDecl.java:430)
        at abc.ja.jrag.ASTNode.jimplify1phase2(ASTNode.java:601)
        at abc.ja.jrag.ASTNode.jimplify1phase2(ASTNode.java:601)
        at abc.ja.jrag.Program.jimplify1(Program.java:898)
        at abc.ja.CompileSequence.compile(CompileSequence.java:118)
        at abc.main.CompileSequence.runSequence(CompileSequence.java:100)
        ... 2 more

I had a very quick look at what was going on, and it seems that when
processing the .class files, the field
abc.ja.jrag.FieldDeclaration.sootField never gets set, because the
conditional at FieldDeclaration line 329 [
if(!hostType().getSootClassDecl().declaresFieldByName(name)) ] returns false
when looking for the field 'i' - when compiling from source, this expression
evaluates to true. I don't know what the significance of this is though, so
I gave up investigating! Please let me know if I can provide any more
information.

Cheers,

Chris

On Wed, Sep 10, 2008 at 1:41 PM, Pavel Avgustinov <pavel_at_comlab.ox.ac.uk>wrote:

> Hi Chris,
>
> Good to hear from you! Sorry for the delay in replying to this, last week
> was
> rather hectic.
>
> > Example input that causes the problem:
> >
> > public enum A{A,B,C}
>
> This has been fixed in SVN head; thanks for reporting it.
>
> > Using the same options as described below, both of the following classes
> > compile fine from Java source, but errors are generated when trying to
> > weave into the outputted .class files. (Is this the right place to be
> > reporting these errors?)
> >
> >
> > public class Test1
> > {
> > public interface IF{};
> > public IF test(){return null;}
> > }
> >
> > results in:
> >
> > Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
> > exception during compilation
>
> This has been fixed in svn HEAD, for the abc.ja extension. Unfortunately
> it's
> currently a bug in the CompileSequence class, which is overridden by each
> extension, so the problem will currently still be present in abc.ja.eaj and
> abc.ja.tm.
>
> I'm working on a slight refactoring that will shift the burden into a
> JastAdd
> aspect, allowing extensions to inherit the fixed behaviour. Hopefully this
> will be done by the end of the day.
>
> > The second error is with:
> >
> > public class Test
> > {
> > @B
> > int i;
> > }
> >
> > public @interface B
> > {
> > }
> >
> > Which gives:
> >
> > Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
> > exception during compilation
>
> I'm afraid I can't reproduce this. Can you give any further information
> that
> might help? The complete abc command line might be useful... also, does it
> happen with recent abc builds?
>
> Cheers,
> - Pavel
>
>
Received on Thu Sep 11 2008 - 13:08:54 BST

This archive was generated by hypermail 2.2.0 : Thu Sep 11 2008 - 15:00:11 BST