diff --git a/common/cpw/mods/fml/common/FMLModContainer.java b/common/cpw/mods/fml/common/FMLModContainer.java index 498226dfdb..f92ebb7c44 100644 --- a/common/cpw/mods/fml/common/FMLModContainer.java +++ b/common/cpw/mods/fml/common/FMLModContainer.java @@ -54,6 +54,7 @@ import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Metadata; import cpw.mods.fml.common.discovery.ASMDataTable; import cpw.mods.fml.common.discovery.ASMDataTable.ASMData; +import cpw.mods.fml.common.discovery.ModCandidate; import cpw.mods.fml.common.event.FMLConstructionEvent; import cpw.mods.fml.common.event.FMLEvent; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -112,11 +113,13 @@ public class FMLModContainer implements ModContainer private ILanguageAdapter languageAdapter; private ListMultimap,Method> eventMethods; private Map customModProperties; + private ModCandidate candidate; - public FMLModContainer(String className, File modSource, Map modDescriptor) + public FMLModContainer(String className, ModCandidate container, Map modDescriptor) { this.className = className; - this.source = modSource; + this.source = container.getModContainer(); + this.candidate = container; this.descriptor = modDescriptor; this.modLanguage = (String) modDescriptor.get("modLanguage"); this.languageAdapter = "scala".equals(modLanguage) ? new ILanguageAdapter.ScalaAdapter() : new ILanguageAdapter.JavaAdapter(); @@ -454,6 +457,7 @@ public class FMLModContainer implements ModContainer { ModClassLoader modClassLoader = event.getModClassLoader(); modClassLoader.addFile(source); + modClassLoader.clearNegativeCacheFor(candidate.getClassList()); Class clazz = Class.forName(className, true, modClassLoader); Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates(); diff --git a/common/cpw/mods/fml/common/ModClassLoader.java b/common/cpw/mods/fml/common/ModClassLoader.java index 734a3743c2..d63c804695 100644 --- a/common/cpw/mods/fml/common/ModClassLoader.java +++ b/common/cpw/mods/fml/common/ModClassLoader.java @@ -18,6 +18,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.List; +import java.util.Set; import java.util.logging.Level; import net.minecraft.launchwrapper.IClassTransformer; @@ -100,4 +101,9 @@ public class ModClassLoader extends URLClassLoader accessTransformer.ensurePublicAccessFor(modClazzName); return (Class) Class.forName(modClazzName, true, this); } + + public void clearNegativeCacheFor(Set classList) + { + mainClassLoader.clearNegativeEntries(classList); + } } diff --git a/common/cpw/mods/fml/common/ModContainerFactory.java b/common/cpw/mods/fml/common/ModContainerFactory.java index f1093bc14d..4899296ef4 100644 --- a/common/cpw/mods/fml/common/ModContainerFactory.java +++ b/common/cpw/mods/fml/common/ModContainerFactory.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -61,7 +61,7 @@ public class ModContainerFactory if (ann.getASMType().equals(Type.getType(Mod.class))) { FMLLog.fine("Identified an FMLMod type mod %s", className); - return new FMLModContainer(className, modSource, ann.getValues()); + return new FMLModContainer(className, container, ann.getValues()); } } diff --git a/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java b/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java index 4cee4451f9..cf22b6c0e1 100644 --- a/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java +++ b/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -98,6 +98,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer FileInputStream fis = new FileInputStream(file); modParser = new ASMModParser(fis); fis.close(); + candidate.addClassEntry(path+file.getName()); } catch (LoaderException e) { diff --git a/common/cpw/mods/fml/common/discovery/JarDiscoverer.java b/common/cpw/mods/fml/common/discovery/JarDiscoverer.java index f7b33fc632..ecc79c5a6c 100644 --- a/common/cpw/mods/fml/common/discovery/JarDiscoverer.java +++ b/common/cpw/mods/fml/common/discovery/JarDiscoverer.java @@ -70,6 +70,7 @@ public class JarDiscoverer implements ITypeDiscoverer try { modParser = new ASMModParser(jar.getInputStream(ze)); + candidate.addClassEntry(ze.getName()); } catch (LoaderException e) { diff --git a/common/cpw/mods/fml/common/discovery/ModCandidate.java b/common/cpw/mods/fml/common/discovery/ModCandidate.java index 9263e0910e..172526116f 100644 --- a/common/cpw/mods/fml/common/discovery/ModCandidate.java +++ b/common/cpw/mods/fml/common/discovery/ModCandidate.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -14,8 +14,10 @@ package cpw.mods.fml.common.discovery; import java.io.File; import java.util.List; +import java.util.Set; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.ModContainer; @@ -31,6 +33,7 @@ public class ModCandidate private List baseModTypes = Lists.newArrayList(); private boolean isMinecraft; private List baseModCandidateTypes = Lists.newArrayListWithCapacity(1); + private Set foundClasses = Sets.newHashSet(); public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType) { @@ -73,6 +76,12 @@ public class ModCandidate } } + public void addClassEntry(String name) + { + String className = name.substring(0, name.lastIndexOf('.')).replace('.', '/'); // strip the .class and . -> / + foundClasses.add(className); + } + public boolean isClasspath() { return classpath; @@ -93,4 +102,8 @@ public class ModCandidate { baseModCandidateTypes.add(modParser); } + public Set getClassList() + { + return foundClasses; + } }