use of soot.SootMethod in project robovm by robovm.
the class TrampolineCompiler method checkMemberAccessible.
private boolean checkMemberAccessible(Function f, Trampoline t, ClassMember member) {
Clazz caller = config.getClazzes().load(t.getCallingClass());
Clazz target = config.getClazzes().load(member.getDeclaringClass().getName().replace('.', '/'));
String runtimeClassName = null;
runtimeClassName = t instanceof Invokevirtual ? ((Invokevirtual) t).getRuntimeClass() : runtimeClassName;
runtimeClassName = t instanceof Invokespecial ? ((Invokespecial) t).getRuntimeClass() : runtimeClassName;
runtimeClassName = t instanceof GetField ? ((GetField) t).getRuntimeClass() : runtimeClassName;
runtimeClassName = t instanceof PutField ? ((PutField) t).getRuntimeClass() : runtimeClassName;
SootClass runtimeClass = null;
if (runtimeClassName != null && !isArray(runtimeClassName)) {
Clazz c = config.getClazzes().load(runtimeClassName);
if (c == null) {
// just return true here.
return true;
}
runtimeClass = c.getSootClass();
}
if (Access.checkMemberAccessible(member, caller, target, runtimeClass)) {
return true;
}
if (member instanceof SootMethod) {
SootMethod method = (SootMethod) member;
throwIllegalAccessError(f, ILLEGAL_ACCESS_ERROR_METHOD, method.getDeclaringClass(), method.getName(), getDescriptor(method), caller.getSootClass());
} else {
SootField field = (SootField) member;
throwIllegalAccessError(f, ILLEGAL_ACCESS_ERROR_FIELD, field.getDeclaringClass(), field.getName(), caller.getSootClass());
}
f.add(new Unreachable());
return false;
}
use of soot.SootMethod in project robovm by robovm.
the class ObjCBlockPluginTest method testParseTargetMethodAnnotationsInvalid3.
@Test(expected = CompilerException.class)
public void testParseTargetMethodAnnotationsInvalid3() throws Exception {
SootMethod m = toSootClass(Runners.class).getMethodByName("runner1");
ObjCBlockPlugin.parseTargetMethodAnnotations(m, 0, "garbage");
}
use of soot.SootMethod in project robovm by robovm.
the class ObjCBlockPluginTest method testParseTargetMethodAnnotationsInvalid1.
@Test(expected = CompilerException.class)
public void testParseTargetMethodAnnotationsInvalid1() throws Exception {
SootMethod m = toSootClass(Runners.class).getMethodByName("runner1");
ObjCBlockPlugin.parseTargetMethodAnnotations(m, 0, "(");
}
use of soot.SootMethod in project robovm by robovm.
the class ObjCBlockPluginTest method testResolveTargetMethodSignatureGenericWithUnresolvedDirectTypeVariable.
@Test(expected = CompilerException.class)
public void testResolveTargetMethodSignatureGenericWithUnresolvedDirectTypeVariable() throws Exception {
SootMethod target = toSootClass(F.class).getMethodByName("run");
SootMethod m = toSootClass(Runners.class).getMethodByName("runner8");
SootMethodType mType = new SootMethodType(m);
ObjCBlockPlugin.resolveTargetMethodSignature(m, target, mType.getGenericParameterTypes()[0]);
}
use of soot.SootMethod in project robovm by robovm.
the class MarshalerLookupTest method testFindMarshalerStructMemberUnsupportedArrayDimension.
@Test
public void testFindMarshalerStructMemberUnsupportedArrayDimension() {
MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
SootMethod getter = toSootClass(TestStruct.class).getMethodByName("getV6");
SootMethod setter = toSootClass(TestStruct.class).getMethodByName("setV6");
try {
lookup.findMarshalerMethod(new MarshalSite(getter)).getMethod();
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
}
try {
lookup.findMarshalerMethod(new MarshalSite(setter, 0)).getMethod();
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
}
}
Aggregations