Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit75dcd53

Browse files
graememorganError Prone Team
authored and
Error Prone Team
committed
Fix the Optional wrapping in the description of NonCanonicalStaticMemberImport.
PiperOrigin-RevId: 835159948
1 parent10f5424 commit75dcd53

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎core/src/main/java/com/google/errorprone/bugpatterns/NonCanonicalStaticMemberImport.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public Description matchImport(ImportTree tree, VisitorState state) {
4848
.setMessage(
4949
String.format(
5050
"Static import of '%s' uses non-canonical name; prefer '%s'",
51-
importInfo.simpleName(),importInfo.canonicalName()))
51+
importInfo.simpleName().get(),importInfo.canonicalName()))
5252
.build();
5353
}
5454
}

‎core/src/test/java/com/google/errorprone/bugpatterns/NonCanonicalStaticMemberImportTest.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class A {
3939
public static final int foo() {
4040
return 42;
4141
}
42+
43+
public static final int bar() {
44+
return 42;
45+
}
4246
}
4347
""")
4448
.addSourceLines(
@@ -57,6 +61,8 @@ public class B extends A {}
5761
5862
// BUG: Diagnostic contains: import static a.A.foo;
5963
import static b.B.foo;
64+
// BUG: Diagnostic contains: of 'bar'
65+
import static b.B.bar;
6066
6167
class Test {}
6268
""")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp