Issue 4009: Union exceptions (java-rtf) Source: Triodia Technologies Pty Ltd (Mr. Michi Henning, michi(at)triodia.com) Nature: Uncategorized Issue Severity: Summary: Given a union such as: union u switch (long) { case 2: case 3: case 4: string string_member; case 5: double double_member; }; I get a modifier public void string_member(int d, string v); What should happen if I call string_member(99, "hello")? Clearly, this is meaningless, but the spec doesn't say what should happen. I would suggest to throw BAD_PARAM. Resolution: see below Revised Text: In section 1.9, for the paragraph that begins "If there is more than one case label corresponding to a branch, ...", add to the end of the paragraph: The extra modifier method should throw a BAD_PARAM exception with a minor code of XXX when a value is passed for the discriminator that is not among the case labels for the branch. In section 1.9, for the paragraph that begins "If the branch corresponds to the default case label,...", add to the end of the paragraph: The extra modifier method should throw a BAD_PARAM exception with a minor code of XXX when a value is passed for the discriminator that is not among the case labels for the default branch. Actions taken: October 31, 2000: received issue May 13, 2002: closed issue Discussion: End of Annotations:===== Date: Wed, 1 Nov 2000 06:19:52 +1000 (EST) From: Michi Henning Reply-To: java-rtf@omg.org To: java-rtf@omg.org cc: issues@omg.org Subject: Union exceptions Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: 4(!!!<3$e9/K5!!!!Z!! Given a union such as: union u switch (long) { case 2: case 3: case 4: string string_member; case 5: double double_member; }; I get a modifier public void string_member(int d, string v); What should happen if I call string_member(99, "hello")? Clearly, this is meaningless, but the spec doesn't say what should happen. I would suggest to throw BAD_PARAM. Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Date: Tue, 11 Dec 2001 23:08:23 -0800 (PST) From: Ken Cavanaugh Reply-To: Ken Cavanaugh Subject: Proposal for issue 4009 To: java-rtf@omg.org MIME-Version: 1.0 Content-MD5: K61nwgYTOGBNCyV82YAE0Q== X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.3.5 SunOS 5.7 sun4u sparc Content-Type: TEXT/plain; charset=us-ascii X-UIDL: mRK!!I6`!!;%k!!lbY!! Issue 4009: exception thrown when union discriminator is incorrectly set This should be addressed with the following edits: In section 1.9, for the paragraph that begins "If there is more than one case label corresponding to a branch, ...", add to the end of the paragraph: The extra modifier method should throw a BAD_PARAM exception with a minor code of XXX when a value is passed for the discriminator that is not among the case labels for the branch. In section 1.9, for the paragraph that begins "If the branch corresponds to the default case label,...", add to the end of the paragraph: The extra modifier method should throw a BAD_PARAM exception with a minor code of XXX when a value is passed for the discriminator that is not among the case labels for the default branch. XXX will be obtained from Andrew. Ken.