The UserCodeWrapper is only a tool to support either setting instances of a class, or the class itself. The underlying system Mappers for example as either "new MapFunction()", or as "MapFunction.class".
To support non serializable types (which anonymous classes are unless the surrounding class is serializable), we'd need to switch the serialization Framework for UDFs (for example to Kryo). That is actually a worthwhile effort, if you want to tackle it. It is also a fairly isolated change. Stephan
