[m-rev.] diff: fix arrays of arrays in java
Peter Wang
novalazy at gmail.com
Mon Jun 29 16:39:18 AEST 2009
Branches: main
library/array.m:
Fix Java ML_new_array() when passed a representative element which is
itself an array.
diff --git a/library/array.m b/library/array.m
index f5f90e6..70a25f0 100644
--- a/library/array.m
+++ b/library/array.m
@@ -648,15 +648,18 @@ ML_new_array(int Size, Object Item)
// to a functor, so we want the enclosing class.
java.lang.Class itemClass = Item.getClass();
- boolean found = false;
- for (java.lang.Class iface : itemClass.getInterfaces()) {
- if (iface == jmercury.runtime.MercuryType.class) {
- found = true;
- break;
+ if (!itemClass.isArray()) {
+ boolean found = false;
+ for (java.lang.Class iface : itemClass.getInterfaces()) {
+ if (iface == jmercury.runtime.MercuryType.class) {
+ found = true;
+ break;
+ }
}
- }
- if (!found) {
- itemClass = itemClass.getEnclosingClass();
+ if (!found) {
+ itemClass = itemClass.getEnclosingClass();
+ }
+ assert itemClass != null;
}
return java.lang.reflect.Array.newInstance(itemClass, Size);
}
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list