Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Can't see advice being applied
Can't see advice being applied [message #655997] Wed, 23 February 2011 16:59 Go to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi,

I'm making my first steps with ApsectJ and AJDT. Not very successful so far ;-(

In my workspace I have plugin projects with my source code and I added an "aspects" project (also a plugin). I added one aspect:

package aspects;
import org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision;

public aspect Universe
{
before() : execution(* BaseCDORevision.*(..)) { bang(); }

private static void bang() { System.err.println("=== BANG! ==="); }
}

The AJDT Event Trace view shows this:

17:55:34 ============================================================ ===============================
17:55:34 Build kind = AUTOBUILD
17:55:34 Project=aspects, kind of build requested=Incremental AspectJ compilation
17:55:34 Timer event: 0ms: Flush included source file cache
17:55:34 Timer event: 0ms: Check delta
17:55:34 File: C:\develop\ws\aspectj\aspects\src\aspects\Universe.aj has changed.
17:55:34 build: Examined delta - 1 changed, 0 added, and 0 deleted source files in required project aspects
17:55:34 Timer event: 1ms: Looking for and marking configuration changes in aspects
17:55:34 Configuration changes found: true
17:55:34 Timer event: 1ms: Look for source/resource changes
17:55:34 Setting list of classpath elements with modified contents:
17:55:34 [C:/develop/ws/aspectj/plugins/org.eclipse.net4j.tcp/bin, C:/develop/ws/aspectj/plugins/org.eclipse.net4j.util/bin, C:/develop/ws/aspectj/plugins/org.eclipse.net4j/bin, C:/develop/ws/aspectj/plugins/org.eclipse.emf.cdo.server/bin , C:/develop/ws/aspectj/plugins/org.eclipse.emf.cdo.common/bin , C:/develop/ws/aspectj/plugins/org.eclipse.emf.cdo.server.net 4j/bin]
17:55:34 Timer event: 46ms: Pre compile
17:55:34 Sending the following configuration changes to the compiler: []
17:55:34 1 source file changes since last build
17:55:34 Compiler configuration for project aspects has been read by compiler. Resetting.
17:55:34 Configuration was []
17:55:34 Resetting list of modified source files. Was [C:\develop\ws\aspectj\aspects\src\aspects\Universe.aj]
17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.net4j.tcp\bin
17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.net4j.tcp\bin' is apparently unchanged so not performing timestamp check
17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.net4j.util\bin
17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.net4j.util\bin' is apparently unchanged so not performing timestamp check
17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.net4j\bin
17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.net4j\bin' is apparently unchanged so not performing timestamp check
17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server\bin
17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server\bi n' is apparently unchanged so not performing timestamp check
17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.common\bin
17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.common\bi n' is apparently unchanged so not performing timestamp check
17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server.net 4j\bin
17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server.ne t4j\bin' is apparently unchanged so not performing timestamp check
17:55:34 Preparing for build: planning to be an incremental build
17:55:34 Starting incremental compilation loop 1 of possibly 5
17:55:34 Timer event: 303ms: Time to first compiled message
17:55:34 Dropping back to full build
17:55:34 Preparing for build: not going to be incremental because no successful previous full build
17:55:35 Timer event: 735ms: Time to first woven message
17:55:35 AspectJ reports build successful, build was: FULL
17:55:35 AJDE Callback: finish. Was full build: true
17:55:35 Timer event: 1588ms: Total time spent in AJDE
17:55:35 Timer event: 0ms: Refresh after build
17:55:35 Types affected during build = 1133
17:55:35 Timer event: 1638ms: Total time spent in AJBuilder.build()
17:55:35 Timer event: 5ms: Delete markers: aspects (Finished deleting markers for aspects)
17:55:35 Timer event: 0ms: Create markers: aspects (Finished creating markers for aspects)
17:55:35 Created 0 markers in 1 files
17:55:35 Timer event: 0ms: Update visualizer, xref, advice listeners for (separate thread): aspects


But in the class BaseCDORevision.java I can not see any advice markers, nor is "=== BANG! ===" output when I start the program.

I have no clue where to start. Please help ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Can't see advice being applied [message #656004 is a reply to message #655997] Wed, 23 February 2011 17:14 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
When I copy the BaseCDORevision.java file into the "aspects" project I can see that the advice is properly applied.

