use of org.springframework.cglib.core.CodeEmitter in project spring-framework by spring-projects.
the class Enhancer method emitConstructors.
private void emitConstructors(ClassEmitter ce, List constructors) {
boolean seenNull = false;
for (Iterator it = constructors.iterator(); it.hasNext(); ) {
MethodInfo constructor = (MethodInfo) it.next();
if (currentData != null && !"()V".equals(constructor.getSignature().getDescriptor())) {
continue;
}
CodeEmitter e = EmitUtils.begin_method(ce, constructor, Constants.ACC_PUBLIC);
e.load_this();
e.dup();
e.load_args();
Signature sig = constructor.getSignature();
seenNull = seenNull || sig.getDescriptor().equals("()V");
e.super_invoke_constructor(sig);
if (currentData == null) {
e.invoke_static_this(BIND_CALLBACKS);
if (!interceptDuringConstruction) {
e.load_this();
e.push(1);
e.putfield(CONSTRUCTED_FIELD);
}
}
e.return_value();
e.end_method();
}
if (!classOnly && !seenNull && arguments == null)
throw new IllegalArgumentException("Superclass has no null constructors but no arguments were given");
}
use of org.springframework.cglib.core.CodeEmitter in project spring-framework by spring-projects.
the class Enhancer method emitNewInstanceCallback.
private void emitNewInstanceCallback(ClassEmitter ce) {
CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, SINGLE_NEW_INSTANCE, null);
switch(callbackTypes.length) {
case 0:
// TODO: make sure Callback is null
break;
case 1:
// for now just make a new array; TODO: optimize
e.push(1);
e.newarray(CALLBACK);
e.dup();
e.push(0);
e.load_arg(0);
e.aastore();
e.invoke_static(getThisType(e), SET_THREAD_CALLBACKS, false);
break;
default:
e.throw_exception(ILLEGAL_STATE_EXCEPTION, "More than one callback object required");
}
emitCommonNewInstance(e);
}
use of org.springframework.cglib.core.CodeEmitter in project spring-framework by spring-projects.
the class Enhancer method emitSetThreadCallbacks.
private void emitSetThreadCallbacks(ClassEmitter ce) {
CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC | Constants.ACC_STATIC, SET_THREAD_CALLBACKS, null);
e.getfield(THREAD_CALLBACKS_FIELD);
e.load_arg(0);
e.invoke_virtual(THREAD_LOCAL, THREAD_LOCAL_SET);
e.return_value();
e.end_method();
}
Aggregations