Skip to content

Conversation

@thmasker
Copy link

@thmasker thmasker commented Aug 10, 2025

The test fails. I need to somehow differentiate fluent getters from other methods without parameters and with return type that are not getters. Any idea is appreciated, as I haven't been able to find a way so far... for example, ImmutableItemDto#id matches also ImmutableItem.Builder#build

@thmasker
Copy link
Author

Closes #1601

Copy link
Member

@filiphr filiphr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the code I am not sure that this works @thmasker. I've approved the CI to run, so let's see. In any case, I think we need a better more granular support here

Comment on lines +28 to +32
private boolean isFluentGetter(ExecutableElement method) {
return method.getParameters().isEmpty() &&
method.getReturnType().getKind() != TypeKind.VOID &&
!JAVA_JAVAX_PACKAGE.matcher( method.getEnclosingElement().asType().toString() ).matches();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we should just make this like this. We should look at the Immutables @Styles, see https://immutables.github.io/style.html and determine based on that.

Otherwise, this just applies to everything.

Additionally, I really do not understand how this even works, the getElementName is not overridden, so I don't think that this works properly

Comment on lines +39 to +41
var item = ImmutableItemDto.builder().id( "test" ).build();

var target = ItemMapper.INSTANCE.map( item );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use var. We don't have a check for this, but I am not a fan of it and we are not using it anywhere else in our codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants