@Nonnull
	public ExpressionResult compile(@Nonnull String expression) {
		// Generate source of a class to house the expression within
		ExpressionHostingClassStubGenerator stubber;
		String code;
		try {
			stubber = new ExpressionHostingClassStubGenerator(workspace, classAccess, className, superName, implementing,
					fields, methods, innerClasses, methodFlags, methodName, methodType, methodVariables, expression);
			code = stubber.generate();
		} catch (ExpressionCompileException ex) {
			return new ExpressionResult(ex);
		}

		// Compile the generated class
		JavacArguments arguments = new JavacArguments(className, code, null, Math.max(versionTarget, JavacCompiler.getMinTargetVersion()), -1, true, false, false);
		CompilerResult result = javac.compile(arguments, workspace, null);
		if (!result.wasSuccess()) {
			Throwable exception = result.getException();
			if (exception != null)
				return new ExpressionResult(new ExpressionCompileException(exception, "Compilation task encountered an error"));
			List<CompilerDiagnostic> diagnostics = result.getDiagnostics();
			if (!diagnostics.isEmpty())
				return new ExpressionResult(remap(code, diagnostics));
		}
		byte[] klass = result.getCompilations().get(className);
		if (klass == null)
			return new ExpressionResult(new ExpressionCompileException("Compilation results missing the generated expression class"));

		// Convert the compiled class to JASM
		try {
			PrintContext<?> context = new PrintContext<>(assemblerConfig.getDisassemblyIndent().getValue());
			context.setLabelPrefix("g");
			JvmClassPrinter printer = new JvmClassPrinter(new ByteArrayInputStream(klass));
			MethodPrinter method = printer.method(stubber.getAdaptedMethodName(), stubber.methodDescriptorWithVariables());
			if (method == null)
				return new ExpressionResult(new ExpressionCompileException("Target method was not in generated class"));
			method.print(context);
			return new ExpressionResult(context.toString());
		} catch (IOException ex) {
			return new ExpressionResult(new ExpressionCompileException(ex, "Failed to print generated class"));
		} catch (ExpressionCompileException ex) {
			return new ExpressionResult(ex);
		}
	}
Compiles the given expression with the current context.

@param expression
		Expression to compile.

@return Expression compilation result.

@see #setClassContext(JvmClassInfo) For allowing access to a class's fields/methods/inheritance.
@see #setMethodContext(MethodMember) For allowing access to a method's parameters & other local variables.
recaf-core/src/main/java/software/coley/recaf/services/assembler/ExpressionCompiler.java