Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Issue converting old project

Hi Charlie,

There shouldn't be any difference between creating a new AspectJ
project and converting a Java one. It's not clear to me from your
description exactly what is going wrong.

By default aspects will NOT apply to classes in other projects, only
to classes in the same project. To apply aspects across projects you
need to use the aspect-path setting, as described here:
http://www.eclipse.org/articles/Article-Introducing-AJDT/article.html

If you have everything in the same project, and it's not working,
check that both folders are defined as source folders. If it's still
not working, export the whole project as a zip file, and either raise
a bug and attach it there, or send it to me.

Regards,

Matt.

On 15/01/07, aspectj@xxxxxxxxxxxxxxxxxxxx <aspectj@xxxxxxxxxxxxxxxxxxxx> wrote:
I'm having an issue converting an old project, so hopefully I'm just missing something fundamental w/ the tool (AJDT).

The setup:  Using a new aspectj project, I followed some of the Swing threading aspects outlined in the AspectJ in Action book (aside: one of the better technical books I've read).  Everything looked great. I converted my old project over to an AspectJ project (btw, it's the latest version of AJDT, 1.4.1).  I copied the source tree over in another project, setting up the source path as aop/src/<mypackagenametoaspjects>.  The test program had all the aspects being recognized, etc. by the decorations that AJDT provides in the margins.  Oddly, though, none of my other classes in, say <mycompany>/src/<myotherpackages> showed any knowledge of the aspects at all.  I moved all the aspects over to the <mycompany>/src/<mypackagenametoaspjects> and still nothing on my old project sources, but the original test (in the aop/src/<mypackagenametoaspjects> package) was being recognized.  When I move the test file over to my original source path, the test file was no longer being decorated a
 nd I was getting the "advice does not match" warning on the aspect (included below).

So, what am I doing wrong here?  The tool looks like it will help a bunch, and I'm likely missing something obvious--I'd just like to get over this hurdle...TIA.

...Charlie


public aspect LogUIActivitiesAspect {
    pointcut uiActivities() : call(* javax..*+.*(..));

    before() : uiActivities() {
        System.out.println( "Executing:\n\t"
                           + thisJoinPointStaticPart.getSignature()
                           + "\n\t"
                           + Thread.currentThread() + "\n");
    }
}



public class Test {
    public static void main(String[] args) {
        JFrame appFrame = new JFrame();
        appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        DefaultTableModel tableModel = new DefaultTableModel(4, 2);

        JTable table = new MyTable2(tableModel);
        JTable table2 = new JTable(tableModel);
        System.out.println(table2);
        appFrame.getContentPane().add(table);
        appFrame.pack();
        appFrame.setVisible(true);
        String value = "[0,0]";
        tableModel.setValueAt(value, 0, 0);
        JOptionPane.showMessageDialog(appFrame, "Press OK to continue");
        int rowCount = tableModel.getRowCount();
        System.out.println("Row count = " + rowCount);
        Color gridColor = table.getGridColor();
        Color d = table2.getGridColor();
        System.out.println("Grid color = " + gridColor + " // " + d);
    }
}


_______________________________________________________
The FREE service that prevents junk email http://www.mailshell.com
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top