Cherry pick some changes from 1.8 for inner class discovery, also fix the negativecache. Closes #1872

This commit is contained in:
cpw 2015-07-18 12:47:31 -04:00
parent 0f456b4684
commit c308a47124
3 changed files with 5 additions and 4 deletions

View File

@ -38,7 +38,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
@Override @Override
public boolean accept(File file) public boolean accept(File file)
{ {
return (file.isFile() && classFile.matcher(file.getName()).find()) || file.isDirectory(); return (file.isFile() && classFile.matcher(file.getName()).matches()) || file.isDirectory();
} }
} }

View File

@ -19,7 +19,8 @@ import cpw.mods.fml.common.ModContainer;
public interface ITypeDiscoverer public interface ITypeDiscoverer
{ {
public static Pattern classFile = Pattern.compile("([^\\s$]+).class$"); // main class part, followed by an optional $ and an "inner class" part. $ cannot be last, otherwise scala breaks
public static Pattern classFile = Pattern.compile("[^\\s\\$]+(\\$[^\\s]+)?\\.class$");
public List<ModContainer> discover(ModCandidate candidate, ASMDataTable table); public List<ModContainer> discover(ModCandidate candidate, ASMDataTable table);
} }

View File

@ -80,7 +80,7 @@ public class ModCandidate
public void addClassEntry(String name) public void addClassEntry(String name)
{ {
String className = name.substring(0, name.lastIndexOf('.')); // strip the .class String className = name.substring(0, name.lastIndexOf('.')); // strip the .class
foundClasses.add(className.replace('.', '/')); foundClasses.add(className);
className = className.replace('/','.'); className = className.replace('/','.');
int pkgIdx = className.lastIndexOf('.'); int pkgIdx = className.lastIndexOf('.');
if (pkgIdx > -1) if (pkgIdx > -1)