[m-rev.] diff: RTTI for Java
James Goddard
goddardjames at yahoo.com
Thu Feb 26 19:13:39 AEDT 2004
Some changes after a brief review.
diff -u java/runtime/PseudoTypeInfo.java java/runtime/PseudoTypeInfo.java
--- java/runtime/PseudoTypeInfo.java 20 Feb 2004 04:11:35 -0000
+++ java/runtime/PseudoTypeInfo.java 26 Feb 2004 07:48:08 -0000
@@ -26,6 +26,7 @@
public PseudoTypeInfo(int n) { variable_number = n; }
protected PseudoTypeInfo() { variable_number = -1; }
+ // XXX This should be renamed `equals'
public boolean unify(PseudoTypeInfo ti) {
if (this.getClass() == TypeInfo_Struct.class &&
ti.getClass() == TypeInfo_Struct.class) {
diff -u java/runtime/TypeCtorInfo_Struct.java java/runtime/TypeCtorInfo_Struct.java
--- java/runtime/TypeCtorInfo_Struct.java 22 Feb 2004 03:45:50 -0000
+++ java/runtime/TypeCtorInfo_Struct.java 26 Feb 2004 07:49:07 -0000
@@ -49,6 +49,7 @@
type_ctor_flags = flags;
}
+ // XXX this should be renamed `equals'
public boolean unify(TypeCtorInfo_Struct tci) {
return this == tci;
/*
diff -u java/runtime/TypeInfo_Struct.java java/runtime/TypeInfo_Struct.java
--- java/runtime/TypeInfo_Struct.java 22 Feb 2004 03:44:50 -0000
+++ java/runtime/TypeInfo_Struct.java 26 Feb 2004 07:48:40 -0000
@@ -126,6 +126,7 @@
}
}
+ // XXX this should be renamed `equals'
public boolean unify(TypeInfo_Struct ti) {
if (this == ti) {
return true;
diff -u library/rtti_implementation.m library/rtti_implementation.m
--- library/rtti_implementation.m 26 Feb 2004 07:29:55 -0000
+++ library/rtti_implementation.m 26 Feb 2004 08:10:41 -0000
@@ -159,8 +159,7 @@
:- type type_info ---> type_info(c_pointer).
:- pragma foreign_type("Java", type_info,
- % XXX should this be "mercury.runtime.TypeInfo_Struct" instead?
- "mercury.runtime.PseudoTypeInfo").
+ "mercury.runtime.TypeInfo_Struct").
:- type compare_pred ---> compare_pred(c_pointer).
@@ -1818,14 +1817,15 @@
get_remote_secondary_tag(X::in) = (Tag::out), [promise_pure],
"
// If there is a secondary tag, it will be in a member called
- // `data_tag', which we obtain by reflection. Otherwise we return -1.
- // XXX Is this the correct behaviour?
+ // `data_tag', which we obtain by reflection.
try {
Tag = X.getClass().getField(""data_tag"").getInt(X);
}
catch (java.lang.Exception e) {
- return -1;
+ throw new java.lang.RuntimeException(
+ ""get_remote_secondary_tag: `data_tag' not "" +
+ ""found"");
}
").
@@ -2541,16 +2541,19 @@
Name = NotagFunctorDesc.no_tag_functor_name;
").
+ % XXX This is a bug. This function should actually return a
+ % PseudoTypeInfo. The Java code below should work once this is
+ % corrected.
:- func notag_functor_arg_type(notag_functor_desc) = type_info.
notag_functor_arg_type(NoTagFunctorDesc) = NoTagFunctorDesc ^ unsafe_index(1).
-:- pragma foreign_proc("Java",
- notag_functor_arg_type(NotagFunctorDesc::in) = (ArgType::out),
- [will_not_call_mercury, promise_pure, thread_safe],
-"
- ArgType = NotagFunctorDesc.no_tag_functor_arg_type;
-").
+% :- pragma foreign_proc("Java",
+% notag_functor_arg_type(NotagFunctorDesc::in) = (ArgType::out),
+% [will_not_call_mercury, promise_pure, thread_safe],
+% "
+% ArgType = NotagFunctorDesc.no_tag_functor_arg_type;
+% ").
:- func notag_functor_arg_name(notag_functor_desc) = string.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list