You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2012/06/09 15:28:43 UTC

svn commit: r1348407 - /commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java

Author: mbenson
Date: Sat Jun  9 13:28:43 2012
New Revision: 1348407

URL: http://svn.apache.org/viewvc?rev=1348407&view=rev
Log:
explain suppressed warning

Modified:
    commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java

Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java?rev=1348407&r1=1348406&r2=1348407&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java Sat Jun  9 13:28:43 2012
@@ -214,9 +214,17 @@ public class AnnotationFactory {
          * {@inheritDoc}
          */
         @Override
-        @SuppressWarnings("unchecked")
         public Class<Annotation> getStubType() {
-            return (Class<Annotation>) AnnotationFactory.getStubType();
+            /*
+             * Suppress the warning because we are using this shared object in
+             * a very special, albeit peculiar way, and effectively
+             * hijacking the only place where the generic type of the
+             * instance matters:  namely, providing the type of
+             * Annotation to be stubbed at any given time.
+             */
+            @SuppressWarnings("unchecked")
+            Class<Annotation> result = (Class<Annotation>) AnnotationFactory.getStubType();
+            return result;
         }
 
         /**