Comments (19)
π€ warchildwts Β π Aug 09, 2009 at 18:30 UTC
What steps will reproduce the problem?
- Setup a custom formatter in eclipse and set it to format on save
- Create a lombok based class and annotate it with @ Data
- Create another method (make sure that you make formatting errors the
formatter should fix. - Save the class
What is the expected output? What do you see instead?
The formatter should run.
Actually, the formatter will not run unless I remove the @ Data annotation.
What version of the product are you using? On what operating system?
Eclipse 3.5
Linux x86_64
java 6 (I think...)
Lombok 0.8.2
Please provide any additional information below.
from lombok.
π€ reinierz Β π Aug 10, 2009 at 18:17 UTC
Known problem that will be very hard to fix for the general case.
For your specific case: Check the eclipse error log (it's a view), find the exception that should be occuring
(that's why the save action isn't working - it's erroring out), and post it here in a comment. Also, if generated
methods are actually part of the problem (they contain code that the save action is trying to fix), then report
your save action and we'll consider fixing how lombok generates code.
Prime example: Someone else is currently working on a patch to add 'final' to all parameters in generated
methods. Once that patch is in, it'll be integrated into trunk and rolled out into a new version.
from lombok.
π€ warchildwts Β π Aug 13, 2009 at 02:27 UTC
I'm not getting any errors in the error log. Also, on save it isn't telling me that
something failed in the save actions. It just doesn't format the code. I've even
tried CTRL+SHIFT+F & bringing up the context menu and selecting source->format. As
long as I have @ Data added to the class, it never gives errors and it never formats.
from lombok.
π€ reinierz Β π Aug 13, 2009 at 02:43 UTC
Weird that you don't see any errors in the error log. We may at some point find a more general solution to this
problem, but don't hold your breath. It would be a vast eclipse hack effort, and would most likely make
lombok's eclipse integration very fragile. As it stands, we developed against eclipse 3.5 and lombok ran
without requiring any modifications in eclipse 3.4 as well, which is always good news (we're hacking around
with inner API, which the eclipse team can change at any time, hence the suspense!).
Eclipse hard-codes silent members (such as the default constructor), it's not a simple matter of a flag, so
we'd have to patch every single last place eclipse may inspect source and have problems with the erroneous
source positions on the generated nodes. That's why it's so much effort: We'd have to find every spot, and fix
it via a patch (and writing runtime patch code is extremely complicated as it requires writing directly in
bytecode and working within the stack frame of usually very long methods that are hard to read even in java
form!)
Fixing specific cases as they come up is sometimes possible, but without an error log, that's going to be
rather difficult.
This particular case (auto-format/format on save) is quite an important task, so we'll at the very least do
some research to see if it can be fixed in a reasonable timeframe. Of course, an auto-formatter is going to
ping every single node and is going to attempt to format them all. Hopefully we can hack the auto-formatter
itself to first toss all generated members out of the AST, format it, and on the automatic re-read, all
generated items will immediately show up again. That'd might actually be relatively simple.
Expect this research somewhere next month, Roel is on vacation and I'm very busy this month.
from lombok.
π€ karthik.abram Β π Aug 21, 2009 at 14:57 UTC
Please reconsider the priority of this issue. Adding any Lombok annotation causes
auto-formatting to stop. This is a major pain.
Also, related to this, if you do Source refactory: "Overring/Implement Method" and
choose a specific location, Eclipse ends up ignoring it and placing the method
between say @ Getter and the type declartion of the field that is Lombok annotated!
This will cause many to abandon Lombok and is a serious issue.
from lombok.
π€ mccallum.michael Β π Sep 18, 2009 at 11:52 UTC
Is it possible that method.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; stops eclipse from
attempting to format the source?
from lombok.
π€ framiere Β π Sep 19, 2009 at 19:32 UTC
I do very much agree with karthik.abram : the priority of this issue should be
reconsidered as "Project Lombok" breaks many eclipse refactoring functionalities.
Because of that even if "Project Lombok" provides great value I have no choice but to
go back to manual dull code.
I have read your source code, and looked at how you integrate with eclipse and
understand now the challenge of a "pure" integration.
But still, this issue will be for many user a simple no-go.
I think this issue should really not be overlooked, either in code (preferably), or
in documentation stating exactly what a user would miss from eclipse functionalities.
from lombok.
π€ reinierz Β π Sep 23, 2009 at 05:48 UTC
Priority has been reconsidered; it's what we're working right now. A big chunk of work (but this is only the
begininning!) has been done in 35691e8. Auto-formatting has already
been fixed (check out master and build your own lombok. It's very very easy; just grab sources and run ant!).
Fixing save actions, refactor scripts, and the actions available to you in the 'source' menu is next on the agenda.
from lombok.
π€ reinierz Β π Oct 16, 2009 at 08:47 UTC
Fixed in 310862d - should be out in v0.9
from lombok.
π€ reinierz Β π Oct 16, 2009 at 08:47 UTC
from lombok.
π€ zacharyshaw Β π Nov 24, 2009 at 20:16 UTC
I just built head (0.9.2) and the problem still exists.
from lombok.
π€ reinierz Β π Nov 24, 2009 at 22:49 UTC
save action still doesn't work, but cmd/ctrl+shift+F certainly does. Are you having problems with format-on-
save, or with auto-format in general? If the latter, please post the source that isn't being formatted, and check if
there are any errors in your error log (you can open that from the view menu), and attach it to this issue so we
can reproduce it.
On the topic of format-on-save, we'll try and figure this out, though for some reason eclipse is swallowing the
problem so we're going to have a heck of a time figuring out where format-on-save is failing.
from lombok.
π€ [email protected] Β π Nov 25, 2009 at 03:36 UTC
I can't format at all, I've verified this on 3 different machines. They all have a custom formatting template.
Attached are the error logs. lombok-formatting-error.txt is when I press cmd+shift+F. The other is from when I
try and open the java code formatting menu.
from lombok.
π€ [email protected] Β π Nov 25, 2009 at 03:36 UTC
π lombok-formatting-error.txt
from lombok.
π€ [email protected] Β π Nov 25, 2009 at 03:36 UTC
π opening-the-formatting-menu.txt
from lombok.
π€ reinierz Β π Nov 25, 2009 at 04:07 UTC
Ha! Funny story. I was using LinkedList.push which was added in java 1.6, and you are running your eclipse on
1.5.
Lombok is specifically compiled against (mostly) 1.5 just to ensure it does run on eclipse on JVM 1.5, so I'll
fix this pronto. I thought LinkedList has had push since, oh, java 1.4 or below. Huh. Learn something new
every day.
Fixed in lombok.patcher commit 587b904859dc3d0a8f83d3b4af69c1679cb90c0b and will be rolled out in
v0.9.2.
from lombok.
π€ [email protected] Β π Nov 25, 2009 at 16:01 UTC
Thanks for the quick patch! I built the master, and it's partially fixed. I can access the formatting menu. And
there are no more errors. But formatting silently fails for any class with the lombok annotations. There are no
errors in the error log. It just doesn't work.
from lombok.
π€ reinierz Β π Nov 26, 2009 at 07:47 UTC
Cripes. I'm in regression hell.
This was a regression. We fixed it, and then later we fixed regression bug οΉ68, which then broke this one for
the third time.
It took a while, but I managed to fix this. It's in commit 390cdcef1a5768d8219dd86b06cb0dad18d4adbf on
the lombok.patcher project.
Give it a try! format-as-save-action still doesn't work, that's a separate problem.
from lombok.
End of migration
from lombok.
Related Issues (20)
- [FEATURE] @FieldNameConstants Easier overwrite for generated fields HOT 2
- @FieldDefaults: Keep the global setting experimental, make the annotation permanent.
- [FEATURE] Allow to easily add interfaces to Builders
- [BUG] Support for Eclipse 2024-06 (4.32) HOT 11
- [FEATURE] Super Constructor
- [FEATURE] enhance @FieldNameConstants with specific prefix string HOT 2
- [BUG] SuperBuilder does not compile then binding generics to an array HOT 5
- [BUG] SaSessionForFastjsonCustomizedη±»δΈηgetModelζ₯ι HOT 1
- [FEATURE] setX() for mutable state, fluent otherwise HOT 2
- [BUG] Lombok 1.18.34 (Edit updated) not working with eclipse 24-06 HOT 3
- [QUESTION} How to build lombok using JDK21 (javac)
- Support for an entirely new constructor generation HOT 2
- [FEATURE] Support for use extension method within the same class it was declared in
- [@ToStringJSON, @ToStringJSONPretty] Please add feature when class have some others lombok JSON. For default actual mode of lombok ToString. HOT 1
- [BUG] Lombok with Java 21 Compilation failure with v1.18.32
- [BUG] Warning when using @StandardException with the -Xlint:this-escape compiler flag
- [BUG] Potential NPE in EclipseHandlerUtil.setDocComment(..)
- [BUG] @Delegate throwing null pointer exception on enums
- [BUG] `@Getter` with `AccessLevel` and `onMethod_` causes a compile error
- [BUG] `StringIndexOutOfBoundsException` in `EclipseHandlerUtil.getDocComment()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lombok.