Go Back   ZeroC Forums > Bug Reports

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 05-11-2007
mefoster mefoster is offline
Registered User
 
Name: Mary Ellen Foster
Organization: Technical University of Munich
Project: JAST human-robot dialogue system
 
Join Date: Jun 2006
Posts: 78
Java global package metadata and builtin datatypes

It seems that specifying "java:package:whatever" in a .ice file has a different effect than specifying it on the slice2java command line, at least when the built-in datatypes like ::Ice::StringSeq are used.

Here's a sample file:
Code:
#ifndef SPEECHRECOGNITIONLISTENER_ICE
#define SPEECHRECOGNITIONLISTENER_ICE

[["java:package:de.tum.in"]]

#include <Ice/BuiltinSequences.ice>

module jast {
    module listener {
        interface SpeechRecognitionListener {
            void recognizedTurn (string top, ::Ice::StringSeq alternatives);
        };
    };
};

#endif
If I run slice2java on this as it is (with the appropriate -I argument to find Ice/StringSeq), I get generated Java that refers to Ice.StringSeqHelper. However, if I delete the metadata line in the ice file and specify instead '--meta "java:package:de.tum.in"', the generated file refers (incorrectly) to de.tum.in.Ice.StringSeqHelper. Here's a diff of the generated code from the two cases.

Code:
--- test/de/tum/in/jast/listener/_SpeechRecognitionListenerDelM.java    2007-05-
11 15:39:06.000000000 +0100
+++ test2/de/tum/in/jast/listener/_SpeechRecognitionListenerDelM.java   2007-05-
11 15:39:29.000000000 +0100
@@ -24,7 +24,7 @@
             {
                 IceInternal.BasicStream __os = __og.os();
                 __os.writeString(top);
-                de.tum.in.Ice.StringSeqHelper.write(__os, alternatives);
+                Ice.StringSeqHelper.write(__os, alternatives);
             }
             catch(Ice.LocalException __ex)
             {
diff -ur test/de/tum/in/jast/listener/_SpeechRecognitionListenerDisp.java test2/
de/tum/in/jast/listener/_SpeechRecognitionListenerDisp.java
--- test/de/tum/in/jast/listener/_SpeechRecognitionListenerDisp.java    2007-05-
11 15:39:06.000000000 +0100
+++ test2/de/tum/in/jast/listener/_SpeechRecognitionListenerDisp.java   2007-05-
11 15:39:29.000000000 +0100
@@ -82,7 +82,7 @@
         String top;
         top = __is.readString();
         String[] alternatives;
-        alternatives = de.tum.in.Ice.StringSeqHelper.read(__is);
+        alternatives = Ice.StringSeqHelper.read(__is);
         __obj.recognizedTurn(top, alternatives, __current);
         return IceInternal.DispatchStatus.DispatchOK;
     }
Is this the intended effect? I'd rather use one metadata directive on the command line rather than one per file ...

MEF
__________________
Mary Ellen Foster
Technical University of Munich
JAST human-robot dialogue system
Maintainer of Fedora Ice packages
Reply With Quote
  #2 (permalink)  
Old 05-11-2007
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi,

You are seeing the expected behavior. From the manual:

Using this option is equivalent to defining the global metadata META in each named Slice file, as well as in any file included by a named Slice file.

As you've discovered, the package metadata typically cannot be defined with the --meta option because it is applied to included files as well.

The package metadata really is meant to be defined explicitly in each Slice file. Without it, the translator would not be able to compose the correct fully-scoped names for types in included files.

Take care,
- Mark
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
IcePy and The global interpreter lock rc_hz Comments 1 10-17-2006 10:50 AM
Another solution about package mapping in Java rc_hz Comments 4 08-23-2006 10:33 PM
Metadata directives bartley Help Center 1 02-03-2006 02:35 PM
package metadata directive - ClassCast Exception vsonnathi Bug Reports 1 09-28-2004 11:46 AM
c++ metadata sylvain Help Center 5 08-06-2003 10:10 AM


All times are GMT -4. The time now is 08:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.