.defineMethod("callWithTimeout", Object.class, Visibility.PUBLIC).withParameters(Callable.class, TimeUnit.class).withoutCode())
.type(named("com.google.common.util.concurrent.SimpleTimeLimiter"))
.transform((builder, type, classloader, module) -> builder
.visit(new ModifierAdjustment().withInvokableModifiers(isConstructor().or(named("callWithTimeout"), Visibility.PUBLIC))
At runtime, all generic types are erased to their most specialized type. If you wanted to get the generic signatures correct for reflection purposes, you can use TypeDescription.Generic.Builder to create them and define a type variable T on the method using the DSL. As for the matchers, you can make them more specific if you wanted but making types public is always possible since you do not reduce any visibility.
.