Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow whitespaces before and after java expression #164

Conversation

hduelme
Copy link
Contributor

@hduelme hduelme commented Dec 9, 2023

mapstruct allows whitespaces before and after the java( ) block. Currently the plugin does not support this.
I changed the JavaExpressionInjector to allow whitespaces before and after the java( ) block. In addition I added an inspection to check if there are unnecessary whitespaces. If one or more is found before or after the java( ) block, I added two quick fixes to remove allwhitespaces before or after the java( ) block.

Copy link
Contributor

@thunderhook thunderhook left a comment

Choose a reason for hiding this comment

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

Looks good! 👍
Just some naming nitpicks to be more consistent and provide a better usability in the IntelliJ settings dialog.

src/main/resources/META-INF/plugin.xml Outdated Show resolved Hide resolved
src/main/resources/META-INF/plugin.xml Outdated Show resolved Hide resolved
@hduelme
Copy link
Contributor Author

hduelme commented Dec 10, 2023

@thunderhook thanks for the feedback. I change the names like you suggested. In addition the properties file is now used to provide the warning message instead of defining it directly inside the java code.

@thunderhook thunderhook merged commit 9cb04f3 into mapstruct:main Dec 10, 2023
6 of 7 checks passed
@@ -49,7 +49,7 @@
*/
public class JavaExpressionInjector implements MultiHostInjector {

private static final Pattern JAVA_EXPRESSION = Pattern.compile( "\"java\\(.*\\)\"" );
public static final Pattern JAVA_EXPRESSION = Pattern.compile( "\" *java\\(.*\\) *\"" );
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. The current implementation is missing the Pattern.DOTALL and does not match all whitespace characters.

@filiphr filiphr added this to the 1.7.0 milestone Apr 28, 2024
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.

3 participants