Skip to content

Instantly share code, notes, and snippets.

@LudgerPeters
Last active March 4, 2016 11:14
Show Gist options
  • Select an option

  • Save LudgerPeters/570708438dbcb3f08106 to your computer and use it in GitHub Desktop.

Select an option

Save LudgerPeters/570708438dbcb3f08106 to your computer and use it in GitHub Desktop.
Annotation Processor causing javac to not return the correct error codes
package com.test;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.element.TypeElement;
import javax.lang.model.SourceVersion;
@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedAnnotationTypes("*")
public class AnnotationProcessor extends AbstractProcessor{
public AnnotationProcessor() {
System.out.println("Using Test AnnotationProcessor");
}
@Override
public boolean process(Set<? extends TypeElement> arg0, RoundEnvironment arg1) {
// TODO Auto-generated method stub
return false;
}
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("hello world");
}
}
@echo off
echo running compile with a corrupted jar
javac -cp annotationProcessor.jar;corruptedJar.jar HelloWorld.java
echo Error level %errorlevel%
echo running compile without the corrupted jar
javac -cp annotationProcessor.jar HelloWorld.java
echo Error level %errorlevel%
echo running compile without the annotationProcessor but with the corrupted jar
javac -cp corruptedJar.jar HelloWorld.java
echo Error level %errorlevel%
@LudgerPeters
Copy link
Author

I forgot to add the annotation processor meta inf file you can put the javax.annotation.processing.Processor in META-INF\ services\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment