1 | /*
|
---|
2 | * java.lang.ClassLoader: part of the Java Class Libraries project.
|
---|
3 | * Copyright (C) 1998, 2001, 2002 Free Software Foundation
|
---|
4 | *
|
---|
5 | * This library is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU Library General Public
|
---|
7 | * License as published by the Free Software Foundation; either
|
---|
8 | * version 2 of the License, or (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This library is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
13 | * Library General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU Library General Public
|
---|
16 | * License along with this library; if not, write to the
|
---|
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
18 | * Boston, MA 02111-1307, USA.
|
---|
19 | */
|
---|
20 |
|
---|
21 | package java.lang;
|
---|
22 |
|
---|
23 | import java.util.*;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * java.lang.VMClassLoader is a package-private helper for VMs to implement
|
---|
27 | * on behalf of java.lang.ClassLoader.
|
---|
28 | *
|
---|
29 | * @author John Keiser
|
---|
30 | * @version 1.1.0, Sep 22 1998
|
---|
31 | * @since CP1.1
|
---|
32 | */
|
---|
33 |
|
---|
34 | class VMClassLoader {
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Helper to define a class using a string of bytes.
|
---|
38 | *
|
---|
39 | * @param name the name to give the class. null if unknown.
|
---|
40 | * @param data the data representing the classfile, in classfile format.
|
---|
41 | * @param offset the offset into the data where the classfile starts.
|
---|
42 | * @param len the length of the classfile data in the array.
|
---|
43 | * @return the class that was defined.
|
---|
44 | * @exception ClassFormatError if the byte array is not in proper classfile format.
|
---|
45 | */
|
---|
46 | final static native Class defineClass(ClassLoader cl, String name,
|
---|
47 | byte[] data, int offset, int len)
|
---|
48 | throws ClassFormatError;
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Helper to resolve all references to other classes from this class.
|
---|
52 | * @param c the class to resolve.
|
---|
53 | */
|
---|
54 | // Not yet needed for libgcj.
|
---|
55 | // final static native void resolveClass(Class c);
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Helper for java.lang.Integer, Byte, etc. to get the TYPE class
|
---|
59 | * at initialization time.
|
---|
60 | *
|
---|
61 | * @param type code for the primitive type.
|
---|
62 | */
|
---|
63 | static native Class getPrimitiveClass(char type);
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * The system default for assertion status. This is used for all system
|
---|
67 | * classes (those with a null ClassLoader), as well as the initial value for
|
---|
68 | * every ClassLoader's default assertion status.
|
---|
69 | *
|
---|
70 | * XXX - Not implemented yet; this requires native help.
|
---|
71 | *
|
---|
72 | * @return the system-wide default assertion status
|
---|
73 | */
|
---|
74 | static final boolean defaultAssertionStatus()
|
---|
75 | {
|
---|
76 | return true;
|
---|
77 | }
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * The system default for package assertion status. This is used for all
|
---|
81 | * ClassLoader's packageAssertionStatus defaults. It must be a map of
|
---|
82 | * package names to Boolean.TRUE or Boolean.FALSE, with the unnamed package
|
---|
83 | * represented as a null key.
|
---|
84 | *
|
---|
85 | * XXX - Not implemented yet; this requires native help.
|
---|
86 | *
|
---|
87 | * @return a (read-only) map for the default packageAssertionStatus
|
---|
88 | */
|
---|
89 | static final Map packageAssertionStatus()
|
---|
90 | {
|
---|
91 | return new HashMap();
|
---|
92 | }
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * The system default for class assertion status. This is used for all
|
---|
96 | * ClassLoader's classAssertionStatus defaults. It must be a map of
|
---|
97 | * class names to Boolean.TRUE or Boolean.FALSE
|
---|
98 | *
|
---|
99 | * XXX - Not implemented yet; this requires native help.
|
---|
100 | *
|
---|
101 | * @return a (read-only) map for the default classAssertionStatus
|
---|
102 | */
|
---|
103 | static final Map classAssertionStatus()
|
---|
104 | {
|
---|
105 | return new HashMap();
|
---|
106 | }
|
---|
107 | }
|
---|