Hi Gian,
The reason why your code snippet fails at Line 37 is because GWT doesn't
support / emulate the Class.getAnnotation() or isAnnotationPresent()
methods. Although GWT does support the use of annotations, which is useful
for cases where you would like to reuse a POJO on both the client and the
server-side. However, supporting something like getAnnotation() in GWT code
wouldn't be as useful since there wouldn't be a lean equivalent of that in
the target JavaScript world.

You can check out more details about the GWT Emulated JRE to see the types
and methods that are supported at the link below.

GWT Emulated JRE:
http://code.google.com/webtoolkit/doc/1.6/RefJreEmulation.html

Hope that helps,
-Sumit Chandel

On Fri, Jul 17, 2009 at 8:02 AM, Gianluigi <[email protected]> wrote:

>
>
>
> Hi to all, it's first time that i try to use annotation in client side gwt
> application, i tried to compile that code:
>
> @Target( { ElementType.TYPE })
> @Retention(RetentionPolicy.RUNTIME)
> @interface MyAnn {
>        String value() default "";
> }
>
> @MyAnn(value="foo1")
> class B {}
>
> public class MyAnnotation {
>
>        public MyAnnotation() {}
>
>        public static final void foo() {
>
>                B b = new B();
>
>        MyAnn ann = b.getClass().getAnnotation(MyAnn.class);
>        GWT.log("" + b.getClass().isAnnotationPresent(MyAnn.class), null);
>
>        }
> }
>
> but when the compiler reach getAnnotation OR isAnnotationPresent say to me
> an error like this:
>
> [ERROR] Line 31: The method isAnnotationPresent(Class<MyAnn>) is undefined
> for the type Class<capture#1-of ? extends B>
>
> What's wrong with my code? thanks for any hint
> Gian
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to