projects
/
org.ibex.classgen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9b8b835
)
fix Type.equals
author
brian
<brian@brianweb.net>
Fri, 28 May 2004 16:29:48 +0000
(16:29 +0000)
committer
brian
<brian@brianweb.net>
Fri, 28 May 2004 16:29:48 +0000
(16:29 +0000)
darcs-hash:
20040528162948
-24bed-
e98684bd0c250a7303052003b9ea99301f98f700
.gz
src/org/ibex/classgen/Type.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/classgen/Type.java
b/src/org/ibex/classgen/Type.java
index
dd73d70
..
33af24d
100644
(file)
--- a/
src/org/ibex/classgen/Type.java
+++ b/
src/org/ibex/classgen/Type.java
@@
-19,14
+19,13
@@
public class Type {
public static final Type[] NO_ARGS = new Type[0];
public static final Type[] NO_ARGS = new Type[0];
- String descriptor;
+ final String descriptor;
- Type() { }
Type(String descriptor) { this.descriptor = descriptor; }
public final String getDescriptor() { return descriptor; }
public int hashCode() { return descriptor.hashCode(); }
Type(String descriptor) { this.descriptor = descriptor; }
public final String getDescriptor() { return descriptor; }
public int hashCode() { return descriptor.hashCode(); }
- public boolean equals(Object o) { return o instanceof Type && ((Type)o).descriptor.equals(descriptor); }
+ public boolean equals(java.lang.Object o) { return o instanceof Type && ((Type)o).descriptor.equals(descriptor); }
public static Type arrayType(Type base) { return arrayType(base,1); }
public static Type arrayType(Type base, int dim) {
public static Type arrayType(Type base) { return arrayType(base,1); }
public static Type arrayType(Type base, int dim) {
@@
-37,12
+36,14
@@
public class Type {
}
public static class Object extends Type {
}
public static class Object extends Type {
- public Object(String s) {
+ public Object(String s) { super(_initHelper(s)); }
+
+ private static String _initHelper(String s) {
if(!s.startsWith("L") || !s.endsWith(";")) s = "L" + s.replace('.','/') + ";";
if(!validDescriptorString(s)) throw new IllegalArgumentException("invalid descriptor string");
if(!s.startsWith("L") || !s.endsWith(";")) s = "L" + s.replace('.','/') + ";";
if(!validDescriptorString(s)) throw new IllegalArgumentException("invalid descriptor string");
- descriptor = s;
+ return s;
}
}
-
+
public String[] components() {
StringTokenizer st = new StringTokenizer(descriptor.substring(1,descriptor.length()-1),"/");
String[] a = new String[st.countTokens()];
public String[] components() {
StringTokenizer st = new StringTokenizer(descriptor.substring(1,descriptor.length()-1),"/");
String[] a = new String[st.countTokens()];
@@
-53,7
+54,7
@@
public class Type {
public String internalForm() { return descriptor.substring(1,descriptor.length()-1); }
// FEATURE: Do a proper check here (invalid chars, etc)
public String internalForm() { return descriptor.substring(1,descriptor.length()-1); }
// FEATURE: Do a proper check here (invalid chars, etc)
- public boolean validDescriptorString(String s) {
+ static boolean validDescriptorString(String s) {
return s.startsWith("L") && s.endsWith(";");
}
}
return s.startsWith("L") && s.endsWith(";");
}
}