use of java.lang.reflect.MalformedParametersException in project graal by oracle.
the class VerifyGetOptionsUsage method verify.
@Override
protected boolean verify(StructuredGraph graph, PhaseContext context) {
MetaAccessProvider metaAccess = context.getMetaAccess();
ResolvedJavaType canonicalizerToolClass = metaAccess.lookupJavaType(CanonicalizerTool.class);
boolean hasTool = false;
try {
for (ResolvedJavaMethod.Parameter parameter : graph.method().getParameters()) {
if (parameter.getType().getName().equals(canonicalizerToolClass.getName())) {
hasTool = true;
break;
}
}
} catch (MalformedParametersException e) {
// Lambdas sometimes have malformed parameters so ignore this.
}
if (hasTool) {
ResolvedJavaMethod getOptionsMethod = metaAccess.lookupJavaMethod(lookupMethod(Node.class, "getOptions"));
for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
ResolvedJavaMethod callee = t.targetMethod();
if (callee.equals(getOptionsMethod)) {
if (hasTool) {
throw new VerificationError("Must use CanonicalizerTool.getOptions() instead of Node.getOptions() in method '%s' of class '%s'.", graph.method().getName(), graph.method().getDeclaringClass().getName());
}
}
}
}
return true;
}
use of java.lang.reflect.MalformedParametersException in project jdk8u_jdk by JetBrains.
the class BadClassFiles method assertBadParameters.
public void assertBadParameters(Class<?> cls) throws NoSuchMethodException {
try {
System.err.println("Trying " + cls);
final Method method = cls.getMethod("m", int.class, int.class);
final Parameter[] params = method.getParameters();
System.err.println("Name " + params[0].getName());
System.err.println("Did not see expected exception");
errors++;
} catch (MalformedParametersException e) {
System.err.println("Expected exception seen");
}
}
Aggregations