Skip to content

Commit

Permalink
Support .class suffix with whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jevanlingen committed Jan 27, 2025
1 parent c82e5ee commit d36f408
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -871,9 +871,10 @@ public void visitClassExpression(ClassExpression clazz) {
name = clazz.getType().getNameWithoutPackage().replace('$', '.');
}
skip(name);
if (source.startsWith(".class", cursor)) {
name += ".class";
skip(".class");
if (sourceStartsWith(".class")) {
String classSuffix = source.substring(cursor, indexOfNextNonWhitespace(cursor, source)) + ".class";
name += classSuffix;
skip(classSuffix);
}
queue.add(TypeTree.build(name)
.withType(typeMapping.type(clazz.getType()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void useClassAsArgumentJavaStyle() {
rewriteRun(
groovy(
"""
foo(String.class)
foo(String .class)
"""
)
);
Expand Down

0 comments on commit d36f408

Please sign in to comment.