Created On:  15 February 2011

Problem:

  • Product Name: VisiBroker for Java
  • Product Version: 3.4, 8.0
  • Product Component: idl2java
  • Platform/OS Version: All
The below IDL is working on VisiBroker 3.4 but got an “duplicate definition” error when migrated to VisiBroker 8.0

>>> [exec] ModuleName.idl: 103:duplicate definition of none (previously defined on line 87)

 

// ModuleName.idl

module ModuleName {
            enum Enumeration1 {
                        none,
                        A,
                        B
            };

            enum Enumeration2 {
                        none,
                        C,
                        D
            };

};

Resolution:

There was a change in IDL compiler since VisiBroker v4.5, where Enumeration names are now only accessible within their container scope.

For example:

// IDL 
module x {
 enum myEnum { name1, name2, name3 };
 };

Given the above IDL, name1 inside x::myEnum can be referred to as x::name1 but NOT x::myEnum::name1.

From the IDL (ie. ModuleName.idl), the “none” is being declared twice under ModuleName’s context that explains why the “duplicate definition of none” error occurs if you use with any VisiBroker version later than 4.5.

In the earlier version of VisiBroker (ie. 3.4), the above issue won’t occurs as the “none” is accessible via either ModuleName::Enumeration1::none or ModuleName::Enumeration2::none separately.

Please refer to the release notes for more details:

VisiBroker for Java 4.5.1 release notes
 

Incident #2493679