Questions tagged [aspectj]

AspectJ is an aspect-oriented extension to the Java programming language that enables clean modularization of crosscutting concerns such as logging, error handling, standards enforcement and feature variations. Use this tag for questions about the programmatic use of this extension. For downloads, support, IDE integration, & documentation, see the "learn more" for this tag.

AspectJ is an Aspect-Oriented Programming (AOP) extension to Java, created by Xerox, that has as main components aspects (consisting of pointcuts and advices) and join points.

For AspectJ Eclipse integration, also see AspectJ Development Tools (AJDT); for NetBeans integration, see AspectJ in NetBeans; for IntelliJ IDEA integration, see IDEA Web Help.

Books:

Documentation:

3304 questions
1
vote
1 answer

AspectJ pointcut matching arguments (args()) is not matching correctly

I've got an pointcut that I am trying to use with LTW. I have 2 methods that I am trying to advise, each with a different parameter list. However, they both have a single common parameter that I want. These are the method signatures I want to…
Eric B.
  • 23,425
  • 50
  • 169
  • 316
1
vote
1 answer

AspectJ expose annotation value using AspectJ annotations

I'm using AspectJ annotations instead of writing actual aspect files. I want to expose an annotation value to my advice. I currently have this but it it doesn't expose the values inside MyAnnotation @Before("execution(@MyAnnotation * *…
Mark
  • 837
  • 2
  • 9
  • 19
1
vote
2 answers

AspectJ: How to replace an existing annotation

Using AspectJ, how do you replace an existing annotation? I have the following code declare @method : @Test * *(..) : @Test(timeout=10); Which generates the following error on every test method: ... already has an annotation of type org.junit.Test,…
gMale
  • 17,147
  • 17
  • 91
  • 116
1
vote
0 answers

Java 8 - A fatal error has been detected by the Java Runtime Environment

my webapp deployed on tomcat server getting crashed with error: A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007fe6f9b9e105, pid=7607, tid=140628827879168 JRE version: Java(TM) SE Runtime Environment…
Abdul Salam
  • 238
  • 1
  • 3
  • 11
1
vote
1 answer

Array element set pointcut. Is there a workaround?

I just read that it is not possible to define a pointcut on a single array element (bug link). Considering I really need to detect an array element modification, I would like to know if there is any workaround for this kind of problem (a pattern or…
Jack
  • 1,066
  • 2
  • 10
  • 22
1
vote
2 answers

Understanding the pointcut and accessing the annotation parameter in advice

Could someone please help me understand the below pointcut in aspectj? This pointcut works for annotation @DynamicValue but how it works is confusing. Below is my custom annotation: @Target({ElementType.FIELD,…
1
vote
1 answer

Get java.lang.OutOfMemoryError: Java heap space error when compiling aspectJ project

I get java.lang.OutOfMemoryError: Java heap space when I try to compile an aspecj project. The project is a maven 2 project and I have set maven-compiler-plugin to use up to 2048m memory. But this error just doesn't go away. What else can I do to…
newguy
  • 5,668
  • 12
  • 55
  • 95
1
vote
0 answers

Unable to invoke aspect methods in an external jar/different project

I have an external jar which contains an aspect which is to be used by my other projects but I am not able to call the aspect methods inside the external jar. When I searched I came to know that I would have to use load-time weaving for my…
Akash Raveendran
  • 559
  • 1
  • 9
  • 22
1
vote
1 answer

Spring AOP execution expression with two arguments

I want to advice the following method public BaseRepresentationObject createLedgerTransaction(Long fromUserId, Long toUserId, Double serviceAmount, Double masaryCommission, Double merchantCommission, Double appliedFees, Double tax, Long…
Shady Ragab
  • 705
  • 10
  • 26
1
vote
0 answers

Spring Boot error when AspectJ 1.8 Plugin compiles

I face an issue that seems to be resolved here Mine is an aspect that needs AspectJ. There is a > "if()" condition in my aspect. I have enabled this plugin. org.codehaus.mojo
Mohan Radhakrishnan
  • 3,002
  • 5
  • 28
  • 42
1
vote
2 answers

Execute code before @Before method for JUnit test

I need to execute some code before the @Before method of each unit test is executed. The problem is that I also need to know which test (the name is sufficient) will be executed afterwards. I can either use AspectJ or Java Agents with bytecode…
skappler
  • 722
  • 1
  • 10
  • 26
1
vote
2 answers

AspectJ is not getting added to classpath with eclipse:eclipse

I'm executing the following command, mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:clean \ org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse My all the dependencies are coming in classpath but AspectJ is not added to the…
srinannapa
  • 3,085
  • 8
  • 49
  • 66
1
vote
2 answers

In aspect oriented programming, where exactly does a join point start

I was going through spring documentation, and this is what it says about join points " Join point: a point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always…
1
vote
1 answer

cannot find symbol variable thisJoinPoint

How to solve a “cannot find symbol variable thisJoinPoint” while trying to build an AspectJ project in AndroidStudio using annotation style? Platform details: AspectJ 1.8.1, AndroidStudio 2.1.3 Code Example: import org.aspectj.lang.JoinPoint.*; …
1
vote
2 answers

AspectJ - Pointcut on inherited 'parents' class

Goal: Call a class's static filter() method from any of my @Entity classes. Returning a List
Tokazio
  • 516
  • 2
  • 18