Open lombokissues opened 9 years ago
:bust_in_silhouette: gss222 :clock8: Oct 31, 2013 at 21:24 UTC
What steps will reproduce the problem?
The following class does not compile under javac using lombok but it does on Eclipse. The problem seems to arise from mixing usage of @ val and @ Delegate in a parent-child relationship.
import lombok.Delegate; import lombok.val;
public class Main { public static void main(String[] args) { val bomb = new Bomb(); bomb.arm(); }
public static class Bomb { @ Delegate private Detonator detonator = new Detonator();
private Timer timer = new Timer();
public void arm()
{
this.timer.bomb = this;
this.timer.start();
}
}
public static class Detonator { public Trigger getTrigger() { return new Trigger(); } }
public static class Timer { private Bomb bomb;
public void start()
{
val trigger = bomb.getTrigger();
trigger.detonate();
}
}
public static class Trigger { public void detonate() { System.out.println("BOOM!!"); } } }
What is the expected output? What do you see instead?
The error message returned is:
Main.java:46: error: Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved val something = parent.getSomething(); ^ 1 error
What version of the product are you using? On what operating system?
Lombok Version 1.12.2, JDK 7
:bust_in_silhouette: gss222 :clock8: Oct 31, 2013 at 21:24 UTC
:bust_in_silhouette: gss222 :clock8: Oct 31, 2013 at 21:29 UTC
The error should be
Main.java:40: error: Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved val trigger = bomb.getTrigger();
End of migration
Confirming this is still an issue.
Experiencing this issue in IntelliJ IDEA Ultimate 2018.2
Migrated from Google Code (issue 601)