Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AJDT and eclipse 3.0RC3

hi andy,

Multiple projects in the same workspace is fine.  As Ron pointed out,
AJDT works with the structure model for one project as a time, as you
flick between them, it switches to the structure model for the project you
select.  We do not currently support visualization across more than one
project.
thats ok. but currently it seems like it rebuilds that model on every
switch witch takes looooong. on my machine between half a minute
and a minute. also when i resize the the visualizer window it takes
enormously long to get it redrawn.
eclipse is certainly a monster when it comes to resource consumption
but i never had such problems on my machine before (2GH, 512MB).


NEWS UPDATE!
ok i am starting to realize whats going on. at least partly.
it seems like AJDT has a problem recognizing crosscutting when
there are no PCDs.

i use aspectj heavyly for introductions where the
introductions are sort of deferred.

example
<code>

interface BaseInterface{}
interface AspectedBaseInterface extends BaseInterface{}

public abstract aspect EnableBaseInterface{
  private int AspectedBaseInterface.foo_;

  public int AspectedBaseInterface.getFoo(){return foo_;}
}

public DefaultEnableBaseInterface extends EnableBaseInterface{
   declare parents: MyType implements AspectedBaseInterface;
}
</code>

now none of these is visualized.

for aspects with PCDs most of them are visualized but again not all.

<code example=1>
package org.pragmatico.util.aspects;

import org.pragmatico.util.Util;
import org.aspectj.lang.*;


public abstract aspect EnableLogging
{
    protected int indent_ = 0;
    protected String ws_ = "    ";
    protected String info_level_ = "SIG";  //SIG OR ARGS

    protected abstract pointcut log();

protected pointcut toString(): cflowbelow(execution(String *.toString()));
    protected pointcut enter(): if(true);
    protected pointcut leave(): if(true);

    before():
        log() && enter() && !toString()
        {
	        indent_++;
            printSignature(thisJoinPoint, "ENTER", info_level_);

        }

    after():
        log() && leave() && !toString()
        {
            printSignature(thisJoinPoint, "LEAVE", "SIG");
	        indent_--;
        }

private void printSignature(JoinPoint _jp, String _type, String _level)
    {
        Signature sig = _jp.getStaticPart().getSignature();
        String typename = Util.getTypeName(sig.getDeclaringType());
        String msg = _type + ": " + typename + "." + sig.getName();
        if (getInfoLevel().equals("ARGS"))
        {
            msg += createParameters(_jp);
        }
        printIndent();
        System.out.println(msg);
    }


    private String createParameters(JoinPoint _jp)
    {
        StringBuffer buffer = new StringBuffer("(");
        Object[] arguments = _jp.getArgs();
        for (int length = arguments.length, i = 0; i < length; ++i)
        {
            Object argument = arguments[i];
            buffer.append(argument);
            if (i != length-1)
            {
                buffer.append(',');
            }
        }
        buffer.append(")");
        return buffer.toString();
    }

    private void printIndent()
    {
        System.out.print(Util.indent(ws_, indent_));
    }

    public String getInfoLevel()
    {
       return "SIG";
    }
}
</code>

<code example=2>
package org.pragmatico.util.autoprop.aspects;

import org.pragmatico.util.autoprop.AspectedAutoProp;

public abstract aspect BaseEnableAutoProp //extends AutoPropImplAspect
{
    public pointcut getter():
            execution(public Object+ get*())
        &&  target(AspectedAutoProp+);


    Object around():
        getter()
        {
            Object result = proceed();
            try
            {
                if (result == null)
                {
AspectedAutoProp ape = (AspectedAutoProp) thisJoinPoint.getThis(); String name = thisJoinPoint.getSignature().getName().substring(3);
                    result = ape.getValue(result, name);
                }
            }
            catch(Exception ex)
            {
                //
            }

            return result;
        }
}
</code>

example 1 is never shown example 2 is shown. whats the difference?
the only one i know is that i import classes on example 1 that are
not part of the project but reside within a jarfile.

any thoughts?

ciao robertj


Back to the top