Coder Social home page Coder Social logo

Comments (19)

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ warchildwts Β  πŸ•— Aug 09, 2009 at 18:30 UTC

What steps will reproduce the problem?

  1. Setup a custom formatter in eclipse and set it to format on save
  2. Create a lombok based class and annotate it with @ Data
  3. Create another method (make sure that you make formatting errors the
    formatter should fix.
  4. 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ reinierz Β  πŸ•— Oct 16, 2009 at 08:47 UTC

Fixed in 310862d - should be out in v0.9

from lombok.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ reinierz Β  πŸ•— Oct 16, 2009 at 08:47 UTC

from lombok.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ zacharyshaw Β  πŸ•— Nov 24, 2009 at 20:16 UTC

I just built head (0.9.2) and the problem still exists.

from lombok.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ [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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ [email protected] Β  πŸ•— Nov 25, 2009 at 03:36 UTC

πŸ”— lombok-formatting-error.txt View file

from lombok.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ [email protected] Β  πŸ•— Nov 25, 2009 at 03:36 UTC

πŸ”— opening-the-formatting-menu.txt View file

from lombok.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ [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.

lombokissues avatar lombokissues commented on July 17, 2024

πŸ‘€ 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.

lombokissues avatar lombokissues commented on July 17, 2024

End of migration

from lombok.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.