[BUG] Annotation processor

Hello,
long story short: ButterKnife generated classes are not generated properly. Specific code included below works with Java7, but with Kotlin doesn’t.
Basically problem is with RecyclerView.ViewHolder (it works for Activity derivates, but not here). Let’s say we have 2 view holders in same package like:

class Item101ViewHolder : DashboardViewHolder {

    @Bind(R.id.valueTextView)
    lateinit var valueTextView: TextView;

    @Bind(R.id.iconImageView)
    lateinit var imageView: ImageView;

    constructor(itemView: View?) : super(itemView){
        ButterKnife.bind(this, itemView!!);
    }
    override fun onBind(position: Int, drawableItem: DrawableItem) {
        ...
    }
}

and

class Item102ViewHolder : DashboardViewHolder {

    @Bind(R.id.nameTextView)
    lateinit var nameTextView: TextView;

    @Bind(R.id.valueTextView)
    lateinit var valueTextView: TextView;

    @Bind(R.id.iconImageView)
    lateinit var imageView: ImageView;

    constructor(itemView: View?) : super(itemView){
        ButterKnife.bind(this, itemView!!);
    }

    override fun onBind(position: Int, drawableItem: DrawableItem) {
        ...
    }
}

Generated classes (ViewBinders) looks like this:

public class Item101ViewHolder$$ViewBinder<T extends Item101ViewHolder> implements ViewBinder<T> {
    public Item101ViewHolder$$ViewBinder() { }

    public void bind(Finder finder, T target, Object source) {
        View view = (View)finder.findOptionalView(source, 2131492984, (String)null);
        target.imageView = (ImageView)finder.castView(view, 2131492984, "field \'imageView\'");
        view = (View)finder.findRequiredView(source, 2131492983, "field \'valueTextView\'");
        target.valueTextView = (TextView)finder.castView(view, 2131492983, "field \'valueTextView\'");
    }
}

and

public class Item102ViewHolder$$ViewBinder<T extends Item102ViewHolder> implements ViewBinder<T> {
    public Item102ViewHolder$$ViewBinder() { }

    public void bind(Finder finder, T target, Object source) {
        View view = (View)finder.findRequiredView(source, 2131492982, "field \'nameTextView\'");
        target.nameTextView = (TextView)finder.castView(view, 2131492982, "field \'nameTextView\'");
    }
}

As you can see, in second file there are 2 fields missing, that were already used in first file. Also, if Item101… is renamed to Item103… generated file for Item103 is empty, while Item102… contains 3 fields. I have no idea why, but it seems, if field with specific name was already used before it won’t be used anymore in other classes. I think it is very serious bug in annotation processor. Also i created one working solution, but it is very ugly. Working implementations are:

class Item101ViewHolder : DashboardViewHolder {

    @Bind(R.id.valueTextView)
    lateinit var valueTextView101: TextView;

    @Bind(R.id.iconImageView)
    lateinit var imageView101: ImageView;

    constructor(itemView: View?) : super(itemView){
        ButterKnife.bind(this, itemView!!);
    }

    override fun onBind(position: Int, drawableItem: DrawableItem) {
        ...
    }
}

and

class Item102ViewHolder : DashboardViewHolder {

    @Bind(R.id.nameTextView)
    lateinit var nameTextView102: TextView;

    @Bind(R.id.valueTextView)
    lateinit var valueTextView102: TextView;

    @Bind(R.id.iconImageView)
    lateinit var imageView102: ImageView;

    constructor(itemView: View?) : super(itemView){
        ButterKnife.bind(this, itemView!!);
    }

   override fun onBind(position: Int, drawableItem: DrawableItem) {
        ...
   }
}

Well, it is working, but not really a thing, we can use as producton code, because if someone wan to use that in bigger project it may lead to critical issues, that are not easilly able to detect, what is really wrong.
Does anyone know, if there is any BugTracker for kapt or something like this, or this is right place to post such bugs? If not, please let me know, i’ll post it somewhere else :slight_smile:

Ok, I think this issue can be fixed with KT-9183 - Annotation processing isn't processing all field and method annotations unless the names are unique by wontondon · Pull Request #822 · JetBrains/kotlin · GitHub