Skip to main content

I am trying to follow the documentation here: https://www.docs.developers.amplitude.com/data/sdks/java/ampli/#track

generating code into a backend kotlin project, similar to this example https://github.com/amplitude/ampli-examples/tree/main/jre/kotlin/AmpliApp

 

However when I generate the code there is a compilation error in the generated file Ampli.kt, line 207

 

    open fun identify(userId: String?, event: Identify? = null, options: EventOptions? = null, extra: MiddlewareExtra? = null) {
if (!this.isInitializedAndEnabled()) {
return
}
val amplitudeEvent = this.createAmplitudeEvent(event?.eventType, event?.options, options, userId)
amplitudeEvent.userProperties = this.getEventPropertiesJson(event)

this._client?.logEvent(amplitudeEvent, extra)
}

 

the problem is that event is a nullable type.

 

In the example repo i pasted above, this argument is non-nullable

I have noticed that this section of code only generates if you specify some user properties


Hi @KatSharp, Thank you for writing this post! Please allow me to check this internally and get back to you! 


there are also some compiler warnings, like usage of deprecated methods.

Plus it fails a bunch of tests run by common tools, such as detekt.

It would be nice is the code generated adhered to these checks


Reply