@Nonnull
	@SuppressWarnings("unchecked")
	protected Result<R> compile(@Nonnull List<ASTElement> elements, @Nonnull PathNode<?> path) {
		if (elements.isEmpty()) {
			return Result.err(Error.of("No elements to compile", null));
		}
		if (elements.size() != 1) {
			return Result.err(Error.of("Multiple elements to compile", elements.get(1).location()));
		}
		ASTElement element = elements.get(0);

		if (element == null) {
			return Result.err(Error.of("No element to compile", null));
		}

		ClassInfo classInfo = path.getValueOfType(ClassInfo.class);
		if (classInfo == null) {
			return Result.err(Error.of("Dangling member", null));
		}

		C info = (C) classInfo;

		CompilerOptions<? extends CompilerOptions<?>> options = getCompilerOptions();
		options.version(getClassVersion(info))
				.inheritanceChecker(getInheritanceChecker());

		if (element.type() != ElementType.CLASS) {
			options.overlay(getRepresentation(info));

			if (element.type() == ElementType.ANNOTATION) {
				// build annotation path
				String annoPath = "this";
				PathNode<?> parent = path.getParent();
				if (parent instanceof ClassMemberPathNode memberPathNode) {
					annoPath += memberPathNode.isMethod() ? ".method." : ".field.";
					annoPath += memberPathNode.getValue().getName() + ".";
					annoPath += memberPathNode.getValue().getDescriptor();
				}

				Annotated annotated = path.getValueOfType(Annotated.class);

				if (annotated == null) {
					return Result.err(Error.of("Dangling annotation", null));
				}

				AnnotationInfo annotation = (AnnotationInfo) path.getValue();

				annoPath += annotated.getAnnotations().indexOf(annotation);

				options.annotationPath(annoPath);
			}
		}

		Compiler compiler = getCompiler();

		return (Result<R>) compiler.compile(elements, options);
	}
Common pipeline implementation details for all class types.

@param <C>
		Class type which will be assembled.
@param <R>
		Compile return value for JASM {@link Compiler}.
@param <I>
		Class intermediate representation type.

@author Justus Garbe
recaf-core/src/main/java/software/coley/recaf/services/assembler/AbstractAssemblerPipeline.java