use of org.neo4j.codegen.ByteCodes in project neo4j by neo4j.
the class ByteCodeVerifier method check.
/**
* Check the bytecode from one round of bytecode generation.
*
* @param classpathLoader
* the ClassLoader to use for loading classes from the classpath.
* @param byteCodes
* the bytecodes generated in this round.
* @throws CompilationFailureException
* if any issue is discovered in the verification.
*/
@Override
public void check(ClassLoader classpathLoader, Collection<ByteCodes> byteCodes) throws CompilationFailureException {
List<ClassNode> classes = new ArrayList<>(byteCodes.size());
List<Failure> failures = new ArrayList<>();
// load (and verify) the structure of the generated classes
for (ByteCodes byteCode : byteCodes) {
try {
classes.add(classNode(byteCode.bytes()));
} catch (Exception e) {
failures.add(new Failure(e, e.toString()));
}
}
// we are not going to be able to verify their methods
if (!failures.isEmpty()) {
throw compilationFailure(failures);
}
// continue with verifying the methods of the classes
AssignmentChecker check = new AssignmentChecker(classpathLoader, classes);
for (ClassNode clazz : classes) {
verify(check, clazz, failures);
}
if (!failures.isEmpty()) {
throw compilationFailure(failures);
}
}
Aggregations