Bug 573001: [17] Merge master branch to BETA_JAVA17 branch after
milestones

after RC2 - Merge remote-tracking branch 'origin/master' into
BETA_JAVA17

Change-Id: Ic4d4f349ce1283d9fb4f6552979d8cf0560ed5c8
diff --git a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/ConstantsForSystemPropertiesCleanUpCore.java b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/ConstantsForSystemPropertiesCleanUpCore.java
index 4345db4..bf5d83b 100644
--- a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/ConstantsForSystemPropertiesCleanUpCore.java
+++ b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/ConstantsForSystemPropertiesCleanUpCore.java
@@ -126,34 +126,35 @@
 
 	@Override
 	public String getPreview() {
-		StringBuilder sb=new StringBuilder();
+		StringBuilder sb= new StringBuilder();
+		boolean isEnabled= isEnabled(CONSTANTS_FOR_SYSTEM_PROPERTY);
 		EnumSet<UpdateProperty> computeFixSet= computeFixSet();
 
-		if(computeFixSet.contains(UpdateProperty.PATH_SEPARATOR)) {
-			sb.append("String ps = File.pathSeparator;\n"); //$NON-NLS-1$
-		} else {
-			sb.append("String ps = System.getProperty(\"path.separator\");\n"); //$NON-NLS-1$
-		}
-
-		if(computeFixSet.contains(UpdateProperty.FILE_SEPARATOR)) {
+		if (isEnabled && computeFixSet.contains(UpdateProperty.FILE_SEPARATOR)) {
 			sb.append("String fs = FileSystems.getDefault().getSeparator(); /* on JVM 1.6 this will be File.separator; */ \n"); //$NON-NLS-1$
 		} else {
 			sb.append("String fs = System.getProperty(\"file.separator\");\n"); //$NON-NLS-1$
 		}
 
-		if(computeFixSet.contains(UpdateProperty.FILE_ENCODING)) {
-			sb.append("String fe = Charset.defaultCharset().displayName();\n"); //$NON-NLS-1$
+		if (isEnabled && computeFixSet.contains(UpdateProperty.PATH_SEPARATOR)) {
+			sb.append("String ps = File.pathSeparator;\n"); //$NON-NLS-1$
 		} else {
-			sb.append("String fe = System.getProperty(\"file.encoding\");\n"); //$NON-NLS-1$
+			sb.append("String ps = System.getProperty(\"path.separator\");\n"); //$NON-NLS-1$
 		}
 
-		if(computeFixSet.contains(UpdateProperty.LINE_SEPARATOR)) {
+		if (isEnabled && computeFixSet.contains(UpdateProperty.LINE_SEPARATOR)) {
 			sb.append("String ls = System.lineSeparator();\n"); //$NON-NLS-1$
 		} else {
 			sb.append("String ls = System.getProperty(\"line.separator\");\n"); //$NON-NLS-1$
 		}
 
-		if(computeFixSet.contains(UpdateProperty.BOOLEAN_PROPERTY)) {
+		if (isEnabled && computeFixSet.contains(UpdateProperty.FILE_ENCODING)) {
+			sb.append("String fe = Charset.defaultCharset().displayName();\n"); //$NON-NLS-1$
+		} else {
+			sb.append("String fe = System.getProperty(\"file.encoding\");\n"); //$NON-NLS-1$
+		}
+
+		if (isEnabled && computeFixSet.contains(UpdateProperty.BOOLEAN_PROPERTY)) {
 			sb.append("Boolean b = Boolean.getBoolean(\"arbitrarykey\")\n"); //$NON-NLS-1$
 		} else {
 			sb.append("Boolean b = Boolean.parseBoolean(System.getProperty(\"arbitrarykey\"));\n"); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java
index af54444..5d58077 100644
--- a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java
+++ b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java
@@ -187,6 +187,7 @@
 
 	public static String OperandFactorizationCleanUp_description;
 	public static String OneIfRatherThanDuplicateBlocksThatFallThroughCleanUp_description;
+	public static String PullOutIfFromIfElseCleanUp_description;
 
 	public static String InvertEqualsCleanUp_description;
 	public static String CheckSignOfBitwiseOperation_description;
diff --git a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties
index 208fc55..73cb91a 100644
--- a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties
+++ b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties
@@ -169,6 +169,7 @@
 
 OperandFactorizationCleanUp_description=Replace (X && Y) || (X && Z) by (X && (Y || Z))
 OneIfRatherThanDuplicateBlocksThatFallThroughCleanUp_description=Single 'if' statement rather than duplicate blocks that fall through
+PullOutIfFromIfElseCleanUp_description=Pull out a duplicate 'if' from an if/else
 
 InvertEqualsCleanUp_description=Avoid Object.equals() or String.equalsIgnoreCase() on null objects
 CheckSignOfBitwiseOperation_description=Use != 0 instead of > 0 when comparing the result of a bitwise expression
diff --git a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/PullOutIfFromIfElseCleanUpCore.java b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/PullOutIfFromIfElseCleanUpCore.java
new file mode 100644
index 0000000..6fe812e
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/fix/PullOutIfFromIfElseCleanUpCore.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Fabrice TIERCELIN and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *     Fabrice TIERCELIN - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.fix;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.manipulation.CleanUpContextCore;
+import org.eclipse.jdt.core.manipulation.CleanUpRequirementsCore;
+import org.eclipse.jdt.core.manipulation.ICleanUpFixCore;
+
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+import org.eclipse.jdt.internal.corext.fix.PullOutIfFromIfElseFixCore;
+
+public class PullOutIfFromIfElseCleanUpCore extends AbstractCleanUpCore {
+	public PullOutIfFromIfElseCleanUpCore(final Map<String, String> options) {
+		super(options);
+	}
+
+	public PullOutIfFromIfElseCleanUpCore() {
+	}
+
+	@Override
+	public CleanUpRequirementsCore getRequirementsCore() {
+		return new CleanUpRequirementsCore(requireAST(), false, false, null);
+	}
+
+	public boolean requireAST() {
+		return isEnabled(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE);
+	}
+
+	@Override
+	public ICleanUpFixCore createFixCore(final CleanUpContextCore context) throws CoreException {
+		CompilationUnit compilationUnit= context.getAST();
+
+		if (compilationUnit == null || !isEnabled(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE)) {
+			return null;
+		}
+
+		return PullOutIfFromIfElseFixCore.createCleanUp(compilationUnit);
+	}
+
+	@Override
+	public String[] getStepDescriptions() {
+		if (isEnabled(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE)) {
+			return new String[] {MultiFixMessages.PullOutIfFromIfElseCleanUp_description};
+		}
+
+		return new String[0];
+	}
+
+	@Override
+	public String getPreview() {
+		if (isEnabled(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE)) {
+			return "" //$NON-NLS-1$
+					+ "if (isActive) {\n" //$NON-NLS-1$
+					+ "    if (isFound) {\n" //$NON-NLS-1$
+					+ "        System.out.println(\"foo\");\n" //$NON-NLS-1$
+					+ "    } else {\n" //$NON-NLS-1$
+					+ "        System.out.println(\"bar\");\n" //$NON-NLS-1$
+					+ "    }\n" //$NON-NLS-1$
+					+ "}\n\n\n"; //$NON-NLS-1$
+		}
+
+		return "" //$NON-NLS-1$
+				+ "if (isFound) {\n" //$NON-NLS-1$
+				+ "    if (isActive) {\n" //$NON-NLS-1$
+				+ "        System.out.println(\"foo\");\n" //$NON-NLS-1$
+				+ "    }\n" //$NON-NLS-1$
+				+ "} else {\n" //$NON-NLS-1$
+				+ "    if (isActive) {\n" //$NON-NLS-1$
+				+ "        System.out.println(\"bar\");\n" //$NON-NLS-1$
+				+ "    }\n" //$NON-NLS-1$
+				+ "}\n"; //$NON-NLS-1$
+	}
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractPrimitiveRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractPrimitiveRatherThanWrapperFinder.java
index 0f5cf6b..e10794a 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractPrimitiveRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractPrimitiveRatherThanWrapperFinder.java
@@ -22,6 +22,8 @@
 import org.eclipse.jdt.core.dom.Assignment;
 import org.eclipse.jdt.core.dom.Block;
 import org.eclipse.jdt.core.dom.CastExpression;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jdt.core.dom.ConditionalExpression;
 import org.eclipse.jdt.core.dom.Expression;
 import org.eclipse.jdt.core.dom.FieldAccess;
@@ -44,6 +46,7 @@
 import org.eclipse.jdt.internal.corext.dom.Bindings;
 import org.eclipse.jdt.internal.corext.dom.InterruptibleVisitor;
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 
 public abstract class AbstractPrimitiveRatherThanWrapperFinder extends ASTVisitor {
 	protected List<CompilationUnitRewriteOperation> fResult;
@@ -63,13 +66,6 @@
 	public abstract Class<? extends Expression> getLiteralClass();
 
 	/**
-	 * Refactor the wrapper.
-	 *
-	 * @param node the node
-	 */
-	public abstract void refactorWrapper(final VariableDeclarationStatement node);
-
-	/**
 	 * Get the wrapper fully qualified name.
 	 *
 	 * @return the wrapper fully qualified name.
@@ -162,22 +158,35 @@
 	}
 
 	@Override
-	public boolean visit(final VariableDeclarationStatement node) {
-		VariableDeclarationFragment fragment= ASTNodes.getUniqueFragment(node);
+	public boolean visit(final VariableDeclarationStatement visited) {
+		VariableDeclarationFragment fragment= ASTNodes.getUniqueFragment(visited);
 
 		if (fragment != null
-				&& (fragment.resolveBinding() != null && ASTNodes.hasType(fragment.resolveBinding().getType(), getWrapperFullyQualifiedName())
-						|| node.getType() != null && node.getType().resolveBinding() != null && ASTNodes.hasType(node.getType().resolveBinding(), getWrapperFullyQualifiedName()))
 				&& fragment.getInitializer() != null
-				&& isNotNull(fragment.getInitializer())) {
+				&& (isNotNull(fragment.getInitializer()) || canReturnPrimitiveInstead(fragment.getInitializer()))
+				&& (fragment.resolveBinding() != null && ASTNodes.hasType(fragment.resolveBinding().getType(), getWrapperFullyQualifiedName())
+						|| visited.getType() != null && visited.getType().resolveBinding() != null && ASTNodes.hasType(visited.getType().resolveBinding(), getWrapperFullyQualifiedName()))) {
 			VarOccurrenceVisitor varOccurrenceVisitor= new VarOccurrenceVisitor(fragment);
 			Block parentBlock= ASTNodes.getTypedAncestor(fragment, Block.class);
 
 			if (parentBlock != null) {
 				varOccurrenceVisitor.traverseNodeInterruptibly(parentBlock);
+				int boxingCount= varOccurrenceVisitor.getAutoBoxingCount();
 
-				if (varOccurrenceVisitor.isPrimitiveAllowed() && varOccurrenceVisitor.getAutoBoxingCount() < 2) {
-					refactorWrapper(node);
+				if (ASTNodes.hasType(fragment.getInitializer(), getWrapperFullyQualifiedName()) && !canReturnPrimitiveInstead(fragment.getInitializer())) {
+					boxingCount++;
+				}
+
+				if (varOccurrenceVisitor.isPrimitiveAllowed() && boxingCount < 2) {
+					fResult.add(new PrimitiveRatherThanWrapperOperation(
+							visited,
+							getPrimitiveTypeName(),
+							getWrapperFullyQualifiedName(),
+							fragment.getInitializer(),
+							varOccurrenceVisitor.getToStringMethods(),
+							varOccurrenceVisitor.getCompareToMethods(),
+							varOccurrenceVisitor.getPrimitiveValueMethods(),
+							getParsingMethodName(getWrapperFullyQualifiedName(), (CompilationUnit) visited.getRoot())));
 					return false;
 				}
 			}
@@ -230,16 +239,83 @@
 							&& isNotNull(castExpression.getExpression());
 		}
 
-		if (expression instanceof MethodInvocation) {
-			MethodInvocation methodInvocation= (MethodInvocation) expression;
-			return ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), "valueOf", getPrimitiveTypeName()); //$NON-NLS-1$
+		if (expression instanceof ClassInstanceCreation) {
+			ClassInstanceCreation classInstanceCreation= (ClassInstanceCreation) expression;
+			List<Expression> classInstanceCreationArguments= classInstanceCreation.arguments();
+
+			if (classInstanceCreationArguments.size() == 1) {
+				Expression arg0= classInstanceCreationArguments.get(0);
+
+				return ASTNodes.hasType(arg0, String.class.getCanonicalName());
+			}
 		}
 
 		return false;
 	}
 
+	private boolean canReturnPrimitiveInstead(final Expression expression) {
+		MethodInvocation methodInvocation= ASTNodes.as(expression, MethodInvocation.class);
+
+		if (methodInvocation != null) {
+			return ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), "valueOf", getPrimitiveTypeName()) //$NON-NLS-1$
+					|| getParsingMethodName(getWrapperFullyQualifiedName(), (CompilationUnit) expression.getRoot()) != null
+					&& (
+							ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), "valueOf", String.class.getCanonicalName()) //$NON-NLS-1$
+							|| ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), "valueOf", String.class.getCanonicalName(), int.class.getSimpleName()) //$NON-NLS-1$
+							);
+		}
+
+		ClassInstanceCreation classInstanceCreation= ASTNodes.as(expression, ClassInstanceCreation.class);
+		if (classInstanceCreation != null) {
+			List<Expression> classInstanceCreationArguments= classInstanceCreation.arguments();
+
+			if (classInstanceCreationArguments.size() == 1) {
+				Expression arg0= classInstanceCreationArguments.get(0);
+
+				return ASTNodes.hasType(arg0, String.class.getCanonicalName());
+			}
+		}
+
+		return false;
+	}
+
+	private String getParsingMethodName(final String wrapperFullyQualifiedName, final CompilationUnit compilationUnit) {
+		if (Boolean.class.getCanonicalName().equals(wrapperFullyQualifiedName) && JavaModelUtil.is50OrHigher(compilationUnit.getJavaElement().getJavaProject())) {
+			return "parseBoolean"; //$NON-NLS-1$
+		}
+
+		if (Integer.class.getCanonicalName().equals(wrapperFullyQualifiedName)) {
+			return "parseInt"; //$NON-NLS-1$
+		}
+
+		if (Long.class.getCanonicalName().equals(wrapperFullyQualifiedName)) {
+			return "parseLong"; //$NON-NLS-1$
+		}
+
+		if (Double.class.getCanonicalName().equals(wrapperFullyQualifiedName) && JavaModelUtil.is1d2OrHigher(compilationUnit.getJavaElement().getJavaProject())) {
+			return "parseDouble"; //$NON-NLS-1$
+		}
+
+		if (Float.class.getCanonicalName().equals(wrapperFullyQualifiedName) && JavaModelUtil.is1d2OrHigher(compilationUnit.getJavaElement().getJavaProject())) {
+			return "parseFloat"; //$NON-NLS-1$
+		}
+
+		if (Short.class.getCanonicalName().equals(wrapperFullyQualifiedName)) {
+			return "parseShort"; //$NON-NLS-1$
+		}
+
+		if (Byte.class.getCanonicalName().equals(wrapperFullyQualifiedName)) {
+			return "parseByte"; //$NON-NLS-1$
+		}
+
+		return null;
+	}
+
 	private class VarOccurrenceVisitor extends InterruptibleVisitor {
 		private final VariableDeclarationFragment varDecl;
+		private final List<MethodInvocation> toStringMethods = new ArrayList<>();
+		private final List<MethodInvocation> compareToMethods = new ArrayList<>();
+		private final List<MethodInvocation> primitiveValueMethods = new ArrayList<>();
 		private boolean isPrimitiveAllowed= true;
 		private boolean isVarReturned;
 		private int autoBoxingCount;
@@ -248,6 +324,18 @@
 			varDecl= var;
 		}
 
+		public List<MethodInvocation> getToStringMethods() {
+			return toStringMethods;
+		}
+
+		public List<MethodInvocation> getCompareToMethods() {
+			return compareToMethods;
+		}
+
+		public List<MethodInvocation> getPrimitiveValueMethods() {
+			return primitiveValueMethods;
+		}
+
 		public boolean isPrimitiveAllowed() {
 			return isPrimitiveAllowed;
 		}
@@ -346,9 +434,36 @@
 			case ASTNode.POSTFIX_EXPRESSION:
 				return getPostfixOutSafeOperators().contains(((PostfixExpression) parentNode).getOperator());
 
+			case ASTNode.METHOD_INVOCATION:
+				MethodInvocation methodInvocation= (MethodInvocation) parentNode;
+
+				if (node.getLocationInParent() == MethodInvocation.EXPRESSION_PROPERTY) {
+					if (ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), getPrimitiveTypeName() + "Value")) { //$NON-NLS-1$
+						primitiveValueMethods.add(methodInvocation);
+						return true;
+					}
+
+					if (ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), "toString")) { //$NON-NLS-1$
+						toStringMethods.add(methodInvocation);
+						return true;
+					}
+
+					if (ASTNodes.usesGivenSignature(methodInvocation, getWrapperFullyQualifiedName(), "compareTo", getWrapperFullyQualifiedName())) { //$NON-NLS-1$
+						if (ASTNodes.hasType((Expression) methodInvocation.arguments().get(0), getWrapperFullyQualifiedName())) {
+							autoBoxingCount++;
+						}
+
+						compareToMethods.add(methodInvocation);
+						return true;
+					}
+				}
+
+				break;
+
 			default:
-				return isSpecificPrimitiveAllowed(node);
 			}
+
+			return isSpecificPrimitiveAllowed(node);
 		}
 
 		private boolean isOfType(final ITypeBinding resolveTypeBinding) {
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
index 7111d69..1d006ab 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
@@ -1635,6 +1635,18 @@
 	public static final String ONE_IF_RATHER_THAN_DUPLICATE_BLOCKS_THAT_FALL_THROUGH= "cleanup.one_if_rather_than_duplicate_blocks_that_fall_through"; //$NON-NLS-1$
 
 	/**
+	 * Moves an inner <code>if</code> statement around the outer <code>if</code> condition.
+	 * <p>
+	 * Possible values: {TRUE, FALSE}
+	 * <p>
+	 *
+	 * @see CleanUpOptionsCore#TRUE
+	 * @see CleanUpOptionsCore#FALSE
+	 * @since 4.21
+	 */
+	public static final String PULL_OUT_IF_FROM_IF_ELSE= "cleanup.pull_out_if_from_if_else"; //$NON-NLS-1$
+
+	/**
 	 * Merges blocks that end with a jump statement into the following same code.
 	 * <p>
 	 * Possible values: {TRUE, FALSE}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
index ee02c5a..8cc89f5 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
@@ -172,6 +172,7 @@
 	public static String ReturnExpressionFix_description;
 
 	public static String OneIfRatherThanDuplicateBlocksThatFallThroughFix_description;
+	public static String PullOutIfFromIfElseFix_description;
 
 	public static String TypeAnnotationFix_move;
 	public static String TypeAnnotationFix_remove;
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
index 0bf5094..4919113 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
@@ -159,6 +159,7 @@
 ReturnExpressionFix_description=Remove variable assignment before return
 
 OneIfRatherThanDuplicateBlocksThatFallThroughFix_description=Single 'if' statement rather than duplicate blocks that fall through
+PullOutIfFromIfElseFix_description=Pull out a duplicate 'if' from an if/else
 
 TypeAnnotationFix_move=Move type annotation
 TypeAnnotationFix_remove=Remove type annotation
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveBooleanRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveBooleanRatherThanWrapperFinder.java
index 46f5ecd..25b6672 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveBooleanRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveBooleanRatherThanWrapperFinder.java
@@ -22,15 +22,11 @@
 import org.eclipse.jdt.core.dom.Expression;
 import org.eclipse.jdt.core.dom.InfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveBooleanRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveBooleanRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveBooleanRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -89,9 +85,4 @@
 			return false;
 		}
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.BOOLEAN));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveByteRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveByteRatherThanWrapperFinder.java
index 2856166..9aabd06 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveByteRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveByteRatherThanWrapperFinder.java
@@ -22,15 +22,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveByteRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveByteRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveByteRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -100,9 +96,4 @@
 			return false;
 		}
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.BYTE));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveCharRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveCharRatherThanWrapperFinder.java
index d2ed825..ba17c84 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveCharRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveCharRatherThanWrapperFinder.java
@@ -23,15 +23,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveCharRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveCharRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveCharRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -113,9 +109,4 @@
 			return false;
 		}
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.CHAR));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveDoubleRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveDoubleRatherThanWrapperFinder.java
index c66f638..9dcc0ac 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveDoubleRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveDoubleRatherThanWrapperFinder.java
@@ -22,15 +22,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveDoubleRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveDoubleRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveDoubleRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -94,9 +90,4 @@
 	public String[] getSafeInConstants() {
 		return new String[] { "MIN_VALUE", "MAX_VALUE", "MIN_NORMAL", "NaN", "NEGATIVE_INFINITY", "POSITIVE_INFINITY" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.DOUBLE));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveFloatRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveFloatRatherThanWrapperFinder.java
index cbb20bd..ed43f96 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveFloatRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveFloatRatherThanWrapperFinder.java
@@ -22,15 +22,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveFloatRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveFloatRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveFloatRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -92,9 +88,4 @@
 	public String[] getSafeInConstants() {
 		return new String[] { "MIN_VALUE", "MAX_VALUE", "MIN_NORMAL", "NaN", "NEGATIVE_INFINITY", "POSITIVE_INFINITY" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.FLOAT));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveIntRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveIntRatherThanWrapperFinder.java
index 3f4b262..a0f9297 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveIntRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveIntRatherThanWrapperFinder.java
@@ -23,15 +23,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveIntRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveIntRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveIntRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -114,9 +110,4 @@
 			return false;
 		}
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.INT));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveLongRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveLongRatherThanWrapperFinder.java
index 914ecf5..c835466 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveLongRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveLongRatherThanWrapperFinder.java
@@ -22,15 +22,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveLongRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveLongRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveLongRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -99,9 +95,4 @@
 	public String[] getSafeInConstants() {
 		return new String[] { "MIN_VALUE", "MAX_VALUE" }; //$NON-NLS-1$ //$NON-NLS-2$
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.LONG));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveRatherThanWrapperOperation.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveRatherThanWrapperOperation.java
index b13a014..cc1f93a 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveRatherThanWrapperOperation.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveRatherThanWrapperOperation.java
@@ -13,38 +13,65 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
+import java.util.List;
+
 import org.eclipse.core.runtime.CoreException;
 
 import org.eclipse.text.edits.TextEditGroup;
 
 import org.eclipse.jdt.core.dom.AST;
 import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.MethodInvocation;
 import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.SimpleType;
 import org.eclipse.jdt.core.dom.Type;
 import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
+import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
 import org.eclipse.jdt.core.dom.rewrite.TargetSourceRangeComputer;
 
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
 
-public class PrimitiveRatherThanWrapperOperation extends CompilationUnitRewriteOperation {
-	private final VariableDeclarationStatement node;
-	private final String description;
-	private final PrimitiveType.Code primitiveType;
+import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
 
-	public PrimitiveRatherThanWrapperOperation(final VariableDeclarationStatement node, final String description, final PrimitiveType.Code primitiveType) {
-		this.node= node;
-		this.description= description;
-		this.primitiveType= primitiveType;
+public class PrimitiveRatherThanWrapperOperation extends CompilationUnitRewriteOperation {
+	private final VariableDeclarationStatement visited;
+	private final String primitiveTypeName;
+	private final String wrapperFullyQualifiedName;
+	private final Expression initializer;
+	private final List<MethodInvocation> toStringMethods;
+	private final List<MethodInvocation> compareToMethods;
+	private final List<MethodInvocation> primitiveValueMethods;
+	private final String parsingMethodName;
+
+	public PrimitiveRatherThanWrapperOperation(
+			final VariableDeclarationStatement visited,
+			final String primitiveTypeName,
+			final String wrapperFullyQualifiedName,
+			final Expression initializer,
+			final List<MethodInvocation> toStringMethods,
+			final List<MethodInvocation> compareToMethods,
+			final List<MethodInvocation> primitiveValueMethods,
+			final String parsingMethodName) {
+		this.visited= visited;
+		this.primitiveTypeName= primitiveTypeName;
+		this.wrapperFullyQualifiedName= wrapperFullyQualifiedName;
+		this.initializer= initializer;
+		this.toStringMethods= toStringMethods;
+		this.compareToMethods= compareToMethods;
+		this.primitiveValueMethods= primitiveValueMethods;
+		this.parsingMethodName= parsingMethodName;
 	}
 
 	@Override
 	public void rewriteAST(final CompilationUnitRewrite cuRewrite, final LinkedProposalModelCore linkedModel) throws CoreException {
 		ASTRewrite rewrite= cuRewrite.getASTRewrite();
 		AST ast= cuRewrite.getRoot().getAST();
-		TextEditGroup group= createTextEditGroup(description, cuRewrite);
+		TextEditGroup group= createTextEditGroup(MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, cuRewrite);
 		rewrite.setTargetSourceRangeComputer(new TargetSourceRangeComputer() {
 			@Override
 			public SourceRange computeSourceRange(final ASTNode nodeWithComment) {
@@ -56,8 +83,64 @@
 			}
 		});
 
-		Type newPrimitiveType= ast.newPrimitiveType(primitiveType);
+		MethodInvocation methodInvocation= ASTNodes.as(initializer, MethodInvocation.class);
 
-		ASTNodes.replaceButKeepComment(rewrite, node.getType(), newPrimitiveType, group);
+		if (methodInvocation != null) {
+			if (ASTNodes.usesGivenSignature(methodInvocation, wrapperFullyQualifiedName, "valueOf", primitiveTypeName)) { //$NON-NLS-1$
+				rewrite.replace(methodInvocation, ASTNodes.createMoveTarget(rewrite, (Expression) methodInvocation.arguments().get(0)), group);
+			}
+
+			if (ASTNodes.usesGivenSignature(methodInvocation, wrapperFullyQualifiedName, "valueOf", String.class.getCanonicalName()) //$NON-NLS-1$
+					|| ASTNodes.usesGivenSignature(methodInvocation, wrapperFullyQualifiedName, "valueOf", String.class.getCanonicalName(), int.class.getSimpleName())) { //$NON-NLS-1$
+				rewrite.set(methodInvocation, MethodInvocation.NAME_PROPERTY, ast.newSimpleName(parsingMethodName), group);
+			}
+		}
+
+		ClassInstanceCreation classInstanceCreation= ASTNodes.as(initializer, ClassInstanceCreation.class);
+
+		if (classInstanceCreation != null) {
+			List<Expression> classInstanceCreationArguments= classInstanceCreation.arguments();
+
+			if (classInstanceCreationArguments.size() == 1
+					&& parsingMethodName != null
+					&& !Character.class.getCanonicalName().equals(wrapperFullyQualifiedName)
+					&& ASTNodes.hasType(classInstanceCreation, wrapperFullyQualifiedName)) {
+				Expression arg0= classInstanceCreationArguments.get(0);
+
+				if (ASTNodes.hasType(arg0, String.class.getCanonicalName())) {
+					MethodInvocation newMethodInvocation= ast.newMethodInvocation();
+					newMethodInvocation.setExpression((Expression) rewrite.createCopyTarget(((SimpleType) visited.getType()).getName()));
+					newMethodInvocation.setName(ast.newSimpleName(parsingMethodName));
+					newMethodInvocation.arguments().add(ASTNodes.createMoveTarget(rewrite, ASTNodes.getUnparenthesedExpression(arg0)));
+
+					ASTNodes.replaceButKeepComment(rewrite, initializer, newMethodInvocation, group);
+				}
+			}
+		}
+
+		for (MethodInvocation primitiveValueMethod : primitiveValueMethods) {
+			rewrite.replace(primitiveValueMethod, ASTNodes.createMoveTarget(rewrite, primitiveValueMethod.getExpression()), group);
+		}
+
+		for (MethodInvocation toStringMethod : toStringMethods) {
+			Type wrapperType= (Type) rewrite.createCopyTarget(visited.getType());
+
+			ListRewrite targetListRewrite= rewrite.getListRewrite(toStringMethod, MethodInvocation.ARGUMENTS_PROPERTY);
+			targetListRewrite.insertFirst(ASTNodes.createMoveTarget(rewrite, toStringMethod.getExpression()), group);
+			rewrite.set(toStringMethod, MethodInvocation.EXPRESSION_PROPERTY, wrapperType, group);
+		}
+
+		for (MethodInvocation compareToMethod : compareToMethods) {
+			Type wrapperType= (Type) rewrite.createCopyTarget(visited.getType());
+
+			ListRewrite targetListRewrite= rewrite.getListRewrite(compareToMethod, MethodInvocation.ARGUMENTS_PROPERTY);
+			targetListRewrite.insertFirst(ASTNodes.createMoveTarget(rewrite, compareToMethod.getExpression()), group);
+			rewrite.set(compareToMethod, MethodInvocation.EXPRESSION_PROPERTY, wrapperType, group);
+			rewrite.replace(compareToMethod.getName(), ast.newSimpleName("compare"), group); //$NON-NLS-1$
+		}
+
+		Type newPrimitiveType= ast.newPrimitiveType(PrimitiveType.toCode(primitiveTypeName));
+
+		ASTNodes.replaceButKeepComment(rewrite, visited.getType(), newPrimitiveType, group);
 	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveShortRatherThanWrapperFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveShortRatherThanWrapperFinder.java
index bd223f2..5c17160 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveShortRatherThanWrapperFinder.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PrimitiveShortRatherThanWrapperFinder.java
@@ -23,15 +23,11 @@
 import org.eclipse.jdt.core.dom.NumberLiteral;
 import org.eclipse.jdt.core.dom.PostfixExpression;
 import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 
 import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
 
-import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
-
 public final class PrimitiveShortRatherThanWrapperFinder extends AbstractPrimitiveRatherThanWrapperFinder {
-	public PrimitiveShortRatherThanWrapperFinder(List<CompilationUnitRewriteOperation> ops) {
+	public PrimitiveShortRatherThanWrapperFinder(final List<CompilationUnitRewriteOperation> ops) {
 		fResult= ops;
 	}
 
@@ -104,9 +100,4 @@
 			return false;
 		}
 	}
-
-	@Override
-	public void refactorWrapper(VariableDeclarationStatement node) {
-		fResult.add(new PrimitiveRatherThanWrapperOperation(node, MultiFixMessages.PrimitiveRatherThanWrapperCleanUp_description, PrimitiveType.SHORT));
-	}
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PullOutIfFromIfElseFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PullOutIfFromIfElseFixCore.java
new file mode 100644
index 0000000..0616ec6
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PullOutIfFromIfElseFixCore.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Fabrice TIERCELIN and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *     Fabrice TIERCELIN - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.text.edits.TextEditGroup;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
+import org.eclipse.jdt.core.dom.rewrite.TargetSourceRangeComputer;
+import org.eclipse.jdt.core.manipulation.ICleanUpFixCore;
+
+import org.eclipse.jdt.internal.corext.dom.ASTNodes;
+import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
+
+import org.eclipse.jdt.internal.ui.fix.MultiFixMessages;
+
+public class PullOutIfFromIfElseFixCore extends CompilationUnitRewriteOperationsFixCore {
+	public static final class PullOutIfFromIfElseFinder extends ASTVisitor {
+		private List<CompilationUnitRewriteOperation> fResult;
+
+		public PullOutIfFromIfElseFinder(List<CompilationUnitRewriteOperation> ops) {
+			fResult= ops;
+		}
+
+		@Override
+		public boolean visit(final IfStatement visited) {
+			IfStatement thenInnerIfStatement= ASTNodes.as(visited.getThenStatement(), IfStatement.class);
+			IfStatement elseInnerIfStatement= ASTNodes.as(visited.getElseStatement(), IfStatement.class);
+
+			if (thenInnerIfStatement != null
+					&& elseInnerIfStatement != null
+					&& thenInnerIfStatement.getElseStatement() == null
+					&& elseInnerIfStatement.getElseStatement() == null
+					&& ASTNodes.isPassive(visited.getExpression())
+					&& ASTNodes.isPassive(thenInnerIfStatement.getExpression())
+					&& ASTNodes.match(thenInnerIfStatement.getExpression(), elseInnerIfStatement.getExpression())) {
+				fResult.add(new PullOutIfFromIfElseOperation(visited, thenInnerIfStatement, elseInnerIfStatement));
+				return false;
+			}
+
+			return true;
+		}
+	}
+
+	private static class PullOutIfFromIfElseOperation extends CompilationUnitRewriteOperation {
+		private final IfStatement visited;
+		private final IfStatement thenInnerIfStatement;
+		private final IfStatement elseInnerIfStatement;
+
+		public PullOutIfFromIfElseOperation(final IfStatement visited, final IfStatement thenInnerIfStatement, final IfStatement elseInnerIfStatement) {
+			this.visited= visited;
+			this.thenInnerIfStatement= thenInnerIfStatement;
+			this.elseInnerIfStatement= elseInnerIfStatement;
+		}
+
+		@Override
+		public void rewriteAST(final CompilationUnitRewrite cuRewrite, final LinkedProposalModelCore linkedModel) throws CoreException {
+			ASTRewrite rewrite= cuRewrite.getASTRewrite();
+			AST ast= cuRewrite.getRoot().getAST();
+			TextEditGroup group= createTextEditGroup(MultiFixMessages.PullOutIfFromIfElseCleanUp_description, cuRewrite);
+			rewrite.setTargetSourceRangeComputer(new TargetSourceRangeComputer() {
+				@Override
+				public SourceRange computeSourceRange(final ASTNode nodeWithComment) {
+					if (Boolean.TRUE.equals(nodeWithComment.getProperty(ASTNodes.UNTOUCH_COMMENT))) {
+						return new SourceRange(nodeWithComment.getStartPosition(), nodeWithComment.getLength());
+					}
+
+					return super.computeSourceRange(nodeWithComment);
+				}
+			});
+
+			Expression newCondition= ASTNodes.createMoveTarget(rewrite, ASTNodes.getUnparenthesedExpression(thenInnerIfStatement.getExpression()));
+			IfStatement newIfStatement= ast.newIfStatement();
+			newIfStatement.setExpression(newCondition);
+			Block newBlock= ast.newBlock();
+			newBlock.statements().add(ASTNodes.createMoveTarget(rewrite, visited));
+			newIfStatement.setThenStatement(newBlock);
+
+			ASTNodes.replaceButKeepComment(rewrite, visited, newIfStatement, group);
+			ASTNodes.replaceButKeepComment(rewrite, visited.getThenStatement(), ASTNodes.createMoveTarget(rewrite, thenInnerIfStatement.getThenStatement()), group);
+			ASTNodes.replaceButKeepComment(rewrite, visited.getElseStatement(), ASTNodes.createMoveTarget(rewrite, elseInnerIfStatement.getThenStatement()), group);
+		}
+	}
+
+	public static ICleanUpFixCore createCleanUp(final CompilationUnit compilationUnit) {
+		List<CompilationUnitRewriteOperation> operations= new ArrayList<>();
+		PullOutIfFromIfElseFinder finder= new PullOutIfFromIfElseFinder(operations);
+		compilationUnit.accept(finder);
+
+		if (operations.isEmpty()) {
+			return null;
+		}
+
+		CompilationUnitRewriteOperation[] ops= operations.toArray(new CompilationUnitRewriteOperation[0]);
+		return new PullOutIfFromIfElseFixCore(FixMessages.PullOutIfFromIfElseFix_description, compilationUnit, ops);
+	}
+
+	protected PullOutIfFromIfElseFixCore(final String name, final CompilationUnit compilationUnit, final CompilationUnitRewriteOperation[] fixRewriteOperations) {
+		super(name, compilationUnit, fixRewriteOperations);
+	}
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
index a107d00..182b231 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -1632,6 +1632,8 @@
 
 	public static String RenameFieldRefactoring_already_exists;
 
+	public static String RenameFieldRefactoring_recordromponent_accessor_method_already_exists;
+
 	public static String RenameFieldRefactoring_another_name;
 
 	public static String RenameFieldRefactoring_another_name2;
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
index c9fc9d4..526ea91 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2020 IBM Corporation and others.
+# Copyright (c) 2000, 2021 IBM Corporation and others.
 #
 # This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License 2.0
@@ -397,6 +397,7 @@
 RenameFieldRefactoring_field_already_defined2=A field with name ''{0}'' is already defined in ''{1}''.
 RenameFieldRefactoring_deleted=The selected field has been deleted from ''{0}''
 RenameFieldRefactoring_already_exists=Method ''{0}'' already exists in ''{1}''
+RenameFieldRefactoring_recordromponent_accessor_method_already_exists=Method ''{0}'' already exists in ''{1}'', having same signature as the new accessor method.
 RenameFieldRefactoring_overridden=Method ''{0}'' is overridden or overrides another method
 RenameFieldRefactoring_overridden_or_overrides=Method ''{0}'' is overridden or overrides another method
 RenameFieldRefactoring_Update_getter_occurrence=Update getter occurrence
diff --git a/org.eclipse.jdt.junit/META-INF/MANIFEST.MF b/org.eclipse.jdt.junit/META-INF/MANIFEST.MF
index 3cdc51c..cc4aa43 100644
--- a/org.eclipse.jdt.junit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.junit/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.junit;singleton:=true
-Bundle-Version: 3.11.1200.qualifier
+Bundle-Version: 3.12.0.qualifier
 Bundle-Activator: org.eclipse.jdt.internal.junit.ui.JUnitPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.junit/pom.xml b/org.eclipse.jdt.junit/pom.xml
index 62f48e5..33a9c73 100644
--- a/org.eclipse.jdt.junit/pom.xml
+++ b/org.eclipse.jdt.junit/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012, 2019 Eclipse Foundation and others.
+  Copyright (c) 2012, 2021 Eclipse Foundation and others.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -18,6 +18,6 @@
   </parent>
   <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.junit</artifactId>
-  <version>3.11.1200-SNAPSHOT</version>
+  <version>3.12.0-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/CopyFailureListAction.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/CopyFailureListAction.java
index c990b6f..94411f8 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/CopyFailureListAction.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/CopyFailureListAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -66,26 +66,16 @@
 		StringBuilder buf= new StringBuilder();
 		TestElement[] failures= fRunner.getAllFailures();
 
-		String lineDelim= System.getProperty("line.separator", "\n");  //$NON-NLS-1$//$NON-NLS-2$
+		String lineDelim= System.lineSeparator();
 		for (TestElement failure : failures) {
 			buf.append(failure.getTestName()).append(lineDelim);
 			String failureTrace= failure.getTrace();
 			if (failureTrace != null) {
-				int start= 0;
-				while (start < failureTrace.length()) {
-					int idx= failureTrace.indexOf('\n', start);
-					if (idx != -1) {
-						String line= failureTrace.substring(start, idx);
-						buf.append(line).append(lineDelim);
-						start= idx + 1;
-					} else {
-						start= Integer.MAX_VALUE;
-					}
-				}
+				failureTrace = failureTrace.replaceAll("\\r\\n|\\r|\\n", lineDelim); //$NON-NLS-1$
+				buf.append(failureTrace);
 			}
 		}
 		return buf.toString();
 	}
 
-
 }
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java
index 9069dcf..3b7dfe4 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,8 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.junit.wizards;
 
+import org.eclipse.jdt.junit.wizards.NewTestCaseWizardPageOne.JUnitVersion;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
@@ -53,18 +55,16 @@
 	/**
 	 * Creates a group without border.
 	 * @param buttonsStyle one of {@link SWT#RADIO}, {@link SWT#CHECK}, or {@link SWT#TOGGLE}
-	 * @param buttonNames names of the buttons
+	 * @param jver the JUnit version
 	 * @param nColumns column count
 	 */
-	public MethodStubsSelectionButtonGroup(int buttonsStyle, String[] buttonNames, int nColumns) {
+	public MethodStubsSelectionButtonGroup(int buttonsStyle, JUnitVersion jver, int nColumns) {
 		fEnabled= true;
 		fLabel= null;
 		fLabelText= ""; //$NON-NLS-1$
 
 		Assert.isTrue(buttonsStyle == SWT.RADIO || buttonsStyle == SWT.CHECK || buttonsStyle == SWT.TOGGLE);
-		fButtonNames= buttonNames;
-
-		int nButtons= buttonNames.length;
+		int nButtons= updateButtons(jver);
 		fButtonsSelected= new boolean[nButtons];
 		fButtonsEnabled= new boolean[nButtons];
 		for (int i= 0; i < nButtons; i++) {
@@ -82,6 +82,18 @@
 		fButtonsStyle= buttonsStyle;
 	}
 
+	public int updateButtons(JUnitVersion jver) {
+		fButtonNames= jver.buttonNames;
+		int nButtons= fButtonNames.length;
+		if (fButtons != null) {
+			for (int i= 0; i < nButtons; i++) {
+				fButtons[i].setText(jver.buttonNames[i]);
+				fButtons[i].requestLayout();
+			}
+		}
+		return nButtons;
+	}
+
 	/*
 	 * @see DialogField#doFillIntoGrid
 	 */
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.java
index 6deae1a..6a1a8fe 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.java
@@ -121,6 +121,14 @@
 	public static String UpdateTestSuite_error;
 	public static String UpdateTestSuite_update;
 	public static String UpdateTestSuite_could_not_update;
+	public static String NewJ4TestCaseWizardPageOne_methodStub_setUpBeforeClass;
+	public static String NewJ4TestCaseWizardPageOne_methodStub_tearDownAfterClass;
+	public static String NewJ4TestCaseWizardPageOne_methodStub_setUp;
+	public static String NewJ4TestCaseWizardPageOne_methodStub_tearDown;
+	public static String NewJ5TestCaseWizardPageOne_methodStub_setUpBeforeClass;
+	public static String NewJ5TestCaseWizardPageOne_methodStub_tearDownAfterClass;
+	public static String NewJ5TestCaseWizardPageOne_methodStub_setUp;
+	public static String NewJ5TestCaseWizardPageOne_methodStub_tearDown;
 
 	static {
 		NLS.initializeMessages(BUNDLE_NAME, WizardMessages.class);
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.properties b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.properties
index e90c815..b2681f2 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.properties
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/WizardMessages.properties
@@ -34,6 +34,14 @@
 NewTestCaseWizardPageOne_methodStub_tearDownAfterClass=tearDown&AfterClass()
 NewTestCaseWizardPageOne_methodStub_constructor=&constructor
 NewTestCaseWizardPageOne_methodStub_setUpBeforeClass=setU&pBeforeClass()
+NewJ4TestCaseWizardPageOne_methodStub_setUp=@Before set&Up()
+NewJ4TestCaseWizardPageOne_methodStub_setUpBeforeClass=@BeforeClass setU&pBeforeClass()
+NewJ4TestCaseWizardPageOne_methodStub_tearDown=@After &tearDown()
+NewJ4TestCaseWizardPageOne_methodStub_tearDownAfterClass=@AfterClass tearDown&AfterClass()
+NewJ5TestCaseWizardPageOne_methodStub_setUp=@BeforeEach set&Up()
+NewJ5TestCaseWizardPageOne_methodStub_setUpBeforeClass=@BeforeAll setU&pBeforeClass()
+NewJ5TestCaseWizardPageOne_methodStub_tearDown=@AfterEach &tearDown()
+NewJ5TestCaseWizardPageOne_methodStub_tearDownAfterClass=@AfterAll tearDown&AfterClass()
 NewTestCaseWizardPageOne_method_Stub_label=Which method stubs would you like to create?
 NewTestCaseWizardPageOne_class_to_test_label=C&lass under test:
 NewTestCaseWizardPageOne_class_to_test_browse=B&rowse...
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java
index 77d3edc..e60f846 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -165,7 +165,7 @@
 	private Link fLink;
 	private Label fImage;
 
-	private JUnitVersion fJUnitVersion;
+	private JUnitVersion fJUnitVersion= JUnitVersion.VERSION_3;
 
 	/**
 	 * Available JUnit versions.
@@ -173,7 +173,36 @@
 	 * @since 3.11
 	 */
 	public enum JUnitVersion {
-		VERSION_3, VERSION_4, VERSION_5
+		VERSION_3(new String[] {
+				/* IDX_SETUP_CLASS */ WizardMessages.NewTestCaseWizardPageOne_methodStub_setUpBeforeClass,
+				/* IDX_TEARDOWN_CLASS */ WizardMessages.NewTestCaseWizardPageOne_methodStub_tearDownAfterClass,
+				/* IDX_SETUP */ WizardMessages.NewTestCaseWizardPageOne_methodStub_setUp,
+				/* IDX_TEARDOWN */ WizardMessages.NewTestCaseWizardPageOne_methodStub_tearDown,
+				/* IDX_CONSTRUCTOR */ WizardMessages.NewTestCaseWizardPageOne_methodStub_constructor
+		}),
+		VERSION_4(new String[] {
+				/* IDX_SETUP_CLASS */ WizardMessages.NewJ4TestCaseWizardPageOne_methodStub_setUpBeforeClass,
+				/* IDX_TEARDOWN_CLASS */ WizardMessages.NewJ4TestCaseWizardPageOne_methodStub_tearDownAfterClass,
+				/* IDX_SETUP */ WizardMessages.NewJ4TestCaseWizardPageOne_methodStub_setUp,
+				/* IDX_TEARDOWN */ WizardMessages.NewJ4TestCaseWizardPageOne_methodStub_tearDown,
+				/* IDX_CONSTRUCTOR */ WizardMessages.NewTestCaseWizardPageOne_methodStub_constructor
+		}),
+		VERSION_5(new String[] {
+				/* IDX_SETUP_CLASS */ WizardMessages.NewJ5TestCaseWizardPageOne_methodStub_setUpBeforeClass,
+				/* IDX_TEARDOWN_CLASS */ WizardMessages.NewJ5TestCaseWizardPageOne_methodStub_tearDownAfterClass,
+				/* IDX_SETUP */ WizardMessages.NewJ5TestCaseWizardPageOne_methodStub_setUp,
+				/* IDX_TEARDOWN */ WizardMessages.NewJ5TestCaseWizardPageOne_methodStub_tearDown,
+				/* IDX_CONSTRUCTOR */ WizardMessages.NewTestCaseWizardPageOne_methodStub_constructor
+		});
+
+		/**
+		 * @since 3.12
+		 */
+		public final String[] buttonNames;
+
+		JUnitVersion(String[] buttonNames) {
+			this.buttonNames= buttonNames;
+		}
 	}
 
 	/**
@@ -189,16 +218,9 @@
 		setTitle(WizardMessages.NewTestCaseWizardPageOne_title);
 		setDescription(WizardMessages.NewTestCaseWizardPageOne_description);
 
-		String[] buttonNames= new String[] {
-			/* IDX_SETUP_CLASS */ WizardMessages.NewTestCaseWizardPageOne_methodStub_setUpBeforeClass,
-			/* IDX_TEARDOWN_CLASS */ WizardMessages.NewTestCaseWizardPageOne_methodStub_tearDownAfterClass,
-			/* IDX_SETUP */ WizardMessages.NewTestCaseWizardPageOne_methodStub_setUp,
-			/* IDX_TEARDOWN */ WizardMessages.NewTestCaseWizardPageOne_methodStub_tearDown,
-			/* IDX_CONSTRUCTOR */ WizardMessages.NewTestCaseWizardPageOne_methodStub_constructor
-		};
 		enableCommentControl(true);
 
-		fMethodStubsButtons= new MethodStubsSelectionButtonGroup(SWT.CHECK, buttonNames, 2) {
+		fMethodStubsButtons= new MethodStubsSelectionButtonGroup(SWT.CHECK, fJUnitVersion, 2) {
 			@Override
 			protected void doWidgetSelected(SelectionEvent e) {
 				super.doWidgetSelected(e);
@@ -214,7 +236,7 @@
 		fClassUnderTestText= ""; //$NON-NLS-1$
 
 		fJUnitStatus= new JUnitStatus();
-		setJUnitVersion(JUnitVersion.VERSION_3);
+		setJUnitVersion(fJUnitVersion);
 	}
 
 	/**
@@ -392,6 +414,7 @@
 
 	private void internalSetJUnit(JUnitVersion version) {
 		fJUnitVersion= version;
+		fMethodStubsButtons.updateButtons(version);
 		fJUnitStatus= junitStatusChanged();
 		if (isDefaultSuperClass() || "".equals(getSuperClass().trim())) //$NON-NLS-1$
 			setSuperClass(getDefaultSuperClassName(), true);
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/in/B.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/in/B.java
index 5c15421..be2def5 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/in/B.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/in/B.java
@@ -1,8 +1,9 @@
 package p;
-class B(){
+class B{
 
 	public int val() {
 		A a= new A(10);
+		java.util.function.ToDoubleFunction<A> f = A::f;
 		return a.f();
 	}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/out/B.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/out/B.java
index cb5705d..a2113d1 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/out/B.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordCanonicalConstructorImplicitAccessor/out/B.java
@@ -1,8 +1,9 @@
 package p;
-class B(){
+class B{
 
 	public int val() {
 		A a= new A(10);
+		java.util.function.ToDoubleFunction<A> f = A::g;
 		return a.g();
 	}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordComponentFail01/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordComponentFail01/in/A.java
new file mode 100644
index 0000000..54706c5
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameRecordElements/testRenameRecordComponentFail01/in/A.java
@@ -0,0 +1,11 @@
+package p;
+record A(int f){
+	private void g() {
+
+	}
+	private void h() {
+		int a = f;
+		this.f() ;
+
+	}
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameRecordElementsTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameRecordElementsTests.java
index 250f402..0635b8d 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameRecordElementsTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameRecordElementsTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2020 IBM Corporation and others.
+ * Copyright (c) 2020, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -35,6 +35,7 @@
 import org.eclipse.jdt.core.IAnnotatable;
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.ILocalVariable;
 import org.eclipse.jdt.core.IMethod;
 import org.eclipse.jdt.core.IPackageFragment;
@@ -274,6 +275,27 @@
 		renameRecordCompactConstructor(methodName, newMethodName, updateReferences, fail, true);
 	}
 
+	private void renameRecordComponentFail(String record, String fieldName, String newFieldName, String failMsg) throws Exception {
+		ParticipantTesting.reset();
+		ICompilationUnit cu= createCUfromTestFile(getPackageP(), record);
+		IType recordA= getType(cu, record);
+		IField field= recordA.getField(fieldName);
+		IJavaProject jProj= recordA.getJavaProject();
+		String projName= jProj.getElementName();
+		RenameJavaElementDescriptor descriptor= RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_FIELD);
+		descriptor.setJavaElement(field);
+		descriptor.setNewName(newFieldName);
+		descriptor.setUpdateReferences(true);
+		descriptor.setUpdateTextualOccurrences(false);
+		descriptor.setRenameGetters(false);
+		descriptor.setRenameSetters(false);
+		RenameRefactoring refactoring= (RenameRefactoring) createRefactoring(descriptor);
+		RefactoringStatus result= performRefactoring(refactoring);
+		assertNotNull("was supposed to fail", result);
+		assertTrue("should have errors", result.hasError());
+		assertEquals(failMsg.replaceAll("TestProject", projName), result.toString());
+	}
+
 	private void renameRecord(String recordName, String newRecordName, boolean updateReferences) throws Exception{
 		ParticipantTesting.reset();
 		ICompilationUnit cu= createCUfromTestFile(getPackageP(), recordName);
@@ -391,4 +413,16 @@
 	public void testRenameRecordCompactConstructorFailLocalVariableConflict() throws Exception{
 		renameRecordCompactConstructor("f", "g", true, true, true);
 	}
+
+	@Test
+	public void testRenameRecordComponentFail01() throws Exception{
+		String errorMsg = "<ERROR\n" +
+				"	\n" +
+				"ERROR: Method 'void g()' already exists in 'p.A', having same signature as the new accessor method.\n" +
+				"Context: A.java (not open) [in p [in src [in TestProject]]]\n" +
+				"code: none\n" +
+				"Data: null\n" +
+				">";
+		renameRecordComponentFail("A","f","g",errorMsg);
+	}
 }
diff --git a/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/CleanUpPerfTest.java b/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/CleanUpPerfTest.java
index cd1d107..e6c0900 100644
--- a/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/CleanUpPerfTest.java
+++ b/org.eclipse.jdt.ui.tests/performance/org/eclipse/jdt/ui/tests/performance/views/CleanUpPerfTest.java
@@ -90,6 +90,7 @@
 import org.eclipse.jdt.internal.ui.fix.PlainReplacementCleanUp;
 import org.eclipse.jdt.internal.ui.fix.PrimitiveComparisonCleanUp;
 import org.eclipse.jdt.internal.ui.fix.PrimitiveRatherThanWrapperCleanUp;
+import org.eclipse.jdt.internal.ui.fix.PullOutIfFromIfElseCleanUp;
 import org.eclipse.jdt.internal.ui.fix.ReduceIndentationCleanUp;
 import org.eclipse.jdt.internal.ui.fix.RedundantComparatorCleanUp;
 import org.eclipse.jdt.internal.ui.fix.ReturnExpressionCleanUp;
@@ -788,6 +789,22 @@
 	}
 
 	@Test
+	public void testPullOutIfFromIfElseCleanUp() throws Exception {
+		CleanUpRefactoring cleanUpRefactoring= new CleanUpRefactoring();
+		addAllCUs(cleanUpRefactoring, MyTestSetup.fJProject1.getChildren());
+
+		Map<String, String> node= getNullSettings();
+
+		node.put(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE, CleanUpOptions.TRUE);
+
+		storeSettings(node);
+
+		cleanUpRefactoring.addCleanUp(new PullOutIfFromIfElseCleanUp());
+
+		doCleanUp(cleanUpRefactoring);
+	}
+
+	@Test
 	public void testComparingOnCriteriaCleanUp() throws Exception {
 		CleanUpRefactoring cleanUpRefactoring= new CleanUpRefactoring();
 		addAllCUs(cleanUpRefactoring, MyTestSetup.fJProject1.getChildren());
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java
index 8724dbb..60901a5 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -6211,7 +6211,7 @@
 
 		assertExpectedExistInProposals(proposals, new String[] { expected });
 
-	}
+}
 
 	@Test
 	public void testPickOutStringProposals2() throws Exception {
@@ -6709,4 +6709,42 @@
 		assertCorrectLabels(proposals);
 		assertProposalDoesNotExist(proposals, CorrectionMessages.AdvancedQuickAssistProcessor_convertToIfReturn);
 	}
+
+	@Test
+	public void testConvertParamsToFields() throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		String buf= "" +
+				"package test;\n\n" +
+				"package test16_3;\n" +
+				"public class App {\n" +
+				"	private String s;\n" +
+				"\n" +
+				"	public App(String s, String s3, String s2) {\n" +
+				"	}\n" +
+				"}";
+
+		ICompilationUnit cu= pack1.createCompilationUnit("App.java", buf, false, null);
+
+		String str= "String s3";
+		AssistContext context= getCorrectionContext(cu, buf.indexOf(str) + str.length(), 0);
+		List<IJavaCompletionProposal> proposals= collectAssists(context, false);
+		assertProposalExists(proposals, CorrectionMessages.AssignToVariableAssistProposal_assignallparamstofields_description);
+		String expected= "" +
+				"package test;\n\n" +
+				"package test16_3;\n" +
+				"public class App {\n" +
+				"	private String s;\n" +
+				"    private String s4;\n" +
+				"    private String s3;\n" +
+				"    private String s2;\n" +
+				"\n" +
+				"	public App(String s, String s3, String s2) {\n" +
+				"        s4 = s;\n" +
+				"        this.s3 = s3;\n" +
+				"        this.s2 = s2;\n" +
+				"	}\n" +
+				"}";
+
+		assertProposalPreviewEquals(expected, CorrectionMessages.AssignToVariableAssistProposal_assignallparamstofields_description, proposals);
+	}
 }
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest10.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest10.java
index f40e342..a15302d 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest10.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest10.java
@@ -13,6 +13,8 @@
  *******************************************************************************/
 package org.eclipse.jdt.ui.tests.quickfix;
 
+import static org.junit.Assert.assertNotNull;
+
 import java.util.Hashtable;
 import java.util.List;
 
@@ -24,6 +26,8 @@
 import org.eclipse.jdt.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.testplugin.TestOptions;
 
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.IPackageFragment;
@@ -255,4 +259,37 @@
 
 		assertProposalPreviewEquals(buf, CorrectionMessages.QuickAssistProcessor_splitdeclaration_description, proposals);
 	}
+
+	@Test
+	public void testVarOptionAvailableForLocalVarTypeVariable() throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		String buf= "" +
+				"package test1;\n" +
+				"\n" +
+				"import java.io.BufferedReader;\n" +
+				"\n" +
+				"public class Test {\n" +
+				"	public void sample() {\n" +
+				"		new BufferedReader(null);\n" +
+				"	}\n" +
+				"}";
+
+		ICompilationUnit cu= pack1.createCompilationUnit("Test.java", buf.toString(), false, null);
+
+		String str= "new BufferedReader(null)";
+		AssistContext context= getCorrectionContext(cu, buf.indexOf(str) + str.length(), 0);
+		List<IJavaCompletionProposal> proposals= collectAssists(context, false);
+		assertProposalExists(proposals, CorrectionMessages.AssignToVariableAssistProposal_assigntolocal_description);
+		assertProposalExists(proposals, CorrectionMessages.AssignToVariableAssistProposal_assignintrywithresources_description);
+		String[] choices= new String [] { "BufferedReader - java.io", "var" }; // NOT containing IllegalFoo
+
+		ICompletionProposal proposal= findProposalByName(CorrectionMessages.AssignToVariableAssistProposal_assigntolocal_description, proposals);
+		ICompletionProposal proposal2=  findProposalByName(CorrectionMessages.AssignToVariableAssistProposal_assignintrywithresources_description, proposals);
+
+		assertNotNull("Proposal `" + CorrectionMessages.AssignToVariableAssistProposal_assigntolocal_description + "` missing",proposal);
+		assertNotNull("Proposal `" + CorrectionMessages.AssignToVariableAssistProposal_assignintrywithresources_description + "` missing",proposal2);
+
+		assertLinkedChoicesContains(proposal, "type", choices);
+        assertLinkedChoicesContains(proposal2, "type", choices);
+	}
 }
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java
index aa34c4e..962d347 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java
@@ -5629,15 +5629,52 @@
 				+ "\n" //
 				+ "    public void replaceWrapper(boolean b) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        /* c1 */ Boolean /* c2 */ alwaysInitializedVar /* c3 */ = /* c4 */ Boolean.TRUE /* c5 */;\n" //
+				+ "        /* c1 */ Boolean /* c2 */ alwaysInitializedVar /* c3 */ = /* c4 */ true /* c5 */;\n" //
 				+ "        if (alwaysInitializedVar && b) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
 				+ "    }\n" //
+				+ "    public void replaceWrapperAndUseParsing(boolean b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Boolean alwaysInitializedVar = Boolean.valueOf(\"true\");\n" //
+				+ "        if (alwaysInitializedVar && b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "    public String replaceWrapperAndToStringMethod(boolean b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Boolean alwaysInitializedVar = true;\n" //
+				+ "        if (alwaysInitializedVar) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(boolean b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Boolean alwaysInitializedVar = new Boolean(\"true\");\n" //
+				+ "        if (alwaysInitializedVar) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(b);\n" //
+				+ "    }\n" //
+				+ "    public boolean replaceWrapperAndPrimitiveValueMethod() {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Boolean alwaysInitializedVar = true;\n" //
+				+ "        if (alwaysInitializedVar) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.booleanValue();\n" //
+				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(boolean b) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        java.lang.Boolean alwaysInitializedVar = Boolean.FALSE;\n" //
+				+ "        java.lang.Boolean alwaysInitializedVar = false;\n" //
 				+ "        if (alwaysInitializedVar && b) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5645,7 +5682,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInCast() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean alwaysInitializedVar = Boolean.FALSE;\n" //
+				+ "        Boolean alwaysInitializedVar = false;\n" //
 				+ "        if ((boolean) alwaysInitializedVar) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5653,7 +5690,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInParenthesis() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean alwaysInitializedVar = Boolean.FALSE;\n" //
+				+ "        Boolean alwaysInitializedVar = false;\n" //
 				+ "        if ((alwaysInitializedVar)) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5733,7 +5770,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInPrefixExpression() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean alwaysInitializedVar = Boolean.TRUE;\n" //
+				+ "        Boolean alwaysInitializedVar = true;\n" //
 				+ "        if (!alwaysInitializedVar) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5741,7 +5778,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInIf() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean alwaysInitializedVar = Boolean.TRUE;\n" //
+				+ "        Boolean alwaysInitializedVar = true;\n" //
 				+ "        if (alwaysInitializedVar) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5765,19 +5802,19 @@
 				+ "\n" //
 				+ "    public String replaceWrapperInConditionalExpression() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean alwaysInitializedVar = Boolean.TRUE;\n" //
+				+ "        Boolean alwaysInitializedVar = true;\n" //
 				+ "        return alwaysInitializedVar ? \"foo\" : \"bar\";\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public boolean replaceReturnedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean returnedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean returnedBoolean = true;\n" //
 				+ "        return returnedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public boolean replaceMultiReturnedWrapper(int i) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean returnedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean returnedBoolean = true;\n" //
 				+ "        if (i > 0) {\n" //
 				+ "            System.out.println(\"Positive\");\n" //
 				+ "            return returnedBoolean;\n" //
@@ -5789,7 +5826,7 @@
 				+ "\n" //
 				+ "    public Boolean replaceReturnedAutoBoxedWrapper(int i) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean returnedBoolean = Boolean.FALSE;\n" //
+				+ "        Boolean returnedBoolean = false;\n" //
 				+ "        if (i > 0) {\n" //
 				+ "            System.out.println(\"Positive\");\n" //
 				+ "            return returnedBoolean;\n" //
@@ -5801,39 +5838,39 @@
 				+ "\n" //
 				+ "    public void replaceReassignedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean reassignedBoolean = Boolean.TRUE;\n" //
-				+ "        reassignedBoolean = Boolean.FALSE;\n" //
+				+ "        Boolean reassignedBoolean = true;\n" //
+				+ "        reassignedBoolean = false;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceMultiReassignedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean multiReassignedBoolean = Boolean.TRUE;\n" //
-				+ "        multiReassignedBoolean = Boolean.FALSE;\n" //
-				+ "        multiReassignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean multiReassignedBoolean = true;\n" //
+				+ "        multiReassignedBoolean = false;\n" //
+				+ "        multiReassignedBoolean = true;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceAssignedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        Boolean anotherBoolean = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceWrapperAssignedOnBooleanField() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        booleanField = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceWrapperAssignedOnWrapperField() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        wrapperField = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceBitAssignedWrapper(Boolean aBoolean, Boolean anotherBoolean,\n" //
 				+ "            Boolean yetAnotherBoolean) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        aBoolean &= assignedBoolean;\n" //
 				+ "        anotherBoolean |= assignedBoolean;\n" //
 				+ "        yetAnotherBoolean ^= assignedBoolean;\n" //
@@ -5849,15 +5886,52 @@
 				+ "\n" //
 				+ "    public void replaceWrapper(boolean b) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        /* c1 */ boolean /* c2 */ alwaysInitializedVar /* c3 */ = /* c4 */ Boolean.TRUE /* c5 */;\n" //
+				+ "        /* c1 */ boolean /* c2 */ alwaysInitializedVar /* c3 */ = /* c4 */ true /* c5 */;\n" //
 				+ "        if (alwaysInitializedVar && b) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
 				+ "    }\n" //
+				+ "    public void replaceWrapperAndUseParsing(boolean b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        boolean alwaysInitializedVar = Boolean.parseBoolean(\"true\");\n" //
+				+ "        if (alwaysInitializedVar && b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "    public String replaceWrapperAndToStringMethod(boolean b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        boolean alwaysInitializedVar = true;\n" //
+				+ "        if (alwaysInitializedVar) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Boolean.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(boolean b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        boolean alwaysInitializedVar = Boolean.parseBoolean(\"true\");\n" //'				+ "        if (alwaysInitializedVar) {\n" //
+				+ "        if (alwaysInitializedVar) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Boolean.compare(alwaysInitializedVar, b);\n" //
+				+ "    }\n" //
+				+ "    public boolean replaceWrapperAndPrimitiveValueMethod() {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        boolean alwaysInitializedVar = true;\n" //
+				+ "        if (alwaysInitializedVar) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(boolean b) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean alwaysInitializedVar = Boolean.FALSE;\n" //
+				+ "        boolean alwaysInitializedVar = false;\n" //
 				+ "        if (alwaysInitializedVar && b) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5865,7 +5939,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInCast() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean alwaysInitializedVar = Boolean.FALSE;\n" //
+				+ "        boolean alwaysInitializedVar = false;\n" //
 				+ "        if ((boolean) alwaysInitializedVar) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5873,7 +5947,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInParenthesis() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean alwaysInitializedVar = Boolean.FALSE;\n" //
+				+ "        boolean alwaysInitializedVar = false;\n" //
 				+ "        if ((alwaysInitializedVar)) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5921,7 +5995,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperFromValueOf(boolean b1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean varFromValueOf = Boolean.valueOf(b1);\n" //
+				+ "        boolean varFromValueOf = b1;\n" //
 				+ "        if (varFromValueOf) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5953,7 +6027,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInPrefixExpression() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean alwaysInitializedVar = Boolean.TRUE;\n" //
+				+ "        boolean alwaysInitializedVar = true;\n" //
 				+ "        if (!alwaysInitializedVar) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5961,7 +6035,7 @@
 				+ "\n" //
 				+ "    public void replaceWrapperInIf() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean alwaysInitializedVar = Boolean.TRUE;\n" //
+				+ "        boolean alwaysInitializedVar = true;\n" //
 				+ "        if (alwaysInitializedVar) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -5985,19 +6059,19 @@
 				+ "\n" //
 				+ "    public String replaceWrapperInConditionalExpression() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean alwaysInitializedVar = Boolean.TRUE;\n" //
+				+ "        boolean alwaysInitializedVar = true;\n" //
 				+ "        return alwaysInitializedVar ? \"foo\" : \"bar\";\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public boolean replaceReturnedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean returnedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean returnedBoolean = true;\n" //
 				+ "        return returnedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public boolean replaceMultiReturnedWrapper(int i) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean returnedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean returnedBoolean = true;\n" //
 				+ "        if (i > 0) {\n" //
 				+ "            System.out.println(\"Positive\");\n" //
 				+ "            return returnedBoolean;\n" //
@@ -6009,7 +6083,7 @@
 				+ "\n" //
 				+ "    public Boolean replaceReturnedAutoBoxedWrapper(int i) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean returnedBoolean = Boolean.FALSE;\n" //
+				+ "        boolean returnedBoolean = false;\n" //
 				+ "        if (i > 0) {\n" //
 				+ "            System.out.println(\"Positive\");\n" //
 				+ "            return returnedBoolean;\n" //
@@ -6021,39 +6095,39 @@
 				+ "\n" //
 				+ "    public void replaceReassignedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean reassignedBoolean = Boolean.TRUE;\n" //
-				+ "        reassignedBoolean = Boolean.FALSE;\n" //
+				+ "        boolean reassignedBoolean = true;\n" //
+				+ "        reassignedBoolean = false;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceMultiReassignedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean multiReassignedBoolean = Boolean.TRUE;\n" //
-				+ "        multiReassignedBoolean = Boolean.FALSE;\n" //
-				+ "        multiReassignedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean multiReassignedBoolean = true;\n" //
+				+ "        multiReassignedBoolean = false;\n" //
+				+ "        multiReassignedBoolean = true;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceAssignedWrapper() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean assignedBoolean = true;\n" //
 				+ "        Boolean anotherBoolean = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceWrapperAssignedOnBooleanField() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean assignedBoolean = true;\n" //
 				+ "        booleanField = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceWrapperAssignedOnWrapperField() {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean assignedBoolean = true;\n" //
 				+ "        wrapperField = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void replaceBitAssignedWrapper(Boolean aBoolean, Boolean anotherBoolean,\n" //
 				+ "            Boolean yetAnotherBoolean) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        boolean assignedBoolean = true;\n" //
 				+ "        aBoolean &= assignedBoolean;\n" //
 				+ "        anotherBoolean |= assignedBoolean;\n" //
 				+ "        yetAnotherBoolean ^= assignedBoolean;\n" //
@@ -6079,48 +6153,53 @@
 				+ "import java.util.Observable;\n" //
 				+ "\n" //
 				+ "public class E {\n" //
-				+ "    public Boolean doNotRefactorFields = Boolean.TRUE;\n" //
+				+ "    public Boolean doNotRefactorFields = true;\n" //
 				+ "    public Object objectField;\n" //
 				+ "\n" //
 				+ "    public Object doNotBreakAutoboxing() {\n" //
+				+ "        Boolean returnedObject = true;\n" //
+				+ "        return returnedObject;\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public Boolean doNotUsePrimitiveWithWrappedInitializer() {\n" //
 				+ "        Boolean returnedObject = Boolean.TRUE;\n" //
 				+ "        return returnedObject;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotReplaceNullWrapper() {\n" //
-				+ "        Boolean reassignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean reassignedBoolean = true;\n" //
 				+ "        reassignedBoolean = null;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotReplaceWrapperPassedAsObject(Map<Boolean, Observable> obsByBoolean) {\n" //
-				+ "        Boolean reassignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean reassignedBoolean = true;\n" //
 				+ "        obsByBoolean.get(reassignedBoolean).notifyObservers();\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotReplaceWrapperAssignedOnObjectField() {\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        objectField = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotReplaceMultiAssignedWrapper() {\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        Boolean anotherBoolean = assignedBoolean;\n" //
 				+ "        Boolean yetAnotherBoolean = assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public Boolean doNotReplaceMultiAutoBoxedWrapper() {\n" //
-				+ "        Boolean assignedBoolean = Boolean.TRUE;\n" //
+				+ "        Boolean assignedBoolean = true;\n" //
 				+ "        Boolean anotherBoolean = assignedBoolean;\n" //
 				+ "        return assignedBoolean;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotBreakAutoboxingOnAssignment() {\n" //
-				+ "        Boolean returnedObject = Boolean.TRUE;\n" //
+				+ "        Boolean returnedObject = true;\n" //
 				+ "        Object anotherObject = returnedObject;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotReplaceRessignedWrapper(Boolean b) {\n" //
-				+ "        Boolean returnedObject = Boolean.TRUE;\n" //
+				+ "        Boolean returnedObject = true;\n" //
 				+ "        try {\n" //
 				+ "            returnedObject = b;\n" //
 				+ "        } catch (Exception e) {\n" //
@@ -6129,13 +6208,13 @@
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public Boolean doNotReplaceAssignedAndReturnedWrapper(Boolean b) {\n" //
-				+ "        Boolean returnedObject = Boolean.FALSE;\n" //
+				+ "        Boolean returnedObject = false;\n" //
 				+ "        returnedObject = b;\n" //
 				+ "        return returnedObject;\n" //
 				+ "    }\n" //
 				+ "\n" //
 				+ "    public void doNotRefactorMultiDeclaration(boolean isValid) {\n" //
-				+ "        Boolean alwaysInitializedVar = Boolean.TRUE, otherVar;\n" //
+				+ "        Boolean alwaysInitializedVar = true, otherVar;\n" //
 				+ "        if (alwaysInitializedVar && isValid) {\n" //
 				+ "            System.out.println(\"True!\");\n" //
 				+ "        }\n" //
@@ -6167,6 +6246,39 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(char c) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Character alwaysInitializedVar = Character.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > c) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(char c) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Character alwaysInitializedVar = Character.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > c) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(c);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public char replaceWrapperAndPrimitiveValueMethod(char c) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Character alwaysInitializedVar = Character.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > c) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.charValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(char c) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Character alwaysInitializedVar = Character.MAX_VALUE;\n" //
@@ -6350,6 +6462,39 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(char c) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        char alwaysInitializedVar = Character.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > c) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Character.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(char c) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        char alwaysInitializedVar = Character.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > c) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Character.compare(alwaysInitializedVar, c);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public char replaceWrapperAndPrimitiveValueMethod(char c) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        char alwaysInitializedVar = Character.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > c) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(char c) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        char alwaysInitializedVar = Character.MAX_VALUE;\n" //
@@ -6384,7 +6529,7 @@
 				+ "\n" //
 				+ "    public int replaceWrapperFromValueOf(char c1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        char varFromValueOf = Character.valueOf(c1);\n" //
+				+ "        char varFromValueOf = c1;\n" //
 				+ "        return +varFromValueOf;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -6609,6 +6754,47 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Byte alwaysInitializedVar = Byte.valueOf(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Byte alwaysInitializedVar = Byte.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Byte alwaysInitializedVar = new Byte(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(b);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public byte replaceWrapperAndPrimitiveValueMethod(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Byte alwaysInitializedVar = Byte.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.byteValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(byte b) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Byte alwaysInitializedVar = Byte.MAX_VALUE;\n" //
@@ -6789,6 +6975,47 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        byte alwaysInitializedVar = Byte.parseByte(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        byte alwaysInitializedVar = Byte.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Byte.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        byte alwaysInitializedVar = Byte.parseByte(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Byte.compare(alwaysInitializedVar, b);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public byte replaceWrapperAndPrimitiveValueMethod(byte b) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        byte alwaysInitializedVar = Byte.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > b) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(byte b) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        byte alwaysInitializedVar = Byte.MAX_VALUE;\n" //
@@ -6823,7 +7050,7 @@
 				+ "\n" //
 				+ "    public byte replaceWrapperFromValueOf(byte b1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        byte varFromValueOf = Byte.valueOf(b1);\n" //
+				+ "        byte varFromValueOf = b1;\n" //
 				+ "        return varFromValueOf++;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -7045,6 +7272,55 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Short alwaysInitializedVar = Short.valueOf(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndConstructor(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Short alwaysInitializedVar = new Short(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Short alwaysInitializedVar = Short.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Short alwaysInitializedVar = new Short(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(s);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public short replaceWrapperAndPrimitiveValueMethod(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Short alwaysInitializedVar = Short.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.shortValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(short s) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Short alwaysInitializedVar = Short.MIN_VALUE;\n" //
@@ -7231,6 +7507,55 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        short alwaysInitializedVar = Short.parseShort(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndConstructor(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        short alwaysInitializedVar = Short.parseShort(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        short alwaysInitializedVar = Short.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Short.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        short alwaysInitializedVar = Short.parseShort(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Short.compare(alwaysInitializedVar, s);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public short replaceWrapperAndPrimitiveValueMethod(short s) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        short alwaysInitializedVar = Short.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > s) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(short s) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        short alwaysInitializedVar = Short.MIN_VALUE;\n" //
@@ -7268,7 +7593,7 @@
 				+ "\n" //
 				+ "    public short replaceWrapperFromValueOf(short s1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        short varFromValueOf = Short.valueOf(s1);\n" //
+				+ "        short varFromValueOf = s1;\n" //
 				+ "        return varFromValueOf++;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -7493,6 +7818,55 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Integer alwaysInitializedVar = Integer.valueOf(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsingWithRadix(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Integer alwaysInitializedVar = Integer.valueOf(\"0\", 10);\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Integer alwaysInitializedVar = Integer.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Integer alwaysInitializedVar = new Integer(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(i);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndPrimitiveValueMethod(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Integer alwaysInitializedVar = Integer.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.intValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(int i) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Integer alwaysInitializedVar = Integer.MAX_VALUE;\n" //
@@ -7733,6 +8107,55 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        int alwaysInitializedVar = Integer.parseInt(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsingWithRadix(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        int alwaysInitializedVar = Integer.parseInt(\"0\", 10);\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        int alwaysInitializedVar = Integer.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Integer.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        int alwaysInitializedVar = Integer.parseInt(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Integer.compare(alwaysInitializedVar, i);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndPrimitiveValueMethod(int i) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        int alwaysInitializedVar = Integer.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > i) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(int i) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        int alwaysInitializedVar = Integer.MAX_VALUE;\n" //
@@ -7818,7 +8241,7 @@
 				+ "\n" //
 				+ "    public int replaceWrapperFromValueOf(int i1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        int varFromValueOf = Integer.valueOf(i1);\n" //
+				+ "        int varFromValueOf = i1;\n" //
 				+ "        return varFromValueOf++;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -8049,6 +8472,63 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Long alwaysInitializedVar = Long.valueOf(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsingWithRadix(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Long alwaysInitializedVar = Long.valueOf(\"0\", 10);\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndConstructor(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Long alwaysInitializedVar = new Long(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Long alwaysInitializedVar = Long.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Long alwaysInitializedVar = new Long(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(l);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public long replaceWrapperAndPrimitiveValueMethod(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Long alwaysInitializedVar = Long.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.longValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(long l) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Long alwaysInitializedVar = Long.MIN_VALUE;\n" //
@@ -8266,6 +8746,63 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        long alwaysInitializedVar = Long.parseLong(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsingWithRadix(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        long alwaysInitializedVar = Long.parseLong(\"0\", 10);\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndConstructor(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        long alwaysInitializedVar = Long.parseLong(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        long alwaysInitializedVar = Long.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Long.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        long alwaysInitializedVar = Long.parseLong(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Long.compare(alwaysInitializedVar, l);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public long replaceWrapperAndPrimitiveValueMethod(long l) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        long alwaysInitializedVar = Long.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > l) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(long l) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        long alwaysInitializedVar = Long.MIN_VALUE;\n" //
@@ -8351,7 +8888,7 @@
 				+ "\n" //
 				+ "    public long replaceWrapperFromValueOf(long l1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        long varFromValueOf = Long.valueOf(l1);\n" //
+				+ "        long varFromValueOf = l1;\n" //
 				+ "        return varFromValueOf++;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -8559,6 +9096,47 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Float alwaysInitializedVar = Float.valueOf(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Float alwaysInitializedVar = Float.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Float alwaysInitializedVar = new Float(\"0.0\");\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(f);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public float replaceWrapperAndPrimitiveValueMethod(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Float alwaysInitializedVar = Float.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.floatValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(float f) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Float alwaysInitializedVar = Float.MIN_VALUE;\n" //
@@ -8759,6 +9337,47 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        float alwaysInitializedVar = Float.parseFloat(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        float alwaysInitializedVar = Float.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Float.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        float alwaysInitializedVar = Float.parseFloat(\"0.0\");\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Float.compare(alwaysInitializedVar, f);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public float replaceWrapperAndPrimitiveValueMethod(float f) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        float alwaysInitializedVar = Float.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > f) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(float f) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        float alwaysInitializedVar = Float.MIN_VALUE;\n" //
@@ -8826,7 +9445,7 @@
 				+ "\n" //
 				+ "    public float replaceWrapperFromValueOf(float f1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        float varFromValueOf = Float.valueOf(f1);\n" //
+				+ "        float varFromValueOf = f1;\n" //
 				+ "        return varFromValueOf++;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -9035,6 +9654,55 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Double alwaysInitializedVar = Double.valueOf(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndConstructor(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Double alwaysInitializedVar = new Double(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Double alwaysInitializedVar = Double.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.toString();\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Double alwaysInitializedVar = new Double(\"0.0\");\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.compareTo(d);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public double replaceWrapperAndPrimitiveValueMethod(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        Double alwaysInitializedVar = Double.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar.doubleValue();\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(double d) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        java.lang.Double alwaysInitializedVar = Double.MAX_VALUE;\n" //
@@ -9246,6 +9914,55 @@
 				+ "        }\n" //
 				+ "    }\n" //
 				+ "\n" //
+				+ "    public void replaceWrapperAndUseParsing(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        double alwaysInitializedVar = Double.parseDouble(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void replaceWrapperAndConstructor(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        double alwaysInitializedVar = Double.parseDouble(\"0\");\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public String replaceWrapperAndToStringMethod(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        double alwaysInitializedVar = Double.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Double.toString(alwaysInitializedVar);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public int replaceWrapperAndCompareToMethod(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        double alwaysInitializedVar = Double.parseDouble(\"0.0\");\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return Double.compare(alwaysInitializedVar, d);\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public double replaceWrapperAndPrimitiveValueMethod(double d) {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        double alwaysInitializedVar = Double.MIN_VALUE;\n" //
+				+ "        if (alwaysInitializedVar > d) {\n" //
+				+ "            System.out.println(\"True!\");\n" //
+				+ "        }\n" //
+				+ "\n" //
+				+ "        // Keep this comment too\n" //
+				+ "        return alwaysInitializedVar;\n" //
+				+ "    }\n" //
+				+ "\n" //
 				+ "    public void replaceFullyQualifiedWrapper(double d) {\n" //
 				+ "        // Keep this comment\n" //
 				+ "        double alwaysInitializedVar = Double.MAX_VALUE;\n" //
@@ -9313,7 +10030,7 @@
 				+ "\n" //
 				+ "    public double replaceWrapperFromValueOf(double d1) {\n" //
 				+ "        // Keep this comment\n" //
-				+ "        double varFromValueOf = Double.valueOf(d1);\n" //
+				+ "        double varFromValueOf = d1;\n" //
 				+ "        return varFromValueOf++;\n" //
 				+ "    }\n" //
 				+ "\n" //
@@ -13924,6 +14641,173 @@
 	}
 
 	@Test
+	public void testPullOutIfFromIfElse() throws Exception {
+		// Given
+		IPackageFragment pack= fSourceFolder.createPackageFragment("test1", false, null);
+		String given= "" //
+				+ "package test1;\n" //
+				+ "\n" //
+				+ "public class E {\n" //
+				+ "    public void refactorCommonInnerIf(boolean b1, boolean b2) throws Exception {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        if (b1) {\n" //
+				+ "            if (b2) {\n" //
+				+ "                // Keep this comment too\n" //
+				+ "                System.out.println(b1);\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (b2) {\n" //
+				+ "                // Keep this comment too\n" //
+				+ "                System.out.println(!b1);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void refactorWithoutBrackets(boolean isValid, boolean isCreation) {\n" //
+				+ "        if (isValid) {\n" //
+				+ "            if (isCreation) {\n" //
+				+ "                // Keep this comment\n" //
+				+ "                System.out.println(isValid);\n" //
+				+ "            }\n" //
+				+ "        } else if (isCreation) {\n" //
+				+ "            // Keep this comment\n" //
+				+ "            System.out.println(!isValid);\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "}\n";
+
+		String expected= "" //
+				+ "package test1;\n" //
+				+ "\n" //
+				+ "public class E {\n" //
+				+ "    public void refactorCommonInnerIf(boolean b1, boolean b2) throws Exception {\n" //
+				+ "        // Keep this comment\n" //
+				+ "        if (b2) {\n" //
+				+ "            if (b1) {\n" //
+				+ "                // Keep this comment too\n" //
+				+ "                System.out.println(b1);\n" //
+				+ "            } else {\n" //
+				+ "                // Keep this comment too\n" //
+				+ "                System.out.println(!b1);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void refactorWithoutBrackets(boolean isValid, boolean isCreation) {\n" //
+				+ "        if (isCreation) {\n" //
+				+ "            if (isValid) {\n" //
+				+ "                // Keep this comment\n" //
+				+ "                System.out.println(isValid);\n" //
+				+ "            } else {\n" //
+				+ "                // Keep this comment\n" //
+				+ "                System.out.println(!isValid);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "}\n";
+
+		// When
+		ICompilationUnit cu= pack.createCompilationUnit("E.java", given, false, null);
+		enable(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE);
+
+		// Then
+		assertNotEquals("The class must be changed", given, expected);
+		assertRefactoringResultAsExpected(new ICompilationUnit[] { cu }, new String[] { expected }, new HashSet<>(Arrays.asList(MultiFixMessages.PullOutIfFromIfElseCleanUp_description)));
+	}
+
+	@Test
+	public void testDoNotPullOutIfFromIfElse() throws Exception {
+		IPackageFragment pack= fSourceFolder.createPackageFragment("test1", false, null);
+		String sample= "" //
+				+ "package test1;\n" //
+				+ "\n" //
+				+ "import java.util.List;\n" //
+				+ "\n" //
+				+ "public class E {\n" //
+				+ "    public void doNotRefactorBecauseOfInnerElse1(boolean isActive, boolean isFound) throws Exception {\n" //
+				+ "        if (isActive) {\n" //
+				+ "            if (isFound) {\n" //
+				+ "                System.out.println(isFound);\n" //
+				+ "            } else {\n" //
+				+ "                System.out.println(isActive);\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (isFound) {\n" //
+				+ "                System.out.println(!isActive);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void doNotRefactorBecauseOfInnerElse2(boolean isActive, boolean isFound) throws Exception {\n" //
+				+ "        if (isActive) {\n" //
+				+ "            if (isFound) {\n" //
+				+ "                System.out.println(isActive);\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (isFound) {\n" //
+				+ "                System.out.println(isFound);\n" //
+				+ "            } else {\n" //
+				+ "                System.out.println(!isActive);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void doNotRefactorActiveCondition(List<String> myList) throws Exception {\n" //
+				+ "        if (myList.remove(\"lorem\")) {\n" //
+				+ "            if (myList.isEmpty()) {\n" //
+				+ "                System.out.println(\"Now empty\");\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (myList.isEmpty()) {\n" //
+				+ "                System.out.println(\"Still empty\");\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void doNotRefactorAssignment(boolean isActive, boolean isFound) throws Exception {\n" //
+				+ "        if (isFound = isActive) {\n" //
+				+ "            if (isFound) {\n" //
+				+ "                System.out.println(isActive);\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (isFound) {\n" //
+				+ "                System.out.println(!isActive);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void doNotRefactorPostincrement(int i1, int i2) throws Exception {\n" //
+				+ "        if (i1 == i2++) {\n" //
+				+ "            if (i2 == 0) {\n" //
+				+ "                System.out.println(i1);\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (i2 == 0) {\n" //
+				+ "                System.out.println(-i1);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "\n" //
+				+ "    public void doNotRefactorPreincrement(int i1, int i2) throws Exception {\n" //
+				+ "        if (i1 == ++i2) {\n" //
+				+ "            if (i2 == 0) {\n" //
+				+ "                System.out.println(i1);\n" //
+				+ "            }\n" //
+				+ "        } else {\n" //
+				+ "            if (i2 == 0) {\n" //
+				+ "                System.out.println(-i1);\n" //
+				+ "            }\n" //
+				+ "        }\n" //
+				+ "    }\n" //
+				+ "}\n";
+		ICompilationUnit cu= pack.createCompilationUnit("E.java", sample, false, null);
+
+		enable(CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE);
+
+		assertRefactoringHasNoChange(new ICompilationUnit[] { cu });
+	}
+
+	@Test
 	public void testRedundantComparator() throws Exception {
 		// Given
 		IPackageFragment pack= fSourceFolder.createPackageFragment("test1", false, null);
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest11.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest11.java
index 863a0aa..5ef7b35 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest11.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest11.java
@@ -559,6 +559,12 @@
 				+ "            System.err.println(\"Text must not be blank\");\n" //
 				+ "        }\n" //
 				+ "    }\n" //
+				+ "\n" //
+				+ "    void bug_573831(String text) {\n" //
+				+ "        if (equals(text.strip())) {\n" //
+				+ "            System.err.println(\"Applying the cleanup should not cause NPE\");\n" //
+				+ "        }\n" //
+				+ "    }\n" //
 				+ "}\n";
 		ICompilationUnit cu= pack.createCompilationUnit("NotAString.java", sample, false, null);
 
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest1d5.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest1d5.java
index 35b1434..bda9c3b 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest1d5.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest1d5.java
@@ -14,7 +14,10 @@
 package org.eclipse.jdt.ui.tests.quickfix;
 
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.Arrays;
 import java.util.HashSet;
 
@@ -2858,6 +2861,71 @@
 	}
 
 	@Test
+	public void testUnnecessaryArray_default_package() throws Exception {
+		try {
+			// Given
+			IPackageFragment pack1= fSourceFolder.createPackageFragment("", false, null);
+			String given= "" //
+					+ "public class A {\n" //
+					+ "    public class B {\n" //
+					+ "        public void foo(Object elementsOrTreePaths, Integer obj, Integer obj2) {\n" //
+					+ "            return;\n" //
+					+ "        }\n" //
+					+ "    }\n" //
+					+ "\n" //
+					+ "    public class C extends B {\n" //
+					+ "        public void foo(Object... elementsOrTreePaths) {\n" //
+					+ "            return;\n" //
+					+ "        }\n" //
+					+ "\n" //
+					+ "        public void foo(Object elementsOrTreePaths, Integer obj) {\n" //
+					+ "            foo(new Object[] {elementsOrTreePaths, obj});\n" //
+					+ "            foo(new Object[] {elementsOrTreePaths, elementsOrTreePaths});\n" //
+					+ "            foo(new Object[] {elementsOrTreePaths, obj, obj});\n" //
+					+ "            foo(new Object[] {elementsOrTreePaths, obj, elementsOrTreePaths});\n" //
+					+ "        }\n" //
+					+ "    }\n" //
+					+ "}\n";
+
+			String expected= "" //
+					+ "public class A {\n" //
+					+ "    public class B {\n" //
+					+ "        public void foo(Object elementsOrTreePaths, Integer obj, Integer obj2) {\n" //
+					+ "            return;\n" //
+					+ "        }\n" //
+					+ "    }\n" //
+					+ "\n" //
+					+ "    public class C extends B {\n" //
+					+ "        public void foo(Object... elementsOrTreePaths) {\n" //
+					+ "            return;\n" //
+					+ "        }\n" //
+					+ "\n" //
+					+ "        public void foo(Object elementsOrTreePaths, Integer obj) {\n" //
+					+ "            foo(new Object[] {elementsOrTreePaths, obj});\n" //
+					+ "            foo(elementsOrTreePaths, elementsOrTreePaths);\n" //
+					+ "            foo(new Object[] {elementsOrTreePaths, obj, obj});\n" //
+					+ "            foo(elementsOrTreePaths, obj, elementsOrTreePaths);\n" //
+					+ "        }\n" //
+					+ "    }\n" //
+					+ "}\n";
+
+			// When
+			ICompilationUnit cu= pack1.createCompilationUnit("A.java", given, false, null);
+			enable(CleanUpConstants.REMOVE_UNNECESSARY_ARRAY_CREATION);
+
+			// Then
+			assertNotEquals("The class must be changed", given, expected);
+			assertRefactoringResultAsExpected(new ICompilationUnit[] { cu }, new String[] { expected },
+					new HashSet<>(Arrays.asList(FixMessages.UnusedCodeFix_RemoveUnnecessaryArrayCreation_description)));
+		} catch (Exception e) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            e.printStackTrace(pw);
+            fail(sw.toString());
+		}
+	}
+
+	@Test
 	public void testUnnecessaryEmptyArray() throws Exception {
 		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
 		String sample= "" //
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/QuickFixTest.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/QuickFixTest.java
index 023015f..360f14e 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/QuickFixTest.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/QuickFixTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -601,6 +601,22 @@
 			assertEquals("Unexpected choice", expectedChoices[i], sortedChoices.get(i));
 		}
 	}
+	protected void assertLinkedChoicesContains(ICompletionProposal proposal, String linkedGroup, String[] expectedChoices) throws CoreException{
+		assertTrue("Not a LinkedCorrectionProposal", proposal instanceof LinkedCorrectionProposal);
+		LinkedCorrectionProposal linkedProposal = (LinkedCorrectionProposal)proposal;
+		linkedProposal.getChange(); // force computing the proposal details
+		LinkedProposalModel linkedProposalModel = linkedProposal.getLinkedProposalModel();
+		LinkedProposalPositionGroup positionGroup = linkedProposalModel.getPositionGroup(linkedGroup, false);
+		Proposal[] choices = positionGroup.getProposals();
+		assertTrue("Contains less number of choices", choices.length >= expectedChoices.length);
+		List<String> sortedChoices= Arrays.stream(choices)
+									.map(Proposal::getDisplayString)
+									.sorted()
+									.collect(Collectors.toList());
+		for (int i=0; i<expectedChoices.length; i++) {
+			assertTrue("choice not found" + expectedChoices[i], sortedChoices.contains(expectedChoices[i]));
+		}
+	}
 
 	/**
 	 * Computes the number of warnings the java file "filename" has.
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java
index d7511b9..714c63f 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java
@@ -171,6 +171,7 @@
 		options.setOption(MERGE_CONDITIONAL_BLOCKS, CleanUpOptions.FALSE);
 		options.setOption(CONTROLFLOW_MERGE, CleanUpOptions.FALSE);
 		options.setOption(ONE_IF_RATHER_THAN_DUPLICATE_BLOCKS_THAT_FALL_THROUGH, CleanUpOptions.TRUE);
+		options.setOption(PULL_OUT_IF_FROM_IF_ELSE, CleanUpOptions.FALSE);
 
 		// Java Features
 		options.setOption(USE_PATTERN_MATCHING_FOR_INSTANCEOF, CleanUpOptions.FALSE);
@@ -346,6 +347,7 @@
 		options.setOption(MERGE_CONDITIONAL_BLOCKS, CleanUpOptions.FALSE);
 		options.setOption(CONTROLFLOW_MERGE, CleanUpOptions.FALSE);
 		options.setOption(ONE_IF_RATHER_THAN_DUPLICATE_BLOCKS_THAT_FALL_THROUGH, CleanUpOptions.FALSE);
+		options.setOption(PULL_OUT_IF_FROM_IF_ELSE, CleanUpOptions.FALSE);
 
 		// Java Features
 		options.setOption(USE_PATTERN_MATCHING_FOR_INSTANCEOF, CleanUpOptions.FALSE);
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnnecessaryArrayCreationFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnnecessaryArrayCreationFix.java
index c61ea19..b8b68d5 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnnecessaryArrayCreationFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnnecessaryArrayCreationFix.java
@@ -163,7 +163,11 @@
 					if (root instanceof CompilationUnit) {
 						CompilationUnit compilationUnit= (CompilationUnit) root;
 						List<ImportDeclaration> imports= compilationUnit.imports();
-						String localPackage= compilationUnit.getPackage().getName().getFullyQualifiedName();
+						String localPackage= null;
+
+						if (compilationUnit.getPackage() != null && compilationUnit.getPackage().getName() != null) {
+							localPackage= compilationUnit.getPackage().getName().getFullyQualifiedName();
+						}
 
 						for (ImportDeclaration oneImport : imports) {
 							if (oneImport.isStatic()
@@ -173,11 +177,16 @@
 								String methodIdentifier= methodName.getName().getIdentifier();
 								ITypeBinding conflictingType= methodName.getQualifier().resolveTypeBinding();
 
-								if (conflictingType == null || conflictingType.getPackage() == null) {
+								if (conflictingType == null) {
 									return true; // Error on side of caution
 								}
 
-								String importPackage= conflictingType.getPackage().getName();
+								String importPackage= null;
+
+								if (conflictingType.getPackage() != null) {
+									importPackage= conflictingType.getPackage().getName();
+								}
+
 								boolean inSamePackage= Objects.equals(localPackage, importPackage);
 
 								for (IMethodBinding declaredMethod : conflictingType.getDeclaredMethods()) {
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameFieldProcessor.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameFieldProcessor.java
index 55d1fb1..6371621 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameFieldProcessor.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameFieldProcessor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -61,6 +61,7 @@
 import org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor;
 import org.eclipse.jdt.core.search.IJavaSearchConstants;
 import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.MethodReferenceMatch;
 import org.eclipse.jdt.core.search.SearchEngine;
 import org.eclipse.jdt.core.search.SearchMatch;
 import org.eclipse.jdt.core.search.SearchPattern;
@@ -557,8 +558,8 @@
 				pm.worked(1);
 			}
 
-			if (getAccessor() != null && fIsRecordComponent){
-				result.merge(checkAccessor(new SubProgressMonitor(pm, 1), getAccessor(), getNewElementName()));
+			if (fIsRecordComponent){
+				result.merge(checkRecordComponentAccessor(new SubProgressMonitor(pm, 1), getAccessor(), getNewElementName()));
 				result.merge(Checks.checkIfConstructorName(getAccessor(), getNewElementName(), fField.getDeclaringType().getElementName()));
 			} else {
 				pm.worked(1);
@@ -591,6 +592,15 @@
 		return result;
 	}
 
+	private RefactoringStatus checkRecordComponentAccessor(IProgressMonitor pm, IMethod existingAccessor, String newAccessorName) throws CoreException{
+		RefactoringStatus result= new RefactoringStatus();
+		if (existingAccessor != null) {
+			result.merge(checkAccessorDeclarations(pm, existingAccessor));
+		}
+		result.merge(checkNewRecordComponentAccessor(newAccessorName));
+		return result;
+	}
+
 	private RefactoringStatus checkNewAccessor(IMethod existingAccessor, String newAccessorName) throws CoreException{
 		RefactoringStatus result= new RefactoringStatus();
 		IMethod accessor= JavaModelUtil.findMethod(newAccessorName, existingAccessor.getParameterTypes(), false, fField.getDeclaringType());
@@ -603,6 +613,17 @@
 		return result;
 	}
 
+	private RefactoringStatus checkNewRecordComponentAccessor(String newAccessorName) throws CoreException{
+		RefactoringStatus result= new RefactoringStatus();
+		IMethod accessor= JavaModelUtil.findMethod(newAccessorName, new String[]{}, false, fField.getDeclaringType());
+		if (accessor == null || !accessor.exists())
+			return null;
+		String message= Messages.format(RefactoringCoreMessages.RenameFieldRefactoring_recordromponent_accessor_method_already_exists,
+				new String[]{JavaElementUtil.createMethodSignature(accessor), BasicElementLabels.getJavaElementName(fField.getDeclaringType().getFullyQualifiedName('.'))});
+		result.addError(message, JavaStatusContext.create(accessor));
+		return result;
+	}
+
 	private RefactoringStatus checkAccessorDeclarations(IProgressMonitor pm, IMethod existingAccessor) throws CoreException{
 		RefactoringStatus result= new RefactoringStatus();
 		SearchPattern pattern= SearchPattern.createPattern(existingAccessor, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
@@ -694,10 +715,46 @@
 		SearchResultGroup[] result= RefactoringSearchEngine.search(createSearchPattern(), createRefactoringScope(),
 				new CuCollectingSearchRequestor(binaryRefs), pm, status);
 		binaryRefs.addErrorIfNecessary(status);
-
+		result= filterAccessorMethods(result, true);
 		return result;
 	}
 
+	/**
+	 * @param grouped the list that needs to be filtered
+	 * @param filterOut if <code>true</code>, filters out the references to record component
+	 *            accessor methods. If <code>false</code>, returns only the references to record
+	 *            component accessor methods.
+	 * @return the filtered list
+	 */
+	private SearchResultGroup[] filterAccessorMethods(SearchResultGroup[] grouped, boolean filterOut) {
+		if (this.fIsRecordComponent) {
+			List<SearchResultGroup> result= new ArrayList<>();
+			for (SearchResultGroup g : grouped) {
+				SearchMatch[] matches= g.getSearchResults();
+				List<SearchMatch> newList= new ArrayList<>();
+				for (SearchMatch match : matches) {
+					if (match instanceof MethodReferenceMatch) {
+						if (filterOut) {
+							continue;
+						}
+						newList.add(match);
+					} else if (filterOut) {
+						newList.add(match);
+					}
+				}
+				if (newList.size() != matches.length) {
+					result.add(new SearchResultGroup(g.getResource(), newList.toArray(new SearchMatch[newList.size()])));
+				} else {
+					result.add(g);
+				}
+			}
+			return result.toArray(new SearchResultGroup[result.size()]);
+		} else {
+			return grouped;
+		}
+
+	}
+
 	@Override
 	public Change createChange(IProgressMonitor monitor) throws CoreException {
 		try {
@@ -954,20 +1011,23 @@
 
 	private void addFieldAccessorOccurrences(IProgressMonitor pm, String editName, String newAccessorName, RefactoringStatus status) throws CoreException {
 		Assert.isTrue(fField.exists());
-
+		String fieldName= fField.getElementName();
 		IJavaSearchScope scope= RefactoringScopeFactory.create(fField.getDeclaringType());
-		String patternStr= getCurrentElementQualifier() + '.' + fField.getElementName();
-		SearchPattern pattern= SearchPattern.createPattern(patternStr, IJavaSearchConstants.METHOD,
-				IJavaSearchConstants.REFERENCES, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH);
-		SearchResultGroup[] groupedResults= RefactoringSearchEngine.search(
-				pattern, scope, new MethodOccurenceCollector(fField.getElementName()), pm, status);
-		for (SearchResultGroup groupedResult : groupedResults) {
+
+		String binaryRefsDescription= Messages.format(RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description , BasicElementLabels.getJavaElementName(getCurrentElementName()));
+		ReferencesInBinaryContext binaryRefs= new ReferencesInBinaryContext(binaryRefsDescription);
+
+		SearchResultGroup[] result= RefactoringSearchEngine.search(createSearchPattern(), scope,
+				new CuCollectingSearchRequestor(binaryRefs), pm, status);
+		binaryRefs.addErrorIfNecessary(status);
+		result= filterAccessorMethods(result, false);
+		for (SearchResultGroup groupedResult : result) {
 			ICompilationUnit cu= groupedResult.getCompilationUnit();
 			if (cu == null)
 				continue;
 			SearchMatch[] results= groupedResult.getSearchResults();
 			for (SearchMatch searchResult : results) {
-				TextEdit edit= new ReplaceEdit(searchResult.getOffset(), searchResult.getLength(), newAccessorName);
+				TextEdit edit= new ReplaceEdit(searchResult.getOffset(), fieldName.length(), newAccessorName);
 				addTextEdit(fChangeManager.get(cu), editName, edit);
 			}
 		}
diff --git a/org.eclipse.jdt.ui/plugin.xml b/org.eclipse.jdt.ui/plugin.xml
index 95a41ea..02ac38f 100644
--- a/org.eclipse.jdt.ui/plugin.xml
+++ b/org.eclipse.jdt.ui/plugin.xml
@@ -7428,9 +7428,14 @@
             runAfter="org.eclipse.jdt.ui.cleanup.redundant_falling_through_block_end">
       </cleanUp>
       <cleanUp
+            class="org.eclipse.jdt.internal.ui.fix.PullOutIfFromIfElseCleanUp"
+            id="org.eclipse.jdt.ui.pull_out_if_from_if_else"
+            runAfter="org.eclipse.jdt.ui.cleanup.if_condition">
+      </cleanUp>
+      <cleanUp
             class="org.eclipse.jdt.internal.ui.fix.PatternMatchingForInstanceofCleanUp"
             id="org.eclipse.jdt.ui.cleanup.pattern_matching"
-            runAfter="org.eclipse.jdt.ui.cleanup.if_condition">
+            runAfter="org.eclipse.jdt.ui.pull_out_if_from_if_else">
       </cleanUp>
       <cleanUp
             class="org.eclipse.jdt.internal.ui.fix.SwitchExpressionsCleanUp"
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/ConvertLoopCleanUp.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/ConvertLoopCleanUp.java
index d011c31..1cb36c8 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/ConvertLoopCleanUp.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/ConvertLoopCleanUp.java
@@ -63,9 +63,10 @@
 		List<String> result= new ArrayList<>();
 
 		if (isEnabled(CleanUpConstants.CONTROL_STATEMENTS_CONVERT_FOR_LOOP_TO_ENHANCED)) {
-			result.add(MultiFixMessages.Java50CleanUp_ConvertToEnhancedForLoop_description);
 			if (isEnabled(CleanUpConstants.CONTROL_STATEMENTS_CONVERT_FOR_LOOP_ONLY_IF_LOOP_VAR_USED)) {
 				result.add(MultiFixMessages.Java50CleanUp_ConvertLoopOnlyIfLoopVarUsed_description);
+			} else {
+				result.add(MultiFixMessages.Java50CleanUp_ConvertToEnhancedForLoop_description);
 			}
 		}
 		return result.toArray(new String[result.size()]);
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/PullOutIfFromIfElseCleanUp.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/PullOutIfFromIfElseCleanUp.java
new file mode 100644
index 0000000..a2aa9b1
--- /dev/null
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/PullOutIfFromIfElseCleanUp.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Fabrice TIERCELIN and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *     Fabrice TIERCELIN - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.fix;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jdt.core.manipulation.ICleanUpFixCore;
+
+import org.eclipse.jdt.ui.cleanup.CleanUpContext;
+import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
+import org.eclipse.jdt.ui.cleanup.CleanUpRequirements;
+import org.eclipse.jdt.ui.cleanup.ICleanUpFix;
+
+/**
+ * A fix that moves an inner <code>if</code> condition around the outer <code>if</code> condition:
+ * <ul>
+ * <li>The inner <code>if</code> condition should be common to both <code>if</code>/<code>else</code> clauses of the outer <code>if</code> statement,</li>
+ * <li>The <code>if</code> conditions should be passive.</li>
+ * </ul>
+ */
+public class PullOutIfFromIfElseCleanUp extends AbstractCleanUp {
+	private PullOutIfFromIfElseCleanUpCore coreCleanUp= new PullOutIfFromIfElseCleanUpCore();
+
+	public PullOutIfFromIfElseCleanUp(final Map<String, String> options) {
+		setOptions(options);
+	}
+
+	public PullOutIfFromIfElseCleanUp() {
+	}
+
+	@Override
+	public void setOptions(final CleanUpOptions options) {
+		coreCleanUp.setOptions(options);
+	}
+
+	@Override
+	public CleanUpRequirements getRequirements() {
+		return new CleanUpRequirements(coreCleanUp.getRequirementsCore());
+	}
+
+	@Override
+	public ICleanUpFix createFix(final CleanUpContext context) throws CoreException {
+		ICleanUpFixCore fixCore= coreCleanUp.createFixCore(context);
+		return fixCore != null ? new CleanUpFixWrapper(fixCore) : null;
+	}
+
+	@Override
+	public String[] getStepDescriptions() {
+		return coreCleanUp.getStepDescriptions();
+	}
+
+	@Override
+	public String getPreview() {
+		return coreCleanUp.getPreview();
+	}
+}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UseStringIsBlankCleanUp.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UseStringIsBlankCleanUp.java
index 12d6204..552fdf0 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UseStringIsBlankCleanUp.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UseStringIsBlankCleanUp.java
@@ -146,7 +146,9 @@
 				}
 
 				// "".equals(s.strip())
-				if ("".equals(visited.getExpression().resolveConstantExpressionValue()) //$NON-NLS-1$
+				Expression expression= visited.getExpression();
+				if (expression != null
+						&& "".equals(expression.resolveConstantExpressionValue()) //$NON-NLS-1$
 						&& (isStringMethodInvocation(arguments.get(0), "strip") //$NON-NLS-1$
 								|| isStringMethodInvocation(arguments.get(0), "stripLeading") //$NON-NLS-1$
 								|| isStringMethodInvocation(arguments.get(0), "stripTrailing"))) { //$NON-NLS-1$
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java
index b6be52b..a958d31 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java
@@ -185,6 +185,7 @@
 	public static String DuplicateCodeTabPage_CheckboxName_OneIfRatherThanDuplicateBlocksThatFallThrough;
 	public static String DuplicateCodeTabPage_CheckboxName_RedundantFallingThroughBlockEnd;
 	public static String DuplicateCodeTabPage_CheckboxName_RedundantIfCondition;
+	public static String DuplicateCodeTabPage_CheckboxName_PullOutIfFromIfElse;
 
 	public static String JavaFeatureTabPage_GroupName_Java16;
 	public static String JavaFeatureTabPage_CheckboxName_PatternMatchingForInstanceof;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties
index 603dc13..297041b 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties
@@ -72,7 +72,7 @@
 OptimizationTabPage_CheckboxName_PrimitiveComparison=Primitive comparison
 OptimizationTabPage_CheckboxName_PrimitiveParsing=Primitive parsing
 OptimizationTabPage_CheckboxName_PrimitiveSerialization=&Primitive serialization
-OptimizationTabPage_CheckboxName_PrimitiveRatherThanWrapper=Primitive type rather then wrapper class
+OptimizationTabPage_CheckboxName_PrimitiveRatherThanWrapper=Primitive type rather than wrapper class
 OptimizationTabPage_CheckboxName_PrecompileRegEx=Precompile reused regular e&xpressions
 OptimizationTabPage_CheckboxName_NoStringCreation=Remo&ve redundant string creation
 OptimizationTabPage_CheckboxName_BooleanLiteral=Prefer &boolean literals
@@ -161,6 +161,7 @@
 DuplicateCodeTabPage_CheckboxName_OneIfRatherThanDuplicateBlocksThatFallThrough=Single 'if' statement rather than duplicate blocks that fall through
 DuplicateCodeTabPage_CheckboxName_RedundantFallingThroughBlockEnd=Remove redundant end of block with &jump statement
 DuplicateCodeTabPage_CheckboxName_RedundantIfCondition=R&emove redundant if condition
+DuplicateCodeTabPage_CheckboxName_PullOutIfFromIfElse=Pull out a duplicate 'if' from an if/else
 
 JavaFeatureTabPage_GroupName_Java16=Java 16
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DuplicateCodeTabPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DuplicateCodeTabPage.java
index 62c1108..813c220 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DuplicateCodeTabPage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DuplicateCodeTabPage.java
@@ -25,6 +25,7 @@
 import org.eclipse.jdt.internal.ui.fix.MergeConditionalBlocksCleanUp;
 import org.eclipse.jdt.internal.ui.fix.OneIfRatherThanDuplicateBlocksThatFallThroughCleanUp;
 import org.eclipse.jdt.internal.ui.fix.OperandFactorizationCleanUp;
+import org.eclipse.jdt.internal.ui.fix.PullOutIfFromIfElseCleanUp;
 import org.eclipse.jdt.internal.ui.fix.RedundantFallingThroughBlockEndCleanUp;
 import org.eclipse.jdt.internal.ui.fix.RedundantIfConditionCleanUp;
 import org.eclipse.jdt.internal.ui.fix.StrictlyEqualOrDifferentCleanUp;
@@ -43,7 +44,8 @@
 				new ControlFlowMergeCleanUp(values),
 				new OneIfRatherThanDuplicateBlocksThatFallThroughCleanUp(values),
 				new RedundantFallingThroughBlockEndCleanUp(values),
-				new RedundantIfConditionCleanUp(values)
+				new RedundantIfConditionCleanUp(values),
+				new PullOutIfFromIfElseCleanUp(values)
 		};
 	}
 
@@ -74,5 +76,8 @@
 
 		final CheckboxPreference redundantIfCondition= createCheckboxPref(duplicateGroup, numColumns, CleanUpMessages.DuplicateCodeTabPage_CheckboxName_RedundantIfCondition, CleanUpConstants.REDUNDANT_IF_CONDITION, CleanUpModifyDialog.FALSE_TRUE);
 		registerPreference(redundantIfCondition);
+
+		final CheckboxPreference pullOutIfFromIfElse= createCheckboxPref(duplicateGroup, numColumns, CleanUpMessages.DuplicateCodeTabPage_CheckboxName_PullOutIfFromIfElse, CleanUpConstants.PULL_OUT_IF_FROM_IF_ELSE, CleanUpModifyDialog.FALSE_TRUE);
+		registerPreference(pullOutIfFromIfElse);
 	}
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/AssignToVariableAssistProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/AssignToVariableAssistProposal.java
index aecb755..0e4ed20 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/AssignToVariableAssistProposal.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/AssignToVariableAssistProposal.java
@@ -27,6 +27,8 @@
 
 import org.eclipse.core.resources.ProjectScope;
 
+import org.eclipse.jface.resource.ImageDescriptor;
+
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.NamingConventions;
@@ -85,6 +87,7 @@
 import org.eclipse.jdt.internal.corext.refactoring.surround.ExceptionAnalyzer;
 import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryWithResourcesAnalyzer;
 import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryWithResourcesRefactoring;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 import org.eclipse.jdt.internal.corext.util.Messages;
 
 import org.eclipse.jdt.ui.PreferenceConstants;
@@ -95,6 +98,7 @@
 import org.eclipse.jdt.internal.ui.javaeditor.saveparticipant.AbstractSaveParticipantPreferenceConfiguration;
 import org.eclipse.jdt.internal.ui.text.correction.CorrectionMessages;
 import org.eclipse.jdt.internal.ui.text.correction.ModifierCorrectionSubProcessorCore;
+import org.eclipse.jdt.internal.ui.viewsupport.BindingLabelProvider;
 
 /**
  * Proposals for 'Assign to variable' quick assist
@@ -111,11 +115,13 @@
 	private final String KEY_TYPE= "type";  //$NON-NLS-1$
 	private final String GROUP_EXC_TYPE= "exc_type"; //$NON-NLS-1$
 	private final String GROUP_EXC_NAME= "exc_name"; //$NON-NLS-1$
+	private final String VAR_TYPE= "var";  //$NON-NLS-1$
 
 	private final int  fVariableKind;
 	private final List<ASTNode> fNodesToAssign; // ExpressionStatement or SingleVariableDeclaration(s)
 	private final ITypeBinding fTypeBinding;
 	private final ICompilationUnit fCUnit;
+	private final List<String> fParamNames;
 
 	private VariableDeclarationFragment fExistingFragment;
 
@@ -124,6 +130,7 @@
 
 		fCUnit= cu;
 		fVariableKind= variableKind;
+		fParamNames = null;
 		fNodesToAssign= new ArrayList<>();
 		fNodesToAssign.add(node);
 
@@ -148,6 +155,7 @@
 		fVariableKind= FIELD;
 		fNodesToAssign= new ArrayList<>();
 		fNodesToAssign.add(parameter);
+		fParamNames= null;
 		fTypeBinding= typeBinding;
 		fExistingFragment= existingFragment;
 
@@ -167,7 +175,8 @@
 		fNodesToAssign= new ArrayList<>();
 		fNodesToAssign.addAll(parameters);
 		fTypeBinding= null;
-
+		fParamNames= new ArrayList<>();
+		populateNames(parameters);
 		setDisplayName(CorrectionMessages.AssignToVariableAssistProposal_assignallparamstofields_description);
 		setImage(JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE));
 	}
@@ -186,6 +195,16 @@
 		}
 	}
 
+	private void populateNames(List<SingleVariableDeclaration> parameters) {
+		if (parameters != null && parameters.size() > 0) {
+			for (SingleVariableDeclaration param : parameters) {
+				if (param.getName() != null) {
+					fParamNames.add(param.getName().getIdentifier());
+				}
+			}
+		}
+	}
+
 	private ASTRewrite doAddLocal() throws CoreException {
 		ASTNode nodeToAssign= fNodesToAssign.get(0);
 		Expression expression= ((ExpressionStatement) nodeToAssign).getExpression();
@@ -206,6 +225,12 @@
 
 		Type type= evaluateType(ast, nodeToAssign, fTypeBinding, KEY_TYPE, TypeLocation.LOCAL_VARIABLE);
 
+		ICompilationUnit cu= getCompilationUnit();
+		if (type != null && cu != null && JavaModelUtil.is10OrHigher(cu.getJavaProject())) {
+			ImageDescriptor desc= BindingLabelProvider.getBindingImageDescriptor(fTypeBinding, BindingLabelProvider.DEFAULT_IMAGEFLAGS);
+			addLinkedPositionProposal(KEY_TYPE, VAR_TYPE, (desc != null) ? JavaPlugin.getImageDescriptorRegistry().get(desc) : null);
+		}
+
 		if (fVariableKind == LOCAL) {
 			if (ASTNodes.isControlStatementBody(nodeToAssign.getLocationInParent())) {
 				Block block= ast.newBlock();
@@ -533,7 +558,29 @@
 	}
 
 	private Collection<String> getUsedVariableNames(ASTNode nodeToAssign) {
-		return Arrays.asList(ASTResolving.getUsedVariableNames(nodeToAssign));
+		Collection<String> usedVarNames = Arrays.asList(ASTResolving.getUsedVariableNames(nodeToAssign));
+		Collection<String> additionalVarNames= getRemainingParamNamed(nodeToAssign);
+		if (additionalVarNames != null) {
+			usedVarNames = new ArrayList<>(Arrays.asList(ASTResolving.getUsedVariableNames(nodeToAssign)));
+			usedVarNames.addAll(additionalVarNames);
+		}
+		return usedVarNames;
+	}
+
+	private ArrayList<String> getRemainingParamNamed(ASTNode nodeToAssign) {
+		ArrayList<String> paramNames = null;
+		if (fParamNames != null) {
+			paramNames = new ArrayList<>();
+			paramNames.addAll(fParamNames);
+			if (nodeToAssign instanceof SingleVariableDeclaration
+					&& ((SingleVariableDeclaration)nodeToAssign).getName() != null) {
+				int index= fNodesToAssign.indexOf(nodeToAssign);
+				if (index >= 0 && index < paramNames.size()) {
+					paramNames.remove(index);
+				}
+			}
+		}
+		return paramNames;
 	}
 
 	private int findAssignmentInsertIndex(List<Statement> statements, ASTNode nodeToAssign) {
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/BindingLabelProvider.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/BindingLabelProvider.java
index 03d9cdc..54a393c 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/BindingLabelProvider.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/BindingLabelProvider.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -167,7 +167,9 @@
 			if (inner)
 				return getInnerInterfaceImageDescriptor(binding.getModifiers());
 			return getInterfaceImageDescriptor(binding.getModifiers());
-		} else if (binding.isClass()) {
+		} else if (binding.isRecord())
+			return JavaPluginImages.DESC_OBJS_RECORD;
+		else if (binding.isClass()) {
 			if ((flags & JavaElementImageProvider.LIGHT_TYPE_ICONS) != 0)
 				return JavaPluginImages.DESC_OBJS_CLASSALT;
 			if (inner)