???????????????????????????£?
????loader??????????????ClassLoder??
????interfaces???????????????б?
????h???????????????????????漲????????InvocationHandler?????????
??????????????£????????????????????????????????????????к????????
??????????????????????Ч???
??????????????????????????????????????????????£????????newProxyInstance????????????????????????????????????????????????????????????????????????????????????????н????????????????invoke????????invoke???????????????????????????????????????????????????????????????????????????????????????????
????3. ????????????????
???????????Main???????????????“$Proxy”??class?????????????????????????????????????????????????????????????
package com.sun.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.UndeclaredThrowableException;
public final class $Proxy0 extends Proxy implements Sell {
//??5??Method?????????equals()??toString()??ad()??sell()??hashCode()????
private static Method m1;
private static Method m2;
private static Method m4;
private static Method m3;
private static Method m0;
//?????????????InvocationHandler??????????????????????????“????????”??????????????????????????“????????”??
public $Proxy0(InvocationHandler var1) throws  {
super??var1);
}
//??equals??????????????????super.h.invoke???????????????е?h???????????????д????InvocationHandler???????μ?toString()??sell()??ad()??hashCode()????????
public final boolean equals(Object var1) throws  {
try {
return ((Boolean)super.h.invoke(this?? m1?? new Object[]{var1})).booleanValue();
} catch (RuntimeException | Error var3) {
throw var3;
} catch (Throwable var4) {
throw new UndeclaredThrowableException(var4);
}
}
public final String toString() throws  {
try {
return (String)super.h.invoke(this?? m2?? (Object[])null);
} catch (RuntimeException | Error var2) {
throw var2;
} catch (Throwable var3) {
throw new UndeclaredThrowableException(var3);
}
}
public final void ad() throws  {
try {
super.h.invoke(this?? m4?? (Object[])null);
} catch (RuntimeException | Error var2) {
throw var2;
} catch (Throwable var3) {
throw new UndeclaredThrowableException(var3);
}
}
public final void sell() throws  {
try {
super.h.invoke(this?? m3?? (Object[])null);
} catch (RuntimeException | Error var2) {
throw var2;
} catch (Throwable var3) {
throw new UndeclaredThrowableException(var3);
}
}
public final int hashCode() throws  {
try {
return ((Integer)super.h.invoke(this?? m0?? (Object[])null)).intValue();
} catch (RuntimeException | Error var2) {
throw var2;
} catch (Throwable var3) {
throw new UndeclaredThrowableException(var3);
}
}
//???????Method????????????????????????????Method????
static {
try {
m1 = Class.forName("java.lang.Object").getMethod("equals"?? new Class[]{Class.forName("java.lang.Object")});
m2 = Class.forName("java.lang.Object").getMethod("toString"?? new Class[0]);
m4 = Class.forName("Sell").getMethod("ad"?? new Class[0]);
m3 = Class.forName("Sell").getMethod("sell"?? new Class[0]);
m0 = Class.forName("java.lang.Object").getMethod("hashCode"?? new Class[0]);
} catch (NoSuchMethodException var2) {
throw new NoSuchMethodError(var2.getMessage());
} catch (ClassNotFoundException var3) {
throw new NoClassDefFoundError(var3.getMessage());
}
}
}
????????????????????????????????????????????????????????????????????????漰?????????????????仹??????????С??????ο?????Java??????????????
????????????????????????????????????????????????????????????????????????????????????????????????newProxyInstance???????????????????????????и??????????????????