airbnb / paris

Define and apply styles to Android views programmatically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Annotation processing fails when using Kotlin 1.4-M3

plnice opened this issue · comments

Paris 1.5.0

Annotation processing (kapt) fails when processing item annotated with @StyleableChild:

@Styleable("MyView")
class MyView @JvmOverloads constructor(...) : ConstraintLayout(...) {
  ...
  @StyleableChild(R2.styleable.MyView_mvTitle)
  val title: TextView
  ...
  init {
    ...
    title = findViewById(R.id.title)
    ...
  }
}

Stacktrace:

Caused by: java.lang.IllegalArgumentException: my.ui.MyView.getTitle$annotations: Could not find getter for property annotated with @StyleableChild. This probably means the property is private or protected.
        at com.airbnb.paris.processor.framework.models.SkyPropertyModel.<init>(SkyPropertyModel.kt:55)
        at com.airbnb.paris.processor.models.StyleableChildInfo.<init>(StyleableChildInfo.kt:68)
        at com.airbnb.paris.processor.models.StyleableChildInfoExtractor.elementToModel(StyleableChildInfo.kt:47)
        at com.airbnb.paris.processor.models.StyleableChildInfoExtractor.elementToModel(StyleableChildInfo.kt:16)
        at com.airbnb.paris.processor.framework.models.SkyModelFactory.process(SkyModel.kt:25)
        at com.airbnb.paris.processor.ParisProcessor.processRound(ParisProcessor.kt:99)
        at com.airbnb.paris.processor.framework.SkyProcessor.process(SkyProcessor.kt:22)
        at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
        at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:147)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)

Works fine for Kotlin 1.3.72.

I observed this same behavior with the stable Kotlin 1.4.0 release. I noticed this Paris issue has been resolved in #142 which was released in version 1.7.1. When I upgrade to version 1.7.1 of Paris, I am able to compile successfully.

Yep, this is fixed.