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
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

@ -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
*/
@ -19,7 +19,8 @@ import cpw.mods.fml.common.ModContainer;
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);
}

View File

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