renamed all modules
This commit is contained in:
11
testdata-subloader/src/main/java/subpkg/Bottom.java
Normal file
11
testdata-subloader/src/main/java/subpkg/Bottom.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.Top;
|
||||
|
||||
public class Bottom extends Top {
|
||||
|
||||
public void m() {
|
||||
System.out.println("Bottom.m() running");
|
||||
}
|
||||
|
||||
}
|
||||
11
testdata-subloader/src/main/java/subpkg/Bottom002.java
Normal file
11
testdata-subloader/src/main/java/subpkg/Bottom002.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.Top002;
|
||||
|
||||
public class Bottom002 extends Top002 {
|
||||
|
||||
public void m() {
|
||||
System.out.println("Bottom002.m() running");
|
||||
}
|
||||
|
||||
}
|
||||
11
testdata-subloader/src/main/java/subpkg/Bottom003.java
Normal file
11
testdata-subloader/src/main/java/subpkg/Bottom003.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.Top003;
|
||||
|
||||
public class Bottom003 extends Top003 {
|
||||
|
||||
public void m() {
|
||||
newMethodOnTop();
|
||||
}
|
||||
|
||||
}
|
||||
15
testdata-subloader/src/main/java/subpkg/BottomB.java
Normal file
15
testdata-subloader/src/main/java/subpkg/BottomB.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.TopB;
|
||||
|
||||
public class BottomB extends TopB {
|
||||
|
||||
public void m() {
|
||||
System.out.println("BottomB.m() running");
|
||||
}
|
||||
|
||||
public void run() {
|
||||
m();
|
||||
}
|
||||
|
||||
}
|
||||
15
testdata-subloader/src/main/java/subpkg/BottomB002.java
Normal file
15
testdata-subloader/src/main/java/subpkg/BottomB002.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.TopB002;
|
||||
|
||||
public class BottomB002 extends TopB002 {
|
||||
|
||||
public void m() {
|
||||
super.m();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
m();
|
||||
}
|
||||
|
||||
}
|
||||
13
testdata-subloader/src/main/java/subpkg/Invoker.java
Normal file
13
testdata-subloader/src/main/java/subpkg/Invoker.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.Target;
|
||||
|
||||
public class Invoker {
|
||||
|
||||
static Target t = new Target();
|
||||
|
||||
public void run() {
|
||||
System.out.println("Invoker.run() running");
|
||||
}
|
||||
|
||||
}
|
||||
13
testdata-subloader/src/main/java/subpkg/Invoker002.java
Normal file
13
testdata-subloader/src/main/java/subpkg/Invoker002.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.Target002;
|
||||
|
||||
public class Invoker002 {
|
||||
|
||||
static Target002 t = new Target002();
|
||||
|
||||
public void run() {
|
||||
t.m();
|
||||
}
|
||||
|
||||
}
|
||||
9
testdata-subloader/src/main/java/subpkg/InvokerB.java
Normal file
9
testdata-subloader/src/main/java/subpkg/InvokerB.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package subpkg;
|
||||
|
||||
public class InvokerB {
|
||||
|
||||
public void run() {
|
||||
System.out.println("InvokerB.run() running");
|
||||
}
|
||||
|
||||
}
|
||||
11
testdata-subloader/src/main/java/subpkg/InvokerB002.java
Normal file
11
testdata-subloader/src/main/java/subpkg/InvokerB002.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.TargetB002;
|
||||
|
||||
public class InvokerB002 {
|
||||
|
||||
public void run() {
|
||||
TargetB002.m();
|
||||
}
|
||||
|
||||
}
|
||||
9
testdata-subloader/src/main/java/subpkg/InvokerC.java
Normal file
9
testdata-subloader/src/main/java/subpkg/InvokerC.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package subpkg;
|
||||
|
||||
public class InvokerC {
|
||||
|
||||
public void run() {
|
||||
System.out.println("InvokerC.run() running");
|
||||
}
|
||||
|
||||
}
|
||||
13
testdata-subloader/src/main/java/subpkg/InvokerC002.java
Normal file
13
testdata-subloader/src/main/java/subpkg/InvokerC002.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.TargetC002;
|
||||
import superpkg.TargetImplC002;
|
||||
|
||||
public class InvokerC002 {
|
||||
|
||||
public void run() {
|
||||
TargetC002 t = new TargetImplC002();
|
||||
t.m();
|
||||
}
|
||||
|
||||
}
|
||||
13
testdata-subloader/src/main/java/subpkg/InvokerC003.java
Normal file
13
testdata-subloader/src/main/java/subpkg/InvokerC003.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.TargetC002;
|
||||
import superpkg.TargetImplC002;
|
||||
|
||||
public class InvokerC003 {
|
||||
|
||||
public void run() {
|
||||
TargetC002 t = new TargetImplC002();
|
||||
t.n();
|
||||
}
|
||||
|
||||
}
|
||||
11
testdata-subloader/src/main/java/subpkg/InvokerD.java
Normal file
11
testdata-subloader/src/main/java/subpkg/InvokerD.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.TargetD;
|
||||
|
||||
public class InvokerD {
|
||||
|
||||
public void run() {
|
||||
System.out.println(new TargetD().getOne());
|
||||
}
|
||||
|
||||
}
|
||||
48
testdata-subloader/src/main/java/subpkg/ProxyBuilder.java
Normal file
48
testdata-subloader/src/main/java/subpkg/ProxyBuilder.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package subpkg;
|
||||
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
|
||||
import net.sf.cglib.proxy.Callback;
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
import net.sf.cglib.proxy.MethodInterceptor;
|
||||
import net.sf.cglib.transform.impl.UndeclaredThrowableStrategy;
|
||||
|
||||
public class ProxyBuilder {
|
||||
|
||||
static <T> T createProxyFor(Class<T> clazz, MethodInterceptor mi) {
|
||||
Enhancer enhancer = new Enhancer();
|
||||
// if (classLoader != null) {
|
||||
// enhancer.setClassLoader(classLoader);
|
||||
// if (classLoader instanceof SmartClassLoader &&
|
||||
// ((SmartClassLoader) classLoader).isClassReloadable(proxySuperClass)) {
|
||||
// enhancer.setUseCache(false);
|
||||
// }
|
||||
// }
|
||||
enhancer.setSuperclass(clazz);
|
||||
enhancer.setStrategy(new UndeclaredThrowableStrategy(UndeclaredThrowableException.class));
|
||||
enhancer.setInterfaces(null);//AopProxyUtils.completeProxiedInterfaces(this.advised));
|
||||
enhancer.setInterceptDuringConstruction(false);
|
||||
|
||||
Callback[] callbacks = new Callback[] { mi };//getCallbacks(rootClass);
|
||||
enhancer.setCallbacks(callbacks);
|
||||
// enhancer.setCallbackFilter(new ProxyCallbackFilter(
|
||||
// this.advised.getConfigurationOnlyCopy(), this.fixedInterceptorMap, this.fixedInterceptorOffset));
|
||||
|
||||
Class<?>[] types = new Class[callbacks.length];
|
||||
for (int x = 0; x < types.length; x++) {
|
||||
types[x] = callbacks[x].getClass();
|
||||
}
|
||||
enhancer.setCallbackTypes(types);
|
||||
|
||||
// Generate the proxy class and create a proxy instance.
|
||||
// Object proxy;
|
||||
// if (this.constructorArgs != null) {
|
||||
// proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
|
||||
// }
|
||||
// else {
|
||||
@SuppressWarnings("unchecked")
|
||||
T proxy = (T) enhancer.create();
|
||||
// }
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
48
testdata-subloader/src/main/java/subpkg/ProxyTestcase.java
Normal file
48
testdata-subloader/src/main/java/subpkg/ProxyTestcase.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package subpkg;
|
||||
|
||||
import superpkg.MyMethodInterceptor;
|
||||
import superpkg.Simple;
|
||||
|
||||
public class ProxyTestcase {
|
||||
|
||||
static Simple proxy = ProxyBuilder.createProxyFor(Simple.class, new MyMethodInterceptor());
|
||||
|
||||
public static void main(String[] args) {
|
||||
run();
|
||||
}
|
||||
|
||||
public static void run() {
|
||||
MyMethodInterceptor.clearLog();
|
||||
proxy.moo();
|
||||
System.out.println(MyMethodInterceptor.interceptionLog());
|
||||
}
|
||||
|
||||
public static void runMoo() {
|
||||
MyMethodInterceptor.clearLog();
|
||||
proxy.moo();
|
||||
System.out.println(MyMethodInterceptor.interceptionLog());
|
||||
}
|
||||
|
||||
public static void runBar() {
|
||||
MyMethodInterceptor.clearLog();
|
||||
// proxy.bar(1, "abc", 3L); active in ProxyTestcase2
|
||||
System.out.println(MyMethodInterceptor.interceptionLog());
|
||||
}
|
||||
|
||||
public String getProxyLoader() {
|
||||
return proxy.getClass().getClassLoader().toString();
|
||||
}
|
||||
|
||||
public String getSimpleLoader() {
|
||||
return Simple.class.getClassLoader().toString();
|
||||
}
|
||||
|
||||
public static void configureTest1() {
|
||||
MyMethodInterceptor.setCallSupers(false);
|
||||
}
|
||||
|
||||
public static void configureTest2() {
|
||||
MyMethodInterceptor.setCallSupers(true);
|
||||
}
|
||||
|
||||
}
|
||||
8
testdata-subloader/src/main/java/subpkg/Subby.java
Normal file
8
testdata-subloader/src/main/java/subpkg/Subby.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package subpkg;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Subby implements java.io.Serializable {
|
||||
public String toString() {
|
||||
return "a subby";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user