Bug 114369 Remove unused local and field too dangerous for multi quick fix
Version: 3.1.0 Build id: I20051025-0800 The two clean ups: Remove unused local variable and assignments without possible side effects and Remove unused private field and assignments without possible side effects are too dangerous to apply in a batch mode, at least without warning the user. Reason: private int i= methodWithSideEffect(); foo () { int j= methodWithSideEffect(); } in both cases i and j are removed as well as the two calls to methodWithSideEffect which will change the semantic of the program. Possible solutions: 1. Not having these two multi quick fixes 2. Warn the user 3. Only remove variables if this does not remove any method call 4. ?
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UnusedCodeMultiFix.java
removePrivateMethods.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
		removePrivateMethods.setSelection(fRemoveUnusedPrivateMethods);
		removePrivateMethods.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				fRemoveUnusedPrivateMethods= ((Button)e.getSource()).getSelection();
			}
		});
		
		Button removePrivateConstructors= new Button(composite, SWT.CHECK);
		removePrivateConstructors.setText(MultiFixMessages.UnusedCodeMultiFix_RemoveUnusedConstructor_description);
		removePrivateConstructors.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
		removePrivateConstructors.setSelection(fRemoveUnusedPrivateConstructors);
		removePrivateConstructors.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				fRemoveUnusedPrivateConstructors= ((Button)e.getSource()).getSelection();
			}
		});
		
		Button removePrivateType= new Button(composite, SWT.CHECK);
		removePrivateType.setText(MultiFixMessages.UnusedCodeMultiFix_RemoveUnusedType_description);
		removePrivateType.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
		removePrivateType.setSelection(fRemoveUnusedPrivateTypes);
		removePrivateType.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				fRemoveUnusedPrivateTypes= ((Button)e.getSource()).getSelection();
			}
		});
		
		Button removePrivateFields= new Button(composite, SWT.CHECK);
		removePrivateFields.setText(MultiFixMessages.UnusedCodeMultiFix_RemoveUnusedField_description);