summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/pom.xml2
-rw-r--r--java/src/test/java/com/google/protobuf/MicroTest.java21
-rw-r--r--java/src/test/java/com/google/protobuf/NanoTest.java16
3 files changed, 37 insertions, 2 deletions
diff --git a/java/pom.xml b/java/pom.xml
index 0b9f6e4..399540f 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -126,6 +126,7 @@
<arg value="../src/google/protobuf/unittest_stringutf8_micro.proto" />
<arg value="../src/google/protobuf/unittest_recursive_micro.proto" />
<arg value="../src/google/protobuf/unittest_import_micro.proto" />
+ <arg value="../src/google/protobuf/unittest_multiple_micro.proto" />
</exec>
<exec executable="../src/protoc">
<arg value="--javanano_out=java_package=google/protobuf/unittest_import_nano.proto|com.google.protobuf.nano,java_outer_classname=google/protobuf/unittest_import_nano.proto|UnittestImportNano:target/generated-test-sources" />
@@ -137,6 +138,7 @@
<arg value="../src/google/protobuf/unittest_recursive_nano.proto" />
<arg value="../src/google/protobuf/unittest_import_nano.proto" />
<arg value="../src/google/protobuf/unittest_enum_multiplejava_nano.proto" />
+ <arg value="../src/google/protobuf/unittest_multiple_nano.proto" />
</exec>
<exec executable="../src/protoc">
<arg value="--javanano_out=store_unknown_fields=true:target/generated-test-sources" />
diff --git a/java/src/test/java/com/google/protobuf/MicroTest.java b/java/src/test/java/com/google/protobuf/MicroTest.java
index 9e18feb..03005a7 100644
--- a/java/src/test/java/com/google/protobuf/MicroTest.java
+++ b/java/src/test/java/com/google/protobuf/MicroTest.java
@@ -30,14 +30,16 @@
package com.google.protobuf;
+import com.google.protobuf.micro.ByteStringMicro;
+import com.google.protobuf.micro.CodedInputStreamMicro;
import com.google.protobuf.micro.MicroOuterClass;
import com.google.protobuf.micro.MicroOuterClass.TestAllTypesMicro;
+import com.google.protobuf.micro.MultipleImportingNonMultipleMicro1;
+import com.google.protobuf.micro.MultipleImportingNonMultipleMicro2;
import com.google.protobuf.micro.RecursiveMessageMicro;
import com.google.protobuf.micro.SimpleMessageMicro;
import com.google.protobuf.micro.StringUtf8;
import com.google.protobuf.micro.UnittestImportMicro;
-import com.google.protobuf.micro.ByteStringMicro;
-import com.google.protobuf.micro.CodedInputStreamMicro;
import junit.framework.TestCase;
@@ -2101,6 +2103,21 @@ public class MicroTest extends TestCase {
assertEquals("world", newMsg.getRepeatedCord(1));
}
+ /**
+ * Tests that code generation with mixed values of the java_multiple_files
+ * options between the main source file and the imported source files would
+ * generate correct references. Any error would cause this method to fail
+ * compilation.
+ */
+ public void testMicroMultipleImportingNonMultiple() throws Exception {
+ UnittestImportMicro.ImportMessageMicro importMsg =
+ new UnittestImportMicro.ImportMessageMicro();
+ MultipleImportingNonMultipleMicro1 micro1 = new MultipleImportingNonMultipleMicro1();
+ micro1.setField(importMsg);
+ MultipleImportingNonMultipleMicro2 micro2 = new MultipleImportingNonMultipleMicro2();
+ micro2.setMicro1(micro1);
+ }
+
public void testMicroDefaults() throws Exception {
TestAllTypesMicro msg = new TestAllTypesMicro();
assertFalse(msg.hasDefaultInt32());
diff --git a/java/src/test/java/com/google/protobuf/NanoTest.java b/java/src/test/java/com/google/protobuf/NanoTest.java
index 92ddda6..0ea80d4 100644
--- a/java/src/test/java/com/google/protobuf/NanoTest.java
+++ b/java/src/test/java/com/google/protobuf/NanoTest.java
@@ -35,6 +35,8 @@ import com.google.protobuf.nano.Extensions;
import com.google.protobuf.nano.Extensions.AnotherMessage;
import com.google.protobuf.nano.InternalNano;
import com.google.protobuf.nano.MessageNano;
+import com.google.protobuf.nano.MultipleImportingNonMultipleNano1;
+import com.google.protobuf.nano.MultipleImportingNonMultipleNano2;
import com.google.protobuf.nano.NanoOuterClass;
import com.google.protobuf.nano.NanoOuterClass.TestAllTypesNano;
import com.google.protobuf.nano.RecursiveMessageNano;
@@ -2039,6 +2041,20 @@ public class NanoTest extends TestCase {
assertEquals(nestedMsg2.bb, newMsg.repeatedNestedMessage[2].bb);
}
+ /**
+ * Tests that code generation with mixed values of the java_multiple_files
+ * options between the main source file and the imported source files would
+ * generate correct references. Any error would cause this method to fail
+ * compilation.
+ */
+ public void testNanoMultipleImportingNonMultiple() throws Exception {
+ UnittestImportNano.ImportMessageNano importMsg = new UnittestImportNano.ImportMessageNano();
+ MultipleImportingNonMultipleNano1 nano1 = new MultipleImportingNonMultipleNano1();
+ nano1.field = importMsg;
+ MultipleImportingNonMultipleNano2 nano2 = new MultipleImportingNonMultipleNano2();
+ nano2.nano1 = nano1;
+ }
+
public void testNanoDefaults() throws Exception {
TestAllTypesNano msg = new TestAllTypesNano();
for (int i = 0; i < 2; i++) {