Whitespace
This commit is contained in:
parent
8d9e51cf4e
commit
7139d1eff7
@ -507,7 +507,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||
/**
|
||||
* Internal (package private) implementation of
|
||||
* {@link #copyTo(byte[],int,int,int)}.
|
||||
* It assumes that all error checking has already been performed and that
|
||||
* It assumes that all error checking has already been performed and that
|
||||
* {@code numberToCopy > 0}.
|
||||
*/
|
||||
protected abstract void copyToInternal(byte[] target, int sourceOffset,
|
||||
@ -546,7 +546,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||
* @throws IOException if an I/O error occurs.
|
||||
*/
|
||||
public abstract void writeTo(OutputStream out) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Writes a specified part of this byte string to an output stream.
|
||||
*
|
||||
@ -572,7 +572,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||
if (numberToWrite > 0) {
|
||||
writeToInternal(out, sourceOffset, numberToWrite);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -599,7 +599,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||
* <p>
|
||||
* By returning a list, implementations of this method may be able to avoid
|
||||
* copying even when there are multiple backing arrays.
|
||||
*
|
||||
*
|
||||
* @return a list of wrapped bytes
|
||||
*/
|
||||
public abstract List<ByteBuffer> asReadOnlyByteBufferList();
|
||||
@ -831,7 +831,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
|
||||
flushLastBuffer();
|
||||
return ByteString.copyFrom(flushedBuffers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement java.util.Arrays.copyOf() for jdk 1.5.
|
||||
*/
|
||||
|
@ -144,7 +144,7 @@ public final class CodedOutputStream {
|
||||
int bufferSize) {
|
||||
return newInstance(new ByteBufferOutputStream(byteBuffer), bufferSize);
|
||||
}
|
||||
|
||||
|
||||
private static class ByteBufferOutputStream extends OutputStream {
|
||||
private final ByteBuffer byteBuffer;
|
||||
public ByteBufferOutputStream(ByteBuffer byteBuffer) {
|
||||
@ -750,7 +750,7 @@ public final class CodedOutputStream {
|
||||
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
|
||||
computeLazyFieldSize(WireFormat.MESSAGE_SET_MESSAGE, value);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -256,7 +256,7 @@ public final class Descriptors {
|
||||
throws DescriptorValidationException {
|
||||
return buildFrom(proto, dependencies, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a {@code FileDescriptor}.
|
||||
@ -495,9 +495,9 @@ public final class Descriptors {
|
||||
proto.getExtension(i), this, null, i, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a placeholder FileDescriptor for a message Descriptor.
|
||||
* Create a placeholder FileDescriptor for a message Descriptor.
|
||||
*/
|
||||
FileDescriptor(String packageName, Descriptor message)
|
||||
throws DescriptorValidationException {
|
||||
@ -561,7 +561,7 @@ public final class Descriptors {
|
||||
extensions[i].setProto(proto.getExtension(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean supportsUnknownEnumValue() {
|
||||
return getSyntax() == Syntax.PROTO3;
|
||||
}
|
||||
@ -745,7 +745,7 @@ public final class Descriptors {
|
||||
this.fields = new FieldDescriptor[0];
|
||||
this.extensions = new FieldDescriptor[0];
|
||||
this.oneofs = new OneofDescriptor[0];
|
||||
|
||||
|
||||
// Create a placeholder FileDescriptor to hold this message.
|
||||
this.file = new FileDescriptor(packageName, this);
|
||||
}
|
||||
@ -1333,8 +1333,8 @@ public final class Descriptors {
|
||||
"Message type had default value.");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new DescriptorValidationException(this,
|
||||
"Could not parse default value: \"" +
|
||||
throw new DescriptorValidationException(this,
|
||||
"Could not parse default value: \"" +
|
||||
proto.getDefaultValue() + '\"', e);
|
||||
}
|
||||
} else {
|
||||
@ -1456,7 +1456,7 @@ public final class Descriptors {
|
||||
return file.pool.enumValuesByNumber.get(
|
||||
new DescriptorPool.DescriptorIntPair(this, number));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the enum value for a number. If no enum value has this number,
|
||||
* construct an EnumValueDescriptor for it.
|
||||
@ -1494,7 +1494,7 @@ public final class Descriptors {
|
||||
// then remove the whole entry. This way unknown descriptors will
|
||||
// be freed automatically and we don't need to do anything to
|
||||
// clean-up unused map entries.
|
||||
|
||||
|
||||
// Note: We must use "new Integer(number)" here because we don't want
|
||||
// these Integer objects to be cached.
|
||||
Integer key = new Integer(number);
|
||||
@ -1509,7 +1509,7 @@ public final class Descriptors {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Used in tests only.
|
||||
int getUnknownEnumValueDescriptorCount() {
|
||||
return unknownValues.size();
|
||||
@ -1585,7 +1585,7 @@ public final class Descriptors {
|
||||
|
||||
/** Get the value's number. */
|
||||
public int getNumber() { return proto.getNumber(); }
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() { return proto.getName(); }
|
||||
|
||||
@ -1627,7 +1627,7 @@ public final class Descriptors {
|
||||
file.pool.addSymbol(this);
|
||||
file.pool.addEnumValueByNumber(this);
|
||||
}
|
||||
|
||||
|
||||
private Integer number;
|
||||
// Create an unknown enum value.
|
||||
private EnumValueDescriptor(
|
||||
@ -1643,7 +1643,7 @@ public final class Descriptors {
|
||||
this.type = parent;
|
||||
this.fullName = parent.getFullName() + '.' + proto.getName();
|
||||
this.number = number;
|
||||
|
||||
|
||||
// Don't add this descriptor into pool.
|
||||
}
|
||||
|
||||
@ -1930,13 +1930,13 @@ public final class Descriptors {
|
||||
* descriptors defined in a particular file.
|
||||
*/
|
||||
private static final class DescriptorPool {
|
||||
|
||||
/** Defines what subclass of descriptors to search in the descriptor pool.
|
||||
|
||||
/** Defines what subclass of descriptors to search in the descriptor pool.
|
||||
*/
|
||||
enum SearchFilter {
|
||||
TYPES_ONLY, AGGREGATES_ONLY, ALL_SYMBOLS
|
||||
}
|
||||
|
||||
|
||||
DescriptorPool(final FileDescriptor[] dependencies,
|
||||
boolean allowUnknownDependencies) {
|
||||
this.dependencies = new HashSet<FileDescriptor>();
|
||||
@ -1982,9 +1982,9 @@ public final class Descriptors {
|
||||
GenericDescriptor findSymbol(final String fullName) {
|
||||
return findSymbol(fullName, SearchFilter.ALL_SYMBOLS);
|
||||
}
|
||||
|
||||
/** Find a descriptor by fully-qualified name and given option to only
|
||||
* search valid field type descriptors.
|
||||
|
||||
/** Find a descriptor by fully-qualified name and given option to only
|
||||
* search valid field type descriptors.
|
||||
*/
|
||||
GenericDescriptor findSymbol(final String fullName,
|
||||
final SearchFilter filter) {
|
||||
@ -2013,18 +2013,18 @@ public final class Descriptors {
|
||||
|
||||
/** Checks if the descriptor is a valid type for a message field. */
|
||||
boolean isType(GenericDescriptor descriptor) {
|
||||
return (descriptor instanceof Descriptor) ||
|
||||
return (descriptor instanceof Descriptor) ||
|
||||
(descriptor instanceof EnumDescriptor);
|
||||
}
|
||||
|
||||
|
||||
/** Checks if the descriptor is a valid namespace type. */
|
||||
boolean isAggregate(GenericDescriptor descriptor) {
|
||||
return (descriptor instanceof Descriptor) ||
|
||||
(descriptor instanceof EnumDescriptor) ||
|
||||
(descriptor instanceof PackageDescriptor) ||
|
||||
return (descriptor instanceof Descriptor) ||
|
||||
(descriptor instanceof EnumDescriptor) ||
|
||||
(descriptor instanceof PackageDescriptor) ||
|
||||
(descriptor instanceof ServiceDescriptor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up a type descriptor by name, relative to some other descriptor.
|
||||
* The name may be fully-qualified (with a leading '.'),
|
||||
@ -2082,7 +2082,7 @@ public final class Descriptors {
|
||||
|
||||
// Append firstPart and try to find
|
||||
scopeToTry.append(firstPart);
|
||||
result = findSymbol(scopeToTry.toString(),
|
||||
result = findSymbol(scopeToTry.toString(),
|
||||
DescriptorPool.SearchFilter.AGGREGATES_ONLY);
|
||||
|
||||
if (result != null) {
|
||||
|
@ -112,7 +112,7 @@ public class Internal {
|
||||
* Helper called by generated code to construct default values for bytes
|
||||
* fields.
|
||||
* <p>
|
||||
* This is like {@link #bytesDefaultValue}, but returns a byte array.
|
||||
* This is like {@link #bytesDefaultValue}, but returns a byte array.
|
||||
*/
|
||||
public static byte[] byteArrayDefaultValue(String bytes) {
|
||||
try {
|
||||
@ -129,7 +129,7 @@ public class Internal {
|
||||
* Helper called by generated code to construct default values for bytes
|
||||
* fields.
|
||||
* <p>
|
||||
* This is like {@link #bytesDefaultValue}, but returns a ByteBuffer.
|
||||
* This is like {@link #bytesDefaultValue}, but returns a ByteBuffer.
|
||||
*/
|
||||
public static ByteBuffer byteBufferDefaultValue(String bytes) {
|
||||
return ByteBuffer.wrap(byteArrayDefaultValue(bytes));
|
||||
@ -185,7 +185,7 @@ public class Internal {
|
||||
public static boolean isValidUtf8(ByteString byteString) {
|
||||
return byteString.isValidUtf8();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Like {@link #isValidUtf8(ByteString)} but for byte arrays.
|
||||
*/
|
||||
@ -203,7 +203,7 @@ public class Internal {
|
||||
throw new RuntimeException("UTF-8 not supported?", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to convert a byte array to a string using UTF-8 encoding.
|
||||
*/
|
||||
@ -274,7 +274,7 @@ public class Internal {
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for implementing {@link Message#equals(Object)} for bytes field.
|
||||
*/
|
||||
@ -298,7 +298,7 @@ public class Internal {
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for implementing {@link Message#hashCode()} for bytes field.
|
||||
*/
|
||||
@ -309,7 +309,7 @@ public class Internal {
|
||||
// based hashCode() method.
|
||||
return LiteralByteString.hashCode(bytes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for implementing {@link Message#equals(Object)} for bytes
|
||||
* field.
|
||||
@ -322,7 +322,7 @@ public class Internal {
|
||||
// compare all the content.
|
||||
return a.duplicate().clear().equals(b.duplicate().clear());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for implementing {@link Message#equals(Object)} for bytes
|
||||
* field.
|
||||
@ -351,9 +351,9 @@ public class Internal {
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
private static final int DEFAULT_BUFFER_SIZE = 4096;
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for implementing {@link Message#hashCode()} for bytes
|
||||
* field.
|
||||
@ -382,18 +382,18 @@ public class Internal {
|
||||
return h == 0 ? 1 : h;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An empty byte array constant used in generated code.
|
||||
*/
|
||||
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
||||
|
||||
|
||||
/**
|
||||
* An empty byte array constant used in generated code.
|
||||
*/
|
||||
public static final ByteBuffer EMPTY_BYTE_BUFFER =
|
||||
ByteBuffer.wrap(EMPTY_BYTE_ARRAY);
|
||||
|
||||
|
||||
/** An empty coded input stream constant used in generated code. */
|
||||
public static final CodedInputStream EMPTY_CODED_INPUT_STREAM =
|
||||
CodedInputStream.newInstance(EMPTY_BYTE_ARRAY);
|
||||
@ -458,13 +458,13 @@ public class Internal {
|
||||
|
||||
private final Map<K, RealValue> realMap;
|
||||
private final Converter<RealValue, V> valueConverter;
|
||||
|
||||
|
||||
public MapAdapter(Map<K, RealValue> realMap,
|
||||
Converter<RealValue, V> valueConverter) {
|
||||
this.realMap = realMap;
|
||||
this.valueConverter = valueConverter;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public V get(Object key) {
|
||||
@ -474,7 +474,7 @@ public class Internal {
|
||||
}
|
||||
return valueConverter.doForward(result);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public V put(K key, V value) {
|
||||
RealValue oldValue = realMap.put(key, valueConverter.doBackward(value));
|
||||
@ -488,13 +488,13 @@ public class Internal {
|
||||
public Set<java.util.Map.Entry<K, V>> entrySet() {
|
||||
return new SetAdapter(realMap.entrySet());
|
||||
}
|
||||
|
||||
|
||||
private class SetAdapter extends AbstractSet<Map.Entry<K, V>> {
|
||||
private final Set<Map.Entry<K, RealValue>> realSet;
|
||||
public SetAdapter(Set<Map.Entry<K, RealValue>> realSet) {
|
||||
this.realSet = realSet;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Iterator<java.util.Map.Entry<K, V>> iterator() {
|
||||
return new IteratorAdapter(realSet.iterator());
|
||||
@ -503,17 +503,17 @@ public class Internal {
|
||||
@Override
|
||||
public int size() {
|
||||
return realSet.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class IteratorAdapter implements Iterator<Map.Entry<K, V>> {
|
||||
private final Iterator<Map.Entry<K, RealValue>> realIterator;
|
||||
|
||||
|
||||
public IteratorAdapter(
|
||||
Iterator<Map.Entry<K, RealValue>> realIterator) {
|
||||
this.realIterator = realIterator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return realIterator.hasNext();
|
||||
@ -529,14 +529,14 @@ public class Internal {
|
||||
realIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class EntryAdapter implements Map.Entry<K, V> {
|
||||
private final Map.Entry<K, RealValue> realEntry;
|
||||
|
||||
|
||||
public EntryAdapter(Map.Entry<K, RealValue> realEntry) {
|
||||
this.realEntry = realEntry;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public K getKey() {
|
||||
return realEntry.getKey();
|
||||
|
@ -112,7 +112,7 @@ class LiteralByteString extends ByteString {
|
||||
// ByteString -> byte[]
|
||||
|
||||
@Override
|
||||
protected void copyToInternal(byte[] target, int sourceOffset,
|
||||
protected void copyToInternal(byte[] target, int sourceOffset,
|
||||
int targetOffset, int numberToCopy) {
|
||||
// Optimized form, not for subclasses, since we don't call
|
||||
// getOffsetIntoBytes() or check the 'numberToCopy' parameter.
|
||||
@ -199,12 +199,12 @@ class LiteralByteString extends ByteString {
|
||||
LiteralByteString otherAsLiteral = (LiteralByteString) other;
|
||||
// If we know the hash codes and they are not equal, we know the byte
|
||||
// strings are not equal.
|
||||
if (hash != 0
|
||||
&& otherAsLiteral.hash != 0
|
||||
if (hash != 0
|
||||
&& otherAsLiteral.hash != 0
|
||||
&& hash != otherAsLiteral.hash) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return equalsRange((LiteralByteString) other, 0, size());
|
||||
} else if (other instanceof RopeByteString) {
|
||||
return other.equals(this);
|
||||
@ -285,14 +285,14 @@ class LiteralByteString extends ByteString {
|
||||
protected int partialHash(int h, int offset, int length) {
|
||||
return hashCode(h, bytes, getOffsetIntoBytes() + offset, length);
|
||||
}
|
||||
|
||||
|
||||
static int hashCode(int h, byte[] bytes, int offset, int length) {
|
||||
for (int i = offset; i < offset + length; i++) {
|
||||
h = h * 31 + bytes[i];
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
static int hashCode(byte[] bytes) {
|
||||
int h = hashCode(bytes.length, bytes, 0, bytes.length);
|
||||
return h == 0 ? 1 : h;
|
||||
|
@ -380,7 +380,7 @@ public class ByteStringTest extends TestCase {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// A stream which exposes the byte array passed into write(byte[], int, int).
|
||||
private static class EvilOutputStream extends OutputStream {
|
||||
public byte[] capturedArray = null;
|
||||
@ -492,13 +492,13 @@ public class ByteStringTest extends TestCase {
|
||||
isArrayRange(bytes, byteString.toByteArray(), 0, bytes.length));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testNewOutputEmpty() throws IOException {
|
||||
// Make sure newOutput() correctly builds empty byte strings
|
||||
ByteString byteString = ByteString.newOutput().toByteString();
|
||||
assertEquals(ByteString.EMPTY, byteString);
|
||||
}
|
||||
|
||||
|
||||
public void testNewOutput_Mutating() throws IOException {
|
||||
Output os = ByteString.newOutput(5);
|
||||
os.write(new byte[] {1, 2, 3, 4, 5});
|
||||
@ -705,14 +705,14 @@ public class ByteStringTest extends TestCase {
|
||||
}
|
||||
return pieces;
|
||||
}
|
||||
|
||||
|
||||
private byte[] substringUsingWriteTo(
|
||||
ByteString data, int offset, int length) throws IOException {
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
data.writeTo(output, offset, length);
|
||||
return output.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
public void testWriteToOutputStream() throws Exception {
|
||||
// Choose a size large enough so when two ByteStrings are concatenated they
|
||||
// won't be merged into one byte array due to some optimizations.
|
||||
@ -727,7 +727,7 @@ public class ByteStringTest extends TestCase {
|
||||
byte[] result = substringUsingWriteTo(left, 1, 1);
|
||||
assertEquals(1, result.length);
|
||||
assertEquals((byte) 11, result[0]);
|
||||
|
||||
|
||||
byte[] data2 = new byte[dataSize];
|
||||
for (int i = 0; i < data1.length; i++) {
|
||||
data2[i] = (byte) 2;
|
||||
|
@ -330,7 +330,7 @@ public class CodedOutputStreamTest extends TestCase {
|
||||
assertTrue(codedStream.getTotalBytesWritten() > BUFFER_SIZE);
|
||||
assertEquals(value.length * 1024, codedStream.getTotalBytesWritten());
|
||||
}
|
||||
|
||||
|
||||
public void testWriteToByteBuffer() throws Exception {
|
||||
final int bufferSize = 16 * 1024;
|
||||
ByteBuffer buffer = ByteBuffer.allocate(bufferSize);
|
||||
@ -351,7 +351,7 @@ public class CodedOutputStreamTest extends TestCase {
|
||||
codedStream.writeRawByte((byte) 3);
|
||||
}
|
||||
codedStream.flush();
|
||||
|
||||
|
||||
// Check that data is correctly written to the ByteBuffer.
|
||||
assertEquals(0, buffer.remaining());
|
||||
buffer.flip();
|
||||
@ -365,7 +365,7 @@ public class CodedOutputStreamTest extends TestCase {
|
||||
assertEquals((byte) 3, buffer.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testWriteByteBuffer() throws Exception {
|
||||
byte[] value = "abcde".getBytes("UTF-8");
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
@ -377,10 +377,10 @@ public class CodedOutputStreamTest extends TestCase {
|
||||
// The above call shouldn't affect the ByteBuffer's state.
|
||||
assertEquals(0, byteBuffer.position());
|
||||
assertEquals(1, byteBuffer.limit());
|
||||
|
||||
|
||||
// The correct way to write part of an array using ByteBuffer.
|
||||
codedStream.writeRawBytes(ByteBuffer.wrap(value, 2, 1).slice());
|
||||
|
||||
|
||||
codedStream.flush();
|
||||
byte[] result = outputStream.toByteArray();
|
||||
assertEquals(6, result.length);
|
||||
|
@ -497,7 +497,7 @@ public class DescriptorsTest extends TestCase {
|
||||
.build();
|
||||
// translate and crosslink
|
||||
FileDescriptor file =
|
||||
Descriptors.FileDescriptor.buildFrom(fileDescriptorProto,
|
||||
Descriptors.FileDescriptor.buildFrom(fileDescriptorProto,
|
||||
new FileDescriptor[0]);
|
||||
// verify resulting descriptors
|
||||
assertNotNull(file);
|
||||
@ -518,7 +518,7 @@ public class DescriptorsTest extends TestCase {
|
||||
}
|
||||
assertTrue(barFound);
|
||||
}
|
||||
|
||||
|
||||
public void testDependencyOrder() throws Exception {
|
||||
FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
|
||||
.setName("foo.proto").build();
|
||||
@ -537,14 +537,14 @@ public class DescriptorsTest extends TestCase {
|
||||
new FileDescriptor[0]);
|
||||
FileDescriptor barFile = Descriptors.FileDescriptor.buildFrom(barProto,
|
||||
new FileDescriptor[] {fooFile});
|
||||
|
||||
// Items in the FileDescriptor array can be in any order.
|
||||
|
||||
// Items in the FileDescriptor array can be in any order.
|
||||
Descriptors.FileDescriptor.buildFrom(bazProto,
|
||||
new FileDescriptor[] {fooFile, barFile});
|
||||
Descriptors.FileDescriptor.buildFrom(bazProto,
|
||||
new FileDescriptor[] {barFile, fooFile});
|
||||
}
|
||||
|
||||
|
||||
public void testInvalidPublicDependency() throws Exception {
|
||||
FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
|
||||
.setName("foo.proto").build();
|
||||
@ -628,7 +628,7 @@ public class DescriptorsTest extends TestCase {
|
||||
Descriptors.FileDescriptor.buildFrom(
|
||||
fooProto, new FileDescriptor[] {forwardFile});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the translate/crosslink for an example with a more complex namespace
|
||||
* referencing.
|
||||
@ -677,7 +677,7 @@ public class DescriptorsTest extends TestCase {
|
||||
assertTrue(field.getEnumType().getFile().getName().equals("bar.proto"));
|
||||
assertTrue(field.getEnumType().getFile().getPackage().equals(
|
||||
"a.b.c.d.bar.shared"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testOneofDescriptor() throws Exception {
|
||||
|
@ -248,7 +248,7 @@ public class LiteralByteStringTest extends TestCase {
|
||||
assertTrue(classUnderTest + ".writeTo() must give back the same bytes",
|
||||
Arrays.equals(referenceBytes, roundTripBytes));
|
||||
}
|
||||
|
||||
|
||||
public void testWriteTo_mutating() throws IOException {
|
||||
OutputStream os = new OutputStream() {
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* This class tests {@link RopeByteString#substring(int, int)} by inheriting the tests from
|
||||
* {@link LiteralByteStringTest}. Only a couple of methods are overridden.
|
||||
* {@link LiteralByteStringTest}. Only a couple of methods are overridden.
|
||||
*
|
||||
* @author carlanton@google.com (Carl Haverl)
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ import java.util.Iterator;
|
||||
/**
|
||||
* This class tests {@link RopeByteString} by inheriting the tests from
|
||||
* {@link LiteralByteStringTest}. Only a couple of methods are overridden.
|
||||
*
|
||||
*
|
||||
* <p>A full test of the result of {@link RopeByteString#substring(int, int)} is found in the
|
||||
* separate class {@link RopeByteStringSubstringTest}.
|
||||
*
|
||||
|
@ -863,7 +863,7 @@ public class TextFormatTest extends TestCase {
|
||||
TextFormat.merge(TextFormat.printToUnicodeString(message), builder);
|
||||
assertEquals(message.getOptionalString(), builder.getOptionalString());
|
||||
}
|
||||
|
||||
|
||||
public void testPrintToUnicodeStringWithNewlines() throws Exception {
|
||||
// No newlines at start and end
|
||||
assertEquals("optional_string: \"test newlines\\n\\nin\\nstring\"\n",
|
||||
|
Loading…
Reference in New Issue
Block a user