changeset 703:583e454e0813

4504275: CORBA boolean type unions do not generate compilable code from idlj Summary: JLS doesn't allow boolean type in switch statement, hence substituted by if statement. Reviewed-by: lancea
author dmeetry
date Mon, 29 Apr 2013 16:44:32 +0400
parents d85df1552f87
children 2f38ced3bea8
files src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Wed Apr 24 12:20:36 2013 -0700
+++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Mon Apr 29 16:44:32 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -258,6 +258,19 @@
   {
     Vector labels = vectorizeLabels (u.branches (), true);
 
+    if (Util.javaName(utype).equals ("boolean")) {
+        stream.println( "" ) ;
+        stream.println( "  private void verifyDefault (boolean discriminator)" ) ;
+        stream.println( "  {" ) ;
+        if (labels.contains ("true"))
+            stream.println ("    if ( discriminator )");
+        else
+            stream.println ("    if ( !discriminator )");
+        stream.println( "        throw new org.omg.CORBA.BAD_OPERATION();" ) ;
+        stream.println( "  }" ) ;
+        return;
+    }
+
     stream.println( "" ) ;
     stream.println( "  private void verifyDefault( " + Util.javaName(utype) +
         " value )" ) ;