@Override protected synchronized CtClass get0(String className, boolean useCache) throws NotFoundException { if (!exclude(className)) { if (isSrg) { CtClass cachedClass = srgClasses.get(className); if (cachedClass != null) { return cachedClass; } cachedClass = super.getCached(className); if (cachedClass != null && cachedClass.isPrimitive()) { return cachedClass; } if (!Transformer.remapClassName(className).equals(className)) { Log.severe("Attempted to load obfuscated class " + className, new Throwable()); return null; } String remappedName = Transformer.unmapClassName(className); byte[] bytes = getBytes(remappedName); if (bytes != null) { bytes = Transformer.transform(bytes); try { CtClass ctClass = new CtClassType(new ByteArrayInputStream(bytes), this); if (!remappedName.equals(className)) { ctClass.freeze(); } srgClasses.put(className, ctClass); return ctClass; } catch (IOException e) { Log.severe("Failed to make " + className + " from " + remappedName, e); } return null; } } else { if (!Transformer.unmapClassName(className).equals(className)) { Log.severe( "Attempted to load SRG class " + className + " while patching a non-SRG class.", new Throwable()); return null; } } } CtClass clazz; if (useCache) { clazz = getCached(className); if (clazz != null) { return clazz; } } clazz = createCtClass(className, useCache); if (clazz != null) { // clazz.getName() != classname if classname is "[L<name>;". if (useCache) { cacheCtClass(clazz.getName(), clazz, false); } } return clazz; }
@Override public CtClass getCached(String className) { if (isSrg && !exclude(className)) { return srgClasses.get(className); } return super.getCached(className); }
public void markChanged(final String className) { srgClasses.remove(className); }