You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The code below gives this compilation error:
11:55:45: Executing ':Main.main()'...
> Task :compileJava FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
1 actionable task: 1 executed
W:\Projects\tests\Lombok-Bug\src\main\java\org\example\Main.java:15: error: no suitable method found for collect(Collector<String,CAP#1,Map<Integer,Object>>)
@Getter(lazy = true)
^
method Stream.<R#1>collect(Supplier<R#1>,BiConsumer<R#1,? super String>,BiConsumer<R#1,R#1>) is not applicable
(cannot infer type-variable(s) R#1
(actual and formal argument lists differ in length))
method Stream.<R#2,A>collect(Collector<? super String,A,R#2>) is not applicable
(cannot infer type-variable(s) R#2,A
(argument mismatch; Duration cannot be converted to Collector<? super String,A,R#2>))
where R#1,T,R#2,A are type-variables:
R#1 extends Object declared in method <R#1>collect(Supplier<R#1>,BiConsumer<R#1,? super T>,BiConsumer<R#1,R#1>)
T extends Object declared in interface Stream
R#2 extends Object declared in method <R#2,A>collect(Collector<? super T,A,R#2>)
A extends Object declared in method <R#2,A>collect(Collector<? super T,A,R#2>)
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 704ms
11:55:46: Execution finished ':Main.main()'.
To Reproduce Main.java
packageorg.example;
importlombok.Getter;
importreactor.core.publisher.Mono;
importjava.time.Duration;
importjava.util.Arrays;
importjava.util.Map;
importjava.util.stream.Collectors;
publicclassMain {
@Getter(lazy = true)
privatefinalMono<Map<Integer, String>> mono =
Mono.just(newString[]{"a", "b", "c", "d"})
.map(Arrays::asList)
.map(list -> list.stream().collect(Collectors.toMap(String::hashCode, v -> v)))
.cache(a -> Duration.ofSeconds(10),
v -> Duration.ofSeconds(10),
() -> Duration.ofSeconds(10)
);
/* Similar code that works as expected @Getter(lazy = true) private final Mono<Map<Integer, String>> mono = Mono.just(new String[]{"a", "b", "c", "d"}) .map(Arrays::asList) .map(list -> list.stream().collect(Collectors.toMap(String::hashCode, v -> v))) .cache(a -> Duration.ofSeconds(10), v -> Duration.ofSeconds(10), () -> Duration.ZERO // <--------The only difference is in this line ); @Getter(lazy = true) private final Mono<Map<Integer, String>> mono = Mono.just(new String[]{"a", "b", "c", "d"}) .map(Arrays::asList) .map(list -> list.stream().collect(Collectors.toMap(String::hashCode, v -> v)));*/publicstaticvoidmain(String[] args) {
newMain().getMono().subscribe(v -> System.out.println(v));
}
}
build.gradle
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
implementation 'io.projectreactor:reactor-core:3.5.1'
}
Expected behavior
Successful compilation. Code should run as expected.
Version info:
Lombok version: 1.18.24
JDK: 17.0.1, 17.0.5.
IDE: Intellij Idea 2022.3
Gradle: 7.5.1
The text was updated successfully, but these errors were encountered:
Describe the bug
The code below gives this compilation error:
To Reproduce
Main.java
build.gradle
Expected behavior
Successful compilation. Code should run as expected.
Version info:
1.18.24
17.0.1
,17.0.5
.2022.3
7.5.1
The text was updated successfully, but these errors were encountered: