Bug 82134 - AspectJ 5 M2 should implement backwards compatibility for binary aspect form
Summary: AspectJ 5 M2 should implement backwards compatibility for binary aspect form
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-04 09:40 EST by Adrian Colyer CLA
Modified: 2005-03-23 09:10 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Colyer CLA 2005-01-04 09:40:55 EST
Hi Adrian,

thanks for the detailed explanation of the compatibility questions. That 
explains the problem I observed.

> * An AspectJ program should always be run with the aspectjrt.jar runtime 
> library that accompanies the distribution containing the compiler/weaver 
> used to build it. 

Interesting point. Which one? The one that is used to compile it or the 
one that is used to weave it?

> However, instead of some IOException, what you should see is a nice 
> message saying that the aspect was produced by a more recent version of 
> AspectJ and cannot be read. Likewise, if you load a pre-aspectj 5 aspect 
> into the AspectJ 5 weaver right now, you'll also see an IOException 
> (odds-on). In M2 we'll detect that and use the back-level loaders to read 
> it in.

Okay. Is there a bug to track this? I really would like to update the 
weaver of my weaving runtime but only if it allows to load/weave 
asepects that are compiled with any of the AJDT versions that are out 
right now (AJDT 1.1.x and AJDT 1.2.0Mx).
Comment 1 Andrew Clement CLA 2005-01-07 09:22:25 EST
I have just checked in the fix for this.  AspectJ5 will now read in 1.2.1 built
aspects.  I have:

1. Updated the version number for the WeaverVersionInfo attribute that exists in
files generated by AspectJ releases since 1.2.1 onwards.  1.2.1 had version 1.0
in the attribute.  AspectJ 5 has version 2.0

2. Rebuilt all the jar files used by testcases so they include the new version
number.

3. Introduced a VersionedDataInputStream subclass of DataInputStream that knows
the weaver version that was used to build the contents of the data in the stream.  

4. Modified all read() methods in the org.aspectj.weaver.patterns package to use
 a VersionedDataInputStream rather than a DataInputStream, they are then able to
check the version before determining what data they should read.

5. Fixed the TypePattern and SignaturePattern read methods to allow for the old
version number (1.0) which wouldn't include varargs info or annotation patterns.

6. Added a testcase that takes 1.2.1 generated code as input for a weave by
AspectJ 5.

Basically, the VersionedDataInputStream defaults to assuming the latest version,
and some changes in the attribute unpacking code modify the version if they come
across a WeaverVersionInfo attribute.  

We can't (without a lot of messy messy work) get AspectJ 5 to accept pre-1.2.1
built aspects as input.

waiting for build ...
Comment 2 Andrew Clement CLA 2005-01-07 11:28:18 EST
Build available:

BUILD COMPLETE -  build.428
Date of build: 01/07/2005 14:46:31
Time to build: 100 minutes 19 seconds
Last changed: 01/07/2005 14:14:51
Last log entry: Fix for Bug 82134: AspectJ 5 M2 should implement backwards
compatibility for binary aspect form
Latest good AspectJ jar available at:
download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar
Comment 3 Adrian Colyer CLA 2005-03-23 09:10:59 EST
Should have been closed on Jan. 7th...