@Nonnull
	public static List<Diff> diff(@Nonnull String a, @Nonnull String b) {
		int[] newlineOffsetsA = computeNewlineOffsets(a);
		int[] newlineOffsetsB = computeNewlineOffsets(b);
		List<String> aa = Arrays.asList(StringUtil.splitNewline(a));
		List<String> bb = Arrays.asList(StringUtil.splitNewline(b));
		Patch<String> stringPatch = DiffUtils.diff(aa, bb);
		List<Diff> diffs = new ArrayList<>();
		for (AbstractDelta<String> delta : stringPatch.getDeltas()) {
			if (delta.getType() == DeltaType.EQUAL)
				continue;
			int newlineStartA = delta.getSource().getPosition();
			int newlineStartB = delta.getTarget().getPosition();
			int offsetStartA = newlineOffsetsA[newlineStartA];
			int offsetStartB = newlineOffsetsB[newlineStartB];
			int offsetEndA = newlineOffsetsA[Math.max(newlineStartA + 1, delta.getSource().last() + 1)];
			int offsetEndB = newlineOffsetsB[Math.max(newlineStartB + 1, delta.getTarget().last() + 1)];
			String contentA = a.substring(offsetStartA, offsetEndA);
			String contentB = b.substring(offsetStartB, offsetEndB);

			// Shrink difference by trimming out the common prefix and suffix.
			String commonPrefix = StringUtil.getCommonPrefix(contentA, contentB);
			if (!commonPrefix.isEmpty()) {
				int common = commonPrefix.length();
				offsetStartA += common;
				offsetStartB += common;
				contentA = contentA.substring(common);
				contentB = contentB.substring(common);
			}
			String commonSuffix = StringUtil.getCommonSuffix(contentA, contentB);
			if (!commonSuffix.isEmpty()) {
				int common = commonSuffix.length();
				offsetEndA -= common;
				offsetEndB -= common;
				contentA = contentA.substring(0, contentA.length() - common);
				contentB = contentB.substring(0, contentB.length() - common);
			}

			// Compute the diff type. It will have changed from what JGit reports if our
			// shrinking has shrunk either 'A' or 'B' to an empty string.
			DiffType type = DiffType.from(delta.getType());
			if (contentA.isEmpty() && !contentB.isEmpty())
				type = DiffType.INSERT;
			else if (!contentA.isEmpty() && contentB.isEmpty())
				type = DiffType.REMOVE;

			// Add our mapped diff.
			diffs.add(new Diff(type, offsetStartA, offsetStartB, offsetEndA, offsetEndB, contentA, contentB));
		}
		return diffs;
	}
@param a
		Input.
@param b
		Modified input.

@return Diffs from {@code a} --> {@code b}.
recaf-core/src/main/java/software/coley/recaf/util/StringDiff.java