[Demonstration 1]

[Buggy Method]
public Object call(LanguageContext lcx, Object thisObj, Object... args) {
    Declaration argmax = null;
    int max = 0;
    Function[] argmaxConverters = new Function[args.length];
    Function[] converters = new Function[args.length];
    int argMaxOffset = 0;
    for (int i = 0; i < args.length; ++i) {
        if (args[i] instanceof Wrapper) {
            args[i] = ((Wrapper) args[i]).unwrap();
        }
    }
    int n = 0;
    for (Declaration method : declarations()) {
        ++n;
        MutableInt offset = new MutableInt(0);
        int score = score(lcx, method, args, converters, offset, false);
        if (score > max) {
            max = score;
            argmax = method;
            Function[] tmp = argmaxConverters;
            argMaxOffset = offset.intValue();
            argmaxConverters = converters;
            converters = tmp;
        }
    }
    if (argmax == null) {
        String context = "";
        if (thisObj instanceof JSBaseObject) {
            context = " in an object of class " + ((JSBaseObject) thisObj).getClassName();
        }
        // Print the best matching methods
        ScoredDeclaration[] scoredDeclarations = new ScoredDeclaration[n];
        int i = 0;
        for (Declaration declaration : declarations()) {
            MutableInt offset = new MutableInt(0);
            scoredDeclarations[i++] = new ScoredDeclaration(declaration, score(lcx, declaration, args, converters, offset, true));
        }
        Arrays.sort(scoredDeclarations, (a, b) -> Integer.compare(a.score, b.score));
        final Logger logger = ScriptContext.get().getMainLogger();
        final String message = String.format("Could not find a matching method for %s(%s)%s", getKey(), Output.toString(", ", args, o -> o.getClass().toString()), context);
        logger.error(message);
        logger.error("Candidates are:");
        for (ScoredDeclaration scoredDeclaration : scoredDeclarations) {
            logger.error("%s", scoredDeclaration.method);
        }
        throw ScriptRuntime.typeError(message);
    }
    // Call the constructor
    try {
        Object[] transformedArgs = transform(lcx, argmax, args, argmaxConverters, argMaxOffset);
        // Show deprecated methods
        if (argmax.executable.getAnnotation(Deprecated.class) != null) {
            final Logger logger = ScriptContext.get().getMainLogger();
            logger.warn("In %s", lcx.getScriptLocation());
            logger.warn("Method %s is deprecated", argmax);
        }
        final Object result = argmax.invoke(lcx, transformedArgs);
        return result;
    } catch (InvocationTargetException e) {
        if (e.getCause() instanceof XPMRhinoException) {
            throw (XPMRhinoException) e.getCause();
        }
        throw new WrappedException(new XPMRhinoException(e.getCause()));
    } catch (RuntimeException e) {
        throw e;
    } catch (Throwable e) {
        throw new WrappedException(new XPMRhinoException(e));
    }
}

[Buggy Hunk]
logger.error("%s", scoredDeclaration.method);

[Patch]
logger.error("[%d] %s", scoredDeclaration.score, scoredDeclaration.method);

[Demonstration 2]

[Buggy Method]
private void validate(Method method) {
    String procedureName = NetconfUtil.getName(method);
    if (procedures.containsKey(procedureName)) {
        Method existentProcedure = procedures.get(procedureName);
        throw new IllegalArgumentException(String.format("%s method with %s name is " + "already defined in %s method", method, procedureName, existentProcedure));
    }
    procedures.put(procedureName, method);
}

[Buggy Hunk]
private void validate(Method method) {

[Patch]
private void validate(final Method method) {

[Demonstration 3]

[Buggy Method]
@Override
public StringTooltips getToolTip() {
    StringTooltips out = new StringTooltips();
    out.add("Growtime: " + Buff.getDurationText((growTime - getLevel().getWorldEntity().getWorldTime()) / 1000f));
    return out;
}

[Buggy Hunk]
out.add("Growtime: " + Buff.getDurationText((growTime - getLevel().getWorldEntity().getWorldTime()) / 1000f));

[Patch]
out.add("Growtime: " + ActiveBuff.getDurationText((growTime - getLevel().getWorldEntity().getWorldTime()) / 1000f));