Logo
StartDownloadsDocumentationPublicationsContactCommunityDevelopers

0.8.5M2 Release Notes

Important upgrade information:

Gotchas:

  • Default VM target is now 1.5, when using JAsCo in 1.4, use the target flag for compiling JAsCo artifacts..
  • Make sure to alter all your existing aspects and connectors since four keywords have changed for compliance with AspectJ’s terminology. See 0.8.5M1 release notes.
  • Several features now require a Java 1.5 VM (refinable methods, run-time weaver), a clear error is shown when this is not the case

If you are updgrading from a version earlier then:

  • 0.8.x: you have to redo the install procedure as outlined by the installation instructions. The classpath has changed.
  • 0.7.4: the HotSwap 2 startup command is Modified for compliance with Java 1.5 final! See here for the new command.

Latest public build detailed information: Click here. See also for known limitations and bugs of current version.

Major Changes for latest build:

1. Refining Classes

Refining classes are an alternative to an inline implementation in the connector for implementing a refinable method. Refining classes implement logic for a specific target type and thus allow for aspectual polymorphism. The following code fragment shows an example persistence aspect that uses a refinable method for fetching data from the target object of an encountered joinpoint:

class TestAspect {
    hook TestHook {
          TestHook(method(..args)) {
                execution(method);
          }
          
          refinable public Object getData();
 
          before() {
               ... getData() ... ;
          }
 
          public void iAmRefining(String s) {
              ...
          }
    }
}

Now, depending on the encountered type, different manners for fetching data might be appropriate. The following code fragments show two example refinements for the above aspect bean:

class TestRefinement refining TestAspect.TestHook for java.io.Serializable {
 
         public refinable Object getData() {
               thisHook.iAmRefining(thisJoinPoint.getName());
               return thisJoinPointObject;
         }
}
class TestRefinement2 refining TestAspect.TestHook for status.DataStore {
 
         public refinable Object getData() { //refinable modifier here as well
               DataStore store = thisJoinPointObject;
               thisHook.iAmRefining(thisJoinPoint.getName());
               return store.getData();
         }
}

Notice that the thisJoinPointObject keyword has the type of the refining target. Apart from that keyword, the thisJoinPoint keyword and thisHook keywords are available as well. The thisHook keyword refers to the hook instance that has invoked the refinable method. This keyword has the type of the declared hook to refine.

Refinements are bound lately. Just compile them into the classpath (as class or in jar) and the JAsCo runtime infrastructure will load them. Just make sure to use the compileRefinement tool for compiling them.

The result of the above declaration is that the aspect will be that depending on the target type of the currently enountered joinpoint, the aspect will fetch the data to save in a different way!

Inheritance for refining classes is allowed as well.

2. Connector Inline Refinements

Inline refinements in the connector have some added features to make them consistent with refining classes:

  • thisJoinPointObject & thisJoinPoint keywords
  • thisHook keyword for referring to the hook instance

Example:

static connector InlineRefiningConnector {
	ToRefineAspect.ToRefine temp = new ToRefineAspect.ToRefine(* *.*(*)) {
		public refinable int doRefine(String s) {
			thisHook.iAmRefining(thisJoinPoint.getName());
			return 29;  
		}
	};
}

3. Virtual Mixins

Virtual mixins allow to insert the implementation of an interface in target classes so that other aspects can depend on that. This is mainly useful for communicating information between aspects.

In order to cast an object to the mixin interface, use the following code (only available inside hooks):

ICustomerInfo info = (ICustomerInfo) mixinOf(customer,ICustomerInfo.class);

The ICustomerInfo interface consists of:

interface ICustomerInfo {
     public boolean isFrequent();
     public boolean setIsFrequent(boolean b);
}

The interface is inserted into a target class by simply declaring a hook that implements the interface and correspondig connector. Notice the perobject modifier in the connector for having one hook instance per customer instance. Otherwise the isFrequent property would be global for all customer instances.

The hook is also able to define regular advices. Those are executed as usual, i.e. for all method executions on customer objects in this case.

class BRFrequent {
hook Introduce implements ICustomerInfo {
 
    private boolean isFrequent=false;
 
    Introduce(void method(..args)) {
        execution(method(args));
    }
 
    public boolean isFrequent() {
 
        return isFrequent ;
     }
 
    public boolean setIsFrequent(boolean b) {
        isFrequent=b;
    }
}
}
static connector IntroduceMixin {
      perobject BRFrequent.Introduce hook1 = new BRFrequent.Introduce(* Customer.*(*)); //the wildcards are important!
}

Now other hooks are able to access this mixin through the following code:

    around returning(double price) {
        ICustomerInfo mixin = (ICustomerInfo) mixinOf(customer,ICustomerInfo.class);
        if(mixin.isFrequent())
            return applyDiscount(price);
        else return price;
    }

4. Small improvements

  • specialized proceed has declared return type, around still has Object (will change in the future as well)
    hook TestHook(int compute(int k)) {
        execution(compute);
    }
 
    around() {
       int j = proceed(k*2);
       return new Integer(j/2);
    }
  • Declared arguments are type checked to avoid casting problems
  • Improved Java Code parsing
    • hooks can have meta-data
    • hooks can implement interfaces
    • aspect beans can implement interfaces
    • aspect beans can extend regular Java classes
    • both hooks and aspect beans can contain inner classes
  • several bug fixes, mainly wrt run-time weaver
  

Changes of previous milestones

For changes introduced in 0.8.5M1, see the release notes of that milestone.

kernel/0.8.5m2.txt · Last modified: 10.06.2005 14:24
SiteMapRecent Content by SSEL ©2002-2005     Latest JAsCo Release: JAsCo 0.8.7 (revised 2005-11-25 16:29:02)