Date: Mon, 23 Nov 1998 18:22:23 PST Sender: choppell@parc.xerox.com From: The AspectJ Team Subject: AspectJ 0.2.0beta6 now available To: AspectJ Announce Reply-to: The AspectJ Team Message-ID: <98Nov23.182229pst."206113"@paranoia.parc.xerox.com> The 0.2.0beta6 release of AspectJ is now available from: http://www.parc.xerox.com/aop/aspectj Some of you may be thinking its been a while since I've heard about new releases, and that we really are doing a good job of keeping this mailing list quiet. Well... its actually been a little more quiet than we intended. A bug in our mailer software has meant that the messages we sent announcing three releases didn't go out! Here's a brief recap of news: - The beta6 release is a significant improvement over the beta2, beta3 and beta4 releases. It doesn't add functionality over beta5, but it does fix several bugs in beta5. - We've made improvements in the web site that mean you won't have to re-register every time you download a new release. (After the next time you register you'll be sent a special URL you can use to download in the future.) - The web site now includes an automatically updated list of open bug reports. - The tutorial has been significantly improved. More of the code from the tutorial has been extracted into files that you can edit and use. - The ajava-mode for emacs has been improved. There still isn't an actual language manual, but an internal draft does exist. Once it is a bit more solid we will send it out. Please check out the latest release and let us know what you think. Thanks and stay in touch, The AspectJ Team ---- Following are the release notes for AspectJ 0.2.0 beta6. This release differs from 0.2.0beta5 in only small ways. Given that, and given the fact that because of a bug in our aspectj-announce mailing many people didn't find out about beta5, we have chosen to simply add to the beta5 notes. This should make things simpler for people who haven't yet switched to beta5. Notes for past releases are available in the doc directory, they are named: notes-0-2-0beta4.text notes-0-2-0beta5.text The differences between beta5 and beta6 are that the following bugs were fixed: - b076 some unicode characters broke the weaver - b070 weaver error messages not in proper format Also fixed was a bug, which beta5 introduced, having to do with constructors in files with packages. As compared to 0.2.0beta4, this release includes significant new functionality and an improved syntax for weave declarations. It also fixes several reported and internally discovered bugs in the weaver. To support these improvements we made an incompatible change to the syntax of weaves. This change will require a systematic, but straightforward edit to your programs. Please read these notes to find out about the changes and to get some tips on how to update your programs. -- CHANGES TO THE LANGUAGE -- The syntax of weaves is now different. -Introduce Weaves- Where you used to write: static new int Pos.getMumble(), int Line.getMumble() { return mumble; } You now write: introduce int Pos.getMumble(), int Line.getMumble() { return mumble; } This is now called an "introduce weave", since it introduces a new member into the class. Introduce weaves can also introduce constructors and initializers. A given introduce weave can introduce either all methods, all constructors or all initializers. -Advise Weaves- Where you used to write: before int Pos.getX(), int Pos.getY() { System.out.println("Hello!"); } You now write: advise int Pos.getX(), int Pos.getY() { before { System.out.println("Hello!"); } } This is called an advise weave, with one bit of before advice. The static modifier, if it exists, is part of each bit of advice. So, for example, if you want to include static in the code above, you write: advise int Pos.getX(), int Pos.getY() { static before { System.out.println("Hello!"); } } Within the body of an advise weave you can have multiple bits of advice. So, for example, you could say: advise int Pos.getX(), int Pos.getY() { before { System.out.println("Hello!"); } after { System.out.println("Goodbye!"); } static catch (Error e) { System.out.println("Whoops!"); } finally { System.out.println("Leaving!"); } } The designators in an advise weave can be either method designators or constructor designators. It is now possible to use wildcards in the designators of an advise weave. So, you can say: advise * Pos.*(*) which means all the methods of Pos. -Method Modifiers- You can now select methods based on their modifiers and on simple combination of modifiers. For example, you can say: advise public * Pos.*(*) advise static * Pos.*(*) which means all the public methods of Pos and all the static methods of Pos, respectively. advise !static * Pos.*(*) means all the non-static methods of Pos. If the modifiers are omitted, it means that you don't care. So advise * Pos.*(*) means all methods of Pos (public, protected, private, static or not) advise int Pos.getX() means the getX method of Pos returning an int, whether getX is public, protected, private, static or not. Please see the tutorial for more details about how the new semantics works. (YES, WE ARE WORKING ON A REAL LANGUAGE MANUAL!) -thisMethodName- The special identifier thisMethodID is now called thisMethodName. This term is more consistent with the naming used by built-in Java accessors for getting at methods. -Tips for updating your programs- The change to advise introduces an extra level of nesting, and this means that while a simple macro will work, to get the best code you will often want to do some manual merging. For example, given the old syntax: static before XXX { ... } static after XXX { ... } a simple editor macro will make: advise XXX { static before { ... } } advise XXX { static after { ... } } But a nicer bit of code is probably advise XXX { static before { ... } static after { ... } } -- CHANGES TO THE WEAVER -- * The weaver is now much more silent by default it can be made verbose by running it with the flag -verbose. It will shortly be completely silent. Licensing issues are complicating the desire to withhold all copyright messages at startup. -- CHANGES TO THE DOCUMENTATION -- * The tutorial was updated to be consistent with the new syntax and functionality. The tutorial has also been reorganized, based on feedback from a number of presentations, to make it flow better, and include more crucial language and style details. * The coordination library is now documented in doc\lib\index.html -- CHANGES TO THE DISTRIBUTION -- The directory and package structure of this release is somewhat different. This effects users in two ways: - the classpath entries associated with AspectJ are now BOTH: \lib\ajweaver.jar \lib\ajruntime.jar so, make sure to add these two to CLASSPATH - the ajava-mode.el emacs IDE customization is now in: \ide\emacs\ajava-mode.el If you have included this information in your emacs set-up, please make sure to update it. where is the place you have installed AspectJ on your machine. -- KNOWN PROBLEMS IN THIS RELEASE -- -Throwing exceptions in advise weaves- Here's a sample code that will cause problems: class C { void f() { /* implementation of f */ } } aspect A { advise void C.f() { static after { /* ... */ throw new SomeException(); } } } The problem is that the aspect throws an exception in method f of class C, but that exception is not included in the declaration of f. Java statically checks for these exceptions, so the java compiler will complain. This is a known problem in the current language design. There are two workarounds. The first workaround is to use subclasses of runtime error as the exception that you throw this way. Since java doesn't statically check those, this problem will go away. This may not be satisfactory if, in fact, you are catching exceptions that someone else is throwing, so you can't control their class. The second workaround is to manually put a throws SomeException on the f method declaration in the class C. This may not be satisfactory because method f is marked as throwing an exception and yet its body doesn't appear to. However, if you use the ajava-mode support you will get an indication that an advise applies, reminding you that it might be doing the throwing. It isn't clear to us exactly what the right solution to this problem is. We are soliciting input from the users about this. -Stale .class files- Here is a scenario that may cause a run-time exception of the weaver: 1. Weave and compile your program. The java compiler produces the proper .class files. 2. Modify your source code. 3. Run the weaver again. You may get an exception such as this one Exception in thread "main" java.lang.ExceptionInInitializerError: java.lang.NullPointerException The problem is that the way the weaver calls Java to do some lookups, it looks at the old .class files if they exist, since they are newer than the .java files that are sitting there (even though they aren't newer than the .ajava files, but Java doesn't know about them). Then some inconsistencies may occur. We're working on fixing this problem. For now, the quick fix is to delete your .class files and run the weaver again. -- BUG FIXES -- * bug 050 Private and protected members of aspects are now handled properly. It is now possible for an aspect to have private and protected members. * bug b052 It is now possible to have static and non-static initializers in classes and aspects. * bug b053 Double weaving of constructors in the presence of subclassing. * bug b054 Make introduce work with abstract methods. * bug b055 Make introduce work to put constructors on interfaces. * bug b057 Weaves on static methods should not refer to 'this'. * bug b061 Make introduce work to put methods on interfaces. * bug b064 Make the return code from the weaver be 0 if there are no warnings or errors, 1 if just warnings, 2 if errors. * bug b065 "java.exe", which is the name of the java vm in JDK, is hardcoded into the weaver. This is "fixed in the documentation". Because not all java ide's call their java the same name, and more importantly, they don't all accept arguments in the same form, for the time being we require that you have jdk installed to run the WEAVER. The woven output code can be compiled and run by any Java implementation. * bug b066 The coordination library was incomplete and broken: 1. The definition of guardedEntries on Conditions was broken. 2. guardedExits with CoordinationAction was missing. Both of these have been fixed. Also, the coordination library has now been documented. * bug b067 Release notes from previous releases are included in this release. * bug b068 Weaver is now silent by default. Passing -verbose will make it say more about what it is doing. * bug b070 Weaver error messages should be in the same format as those from the C compiler. * bug b076 Unicode characters without ascii equivalents broke the weaver. * bug b046 AspectJ no longer requires that your machine have a c:\temp directory in order to run the weaver. Instead it uses the temp subdirectory of your AspectJ installation directory for scratch files. * A possible problem when running more than one weaver process on the same machine has been fixed.