Anonymous Java Delegate classes

I want to create a JavaDelegate instance using a lambda expression or an anonymous class. Is it possible?

I tried this:

JavaDelegate javaDelegate = execution -> {
	log.info("EXECUTED");
        // other code  
};
ServiceTaskBuilder stepBuilder = /*some code */.serviceTask().camundaClass(javaDelegate.getClass());

It gives me no warning nor error, but when I execute this code the process completes without print the log message.