Adapt instances of AnnotationValue in the annotation processor#131
Merged
Adapt instances of AnnotationValue in the annotation processor#131
Conversation
Kevin Mader reported that certain @interfaces were not handled gracefully because the annotation processor would encounter AnnotationValue instances and not know how to handle them. This fixes #130. Without these changes, the example provided below yielded the following exception: error: java.io.IOException: Cannot handle object of type class com.sun.tools.javac.code.Attribute$Constant at org.scijava.annotations.AbstractIndexWriter.writeObject(AbstractIndexWriter.java:252) at org.scijava.annotations.AbstractIndexWriter.writeArray(AbstractIndexWriter.java:306) at org.scijava.annotations.AbstractIndexWriter.writeObject(AbstractIndexWriter.java:243) at org.scijava.annotations.AbstractIndexWriter.writeMap(AbstractIndexWriter.java:288) at org.scijava.annotations.AbstractIndexWriter.writeObject(AbstractIndexWriter.java:249) at org.scijava.annotations.AbstractIndexWriter.writeMap(AbstractIndexWriter.java:288) at org.scijava.annotations.AbstractIndexWriter.writeObject(AbstractIndexWriter.java:249) at org.scijava.annotations.AbstractIndexWriter.write(AbstractIndexWriter.java:99) at org.scijava.annotations.AnnotationProcessor.process(AnnotationProcessor.java:91) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:627) ... -- snip BlockIdentity.java -- import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.scijava.annotations.Indexable; @target(ElementType.TYPE) @retention(RetentionPolicy.RUNTIME) @indexable public @interface BlockIdentity { String blockName(); String desc() default ""; String[] inputNames(); String[] outputNames(); } -- snap -- -- snip Test.java -- @Blockidentity(blockName = "GrowRegionsBlock", inputNames= {"labeled image", "mask image"}, outputNames= {"filled labels", "filled neighborhood"}) public class Test {} -- snap -- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho
added a commit
that referenced
this pull request
Oct 8, 2014
Adapt instances of AnnotationValue in the annotation processor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kevin Mader reported that certain @interfaces were not handled gracefully
because the annotation processor would encounter AnnotationValue instances
and not know how to handle them.
This fixes #130.
Without these changes, the example provided below yielded the following
exception:
-- snip BlockIdentity.java --
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.scijava.annotations.Indexable;
@target(ElementType.TYPE)
@retention(RetentionPolicy.RUNTIME)
@indexable
public @interface BlockIdentity {
String blockName();
String desc() default "";
String[] inputNames();
String[] outputNames();
}
-- snap --
-- snip Test.java --
@Blockidentity(blockName = "GrowRegionsBlock",
inputNames= {"labeled image", "mask image"},
outputNames= {"filled labels", "filled neighborhood"})
public class Test {}
-- snap --
Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de