The following issues were found

java/core/src/test/java/com/google/protobuf/CodedAdapterTest.java
16 issues
Avoid throwing raw exception types.
Design

Line: 107

                        ExtensionRegistryLite.EMPTY_REGISTRY_LITE);
      return msg;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
}

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 49

                public void setup() {
    TestSchemas.registerGenericProto2Schemas();

    Protobuf.getInstance()
        .registerSchemaOverride(Proto3Message.class, TestSchemas.genericProto3Schema);
  }

  @Test
  public void proto3Roundtrip() throws Exception {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 54

                }

  @Test
  public void proto3Roundtrip() throws Exception {
    Proto3Message expected = new Proto3MessageFactory(5, 10, 2, 2).newMessage();
    byte[] expectedBytes = expected.toByteArray();

    // Deserialize with BinaryReader and verify that the message matches the original.
    Proto3Message result = fromByteArray(expectedBytes, Proto3Message.class);

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 54

                }

  @Test
  public void proto3Roundtrip() throws Exception {
    Proto3Message expected = new Proto3MessageFactory(5, 10, 2, 2).newMessage();
    byte[] expectedBytes = expected.toByteArray();

    // Deserialize with BinaryReader and verify that the message matches the original.
    Proto3Message result = fromByteArray(expectedBytes, Proto3Message.class);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

              
    // Deserialize with BinaryReader and verify that the message matches the original.
    Proto3Message result = fromByteArray(expectedBytes, Proto3Message.class);
    assertThat(result).isEqualTo(expected);

    // Now write it back out using BinaryWriter and verify the output length.
    byte[] actualBytes = toByteArray(result, expectedBytes.length);

    // Read back in the bytes and verify that it matches the original message.

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

              
    // Read back in the bytes and verify that it matches the original message.
    Proto3Message actual = Proto3Message.parseFrom(actualBytes);
    assertThat(actual).isEqualTo(expected);
  }

  @Test
  public void proto2Roundtrip() throws Exception {
    Proto2Message expected = new Proto2MessageFactory(5, 10, 2, 2).newMessage();

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 71

                }

  @Test
  public void proto2Roundtrip() throws Exception {
    Proto2Message expected = new Proto2MessageFactory(5, 10, 2, 2).newMessage();
    byte[] expectedBytes = expected.toByteArray();

    // Deserialize with BinaryReader and verify that the message matches the original.
    Proto2Message result = fromByteArray(expectedBytes, Proto2Message.class);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 71

                }

  @Test
  public void proto2Roundtrip() throws Exception {
    Proto2Message expected = new Proto2MessageFactory(5, 10, 2, 2).newMessage();
    byte[] expectedBytes = expected.toByteArray();

    // Deserialize with BinaryReader and verify that the message matches the original.
    Proto2Message result = fromByteArray(expectedBytes, Proto2Message.class);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 77

              
    // Deserialize with BinaryReader and verify that the message matches the original.
    Proto2Message result = fromByteArray(expectedBytes, Proto2Message.class);
    assertThat(result).isEqualTo(expected);

    // Now write it back out using BinaryWriter and verify the output length.
    byte[] actualBytes = toByteArray(result, expectedBytes.length);

    // Read back in the bytes and verify that it matches the original message.

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 84

              
    // Read back in the bytes and verify that it matches the original message.
    Proto2Message actual = Proto2Message.parseFrom(actualBytes);
    assertThat(actual).isEqualTo(expected);
  }

  public static <T> byte[] toByteArray(T msg, int size) throws Exception {
    Schema<T> schema = Protobuf.getInstance().schemaFor(msg);
    byte[] out = new byte[size];

            

Reported by PMD.

java/util/src/test/java/com/google/protobuf/util/ValuesTest.java
16 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 49

              public final class ValuesTest {
  @Test
  public void testOfNull_IsNullValue() throws Exception {
    assertThat(Values.ofNull())
        .isEqualTo(Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build());
  }

  @Test
  public void testOfBoolean_ConstructsValue() {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 54

                }

  @Test
  public void testOfBoolean_ConstructsValue() {
    assertThat(Values.of(true)).isEqualTo(Value.newBuilder().setBoolValue(true).build());
    assertThat(Values.of(false)).isEqualTo(Value.newBuilder().setBoolValue(false).build());
  }

  @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 55

              
  @Test
  public void testOfBoolean_ConstructsValue() {
    assertThat(Values.of(true)).isEqualTo(Value.newBuilder().setBoolValue(true).build());
    assertThat(Values.of(false)).isEqualTo(Value.newBuilder().setBoolValue(false).build());
  }

  @Test
  public void testOfNumeric_ConstructsValue() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 56

                @Test
  public void testOfBoolean_ConstructsValue() {
    assertThat(Values.of(true)).isEqualTo(Value.newBuilder().setBoolValue(true).build());
    assertThat(Values.of(false)).isEqualTo(Value.newBuilder().setBoolValue(false).build());
  }

  @Test
  public void testOfNumeric_ConstructsValue() {
    assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 60

                }

  @Test
  public void testOfNumeric_ConstructsValue() {
    assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());
    assertThat(Values.of(1000L)).isEqualTo(Value.newBuilder().setNumberValue(1000).build());
    assertThat(Values.of(1000.23f)).isEqualTo(Value.newBuilder().setNumberValue(1000.23f).build());
    assertThat(Values.of(10000.23)).isEqualTo(Value.newBuilder().setNumberValue(10000.23).build());
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 61

              
  @Test
  public void testOfNumeric_ConstructsValue() {
    assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());
    assertThat(Values.of(1000L)).isEqualTo(Value.newBuilder().setNumberValue(1000).build());
    assertThat(Values.of(1000.23f)).isEqualTo(Value.newBuilder().setNumberValue(1000.23f).build());
    assertThat(Values.of(10000.23)).isEqualTo(Value.newBuilder().setNumberValue(10000.23).build());
  }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 62

                @Test
  public void testOfNumeric_ConstructsValue() {
    assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());
    assertThat(Values.of(1000L)).isEqualTo(Value.newBuilder().setNumberValue(1000).build());
    assertThat(Values.of(1000.23f)).isEqualTo(Value.newBuilder().setNumberValue(1000.23f).build());
    assertThat(Values.of(10000.23)).isEqualTo(Value.newBuilder().setNumberValue(10000.23).build());
  }

  @Test

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 63

                public void testOfNumeric_ConstructsValue() {
    assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());
    assertThat(Values.of(1000L)).isEqualTo(Value.newBuilder().setNumberValue(1000).build());
    assertThat(Values.of(1000.23f)).isEqualTo(Value.newBuilder().setNumberValue(1000.23f).build());
    assertThat(Values.of(10000.23)).isEqualTo(Value.newBuilder().setNumberValue(10000.23).build());
  }

  @Test
  public void testOfString_ConstructsValue() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 64

                  assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());
    assertThat(Values.of(1000L)).isEqualTo(Value.newBuilder().setNumberValue(1000).build());
    assertThat(Values.of(1000.23f)).isEqualTo(Value.newBuilder().setNumberValue(1000.23f).build());
    assertThat(Values.of(10000.23)).isEqualTo(Value.newBuilder().setNumberValue(10000.23).build());
  }

  @Test
  public void testOfString_ConstructsValue() {
    assertThat(Values.of("")).isEqualTo(Value.newBuilder().setStringValue("").build());

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 68

                }

  @Test
  public void testOfString_ConstructsValue() {
    assertThat(Values.of("")).isEqualTo(Value.newBuilder().setStringValue("").build());
    assertThat(Values.of("foo")).isEqualTo(Value.newBuilder().setStringValue("foo").build());
  }

  @Test

            

