4504275: CORBA boolean type unions do not generate compilable code from idlj

Mon, 29 Apr 2013 16:44:32 +0400

author
dmeetry
date
Mon, 29 Apr 2013 16:44:32 +0400
changeset 462
8f0a461776a9
parent 459
f1709874d55a
child 463
846aaf02e516

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

src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Thu Apr 18 10:30:06 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Mon Apr 29 16:44:32 2013 +0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -258,6 +258,19 @@
    1.11    {
    1.12      Vector labels = vectorizeLabels (u.branches (), true);
    1.13  
    1.14 +    if (Util.javaName(utype).equals ("boolean")) {
    1.15 +        stream.println( "" ) ;
    1.16 +        stream.println( "  private void verifyDefault (boolean discriminator)" ) ;
    1.17 +        stream.println( "  {" ) ;
    1.18 +        if (labels.contains ("true"))
    1.19 +            stream.println ("    if ( discriminator )");
    1.20 +        else
    1.21 +            stream.println ("    if ( !discriminator )");
    1.22 +        stream.println( "        throw new org.omg.CORBA.BAD_OPERATION();" ) ;
    1.23 +        stream.println( "  }" ) ;
    1.24 +        return;
    1.25 +    }
    1.26 +
    1.27      stream.println( "" ) ;
    1.28      stream.println( "  private void verifyDefault( " + Util.javaName(utype) +
    1.29          " value )" ) ;

mercurial