38 |
|
|
39 |
package java.lang.reflect; |
package java.lang.reflect; |
40 |
|
|
41 |
|
import gnu.classpath.Configuration; |
42 |
|
import gnu.java.lang.reflect.TypeSignature; |
43 |
|
|
44 |
import java.io.Serializable; |
import java.io.Serializable; |
45 |
import java.security.ProtectionDomain; |
import java.security.ProtectionDomain; |
|
import java.util.Map; |
|
46 |
import java.util.HashMap; |
import java.util.HashMap; |
|
import java.util.Set; |
|
47 |
import java.util.HashSet; |
import java.util.HashSet; |
48 |
import java.util.Iterator; |
import java.util.Iterator; |
49 |
import gnu.classpath.Configuration; |
import java.util.Map; |
50 |
import gnu.java.lang.reflect.TypeSignature; |
import java.util.Set; |
51 |
|
|
52 |
/** |
/** |
53 |
* This class allows you to dynamically create an instance of any (or |
* This class allows you to dynamically create an instance of any (or |
154 |
* @see InvocationHandler |
* @see InvocationHandler |
155 |
* @see UndeclaredThrowableException |
* @see UndeclaredThrowableException |
156 |
* @see Class |
* @see Class |
157 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake (ebb9@email.byu.edu) |
158 |
* @since 1.3 |
* @since 1.3 |
159 |
* @status updated to 1.5, except for the use of ProtectionDomain |
* @status updated to 1.5, except for the use of ProtectionDomain |
160 |
*/ |
*/ |
723 |
private static final class ProxyData |
private static final class ProxyData |
724 |
{ |
{ |
725 |
/** |
/** |
726 |
* The package this class is in *including the trailing dot* or "" for |
* The package this class is in <b>including the trailing dot</b> |
727 |
* the unnamed (aka default) package. |
* or an empty string for the unnamed (aka default) package. |
728 |
*/ |
*/ |
729 |
String pack; |
String pack; |
730 |
|
|
755 |
/** |
/** |
756 |
* For unique id's |
* For unique id's |
757 |
*/ |
*/ |
758 |
private static int count = 0; |
private static int count; |
759 |
|
|
760 |
/** |
/** |
761 |
* The id of this proxy class |
* The id of this proxy class |
772 |
/** |
/** |
773 |
* Return the name of a package (including the trailing dot) |
* Return the name of a package (including the trailing dot) |
774 |
* given the name of a class. |
* given the name of a class. |
775 |
* Returns "" if no package. We use this in preference to |
* Returns an empty string if no package. We use this in preference to |
776 |
* using Class.getPackage() to avoid problems with ClassLoaders |
* using Class.getPackage() to avoid problems with ClassLoaders |
777 |
* that don't set the package. |
* that don't set the package. |
778 |
*/ |
*/ |
1303 |
* implies the bootstrap class loader |
* implies the bootstrap class loader |
1304 |
* @return the proxy class Class object |
* @return the proxy class Class object |
1305 |
*/ |
*/ |
1306 |
final Class generate(ClassLoader loader) |
Class generate(ClassLoader loader) |
1307 |
{ |
{ |
1308 |
byte[] bytecode = new byte[pool.length() + stream.length()]; |
byte[] bytecode = new byte[pool.length() + stream.length()]; |
1309 |
// More efficient to bypass calling charAt() repetitively. |
// More efficient to bypass calling charAt() repetitively. |