Bug 100211 [source actions] Strange behavior in "Generate Constructor using Fields"
I find the behavior of "Generate Constructor using Fields" is strange in some case. Suppose you have the following file: class ID { private int publicPart; private int localPart; } Then when you call "Generate Constructor using Fields", it generates: public ID(int part, int part2) { super(); // TODO Auto-generated constructor stub publicPart = part; localPart = part2; } I don't known why the names of the two arguments are "part" and "part2", instead of "publicPart" and "localPart". The first line of the generated code, "super()", is also unnessary. So I think it will be better if you delete this line if the class does not inherit from other class (except Object).
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/GenerateConstructorUsingFieldsContentProvider.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.internal.corext.dom.NodeFinder;
import org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil;
import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
public class GenerateConstructorUsingFieldsContentProvider implements ITreeContentProvider {
	private static final Object[] EMPTY= new Object[0];
	private List fFields= new ArrayList();
	private List fSelected= new ArrayList();
	private ITypeBinding fType= null;
	private final CompilationUnit fUnit;
	public GenerateConstructorUsingFieldsContentProvider(IType type, List fields, List selected) throws JavaModelException {
		RefactoringASTParser parser= new RefactoringASTParser(AST.JLS3);