Reported by PMD.

java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java
16 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 45

              public final class TypeRegistryTest {

  @Test
  public void findDescriptorByFullName() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 45

              public final class TypeRegistryTest {

  @Test
  public void findDescriptorByFullName() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 46

              
  @Test
  public void findDescriptorByFullName() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);
  }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 47

                @Test
  public void findDescriptorByFullName() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 47

                @Test
  public void findDescriptorByFullName() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 47

                @Test
  public void findDescriptorByFullName() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 49

                  Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);
  }

  @Test
  public void findDescriptorByTypeUrl() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 49

                  Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName())).isNull();

    assertThat(TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()))
        .isSameInstanceAs(descriptor);
  }

  @Test
  public void findDescriptorByTypeUrl() throws Exception {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 54

                }

  @Test
  public void findDescriptorByTypeUrl() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(
            TypeRegistry.getEmptyTypeRegistry()
                .getDescriptorForTypeUrl("type.googleapis.com/" + descriptor.getFullName()))
        .isNull();

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 54

                }

  @Test
  public void findDescriptorByTypeUrl() throws Exception {
    Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
    assertThat(
            TypeRegistry.getEmptyTypeRegistry()
                .getDescriptorForTypeUrl("type.googleapis.com/" + descriptor.getFullName()))
        .isNull();

            

Reported by PMD.

python/google/protobuf/internal/text_encoding_test.py
16 issues
Bad indentation. Found 2 spaces, expected 4
Style

Line: 36 Column: 1

              """Tests for google.protobuf.text_encoding."""

try:
  import unittest2 as unittest  #PY26
except ImportError:
  import unittest

from google.protobuf import text_encoding


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 38 Column: 1

              try:
  import unittest2 as unittest  #PY26
except ImportError:
  import unittest

from google.protobuf import text_encoding

TEST_VALUES = [
    ("foo\\rbar\\nbaz\\t",

            

Reported by Pylint.

Missing class docstring
Error

Line: 57 Column: 1

                   b"\010\011\012\013\014\015")]


class TextEncodingTestCase(unittest.TestCase):
  def testCEscape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 58 Column: 1

              

class TextEncodingTestCase(unittest.TestCase):
  def testCEscape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))

            

