Commit 8bbd4f8
committed
Adapt instances of AnnotationValue in the annotation processor
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>1 parent 8e11e2e commit 8bbd4f8
File tree
1 file changed
+5
-0
lines changed- src/main/java/org/scijava/annotations
1 file changed
+5
-0
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
| |||
0 commit comments