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

'val' should not be legal in basic for loops. #419

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

'val' should not be legal in basic for loops. #419

lombokissues opened this issue Jul 14, 2015 · 6 comments
Milestone

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 346)

@lombokissues
Copy link
Author

👤 reinierz   🕗 Feb 14, 2012 at 01:37 UTC

This actually works and is really cool:

for (val x = 5, y = ""; ; ) {
}

Unfortunately, while it's cool that that works, we CANNOT delombok it. Practically speaking having final variables declared inside a basic for loop's line has no real use cases, either.

The easiest solution is to just disallow use of 'val' here. We won't, of course, mess with using 'val' in foreach loops!

NB: We should also test how delombok treats:

val x = 5, y = "";

as a variable declaration. Correct treatment is allowing it and splitting it into two var decls which I'm fairly sure will happen, but, we should add a test.

@lombokissues
Copy link
Author

👤 reinierz   🕗 Feb 14, 2012 at 01:37 UTC

NB: Someone sent me a message about this (twitter, google+, google groups? I can't remember). Anyway, all credit to him for figuring this one out :)

@lombokissues
Copy link
Author

👤 reinierz   🕗 Feb 15, 2012 at 03:36 UTC

Fixed; will be in whatever's after 0.10.8.

@lombokissues lombokissues added this to the 0.10.9 milestone Jul 14, 2015
@lombokissues
Copy link
Author

👤 askoning   🕗 Mar 02, 2012 at 19:37 UTC

@lombokissues
Copy link
Author

👤 enrique.dacostacambio   🕗 Mar 17, 2015 at 06:55 UTC

Would it make sense to enforce that all variables are of the same type? By explicitly checking the types of the expressions or by using the type of the expression if the first variable?

@lombokissues
Copy link
Author

End of migration

lianhaijun pushed a commit to lianhaijun/lombok that referenced this issue May 8, 2020
fixed projectlombok#419
migrated existing delagate inspection tests to new format, adding new
updated change.log
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

1 participant