Skip to content

RFC: codegen any Java type support

Julien Viet edited this page Dec 19, 2018 · 1 revision

Codegen any Java type support

The code generator categorizes types in sets:

  • basic types: a json value, a primitive value (or its boxed type) or a string
  • api types: types annotated with @VertxGen
  • etc...

Some types don't fall in any of these set, e.g java.net.Socket.

We want to create a new set that contains any java type that does not git in these category.

  • class model (io.vertx.codegen.ClassModel) in its method declarations (io.vertx.codegen.MethodInfo), i.e parameter types and return type
  • data object model (io.vertx.codegen.DataObjectModel) is its property declaration (io.vertx.codegen.PropertyInfo) type

We want to handle such types in such declarations, so the method can be represented in the model and generators using the Java type system can use them.

The MethodInfo and PropertyInfo needs to have a method that determines whether they use an OTHER class kind, e.g a boolean property containingAnyJavaType.

The actual code generators needs to be updated such as

  • they filter the new methods
  • they use them for their own benefits
    • RxJava (1 and 2) support for methods proxying
    • Kotlin generator support for methods (coroutines) and support for properties (data object helper)
    • Codegen data object converter support
Clone this wiki locally