Reported by Pylint.

Method name "testCEscape" doesn't conform to snake_case naming style
Error

Line: 58 Column: 3

              

class TextEncodingTestCase(unittest.TestCase):
  def testCEscape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 58 Column: 3

              

class TextEncodingTestCase(unittest.TestCase):
  def testCEscape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 59 Column: 1

              
class TextEncodingTestCase(unittest.TestCase):
  def testCEscape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))


            

Reported by Pylint.

Bad indentation. Found 6 spaces, expected 12
Style

Line: 60 Column: 1

              class TextEncodingTestCase(unittest.TestCase):
  def testCEscape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))

  def testCUnescape(self):

            

Reported by Pylint.

Bad indentation. Found 6 spaces, expected 12
Style

Line: 62 Column: 1

                  for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(escaped,
                        text_encoding.CEscape(unescaped, as_utf8=False))
      self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))

  def testCUnescape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(unescaped, text_encoding.CUnescape(escaped))

            

Reported by Pylint.

Method name "testCUnescape" doesn't conform to snake_case naming style
Error

Line: 65 Column: 3

                    self.assertEqual(escaped_utf8,
                        text_encoding.CEscape(unescaped, as_utf8=True))

  def testCUnescape(self):
    for escaped, escaped_utf8, unescaped in TEST_VALUES:
      self.assertEqual(unescaped, text_encoding.CUnescape(escaped))
      self.assertEqual(unescaped, text_encoding.CUnescape(escaped_utf8))



            

Reported by Pylint.

examples/ListPeople.java
16 issues
Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter
Performance

Line: 49

              
    // Read the existing address book.
    AddressBook addressBook =
      AddressBook.parseFrom(new FileInputStream(args[0]));

    Print(addressBook);
  }
}

            

Reported by PMD.

System.out.println is used
Design

