亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? proxy.java

?? kaffe Java 解釋器語言,源碼,Java的子集系統,開放源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/* Proxy.java -- build a proxy class that implements reflected interfaces   Copyright (C) 2001, 2002 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package java.lang.reflect;import java.io.Serializable;import java.security.ProtectionDomain;import java.util.Map;import java.util.HashMap;import java.util.Set;import java.util.HashSet;import java.util.Iterator;import gnu.classpath.Configuration;import gnu.java.lang.reflect.TypeSignature;/** * This class allows you to dynamically create an instance of any (or * even multiple) interfaces by reflection, and decide at runtime * how that instance will behave by giving it an appropriate * {@link InvocationHandler}.  Proxy classes serialize specially, so * that the proxy object can be reused between VMs, without requiring * a persistent copy of the generated class code. * * <h3>Creation</h3> * To create a proxy for some interface Foo: * * <pre> *   InvocationHandler handler = new MyInvocationHandler(...); *   Class proxyClass = Proxy.getProxyClass( *       Foo.class.getClassLoader(), new Class[] { Foo.class }); *   Foo f = (Foo) proxyClass *       .getConstructor(new Class[] { InvocationHandler.class }) *       .newInstance(new Object[] { handler }); * </pre> * or more simply: * <pre> *   Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(), *                                        new Class[] { Foo.class }, *                                        handler); * </pre> * * <h3>Dynamic Proxy Classes</h3> * A dynamic proxy class is created at runtime, and has the following * properties: * <ul> *  <li>The class is <code>public</code> and <code>final</code>, *      and is neither <code>abstract</code> nor an inner class.</li> *  <li>The class has no canonical name (there is no formula you can use *      to determine or generate its name), but begins with the *      sequence "$Proxy".  Abuse this knowledge at your own peril. *      (For now, '$' in user identifiers is legal, but it may not *      be that way forever. You weren't using '$' in your *      identifiers, were you?)</li> *  <li>The class extends Proxy, and explicitly implements all the *      interfaces specified at creation, in order (this is important *      for determining how method invocation is resolved).  Note that *      a proxy class implements {@link Serializable}, at least *      implicitly, since Proxy does, but true serial behavior *      depends on using a serializable invocation handler as well.</li> *  <li>If at least one interface is non-public, the proxy class *      will be in the same package.  Otherwise, the package is *      unspecified.  This will work even if the package is sealed *      from user-generated classes, because Proxy classes are *      generated by a trusted source.  Meanwhile, the proxy class *      belongs to the classloader you designated.</li> *  <li>Reflection works as expected: {@link Class#getInterfaces()} and *      {@link Class#getMethods()} work as they do on normal classes.</li> *  <li>The method {@link #isProxyClass()} will distinguish between *      true proxy classes and user extensions of this class.  It only *      returns true for classes created by {@link #getProxyClass}.</li> *  <li>The {@link ProtectionDomain} of a proxy class is the same as for *      bootstrap classes, such as Object or Proxy, since it is created by *      a trusted source.  This protection domain will typically be granted *      {@link java.security.AllPermission}. But this is not a security *      risk, since there are adequate permissions on reflection, which is *      the only way to create an instance of the proxy class.</li> *  <li>The proxy class contains a single constructor, which takes as *      its only argument an {@link InvocationHandler}.  The method *      {@link #newInstance} is shorthand to do the necessary *      reflection.</li> * </ul> * * <h3>Proxy Instances</h3> * A proxy instance is an instance of a proxy class.  It has the * following properties, many of which follow from the properties of a * proxy class listed above: * <ul> *  <li>For a proxy class with Foo listed as one of its interfaces, the *      expression <code>proxy instanceof Foo</code> will return true, *      and the expression <code>(Foo) proxy</code> will succeed without *      a {@link ClassCastException}.</li> *  <li>Each proxy instance has an invocation handler, which can be *      accessed by {@link #getInvocationHandler(Object)}.  Any call *      to an interface method, including {@link Object#hashcode()}, *      {@link Object#equals(Object)}, or {@link Object#toString()}, *      but excluding the public final methods of Object, will be *      encoded and passed to the {@link InvocationHandler#invoke} *      method of this handler.</li> * </ul> * * <h3>Inheritance Issues</h3> * A proxy class may inherit a method from more than one interface. * The order in which interfaces are listed matters, because it determines * which reflected {@link Method} object will be passed to the invocation * handler.  This means that the dynamically generated class cannot * determine through which interface a method is being invoked.<p> * * In short, if a method is declared in Object (namely, hashCode, * equals, or toString), then Object will be used; otherwise, the * leftmost interface that inherits or declares a method will be used, * even if it has a more permissive throws clause than what the proxy * class is allowed. Thus, in the invocation handler, it is not always * safe to assume that every class listed in the throws clause of the * passed Method object can safely be thrown; fortunately, the Proxy * instance is robust enough to wrap all illegal checked exceptions in * {@link UndeclaredThrowableException}. * * @see InvocationHandler * @see UndeclaredThrowableException * @see Class * @author Eric Blake <ebb9@email.byu.edu> * @since 1.3 * @status updated to 1.4, except for the use of ProtectionDomain */public class Proxy implements Serializable{  /**   * Compatible with JDK 1.3+.   */  private static final long serialVersionUID = -2222568056686623797L;  /**   * Map of ProxyType to proxy class.   *   * @XXX This prevents proxy classes from being garbage collected.   * java.util.WeakHashSet is not appropriate, because that collects the   * keys, but we are interested in collecting the elements.   */  private static final Map proxyClasses = new HashMap();  /**   * The invocation handler for this proxy instance.  For Proxy, this   * field is unused, but it appears here in order to be serialized in all   * proxy classes.   *   * <em>NOTE</em>: This implementation is more secure for proxy classes   * than what Sun specifies. Sun does not require h to be immutable, but   * this means you could change h after the fact by reflection.  However,   * by making h immutable, we may break non-proxy classes which extend   * Proxy.   * @serial invocation handler associated with this proxy instance   */  protected InvocationHandler h;  /**   * Constructs a new Proxy from a subclass (usually a proxy class),   * with the specified invocation handler.   *   * <em>NOTE</em>: This throws a NullPointerException if you attempt   * to create a proxy instance with a null handler using reflection.   * This behavior is not yet specified by Sun; see Sun Bug 4487672.   *   * @param handler the invocation handler, may be null if the subclass   *        is not a proxy class   * @throws NullPointerException if handler is null and this is a proxy   *         instance   */  protected Proxy(InvocationHandler handler)  {    if (handler == null && isProxyClass(getClass()))      throw new NullPointerException("invalid handler");    h = handler;  }  /**   * Returns the proxy {@link Class} for the given ClassLoader and array   * of interfaces, dynamically generating it if necessary.   *   * There are several restrictions on this method, the violation of   * which will result in an IllegalArgumentException or   * NullPointerException:   * <ul>   *  <li>All objects in `interfaces' must represent distinct interfaces.   *      Classes, primitive types, null, and duplicates are forbidden.</li>   *  <li>The interfaces must be visible in the specified ClassLoader.   *      In other words, for each interface i:   *      <code>Class.forName(i.getName(), false, loader) == i</code>   *      must be true.</li>   *  <li>All non-public interfaces (if any) must reside in the same   *      package, or the proxy class would be non-instantiable.  If   *      there are no non-public interfaces, the package of the proxy   *      class is unspecified.</li>   *  <li>All interfaces must be compatible - if two declare a method   *      with the same name and parameters, the return type must be   *      the same and the throws clause of the proxy class will be   *      the maximal subset of subclasses of the throws clauses for   *      each method that is overridden.</li>   *  <li>VM constraints limit the number of interfaces a proxy class   *      may directly implement (however, the indirect inheritance   *      of {@link Serializable} does not count against this limit).   *      Even though most VMs can theoretically have 65535   *      superinterfaces for a class, the actual limit is smaller   *      because a class's constant pool is limited to 65535 entries,   *      and not all entries can be interfaces.</li>   * </ul><p>   *   * Note that different orders of interfaces produce distinct classes.   *   * @param loader the class loader to define the proxy class in; null   *        implies the bootstrap class loader   * @param interfaces the array of interfaces the proxy class implements,   *        may be empty, but not null   * @return the Class object of the proxy class   * @throws IllegalArgumentException if the constraints above were   *         violated, except for problems with null   * @throws NullPointerException if `interfaces' is null or contains   *         a null entry   */  // synchronized so that we aren't trying to build the same class  // simultaneously in two threads  public static synchronized Class getProxyClass(ClassLoader loader,                                                 Class[] interfaces)  {    interfaces = (Class[]) interfaces.clone();    ProxyType pt = new ProxyType(loader, interfaces);    Class clazz = (Class) proxyClasses.get(pt);    if (clazz == null)      {        if (Configuration.HAVE_NATIVE_GET_PROXY_CLASS)          clazz = getProxyClass0(loader, interfaces);        else          {            ProxyData data = (Configuration.HAVE_NATIVE_GET_PROXY_DATA                              ? getProxyData0(loader, interfaces)                              : ProxyData.getProxyData(pt));            // FIXME workaround for bug in gcj 3.0.x            // Not needed with the latest gcj from cvs            //clazz = (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS            //	       ? generateProxyClass0(loader, data)            //         : new ClassFactory(data).generate(loader));            if (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS)              clazz = generateProxyClass0(loader, data);            else              {                ClassFactory cf = new ClassFactory(data);                clazz = cf.generate(loader);              }          }        Object check = proxyClasses.put(pt, clazz);        // assert check == null && clazz != null;        if (check != null || clazz == null)          throw new InternalError(/*"Fatal flaw in getProxyClass"*/);      }    return clazz;  }  /**   * Combines several methods into one.  This is equivalent to:   * <pre>   *   Proxy.getProxyClass(loader, interfaces)   *       .getConstructor(new Class[] {InvocationHandler.class})   *       .newInstance(new Object[] {handler});   * </pre>   * except that it will not fail with the normal problems caused   * by reflection.  It can still fail for the same reasons documented   * in getProxyClass, or if handler is null.   *   * @param loader the class loader to define the proxy class in; null   *        implies the bootstrap class loader   * @param interfaces the array of interfaces the proxy class implements,   *        may be empty, but not null   * @param handler the invocation handler, may not be null   * @return a proxy instance implementing the specified interfaces   * @throws IllegalArgumentException if the constraints for getProxyClass   *         were violated, except for problems with null   * @throws NullPointerException if `interfaces' is null or contains   *         a null entry, or if handler is null   * @see #getProxyClass(ClassLoader, Class[])   * @see Class#getConstructor(Class[])   * @see Constructor#newInstance(Object[])   */  public static Object newProxyInstance(ClassLoader loader,                                        Class[] interfaces,                                        InvocationHandler handler)  {    try      {        // getProxyClass() and Proxy() throw the necessary exceptions        return getProxyClass(loader, interfaces)          .getConstructor(new Class[] {InvocationHandler.class})          .newInstance(new Object[] {handler});      }    catch (RuntimeException e)      {        // Let IllegalArgumentException, NullPointerException escape.        // assert e instanceof IllegalArgumentException        //   || e instanceof NullPointerException;        throw e;      }    catch (InvocationTargetException e)      {        // Let wrapped NullPointerException escape.        // assert e.getTargetException() instanceof NullPointerException        throw (NullPointerException) e.getCause();      }    catch (Exception e)      {        // Covers InstantiationException, IllegalAccessException,        // NoSuchMethodException, none of which should be generated        // if the proxy class was generated correctly.        // assert false;        throw (Error) new InternalError("Unexpected: " + e).initCause(e);      }  }  /**   * Returns true if and only if the Class object is a dynamically created   * proxy class (created by <code>getProxyClass</code> or by the   * syntactic sugar of <code>newProxyInstance</code>).   *   * <p>This check is secure (in other words, it is not simply   * <code>clazz.getSuperclass() == Proxy.class</code>), it will not   * be spoofed by non-proxy classes that extend Proxy.   *   * @param clazz the class to check, must not be null   * @return true if the class represents a proxy class   * @throws NullPointerException if clazz is null   */  // This is synchronized on the off chance that another thread is  // trying to add a class to the map at the same time we read it.  public static synchronized boolean isProxyClass(Class clazz)  {    if (! Proxy.class.isAssignableFrom(clazz))      return false;    // This is a linear search, even though we could do an O(1) search    // using new ProxyType(clazz.getClassLoader(), clazz.getInterfaces()).    return proxyClasses.containsValue(clazz);  }  /**   * Returns the invocation handler for the given proxy instance.<p>   *   * <em>NOTE</em>: We guarantee a non-null result if successful,   * but Sun allows the creation of a proxy instance with a null   * handler.  See the comments for {@link #Proxy(InvocationHandler)}.   *   * @param proxy the proxy instance, must not be null   * @return the invocation handler, guaranteed non-null.   * @throws IllegalArgumentException if   *         <code>Proxy.isProxyClass(proxy.getClass())</code> returns false.   * @throws NullPointerException if proxy is null   */  public static InvocationHandler getInvocationHandler(Object proxy)  {    if (! isProxyClass(proxy.getClass()))      throw new IllegalArgumentException("not a proxy instance");    return ((Proxy) proxy).h;  }  /**   * Optional native method to replace (and speed up) the pure Java   * implementation of getProxyClass.  Only needed if   * Configuration.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the   * work of both getProxyData0 and generateProxyClass0 with no   * intermediate form in Java. The native code may safely assume that   * this class must be created, and does not already exist.   *   * @param loader the class loader to define the proxy class in; null   *        implies the bootstrap class loader   * @param interfaces the interfaces the class will extend

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品免费在线观看| 成人午夜电影网站| 99久久夜色精品国产网站| 88在线观看91蜜桃国自产| 亚洲国产精品99久久久久久久久| 五月天一区二区| av电影一区二区| 久久久久久久av麻豆果冻| 手机精品视频在线观看| 日本韩国一区二区| 国产精品色噜噜| 国产一二精品视频| 日韩欧美国产午夜精品| 亚洲国产精品麻豆| 色素色在线综合| 日本一区二区成人| 国产一区不卡在线| 精品免费99久久| 日韩电影免费一区| 欧美日韩一区久久| 国产精品久久综合| 亚洲免费av在线| 成人av网站在线观看| 国产视频视频一区| 国产一区二区在线视频| 精品人伦一区二区色婷婷| 日韩成人免费看| 在线欧美日韩国产| 亚洲欧美偷拍卡通变态| 成人h动漫精品一区二| 国产欧美视频在线观看| 国产一区二区三区国产| 2021久久国产精品不只是精品| 男人的天堂亚洲一区| 91精品国产综合久久久久 | 97国产一区二区| 国产亚洲成av人在线观看导航| 久久福利资源站| 精品久久久久av影院| 久久精品国产在热久久| 日韩三级视频在线看| 日韩av在线播放中文字幕| 51午夜精品国产| 日本中文字幕一区二区视频| 51午夜精品国产| 蜜桃精品视频在线观看| 日韩欧美电影一二三| 九色综合狠狠综合久久| 精品粉嫩超白一线天av| 国产中文字幕精品| 久久久久97国产精华液好用吗| 狠狠色狠狠色合久久伊人| 久久免费精品国产久精品久久久久| 精品一区二区免费在线观看| 精品嫩草影院久久| 国产在线精品视频| 国产精品少妇自拍| 色婷婷激情久久| 亚洲日本在线天堂| 国产尤物一区二区在线| 国产午夜亚洲精品理论片色戒| 国产91丝袜在线播放0| 国产精品国产自产拍高清av王其| 91网页版在线| 亚洲成av人影院在线观看网| 日韩一区二区免费在线电影| 国产又黄又大久久| 日韩一区欧美一区| 欧美吻胸吃奶大尺度电影| 日韩高清国产一区在线| 精品91自产拍在线观看一区| 成人精品视频一区| 一二三区精品福利视频| 在线综合+亚洲+欧美中文字幕| 久久草av在线| 国产精品国产三级国产aⅴ无密码| 一本大道综合伊人精品热热| 午夜精品福利一区二区蜜股av| 日韩欧美在线综合网| 高清不卡在线观看| 亚洲一区中文日韩| 精品剧情在线观看| 99精品桃花视频在线观看| 午夜激情综合网| 久久精品一区二区三区四区| 一本久久a久久免费精品不卡| 日韩精品欧美成人高清一区二区| 久久久久国产精品人| 91蜜桃婷婷狠狠久久综合9色| 日韩黄色小视频| 国产欧美精品一区二区色综合朱莉| 色菇凉天天综合网| 精品午夜久久福利影院| 亚洲美女免费视频| 精品国产自在久精品国产| 91视频.com| 国精产品一区一区三区mba视频| ...中文天堂在线一区| 日韩欧美在线综合网| 91麻豆蜜桃一区二区三区| 另类小说视频一区二区| 亚洲视频免费看| 99re66热这里只有精品3直播| 亚洲色欲色欲www在线观看| 欧美一区二区三区婷婷月色| 国产91精品欧美| 日韩高清国产一区在线| 中文字幕一区二区三区在线播放| 欧美一区二区三区色| av在线综合网| 国内精品免费**视频| 亚洲无人区一区| 国产精品麻豆视频| 精品少妇一区二区三区在线播放 | 午夜精品久久久久久不卡8050| 久久久久成人黄色影片| 欧美精品日韩综合在线| 91片黄在线观看| 国产不卡在线播放| 美日韩黄色大片| 亚洲一区二区三区视频在线播放| 中文字幕不卡在线观看| 日韩欧美一级片| 欧美色图片你懂的| 91视频在线看| 国产99精品国产| 激情欧美一区二区三区在线观看| 亚洲高清免费在线| 亚洲视频免费观看| 中文一区一区三区高中清不卡| 91精品国产免费久久综合| 色婷婷综合久久久| 成人av午夜电影| 国产成人在线网站| 精品综合久久久久久8888| 丝袜美腿成人在线| 亚洲国产视频a| 亚洲综合在线电影| 亚洲男人天堂一区| 亚洲欧洲av在线| 国产精品乱人伦| 中文字幕巨乱亚洲| 国产日产欧美一区二区视频| 精品国产一区二区三区久久久蜜月| 制服丝袜亚洲网站| 在线电影一区二区三区| 成人免费毛片app| 亚洲v日本v欧美v久久精品| 亚洲精品免费电影| 亚洲精品中文在线影院| 中文字幕亚洲精品在线观看| 国产精品福利在线播放| 国产精品卡一卡二卡三| 亚洲欧洲精品天堂一级| 国产精品成人一区二区三区夜夜夜| 国产欧美日韩精品在线| 欧美高清在线精品一区| 欧美激情一区二区在线| 国产精品日日摸夜夜摸av| 国产天堂亚洲国产碰碰| 国产日产欧美一区二区视频| 欧美高清在线精品一区| 亚洲欧洲日产国产综合网| 亚洲欧洲精品天堂一级| 亚洲美女屁股眼交| 亚洲狠狠爱一区二区三区| 亚洲一区视频在线观看视频| 亚洲成av人综合在线观看| 日韩精品高清不卡| 久久精品国产久精国产爱| 国产在线观看免费一区| 国产盗摄女厕一区二区三区 | 亚洲欧美一区二区三区久本道91| 日韩一区有码在线| 亚洲狠狠丁香婷婷综合久久久| 亚洲一区二区三区中文字幕在线| 亚洲高清在线视频| 麻豆精品新av中文字幕| 国产一区二区三区黄视频 | 激情五月婷婷综合| 韩国女主播一区| k8久久久一区二区三区| 日本韩国精品一区二区在线观看| 在线观看国产日韩| 日韩一二三四区| 久久久精品2019中文字幕之3| 国产精品乱人伦中文| 一区二区三区四区高清精品免费观看| 亚洲影视资源网| 美脚の诱脚舐め脚责91 | 99精品视频一区| 欧美精品第1页| 日韩一区二区三区免费观看| 精品久久久久久久久久久院品网| 中文字幕久久午夜不卡| 一区二区成人在线观看| 日日夜夜精品免费视频| 国产福利一区在线观看| 色婷婷精品大在线视频| 日韩美女一区二区三区|