Bug 95326 [code manipulation] Class wizard produces junk
Env: 3.1M7 Sometimes the class wizard produces junk when generating a new class skeleton (seems that constructors are placed inside the import statements). With the following example, the bug can always reproduced: 0) no enclosing type 1) Create a new Class: JxX509TrustManager 2) Modifiers: public only 3) SuperClass: java.lang.Object 4) Interfaces: javax.net.ssl.X509TrustManager 5) Stubs: constructor, abstract methods 6) Generate comments: no 7) Finish produces: <pre> package bla.bla; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import j public JxX509TrustManager() { super(); // @todo Auto-generated constructor stub }avax.net.ssl.X509TrustManager; public class JxX509TrustManager implements X509TrustManager { public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // @todo Auto-generated method stub } public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // @todo Auto-generated method stub } public X509Certificate[] getAcceptedIssuers() { // @todo Auto-generated method stub return null; } } </pre>
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogFieldGroup;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.Separator;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonStatusDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
/**
 * The class <code>NewTypeWizardPage</code> contains controls and validation routines 
 * for a 'New Type WizardPage'. Implementors decide which components to add and to enable. 
 * Implementors can also customize the validation code. <code>NewTypeWizardPage</code> 
 * is intended to serve as base class of all wizards that create types like applets, servlets, classes, 
 * interfaces, etc.
 * <p>
 * See {@link NewClassWizardPage} or {@link NewInterfaceWizardPage} for an
 * example usage of the <code>NewTypeWizardPage</code>.
 * </p>
 * 
 * @see org.eclipse.jdt.ui.wizards.NewClassWizardPage
 * @see org.eclipse.jdt.ui.wizards.NewInterfaceWizardPage
 * 
 * @since 2.0
 */
public abstract class NewTypeWizardPage extends NewContainerWizardPage {
	/**
	 * Class used in stub creation routines to add needed imports to a 
	 * compilation unit.
	 */
	public static class ImportsManager {