提交 1f87e502 编写于 作者: C chegar

Merge

...@@ -209,3 +209,4 @@ a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83 ...@@ -209,3 +209,4 @@ a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83
9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85 9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85
44a8ce4a759f2668ff434661a93ff462ea472478 jdk8-b86 44a8ce4a759f2668ff434661a93ff462ea472478 jdk8-b86
f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87 f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87
4e3a881ebb1ee96ce0872508b0066d74f310dbfa jdk8-b88
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -258,6 +258,19 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera ...@@ -258,6 +258,19 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera
{ {
Vector labels = vectorizeLabels (u.branches (), true); 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( "" ) ;
stream.println( " private void verifyDefault( " + Util.javaName(utype) + stream.println( " private void verifyDefault( " + Util.javaName(utype) +
" value )" ) ; " value )" ) ;
...@@ -763,7 +776,7 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera ...@@ -763,7 +776,7 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera
stream.println (indent + "if (" + disName + ')'); stream.println (indent + "if (" + disName + ')');
if (firstBranch == null) if (firstBranch == null)
stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); stream.println (indent + " value._default(" + disName + ");");
else { else {
stream.println (indent + '{'); stream.println (indent + '{');
index = readBranch (index, indent + " ", firstBranch.typedef.name (), index = readBranch (index, indent + " ", firstBranch.typedef.name (),
...@@ -774,7 +787,7 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera ...@@ -774,7 +787,7 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera
stream.println (indent + "else"); stream.println (indent + "else");
if (secondBranch == null) if (secondBranch == null)
stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); stream.println (indent + " value._default(" + disName + ");");
else { else {
stream.println (indent + '{'); stream.println (indent + '{');
index = readBranch (index, indent + " ", secondBranch.typedef.name (), index = readBranch (index, indent + " ", secondBranch.typedef.name (),
...@@ -924,23 +937,25 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera ...@@ -924,23 +937,25 @@ public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenera
firstBranch = secondBranch; firstBranch = secondBranch;
secondBranch = tmp; secondBranch = tmp;
} }
stream.println (indent + "if (" + disName + ')'); if (firstBranch != null && secondBranch != null) {
if (firstBranch == null) stream.println (indent + "if (" + disName + ')');
stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); stream.println (indent + '{');
else index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream);
{ stream.println (indent + '}');
stream.println (indent + '{'); stream.println (indent + "else");
index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); stream.println (indent + '{');
stream.println (indent + '}'); index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream);
} stream.println (indent + '}');
stream.println (indent + "else"); } else if (firstBranch != null) {
if (secondBranch == null) stream.println (indent + "if (" + disName + ')');
stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); stream.println (indent + '{');
else index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream);
{ stream.println (indent + '}');
stream.println (indent + '{'); } else {
index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); stream.println (indent + "if (!" + disName + ')');
stream.println (indent + '}'); stream.println (indent + '{');
index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream);
stream.println (indent + '}');
} }
} }
return index; return index;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册