I reproduced the code that resulted in the compiler error and have attached
the relevant files here. Let me know if you need anything else.
======================================================================
compile:
[javac] Compiling 1 source file to C:\projects\java\tiger\build
[javac] =
C:\projects\java\tiger\src\com\sentous\tiger\XmlAnnotation.java:12: =
annotation values must be of the form 'name=3Dvalue'
[javac] @Target(ElementType.METHOD, ElementType.TYPE)
[javac] ^
[javac] =
C:\projects\java\tiger\src\com\sentous\tiger\XmlAnnotation.java:12: =
annotation java.lang.annotation.Target is missing value
[javac] @Target(ElementType.METHOD, ElementType.TYPE)
[javac] ^
[javac] An exception has occurred in the compiler (1.5.0-beta). =
Please file a bug at the Java Developer Connection =
(http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug =
Parade for duplicates. Include your program and the following diagnostic =
in your report. Thank you.
[javac] java.lang.ClassCastException: =
com.sun.tools.javac.tree.Tree$Select
[javac] at =
com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:1567)
[javac] at =
com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:1462)
[javac] at =
com.sun.tools.javac.comp.Check.validateAnnotations(Check.java:1456)
[javac] at =
com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2257)
[javac] at =
com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2237)
[javac] at =
com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2190)
[javac] at =
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:409)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:584)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:536)
[javac] at com.sun.tools.javac.Main.compile(Main.java:41)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native =
Method)
[javac] at =
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java=
:39)
[javac] at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI=
mpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:494)
[javac] at =
org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:98)
[javac] at =
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:976)
[javac] at =
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:799)
[javac] at =
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:302)
[javac] at org.apache.tools.ant.Task.perform(Task.java:401)
[javac] at org.apache.tools.ant.Target.execute(Target.java:338)
[javac] at =
org.apache.tools.ant.Target.performTasks(Target.java:365)
[javac] at =
org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[javac] at =
org.apache.tools.ant.Project.executeTargets(Project.java:1094)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[javac] at =
org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[javac] at =
org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
[javac] at =
org.apache.tools.ant.Project.executeTargets(Project.java:1094
)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[javac] at =
org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[javac] at =
org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
======================================================================
package com.sentous.tiger;
import java.lang.annotation.*;
@XmlAnnotation(elementName="Tiger")
public class TigerTest
{
public TigerTest()
{
}
public static void main(String[] args)
{
Class tigerClass = TigerTest.class;
for(Annotation ann : tigerClass.getAnnotations())
{
System.out.println("Annotation="+ann);
if(ann instanceof XmlAnnotation)
{
System.out.println("This is an XmlAnnotation");
XmlAnnotation xmlAnn = (XmlAnnotation)ann;
System.out.println("Xml Annotation elementName="+xmlAnn.elementName());
}
}
}
}
======================================================================
package com.sentous.tiger;
import java.lang.annotation.*;
import java.util.*;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD, ElementType.TYPE)
public @interface XmlAnnotation
{
String elementName();
}
the relevant files here. Let me know if you need anything else.
======================================================================
compile:
[javac] Compiling 1 source file to C:\projects\java\tiger\build
[javac] =
C:\projects\java\tiger\src\com\sentous\tiger\XmlAnnotation.java:12: =
annotation values must be of the form 'name=3Dvalue'
[javac] @Target(ElementType.METHOD, ElementType.TYPE)
[javac] ^
[javac] =
C:\projects\java\tiger\src\com\sentous\tiger\XmlAnnotation.java:12: =
annotation java.lang.annotation.Target is missing value
[javac] @Target(ElementType.METHOD, ElementType.TYPE)
[javac] ^
[javac] An exception has occurred in the compiler (1.5.0-beta). =
Please file a bug at the Java Developer Connection =
(http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug =
Parade for duplicates. Include your program and the following diagnostic =
in your report. Thank you.
[javac] java.lang.ClassCastException: =
com.sun.tools.javac.tree.Tree$Select
[javac] at =
com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:1567)
[javac] at =
com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:1462)
[javac] at =
com.sun.tools.javac.comp.Check.validateAnnotations(Check.java:1456)
[javac] at =
com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2257)
[javac] at =
com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2237)
[javac] at =
com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2190)
[javac] at =
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:409)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:584)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:536)
[javac] at com.sun.tools.javac.Main.compile(Main.java:41)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native =
Method)
[javac] at =
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java=
:39)
[javac] at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI=
mpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:494)
[javac] at =
org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:98)
[javac] at =
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:976)
[javac] at =
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:799)
[javac] at =
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:302)
[javac] at org.apache.tools.ant.Task.perform(Task.java:401)
[javac] at org.apache.tools.ant.Target.execute(Target.java:338)
[javac] at =
org.apache.tools.ant.Target.performTasks(Target.java:365)
[javac] at =
org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[javac] at =
org.apache.tools.ant.Project.executeTargets(Project.java:1094)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[javac] at =
org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[javac] at =
org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
[javac] at =
org.apache.tools.ant.Project.executeTargets(Project.java:1094
)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[javac] at =
org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[javac] at =
org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
======================================================================
package com.sentous.tiger;
import java.lang.annotation.*;
@XmlAnnotation(elementName="Tiger")
public class TigerTest
{
public TigerTest()
{
}
public static void main(String[] args)
{
Class tigerClass = TigerTest.class;
for(Annotation ann : tigerClass.getAnnotations())
{
System.out.println("Annotation="+ann);
if(ann instanceof XmlAnnotation)
{
System.out.println("This is an XmlAnnotation");
XmlAnnotation xmlAnn = (XmlAnnotation)ann;
System.out.println("Xml Annotation elementName="+xmlAnn.elementName());
}
}
}
}
======================================================================
package com.sentous.tiger;
import java.lang.annotation.*;
import java.util.*;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD, ElementType.TYPE)
public @interface XmlAnnotation
{
String elementName();
}