summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschinz <schinz@epfl.ch>2005-04-05 19:53:20 +0000
committerschinz <schinz@epfl.ch>2005-04-05 19:53:20 +0000
commit87ea8ccb1a5490efb2a7f940e4402e19a9768d15 (patch)
tree226cb96062b583ec00d6a2da64d822cdb71afb86
parentb8c5798b5c2d56fa51075b6cc8fedf37f1d5fa4e (diff)
downloadscala-87ea8ccb1a5490efb2a7f940e4402e19a9768d15.tar.gz
scala-87ea8ccb1a5490efb2a7f940e4402e19a9768d15.tar.bz2
scala-87ea8ccb1a5490efb2a7f940e4402e19a9768d15.zip
- made the isInstance test more precise
-rw-r--r--sources/scala/runtime/types/JavaRefArrayType.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/sources/scala/runtime/types/JavaRefArrayType.java b/sources/scala/runtime/types/JavaRefArrayType.java
index 1c5e65a1b6..0d679c256c 100644
--- a/sources/scala/runtime/types/JavaRefArrayType.java
+++ b/sources/scala/runtime/types/JavaRefArrayType.java
@@ -37,9 +37,20 @@ public class JavaRefArrayType extends Type {
public boolean isInstance(Object o) {
assert Statistics.incInstanceOf();
- // TODO plus fin: on doit tenir compte de la version effacée
- // de elemType.
- return (o instanceof Object[]);
+ if (o instanceof Object[]) {
+ if (elemType instanceof ClassType) {
+ ClassType elemTypeClass = (ClassType)elemType;
+ if (o.getClass().getComponentType() == elemTypeClass.clazz) {
+ if (elemTypeClass.isTrivial)
+ return true;
+ else
+ throw new Error("not able to compute isInstance");
+ } else
+ return false;
+ } else
+ throw new Error("not able to compute isInstance");
+ } else
+ return false;
}
public boolean isSameType(Type that) {