Shouldn't the aspect be applied to source in other (plugin) projects, as well?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 23.02.2011 17:59, schrieb Eike Stepper:
> Hi,
>
> I'm making my first steps with ApsectJ and AJDT. Not very successful so far ;-(
>
> In my workspace I have plugin projects with my source code and I added an "aspects" project (also a plugin). I added one aspect:
>
> package aspects;
> import org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision;
>
> public aspect Universe
> {
> before() : execution(* BaseCDORevision.*(..)) { bang(); }
>
> private static void bang() { System.err.println("=== BANG! ==="); }
> }
>
> The AJDT Event Trace view shows this:
>
> 17:55:34 ============================================================ ===============================
> 17:55:34 Build kind = AUTOBUILD
> 17:55:34 Project=aspects, kind of build requested=Incremental AspectJ compilation
> 17:55:34 Timer event: 0ms: Flush included source file cache
> 17:55:34 Timer event: 0ms: Check delta
> 17:55:34 File: C:\develop\ws\aspectj\aspects\src\aspects\Universe.aj has changed.
> 17:55:34 build: Examined delta - 1 changed, 0 added, and 0 deleted source files in required project aspects
> 17:55:34 Timer event: 1ms: Looking for and marking configuration changes in aspects
> 17:55:34 Configuration changes found: true
> 17:55:34 Timer event: 1ms: Look for source/resource changes
> 17:55:34 Setting list of classpath elements with modified contents:
> 17:55:34 [C:/develop/ws/aspectj/plugins/org.eclipse.net4j.tcp/bin, C:/develop/ws/aspectj/plugins/org.eclipse.net4j.util/bin, C:/develop/ws/aspectj/plugins/org.eclipse.net4j/bin, C:/develop/ws/aspectj/plugins/org.eclipse.emf.cdo.server/bin , C:/develop/ws/aspectj/plugins/org.eclipse.emf.cdo.common/bin , C:/develop/ws/aspectj/plugins/org.eclipse.emf.cdo.server.net 4j/bin]
> 17:55:34 Timer event: 46ms: Pre compile
> 17:55:34 Sending the following configuration changes to the compiler: []
> 17:55:34 1 source file changes since last build
> 17:55:34 Compiler configuration for project aspects has been read by compiler. Resetting.
> 17:55:34 Configuration was []
> 17:55:34 Resetting list of modified source files. Was [C:\develop\ws\aspectj\aspects\src\aspects\Universe.aj]
> 17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.net4j.tcp\bin
> 17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.net4j.tcp\bin' is apparently unchanged so not performing timestamp check
> 17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.net4j.util\bin
> 17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.net4j.util\bin' is apparently unchanged so not performing timestamp check
> 17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.net4j\bin
> 17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.net4j\bin' is apparently unchanged so not performing timestamp check
> 17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server\bin
> 17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server\bi n' is apparently unchanged so not performing timestamp check
> 17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.common\bin
> 17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.common\bi n' is apparently unchanged so not performing timestamp check
> 17:55:34 ClassFileChangeChecking: failed to find a state instance managing output location : C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server.net 4j\bin
> 17:55:34 ClassFileChangeChecking: queried JDT and 'C:\develop\ws\aspectj\plugins\org.eclipse.emf.cdo.server.ne t4j\bin' is apparently unchanged so not performing timestamp check
> 17:55:34 Preparing for build: planning to be an incremental build
> 17:55:34 Starting incremental compilation loop 1 of possibly 5
> 17:55:34 Timer event: 303ms: Time to first compiled message
> 17:55:34 Dropping back to full build
> 17:55:34 Preparing for build: not going to be incremental because no successful previous full build
> 17:55:35 Timer event: 735ms: Time to first woven message
> 17:55:35 AspectJ reports build successful, build was: FULL
> 17:55:35 AJDE Callback: finish. Was full build: true
> 17:55:35 Timer event: 1588ms: Total time spent in AJDE
> 17:55:35 Timer event: 0ms: Refresh after build
> 17:55:35 Types affected during build = 1133
> 17:55:35 Timer event: 1638ms: Total time spent in AJBuilder.build()
> 17:55:35 Timer event: 5ms: Delete markers: aspects (Finished deleting markers for aspects)
> 17:55:35 Timer event: 0ms: Create markers: aspects (Finished creating markers for aspects)
> 17:55:35 Created 0 markers in 1 files
> 17:55:35 Timer event: 0ms: Update visualizer, xref, advice listeners for (separate thread): aspects
>
>
> But in the class BaseCDORevision.java I can not see any advice markers, nor is "=== BANG! ===" output when I start the program.
>
> I have no clue where to start. Please help ;-)
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>


Re: Can't see advice being applied [message #656084 is a reply to message #656004] Thu, 24 February 2011 04:15 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
Since you are creating Eclipse plugins, standard compile time aspectj will not work, instead, you must use Equinox Weaving:

http://www.eclipse.org/equinox/incubator/aspects/

This is the only way to get AspectJ working across bundles in an OSGi environment. You already have Equinox weaving installed because you are using AJDT. The documentation is a little outdated, but you should start by looking at the quick start guide and send any questions to this forum.

http://www.eclipse.org/equinox/incubator/aspects/equinox-asp ects-quick-start.php
Re: Can't see advice being applied [message #656089 is a reply to message #656084] Thu, 24 February 2011 06:39 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 24.02.2011 05:15, schrieb Andrew Eisenberg:
> Since you are creating Eclipse plugins, standard compile time aspectj will not work, instead, you must use Equinox Weaving:
>
> http://www.eclipse.org/equinox/incubator/aspects/
>
> This is the only way to get AspectJ working across bundles in an OSGi environment. You already have Equinox weaving installed because you are using AJDT. The documentation is a little outdated, but you should start by looking at the quick start guide and send any questions to this forum.
>
> http://www.eclipse.org/equinox/incubator/aspects/equinox-asp ects-quick-start.php

A lot of steps to follow but finally it's working now. Thank you very much!

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Need to skip an Entrust jar file during weaving
Next Topic:No development time feedback with Equinox Aspects?
Goto Forum:
  


Current Time: Fri Apr 19 05:28:47 GMT 2024

Powered by FUDForum. Page generated in 0.02027 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top