diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-06-26 20:54:48 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-06-26 20:54:48 +0000 |
commit | 005998b0fe3bcc3fb4e4a850b49164c4e19eb441 (patch) | |
tree | f221c20c1065ec13c81d7b5aa8d7bf056aef1e65 | |
parent | Fixed ICE-5546: Python Ice/converter demo (diff) | |
download | ice-005998b0fe3bcc3fb4e4a850b49164c4e19eb441.tar.bz2 ice-005998b0fe3bcc3fb4e4a850b49164c4e19eb441.tar.xz ice-005998b0fe3bcc3fb4e4a850b49164c4e19eb441.zip |
Fix for ICE-5515 (ice_staticId on proxies) in Java, C#, Python, Ruby and PHP (not complete in Python, Ruby and PHP)
-rw-r--r-- | cpp/include/Ice/Proxy.h | 7 | ||||
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Slice/RubyUtil.cpp | 6 | ||||
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 5 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Twoways.cpp | 1 | ||||
-rw-r--r-- | cs/src/Ice/Proxy.cs | 11 | ||||
-rw-r--r-- | cs/test/Ice/metrics/InstrumentationI.cs | 3 | ||||
-rw-r--r-- | cs/test/Ice/operations/Twoways.cs | 4 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelper.java | 13 | ||||
-rw-r--r-- | java/test/Ice/operations/Twoways.java | 4 | ||||
-rw-r--r-- | php/test/Ice/operations/Client.php | 5 | ||||
-rw-r--r-- | php/test/Ice/proxy/Client.php | 2 | ||||
-rw-r--r-- | py/test/Ice/operations/Twoways.py | 7 | ||||
-rw-r--r-- | rb/test/Ice/operations/Twoways.rb | 5 |
14 files changed, 82 insertions, 1 deletions
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 820fd28ccfe..4e8ad247e01 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -585,6 +585,13 @@ public: ::std::string end_ice_id(const ::Ice::AsyncResultPtr&); + + static const ::std::string& ice_staticId() + { + return ::Ice::Object::ice_staticId(); + } + + // Returns true if ok, false if user exception. bool ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 59f4e98ab51..bfdf33a7b8d 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -779,7 +779,17 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out.dec(); _out << nl << "uncheckedCast = staticmethod(uncheckedCast)"; + + // + // ice_staticId + // + _out << sp << nl << "def ice_staticId():"; + _out.inc(); + _out << nl << "return '" << scoped << "'"; _out.dec(); + _out << nl << "ice_staticId = staticmethod(ice_staticId)"; + + _out.dec(); _out << sp << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")"; } diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index a93af8ec9fd..79a8185d2f4 100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp @@ -581,6 +581,12 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out.dec(); _out << nl << "end"; + _out << nl << "def " << name << "Prx.ice_staticId()"; + _out.inc(); + _out << nl << "'" << scoped << "'"; + _out.dec(); + _out << nl << "end"; + _out.dec(); _out << nl << "end"; // End of proxy class. } diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 0abc9a3f25a..5cd4afc6a5c 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -373,6 +373,11 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "return $proxy->ice_uncheckedCast('" << scoped << "', $facet);"; _out << eb; + _out << sp << nl << "public static function ice_staticId()"; + _out << sb; + _out << nl << "return '" << scoped << "';"; + _out << eb; + _out << eb; } diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index f95cf68337b..1dcb1c18795 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -68,6 +68,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) { test(Test::MyClassPrx::ice_staticId() == Test::MyClass::ice_staticId()); + test(Ice::ObjectPrx::ice_staticId() == Ice::Object::ice_staticId()); } { diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index 017eaf09794..38d3d8d8132 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -2856,6 +2856,17 @@ namespace Ice } return d; } + + + /// <summary> + /// Returns the Slice type id of the interface or class associated + /// with this proxy class. + /// </summary> + /// <returns>The type id, "::Ice::Object".</returns> + public static string ice_staticId() + { + return Ice.ObjectImpl.ice_staticId(); + } } public interface ObjectDel_ diff --git a/cs/test/Ice/metrics/InstrumentationI.cs b/cs/test/Ice/metrics/InstrumentationI.cs index 36189324772..38e2a1d8de3 100644 --- a/cs/test/Ice/metrics/InstrumentationI.cs +++ b/cs/test/Ice/metrics/InstrumentationI.cs @@ -359,6 +359,8 @@ public class CommunicatorObserverI : Ice.Instrumentation.CommunicatorObserver } } + + /* void reset() { @@ -390,6 +392,7 @@ public class CommunicatorObserverI : Ice.Instrumentation.CommunicatorObserver } } } + */ protected Ice.Instrumentation.ObserverUpdater updater; diff --git a/cs/test/Ice/operations/Twoways.cs b/cs/test/Ice/operations/Twoways.cs index 3a5f1dc3fb2..ed7d0b57ac1 100644 --- a/cs/test/Ice/operations/Twoways.cs +++ b/cs/test/Ice/operations/Twoways.cs @@ -56,6 +56,10 @@ class Twoways { p.ice_ping(); + test(Test.MyClassPrxHelper.ice_staticId().Equals(Test.MyClass.ice_staticId())); + test(Ice.ObjectPrxHelper.ice_staticId().Equals(Ice.ObjectImpl.ice_staticId())); + + test(p.ice_isA(Test.MyClass.ice_staticId())); test(p.ice_id().Equals(Test.MyDerivedClass.ice_staticId())); diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java index a4c054fd7e9..14bbc89f4da 100644 --- a/java/src/Ice/ObjectPrxHelper.java +++ b/java/src/Ice/ObjectPrxHelper.java @@ -142,4 +142,17 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase } return d; } + + /** + * Returns the Slice type id of the interface or class associated + * with this proxy class. + * + * @return the type id, "::Ice::Object" + **/ + public static String + ice_staticId() + { + return Ice.ObjectImpl.ice_staticId(); + } + } diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java index b13619728b6..58c152f65e8 100644 --- a/java/test/Ice/operations/Twoways.java +++ b/java/test/Ice/operations/Twoways.java @@ -27,6 +27,7 @@ import test.Ice.operations.Test.MyClassPrx; import test.Ice.operations.Test.MyClassPrxHelper; import test.Ice.operations.Test.MyClassPrxHolder; import test.Ice.operations.Test.MyDerivedClass; +import test.Ice.operations.Test.MyDerivedClassPrxHelper; import test.Ice.operations.Test.MyEnum; import test.Ice.operations.Test.MyStruct; import test.Ice.operations.Test.MyEnumHolder; @@ -84,6 +85,9 @@ class Twoways test(p.ice_id().equals(MyDerivedClass.ice_staticId())); + test(MyDerivedClassPrxHelper.ice_staticId().equals(MyDerivedClass.ice_staticId())); + test(Ice.ObjectPrxHelper.ice_staticId().equals(Ice.ObjectImpl.ice_staticId())); + { String[] ids = p.ice_ids(); test(ids.length == 3); diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index 6f3fba259c7..6a71e960724 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -42,6 +42,11 @@ function twoways($communicator, $p) } { + test(Test_MyDerivedClassPrxHelper::ice_staticId() == Test_MyDerivedClass::ice_staticId()); + } + + + { test($p->ice_isA("::Test::MyClass")); } diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php index 7789be1d865..33924acd10a 100644 --- a/php/test/Ice/proxy/Client.php +++ b/php/test/Ice/proxy/Client.php @@ -402,7 +402,7 @@ function allTests($communicator) $b1 = $b1->ice_locator($locator->ice_uncheckedCast("::Ice::Locator")); $proxyProps = $communicator->proxyToProperty($b1, "Test"); - test(count($proxyProps) == 18); + test(count($proxyProps) == 21); test($proxyProps["Test"] == "test -t -e 1.0"); //test($proxyProps["Test.CollocationOptimized"] == "1"); diff --git a/py/test/Ice/operations/Twoways.py b/py/test/Ice/operations/Twoways.py index 94554af0865..e155fbad8e3 100644 --- a/py/test/Ice/operations/Twoways.py +++ b/py/test/Ice/operations/Twoways.py @@ -37,6 +37,13 @@ def twoways(communicator, p): # ice_id # test(p.ice_id() == Test.MyDerivedClass.ice_staticId()) + + + # + # Prx ice_staticId + # + test(Test.MyDerivedClassPrx.ice_staticId() == Test.MyDerivedClass.ice_staticId()) + # # opVoid diff --git a/rb/test/Ice/operations/Twoways.rb b/rb/test/Ice/operations/Twoways.rb index 00d59a6a4c3..17ea26dd225 100644 --- a/rb/test/Ice/operations/Twoways.rb +++ b/rb/test/Ice/operations/Twoways.rb @@ -33,6 +33,11 @@ def twoways(communicator, p) test(p.ice_id == Test::MyDerivedClass::ice_staticId()) # + # Proxy ice_staticId + # + test(Test::MyDerivedClassPrx::ice_staticId() == Test::MyDerivedClass::ice_staticId()) + + # # opVoid # p.opVoid() |