diff --git a/framework/bug-mining/Patch-Minimization-Guide.md b/framework/bug-mining/Patch-Minimization-Guide.md index b72aa1fdd..e7e2e316e 100644 --- a/framework/bug-mining/Patch-Minimization-Guide.md +++ b/framework/bug-mining/Patch-Minimization-Guide.md @@ -261,7 +261,7 @@ Code refactoring may consist of one or more of the following: ### 2. Compiler directives and annotations -1. __Changes made to import statements that are not relevant to the bug fix should be removed__ +1. __Changes made to import statements that are not relevant to the bug fix should be removed__ Although removing changes involving import statements might create new warnings of `unused import statements`, import statements would not communicate anything about the bug or the bug fix since they would only be necessary to support functions. It is also worth noting that these import statements could be completely removed by using the fully qualified function names. 2. __Changes made to @override statements can be removed under some circumstances__ diff --git a/framework/projects/Cli/patches/3.src.patch b/framework/projects/Cli/patches/3.src.patch index bce663cc6..f2bf9234e 100644 --- a/framework/projects/Cli/patches/3.src.patch +++ b/framework/projects/Cli/patches/3.src.patch @@ -1,16 +1,8 @@ diff --git a/src/java/org/apache/commons/cli/TypeHandler.java b/src/java/org/apache/commons/cli/TypeHandler.java -index 0a0aa72..1ddde5b 100644 +index 0a0aa72..addf90b 100644 --- a/src/java/org/apache/commons/cli/TypeHandler.java +++ b/src/java/org/apache/commons/cli/TypeHandler.java -@@ -22,6 +22,7 @@ import java.net.URL; - - import java.util.Date; - -+import org.apache.commons.lang.math.NumberUtils; - /** - * This is a temporary implementation. TypeHandler will handle the - * pluggableness of OptionTypes and it will direct all of these types -@@ -158,17 +159,7 @@ public class TypeHandler { +@@ -158,17 +158,7 @@ public class TypeHandler { { try { @@ -25,7 +17,7 @@ index 0a0aa72..1ddde5b 100644 - return Long.valueOf(str); - } - } -+ return NumberUtils.createNumber(str); ++ return org.apache.commons.lang.math.NumberUtils.createNumber(str); } catch (NumberFormatException nfe) { diff --git a/framework/projects/Cli/patches/36.src.patch b/framework/projects/Cli/patches/36.src.patch index 5f8ce1435..10a5b3078 100644 --- a/framework/projects/Cli/patches/36.src.patch +++ b/framework/projects/Cli/patches/36.src.patch @@ -22,23 +22,15 @@ index dc6d5db..322053f 100644 /** the name of the selected option */ private String selected; diff --git a/src/main/java/org/apache/commons/cli/Options.java b/src/main/java/org/apache/commons/cli/Options.java -index 796fe5c..0ee4eea 100644 +index 796fe5c..721baaf 100644 --- a/src/main/java/org/apache/commons/cli/Options.java +++ b/src/main/java/org/apache/commons/cli/Options.java -@@ -21,6 +21,7 @@ import java.io.Serializable; - import java.util.ArrayList; - import java.util.Collection; - import java.util.Collections; -+import java.util.HashMap; - import java.util.HashSet; - import java.util.LinkedHashMap; - import java.util.List; -@@ -57,7 +58,7 @@ public class Options implements Serializable +@@ -57,7 +57,7 @@ public class Options implements Serializable private final List requiredOpts = new ArrayList(); /** a map of the option groups */ - private final Map optionGroups = new LinkedHashMap(); -+ private final Map optionGroups = new HashMap(); ++ private final Map optionGroups = new java.util.HashMap(); /** * Add the specified option group. diff --git a/framework/projects/Closure/patches/153.src.patch b/framework/projects/Closure/patches/153.src.patch index 51f1287cd..c78f008da 100644 --- a/framework/projects/Closure/patches/153.src.patch +++ b/framework/projects/Closure/patches/153.src.patch @@ -1,5 +1,5 @@ diff --git a/src/com/google/javascript/jscomp/Normalize.java b/src/com/google/javascript/jscomp/Normalize.java -index c14ac8f1..4c99858e 100644 +index c14ac8f..4c99858 100644 --- a/src/com/google/javascript/jscomp/Normalize.java +++ b/src/com/google/javascript/jscomp/Normalize.java @@ -628,7 +628,6 @@ class Normalize implements CompilerPass { @@ -54,18 +54,10 @@ index c14ac8f1..4c99858e 100644 } diff --git a/src/com/google/javascript/jscomp/SyntacticScopeCreator.java b/src/com/google/javascript/jscomp/SyntacticScopeCreator.java -index eb6e1eab..04bafcf0 100644 +index eb6e1ea..9494792 100644 --- a/src/com/google/javascript/jscomp/SyntacticScopeCreator.java +++ b/src/com/google/javascript/jscomp/SyntacticScopeCreator.java -@@ -20,6 +20,7 @@ import com.google.common.base.Preconditions; - import com.google.javascript.rhino.JSDocInfo; - import com.google.javascript.rhino.Node; - import com.google.javascript.rhino.Token; -+import com.google.javascript.rhino.jstype.JSType; - - - /** -@@ -91,7 +92,7 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -91,7 +91,7 @@ class SyntacticScopeCreator implements ScopeCreator { // been declared in the outer scope. String fnName = fnNameNode.getString(); if (!fnName.isEmpty() && NodeUtil.isFunctionExpression(n)) { @@ -74,7 +66,7 @@ index eb6e1eab..04bafcf0 100644 } // Args: Declare function variables -@@ -99,7 +100,7 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -99,7 +99,7 @@ class SyntacticScopeCreator implements ScopeCreator { for (Node a = args.getFirstChild(); a != null; a = a.getNext()) { Preconditions.checkState(a.getType() == Token.NAME); @@ -83,7 +75,7 @@ index eb6e1eab..04bafcf0 100644 } // Body -@@ -121,7 +122,9 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -121,7 +121,9 @@ class SyntacticScopeCreator implements ScopeCreator { for (Node child = n.getFirstChild(); child != null;) { Node next = child.getNext(); @@ -94,7 +86,7 @@ index eb6e1eab..04bafcf0 100644 child = next; } return; -@@ -136,7 +139,7 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -136,7 +138,7 @@ class SyntacticScopeCreator implements ScopeCreator { // This is invalid, but allow it so the checks can catch it. return; } @@ -103,7 +95,7 @@ index eb6e1eab..04bafcf0 100644 return; // should not examine function's children case Token.CATCH: -@@ -148,7 +151,7 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -148,7 +150,7 @@ class SyntacticScopeCreator implements ScopeCreator { final Node var = n.getFirstChild(); final Node block = var.getNext(); @@ -112,7 +104,7 @@ index eb6e1eab..04bafcf0 100644 scanVars(block, n); return; // only one child to scan -@@ -174,7 +177,8 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -174,7 +176,8 @@ class SyntacticScopeCreator implements ScopeCreator { */ interface RedeclarationHandler { void onRedeclaration( @@ -122,7 +114,7 @@ index eb6e1eab..04bafcf0 100644 } /** -@@ -182,8 +186,8 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -182,8 +185,8 @@ class SyntacticScopeCreator implements ScopeCreator { */ private class DefaultRedeclarationHandler implements RedeclarationHandler { public void onRedeclaration( @@ -133,14 +125,14 @@ index eb6e1eab..04bafcf0 100644 // Don't allow multiple variables to be declared at the top level scope if (scope.isGlobal()) { -@@ -228,17 +232,16 @@ class SyntacticScopeCreator implements ScopeCreator { +@@ -228,17 +231,16 @@ class SyntacticScopeCreator implements ScopeCreator { * @param n The node corresponding to the variable name. * @param declaredType The variable's type, according to JSDoc */ - private void declareVar(Node n) { - Preconditions.checkState(n.getType() == Token.NAME); + private void declareVar(String name, Node n, Node parent, -+ Node gramps, JSType declaredType, ++ Node gramps, com.google.javascript.rhino.jstype.JSType declaredType, + Node nodeWithLineNumber) { - CompilerInput input = compiler.getInput(sourceName); diff --git a/framework/projects/Closure/patches/158.src.patch b/framework/projects/Closure/patches/158.src.patch index 5560eca46..6c2209952 100644 --- a/framework/projects/Closure/patches/158.src.patch +++ b/framework/projects/Closure/patches/158.src.patch @@ -1,5 +1,5 @@ diff --git a/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java b/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java -index e2e102c6..3a7f427f 100644 +index e2e102c..3a7f427 100644 --- a/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java +++ b/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java @@ -194,11 +194,12 @@ abstract class AbstractCommandLineRunner diagnosticGroups, CheckLevel level) { ++ java.util.List diagnosticGroups, CheckLevel level) { + for (String name : diagnosticGroups) { DiagnosticGroup group = forName(name); Preconditions.checkNotNull(group, "No warning class for name: " + name); diff --git a/framework/projects/JacksonDatabind/patches/63.src.patch b/framework/projects/JacksonDatabind/patches/63.src.patch index f31b8f91a..e43a10516 100644 --- a/framework/projects/JacksonDatabind/patches/63.src.patch +++ b/framework/projects/JacksonDatabind/patches/63.src.patch @@ -1,16 +1,8 @@ diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java b/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java -index 00896eab5..e8bd1e268 100644 +index 00896ea..482622b 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java -@@ -7,6 +7,7 @@ import java.util.*; - - import com.fasterxml.jackson.annotation.JsonIgnore; - import com.fasterxml.jackson.core.*; -+import com.fasterxml.jackson.databind.util.ClassUtil; - - /** - * Checked exception used to signal fatal problems with mapping of -@@ -127,22 +128,12 @@ public class JsonMappingException +@@ -127,22 +127,12 @@ public class JsonMappingException // butt-ugly for arrays. // 06-Oct-2016, tatu: as per [databind#1403], `getSimpleName()` not so good // as it drops enclosing class. So let's try bit different approach @@ -24,7 +16,8 @@ index 00896eab5..e8bd1e268 100644 - sb.append("[]"); - } - /* was: - String pkgName = ClassUtil.getPackageName(cls); +- String pkgName = ClassUtil.getPackageName(cls); ++ String pkgName = com.fasterxml.jackson.databind.util.ClassUtil.getPackageName(cls); if (pkgName != null) { sb.append(pkgName); sb.append('.'); diff --git a/framework/projects/JxPath/patches/7.src.patch b/framework/projects/JxPath/patches/7.src.patch index 31e809ced..8a7290e9b 100644 --- a/framework/projects/JxPath/patches/7.src.patch +++ b/framework/projects/JxPath/patches/7.src.patch @@ -1,103 +1,67 @@ diff --git a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThan.java b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThan.java -index 4d8c2c4..af667db 100644 +index 4d8c2c4..3a053d4 100644 --- a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThan.java +++ b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThan.java -@@ -16,6 +16,8 @@ - */ - package org.apache.commons.jxpath.ri.compiler; - -+import org.apache.commons.jxpath.ri.EvalContext; -+import org.apache.commons.jxpath.ri.InfoSetUtil; - /** - * Implementation of Expression for the operation ">". - * -@@ -28,8 +30,10 @@ public class CoreOperationGreaterThan extends CoreOperationRelationalExpression +@@ -28,8 +28,10 @@ public class CoreOperationGreaterThan extends CoreOperationRelationalExpression super(new Expression[] { arg1, arg2 }); } - protected boolean evaluateCompare(int compare) { - return compare > 0; -+ public Object computeValue(EvalContext context) { -+ double l = InfoSetUtil.doubleValue(args[0].computeValue(context)); -+ double r = InfoSetUtil.doubleValue(args[1].computeValue(context)); ++ public Object computeValue(org.apache.commons.jxpath.ri.EvalContext context) { ++ double l = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[0].computeValue(context)); ++ double r = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[1].computeValue(context)); + return l > r ? Boolean.TRUE : Boolean.FALSE; } public String getSymbol() { diff --git a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThanOrEqual.java b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThanOrEqual.java -index c3d5720..42b4ec2 100644 +index c3d5720..b9f156c 100644 --- a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThanOrEqual.java +++ b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationGreaterThanOrEqual.java -@@ -16,6 +16,8 @@ - */ - package org.apache.commons.jxpath.ri.compiler; - -+import org.apache.commons.jxpath.ri.EvalContext; -+import org.apache.commons.jxpath.ri.InfoSetUtil; - /** - * Implementation of Expression for the operation ">=". - * -@@ -29,8 +31,10 @@ public class CoreOperationGreaterThanOrEqual extends +@@ -29,8 +29,10 @@ public class CoreOperationGreaterThanOrEqual extends super(new Expression[] { arg1, arg2 }); } - protected boolean evaluateCompare(int compare) { - return compare >= 0; -+ public Object computeValue(EvalContext context) { -+ double l = InfoSetUtil.doubleValue(args[0].computeValue(context)); -+ double r = InfoSetUtil.doubleValue(args[1].computeValue(context)); ++ public Object computeValue(org.apache.commons.jxpath.ri.EvalContext context) { ++ double l = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[0].computeValue(context)); ++ double r = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[1].computeValue(context)); + return l >= r ? Boolean.TRUE : Boolean.FALSE; } public String getSymbol() { diff --git a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThan.java b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThan.java -index 4c0d9ce..e0da347 100644 +index 4c0d9ce..374f772 100644 --- a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThan.java +++ b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThan.java -@@ -16,6 +16,8 @@ - */ - package org.apache.commons.jxpath.ri.compiler; - -+import org.apache.commons.jxpath.ri.EvalContext; -+import org.apache.commons.jxpath.ri.InfoSetUtil; - /** - * Implementation of Expression for the operation "<". - * -@@ -28,8 +30,10 @@ public class CoreOperationLessThan extends CoreOperationRelationalExpression { +@@ -28,8 +28,10 @@ public class CoreOperationLessThan extends CoreOperationRelationalExpression { super(new Expression[] { arg1, arg2 }); } - protected boolean evaluateCompare(int compare) { - return compare < 0; -+ public Object computeValue(EvalContext context) { -+ double l = InfoSetUtil.doubleValue(args[0].computeValue(context)); -+ double r = InfoSetUtil.doubleValue(args[1].computeValue(context)); ++ public Object computeValue(org.apache.commons.jxpath.ri.EvalContext context) { ++ double l = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[0].computeValue(context)); ++ double r = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[1].computeValue(context)); + return l < r ? Boolean.TRUE : Boolean.FALSE; } public String getSymbol() { diff --git a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java -index 7940ecb..becf2e7 100644 +index 7940ecb..db562d8 100644 --- a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java +++ b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationLessThanOrEqual.java -@@ -16,6 +16,8 @@ - */ - package org.apache.commons.jxpath.ri.compiler; - -+import org.apache.commons.jxpath.ri.EvalContext; -+import org.apache.commons.jxpath.ri.InfoSetUtil; - /** - * Implementation of Expression for the operation "<=". - * -@@ -29,8 +31,10 @@ public class CoreOperationLessThanOrEqual extends +@@ -29,8 +29,10 @@ public class CoreOperationLessThanOrEqual extends super(new Expression[] { arg1, arg2 }); } - protected boolean evaluateCompare(int compare) { - return compare <= 0; -+ public Object computeValue(EvalContext context) { -+ double l = InfoSetUtil.doubleValue(args[0].computeValue(context)); -+ double r = InfoSetUtil.doubleValue(args[1].computeValue(context)); ++ public Object computeValue(org.apache.commons.jxpath.ri.EvalContext context) { ++ double l = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[0].computeValue(context)); ++ double r = org.apache.commons.jxpath.ri.InfoSetUtil.doubleValue(args[1].computeValue(context)); + return l <= r ? Boolean.TRUE : Boolean.FALSE; } diff --git a/framework/projects/JxPath/patches/9.src.patch b/framework/projects/JxPath/patches/9.src.patch index 231c83ab1..fb2354c9e 100644 --- a/framework/projects/JxPath/patches/9.src.patch +++ b/framework/projects/JxPath/patches/9.src.patch @@ -75,40 +75,24 @@ index e083ab3..26875b8 100644 } diff --git a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationEqual.java b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationEqual.java -index 801e7fb..26da44c 100644 +index 801e7fb..baca531 100644 --- a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationEqual.java +++ b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationEqual.java -@@ -16,6 +16,7 @@ - */ - package org.apache.commons.jxpath.ri.compiler; - -+import org.apache.commons.jxpath.ri.EvalContext; - /** - * Implementation of Expression for the operation "=". - * -@@ -28,6 +29,9 @@ public class CoreOperationEqual extends CoreOperationCompare { +@@ -28,6 +28,9 @@ public class CoreOperationEqual extends CoreOperationCompare { super(arg1, arg2); } -+ public Object computeValue(EvalContext context) { ++ public Object computeValue(org.apache.commons.jxpath.ri.EvalContext context) { + return equal(context, args[0], args[1]) ? Boolean.TRUE : Boolean.FALSE; + } public String getSymbol() { return "="; } diff --git a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNotEqual.java b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNotEqual.java -index aad3f5f..dac71f2 100644 +index aad3f5f..6754f46 100644 --- a/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNotEqual.java +++ b/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNotEqual.java -@@ -16,6 +16,7 @@ - */ - package org.apache.commons.jxpath.ri.compiler; - -+import org.apache.commons.jxpath.ri.EvalContext; - /** - * Implementation of Expression for the operation "!=". - * -@@ -25,9 +26,12 @@ package org.apache.commons.jxpath.ri.compiler; +@@ -25,9 +25,12 @@ package org.apache.commons.jxpath.ri.compiler; public class CoreOperationNotEqual extends CoreOperationCompare { public CoreOperationNotEqual(Expression arg1, Expression arg2) { @@ -116,7 +100,7 @@ index aad3f5f..dac71f2 100644 + super(arg1, arg2); } -+ public Object computeValue(EvalContext context) { ++ public Object computeValue(org.apache.commons.jxpath.ri.EvalContext context) { + return equal(context, args[0], args[1]) ? Boolean.FALSE : Boolean.TRUE; + } public String getSymbol() {