Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factory and multiple messages in a proto file #69

Closed
chapulina opened this issue Jun 30, 2020 · 0 comments · Fixed by #70
Closed

Factory and multiple messages in a proto file #69

chapulina opened this issue Jun 30, 2020 · 0 comments · Fixed by #70
Assignees
Labels
bug Something isn't working

Comments

@chapulina
Copy link
Contributor

While debugging gazebosim/gz-gui#69, I noticed that the Factory::New function fails for ignition.msgs.SerializedStepMap. This test currently fails:

diff --git a/src/Factory_TEST.cc b/src/Factory_TEST.cc
index c5d6516..28d7a52 100644
--- a/src/Factory_TEST.cc
+++ b/src/Factory_TEST.cc
@@ -78,3 +78,12 @@ TEST(FactoryTest, NewDynamicFactory)
   msg = msgs::Factory::New("example.msgs.StringMsg");
   EXPECT_TRUE(msg.get() != nullptr);
 }
+
+/////////////////////////////////////////////////
+TEST(FactoryTest, NewSerializedStepMap)
+{
+  auto msg = msgs::Factory::New<msgs::SerializedStepMap>(
+      "ignition.msgs.SerializedStepMap");
+
+  ASSERT_NE(nullptr, msg.get());
+}

I noticed that the serialized_map.proto file doesn't have the option java_outer_classname line like other messages do. But when I added it, I noticed that that proto file has multiple messages defined, so we can add only one classname. I checked that adding

option java_outer_classname = "SerializedStepMapProtos";

fixes the test, but only for the 1st message defined in the proto file - whichever one it is.

If we ignore the factory issue, the message works otherwise. We've been publishing and using a few messages from serialized_map.proto on ign-gazebo without issues.

I'm wondering if the only solution to this is splitting the messages into multiple files, or if there's another more appropriate solution to this. I think moving the messages to other files wouldn't break API / ABI as long as the existing message includes all others.

@chapulina chapulina added the bug Something isn't working label Jun 30, 2020
@chapulina chapulina self-assigned this Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant