AppliedSomehowPatch (CharSequence text, List<? extends PatchHunk> hunks) { String patchedText = PlainSimplePatchApplier.apply(text, hunks); if (patchedText != null) { return new AppliedSomehowPatch(patchedText, SUCCESS, false); } GenericPatchApplier applier = new GenericPatchApplier(text, hunks); boolean success = applier.execute(); if (!success) applier.trySolveSomehow(); return new AppliedSomehowPatch(applier.getAfter(), applier.getStatus(), !success); }