@Nonnull
	private GenerateResult generateStandardClass(@Nonnull String source) {
		String originalSource = source;

		// Extract package name
		String packageName = SCRIPT_PACKAGE_NAME;
		Matcher matcher = RegexUtil.getMatcher(PATTERN_PACKAGE, source);
		if (matcher.find())
			packageName = matcher.group(1);
		else
			source = "package " + packageName + ";\n" + source;

		// Add default imports
		String imports = "\nimport " + String.join(";\nimport ", DEFAULT_IMPORTS) + ";\n";
		source = StringUtil.insert(source, source.indexOf(packageName + ";") + packageName.length() + 1, imports);

		// Normalize package name
		packageName = packageName.replace('.', '/');

		// Extract class name
		String className;
		matcher = RegexUtil.getMatcher(PATTERN_CLASS_NAME, source);
		if (matcher.find()) {
			String originalName = matcher.group(1);
			String modifiedName = originalName + Math.abs(source.hashCode());
			className = packageName + "/" + modifiedName;

			// Replace name in script
			//  - Class definition
			//  - Constructors
			source = StringUtil.replaceRange(source, matcher.start(1), matcher.end(1), modifiedName);
			source = source.replace(" " + originalName + "(", " " + modifiedName + "(");
			source = source.replace("\t" + originalName + "(", "\t" + modifiedName + "(");
		} else {
			return new GenerateResult(null, List.of(
					new CompilerDiagnostic(-1, -1, 0,
							"Could not determine name of class", CompilerDiagnostic.Level.ERROR)));
		}

		// Compile the class
		return generate(className, originalSource, source);
	}
Used when the script contains a class definition in itself.
Adds the default script package name, if no package is defined.

@param source
		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