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

Invalid expansion of lombok.val for Map.Entry containing an inner class of a generic outer class #416

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

Comments

Projects
None yet
2 participants
@lombokissues
Collaborator

lombokissues commented Jul 14, 2015

Migrated from Google Code (issue 343)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

👤 jwnimmer@jaybridge.com   🕗 Feb 07, 2012 at 15:28 UTC

What steps will reproduce the problem?

  1. Use lombok.val to iterate over a map with a inner class of a generic outer;
    a sample file is inlined here:

package pkg;
import java.util.Map;
public class Thing<T> {
private final Map<String, Outer<T>.Inner> map = null;
private void loop() {
for (lombok.val entry : map.entrySet()) {}
}
}
class Outer<T> { class Inner {} }

What is the expected output? What do you see instead?

Eclipse and delombok both produce an invalid substitute type for val.
Delombok produces the for-loop as:

for (final java.util.Map.Entry<java.lang.String, pkg.Outer.Inner> entry :
map.entrySet()) { }

Eclipse says: Type mismatch: cannot convert from element type
Map.Entry<String,Outer<T>.Inner> to Map.Entry<String,Outer.Inner>

I expect second the Map.Entry generic parameters to show up as
pkg.Outer<T>.Inner, not pkg.Outer.Inner.

What version of the product are you using? On what operating system?
Eclipse SDK Version: 3.7.1 Build id: M20110909-1335
Lombok v0.10.8 "Burning Emu" is installed. https://projectlombok.org/
java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.10) (6b20-1.9.10-0ubuntu1~10.04.3)

Collaborator

lombokissues commented Jul 14, 2015

👤 jwnimmer@jaybridge.com   🕗 Feb 07, 2012 at 15:28 UTC

What steps will reproduce the problem?

  1. Use lombok.val to iterate over a map with a inner class of a generic outer;
    a sample file is inlined here:

package pkg;
import java.util.Map;
public class Thing<T> {
private final Map<String, Outer<T>.Inner> map = null;
private void loop() {
for (lombok.val entry : map.entrySet()) {}
}
}
class Outer<T> { class Inner {} }

What is the expected output? What do you see instead?

Eclipse and delombok both produce an invalid substitute type for val.
Delombok produces the for-loop as:

for (final java.util.Map.Entry<java.lang.String, pkg.Outer.Inner> entry :
map.entrySet()) { }

Eclipse says: Type mismatch: cannot convert from element type
Map.Entry<String,Outer<T>.Inner> to Map.Entry<String,Outer.Inner>

I expect second the Map.Entry generic parameters to show up as
pkg.Outer<T>.Inner, not pkg.Outer.Inner.

What version of the product are you using? On what operating system?
Eclipse SDK Version: 3.7.1 Build id: M20110909-1335
Lombok v0.10.8 "Burning Emu" is installed. https://projectlombok.org/
java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.10) (6b20-1.9.10-0ubuntu1~10.04.3)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

👤 reinierz   🕗 Feb 14, 2012 at 17:20 UTC

Checked a fix for this into master.

Will be in whatever follows 0.10.8.

Collaborator

lombokissues commented Jul 14, 2015

👤 reinierz   🕗 Feb 14, 2012 at 17:20 UTC

Checked a fix for this into master.

Will be in whatever follows 0.10.8.

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

End of migration

Collaborator

lombokissues commented Jul 14, 2015

End of migration

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