Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
See original GitHub issueLombok 1.18.0
Works:
Stream.of(DocumentCapability.DOCUMENT_TO_PDF, DocumentCapability.DOCUMENT_TO_TEXT)
.map(
c -> {
CapabilityStatusRecord s = new CapabilityStatusRecord();
s.setCapability(c);
return s;
})
.collect(Collectors.toList());
Doesn’t work:
Stream.of(DocumentCapability.DOCUMENT_TO_PDF, DocumentCapability.DOCUMENT_TO_TEXT)
.map(
c -> {
val s = new CapabilityStatusRecord();
s.setCapability(c);
return s;
})
.collect(Collectors.toList());
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How can I debug lombok val? - Stack Overflow
Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved.
Read more >Cannot use 'val' here because initializer expression does not ...
Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved.
Read more >Declaring Val and Var Variables in Lombok - Baeldung
Learn how to use Lombok's val and var to define local variables without specifying the type.
Read more >Lomboker Eclipse Plugin (Day 3)
java:[648,7] error: Cannot use 'var' here because initializer expression does not have a representable type: Type cannot be resolved [ERROR] src ...
Read more >val - Project Lombok
You can use val as the type of a local variable declaration instead of actually writing the type. When you do this, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m seeing the aformentioned behavior in 1.18.4. (using gradle/intellij (with latest plugin circa 2018-12-01))
-Surprisingly its happening within a ‘try’ as opposed to a lamda-
Looks like this might be a red herring. The root of the issue was:
explicitly defining the generic type solved the problem:
val future = CompletableFuture.<Integer>supplyAsync(() -> CompletableFuture.completedFuture(1));
With 1.18.6, I still faced this issue. Is there a solution now? @mplushnikov