diff --git a/error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrder.java b/error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrder.java index 9fd385aa1c..18e5afc6c0 100644 --- a/error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrder.java +++ b/error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrder.java @@ -113,6 +113,7 @@ private ImmutableList getAllTypeMembers( new AutoValue_TypeMemberOrder_TypeMember( member, treeStartPos, state.getEndPosition(member), e))); + /* XXX: Write explanation about this enum. */ currentStartPos = Math.max(currentStartPos, state.getEndPosition(member)); } return builder.build(); diff --git a/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderClassTest.java b/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderClassTest.java index f0ce4f97cf..4828bcee2d 100644 --- a/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderClassTest.java +++ b/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderClassTest.java @@ -96,7 +96,13 @@ void replacement() { .addInputLines( "A.java", "class A {", - " class Inner {}", + " class Inner {", + " int innerFoo() {", + " return 1;", + " }", + "", + " private final int innerBar = 2;", + " }", "", " int foo() {", " return foo;", diff --git a/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderEnumTest.java b/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderEnumTest.java index bfdbea270e..db60778373 100644 --- a/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderEnumTest.java +++ b/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/TypeMemberOrderEnumTest.java @@ -91,7 +91,8 @@ void replacement() { .addInputLines( "A.java", "enum A {", - " FOO;", + " FOO,", + " BAR;", "", " class InnerClass {}", "", @@ -112,13 +113,14 @@ void replacement() { " }", "", " final int baz = 2;", - " static final int BAR = 1;", + " static final int BAZ = 1;", "}") .addOutputLines( "A.java", "enum A {", - " FOO;", - " static final int BAR = 1;", + " FOO,", + " BAR;", + " static final int BAZ = 1;", "", " final int baz = 2;", "",