I just built an annotation processor that generates a builder class for my classes annotated with
@DataBuilder
, my classes annotated with this annotation are located in
com.my.package.model
and the generated builder class is also located in the same package
com.my.package.model
but in the generated directory of course
build/generated/source/kapt/debug/com/my/package/model/MyModelBuilder.kt
, I can use these generated classes fine inside of my model classes(written in Kotlin)
BUT I cannot use the generated
MyModelBuilder
Kotlin class inside of a java class as a class member
package com.my.package.home;
import com.my.package.model.MyModelBuilder;
public class Home {
MyModelBuilder builder; // <=== AS recognizes the class, but I'm having an compilation issue
}
AndroidStudio recognizes the class, but I’m having this compilation issue
com/my/package/home/Home.java:4: error: cannot find symbol
MyModelBuilder builder;
^
symbol: class MyModelBuilder
location: class Home
it’s weird because I can use this generated builder class only inside of methods, this code works fine
package com.my.package.home;
import com.my.package.model.MyModelBuilder;
public class Home {
public void hello() {
MyModelBuilder builder;
}
}
could somebody here help me to understand this behavior? In advance, thanks!