summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-07-09 17:13:39 +0200
committerJose <jose@zeroc.com>2019-07-09 17:13:39 +0200
commitf0352140506800ed3a53a7fa7caca63f251bb1a4 (patch)
tree355dc0f3bb7ea8534e087474a35371140b3d0b18 /java
parentIceSSL fixes for RHEL8 (diff)
downloadice-f0352140506800ed3a53a7fa7caca63f251bb1a4.tar.bz2
ice-f0352140506800ed3a53a7fa7caca63f251bb1a4.tar.xz
ice-f0352140506800ed3a53a7fa7caca63f251bb1a4.zip
Remove forward declarations limitation - Close #97
Diffstat (limited to 'java')
-rw-r--r--java/test/src/main/java/test/Ice/objects/AllTests.java29
-rw-r--r--java/test/src/main/java/test/Ice/objects/Forward.ice22
-rw-r--r--java/test/src/main/java/test/Ice/objects/InitialI.java34
-rw-r--r--java/test/src/main/java/test/Ice/objects/Test.ice14
4 files changed, 99 insertions, 0 deletions
diff --git a/java/test/src/main/java/test/Ice/objects/AllTests.java b/java/test/src/main/java/test/Ice/objects/AllTests.java
index 77129e806c2..f15b0cf83c9 100644
--- a/java/test/src/main/java/test/Ice/objects/AllTests.java
+++ b/java/test/src/main/java/test/Ice/objects/AllTests.java
@@ -35,6 +35,11 @@ import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrx;
import test.Ice.objects.Test.M;
import test.Ice.objects.Test.StructKey;
import test.Ice.objects.Test.Initial.OpMResult;
+
+import test.Ice.objects.Test.F1;
+import test.Ice.objects.Test.F2Prx;
+import test.Ice.objects.Test.F3;
+
public class AllTests
{
private static void test(boolean b)
@@ -404,6 +409,30 @@ public class AllTests
}
out.println("ok");
+ out.print("testing forward declared types... ");
+ out.flush();
+ {
+ Initial.OpF1Result opF1Result = initial.opF1(new F1("F11"));
+ test(opF1Result.returnValue.name.equals("F11"));
+ test(opF1Result.f12.name.equals("F12"));
+
+ Initial.OpF2Result opF2Result = initial.opF2(F2Prx.uncheckedCast(communicator.stringToProxy("F21")));
+ test(opF2Result.returnValue.ice_getIdentity().name.equals("F21"));
+ test(opF2Result.f22.ice_getIdentity().name.equals("F22"));
+
+ if(initial.hasF3())
+ {
+ Initial.OpF3Result opF3Result = initial.opF3(new F3(new F1("F11"),
+ F2Prx.uncheckedCast(communicator.stringToProxy("F21"))));
+ test(opF3Result.returnValue.f1.name.equals("F11"));
+ test(opF3Result.returnValue.f2.ice_getIdentity().name.equals("F21"));
+
+ test(opF3Result.f32.f1.name.equals("F12"));
+ test(opF3Result.f32.f2.ice_getIdentity().name.equals("F22"));
+ }
+ }
+ out.println("ok");
+
return initial;
}
}
diff --git a/java/test/src/main/java/test/Ice/objects/Forward.ice b/java/test/src/main/java/test/Ice/objects/Forward.ice
new file mode 100644
index 00000000000..057b9424c6d
--- /dev/null
+++ b/java/test/src/main/java/test/Ice/objects/Forward.ice
@@ -0,0 +1,22 @@
+//
+// Copyright (c) ZeroC, Inc. All rights reserved.
+//
+
+#pragma once
+
+[["java:package:test.Ice.objects"]]
+
+module Test
+{
+
+class F1
+{
+ string name;
+}
+
+interface F2
+{
+ void op();
+}
+
+};
diff --git a/java/test/src/main/java/test/Ice/objects/InitialI.java b/java/test/src/main/java/test/Ice/objects/InitialI.java
index c886195551a..7760480f1e9 100644
--- a/java/test/src/main/java/test/Ice/objects/InitialI.java
+++ b/java/test/src/main/java/test/Ice/objects/InitialI.java
@@ -243,6 +243,40 @@ public final class InitialI implements Initial
return r;
}
+ @Override
+ public Initial.OpF1Result opF1(F1 f11, com.zeroc.Ice.Current current)
+ {
+ Initial.OpF1Result r = new Initial.OpF1Result();
+ r.returnValue = f11;
+ r.f12 = new F1("F12");
+ return r;
+ }
+
+ @Override
+ public Initial.OpF2Result opF2(F2Prx f21, com.zeroc.Ice.Current current)
+ {
+ Initial.OpF2Result r = new Initial.OpF2Result();
+ r.returnValue = f21;
+ r.f22 = F2Prx.uncheckedCast(current.adapter.getCommunicator().stringToProxy("F22"));
+ return r;
+ }
+
+ @Override
+ public Initial.OpF3Result opF3(F3 f31, com.zeroc.Ice.Current current)
+ {
+ Initial.OpF3Result r = new Initial.OpF3Result();
+ r.returnValue = f31;
+ r.f32 = new F3(new F1("F12"),
+ F2Prx.uncheckedCast(current.adapter.getCommunicator().stringToProxy("F22")));
+ return r;
+ }
+
+ @Override
+ public boolean hasF3(com.zeroc.Ice.Current current)
+ {
+ return true;
+ }
+
private com.zeroc.Ice.ObjectAdapter _adapter;
private B _b1;
private B _b2;
diff --git a/java/test/src/main/java/test/Ice/objects/Test.ice b/java/test/src/main/java/test/Ice/objects/Test.ice
index cc72f1323c9..50e6248fd4a 100644
--- a/java/test/src/main/java/test/Ice/objects/Test.ice
+++ b/java/test/src/main/java/test/Ice/objects/Test.ice
@@ -194,6 +194,15 @@ class M
LMap v;
}
+class F1;
+interface F2;
+
+class F3
+{
+ F1 f1;
+ F2* f2;
+}
+
interface Initial
{
void shutdown();
@@ -239,6 +248,11 @@ interface Initial
void throwInnerSubEx() throws Inner::Sub::Ex;
M opM(M v1, out M v2);
+
+ F1 opF1(F1 f11, out F1 f12);
+ F2* opF2(F2* f21, out F2* f22);
+ F3 opF3(F3 f31, out F3 f32);
+ bool hasF3();
}
class Empty