Bug 106874 - VerifyError with inner class, field set, and -1.5 switch
Summary: VerifyError with inner class, field set, and -1.5 switch
Status: RESOLVED DUPLICATE of bug 109124
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.5.0 M4   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-12 12:41 EDT by Samuel Gélineau CLA
Modified: 2005-09-09 07:18 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Gélineau CLA 2005-08-12 12:41:12 EDT
the folowing fails at runtime with a VerifyError.
the bug only occurs if the weaved in class is an inner class,
the pointcut is a set(* *.*) with the type and field name part left as "*" (a
pattern such as "f*" doesn't trigger the bug for instance),
the target of the pointcut is bounded to an advice declaration,
and the "-1.5" switch is used when calling ajc.


public class Bug {
  class Inner { // works if static
    private Integer field;
    void bug() {
      field = new Integer(0);
    }
  }

  public static void main(String[] args) {
    new Bug().new Inner().bug();
  }
}

aspect Aspect {
  before(Object t) :
    // target(Object) && // works
    // this(t) && // works
    target(t) && // fails
    // set(* Bug.Inner.field) // works
    // set(Integer Bug.Inner.*) // works
    // get(* Bug.Inner.*) // works
    set(* Bug.Inner.*) // fails
  {}
}


Exception in thread "main" java.lang.VerifyError: (class: Bug$Inner, method:
<init> signature: (LBug;)V) Expecting to find object/array on stack
        at Bug.main(Bug.java:10)
Comment 1 Adrian Colyer CLA 2005-08-12 17:21:26 EDT
just a quick note to say... we really appreciate the excellent bug reports that you submit with easily 
reproducable test cases. You're obviously pushing the new AspectJ support to the limits which is great. 
What is your project using aspectj for if you don't mind me asking ? 
Comment 2 Samuel Gélineau CLA 2005-08-12 21:29:54 EDT
(In reply to comment #1)
see "http://www.cs.mcgill.ca/~joerg/sel/research/optima.html"

it's a framework for multithreaded programming which allows application
programmers to separate their work into (multithreaded) atomic components which
get automatically undone if an exception is thrown past its boundary.

we decided to use aspectj because we needed to keep track of all the field
modifications in order to undo them, but I got carried away and used aspectj all
over the place because I feel inter-type declarations allow me to modularize my
work better.

I am also a big fan of the new syntactic features of java 1.5, which is why I am
using your new development branches intead of using abc, the alternative aspectj
compiler from my university.

unfortunately, pushing the limits of aspectj has led me to discover the
limitations of its pointcut syntax. for now, I am bothered by the fact that
although we can easily write code around all "get(* *.*)" statements inside "*
foo(..)" bodies, I could not figure a way of writing code around all "* foo(..)"
executions containing "get(* *.*)" statements. as you may know, more powerful
and programmable pointcut languages are being suggested by university folks (for
instance see "www.st.informatik.tu-darmstadt.de"), but available implementations
don't support my favorite 1.5 extensions, so aspectj still wins; keep up the
good work!
Comment 3 Adrian Colyer CLA 2005-08-26 11:44:40 EDT
for M4
Comment 4 Adrian Colyer CLA 2005-09-09 07:18:49 EDT
didn't realise it at the time, but pr109124 was a duplicate of this. I've fixed
that bug, and just verified that it also fixes the problem reported here, so
this is now fixed and you can pick up the fix from the AspectJ download page
later on today.

Thanks, Adrian.

*** This bug has been marked as a duplicate of 109124 ***