summaryrefslogtreecommitdiff
path: root/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java')
-rw-r--r--src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java b/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java
new file mode 100644
index 0000000000..a1930f77ef
--- /dev/null
+++ b/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java
@@ -0,0 +1,53 @@
+// $Id$
+
+package ch.epfl.lamp.fjbg;
+
+/**
+ * Types for Java objects.
+ *
+ * @version 1.0
+ * @author Michel Schinz
+ */
+
+public class JObjectType extends JReferenceType {
+ protected final String name;
+ protected String signature = null;
+
+ public final static JObjectType JAVA_LANG_OBJECT =
+ new JObjectType("java.lang.Object");
+ public final static JObjectType JAVA_LANG_STRING =
+ new JObjectType("java.lang.String");
+ public final static JObjectType CLONEABLE =
+ new JObjectType("Cloneable");
+ public final static JObjectType JAVA_IO_SERIALIZABLE =
+ new JObjectType("java.io.Serializable");
+
+ public JObjectType(String name) {
+ this.name = name;
+ }
+
+ public int getSize() { return 1; }
+
+ public String getName() { return name; }
+
+ public String getSignature() {
+ if (signature == null)
+ signature = "L" + name.replace('.','/') + ";";
+ return signature;
+ }
+
+ public String getDescriptor() {
+ return name.replace('.','/');
+ }
+
+ public int getTag() { return T_OBJECT; }
+
+ public String toString() { return name; }
+
+ public boolean isObjectType() { return true; }
+
+ public boolean isCompatibleWith(JType other) {
+ return other instanceof JObjectType
+ || other == JType.REFERENCE;
+ }
+}