commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1348407 - /commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
Date Sat, 09 Jun 2012 13:28:43 GMT
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;
         }
 
         /**



Mime
View raw message