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
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java Wed Jul 05 18:52:11 2017 +0200
+++ b/corba/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 )" ) ;