use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class ProxyGeneratorAdapter method visit.
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
Set<String> interfacesSet = new LinkedHashSet<String>();
if (interfaces != null)
Collections.addAll(interfacesSet, interfaces);
for (Class extraInterface : classList) {
if (extraInterface.isInterface())
interfacesSet.add(BytecodeHelper.getClassInternalName(extraInterface));
}
final boolean addGroovyObjectSupport = !GroovyObject.class.isAssignableFrom(superClass);
if (addGroovyObjectSupport)
interfacesSet.add("groovy/lang/GroovyObject");
if (generateDelegateField) {
classList.add(GeneratedGroovyProxy.class);
interfacesSet.add("groovy/lang/GeneratedGroovyProxy");
}
super.visit(V1_5, ACC_PUBLIC, proxyName, signature, BytecodeHelper.getClassInternalName(superClass), interfacesSet.toArray(new String[interfacesSet.size()]));
visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
addDelegateFields();
if (addGroovyObjectSupport) {
createGroovyObjectSupport();
}
for (Class clazz : classList) {
visitClass(clazz);
}
}
use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class MethodFailureTest method testMethodWhichCallsTheFailingMethodInsideAClosure.
public void testMethodWhichCallsTheFailingMethodInsideAClosure() {
MockGroovyObject object = new MockGroovyObject();
try {
object.invokeMethod("callClosure", new Closure(this) {
protected Object doCall(GroovyObject object) {
return object.invokeMethod("nonExistentMethod", "hello");
}
});
fail("Should have thrown an exception");
} catch (GroovyRuntimeException e) {
System.out.println(e);
//e.printStackTrace();
}
}
use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class RunClosureTest method testBytecode2Bug.
public void testBytecode2Bug() throws Exception {
GroovyObject object = compile("src/test/groovy/bugs/Bytecode2Bug.groovy");
object.invokeMethod("testTedsBytecodeBug", null);
}
use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class RunClosureTest method testZoharsBug.
public void testZoharsBug() throws Exception {
GroovyObject object = compile("src/test/groovy/bugs/ZoharsBug.groovy");
object.invokeMethod("testBug", null);
}
use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class RunClosureTest method testBytecodeBug.
public void testBytecodeBug() throws Exception {
GroovyObject object = compile("src/test/groovy/bugs/BytecodeBug.groovy");
object.invokeMethod("testTedsBytecodeBug", null);
}
Aggregations