3

I have this code:

import java.util.List;
public class Main {
     public static void main(String[] args) {
          var first = List.of("a", "b", "c").stream().map(String::length).findFirst();
          System.out.print(first);
     }
}

When I run normally, this work very well, but when I run with debug and evaluate the expression:

List.of("a", "b", "c").stream().map(String::length).findFirst();

I receives the message "Method reference evaluation is not supported".

When I run the same code with explicit inference type, the evaluation work normally.

import java.util.List;
public class Main {
     public static void main(String[] args) {
          Optional<?> first = List.of("a", "b", "c").stream().map(String::length).findFirst();
          System.out.print(first);
     }
}

This is a bug or exists some configuration?

Naman
  • 23,555
  • 22
  • 173
  • 290
Everton Luis
  • 151
  • 4
  • Could be a bug if works in Run mode. Try to follow the error and see what's going on. evaluation.error.method.reference.evaluation.not.supported=Method reference evaluation is not supported => DebuggerBundle.properties – Graciano Apr 02 '18 at 00:27
  • Please report a bug https://youtrack.jetbrains.com/issues/idea – Egor Apr 02 '18 at 11:55
  • 1
    https://youtrack.jetbrains.com/issue/IDEA-189357 – Everton Luis Apr 02 '18 at 12:12
  • This message appears when you run in debug mode, stop at a breakpoint and change your code in a way that it won't compile anymore. Even when you attempt to evaluate a valid expression now, the compiling process fails so Intellij thinks your expression is the reason for it. – Cani Mar 15 '19 at 12:10
  • to close this thread, the issue reported seems to be fixed with intelliJ version `2020.3` – Naman Dec 28 '20 at 09:00

0 Answers0