Bug 80430 - JSR 45 support (was: withincode aspect crashes recent IBM 1.4.2 JVMs)
Summary: JSR 45 support (was: withincode aspect crashes recent IBM 1.4.2 JVMs)
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 88279 (view as bug list)
Depends on:
Blocks: 82544
  Show dependency tree
 
Reported: 2004-12-07 17:22 EST by Ray Ellis CLA
Modified: 2007-02-14 05:56 EST (History)
1 user (show)

See Also:


Attachments
zip of Eclipse project that illustrates bug (78.69 KB, application/octet-stream)
2004-12-07 17:31 EST, Ray Ellis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Ellis CLA 2004-12-07 17:22:07 EST
Code generated from the following aspect

	// Do nothing when setFoo is called from within eUnset
	void around() :
		call(void AClass.setFoo(..))
		&& withincode(void AClass+.eUnset(..))
	{
		return;
	}

causes recent IBM 1.4.2 JVMs to core dump.  (I have a small Eclipse project 
where this aspect is applied to classes generated by the EMF framework from a 
simple one-class, two-attribute model.)
Comment 1 Ray Ellis CLA 2004-12-07 17:31:42 EST
Created attachment 16444 [details]
zip of Eclipse project that illustrates bug

crashes IBM 1.4.2 JVMs built 6/26
works on earlier IBM 1.4.2 JVMs, and Sun JVMs
doesn't crash if you build project without aspects
Comment 2 Andrew Clement CLA 2004-12-08 06:28:48 EST
Can I ask what version of Eclipse, what version of AJDT and what version of EMF
you are using?  

I've tried to recompile the code at the command line, and it doesn't fail for
me.  But I am using the only 1.4.2 I can get hold of, IBM 1.4.2 SR1 build date
20040926 which is more recent than yours - are you stuck with that older version
or can you try something more recent?  We have had a recent situation where a
particular build of an IBM JVM had problems running AJDT but I don't think it
was failing during compilation, it was failing much sooner than that.
Comment 3 Ray Ellis CLA 2004-12-08 14:06:45 EST
I'm using Eclipse 3.0.1.1, build ID 200410121820; AJDT 1.1.12 w/ AspectJ 1.2.0; 
all on Windows 2000, SP4

By "it doesn't fail for me," do you mean it builds ok, or that it runs 
successfully?  The code compiles and weaves successfully for me under, say, the 
IBM 20040926 JVM, but the JVM crashes while executing the resulting code.  

And no, thankfully I'm not stuck using the older JVM.  In fact, I'd like to 
move to a newer version, but for the moment only the older ones (20040626 and 
before) seem to work.
Comment 4 Andrew Clement CLA 2004-12-20 12:22:05 EST
The SMAP (for JSR45 support) in the woven class file just doesn't seem right to
me and the IBM JVMs doesn't like it if it isn't right - I guess it is doing more
verification than other JVMs.  Here is the data:

SMAP
AClassImpl.java
AspectJ
*S AspectJ
*F
1 AClassImpl.java
+ 2 LazyLoader.aj
com/ibm/aspectfailure/LazyLoader.aj
*L
1#1,0:1,1
1#2,16:101,1

The line info just doesn't look right.  The two lines there say:
1#1,0:1,1 > For this woven file, starting at line 1 there are zero lines
corresponding to file id#1 (AClassImpl.java)
1#2,16:101,1 > For this woven file, starting at line 1, there are 16 lines
corresponding to lines 101->117 in file id#2 (LazyLoader.aj)

Now, LazyLoader doesn't have 100 lines, and only a portion of the woven file
should correspond to it, certainly not starting from line 1.

If I modify the compiler to omit creation of the 2nd bit of line info, the
resulting code runs OK on the IBM JVM.

Trying to make sense of the data, it should be something like:

<placeWhereAdviceInlined>#2,<lengthOfInlinedCode>:<lineInAspectWhereInlinedCodeOriginated>,1

The number '16' is correct (from the bad line we put out), and fits in field 3,
it is the lineInAspectWhereInlinedCodeOriginated.  I'm still working on where to
get the other data from ...
Comment 5 Andrew Clement CLA 2004-12-20 15:48:42 EST
I've got my inputs and outputs mixed up !!!

the first line still looks incorrect, but the second line:

1#2,16:101,1

actually means:

Lines 1-16 of input file 2 (LazyLoader.aj) map to lines 101-102 in the 'output'
file AClassImpl.class.  I now have a patched version of AJ where I can get the
correct lines for the inlined advice (so I know the right lines in LazyLoader) -
the trick is getting the info correct for the 'output' .class file as we have to
generate a new line number table for the advice method.  
Comment 6 Andrew Clement CLA 2005-01-11 09:00:03 EST
Although it appears the JSR45 information is incorrect in terms of line numbers,
it turns out that the JVM is blowing up because the path is supplied for the .aj
file.  This information causes it to fail:

----
+ 2 LazyLoader.aj
com/ibm/aspectfailure/LazyLoader.aj
----

This information means it works:

----
2 LazyLoader.aj
----

This also works:

----
+ 2 LazyLoader.aj
LazyLoader.aj
----

The '+' variant (the number is a file identifier for use later in the SMAP)
means the source name is followed by the source path.

So - my short term fix for the failure is to remove the path information from
the second part of the entry.  We can then look at rectifying the problem with
the line numbers.

Comment 7 Adrian Colyer CLA 2005-03-23 09:05:45 EST
remaining work on this bug scheduled for aj5m4.
Comment 8 Sian January CLA 2005-03-30 06:35:58 EST
*** Bug 88279 has been marked as a duplicate of this bug. ***
Comment 9 Adrian Colyer CLA 2005-10-28 07:57:22 EDT
remaining issues in this bug moved to 1.5.1