Skip to content

Commit

Permalink
Add Guice extensions to cirvlist.
Browse files Browse the repository at this point in the history
Also update `Api#parse()` to accept class names with `-` in them.

PiperOrigin-RevId: 496717232
  • Loading branch information
chaoren authored and Error Prone Team committed Dec 20, 2022
1 parent 2a82a27 commit b4e8d5b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ String owningType() {
case '.':
// OK, separator
break;
case '-':
// OK, used in Kotlin JvmName to prevent Java users.
break;
default:
checkArgument(
isJavaIdentifierPart(next),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,16 @@ public void parseApi_methodWithVarargs_b231250004() {
assertThat(api.isConstructor()).isTrue();
assertThat(api.toString()).isEqualTo(string);
}

@Test
public void parseApi_kotlinClassWithJvmName() {
String string = "com.google.inject.-GuiceExtensions#bind(com.google.inject.AbstractModule)";
Api api = Api.parse(string);

assertThat(api.className()).isEqualTo("com.google.inject.-GuiceExtensions");
assertThat(api.methodName()).isEqualTo("bind");
assertThat(api.parameterTypes()).containsExactly("com.google.inject.AbstractModule");
assertThat(api.isConstructor()).isFalse();
assertThat(api.toString()).isEqualTo(string);
}
}

0 comments on commit b4e8d5b

Please sign in to comment.