IDL2JAVA does not allow duplicate module name in operation's parameter
- Product Name: VisiBroker Java
- Product Version: 7.0, 8.x
- Product Component: idl2java
- Platform: All
VisiBroker 8.0 IDL2JAVA will fail during compilation when the IDL is declared as follows:
void someMethod(in someStruct example);
The failing part of the IDL is on the line:
void someMethod(in someStruct example)
where the parameter name "example" is a duplicate to the module name "example".
However, based on the OMG CORBA specification, the parameter names should be able to duplicate other identifiers including the module name.
The following are the snippets from the Part1 CORBA Interfaces (08-01-04) Specifications:
Section 7.20.2: Scoping Rules and Name Resolution
An identifier can only be defined once in a scope. However, identifiers can be redefined in nested scopes. An identifier declaring a module is considered to be defined by its first occurrence in a scope. Subsequent occurrences of a module declaration with the same identifier within the same scope reopens the module and hence its scope, allowing additional definitions to be added to it.
From the following sections also, we know that module and operator are of different scopes. Operator are nested inside the module, hence it is possible for its parameter to duplicate the module’s name/identifier.
Section 7.20.1: Qualified Names
Whenever a module keyword is encountered, the string “::” and the associated identifier are appended to the name of the current root; upon detection of the termination of the module, the trailing “::” and identifier are deleted from the name of the current root.
Additionally, a new, unnamed, scope is entered when the parameters of an operation declaration are processed; this allows the parameter names to duplicate other identifiers; when parameter processing has completed, the unnamed scope is exited.
As a workaround on this issue, it is safe to change the parameter name to be different from the module name since parameter name are not used during GIOP marshalling/unmarshalling operations.