Issue 1931: Need overloaded write_Value method on OutputStream (java2idl-rtf) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: Suppose we are passing an array of declared type Animal[] and runtime type Wombat[] but whose elements are all of runtime type Wombat, where Wombat is a subtype of Animal. This array is mapped to a boxed valuetype in the org.omg.sequences module. In the RMI-IIOP stub, we need to write this array by making a write_Value call (so that sharing can be handled correctly). The repository ID that we need to write is for a type seq_Animal, based on a static mapping from the declared type of the array (see section 5.6 of the Java-to-IDL spec). However, if the stub used the normal write_Value call that takes a single argument of the object to be written, the runtime will not be able to put the correct repository ID on the wire because it only knows about the runtime type of the array, not the declared type. For the IDL case, this is taken care of by having the stub generate the form of write_Value that takes a ValueHelper object for the declared type, but in RMI-IIOP there are no ValueHelper objects. Resolution: closed, accepted Revised Text: RMI/IDL arrays must be marshaled with a repository ID indicating their runtime type. Also, RMI/IDL arrays must be demarshaled according to the type specified in the repository ID of the boxed valuetype in the GIOP encoding. Actions taken: September 3, 1998: received issue June 4, 1999: closed issue Discussion: End of Annotations:===== Return-Path: Date: Thu, 03 Sep 1998 14:49:15 +0100 From: Simon Nash Reply-To: nash@hursley.ibm.com Organization: IBM To: java2idl-rtf@omg.org Cc: obv-rtf@omg.org, issues@omg.org Subject: Need overloaded write_Value method on OutputStream We have come across a case in the Java-to-IDL mapping where we need another overloaded form of the write_Value method on the org.omg.CORBA.portable.OutputStream class. Suppose we are passing an array of declared type Animal[] and runtime type Wombat[] but whose elements are all of runtime type Wombat, where Wombat is a subtype of Animal. This array is mapped to a boxed valuetype in the org.omg.sequences module. In the RMI-IIOP stub, we need to write this array by making a write_Value call (so that sharing can be handled correctly). The repository ID that we need to write is for a type seq_Animal, based on a static mapping from the declared type of the array (see section 5.6 of the Java-to-IDL spec). However, if the stub used the normal write_Value call that takes a single argument of the object to be written, the runtime will not be able to put the correct repository ID on the wire because it only knows about the runtime type of the array, not the declared type. For the IDL case, this is taken care of by having the stub generate the form of write_Value that takes a ValueHelper object for the declared type, but in RMI-IIOP there are no ValueHelper objects. Here is a proposal to handle this case. Add another overloaded write_Value method to the org.omg.CORBA.portable.OutputStream class. Its signature would be void write_Value(java.io.Serializable value, String repository_id); The RMI-IIOP stubs would use this form for arrays, passing the repository ID corresponding to the declared type of the array. At present we do not see a need to use this form for non-array types, but it is available for such use if we need it. This would mean that we need to add a repositoryID parameter to the write_Value method of the ValueHandler interface, so that the ValueHandler can know what repository ID was passed to the stream by the stub. The new signature would be void write_Value(org.omg.CORBA.portable.OutputStream out, java.io.Serializable value, String repositoryID); Simon -- Simon C Nash, IBM Java Technology Centre, Hursley, UK MailPoint 146, x245156 Tel. 01962 815156 or +44-1962-815156 Internet: nash@hursley.ibm.com Notes mail: Simon Nash@ibmgb