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

Mockito WHEN Bug in Eclipse formatting jdt core 3.32.0 and 3.33.0 #712

Closed
hazendaz opened this issue Mar 17, 2023 · 3 comments
Closed

Mockito WHEN Bug in Eclipse formatting jdt core 3.32.0 and 3.33.0 #712

hazendaz opened this issue Mar 17, 2023 · 3 comments
Assignees
Labels

Comments

@hazendaz
Copy link
Member

hazendaz commented Mar 17, 2023

Expect some vague stuff here. Spent hours looking at this and while I'm probably onto something this would likely go entirely unnoticed by many.

Not sure if edge case or what yet. Basically 3.31.0 with this plugin at latest main works fine in tabs to spaces. But setting it to 3.32.0 or 3.33.0 partially does but doesn't touch some tabs and simply commenting calls out can make it work. Not seeing why exactly but wanted to document this. The issue is present in Eclipse itself so not this plugin. Technically we could fix by supporting tabs to spaces and size of the spacing directly but prefer eclipse work...

What I can confirm is that 3.31.0 came from this commit c629d6bbecf94f42dbc352301f30a47d6578c4e9 and our direct support was 2.21.0 which works fine.

Can find that here in full history https://github.com/eclipse-jdt/eclipse.jdt.core/commits/master?after=b1c0332929b1dbf651f62c7792a6d16d4137e768+139&branch=master&qualified_name=refs%2Fheads%2Fmaster.

Believe issue is from this eclipse-jdt/eclipse.jdt.core@ebc978e

The example I can cause this with is mockito 'when'. But some work without issue. I can add junk on front of the 'when' such as 'junkwhen' or even comment it out then it formats both by our plugin and eclipse. I don't really understand yet why some work and others do not.

@hazendaz hazendaz added the bug label Mar 17, 2023
@hazendaz hazendaz self-assigned this Mar 17, 2023
@hazendaz hazendaz changed the title Bug in Eclipse formatting jdt core 3.32.0 and 3.33.0 Tabs to spaces: Bug in Eclipse formatting jdt core 3.32.0 and 3.33.0 Mar 17, 2023
@hazendaz
Copy link
Member Author

The issue is due to usage of static import on mockito 'when'. The "Handle 'when' clause in switch pattern expressions" eclipse-jdt/eclipse.jdt.core@ebc978e that I noted earlier is the issue. I do not know if they fixed it but any fix requires we move to jdk 17. So it would be best to drop back actually.

@hazendaz
Copy link
Member Author

Issue is already reported eclipse-jdt/eclipse.jdt.core#609

@hazendaz hazendaz changed the title Tabs to spaces: Bug in Eclipse formatting jdt core 3.32.0 and 3.33.0 Mockito WHEN Bug in Eclipse formatting jdt core 3.32.0 and 3.33.0 Oct 9, 2023
@hazendaz
Copy link
Member Author

hazendaz commented Mar 9, 2024

Closing as this was resolved.

@hazendaz hazendaz closed this as completed Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant