[Soot-list] problem on anonymous class

Kouhei Sakurai sakurai at graco.c.u-tokyo.ac.jp
Mon Mar 26 22:14:19 EDT 2007


Hi,

I am a user of the Aspect Bench compiler.
I saw a problem about compilation on a large project.
The problem was that the abc cannot compile some classes which  
contain an anonymous class.

I think the soot framework has a bug around compilation of anonymous  
class which calls private methods.
The following sample code will fail compilation with the abc:
---------
public class Example {
     public void run() {
         new Runnable() {
             public void run() {
                 try {
                     privateRun();
                 } catch (Exception e){
                 }
             }
         }.run();
     }

     private void privateRun() throws Exception {
         throw new Exception();
     }

     public static void main(String[] args) {
         new Example().run();
     }
  }
---------
 > Example.java: The exception java.lang.Exception must be either  
caught or
 >     declared to be thrown in method <Example: void access$000 
(Example)>
 > 1 error.

Probably the reason is that the soot framework does not copy the  
"throws" clause of an outside private method to an access$XXX method.

Thank you,

Kouhei Sakurai





More information about the Soot-list mailing list