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 fails with method reference on @Delegate methods #1976

Open
bormoshka opened this issue Dec 10, 2018 · 0 comments
Open

val fails with method reference on @Delegate methods #1976

bormoshka opened this issue Dec 10, 2018 · 0 comments

Comments

@bormoshka
Copy link

bormoshka commented Dec 10, 2018

Lombok version: 1.16.20 / 1.18.4
jdk: 1.8.181
code example: https://github.com/bormoshka/lombokTest/blob/master/lombok_1.16.20/src/main/java/ru/ulmc/lombok/fails/ValTypeFail.java

public class ValTypeFail {

    public void config() {
        val columnBool = createColumn(entity -> entity.getABoolean()); // this is working!
        val column = createColumn(Entity::getValue); // and here an error occurs
    }

    private <V> Column<Entity, V> createColumn(Function<Entity, V> func) {
        return new Column<>(func);
    }

    private static class Column<T, V> {
        public Column(Function<T, V> vp) {}
    }

    public static class Entity {
        @Delegate
        private MyDelegate innerDelegate;
    }

    @Getter
    @Setter
    public static class MyDelegate {
        private String value;
        private Boolean aBoolean;
    }
}

error: ValTypeFail.java:14: error: Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
val column = createColumn(Entity::getValue); // and here an error occurs

UPD: IntelliJ idea lombok plugin see no error here:
image

m4gshm pushed a commit to m4gshm/lombok that referenced this issue Apr 28, 2019
…andleDelegate generates code before the HandleVal.
m4gshm pushed a commit to m4gshm/lombok that referenced this issue Apr 28, 2019
…andleDelegate generates code before the HandleVal.
rzwitserloot added a commit that referenced this issue Apr 30, 2019
m4gshm pushed a commit to m4gshm/lombok that referenced this issue May 7, 2019
…rget type of this expression must be a functional interface' in code like 'lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println;'
m4gshm pushed a commit to m4gshm/lombok that referenced this issue May 8, 2019
m4gshm pushed a commit to m4gshm/lombok that referenced this issue May 20, 2019
m4gshm pushed a commit to m4gshm/lombok that referenced this issue May 24, 2019
…r to guarantee AbortCompilation is throwing.
rzwitserloot added a commit that referenced this issue Sep 10, 2019
This PR does fix that, but introduces its own problem.
See commit immediately following this one for explanation
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