Skip to content

Instantly share code, notes, and snippets.

@RainWarrior
Created December 28, 2016 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RainWarrior/5e9cd7d2eebe8600f54c1606f33ce9da to your computer and use it in GitHub Desktop.
Save RainWarrior/5e9cd7d2eebe8600f54c1606f33ce9da to your computer and use it in GitHub Desktop.
private class T extends ClassLoader {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException
{
ClassNode node = readClassNode(name);
// better actual set of default composable contexts
for (MethodNode m: node.methods) {
// set in the list, you know what I mean
m = transform(new WholeMethodContext(m));
}
for (FieldNode f : node.fields) {
f = transform(new WholeFieldContext(f));
}
node = transform(new FullClassContext(node));
return makeClass(node);
}
void transform(IContext c) {
if(moreThan1Transformer(c)) {
throw new IllegalStateException();
}
if(oneTransformer(c)) {
getTransformer(c).run(c);
}
}
}
class FancyPredicateMethodContext implements ITransformer {
// defines its own set of sub-method contexts, loads all of them and does things to manage conflicts inside run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment