@@ -117,7 +117,6 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
117117 }
118118
119119 private boolean isRelevantClass (J .ClassDeclaration classDeclaration ) {
120- List <J .Annotation > allAnnotations = classDeclaration .getAllAnnotations ();
121120 return classDeclaration .getType () != null &&
122121 J .ClassDeclaration .Kind .Type .Record != classDeclaration .getKind () &&
123122 hasMatchingAnnotations (classDeclaration ) &&
@@ -231,6 +230,7 @@ private static class LombokValueToRecordVisitor extends JavaIsoVisitor<Execution
231230 private static final String TO_STRING_MEMBER_LINE_PATTERN = "\" %s=\" + %s +" ;
232231 private static final String TO_STRING_MEMBER_DELIMITER = "\" , \" +\n " ;
233232 private static final String STANDARD_GETTER_PREFIX = "get" ;
233+ private static final String BOOLEAN_GETTER_PREFIX = "is" ;
234234
235235 private final @ Nullable Boolean useExactToString ;
236236 private final Map <String , Set <String >> recordTypeToMembers ;
@@ -249,10 +249,9 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
249249 }
250250
251251 J .Identifier methodName = methodInvocation .getName ();
252- return methodInvocation
253- .withName (methodName
254- .withSimpleName (getterMethodNameToFluentMethodName (methodName .getSimpleName ()))
255- );
252+ return methodInvocation .withName (
253+ methodName .withSimpleName (
254+ getterMethodNameToFluentMethodName (methodName .getSimpleName ())));
256255 }
257256
258257 @ Override
@@ -264,18 +263,19 @@ public J.MemberReference visitMemberReference(J.MemberReference memberRef, Execu
264263 String classFqn = ((JavaType .Class ) containing .getType ()).getFullyQualifiedName ();
265264 J .Identifier reference = memberReference .getReference ();
266265 String methodName = reference .getSimpleName ();
267- String newSimpleName = getterMethodNameToFluentMethodName (methodName );
268- if (recordTypeToMembers .containsKey (classFqn ) &&
269- methodName .startsWith (STANDARD_GETTER_PREFIX ) &&
270- recordTypeToMembers .get (classFqn ).contains (newSimpleName )) {
271266
272- JavaType .Method methodType = memberReference .getMethodType ();
273- if (methodType != null ) {
274- methodType = methodType .withName (newSimpleName );
267+ if (recordTypeToMembers .containsKey (classFqn ) &&
268+ (methodName .startsWith (STANDARD_GETTER_PREFIX ) || methodName .startsWith (BOOLEAN_GETTER_PREFIX ))) {
269+ String newSimpleName = getterMethodNameToFluentMethodName (methodName );
270+ if (recordTypeToMembers .get (classFqn ).contains (newSimpleName )) {
271+ JavaType .Method methodType = memberReference .getMethodType ();
272+ if (methodType != null ) {
273+ methodType = methodType .withName (newSimpleName );
274+ }
275+ return memberReference
276+ .withReference (reference .withSimpleName (newSimpleName ))
277+ .withMethodType (methodType );
275278 }
276- return memberReference
277- .withReference (reference .withSimpleName (newSimpleName ))
278- .withMethodType (methodType );
279279 }
280280 }
281281 return memberReference ;
@@ -296,8 +296,9 @@ private boolean isMethodInvocationOnRecordTypeClassMember(J.MethodInvocation met
296296 String classFqn = classType .getFullyQualifiedName ();
297297
298298 return recordTypeToMembers .containsKey (classFqn ) &&
299- methodName .startsWith (STANDARD_GETTER_PREFIX ) &&
300- recordTypeToMembers .get (classFqn ).contains (getterMethodNameToFluentMethodName (methodName ));
299+ (methodName .startsWith (STANDARD_GETTER_PREFIX ) || methodName .startsWith (BOOLEAN_GETTER_PREFIX )) &&
300+ recordTypeToMembers .get (classFqn ).contains (getterMethodNameToFluentMethodName (methodName ));
301+
301302 }
302303
303304 private static boolean isClassExpression (@ Nullable Expression expression ) {
@@ -306,7 +307,7 @@ private static boolean isClassExpression(@Nullable Expression expression) {
306307
307308 private static String getterMethodNameToFluentMethodName (String methodName ) {
308309 StringBuilder fluentMethodName = new StringBuilder (
309- methodName .replace ( STANDARD_GETTER_PREFIX , "" ));
310+ methodName .replaceFirst ( "^(get|is)" , "" ));
310311
311312 if (fluentMethodName .length () == 0 ) {
312313 return "" ;
0 commit comments