Eclipse assign parameter not in class body #295

Closed
lombokissues opened this Issue Jul 14, 2015 · 9 comments

Projects

None yet

1 participant

@lombokissues
Collaborator

Migrated from Google Code (issue 222)

@lombokissues
Collaborator

๐Ÿ‘ค middelkoop ย  ๐Ÿ•— Jun 21, 2011 at 11:25 UTC

What steps will reproduce the problem?

  1. Eclipse: create a class and annotate it with @ Data or @ Slf4j.
  2. Add a constructor with a parameter
  3. Use "Assign parameter to new field"

What is the expected output? What do you see instead?
The new field is created above the class declaration.

What version of the product are you using? On what operating system?
0.10.0-RC1, Windows XP, Eclipse Helios SR 2

Please provide any additional information below.
I didn't test other annotations, but I guess the problem exist there also. Maybe similar to Issue #228.

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Jun 21, 2011 at 14:15 UTC

A proper fix (vs the patchwork solution we applied for 155) for all these errors is rather complicated and involves tracking 2 positions for any given generated lombok node - where the code would have appeared if you typed it by hand, and the source annotation that caused it to be generated in the first place.

Then, we should patch 'jump to declaration' and friends to use the generating node, but set the position on the node itself to where it would have appeared. Right now we don't do this, so if we fix this, then 'go to declaration' would be broken and vice versa.

@lombokissues
Collaborator

๐Ÿ‘ค Jappe.vanderHel ย  ๐Ÿ•— Nov 29, 2011 at 19:32 UTC

Can't reproduce this problem in the current edge release

@lombokissues
Collaborator

๐Ÿ‘ค middelkoop ย  ๐Ÿ•— Nov 30, 2011 at 08:41 UTC

I still can reproduce this with Eclipse Indigo SR 1 and Lombok 0.10.4.

Create this class:

@ Data
public class Test {

public Test(List<String> parameter1) {

}

}

Right-click on parameter1 and choose "Assign paramter to new field". The field is created above the @ Data annotation which is incorrect.

@lombokissues
Collaborator

๐Ÿ‘ค Jappe.vanderHel ย  ๐Ÿ•— Dec 01, 2011 at 07:42 UTC

Sorry, I should have provided the download link to clarify which edge-release I meant. https://projectlombok.org/download-edge.html

However I do see that the parameter has a generic type, maybe that causes the problem.

I'm working with Eclipse Indigo SR 1 as well.

@lombokissues
Collaborator

๐Ÿ‘ค Jappe.vanderHel ย  ๐Ÿ•— Dec 01, 2011 at 19:57 UTC

Tried your example with lombok 0.10.5 2011-11-28 18:49 UTC on Eclipse Indigo SP1, and it works for me. It should be fixed by the same bugfix that fixed Issue #124

@lombokissues
Collaborator

๐Ÿ‘ค r.spilker ย  ๐Ÿ•— Dec 19, 2011 at 20:31 UTC

Fixed in de1bc35. Will be present in 0.10.6.

@lombokissues lombokissues removed the accepted label Jul 14, 2015
@lombokissues
Collaborator

๐Ÿ‘ค r.spilker ย  ๐Ÿ•— Dec 19, 2011 at 22:04 UTC

@lombokissues lombokissues added this to the 0.10.6 milestone Jul 14, 2015
@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment