aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs1810/500035/Code.java
blob: 58e738da43d8bf0839ac2611de4e1d01eda7c65f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.*;

@Aspect
public class Code {
 
    @Around(value = "args(regex, replacement) && target(targetObject) " +
            "&& call(public String String.replaceFirst(String, String)) "
//,            argNames = "proceedingJoinPoint,targetObject,regex,replacement,thisJoinPoint"
)
    public String replaceFirstAspect(ProceedingJoinPoint proceedingJoinPoint, String targetObject, String regex, String replacement) throws Throwable {
System.out.println("targetObject = "+targetObject);
System.out.println("regex = "+regex);
System.out.println("replacement = "+replacement);
        String returnObject = (String) proceedingJoinPoint.proceed(new Object[]{ targetObject, regex, replacement});
        return returnObject;
    }


  public static void main(String []argv) {
    new Code().run();
  }

  public void run() {
    String s = "hello";
    s = s.replaceFirst("l","7");
    System.out.println(s);
  }

}