Debian Codegraph @

org.eclipse.jdt.apt.pluggable.tests/resources/targets/bug387956/SomeClass.java

raw
1 package targets.bug387956;
2
3 /*
4 * The import triggers a compilation error, if SomeAnnotation has a reference to
5 * Integer.MAX_VALUE: "The import generated.GeneratedEntity cannot be resolved"
6 */
7 import generated.GeneratedEntity;
8
9
10 @SuppressWarnings("unused")
11 public class SomeClass {
12
13 /**
14 * The problem only occurs when you do a Project > Clean. It doesn't occur
15 * when saving the file without cleaning (incremental compilation), because
16 * cleaning removes generated.GeneratedEntity, which is then generated
17 * again.
18 *
19 * If you comment "@SomeAnnotation(Integer.MAX_VALUE)", the error
20 * disappears.
21 *
22 * If you replace Integer.MAX_VALUE with its value, the error disappears.
23 *
24 * This seems to be because {@link SomeAnnotation} fires the Eclipse
25 * annotation processing, which sees a reference that needs to be resolved
26 * (Integer.MAX_VALUE), and therefore tries to resolve imports, where it
27 * finds import {@link generated.GeneratedEntity} and cannot resolve it.
28 *
29 * This can happen with any annotation java 6 processor that generates code.
30 * Also note that I couldn't reproduce this on the simple java 5 processor
31 * given here: http://www.eclipse.org/jdt/apt/introToAPT.html
32 */
33 @SomeAnnotation(Integer.MAX_VALUE)
34 Object none;
35 }