-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Working with lombok and eclipse cleanup fails: "A save participant caused problems." #879
Comments
maybe related to #374 ? |
Is this a Mars installation? Did you try the edge release: https://projectlombok.org/download-edge.html |
Hi roel, thx for the feedback. |
It would help if you can identify which cleanup action triggers this bug. Can you also provide the smallest possible java program to trigger this bug? |
In experimenting with it, the save action setting Format source code > Format edited lines toggles whether it happens. With it enabled, it won't happen if I add and remove a space, but it will happen if I add a new field to the class or even a new comment/new token. It does only happen if I have |
Same here. The Exception occured with all these versions when using the save action "Format source" |
👍 I'm on Eclipse Mars.1 with lombok 1.16.6. |
I just found out, that the exception only occurs if "Format edited lines" is selected. If "Format all lines" is selected, everything works find (both the lombok stuff and the code formatting). Nevertheless it is often definitely not wanted that all lines are formatted on save (unreadable svn-history, code changes hard to track, ...). |
@thisisthekap, great for fiddeling out what the issue is. We have Format all lines as default on all environments. |
Unfortunately I have to deal with legacy code that does not fit to the current formatter. So "Format all lines" is no real option for me. Another thing I found out: The issue persists even if I encapsulate the whole class in formatter deactivation comments. Edit: I am using Eclipse Mars SR1 with lombok 1.16.6 |
@thisisthekap, regarding legacy code, we had the same issue before we enforced the rules. We have done one bigger task But back to the issue. Do not get your point with "formatter deactivation comment"?!? Can you elaborate more? |
Our formatter uses comments like |
java.lang.reflect.InvocationTargetException |
👍 Eclipse Luna (4.4.2), STS (4.5.1), Lombok 1.16.6 |
For me it was the "Use parenthese in expressions" = "Always" that caused the problem. A save participant caused problems. |
are here any updates? The issue is pretty annoying so, how can I help to get a fix for it? |
issue is still there in eclipse neon with lombok 1.16.8 |
I'm not the developer, but I looked into the code a little bit and it looks like this will be a mess to fix. Essentially, the Eclipse developers changed the way that they do code formatting. The new method doesn't take into account that the code compiled doesn't match the code written. With lombok, however, that assertion is incorrect. I suspect that fixing it would require a decent overhaul of how lombok works with eclipse—probably a huge effort. Add to that eclipse doesn't provide a nice API to help the cause, the same scenario is likely to play out again at a random time in the future. There is a work-around: Uncheck Java > Editor > Save Actions > Perform the selected actions on save > Format Source |
Eclipse Neon (4.6.0) + Lombok 1.16.10 - the issue still persists. |
Eclipse Neon (4.6.2) + Lombok 1.16.12 - the issue still persists. |
Hi, I'm the main developer for Eclipse formatter and I just noticed this Lombok-formatter conflict is still unresolved. Maybe we can work something out together? I haven't investigated it yet, but from @stevetodd's comments I understand that the Lombok plugin replaces the Eclipse compiler so that it adds some extra AST nodes according to Lombok annotations used. So my first thought is that maybe the formatter can do something to indicate that it needs the original compiler behavior? The formatter creates a new instance of ASTParser every time it is invoked, so there there should be no risk of changing something in the core JDT functionality. Another approach would be that if Lombok could somehow mark the extra nodes, the formatter could recognize them and skip their processing. What are your thoughts? |
Eclipse Oxygen (4.7.1a) + Lombok 1.6.18 - the issue still persists. |
Oh, I only see this now... I think the best approach is to mark the nodes as generated. We already do this by setting on of the flag bits in the AST. But if necessary, we can also add other metadata. Lombok kicks in in the endParse of the ECJ parser. |
OK, I think I've got it. It looks like in
|
I'm also for creating a pull request. Even if it is just a 99% fix and some edge case isn't fix, it is a huge improvement. |
Eclipse: Oxygen.2 Release (4.7.2) Hi All, I have a pretty crazy requirement that includes many save actions (listed below) and with the patched .jar from above I see the following message on save 100% of the time: here are my save actions:
Hoping this might also get resolved as well, thanks! |
@thule-admin can you attach a full stack trace from the Error Logs view? |
Would be great to have this patch incorporated in the main branch and next release. It also resolved the problem for me. Thanks. |
Hi, I have the same problem with this Eclipse configuration: and this "Save actions" configuration:
Below, The two exceptions which come from logs view: HTH |
@Gabitchov Of course you have the same problem, you don't use the patched version from this thread :) |
@mateusz-matela Indeed, it's better with the patch :-). I had to fix some some compilation errors on Eclipse handler SetGeneratedByVisitor.java before get the fixed version. It's strange to have a tag(v1.6.20) which doesn't compile. Perhaps, I did something wrong with ant configuration. |
Guys, Issue is present in latest version on Version: Oxygen.1a Release (4.7.1a) Could you let me know please? |
@pduleba I merged all changes from the current lombok master and built a new agent containing @mateusz-matela's patch. As before: Just rename the Can anyone verify that it is still working with Java 9? If so, I will try to create a pull request at the weekend as it seems to resolve the issue for the majority of the users (or at least improve the situation for those with nasty ;) save-action configuration) |
@nuessgens Many thanks for patched version :) |
fixed via @nuessgens and @mateusz-matela 's work. |
Hello @rzwitserloot ... The release 1.16.21 will have this patch? |
It solved my issue! (Neon, Java 8) |
@mateusz-matela, I had put $50 as a bounty on this. Click here to claim it: If you don't, bountysource gets the $50 instead of you... |
I'm still having this issue with eclipse oxygen even with the latest lombok |
eclipse.buildId=4.9.0.I20180906-0745
|
When I change the the Code Style from "Always" to "Only if necessary" the issue seems to be 'fixed' |
Disclaimer: Not a Lombok team member here. @gsugambit I guess, this is slightly related to #1628. Every piece of generated source gets the same source start and end indexes. Eclipse sees a piece of code not corresponding to your formatting rules and tries to adapt it, e.g., change I guess, this (and all other save-actions problems) could be fixed somewhere in Eclipse, maybe in |
The newest version 1.18.6 has the same problem. |
having the same problem with Lombok 1.18.6 |
just updated STS 4,4,x to 4.5.x. Bug is appears again in the latest STS (STS 4.5.0) release: Using Eclipse Platform Version : 4.14.0.v20191210-0610 the "save action" "use this qualifier" is causing the bug. |
Save Actions - Additional Actions -> Member Accesses -> Non static access -> checked Eclipse: 4.14.0 |
guys, please don't add commentary to closed issues like this; there are a million-and-one reasons why you can get that error; you're getting the same error for a different issue. Better to file a new bug, with a specific report on how to reproduce (@sathomps did a reasonable job, but it would help a lot to also include some code to actually trigger it; save actions themselves don't trigger unless you're saving an editor where there's some code open that would trigger the issue). |
NB: Rawi just contributed an update which may or may not fix this; can you test with the latest edge release? It's available at https://projectlombok.org/download-edge (There is no changelog record because the patch didn't seem worth mentioning – the timestamp should be 27th of feb or later). |
I can confirm that this configuration is working Eclipse Version: 2019-12 (4.14) Build id: I20191210-0610 |
How about this problem? This configuration still failing :( |
I am using lombok 1.16.4.
I can narrow down the issue to lombok. As soon as I add @DaTa to the class to get the getters/setters generated by lombok my eclipse cleanup is failing with the error dialog:
And this is in the log everytime the error occurs:
This message is sometimes added in the log:
Hope someone can help to get rid of the annoying error.
The text was updated successfully, but these errors were encountered: