commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1088085 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
Date Sat, 02 Apr 2011 18:58:05 GMT
Author: simonetripodi
Date: Sat Apr  2 18:58:04 2011
New Revision: 1088085

URL: http://svn.apache.org/viewvc?rev=1088085&view=rev
Log:
fixed "type parameters of <T>T cannot be determined" compiler issue

Modified:
    commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java

Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java?rev=1088085&r1=1088084&r2=1088085&view=diff
==============================================================================
--- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
(original)
+++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
Sat Apr  2 18:58:04 2011
@@ -367,7 +367,8 @@ public class DiscoverSingleton {
     {
         ClassLoader contextLoader = JDKHooks.getJDKHooks().getThreadContextClassLoader();
 
-        T obj = get(contextLoader, spi.getSPName());
+        @SuppressWarnings("unchecked") // spiName is assignable from stored object class
+        T obj = (T) get(contextLoader, spi.getSPName());
 
         if (obj == null) {
             try {
@@ -455,15 +456,13 @@ public class DiscoverSingleton {
     /**
      * Get service keyed by spi & classLoader.
      */
-    private static synchronized <T> T get(ClassLoader classLoader,
+    private static synchronized Object get(ClassLoader classLoader,
                                            String spiName)
     {
         Map<String, Object> spis = EnvironmentCache.get(classLoader);
         
         if (spis != null) {
-            @SuppressWarnings("unchecked") // spiName is assignable from stored object class
-            T t = (T) spis.get(spiName);
-            return t;
+            return spis.get(spiName);
         }
         return null;
     }



Mime
View raw message