Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORBA boolean type unions do not generate compilable code from idlj #64

Closed
hdreihah opened this issue Sep 6, 2019 · 5 comments
Closed

Comments

@hdreihah
Copy link

hdreihah commented Sep 6, 2019

This bug has been reported on JDK some time ago:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4504275

The java code generated from an idl union where the switch is the boolean type
will not compile with javac. The following example IDL will compile java code
with idlj, but when we run the java code through javac it fails with syntax
errors.
--- example IDL follows --------------
module xyz
{
union LongTypeOpt switch (boolean) {
case TRUE: long value;
};

};

A fix is available for JDK:
https://www.programcreek.com/java-api-examples/?code=jboss/openjdk-orb/openjdk-orb-master/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java

look at:
private void writeVerifyDefault()
{
...
if (Util.javaName(utype).equals ("boolean")) {
...
}
...
}

@hdreihah
Copy link
Author

hdreihah commented Sep 6, 2019

The link below shows the fix (1.14 - 1.26)
http://hg.openjdk.java.net/jdk7u/jdk7u/corba/rev/583e454e0813

russgold pushed a commit that referenced this issue Apr 27, 2020
Signed-off-by: David Marina <David.Marina@esa.int>
@Sat-Ing
Copy link

Sat-Ing commented Jan 15, 2021

The generated code is compile clean now for me. Although there remains a problem within the read method of the helper class. If the boolean discriminator is false, then a BAD_OPERATION exception is thrown. But instead, the value should be set to a default value. Otherwise, this IDL definition would be meaningless if the discriminator always needs to be true?

@hdreihah
Copy link
Author

Different bug. Look at:
https://bugs.openjdk.java.net/browse/JDK-8011986

@Sat-Ing
Copy link

Sat-Ing commented Jan 15, 2021

Thanks referencing the relevant bug!
I opened this new ticket: #118

@pzygielo
Copy link
Contributor

pzygielo commented Sep 3, 2023

Closing for the statement in #64 (comment)

@pzygielo pzygielo closed this as completed Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants