Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues

Bug 517

Summary: interitance redefinition fails to compile
Product: JacORB Reporter: Rob Gordon <gordon>
Component: IDL compilerAssignee: Simon McQueen <sm>
Status: RESOLVED FIXED    
Severity: major CC: lxhjw2000, Thomas.Leineweber, zhijiedong
Priority: P2    
Version: 2.2   
Hardware: PC   
OS: Windows 2000   
Attachments: proposed patch. Gives correct result for given testcase

Description Rob Gordon 2004-10-04 00:10:21 UTC
We use interitance quite heavily in our app and inevitably we will reuse the
same class variable names. But redefinition is allowed with inheritance in IDL.
Under jacorb 1.4 this worked fine.  Under 2.2 it is failing to compile.  Sample
code:

interface A
{
	const string NAME = "interface_A";
};
interface B : A
{
	const string NAME = "interface_B";
};

This code above compiles under 1.4 and TAO but fails under 2.2 with message:

java.lang.RuntimeException: Could not find definition of : B.NAME
        at org.jacorb.idl.TypeMap.removeDefinition(Unknown Source)
        at org.jacorb.idl.NameTable.define(Unknown Source)
        at org.jacorb.idl.ConstDecl.parse(Unknown Source)
        at org.jacorb.idl.InterfaceBody.internal_parse(Unknown Source)
        at org.jacorb.idl.InterfaceBody.parse(Unknown Source)
        at org.jacorb.idl.Interface.parse(Unknown Source)
        at org.jacorb.idl.Definition.parse(Unknown Source)
        at org.jacorb.idl.Spec.parse(Unknown Source)
        at org.jacorb.idl.CUP$actions.CUP$do_action(Unknown Source)
        at org.jacorb.idl.parser.do_action(Unknown Source)
        at org.jacorb.idl.runtime.lr_parser.parse(Unknown Source)
        at org.jacorb.idl.parser.prepareAndParse(Unknown Source)
        at org.jacorb.idl.parser.compile(Unknown Source)
        at org.jacorb.idl.parser.compile(Unknown Source)
        at org.jacorb.idl.parser.compileAndHandle(Unknown Source)
        at org.jacorb.idl.parser.main(Unknown Source)
[jacorb.idl] ERROR : C:\Projects\test_jacorb.idl, line: 9(1): Exception: java.la
ng.RuntimeException: Could not find definition of : B.NAME
Comment 1 Simon McQueen 2004-10-04 10:35:51 UTC
This is quite correct as per the CORBA spec. Redefinition is *not* allowed. You
need to change your IDL so it conforms. See bug 479 for more.
Comment 2 Simon McQueen 2004-10-04 10:36:27 UTC

*** This bug has been marked as a duplicate of 479 ***
Comment 3 Simon McQueen 2004-10-04 15:07:55 UTC
Sorry - my mistake. I didn't read that properly. I thought they were attributes
rather than consts. Not a duplicate at all.
Comment 4 Simon McQueen 2005-07-15 12:25:13 UTC
*** Bug 613 has been marked as a duplicate of this bug. ***
Comment 5 Simon McQueen 2005-08-15 17:22:25 UTC
*** Bug 624 has been marked as a duplicate of this bug. ***
Comment 6 Thomas Leineweber 2005-08-23 15:26:10 UTC
Created attachment 180 [details]
proposed patch. Gives correct result for given testcase
Comment 7 Thomas Leineweber 2005-08-24 12:05:16 UTC
this bug seems to be the same as bug #616. The patch given there resolves the
problem in this bug, too.
Comment 8 André Spiegel 2005-10-03 22:47:35 UTC
Should be solved now by the patch for bug 616, which I just installed.