private void exposeExposedFieldsToJs ( ) { if ( fieldsWithNameExposed . isEmpty ( ) ) { return ; } MethodSpec . Builder exposeFieldMethod = MethodSpec . methodBuilder ( "vg$ef" ) . addAnnotation ( JsMethod . class ) ; fieldsWithNameExposed . forEach ( field -> exposeFieldMethod . addStatement ( "this.$L = $T.v()" , field . getName ( ) , FieldsExposer . class ) ) ; exposeFieldMethod . addStatement ( "$T.e($L)" , FieldsExposer . class , String . join ( "," , fieldsWithNameExposed . stream ( ) . map ( ExposedField :: getName ) . collect ( Collectors . toList ( ) ) ) ) ; componentExposedTypeBuilder . addMethod ( exposeFieldMethod . build ( ) ) ; }
Generate a method that use all the fields we want to determine the name of at runtime . This is to avoid GWT optimizing away assignation on those fields .