[jbossws-issues] [JBoss JIRA] Updated: (JBWS-1577) javax.jws.WebService in jbossws14-client.jar breaks Class#isAnnotationPresent()

Thomas Diesler (JIRA) jira-events at lists.jboss.org
Wed Jun 6 10:01:10 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBWS-1577?page=all ]

Thomas Diesler updated JBWS-1577:
---------------------------------

    Assignee: Thomas Diesler

> javax.jws.WebService in jbossws14-client.jar breaks Class#isAnnotationPresent()
> -------------------------------------------------------------------------------
>
>                 Key: JBWS-1577
>                 URL: http://jira.jboss.com/jira/browse/JBWS-1577
>             Project: JBoss Web Services
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: jbossws
>         Environment: n/a
>            Reporter: Brice Ruth
>         Assigned To: Thomas Diesler
>
> The javax.jws.WebService in jbossws14-client.jar breaks Class#isAnnotationPresent().
> Because the javax.jws.WebService annotation is defined to extend org.jboss.lang.Annotation, instead of java.lang.annotation.Annotation, the Java language method Class#isAnnotationPresent() throws a ClassCastException when it tries to cast JBoss' javax.jws.WebService to a java.lang.annotation.Annotation in sun.reflect.annotation.AnnotationParser#annotationForMap().
> To replicate:
> Create a class, MyService:
> package test;
> import javax.jws.WebService;
> @WebService
> public class MyService {
> 	public void execute() {
> 		
> 	}
> }
> Create a class, TestAnnotation:
> package test;
> import javax.jws.WebService;
> public class TestAnnotation {
> 	public static void main(String[] args) {
> 		Class clazz = MyService.class;
> 		boolean hasAnnotation = clazz.isAnnotationPresent(WebService.class);
> 		System.out.print("Has annotation? " + hasAnnotation);
> 	}
> }
> Run TestAnnotation against the jbossws14-client.jar (and its dependencies). The following exception will be thrown:
> Exception in thread "main" java.lang.ClassCastException: $Proxy0
> 	at sun.reflect.annotation.AnnotationParser.annotationForMap(Unknown Source)
> 	at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source)
> 	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source)
> 	at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source)
> 	at java.lang.Class.initAnnotationsIfNecessary(Unknown Source)
> 	at java.lang.Class.getAnnotation(Unknown Source)
> 	at java.lang.Class.isAnnotationPresent(Unknown Source)
> 	at test.TestAnnotation.main(TestAnnotation.java:8)
> The JSR-181 APIs provided by jbossws14-client.jar should not extend JBoss custom classes, I don't think. Especially not something as fundamental as Annotation.
> Respectfully,
> Brice Ruth

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbossws-issues mailing list