diff options
| author | Aaron M. Renn <arenn@urbanophile.com> | 1998-12-25 03:46:02 +0000 |
|---|---|---|
| committer | Aaron M. Renn <arenn@urbanophile.com> | 1998-12-25 03:46:02 +0000 |
| commit | 67dabb975a56416599fc10ad49b7c8d738b5c4db (patch) | |
| tree | 17764c569cbfc596dea9872b564da35bfa9f0002 /vm/reference/java/lang/Class.java | |
| parent | 03cdd8a03faada92187ebc19247cb039ba88ab06 (diff) | |
| download | classpath-67dabb975a56416599fc10ad49b7c8d738b5c4db.tar.gz | |
Remove name and superclass variables and simply make the getName() and
getSuperclass() method natives. Note that Japhar currently manually and
arbitrarily sets the field count on java/lang/Class to 0, so using
instance variables won't work in this class. This should be resolved
at a future date.
Diffstat (limited to 'vm/reference/java/lang/Class.java')
| -rwxr-xr-x | vm/reference/java/lang/Class.java | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/vm/reference/java/lang/Class.java b/vm/reference/java/lang/Class.java index 05ed8bc18..b9ceaaef2 100755 --- a/vm/reference/java/lang/Class.java +++ b/vm/reference/java/lang/Class.java @@ -49,9 +49,10 @@ import gnu.java.lang.*; **/ public class Class { - Class superclass = null; - String name = null; - Object[] signers = null; + private Object[] signers = null; + + private Class() { + } /** Return the human-readable form of this Object. For ** class, that means "interface " or "class " plus the @@ -68,12 +69,7 @@ public class Class { ** @return the name of this class. ** @since JDK1.0 **/ - public String getName() { - if(name != null) - return name; - else - return nativeGetName(); - } + public native String getName(); /** Get whether this class is an interface or not. Array ** types are not interfaces. @@ -87,12 +83,7 @@ public class Class { ** @return the direct superclass of this class. ** @since JDK1.0 **/ - public Class getSuperclass() { - if(superclass != null) - return superclass; - else - return nativeGetSuperclass(); - } + public native Class getSuperclass(); /** Get the interfaces this class <EM>directly</EM> ** implements, in the order that they were declared. @@ -196,7 +187,7 @@ public class Class { public Class getComponentType() { if(isArray()) { try { - return Class.forName(name.substring(1)); + return Class.forName(getName().substring(1)); } catch(ClassNotFoundException e) { return null; } @@ -415,7 +406,5 @@ public class Class { **/ public native Field[] getDeclaredFields() throws SecurityException; - private native String nativeGetName(); - private native Class nativeGetSuperclass(); } |
