annotation-processing

Dagger 2 on Android, missing error messages

廉价感情. 提交于 2019-12-01 15:20:35
I'm using Dagger 2 in my Android project and I'm having trouble debugging it. I know that the compilation fails because of an error in my dagger 2 setup (had it before) but it's almost impossible to track it down because I don't get a proper error message telling me where the problem lies. All I get are messages that show that the annotation processing failed. Along the lines of: Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. Error:(14, 28) error: cannot find symbol class BR Error:(17, 40) error: package com

Dagger 2 on Android, missing error messages

早过忘川 提交于 2019-12-01 14:11:52
问题 I'm using Dagger 2 in my Android project and I'm having trouble debugging it. I know that the compilation fails because of an error in my dagger 2 setup (had it before) but it's almost impossible to track it down because I don't get a proper error message telling me where the problem lies. All I get are messages that show that the annotation processing failed. Along the lines of: Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error

Why IntelliJ needs Lombok plugin?

断了今生、忘了曾经 提交于 2019-12-01 06:54:39
As far as I understand, Lombok uses Java's Annotation Processors to generate additional methods. With Maven 3.5 it works perfectly without adding any additional configuration, just add dependecy to Lombok and put some annotations like @Getter , @Setter . However, if I open this project in IntelliJ IDEA 2018.2, all usages of generated getters/setters are highlighted as errors. I have Annotation Processing turned on, I tried to built project in IntelliJ or build in Maven and then use in IntelliJ, but it still requires Lombok Plugin to avoid false errors. Is it some kind of bug? Error in workflow

How to obtain the right JavaFileManager in a Java annotation processor?

﹥>﹥吖頭↗ 提交于 2019-12-01 03:52:59
I've written an Java annotation processor by extending javax.annotation.processing.AbstractProcessor which is called in the Eclipse context and it works fine, except that I need more information about the source path and class path for my processor to work: @SupportedAnnotationTypes({"MyAnno"}) @SupportedSourceVersion(SourceVersion.RELEASE_8) public class Processor extends AbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { // this used to work in Java4 but not anymore (since Java6?): String sourcePath = processingEnv

Annotation processor output in maven

痞子三分冷 提交于 2019-12-01 03:12:24
I'm using JSR 269 as a way to analyze code during compilation and to fail it if needed. I'm having troubles with displaying output of my annotation processor in maven (Ant does show the output) I'm using javax.annotation.processing.Messager to display warnings and errors, but in maven I don't see it's output. (I do know it runs though, because it generates code like it should). Any ideas? Hardy I think you are running into a Maven bug or better a bug in the compiler plugin - MCOMPILER-66 . When it comes to annotation processing the compiler plugin has several problems, eg also MCOMPILER-62 .

Annotation Processor in IntelliJ and Gradle

送分小仙女□ 提交于 2019-12-01 02:23:23
tl;dr : I cannot configure IntelliJ to generate the java files in the same directory as gradle I have a small project which uses the immutables annotation processor. It works as expected in the gradle command line build, but I cannot get IntelliJ to output the generated files to the same directory. The full project is available on GitLab Gradle config : I use the folowing gradle plugins: gradle-idea plugin which handles the idea configuration gradle-apt-plugin which provides the apt configuration and handles the compile-class path and idea config related to annotation processing (if also the

How to step-debug annotation processor during compile?

时光怂恿深爱的人放手 提交于 2019-11-30 18:48:01
I have an annotation processor for an annotation of retention policy=SOURCE. I have not idea how to step-debug it. I have issued print statements, logger info when I run mvn install, compile or package or ant javac, and I see their sysouts in the compile log. However, I have no idea how to step-debug the processor in Eclipse. I mean, how do you step-debug compile-time? You have to invoke the Java compiler from Eclipse, using a debug configuration (you'll need to create the configuration manually, from the "Debug Configurations..." menu choice. The "correct" way to invoke the Java compiler

Cannot load resources in Annotation Processor (Not on classpath)

筅森魡賤 提交于 2019-11-30 17:19:29
I have an annotation processor which shall generate a enumeration with the keys defined by getter methods of an interface. The interface resides in MyProject/src/main/java/my.package.MyInterfaces.java. I want to validate the properties files which reside in MyProject/src/main/resources/META-INF/resource-bundle/ if they do contain the keys defined in the generated enum. My problem is that the properties files are not available via the classloader of the processor or via Filer.getResource(...). How can I make the source or classpath of this project available to the processor, so that I can load

Android javax.annotation.processing Package missing

六眼飞鱼酱① 提交于 2019-11-30 06:41:26
I would like to do some annotation processing based on the example in the following link: http://www.zdnetasia.com/writing-and-processing-custom-annotations-part-3-39362483.htm . However, I would like to implement this in my Android project, and it seems I cannot use the package with the android platform. Do I need to add an external jar or is there something I'm missing? Thanks. Jens The javax.annotation.processing package is not included in Android, but the Android VM team describes how to include extra javax packages here - it might be applicable to your question. The javax.annotation

How to step-debug annotation processor during compile?

心已入冬 提交于 2019-11-30 03:04:17
问题 I have an annotation processor for an annotation of retention policy=SOURCE. I have not idea how to step-debug it. I have issued print statements, logger info when I run mvn install, compile or package or ant javac, and I see their sysouts in the compile log. However, I have no idea how to step-debug the processor in Eclipse. I mean, how do you step-debug compile-time? 回答1: You have to invoke the Java compiler from Eclipse, using a debug configuration (you'll need to create the configuration