Line: 13

                // Iterates though all people in the AddressBook and prints info about them.
  static void Print(AddressBook addressBook) {
    for (Person person: addressBook.getPeopleList()) {
      System.out.println("Person ID: " + person.getId());
      System.out.println("  Name: " + person.getName());
      if (!person.getEmail().isEmpty()) {
        System.out.println("  E-mail address: " + person.getEmail());
      }


            

Reported by PMD.

System.out.println is used
Design

Line: 14

                static void Print(AddressBook addressBook) {
    for (Person person: addressBook.getPeopleList()) {
      System.out.println("Person ID: " + person.getId());
      System.out.println("  Name: " + person.getName());
      if (!person.getEmail().isEmpty()) {
        System.out.println("  E-mail address: " + person.getEmail());
      }

      for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {

            

Reported by PMD.

System.out.println is used
Design

Line: 16

                    System.out.println("Person ID: " + person.getId());
      System.out.println("  Name: " + person.getName());
      if (!person.getEmail().isEmpty()) {
        System.out.println("  E-mail address: " + person.getEmail());
      }

      for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
        switch (phoneNumber.getType()) {
          case MOBILE:

            

Reported by PMD.

System.out.print is used
Design

Line: 22

                    for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
        switch (phoneNumber.getType()) {
          case MOBILE:
            System.out.print("  Mobile phone #: ");
            break;
          case HOME:
            System.out.print("  Home phone #: ");
            break;
          case WORK:

            

Reported by PMD.

System.out.print is used
Design

Line: 25

                          System.out.print("  Mobile phone #: ");
            break;
          case HOME:
            System.out.print("  Home phone #: ");
            break;
          case WORK:
            System.out.print("  Work phone #: ");
            break;
          default:

            

Reported by PMD.

System.out.print is used
Design

Line: 28

                          System.out.print("  Home phone #: ");
            break;
          case WORK:
            System.out.print("  Work phone #: ");
            break;
          default:
            System.out.println(" Unknown phone #: ");
            break;
        }

            

Reported by PMD.

System.out.println is used
Design

Line: 31

                          System.out.print("  Work phone #: ");
            break;
          default:
            System.out.println(" Unknown phone #: ");
            break;
        }
        System.out.println(phoneNumber.getNumber());
      }
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 34

                          System.out.println(" Unknown phone #: ");
            break;
        }
        System.out.println(phoneNumber.getNumber());
      }
    }
  }

  // Main function:  Reads the entire address book from a file and prints all

            

Reported by PMD.

System.err.println is used
Design

