Results 1 to 4 of 4

Thread: Duplicate naming error while running slice2java

  1. #1
    Sameerrele's Avatar
    Sameerrele is offline Registered User
    Name: Sameer Rele
    Organization: TRG
    Project: SOA
    Join Date
    Aug 2006
    Location
    New York
    Posts
    18

    Duplicate naming error while running slice2java

    I would appreciate your help in understanding why this is not supported or what am I doing wrong.

    Thanks

    My sample ice file is
    Code:
    #ifndef TEST_ICE
    #define TEST_ICE
    
    module com
    {
        module xxx
        {
            module data
            {
                module testsomething
                {
                    module service
                    {
                        interface TestSomething
                        {
                            int         getPoints();
                        };
        
                        interface TestSomethingHandler
                        {
                            TestSomething* getSomething(string name );
                        };
                    };
                };
            };
        };
    };
    
    #endif
    
    
    When I run slice2java I get following error

    slice2java --output-dir c:\myproj\src c:\myproj\ice\test.ice
    c:\\myproj\\ice\\test.ice:16: interface name `testsomething' cannot differ only in capitalization from enclosing module `testsomething' (first defined at c:\\myproj\\ice\\test.ice:11)
    c:\\myproj\\ice\\test.ice:22: module name `TestSomething' is capitalized inconsistently with its previous name: `::com::xxx::data::testsomething'
    c:\\myproj\\ice\\test.ice:22: `TestSomething' is not a type
    Sameer Rele
    Global Enterprise Solutions Architect

    The Rohatyn Group
    280 Park Avenue, 27th Floor - West
    New York, NY 10017
    Tel : (212) 984 2946
    sameer.rele@rohatyngroup.com

  2. #2
    mes's Avatar
    mes
    mes is online now ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    When you declared the module testsomething, you introduced that symbol into the enclosing scope. Slice does not permit you to introduce another symbol that differs only in capitalization (such as TestSomething) into the same scope, or into any nested scope. You'll need to rename the module or the interface.

    Take care,
    - Mark

  3. #3
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    By the way, initially, the rule what as that only immediately nested scopes could not have the same name because that can cause problems with constructors in many languages.

    Later, we made the rule more strict to prohibit scopes with the same name anywhere along the nesting chain because of C#: prior to C# 2.0, there was no way to anchor a symbol lookup at the global scope so, if you had nested scopes with the same name, anything outside the inner scope became inaccessible from within the inner scope.

    If we ever get to the point where we drop support for C# 1.0, we can relax this rule again. However, as a general point, I would still discourage having nested scopes with the same name as a matter of style--the potential for confusion this creates is almost certainly worse than having to use unique names for nested scopes.

    Cheers,

    Michi.

  4. #4
    Sameerrele's Avatar
    Sameerrele is offline Registered User
    Name: Sameer Rele
    Organization: TRG
    Project: SOA
    Join Date
    Aug 2006
    Location
    New York
    Posts
    18
    Gentlemen,

    Thanks for the update and explaining me the reasoning behind the situation.

    Regarcs
    Sameer Rele
    Global Enterprise Solutions Architect

    The Rohatyn Group
    280 Park Avenue, 27th Floor - West
    New York, NY 10017
    Tel : (212) 984 2946
    sameer.rele@rohatyngroup.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Running error in JAVA hello world demo
    By abhimohpra in forum Help Center
    Replies: 1
    Last Post: 10-14-2010, 03:51 PM
  2. slice2java ant task not re-running
    By blair in forum Help Center
    Replies: 6
    Last Post: 05-14-2010, 11:28 PM
  3. Error running allTests.py (certificate problem?)
    By PeteH in forum Help Center
    Replies: 1
    Last Post: 03-09-2005, 02:28 AM
  4. running sample server error on rh9
    By a2234 in forum Help Center
    Replies: 1
    Last Post: 10-12-2004, 10:50 PM
  5. error running Java server on XP
    By dipakyadav in forum Bug Reports
    Replies: 9
    Last Post: 02-21-2003, 10:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •