Project: AspectJ
Bug 76798 Add versions to woven class files - enabling better backwards compatibility.
Reported: 2004-10-22 07:04:41 | Status: resolved fixed

We don't currently include a version in the class files that come out of the weaver. This can cause problems. For example, if we add a new attribute to a class file in a future version of AspectJ, then that attribute will cause older versions of AspectJ to blow up if they encounter it. If we include a version in the class file we can rev the version number when we add attributes (or change the class file form in another way), and by checking that version number in the weaver we can better determine whether we should fail if we encounter a new attribute (or other change), or if it is safe to continue processing. I will add a new WeaverVersion attribute that includes 2 shorts. Major and Minor. Encountering a major version in a class file that is greater than the version a particular weaver is designed to understand will cause compilation to fail. Encountering a minor version in a class file that is greater than the minor version a particular weaver is designed to understand will not cause compilation to fail - we will assume it is safe to continue.

Files changed in fix:
weaver/src/org/aspectj/weaver/AjAttribute.java weaver/src/org/aspectj/weaver/bcel/BcelAttributes.java weaver/src/org/aspectj/weaver/bcel/BcelField.java weaver/src/org/aspectj/weaver/bcel/BcelMethod.java weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java