Line: 43

                //   the information inside.
  public static void main(String[] args) throws Exception {
    if (args.length != 1) {
      System.err.println("Usage:  ListPeople ADDRESS_BOOK_FILE");
      System.exit(-1);
    }

    // Read the existing address book.
    AddressBook addressBook =

            

Reported by PMD.

java/core/src/test/java/com/google/protobuf/TestSchemasLite.java
15 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 43

              import com.google.protobuf.testing.Proto3TestingLite.Proto3MessageLiteWithMaps;

/** Schemas to support testing. */
public final class TestSchemasLite {

  public static final Schema<Proto2MessageLite> genericProto2LiteSchema =
      new ManifestSchemaFactory().createSchema(Proto2MessageLite.class);
  public static final Schema<Proto3MessageLite> genericProto3LiteSchema =
      new ManifestSchemaFactory().createSchema(Proto3MessageLite.class);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 61

                private static void registerProto2LiteSchemas() {
    Protobuf protobuf = Protobuf.getInstance();
    ManifestSchemaFactory factory = new ManifestSchemaFactory();
    protobuf.registerSchemaOverride(
        Proto2MessageLite.class, factory.createSchema(Proto2MessageLite.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup49.class,
        factory.createSchema(Proto2MessageLite.FieldGroup49.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 63

                  ManifestSchemaFactory factory = new ManifestSchemaFactory();
    protobuf.registerSchemaOverride(
        Proto2MessageLite.class, factory.createSchema(Proto2MessageLite.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup49.class,
        factory.createSchema(Proto2MessageLite.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroupList51.class,
        factory.createSchema(Proto2MessageLite.FieldGroupList51.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 66

                  protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup49.class,
        factory.createSchema(Proto2MessageLite.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroupList51.class,
        factory.createSchema(Proto2MessageLite.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup69.class,
        factory.createSchema(Proto2MessageLite.FieldGroup69.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 69

                  protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroupList51.class,
        factory.createSchema(Proto2MessageLite.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup69.class,
        factory.createSchema(Proto2MessageLite.FieldGroup69.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.RequiredNestedMessage.class,
        factory.createSchema(Proto2MessageLite.RequiredNestedMessage.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 72

                  protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldGroup69.class,
        factory.createSchema(Proto2MessageLite.FieldGroup69.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.RequiredNestedMessage.class,
        factory.createSchema(Proto2MessageLite.RequiredNestedMessage.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldRequiredGroup88.class,
        factory.createSchema(Proto2MessageLite.FieldRequiredGroup88.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 75

                  protobuf.registerSchemaOverride(
        Proto2MessageLite.RequiredNestedMessage.class,
        factory.createSchema(Proto2MessageLite.RequiredNestedMessage.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldRequiredGroup88.class,
        factory.createSchema(Proto2MessageLite.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(
        Proto2EmptyLite.class, factory.createSchema(Proto2EmptyLite.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 78

                  protobuf.registerSchemaOverride(
        Proto2MessageLite.FieldRequiredGroup88.class,
        factory.createSchema(Proto2MessageLite.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(
        Proto2EmptyLite.class, factory.createSchema(Proto2EmptyLite.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLiteWithExtensions.class,
        factory.createSchema(Proto2MessageLiteWithExtensions.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 80

                      factory.createSchema(Proto2MessageLite.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(
        Proto2EmptyLite.class, factory.createSchema(Proto2EmptyLite.class));
    protobuf.registerSchemaOverride(
        Proto2MessageLiteWithExtensions.class,
        factory.createSchema(Proto2MessageLiteWithExtensions.class));
    protobuf.registerSchemaOverride(
        Proto2TestingLite.FieldGroup49.class,
        factory.createSchema(Proto2TestingLite.FieldGroup49.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 83

                  protobuf.registerSchemaOverride(
        Proto2MessageLiteWithExtensions.class,
        factory.createSchema(Proto2MessageLiteWithExtensions.class));
    protobuf.registerSchemaOverride(
        Proto2TestingLite.FieldGroup49.class,
        factory.createSchema(Proto2TestingLite.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2TestingLite.FieldGroupList51.class,
        factory.createSchema(Proto2TestingLite.FieldGroupList51.class));

            

Reported by PMD.

ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
15 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 133

              
    protected IRubyObject nameToNumber(ThreadContext context, IRubyObject name)  {
        EnumValueDescriptor value = descriptor.findValueByName(name.asJavaString());
        return value == null ? context.nil : context.runtime.newFixnum(value.getNumber());
    }

    protected IRubyObject numberToName(ThreadContext context, IRubyObject number)  {
        EnumValueDescriptor value = descriptor.findValueByNumber(RubyNumeric.num2int(number));
        return value == null ? context.nil : context.runtime.newSymbol(value.getName());

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 133

              
    protected IRubyObject nameToNumber(ThreadContext context, IRubyObject name)  {
        EnumValueDescriptor value = descriptor.findValueByName(name.asJavaString());
        return value == null ? context.nil : context.runtime.newFixnum(value.getNumber());
    }

    protected IRubyObject numberToName(ThreadContext context, IRubyObject number)  {
        EnumValueDescriptor value = descriptor.findValueByNumber(RubyNumeric.num2int(number));
        return value == null ? context.nil : context.runtime.newSymbol(value.getName());

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 138

              
    protected IRubyObject numberToName(ThreadContext context, IRubyObject number)  {
        EnumValueDescriptor value = descriptor.findValueByNumber(RubyNumeric.num2int(number));
        return value == null ? context.nil : context.runtime.newSymbol(value.getName());
    }

    protected void setDescriptor(ThreadContext context, EnumDescriptor descriptor) {
        this.descriptor = descriptor;
        this.module = buildModuleFromDescriptor(context);

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 138

              
    protected IRubyObject numberToName(ThreadContext context, IRubyObject number)  {
        EnumValueDescriptor value = descriptor.findValueByNumber(RubyNumeric.num2int(number));
        return value == null ? context.nil : context.runtime.newSymbol(value.getName());
    }

    protected void setDescriptor(ThreadContext context, EnumDescriptor descriptor) {
        this.descriptor = descriptor;
        this.module = buildModuleFromDescriptor(context);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 157

                      for (EnumValueDescriptor value : descriptor.getValues()) {
            String name = value.getName();
            // Make sure its a valid constant name before trying to create it
            if (Character.isUpperCase(name.codePointAt(0))) {
                enumModule.defineConstant(name, runtime.newFixnum(value.getNumber()));
            } else {
                runtime.getWarnings().warn("Enum value " + name + " does not start with an uppercase letter as is required for Ruby constants.");
            }
        }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 160

                          if (Character.isUpperCase(name.codePointAt(0))) {
                enumModule.defineConstant(name, runtime.newFixnum(value.getNumber()));
            } else {
                runtime.getWarnings().warn("Enum value " + name + " does not start with an uppercase letter as is required for Ruby constants.");
            }
        }

        enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this);
        enumModule.defineAnnotatedMethods(RubyEnum.class);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 164

                          }
        }

        enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this);
        enumModule.defineAnnotatedMethods(RubyEnum.class);
        return enumModule;
    }

    private EnumDescriptor descriptor;

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 164

                          }
        }

        enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this);
        enumModule.defineAnnotatedMethods(RubyEnum.class);
        return enumModule;
    }

    private EnumDescriptor descriptor;

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 165

                      }

        enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this);
        enumModule.defineAnnotatedMethods(RubyEnum.class);
        return enumModule;
    }

    private EnumDescriptor descriptor;
    private EnumDescriptorProto.Builder builder;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 169

                      return enumModule;
    }

    private EnumDescriptor descriptor;
    private EnumDescriptorProto.Builder builder;
    private IRubyObject name;
    private RubyModule module;
}

            

Reported by PMD.

java/core/src/test/java/com/google/protobuf/TestSchemas.java
15 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 43

              import com.google.protobuf.testing.Proto3Testing.Proto3MessageWithMaps;

/** Schemas to support testing. */
public class TestSchemas {
  public static final Schema<Proto2Message> genericProto2Schema =
      new ManifestSchemaFactory().createSchema(Proto2Message.class);
  public static final Schema<Proto3Message> genericProto3Schema =
      new ManifestSchemaFactory().createSchema(Proto3Message.class);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 60

                private static void registerProto2Schemas() {
    Protobuf protobuf = Protobuf.getInstance();
    ManifestSchemaFactory factory = new ManifestSchemaFactory();
    protobuf.registerSchemaOverride(Proto2Message.class, factory.createSchema(Proto2Message.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroup49.class, factory.createSchema(Proto2Message.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroupList51.class,
        factory.createSchema(Proto2Message.FieldGroupList51.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 61

                  Protobuf protobuf = Protobuf.getInstance();
    ManifestSchemaFactory factory = new ManifestSchemaFactory();
    protobuf.registerSchemaOverride(Proto2Message.class, factory.createSchema(Proto2Message.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroup49.class, factory.createSchema(Proto2Message.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroupList51.class,
        factory.createSchema(Proto2Message.FieldGroupList51.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 63

                  protobuf.registerSchemaOverride(Proto2Message.class, factory.createSchema(Proto2Message.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroup49.class, factory.createSchema(Proto2Message.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroupList51.class,
        factory.createSchema(Proto2Message.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroup69.class, factory.createSchema(Proto2Message.FieldGroup69.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 66

                  protobuf.registerSchemaOverride(
        Proto2Message.FieldGroupList51.class,
        factory.createSchema(Proto2Message.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroup69.class, factory.createSchema(Proto2Message.FieldGroup69.class));
    protobuf.registerSchemaOverride(
        Proto2Message.RequiredNestedMessage.class,
        factory.createSchema(Proto2Message.RequiredNestedMessage.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 68

                      factory.createSchema(Proto2Message.FieldGroupList51.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldGroup69.class, factory.createSchema(Proto2Message.FieldGroup69.class));
    protobuf.registerSchemaOverride(
        Proto2Message.RequiredNestedMessage.class,
        factory.createSchema(Proto2Message.RequiredNestedMessage.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldRequiredGroup88.class,
        factory.createSchema(Proto2Message.FieldRequiredGroup88.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 71

                  protobuf.registerSchemaOverride(
        Proto2Message.RequiredNestedMessage.class,
        factory.createSchema(Proto2Message.RequiredNestedMessage.class));
    protobuf.registerSchemaOverride(
        Proto2Message.FieldRequiredGroup88.class,
        factory.createSchema(Proto2Message.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(Proto2Empty.class, factory.createSchema(Proto2Empty.class));
    protobuf.registerSchemaOverride(
        Proto2MessageWithExtensions.class, factory.createSchema(Proto2MessageWithExtensions.class));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 74

                  protobuf.registerSchemaOverride(
        Proto2Message.FieldRequiredGroup88.class,
        factory.createSchema(Proto2Message.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(Proto2Empty.class, factory.createSchema(Proto2Empty.class));
    protobuf.registerSchemaOverride(
        Proto2MessageWithExtensions.class, factory.createSchema(Proto2MessageWithExtensions.class));
    protobuf.registerSchemaOverride(
        Proto2Testing.FieldGroup49.class, factory.createSchema(Proto2Testing.FieldGroup49.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 75

                      Proto2Message.FieldRequiredGroup88.class,
        factory.createSchema(Proto2Message.FieldRequiredGroup88.class));
    protobuf.registerSchemaOverride(Proto2Empty.class, factory.createSchema(Proto2Empty.class));
    protobuf.registerSchemaOverride(
        Proto2MessageWithExtensions.class, factory.createSchema(Proto2MessageWithExtensions.class));
    protobuf.registerSchemaOverride(
        Proto2Testing.FieldGroup49.class, factory.createSchema(Proto2Testing.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2Testing.FieldGroupList51.class,

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 77

                  protobuf.registerSchemaOverride(Proto2Empty.class, factory.createSchema(Proto2Empty.class));
    protobuf.registerSchemaOverride(
        Proto2MessageWithExtensions.class, factory.createSchema(Proto2MessageWithExtensions.class));
    protobuf.registerSchemaOverride(
        Proto2Testing.FieldGroup49.class, factory.createSchema(Proto2Testing.FieldGroup49.class));
    protobuf.registerSchemaOverride(
        Proto2Testing.FieldGroupList51.class,
        factory.createSchema(Proto2Testing.FieldGroupList51.class));
    protobuf.registerSchemaOverride(

            

Reported by PMD.

java/core/src/main/java/com/google/protobuf/AbstractParser.java
15 issues
Possible God Class (WMC=48, ATFD=8, TCC=22.222%)
Design

Line: 48

               *
 * @author liujisi@google.com (Pherl Liu)
 */
public abstract class AbstractParser<MessageType extends MessageLite>
    implements Parser<MessageType> {
  /** Creates an UninitializedMessageException for MessageType. */
  private UninitializedMessageException newUninitializedMessageException(MessageType message) {
    if (message instanceof AbstractMessageLite) {
      return ((AbstractMessageLite) message).newUninitializedMessageException();

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 49

               * @author liujisi@google.com (Pherl Liu)
 */
public abstract class AbstractParser<MessageType extends MessageLite>
    implements Parser<MessageType> {
  /** Creates an UninitializedMessageException for MessageType. */
  private UninitializedMessageException newUninitializedMessageException(MessageType message) {
    if (message instanceof AbstractMessageLite) {
      return ((AbstractMessageLite) message).newUninitializedMessageException();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

                private MessageType checkMessageInitialized(MessageType message)
      throws InvalidProtocolBufferException {
    if (message != null && !message.isInitialized()) {
      throw newUninitializedMessageException(message)
          .asInvalidProtocolBufferException()
          .setUnfinishedMessage(message);
    }
    return message;
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

                private MessageType checkMessageInitialized(MessageType message)
      throws InvalidProtocolBufferException {
    if (message != null && !message.isInitialized()) {
      throw newUninitializedMessageException(message)
          .asInvalidProtocolBufferException()
          .setUnfinishedMessage(message);
    }
    return message;
  }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 102

                    CodedInputStream input = data.newCodedInput();
      message = parsePartialFrom(input, extensionRegistry);
      try {
        input.checkLastTagWas(0);
      } catch (InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(message);
      }
      return message;
    } catch (InvalidProtocolBufferException e) {

            

Reported by PMD.

New exception is thrown in catch block, original stack trace may be lost
Design

Line: 104

                    try {
        input.checkLastTagWas(0);
      } catch (InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(message);
      }
      return message;
    } catch (InvalidProtocolBufferException e) {
      throw e;
    }

            

Reported by PMD.

A catch statement that catches an exception only to rethrow it should be avoided.
Design

Line: 107

                      throw e.setUnfinishedMessage(message);
      }
      return message;
    } catch (InvalidProtocolBufferException e) {
      throw e;
    }
  }

  @Override

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 136

                    CodedInputStream input = CodedInputStream.newInstance(data);
      message = parsePartialFrom(input, extensionRegistry);
      try {
        input.checkLastTagWas(0);
      } catch (InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(message);
      }
    } catch (InvalidProtocolBufferException e) {
      throw e;

            

Reported by PMD.

New exception is thrown in catch block, original stack trace may be lost
Design

Line: 138

                    try {
        input.checkLastTagWas(0);
      } catch (InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(message);
      }
    } catch (InvalidProtocolBufferException e) {
      throw e;
    }


            

Reported by PMD.

A catch statement that catches an exception only to rethrow it should be avoided.
Design

Line: 140

                    } catch (InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(message);
      }
    } catch (InvalidProtocolBufferException e) {
      throw e;
    }

    return checkMessageInitialized(message);
  }

            

Reported by PMD.

java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java
15 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 45

              /** Test field deprecation. */
@RunWith(JUnit4.class)
public class DeprecatedFieldTest {
  private final String[] deprecatedGetterNames = {"hasDeprecatedInt32", "getDeprecatedInt32"};

  private final String[] deprecatedBuilderGetterNames = {
    "hasDeprecatedInt32", "getDeprecatedInt32", "clearDeprecatedInt32"
  };


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 47

              public class DeprecatedFieldTest {
  private final String[] deprecatedGetterNames = {"hasDeprecatedInt32", "getDeprecatedInt32"};

  private final String[] deprecatedBuilderGetterNames = {
    "hasDeprecatedInt32", "getDeprecatedInt32", "clearDeprecatedInt32"
  };

  private final String[] deprecatedBuilderSetterNames = {"setDeprecatedInt32"};


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 51

                  "hasDeprecatedInt32", "getDeprecatedInt32", "clearDeprecatedInt32"
  };

  private final String[] deprecatedBuilderSetterNames = {"setDeprecatedInt32"};

  @Test
  public void testDeprecatedField() throws Exception {
    Class<?> deprecatedFields = TestDeprecatedFields.class;
    Class<?> deprecatedFieldsBuilder = TestDeprecatedFields.Builder.class;

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 54

                private final String[] deprecatedBuilderSetterNames = {"setDeprecatedInt32"};

  @Test
  public void testDeprecatedField() throws Exception {
    Class<?> deprecatedFields = TestDeprecatedFields.class;
    Class<?> deprecatedFieldsBuilder = TestDeprecatedFields.Builder.class;
    for (String name : deprecatedGetterNames) {
      Method method = deprecatedFields.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 59

                  Class<?> deprecatedFieldsBuilder = TestDeprecatedFields.Builder.class;
    for (String name : deprecatedGetterNames) {
      Method method = deprecatedFields.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }
    for (String name : deprecatedBuilderGetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 59

                  Class<?> deprecatedFieldsBuilder = TestDeprecatedFields.Builder.class;
    for (String name : deprecatedGetterNames) {
      Method method = deprecatedFields.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }
    for (String name : deprecatedBuilderGetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 63

                  }
    for (String name : deprecatedBuilderGetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }
    for (String name : deprecatedBuilderSetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name, int.class);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 63

                  }
    for (String name : deprecatedBuilderGetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }
    for (String name : deprecatedBuilderSetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name, int.class);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

                  }
    for (String name : deprecatedBuilderSetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name, int.class);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }
  }

  @Test
  public void testDeprecatedFieldInOneof() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

                  }
    for (String name : deprecatedBuilderSetterNames) {
      Method method = deprecatedFieldsBuilder.getMethod(name, int.class);
      assertWithMessage("Method %s should be deprecated", name).that(isDeprecated(method)).isTrue();
    }
  }

  @Test
  public void testDeprecatedFieldInOneof() throws Exception {

            

Reported by PMD.