소스 검색

194314: testcode

tags/pre268419
aclement 15 년 전
부모
커밋
fedb620ccb

+ 4
- 0
tests/bugs164/pr194314/IService.java 파일 보기

@@ -0,0 +1,4 @@

public interface IService {
void method(long l) throws Exception;
}

+ 18
- 0
tests/bugs164/pr194314/ITDOne.java 파일 보기

@@ -0,0 +1,18 @@
interface I {

}

class C implements I {

public void m() {
foo(null,1,null);
fooStatic(6,1,null);
}
}

aspect X {
void around(): call(* foo(..)) {}
public void I.foo(String s,int i,String[] ss) {}
void around(): call(* fooStatic(..)) {}
public static void C.fooStatic(long l,int i,String[] ss) {}
}

+ 15
- 0
tests/bugs164/pr194314/ITDTwo.java 파일 보기

@@ -0,0 +1,15 @@
interface I {

}

class C implements I {

public void m() {
foo(null,1,null);
}
}

aspect X {
void around(): call(* foo(..)) {}
public void I.foo(String s,int i,String[] ss) {}
}

+ 8
- 0
tests/bugs164/pr194314/Main.java 파일 보기

@@ -0,0 +1,8 @@

public class Main {

public static void main(String[] args) throws Exception {
IService service = new Service();
service.method(42L);
}
}

+ 7
- 0
tests/bugs164/pr194314/Service.java 파일 보기

@@ -0,0 +1,7 @@

public class Service implements IService {

public void method(long l) throws Exception {
System.err.println("Original impl of service method, arg " + l);
}
}

+ 17
- 0
tests/bugs164/pr194314/ServiceInterceptor.java 파일 보기

@@ -0,0 +1,17 @@

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class ServiceInterceptor {

@Around("execution(void Service.method(long))")
public void method(ProceedingJoinPoint pjp) throws Throwable {
Object[] args = pjp.getArgs();
long id = (Long) args[0];
System.out.println("in advice, arg = " + id + " (before proceed)");
pjp.proceed(pjp.getArgs());
System.out.println("in advice (after proceed)");
}
}

+ 15
- 0
tests/bugs164/pr194314/ServiceInterceptorCodeStyle.java 파일 보기

@@ -0,0 +1,15 @@

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

public aspect ServiceInterceptorCodeStyle {

void around(): execution(void Service.method(long)) {
Object[] args = thisJoinPoint.getArgs();
long id = (Long) args[0];
System.out.println("in advice, arg = " + id + " (before proceed)");
proceed();
System.out.println("in advice (after proceed)");
}
}

Loading…
취소
저장