1 |
14 |
jlechner |
/* VMProxy.java -- VM interface for proxy class
|
2 |
|
|
Copyright (C) 2005 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GNU Classpath.
|
5 |
|
|
|
6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
9 |
|
|
any later version.
|
10 |
|
|
|
11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 |
|
|
02110-1301 USA.
|
20 |
|
|
|
21 |
|
|
Linking this library statically or dynamically with other modules is
|
22 |
|
|
making a combined work based on this library. Thus, the terms and
|
23 |
|
|
conditions of the GNU General Public License cover the whole
|
24 |
|
|
combination.
|
25 |
|
|
|
26 |
|
|
As a special exception, the copyright holders of this library give you
|
27 |
|
|
permission to link this library with independent modules to produce an
|
28 |
|
|
executable, regardless of the license terms of these independent
|
29 |
|
|
modules, and to copy and distribute the resulting executable under
|
30 |
|
|
terms of your choice, provided that you also meet, for each linked
|
31 |
|
|
independent module, the terms and conditions of the license of that
|
32 |
|
|
module. An independent module is a module which is not derived from
|
33 |
|
|
or based on this library. If you modify this library, you may extend
|
34 |
|
|
this exception to your version of the library, but you are not
|
35 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
36 |
|
|
exception statement from your version. */
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
package java.lang.reflect;
|
40 |
|
|
|
41 |
|
|
final class VMProxy
|
42 |
|
|
{
|
43 |
|
|
/**
|
44 |
|
|
* Set to true if the VM provides a native method to implement
|
45 |
|
|
* Proxy.getProxyClass completely, including argument verification.
|
46 |
|
|
* If this is true, HAVE_NATIVE_GET_PROXY_DATA and
|
47 |
|
|
* HAVE_NATIVE_GENERATE_PROXY_CLASS should be false.
|
48 |
|
|
* @see java.lang.reflect.Proxy
|
49 |
|
|
*/
|
50 |
|
|
static boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
* Set to true if the VM provides a native method to implement
|
54 |
|
|
* the first part of Proxy.getProxyClass: generation of the array
|
55 |
|
|
* of methods to convert, and verification of the arguments.
|
56 |
|
|
* If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
|
57 |
|
|
* @see java.lang.reflect.Proxy
|
58 |
|
|
*/
|
59 |
|
|
static boolean HAVE_NATIVE_GET_PROXY_DATA = false;
|
60 |
|
|
|
61 |
|
|
/**
|
62 |
|
|
* Set to true if the VM provides a native method to implement
|
63 |
|
|
* the second part of Proxy.getProxyClass: conversion of an array of
|
64 |
|
|
* methods into an actual proxy class.
|
65 |
|
|
* If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
|
66 |
|
|
* @see java.lang.reflect.Proxy
|
67 |
|
|
*/
|
68 |
|
|
static boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
|
69 |
|
|
|
70 |
|
|
/**
|
71 |
|
|
* Optional native method to replace (and speed up) the pure Java
|
72 |
|
|
* implementation of getProxyClass. Only needed if
|
73 |
|
|
* VMProxy.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the
|
74 |
|
|
* work of both getProxyData and generateProxyClass with no
|
75 |
|
|
* intermediate form in Java. The native code may safely assume that
|
76 |
|
|
* this class must be created, and does not already exist.
|
77 |
|
|
*
|
78 |
|
|
* @param loader the class loader to define the proxy class in; null
|
79 |
|
|
* implies the bootstrap class loader
|
80 |
|
|
* @param interfaces the interfaces the class will extend
|
81 |
|
|
* @return the generated proxy class
|
82 |
|
|
* @throws IllegalArgumentException if the constraints for getProxyClass
|
83 |
|
|
* were violated, except for problems with null
|
84 |
|
|
* @throws NullPointerException if `interfaces' is null or contains
|
85 |
|
|
* a null entry, or if handler is null
|
86 |
|
|
* @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS
|
87 |
|
|
* @see #getProxyClass(ClassLoader, Class[])
|
88 |
|
|
* @see #getProxyData(ClassLoader, Class[])
|
89 |
|
|
* @see #generateProxyClass(ProxyData)
|
90 |
|
|
*/
|
91 |
|
|
static Class getProxyClass(ClassLoader loader, Class[] interfaces)
|
92 |
|
|
{
|
93 |
|
|
return null;
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
/**
|
97 |
|
|
* Optional native method to replace (and speed up) the pure Java
|
98 |
|
|
* implementation of getProxyData. Only needed if
|
99 |
|
|
* Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code
|
100 |
|
|
* may safely assume that a new ProxyData object must be created which
|
101 |
|
|
* does not duplicate any existing ones.
|
102 |
|
|
*
|
103 |
|
|
* @param loader the class loader to define the proxy class in; null
|
104 |
|
|
* implies the bootstrap class loader
|
105 |
|
|
* @param interfaces the interfaces the class will extend
|
106 |
|
|
* @return all data that is required to make this proxy class
|
107 |
|
|
* @throws IllegalArgumentException if the constraints for getProxyClass
|
108 |
|
|
* were violated, except for problems with null
|
109 |
|
|
* @throws NullPointerException if `interfaces' is null or contains
|
110 |
|
|
* a null entry, or if handler is null
|
111 |
|
|
* @see Configuration.HAVE_NATIVE_GET_PROXY_DATA
|
112 |
|
|
* @see #getProxyClass(ClassLoader, Class[])
|
113 |
|
|
* @see #getProxyClass(ClassLoader, Class[])
|
114 |
|
|
* @see ProxyType#getProxyData()
|
115 |
|
|
*/
|
116 |
|
|
static Proxy.ProxyData getProxyData(ClassLoader loader, Class[] interfaces)
|
117 |
|
|
{
|
118 |
|
|
return null;
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
/**
|
122 |
|
|
* Optional native method to replace (and speed up) the pure Java
|
123 |
|
|
* implementation of generateProxyClass. Only needed if
|
124 |
|
|
* Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native
|
125 |
|
|
* code may safely assume that a new Class must be created, and that
|
126 |
|
|
* the ProxyData object does not describe any existing class.
|
127 |
|
|
*
|
128 |
|
|
* @param loader the class loader to define the proxy class in; null
|
129 |
|
|
* implies the bootstrap class loader
|
130 |
|
|
* @param data the struct of information to convert to a Class. This
|
131 |
|
|
* has already been verified for all problems except exceeding
|
132 |
|
|
* VM limitations
|
133 |
|
|
* @return the newly generated class
|
134 |
|
|
* @throws IllegalArgumentException if VM limitations are exceeded
|
135 |
|
|
* @see #getProxyClass(ClassLoader, Class[])
|
136 |
|
|
* @see #getProxyClass(ClassLoader, Class[])
|
137 |
|
|
* @see ProxyData#generateProxyClass(ClassLoader)
|
138 |
|
|
*/
|
139 |
|
|
static Class generateProxyClass(ClassLoader loader, Proxy.ProxyData data)
|
140 |
|
|
{
|
141 |
|
|
return null;
|
142 |
|
|
}
|
143 |
|
|
}
|