I'm trying to profile a Java application with FlightRecorder and MissionControl and I'm getting some errors related to lambda functions. The app runs perfectly - the errors appear only in FR/MC.
Simple program:
import java.util.function.Supplier;
public class TestClass {
public static void main(String[] args) {
Supplier<String> s = () -> "VALUE"; // <- error at this line
}
}
Java version:
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
JVM args:
-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=delay=0s,duration=10s,filename=recording.jfr,settings=profile
Java Error as reported by FlightRecorder (open recording.jfr in MissionControl and go to Events->Log):
Class java.lang.NoSuchFieldError thrownClass class
Message method resolution failed message text
Event Thread main (thread) thread
Error.<init>(String) line: 71
LinkageError.<init>(String) line: 55
IncompatibleClassChangeError.<init>(String) line: 55
NoSuchFieldError.<init>(String) line: 57
MethodHandleNatives.resolve(MemberName, Class)
MemberName$Factory.resolve(byte, MemberName, Class) line: 975
MemberName$Factory.resolveOrFail(byte, MemberName, Class, Class) line: 1000
MethodHandles$Lookup.resolveOrFail(byte, Class, String, MethodType) line: 1386
MethodHandles$Lookup.findStatic(Class, String, MethodType) line: 780
MethodHandleImpl.findCollector(String, int, Class, Class[]) line: 1387
MethodHandleImpl.makeArrays() line: 1427
MethodHandleImpl.access$000() line: 49
MethodHandleImpl$Lazy.<clinit>() line: 610
MethodHandleImpl.varargsArray(int) line: 1506
MethodHandleImpl.varargsArray(Class, int) line: 1623
MethodHandle.asCollector(Class, int) line: 999
MethodHandleImpl$AsVarargsCollector.<init>(MethodType, MethodHandle, Class) line: 460
MethodHandleImpl$AsVarargsCollector.<init>(MethodHandle, Class) line: 454
MethodHandleImpl.makeVarargsCollector(MethodHandle, Class) line: 445
MethodHandle.setVarargs(MemberName) line: 1325
MethodHandles$Lookup.getDirectMethodCommon(byte, Class, MemberName, boolean, boolean, Class) line: 1670
MethodHandles$Lookup.getDirectMethod(byte, Class, MemberName, Class) line: 1605
MethodHandles$Lookup.findStatic(Class, String, MethodType) line: 781
CallSite.<clinit>() line: 226
MethodHandleNatives.linkCallSiteImpl(Class, MethodHandle, String, MethodType, Object, Object[]) line: 307
MethodHandleNatives.linkCallSite(Object, Object, Object, Object, Object, Object[]) line: 297
TestClass.main(String[]) line: 6
Any thoughts? Cheers.
Supplier<String> s = () -> { return "VALUE"; };works?