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

Source... actions insert code templates in wrong place #124

Closed
lombokissues opened this issue Jul 14, 2015 · 7 comments
Closed

Source... actions insert code templates in wrong place #124

lombokissues opened this issue Jul 14, 2015 · 7 comments
Assignees

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 51)

@lombokissues
Copy link
Author

👤 mccallum.michael   🕗 Sep 18, 2009 at 03:34 UTC

What steps will reproduce the problem?

  1. Add new method to interface
  2. Eclipse prompts for quick fix on an implementor
  3. Choose add unimplemented methods

What is the expected output? What do you see instead?
Expect to see the new stub method appear at the end of the class or
somewhere reasonable.

The code appears directly after the first lombok annotation, before any
parameters...

e.g.

@ Getter
public void methodstub() {
}
private int fieldThatWasAnnotated;

What version of the product are you using? On what operating system?
lombok 0.8.5
eclipse 3.4.2
java 6.0.14
windows xp

Please provide any additional information below.
The effect is the same if a Data or other annotation is at the class level.

Issue #98 alluded to this at the end

@lombokissues
Copy link
Author

👤 mccallum.michael   🕗 Sep 18, 2009 at 11:49 UTC

There are two solutions...

  1. change the declarationSourceStart and end to match the largest of any method as
    its added to the end of the list of methods and the template insertion defaults to
    after the last method defined in the type (irregardless of its specified position)
  2. or add as the not the first or last method in the list

I have a patch for the first as the second has complications what to do if you have
only generated methods, i guess the same field approach i've used for 1.

@lombokissues
Copy link
Author

👤 mccallum.michael   🕗 Sep 18, 2009 at 11:49 UTC

🔗 source-template-insertion.patch View file

@lombokissues
Copy link
Author

👤 reinierz   🕗 Sep 21, 2009 at 01:25 UTC

We thought of that fix and rejected it, as it would mean that 'jump to declaration', as well as errors and
warnings related to generated code, would go to/highlight entirely the wrong thing. We'd be fixing this issue
but opening the door for others.

We need eclipse's understanding of position to be one thing some time, and another thing at other times.
There's no quick way out of this - we need to fix eclipse itself and give it a basic notion of generated code.
This will most likely involve more patching work, though the proof of concept fix of the code formatter (
2547ee7 ) may give us a quick way out of this: If we don't generate
anything when the parser is run to determine insertion points, things may work itself out.

@lombokissues lombokissues added the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

👤 askoning   🕗 Aug 23, 2011 at 18:53 UTC

This seems to be working in 0.10 RC3; all methods are generated at the place I expect them to be.

Only minor detail I see is that there isn't always an empty line added. In a class with @ Getter/@ Setter annotations present, the unimplemented method is placed one newline below the last method, whereas in a class annotated with @ Data, the method is placed directly below the last method, without newline in between.

@lombokissues
Copy link
Author

👤 reinierz   🕗 Nov 28, 2011 at 18:51 UTC

That last issue has now been addressed too. This edge release contains the fixes:

https://projectlombok.org/download-edge.html

@lombokissues lombokissues removed the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

End of migration

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

No branches or pull requests

2 participants