@Nonnull
	private GenerateResult generateScriptClass(@Nonnull String className, @Nonnull String script) {
		String originalSource = script;
		Set<String> imports = new HashSet<>(DEFAULT_IMPORTS);
		Matcher matcher = RegexUtil.getMatcher(PATTERN_IMPORT, script);
		while (matcher.find()) {
			// Record import statement
			String importIdentifier = matcher.group(1);
			imports.add(importIdentifier);

			// Replace text with spaces to maintain script character offsets
			String importMatch = script.substring(matcher.start(), matcher.end());
			script = script.replace(importMatch, " ".repeat(importMatch.length()));
		}

		// Create code (just a basic class with a static 'run' method)
		StringBuilder code = new StringBuilder(
				"@Dependent public class " + className + " implements Runnable, Opcodes { " +
						"private static final Logger log = Logging.get(\"script\"); " +
						"Workspace workspace; " +
						"@Inject " + className +"(Workspace workspace) { this.workspace = workspace; } " +
						"public void run() {\n" + script + "\n" + "}" +
						"}");
		for (String imp : imports)
			code.insert(0, "import " + imp + "; ");
		code.insert(0, "package " + SCRIPT_PACKAGE_NAME + "; ");
		className = SCRIPT_PACKAGE_NAME.replace('.', '/') + "/" + className;

		// Compile the class
		return generate(className, originalSource, code.toString());
	}
Used when the script immediately starts with the code.
This will wrap that content in a basic class.

@param className
		Name of the script class.
@param script
		Initial source of the script.

@return Compiler result wrapper containing the loaded class reference.
recaf-core/src/main/java/software/coley/recaf/services/script/JavacScriptEngine.java