Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Path is not a functional interface" compilation error in Java class

Tags:

java-8

I am getting the following error when I try to build my Java 1.8 project:

COMPILATION ERROR : 
-------------------------------------------------------------
error: incompatible types: Path is not a functional interface
1 error

There is no line number associated with the error, but Netbeans is showing the red squiggly line under the package declaration for one of the classes in the project. That class doesn't even use Path though. It extends an abstract class in the same package that does use Path, if that's relevant.

Has anyone seen this before? Any thoughts on how to fix this?

like image 401
Jess Avatar asked Sep 18 '25 13:09

Jess


1 Answers

Functional interface has a "single abstract method" (SAM). Maybe you are attempting to use Path in a way that requires it be SAM (e.g. as a lambda), but Path isn't SAM. https://dzone.com/articles/introduction-functional-1

like image 58
Jonathan Crosmer Avatar answered Sep 22 '25 18:09

Jonathan Crosmer