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

Apply spotless to groovy #12147

Closed
wants to merge 1 commit into from
Closed

Apply spotless to groovy #12147

wants to merge 1 commit into from

Conversation

heyams
Copy link
Contributor

@heyams heyams commented Aug 30, 2024

Try to fix #12143

@heyams
Copy link
Contributor Author

heyams commented Aug 30, 2024

Step 'eclipse groovy formatter' found problem in 'src\test\groovy\io\opentelemetry\smoketest\AppServerTest.groovy':
Multiple problems detected during step execution:
Snippet4e0e929340b5448790023a3e8b406651.groovy: 57: unexpected token: abstract @ line 57, column 15.
         !helper.abstract
                 ^
Snippet4e0e929340b5448790023a3e8b406651.groovy: 57: expecting '}', found 'abstract' @ line 57, column 15.
         !helper.abstract
                 ^
Snippet4e0e929340b5448790023a3e8b406651.groovy: 57: expecting '}', found 'abstract' @ line 57, column 15.
         !helper.abstract

anyone knows Snippet4e0e929340b5448790023a3e8b406651.groovy?

@laurit
Copy link
Contributor

laurit commented Sep 5, 2024

The error reporting is a bit confusing. Anyway this should be

I guess abstract is treated as a reserved word? Seems to go away when all occurrences of abstract in this file are replaced with isAbstract(). Unfortunately this isn't the only issue, there is also .flatMap(log -> log.getResourceLogsList().stream()) that seems to go away when replaced with .flatMap { log -> log.getResourceLogsList().stream() }. Next there is java.lang.NullPointerException: Cannot invoke "org.codehaus.groovy.ast.ASTNode.getEnd()" because "nestedNode" is null that will take more effort to figure out what exactly causes it (I'd try commenting out parts of the offending file to isolate the problematic construct).
If you are going to proceed with this please see if you can change the formatting settings to 2 space indent, hopefully that way less code will need to be completely reformatted.

@heyams
Copy link
Contributor Author

heyams commented Sep 17, 2024

The error reporting is a bit confusing. Anyway this should be

I guess abstract is treated as a reserved word? Seems to go away when all occurrences of abstract in this file are replaced with isAbstract(). Unfortunately this isn't the only issue, there is also .flatMap(log -> log.getResourceLogsList().stream()) that seems to go away when replaced with .flatMap { log -> log.getResourceLogsList().stream() }. Next there is java.lang.NullPointerException: Cannot invoke "org.codehaus.groovy.ast.ASTNode.getEnd()" because "nestedNode" is null that will take more effort to figure out what exactly causes it (I'd try commenting out parts of the offending file to isolate the problematic construct).
If you are going to proceed with this please see if you can change the formatting settings to 2 space indent, hopefully that way less code will need to be completely reformatted.

Thank you for looking into it. yes, there are more issues than what I expected. i will try to help convert as many groovy classes as possible to java so that we don't need to deal with groovy anymore :)

I'm going to close this PR.

@heyams heyams closed this Sep 17, 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.

Spotless should have taken care of groovy source code
2 participants