Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
Bug 517 - interitance redefinition fails to compile
Summary: interitance redefinition fails to compile
Status: RESOLVED FIXED
Alias: None
Product: JacORB
Classification: Unclassified
Component: IDL compiler (show other bugs)
Version: 2.2
Hardware: PC Windows 2000
: P2 major
Assignee: Simon McQueen
URL:
: 613 624 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-04 00:10 CEST by Rob Gordon
Modified: 2005-10-03 22:47 CEST (History)
3 users (show)

See Also:


Attachments
proposed patch. Gives correct result for given testcase (600 bytes, patch)
2005-08-23 15:26 CEST, Thomas Leineweber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Gordon 2004-10-04 00:10:21 CEST
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 CEST
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 CEST

*** This bug has been marked as a duplicate of 479 ***
Comment 3 Simon McQueen 2004-10-04 15:07:55 CEST
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 CEST
*** Bug 613 has been marked as a duplicate of this bug. ***
Comment 5 Simon McQueen 2005-08-15 17:22:25 CEST
*** Bug 624 has been marked as a duplicate of this bug. ***
Comment 6 Thomas Leineweber 2005-08-23 15:26:10 CEST
Created attachment 180 [details]
proposed patch. Gives correct result for given testcase
Comment 7 Thomas Leineweber 2005-08-24 12:05:16 CEST
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 CEST
Should be solved now by the patch for bug 616, which I just installed.