@SupportedAnnotationTypes considered harmful. Use class constants instead.
authorJesse Glick <jglick@netbeans.org>
Fri, 30 Oct 2009 19:04:50 -0400
changeset 8461497742f45ca
parent 845 ca5ca94c13b6
child 851 b0ddeb781b30
child 852 b1cecb0b4f89
child 949 5541b131b88a
@SupportedAnnotationTypes considered harmful. Use class constants instead.
openide.util/src/org/netbeans/modules/openide/util/ServiceProviderProcessor.java
openide.util/src/org/netbeans/modules/openide/util/URLStreamHandlerRegistrationProcessor.java
     1.1 --- a/openide.util/src/org/netbeans/modules/openide/util/ServiceProviderProcessor.java	Fri Oct 30 13:29:24 2009 -0400
     1.2 +++ b/openide.util/src/org/netbeans/modules/openide/util/ServiceProviderProcessor.java	Fri Oct 30 19:04:50 2009 -0400
     1.3 @@ -40,14 +40,15 @@
     1.4  package org.netbeans.modules.openide.util;
     1.5  
     1.6  import java.lang.annotation.Annotation;
     1.7 +import java.util.Arrays;
     1.8  import java.util.Collection;
     1.9  import java.util.Collections;
    1.10 +import java.util.HashSet;
    1.11  import java.util.LinkedList;
    1.12  import java.util.List;
    1.13  import java.util.Set;
    1.14  import javax.annotation.processing.Completion;
    1.15  import javax.annotation.processing.RoundEnvironment;
    1.16 -import javax.annotation.processing.SupportedAnnotationTypes;
    1.17  import javax.annotation.processing.SupportedSourceVersion;
    1.18  import javax.lang.model.SourceVersion;
    1.19  import javax.lang.model.element.AnnotationMirror;
    1.20 @@ -61,9 +62,15 @@
    1.21  import org.openide.util.lookup.ServiceProviders;
    1.22  
    1.23  @SupportedSourceVersion(SourceVersion.RELEASE_6)
    1.24 -@SupportedAnnotationTypes({"org.openide.util.lookup.ServiceProvider", "org.openide.util.lookup.ServiceProviders"})
    1.25  public class ServiceProviderProcessor extends AbstractServiceProviderProcessor {
    1.26  
    1.27 +    public @Override Set<String> getSupportedAnnotationTypes() {
    1.28 +        return new HashSet<String>(Arrays.asList(
    1.29 +            ServiceProvider.class.getCanonicalName(),
    1.30 +            ServiceProviders.class.getCanonicalName()
    1.31 +        ));
    1.32 +    }
    1.33 +
    1.34      /** public for ServiceLoader */
    1.35      public ServiceProviderProcessor() {}
    1.36  
     2.1 --- a/openide.util/src/org/netbeans/modules/openide/util/URLStreamHandlerRegistrationProcessor.java	Fri Oct 30 13:29:24 2009 -0400
     2.2 +++ b/openide.util/src/org/netbeans/modules/openide/util/URLStreamHandlerRegistrationProcessor.java	Fri Oct 30 19:04:50 2009 -0400
     2.3 @@ -40,9 +40,9 @@
     2.4  package org.netbeans.modules.openide.util;
     2.5  
     2.6  import java.net.URLStreamHandler;
     2.7 +import java.util.Collections;
     2.8  import java.util.Set;
     2.9  import javax.annotation.processing.RoundEnvironment;
    2.10 -import javax.annotation.processing.SupportedAnnotationTypes;
    2.11  import javax.annotation.processing.SupportedSourceVersion;
    2.12  import javax.lang.model.SourceVersion;
    2.13  import javax.lang.model.element.Element;
    2.14 @@ -51,11 +51,12 @@
    2.15  import org.openide.util.URLStreamHandlerRegistration;
    2.16  
    2.17  @SupportedSourceVersion(SourceVersion.RELEASE_6)
    2.18 -@SupportedAnnotationTypes({
    2.19 -    "org.openide.util.URLStreamHandlerRegistration"
    2.20 -})
    2.21  public class URLStreamHandlerRegistrationProcessor extends AbstractServiceProviderProcessor {
    2.22  
    2.23 +    public @Override Set<String> getSupportedAnnotationTypes() {
    2.24 +        return Collections.singleton(URLStreamHandlerRegistration.class.getCanonicalName());
    2.25 +    }
    2.26 +
    2.27      public static final String REGISTRATION_PREFIX = "URLStreamHandler/"; // NOI18N
    2.28  
    2.29      /** public for ServiceLoader */