Merge remote-tracking branch 'origin/master' into BETA_JAVA11

Change-Id: Ib70e55a6e1f26838206b5f67b207bd2c929142b4
diff --git a/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
index db12e16..670ef14 100644
--- a/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
@@ -24,12 +24,16 @@
  org.eclipse.jdt.internal.core.manipulation.search;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.text.tests",
  org.eclipse.jdt.internal.core.manipulation.util;x-friends:="org.eclipse.jdt.junit,org.eclipse.jdt.text.tests,org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.core.refactoring.descriptors;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.jdt.internal.corext.codemanipulation;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.dom;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.junit",
  org.eclipse.jdt.internal.corext.fix;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.jdt.internal.corext.refactoring;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.refactoring.changes;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui.examples.javafamily,org.eclipse.jdt.ui",
+ org.eclipse.jdt.internal.corext.refactoring.structure;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.refactoring.util;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.template.java;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui",
- org.eclipse.jdt.internal.corext.util;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.junit"
+ org.eclipse.jdt.internal.corext.util;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.junit",
+ org.eclipse.jdt.internal.ui.text.correction;x-friends:="org.eclipse.jdt.ui"
 Import-Package: com.ibm.icu.text
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/correction/IProblemLocationCore.java b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/correction/IProblemLocationCore.java
new file mode 100644
index 0000000..205fb18
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/correction/IProblemLocationCore.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copy to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.text.correction;
+
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+
+/**
+ * Problem information for quick fix and quick assist processors.
+ * <p>
+ * Note: this interface is not intended to be implemented.
+ * </p>
+ *
+ * @since 3.0
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface IProblemLocationCore {
+
+	/**
+	 * Returns the start offset of the problem.
+	 *
+	 * @return the start offset of the problem
+	 */
+	int getOffset();
+
+	/**
+	 * Returns the length of the problem.
+	 *
+	 * @return the length of the problem
+	 */
+	int getLength();
+
+	/**
+	 * Returns the marker type of this problem.
+	 *
+	 * @return The marker type of the problem.
+	 * @since 3.2
+	 */
+	String getMarkerType();
+
+	/**
+	 * Returns the id of problem. Note that problem ids are defined per problem marker type.
+	 * See {@link org.eclipse.jdt.core.compiler.IProblem} for id definitions for problems of type
+	 * <code>org.eclipse.jdt.core.problem</code> and <code>org.eclipse.jdt.core.task</code>.
+	 *
+	 * @return The id of the problem.
+	 */
+	int getProblemId();
+
+	/**
+	 * Returns the original arguments recorded into the problem.
+	 *
+	 * @return String[] Returns the problem arguments.
+	 */
+	String[] getProblemArguments();
+
+	/**
+	 * Returns if the problem has error severity.
+	 *
+	 * @return <code>true</code> if the problem has error severity
+	 */
+	boolean isError();
+
+	/**
+	 * Convenience method to evaluate the AST node covering this problem.
+	 *
+	 * @param astRoot The root node of the current AST
+	 * @return Returns the node that covers the location of the problem
+	 */
+	ASTNode getCoveringNode(CompilationUnit astRoot);
+
+	/**
+	 * Convenience method to evaluate the AST node covered by this problem.
+	 *
+	 * @param astRoot The root node of the current AST
+	 * @return Returns the node that is covered by the location of the problem
+	 */
+	ASTNode getCoveredNode(CompilationUnit astRoot);
+
+}
diff --git a/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/correction/ProblemLocationCore.java b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/correction/ProblemLocationCore.java
new file mode 100644
index 0000000..97d98ca
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/correction/ProblemLocationCore.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied and modified in jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.text.correction;
+
+import org.eclipse.jdt.core.IJavaModelMarker;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.NodeFinder;
+
+/**
+ *
+ */
+public class ProblemLocationCore implements IProblemLocationCore {
+
+	private final int fId;
+	private final String[] fArguments;
+	private final int fOffset;
+	private final int fLength;
+	private final boolean fIsError;
+	private final String fMarkerType;
+
+	public ProblemLocationCore(int offset, int length, int id, String[] arguments, boolean isError, String markerType) {
+		fId= id;
+		fArguments= arguments;
+		fOffset= offset;
+		fLength= length;
+		fIsError= isError;
+		fMarkerType= markerType;
+	}
+
+	public ProblemLocationCore(IProblem problem) {
+		fId= problem.getID();
+		fArguments= problem.getArguments();
+		fOffset= problem.getSourceStart();
+		fLength= problem.getSourceEnd() - fOffset + 1;
+		fIsError= problem.isError();
+		fMarkerType= problem instanceof CategorizedProblem ? ((CategorizedProblem) problem).getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER;
+	}
+
+
+	@Override
+	public int getProblemId() {
+		return fId;
+	}
+
+	@Override
+	public String[] getProblemArguments() {
+		return fArguments;
+	}
+
+	@Override
+	public int getLength() {
+		return fLength;
+	}
+
+	@Override
+	public int getOffset() {
+		return fOffset;
+	}
+
+	@Override
+	public boolean isError() {
+		return fIsError;
+	}
+
+	@Override
+	public String getMarkerType() {
+		return fMarkerType;
+	}
+
+	@Override
+	public ASTNode getCoveringNode(CompilationUnit astRoot) {
+		NodeFinder finder= new NodeFinder(astRoot, fOffset, fLength);
+		return finder.getCoveringNode();
+	}
+
+	@Override
+	public ASTNode getCoveredNode(CompilationUnit astRoot) {
+		NodeFinder finder= new NodeFinder(astRoot, fOffset, fLength);
+		return finder.getCoveredNode();
+	}
+
+	@Override
+	public String toString() {
+		StringBuilder buf= new StringBuilder();
+		buf.append("Id: ").append(getErrorCode(fId)).append('\n'); //$NON-NLS-1$
+		buf.append('[').append(fOffset).append(", ").append(fLength).append(']').append('\n'); //$NON-NLS-1$
+		String[] arg= fArguments;
+		for (int i= 0; i < arg.length; i++) {
+			buf.append(arg[i]);
+			buf.append('\n');
+		}
+		return buf.toString();
+	}
+
+	private String getErrorCode(int code) {
+		StringBuilder buf= new StringBuilder();
+
+		if ((code & IProblem.TypeRelated) != 0) {
+			buf.append("TypeRelated + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.FieldRelated) != 0) {
+			buf.append("FieldRelated + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.ConstructorRelated) != 0) {
+			buf.append("ConstructorRelated + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.MethodRelated) != 0) {
+			buf.append("MethodRelated + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.ImportRelated) != 0) {
+			buf.append("ImportRelated + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.Internal) != 0) {
+			buf.append("Internal + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.Syntax) != 0) {
+			buf.append("Syntax + "); //$NON-NLS-1$
+		}
+		if ((code & IProblem.Javadoc) != 0) {
+			buf.append("Javadoc + "); //$NON-NLS-1$
+		}
+		buf.append(code & IProblem.IgnoreCategoriesMask);
+
+		return buf.toString();
+	}
+
+
+}
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/NecessaryParenthesesChecker.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/dom/NecessaryParenthesesChecker.java
similarity index 98%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/NecessaryParenthesesChecker.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/dom/NecessaryParenthesesChecker.java
index 8a4210c..b1dd674 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/NecessaryParenthesesChecker.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/dom/NecessaryParenthesesChecker.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011, 2015 IBM Corporation and others.
+ * Copyright (c) 2011, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
  *     Nikolay Metchev <nikolaymetchev@gmail.com> - [inline] Inline local variable with initializer generates assignment where left-hand side is not a variable - https://bugs.eclipse.org/394721
  *******************************************************************************/
 
-package org.eclipse.jdt.internal.corext.dom;
+package org.eclipse.jdt.internal.core.manipulation.dom;
 
 import java.util.Iterator;
 
@@ -40,9 +40,6 @@
 import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
 import org.eclipse.jdt.core.dom.WhileStatement;
 
-import org.eclipse.jdt.internal.corext.refactoring.code.OperatorPrecedence;
-import org.eclipse.jdt.internal.corext.util.JDTUIHelperClasses;
-
 /**
  * Helper class to check if an expression requires parentheses.
  * 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/OperatorPrecedence.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/dom/OperatorPrecedence.java
similarity index 97%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/OperatorPrecedence.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/dom/OperatorPrecedence.java
index 8f6e31f..7704042 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/OperatorPrecedence.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/dom/OperatorPrecedence.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
-package org.eclipse.jdt.internal.corext.refactoring.code;
+package org.eclipse.jdt.internal.core.manipulation.dom;
 
 import org.eclipse.jdt.core.dom.ArrayAccess;
 import org.eclipse.jdt.core.dom.Assignment;
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
similarity index 99%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
index 711573e..1a289a5 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - moved to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.codemanipulation;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
similarity index 99%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
index 4dcb357..10eef0a 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     Till Brychcy - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.codemanipulation;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
similarity index 83%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
index de90f06..41a00ab 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,13 +7,14 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - moved to jdt.core.manipulation and modified
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
 import org.eclipse.core.runtime.IStatus;
 
 
-public abstract class AbstractFix implements IProposableFix, ILinkedFix {
+public abstract class AbstractFix implements IProposableFix, ILinkedFixCore {
 
 	private final String fDisplayString;
 
@@ -32,7 +33,7 @@
 	}
 
 	@Override
-	public LinkedProposalModel getLinkedPositions() {
+	public LinkedProposalModelCore getLinkedPositionsCore() {
 		return null;
 	}
 
diff --git a/org.eclipse.jdt.ui/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
similarity index 74%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
index f1be858..7360e3b 100644
--- a/org.eclipse.jdt.ui/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
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,23 +8,12 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *     Alex Blewitt - https://bugs.eclipse.org/bugs/show_bug.cgi?id=168954
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
 import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
 
-import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
-
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.ui.fix.UnimplementedCodeCleanUp;
-import org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpProfileVersioner;
-
 public class CleanUpConstants {
 
 	/**
@@ -871,6 +860,19 @@
 
 
 	/**
+	 * Removes redundant semicolons.<br>
+	 * <br>
+	 * Possible values: {TRUE, FALSE}<br>
+	 * <br>
+	 *
+	 * @see CleanUpOptions#TRUE
+	 * @see CleanUpOptions#FALSE
+	 * @since 3.14
+	 */
+	public static final String REMOVE_REDUNDANT_SEMICOLONS= "cleanup.remove_redundant_semicolons"; //$NON-NLS-1$
+
+
+	/**
 	 * Controls whether missing annotations should be added to the code. For detailed settings use:<br>
 	 * {@link #ADD_MISSING_ANNOTATIONS_DEPRECATED}<br> {@value #ADD_MISSING_ANNOTATIONS_OVERRIDE} <br>
 	 * <br>
@@ -883,7 +885,7 @@
 	 * @since 3.3
 	 */
 	public static final String ADD_MISSING_ANNOTATIONS= "cleanup.add_missing_annotations"; //$NON-NLS-1$
-
+	
 	/**
 	 * Add '@Override' annotation in front of overriding methods.
 	 * <p>
@@ -932,7 +934,7 @@
 	 * @since 3.6
 	 */
 	public static final String ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION= "cleanup.add_missing_override_annotations_interface_methods"; //$NON-NLS-1$
-	
+
 	/**
 	 * Add '@Deprecated' annotation in front of deprecated members.
 	 * <p>
@@ -1133,7 +1135,7 @@
 	 * A key to the version of the profile stored in the preferences.<br>
 	 * <br>
 	 * Possible values: Integer value<br>
-	 * Default value: {@link CleanUpProfileVersioner#CURRENT_VERSION} <br>
+	 * Default value: CleanUpProfileVersioner#CURRENT_VERSION <br>
 	 * 
 	 * @since 3.3
 	 */
@@ -1177,208 +1179,4 @@
 	 */
 	public final static String DEFAULT_SAVE_PARTICIPANT_PROFILE= SAVE_PARTICIPANT_PROFILE;
 
-	private static void setEclipseDefaultSettings(CleanUpOptions options) {
-
-		//Member Accesses
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.TRUE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
-
-		//Control Statements
-		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
-
-		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
-
-		//Expressions
-		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
-
-		//Variable Declarations
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
-
-		//Functional Interfaces
-		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
-		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
-		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
-
-		//Unused Code
-		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
-
-		//Unnecessary Code
-		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE);
-		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
-
-		//Missing Code
-		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
-
-		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
-		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
-
-		//Code Organizing
-		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
-
-		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.FALSE);
-
-		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
-	}
-
-	private static void setSaveParticipantSettings(CleanUpOptions options) {
-
-		//Member Accesses
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
-
-		//Control Statements
-		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
-
-		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
-
-		//Expressions
-		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
-
-		//Variable Declarations
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
-
-		//Functional Interfaces
-		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
-		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
-		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
-
-		//Unused Code
-		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
-
-		//Unnecessary Code
-		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.FALSE);
-		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
-
-		//Missing Code
-		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
-
-		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
-		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
-
-		//Code Organizing
-		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
-
-		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.TRUE);
-
-		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
-
-		options.setOption(CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS, CleanUpOptions.FALSE);
-	}
-
-	public static void initDefaults(IPreferenceStore store) {
-		CleanUpOptions settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
-		for (Iterator<String> iterator= settings.getKeys().iterator(); iterator.hasNext();) {
-			String key= iterator.next();
-			store.setDefault(key, settings.getValue(key));
-		}
-
-		store.setDefault(SHOW_CLEAN_UP_WIZARD, true);
-		store.setDefault(CLEANUP_PROFILE, DEFAULT_PROFILE);
-		store.setDefault(CLEANUP_ON_SAVE_PROFILE, DEFAULT_SAVE_PARTICIPANT_PROFILE);
-	}
-
-	public static void setDefaultOptions(int kind, CleanUpOptions options) {
-		switch (kind) {
-			case CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS:
-				CleanUpConstants.setEclipseDefaultSettings(options);
-				break;
-			case CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS:
-				CleanUpConstants.setSaveParticipantSettings(options);
-				break;
-			default:
-				Assert.isTrue(false, "Unknown Clean Up option kind: " + kind); //$NON-NLS-1$
-				break;
-		}
-	}
-
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpContext.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpContext.java
new file mode 100644
index 0000000..01f6764
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpContext.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipultion
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+
+/**
+ * The context that contains all information required by a clean up to create a fix.
+ * 
+ * @since 3.5
+ */
+public class CleanUpContext {
+
+	private final ICompilationUnit fUnit;
+
+	private final CompilationUnit fAst;
+
+	/**
+	 * Creates a new clean up context.
+	 * 
+	 * @param unit the compilation unit
+	 * @param ast the AST, can be <code>null</code> if {@link CleanUpRequirements#requiresAST()}
+	 *            returns <code>false</code>. The AST is guaranteed to contain changes made by
+	 *            previous clean ups only if {@link CleanUpRequirements#requiresFreshAST()} returns
+	 *            <code>true</code>.
+	 */
+	public CleanUpContext(ICompilationUnit unit, CompilationUnit ast) {
+		Assert.isLegal(unit != null);
+		fUnit= unit;
+		fAst= ast;
+	}
+
+	/**
+	 * The compilation unit to clean up.
+	 * 
+	 * @return the compilation unit to clean up
+	 */
+	public ICompilationUnit getCompilationUnit() {
+		return fUnit;
+	}
+
+	/**
+	 * An AST built from the compilation unit to fix.
+	 * <p>
+	 * Can be <code>null</code> if {@link CleanUpRequirements#requiresAST()} returns
+	 * <code>false</code>. The AST is guaranteed to contain changes made by previous clean ups only
+	 * if {@link CleanUpRequirements#requiresFreshAST()} returns <code>true</code>.
+	 * </p>
+	 * <p>Clients should check the AST API level and do nothing if they are given an AST
+	 * they can't handle (see {@link org.eclipse.jdt.core.dom.AST#apiLevel()}).
+	 * 
+	 * @return an AST or <code>null</code> if none required
+	 */
+	public CompilationUnit getAST() {
+		return fAst;
+	}
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpOptions.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpOptions.java
new file mode 100644
index 0000000..1177e49
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpOptions.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+
+
+/**
+ * Allows to set and retrieve clean up settings for given options keys.
+ * 
+ * @since 3.5
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class CleanUpOptions {
+
+	private final Map<String, String> fOptions;
+
+	/**
+	 * True value
+	 */
+	public static final String TRUE= "true"; //$NON-NLS-1$
+
+	/**
+	 * False value
+	 */
+	public static final String FALSE= "false"; //$NON-NLS-1$
+
+	/**
+	 * Creates a new CleanUpOptions instance with the given options.
+	 * 
+	 * @param options map that maps clean ups keys (<code>String</code>) to a non-<code>null</code>
+	 *            string value
+	 */
+	public CleanUpOptions(Map<String, String> options) {
+		fOptions= options;
+	}
+
+	/**
+	 * Creates a new instance.
+	 */
+	public CleanUpOptions() {
+		fOptions= new Hashtable<>();
+	}
+
+	/**
+	 * Tells whether the option with the given <code>key</code> is enabled.
+	 * 
+	 * @param key the name of the option
+	 * @return <code>true</code> if enabled, <code>false</code> if not enabled or unknown key
+	 * @throws IllegalArgumentException if the key is <code>null</code>
+	 * @see CleanUpConstants
+	 */
+	public boolean isEnabled(String key) {
+		Assert.isLegal(key != null);
+		Object value= fOptions.get(key);
+		return CleanUpOptions.TRUE == value || CleanUpOptions.TRUE.equals(value);
+	}
+
+	/**
+	 * Returns the value for the given key.
+	 * 
+	 * @param key the key of the value
+	 * @return the value associated with the key
+	 * @throws IllegalArgumentException if the key is null or unknown
+	 */
+	public String getValue(String key) {
+		Assert.isLegal(key != null);
+		String value= fOptions.get(key);
+		Assert.isLegal(value != null);
+		return value;
+	}
+
+	/**
+	 * Sets the option for the given key to the given value.
+	 * 
+	 * @param key the name of the option to set
+	 * @param value the value of the option
+	 * @throws IllegalArgumentException if the key is <code>null</code>
+	 * @see CleanUpOptions#TRUE
+	 * @see CleanUpOptions#FALSE
+	 */
+	public void setOption(String key, String value) {
+		Assert.isLegal(key != null);
+		Assert.isLegal(value != null);
+		fOptions.put(key, value);
+	}
+
+	/**
+	 * Returns an unmodifiable set of all known keys.
+	 * 
+	 * @return an unmodifiable set of all keys
+	 */
+	public Set<String> getKeys() {
+		return Collections.unmodifiableSet(fOptions.keySet());
+	}
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpRequirements.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpRequirements.java
new file mode 100644
index 0000000..288d258
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpRequirements.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jdt.core.JavaCore;
+
+
+/**
+ * Specifies the requirements of a clean up.
+ * 
+ * @since 3.5
+ */
+public final class CleanUpRequirements {
+
+	private final boolean fRequiresAST;
+
+	private final Map<String, String> fCompilerOptions;
+
+	private final boolean fRequiresFreshAST;
+
+	private final boolean fRequiresChangedRegions;
+
+
+	/**
+	 * Create a new instance
+	 * 
+	 * @param requiresAST <code>true</code> if an AST is required
+	 * @param requiresFreshAST <code>true</code> if a fresh AST is required
+	 * @param requiresChangedRegions <code>true</code> if changed regions are required
+	 * @param compilerOptions map of compiler options or <code>null</code> if no requirements
+	 */
+	public CleanUpRequirements(boolean requiresAST, boolean requiresFreshAST, boolean requiresChangedRegions, Map<String, String> compilerOptions) {
+		Assert.isLegal(!requiresFreshAST || requiresAST, "Must not request fresh AST if no AST is required"); //$NON-NLS-1$
+		Assert.isLegal(compilerOptions == null || requiresAST, "Must not provide options if no AST is required"); //$NON-NLS-1$
+		fRequiresAST= requiresAST;
+		fRequiresFreshAST= requiresFreshAST;
+		fRequiresChangedRegions= requiresChangedRegions;
+
+		fCompilerOptions= compilerOptions;
+		// Make sure that compile warnings are not suppressed since some clean ups work on reported warnings
+		if (fCompilerOptions != null)
+			fCompilerOptions.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);
+	}
+
+	/**
+	 * Tells whether the clean up requires an AST.
+	 * <p>
+	 * <strong>Note:</strong> This should return <code>false</code> whenever possible because
+	 * creating an AST is expensive.
+	 * </p>
+	 * 
+	 * @return <code>true</code> if the {@linkplain CleanUpContext context} must provide an AST
+	 */
+	public boolean requiresAST() {
+		return fRequiresAST;
+	}
+
+	/**
+	 * Tells whether a fresh AST, containing all the changes from previous clean ups, will be
+	 * needed.
+	 * 
+	 * @return <code>true</code> if the caller needs an up to date AST
+	 */
+	public boolean requiresFreshAST() {
+		return fRequiresFreshAST;
+	}
+
+	/**
+	 * Required compiler options.
+	 * 
+	 * @return the compiler options map or <code>null</code> if none
+	 * @see JavaCore
+	 */
+	public Map<String, String> getCompilerOptions() {
+		return fCompilerOptions;
+	}
+
+	/**
+	 * Tells whether this clean up requires to be informed about changed regions. The changed regions are the
+	 * regions which have been changed between the last save state of the compilation unit and its
+	 * current state.
+	 * <p>
+	 * Has only an effect if the clean up is used as save action.
+	 * </p>
+	 * <p>
+	 * <strong>Note:</strong>: This should return <code>false</code> whenever possible because
+	 * calculating the changed regions is expensive.
+	 * </p>
+	 * 
+	 * @return <code>true</code> if the {@linkplain CleanUpContext context} must provide changed
+	 *         regions
+	 */
+	public boolean requiresChangedRegions() {
+		return fRequiresChangedRegions;
+	}
+
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFixCore.java
new file mode 100644
index 0000000..aef8f2b
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFixCore.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied over to jdt.core.manipulation and renamed
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.text.edits.TextEditGroup;
+
+import org.eclipse.ltk.core.refactoring.GroupCategory;
+import org.eclipse.ltk.core.refactoring.GroupCategorySet;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext;
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+
+import org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin;
+import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
+import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
+
+public class CompilationUnitRewriteOperationsFixCore extends AbstractFix {
+
+	public abstract static class CompilationUnitRewriteOperation {
+
+		public abstract void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModelCore linkedModel) throws CoreException;
+
+		protected Type importType(final ITypeBinding toImport, final ASTNode accessor, ImportRewrite imports, final CompilationUnit compilationUnit) {
+			ImportRewriteContext importContext= new ContextSensitiveImportRewriteContext(compilationUnit, accessor.getStartPosition(), imports);
+			return imports.addImport(toImport, compilationUnit.getAST(), importContext);
+		}
+
+		protected TextEditGroup createTextEditGroup(String label, CompilationUnitRewrite rewrite) {
+			if (label.length() > 0) {
+				return rewrite.createCategorizedGroupDescription(label, new GroupCategorySet(new GroupCategory(label, label, label)));
+			} else {
+				return rewrite.createGroupDescription(label);
+			}
+		}
+
+		public String getAdditionalInfo() {
+			return null;
+		}
+	}
+
+	private final CompilationUnitRewriteOperation[] fOperations;
+	private final CompilationUnit fCompilationUnit;
+	protected LinkedProposalModelCore fLinkedProposalModel;
+
+	public CompilationUnitRewriteOperationsFixCore(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation operation) {
+		this(name, compilationUnit, new CompilationUnitRewriteOperation[] { operation });
+		Assert.isNotNull(operation);
+	}
+
+	public CompilationUnitRewriteOperationsFixCore(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation[] operations) {
+		super(name);
+		Assert.isNotNull(operations);
+		Assert.isLegal(operations.length > 0);
+		fCompilationUnit= compilationUnit;
+		fOperations= operations;
+		fLinkedProposalModel= new LinkedProposalModelCore();
+	}
+
+	@Override
+	public LinkedProposalModelCore getLinkedPositionsCore() {
+		if (!fLinkedProposalModel.hasLinkedPositions())
+			return null;
+
+		return fLinkedProposalModel;
+	}
+
+	@Override
+	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
+		CompilationUnitRewrite cuRewrite= new CompilationUnitRewrite((ICompilationUnit)fCompilationUnit.getJavaElement(), fCompilationUnit);
+
+		fLinkedProposalModel.clear();
+		for (int i= 0; i < fOperations.length; i++) {
+			CompilationUnitRewriteOperation operation= fOperations[i];
+			operation.rewriteAST(cuRewrite, fLinkedProposalModel);
+		}
+
+		CompilationUnitChange result= cuRewrite.createChange(getDisplayString(), true, null);
+		if (result == null)
+			throw new CoreException(new Status(IStatus.ERROR, JavaManipulationPlugin.getPluginId(), Messages.format(FixMessages.CompilationUnitRewriteOperationsFix_nullChangeError, getDisplayString())));
+
+		return result;
+	}
+
+	@Override
+	public String getAdditionalProposalInfo(){
+		StringBuilder sb= new StringBuilder();
+		for (int i= 0; i < fOperations.length; i++) {
+			CompilationUnitRewriteOperation operation= fOperations[i];
+			String info= operation.getAdditionalInfo();
+			if (info != null)
+				sb.append(info);
+		}
+
+		if (sb.length() == 0)
+			return null;
+
+		return sb.toString();
+	}
+
+}
diff --git a/org.eclipse.jdt.ui/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
similarity index 98%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
index 5e51ed6..f21a4e1 100644
--- a/org.eclipse.jdt.ui/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
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
  *								[quick fix] Add quick fixes for null annotations - https://bugs.eclipse.org/337977
  *								[quick fix] The fix change parameter type to @Nonnull generated a null change - https://bugs.eclipse.org/400668
  *								[null] "Annotate" proposals for adding external null annotations to library classes - https://bugs.eclipse.org/458200
+ *     Red Hat Inc - refactored to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
diff --git a/org.eclipse.jdt.ui/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
similarity index 98%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
index bc5699b..8629387 100644
--- a/org.eclipse.jdt.ui/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
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2005, 2017 IBM Corporation and others.
+# Copyright (c) 2005, 2018 IBM Corporation and others.
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
 # which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
 #								[quick fix] Add quick fixes for null annotations - https://bugs.eclipse.org/337977
 #								[quick fix] The fix change parameter type to @Nonnull generated a null change - https://bugs.eclipse.org/400668
 #								[null] "Annotate" proposals for adding external null annotations to library classes - https://bugs.eclipse.org/458200
+#     Red Hat Inc. - refactored to jdt.core.manipulation
 ###############################################################################
 CleanUpRefactoring_Refactoring_name=Clean Up
 CleanUpRefactoring_Initialize_message=Checking preconditions for project ''{0}''
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpCore.java
new file mode 100644
index 0000000..dba67f3
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpCore.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied and renamed in jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+
+
+/**
+ * A clean up solves problems in a compilation unit.
+ * <p>
+ * The clean up is asked for its requirements through a call to {@link #getRequirements()}. The
+ * clean up can request an AST and define how to build this AST. It can base its requirements on the
+ * options passed through {@link #setOptions(CleanUpOptions)}.
+ * </p>
+ * <p>
+ * A context containing the information requested by the requirements are passed to
+ * {@link #createFix(CleanUpContext)}. A fix capable of fixing the problems is returned by this
+ * function if {@link #checkPreConditions(IJavaProject, ICompilationUnit[], IProgressMonitor)} has
+ * returned a non fatal error status.
+ * </p>
+ * <p>
+ * At the end {@link #checkPostConditions(IProgressMonitor)} is called.
+ * </p>
+ * 
+ * @since 3.5
+ */
+public interface ICleanUpCore {
+
+	/**
+	 * Sets the options that will be used.
+	 * 
+	 * @param options the options to use
+	 */
+	void setOptions(CleanUpOptions options);
+
+	/**
+	 * Human readable description for each step this clean up will execute.
+	 * <p>
+	 * <strong>Note:</strong> This method must only be called after the options have been set.
+	 * </p>
+	 * 
+	 * @return descriptions an array of {@linkplain String strings} or <code>null</code>
+	 */
+	String[] getStepDescriptions();
+
+	/**
+	 * The requirements of this clean up.
+	 * <p>
+	 * <strong>Note:</strong> This method must only be called after the options have been set.
+	 * </p>
+	 * 
+	 * @return the requirements used for {@link #createFix(CleanUpContext)} to work
+	 */
+	CleanUpRequirements getRequirements();
+
+	/**
+	 * After call to checkPreConditions clients will start creating fixes for
+	 * <code>compilationUnits</code> in <code>project</code> unless the result of checkPreConditions
+	 * contains a fatal error
+	 * 
+	 * @param project the project to clean up
+	 * @param compilationUnits an array of compilation units to clean up, all member of <code>project</code>
+	 * @param monitor the monitor to show progress
+	 * @return the result of the precondition check
+	 * @throws CoreException if an unexpected error occurred
+	 */
+	RefactoringStatus checkPreConditions(IJavaProject project, ICompilationUnit[] compilationUnits, IProgressMonitor monitor) throws CoreException;
+
+	/**
+	 * Create an <code>ICleanUpFixCore</code> which fixes all problems in <code>context</code> or
+	 * <code>null</code> if nothing to fix.
+	 * 
+	 * @param context a context containing all information requested by {@link #getRequirements()}
+	 * @return the fix for the problems or <code>null</code> if nothing to fix
+	 * @throws CoreException if an unexpected error occurred
+	 */
+	ICleanUpFixCore createFix(CleanUpContext context) throws CoreException;
+
+	/**
+	 * Called when done cleaning up.
+	 * 
+	 * @param monitor the monitor to show progress
+	 * @return the result of the postcondition check, not null
+	 * @throws CoreException if an unexpected error occurred
+	 */
+	RefactoringStatus checkPostConditions(IProgressMonitor monitor) throws CoreException;
+
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpFixCore.java
new file mode 100644
index 0000000..1391c80
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpFixCore.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied and renamed in jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+
+
+/**
+ * A clean up fix calculates a {@link CompilationUnitChange} which can be applied on a document to
+ * fix one or more problems in a compilation unit.
+ * 
+ * @since 1.10
+ */
+public interface ICleanUpFixCore {
+
+	/**
+	 * Calculates and returns a {@link CompilationUnitChange} which can be applied on a document to
+	 * fix one or more problems in a compilation unit.
+	 * 
+	 * @param progressMonitor the progress monitor or <code>null</code> if none
+	 * @return a compilation unit change change which should not be empty
+	 * @throws CoreException if something went wrong while calculating the change
+	 */
+	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException;
+
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ILinkedFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ILinkedFixCore.java
new file mode 100644
index 0000000..c18568a
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ILinkedFixCore.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified and renamed to ILinkedFixCore
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+/**
+ * A fix which when executed can set up a linked mode model
+ * and put an editor into linked mode.
+ *
+ * @since 1.10
+ */
+public interface ILinkedFixCore extends ICleanUpFixCore {
+
+	/**
+	 * @return the linked proposal model to use to set up linked positions or <b>null</b>
+	 */
+	public LinkedProposalModelCore getLinkedPositionsCore();
+}
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
similarity index 88%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
index 6201112..ed52c9e 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,22 +7,21 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - moved to jdt.core.manipulation and modified
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
 import org.eclipse.core.runtime.IStatus;
 
-import org.eclipse.jdt.ui.cleanup.ICleanUpFix;
-
 /**
  * A <code>ICleanUpFix</code> which can be used in a
  * correction proposal environment. A proposal
  * will be shown to the user and if chosen the
  * fix is executed.
  *
- * @since 3.4
+ * @since 1.10
  */
-public interface IProposableFix extends ICleanUpFix {
+public interface IProposableFix extends ICleanUpFixCore {
 
 	/**
 	 * Returns the string to be displayed in the list of completion proposals.
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/Messages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/Messages.java
new file mode 100644
index 0000000..95d35a4
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/Messages.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * Helper class to format message strings.
+ *
+ * @since 3.1
+ */
+public class Messages {
+
+	public static String format(String message, Object object) {
+		return MessageFormat.format(message, new Object[] { object});
+	}
+
+	public static String format(String message, Object[] objects) {
+		return MessageFormat.format(message, objects);
+	}
+
+	private Messages() {
+		// Not for instantiation
+	}
+}
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
similarity index 99%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
index 9d9fbda..dd6431c 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
@@ -10,6 +10,7 @@
  *     Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056
  *     Samrat Dhillon <samrat.dhillon@gmail.com> - [introduce factory] Introduce Factory on an abstract class adds a statement to create an instance of that class - https://bugs.eclipse.org/bugs/show_bug.cgi?id=395016
  *     Yves Joan <yves.joan@oracle.com> - [reorg] Copy action should NOT add 'copy of' prefix - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151668
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring;
 
diff --git a/org.eclipse.jdt.ui/internal compatibility/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
similarity index 94%
rename from org.eclipse.jdt.ui/internal compatibility/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
index 54e8cbe..2f4fee9 100644
--- a/org.eclipse.jdt.ui/internal compatibility/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.changes;
 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
similarity index 99%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
index b57b832..63182a1 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
@@ -11,6 +11,7 @@
 #     Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Name ambiguous return value in error message - https://bugs.eclipse.org/bugs/show_bug.cgi?id=50607
 #	  Samrat Dhillon <samrat.dhillon@gmail.com> - [introduce factory] Introduce Factory on an abstract class adds a statement to create an instance of that class - https://bugs.eclipse.org/bugs/show_bug.cgi?id=395016
 #     Yves Joan <yves.joan@oracle.com> - [reorg] Copy action should NOT add 'copy of' prefix - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151668
+#     Red Hat Inc. - copied to jdt.core.manipulation
 ###############################################################################
 # NLS properties for the Refactoring Core
 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
similarity index 94%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
index 8ecfb9b..faf5eb9 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc, - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.structure;
 
@@ -34,15 +35,13 @@
 import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.manipulation.CodeStyleConfiguration;
 import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
 
-import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin;
+import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
 import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.jdt.internal.corext.util.JDTUIHelperClasses;
-
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
 
 /**
  * A {@link CompilationUnitRewrite} holds all data structures that are typically
@@ -55,7 +54,7 @@
  * Bindings recovery is disabled by default, but can be enabled with <code>setBindingRecovery(true)</code>.
  * </p>
  * 
- * @see JDTUIHelperClasses
+ * see JDTUIHelperClasses
  */
 public class CompilationUnitRewrite {
 	//TODO: add RefactoringStatus fStatus;?
@@ -350,12 +349,12 @@
 				 * ImportRewrite#setUseContextToFilterImplicitImports(boolean) will be set to true
 				 * and ContextSensitiveImportRewriteContext etc. can be used. */
 				if (fRoot == null && ! fResolveBindings) {
-					fImportRewrite= StubUtility.createImportRewrite(fCu, true);
+					fImportRewrite= CodeStyleConfiguration.createImportRewrite(fCu, true);
 				} else {
-					fImportRewrite= StubUtility.createImportRewrite(getRoot(), true);
+					fImportRewrite= createImportRewrite(getRoot(), true);
 				}
 			} catch (CoreException e) {
-				JavaPlugin.log(e);
+				JavaManipulationPlugin.log(e);
 				throw new IllegalStateException(e.getMessage()); // like ASTParser#createAST(..) does
 			}
 		}
@@ -363,6 +362,15 @@
 
 	}
 
+	private ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports) {
+		ImportRewrite rewrite= CodeStyleConfiguration.createImportRewrite(astRoot, restoreExistingImports);
+		if (astRoot.getAST().hasResolvedBindings()) {
+			rewrite.setUseContextToFilterImplicitImports(true);
+		}
+		return rewrite;
+	}
+
+
 	public ImportRemover getImportRemover() {
 		if (fImportRemover == null) {
 			fImportRemover= new ImportRemover(fCu.getJavaProject(), getRoot());
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
similarity index 99%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
index cddf80c..2e49c0a 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.structure;
 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
similarity index 93%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
index 15c289a..12685d1 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,11 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.util;
 
-import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 
@@ -25,12 +26,10 @@
 import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.ASTParser;
 import org.eclipse.jdt.core.dom.CompilationUnit;
-
-import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
-
-import org.eclipse.jdt.ui.SharedASTProvider;
+import org.eclipse.jdt.core.manipulation.CoreASTProvider;
 
 import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 
 public class RefactoringASTParser {
 
@@ -116,7 +115,7 @@
 	 * @return the parsed CompilationUnit
 	 */
 	public static CompilationUnit parseWithASTProvider(ITypeRoot typeRoot, boolean resolveBindings, IProgressMonitor pm) {
-		CompilationUnit cuNode= SharedASTProvider.getAST(typeRoot, SharedASTProvider.WAIT_ACTIVE_ONLY, pm);
+		CompilationUnit cuNode= CoreASTProvider.getInstance().getAST(typeRoot, CoreASTProvider.WAIT_ACTIVE_ONLY, pm);
 		if (cuNode != null) {
 			return cuNode;
 		} else {
@@ -147,9 +146,9 @@
 	public static Map<String, String> getCompilerOptions(IJavaElement element) {
 		IJavaProject project= element.getJavaProject();
 		Map<String, String> options= project.getOptions(true);
-		for (Iterator<String> iter= options.keySet().iterator(); iter.hasNext();) {
-			String key= iter.next();
-			String value= options.get(key);
+		for (Entry<String, String> entry : options.entrySet()) {
+			String key = entry.getKey();
+			String value= entry.getValue();
 			if (JavaCore.ERROR.equals(value) || JavaCore.WARNING.equals(value) || JavaCore.INFO.equals(value)) {
 				// System.out.println("Ignoring - " + key);
 				options.put(key, JavaCore.IGNORE);
diff --git a/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java b/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java
index 386a0c5..b095fe9 100644
--- a/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java
+++ b/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2016, 2017 IBM Corporation and others.
+ * Copyright (c) 2016, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -65,38 +65,30 @@
 
 	@Override
 	public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
-		Status result= testExecutionResult.getStatus();
+		notifyIfNotSuccessful(testIdentifier, testExecutionResult);
 		if (testIdentifier.isTest()) {
-			if (result != Status.SUCCESSFUL) {
-				String trace= ""; //$NON-NLS-1$
-				FailedComparison comparison= null;
-				String status= MessageIds.TEST_FAILED;
-
-				boolean assumptionFailed= result == Status.ABORTED;
-				Optional<Throwable> throwableOp= testExecutionResult.getThrowable();
-				if (throwableOp.isPresent()) {
-					Throwable exception= throwableOp.get();
-					trace= getTrace(exception);
-					comparison= getFailedComparison(exception);
-					status= (assumptionFailed || exception instanceof AssertionError) ? MessageIds.TEST_FAILED : MessageIds.TEST_ERROR;
-				}
-
-				ITestIdentifier identifier= getIdentifier(testIdentifier, false, assumptionFailed);
-				fNotified.notifyTestFailed(new TestReferenceFailure(identifier, status, trace, comparison));
-			}
-
 			fNotified.notifyTestEnded(getIdentifier(testIdentifier, false, false));
+		}
+	}
 
-		} else { // container
-			if (result != Status.SUCCESSFUL) {
-				Optional<Throwable> throwableOp= testExecutionResult.getThrowable();
-				String trace= ""; //$NON-NLS-1$
-				if (throwableOp.isPresent()) {
-					trace= getTrace(throwableOp.get());
-				}
-				ITestIdentifier identifier= getIdentifier(testIdentifier, false, false);
-				fNotified.notifyTestFailed(new TestReferenceFailure(identifier, MessageIds.TEST_ERROR, trace));
+	private void notifyIfNotSuccessful(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
+		Status result= testExecutionResult.getStatus();
+		if (result != Status.SUCCESSFUL) {
+			String trace= ""; //$NON-NLS-1$
+			FailedComparison comparison= null;
+			String status= MessageIds.TEST_FAILED;
+
+			boolean assumptionFailed= result == Status.ABORTED;
+			Optional<Throwable> throwableOp= testExecutionResult.getThrowable();
+			if (throwableOp.isPresent()) {
+				Throwable exception= throwableOp.get();
+				trace= getTrace(exception);
+				comparison= getFailedComparison(exception);
+				status= (assumptionFailed || exception instanceof AssertionError) ? MessageIds.TEST_FAILED : MessageIds.TEST_ERROR;
 			}
+
+			ITestIdentifier identifier= getIdentifier(testIdentifier, false, assumptionFailed);
+			fNotified.notifyTestFailed(new TestReferenceFailure(identifier, status, trace, comparison));
 		}
 	}
 
diff --git a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaBreakIteratorTest.java b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaBreakIteratorTest.java
index f900574..b907f27 100644
--- a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaBreakIteratorTest.java
+++ b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaBreakIteratorTest.java
@@ -17,9 +17,6 @@
  */
 public class JavaBreakIteratorTest extends BreakIteratorTest {
 
-	/*
-	 * @see junit.framework.TestCase#setUp()
-	 */
 	@Override
 	protected void setUp() throws Exception {
 		fBreakIterator= new JavaBreakIterator();
@@ -42,76 +39,76 @@
 	}
 
 	public void testNextLn() {
-		String s= new String("word \n" +
-				"  word2");
+		String s= "word \n" +
+				"  word2";
 		assertNextPositions(s, new int[] { 4, 5, 6, 8, 13 });
 	}
 
 	public void testMultiNextLn() {
-		String s= new String("word \n" +
+		String s= "word \n" +
 				"\n" +
 				"\n" +
-				"  word2");
+				"  word2";
 		assertNextPositions(s, new int[] { 4, 5, 6, 7, 8, 10, 15 });
 	}
 
 	public void testMultiNextLn2() {
-		String s= new String("word \r\n" +
+		String s= "word \r\n" +
 				"\r\n" +
 				"\r\n" +
-				"  word2");
+				"  word2";
 		assertNextPositions(s, new int[] { 4, 5, 7, 9, 11, 13, 18 });
 	}
 
 	public void testNextCamelCaseWord() {
-		String s= new String("   _isURLConnection_   ");
+		String s= "   _isURLConnection_   ";
 		assertNextPositions(s, new int[] { 3, 6, 9, 20, 23 });
 	}
 
 	public void testPrevious1() {
-		String s= new String("word word");
+		String s= "word word";
 		assertPreviousPositions(s, new int[] { 0, 4, 5 });
 	}
 
 	public void testPrevious2() {
-		String s= new String("wordWord word");
+		String s= "wordWord word";
 		assertPreviousPositions(s, new int[] { 0, 4, 8, 9 });
 	}
 
 	public void testPreviousSpace() {
-		String s= new String(" word ");
+		String s= " word ";
 		assertPreviousPositions(s, new int[] { 1, 5 });
 	}
 
 	public void testPreviousParen() {
-		String s= new String("word(params)");
+		String s= "word(params)";
 		assertPreviousPositions(s, new int[] { 0, 4, 5, 11 });
 	}
 
 	public void testPreviousLn() {
-		String s= new String("word \n" +
-				"  word2");
+		String s= "word \n" +
+				"  word2";
 		assertPreviousPositions(s, new int[] { 0, 4, 5, 6, 8 });
 	}
 
 	public void testMultiPreviousLn() {
-		String s= new String("word \n" +
+		String s= "word \n" +
 				"\n" +
 				"\n" +
-				"  word2");
+				"  word2";
 		assertPreviousPositions(s, new int[] { 0, 4, 5, 6, 7, 8, 10 });
 	}
 
 	public void testMultiPreviousLn2() {
-		String s= new String("word \r\n" +
+		String s= "word \r\n" +
 				"\r\n" +
 				"\r\n" +
-				"  word2");
+				"  word2";
 		assertPreviousPositions(s, new int[] { 0, 4, 5, 7, 9, 11, 13 });
 	}
 
 	public void testPreviousCamelCaseWord() {
-		String s= new String("   _isURLConnection_   ");
+		String s= "   _isURLConnection_   ";
 		assertPreviousPositions(s, new int[] { 0, 3, 6, 9, 20 });
 	}
 }
diff --git a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaWordIteratorTest.java b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaWordIteratorTest.java
index bef7fdb..7a00139 100644
--- a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaWordIteratorTest.java
+++ b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JavaWordIteratorTest.java
@@ -17,9 +17,6 @@
  */
 public class JavaWordIteratorTest extends BreakIteratorTest {
 
-	/*
-	 * @see junit.framework.TestCase#setUp()
-	 */
 	@Override
 	protected void setUp() throws Exception {
 		fBreakIterator= new JavaWordIterator();
@@ -42,76 +39,76 @@
 	}
 
 	public void testNextLn() {
-		String s= new String("word \n" +
-				"  word2");
+		String s= "word \n" +
+				"  word2";
 		assertNextPositions(s, new int[] { 5, 6, 8, 13 });
 	}
 
 	public void testMultiNextLn() {
-		String s= new String("word \n" +
+		String s= "word \n" +
 				"\n" +
 				"\n" +
-				"  word2");
+				"  word2";
 		assertNextPositions(s, new int[] { 5, 6, 7, 8, 10, 15 });
 	}
 
 	public void testMultiNextLn2() {
-		String s= new String("word \r\n" +
+		String s= "word \r\n" +
 				"\r\n" +
 				"\r\n" +
-				"  word2");
+				"  word2";
 		assertNextPositions(s, new int[] { 5, 7, 9, 11, 13, 18 });
 	}
 
 	public void testNextCamelCaseWord() {
-		String s= new String("   _isURLConnection_   ");
+		String s= "   _isURLConnection_   ";
 		assertNextPositions(s, new int[] { 3, 6, 9, 23 });
 	}
 
 	public void testPrevious1() {
-		String s= new String("word word");
+		String s= "word word";
 		assertPreviousPositions(s, new int[] { 0, 5 });
 	}
 
 	public void testPrevious2() {
-		String s= new String("wordWord word");
+		String s= "wordWord word";
 		assertPreviousPositions(s, new int[] { 0, 4, 9 });
 	}
 
 	public void testPreviousSpace() {
-		String s= new String(" word ");
+		String s= " word ";
 		assertPreviousPositions(s, new int[] { 1 });
 	}
 
 	public void testPreviousParen() {
-		String s= new String("word(params)");
+		String s= "word(params)";
 		assertPreviousPositions(s, new int[] { 0, 4, 5, 11 });
 	}
 
 	public void testPreviousLn() {
-		String s= new String("word \n" +
-				"  word2");
+		String s= "word \n" +
+				"  word2";
 		assertPreviousPositions(s, new int[] { 0, 5, 6, 8 });
 	}
 
 	public void testMultiPreviousLn() {
-		String s= new String("word \n" +
+		String s= "word \n" +
 				"\n" +
 				"\n" +
-				"  word2");
+				"  word2";
 		assertPreviousPositions(s, new int[] { 0, 5, 6, 7, 8, 10 });
 	}
 
 	public void testMultiPreviousLn2() {
-		String s= new String("word \r\n" +
+		String s= "word \r\n" +
 				"\r\n" +
 				"\r\n" +
-				"  word2");
+				"  word2";
 		assertPreviousPositions(s, new int[] { 0, 5, 7, 9, 11, 13 });
 	}
 
 	public void testPreviousCamelCaseWord() {
-		String s= new String("   _isURLConnection_   ");
+		String s= "   _isURLConnection_   ";
 		assertPreviousPositions(s, new int[] { 0, 3, 6, 9 });
 	}
 
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try10_in/A_testVar1.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try10_in/A_testVar1.java
new file mode 100644
index 0000000..11501d1
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try10_in/A_testVar1.java
@@ -0,0 +1,12 @@
+package try10_in;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+public class A_testVar1 {
+	public static void main(String[] args) {
+		var x = 5;
+		/*]*/var xStr = "x is " + x;/*[*/     // (*)
+		System.out.println(xStr);
+	}
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try10_out/A_testVar1.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try10_out/A_testVar1.java
new file mode 100644
index 0000000..132ed17
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try10_out/A_testVar1.java
@@ -0,0 +1,17 @@
+package try10_in;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+public class A_testVar1 {
+	public static void main(String[] args) {
+		var x = 5;
+		/*]*/var xStr = extracted(x);/*[*/     // (*)
+		System.out.println(xStr);
+	}
+
+	protected static String extracted(int x) {
+		var xStr = "x is " + x;
+		return xStr;
+	}
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup10.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup10.java
new file mode 100644
index 0000000..6ec9800
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup10.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.ui.tests.refactoring;
+
+import org.eclipse.ltk.core.refactoring.RefactoringCore;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+
+import junit.framework.Test;
+
+public class ExtractMethodTestSetup10 extends Java10Setup {
+
+	private IPackageFragment fTry10Package;
+
+	public ExtractMethodTestSetup10(Test test) {
+		super(test);
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+
+		RefactoringCore.getUndoManager().flush();
+
+		IPackageFragmentRoot root= getDefaultSourceFolder();
+		fTry10Package= root.createPackageFragment("try10_in", true, null);
+	}
+
+	public IPackageFragment getTry10Package() {
+		return fTry10Package;
+	}
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests10.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests10.java
new file mode 100644
index 0000000..b275654
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests10.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.ui.tests.refactoring;
+
+import junit.framework.Test;
+
+public class ExtractMethodTests10 extends ExtractMethodTests {
+	private static ExtractMethodTestSetup10 fgTestSetup;
+
+	public ExtractMethodTests10(String name) {
+		super(name);
+	}
+
+	public static Test suite() {
+		fgTestSetup= new ExtractMethodTestSetup10(new NoSuperTestsSuite(ExtractMethodTests10.class));
+		return fgTestSetup;
+	}
+
+	public static Test setUpTest(Test test) {
+		fgTestSetup= new ExtractMethodTestSetup10(test);
+		return fgTestSetup;
+	}
+
+	protected void try10Test() throws Exception {
+		performTest(fgTestSetup.getTry10Package(), "A", COMPARE_WITH_OUTPUT, "try10_out");
+	}
+
+	//====================================================================================
+	// Testing var type 
+	//====================================================================================
+
+	public void testVar1() throws Exception {
+		try10Test();
+	}
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java
index 7d820f5..7248c4d 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -39,9 +39,8 @@
 import org.eclipse.jdt.core.dom.InfixExpression.Operator;
 
 import org.eclipse.jdt.internal.corext.refactoring.code.InlineMethodRefactoring;
-import org.eclipse.jdt.internal.corext.refactoring.code.OperatorPrecedence;
 import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-
+import org.eclipse.jdt.internal.core.manipulation.dom.OperatorPrecedence;
 import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
 
 public class InlineMethodTests extends AbstractSelectionTestCase {
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/Java10Setup.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/Java10Setup.java
new file mode 100644
index 0000000..9bce5d9
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/Java10Setup.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.ui.tests.refactoring;
+
+import org.eclipse.jdt.testplugin.JavaProjectHelper;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+
+import junit.framework.Test;
+
+public class Java10Setup extends RefactoringTestSetup {
+
+	public Java10Setup(Test test) {
+		super(test);
+	}
+
+	@Override
+	protected IPackageFragmentRoot addRTJar(IJavaProject project) throws CoreException {
+		return JavaProjectHelper.addRTJar10(project);
+	}
+}
diff --git a/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaProjectHelper.java b/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaProjectHelper.java
index 4c29ba6..d64b084 100644
--- a/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaProjectHelper.java
+++ b/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/JavaProjectHelper.java
@@ -796,6 +796,12 @@
 		return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
 	}
 
+	public static IPackageFragmentRoot addRTJar10(IJavaProject jproject) throws CoreException {
+		IPath[] rtJarPath= findRtJar(RT_STUBS_10);
+		set10CompilerOptions(jproject);
+		return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
+	}
+
 	/**
 	 * Adds a variable entry with source attachment to a IJavaProject.
 	 * Can return null if variable can not be resolved.
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpStressTest.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpStressTest.java
index 121d3a9..ef716d1 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpStressTest.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpStressTest.java
@@ -5300,6 +5300,7 @@
 		enable(CleanUpConstants.SORT_MEMBERS_ALL);
 		
 		enable(CleanUpConstants.REMOVE_REDUNDANT_MODIFIERS);
+		enable(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS);
 
 		ICompilationUnit[] units= cus.toArray(new ICompilationUnit[cus.size()]);
 		performRefactoring(units);
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 2a87bc2..e23897d 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
@@ -9152,8 +9152,70 @@
 		buf.append("}\n");
 		String expected2 = buf.toString();
 		
+		// Anonymous class within an interface:
+		// public keyword must not be removed (see bug#536612)
+		buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("public interface X {\n");
+		buf.append("  void B();\n");
+		buf.append("  void A();\n");
+		buf.append("  default X y() {\n");
+		buf.append("    return new X() {\n");
+		buf.append("      @Override public void A() {}\n");
+		buf.append("      @Override public void B() {}\n");
+		buf.append("    };\n");
+		buf.append("  }\n");
+		buf.append("}\n");
+		String expected3 = buf.toString();
+
+		ICompilationUnit cu3= pack1.createCompilationUnit("AnonymousNestedInInterface.java", buf.toString(), false, null);
+
 		enable(CleanUpConstants.REMOVE_REDUNDANT_MODIFIERS);
-		assertRefactoringResultAsExpected(new ICompilationUnit[] { cu1, cu2 }, new String[] { expected1, expected2 });
+		assertRefactoringResultAsExpected(new ICompilationUnit[] { cu1, cu2, cu3 }, new String[] { expected1, expected2, expected3 });
 
 	}
+	
+	public void testRemoveRedundantSemicolons () throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test; ;\n");
+		buf.append("enum cars { sedan, coupe };\n");
+		buf.append("public class Foo {\n");
+		buf.append("  int add(int a, int b) {return a+b;};\n");
+		buf.append("  int a= 3;; ;\n");
+		buf.append("  int b= 7; // leave this ; alone\n");
+		buf.append("  int c= 10; /* and this ; too */\n");
+		buf.append("  public int foo () {\n");
+		buf.append("    ;\n");
+		buf.append("    for (;;)\n");
+		buf.append("      ;;\n");
+		buf.append("      ;\n");
+		buf.append("    while (a++ < 1000) ;\n");
+		buf.append("  };\n");
+		buf.append("};\n");
+		ICompilationUnit cu1= pack1.createCompilationUnit("Foo.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("enum cars { sedan, coupe }\n");
+		buf.append("public class Foo {\n");
+		buf.append("  int add(int a, int b) {return a+b;}\n");
+		buf.append("  int a= 3;\n");
+		buf.append("  int b= 7; // leave this ; alone\n");
+		buf.append("  int c= 10; /* and this ; too */\n");
+		buf.append("  public int foo () {\n");
+		buf.append("    \n");
+		buf.append("    for (;;)\n");
+		buf.append("      ;\n");
+		buf.append("      \n");
+		buf.append("    while (a++ < 1000) ;\n");
+		buf.append("  }\n");
+		buf.append("}\n");
+		String expected1 = buf.toString();
+
+		enable(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS);
+		assertRefactoringResultAsExpected(new ICompilationUnit[] { cu1 }, new String[] { expected1 });
+
+	}
+
 }
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/GetterSetterUtil.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/GetterSetterUtil.java
index ed3155f..596b619 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/GetterSetterUtil.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/GetterSetterUtil.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -37,8 +37,8 @@
 import org.eclipse.jdt.core.dom.PrimitiveType;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 import org.eclipse.jdt.internal.corext.util.JdtFlags;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ASTNodeFactory.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ASTNodeFactory.java
index 6871270..523de3b 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ASTNodeFactory.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ASTNodeFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -239,6 +239,42 @@
 		return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$
 	}
 
+	public static Type newNonVarType(AST ast, VariableDeclaration declaration, ImportRewrite importRewrite, ImportRewriteContext context) {
+		if (declaration.getAST().apiLevel() < AST.JLS10) {
+			return newType(ast, declaration, importRewrite, context);
+		}
+
+		if (declaration instanceof VariableDeclarationFragment && declaration.getParent() instanceof LambdaExpression) {
+			return newType((LambdaExpression) declaration.getParent(), (VariableDeclarationFragment) declaration, ast, importRewrite, context);
+		}
+
+		Type type= ASTNodes.getType(declaration);
+		Type finalType= null;
+		if (declaration instanceof SingleVariableDeclaration) {
+			finalType= ((SingleVariableDeclaration) declaration).getType();
+		} else if (type != null) {
+			finalType= type;
+		}
+		if (finalType != null && finalType.isVar()) {
+			ITypeBinding typeBinding= finalType.resolveBinding();
+			if (typeBinding != null) {
+				if (importRewrite != null) {
+					finalType= importRewrite.addImport(typeBinding, ast, context);
+					return finalType;
+				} else {
+					String qualifiedName= typeBinding.getQualifiedName();
+					if (qualifiedName.length() > 0) {
+						finalType= ast.newSimpleType(ast.newName(qualifiedName));
+						return finalType;
+					}
+				}
+			}
+			return finalType;
+		} else {
+			return newType(ast, declaration, importRewrite, context);
+		}
+	}
+
 	/**
 	 * Returns the new type node representing the return type of <code>lambdaExpression</code>
 	 * including the extra dimensions.
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
new file mode 100644
index 0000000..9739ba3
--- /dev/null
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Alex Blewitt - https://bugs.eclipse.org/bugs/show_bug.cgi?id=168954
+ *     Red Hat Inc. - split from CleanUpConstants
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
+
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.fix.UnimplementedCodeCleanUp;
+
+public class CleanUpConstantsOptions extends CleanUpConstants {
+
+	private static void setEclipseDefaultSettings(CleanUpOptions options) {
+
+		//Member Accesses
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.TRUE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
+
+		//Control Statements
+		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
+
+		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
+
+		//Expressions
+		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
+
+		//Variable Declarations
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
+
+		//Functional Interfaces
+		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
+		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
+		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
+
+		//Unused Code
+		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
+
+		//Unnecessary Code
+		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE);
+		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_SEMICOLONS, CleanUpOptions.FALSE);
+
+		//Missing Code
+		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
+
+		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
+		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
+
+		//Code Organizing
+		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
+
+		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.FALSE);
+
+		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
+	}
+
+	private static void setSaveParticipantSettings(CleanUpOptions options) {
+
+		//Member Accesses
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
+
+		//Control Statements
+		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
+
+		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
+
+		//Expressions
+		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
+
+		//Variable Declarations
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
+
+		//Functional Interfaces
+		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
+		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
+		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
+
+		//Unused Code
+		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
+
+		//Unnecessary Code
+		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.FALSE);
+		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_SEMICOLONS, CleanUpOptions.FALSE);
+
+		//Missing Code
+		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
+
+		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
+		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
+
+		//Code Organizing
+		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
+
+		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.TRUE);
+
+		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
+
+		options.setOption(CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS, CleanUpOptions.FALSE);
+	}
+
+	public static void initDefaults(IPreferenceStore store) {
+		CleanUpOptions settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
+		for (Iterator<String> iterator= settings.getKeys().iterator(); iterator.hasNext();) {
+			String key= iterator.next();
+			store.setDefault(key, settings.getValue(key));
+		}
+
+		store.setDefault(SHOW_CLEAN_UP_WIZARD, true);
+		store.setDefault(CLEANUP_PROFILE, DEFAULT_PROFILE);
+		store.setDefault(CLEANUP_ON_SAVE_PROFILE, DEFAULT_SAVE_PARTICIPANT_PROFILE);
+	}
+
+	public static void setDefaultOptions(int kind, CleanUpOptions options) {
+		switch (kind) {
+			case CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS:
+				CleanUpConstantsOptions.setEclipseDefaultSettings(options);
+				break;
+			case CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS:
+				CleanUpConstantsOptions.setSaveParticipantSettings(options);
+				break;
+			default:
+				Assert.isTrue(false, "Unknown Clean Up option kind: " + kind); //$NON-NLS-1$
+				break;
+		}
+	}
+
+}
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java
index 1031f14..7bd1127 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,74 +7,36 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to extend CompilationUnitRewriteOperationsFixCore
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 
-import org.eclipse.text.edits.TextEditGroup;
-
-import org.eclipse.ltk.core.refactoring.GroupCategory;
-import org.eclipse.ltk.core.refactoring.GroupCategorySet;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
-import org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext;
-import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
 
-import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
 import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
-import org.eclipse.jdt.internal.corext.util.Messages;
 
-import org.eclipse.jdt.ui.JavaUI;
-
-public class CompilationUnitRewriteOperationsFix extends AbstractFix {
-
-	public abstract static class CompilationUnitRewriteOperation {
+public class CompilationUnitRewriteOperationsFix extends CompilationUnitRewriteOperationsFixCore implements ILinkedFix {
+	
+	public abstract static class CompilationUnitRewriteOperation extends CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation {
 
 		public abstract void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel linkedModel) throws CoreException;
 
-		protected Type importType(final ITypeBinding toImport, final ASTNode accessor, ImportRewrite imports, final CompilationUnit compilationUnit) {
-			ImportRewriteContext importContext= new ContextSensitiveImportRewriteContext(compilationUnit, accessor.getStartPosition(), imports);
-			return imports.addImport(toImport, compilationUnit.getAST(), importContext);
-		}
-
-		protected TextEditGroup createTextEditGroup(String label, CompilationUnitRewrite rewrite) {
-			if (label.length() > 0) {
-				return rewrite.createCategorizedGroupDescription(label, new GroupCategorySet(new GroupCategory(label, label, label)));
-			} else {
-				return rewrite.createGroupDescription(label);
-			}
-		}
-
-		public String getAdditionalInfo() {
-			return null;
+		@Override
+		public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModelCore linkedModel) throws CoreException {
+			rewriteAST(cuRewrite, (LinkedProposalModel)linkedModel);
 		}
 	}
 
-	private final CompilationUnitRewriteOperation[] fOperations;
-	private final CompilationUnit fCompilationUnit;
-	private final LinkedProposalModel fLinkedProposalModel;
-
 	public CompilationUnitRewriteOperationsFix(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation operation) {
 		this(name, compilationUnit, new CompilationUnitRewriteOperation[] { operation });
 		Assert.isNotNull(operation);
 	}
 
 	public CompilationUnitRewriteOperationsFix(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation[] operations) {
-		super(name);
-		Assert.isNotNull(operations);
-		Assert.isLegal(operations.length > 0);
-		fCompilationUnit= compilationUnit;
-		fOperations= operations;
+		super(name, compilationUnit, operations);
 		fLinkedProposalModel= new LinkedProposalModel();
 	}
 
@@ -83,40 +45,7 @@
 		if (!fLinkedProposalModel.hasLinkedPositions())
 			return null;
 
-		return fLinkedProposalModel;
-	}
-
-	@Override
-	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
-		CompilationUnitRewrite cuRewrite= new CompilationUnitRewrite((ICompilationUnit)fCompilationUnit.getJavaElement(), fCompilationUnit);
-
-		fLinkedProposalModel.clear();
-		for (int i= 0; i < fOperations.length; i++) {
-			CompilationUnitRewriteOperation operation= fOperations[i];
-			operation.rewriteAST(cuRewrite, fLinkedProposalModel);
-		}
-
-		CompilationUnitChange result= cuRewrite.createChange(getDisplayString(), true, null);
-		if (result == null)
-			throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, Messages.format(FixMessages.CompilationUnitRewriteOperationsFix_nullChangeError, getDisplayString())));
-
-		return result;
-	}
-
-	@Override
-	public String getAdditionalProposalInfo(){
-		StringBuilder sb= new StringBuilder();
-		for (int i= 0; i < fOperations.length; i++) {
-			CompilationUnitRewriteOperation operation= fOperations[i];
-			String info= operation.getAdditionalInfo();
-			if (info != null)
-				sb.append(info);
-		}
-
-		if (sb.length() == 0)
-			return null;
-
-		return sb.toString();
+		return (LinkedProposalModel)fLinkedProposalModel;
 	}
 
 }
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ExpressionsFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ExpressionsFix.java
index 0e0984b..77cde30 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ExpressionsFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ExpressionsFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@
 import org.eclipse.jdt.core.dom.ParenthesizedExpression;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
 import org.eclipse.jdt.internal.corext.refactoring.util.NoCommentSourceRangeComputer;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java
index 6422f97..79153f3 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@
  * 		Remove unnecessary $NON-NLS$ tag
  *
  */
-public class StringFix implements IProposableFix {
+public class StringFix implements IProposableFix, ICleanUpFix {
 
 	private final TextEditGroup[] fEditGroups;
 	private final String fName;
@@ -106,7 +106,7 @@
 		ICompilationUnit cu= (ICompilationUnit)compilationUnit.getJavaElement();
 		if (!cu.isStructureKnown())
 			return null; //[clean up] 'Remove unnecessary $NLS-TAGS$' removes necessary ones in case of syntax errors: https://bugs.eclipse.org/bugs/show_bug.cgi?id=285814 : 
-		
+
 		List<CategorizedTextEditGroup> result= new ArrayList<>();
 
 		List<IProblemLocation> missingNLSProblems= new ArrayList<>();
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java
index 9de42e3..ed06f1b 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -63,7 +63,6 @@
 
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.dom.LinkedNodeFinder;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.StatementRewrite;
 import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
 import org.eclipse.jdt.internal.corext.util.Messages;
@@ -75,6 +74,8 @@
 import org.eclipse.jdt.internal.ui.fix.UnusedCodeCleanUp;
 import org.eclipse.jdt.internal.ui.text.correction.JavadocTagsSubProcessor;
 import org.eclipse.jdt.internal.ui.text.correction.ProblemLocation;
+
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
 
 /**
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java
index 262de59..f07b48f 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2017 IBM Corporation and others.
+ * Copyright (c) 2013, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
 import org.eclipse.jdt.core.dom.NodeFinder;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
 import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2;
 import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory;
@@ -25,7 +26,6 @@
 import org.eclipse.jdt.internal.corext.dom.GenericVisitor;
 import org.eclipse.jdt.internal.corext.dom.HierarchicalASTVisitor;
 import org.eclipse.jdt.internal.corext.dom.ModifierRewrite;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.ReplaceRewrite;
 import org.eclipse.jdt.internal.corext.dom.StatementRewrite;
 import org.eclipse.jdt.internal.corext.dom.TypeAnnotationRewrite;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java
index a354f20..ab2ec9f 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java
@@ -84,6 +84,7 @@
 import org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext;
 import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
 
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.Corext;
 import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
 import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
@@ -93,7 +94,6 @@
 import org.eclipse.jdt.internal.corext.dom.CodeScopeBuilder;
 import org.eclipse.jdt.internal.corext.dom.HierarchicalASTVisitor;
 import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.Selection;
 import org.eclipse.jdt.internal.corext.dom.TypeBindingVisitor;
 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java
index aa978ac..c577799 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java
@@ -277,7 +277,7 @@
 		switch (fReturnKind) {
 			case ACCESS_TO_LOCAL:
 				VariableDeclaration declaration= ASTNodes.findVariableDeclaration(fReturnValue, fEnclosingBodyDeclaration);
-				fReturnType= ASTNodeFactory.newType(ast, declaration, rewriter, new ContextSensitiveImportRewriteContext(declaration, rewriter));
+				fReturnType= ASTNodeFactory.newNonVarType(ast, declaration, rewriter, new ContextSensitiveImportRewriteContext(declaration, rewriter));
 				if (declaration.resolveBinding() != null) {
 					fReturnTypeBinding= declaration.resolveBinding().getType();
 				}
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
index c6d775a..2ba3b23 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -758,7 +758,7 @@
 			boolean isVarargs= declaration instanceof SingleVariableDeclaration
 				? ((SingleVariableDeclaration)declaration).isVarargs()
 				: false;
-			ParameterInfo info= new ParameterInfo(argument, getType(declaration, isVarargs), argument.getName(), i);
+			ParameterInfo info= new ParameterInfo(argument, getType(declaration, isVarargs, false), argument.getName(), i);
 			if (isVarargs) {
 				vararg= info;
 			} else {
@@ -932,6 +932,18 @@
 			return type;
 	}
 
+	private String getType(VariableDeclaration declaration, boolean isVarargs, boolean isVarTypeAllowed) {
+		if (isVarTypeAllowed) {
+			return getType(declaration, isVarargs);
+		} else {
+			String type= ASTNodes.asString(ASTNodeFactory.newNonVarType(declaration.getAST(), declaration, fImportRewriter, new ContextSensitiveImportRewriteContext(declaration, fImportRewriter)));
+			if (isVarargs)
+				return type + ParameterInfo.ELLIPSIS;
+			else
+				return type;
+		}
+	}
+
 	//---- Code generation -----------------------------------------------------------------------
 
 	private ASTNode[] createCallNodes(SnippetFinder.Match duplicate, int modifiers) {
@@ -1139,7 +1151,7 @@
 			VariableDeclaration infoDecl= getVariableDeclaration(info);
 			SingleVariableDeclaration parameter= fAST.newSingleVariableDeclaration();
 			parameter.modifiers().addAll(ASTNodeFactory.newModifiers(fAST, ASTNodes.getModifiers(infoDecl)));
-			parameter.setType(ASTNodeFactory.newType(fAST, infoDecl, fImportRewriter, context));
+			parameter.setType(ASTNodeFactory.newNonVarType(fAST, infoDecl, fImportRewriter, context));
 			parameter.setName(fAST.newSimpleName(info.getNewName()));
 			parameter.setVarargs(info.isNewVarargs());
 			parameters.add(parameter);
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineConstantRefactoring.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineConstantRefactoring.java
index be67c8f..a73a91d 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineConstantRefactoring.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineConstantRefactoring.java
@@ -104,7 +104,6 @@
 import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory;
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.dom.HierarchicalASTVisitor;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.fragments.ASTFragmentFactory;
 import org.eclipse.jdt.internal.corext.dom.fragments.IExpressionFragment;
 import org.eclipse.jdt.internal.corext.refactoring.Checks;
@@ -124,6 +123,7 @@
 import org.eclipse.jdt.internal.corext.refactoring.util.TightSourceRangeComputer;
 import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 import org.eclipse.jdt.internal.corext.util.Messages;
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.core.manipulation.util.Strings;
 
 import org.eclipse.jdt.ui.JavaElementLabels;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java
index 01fe270..76844d5 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java
@@ -79,13 +79,13 @@
 import org.eclipse.jdt.core.refactoring.IJavaRefactorings;
 import org.eclipse.jdt.core.refactoring.descriptors.InlineLocalVariableDescriptor;
 
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
 import org.eclipse.jdt.internal.core.manipulation.util.Strings;
 import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory;
 import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
 import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory;
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.refactoring.Checks;
 import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment;
 import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java
index 46fafbb..33227c8 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java
@@ -59,6 +59,7 @@
 import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
 import org.eclipse.jdt.core.manipulation.ImportReferencesCollector;
 
+import org.eclipse.jdt.internal.core.manipulation.dom.OperatorPrecedence;
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex;
 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceProvider.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceProvider.java
index 0bbdbb1..e2b86d9 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceProvider.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceProvider.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -86,10 +86,10 @@
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.dom.Bindings;
 import org.eclipse.jdt.internal.corext.dom.CodeScopeBuilder;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.refactoring.code.SourceAnalyzer.NameData;
 import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringFileBuffers;
 import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil;
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.core.manipulation.util.Strings;
 
 import org.eclipse.jdt.internal.ui.JavaPlugin;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgPolicyFactory.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgPolicyFactory.java
index bc17e3d..fdc4dee 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgPolicyFactory.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgPolicyFactory.java
@@ -12,6 +12,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.reorg;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -2547,8 +2548,14 @@
 			Matcher m= p.matcher(fileNameNoExtension);
 			if (m.find()) {
 				// String ends with a number: increment it by 1
-				int newNumber= Integer.parseInt(m.group()) + 1;
-				String numberStr= m.replaceFirst(Integer.toString(newNumber));
+				String numberStr;
+				BigDecimal newNumber = null;
+				try {
+					newNumber = new BigDecimal(m.group()).add(new BigDecimal(1));
+					numberStr = m.replaceFirst(newNumber.toPlainString());
+				} catch (NumberFormatException e) {
+					numberStr = m.replaceFirst("2"); //$NON-NLS-1$
+				}
 				return numberStr + fileExtension;
 			} else {
 				return fileNameNoExtension + "2" + fileExtension; //$NON-NLS-1$
@@ -4385,7 +4392,7 @@
 
 				}
 			}
-			final String value= new String(buffer.toString().trim());
+			final String value= buffer.toString().trim();
 			if (!"".equals(value)) //$NON-NLS-1$
 				arguments.put(ATTRIBUTE_LOG, value);
 		}
@@ -4425,7 +4432,7 @@
 					buffer.append(DELIMITER_RECORD);
 				}
 			}
-			final String value= new String(buffer.toString().trim());
+			final String value= buffer.toString().trim();
 			if (!"".equals(value)) //$NON-NLS-1$
 				arguments.put(ATTRIBUTE_LOG, value);
 		}
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/sef/AccessAnalyzer.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/sef/AccessAnalyzer.java
index b596b1f..81d596d 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/sef/AccessAnalyzer.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/sef/AccessAnalyzer.java
@@ -49,10 +49,10 @@
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
 
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.SourceRangeFactory;
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.dom.Bindings;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
 import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext;
 
diff --git a/org.eclipse.jdt.ui/css/e4-dark_jdt_syntaxhighlighting.css b/org.eclipse.jdt.ui/css/e4-dark_jdt_syntaxhighlighting.css
index 3dde4ba..fcc8d9d 100644
--- a/org.eclipse.jdt.ui/css/e4-dark_jdt_syntaxhighlighting.css
+++ b/org.eclipse.jdt.ui/css/e4-dark_jdt_syntaxhighlighting.css
@@ -112,4 +112,24 @@
     background-color:#515658;
     color:#eeeeee;
     swt-titlebar-color: #cccccc;
+}
+
+#BreadcrumbComposite,
+#BreadcrumbItemComposite,
+#BreadcrumbItemDetailComposite,
+#BreadcrumbItemDetailTextComposite,
+#BreadcrumbItemDetailImageComposite,
+#BreadcrumbItemDetailTextLabel,
+#BreadcrumbItemDetailImageLabel,
+#BreadcrumbItemDropDownToolBar
+{
+    /*
+     * Bug 465666
+     *
+     * Note: as we can't change the arrow to black, we configure
+     * the background with the lighter color used for the background
+     * of toolbars and make the foreground color brighter too.
+     */
+    background-color:#515658;
+    color: white;
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui/css/e4-light_jdt_syntaxhighlighting.css b/org.eclipse.jdt.ui/css/e4-light_jdt_syntaxhighlighting.css
new file mode 100644
index 0000000..a647ba4
--- /dev/null
+++ b/org.eclipse.jdt.ui/css/e4-light_jdt_syntaxhighlighting.css
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2018 SAP SE and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+#BreadcrumbComposite,
+#BreadcrumbItemComposite,
+#BreadcrumbItemDetailComposite,
+#BreadcrumbItemDetailTextComposite,
+#BreadcrumbItemDetailImageComposite,
+#BreadcrumbItemDetailTextLabel,
+#BreadcrumbItemDetailImageLabel,
+#BreadcrumbItemDropDownToolBar
+{
+    background-color:COLOR-WIDGET-LIGHT-SHADOW;;
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui/plugin.xml b/org.eclipse.jdt.ui/plugin.xml
index 9886a09..4c4d119 100644
--- a/org.eclipse.jdt.ui/plugin.xml
+++ b/org.eclipse.jdt.ui/plugin.xml
@@ -251,6 +251,11 @@
             class="org.eclipse.jdt.internal.ui.text.correction.DefaultClasspathFixProcessor"
             id="org.eclipse.jdt.ui.text.correction.DefaultClasspathFixProcessor">
       </classpathFixProcessor>
+      <classpathFixProcessor
+            class="org.eclipse.jdt.internal.ui.text.correction.DefaultModulepathFixProcessor"
+            id="org.eclipse.jdt.ui.text.correction.DefaultModulepathFixProcessor"
+            name="%defaultQuickAssistProcessor">
+      </classpathFixProcessor>
    </extension>
 
 	<!-- content assist processors - do not change their order -->  
@@ -6807,6 +6812,12 @@
                refid="org.eclipse.e4.ui.css.theme.e4_dark">
          </themeid>
       </stylesheet>
+      <stylesheet
+            uri="css/e4-light_jdt_syntaxhighlighting.css">
+         <themeid
+               refid="org.eclipse.e4.ui.css.theme.e4_default">
+         </themeid>
+      </stylesheet>
    </extension>
 
    <extension
@@ -6928,9 +6939,14 @@
             runAfter="org.eclipse.jdt.ui.cleanup.unnecessary_code">
       </cleanUp>
       <cleanUp
+            class="org.eclipse.jdt.internal.ui.fix.RedundantSemicolonsCleanUp"
+            id="org.eclipse.jdt.ui.cleanup.unnecessary_semicolons"
+            runAfter="org.eclipse.jdt.ui.cleanup.unnecessary_modifiers">
+      </cleanUp>
+      <cleanUp
             class="org.eclipse.jdt.internal.ui.fix.StringCleanUp"
             id="org.eclipse.jdt.ui.cleanup.strings"
-            runAfter="org.eclipse.jdt.ui.cleanup.unnecessary_modifiers">
+            runAfter="org.eclipse.jdt.ui.cleanup.unnecessary_semicolons">
       </cleanUp>
       <cleanUp
             class="org.eclipse.jdt.internal.ui.fix.UnimplementedCodeCleanUp"
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java
index ef344dd..050f80c 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java
@@ -11,7 +11,6 @@
 package org.eclipse.jdt.internal.ui;
 
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -424,28 +423,33 @@
 			};
 			PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener);
 
-			createOrUpdateWorkingSet(DynamicSourcesWorkingSetUpdater.MAIN_NAME, WorkingSetMessages.JavaMainSourcesWorkingSet_name, IWorkingSetIDs.DYNAMIC_SOURCES);
-			createOrUpdateWorkingSet(DynamicSourcesWorkingSetUpdater.TEST_NAME, WorkingSetMessages.JavaTestSourcesWorkingSet_name, IWorkingSetIDs.DYNAMIC_SOURCES);
+			createOrUpdateWorkingSet(DynamicSourcesWorkingSetUpdater.MAIN_NAME, DynamicSourcesWorkingSetUpdater.MAIN_OLD_NAME, WorkingSetMessages.JavaMainSourcesWorkingSet_name, IWorkingSetIDs.DYNAMIC_SOURCES);
+			createOrUpdateWorkingSet(DynamicSourcesWorkingSetUpdater.TEST_NAME, DynamicSourcesWorkingSetUpdater.TEST_OLD_NAME, WorkingSetMessages.JavaTestSourcesWorkingSet_name, IWorkingSetIDs.DYNAMIC_SOURCES);
 
 			new InitializeAfterLoadJob().schedule(); // last call in start, see bug 191193
 		}
 
 	}
 
-	private void createOrUpdateWorkingSet(String name, String label, final String id) {
+	private void createOrUpdateWorkingSet(String name, String oldname, String label, final String id) {
 		IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager();
-		IWorkingSet workingSet= Arrays.stream(workingSetManager.getAllWorkingSets()) // 
-				.filter(w -> id.equals(w.getId()) && name.equals(w.getName())) //
-				.findAny() //
-				.orElse(null);
+		IWorkingSet workingSet= workingSetManager.getWorkingSet(name);
 		if (workingSet == null) {
 			workingSet= workingSetManager.createWorkingSet(name, new IAdaptable[0]);
 			workingSet.setLabel(label);
 			workingSet.setId(id);
 			workingSetManager.addWorkingSet(workingSet);
 		} else {
-			if (!label.equals(workingSet.getLabel()))
-				workingSet.setLabel(label);
+			if(id.equals(workingSet.getId())) {
+				if (!label.equals(workingSet.getLabel()))
+					workingSet.setLabel(label);
+			} else {
+				logErrorMessage("found existing workingset with name=\"" + name + "\" but id=\"" + workingSet.getId() + "\""); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
+			}			
+		}
+		IWorkingSet oldWorkingSet= workingSetManager.getWorkingSet(oldname);
+		if (oldWorkingSet != null && id.equals(oldWorkingSet.getId())) {
+			workingSetManager.removeWorkingSet(oldWorkingSet);
 		}
 	}
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java
index ec14d0d..b9dcc18 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java
@@ -41,7 +41,6 @@
 import org.eclipse.core.runtime.jobs.Job;
 
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.dialogs.IDialogSettings;
@@ -57,7 +56,6 @@
 import org.eclipse.jface.viewers.ILabelDecorator;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
 import org.eclipse.jface.viewers.StyledString;
 import org.eclipse.jface.viewers.StyledString.Styler;
 
@@ -128,16 +126,8 @@
  */
 public class FilteredTypesSelectionDialog extends FilteredItemsSelectionDialog implements ITypeSelectionComponent {
 
-	/**
-	 * Disabled "Show Container for Duplicates because of
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=184693 .
-	 */
-	private static final boolean BUG_184693= true;
-
 	private static final String DIALOG_SETTINGS= "org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog"; //$NON-NLS-1$
 
-	private static final String SHOW_CONTAINER_FOR_DUPLICATES= "ShowContainerForDuplicates"; //$NON-NLS-1$
-
 	private static final String WORKINGS_SET_SETTINGS= "WorkingSet"; //$NON-NLS-1$
 
 	private WorkingSetFilterActionGroup fFilterActionGroup;
@@ -146,8 +136,6 @@
 
 	private String fTitle;
 
-	private ShowContainerForDuplicatesAction fShowContainerForDuplicatesAction;
-
 	private IJavaSearchScope fSearchScope;
 
 	private boolean fAllowScopeSwitching;
@@ -301,10 +289,6 @@
 	protected void storeDialog(IDialogSettings settings) {
 		super.storeDialog(settings);
 
-		if (! BUG_184693) {
-			settings.put(SHOW_CONTAINER_FOR_DUPLICATES, fShowContainerForDuplicatesAction.isChecked());
-		}
-
 		if (fFilterActionGroup != null) {
 			XMLMemento memento= XMLMemento.createWriteRoot("workingSet"); //$NON-NLS-1$
 			fFilterActionGroup.saveState(memento);
@@ -324,14 +308,6 @@
 	protected void restoreDialog(IDialogSettings settings) {
 		super.restoreDialog(settings);
 
-		if (! BUG_184693) {
-			boolean showContainer= settings.getBoolean(SHOW_CONTAINER_FOR_DUPLICATES);
-			fShowContainerForDuplicatesAction.setChecked(showContainer);
-			fTypeInfoLabelProvider.setContainerInfo(showContainer);
-		} else {
-			fTypeInfoLabelProvider.setContainerInfo(true);
-		}
-
 		if (fAllowScopeSwitching) {
 			String setting= settings.get(WORKINGS_SET_SETTINGS);
 			if (setting != null) {
@@ -365,10 +341,6 @@
 	protected void fillViewMenu(IMenuManager menuManager) {
 		super.fillViewMenu(menuManager);
 
-		if (! BUG_184693) {
-			fShowContainerForDuplicatesAction= new ShowContainerForDuplicatesAction();
-			menuManager.add(fShowContainerForDuplicatesAction);
-		}
 		if (fAllowScopeSwitching) {
 			fFilterActionGroup= new WorkingSetFilterActionGroup(getShell(), JavaPlugin.getActivePage(), new IPropertyChangeListener() {
 				@Override
@@ -655,25 +627,6 @@
 		applyFilter();
 	}
 
-	/**
-	 * The <code>ShowContainerForDuplicatesAction</code> provides means to
-	 * show/hide container information for duplicate elements.
-	 */
-	private class ShowContainerForDuplicatesAction extends Action {
-
-		/**
-		 * Creates a new instance of the class
-		 */
-		public ShowContainerForDuplicatesAction() {
-			super(JavaUIMessages.FilteredTypeSelectionDialog_showContainerForDuplicatesAction, IAction.AS_CHECK_BOX);
-		}
-
-		@Override
-		public void run() {
-			fTypeInfoLabelProvider.setContainerInfo(isChecked());
-		}
-	}
-
 	private class TypeFiltersPreferencesAction extends Action {
 
 		public TypeFiltersPreferencesAction() {
@@ -693,7 +646,6 @@
 	 */
 	private class TypeItemLabelProvider extends LabelProvider implements ILabelDecorator, IStyledLabelProvider {
 
-		private boolean fContainerInfo;
 		private LocalResourceManager fImageManager;
 
 		private BoldStylerProvider fBoldStylerProvider;
@@ -717,11 +669,6 @@
 			}
 		}
 
-		public void setContainerInfo(boolean containerInfo) {
-			fContainerInfo= containerInfo;
-			fireLabelProviderChanged(new LabelProviderChangedEvent(this));
-		}
-
 		@Override
 		public Image getImage(Object element) {
 			if (!(element instanceof TypeNameMatch)) {
@@ -740,16 +687,7 @@
 			if (!(element instanceof TypeNameMatch)) {
 				return super.getText(element);
 			}
-			TypeNameMatch typeMatch= (TypeNameMatch) element;
-			if (fContainerInfo && isDuplicateElement(element)) {
-				return BasicElementLabels.getJavaElementName(fTypeInfoUtil.getFullyQualifiedText(typeMatch));
-			}
-
-			if (!fContainerInfo && isDuplicateElement(element)) {
-				return BasicElementLabels.getJavaElementName(fTypeInfoUtil.getQualifiedText(typeMatch));
-			}
-
-			return BasicElementLabels.getJavaElementName(typeMatch.getSimpleTypeName());
+			return BasicElementLabels.getJavaElementName(fTypeInfoUtil.getFullyQualifiedText((TypeNameMatch) element));
 		}
 
 		@Override
@@ -762,12 +700,7 @@
 			if (!(element instanceof TypeNameMatch)) {
 				return null;
 			}
-
-			if (fContainerInfo && isDuplicateElement(element)) {
-				return BasicElementLabels.getJavaElementName(fTypeInfoUtil.getFullyQualifiedText((TypeNameMatch) element));
-			}
-
-			return BasicElementLabels.getJavaElementName(fTypeInfoUtil.getQualifiedText((TypeNameMatch) element));
+			return BasicElementLabels.getJavaElementName(fTypeInfoUtil.getFullyQualifiedText((TypeNameMatch) element));
 		}
 
 		@Override
@@ -910,21 +843,6 @@
 			return Messages.format(JavaUIMessages.FilteredTypesSelectionDialog_library_name_format, name);
 		}
 
-
-
-		public String getQualifiedText(TypeNameMatch type) {
-			StringBuilder result= new StringBuilder();
-			result.append(type.getSimpleTypeName());
-			String containerName= type.getTypeContainerName();
-			result.append(JavaElementLabels.CONCAT_STRING);
-			if (containerName.length() > 0) {
-				result.append(containerName);
-			} else {
-				result.append(JavaUIMessages.FilteredTypesSelectionDialog_default_package);
-			}
-			return result.toString();
-		}
-
 		public String getFullyQualifiedText(TypeNameMatch type) {
 			StringBuilder result= new StringBuilder();
 			result.append(type.getSimpleTypeName());
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java
index f6b524a..c03b4b0 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.java
@@ -106,6 +106,7 @@
 	public static String TypeParametersCleanUp_RemoveUnnecessaryTypeArguments_description;
 
 	public static String RedundantModifiersCleanup_description;
+	public static String RedundantSemicolonsCleanup_description;
 
 	static {
 		// initialize resource bundle
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties
index f42d2d8..5323e24 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/MultiFixMessages.properties
@@ -92,3 +92,4 @@
 TypeParametersCleanUp_RemoveUnnecessaryTypeArguments_description=Remove redundant type arguments
 
 RedundantModifiersCleanup_description = Remove redundant modifiers
+RedundantSemicolonsCleanup_description= Remove redundant semicolons
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java
index 3d1d07c..cac62fb 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java
@@ -20,6 +20,7 @@
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
 import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jdt.core.dom.FieldDeclaration;
 import org.eclipse.jdt.core.dom.MethodDeclaration;
@@ -134,7 +135,10 @@
 			public boolean visit(MethodDeclaration node) {
 				TypeDeclaration typeDecl= ASTNodes.getParent(node, TypeDeclaration.class);
 				if (typeDecl != null && typeDecl.isInterface()) {
-					rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.PUBLIC | Modifier.ABSTRACT));
+					rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.ABSTRACT));
+					if (!AnonymousClassDeclaration.class.isInstance(node.getParent())) {
+						rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.PUBLIC));
+					}
 				} else if (typeDecl != null && Modifier.isFinal(typeDecl.getModifiers()) && Modifier.isFinal(node.getModifiers())) {
 					rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.FINAL));
 				}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java
new file mode 100644
index 0000000..7190217
--- /dev/null
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2018 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Karsten Thoms (itemis) - initial API and implementation
+ *     Red Hat Inc. - copied and modified to replace extraneous semicolons
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.fix;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.TextEditGroup;
+
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+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.EmptyStatement;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility;
+
+import org.eclipse.jdt.ui.cleanup.CleanUpRequirements;
+import org.eclipse.jdt.ui.cleanup.ICleanUpFix;
+import org.eclipse.jdt.ui.text.java.IProblemLocation;
+
+/**
+ * A fix that removes redundant semi-colons from package declarations, field declarations,
+ * method declarations, and removes empty statements from blocks.  Does not touch
+ * empty statements belonging to loops (e.g. empty for-loop) nor semicolons used
+ * in a for-loop statement itself (e.g. for(;;)).
+ */
+public class RedundantSemicolonsCleanUp extends AbstractMultiFix implements ICleanUpFix {
+
+	private TextEditGroup[] fEditGroups;
+	private String fName;
+	private ICompilationUnit fCompilationUnit;
+	final static Pattern pattern= Pattern.compile("^((\\s*;)+)"); //$NON-NLS-1$
+
+	public RedundantSemicolonsCleanUp() {
+		this(Collections.emptyMap());
+	}
+
+	public RedundantSemicolonsCleanUp(Map<String, String> options) {
+		super(options);
+	}
+
+	@Override
+	public CleanUpRequirements getRequirements() {
+		boolean requireAST= isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS);
+		Map<String, String> requiredOptions= null;
+		return new CleanUpRequirements(requireAST, false, false, requiredOptions);
+	}
+
+	@Override
+	public String[] getStepDescriptions() {
+		if (isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) {
+			return new String[] { MultiFixMessages.RedundantSemicolonsCleanup_description };
+		}
+		return new String[0];
+	}
+
+	@SuppressWarnings("nls")
+	@Override
+	public String getPreview() {
+		StringBuffer buf= new StringBuffer();
+		buf.append("\n");
+		buf.append("enum color {\n");
+		buf.append("  red, yellow, green\n");
+		if (isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) {
+			buf.append("}\n");
+		} else {
+			buf.append("};\n");
+		}
+		buf.append("\npublic class IFoo {\n");
+		if (isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) {
+			buf.append("  int a= 3;\n");
+			buf.append("  public void foo() {}\n");
+			buf.append("}\n");
+		} else {
+			buf.append("  int a= 3;;\n");
+			buf.append("  public void foo() {;};\n");
+			buf.append("};\n");
+		}
+
+		return buf.toString();
+	}
+
+	private void searchNode(ASTNode node, String contents, String label, ArrayList<TextEditGroup> textedits) {
+		int start= node.getStartPosition();
+		int length= node.getLength();
+
+		int trailing = findTrailingSemicolons(contents, start + length);
+
+		if (trailing > 0) {
+			ReplaceEdit edit = new ReplaceEdit(start + length, trailing, ""); //$NON-NLS-1$
+			textedits.add(new TextEditGroup(label, edit));
+		}
+	}
+	
+	@Override
+	protected ICleanUpFix createFix(CompilationUnit unit) throws CoreException {
+		if (!isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) {
+			return null;
+		}
+		ICompilationUnit compilationUnit = (ICompilationUnit)unit.getJavaElement();
+		IBuffer buffer= compilationUnit.getBuffer();
+		String contents= buffer.getContents();
+
+		String label= MultiFixMessages.RedundantSemicolonsCleanup_description;
+		ArrayList<TextEditGroup> textedits= new ArrayList<>();
+
+		unit.accept(new ASTVisitor() {
+			@Override
+			public boolean visit(PackageDeclaration node) {
+				searchNode(node, contents, label, textedits);
+				return false;
+			}
+
+			@Override
+			public boolean visit(FieldDeclaration node) {
+				searchNode(node, contents, label, textedits);
+				return false;
+			}
+
+			@Override
+			public boolean visit(MethodDeclaration node) {
+				searchNode(node, contents, label, textedits);
+				return true;
+			}
+
+			@Override
+			public boolean visit(EnumDeclaration node) {
+				searchNode(node, contents, label, textedits);
+				return true;
+			}
+
+			@Override
+			public boolean visit(TypeDeclaration node) {
+				searchNode(node, contents, label, textedits);
+				return true;
+			}
+
+			@Override
+			public boolean visit(EmptyStatement node) {
+				ASTNode parent= node.getParent();
+				if (parent instanceof Block) {
+					int start= node.getStartPosition();
+					ReplaceEdit edit= new ReplaceEdit(start, 1, ""); //$NON-NLS-1$
+					textedits.add(new TextEditGroup(label, edit));
+				}
+				return false;
+			}
+			
+			@Override
+			public boolean visit(Block node) {
+				searchNode(node, contents, label, textedits);
+				return true;
+			}
+		});
+
+		if (textedits.size() > 0) {
+			return new RedundantSemicolonsCleanUp(label, unit, textedits.toArray(new TextEditGroup[0]));
+		}
+		return null;
+	}
+
+	private int findTrailingSemicolons(String contents, int startLocation) {
+		int i= startLocation;
+		Matcher matcher= pattern.matcher(contents.substring(i));
+		if (matcher.find(0)) {
+			return matcher.end(2);
+		}
+		return -1;
+	}
+
+	private RedundantSemicolonsCleanUp(String name, CompilationUnit compilationUnit, TextEditGroup[] groups) {
+		fName= name;
+		fCompilationUnit= (ICompilationUnit)compilationUnit.getJavaElement();
+		fEditGroups= groups;
+	}
+
+	@Override
+	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
+		if (fEditGroups == null || fEditGroups.length == 0)
+			return null;
+
+		CompilationUnitChange result= new CompilationUnitChange(fName, fCompilationUnit);
+		for (int i= 0; i < fEditGroups.length; i++) {
+			TextEdit[] edits= fEditGroups[i].getTextEdits();
+			String groupName= fEditGroups[i].getName();
+			for (int j= 0; j < edits.length; j++) {
+				TextChangeCompatibility.addTextEdit(result, groupName, edits[j]);
+			}
+		}
+		return result;
+	}
+
+	@Override
+	public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) {
+		return false;
+	}
+
+	@Override
+	protected ICleanUpFix createFix(CompilationUnit unit, IProblemLocation[] problems) throws CoreException {
+		return null;
+	}
+
+}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackFatJarBuilder.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackFatJarBuilder.java
index 59a3ae6..9673a58 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackFatJarBuilder.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackFatJarBuilder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.jarpackagerfat;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.zip.ZipEntry;
@@ -21,12 +22,11 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 
+import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
 import org.eclipse.jdt.internal.corext.util.Messages;
 
 import org.eclipse.jdt.ui.jarpackager.IManifestProvider;
 
-import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
-
 /**
  * A jar builder wich unpacks all referenced libraries into the generated jar.
  * 
@@ -62,17 +62,32 @@
 	}
 
 	@Override
-	public void writeArchive(ZipFile jarFile, IProgressMonitor progressMonitor) {
-		Enumeration<? extends ZipEntry> jarEntriesEnum= jarFile.entries();
-		while (jarEntriesEnum.hasMoreElements()) {
-			ZipEntry jarEntry= jarEntriesEnum.nextElement();
-			if (!jarEntry.isDirectory()) {
-				String entryName= jarEntry.getName();
-				addFile(entryName, jarEntry, jarFile);
+	public void writeArchive(ZipFile zipFile, IProgressMonitor progressMonitor) {
+		Enumeration<? extends ZipEntry> jarEntriesEnum= zipFile.entries();
+		File zipFile1 = new File(zipFile.getName());
+		try {
+			String zipFileCanonical = zipFile1.getCanonicalPath();
+		
+			while (jarEntriesEnum.hasMoreElements()) {
+				ZipEntry zipEntry= jarEntriesEnum.nextElement();
+				if (!zipEntry.isDirectory()) {
+					String entryName= zipEntry.getName();
+					File zipEntryFile = new File(zipFile1, entryName);
+					String zipEntryCanonical = zipEntryFile.getCanonicalPath();
+					if (zipEntryCanonical.startsWith(zipFileCanonical + File.separator)) {
+						addFile(entryName, zipEntry, zipFile);
+					}
+					else {
+						addWarning("Invalid path" + entryName, null); //$NON-NLS-1$
+					}
+				}
+				progressMonitor.worked(1);
+				if (progressMonitor.isCanceled())
+					throw new OperationCanceledException();
 			}
-			progressMonitor.worked(1);
-			if (progressMonitor.isCanceled())
-				throw new OperationCanceledException();
+		} catch (IOException e) {
+			addWarning("ZipFile error" + zipFile.getName(), null); //$NON-NLS-1$
+			e.printStackTrace();
 		}
 	}
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javadocexport/JavadocStandardWizardPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javadocexport/JavadocStandardWizardPage.java
index 518b3f1..225f844 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javadocexport/JavadocStandardWizardPage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javadocexport/JavadocStandardWizardPage.java
@@ -381,17 +381,13 @@
 		else
 			fStore.setTitle(""); //$NON-NLS-1$
 
-		//don't store the buttons if they are not enabled
-		//this will change when there is a single page aimed at the standard doclet
-		if (true) {
-			Object[] buttons= fButtonsList.toArray();
-			for (int i= 0; i < buttons.length; i++) {
-				FlaggedButton button= (FlaggedButton) buttons[i];
-				if (button.getButton().getEnabled())
-					fStore.setBoolean(button.getFlag(), !(button.getButton().getSelection() ^ button.show()));
-				else
-					fStore.setBoolean(button.getFlag(), false == button.show());
-			}
+		Object[] buttons= fButtonsList.toArray();
+		for (int i= 0; i < buttons.length; i++) {
+			FlaggedButton button= (FlaggedButton) buttons[i];
+			if (button.getButton().getEnabled())
+				fStore.setBoolean(button.getFlag(), !(button.getButton().getSelection() ^ button.show()));
+			else
+				fStore.setBoolean(button.getFlag(), false == button.show());
 		}
 
 		if (fStyleSheetText.getEnabled())
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItem.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItem.java
index ad9b119..a28c688 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItem.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItem.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Fabio Zadrozny - Bug 465666
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.javaeditor.breadcrumb;
 
@@ -73,6 +74,8 @@
 		fDetailsBlock= new BreadcrumbItemDetails(this, fContainer);
 
 		fExpandBlock= new BreadcrumbItemDropDown(this, fContainer);
+
+		fContainer.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemComposite"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	/**
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDetails.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDetails.java
index 4f6c055..e9462c3 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDetails.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDetails.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Fabio Zadrozny - Bug 465666
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.javaeditor.breadcrumb;
 
@@ -25,13 +26,11 @@
 import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.events.TraverseEvent;
 import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 
@@ -126,6 +125,12 @@
 		});
 
 		fDetailComposite.setTabList(new Control[] { fTextComposite });
+
+		fDetailComposite.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemDetailComposite"); //$NON-NLS-1$ //$NON-NLS-2$
+		fTextComposite.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemDetailTextComposite"); //$NON-NLS-1$ //$NON-NLS-2$
+		fImageComposite.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemDetailImageComposite"); //$NON-NLS-1$ //$NON-NLS-2$
+		fElementImage.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemDetailImageLabel"); //$NON-NLS-1$ //$NON-NLS-2$
+		fElementText.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemDetailTextLabel"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	/**
@@ -221,7 +226,6 @@
 				fImageComposite.setFocus();
 			}
 		}
-		updateSelection();
 	}
 
 	/**
@@ -253,7 +257,6 @@
 		if (!fSelected)
 			fHasFocus= false;
 
-		updateSelection();
 	}
 
 	public void setFocus(boolean enabled) {
@@ -268,39 +271,6 @@
 				fImageComposite.setFocus();
 			}
 		}
-		updateSelection();
-	}
-
-	private void updateSelection() {
-		Color background;
-		Color foreground;
-
-		if (fSelected && fHasFocus) {
-			background= Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION);
-			foreground= Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
-		} else {
-			foreground= null;
-			background= null;
-		}
-
-		if (isTextVisible()) {
-			fTextComposite.setBackground(background);
-			fElementText.setBackground(background);
-			fElementText.setForeground(foreground);
-
-			fImageComposite.setBackground(null);
-			fElementImage.setBackground(null);
-		} else {
-			fImageComposite.setBackground(background);
-			fElementImage.setBackground(background);
-
-			fTextComposite.setBackground(null);
-			fElementText.setBackground(null);
-			fElementText.setForeground(null);
-		}
-
-		fTextComposite.redraw();
-		fImageComposite.redraw();
 	}
 
 	/**
@@ -406,7 +376,6 @@
 			public void focusGained(FocusEvent e) {
 				if (!fHasFocus) {
 					fHasFocus= true;
-					updateSelection();
 				}
 			}
 
@@ -414,7 +383,6 @@
 			public void focusLost(FocusEvent e) {
 				if (fHasFocus) {
 					fHasFocus= false;
-					updateSelection();
 				}
 			}
 		});
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java
index 814827a..dfab74e 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Fabio Zadrozny - Bug 465666
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.javaeditor.breadcrumb;
 
@@ -104,19 +105,19 @@
 		@Override
 		protected void drawCompositeImage(int width, int height) {
 			Display display= fParentComposite.getDisplay();
-			
+
 			ImageDataProvider imageProvider= zoom -> {
 				Image image= new Image(display, ARROW_SIZE, ARROW_SIZE * 2);
-				
+
 				GC gc= new GC(image, fLTR ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT);
 				gc.setAntialias(SWT.ON);
-				
+
 				Color triangleColor= createColor(SWT.COLOR_LIST_FOREGROUND, SWT.COLOR_LIST_BACKGROUND, 20, display);
 				gc.setBackground(triangleColor);
 				gc.fillPolygon(new int[] { 0, 0, ARROW_SIZE, ARROW_SIZE, 0, ARROW_SIZE * 2 });
 				gc.dispose();
 				triangleColor.dispose();
-				
+
 				ImageData imageData= image.getImageData(zoom);
 				image.dispose();
 				int zoomedArrowSize= ARROW_SIZE * zoom / 100;
@@ -152,7 +153,7 @@
 
 	private static final int DROP_DOWN_MIN_WIDTH= 250;
 	private static final int DROP_DOWN_MAX_WIDTH= 500;
-	
+
 	private static final int DROP_DOWN_DEFAULT_MIN_HEIGHT= 200;
 	private static final int DROP_DOWN_DEFAULT_MAX_HEIGHT= 300;
 
@@ -211,6 +212,7 @@
 				}
 			});
 		}
+		fToolBar.setData("org.eclipse.e4.ui.css.id", "BreadcrumbItemDropDownToolBar"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	/**
@@ -306,7 +308,7 @@
 		fDropDownViewer.setInput(input);
 
 		setShellBounds(fShell);
-		
+
 		fShell.addControlListener(new ControlAdapter() {
 			/*
 			 * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
@@ -315,7 +317,7 @@
 			public void controlResized(ControlEvent e) {
 				if (isResizingProgrammatically)
 					return;
-				
+
 				Point size= fShell.getSize();
 				getDialogSettings().put(DIALOG_HEIGHT, size.y);
 			}
@@ -653,7 +655,7 @@
 			settings= javaSettings.addNewSection(DIALOG_SETTINGS);
 		return settings;
 	}
-	
+
 	private int getMaxHeight() {
 		try {
 			return getDialogSettings().getInt(DIALOG_HEIGHT);
@@ -661,7 +663,7 @@
 			return DROP_DOWN_DEFAULT_MAX_HEIGHT;
 		}
 	}
-	
+
 	/**
 	 * Calculates a useful size for the given shell.
 	 *
@@ -748,7 +750,7 @@
 		int currentHeight= size.y;
 
 		int maxHeight= getMaxHeight();
-		
+
 		if (currentHeight >= maxHeight && currentWidth >= DROP_DOWN_MAX_WIDTH)
 			return;
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbViewer.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbViewer.java
index 558668e..a1603dc 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbViewer.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbViewer.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Fabio Zadrozny - Bug 465666
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.javaeditor.breadcrumb;
 
@@ -21,15 +22,11 @@
 import org.eclipse.swt.events.MenuDetectListener;
 import org.eclipse.swt.events.TraverseEvent;
 import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
@@ -51,8 +48,6 @@
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.ViewerCell;
 
-import org.eclipse.ui.forms.FormColors;
-
 
 /**
  * A breadcrumb viewer shows a the parent chain of its input element in a list. Each breadcrumb item
@@ -108,22 +103,7 @@
 			}
 		});
 		fContainer.setBackgroundMode(SWT.INHERIT_DEFAULT);
-
-		fContainer.addListener(SWT.Resize, new Listener() {
-			@Override
-			public void handleEvent(Event event) {
-				int height= fContainer.getClientArea().height;
-
-				if (fGradientBackground == null || fGradientBackground.getBounds().height != height) {
-					Image image= height == 0 ? null : createGradientImage(height, event.display);
-					fContainer.setBackgroundImage(image);
-
-					if (fGradientBackground != null)
-						fGradientBackground.dispose();
-					fGradientBackground= image;
-				}
-			}
-		});
+		fContainer.setData("org.eclipse.e4.ui.css.id", "BreadcrumbComposite"); //$NON-NLS-1$ //$NON-NLS-2$
 
 		hookControl(fContainer);
 
@@ -744,71 +724,6 @@
 		fContainer.setRedraw(false);
 	}
 
-	/**
-	 * The image to use for the breadcrumb background as specified in
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=221477
-	 *
-	 * @param height the height of the image to create
-	 * @param display the current display
-	 * @return the image for the breadcrumb background
-	 */
-	private Image createGradientImage(int height, Display display) {
-		int width= 50;
-
-		Image result= new Image(display, width, height);
-
-		GC gc= new GC(result);
-
-		Color colorC= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 35, display);
-		Color colorD= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 45, display);
-		Color colorE= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 80, display);
-		Color colorF= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 70, display);
-		Color colorG= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_WHITE, 45, display);
-		Color colorH= createColor(SWT.COLOR_WIDGET_NORMAL_SHADOW, SWT.COLOR_LIST_BACKGROUND, 35, display);
-
-		try {
-			drawLine(width, 0, colorC, gc);
-			drawLine(width, 1, colorC, gc);
-
-			gc.setForeground(colorD);
-			gc.setBackground(colorE);
-			gc.fillGradientRectangle(0, 2, width, 2 + 8, true);
-
-			gc.setBackground(colorE);
-			gc.fillRectangle(0, 2 + 9, width, height - 4);
-
-			drawLine(width, height - 3, colorF, gc);
-			drawLine(width, height - 2, colorG, gc);
-			drawLine(width, height - 1, colorH, gc);
-
-		} finally {
-			gc.dispose();
-
-			colorC.dispose();
-			colorD.dispose();
-			colorE.dispose();
-			colorF.dispose();
-			colorG.dispose();
-			colorH.dispose();
-		}
-
-		return result;
-	}
-
-	private void drawLine(int width, int position, Color color, GC gc) {
-		gc.setForeground(color);
-		gc.drawLine(0, position, width, position);
-	}
-
-	private Color createColor(int color1, int color2, int ratio, Display display) {
-		RGB rgb1= display.getSystemColor(color1).getRGB();
-		RGB rgb2= display.getSystemColor(color2).getRGB();
-
-		RGB blend= FormColors.blend(rgb2, rgb1, ratio);
-
-		return new Color(display, blend);
-	}
-
 	/*
 	 * @see org.eclipse.jface.viewers.StructuredViewer#handleDispose(org.eclipse.swt.events.DisposeEvent)
 	 * @since 3.6.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 df71e0f..d4d68ab 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
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -106,6 +106,8 @@
 	public static String UnnecessaryCodeTabPage_CheckboxName_RedundantTypeArguments;
 	public static String UnnecessaryCodeTabPage_CheckboxName_RedundantModifiers;
 	public static String UnnecessaryCodeTabPage_CheckboxName_RedundantModifiers_description;
+	public static String UnnecessaryCodeTabPage_CheckboxName_RedundantSemicolons;
+	public static String UnnecessaryCodeTabPage_CheckboxName_RedundantSemicolons_description;
 	public static String UnnecessaryCodeTabPage_CheckboxName_UnusedConstructors;
 	public static String UnnecessaryCodeTabPage_CheckboxName_UnusedFields;
 	public static String UnnecessaryCodeTabPage_CheckboxName_UnusedImports;
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 620df3a..74e8f0e 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
@@ -94,3 +94,5 @@
 UnnecessaryCodeTabPage_CheckboxName_RedundantTypeArguments=Remove redundant type &arguments (1.7 or higher)
 UnnecessaryCodeTabPage_CheckboxName_RedundantModifiers=R&emove redundant modifiers
 UnnecessaryCodeTabPage_CheckboxName_RedundantModifiers_description=Removes unnecessary modifiers on fields and methods
+UnnecessaryCodeTabPage_CheckboxName_RedundantSemicolons=Remove redundant semicolons
+UnnecessaryCodeTabPage_CheckboxName_RedundantSemicolons_description=Removes unnecessary semicolons on statements and declarations
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java
index 093501d..bc6e9b3 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.preferences.cleanup;
 
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstantsOptions;
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 
 import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
@@ -29,7 +30,7 @@
 	 */
 	@Override
 	public void setDefaultOptions(CleanUpOptions options) {
-		CleanUpConstants.setDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS, options);
+		CleanUpConstantsOptions.setDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS, options);
 	}
 
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java
index da422f4..e5ecbef 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.preferences.cleanup;
 
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstantsOptions;
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 
 import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
@@ -30,7 +31,7 @@
 	 */
 	@Override
 	public void setDefaultOptions(CleanUpOptions options) {
-		CleanUpConstants.setDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS, options);
+		CleanUpConstantsOptions.setDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS, options);
 	}
 
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/UnnecessaryCodeTabPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/UnnecessaryCodeTabPage.java
index 7884085..9db7674 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/UnnecessaryCodeTabPage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/UnnecessaryCodeTabPage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@
 import org.eclipse.jdt.internal.ui.fix.TypeParametersCleanUp;
 import org.eclipse.jdt.internal.ui.fix.UnnecessaryCodeCleanUp;
 import org.eclipse.jdt.internal.ui.fix.RedundantModifiersCleanUp;
+import org.eclipse.jdt.internal.ui.fix.RedundantSemicolonsCleanUp;
 import org.eclipse.jdt.internal.ui.fix.UnusedCodeCleanUp;
 
 public final class UnnecessaryCodeTabPage extends AbstractCleanUpTabPage {
@@ -39,7 +40,8 @@
 				new UnnecessaryCodeCleanUp(values),
 				new StringCleanUp(values),
 				new TypeParametersCleanUp(values),
-				new RedundantModifiersCleanUp(values)
+				new RedundantModifiersCleanUp(values),
+				new RedundantSemicolonsCleanUp(values)
 		};
 	}
 
@@ -75,6 +77,9 @@
 
 		CheckboxPreference modifiers= createCheckboxPref(unnecessaryGroup, numColumns, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_RedundantModifiers, CleanUpConstants.REMOVE_REDUNDANT_MODIFIERS, CleanUpModifyDialog.FALSE_TRUE);
 		registerPreference(modifiers);
+
+		CheckboxPreference semicolons= createCheckboxPref(unnecessaryGroup, numColumns, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_RedundantSemicolons, CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS, CleanUpModifyDialog.FALSE_TRUE);
+		registerPreference(semicolons);
     }
 
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties
index 163e65a..06af71b 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties
@@ -345,7 +345,7 @@
 FormatterModifyDialog_newLines_pref_before_else_statements=Before 'else' in an 'if' statement
 FormatterModifyDialog_newLines_pref_before_catch_statements=Before 'catch' in a 'try' statement
 FormatterModifyDialog_newLines_pref_before_finally_statements=Before 'finally' in a 'try' statement
-FormatterModifyDialog_newLines_pref_before_while_in_do_statements='while' in a 'do' statement
+FormatterModifyDialog_newLines_pref_before_while_in_do_statements=Before 'while' in a 'do' statement
 
 FormatterModifyDialog_newLines_tree_if_else='if else'
 FormatterModifyDialog_newLines_pref_keep_then_on_same_line=Keep 'then' statement on same line
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterModifyDialog.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterModifyDialog.java
index 1701fd7..b31fe7a 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterModifyDialog.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterModifyDialog.java
@@ -1115,8 +1115,7 @@
 				.pref(FormatterMessages.FormatterModifyDialog_newLines_pref_end_of_file, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING)
 				.build(null, (parent, label, key) -> {
 					String[] values= CheckboxPreference.DO_NOT_INSERT_INSERT;
-					if (parent.getKey().endsWith("-controlstatements") || parent.getKey().endsWith("-ifelse") //$NON-NLS-1$ //$NON-NLS-2$
-							|| key.equals(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE)) {
+					if (parent.getKey().endsWith("-ifelse") || DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE.equals(key)) { //$NON-NLS-1$
 						values= CheckboxPreference.FALSE_TRUE;
 					}
 					return fTree.addCheckbox(parent, label, key, values);
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java
index 36a07e4..b8a253a 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java
@@ -278,7 +278,7 @@
 		} else if (firstSpecification instanceof PatternQuerySpecification) {
 			return BasicElementLabels.getFilePattern(((PatternQuerySpecification) firstSpecification).getPattern());
 		} else {
-			return new String(""); //$NON-NLS-1$
+			return ""; //$NON-NLS-1$
 		}
 	}
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java
index abd4948..a08f278 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -90,18 +90,18 @@
 import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
 
 import org.eclipse.jdt.internal.core.manipulation.dom.ASTResolving;
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
+import org.eclipse.jdt.internal.core.manipulation.dom.OperatorPrecedence;
 import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
 import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
 import org.eclipse.jdt.internal.corext.dom.ASTNodes;
 import org.eclipse.jdt.internal.corext.dom.GenericVisitor;
 import org.eclipse.jdt.internal.corext.dom.LinkedNodeFinder;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.StatementRewrite;
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 import org.eclipse.jdt.internal.corext.fix.ExpressionsFix;
 import org.eclipse.jdt.internal.corext.fix.IProposableFix;
 import org.eclipse.jdt.internal.corext.refactoring.code.Invocations;
-import org.eclipse.jdt.internal.corext.refactoring.code.OperatorPrecedence;
 import org.eclipse.jdt.internal.corext.refactoring.util.NoCommentSourceRangeComputer;
 import org.eclipse.jdt.internal.corext.refactoring.util.TightSourceRangeComputer;
 import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultClasspathFixProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultClasspathFixProcessor.java
index 30a4dc3..14c794e 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultClasspathFixProcessor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultClasspathFixProcessor.java
@@ -60,7 +60,7 @@
  */
 public class DefaultClasspathFixProcessor extends ClasspathFixProcessor {
 
-	private static class DefaultClasspathFixProposal extends ClasspathFixProposal {
+	protected static class DefaultClasspathFixProposal extends ClasspathFixProposal {
 
 		private String fName;
 		private Change fChange;
@@ -103,7 +103,9 @@
 	@Override
 	public ClasspathFixProposal[] getFixImportProposals(IJavaProject project, String missingType) throws CoreException {
 		ArrayList<DefaultClasspathFixProposal> res= new ArrayList<>();
-		collectProposals(project, missingType, res);
+		if (!missingType.startsWith(DefaultModulepathFixProcessor.MODULE_SEARCH)) {
+			collectProposals(project, missingType, res);
+		}
 		return res.toArray(new ClasspathFixProposal[res.size()]);
 	}
 
@@ -204,10 +206,12 @@
 					}
 					Change cuChange= null;
 					String moduleName= null;
+					boolean isModule= false;
 					if (typesWithModule.contains(curr)) {
 						moduleName= typeNameMatchToModuleName.get(curr);
 						if (moduleName != null && currentModuleDescription != null) {
 							ICompilationUnit currentCU= currentModuleDescription.getCompilationUnit();
+							isModule= true;
 							String[] args= { moduleName };
 							final String changeName= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_add_requires_module_info, args);
 							final String changeDescription= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_add_requires_module_description, args);
@@ -222,7 +226,7 @@
 					int entryKind= entry.getEntryKind();
 					if ((entry.isExported() || entryKind == IClasspathEntry.CPE_SOURCE) && addedClaspaths.add(other)) {
 						IClasspathEntry newEntry= null;
-						if (cuChange != null) {
+						if (isModule) {
 							IClasspathAttribute[] extraAttributes= new IClasspathAttribute[] {
 									JavaCore.newClasspathAttribute(IClasspathAttribute.MODULE, "true") //$NON-NLS-1$
 							};
@@ -274,7 +278,7 @@
 		}
 	}
 
-	private void addLibraryProposal(IJavaProject project, IPackageFragmentRoot root, IClasspathEntry entry, Collection<Object> addedClaspaths, Collection<DefaultClasspathFixProposal> proposals,
+	protected void addLibraryProposal(IJavaProject project, IPackageFragmentRoot root, IClasspathEntry entry, Collection<Object> addedClaspaths, Collection<DefaultClasspathFixProposal> proposals,
 			Change additionalChange) throws JavaModelException {
 		if (addedClaspaths.add(entry)) {
 			String label= getAddClasspathLabel(entry, root, project);
@@ -295,7 +299,7 @@
 		}
 	}
 
-	private boolean isNonProjectSpecificContainer(IPath containerPath) {
+	protected boolean isNonProjectSpecificContainer(IPath containerPath) {
 		if (containerPath.segmentCount() > 0) {
 			String id= containerPath.segment(0);
 			if (id.equals(JavaCore.USER_LIBRARY_CONTAINER_ID) || id.equals(JavaRuntime.JRE_CONTAINER)) {
@@ -306,7 +310,7 @@
 	}
 
 
-	private static String getAddClasspathLabel(IClasspathEntry entry, IPackageFragmentRoot root, IJavaProject project) {
+	protected static String getAddClasspathLabel(IClasspathEntry entry, IPackageFragmentRoot root, IJavaProject project) {
 		switch (entry.getEntryKind()) {
 			case IClasspathEntry.CPE_LIBRARY:
 				if (root.isArchive()) {
@@ -328,6 +332,8 @@
 					// ignore
 				}
 				break;
+			default:
+				break;
 		}
 		return null;
 	}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultModulepathFixProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultModulepathFixProcessor.java
new file mode 100644
index 0000000..dfd827b
--- /dev/null
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/DefaultModulepathFixProcessor.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.text.correction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.OperationCanceledException;
+
+import org.eclipse.ltk.core.refactoring.Change;
+
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IModuleDescription;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.SearchRequestor;
+
+import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
+import org.eclipse.jdt.internal.corext.util.Messages;
+
+public class DefaultModulepathFixProcessor extends DefaultClasspathFixProcessor {
+
+	public static String MODULE_SEARCH= "Module/:"; //$NON-NLS-1$
+
+	@Override
+	public ClasspathFixProposal[] getFixImportProposals(IJavaProject project, String missingType) throws CoreException {
+		ArrayList<DefaultClasspathFixProposal> res= new ArrayList<>();
+		if (missingType.startsWith(MODULE_SEARCH)) {
+			collectModuleProposals(project, missingType.substring(MODULE_SEARCH.length()), res);
+		}
+		return res.toArray(new ClasspathFixProposal[res.size()]);
+	}
+
+	private void collectModuleProposals(IJavaProject project, String name, Collection<DefaultClasspathFixProposal> proposals) throws CoreException {
+
+		IModuleDescription currentModuleDescription= null;
+		if (JavaModelUtil.is9OrHigher(project)) {
+			currentModuleDescription= project.getModuleDescription();
+			if (currentModuleDescription != null && !currentModuleDescription.exists()) {
+				currentModuleDescription= null;
+			}
+		}
+		if (currentModuleDescription == null) {
+			return;
+		}
+
+		IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
+		ArrayList<IModuleDescription> res= new ArrayList<>();
+		SearchRequestor requestor= new SearchRequestor() {
+			@Override
+			public void acceptSearchMatch(SearchMatch match) throws CoreException {
+				Object element= match.getElement();
+				if (element instanceof IModuleDescription) {
+					IModuleDescription moduleDesc= (IModuleDescription) element;
+					if (moduleDesc.exists() || moduleDesc.isAutoModule()) {
+						res.add(moduleDesc);
+					}
+				}
+			}
+		};
+		SearchPattern searchPattern= SearchPattern.createPattern(name, IJavaSearchConstants.MODULE, IJavaSearchConstants.DECLARATIONS,
+				SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE);
+		SearchParticipant[] participants= new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
+		try {
+			new SearchEngine().search(searchPattern, participants, scope, requestor, null);
+		} catch (CoreException e) {
+			//do nothing
+		} catch (OperationCanceledException e) {
+			//do nothing
+		}
+
+		if (res.isEmpty()) {
+			return;
+		}
+
+
+		HashMap<IClasspathEntry, IModuleDescription> classPathEntryToModuleMap= new HashMap<>();
+		HashSet<IClasspathEntry> classpaths= new HashSet<>();
+		HashSet<String> typesWithModule= new HashSet<>();
+		for (int i= 0; i < res.size(); i++) {
+			IModuleDescription curr= res.get(i);
+			if (curr != null) {
+				IPackageFragmentRoot root= (IPackageFragmentRoot) curr.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+				try {
+					IClasspathEntry entry= root.getRawClasspathEntry();
+					if (entry == null) {
+						continue;
+					}
+
+					String moduleName= curr.getElementName();
+
+
+					if (classpaths.add(entry) && moduleName != null) {
+						classPathEntryToModuleMap.put(entry, curr);
+						typesWithModule.add(moduleName);
+					} else {
+						Object typeNameMatch= classPathEntryToModuleMap.get(entry);
+						if (typeNameMatch != null) {
+							if (moduleName != null) {
+								if (typesWithModule.contains(moduleName)) {
+									typesWithModule.remove(typeNameMatch);
+								}
+							}
+						}
+					}
+				} catch (JavaModelException e) {
+					// ignore
+				}
+			}
+		}
+
+
+		HashSet<Object> addedClaspaths= new HashSet<>();
+		for (int i= 0; i < res.size(); i++) {
+			IModuleDescription curr= res.get(i);
+			if (curr != null) {
+				IPackageFragmentRoot root= (IPackageFragmentRoot) curr.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+				try {
+					IClasspathEntry entry= root.getRawClasspathEntry();
+					if (entry == null) {
+						continue;
+					}
+					String moduleName= curr.getElementName();
+					boolean isModule= false;
+					if (moduleName != null && typesWithModule.contains(moduleName)) {
+						isModule= true;
+					}
+					IJavaProject other= root.getJavaProject();
+					int entryKind= entry.getEntryKind();
+					if ((entry.isExported() || entryKind == IClasspathEntry.CPE_SOURCE) && addedClaspaths.add(other)) {
+						IClasspathEntry newEntry= null;
+						if (isModule) {
+							IClasspathAttribute[] extraAttributes= new IClasspathAttribute[] {
+									JavaCore.newClasspathAttribute(IClasspathAttribute.MODULE, "true") //$NON-NLS-1$
+							};
+							newEntry= JavaCore.newProjectEntry(other.getPath(), null, true, extraAttributes, false);
+						} else {
+							newEntry= JavaCore.newProjectEntry(other.getPath());
+						}
+						Change change= ClasspathFixProposal.newAddClasspathChange(project, newEntry);
+						if (change != null) {
+							String[] args= { BasicElementLabels.getResourceName(other.getElementName()), BasicElementLabels.getResourceName(project.getElementName()) };
+							String label= Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_addcp_project_description, args);
+							String desc= label;
+							DefaultClasspathFixProposal proposal= new DefaultClasspathFixProposal(label, change, desc, IProposalRelevance.ADD_PROJECT_TO_BUILDPATH);
+							proposals.add(proposal);
+						}
+					}
+					if (entryKind == IClasspathEntry.CPE_CONTAINER) {
+						IPath entryPath= entry.getPath();
+						if (isNonProjectSpecificContainer(entryPath)) {
+							addLibraryProposal(project, root, entry, addedClaspaths, proposals, null);
+						} else {
+							try {
+								IClasspathContainer classpathContainer= JavaCore.getClasspathContainer(entryPath, root.getJavaProject());
+								if (classpathContainer != null) {
+									IClasspathEntry entryInContainer= JavaModelUtil.findEntryInContainer(classpathContainer, root.getPath());
+									if (entryInContainer != null) {
+										addLibraryProposal(project, root, entryInContainer, addedClaspaths, proposals, null);
+									}
+								}
+							} catch (CoreException e) {
+								// ignore
+							}
+						}
+					} else if ((entryKind == IClasspathEntry.CPE_LIBRARY || entryKind == IClasspathEntry.CPE_VARIABLE)) {
+						addLibraryProposal(project, root, entry, addedClaspaths, proposals, null);
+					}
+				} catch (JavaModelException e) {
+					// ignore
+				}
+			}
+		}
+	}
+}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
index 672e706..3081e94 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
@@ -111,6 +111,7 @@
 import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
 
 import org.eclipse.jdt.internal.core.manipulation.dom.ASTResolving;
+import org.eclipse.jdt.internal.core.manipulation.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
 import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
 import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
@@ -121,7 +122,6 @@
 import org.eclipse.jdt.internal.corext.dom.Bindings;
 import org.eclipse.jdt.internal.corext.dom.BodyDeclarationRewrite;
 import org.eclipse.jdt.internal.corext.dom.CodeScopeBuilder;
-import org.eclipse.jdt.internal.corext.dom.NecessaryParenthesesChecker;
 import org.eclipse.jdt.internal.corext.dom.Selection;
 import org.eclipse.jdt.internal.corext.dom.TypeRules;
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ModuleCorrectionsSubProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ModuleCorrectionsSubProcessor.java
index ba70973..1e44619 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ModuleCorrectionsSubProcessor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ModuleCorrectionsSubProcessor.java
@@ -16,11 +16,17 @@
 import java.util.List;
 
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 
+import org.eclipse.jface.operation.IRunnableContext;
+
+import org.eclipse.jface.text.IDocument;
+
 import org.eclipse.ltk.core.refactoring.Change;
 
 import org.eclipse.jdt.core.IClasspathAttribute;
@@ -46,6 +52,7 @@
 import org.eclipse.jdt.core.search.SearchPattern;
 import org.eclipse.jdt.core.search.SearchRequestor;
 
+import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
 import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 import org.eclipse.jdt.internal.corext.util.Messages;
 
@@ -53,11 +60,15 @@
 import org.eclipse.jdt.ui.text.java.ClasspathFixProcessor.ClasspathFixProposal;
 import org.eclipse.jdt.ui.text.java.IInvocationContext;
 import org.eclipse.jdt.ui.text.java.IProblemLocation;
+import org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal;
 import org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal;
 import org.eclipse.jdt.ui.text.java.correction.ICommandAccess;
 
+import org.eclipse.jdt.internal.ui.JavaPlugin;
 import org.eclipse.jdt.internal.ui.JavaPluginImages;
 import org.eclipse.jdt.internal.ui.text.correction.proposals.NewCUUsingWizardProposal;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.internal.ui.wizards.buildpaths.ClasspathFixSelectionDialog;
 
 public class ModuleCorrectionsSubProcessor {
 
@@ -80,6 +91,31 @@
 			return JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
 		}
 	}
+	
+	private static class ModulepathFixCorrectionProposal extends CUCorrectionProposal {
+
+		private final String fModuleSearchStr;
+		
+		protected ModulepathFixCorrectionProposal(ICompilationUnit cu, String moduleSearchStr) {
+			super(CorrectionMessages.ReorgCorrectionsSubProcessor_project_seup_fix_description, cu, -10, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
+			fModuleSearchStr= DefaultModulepathFixProcessor.MODULE_SEARCH + moduleSearchStr;
+		}
+
+		@Override
+		public void apply(IDocument document) {
+			IRunnableContext context= JavaPlugin.getActiveWorkbenchWindow();
+			if (context == null) {
+				context= new BusyIndicatorRunnableContext();
+			}
+			Shell shell= JavaPlugin.getActiveWorkbenchShell();
+			ClasspathFixSelectionDialog.openClasspathFixSelectionDialog(shell, getCompilationUnit().getJavaProject(), fModuleSearchStr, context);			
+		}		
+
+		@Override
+		public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
+			return Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_project_seup_fix_info, BasicElementLabels.getJavaElementName(fModuleSearchStr));
+		}
+	}
 
 
 	public static void getPackageDoesNotExistProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException {
@@ -140,57 +176,68 @@
 				&& javaProject != null && JavaModelUtil.is9OrHigher(javaProject)) {
 			ICompilationUnit moduleCompilationUnit= moduleDescription.getCompilationUnit();
 			if (cu.equals(moduleCompilationUnit)) {
-				IJavaElement[] elements= new IJavaElement[1];
-				elements[0]= javaProject;
-				IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
-				List<IModuleDescription> moduleDescriptions= new ArrayList<>();
-				SearchRequestor requestor= new SearchRequestor() {
-					@Override
-					public void acceptSearchMatch(SearchMatch match) throws CoreException {
-						Object element= match.getElement();
-						if (element instanceof IModuleDescription) {
-							IModuleDescription moduleDesc= (IModuleDescription) element;
-							if (moduleDesc.exists() || moduleDesc.isAutoModule()) {
-								moduleDescriptions.add(moduleDesc);
-							}
+				int oldCount= proposals.size();
+				addModifyClassPathProposals(proposals, javaProject, node);
+				if (oldCount == proposals.size()) {
+					proposals.add(new ModulepathFixCorrectionProposal(context.getCompilationUnit(),  node.getFullyQualifiedName()));					
+				}
+			}
+		}
+	}
+
+	private static void addModifyClassPathProposals(Collection<ICommandAccess> proposals, IJavaProject javaProject, Name node) throws CoreException {
+		if (node == null || javaProject == null) {
+			return;
+		}
+		IJavaElement[] elements= new IJavaElement[1];
+		elements[0]= javaProject;
+		IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
+		List<IModuleDescription> moduleDescriptions= new ArrayList<>();
+		SearchRequestor requestor= new SearchRequestor() {
+			@Override
+			public void acceptSearchMatch(SearchMatch match) throws CoreException {
+				Object element= match.getElement();
+				if (element instanceof IModuleDescription) {
+					IModuleDescription moduleDesc= (IModuleDescription) element;
+					if (moduleDesc.exists() || moduleDesc.isAutoModule()) {
+						moduleDescriptions.add(moduleDesc);
+					}
+				}
+			}
+		};
+
+		SearchPattern searchPattern= SearchPattern.createPattern(node.getFullyQualifiedName(), IJavaSearchConstants.MODULE, IJavaSearchConstants.DECLARATIONS,
+				SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE);
+		SearchParticipant[] participants= new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
+		try {
+			new SearchEngine().search(searchPattern, participants, scope, requestor, null);
+		} catch (CoreException e) {
+			//do nothing
+		} catch (OperationCanceledException e) {
+			//do nothing
+		}
+		
+		IClasspathEntry[] existingEntries= javaProject.readRawClasspath();
+		if (existingEntries != null && existingEntries.length > 0) {
+			for (int i= 0; i < moduleDescriptions.size(); i++) {
+				IModuleDescription moduleDesc= moduleDescriptions.get(i);
+				IPackageFragmentRoot root= (IPackageFragmentRoot) moduleDesc.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+				if (root != null) {
+					IClasspathEntry entry= null;
+					int index= -1;
+					if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
+						entry= root.getRawClasspathEntry();
+						index= getClassPathPresentByEntry(existingEntries, entry);
+					} else if (root.getKind() == IPackageFragmentRoot.K_SOURCE) {
+						IJavaProject project= root.getJavaProject();
+						IPath path= project.getPath();
+						index= getClassPathPresentByPath(existingEntries, path);
+						if (index != -1) {
+							entry= existingEntries[index];
 						}
 					}
-				};
-
-				SearchPattern searchPattern= SearchPattern.createPattern(node.getFullyQualifiedName(), IJavaSearchConstants.MODULE, IJavaSearchConstants.DECLARATIONS,
-						SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE);
-				SearchParticipant[] participants= new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
-				try {
-					new SearchEngine().search(searchPattern, participants, scope, requestor, null);
-				} catch (CoreException e) {
-					//do nothing
-				} catch (OperationCanceledException e) {
-					//do nothing
-				}
-				
-				IClasspathEntry[] existingEntries= javaProject.readRawClasspath();
-				if (existingEntries != null && existingEntries.length > 0) {
-					for (int i= 0; i < moduleDescriptions.size(); i++) {
-						IModuleDescription moduleDesc= moduleDescriptions.get(i);
-						IPackageFragmentRoot root= (IPackageFragmentRoot) moduleDesc.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
-						if (root != null) {
-							IClasspathEntry entry= null;
-							int index= -1;
-							if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
-								entry= root.getRawClasspathEntry();
-								index= getClassPathPresentByEntry(existingEntries, entry);
-							} else if (root.getKind() == IPackageFragmentRoot.K_SOURCE) {
-								IJavaProject project= root.getJavaProject();
-								IPath path= project.getPath();
-								index= getClassPathPresentByPath(existingEntries, path);
-								if (index != -1) {
-									entry= existingEntries[index];
-								}
-							}
-							if (entry != null && index != -1) {
-								modifyClasspathProposal(javaProject, root, existingEntries, index, proposals);
-							}
-						}
+					if (entry != null && index != -1) {
+						modifyClasspathProposal(javaProject, root, existingEntries, index, proposals);
 					}
 				}
 			}
@@ -317,5 +364,7 @@
 		}
 		return null;
 	}
+	
+	
 
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ProblemLocation.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ProblemLocation.java
index 99520c0..a1310e9 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ProblemLocation.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ProblemLocation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,15 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to extend ProblemLocationCore
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.text.correction;
 
 import org.eclipse.jdt.core.IJavaModelMarker;
-import org.eclipse.jdt.core.compiler.CategorizedProblem;
 import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.NodeFinder;
 
 import org.eclipse.jdt.ui.text.java.IProblemLocation;
 
@@ -25,131 +22,21 @@
 /**
  *
  */
-public class ProblemLocation implements IProblemLocation {
-
-	private final int fId;
-	private final String[] fArguments;
-	private final int fOffset;
-	private final int fLength;
-	private final boolean fIsError;
-	private final String fMarkerType;
+public class ProblemLocation extends ProblemLocationCore implements IProblemLocation {
 
 	public ProblemLocation(int offset, int length, IJavaAnnotation annotation) {
-		fId= annotation.getId();
-		String[] arguments= annotation.getArguments();
-		fArguments= arguments != null ? arguments : new String[0];
-		fOffset= offset;
-		fLength= length;
-		fIsError= JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType());
-
-		String markerType= annotation.getMarkerType();
-		fMarkerType= markerType != null ? markerType : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER;
+		super(offset, length, annotation.getId(), 
+				annotation.getArguments() != null ? annotation.getArguments() : new String[0], 
+						JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType()), 
+						annotation.getMarkerType() != null ? annotation.getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
 	}
 
 	public ProblemLocation(int offset, int length, int id, String[] arguments, boolean isError, String markerType) {
-		fId= id;
-		fArguments= arguments;
-		fOffset= offset;
-		fLength= length;
-		fIsError= isError;
-		fMarkerType= markerType;
+		super(offset, length, id, arguments, isError, markerType);
 	}
 
 	public ProblemLocation(IProblem problem) {
-		fId= problem.getID();
-		fArguments= problem.getArguments();
-		fOffset= problem.getSourceStart();
-		fLength= problem.getSourceEnd() - fOffset + 1;
-		fIsError= problem.isError();
-		fMarkerType= problem instanceof CategorizedProblem ? ((CategorizedProblem) problem).getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER;
-	}
-
-
-	@Override
-	public int getProblemId() {
-		return fId;
-	}
-
-	@Override
-	public String[] getProblemArguments() {
-		return fArguments;
-	}
-
-	@Override
-	public int getLength() {
-		return fLength;
-	}
-
-	@Override
-	public int getOffset() {
-		return fOffset;
-	}
-
-	@Override
-	public boolean isError() {
-		return fIsError;
-	}
-
-	@Override
-	public String getMarkerType() {
-		return fMarkerType;
-	}
-
-	@Override
-	public ASTNode getCoveringNode(CompilationUnit astRoot) {
-		NodeFinder finder= new NodeFinder(astRoot, fOffset, fLength);
-		return finder.getCoveringNode();
-	}
-
-	@Override
-	public ASTNode getCoveredNode(CompilationUnit astRoot) {
-		NodeFinder finder= new NodeFinder(astRoot, fOffset, fLength);
-		return finder.getCoveredNode();
-	}
-
-	@Override
-	public String toString() {
-		StringBuilder buf= new StringBuilder();
-		buf.append("Id: ").append(getErrorCode(fId)).append('\n'); //$NON-NLS-1$
-		buf.append('[').append(fOffset).append(", ").append(fLength).append(']').append('\n'); //$NON-NLS-1$
-		String[] arg= fArguments;
-		for (int i= 0; i < arg.length; i++) {
-			buf.append(arg[i]);
-			buf.append('\n');
-		}
-		return buf.toString();
-	}
-
-	private String getErrorCode(int code) {
-		StringBuilder buf= new StringBuilder();
-
-		if ((code & IProblem.TypeRelated) != 0) {
-			buf.append("TypeRelated + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.FieldRelated) != 0) {
-			buf.append("FieldRelated + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.ConstructorRelated) != 0) {
-			buf.append("ConstructorRelated + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.MethodRelated) != 0) {
-			buf.append("MethodRelated + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.ImportRelated) != 0) {
-			buf.append("ImportRelated + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.Internal) != 0) {
-			buf.append("Internal + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.Syntax) != 0) {
-			buf.append("Syntax + "); //$NON-NLS-1$
-		}
-		if ((code & IProblem.Javadoc) != 0) {
-			buf.append("Javadoc + "); //$NON-NLS-1$
-		}
-		buf.append(code & IProblem.IgnoreCategoriesMask);
-
-		return buf.toString();
+		super(problem);
 	}
 
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java
index 4a91c26..3efb0c4 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java
@@ -819,6 +819,10 @@
 			case IProblem.UndefinedModule:
 				ModuleCorrectionsSubProcessor.getUndefinedModuleProposals(context, problem, proposals);
 				break;
+			case IProblem.NotAccessibleType:
+				// Handle the case in an import statement, if a requires needs to be added.
+				ReorgCorrectionsSubProcessor.importNotFoundProposals(context, problem, proposals);
+				break;
 			case IProblem.PackageDoesNotExistOrIsEmpty:
 				ModuleCorrectionsSubProcessor.getPackageDoesNotExistProposals(context, problem, proposals);
 				break;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
index 0319cfd..725bef8 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
@@ -718,6 +718,8 @@
 	public static String NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label;
 	public static String NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_tooltip;
 	public static String NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_label;
+	public static String NewSourceContainerWorkbookPage_ToolBar_AddSelLibToTestCP_tooltip;
+	public static String NewSourceContainerWorkbookPage_ToolBar_AddSelLibToTestCP_label;
 
 	public static String NewSourceContainerWorkbookPage_ToolBar_AddJarCP_tooltip;
 	public static String NewSourceContainerWorkbookPage_ToolBar_AddJarCP_label;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
index 0a4fd58..cc50e2d 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
@@ -857,6 +857,8 @@
 NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label=&Use as Source Folder
 NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_tooltip=Add to Build Path
 NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_label=&Add to Build Path
+NewSourceContainerWorkbookPage_ToolBar_AddSelLibToTestCP_tooltip=Add to Build Path for Test Sources
+NewSourceContainerWorkbookPage_ToolBar_AddSelLibToTestCP_label=Add to Build Path for &Test Sources
 
 NewSourceContainerWorkbookPage_ToolBar_AddJarCP_tooltip=Add External Archives to Java Build Path
 NewSourceContainerWorkbookPage_ToolBar_AddJarCP_label=Add External Archi&ves...
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathBasePage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathBasePage.java
index 3809acf..371863f 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathBasePage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathBasePage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -279,6 +279,29 @@
 	public abstract void setFocus();
 	
 
+	protected boolean getRootExpansionState(TreeListDialogField<CPListElement> list, boolean isClassPathRoot) {
+		for (CPListElement cpListElement : list.getElements()) {
+			if (cpListElement.isClassPathRootNode() && isClassPathRoot) {
+				return list.getTreeViewer().getExpandedState(cpListElement);
+			}
+			if (cpListElement.isModulePathRootNode() && !isClassPathRoot) {
+				return list.getTreeViewer().getExpandedState(cpListElement);
+			}
+		}
+		return false;
+	}
+
+	protected void setRootExpansionState(TreeListDialogField<CPListElement> list, boolean state, boolean isClassPathRoot) {
+		for (CPListElement cpListElement : list.getElements()) {
+			if (cpListElement.isClassPathRootNode() && isClassPathRoot) {
+				list.getTreeViewer().setExpandedState(cpListElement, state);
+			}
+			if (cpListElement.isModulePathRootNode() && !isClassPathRoot) {
+				list.getTreeViewer().setExpandedState(cpListElement, state);
+			}
+		}
+	}
+
 
 	/**
 	 * @param listField the UI element holding the list of elements to be manipulated
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
index 2d7b4c5..b0ed2f1 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
@@ -530,27 +530,33 @@
 				if(selectedElements.size() != 1) {
 					return;
 				}
+				boolean isClassRootExpanded= getRootExpansionState(fLibrariesList, true);
+				boolean isModuleRootExpanded= getRootExpansionState(fLibrariesList, false);
 				fLibrariesList.removeAllElements();
 				RootCPListElement selectedCPElement= (RootCPListElement) selectedElements.get(0);
 				if(selectedCPElement.isClassPathRootNode()) {
 					for (CPListElement cpListElement : elementsToAdd) {
 						cpListElement.setAttribute(IClasspathAttribute.MODULE, null);
 					}
-				} else if(selectedCPElement.isModulePathRootNode()) {
+					isClassRootExpanded= true;
+				} else if (selectedCPElement.isModulePathRootNode()) {
 					for (CPListElement cpListElement : elementsToAdd) {
 						Object attribute= cpListElement.getAttribute(IClasspathAttribute.MODULE);
-						if(attribute == null) {
+						if (attribute == null) {
 							cpListElement.setAttribute(IClasspathAttribute.MODULE, new ModuleEncapsulationDetail[0]);
 						}
 					}
+					isModuleRootExpanded= true;
 				}
 				selectedCPElement.addCPListElement(elementsToAdd);					
 				
 				fLibrariesList.setElements(elements);
 				fLibrariesList.refresh();
-				fLibrariesList.getTreeViewer().expandToLevel(2);		
-			}	
-			
+				fLibrariesList.getTreeViewer().expandToLevel(2);
+				setRootExpansionState(fLibrariesList, isClassRootExpanded, true);
+				setRootExpansionState(fLibrariesList, isModuleRootExpanded, false);
+			}
+
 			if (index == IDX_ADDLIB || index == IDX_ADDVAR) {
 				fLibrariesList.refresh();
 			}
@@ -558,6 +564,9 @@
 		}
 	}
 
+
+
+
 	private boolean hasCurrentElement(List<CPListElement> cplist, CPListElement curr) {
 		//note that the same cpelement with different attribute can be added
 		for (CPListElement cpListElement : cplist) {
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ProjectsWorkbookPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ProjectsWorkbookPage.java
index b66b323..9b27c7a 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ProjectsWorkbookPage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ProjectsWorkbookPage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -427,12 +427,15 @@
 				// if nothing selected, do nothing
 				if(selectedElements.size()==0)
 					return;
+				boolean isClassRootExpanded= getRootExpansionState(fProjectsList, true);
+				boolean isModuleRootExpanded= getRootExpansionState(fProjectsList, false);
 				fProjectsList.removeAllElements();
 				for (int i= 0; i < selectedElements.size(); i++) {
 					if( ((CPListElement)selectedElements.get(i)).isClassPathRootNode()) {
 						for (CPListElement cpListElement : elementsToAdd) {
 							cpListElement.setAttribute(IClasspathAttribute.MODULE, null);
 						}
+						isClassRootExpanded= true;
 					}
 					if( ((CPListElement)selectedElements.get(i)).isModulePathRootNode()) {
 						for (CPListElement cpListElement : elementsToAdd) {
@@ -442,12 +445,15 @@
 								
 							}
 						}
+						isModuleRootExpanded= true;
 					}
 					((RootCPListElement)selectedElements.get(i)).addCPListElement(elementsToAdd);					
 				}
 				fProjectsList.setElements(elements);
 				fProjectsList.refresh();
-				fProjectsList.getTreeViewer().expandToLevel(2);	
+				fProjectsList.getTreeViewer().expandToLevel(2);
+				setRootExpansionState(fProjectsList, isClassRootExpanded, true);
+				setRootExpansionState(fProjectsList, isModuleRootExpanded, false);
 			}
 			
 			if (index == IDX_ADDPROJECT && !hasRootNodes()) {
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/AddSelectedLibraryToBuildpathAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/AddSelectedLibraryToBuildpathAction.java
index 67c560c..4abf940 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/AddSelectedLibraryToBuildpathAction.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/AddSelectedLibraryToBuildpathAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -31,6 +32,7 @@
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ISetSelectionTarget;
 
+import org.eclipse.jdt.core.IClasspathAttribute;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IJavaProject;
@@ -46,28 +48,31 @@
 import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
 import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement;
+import org.eclipse.jdt.internal.ui.wizards.buildpaths.ModuleEncapsulationDetail;
 
 //SelectedElements iff enabled: IFile
 public class AddSelectedLibraryToBuildpathAction extends BuildpathModifierAction {
 
 	private final IRunnableContext fContext;
+	private boolean fForTestOnly;
 
-	public AddSelectedLibraryToBuildpathAction(IWorkbenchSite site) {
-		this(site, null, PlatformUI.getWorkbench().getProgressService());
+	public AddSelectedLibraryToBuildpathAction(IWorkbenchSite site, boolean forTestOnly) {
+		this(site, null, PlatformUI.getWorkbench().getProgressService(), forTestOnly);
 	}
 
 	public AddSelectedLibraryToBuildpathAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
-		this(null, selectionTarget, context);
+		this(null, selectionTarget, context, false);
     }
 
-	private AddSelectedLibraryToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
-		super(site, selectionTarget, BuildpathModifierAction.ADD_SEL_LIB_TO_BP);
+	private AddSelectedLibraryToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context, boolean forTestOnly) {
+		super(site, selectionTarget, forTestOnly ? BuildpathModifierAction.ADD_SEL_LIB_TO_TEST_BP : BuildpathModifierAction.ADD_SEL_LIB_TO_BP);
 
 		fContext= context;
+		fForTestOnly= forTestOnly;
 
-		setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_label);
-		setImageDescriptor(JavaPluginImages.DESC_OBJS_EXTJAR);
-		setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_tooltip);
+		setText(forTestOnly ? NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToTestCP_label: NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_label);
+		setImageDescriptor(forTestOnly ? JavaPluginImages.DESC_OBJS_EXTJAR_TEST : JavaPluginImages.DESC_OBJS_EXTJAR);
+		setToolTipText(forTestOnly ? NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToTestCP_tooltip : NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_tooltip);
     }
 
 	@Override
@@ -124,7 +129,15 @@
 			monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_AddToBuildpath, 4);
 			for (int i= 0; i < resources.length; i++) {
 				IResource res= resources[i];
-				addedEntries.add(new CPListElement(project, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res));
+				CPListElement cpListElement= new CPListElement(project, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res);
+				if(fForTestOnly) {
+					cpListElement.setAttribute(IClasspathAttribute.TEST, "true"); //$NON-NLS-1$
+				} else {
+					if(project.getModuleDescription() != null) {
+						cpListElement.setAttribute(IClasspathAttribute.MODULE, new ModuleEncapsulationDetail[0]);
+					}
+				}
+				addedEntries.add(cpListElement);
 			}
 			monitor.worked(1);
 
@@ -165,9 +178,13 @@
 					IJavaProject project= JavaCore.create(file.getProject());
 					if (project == null)
 						return false;
-
 					if (!ClasspathModifier.isArchive(file, project))
 						return false;
+					if (fForTestOnly) {
+						if (!Arrays.stream(project.getRawClasspath()).anyMatch(e -> e.getEntryKind() == IClasspathEntry.CPE_SOURCE && e.isTest())) {
+							return false;
+						}
+					}
 				} else {
 					return false;
 				}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/BuildpathModifierAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/BuildpathModifierAction.java
index 49a0224..9fbd07a 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/BuildpathModifierAction.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/BuildpathModifierAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -62,6 +62,7 @@
 	public static final int CONFIGURE_BUILD_PATH= 16;
 	public static final int RESET_ALL_OUTPUT_FOLDERS= 17;
 	public static final int DROP_DOWN_ACTION= 18;
+	public static final int ADD_SEL_LIB_TO_TEST_BP= 19;
 
 	private final IWorkbenchSite fSite;
 	private final List<Object> fSelectedElements;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/GenerateBuildPathActionGroup.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/GenerateBuildPathActionGroup.java
index ffa35b3..91cd873 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/GenerateBuildPathActionGroup.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/newsourcepage/GenerateBuildPathActionGroup.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -167,9 +167,12 @@
 		final AddFolderToBuildpathAction addFolder= new AddFolderToBuildpathAction(site);
 		fActions.add(addFolder);
 
-		final AddSelectedLibraryToBuildpathAction addSelectedLibrary= new AddSelectedLibraryToBuildpathAction(site);
+		final AddSelectedLibraryToBuildpathAction addSelectedLibrary= new AddSelectedLibraryToBuildpathAction(site, false);
 		fActions.add(addSelectedLibrary);
 
+		final AddSelectedLibraryToBuildpathAction addSelectedLibraryForTestsOnly= new AddSelectedLibraryToBuildpathAction(site, true);
+		fActions.add(addSelectedLibraryForTestsOnly);
+
 		final RemoveFromBuildpathAction remove= new RemoveFromBuildpathAction(site);
 		fActions.add(remove);
 
@@ -242,9 +245,9 @@
 
             if (i == 2)
                 source.add(new Separator(GROUP_BUILDPATH));
-            else if (i == 8)
+            else if (i == 9)
                 source.add(new Separator(GROUP_FILTER));
-            else if (i == 10)
+            else if (i == 11)
                 source.add(new Separator(GROUP_CUSTOMIZE));
             added+= addAction(source, action);
             i++;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/workingsets/DynamicSourcesWorkingSetUpdater.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/workingsets/DynamicSourcesWorkingSetUpdater.java
index 64a40d2..8671678 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/workingsets/DynamicSourcesWorkingSetUpdater.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/workingsets/DynamicSourcesWorkingSetUpdater.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2017 Till Brychcy and others.
+ * Copyright (c) 2018 Till Brychcy and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -102,9 +102,13 @@
 	
 	private AtomicBoolean isDisposed= new AtomicBoolean();
 
-	public static final String TEST_NAME= "test"; //$NON-NLS-1$
+	public static final String TEST_OLD_NAME= "test"; //$NON-NLS-1$
 
-	public static final String MAIN_NAME= "main"; //$NON-NLS-1$
+	public static final String MAIN_OLD_NAME= "main"; //$NON-NLS-1$
+
+	public static final String TEST_NAME= "Java Test Sources"; //$NON-NLS-1$
+
+	public static final String MAIN_NAME= "Java Main Sources"; //$NON-NLS-1$
 
 	@Override
 	public void add(IWorkingSet workingSet) {
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
index 0cce93a..e23725f 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
@@ -39,7 +39,7 @@
 import org.eclipse.jdt.core.manipulation.JavaManipulation;
 
 import org.eclipse.jdt.internal.core.manipulation.MembersOrderPreferenceCacheCommon;
-import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstantsOptions;
 
 import org.eclipse.jdt.ui.text.IJavaColorConstants;
 
@@ -67,7 +67,7 @@
  *
  * @noinstantiate This class is not intended to be instantiated by clients.
  * @noextend This class is not intended to be subclassed by clients.
-  */
+ */
 public class PreferenceConstants {
 
 	private PreferenceConstants() {
@@ -3759,7 +3759,7 @@
 	 */
 	public final static String EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT= "sourceHoverBackgroundColor.SystemDefault"; //$NON-NLS-1$
 
-	
+
 	/**
 	 * A named preference that tells whether to use different icons
 	 * for source folders marked to contain test code and classpath entries
@@ -4092,7 +4092,7 @@
 
 
 		//Code Clean Up
-		CleanUpConstants.initDefaults(store);
+		CleanUpConstantsOptions.initDefaults(store);
 
 		// Colors that are set by the current theme
 		JavaUIPreferenceInitializer.setThemeBasedPreferences(store, false);
@@ -4128,7 +4128,7 @@
 	 * @param entries an array of classpath entries to be encoded
 	 *
 	 * @return the encoded string.
-	*/
+	 */
 	public static String encodeJRELibrary(String description, IClasspathEntry[] entries) {
 		return NewJavaProjectPreferencePage.encodeJRELibrary(description, entries);
 	}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java
index 60b92a4..15e1e21 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,11 +7,10 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to use internal class to supply logic
  *******************************************************************************/
 package org.eclipse.jdt.ui.cleanup;
 
-import org.eclipse.core.runtime.Assert;
-
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.dom.CompilationUnit;
 
@@ -22,10 +21,9 @@
  * @since 3.5
  */
 public class CleanUpContext {
-
-	private final ICompilationUnit fUnit;
-
-	private final CompilationUnit fAst;
+	
+	// Use internal class to supply logic
+	private final org.eclipse.jdt.internal.corext.fix.CleanUpContext fContext;
 
 	/**
 	 * Creates a new clean up context.
@@ -37,9 +35,7 @@
 	 *            <code>true</code>.
 	 */
 	public CleanUpContext(ICompilationUnit unit, CompilationUnit ast) {
-		Assert.isLegal(unit != null);
-		fUnit= unit;
-		fAst= ast;
+		fContext= new org.eclipse.jdt.internal.corext.fix.CleanUpContext(unit, ast);
 	}
 
 	/**
@@ -48,7 +44,7 @@
 	 * @return the compilation unit to clean up
 	 */
 	public ICompilationUnit getCompilationUnit() {
-		return fUnit;
+		return fContext.getCompilationUnit();
 	}
 
 	/**
@@ -64,6 +60,6 @@
 	 * @return an AST or <code>null</code> if none required
 	 */
 	public CompilationUnit getAST() {
-		return fAst;
+		return fContext.getAST();
 	}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java
index ae67d65..bf131f2 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,16 +7,13 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to supply logic through internal class
  *******************************************************************************/
 package org.eclipse.jdt.ui.cleanup;
 
-import java.util.Collections;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Set;
 
-import org.eclipse.core.runtime.Assert;
-
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 
 
@@ -27,8 +24,9 @@
  * @noextend This class is not intended to be subclassed by clients.
  */
 public class CleanUpOptions {
-
-	private final Map<String, String> fOptions;
+	
+	// Use internal class to supply logic
+	private final org.eclipse.jdt.internal.corext.fix.CleanUpOptions fOptions;
 
 	/**
 	 * True value
@@ -47,14 +45,14 @@
 	 *            string value
 	 */
 	protected CleanUpOptions(Map<String, String> options) {
-		fOptions= options;
+		fOptions= new org.eclipse.jdt.internal.corext.fix.CleanUpOptions(options);
 	}
 
 	/**
 	 * Creates a new instance.
 	 */
 	public CleanUpOptions() {
-		fOptions= new Hashtable<>();
+		fOptions= new org.eclipse.jdt.internal.corext.fix.CleanUpOptions();
 	}
 
 	/**
@@ -66,9 +64,7 @@
 	 * @see CleanUpConstants
 	 */
 	public boolean isEnabled(String key) {
-		Assert.isLegal(key != null);
-		Object value= fOptions.get(key);
-		return CleanUpOptions.TRUE == value || CleanUpOptions.TRUE.equals(value);
+		return fOptions.isEnabled(key);
 	}
 
 	/**
@@ -79,10 +75,7 @@
 	 * @throws IllegalArgumentException if the key is null or unknown
 	 */
 	public String getValue(String key) {
-		Assert.isLegal(key != null);
-		String value= fOptions.get(key);
-		Assert.isLegal(value != null);
-		return value;
+		return fOptions.getValue(key);
 	}
 
 	/**
@@ -95,9 +88,7 @@
 	 * @see CleanUpOptions#FALSE
 	 */
 	public void setOption(String key, String value) {
-		Assert.isLegal(key != null);
-		Assert.isLegal(value != null);
-		fOptions.put(key, value);
+		fOptions.setOption(key, value);
 	}
 
 	/**
@@ -106,6 +97,6 @@
 	 * @return an unmodifiable set of all keys
 	 */
 	public Set<String> getKeys() {
-		return Collections.unmodifiableSet(fOptions.keySet());
+		return fOptions.getKeys();
 	}
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java
index c9ab1e9..6d7ebed 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,13 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to use internal class to perform logic
  *******************************************************************************/
 package org.eclipse.jdt.ui.cleanup;
 
 import java.util.Map;
 
-import org.eclipse.core.runtime.Assert;
-
 import org.eclipse.jdt.core.JavaCore;
 
 
@@ -23,15 +22,9 @@
  * @since 3.5
  */
 public final class CleanUpRequirements {
-
-	private final boolean fRequiresAST;
-
-	private final Map<String, String> fCompilerOptions;
-
-	private final boolean fRequiresFreshAST;
-
-	private final boolean fRequiresChangedRegions;
-
+	
+	// Use internal class which contains logic
+	private final org.eclipse.jdt.internal.corext.fix.CleanUpRequirements fRequirements;
 
 	/**
 	 * Create a new instance
@@ -42,16 +35,7 @@
 	 * @param compilerOptions map of compiler options or <code>null</code> if no requirements
 	 */
 	public CleanUpRequirements(boolean requiresAST, boolean requiresFreshAST, boolean requiresChangedRegions, Map<String, String> compilerOptions) {
-		Assert.isLegal(!requiresFreshAST || requiresAST, "Must not request fresh AST if no AST is required"); //$NON-NLS-1$
-		Assert.isLegal(compilerOptions == null || requiresAST, "Must not provide options if no AST is required"); //$NON-NLS-1$
-		fRequiresAST= requiresAST;
-		fRequiresFreshAST= requiresFreshAST;
-		fRequiresChangedRegions= requiresChangedRegions;
-
-		fCompilerOptions= compilerOptions;
-		// Make sure that compile warnings are not suppressed since some clean ups work on reported warnings
-		if (fCompilerOptions != null)
-			fCompilerOptions.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);
+		this.fRequirements = new org.eclipse.jdt.internal.corext.fix.CleanUpRequirements(requiresAST, requiresFreshAST, requiresChangedRegions, compilerOptions);
 	}
 
 	/**
@@ -64,7 +48,7 @@
 	 * @return <code>true</code> if the {@linkplain CleanUpContext context} must provide an AST
 	 */
 	public boolean requiresAST() {
-		return fRequiresAST;
+		return fRequirements.requiresAST();
 	}
 
 	/**
@@ -74,7 +58,7 @@
 	 * @return <code>true</code> if the caller needs an up to date AST
 	 */
 	public boolean requiresFreshAST() {
-		return fRequiresFreshAST;
+		return fRequirements.requiresFreshAST();
 	}
 
 	/**
@@ -84,7 +68,7 @@
 	 * @see JavaCore
 	 */
 	public Map<String, String> getCompilerOptions() {
-		return fCompilerOptions;
+		return fRequirements.getCompilerOptions();
 	}
 
 	/**
@@ -103,7 +87,7 @@
 	 *         regions
 	 */
 	public boolean requiresChangedRegions() {
-		return fRequiresChangedRegions;
+		return fRequirements.requiresChangedRegions();
 	}
 
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java
index 90e1968..49f5c04 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java
@@ -595,7 +595,7 @@
 			if (i < tabWidth)
 				indentPrefixes[i+1]= spaces + '\t';
 			else
-				indentPrefixes[i+1]= new String(spaces);
+				indentPrefixes[i+1]= spaces;
 		}
 
 		indentPrefixes[tabWidth + 1]= ""; //$NON-NLS-1$
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java
index b31be12..dfab32e 100755
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java
@@ -836,7 +836,7 @@
 		javaProposal.setProposalInfo(new MethodProposalInfo(fJavaProject, proposal));
 		javaProposal.setRelevance(computeRelevance(proposal));
 
-		fSuggestedMethodNames.add(new String(name));
+		fSuggestedMethodNames.add(name);
 		return javaProposal;
 	}