LUCENE-2510, LUCENE-4044: Nuke generics completely - Java 7 bug?

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1365602 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-07-25 14:35:02 +00:00
parent 142d3c788f
commit f7b94431d5
1 changed files with 4 additions and 5 deletions

View File

@ -374,7 +374,7 @@ public class SolrResourceLoader implements ResourceLoader
private static final Map<String, String> classNameCache = new ConcurrentHashMap<String, String>();
// A static map of AnalysisSPILoaders, keyed by ClassLoader used (because it can change during Solr lifetime) and expected base class:
private static final WeakIdentityMap<ClassLoader, Map<Class<?>,AnalysisSPILoader<?>>> expectedTypesSPILoaders = WeakIdentityMap.newConcurrentHashMap();
private static final WeakIdentityMap<ClassLoader, Map<Class,AnalysisSPILoader>> expectedTypesSPILoaders = WeakIdentityMap.newConcurrentHashMap();
// Using this pattern, legacy analysis components from previous Solr versions are identified and delegated to SPI loader:
private static final Pattern legacyAnalysisPattern =
@ -412,16 +412,15 @@ public class SolrResourceLoader implements ResourceLoader
if (m.matches()) {
log.trace("Trying to load class from analysis SPI");
// retrieve the map of classLoader -> expectedType -> SPI from cache / regenerate cache
Map<Class<?>,AnalysisSPILoader<?>> spiLoaders = expectedTypesSPILoaders.get(classLoader);
Map<Class,AnalysisSPILoader> spiLoaders = expectedTypesSPILoaders.get(classLoader);
if (spiLoaders == null) {
spiLoaders = new IdentityHashMap<Class<?>,AnalysisSPILoader<?>>(3);
spiLoaders = new IdentityHashMap<Class,AnalysisSPILoader>(3);
spiLoaders.put(CharFilterFactory.class, CharFilterFactory.getSPILoader(classLoader));
spiLoaders.put(TokenizerFactory.class, TokenizerFactory.getSPILoader(classLoader));
spiLoaders.put(TokenFilterFactory.class, TokenFilterFactory.getSPILoader(classLoader));
expectedTypesSPILoaders.put(classLoader, spiLoaders);
}
@SuppressWarnings("unchecked") final AnalysisSPILoader<? extends T> loader =
(AnalysisSPILoader<? extends T>) spiLoaders.get(expectedType);
final AnalysisSPILoader loader = spiLoaders.get(expectedType);
if (loader != null) {
// it's a correct expected type for analysis! Let's go on!
try {