issue_id
int64
2.03k
426k
title
stringlengths
9
251
body
stringlengths
1
32.8k
status
stringclasses
6 values
after_fix_sha
stringlengths
7
7
project_name
stringclasses
6 values
repo_url
stringclasses
6 values
repo_name
stringclasses
6 values
language
stringclasses
1 value
issue_url
null
before_fix_sha
null
pull_url
null
commit_datetime
timestamp[us, tz=UTC]
report_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
2
187
file_content
stringlengths
0
368k
33,405
Bug 33405 Refactoring extract local variable fails in nested if statements
If a local variable is extracted from a nested if statement, and it only exists in the second case onwards, then the variable is positioned incorrectly between the if cases. String x; boolean test,test2,test3; if (test) { } else if (test2) { x = "ExtractMe"; } else if (test3) { x = "ExtractMe"; } -> highlight "ExtractMe" and extract to local variable 'defect' if (test) { } else final String defect = "ExtractMe"; if (test2) { x = defect; } else if (test3) { x = defect; } Of course, if the first test block also refers to "ExtractMe" then it will work properly and put the final variable declaration above the whole nested if loop. Eclipse 2.1RC1 Windows 2000, Mac OS X.2.4
verified fixed
8e802bb
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T16:53:57Z
2003-02-27T01:40:00Z
org.eclipse.jdt.ui/core
33,405
Bug 33405 Refactoring extract local variable fails in nested if statements
If a local variable is extracted from a nested if statement, and it only exists in the second case onwards, then the variable is positioned incorrectly between the if cases. String x; boolean test,test2,test3; if (test) { } else if (test2) { x = "ExtractMe"; } else if (test3) { x = "ExtractMe"; } -> highlight "ExtractMe" and extract to local variable 'defect' if (test) { } else final String defect = "ExtractMe"; if (test2) { x = defect; } else if (test3) { x = defect; } Of course, if the first test block also refers to "ExtractMe" then it will work properly and put the final variable declaration above the whole nested if loop. Eclipse 2.1RC1 Windows 2000, Mac OS X.2.4
verified fixed
8e802bb
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T16:53:57Z
2003-02-27T01:40:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractTempRefactoring.java
32,656
Bug 32656 Open/Close project in package explorer looses selection on java-projects. [package explorer]
Not on non-java projects, which looks wrong when multiple java- and non-java-projects are opened/closed.
resolved fixed
855600e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:31:04Z
2003-02-24T15:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerContentProvider.java
/* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui.packageview; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.widgets.Control; import org.eclipse.jface.viewers.IBasicPropertyConstants; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IElementChangedListener; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElementDelta; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.IWorkingCopy; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.StandardJavaElementContentProvider; import org.eclipse.jdt.internal.ui.JavaPlugin; /** * Content provider for the PackageExplorer. * * <p> * Since 2.1 this content provider can provide the children for flat or hierarchical * layout. The hierarchical layout is done by delegating to the <code>PackageFragmentProvider</code>. * </p> * * @see org.eclipse.jdt.ui.StandardJavaElementContentProvider * @see org.eclipse.jdt.internal.ui.packageview.PackageFragmentProvider */ class PackageExplorerContentProvider extends StandardJavaElementContentProvider implements ITreeContentProvider, IElementChangedListener { protected TreeViewer fViewer; protected Object fInput; private boolean fIsFlatLayout; private PackageFragmentProvider fPackageFragmentProvider= new PackageFragmentProvider(); private int fPendingChanges; /** * Creates a new content provider for Java elements. */ public PackageExplorerContentProvider() { } /** * Creates a new content provider for Java elements. */ public PackageExplorerContentProvider(boolean provideMembers, boolean provideWorkingCopy) { super(provideMembers, provideWorkingCopy); } /* (non-Javadoc) * Method declared on IElementChangedListener. */ public void elementChanged(final ElementChangedEvent event) { try { processDelta(event.getDelta()); } catch(JavaModelException e) { JavaPlugin.log(e); } } /* (non-Javadoc) * Method declared on IContentProvider. */ public void dispose() { super.dispose(); JavaCore.removeElementChangedListener(this); fPackageFragmentProvider.dispose(); } // ------ Code which delegates to PackageFragmentProvider ------ private boolean needsToDelegate(Object element) { int type= -1; if (element instanceof IJavaElement) type= ((IJavaElement)element).getElementType(); return (!fIsFlatLayout && (type == IJavaElement.PACKAGE_FRAGMENT || type == IJavaElement.PACKAGE_FRAGMENT_ROOT || type == IJavaElement.JAVA_PROJECT)); } public Object[] getChildren(Object parentElement) { Object[] children= NO_CHILDREN; try { if (parentElement instanceof IJavaModel) return concatenate(getJavaProjects((IJavaModel)parentElement), getNonJavaProjects((IJavaModel)parentElement)); if (parentElement instanceof ClassPathContainer) return getContainerPackageFragmentRoots((ClassPathContainer)parentElement); if (parentElement instanceof IProject) return ((IProject)parentElement).members(); if (needsToDelegate(parentElement)) { Object[] packageFragments= fPackageFragmentProvider.getChildren(parentElement); children= getWithParentsResources(packageFragments, parentElement); } else { children= super.getChildren(parentElement); } if (parentElement instanceof IJavaProject) { IJavaProject project= (IJavaProject)parentElement; return rootsAndContainers(project, children); } else return children; } catch (CoreException e) { return NO_CHILDREN; } } private Object[] rootsAndContainers(IJavaProject project, Object[] roots) { List result= new ArrayList(roots.length); Set containers= new HashSet(roots.length); for (int i= 0; i < roots.length; i++) { if (roots[i] instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot)roots[i]; IClasspathEntry entry= null; try { entry= root.getRawClasspathEntry(); } catch (JavaModelException e) { continue; } if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) containers.add(entry); else result.add(root); } else { result.add(roots[i]); } } for (Iterator each= containers.iterator(); each.hasNext();) { IClasspathEntry element= (IClasspathEntry) each.next(); result.add(new ClassPathContainer(project, element)); } return result.toArray(); } private Object[] getContainerPackageFragmentRoots(ClassPathContainer container) throws JavaModelException { return container.getPackageFragmentRoots(); } private Object[] getNonJavaProjects(IJavaModel model) throws JavaModelException { return model.getNonJavaResources(); } public Object getParent(Object child) { if (needsToDelegate(child)) { return fPackageFragmentProvider.getParent(child); } else return super.getParent(child); } /** * Returns the given objects with the resources of the parent. */ private Object[] getWithParentsResources(Object[] existingObject, Object parent) { Object[] objects= super.getChildren(parent); List list= new ArrayList(); // Add everything that is not a PackageFragment for (int i= 0; i < objects.length; i++) { Object object= objects[i]; if (!(object instanceof IPackageFragment)) { list.add(object); } } if (existingObject != null) list.addAll(Arrays.asList(existingObject)); return list.toArray(); } /* (non-Javadoc) * Method declared on IContentProvider. */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { super.inputChanged(viewer, oldInput, newInput); fPackageFragmentProvider.inputChanged(viewer, oldInput, newInput); fViewer= (TreeViewer)viewer; if (oldInput == null && newInput != null) { JavaCore.addElementChangedListener(this); } else if (oldInput != null && newInput == null) { JavaCore.removeElementChangedListener(this); } fInput= newInput; } // ------ delta processing ------ /** * Processes a delta recursively. When more than two children are affected the * tree is fully refreshed starting at this node. The delta is processed in the * current thread but the viewer updates are posted to the UI thread. */ public void processDelta(IJavaElementDelta delta) throws JavaModelException { int kind= delta.getKind(); int flags= delta.getFlags(); IJavaElement element= delta.getElement(); if(element.getElementType()!= IJavaElement.JAVA_MODEL && element.getElementType()!= IJavaElement.JAVA_PROJECT){ IJavaProject proj= element.getJavaProject(); if (proj == null || !proj.getProject().isOpen()) return; } if (!fIsFlatLayout && element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) { fPackageFragmentProvider.processDelta(delta); if (processResourceDeltas(delta.getResourceDeltas(), element)) return; IJavaElementDelta[] affectedChildren= delta.getAffectedChildren(); processAffectedChildren(affectedChildren); return; } if (!getProvideWorkingCopy() && isWorkingCopy(element)) return; if (element != null && element.getElementType() == IJavaElement.COMPILATION_UNIT && !isOnClassPath((ICompilationUnit)element)) return; // handle open and closing of a project if (((flags & IJavaElementDelta.F_CLOSED) != 0) || ((flags & IJavaElementDelta.F_OPENED) != 0)) { postRefresh(element); return; } if (kind == IJavaElementDelta.REMOVED) { // when a working copy is removed all we have to do // is to refresh the compilation unit if (isWorkingCopy(element)) { refreshWorkingCopy((IWorkingCopy)element); return; } Object parent= internalGetParent(element); postRemove(element); if (parent instanceof IPackageFragment) postUpdateIcon((IPackageFragment)parent); // we are filtering out empty subpackages, so we // a package becomes empty we remove it from the viewer. if (isPackageFragmentEmpty(element.getParent())) { if (fViewer.testFindItem(parent) != null) postRefresh(internalGetParent(parent)); } return; } if (kind == IJavaElementDelta.ADDED) { // when a working copy is added all we have to do // is to refresh the compilation unit if (isWorkingCopy(element)) { refreshWorkingCopy((IWorkingCopy)element); return; } Object parent= internalGetParent(element); // we are filtering out empty subpackages, so we // have to handle additions to them specially. if (parent instanceof IPackageFragment) { Object grandparent= internalGetParent(parent); // 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View // avoid posting a refresh to an unvisible parent if (parent.equals(fInput)) { postRefresh(parent); } else { // refresh from grandparent if parent isn't visible yet if (fViewer.testFindItem(parent) == null) postRefresh(grandparent); else { postRefresh(parent); } } return; } else { postAdd(parent, element); } } if (element instanceof ICompilationUnit) { if (getProvideWorkingCopy()) { IJavaElement original= ((IWorkingCopy)element).getOriginalElement(); if (original != null) element= original; } if (kind == IJavaElementDelta.CHANGED) { postRefresh(element); updateSelection(delta); return; } } // we don't show the contents of a compilation or IClassFile, so don't go any deeper if ((element instanceof ICompilationUnit) || (element instanceof IClassFile)) return; // the contents of an external JAR has changed if (element instanceof IPackageFragmentRoot && ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0)) { postRefresh(element); return; } // the source attachment of a JAR has changed if (element instanceof IPackageFragmentRoot && (((flags & IJavaElementDelta.F_SOURCEATTACHED) != 0 || ((flags & IJavaElementDelta.F_SOURCEDETACHED)) != 0))) postUpdateIcon(element); if (isClassPathChange(delta)) { // throw the towel and do a full refresh of the affected java project. postRefresh(element.getJavaProject()); return; } if (processResourceDeltas(delta.getResourceDeltas(), element)) return; handleAffectedChildren(delta, element); } private void handleAffectedChildren(IJavaElementDelta delta, IJavaElement element) throws JavaModelException { IJavaElementDelta[] affectedChildren= delta.getAffectedChildren(); if (affectedChildren.length > 1) { // a package fragment might become non empty refresh from the parent if (element instanceof IPackageFragment) { IJavaElement parent= (IJavaElement)internalGetParent(element); // 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View // avoid posting a refresh to an unvisible parent if (element.equals(fInput)) { postRefresh(element); } else { postRefresh(parent); } return; } // more than one child changed, refresh from here downwards if (element instanceof IPackageFragmentRoot) postRefresh(skipProjectPackageFragmentRoot((IPackageFragmentRoot)element)); else postRefresh(element); return; } processAffectedChildren(affectedChildren); } protected void processAffectedChildren(IJavaElementDelta[] affectedChildren) throws JavaModelException { for (int i= 0; i < affectedChildren.length; i++) { processDelta(affectedChildren[i]); } } private boolean isOnClassPath(ICompilationUnit element) throws JavaModelException { IJavaProject project= element.getJavaProject(); if (project == null || !project.exists()) return false; return project.isOnClasspath(element); } /** * Updates the selection. It finds newly added elements * and selects them. */ private void updateSelection(IJavaElementDelta delta) { final IJavaElement addedElement= findAddedElement(delta); if (addedElement != null) { final StructuredSelection selection= new StructuredSelection(addedElement); postRunnable(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { // 19431 // if the item is already visible then select it if (fViewer.testFindItem(addedElement) != null) fViewer.setSelection(selection); } } }); } } private IJavaElement findAddedElement(IJavaElementDelta delta) { if (delta.getKind() == IJavaElementDelta.ADDED) return delta.getElement(); IJavaElementDelta[] affectedChildren= delta.getAffectedChildren(); for (int i= 0; i < affectedChildren.length; i++) return findAddedElement(affectedChildren[i]); return null; } /** * Refreshes the Compilation unit corresponding to the workging copy * @param iWorkingCopy */ private void refreshWorkingCopy(IWorkingCopy workingCopy) { IJavaElement original= workingCopy.getOriginalElement(); if (original != null) postRefresh(original, false); } private boolean isWorkingCopy(IJavaElement element) { return (element instanceof IWorkingCopy) && ((IWorkingCopy)element).isWorkingCopy(); } /** * Updates the package icon */ private void postUpdateIcon(final IJavaElement element) { postRunnable(new Runnable() { public void run() { // 1GF87WR: ITPUI:ALL - SWTEx + NPE closing a workbench window. Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) fViewer.update(element, new String[]{IBasicPropertyConstants.P_IMAGE}); } }); } /** 1 * Process a resource delta. * * @return true if the parent got refreshed */ private boolean processResourceDelta(IResourceDelta delta, Object parent) { int status= delta.getKind(); int flags= delta.getFlags(); IResource resource= delta.getResource(); // filter out changes affecting the output folder if (resource == null) return false; // this could be optimized by handling all the added children in the parent if ((status & IResourceDelta.REMOVED) != 0) { if (parent instanceof IPackageFragment) { // refresh one level above to deal with empty package filtering properly postRefresh(internalGetParent(parent)); return true; } else postRemove(resource); } if ((status & IResourceDelta.ADDED) != 0) { if (parent instanceof IPackageFragment) { // refresh one level above to deal with empty package filtering properly postRefresh(internalGetParent(parent)); return true; } else postAdd(parent, resource); } // open/close state change of a project if ((flags & IResourceDelta.OPEN) != 0) { postRefresh(internalGetParent(parent)); return true; } processResourceDeltas(delta.getAffectedChildren(), resource); return false; } void setIsFlatLayout(boolean state) { fIsFlatLayout= state; } /** * Process resource deltas. * * @return true if the parent got refreshed */ private boolean processResourceDeltas(IResourceDelta[] deltas, Object parent) { if (deltas == null) return false; if (deltas.length > 1) { // more than one child changed, refresh from here downwards postRefresh(parent); return true; } for (int i= 0; i < deltas.length; i++) { if (processResourceDelta(deltas[i], parent)) return true; } return false; } private void postRefresh(final Object root) { postRefresh(root, true); } private void postRefresh(final Object root, final boolean updateLabels) { postRunnable(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()){ fViewer.refresh(root, updateLabels); } } }); } private void postAdd(final Object parent, final Object element) { postRunnable(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()){ fViewer.add(parent, element); } } }); } private void postRemove(final Object element) { postRunnable(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { fViewer.remove(element); } } }); } private void postRunnable(final Runnable r) { Control ctrl= fViewer.getControl(); final Runnable trackedRunnable= new Runnable() { public void run() { try { r.run(); } finally { removePendingChange(); } } }; if (ctrl != null && !ctrl.isDisposed()) { addPendingChange(); try { ctrl.getDisplay().asyncExec(trackedRunnable); } catch (RuntimeException e) { removePendingChange(); throw e; } catch (Error e) { removePendingChange(); throw e; } } } // ------ Pending change management due to the use of asyncExec in postRunnable. public synchronized boolean hasPendingChanges() { return fPendingChanges > 0; } private synchronized void addPendingChange() { fPendingChanges++; // System.out.print(fPendingChanges); } private synchronized void removePendingChange() { fPendingChanges--; if (fPendingChanges < 0) fPendingChanges= 0; // System.out.print(fPendingChanges); } }
32,656
Bug 32656 Open/Close project in package explorer looses selection on java-projects. [package explorer]
Not on non-java projects, which looks wrong when multiple java- and non-java-projects are opened/closed.
resolved fixed
855600e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:31:04Z
2003-02-24T15:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.packageview; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DragSource; import org.eclipse.swt.dnd.DragSourceEvent; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.swt.widgets.Tree; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ILabelDecorator; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.IOpenListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.ITreeViewerListener; import org.eclipse.jface.viewers.OpenEvent; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeExpansionEvent; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.core.runtime.IPath; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IMemento; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.part.IShowInSource; import org.eclipse.ui.part.IShowInTarget; import org.eclipse.ui.part.IShowInTargetList; import org.eclipse.ui.part.ShowInContext; import org.eclipse.ui.part.ISetSelectionTarget; import org.eclipse.ui.part.ResourceTransfer; import org.eclipse.ui.part.ViewPart; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.dnd.DelegatingDragAdapter; import org.eclipse.jdt.internal.ui.dnd.DelegatingDropAdapter; import org.eclipse.jdt.internal.ui.dnd.LocalSelectionTransfer; import org.eclipse.jdt.internal.ui.dnd.ResourceTransferDragAdapter; import org.eclipse.jdt.internal.ui.dnd.TransferDragSourceListener; import org.eclipse.jdt.internal.ui.dnd.TransferDropTargetListener; import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput; import org.eclipse.jdt.internal.ui.util.JavaUIHelp; import org.eclipse.jdt.internal.ui.viewsupport.AppearanceAwareLabelProvider; import org.eclipse.jdt.internal.ui.viewsupport.DecoratingJavaLabelProvider; import org.eclipse.jdt.internal.ui.viewsupport.IViewPartInputProvider; import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; import org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabels; import org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer; import org.eclipse.jdt.internal.ui.viewsupport.StatusBarUpdater; import org.eclipse.jdt.ui.IPackagesViewPart; import org.eclipse.jdt.ui.JavaElementSorter; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.ui.StandardJavaElementContentProvider; /** * The ViewPart for the ProjectExplorer. It listens to part activation events. * When selection linking with the editor is enabled the view selection tracks * the active editor page. Similarly when a resource is selected in the packages * view the corresponding editor is activated. */ public class PackageExplorerPart extends ViewPart implements ISetSelectionTarget, IMenuListener, IShowInTarget, IPackagesViewPart, IPropertyChangeListener, IViewPartInputProvider { private boolean fIsCurrentLayoutFlat; // true means flat, false means hierachical private static final int HIERARCHICAL_LAYOUT= 0x1; private static final int FLAT_LAYOUT= 0x2; public final static String VIEW_ID= JavaUI.ID_PACKAGES; // Persistance tags. static final String TAG_SELECTION= "selection"; //$NON-NLS-1$ static final String TAG_EXPANDED= "expanded"; //$NON-NLS-1$ static final String TAG_ELEMENT= "element"; //$NON-NLS-1$ static final String TAG_PATH= "path"; //$NON-NLS-1$ static final String TAG_VERTICAL_POSITION= "verticalPosition"; //$NON-NLS-1$ static final String TAG_HORIZONTAL_POSITION= "horizontalPosition"; //$NON-NLS-1$ static final String TAG_FILTERS = "filters"; //$NON-NLS-1$ static final String TAG_FILTER = "filter"; //$NON-NLS-1$ static final String TAG_LAYOUT= "layout"; //$NON-NLS-1$ private PackageExplorerContentProvider fContentProvider; private PackageExplorerActionGroup fActionSet; private ProblemTreeViewer fViewer; private Menu fContextMenu; private IMemento fMemento; private ISelectionChangedListener fSelectionListener; private String fWorkingSetName; private IPartListener fPartListener= new IPartListener() { public void partActivated(IWorkbenchPart part) { if (part instanceof IEditorPart) editorActivated((IEditorPart) part); } public void partBroughtToTop(IWorkbenchPart part) { } public void partClosed(IWorkbenchPart part) { } public void partDeactivated(IWorkbenchPart part) { } public void partOpened(IWorkbenchPart part) { } }; private ITreeViewerListener fExpansionListener= new ITreeViewerListener() { public void treeCollapsed(TreeExpansionEvent event) { } public void treeExpanded(TreeExpansionEvent event) { Object element= event.getElement(); if (element instanceof ICompilationUnit || element instanceof IClassFile) expandMainType(element); } }; private PackageExplorerLabelProvider fLabelProvider; /* (non-Javadoc) * Method declared on IViewPart. */ private boolean fLinkingEnabled; public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); fMemento= memento; restoreLayoutState(memento); } private void restoreLayoutState(IMemento memento) { Integer state= null; if (memento != null) state= memento.getInteger(TAG_LAYOUT); // If no memento try an restore from preference store if(state == null) { IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); state= new Integer(store.getInt(TAG_LAYOUT)); } if (state.intValue() == FLAT_LAYOUT) fIsCurrentLayoutFlat= true; else if (state.intValue() == HIERARCHICAL_LAYOUT) fIsCurrentLayoutFlat= false; else fIsCurrentLayoutFlat= true; } /** * Returns the package explorer part of the active perspective. If * there isn't any package explorer part <code>null</code> is returned. */ public static PackageExplorerPart getFromActivePerspective() { IWorkbenchPage activePage= JavaPlugin.getActivePage(); if (activePage == null) return null; IViewPart view= activePage.findView(VIEW_ID); if (view instanceof PackageExplorerPart) return (PackageExplorerPart)view; return null; } /** * Makes the package explorer part visible in the active perspective. If there * isn't a package explorer part registered <code>null</code> is returned. * Otherwise the opened view part is returned. */ public static PackageExplorerPart openInActivePerspective() { try { return (PackageExplorerPart)JavaPlugin.getActivePage().showView(VIEW_ID); } catch(PartInitException pe) { return null; } } public void dispose() { if (fContextMenu != null && !fContextMenu.isDisposed()) fContextMenu.dispose(); getSite().getPage().removePartListener(fPartListener); JavaPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); if (fViewer != null) fViewer.removeTreeListener(fExpansionListener); if (fActionSet != null) fActionSet.dispose(); super.dispose(); } /** * Implementation of IWorkbenchPart.createPartControl(Composite) */ public void createPartControl(Composite parent) { fViewer= createViewer(parent); fViewer.setUseHashlookup(true); fViewer.setComparer(new PackageExplorerElementComparer()); setProviders(); JavaPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); MenuManager menuMgr= new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(this); fContextMenu= menuMgr.createContextMenu(fViewer.getTree()); fViewer.getTree().setMenu(fContextMenu); // Register viewer with site. This must be done before making the actions. IWorkbenchPartSite site= getSite(); site.registerContextMenu(menuMgr, fViewer); site.setSelectionProvider(fViewer); site.getPage().addPartListener(fPartListener); if (fMemento != null) { restoreLinkingEnabled(fMemento); } makeActions(); // call before registering for selection changes // Set input after filter and sorter has been set. This avoids resorting and refiltering. restoreFilterAndSorter(); fViewer.setInput(findInputElement()); initDragAndDrop(); initKeyListener(); fSelectionListener= new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { handleSelectionChanged(event); } }; fViewer.addSelectionChangedListener(fSelectionListener); fViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { fActionSet.handleDoubleClick(event); } }); fViewer.addOpenListener(new IOpenListener() { public void open(OpenEvent event) { fActionSet.handleOpen(event); } }); IStatusLineManager slManager= getViewSite().getActionBars().getStatusLineManager(); fViewer.addSelectionChangedListener(new StatusBarUpdater(slManager)); fViewer.addTreeListener(fExpansionListener); if (fMemento != null) restoreUIState(fMemento); fMemento= null; // Set help for the view JavaUIHelp.setHelp(fViewer, IJavaHelpContextIds.PACKAGES_VIEW); fillActionBars(); updateTitle(); } /** * This viewer ensures that non-leaves in the hierarchical * layout are not removed by any filters. * * @since 2.1 */ private ProblemTreeViewer createViewer(Composite parent) { return new ProblemTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL) { /* * @see org.eclipse.jface.viewers.StructuredViewer#filter(java.lang.Object) */ protected Object[] getFilteredChildren(Object parent) { List list = new ArrayList(); ViewerFilter[] filters = fViewer.getFilters(); Object[] children = ((ITreeContentProvider) fViewer.getContentProvider()).getChildren(parent); for (int i = 0; i < children.length; i++) { Object object = children[i]; if (!isEssential(object)) { object = filter(object, parent, filters); if (object != null) { list.add(object); } } else list.add(object); } return list.toArray(); } // Sends the object through the given filters private Object filter(Object object, Object parent, ViewerFilter[] filters) { for (int i = 0; i < filters.length; i++) { ViewerFilter filter = filters[i]; if (!filter.select(fViewer, parent, object)) return null; } return object; } /* Checks if a filtered object in essential (ie. is a parent that * should not be removed). */ private boolean isEssential(Object object) { try { if (!isFlatLayout() && object instanceof IPackageFragment) { IPackageFragment fragment = (IPackageFragment) object; return !fragment.isDefaultPackage() && fragment.hasSubpackages(); } } catch (JavaModelException e) { JavaPlugin.log(e); } return false; } }; } /** * Answers whether this part shows the packages flat or hierarchical. * * @since 2.1 */ boolean isFlatLayout() { return fIsCurrentLayoutFlat; } private void setProviders() { //content provider must be set before the label provider fContentProvider= createContentProvider(); fContentProvider.setIsFlatLayout(fIsCurrentLayoutFlat); fViewer.setContentProvider(fContentProvider); fLabelProvider= createLabelProvider(); fLabelProvider.setIsFlatLayout(fIsCurrentLayoutFlat); fViewer.setLabelProvider(new DecoratingJavaLabelProvider(fLabelProvider, false, false)); // problem decoration provided by PackageLabelProvider } void toggleLayout() { // Update current state and inform content and label providers fIsCurrentLayoutFlat= !fIsCurrentLayoutFlat; saveLayoutState(null); fContentProvider.setIsFlatLayout(isFlatLayout()); fLabelProvider.setIsFlatLayout(isFlatLayout()); fViewer.getControl().setRedraw(false); fViewer.refresh(); fViewer.getControl().setRedraw(true); } /** * This method should only be called inside this class * and from test cases. */ public PackageExplorerContentProvider createContentProvider() { IPreferenceStore store= PreferenceConstants.getPreferenceStore(); boolean showCUChildren= store.getBoolean(PreferenceConstants.SHOW_CU_CHILDREN); boolean reconcile= PreferenceConstants.UPDATE_WHILE_EDITING.equals(store.getString(PreferenceConstants.UPDATE_JAVA_VIEWS)); return new PackageExplorerContentProvider(showCUChildren, reconcile); } private PackageExplorerLabelProvider createLabelProvider() { return new PackageExplorerLabelProvider(AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED, AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS | JavaElementImageProvider.SMALL_ICONS, fContentProvider); } private void fillActionBars() { IActionBars actionBars= getViewSite().getActionBars(); fActionSet.fillActionBars(actionBars); } private Object findInputElement() { Object input= getSite().getPage().getInput(); if (input instanceof IWorkspace) { return JavaCore.create(((IWorkspace)input).getRoot()); } else if (input instanceof IContainer) { IJavaElement element= JavaCore.create((IContainer)input); if (element != null && element.exists()) return element; return input; } //1GERPRT: ITPJUI:ALL - Packages View is empty when shown in Type Hierarchy Perspective // we can't handle the input // fall back to show the workspace return JavaCore.create(JavaPlugin.getWorkspace().getRoot()); } /** * Answer the property defined by key. */ public Object getAdapter(Class key) { if (key.equals(ISelectionProvider.class)) return fViewer; if (key == IShowInSource.class) { return getShowInSource(); } if (key == IShowInTargetList.class) { return new IShowInTargetList() { public String[] getShowInTargetIds() { return new String[] { IPageLayout.ID_RES_NAV }; } }; } return super.getAdapter(key); } /** * Returns the tool tip text for the given element. */ String getToolTipText(Object element) { String result; if (!(element instanceof IResource)) { if (element instanceof IJavaModel) result= PackagesMessages.getString("PackageExplorerPart.workspace"); //$NON-NLS-1$ else result= JavaElementLabels.getTextLabel(element, AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS); } else { IPath path= ((IResource) element).getFullPath(); if (path.isRoot()) { result= PackagesMessages.getString("PackageExplorer.title"); //$NON-NLS-1$ } else { result= path.makeRelative().toString(); } } if (fWorkingSetName == null) return result; String wsstr= PackagesMessages.getFormattedString("PackageExplorer.toolTip", new String[] { fWorkingSetName }); //$NON-NLS-1$ if (result.length() == 0) return wsstr; return PackagesMessages.getFormattedString("PackageExplorer.toolTip2", new String[] { result, fWorkingSetName }); //$NON-NLS-1$ } public String getTitleToolTip() { if (fViewer == null) return super.getTitleToolTip(); return getToolTipText(fViewer.getInput()); } /** * @see IWorkbenchPart#setFocus() */ public void setFocus() { fViewer.getTree().setFocus(); } /** * Returns the current selection. */ private ISelection getSelection() { return fViewer.getSelection(); } //---- Action handling ---------------------------------------------------------- /** * Called when the context menu is about to open. Override * to add your own context dependent menu contributions. */ public void menuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); fActionSet.setContext(new ActionContext(getSelection())); fActionSet.fillContextMenu(menu); fActionSet.setContext(null); } private void makeActions() { fActionSet= new PackageExplorerActionGroup(this); } //---- Event handling ---------------------------------------------------------- private void initDragAndDrop() { int ops= DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance()}; // Drop Adapter TransferDropTargetListener[] dropListeners= new TransferDropTargetListener[] { new SelectionTransferDropAdapter(fViewer), new FileTransferDropAdapter(fViewer) }; fViewer.addDropSupport(ops | DND.DROP_DEFAULT, transfers, new DelegatingDropAdapter(dropListeners)); // Drag Adapter Control control= fViewer.getControl(); TransferDragSourceListener[] dragListeners= new TransferDragSourceListener[] { new SelectionTransferDragAdapter(fViewer), new ResourceTransferDragAdapter(fViewer), new FileTransferDragAdapter(fViewer) }; DragSource source= new DragSource(control, ops); // Note, that the transfer agents are set by the delegating drag adapter itself. source.addDragListener(new DelegatingDragAdapter(dragListeners) { public void dragStart(DragSourceEvent event) { IStructuredSelection selection= (IStructuredSelection)getSelection(); if (selection.isEmpty()) { event.doit= false; return; } for (Iterator iter= selection.iterator(); iter.hasNext(); ) { if (iter.next() instanceof IMember) { setPossibleListeners(new TransferDragSourceListener[] {new SelectionTransferDragAdapter(fViewer)}); break; } } super.dragStart(event); } }); } /** * Handles selection changed in viewer. * Updates global actions. * Links to editor (if option enabled) */ private void handleSelectionChanged(SelectionChangedEvent event) { IStructuredSelection selection= (IStructuredSelection) event.getSelection(); fActionSet.handleSelectionChanged(event); // if (OpenStrategy.getOpenMethod() != OpenStrategy.SINGLE_CLICK) linkToEditor(selection); } public void selectReveal(ISelection selection) { selectReveal(selection, 0); } private void selectReveal(final ISelection selection, final int count) { Control ctrl= getViewer().getControl(); if (ctrl == null || ctrl.isDisposed()) return; ISelection javaSelection= convertSelection(selection); fViewer.setSelection(javaSelection, true); PackageExplorerContentProvider provider= (PackageExplorerContentProvider)getViewer().getContentProvider(); ISelection cs= fViewer.getSelection(); // If we have Pending changes and the element could not be selected then // we try it again on more time by posting the select and reveal asynchronuoulsy // to the event queue. See PR http://bugs.eclipse.org/bugs/show_bug.cgi?id=30700 // for a discussion of the underlying problem. if (count == 0 && provider.hasPendingChanges() && !javaSelection.equals(cs)) { ctrl.getDisplay().asyncExec(new Runnable() { public void run() { selectReveal(selection, count + 1); } }); } } private ISelection convertSelection(ISelection s) { if (!(s instanceof IStructuredSelection)) return s; Object[] elements= ((StructuredSelection)s).toArray(); if (!containsResources(elements)) return s; for (int i= 0; i < elements.length; i++) { Object o= elements[i]; if (o instanceof IResource) { IJavaElement jElement= JavaCore.create((IResource)o); if (jElement != null && jElement.exists()) elements[i]= jElement; } } return new StructuredSelection(elements); } private boolean containsResources(Object[] elements) { for (int i = 0; i < elements.length; i++) { if (elements[i] instanceof IResource) return true; } return false; } public void selectAndReveal(Object element) { selectReveal(new StructuredSelection(element)); } boolean isLinkingEnabled() { return fLinkingEnabled; } /** * Initializes the linking enabled setting from the preference store. */ private void initLinkingEnabled() { fLinkingEnabled= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.LINK_PACKAGES_TO_EDITOR); } /** * Links to editor (if option enabled) */ private void linkToEditor(IStructuredSelection selection) { // ignore selection changes if the package explorer is not the active part. // In this case the selection change isn't triggered by a user. if (!isActivePart()) return; Object obj= selection.getFirstElement(); if (selection.size() == 1) { IEditorPart part= EditorUtility.isOpenInEditor(obj); if (part != null) { IWorkbenchPage page= getSite().getPage(); page.bringToTop(part); if (obj instanceof IJavaElement) EditorUtility.revealInEditor(part, (IJavaElement) obj); } } } private boolean isActivePart() { return this == getSite().getPage().getActivePart(); } public void saveState(IMemento memento) { if (fViewer == null) { // part has not been created if (fMemento != null) //Keep the old state; memento.putMemento(fMemento); return; } saveExpansionState(memento); saveSelectionState(memento); saveLayoutState(memento); saveLinkingEnabled(memento); // commented out because of http://bugs.eclipse.org/bugs/show_bug.cgi?id=4676 //saveScrollState(memento, fViewer.getTree()); fActionSet.saveFilterAndSorterState(memento); } private void saveLinkingEnabled(IMemento memento) { memento.putInteger(PreferenceConstants.LINK_PACKAGES_TO_EDITOR, fLinkingEnabled ? 1 : 0); } /** * Saves the current layout state. * * @param memento the memento to save the state into or * <code>null</code> to store the state in the preferences * @since 2.1 */ private void saveLayoutState(IMemento memento) { if (memento != null) { memento.putInteger(TAG_LAYOUT, getLayoutAsInt()); } else { //if memento is null save in preference store IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); store.setValue(TAG_LAYOUT, getLayoutAsInt()); } } private int getLayoutAsInt() { if (fIsCurrentLayoutFlat) return FLAT_LAYOUT; else return HIERARCHICAL_LAYOUT; } protected void saveScrollState(IMemento memento, Tree tree) { ScrollBar bar= tree.getVerticalBar(); int position= bar != null ? bar.getSelection() : 0; memento.putString(TAG_VERTICAL_POSITION, String.valueOf(position)); //save horizontal position bar= tree.getHorizontalBar(); position= bar != null ? bar.getSelection() : 0; memento.putString(TAG_HORIZONTAL_POSITION, String.valueOf(position)); } protected void saveSelectionState(IMemento memento) { Object elements[]= ((IStructuredSelection) fViewer.getSelection()).toArray(); if (elements.length > 0) { IMemento selectionMem= memento.createChild(TAG_SELECTION); for (int i= 0; i < elements.length; i++) { IMemento elementMem= selectionMem.createChild(TAG_ELEMENT); // we can only persist JavaElements for now Object o= elements[i]; if (o instanceof IJavaElement) elementMem.putString(TAG_PATH, ((IJavaElement) elements[i]).getHandleIdentifier()); } } } protected void saveExpansionState(IMemento memento) { Object expandedElements[]= fViewer.getVisibleExpandedElements(); if (expandedElements.length > 0) { IMemento expandedMem= memento.createChild(TAG_EXPANDED); for (int i= 0; i < expandedElements.length; i++) { IMemento elementMem= expandedMem.createChild(TAG_ELEMENT); // we can only persist JavaElements for now Object o= expandedElements[i]; if (o instanceof IJavaElement) elementMem.putString(TAG_PATH, ((IJavaElement) expandedElements[i]).getHandleIdentifier()); } } } private void restoreFilterAndSorter() { fViewer.setSorter(new JavaElementSorter()); if (fMemento != null) fActionSet.restoreFilterAndSorterState(fMemento); } private void restoreUIState(IMemento memento) { restoreExpansionState(memento); restoreSelectionState(memento); // commented out because of http://bugs.eclipse.org/bugs/show_bug.cgi?id=4676 //restoreScrollState(memento, fViewer.getTree()); } private void restoreLinkingEnabled(IMemento memento) { Integer val= memento.getInteger(PreferenceConstants.LINK_PACKAGES_TO_EDITOR); if (val != null) { fLinkingEnabled= val.intValue() != 0; } } protected void restoreScrollState(IMemento memento, Tree tree) { ScrollBar bar= tree.getVerticalBar(); if (bar != null) { try { String posStr= memento.getString(TAG_VERTICAL_POSITION); int position; position= new Integer(posStr).intValue(); bar.setSelection(position); } catch (NumberFormatException e) { // ignore, don't set scrollposition } } bar= tree.getHorizontalBar(); if (bar != null) { try { String posStr= memento.getString(TAG_HORIZONTAL_POSITION); int position; position= new Integer(posStr).intValue(); bar.setSelection(position); } catch (NumberFormatException e) { // ignore don't set scroll position } } } protected void restoreSelectionState(IMemento memento) { IMemento childMem; childMem= memento.getChild(TAG_SELECTION); if (childMem != null) { ArrayList list= new ArrayList(); IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT); for (int i= 0; i < elementMem.length; i++) { Object element= JavaCore.create(elementMem[i].getString(TAG_PATH)); if (element != null) list.add(element); } fViewer.setSelection(new StructuredSelection(list)); } } protected void restoreExpansionState(IMemento memento) { IMemento childMem= memento.getChild(TAG_EXPANDED); if (childMem != null) { ArrayList elements= new ArrayList(); IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT); for (int i= 0; i < elementMem.length; i++) { Object element= JavaCore.create(elementMem[i].getString(TAG_PATH)); if (element != null) elements.add(element); } fViewer.setExpandedElements(elements.toArray()); } } /** * Create the KeyListener for doing the refresh on the viewer. */ private void initKeyListener() { fViewer.getControl().addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent event) { fActionSet.handleKeyEvent(event); } }); } /** * An editor has been activated. Set the selection in this Packages Viewer * to be the editor's input, if linking is enabled. */ void editorActivated(IEditorPart editor) { if (!isLinkingEnabled()) return; showInput(getElementOfInput(editor.getEditorInput())); } boolean showInput(Object input) { Object element= null; if (input instanceof IFile && isOnClassPath((IFile)input)) { element= JavaCore.create((IFile)input); } if (element == null) // try a non Java resource element= input; if (element != null) { ISelection newSelection= new StructuredSelection(element); if (!fViewer.getSelection().equals(newSelection)) { try { fViewer.removeSelectionChangedListener(fSelectionListener); fViewer.setSelection(newSelection); while (element != null && fViewer.getSelection().isEmpty()) { // Try to select parent in case element is filtered element= getParent(element); if (element != null) { newSelection= new StructuredSelection(element); fViewer.setSelection(newSelection); } } } finally { fViewer.addSelectionChangedListener(fSelectionListener); } } return true; } return false; } private boolean isOnClassPath(IFile file) { IJavaProject jproject= JavaCore.create(file.getProject()); try { return jproject.isOnClasspath(file); } catch (JavaModelException e) { // fall through } return false; } /** * Returns the element's parent. * * @return the parent or <code>null</code> if there's no parent */ private Object getParent(Object element) { if (element instanceof IJavaElement) return ((IJavaElement)element).getParent(); else if (element instanceof IResource) return ((IResource)element).getParent(); // else if (element instanceof IStorage) { // can't get parent - see bug 22376 // } return null; } /** * A compilation unit or class was expanded, expand * the main type. */ void expandMainType(Object element) { try { IType type= null; if (element instanceof ICompilationUnit) { ICompilationUnit cu= (ICompilationUnit)element; IType[] types= cu.getTypes(); if (types.length > 0) type= types[0]; } else if (element instanceof IClassFile) { IClassFile cf= (IClassFile)element; type= cf.getType(); } if (type != null) { final IType type2= type; Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { ctrl.getDisplay().asyncExec(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) fViewer.expandToLevel(type2, 1); } }); } } } catch(JavaModelException e) { // no reveal } } /** * Returns the element contained in the EditorInput */ Object getElementOfInput(IEditorInput input) { if (input instanceof IClassFileEditorInput) return ((IClassFileEditorInput)input).getClassFile(); else if (input instanceof IFileEditorInput) return ((IFileEditorInput)input).getFile(); else if (input instanceof JarEntryEditorInput) return ((JarEntryEditorInput)input).getStorage(); return null; } /** * Returns the Viewer. */ TreeViewer getViewer() { return fViewer; } /** * Returns the TreeViewer. */ public TreeViewer getTreeViewer() { return fViewer; } boolean isExpandable(Object element) { if (fViewer == null) return false; return fViewer.isExpandable(element); } void setWorkingSetName(String workingSetName) { fWorkingSetName= workingSetName; } /** * Updates the title text and title tool tip. * Called whenever the input of the viewer changes. */ void updateTitle() { Object input= fViewer.getInput(); String viewName= getConfigurationElement().getAttribute("name"); //$NON-NLS-1$ if (input == null || (input instanceof IJavaModel)) { setTitle(viewName); setTitleToolTip(""); //$NON-NLS-1$ } else { String inputText= JavaElementLabels.getTextLabel(input, AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS); String title= PackagesMessages.getFormattedString("PackageExplorer.argTitle", new String[] { viewName, inputText }); //$NON-NLS-1$ setTitle(title); setTitleToolTip(getToolTipText(input)); } } /** * Sets the decorator for the package explorer. * * @param decorator a label decorator or <code>null</code> for no decorations. * @deprecated To be removed */ public void setLabelDecorator(ILabelDecorator decorator) { } /* * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (fViewer == null) return; boolean refreshViewer= false; if (PreferenceConstants.SHOW_CU_CHILDREN.equals(event.getProperty())) { fActionSet.updateActionBars(getViewSite().getActionBars()); boolean showCUChildren= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.SHOW_CU_CHILDREN); ((StandardJavaElementContentProvider)fViewer.getContentProvider()).setProvideMembers(showCUChildren); refreshViewer= true; } else if (PreferenceConstants.APPEARANCE_MEMBER_SORT_ORDER.equals(event.getProperty())) { refreshViewer= true; } if (refreshViewer) fViewer.refresh(); } /* (non-Javadoc) * @see IViewPartInputProvider#getViewPartInput() */ public Object getViewPartInput() { if (fViewer != null) { return fViewer.getInput(); } return null; } public void collapseAll() { fViewer.getControl().setRedraw(false); fViewer.collapseToLevel(getViewPartInput(), TreeViewer.ALL_LEVELS); fViewer.getControl().setRedraw(true); } public PackageExplorerPart() { initLinkingEnabled(); } public boolean show(ShowInContext context) { Object input= context.getInput(); if (input instanceof IEditorInput) return showInput(getElementOfInput((IEditorInput)context.getInput())); ISelection selection= context.getSelection(); if (selection != null) { selectReveal(selection); return true; } return false; } /** * Returns the <code>IShowInSource</code> for this view. */ protected IShowInSource getShowInSource() { return new IShowInSource() { public ShowInContext getShowInContext() { return new ShowInContext( getViewer().getInput(), getViewer().getSelection()); } }; } /** * @see IResourceNavigator#setLinkingEnabled(boolean) * @since 2.1 */ public void setLinkingEnabled(boolean enabled) { fLinkingEnabled= enabled; PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.LINK_PACKAGES_TO_EDITOR, enabled); if (enabled) { IEditorPart editor = getSite().getPage().getActiveEditor(); if (editor != null) { editorActivated(editor); } } } /** * Returns the name for the given element. * Used as the name for the current frame. */ String getFrameName(Object element) { if (element instanceof IJavaElement) { return ((IJavaElement) element).getElementName(); } else { return ((ILabelProvider) getTreeViewer().getLabelProvider()).getText(element); } } }
32,656
Bug 32656 Open/Close project in package explorer looses selection on java-projects. [package explorer]
Not on non-java projects, which looks wrong when multiple java- and non-java-projects are opened/closed.
resolved fixed
855600e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:31:04Z
2003-02-24T15:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/PasteResourcesFromClipboardAction.java
package org.eclipse.jdt.internal.ui.reorg; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; import org.eclipse.ui.actions.CopyProjectAction; import org.eclipse.ui.part.ResourceTransfer; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.actions.SelectionDispatchAction; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.corext.Assert; import org.eclipse.jdt.internal.corext.refactoring.reorg.CopyRefactoring; import org.eclipse.jdt.internal.corext.refactoring.reorg.IPackageFragmentRootManipulationQuery; public class PasteResourcesFromClipboardAction extends SelectionDispatchAction { private Clipboard fClipboard; protected PasteResourcesFromClipboardAction(IWorkbenchSite site, Clipboard clipboard) { super(site); Assert.isNotNull(clipboard); fClipboard= clipboard; } /* * @see SelectionDispatchAction#selectionChanged(IStructuredSelection) */ protected void selectionChanged(IStructuredSelection selection) { setEnabled(canOperateOn(selection)); } /* * @see SelectionDispatchAction#run(IStructuredSelection) */ public void run(IStructuredSelection selection) { IResource[] resourceData = getClipboardResources(); if (resourceData == null || resourceData.length == 0){ if (canPasteFiles(selection)) pasteFiles(selection.getFirstElement()); return; } pasteResources(selection, resourceData); } private void pasteFiles(Object target) { String[] fileData= getClipboardFiles(); if (fileData == null) return; IContainer container= convertToContainer(target); if (container == null) return; new CopyFilesAndFoldersOperation(getShell()).copyFiles(fileData, container); } private IContainer convertToContainer(Object target){ if (target instanceof IContainer) return (IContainer)target; try { return (IContainer)((IJavaElement)target).getCorrespondingResource(); } catch (JavaModelException e) { ExceptionHandler.handle(e, ReorgMessages.getString("PasteResourcesFromClipboardAction.error.title"), ReorgMessages.getString("PasteResourcesFromClipboardAction.error.message")); //$NON-NLS-1$ //$NON-NLS-2$ return null; } } private void pasteResources(IStructuredSelection selection, IResource[] resourceData) { if (resourceData[0].getType() == IResource.PROJECT) pasteProject((IProject) resourceData[0]); else ReorgActionFactory.createDnDCopyAction(resourceData, getFirstSelectedResource(selection)).run(); } private void pasteProject(IProject project){ CopyProjectAction cpa= new CopyProjectAction(getShell()); cpa.selectionChanged(new StructuredSelection(project)); if (! cpa.isEnabled()) return; cpa.run(); } //- enablement --- private boolean canOperateOn(IStructuredSelection selection){ IResource[] resourceData= getClipboardResources(); if (resourceData == null || resourceData.length == 0) return canPasteFiles(selection); if (ClipboardActionUtil.isOneOpenProject(resourceData)) return true; if (selection.size() != 1) //only after we checked the 'one project' case return false; /* * special case: if both source references and resources are in clipboard - disable this action * if a compilation unit is selected. * this is important in the case when a type is copied to the clipboard - we put also its compilation unit */ TypedSource[] typedSource= getClipboardSourceReference(); if (selection.getFirstElement() instanceof ICompilationUnit && typedSource != null && typedSource.length != 0) return false; if (StructuredSelectionUtil.getResources(selection).length != 1) return false; if (resourceData == null) return ClipboardActionUtil.getFirstResource(selection) instanceof IContainer; if (! allResourcesExist(resourceData)) return false; return canActivateCopyRefactoring(getShell(), resourceData, ClipboardActionUtil.getFirstResource(selection)); } private static boolean allResourcesExist(IResource[] resourceData) { for (int i= 0; i < resourceData.length; i++) { if (! resourceData[i].exists()) return false; } return true; } private boolean canPasteFiles(IStructuredSelection selection) { String[] clipboardFiles= getClipboardFiles(); return clipboardFiles != null && canPasteFilesOn(selection.getFirstElement()); } private static boolean canPasteFilesOn(Object target) { boolean isPackageFragment= target instanceof IPackageFragment; boolean isJavaProject= target instanceof IJavaProject; boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot; boolean isContainer= target instanceof IContainer; if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer)) return false; if (isContainer) { IContainer container= (IContainer)target; if (!container.isReadOnly()) return true; } else { IJavaElement element= (IJavaElement)target; if (!element.isReadOnly()) return true; } return false; } private static boolean canActivateCopyRefactoring(Shell shell, IResource[] resourceData, IResource selectedResource) { try{ CopyRefactoring ref= createCopyRefactoring(shell, resourceData); if (! ref.checkActivation(new NullProgressMonitor()).isOK()) return false; return ref.isValidDestination(ClipboardActionUtil.tryConvertingToJava(selectedResource)); } catch (JavaModelException e){ return false; } } //-- helpers private IResource getFirstSelectedResource(IStructuredSelection selection){ return ClipboardActionUtil.getFirstResource(selection); } private String[] getClipboardFiles() { return ((String[])fClipboard.getContents(FileTransfer.getInstance())); } private IResource[] getClipboardResources() { return ((IResource[])fClipboard.getContents(ResourceTransfer.getInstance())); } private TypedSource[] getClipboardSourceReference() { return ((TypedSource[])fClipboard.getContents(TypedSourceTransfer.getInstance())); } private static CopyRefactoring createCopyRefactoring(Shell shell, IResource[] resourceData) { IPackageFragmentRootManipulationQuery query= JdtCopyAction.createUpdateClasspathQuery(shell); return new CopyRefactoring(ClipboardActionUtil.getConvertedResources(resourceData), new ReorgQueries(), query); } }
32,656
Bug 32656 Open/Close project in package explorer looses selection on java-projects. [package explorer]
Not on non-java projects, which looks wrong when multiple java- and non-java-projects are opened/closed.
resolved fixed
855600e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:31:04Z
2003-02-24T15:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/ReorgDestinationAction.java
32,656
Bug 32656 Open/Close project in package explorer looses selection on java-projects. [package explorer]
Not on non-java projects, which looks wrong when multiple java- and non-java-projects are opened/closed.
resolved fixed
855600e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:31:04Z
2003-02-24T15:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OpenProjectAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.ui.actions; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.OpenResourceAction; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.actions.ActionMessages; import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.ui.JavaElementLabelProvider; /** * Action to open a closed project. Action either opens the closed projects * provided by the strucutured selection or present a dialog from which the * user can select the projects to be opened. * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> * * @since 2.0 */ public class OpenProjectAction extends SelectionDispatchAction implements IResourceChangeListener { private OpenResourceAction fWorkbenchAction; /** * Creates a new <code>OpenProjectAction</code>. The action requires * that the selection provided by the site's selection provider is of type <code> * org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the site providing context information for this action */ public OpenProjectAction(IWorkbenchSite site) { super(site); fWorkbenchAction= new OpenResourceAction(site.getShell()); setText(fWorkbenchAction.getText()); setToolTipText(fWorkbenchAction.getToolTipText()); setEnabled(hasCloseProjects()); WorkbenchHelp.setHelp(this, IJavaHelpContextIds.OPEN_PROJECT_ACTION); } /* * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent) */ public void resourceChanged(IResourceChangeEvent event) { fWorkbenchAction.resourceChanged(event); internalResourceChanged(event); } private void internalResourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null) { IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED); for (int i = 0; i < projDeltas.length; ++i) { IResourceDelta projDelta = projDeltas[i]; if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) { setEnabled(hasCloseProjects()); return; } } } } //---- normal selection ------------------------------------- /* (non-Javadoc) * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.viewers.ISelection) */ protected void selectionChanged(ISelection selection) { setEnabled(hasCloseProjects()); } /* (non-Javadoc) * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.ISelection) */ protected void run(ISelection selection) { internalRun(); } //---- structured selection --------------------------------------- /* (non-Javadoc) * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection) */ protected void selectionChanged(IStructuredSelection selection) { if (selection.isEmpty()) { setEnabled(hasCloseProjects()); return; } fWorkbenchAction.selectionChanged(selection); setEnabled(fWorkbenchAction.isEnabled()); } /* (non-Javadoc) * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.IStructuredSelection) */ protected void run(IStructuredSelection selection) { if (selection.isEmpty()) { internalRun(); return; } fWorkbenchAction.run(); } private void internalRun() { ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider()); dialog.setTitle(ActionMessages.getString("OpenProjectAction.dialog.title")); //$NON-NLS-1$ dialog.setMessage(ActionMessages.getString("OpenProjectAction.dialog.message")); //$NON-NLS-1$ dialog.setElements(getClosedProjects()); dialog.setMultipleSelection(true); int result= dialog.open(); if (result != Dialog.OK) return; final Object[] projects= dialog.getResult(); IWorkspaceRunnable runnable= createRunnable(projects); ProgressMonitorDialog pd= new ProgressMonitorDialog(getShell()); try { pd.run(true, true, new WorkbenchRunnableAdapter(runnable)); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OpenProjectAction.dialog.title"), //$NON-NLS-1$ ActionMessages.getString("OpenProjectAction.error.message")); //$NON-NLS-1$ } catch (InterruptedException e) { } } private IWorkspaceRunnable createRunnable(final Object[] projects) { return new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { monitor.beginTask("", projects.length); //$NON-NLS-1$ MultiStatus errorStatus= null; for (int i = 0; i < projects.length; i++) { IProject project= (IProject)projects[i]; try { project.open(new SubProgressMonitor(monitor, 1)); } catch (CoreException e) { if (errorStatus == null) errorStatus = new MultiStatus(JavaPlugin.getPluginId(), IStatus.ERROR, ActionMessages.getString("OpenProjectAction.error.message"), e); //$NON-NLS-1$ errorStatus.merge(e.getStatus()); } } monitor.done(); if (errorStatus != null) throw new CoreException(errorStatus); } }; } private Object[] getClosedProjects() { IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects(); List result= new ArrayList(5); for (int i = 0; i < projects.length; i++) { IProject project= projects[i]; if (!project.isOpen()) result.add(project); } return result.toArray(); } private boolean hasCloseProjects() { IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (int i = 0; i < projects.length; i++) { if (!projects[i].isOpen()) return true; } return false; } }
33,258
Bug 33258 Push Down needs busy cursor
Build 2.1 RC1 1. Select IAction.run 2. Refactor->Push Down ==> neither busy cursor nor progress is shown even though the system is frozen for more than 6 seconds (and I have one of the faster machines). Note: Same might be true for other refactoring with pre-checking.
resolved fixed
d05097c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:37:59Z
2003-02-26T14:33:20Z
org.eclipse.jdt.ui/ui
33,258
Bug 33258 Push Down needs busy cursor
Build 2.1 RC1 1. Select IAction.run 2. Refactor->Push Down ==> neither busy cursor nor progress is shown even though the system is frozen for more than 6 seconds (and I have one of the faster machines). Note: Same might be true for other refactoring with pre-checking.
resolved fixed
d05097c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:37:59Z
2003-02-26T14:33:20Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/actions/RefactoringStarter.java
32,969
Bug 32969 No QF for uncaught exception type in explicit super call to constructor
RC1 - Given a class CC with default constructor throwing an IOException - create new class C derived from CC - add a default constructor C() Observe: no QFs are proposed for the error: "Unhandled exception type IOException"
resolved fixed
0b5cff7
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:39:23Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
package org.eclipse.jdt.ui.tests.quickfix; import java.util.ArrayList; import java.util.Hashtable; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.testplugin.JavaProjectHelper; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.corext.template.CodeTemplates; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal; import org.eclipse.jdt.internal.ui.text.correction.CorrectionContext; import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; public class LocalCorrectionsQuickFixTest extends QuickFixTest { private static final Class THIS= LocalCorrectionsQuickFixTest.class; private IJavaProject fJProject1; private IPackageFragmentRoot fSourceFolder; public LocalCorrectionsQuickFixTest(String name) { super(name); } public static Test suite() { if (false) { return new TestSuite(THIS); } else { TestSuite suite= new TestSuite(); suite.addTest(new LocalCorrectionsQuickFixTest("testUncaughtExceptionToSurroundingTry")); return suite; } } protected void setUp() throws Exception { Hashtable options= JavaCore.getDefaultOptions(); options.put(JavaCore.FORMATTER_TAB_CHAR, JavaCore.SPACE); options.put(JavaCore.FORMATTER_TAB_SIZE, "4"); options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR); JavaCore.setOptions(options); IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false); CodeTemplates.getCodeTemplate(CodeTemplates.CATCHBLOCK).setPattern(""); CodeTemplates.getCodeTemplate(CodeTemplates.CONSTRUCTORSTUB).setPattern(""); CodeTemplates.getCodeTemplate(CodeTemplates.METHODSTUB).setPattern(""); fJProject1= JavaProjectHelper.createJavaProject("TestProject1", "bin"); assertTrue("rt not found", JavaProjectHelper.addRTJar(fJProject1) != null); fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src"); } protected void tearDown() throws Exception { JavaProjectHelper.delete(fJProject1); } public void testFieldAccessToStatic() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.File;\n"); buf.append("public class E {\n"); buf.append(" public char foo() {\n"); buf.append(" return (new File(\"x.txt\")).separatorChar;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.File;\n"); buf.append("public class E {\n"); buf.append(" public char foo() {\n"); buf.append(" return File.separatorChar;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testInheritedAccessOnStatic() throws Exception { IPackageFragment pack0= fSourceFolder.createPackageFragment("pack", false, null); StringBuffer buf= new StringBuffer(); buf.append("package pack;\n"); buf.append("public class A {\n"); buf.append(" public static void foo() {\n"); buf.append(" }\n"); buf.append("}\n"); pack0.createCompilationUnit("A.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package pack;\n"); buf.append("public class B extends A {\n"); buf.append("}\n"); pack0.createCompilationUnit("B.java", buf.toString(), false, null); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import pack.B;\n"); buf.append("public class E {\n"); buf.append(" public void foo(B b) {\n"); buf.append(" b.foo();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 3); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import pack.B;\n"); buf.append("public class E {\n"); buf.append(" public void foo(B b) {\n"); buf.append(" B.foo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import pack.A;\n"); buf.append("import pack.B;\n"); buf.append("public class E {\n"); buf.append(" public void foo(B b) {\n"); buf.append(" A.foo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(2); String preview3= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package pack;\n"); buf.append("public class A {\n"); buf.append(" public void foo() {\n"); buf.append(" }\n"); buf.append("}\n"); String expected3= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2, preview3 }, new String[] { expected1, expected2, expected3 }); } public void testQualifiedAccessToStatic() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Thread t) {\n"); buf.append(" t.sleep(10);\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Thread t) {\n"); buf.append(" Thread.sleep(10);\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testThisAccessToStatic() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public static void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" this.goo();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public static void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" E.goo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" this.goo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testThisAccessToStaticField() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public static int fCount;\n"); buf.append("\n"); buf.append(" public void foo() {\n"); buf.append(" this.fCount= 1;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public static int fCount;\n"); buf.append("\n"); buf.append(" public void foo() {\n"); buf.append(" E.fCount= 1;\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int fCount;\n"); buf.append("\n"); buf.append(" public void foo() {\n"); buf.append(" this.fCount= 1;\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testCastMissingInVarDecl() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Object o) {\n"); buf.append(" Thread th= o;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Object o) {\n"); buf.append(" Thread th= (Thread) o;\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Object o) {\n"); buf.append(" Object th= o;\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testCastMissingInVarDecl2() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.List;\n"); buf.append("public class Container {\n"); buf.append(" public List[] getLists() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); pack1.createCompilationUnit("Container.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.ArrayList;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Container c) {\n"); buf.append(" ArrayList[] lists= c.getLists();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.ArrayList;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Container c) {\n"); buf.append(" ArrayList[] lists= (ArrayList[]) c.getLists();\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.ArrayList;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Container c) {\n"); buf.append(" List[] lists= c.getLists();\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testCastMissingInFieldDecl() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" int time= System.currentTimeMillis();\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" int time= (int) System.currentTimeMillis();\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" long time= System.currentTimeMillis();\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testCastMissingInAssignment() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Iterator;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Iterator iter) {\n"); buf.append(" String str;\n"); buf.append(" str= iter.next();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Iterator;\n"); buf.append("public class E {\n"); buf.append(" public void foo(Iterator iter) {\n"); buf.append(" String str;\n"); buf.append(" str= (String) iter.next();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testCastMissingInExpression() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public String[] foo(List list) {\n"); buf.append(" return list.toArray(new List[list.size()]);\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public String[] foo(List list) {\n"); buf.append(" return (String[]) list.toArray(new List[list.size()]);\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public Object[] foo(List list) {\n"); buf.append(" return list.toArray(new List[list.size()]);\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testCastOnCastExpression() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.ArrayList;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public void foo(List list) {\n"); buf.append(" ArrayList a= (Cloneable) list;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.ArrayList;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public void foo(List list) {\n"); buf.append(" ArrayList a= (ArrayList) list;\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.ArrayList;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public void foo(List list) {\n"); buf.append(" Cloneable a= (Cloneable) list;\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUncaughtException() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" goo();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" }\n"); buf.append(" public void foo() throws IOException {\n"); buf.append(" goo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUncaughtException2() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public String goo() throws IOException {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" goo().substring(2);\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public String goo() throws IOException {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append(" public void foo() throws IOException {\n"); buf.append(" goo().substring(2);\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public String goo() throws IOException {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo().substring(2);\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUncaughtExceptionRemoveMoreSpecific() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.net.SocketException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() throws SocketException {\n"); buf.append(" this.goo();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.net.SocketException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() throws IOException {\n"); buf.append(" this.goo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.net.SocketException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() throws SocketException {\n"); buf.append(" try {\n"); buf.append(" this.goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUncaughtExceptionToSurroundingTry() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public static void goo() throws IOException, ParseException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" E.goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 3); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public static void goo() throws IOException, ParseException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() throws ParseException {\n"); buf.append(" try {\n"); buf.append(" E.goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public static void goo() throws IOException, ParseException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" try {\n"); buf.append(" E.goo();\n"); buf.append(" } catch (ParseException e1) {\n"); buf.append(" }\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(2); String preview3= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public static void goo() throws IOException, ParseException {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" E.goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" } catch (ParseException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected3= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2, preview3 }, new String[] { expected1, expected2, expected3 }); } public void testUncaughtExceptionOnSuper() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.FileInputStream;\n"); buf.append("public class E extends FileInputStream {\n"); buf.append(" public E() {\n"); buf.append(" super(\"x\");\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.FileInputStream;\n"); buf.append("import java.io.FileNotFoundException;\n"); buf.append("public class E extends FileInputStream {\n"); buf.append(" public E() throws FileNotFoundException {\n"); buf.append(" super(\"x\");\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUncaughtExceptionOnThis() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" this(null);\n"); buf.append(" }\n"); buf.append(" public E(Object x) throws IOException {\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public E() throws IOException {\n"); buf.append(" this(null);\n"); buf.append(" }\n"); buf.append(" public E(Object x) throws IOException {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } boolean BUG_25417= true; public void testUncaughtExceptionDuplicate() throws Exception { if (BUG_25417) { return; } IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class MyException extends Exception {\n"); buf.append("}\n"); pack1.createCompilationUnit("MyException.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void m1() throws IOException {\n"); buf.append(" m2();\n"); buf.append(" }\n"); buf.append(" public void m2() throws IOException, ParseException, MyException {\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 2); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void m1() throws IOException, ParseException, MyException {\n"); buf.append(" m2();\n"); buf.append(" }\n"); buf.append(" public void m2() throws IOException, ParseException, MyException {\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void m1() throws IOException {\n"); buf.append(" try {\n"); buf.append(" m2();\n"); buf.append(" } catch (ParseException e) {\n"); buf.append(" } catch (MyException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append(" public void m2() throws IOException, ParseException, MyException {\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testMultipleUncaughtExceptions() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException, ParseException {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" goo();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 2); // 2 uncaught exceptions CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException, ParseException {\n"); buf.append(" }\n"); buf.append(" public void foo() throws IOException, ParseException {\n"); buf.append(" goo();\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException, ParseException {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" } catch (ParseException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUnneededCatchBlock() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" } catch (ParseException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("import java.text.ParseException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() throws IOException {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnneededCatchBlockSingle() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" goo();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnneededCatchBlockWithFinally() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } catch (IOException e) {\n"); buf.append(" } finally {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class E {\n"); buf.append(" public void goo() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" try {\n"); buf.append(" goo();\n"); buf.append(" } finally {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnimplementedMethods() throws Exception { IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test2;\n"); buf.append("import java.io.IOException;\n"); buf.append("public interface Inter {\n"); buf.append(" int getCount(Object[] o) throws IOException;\n"); buf.append("}\n"); pack2.createCompilationUnit("Inter.java", buf.toString(), false, null); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import test2.Inter;\n"); buf.append("public class E implements Inter{\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import test2.Inter;\n"); buf.append("public abstract class E implements Inter{\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("\n"); buf.append("import test2.Inter;\n"); buf.append("public class E implements Inter{\n"); buf.append("\n"); buf.append(" public int getCount(Object[] o) throws IOException {\n"); buf.append(" return 0;\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUnimplementedMethods2() throws Exception { IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test2;\n"); buf.append("import java.io.IOException;\n"); buf.append("public interface Inter {\n"); buf.append(" int getCount(Object[] o) throws IOException;\n"); buf.append("}\n"); pack2.createCompilationUnit("Inter.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test2;\n"); buf.append("import java.io.IOException;\n"); buf.append("public abstract class InterImpl implements Inter {\n"); buf.append(" protected abstract int[] getMusic() throws IOException;\n"); buf.append("}\n"); pack2.createCompilationUnit("InterImpl.java", buf.toString(), false, null); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import test2.InterImpl;\n"); buf.append("public class E extends InterImpl {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 2); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import test2.InterImpl;\n"); buf.append("public abstract class E extends InterImpl {\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("\n"); buf.append("import test2.InterImpl;\n"); buf.append("public class E extends InterImpl {\n"); buf.append("\n"); buf.append(" protected int[] getMusic() throws IOException {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("\n"); buf.append(" public int getCount(Object[] o) throws IOException {\n"); buf.append(" return 0;\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testUnitializedVariable() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo() {\n"); buf.append(" int s;\n"); buf.append(" try {\n"); buf.append(" s= 1;\n"); buf.append(" } catch (Exception e) {\n"); buf.append(" System.out.println(s);\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo() {\n"); buf.append(" int s = 0;\n"); buf.append(" try {\n"); buf.append(" s= 1;\n"); buf.append(" } catch (Exception e) {\n"); buf.append(" System.out.println(s);\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUndefinedConstructorInDefaultConstructor1() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class F {\n"); buf.append(" public F(Runnable runnable) {\n"); buf.append(" }\n"); buf.append("}\n"); pack1.createCompilationUnit("F.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("\n"); buf.append(" public E(Runnable runnable) {\n"); buf.append(" super(runnable);\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUndefinedConstructorInDefaultConstructor2() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class F {\n"); buf.append(" public F(Runnable runnable) throws IOException {\n"); buf.append(" }\n"); buf.append("\n"); buf.append(" public F(int i, Runnable runnable) {\n"); buf.append(" }\n"); buf.append("}\n"); pack1.createCompilationUnit("F.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview1= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("\n"); buf.append(" public E(int i, Runnable runnable) {\n"); buf.append(" super(i, runnable);\n"); buf.append(" }\n"); buf.append("}\n"); String expected1= buf.toString(); proposal= (CUCorrectionProposal) proposals.get(1); String preview2= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("\n"); buf.append("import java.io.IOException;\n"); buf.append("\n"); buf.append("public class E extends F {\n"); buf.append("\n"); buf.append(" public E(Runnable runnable) throws IOException {\n"); buf.append(" super(runnable);\n"); buf.append(" }\n"); buf.append("}\n"); String expected2= buf.toString(); assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 }); } public void testNotVisibleConstructorInDefaultConstructor() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class F {\n"); buf.append(" private F() {\n"); buf.append(" }\n"); buf.append(" public F(Runnable runnable) {\n"); buf.append(" }\n"); buf.append("}\n"); pack1.createCompilationUnit("F.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("\n"); buf.append(" public E(Runnable runnable) {\n"); buf.append(" super(runnable);\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnhandledExceptionInDefaultConstructor() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.io.IOException;\n"); buf.append("public class F {\n"); buf.append(" public F() throws IOException{\n"); buf.append(" }\n"); buf.append("}\n"); pack1.createCompilationUnit("F.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E extends F {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("\n"); buf.append("import java.io.IOException;\n"); buf.append("\n"); buf.append("public class E extends F {\n"); buf.append("\n"); buf.append(" public E() throws IOException {\n"); buf.append(" super();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnusedPrivateField() throws Exception { Hashtable hashtable= JavaCore.getOptions(); hashtable.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.ERROR); JavaCore.setOptions(hashtable); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" private int fCount;\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnusedPrivateField1() throws Exception { Hashtable hashtable= JavaCore.getOptions(); hashtable.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.ERROR); JavaCore.setOptions(hashtable); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" private int fCount, fColor= fCount;\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" private int fCount;\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnusedPrivateMethod() throws Exception { Hashtable hashtable= JavaCore.getOptions(); hashtable.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.ERROR); JavaCore.setOptions(hashtable); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int fCount;\n"); buf.append(" \n"); buf.append(" private void foo() {\n"); buf.append(" fCount= 1;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int fCount;\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnusedPrivateConstructor() throws Exception { Hashtable hashtable= JavaCore.getOptions(); hashtable.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.ERROR); JavaCore.setOptions(hashtable); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" }\n"); buf.append(" \n"); buf.append(" private E(int i) {\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testUnusedPrivateType() throws Exception { Hashtable hashtable= JavaCore.getOptions(); hashtable.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.ERROR); JavaCore.setOptions(hashtable); IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" private class F {\n"); buf.append(" }\n"); buf.append(" \n"); buf.append(" public E() {\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } }
32,969
Bug 32969 No QF for uncaught exception type in explicit super call to constructor
RC1 - Given a class CC with default constructor throwing an IOException - create new class C derived from CC - add a default constructor C() Observe: no QFs are proposed for the error: "Unhandled exception type IOException"
resolved fixed
0b5cff7
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:39:23Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation * Renaud Waldura &lt;[email protected]&gt; - Access to static proposal ******************************************************************************/ package org.eclipse.jdt.internal.ui.text.correction; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.text.IDocument; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.core.dom.PrimitiveType.Code; import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings; import org.eclipse.jdt.internal.corext.codemanipulation.ImportEdit; import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility; import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.ASTRewrite; import org.eclipse.jdt.internal.corext.dom.Selection; import org.eclipse.jdt.internal.corext.refactoring.changes.CompilationUnitChange; import org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring; import org.eclipse.jdt.internal.corext.refactoring.nls.NLSUtil; import org.eclipse.jdt.internal.corext.refactoring.surround.ExceptionAnalyzer; import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring; import org.eclipse.jdt.internal.corext.textmanipulation.TextEdit; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter; import org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard; /** */ public class LocalCorrectionsSubProcessor { public static void addCastProposals(ICorrectionContext context, List proposals) throws CoreException { String[] args= context.getProblemArguments(); if (args.length != 2) { return; } ICompilationUnit cu= context.getCompilationUnit(); String castType= args[1]; CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (!(selectedNode instanceof Expression)) { return; } Expression nodeToCast= (Expression) selectedNode; int parentNodeType= selectedNode.getParent().getNodeType(); if (parentNodeType == ASTNode.ASSIGNMENT) { Assignment assign= (Assignment) selectedNode.getParent(); if (selectedNode.equals(assign.getLeftHandSide())) { nodeToCast= assign.getRightHandSide(); } } else if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { VariableDeclarationFragment frag= (VariableDeclarationFragment) selectedNode.getParent(); if (selectedNode.equals(frag.getName())) { nodeToCast= frag.getInitializer(); } } ASTRewriteCorrectionProposal castProposal= getCastProposal(context, castType, nodeToCast); if (castProposal != null) { proposals.add(castProposal); } // change method return statement to actual type if (parentNodeType == ASTNode.RETURN_STATEMENT) { ITypeBinding binding= nodeToCast.resolveTypeBinding(); BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (binding != null && decl instanceof MethodDeclaration) { MethodDeclaration methodDeclaration= (MethodDeclaration) decl; ASTRewrite rewrite= new ASTRewrite(methodDeclaration); Type newReturnType= ASTResolving.getTypeFromTypeBinding(astRoot.getAST(), binding); rewrite.markAsReplaced(methodDeclaration.getReturnType(), newReturnType); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changereturntype.description", binding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(binding); proposal.ensureNoModifications(); proposals.add(proposal); } } if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { VariableDeclarationFragment fragment= (VariableDeclarationFragment) selectedNode.getParent(); ASTNode parent= fragment.getParent(); Type type= null; if (parent instanceof VariableDeclarationStatement) { VariableDeclarationStatement stmt= (VariableDeclarationStatement) parent; if (stmt.fragments().size() == 1) { type= stmt.getType(); } } else if (parent instanceof FieldDeclaration) { FieldDeclaration decl= (FieldDeclaration) parent; if (decl.fragments().size() == 1) { type= decl.getType(); } } if (type != null) { ImportEdit edit= new ImportEdit(cu, JavaPreferencesSettings.getCodeGenerationSettings()); String typeName= edit.addImport(args[0]); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast_var.description", typeName); //$NON-NLS-1$ ReplaceCorrectionProposal varProposal= new ReplaceCorrectionProposal(label, cu, type.getStartPosition(), type.getLength(), typeName, 1); varProposal.getRootTextEdit().add(edit); proposals.add(varProposal); } } } private static boolean canCast(String castTarget, ITypeBinding bindingToCast) { bindingToCast= ASTResolving.normalizeTypeBinding(bindingToCast); if (bindingToCast == null) { return false; } int arrStart= castTarget.indexOf('['); if (arrStart != -1) { if (!bindingToCast.isArray()) { return "java.lang.Object".equals(bindingToCast.getQualifiedName()); //$NON-NLS-1$ } castTarget= castTarget.substring(0, arrStart); bindingToCast= bindingToCast.getElementType(); if (bindingToCast.isPrimitive() && !castTarget.equals(bindingToCast.getName())) { return false; // can't cast arrays of primitive types into each other } } Code targetCode= PrimitiveType.toCode(castTarget); if (bindingToCast.isPrimitive()) { Code castCode= PrimitiveType.toCode(bindingToCast.getName()); if (castCode == targetCode) { return true; } return (targetCode != null && targetCode != PrimitiveType.BOOLEAN && castCode != PrimitiveType.BOOLEAN); } else { return targetCode == null; } } public static ASTRewriteCorrectionProposal getCastProposal(ICorrectionContext context, String castType, Expression nodeToCast) throws CoreException { ITypeBinding binding= nodeToCast.resolveTypeBinding(); if (binding != null && !canCast(castType, binding)) { return null; } ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTRewrite rewrite= new ASTRewrite(nodeToCast.getParent()); String label; Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal("", cu, rewrite, 1, image); //$NON-NLS-1$ String simpleCastType= proposal.addImport(castType); if (nodeToCast.getNodeType() == ASTNode.CAST_EXPRESSION) { label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changecast.description", castType); //$NON-NLS-1$ CastExpression expression= (CastExpression) nodeToCast; rewrite.markAsReplaced(expression.getType(), rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE)); } else { label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast.description", castType); //$NON-NLS-1$ Expression expressionCopy= (Expression) rewrite.createCopy(nodeToCast); int nodeType= nodeToCast.getNodeType(); if (nodeType == ASTNode.INFIX_EXPRESSION || nodeType == ASTNode.CONDITIONAL_EXPRESSION || nodeType == ASTNode.ASSIGNMENT || nodeType == ASTNode.INSTANCEOF_EXPRESSION) { // nodes have weaker precedence than cast ParenthesizedExpression parenthesizedExpression= astRoot.getAST().newParenthesizedExpression(); parenthesizedExpression.setExpression(expressionCopy); expressionCopy= parenthesizedExpression; } Type typeCopy= (Type) rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE); CastExpression castExpression= astRoot.getAST().newCastExpression(); castExpression.setExpression(expressionCopy); castExpression.setType(typeCopy); rewrite.markAsReplaced(nodeToCast, castExpression); } proposal.setDisplayName(label); proposal.ensureNoModifications(); return proposal; } public static void addUncaughtExceptionProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (selectedNode == null) { return; } while (selectedNode != null && !(selectedNode instanceof Statement)) { selectedNode= selectedNode.getParent(); } if (selectedNode == null) { return; } CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings(); SurroundWithTryCatchRefactoring refactoring= new SurroundWithTryCatchRefactoring(cu, selectedNode.getStartPosition(), selectedNode.getLength(), settings, null); refactoring.setSaveChanges(false); if (refactoring.checkActivationBasics(astRoot, null).isOK()) { String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.surroundwith.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); CUCorrectionProposal proposal= new CUCorrectionProposal(label, (CompilationUnitChange) refactoring.createChange(null), 4, image); proposals.add(proposal); } BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (decl == null) { return; } ITypeBinding[] uncaughtExceptions= ExceptionAnalyzer.perform(decl, Selection.createFromStartLength(selectedNode.getStartPosition(), selectedNode.getLength())); if (uncaughtExceptions.length == 0) { return; } TryStatement surroundingTry= ASTResolving.findParentTryStatement(selectedNode); if (surroundingTry != null && ASTNodes.isParent(selectedNode, surroundingTry.getBody())) { ASTRewrite rewrite= new ASTRewrite(surroundingTry); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addadditionalcatch.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 5, image); AST ast= astRoot.getAST(); List catchClauses= surroundingTry.catchClauses(); for (int i= 0; i < uncaughtExceptions.length; i++) { ITypeBinding excBinding= uncaughtExceptions[i]; String varName= "e"; //$NON-NLS-1$ String imp= proposal.addImport(excBinding); Name name= ASTNodeFactory.newName(ast, imp); SingleVariableDeclaration var= ast.newSingleVariableDeclaration(); var.setName(ast.newSimpleName(varName)); var.setType(ast.newSimpleType(name)); CatchClause newClause= ast.newCatchClause(); newClause.setException(var); String catchBody = StubUtility.getCatchBodyContent(cu, excBinding.getName(), varName); if (catchBody != null) { ASTNode node= rewrite.createPlaceholder(catchBody, ASTRewrite.STATEMENT); newClause.getBody().statements().add(node); } rewrite.markAsInserted(newClause); catchClauses.add(newClause); } proposal.ensureNoModifications(); proposals.add(proposal); } if (decl instanceof MethodDeclaration) { ASTRewrite rewrite= new ASTRewrite(astRoot); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); AST ast= astRoot.getAST(); MethodDeclaration methodDecl= (MethodDeclaration) decl; List exceptions= methodDecl.thrownExceptions(); for (int i= 0; i < uncaughtExceptions.length; i++) { String imp= proposal.addImport(uncaughtExceptions[i]); Name name= ASTNodeFactory.newName(ast, imp); rewrite.markAsInserted(name); exceptions.add(name); } for (int i= 0; i < exceptions.size(); i++) { Name elem= (Name) exceptions.get(i); if (canRemove(elem.resolveTypeBinding(), uncaughtExceptions)) { rewrite.markAsRemoved(elem); } } proposal.ensureNoModifications(); proposals.add(proposal); } } private static boolean canRemove(ITypeBinding curr, ITypeBinding[] addedExceptions) { while (curr != null) { for (int i= 0; i < addedExceptions.length; i++) { if (curr == addedExceptions[i]) { return true; } } curr= curr.getSuperclass(); } return false; } public static void addUnreachableCatchProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } if (selectedNode.getNodeType() == ASTNode.BLOCK && selectedNode.getParent().getNodeType() == ASTNode.CATCH_CLAUSE ) { CatchClause clause= (CatchClause) selectedNode.getParent(); TryStatement tryStatement= (TryStatement) clause.getParent(); ASTRewrite rewrite= new ASTRewrite(tryStatement.getParent()); if (tryStatement.catchClauses().size() > 1 || tryStatement.getFinally() != null) { rewrite.markAsRemoved(clause); } else { List statements= tryStatement.getBody().statements(); if (statements.size() > 0) { ASTNode placeholder= rewrite.createCopy((ASTNode) statements.get(0), (ASTNode) statements.get(statements.size() - 1)); rewrite.markAsReplaced(tryStatement, placeholder); } else { rewrite.markAsRemoved(tryStatement); } } String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removecatchclause.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addNLSProposals(ICorrectionContext context, List proposals) throws CoreException { final ICompilationUnit cu= context.getCompilationUnit(); String name= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.description"); //$NON-NLS-1$ ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, 0) { public void apply(IDocument document) { try { NLSRefactoring refactoring= new NLSRefactoring(cu, JavaPreferencesSettings.getCodeGenerationSettings()); ExternalizeWizard wizard= new ExternalizeWizard(refactoring); String dialogTitle= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.dialog.title"); //$NON-NLS-1$ new RefactoringStarter().activate(refactoring, wizard, JavaPlugin.getActiveWorkbenchShell(), dialogTitle, true); } catch (JavaModelException e) { JavaPlugin.log(e); } } }; proposals.add(proposal); TextEdit edit= NLSUtil.createNLSEdit(cu, context.getOffset()); if (edit != null) { String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addnon-nls.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE); CUCorrectionProposal nlsProposal= new CUCorrectionProposal(label, cu, 6, image); nlsProposal.getRootTextEdit().add(edit); proposals.add(nlsProposal); } } /** * A static field or method is accessed using a non-static reference. E.g. * <pre> * File f = new File(); * f.pathSeparator; * </pre> * This correction changes <code>f</code> above to <code>File</code>. * * @param context * @param proposals */ public static void addInstanceAccessToStaticProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (selectedNode == null) { return; } Expression qualifier= null; IBinding accessBinding= null; if (selectedNode instanceof QualifiedName) { QualifiedName name= (QualifiedName) selectedNode; qualifier= name.getQualifier(); accessBinding= name.resolveBinding(); } else if (selectedNode instanceof SimpleName) { ASTNode parent= selectedNode.getParent(); if (parent instanceof FieldAccess) { FieldAccess fieldAccess= (FieldAccess) parent; qualifier= fieldAccess.getExpression(); accessBinding= fieldAccess.getName().resolveBinding(); } } else if (selectedNode instanceof MethodInvocation) { MethodInvocation methodInvocation= (MethodInvocation) selectedNode; qualifier= methodInvocation.getExpression(); accessBinding= methodInvocation.getName().resolveBinding(); } else if (selectedNode instanceof FieldAccess) { FieldAccess fieldAccess= (FieldAccess) selectedNode; qualifier= fieldAccess.getExpression(); accessBinding= fieldAccess.getName().resolveBinding(); } ITypeBinding declaringTypeBinding= null; if (accessBinding != null) { if (accessBinding instanceof IMethodBinding) { declaringTypeBinding= ((IMethodBinding) accessBinding).getDeclaringClass(); } else if (accessBinding instanceof IVariableBinding) { declaringTypeBinding= ((IVariableBinding) accessBinding).getDeclaringClass(); } if (declaringTypeBinding != null) { ASTRewrite rewrite= new ASTRewrite(selectedNode.getParent()); rewrite.markAsReplaced(qualifier, astRoot.getAST().newSimpleName(declaringTypeBinding.getName())); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changeaccesstostaticdefining.description", declaringTypeBinding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(declaringTypeBinding); proposal.ensureNoModifications(); proposals.add(proposal); } } if (qualifier != null) { ITypeBinding instanceTypeBinding= ASTResolving.normalizeTypeBinding(qualifier.resolveTypeBinding()); if (instanceTypeBinding != null && instanceTypeBinding != declaringTypeBinding) { ASTRewrite rewrite= new ASTRewrite(selectedNode.getParent()); rewrite.markAsReplaced(qualifier, astRoot.getAST().newSimpleName(instanceTypeBinding.getName())); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changeaccesstostatic.description", instanceTypeBinding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image); proposal.addImport(instanceTypeBinding); proposal.ensureNoModifications(); proposals.add(proposal); } } ModifierCorrectionSubProcessor.addNonAccessibleMemberProposal(context, proposals, ModifierCorrectionSubProcessor.TO_NON_STATIC); } public static void addUnimplementedMethodsProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } ASTNode typeNode= null; if (selectedNode.getNodeType() == ASTNode.SIMPLE_NAME && selectedNode.getParent().getNodeType() == ASTNode.TYPE_DECLARATION) { typeNode= selectedNode.getParent(); } else if (selectedNode.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) { ClassInstanceCreation creation= (ClassInstanceCreation) selectedNode; typeNode= creation.getAnonymousClassDeclaration(); } if (typeNode != null) { UnimplementedMethodsCompletionProposal proposal= new UnimplementedMethodsCompletionProposal(cu, typeNode, 10); proposals.add(proposal); } if (typeNode instanceof TypeDeclaration) { TypeDeclaration typeDeclaration= (TypeDeclaration) typeNode; ASTRewriteCorrectionProposal proposal= ModifierCorrectionSubProcessor.getMakeTypeStaticProposal(cu, typeDeclaration); proposals.add(proposal); } } public static void addUninitializedLocalVariableProposal(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (!(selectedNode instanceof Name)) { return; } Name name= (Name) selectedNode; IBinding binding= name.resolveBinding(); if (!(binding instanceof IVariableBinding)) { return; } IVariableBinding varBinding= (IVariableBinding) binding; CompilationUnit astRoot= context.getASTRoot(); ASTNode node= astRoot.findDeclaringNode(binding); if (node instanceof VariableDeclarationFragment) { ASTRewrite rewrite= new ASTRewrite(node.getParent()); VariableDeclarationFragment fragment= (VariableDeclarationFragment) node; if (fragment.getInitializer() != null) { return; } Expression expression= ASTResolving.getInitExpression(astRoot.getAST(), varBinding.getType()); if (expression == null) { return; } fragment.setInitializer(expression); rewrite.markAsInserted(expression); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.uninitializedvariable.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addConstructorFromSuperclassProposal(ICorrectionContext context, List proposals) { ASTNode selectedNode= context.getCoveringNode(); if (!(selectedNode instanceof Name && selectedNode.getParent() instanceof TypeDeclaration)) { return; } TypeDeclaration typeDeclaration= (TypeDeclaration) selectedNode.getParent(); ITypeBinding binding= typeDeclaration.resolveBinding(); if (binding == null || binding.getSuperclass() == null) { return; } ICompilationUnit cu= context.getCompilationUnit(); IMethodBinding[] methods= binding.getSuperclass().getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { IMethodBinding curr= methods[i]; if (curr.isConstructor() && !Modifier.isPrivate(curr.getModifiers())) { proposals.add(new ConstructorFromSuperclassProposal(cu, typeDeclaration, curr, 2)); } } } public static void addUnusedMemberProposal(ICorrectionContext context, List proposals) throws CoreException { ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } BodyDeclaration declaration= ASTResolving.findParentBodyDeclaration(selectedNode); if (declaration != null) { ASTNode nodeToRemove= declaration; if (declaration.getNodeType() == ASTNode.FIELD_DECLARATION) { List fragments= ((FieldDeclaration) declaration).fragments(); if (fragments.size() > 1) { for (int i= 0; i < fragments.size(); i++) { VariableDeclarationFragment node= (VariableDeclarationFragment) fragments.get(i); if (ASTNodes.isParent(selectedNode, node)) { nodeToRemove= node; break; } } } } ASTRewrite rewrite= new ASTRewrite(nodeToRemove.getParent()); rewrite.markAsRemoved(nodeToRemove); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removeunusedmember.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } }
33,683
Bug 33683 Quick fix doesn't work for null type
null
resolved fixed
2fdde07
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T17:59:24Z
2003-03-03T16:46:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation * Renaud Waldura &lt;[email protected]&gt; - Access to static proposal ******************************************************************************/ package org.eclipse.jdt.internal.ui.text.correction; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.text.IDocument; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.core.dom.PrimitiveType.Code; import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings; import org.eclipse.jdt.internal.corext.codemanipulation.ImportEdit; import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility; import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.ASTRewrite; import org.eclipse.jdt.internal.corext.dom.Selection; import org.eclipse.jdt.internal.corext.refactoring.changes.CompilationUnitChange; import org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring; import org.eclipse.jdt.internal.corext.refactoring.nls.NLSUtil; import org.eclipse.jdt.internal.corext.refactoring.surround.ExceptionAnalyzer; import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring; import org.eclipse.jdt.internal.corext.textmanipulation.TextEdit; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter; import org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard; /** */ public class LocalCorrectionsSubProcessor { public static void addCastProposals(ICorrectionContext context, List proposals) throws CoreException { String[] args= context.getProblemArguments(); if (args.length != 2) { return; } ICompilationUnit cu= context.getCompilationUnit(); String castType= args[1]; CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (!(selectedNode instanceof Expression)) { return; } Expression nodeToCast= (Expression) selectedNode; int parentNodeType= selectedNode.getParent().getNodeType(); if (parentNodeType == ASTNode.ASSIGNMENT) { Assignment assign= (Assignment) selectedNode.getParent(); if (selectedNode.equals(assign.getLeftHandSide())) { nodeToCast= assign.getRightHandSide(); } } else if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { VariableDeclarationFragment frag= (VariableDeclarationFragment) selectedNode.getParent(); if (selectedNode.equals(frag.getName())) { nodeToCast= frag.getInitializer(); } } ASTRewriteCorrectionProposal castProposal= getCastProposal(context, castType, nodeToCast); if (castProposal != null) { proposals.add(castProposal); } // change method return statement to actual type if (parentNodeType == ASTNode.RETURN_STATEMENT) { ITypeBinding binding= nodeToCast.resolveTypeBinding(); BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (binding != null && decl instanceof MethodDeclaration) { MethodDeclaration methodDeclaration= (MethodDeclaration) decl; ASTRewrite rewrite= new ASTRewrite(methodDeclaration); Type newReturnType= ASTResolving.getTypeFromTypeBinding(astRoot.getAST(), binding); rewrite.markAsReplaced(methodDeclaration.getReturnType(), newReturnType); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changereturntype.description", binding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(binding); proposal.ensureNoModifications(); proposals.add(proposal); } } if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { VariableDeclarationFragment fragment= (VariableDeclarationFragment) selectedNode.getParent(); ASTNode parent= fragment.getParent(); Type type= null; if (parent instanceof VariableDeclarationStatement) { VariableDeclarationStatement stmt= (VariableDeclarationStatement) parent; if (stmt.fragments().size() == 1) { type= stmt.getType(); } } else if (parent instanceof FieldDeclaration) { FieldDeclaration decl= (FieldDeclaration) parent; if (decl.fragments().size() == 1) { type= decl.getType(); } } if (type != null) { ImportEdit edit= new ImportEdit(cu, JavaPreferencesSettings.getCodeGenerationSettings()); String typeName= edit.addImport(args[0]); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast_var.description", typeName); //$NON-NLS-1$ ReplaceCorrectionProposal varProposal= new ReplaceCorrectionProposal(label, cu, type.getStartPosition(), type.getLength(), typeName, 1); varProposal.getRootTextEdit().add(edit); proposals.add(varProposal); } } } private static boolean canCast(String castTarget, ITypeBinding bindingToCast) { bindingToCast= ASTResolving.normalizeTypeBinding(bindingToCast); if (bindingToCast == null) { return false; } int arrStart= castTarget.indexOf('['); if (arrStart != -1) { if (!bindingToCast.isArray()) { return "java.lang.Object".equals(bindingToCast.getQualifiedName()); //$NON-NLS-1$ } castTarget= castTarget.substring(0, arrStart); bindingToCast= bindingToCast.getElementType(); if (bindingToCast.isPrimitive() && !castTarget.equals(bindingToCast.getName())) { return false; // can't cast arrays of primitive types into each other } } Code targetCode= PrimitiveType.toCode(castTarget); if (bindingToCast.isPrimitive()) { Code castCode= PrimitiveType.toCode(bindingToCast.getName()); if (castCode == targetCode) { return true; } return (targetCode != null && targetCode != PrimitiveType.BOOLEAN && castCode != PrimitiveType.BOOLEAN); } else { return targetCode == null; } } public static ASTRewriteCorrectionProposal getCastProposal(ICorrectionContext context, String castType, Expression nodeToCast) throws CoreException { ITypeBinding binding= nodeToCast.resolveTypeBinding(); if (binding != null && !canCast(castType, binding)) { return null; } ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTRewrite rewrite= new ASTRewrite(nodeToCast.getParent()); String label; Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal("", cu, rewrite, 1, image); //$NON-NLS-1$ String simpleCastType= proposal.addImport(castType); if (nodeToCast.getNodeType() == ASTNode.CAST_EXPRESSION) { label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changecast.description", castType); //$NON-NLS-1$ CastExpression expression= (CastExpression) nodeToCast; rewrite.markAsReplaced(expression.getType(), rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE)); } else { label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast.description", castType); //$NON-NLS-1$ Expression expressionCopy= (Expression) rewrite.createCopy(nodeToCast); int nodeType= nodeToCast.getNodeType(); if (nodeType == ASTNode.INFIX_EXPRESSION || nodeType == ASTNode.CONDITIONAL_EXPRESSION || nodeType == ASTNode.ASSIGNMENT || nodeType == ASTNode.INSTANCEOF_EXPRESSION) { // nodes have weaker precedence than cast ParenthesizedExpression parenthesizedExpression= astRoot.getAST().newParenthesizedExpression(); parenthesizedExpression.setExpression(expressionCopy); expressionCopy= parenthesizedExpression; } Type typeCopy= (Type) rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE); CastExpression castExpression= astRoot.getAST().newCastExpression(); castExpression.setExpression(expressionCopy); castExpression.setType(typeCopy); rewrite.markAsReplaced(nodeToCast, castExpression); } proposal.setDisplayName(label); proposal.ensureNoModifications(); return proposal; } public static void addUncaughtExceptionProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } while (selectedNode != null && !(selectedNode instanceof Statement)) { selectedNode= selectedNode.getParent(); } if (selectedNode == null) { return; } CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings(); SurroundWithTryCatchRefactoring refactoring= new SurroundWithTryCatchRefactoring(cu, selectedNode.getStartPosition(), selectedNode.getLength(), settings, null); refactoring.setSaveChanges(false); if (refactoring.checkActivationBasics(astRoot, null).isOK()) { String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.surroundwith.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); CUCorrectionProposal proposal= new CUCorrectionProposal(label, (CompilationUnitChange) refactoring.createChange(null), 4, image); proposals.add(proposal); } BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (decl == null) { return; } ITypeBinding[] uncaughtExceptions= ExceptionAnalyzer.perform(decl, Selection.createFromStartLength(selectedNode.getStartPosition(), selectedNode.getLength())); if (uncaughtExceptions.length == 0) { return; } TryStatement surroundingTry= ASTResolving.findParentTryStatement(selectedNode); if (surroundingTry != null && ASTNodes.isParent(selectedNode, surroundingTry.getBody())) { ASTRewrite rewrite= new ASTRewrite(surroundingTry); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addadditionalcatch.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 5, image); AST ast= astRoot.getAST(); List catchClauses= surroundingTry.catchClauses(); for (int i= 0; i < uncaughtExceptions.length; i++) { ITypeBinding excBinding= uncaughtExceptions[i]; String varName= "e"; //$NON-NLS-1$ String imp= proposal.addImport(excBinding); Name name= ASTNodeFactory.newName(ast, imp); SingleVariableDeclaration var= ast.newSingleVariableDeclaration(); var.setName(ast.newSimpleName(varName)); var.setType(ast.newSimpleType(name)); CatchClause newClause= ast.newCatchClause(); newClause.setException(var); String catchBody = StubUtility.getCatchBodyContent(cu, excBinding.getName(), varName); if (catchBody != null) { ASTNode node= rewrite.createPlaceholder(catchBody, ASTRewrite.STATEMENT); newClause.getBody().statements().add(node); } rewrite.markAsInserted(newClause); catchClauses.add(newClause); } proposal.ensureNoModifications(); proposals.add(proposal); } if (decl instanceof MethodDeclaration) { ASTRewrite rewrite= new ASTRewrite(astRoot); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); AST ast= astRoot.getAST(); MethodDeclaration methodDecl= (MethodDeclaration) decl; List exceptions= methodDecl.thrownExceptions(); for (int i= 0; i < uncaughtExceptions.length; i++) { String imp= proposal.addImport(uncaughtExceptions[i]); Name name= ASTNodeFactory.newName(ast, imp); rewrite.markAsInserted(name); exceptions.add(name); } for (int i= 0; i < exceptions.size(); i++) { Name elem= (Name) exceptions.get(i); if (canRemove(elem.resolveTypeBinding(), uncaughtExceptions)) { rewrite.markAsRemoved(elem); } } proposal.ensureNoModifications(); proposals.add(proposal); } } private static boolean canRemove(ITypeBinding curr, ITypeBinding[] addedExceptions) { while (curr != null) { for (int i= 0; i < addedExceptions.length; i++) { if (curr == addedExceptions[i]) { return true; } } curr= curr.getSuperclass(); } return false; } public static void addUnreachableCatchProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } if (selectedNode.getNodeType() == ASTNode.BLOCK && selectedNode.getParent().getNodeType() == ASTNode.CATCH_CLAUSE ) { CatchClause clause= (CatchClause) selectedNode.getParent(); TryStatement tryStatement= (TryStatement) clause.getParent(); ASTRewrite rewrite= new ASTRewrite(tryStatement.getParent()); if (tryStatement.catchClauses().size() > 1 || tryStatement.getFinally() != null) { rewrite.markAsRemoved(clause); } else { List statements= tryStatement.getBody().statements(); if (statements.size() > 0) { ASTNode placeholder= rewrite.createCopy((ASTNode) statements.get(0), (ASTNode) statements.get(statements.size() - 1)); rewrite.markAsReplaced(tryStatement, placeholder); } else { rewrite.markAsRemoved(tryStatement); } } String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removecatchclause.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addNLSProposals(ICorrectionContext context, List proposals) throws CoreException { final ICompilationUnit cu= context.getCompilationUnit(); String name= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.description"); //$NON-NLS-1$ ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, 0) { public void apply(IDocument document) { try { NLSRefactoring refactoring= new NLSRefactoring(cu, JavaPreferencesSettings.getCodeGenerationSettings()); ExternalizeWizard wizard= new ExternalizeWizard(refactoring); String dialogTitle= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.dialog.title"); //$NON-NLS-1$ new RefactoringStarter().activate(refactoring, wizard, JavaPlugin.getActiveWorkbenchShell(), dialogTitle, true); } catch (JavaModelException e) { JavaPlugin.log(e); } } }; proposals.add(proposal); TextEdit edit= NLSUtil.createNLSEdit(cu, context.getOffset()); if (edit != null) { String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addnon-nls.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE); CUCorrectionProposal nlsProposal= new CUCorrectionProposal(label, cu, 6, image); nlsProposal.getRootTextEdit().add(edit); proposals.add(nlsProposal); } } /** * A static field or method is accessed using a non-static reference. E.g. * <pre> * File f = new File(); * f.pathSeparator; * </pre> * This correction changes <code>f</code> above to <code>File</code>. * * @param context * @param proposals */ public static void addInstanceAccessToStaticProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (selectedNode == null) { return; } Expression qualifier= null; IBinding accessBinding= null; if (selectedNode instanceof QualifiedName) { QualifiedName name= (QualifiedName) selectedNode; qualifier= name.getQualifier(); accessBinding= name.resolveBinding(); } else if (selectedNode instanceof SimpleName) { ASTNode parent= selectedNode.getParent(); if (parent instanceof FieldAccess) { FieldAccess fieldAccess= (FieldAccess) parent; qualifier= fieldAccess.getExpression(); accessBinding= fieldAccess.getName().resolveBinding(); } } else if (selectedNode instanceof MethodInvocation) { MethodInvocation methodInvocation= (MethodInvocation) selectedNode; qualifier= methodInvocation.getExpression(); accessBinding= methodInvocation.getName().resolveBinding(); } else if (selectedNode instanceof FieldAccess) { FieldAccess fieldAccess= (FieldAccess) selectedNode; qualifier= fieldAccess.getExpression(); accessBinding= fieldAccess.getName().resolveBinding(); } ITypeBinding declaringTypeBinding= null; if (accessBinding != null) { if (accessBinding instanceof IMethodBinding) { declaringTypeBinding= ((IMethodBinding) accessBinding).getDeclaringClass(); } else if (accessBinding instanceof IVariableBinding) { declaringTypeBinding= ((IVariableBinding) accessBinding).getDeclaringClass(); } if (declaringTypeBinding != null) { ASTRewrite rewrite= new ASTRewrite(selectedNode.getParent()); rewrite.markAsReplaced(qualifier, astRoot.getAST().newSimpleName(declaringTypeBinding.getName())); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changeaccesstostaticdefining.description", declaringTypeBinding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(declaringTypeBinding); proposal.ensureNoModifications(); proposals.add(proposal); } } if (qualifier != null) { ITypeBinding instanceTypeBinding= ASTResolving.normalizeTypeBinding(qualifier.resolveTypeBinding()); if (instanceTypeBinding != null && instanceTypeBinding != declaringTypeBinding) { ASTRewrite rewrite= new ASTRewrite(selectedNode.getParent()); rewrite.markAsReplaced(qualifier, astRoot.getAST().newSimpleName(instanceTypeBinding.getName())); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changeaccesstostatic.description", instanceTypeBinding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image); proposal.addImport(instanceTypeBinding); proposal.ensureNoModifications(); proposals.add(proposal); } } ModifierCorrectionSubProcessor.addNonAccessibleMemberProposal(context, proposals, ModifierCorrectionSubProcessor.TO_NON_STATIC); } public static void addUnimplementedMethodsProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } ASTNode typeNode= null; if (selectedNode.getNodeType() == ASTNode.SIMPLE_NAME && selectedNode.getParent().getNodeType() == ASTNode.TYPE_DECLARATION) { typeNode= selectedNode.getParent(); } else if (selectedNode.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) { ClassInstanceCreation creation= (ClassInstanceCreation) selectedNode; typeNode= creation.getAnonymousClassDeclaration(); } if (typeNode != null) { UnimplementedMethodsCompletionProposal proposal= new UnimplementedMethodsCompletionProposal(cu, typeNode, 10); proposals.add(proposal); } if (typeNode instanceof TypeDeclaration) { TypeDeclaration typeDeclaration= (TypeDeclaration) typeNode; ASTRewriteCorrectionProposal proposal= ModifierCorrectionSubProcessor.getMakeTypeStaticProposal(cu, typeDeclaration); proposals.add(proposal); } } public static void addUninitializedLocalVariableProposal(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (!(selectedNode instanceof Name)) { return; } Name name= (Name) selectedNode; IBinding binding= name.resolveBinding(); if (!(binding instanceof IVariableBinding)) { return; } IVariableBinding varBinding= (IVariableBinding) binding; CompilationUnit astRoot= context.getASTRoot(); ASTNode node= astRoot.findDeclaringNode(binding); if (node instanceof VariableDeclarationFragment) { ASTRewrite rewrite= new ASTRewrite(node.getParent()); VariableDeclarationFragment fragment= (VariableDeclarationFragment) node; if (fragment.getInitializer() != null) { return; } Expression expression= ASTResolving.getInitExpression(astRoot.getAST(), varBinding.getType()); if (expression == null) { return; } fragment.setInitializer(expression); rewrite.markAsInserted(expression); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.uninitializedvariable.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addConstructorFromSuperclassProposal(ICorrectionContext context, List proposals) { ASTNode selectedNode= context.getCoveringNode(); if (!(selectedNode instanceof Name && selectedNode.getParent() instanceof TypeDeclaration)) { return; } TypeDeclaration typeDeclaration= (TypeDeclaration) selectedNode.getParent(); ITypeBinding binding= typeDeclaration.resolveBinding(); if (binding == null || binding.getSuperclass() == null) { return; } ICompilationUnit cu= context.getCompilationUnit(); IMethodBinding[] methods= binding.getSuperclass().getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { IMethodBinding curr= methods[i]; if (curr.isConstructor() && !Modifier.isPrivate(curr.getModifiers())) { proposals.add(new ConstructorFromSuperclassProposal(cu, typeDeclaration, curr, 2)); } } } public static void addUnusedMemberProposal(ICorrectionContext context, List proposals) throws CoreException { ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } BodyDeclaration declaration= ASTResolving.findParentBodyDeclaration(selectedNode); if (declaration != null) { ASTNode nodeToRemove= declaration; if (declaration.getNodeType() == ASTNode.FIELD_DECLARATION) { List fragments= ((FieldDeclaration) declaration).fragments(); if (fragments.size() > 1) { for (int i= 0; i < fragments.size(); i++) { VariableDeclarationFragment node= (VariableDeclarationFragment) fragments.get(i); if (ASTNodes.isParent(selectedNode, node)) { nodeToRemove= node; break; } } } } ASTRewrite rewrite= new ASTRewrite(nodeToRemove.getParent()); rewrite.markAsRemoved(nodeToRemove); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removeunusedmember.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } }
33,251
Bug 33251 Pull Up reports error even though there is none
Build 2.1 RC1 1. Add A.x() and B.x() 2. Start to Pull Up B.x() 3. On the second wizard page select to delete A.x(). 4. Press "Finish" ==> error warns about the fact that there will be a compile error. This is not true: 5. Press "Finish" again ==> everything is done as expected.
resolved fixed
b77daa5
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:08:45Z
2003-02-26T14:33:20Z
org.eclipse.jdt.ui.tests.refactoring/test
33,251
Bug 33251 Pull Up reports error even though there is none
Build 2.1 RC1 1. Add A.x() and B.x() 2. Start to Pull Up B.x() 3. On the second wizard page select to delete A.x(). 4. Press "Finish" ==> error warns about the fact that there will be a compile error. This is not true: 5. Press "Finish" again ==> everything is done as expected.
resolved fixed
b77daa5
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:08:45Z
2003-02-26T14:33:20Z
cases/org/eclipse/jdt/ui/tests/refactoring/PullUpTests.java
33,251
Bug 33251 Pull Up reports error even though there is none
Build 2.1 RC1 1. Add A.x() and B.x() 2. Start to Pull Up B.x() 3. On the second wizard page select to delete A.x(). 4. Press "Finish" ==> error warns about the fact that there will be a compile error. This is not true: 5. Press "Finish" again ==> everything is done as expected.
resolved fixed
b77daa5
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:08:45Z
2003-02-26T14:33:20Z
org.eclipse.jdt.ui/core
33,251
Bug 33251 Pull Up reports error even though there is none
Build 2.1 RC1 1. Add A.x() and B.x() 2. Start to Pull Up B.x() 3. On the second wizard page select to delete A.x(). 4. Press "Finish" ==> error warns about the fact that there will be a compile error. This is not true: 5. Press "Finish" again ==> everything is done as expected.
resolved fixed
b77daa5
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:08:45Z
2003-02-26T14:33:20Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/PullUpRefactoring.java
32,972
Bug 32972 Convert Local to Field: text input field doesn't have focus
RC1
resolved fixed
f2d2231
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:23:29Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui/ui
32,972
Bug 32972 Convert Local to Field: text input field doesn't have focus
RC1
resolved fixed
f2d2231
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:23:29Z
2003-02-25T16:20:00Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/PromoteTempInputPage.java
32,966
Bug 32966 Use suprttype where possible: table should have focus
RC1 - JUnit setup - select TestCase - Refactor->User supertype... Observe: table doesn't have focus
resolved fixed
e32f47e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:27:53Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui/ui
32,966
Bug 32966 Use suprttype where possible: table should have focus
RC1 - JUnit setup - select TestCase - Refactor->User supertype... Observe: table doesn't have focus
resolved fixed
e32f47e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:27:53Z
2003-02-25T16:20:00Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/UseSupertypeInputPage.java
32,101
Bug 32101 JavaCompletionProcessor: error message never shown
null
resolved fixed
fb20794
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T18:29:27Z
2003-02-18T12:06:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java
package org.eclipse.jdt.internal.ui.text.java; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.List; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.contentassist.IContextInformationExtension; import org.eclipse.jface.text.contentassist.IContextInformationValidator; import org.eclipse.ui.IEditorPart; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.IWorkingCopyManager; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.corext.template.ContextType; import org.eclipse.jdt.internal.corext.template.ContextTypeRegistry; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaUIMessages; import org.eclipse.jdt.internal.ui.text.JavaCodeReader; import org.eclipse.jdt.internal.ui.text.template.TemplateEngine; import org.eclipse.jdt.internal.ui.text.template.TemplateProposal; /** * Java completion processor. */ public class JavaCompletionProcessor implements IContentAssistProcessor { private static class ContextInformationWrapper implements IContextInformation, IContextInformationExtension { private final IContextInformation fContextInformation; private int fPosition; public ContextInformationWrapper(IContextInformation contextInformation) { fContextInformation= contextInformation; } /* * @see IContextInformation#getContextDisplayString() */ public String getContextDisplayString() { return fContextInformation.getContextDisplayString(); } /* * @see IContextInformation#getImage() */ public Image getImage() { return fContextInformation.getImage(); } /* * @see IContextInformation#getInformationDisplayString() */ public String getInformationDisplayString() { return fContextInformation.getInformationDisplayString(); } /* * @see IContextInformationExtension#getContextInformationPosition() */ public int getContextInformationPosition() { return fPosition; } public void setContextInformationPosition(int position) { fPosition= position; } }; private final static String VISIBILITY= JavaCore.CODEASSIST_VISIBILITY_CHECK; private final static String ENABLED= "enabled"; //$NON-NLS-1$ private final static String DISABLED= "disabled"; //$NON-NLS-1$ protected IWorkingCopyManager fManager; private IEditorPart fEditor; private ResultCollector fCollector; private IContextInformationValidator fValidator; private char[] fProposalAutoActivationSet; private JavaCompletionProposalComparator fComparator; private boolean fAllowAddImports; private TemplateEngine fTemplateEngine; private ExperimentalResultCollector fExperimentalCollector; private int fNumberOfComputedResults= 0; public JavaCompletionProcessor(IEditorPart editor) { fEditor= editor; fCollector= new ResultCollector(); fManager= JavaPlugin.getDefault().getWorkingCopyManager(); ContextType contextType= ContextTypeRegistry.getInstance().getContextType("java"); //$NON-NLS-1$ if (contextType != null) fTemplateEngine= new TemplateEngine(contextType); fExperimentalCollector= new ExperimentalResultCollector(); fAllowAddImports= true; fComparator= new JavaCompletionProposalComparator(); } /** * Sets this processor's set of characters triggering the activation of the * completion proposal computation. * * @param activationSet the activation set */ public void setCompletionProposalAutoActivationCharacters(char[] activationSet) { fProposalAutoActivationSet= activationSet; } /** * Tells this processor to restrict its proposal to those element * visible in the actual invocation context. * * @param restrict <code>true</code> if proposals should be restricted */ public void restrictProposalsToVisibility(boolean restrict) { Hashtable options= JavaCore.getOptions(); Object value= options.get(VISIBILITY); if (value instanceof String) { String newValue= restrict ? ENABLED : DISABLED; if ( !newValue.equals((String) value)) { options.put(VISIBILITY, newValue); JavaCore.setOptions(options); } } } /** * Tells this processor to order the proposals alphabetically. * * @param order <code>true</code> if proposals should be ordered. */ public void orderProposalsAlphabetically(boolean order) { fComparator.setOrderAlphabetically(order); } /** * Tells this processor to restrict is proposals to those * starting with matching cases. * * @param restrict <code>true</code> if proposals should be restricted */ public void restrictProposalsToMatchingCases(boolean restrict) { // not yet supported } /** * Tells this processor to add import statement for proposals that have * a fully qualified type name * * @param restrict <code>true</code> if import can be added */ public void allowAddingImports(boolean allowAddingImports) { fAllowAddImports= allowAddingImports; } /** * @see IContentAssistProcessor#getErrorMessage() */ public String getErrorMessage() { if (fNumberOfComputedResults == 0) return JavaUIMessages.getString("JavaEditor.codeassist.noCompletions"); //$NON-NLS-1$ if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES)) { return fExperimentalCollector.getErrorMessage(); } else { return fCollector.getErrorMessage(); } } /** * @see IContentAssistProcessor#getContextInformationValidator() */ public IContextInformationValidator getContextInformationValidator() { if (fValidator == null) fValidator= new JavaParameterListValidator(); return fValidator; } /** * @see IContentAssistProcessor#getContextInformationAutoActivationCharacters() */ public char[] getContextInformationAutoActivationCharacters() { return null; } /** * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() */ public char[] getCompletionProposalAutoActivationCharacters() { return fProposalAutoActivationSet; } private boolean looksLikeMethod(JavaCodeReader reader) throws IOException { int curr= reader.read(); while (curr != JavaCodeReader.EOF && Character.isWhitespace((char) curr)) curr= reader.read(); if (curr == JavaCodeReader.EOF) return false; return Character.isJavaIdentifierPart((char) curr) || Character.isJavaIdentifierStart((char) curr); } private int guessContextInformationPosition(ITextViewer viewer, int offset) { int contextPosition= offset; IDocument document= viewer.getDocument(); try { JavaCodeReader reader= new JavaCodeReader(); reader.configureBackwardReader(document, offset, true, true); int nestingLevel= 0; int curr= reader.read(); while (curr != JavaCodeReader.EOF) { if (')' == (char) curr) ++ nestingLevel; else if ('(' == (char) curr) { -- nestingLevel; if (nestingLevel < 0) { int start= reader.getOffset(); if (looksLikeMethod(reader)) return start + 1; } } curr= reader.read(); } } catch (IOException e) { } return contextPosition; } private List addContextInformations(ITextViewer viewer, int offset) { ICompletionProposal[] proposals= internalComputeCompletionProposals(viewer, offset, -1); List result= new ArrayList(); for (int i= 0; i < proposals.length; i++) { IContextInformation contextInformation= proposals[i].getContextInformation(); if (contextInformation != null) { ContextInformationWrapper wrapper= new ContextInformationWrapper(contextInformation); wrapper.setContextInformationPosition(offset); result.add(wrapper); } } return result; } /** * @see IContentAssistProcessor#computeContextInformation(ITextViewer, int) */ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { int contextInformationPosition= guessContextInformationPosition(viewer, offset); List result= addContextInformations(viewer, contextInformationPosition); return (IContextInformation[]) result.toArray(new IContextInformation[result.size()]); } /** * Order the given proposals. */ private ICompletionProposal[] order(ICompletionProposal[] proposals) { Arrays.sort(proposals, fComparator); return proposals; } /** * @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int) */ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { int contextInformationPosition= guessContextInformationPosition(viewer, offset); return internalComputeCompletionProposals(viewer, offset, contextInformationPosition); } private ICompletionProposal[] internalComputeCompletionProposals(ITextViewer viewer, int offset, int contextOffset) { ICompilationUnit unit= fManager.getWorkingCopy(fEditor.getEditorInput()); IJavaCompletionProposal[] results; ResultCollector collector; if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES)) { collector= fExperimentalCollector; } else { collector= fCollector; } try { if (unit != null) { collector.setPreventEating(false); collector.reset(offset, contextOffset, unit.getJavaProject(), fAllowAddImports ? unit : null); collector.setViewer(viewer); Point selection= viewer.getSelectedRange(); if (selection.y > 0) collector.setReplacementLength(selection.y); unit.codeComplete(offset, collector); } } catch (JavaModelException x) { Shell shell= viewer.getTextWidget().getShell(); ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus()); //$NON-NLS-2$ //$NON-NLS-1$ } results= collector.getResults(); if (fTemplateEngine != null) { try { fTemplateEngine.reset(); fTemplateEngine.complete(viewer, offset, unit); } catch (JavaModelException x) { Shell shell= viewer.getTextWidget().getShell(); ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus()); //$NON-NLS-2$ //$NON-NLS-1$ } TemplateProposal[] templateResults= fTemplateEngine.getResults(); // update relavance of template proposals that match with a keyword JavaCompletionProposal[] keyWordResults= collector.getKeywordCompletions(); for (int i= 0; i < keyWordResults.length; i++) { String keyword= keyWordResults[i].getReplacementString(); for (int k= 0; k < templateResults.length; k++) { TemplateProposal curr= templateResults[k]; if (keyword.equals(curr.getTemplate().getName())) { curr.setRelevance(keyWordResults[i].getRelevance()); } } } // concatenate arrays IJavaCompletionProposal[] total= new IJavaCompletionProposal[results.length + templateResults.length]; System.arraycopy(templateResults, 0, total, 0, templateResults.length); System.arraycopy(results, 0, total, templateResults.length, results.length); results= total; } fNumberOfComputedResults= (results == null ? 0 : results.length); /* * Order here and not in result collector to make sure that the order * applies to all proposals and not just those of the compilation unit. */ return order(results); } }
33,175
Bug 33175 Missing target in delete imports dialog
Problem Description: While browsing a class in the outline view, if the "delete" item from the context menu of the "import declarations" item is selected, the pop-up confirmation dialog asks 'Are you sure you want to delete ""?' (i.e 'import declarations' is missing between the quotes). Steps to Reproduce: 1. Open a Java perspective and reset it if necessary. 2. Select File->New->Project from the menu bar. 3. Highlight "Java" and "Java Project", and click "Next" 4. Enter "test" in the project name text field, and then click "Finish". A project called "test" will be created in the Package Explorer. Expand the item to see the sub-tree below it. Note that there is no "default package" item. 5. Make sure the "test" project is highlighted, and click on the "Create a new java class" button in the toolbar. A "Java Class" dialog opens. 6. Enter "ClassTest" in the "Name" text field. Click "Finish". A "(default package)" item is added below the "test" item, and an edit window containing ClassTest opens. 7. On the very first line of the class file, type "import java.util.*;" on a line by itself. The Outline View should now contain a "import declarations" item. 8. Left click on the "import declarations" item in the Outline view, and then right click it. Select "Delete" from the context menu. 9. !BUG! The pop-up confirmation window is missing the target between the quotes at the end of the question. Found in: OS: HP-UX 11.11. Eclipse: V2.1 Build Id: 200302061700 (M5)
closed fixed
074eb40
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T19:07:18Z
2003-02-26T00:40:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/DeleteSourceReferencesAction.java
package org.eclipse.jdt.internal.ui.reorg; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.PlatformUI; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.ISourceReference; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.corext.Assert; import org.eclipse.jdt.internal.corext.codemanipulation.GetterSetterUtil; import org.eclipse.jdt.internal.corext.refactoring.reorg.DeleteSourceReferenceEdit; import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgUtils; import org.eclipse.jdt.internal.corext.refactoring.reorg.SourceReferenceUtil; import org.eclipse.jdt.internal.corext.textmanipulation.TextBuffer; import org.eclipse.jdt.internal.corext.textmanipulation.TextBufferEditor; import org.eclipse.jdt.internal.corext.textmanipulation.TextEdit; import org.eclipse.jdt.internal.corext.util.WorkingCopyUtil; public class DeleteSourceReferencesAction extends SourceReferenceAction { private boolean fCanDeleteGetterSetter; private boolean fAskForDeleteConfirmation; public DeleteSourceReferencesAction(IWorkbenchSite site) { super(site); fCanDeleteGetterSetter= true; fAskForDeleteConfirmation= true; } public void setCanDeleteGetterSetter(boolean canDelete){ fCanDeleteGetterSetter= canDelete; } public void setAskForDeleteConfirmation(boolean ask){ fAskForDeleteConfirmation= ask; } protected void perform(IStructuredSelection selection) throws CoreException { if (fAskForDeleteConfirmation && !confirmDelete(selection)) return; try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(false, true, createDeleteOperation(selection)); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), ReorgMessages.getString("DeleteSourceReferenceAction.error.title"), ReorgMessages.getString("DeleteSourceReferenceAction.error.message")); //$NON-NLS-1$ //$NON-NLS-2$ } catch (InterruptedException e) { //nothing. action interrupted } } private IRunnableWithProgress createDeleteOperation(final IStructuredSelection selection){ return new IRunnableWithProgress(){ public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException { try { JavaCore.run(createDeleteRunnable(selection), pm); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { pm.done(); } } }; } private IWorkspaceRunnable createDeleteRunnable(final IStructuredSelection selection){ return new IWorkspaceRunnable(){ public void run(IProgressMonitor pm) throws CoreException { Map mapping= SourceReferenceUtil.groupByFile(getElementsToProcess(selection)); //IFile -> List of ISourceReference (elements from that file) int size= mapping.keySet().size(); pm.beginTask(ReorgMessages.getString("DeleteSourceReferenceAction.deleting"), 3 * size); //$NON-NLS-1$ if (areAllFilesReadOnly(mapping)){ String title= ReorgMessages.getString("DeleteSourceReferencesAction.title"); //$NON-NLS-1$ String label= ReorgMessages.getString("DeleteSourceReferencesAction.read_only"); //$NON-NLS-1$ MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), title, label); return; } List emptyCuList= Arrays.asList(getCusLeftEmpty(mapping)); for (Iterator iter= mapping.keySet().iterator(); iter.hasNext();) { IFile file= (IFile)iter.next(); if (emptyCuList.contains(JavaCore.create(file))) //do not delete in these files continue; if (isReadOnly(file)) continue; deleteAll(mapping, file, new SubProgressMonitor(pm, 1)); } ICompilationUnit[] notDeleted= deleteEmptyCus(mapping, new SubProgressMonitor(pm, size)); for (int i= 0; i < notDeleted.length; i++) { IFile file= (IFile)notDeleted[i].getResource(); if (isReadOnly(file)) continue; deleteAll(mapping, file, new SubProgressMonitor(pm, 1)); } } }; } private static boolean isReadOnly(IFile file){ if (! file.isReadOnly()) return false; if (ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{file}, null).isOK()) return false; return true; } private static boolean areAllFilesReadOnly(Map mapping){ for (Iterator iter= mapping.keySet().iterator(); iter.hasNext();) { if (! isReadOnly((IFile)iter.next())) return false; } return true; } private static void deleteAll(Map mapping, IFile file, IProgressMonitor pm) throws CoreException { List l= (List)mapping.get(file); ISourceReference[] refs= (ISourceReference[]) l.toArray(new ISourceReference[l.size()]); pm.beginTask("", refs.length); //$NON-NLS-1$ ISourceReference[] nonFields= getNonFields(refs); delete(file, nonFields, new SubProgressMonitor(pm, nonFields.length)); IField[] fields= getFields(refs); delete(fields, new SubProgressMonitor(pm, fields.length)); pm.done(); } private static void delete(IFile file, ISourceReference[] nonFields, IProgressMonitor pm) throws CoreException{ pm.beginTask("", 2); //$NON-NLS-1$ TextBuffer tb= TextBuffer.acquire(file); try{ TextBufferEditor tbe= new TextBufferEditor(tb); for (int i= 0; i < nonFields.length; i++) { Assert.isTrue(! (nonFields[i] instanceof IField)); tbe.add(createDeleteEdit(nonFields[i])); if (pm.isCanceled()) throw new OperationCanceledException(); } if (! tbe.canPerformEdits().isOK()) return; ///XXX can i assert here? tbe.performEdits(new SubProgressMonitor(pm, 1)); TextBuffer.commitChanges(tb, false, new SubProgressMonitor(pm, 1)); } finally{ if (tb != null) TextBuffer.release(tb); pm.done(); } } private static void delete(IField[] fields, IProgressMonitor pm) throws JavaModelException{ if (fields.length != 0) getJavaModel().delete(fields, false, pm); } private static IJavaModel getJavaModel() { return JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); } private static TextEdit createDeleteEdit(ISourceReference ref) throws JavaModelException{ ICompilationUnit cu= SourceReferenceUtil.getCompilationUnit(ref); cu.reconcile(); return new DeleteSourceReferenceEdit(ref, cu); } /** * returns cus that have <b>not</b> been deleted */ private ICompilationUnit[] deleteEmptyCus(Map mapping, IProgressMonitor pm) throws JavaModelException { ICompilationUnit[] cusToDelete= getCusLeftEmpty(mapping); if (cusToDelete.length == 0) return cusToDelete; if (! confirmCusDelete(cusToDelete)) return cusToDelete; List notDeletedCus= new ArrayList(); notDeletedCus.addAll(Arrays.asList(cusToDelete)); pm.beginTask("", cusToDelete.length); //$NON-NLS-1$ for (int i= 0; i < cusToDelete.length; i++) { if (isReadOnly(cusToDelete[i]) && (! isOkToDeleteReadOnly(cusToDelete[i]))) continue; cusToDelete[i].delete(false, new SubProgressMonitor(pm, 1)); notDeletedCus.remove(cusToDelete[i]); } pm.done(); return (ICompilationUnit[]) notDeletedCus.toArray(new ICompilationUnit[notDeletedCus.size()]); } private static boolean isReadOnly(ICompilationUnit cu) throws JavaModelException{ if (cu.isReadOnly()) return true; if (cu.getResource().isReadOnly()) return true; return false; } private static boolean isOkToDeleteReadOnly(ICompilationUnit cu){ String message= ReorgMessages.getFormattedString("DeleteSourceReferencesAction.cu_read_only", cu.getElementName());//$NON-NLS-1$ return MessageDialog.openQuestion(JavaPlugin.getActiveWorkbenchShell(), ReorgMessages.getString("DeleteSourceReferencesAction.delete1"), message); //$NON-NLS-1$ } /* * @param Map mapping //IFile -> List of ISourceReference (elements from that file) */ private static ICompilationUnit[] getCusLeftEmpty(Map mapping) throws JavaModelException{ List cuList= new ArrayList(); for (Iterator iter= mapping.keySet().iterator(); iter.hasNext();) { IFile file= (IFile) iter.next(); IJavaElement el= JavaCore.create(file); if (el == null || el.getElementType() != IJavaElement.COMPILATION_UNIT) continue; ICompilationUnit cu= (ICompilationUnit)el; List sourceReferences= (List)mapping.get(file); if (willBeLeftEmpty(cu, sourceReferences)) cuList.add(cu); } return (ICompilationUnit[]) cuList.toArray(new ICompilationUnit[cuList.size()]); } private static boolean willBeLeftEmpty(ICompilationUnit cu, List sourceReferences) throws JavaModelException{ IType[] cuTypes= WorkingCopyUtil.getWorkingCopyIfExists(cu).getTypes(); for (int i= 0; i < cuTypes.length; i++) { if (! sourceReferences.contains(cuTypes[i])) return false; } return true; } //overridden to add getters/setters protected ISourceReference[] getElementsToProcess(IStructuredSelection selection) { ISourceReference[] elements= super.getElementsToProcess(selection); if (! fCanDeleteGetterSetter) return elements; IField[] fields= getFields(elements); if (fields.length == 0) return elements; IMethod[] gettersSetters= getGettersSettersForFields(fields); if (gettersSetters.length == 0) return elements; Set getterSetterSet= new HashSet(Arrays.asList(gettersSetters)); getterSetterSet.removeAll(Arrays.asList(elements)); if (getterSetterSet.isEmpty()) return elements; if (! confirmGetterSetterDelete()) return elements; Set newElementSet= new HashSet(Arrays.asList(elements)); newElementSet.addAll(getterSetterSet); return (ISourceReference[]) newElementSet.toArray(new ISourceReference[newElementSet.size()]); } private static ISourceReference[] getNonFields(ISourceReference[] elements){ List nonFields= new ArrayList(); for (int i= 0; i < elements.length; i++) { if (! (elements[i] instanceof IField)) nonFields.add(elements[i]); } return (ISourceReference[]) nonFields.toArray(new ISourceReference[nonFields.size()]); } private static IField[] getFields(ISourceReference[] elements){ List fields= new ArrayList(); for (int i= 0; i < elements.length; i++) { if (elements[i] instanceof IField) fields.add(elements[i]); } return (IField[]) fields.toArray(new IField[fields.size()]); } private static IMethod[] getGettersSettersForFields(IField[] fields) { try { List gettersSetters= new ArrayList(); for (int i= 0; i < fields.length; i++) { IMethod getter= GetterSetterUtil.getGetter(fields[i]); if (getter != null && getter.exists()) gettersSetters.add(getter); IMethod setter= GetterSetterUtil.getSetter(fields[i]); if (setter != null && setter.exists()) gettersSetters.add(setter); } return (IMethod[]) gettersSetters.toArray(new IMethod[gettersSetters.size()]); } catch(JavaModelException e) { ExceptionHandler.handle(e, JavaPlugin.getActiveWorkbenchShell(), ReorgMessages.getString("DeleteSourceReferencesAction.delete_elements"), ReorgMessages.getString("DeleteSourceReferencesAction.exception")); //$NON-NLS-1$ //$NON-NLS-2$ return new IMethod[0]; } } private static boolean confirmDelete(IStructuredSelection selection) { String title= ReorgMessages.getString("deleteAction.confirm.title"); //$NON-NLS-1$ String label; if (selection.size() == 1){ String[] keys= {ReorgUtils.getName(selection.getFirstElement())}; label= ReorgMessages.getFormattedString("DeleteSourceReferencesAction.sure", keys); //$NON-NLS-1$ } else { String[] keys= {String.valueOf(selection.size())}; label= ReorgMessages.getFormattedString("DeleteSourceReferencesAction.sure_elements", keys); //$NON-NLS-1$ } return MessageDialog.openQuestion(JavaPlugin.getActiveWorkbenchShell(), title, label); } //made protected for ui-less testing protected boolean confirmCusDelete(ICompilationUnit[] cusToDelete) { String message; if (cusToDelete.length == 1){ message= ReorgMessages.getFormattedString("DeleteSourceReferencesAction.cu_empty", cusToDelete[0].getElementName());//$NON-NLS-1$ } else { message= ReorgMessages.getFormattedString("DeleteSourceReferencesAction.cus_empty", String.valueOf(cusToDelete.length));//$NON-NLS-1$ } return MessageDialog.openQuestion(JavaPlugin.getActiveWorkbenchShell(), ReorgMessages.getString("DeleteSourceReferencesAction.delete1"), message); //$NON-NLS-1$ } //made protected for ui-less testing protected boolean confirmGetterSetterDelete() { String title= ReorgMessages.getString("DeleteSourceReferencesAction.confirm_gs_delete"); //$NON-NLS-1$ String label= ReorgMessages.getString("DeleteSourceReferencesAction.delete_gs"); //$NON-NLS-1$ Shell parent= JavaPlugin.getActiveWorkbenchShell(); return MessageDialog.openQuestion(parent, title, label); } /* * @see SourceReferenceAction#canWorkOn(Object) */ protected boolean canWorkOn(Object element) throws JavaModelException { if (! super.canWorkOn(element)) return false; if (element instanceof IMember && ((IMember)element).isBinary()) return false; return true; } }
33,300
Bug 33300 Package Explorer->Refactor->Move does not allow non-Java projects as destination
Build id: 200302211557 Although you can see non-Java projects and resources on the Package Explorer view, when moving a resource (Refactor->Move), only Java projects are offered as options for destination. If I can use this option to move any resource (from the user perspective, it looks like the same move action - when working with non-Java resources - as offered by the Resource Navigator), I should be able to use it to move to any kind of project.
resolved fixed
3b7e759
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T19:38:39Z
2003-02-26T17:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/JdtMoveAction.java
package org.eclipse.jdt.internal.ui.reorg; import java.util.Iterator; import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.DialogSettings; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.MoveProjectAction; import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.JavaElementLabelProvider; import org.eclipse.jdt.ui.StandardJavaElementContentProvider; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.refactoring.QualifiedNameComponent; import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages; import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard; import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog; import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardPage; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.corext.refactoring.reorg.IPackageFragmentRootManipulationQuery; import org.eclipse.jdt.internal.corext.refactoring.reorg.MoveRefactoring; import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgRefactoring; import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgUtils; public class JdtMoveAction extends ReorgDestinationAction { public static final int PREVIEW_ID= IDialogConstants.CLIENT_ID + 1; private boolean fShowPreview= false; public JdtMoveAction(IWorkbenchSite site) { super(site); setText(ReorgMessages.getString("moveAction.label"));//$NON-NLS-1$ } protected void run(IStructuredSelection selection) { if (ClipboardActionUtil.hasOnlyProjects(selection)){ moveProject(selection); } else { super.run(selection); } } public static ElementTreeSelectionDialog makeDialog(Shell parent, MoveRefactoring refactoring) { StandardJavaElementContentProvider cp= new StandardJavaElementContentProvider() { public boolean hasChildren(Object element) { // prevent the + from being shown in front of packages return !(element instanceof IPackageFragment) && super.hasChildren(element); } }; MoveDestinationDialog dialog= new MoveDestinationDialog( parent, new DestinationRenderer(JavaElementLabelProvider.SHOW_SMALL_ICONS), cp, refactoring); return dialog; } /* non java-doc * see @ReorgDestinationAction#isOkToProceed */ String getActionName() { return ReorgMessages.getString("moveAction.name"); //$NON-NLS-1$ } /* non java-doc * see @ReorgDestinationAction#getDestinationDialogMessage */ String getDestinationDialogMessage() { return ReorgMessages.getString("moveAction.destination.label"); //$NON-NLS-1$ } /* non java-doc * see @ReorgDestinationAction#createRefactoring */ ReorgRefactoring createRefactoring(List elements){ IPackageFragmentRootManipulationQuery query= createUpdateClasspathQuery(getShell()); return new MoveRefactoring(elements, JavaPreferencesSettings.getCodeGenerationSettings(), query); } ElementTreeSelectionDialog createDestinationSelectionDialog(Shell parent, ILabelProvider labelProvider, StandardJavaElementContentProvider cp, ReorgRefactoring refactoring){ return new MoveDestinationDialog(parent, labelProvider, cp, (MoveRefactoring)refactoring); } /* non java-doc * see @ReorgDestinationAction#isOkToProceed */ protected boolean isOkToProceed(ReorgRefactoring refactoring) throws JavaModelException{ return isOkToMoveReadOnly(refactoring); } protected void setShowPreview(boolean showPreview) { fShowPreview = showPreview; } private static boolean isOkToMoveReadOnly(ReorgRefactoring refactoring){ if (! hasReadOnlyElements(refactoring)) return true; //we need to confirm this in all cases except for the case of moving cus to a package //Then, confirmation does not make sense because jcore throws an exception anyway if (refactoring.getDestination() instanceof IPackageFragment){ List list= refactoring.getElementsToReorg(); for (Iterator iter= list.iterator(); iter.hasNext();) { Object element= iter.next(); if (! (element instanceof ICompilationUnit)) return askIfOkToMoveReadOnly(); } return true; } else { return askIfOkToMoveReadOnly(); } } private static boolean askIfOkToMoveReadOnly(){ return MessageDialog.openQuestion( JavaPlugin.getActiveWorkbenchShell(), ReorgMessages.getString("moveAction.checkMove"), //$NON-NLS-1$ ReorgMessages.getString("moveAction.error.readOnly")); //$NON-NLS-1$ } private static boolean hasReadOnlyElements(ReorgRefactoring refactoring){ for (Iterator iter= refactoring.getElementsToReorg().iterator(); iter.hasNext(); ){ if (ReorgUtils.shouldConfirmReadOnly(iter.next())) return true; } return false; } protected Object openDialog(ElementTreeSelectionDialog dialog) { Object result= super.openDialog(dialog); if (dialog instanceof MoveDestinationDialog) { fShowPreview= dialog.getReturnCode() == PREVIEW_ID; } else { fShowPreview= false; } return result; } /* non java-doc * @see ReorgDestinationAction#doReorg(ReorgRefactoring) */ void reorg(ReorgRefactoring refactoring) throws JavaModelException{ if (fShowPreview){ openWizard(getShell(), refactoring); return; } else super.reorg(refactoring); } public static void openWizard(Shell parent, ReorgRefactoring refactoring) { //XX incorrect help RefactoringWizard wizard= new RefactoringWizard(refactoring, ReorgMessages.getString("JdtMoveAction.move"), IJavaHelpContextIds.MOVE_CU_ERROR_WIZARD_PAGE); //$NON-NLS-1$ wizard.setChangeCreationCancelable(false); new RefactoringWizardDialog(parent, wizard).open(); return; } private void moveProject(IStructuredSelection selection){ MoveProjectAction action= new MoveProjectAction(JavaPlugin.getActiveWorkbenchShell()); action.selectionChanged(selection); action.run(); } //--- static inner classes private static class MoveDestinationDialog extends ElementTreeSelectionDialog { private MoveRefactoring fRefactoring; private Button fReferenceCheckbox; private Button fQualifiedNameCheckbox; private QualifiedNameComponent fQualifiedNameComponent; private Button fPreview; MoveDestinationDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider, MoveRefactoring refactoring) { super(parent, labelProvider, contentProvider); fRefactoring= refactoring; setDoubleClickSelects(false); } protected void updateOKStatus() { super.updateOKStatus(); try{ Button okButton= getOkButton(); boolean okEnabled= okButton.getEnabled(); fRefactoring.setDestination(getFirstResult()); fReferenceCheckbox.setEnabled(okEnabled && canUpdateReferences()); fRefactoring.setUpdateReferences(fReferenceCheckbox.getEnabled() && fReferenceCheckbox.getSelection()); if (fQualifiedNameCheckbox != null) { boolean enabled= okEnabled && fRefactoring.canEnableQualifiedNameUpdating(); fQualifiedNameCheckbox.setEnabled(enabled); if (enabled) { fQualifiedNameComponent.setEnabled(fRefactoring.getUpdateQualifiedNames()); if (fRefactoring.getUpdateQualifiedNames()) okButton.setEnabled(false); } else { fQualifiedNameComponent.setEnabled(false); } fRefactoring.setUpdateQualifiedNames(fQualifiedNameCheckbox.getEnabled() && fQualifiedNameCheckbox.getSelection()); } boolean preview= okEnabled; if (preview) preview= fRefactoring.getUpdateQualifiedNames() && fRefactoring.canEnableQualifiedNameUpdating() || fReferenceCheckbox.getSelection() && fRefactoring.canUpdateReferences(); fPreview.setEnabled(preview); } catch (JavaModelException e){ ExceptionHandler.handle(e, ReorgMessages.getString("JdtMoveAction.move"), ReorgMessages.getString("JdtMoveAction.exception")); //$NON-NLS-1$ //$NON-NLS-2$ } } protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); if (buttonId == PREVIEW_ID) { setReturnCode(PREVIEW_ID); close(); } } protected void configureShell(Shell newShell) { super.configureShell(newShell); WorkbenchHelp.setHelp(newShell, IJavaHelpContextIds.MOVE_DESTINATION_DIALOG); } protected void createButtonsForButtonBar(Composite parent) { fPreview= createButton(parent, PREVIEW_ID, ReorgMessages.getString("JdtMoveAction.preview"), false); //$NON-NLS-1$ super.createButtonsForButtonBar(parent); } protected Control createDialogArea(Composite parent) { Composite result= (Composite)super.createDialogArea(parent); addUpdateReferenceComponent(result); addUpdateQualifiedNameComponent(result, ((GridLayout)result.getLayout()).marginWidth); return result; } private void addUpdateReferenceComponent(Composite result) { fReferenceCheckbox= new Button(result, SWT.CHECK); fReferenceCheckbox.setText(ReorgMessages.getString("JdtMoveAction.update_references")); //$NON-NLS-1$ fReferenceCheckbox.setSelection(fRefactoring.getUpdateReferences()); fReferenceCheckbox.setEnabled(canUpdateReferences()); fReferenceCheckbox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fRefactoring.setUpdateReferences(((Button)e.widget).getSelection()); updateOKStatus(); } }); } private boolean canUpdateReferences() { try{ return fRefactoring.canUpdateReferences(); } catch (JavaModelException e){ return false; } } private void addUpdateQualifiedNameComponent(Composite parent, int marginWidth) { if (!fRefactoring.canUpdateQualifiedNames()) return; fQualifiedNameCheckbox= new Button(parent, SWT.CHECK); int indent= marginWidth + fQualifiedNameCheckbox.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; fQualifiedNameCheckbox.setText(RefactoringMessages.getString("RenameInputWizardPage.update_qualified_names")); //$NON-NLS-1$ fQualifiedNameCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fQualifiedNameCheckbox.setSelection(fRefactoring.getUpdateQualifiedNames()); fQualifiedNameComponent= new QualifiedNameComponent(parent, SWT.NONE, fRefactoring, getRefactoringSettings()); fQualifiedNameComponent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData gd= (GridData)fQualifiedNameComponent.getLayoutData(); gd.horizontalAlignment= GridData.FILL; gd.horizontalIndent= indent; fQualifiedNameComponent.setEnabled(false); fQualifiedNameCheckbox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean enabled= ((Button)e.widget).getSelection(); fQualifiedNameComponent.setEnabled(enabled); fRefactoring.setUpdateQualifiedNames(enabled); updateOKStatus(); } }); } protected IDialogSettings getRefactoringSettings() { IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings(); if (settings == null) return null; IDialogSettings result= settings.getSection(RefactoringWizardPage.REFACTORING_SETTINGS); if (result == null) { result= new DialogSettings(RefactoringWizardPage.REFACTORING_SETTINGS); settings.addSection(result); } return result; } public boolean close() { if (getReturnCode() != IDialogConstants.CANCEL_ID && fQualifiedNameComponent != null) { fQualifiedNameComponent.savePatterns(getRefactoringSettings()); } return super.close(); } } public static IPackageFragmentRootManipulationQuery createUpdateClasspathQuery(Shell shell){ String messagePattern= ReorgMessages.getString("JdtMoveAction.referenced") + //$NON-NLS-1$ ReorgMessages.getString("JdtMoveAction.update_classpath"); //$NON-NLS-1$ return new PackageFragmentRootManipulationQuery(shell, ReorgMessages.getString("JdtMoveAction.Move"), messagePattern); //$NON-NLS-1$ } }
33,300
Bug 33300 Package Explorer->Refactor->Move does not allow non-Java projects as destination
Build id: 200302211557 Although you can see non-Java projects and resources on the Package Explorer view, when moving a resource (Refactor->Move), only Java projects are offered as options for destination. If I can use this option to move any resource (from the user perspective, it looks like the same move action - when working with non-Java resources - as offered by the Resource Navigator), I should be able to use it to move to any kind of project.
resolved fixed
3b7e759
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T19:38:39Z
2003-02-26T17:20:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/ReorgDestinationAction.java
32,654
Bug 32654 [Refactoring] Change method signature with problems
2.1 I20030214 I observed some problems when using the "Change method signature" refactoring. This seems to happen when the original method signature includes an array parameter. Problem: I introduced a new method parameter of type boolean with default value set to true. Previewing the changes, I had to realize that the resulting code was incorrect in _some_ cases. Example: x.method(anObject, new Object[]{ anotherObject }, Integer.MAX_VALUE, false); became x.method(anObject, new Object[]{ anotherObject }, Integer.MAX_VALUEtrue, false);
resolved fixed
7a7a396
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T23:03:13Z
2003-02-24T15:20:00Z
org.eclipse.jdt.ui/core
32,654
Bug 32654 [Refactoring] Change method signature with problems
2.1 I20030214 I observed some problems when using the "Change method signature" refactoring. This seems to happen when the original method signature includes an array parameter. Problem: I introduced a new method parameter of type boolean with default value set to true. Previewing the changes, I had to realize that the resulting code was incorrect in _some_ cases. Example: x.method(anObject, new Object[]{ anotherObject }, Integer.MAX_VALUE, false); became x.method(anObject, new Object[]{ anotherObject }, Integer.MAX_VALUEtrue, false);
resolved fixed
7a7a396
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T23:03:13Z
2003-02-24T15:20:00Z
extension/org/eclipse/jdt/internal/corext/dom/ASTRewriteAnalyzer.java
32,917
Bug 32917 the "Change to Constructor" QF deletes my code.
RC1: - create class C - create method "int C()" int C() { return 19*19; } - use QF to "Change method to constructor" Observe: return statement is removed - add "if (true) return 123;" as the first line of method C() - use QF again Observe: no return statement is removed.
resolved fixed
82fbcff
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T23:09:39Z
2003-02-25T10:46:40Z
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ReturnTypeQuickFixTest.java
package org.eclipse.jdt.ui.tests.quickfix; import java.util.ArrayList; import java.util.Hashtable; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.testplugin.JavaProjectHelper; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.text.correction.ASTRewriteCorrectionProposal; import org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal; import org.eclipse.jdt.internal.ui.text.correction.CorrectionContext; import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; public class ReturnTypeQuickFixTest extends QuickFixTest { private static final Class THIS= ReturnTypeQuickFixTest.class; private IJavaProject fJProject1; private IPackageFragmentRoot fSourceFolder; public ReturnTypeQuickFixTest(String name) { super(name); } public static Test suite() { if (true) { return new TestSuite(THIS); } else { TestSuite suite= new TestSuite(); suite.addTest(new ReturnTypeQuickFixTest("testMethodWithConstructorName")); return suite; } } protected void setUp() throws Exception { Hashtable options= JavaCore.getDefaultOptions(); options.put(JavaCore.FORMATTER_TAB_CHAR, JavaCore.SPACE); options.put(JavaCore.FORMATTER_TAB_SIZE, "4"); JavaCore.setOptions(options); IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false); fJProject1= JavaProjectHelper.createJavaProject("TestProject1", "bin"); assertTrue("rt not found", JavaProjectHelper.addRTJar(fJProject1) != null); fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src"); } protected void tearDown() throws Exception { JavaProjectHelper.delete(fJProject1); } public void testSimpleTypeReturnDeclMissing() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Vector;\n"); buf.append("public class E {\n"); buf.append(" public foo() {\n"); buf.append(" return (new Vector()).elements();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); boolean addReturnType= true, doRename= true; for (int i= 0; i < proposals.size(); i++) { Object elem= proposals.get(i); if (elem instanceof ASTRewriteCorrectionProposal) { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) elem; assertTrue("duplicated entries", addReturnType); addReturnType= false; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Enumeration;\n"); buf.append("import java.util.Vector;\n"); buf.append("public class E {\n"); buf.append(" public Enumeration foo() {\n"); buf.append(" return (new Vector()).elements();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } else { assertTrue("duplicated entries", doRename); doRename= false; CUCorrectionProposal proposal= (CUCorrectionProposal) elem; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Vector;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return (new Vector()).elements();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } } public void testVoidTypeReturnDeclMissing() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public foo() {\n"); buf.append(" //do nothing\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); boolean addReturnType= true, doRename= true; for (int i= 0; i < proposals.size(); i++) { Object elem= proposals.get(i); if (elem instanceof ASTRewriteCorrectionProposal) { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) elem; assertTrue("duplicated entries", addReturnType); addReturnType= false; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo() {\n"); buf.append(" //do nothing\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } else { assertTrue("duplicated entries", doRename); doRename= false; CUCorrectionProposal proposal= (CUCorrectionProposal) elem; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" //do nothing\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } } public void testVoidTypeReturnDeclMissing2() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public foo() {\n"); buf.append(" if (true) {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); boolean addReturnType= true, doRename= true; for (int i= 0; i < proposals.size(); i++) { Object elem= proposals.get(i); if (elem instanceof ASTRewriteCorrectionProposal) { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) elem; assertTrue("duplicated entries", addReturnType); addReturnType= false; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo() {\n"); buf.append(" if (true) {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } else { assertTrue("duplicated entries", doRename); doRename= false; CUCorrectionProposal proposal= (CUCorrectionProposal) elem; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" if (true) {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } } public void testVoidMissingInAnonymousType() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo() {\n"); buf.append(" Runnable run= new Runnable() {\n"); buf.append(" public void run() {\n"); buf.append(" }\n"); buf.append(" public foo() {\n"); buf.append(" }\n"); buf.append(" };\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void foo() {\n"); buf.append(" Runnable run= new Runnable() {\n"); buf.append(" public void run() {\n"); buf.append(" }\n"); buf.append(" public void foo() {\n"); buf.append(" }\n"); buf.append(" };\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testNullTypeReturnDeclMissing() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public foo() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); boolean addReturnType= true, doRename= true; for (int i= 0; i < proposals.size(); i++) { Object elem= proposals.get(i); if (elem instanceof ASTRewriteCorrectionProposal) { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) elem; assertTrue("duplicated entries", addReturnType); addReturnType= false; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public Object foo() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } else { assertTrue("duplicated entries", doRename); doRename= false; CUCorrectionProposal proposal= (CUCorrectionProposal) elem; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } } public void testArrayTypeReturnDeclMissing() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public foo() {\n"); buf.append(" return new int[][] { { 1, 2 }, { 2, 3 } };\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); boolean addReturnType= true, doRename= true; for (int i= 0; i < proposals.size(); i++) { Object elem= proposals.get(i); if (elem instanceof ASTRewriteCorrectionProposal) { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) elem; assertTrue("duplicated entries", addReturnType); addReturnType= false; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int[][] foo() {\n"); buf.append(" return new int[][] { { 1, 2 }, { 2, 3 } };\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } else { assertTrue("duplicated entries", doRename); doRename= false; CUCorrectionProposal proposal= (CUCorrectionProposal) elem; String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return new int[][] { { 1, 2 }, { 2, 3 } };\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } } public void testVoidMethodReturnsStatement() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Vector;\n"); buf.append("public class E {\n"); buf.append(" Vector fList= new Vector();\n"); buf.append(" public void elements() {\n"); buf.append(" return fList.toArray();\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Vector;\n"); buf.append("public class E {\n"); buf.append(" Vector fList= new Vector();\n"); buf.append(" public Object[] elements() {\n"); buf.append(" return fList.toArray();\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(1); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Vector;\n"); buf.append("public class E {\n"); buf.append(" Vector fList= new Vector();\n"); buf.append(" public void elements() {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } public void testVoidMethodReturnsAnonymClass() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void getOperation() {\n"); buf.append(" return new Runnable() {\n"); buf.append(" public void run() {}\n"); buf.append(" };\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public Runnable getOperation() {\n"); buf.append(" return new Runnable() {\n"); buf.append(" public void run() {}\n"); buf.append(" };\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(1); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public void getOperation() {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } public void testConstructorReturnsValue() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Arrays;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" return Arrays.asList(null);\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 2); assertCorrectLabels(proposals); { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Arrays;\n"); buf.append("import java.util.List;\n"); buf.append("public class E {\n"); buf.append(" public List E() {\n"); buf.append(" return Arrays.asList(null);\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } { ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(1); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("import java.util.Arrays;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } } public void testCorrectReturnStatement() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public Runnable getOperation() {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public Runnable getOperation() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testCorrectReturnStatementForArray() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int[][] getArray() {\n"); buf.append(" return;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int[][] getArray() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testMethodWithConstructorName() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int[][] E() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public E() {\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testMissingReturnStatement() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int[][] getArray() {\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int[][] getArray() {\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } public void testMissingReturnStatementWithCode() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int getArray()[] {\n"); buf.append(" if (true) {\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertNumberOf("problems", problems.length, 1); CorrectionContext context= getCorrectionContext(cu, problems[0]); assertCorrectContext(context); ArrayList proposals= new ArrayList(); JavaCorrectionProcessor.collectCorrections(context, proposals); assertNumberOf("proposals", proposals.size(), 1); assertCorrectLabels(proposals); ASTRewriteCorrectionProposal proposal= (ASTRewriteCorrectionProposal) proposals.get(0); String preview= proposal.getCompilationUnitChange().getPreviewContent(); buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append(" public int getArray()[] {\n"); buf.append(" if (true) {\n"); buf.append(" }\n"); buf.append(" return null;\n"); buf.append(" }\n"); buf.append("}\n"); assertEqualString(preview, buf.toString()); } }
32,917
Bug 32917 the "Change to Constructor" QF deletes my code.
RC1: - create class C - create method "int C()" int C() { return 19*19; } - use QF to "Change method to constructor" Observe: return statement is removed - add "if (true) return 123;" as the first line of method C() - use QF again Observe: no return statement is removed.
resolved fixed
82fbcff
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T23:09:39Z
2003-02-25T10:46:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ReturnTypeSubProcessor.java
package org.eclipse.jdt.internal.ui.text.correction; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.BodyDeclaration; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.PrimitiveType; import org.eclipse.jdt.core.dom.ReturnStatement; import org.eclipse.jdt.core.dom.Type; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jdt.internal.corext.dom.ASTRewrite; import org.eclipse.jdt.internal.ui.JavaPluginImages; /** */ public class ReturnTypeSubProcessor { private static class ReturnStatementCollector extends ASTVisitor { private ArrayList fResult= new ArrayList(); public Iterator returnStatements() { return fResult.iterator(); } public ITypeBinding getTypeBinding(AST ast) { boolean couldBeObject= false; for (int i= 0; i < fResult.size(); i++) { ReturnStatement node= (ReturnStatement) fResult.get(i); Expression expr= node.getExpression(); if (expr != null) { ITypeBinding binding= ASTResolving.normalizeTypeBinding(expr.resolveTypeBinding()); if (binding != null) { return binding; } else { couldBeObject= true; } } else { return ast.resolveWellKnownType("void"); //$NON-NLS-1$ } } if (couldBeObject) { return ast.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ } return ast.resolveWellKnownType("void"); //$NON-NLS-1$ } public boolean visit(ReturnStatement node) { fResult.add(node); return false; } public boolean visit(AnonymousClassDeclaration node) { return false; } public boolean visit(TypeDeclaration node) { return false; } } public static void addMethodWithConstrNameProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode instanceof MethodDeclaration) { MethodDeclaration declaration= (MethodDeclaration) selectedNode; ASTRewrite rewrite= new ASTRewrite(declaration); rewrite.markAsRemoved(declaration.getReturnType()); ReturnStatementCollector collector= new ReturnStatementCollector(); declaration.accept(collector); for (Iterator iter= collector.returnStatements(); iter.hasNext();) { rewrite.markAsRemoved((ASTNode) iter.next()); } String label= CorrectionMessages.getString("ReturnTypeSubProcessor.constrnamemethod.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addVoidMethodReturnsProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (decl instanceof MethodDeclaration && selectedNode.getNodeType() == ASTNode.RETURN_STATEMENT) { ReturnStatement returnStatement= (ReturnStatement) selectedNode; Expression expr= returnStatement.getExpression(); if (expr != null) { ITypeBinding binding= ASTResolving.normalizeTypeBinding(expr.resolveTypeBinding()); if (binding == null) { binding= selectedNode.getAST().resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ } MethodDeclaration methodDeclaration= (MethodDeclaration) decl; ASTRewrite rewrite= new ASTRewrite(methodDeclaration); Type newReturnType= ASTResolving.getTypeFromTypeBinding(astRoot.getAST(), binding); if (methodDeclaration.isConstructor()) { MethodDeclaration modifiedNode= astRoot.getAST().newMethodDeclaration(); modifiedNode.setModifiers(methodDeclaration.getModifiers()); // no changes modifiedNode.setExtraDimensions(methodDeclaration.getExtraDimensions()); // no changes modifiedNode.setConstructor(false); rewrite.markAsModified(methodDeclaration, modifiedNode); methodDeclaration.setReturnType(newReturnType); rewrite.markAsInserted(newReturnType); } else { rewrite.markAsReplaced(methodDeclaration.getReturnType(), newReturnType); } String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.voidmethodreturns.description", binding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(binding); proposal.ensureNoModifications(); proposals.add(proposal); } ASTRewrite rewrite= new ASTRewrite(decl); rewrite.markAsRemoved(returnStatement); String label= CorrectionMessages.getString("ReturnTypeSubProcessor.removereturn.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addMissingReturnTypeProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (decl instanceof MethodDeclaration) { MethodDeclaration methodDeclaration= (MethodDeclaration) decl; ReturnStatementCollector eval= new ReturnStatementCollector(); decl.accept(eval); ITypeBinding typeBinding= eval.getTypeBinding(decl.getAST()); ASTRewrite rewrite= new ASTRewrite(methodDeclaration); AST ast= astRoot.getAST(); Type type; String typeName; if (typeBinding != null) { type= ASTResolving.getTypeFromTypeBinding(ast, typeBinding); typeName= typeBinding.getName(); } else { type= ast.newPrimitiveType(PrimitiveType.VOID); typeName= "void"; //$NON-NLS-1$ } String label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.missingreturntype.description", typeName); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); if (typeBinding != null) { proposal.addImport(typeBinding); } rewrite.markAsInserted(type); methodDeclaration.setReturnType(type); MethodDeclaration modifiedNode= ast.newMethodDeclaration(); modifiedNode.setModifiers(methodDeclaration.getModifiers()); // no changes modifiedNode.setExtraDimensions(methodDeclaration.getExtraDimensions()); // no changes modifiedNode.setConstructor(false); rewrite.markAsModified(methodDeclaration, modifiedNode); proposal.ensureNoModifications(); proposals.add(proposal); // change to constructor ASTNode parentType= ASTResolving.findParentType(decl); if (parentType instanceof TypeDeclaration) { String constructorName= ((TypeDeclaration) parentType).getName().getIdentifier(); ASTNode nameNode= methodDeclaration.getName(); label= CorrectionMessages.getFormattedString("ReturnTypeSubProcessor.wrongconstructorname.description", constructorName); //$NON-NLS-1$ proposals.add(new ReplaceCorrectionProposal(label, cu, nameNode.getStartPosition(), nameNode.getLength(), constructorName, 1)); } } } /** * Method addMissingReturnStatementProposals. * @param context * @param proposals */ public static void addMissingReturnStatementProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (decl instanceof MethodDeclaration) { MethodDeclaration methodDecl= (MethodDeclaration) decl; if (selectedNode instanceof ReturnStatement) { ReturnStatement returnStatement= (ReturnStatement) selectedNode; if (returnStatement.getExpression() == null) { ASTRewrite rewrite= new ASTRewrite(methodDecl); Expression expression= ASTResolving.getInitExpression(methodDecl.getReturnType(), methodDecl.getExtraDimensions()); if (expression != null) { returnStatement.setExpression(expression); rewrite.markAsInserted(expression); } Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); String label= CorrectionMessages.getString("ReturnTypeSubProcessor.changereturnstatement.description"); //$NON-NLS-1$ ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 3, image); proposal.ensureNoModifications(); proposals.add(proposal); } } else { Block block= methodDecl.getBody(); if (block == null) { return; } AST ast= methodDecl.getAST(); ASTRewrite rewrite= new ASTRewrite(methodDecl); List statements= block.statements(); ReturnStatement returnStatement= ast.newReturnStatement(); returnStatement.setExpression(ASTResolving.getInitExpression(methodDecl.getReturnType(), methodDecl.getExtraDimensions())); statements.add(returnStatement); rewrite.markAsInserted(returnStatement); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); String label= CorrectionMessages.getString("ReturnTypeSubProcessor.addreturnstatement.description"); //$NON-NLS-1$ ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 3, image); proposal.ensureNoModifications(); proposals.add(proposal); } } } }
32,953
Bug 32953 wording of "remove" QF
RC1 - enable warnings for unused methods - add a (unused) private method xxx to a class - open QF Observe: the only quickfix listed is a very brief "remove". Since "remove" is a potentially dangerous operation, it would be good to explicitely state what gets removed, like "remove unused method" or even better "remove unused method xxx".
resolved fixed
daf62e0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-03T23:30:14Z
2003-02-25T13:33:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation * Renaud Waldura &lt;[email protected]&gt; - Access to static proposal ******************************************************************************/ package org.eclipse.jdt.internal.ui.text.correction; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.text.IDocument; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.core.dom.PrimitiveType.Code; import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings; import org.eclipse.jdt.internal.corext.codemanipulation.ImportEdit; import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility; import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.ASTRewrite; import org.eclipse.jdt.internal.corext.dom.Selection; import org.eclipse.jdt.internal.corext.refactoring.changes.CompilationUnitChange; import org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring; import org.eclipse.jdt.internal.corext.refactoring.nls.NLSUtil; import org.eclipse.jdt.internal.corext.refactoring.surround.ExceptionAnalyzer; import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring; import org.eclipse.jdt.internal.corext.textmanipulation.TextEdit; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter; import org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard; /** */ public class LocalCorrectionsSubProcessor { public static void addCastProposals(ICorrectionContext context, List proposals) throws CoreException { String[] args= context.getProblemArguments(); if (args.length != 2) { return; } ICompilationUnit cu= context.getCompilationUnit(); String castType= args[1]; CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (!(selectedNode instanceof Expression)) { return; } Expression nodeToCast= (Expression) selectedNode; int parentNodeType= selectedNode.getParent().getNodeType(); if (parentNodeType == ASTNode.ASSIGNMENT) { Assignment assign= (Assignment) selectedNode.getParent(); if (selectedNode.equals(assign.getLeftHandSide())) { nodeToCast= assign.getRightHandSide(); } } else if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { VariableDeclarationFragment frag= (VariableDeclarationFragment) selectedNode.getParent(); if (selectedNode.equals(frag.getName())) { nodeToCast= frag.getInitializer(); } } ASTRewriteCorrectionProposal castProposal= getCastProposal(context, castType, nodeToCast); if (castProposal != null) { proposals.add(castProposal); } // change method return statement to actual type if (parentNodeType == ASTNode.RETURN_STATEMENT) { ITypeBinding binding= nodeToCast.resolveTypeBinding(); BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (binding != null && decl instanceof MethodDeclaration) { MethodDeclaration methodDeclaration= (MethodDeclaration) decl; binding= ASTResolving.normalizeTypeBinding(binding); if (binding == null) { binding= astRoot.getAST().resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$ } ASTRewrite rewrite= new ASTRewrite(methodDeclaration); Type newReturnType= ASTResolving.getTypeFromTypeBinding(astRoot.getAST(), binding); rewrite.markAsReplaced(methodDeclaration.getReturnType(), newReturnType); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changereturntype.description", binding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(binding); proposal.ensureNoModifications(); proposals.add(proposal); } } if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { VariableDeclarationFragment fragment= (VariableDeclarationFragment) selectedNode.getParent(); ASTNode parent= fragment.getParent(); Type type= null; if (parent instanceof VariableDeclarationStatement) { VariableDeclarationStatement stmt= (VariableDeclarationStatement) parent; if (stmt.fragments().size() == 1) { type= stmt.getType(); } } else if (parent instanceof FieldDeclaration) { FieldDeclaration decl= (FieldDeclaration) parent; if (decl.fragments().size() == 1) { type= decl.getType(); } } if (type != null) { ImportEdit edit= new ImportEdit(cu, JavaPreferencesSettings.getCodeGenerationSettings()); String typeName= edit.addImport(args[0]); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast_var.description", typeName); //$NON-NLS-1$ ReplaceCorrectionProposal varProposal= new ReplaceCorrectionProposal(label, cu, type.getStartPosition(), type.getLength(), typeName, 1); varProposal.getRootTextEdit().add(edit); proposals.add(varProposal); } } } private static boolean canCast(String castTarget, ITypeBinding bindingToCast) { bindingToCast= ASTResolving.normalizeTypeBinding(bindingToCast); if (bindingToCast == null) { return false; } int arrStart= castTarget.indexOf('['); if (arrStart != -1) { if (!bindingToCast.isArray()) { return "java.lang.Object".equals(bindingToCast.getQualifiedName()); //$NON-NLS-1$ } castTarget= castTarget.substring(0, arrStart); bindingToCast= bindingToCast.getElementType(); if (bindingToCast.isPrimitive() && !castTarget.equals(bindingToCast.getName())) { return false; // can't cast arrays of primitive types into each other } } Code targetCode= PrimitiveType.toCode(castTarget); if (bindingToCast.isPrimitive()) { Code castCode= PrimitiveType.toCode(bindingToCast.getName()); if (castCode == targetCode) { return true; } return (targetCode != null && targetCode != PrimitiveType.BOOLEAN && castCode != PrimitiveType.BOOLEAN); } else { return targetCode == null; } } public static ASTRewriteCorrectionProposal getCastProposal(ICorrectionContext context, String castType, Expression nodeToCast) throws CoreException { ITypeBinding binding= nodeToCast.resolveTypeBinding(); if (binding != null && !canCast(castType, binding)) { return null; } ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTRewrite rewrite= new ASTRewrite(nodeToCast.getParent()); String label; Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal("", cu, rewrite, 1, image); //$NON-NLS-1$ String simpleCastType= proposal.addImport(castType); if (nodeToCast.getNodeType() == ASTNode.CAST_EXPRESSION) { label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changecast.description", castType); //$NON-NLS-1$ CastExpression expression= (CastExpression) nodeToCast; rewrite.markAsReplaced(expression.getType(), rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE)); } else { label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast.description", castType); //$NON-NLS-1$ Expression expressionCopy= (Expression) rewrite.createCopy(nodeToCast); int nodeType= nodeToCast.getNodeType(); if (nodeType == ASTNode.INFIX_EXPRESSION || nodeType == ASTNode.CONDITIONAL_EXPRESSION || nodeType == ASTNode.ASSIGNMENT || nodeType == ASTNode.INSTANCEOF_EXPRESSION) { // nodes have weaker precedence than cast ParenthesizedExpression parenthesizedExpression= astRoot.getAST().newParenthesizedExpression(); parenthesizedExpression.setExpression(expressionCopy); expressionCopy= parenthesizedExpression; } Type typeCopy= (Type) rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE); CastExpression castExpression= astRoot.getAST().newCastExpression(); castExpression.setExpression(expressionCopy); castExpression.setType(typeCopy); rewrite.markAsReplaced(nodeToCast, castExpression); } proposal.setDisplayName(label); proposal.ensureNoModifications(); return proposal; } public static void addUncaughtExceptionProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } while (selectedNode != null && !(selectedNode instanceof Statement)) { selectedNode= selectedNode.getParent(); } if (selectedNode == null) { return; } CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings(); SurroundWithTryCatchRefactoring refactoring= new SurroundWithTryCatchRefactoring(cu, selectedNode.getStartPosition(), selectedNode.getLength(), settings, null); refactoring.setSaveChanges(false); if (refactoring.checkActivationBasics(astRoot, null).isOK()) { String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.surroundwith.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); CUCorrectionProposal proposal= new CUCorrectionProposal(label, (CompilationUnitChange) refactoring.createChange(null), 4, image); proposals.add(proposal); } BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode); if (decl == null) { return; } ITypeBinding[] uncaughtExceptions= ExceptionAnalyzer.perform(decl, Selection.createFromStartLength(selectedNode.getStartPosition(), selectedNode.getLength())); if (uncaughtExceptions.length == 0) { return; } TryStatement surroundingTry= ASTResolving.findParentTryStatement(selectedNode); if (surroundingTry != null && ASTNodes.isParent(selectedNode, surroundingTry.getBody())) { ASTRewrite rewrite= new ASTRewrite(surroundingTry); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addadditionalcatch.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 5, image); AST ast= astRoot.getAST(); List catchClauses= surroundingTry.catchClauses(); for (int i= 0; i < uncaughtExceptions.length; i++) { ITypeBinding excBinding= uncaughtExceptions[i]; String varName= "e"; //$NON-NLS-1$ String imp= proposal.addImport(excBinding); Name name= ASTNodeFactory.newName(ast, imp); SingleVariableDeclaration var= ast.newSingleVariableDeclaration(); var.setName(ast.newSimpleName(varName)); var.setType(ast.newSimpleType(name)); CatchClause newClause= ast.newCatchClause(); newClause.setException(var); String catchBody = StubUtility.getCatchBodyContent(cu, excBinding.getName(), varName); if (catchBody != null) { ASTNode node= rewrite.createPlaceholder(catchBody, ASTRewrite.STATEMENT); newClause.getBody().statements().add(node); } rewrite.markAsInserted(newClause); catchClauses.add(newClause); } proposal.ensureNoModifications(); proposals.add(proposal); } if (decl instanceof MethodDeclaration) { ASTRewrite rewrite= new ASTRewrite(astRoot); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); AST ast= astRoot.getAST(); MethodDeclaration methodDecl= (MethodDeclaration) decl; List exceptions= methodDecl.thrownExceptions(); for (int i= 0; i < uncaughtExceptions.length; i++) { String imp= proposal.addImport(uncaughtExceptions[i]); Name name= ASTNodeFactory.newName(ast, imp); rewrite.markAsInserted(name); exceptions.add(name); } for (int i= 0; i < exceptions.size(); i++) { Name elem= (Name) exceptions.get(i); if (canRemove(elem.resolveTypeBinding(), uncaughtExceptions)) { rewrite.markAsRemoved(elem); } } proposal.ensureNoModifications(); proposals.add(proposal); } } private static boolean canRemove(ITypeBinding curr, ITypeBinding[] addedExceptions) { while (curr != null) { for (int i= 0; i < addedExceptions.length; i++) { if (curr == addedExceptions[i]) { return true; } } curr= curr.getSuperclass(); } return false; } public static void addUnreachableCatchProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } if (selectedNode.getNodeType() == ASTNode.BLOCK && selectedNode.getParent().getNodeType() == ASTNode.CATCH_CLAUSE ) { CatchClause clause= (CatchClause) selectedNode.getParent(); TryStatement tryStatement= (TryStatement) clause.getParent(); ASTRewrite rewrite= new ASTRewrite(tryStatement.getParent()); if (tryStatement.catchClauses().size() > 1 || tryStatement.getFinally() != null) { rewrite.markAsRemoved(clause); } else { List statements= tryStatement.getBody().statements(); if (statements.size() > 0) { ASTNode placeholder= rewrite.createCopy((ASTNode) statements.get(0), (ASTNode) statements.get(statements.size() - 1)); rewrite.markAsReplaced(tryStatement, placeholder); } else { rewrite.markAsRemoved(tryStatement); } } String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removecatchclause.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addNLSProposals(ICorrectionContext context, List proposals) throws CoreException { final ICompilationUnit cu= context.getCompilationUnit(); String name= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.description"); //$NON-NLS-1$ ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, 0) { public void apply(IDocument document) { try { NLSRefactoring refactoring= new NLSRefactoring(cu, JavaPreferencesSettings.getCodeGenerationSettings()); ExternalizeWizard wizard= new ExternalizeWizard(refactoring); String dialogTitle= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.dialog.title"); //$NON-NLS-1$ new RefactoringStarter().activate(refactoring, wizard, JavaPlugin.getActiveWorkbenchShell(), dialogTitle, true); } catch (JavaModelException e) { JavaPlugin.log(e); } } }; proposals.add(proposal); TextEdit edit= NLSUtil.createNLSEdit(cu, context.getOffset()); if (edit != null) { String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addnon-nls.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE); CUCorrectionProposal nlsProposal= new CUCorrectionProposal(label, cu, 6, image); nlsProposal.getRootTextEdit().add(edit); proposals.add(nlsProposal); } } /** * A static field or method is accessed using a non-static reference. E.g. * <pre> * File f = new File(); * f.pathSeparator; * </pre> * This correction changes <code>f</code> above to <code>File</code>. * * @param context * @param proposals */ public static void addInstanceAccessToStaticProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= context.getCoveredNode(); if (selectedNode == null) { return; } Expression qualifier= null; IBinding accessBinding= null; if (selectedNode instanceof QualifiedName) { QualifiedName name= (QualifiedName) selectedNode; qualifier= name.getQualifier(); accessBinding= name.resolveBinding(); } else if (selectedNode instanceof SimpleName) { ASTNode parent= selectedNode.getParent(); if (parent instanceof FieldAccess) { FieldAccess fieldAccess= (FieldAccess) parent; qualifier= fieldAccess.getExpression(); accessBinding= fieldAccess.getName().resolveBinding(); } } else if (selectedNode instanceof MethodInvocation) { MethodInvocation methodInvocation= (MethodInvocation) selectedNode; qualifier= methodInvocation.getExpression(); accessBinding= methodInvocation.getName().resolveBinding(); } else if (selectedNode instanceof FieldAccess) { FieldAccess fieldAccess= (FieldAccess) selectedNode; qualifier= fieldAccess.getExpression(); accessBinding= fieldAccess.getName().resolveBinding(); } ITypeBinding declaringTypeBinding= null; if (accessBinding != null) { if (accessBinding instanceof IMethodBinding) { declaringTypeBinding= ((IMethodBinding) accessBinding).getDeclaringClass(); } else if (accessBinding instanceof IVariableBinding) { declaringTypeBinding= ((IVariableBinding) accessBinding).getDeclaringClass(); } if (declaringTypeBinding != null) { ASTRewrite rewrite= new ASTRewrite(selectedNode.getParent()); rewrite.markAsReplaced(qualifier, astRoot.getAST().newSimpleName(declaringTypeBinding.getName())); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changeaccesstostaticdefining.description", declaringTypeBinding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 2, image); proposal.addImport(declaringTypeBinding); proposal.ensureNoModifications(); proposals.add(proposal); } } if (qualifier != null) { ITypeBinding instanceTypeBinding= ASTResolving.normalizeTypeBinding(qualifier.resolveTypeBinding()); if (instanceTypeBinding != null && instanceTypeBinding != declaringTypeBinding) { ASTRewrite rewrite= new ASTRewrite(selectedNode.getParent()); rewrite.markAsReplaced(qualifier, astRoot.getAST().newSimpleName(instanceTypeBinding.getName())); String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.changeaccesstostatic.description", instanceTypeBinding.getName()); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image); proposal.addImport(instanceTypeBinding); proposal.ensureNoModifications(); proposals.add(proposal); } } ModifierCorrectionSubProcessor.addNonAccessibleMemberProposal(context, proposals, ModifierCorrectionSubProcessor.TO_NON_STATIC); } public static void addUnimplementedMethodsProposals(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } ASTNode typeNode= null; if (selectedNode.getNodeType() == ASTNode.SIMPLE_NAME && selectedNode.getParent().getNodeType() == ASTNode.TYPE_DECLARATION) { typeNode= selectedNode.getParent(); } else if (selectedNode.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) { ClassInstanceCreation creation= (ClassInstanceCreation) selectedNode; typeNode= creation.getAnonymousClassDeclaration(); } if (typeNode != null) { UnimplementedMethodsCompletionProposal proposal= new UnimplementedMethodsCompletionProposal(cu, typeNode, 10); proposals.add(proposal); } if (typeNode instanceof TypeDeclaration) { TypeDeclaration typeDeclaration= (TypeDeclaration) typeNode; ASTRewriteCorrectionProposal proposal= ModifierCorrectionSubProcessor.getMakeTypeStaticProposal(cu, typeDeclaration); proposals.add(proposal); } } public static void addUninitializedLocalVariableProposal(ICorrectionContext context, List proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= context.getCoveringNode(); if (!(selectedNode instanceof Name)) { return; } Name name= (Name) selectedNode; IBinding binding= name.resolveBinding(); if (!(binding instanceof IVariableBinding)) { return; } IVariableBinding varBinding= (IVariableBinding) binding; CompilationUnit astRoot= context.getASTRoot(); ASTNode node= astRoot.findDeclaringNode(binding); if (node instanceof VariableDeclarationFragment) { ASTRewrite rewrite= new ASTRewrite(node.getParent()); VariableDeclarationFragment fragment= (VariableDeclarationFragment) node; if (fragment.getInitializer() != null) { return; } Expression expression= ASTResolving.getInitExpression(astRoot.getAST(), varBinding.getType()); if (expression == null) { return; } fragment.setInitializer(expression); rewrite.markAsInserted(expression); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.uninitializedvariable.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } public static void addConstructorFromSuperclassProposal(ICorrectionContext context, List proposals) { ASTNode selectedNode= context.getCoveringNode(); if (!(selectedNode instanceof Name && selectedNode.getParent() instanceof TypeDeclaration)) { return; } TypeDeclaration typeDeclaration= (TypeDeclaration) selectedNode.getParent(); ITypeBinding binding= typeDeclaration.resolveBinding(); if (binding == null || binding.getSuperclass() == null) { return; } ICompilationUnit cu= context.getCompilationUnit(); IMethodBinding[] methods= binding.getSuperclass().getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { IMethodBinding curr= methods[i]; if (curr.isConstructor() && !Modifier.isPrivate(curr.getModifiers())) { proposals.add(new ConstructorFromSuperclassProposal(cu, typeDeclaration, curr, 2)); } } } public static void addUnusedMemberProposal(ICorrectionContext context, List proposals) throws CoreException { ASTNode selectedNode= context.getCoveringNode(); if (selectedNode == null) { return; } BodyDeclaration declaration= ASTResolving.findParentBodyDeclaration(selectedNode); if (declaration != null) { ASTNode nodeToRemove= declaration; if (declaration.getNodeType() == ASTNode.FIELD_DECLARATION) { List fragments= ((FieldDeclaration) declaration).fragments(); if (fragments.size() > 1) { for (int i= 0; i < fragments.size(); i++) { VariableDeclarationFragment node= (VariableDeclarationFragment) fragments.get(i); if (ASTNodes.isParent(selectedNode, node)) { nodeToRemove= node; break; } } } } ASTRewrite rewrite= new ASTRewrite(nodeToRemove.getParent()); rewrite.markAsRemoved(nodeToRemove); String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removeunusedmember.description"); //$NON-NLS-1$ Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, 6, image); proposal.ensureNoModifications(); proposals.add(proposal); } } }
33,230
Bug 33230 Convert local to field not always using code generation templates
Build 2.1 RC1 Select to initialize the field in the constructor ==> the code generation templates (comment and body) are not used.
resolved fixed
199d71c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T09:51:51Z
2003-02-26T11:46:40Z
org.eclipse.jdt.ui.tests.refactoring/resources/PromoteTempToField/canPromote/A_test4_out.java
package p; //initialize in constructors class A{ private int i; A() { i= 0; } void f(){ i++; } }
33,230
Bug 33230 Convert local to field not always using code generation templates
Build 2.1 RC1 Select to initialize the field in the constructor ==> the code generation templates (comment and body) are not used.
resolved fixed
199d71c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T09:51:51Z
2003-02-26T11:46:40Z
org.eclipse.jdt.ui.tests.refactoring/test
33,230
Bug 33230 Convert local to field not always using code generation templates
Build 2.1 RC1 Select to initialize the field in the constructor ==> the code generation templates (comment and body) are not used.
resolved fixed
199d71c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T09:51:51Z
2003-02-26T11:46:40Z
cases/org/eclipse/jdt/ui/tests/refactoring/PromoteTempToFieldTests.java
33,230
Bug 33230 Convert local to field not always using code generation templates
Build 2.1 RC1 Select to initialize the field in the constructor ==> the code generation templates (comment and body) are not used.
resolved fixed
199d71c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T09:51:51Z
2003-02-26T11:46:40Z
org.eclipse.jdt.ui/core
33,230
Bug 33230 Convert local to field not always using code generation templates
Build 2.1 RC1 Select to initialize the field in the constructor ==> the code generation templates (comment and body) are not used.
resolved fixed
199d71c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T09:51:51Z
2003-02-26T11:46:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/PromoteTempToFieldRefactoring.java
33,230
Bug 33230 Convert local to field not always using code generation templates
Build 2.1 RC1 Select to initialize the field in the constructor ==> the code generation templates (comment and body) are not used.
resolved fixed
199d71c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T09:51:51Z
2003-02-26T11:46:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/ConvertLocalToFieldAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.ui.actions; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.corext.refactoring.base.Refactoring; import org.eclipse.jdt.internal.corext.refactoring.code.PromoteTempToFieldRefactoring; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.actions.ActionUtil; import org.eclipse.jdt.internal.ui.actions.SelectionConverter; import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor; import org.eclipse.jdt.internal.ui.refactoring.PromoteTempWizard; import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages; import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard; import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; /** * Action to convert a local variable to a field. * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> * * @since 2.1 */ public class ConvertLocalToFieldAction extends SelectionDispatchAction { private CompilationUnitEditor fEditor; private static final String DIALOG_MESSAGE_TITLE= RefactoringMessages.getString("ConvertLocalToField.title"); //$NON-NLS-1$ /** * Note: This constructor is for internal use only. Clients should not call this constructor. */ public ConvertLocalToFieldAction(CompilationUnitEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.getString("ConvertLocalToField.label")); //$NON-NLS-1$ fEditor= editor; setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); WorkbenchHelp.setHelp(this, IJavaHelpContextIds.PROMOTE_TEMP_TO_FIELD_ACTION); } private Refactoring createRefactoring(ICompilationUnit cunit, ITextSelection selection) { return new PromoteTempToFieldRefactoring(cunit, selection.getOffset(), selection.getLength()); } private RefactoringWizard createWizard(Refactoring refactoring) { String helpId= IJavaHelpContextIds.PROMOTE_TEMP_TO_FIELD_ERROR_WIZARD_PAGE; String pageTitle= RefactoringMessages.getString("ConvertLocalToField.title"); //$NON-NLS-1$ return new PromoteTempWizard((PromoteTempToFieldRefactoring)refactoring, pageTitle, helpId); } /* (non-Javadoc) * Method declared on SelectionDispatchAction */ protected void run(ITextSelection selection) { if (!ActionUtil.isProcessable(getShell(), fEditor)) return; try{ Refactoring refactoring= createRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), selection); new RefactoringStarter().activate(refactoring, createWizard(refactoring), getShell(), DIALOG_MESSAGE_TITLE, false); } catch (JavaModelException e){ ExceptionHandler.handle(e, DIALOG_MESSAGE_TITLE, RefactoringMessages.getString("NewTextRefactoringAction.exception")); //$NON-NLS-1$ } } /* (non-Javadoc) * Method declared on SelectionDispatchAction */ protected void selectionChanged(ITextSelection selection) { setEnabled(checkEnabled(selection)); } private boolean checkEnabled(ITextSelection selection) { return fEditor != null && SelectionConverter.getInputAsCompilationUnit(fEditor) != null; } }
33,027
Bug 33027 Externalize Strings does not use code template for constructor
Build 2.1 RC1 Externalize some strings and choose to generate the Messages class. Observe: the file and type comment templates are used but not the one for the constructor.
resolved fixed
802f1a5
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:15:35Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui/core
33,027
Bug 33027 Externalize Strings does not use code template for constructor
Build 2.1 RC1 Externalize some strings and choose to generate the Messages class. Observe: the file and type comment templates are used but not the one for the constructor.
resolved fixed
802f1a5
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:15:35Z
2003-02-25T16:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/nls/NLSRefactoring.java
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_0/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_1/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } void f(){ } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_10/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_11/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ new Inner(this.a); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_12/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ this.a.foo(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_13/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ this.a.i= 1; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_14/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } void f(){ A.X x= this.a.new X(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_15/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ A.foo(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_16/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ A.i= 1; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_17/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } void f(){ A.X x= new A.X(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_2/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } void f(){ } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_22/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_23/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_26/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ A.foo(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_27/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } void f(){ A.foo(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_28/out/Inner.java
package p; public class Inner extends A.OtherInner { private A a; Inner(A a) { this.a = a; }}
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_3/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_30/out/Inner.java
package p; class Inner{ private final A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_31/out/Inner.java
package p; class Inner{ private final A a; Inner(A a) { this.a= a; } void f(){ this.a.m(); } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_32/out/Inner.java
package p; class Inner{ private final A a; Inner(A a) { this.a= a; } void f(){ this.a.m= 1; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_33/out/I.java
package p; class I{ private final A a; I(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_35/in/A.java
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_35/out/A.java
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_35/out/Inner.java
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_4/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_5/out/Inner.java
package p; class Inner{ private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_7/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_8/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_nonstatic_9/out/Inner.java
package p; class Inner { private A a; Inner(A a) { this.a= a; } }
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui.tests.refactoring/test
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
org.eclipse.jdt.ui/core
33,015
Bug 33015 Convert to toplevel type does not use code templates
Buid 2.1 RC1 The file template is used but not the type and constructor template: /* * Dani - Kreated on 25.02.2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ package danisaddons.preferences; class T { T(T) { } private final PreferencePage preferencePage; T(PreferencePage preferencePage) { this.preferencePage= preferencePage; } }
resolved fixed
bce534a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:49:47Z
2003-02-25T16:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInnerToTopRefactoring.java
33,187
Bug 33187 Eclipse stops working at seemingly random times...
Whenever I am using the Linux-GTK version of Eclipse, eventually, eclipse will stop opening files. It will simply never bring up the editor when I double- click on files. I have previously opened them, and I have never had this problem in the Windows version. There does not seem to be any triggering event that I could note. Eventually, it just stopped working. When I close Eclipse, it says an error occured. Check the error log. I wasn't sure where the error log was, but I would be happy to reinstall Eclipse 2.1 and get it to happen again if someone will tell me where to look for this. The problem did has never appeared in the Windows version, or version 2.0 or prior. I only noticed it in Eclipse 2.1 RC1, and the one just prior to it (I cannot remember if this was G6 or G5 or M5, but the stable release just before RC1).
resolved fixed
38e7f32
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:58:26Z
2003-02-26T03:26:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaMarkerAnnotation.java
/********************************************************************** Copyright (c) 2000, 2003 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html Contributors: IBM Corporation - Initial implementation **********************************************************************/ package org.eclipse.jdt.internal.ui.javaeditor; import java.util.Iterator; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.jface.text.Assert; import org.eclipse.ui.texteditor.MarkerAnnotation; import org.eclipse.ui.texteditor.MarkerUtilities; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.search.ui.SearchUI; import org.eclipse.jdt.core.IJavaModelMarker; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnotation { private static final int NO_IMAGE= 0; private static final int ORIGINAL_MARKER_IMAGE= 1; private static final int QUICKFIX_IMAGE= 2; private static final int QUICKFIX_ERROR_IMAGE= 3; private static final int OVERLAY_IMAGE= 4; private static final int GRAY_IMAGE= 5; private static final int BREAKPOINT_IMAGE= 6; private static Image fgQuickFixImage; private static Image fgQuickFixErrorImage; private static ImageRegistry fgGrayMarkersImageRegistry; private IDebugModelPresentation fPresentation; private IJavaAnnotation fOverlay; private boolean fNotRelevant= false; private AnnotationType fType; private int fImageType; private boolean fQuickFixIconEnabled; public JavaMarkerAnnotation(IMarker marker) { super(marker); } /* * @see MarkerAnnotation#getUnknownImageName(IMarker) */ protected String getUnknownImageName(IMarker marker) { return JavaPluginImages.IMG_OBJS_GHOST; } /** * Initializes the annotation's icon representation and its drawing layer * based upon the properties of the underlying marker. */ protected void initialize() { fQuickFixIconEnabled= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION); fImageType= NO_IMAGE; IMarker marker= getMarker(); if (MarkerUtilities.isMarkerType(marker, IBreakpoint.BREAKPOINT_MARKER)) { if (fPresentation == null) fPresentation= DebugUITools.newDebugModelPresentation(); setImage(null); // see bug 32469 setLayer(4); fImageType= BREAKPOINT_IMAGE; fType= AnnotationType.UNKNOWN; } else { fType= AnnotationType.UNKNOWN; try { if (marker.isSubtypeOf(IMarker.PROBLEM)) { int severity= marker.getAttribute(IMarker.SEVERITY, -1); switch (severity) { case IMarker.SEVERITY_ERROR: fType= AnnotationType.ERROR; break; case IMarker.SEVERITY_WARNING: fType= AnnotationType.WARNING; break; } } else if (marker.isSubtypeOf(IMarker.TASK)) fType= AnnotationType.TASK; else if (marker.isSubtypeOf(SearchUI.SEARCH_MARKER)) fType= AnnotationType.SEARCH; else if (marker.isSubtypeOf(IMarker.BOOKMARK)) fType= AnnotationType.BOOKMARK; } catch(CoreException e) { JavaPlugin.log(e); } super.initialize(); } } private boolean mustShowQuickFixIcon() { return fQuickFixIconEnabled && JavaCorrectionProcessor.hasCorrections(getMarker()); } private Image getQuickFixImage() { if (fgQuickFixImage == null) fgQuickFixImage= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_FIXABLE_PROBLEM); return fgQuickFixImage; } private Image getQuickFixErrorImage() { if (fgQuickFixErrorImage == null) fgQuickFixErrorImage= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_FIXABLE_ERROR); return fgQuickFixErrorImage; } /* * @see IJavaAnnotation#getMessage() */ public String getMessage() { IMarker marker= getMarker(); if (marker == null) return ""; //$NON-NLS-1$ else return marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$ } /* * @see IJavaAnnotation#isTemporary() */ public boolean isTemporary() { return false; } /* * @see IJavaAnnotation#getArguments() */ public String[] getArguments() { if (isProblem()) return Util.getProblemArgumentsFromMarker(getMarker().getAttribute(IJavaModelMarker.ARGUMENTS, "")); //$NON-NLS-1$ return null; } /* * @see IJavaAnnotation#getId() */ public int getId() { if (isProblem()) return getMarker().getAttribute(IJavaModelMarker.ID, -1); return -1; } /* * @see IJavaAnnotation#isProblem() */ public boolean isProblem() { return fType == AnnotationType.WARNING || fType == AnnotationType.ERROR; } /* * @see IJavaAnnotation#isRelevant() */ public boolean isRelevant() { return !fNotRelevant; } /** * Overlays this annotation with the given javaAnnotation. * * @param javaAnnotation annotation that is overlaid by this annotation */ public void setOverlay(IJavaAnnotation javaAnnotation) { if (fOverlay != null) fOverlay.removeOverlaid(this); fOverlay= javaAnnotation; fNotRelevant= (fNotRelevant || fOverlay != null); if (javaAnnotation != null) javaAnnotation.addOverlaid(this); } /* * @see IJavaAnnotation#hasOverlay() */ public boolean hasOverlay() { return fOverlay != null; } /* * @see MarkerAnnotation#getImage(Display) */ public Image getImage(Display display) { if (fImageType == BREAKPOINT_IMAGE) { Image result= super.getImage(display); if (result == null) { result= fPresentation.getImage(getMarker()); setImage(result); } return result; } int newImageType= NO_IMAGE; if (hasOverlay()) newImageType= OVERLAY_IMAGE; else if (isRelevant()) { if (mustShowQuickFixIcon()) { if (fType == AnnotationType.ERROR) newImageType= QUICKFIX_ERROR_IMAGE; else newImageType= QUICKFIX_IMAGE; } else newImageType= ORIGINAL_MARKER_IMAGE; } else newImageType= GRAY_IMAGE; if (fImageType == newImageType && newImageType != OVERLAY_IMAGE) // Nothing changed - simply return the current image return super.getImage(display); Image newImage= null; switch (newImageType) { case ORIGINAL_MARKER_IMAGE: newImage= null; break; case OVERLAY_IMAGE: newImage= fOverlay.getImage(display); break; case QUICKFIX_IMAGE: newImage= getQuickFixImage(); break; case QUICKFIX_ERROR_IMAGE: newImage= getQuickFixErrorImage(); break; case GRAY_IMAGE: if (fImageType != ORIGINAL_MARKER_IMAGE) setImage(null); Image originalImage= super.getImage(display); if (originalImage != null) { ImageRegistry imageRegistry= getGrayMarkerImageRegistry(display); if (imageRegistry != null) { String key= Integer.toString(originalImage.hashCode()); Image grayImage= imageRegistry.get(key); if (grayImage == null) { grayImage= new Image(display, originalImage, SWT.IMAGE_GRAY); imageRegistry.put(key, grayImage); } newImage= grayImage; } } break; default: Assert.isLegal(false); } fImageType= newImageType; setImage(newImage); return super.getImage(display); } private ImageRegistry getGrayMarkerImageRegistry(Display display) { if (fgGrayMarkersImageRegistry == null) fgGrayMarkersImageRegistry= new ImageRegistry(display); return fgGrayMarkersImageRegistry; } /* * @see IJavaAnnotation#addOverlaid(IJavaAnnotation) */ public void addOverlaid(IJavaAnnotation annotation) { // not supported } /* * @see IJavaAnnotation#removeOverlaid(IJavaAnnotation) */ public void removeOverlaid(IJavaAnnotation annotation) { // not supported } /* * @see IJavaAnnotation#getOverlaidIterator() */ public Iterator getOverlaidIterator() { // not supported return null; } /* * @see org.eclipse.jdt.internal.ui.javaeditor.IJavaAnnotation#getAnnotationType() */ public AnnotationType getAnnotationType() { return fType; } }
33,187
Bug 33187 Eclipse stops working at seemingly random times...
Whenever I am using the Linux-GTK version of Eclipse, eventually, eclipse will stop opening files. It will simply never bring up the editor when I double- click on files. I have previously opened them, and I have never had this problem in the Windows version. There does not seem to be any triggering event that I could note. Eventually, it just stopped working. When I close Eclipse, it says an error occured. Check the error log. I wasn't sure where the error log was, but I would be happy to reinstall Eclipse 2.1 and get it to happen again if someone will tell me where to look for this. The problem did has never appeared in the Windows version, or version 2.0 or prior. I only noticed it in Eclipse 2.1 RC1, and the one just prior to it (I cannot remember if this was G6 or G5 or M5, but the stable release just before RC1).
resolved fixed
38e7f32
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T10:58:26Z
2003-02-26T03:26:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaAnnotationHover.java
/********************************************************************** Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html Contributors: IBM Corporation - Initial implementation **********************************************************************/ package org.eclipse.jdt.internal.ui.text; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jdt.internal.ui.JavaUIMessages; import org.eclipse.jdt.internal.ui.javaeditor.IJavaAnnotation; /** * Determines all markers for the given line and collects, concatenates, and formates * their messages. */ public class JavaAnnotationHover implements IAnnotationHover { /** * Returns the distance to the ruler line. */ protected int compareRulerLine(Position position, IDocument document, int line) { if (position.getOffset() > -1 && position.getLength() > -1) { try { int javaAnnotationLine= document.getLineOfOffset(position.getOffset()); if (line == javaAnnotationLine) return 1; if (javaAnnotationLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength())) return 2; } catch (BadLocationException x) { } } return 0; } /** * Selects a set of markers from the two lists. By default, it just returns * the set of exact matches. */ protected List select(List exactMatch, List including) { return exactMatch; } /** * Returns one marker which includes the ruler's line of activity. */ protected List getJavaAnnotationsForLine(ISourceViewer viewer, int line) { IDocument document= viewer.getDocument(); IAnnotationModel model= viewer.getAnnotationModel(); if (model == null) return null; List exact= new ArrayList(); List including= new ArrayList(); Iterator e= model.getAnnotationIterator(); HashMap messagesAtPosition= new HashMap(); while (e.hasNext()) { Object o= e.next(); if (o instanceof IJavaAnnotation) { IJavaAnnotation a= (IJavaAnnotation)o; if (!a.hasOverlay()) { Position position= model.getPosition((Annotation)a); if (position == null) continue; if (isDuplicateJavaAnnotation(messagesAtPosition, position, a.getMessage())) continue; switch (compareRulerLine(position, document, line)) { case 1: exact.add(a); break; case 2: including.add(a); break; } } } } return select(exact, including); } private boolean isDuplicateJavaAnnotation(Map messagesAtPosition, Position position, String message) { if (messagesAtPosition.containsKey(position)) { Object value= messagesAtPosition.get(position); if (message.equals(value)) return true; if (value instanceof List) { List messages= (List)value; if (messages.contains(message)) return true; else messages.add(message); } else { ArrayList messages= new ArrayList(); messages.add(value); messages.add(message); messagesAtPosition.put(position, messages); } } else messagesAtPosition.put(position, message); return false; } /* * @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int) */ public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) { List javaAnnotations= getJavaAnnotationsForLine(sourceViewer, lineNumber); if (javaAnnotations != null) { if (javaAnnotations.size() == 1) { // optimization IJavaAnnotation javaAnnotation= (IJavaAnnotation)javaAnnotations.get(0); String message= javaAnnotation.getMessage(); if (message != null && message.trim().length() > 0) return formatSingleMessage(message); } else { List messages= new ArrayList(); Iterator e= javaAnnotations.iterator(); while (e.hasNext()) { IJavaAnnotation javaAnnotation= (IJavaAnnotation)e.next(); String message= javaAnnotation.getMessage(); if (message != null && message.trim().length() > 0) messages.add(message.trim()); } if (messages.size() == 1) return formatSingleMessage((String) messages.get(0)); if (messages.size() > 1) return formatMultipleMessages(messages); } } return null; } /* * Formats a message as HTML text. */ private String formatSingleMessage(String message) { StringBuffer buffer= new StringBuffer(); HTMLPrinter.addPageProlog(buffer); HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message)); HTMLPrinter.addPageEpilog(buffer); return buffer.toString(); } /* * Formats several message as HTML text. */ private String formatMultipleMessages(List messages) { StringBuffer buffer= new StringBuffer(); HTMLPrinter.addPageProlog(buffer); HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(JavaUIMessages.getString("JavaAnnotationHover.multipleMarkersAtThisLine"))); //$NON-NLS-1$ HTMLPrinter.startBulletList(buffer); Iterator e= messages.iterator(); while (e.hasNext()) HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next())); HTMLPrinter.endBulletList(buffer); HTMLPrinter.addPageEpilog(buffer); return buffer.toString(); } }
33,163
Bug 33163 Search again menu option fails to find new occurrences
R2.1 RC1 From the java editor popup menu "Search -> Occurrences in file" on an item that will generate one or more matches. Note the number of matches. Now insert another instance of the item you searched for and press save to recompile the class. RMB in the search view and "Search again" It won't find the new occurrence. Either the search again should be disabled or it should do the search again. I prefer the later.
resolved fixed
3c9d20f
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T11:02:30Z
2003-02-25T21:53:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/FindOccurrencesEngine.java
/******************************************************************************* * Copyright (c) 2000, 2003 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials are made * available under the terms of the Common Public License v1.0 which accompanies * this distribution, and is available at http://www.eclipse.org/legal/cpl-v10. * html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.search; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.texteditor.MarkerUtilities; import org.eclipse.search.ui.IGroupByKeyComputer; import org.eclipse.search.ui.ISearchResultView; import org.eclipse.search.ui.SearchUI; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.ISourceReference; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.Name; import org.eclipse.jdt.core.dom.QualifiedName; import org.eclipse.jdt.core.dom.SimpleName; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.NodeFinder; import org.eclipse.jdt.internal.corext.util.WorkingCopyUtil; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.ui.JavaUI; public abstract class FindOccurrencesEngine { public static final String IS_WRITEACCESS= "writeAccess"; //$NON-NLS-1$ public static final String IS_VARIABLE= "variable"; //$NON-NLS-1$ private IRunnableWithProgress fNullOperation= getNullOperation(); private static class SearchGroupByKeyComputer implements IGroupByKeyComputer { public Object computeGroupByKey(IMarker marker) { return marker; } } private static class NameNodeFinder extends ASTVisitor { Name result; public static Name perform(ASTNode root) { NameNodeFinder finder= new NameNodeFinder(); root.accept(finder); return finder.result; } public boolean visit(SimpleName node) { result= node; return false; } public boolean visit(QualifiedName node) { result= node; return false; } } private static class FindOccurencesClassFileEngine extends FindOccurrencesEngine { private IClassFile fClassFile; public FindOccurencesClassFileEngine(IClassFile file) { fClassFile= file; } protected CompilationUnit createAST() { return AST.parseCompilationUnit(fClassFile, true); } protected IJavaElement getInput() { return fClassFile; } protected IResource getMarkerOwner() { return fClassFile.getJavaProject().getProject(); } protected void addSpecialAttributes(Map attributes) throws JavaModelException { attributes.put(IWorkbenchPage.EDITOR_ID_ATTR, JavaUI.ID_CF_EDITOR); JavaCore.addJavaElementMarkerAttributes(attributes, fClassFile.getType()); attributes.put(IJavaSearchUIConstants.ATT_JE_HANDLE_ID, fClassFile.getType().getHandleIdentifier()); } protected ISourceReference getSourceReference() { return fClassFile; } } private static class FindOccurencesCUEngine extends FindOccurrencesEngine { private ICompilationUnit fCUnit; public FindOccurencesCUEngine(ICompilationUnit unit) { fCUnit= unit; } protected CompilationUnit createAST() { return AST.parseCompilationUnit(fCUnit, true); } protected IJavaElement getInput() { return fCUnit; } protected IResource getMarkerOwner() throws JavaModelException { ICompilationUnit original= WorkingCopyUtil.getOriginal(fCUnit); return original.getUnderlyingResource(); } protected void addSpecialAttributes(Map attributes) { // do nothing } protected ISourceReference getSourceReference() { return fCUnit; } } public static FindOccurrencesEngine create(IJavaElement root) { ICompilationUnit unit= (ICompilationUnit)root.getAncestor(IJavaElement.COMPILATION_UNIT); if (unit != null) return new FindOccurencesCUEngine(unit); IClassFile cf= (IClassFile)root.getAncestor(IJavaElement.CLASS_FILE); if (cf != null) return new FindOccurencesClassFileEngine(cf); return null; } protected abstract CompilationUnit createAST(); protected abstract IJavaElement getInput(); protected abstract ISourceReference getSourceReference(); protected abstract IResource getMarkerOwner() throws JavaModelException; protected abstract void addSpecialAttributes(Map attributes) throws JavaModelException; public String run(int offset, int length) throws JavaModelException { ISourceReference sr= getSourceReference(); if (sr.getSourceRange() == null) { return SearchMessages.getString("FindOccurrencesEngine.noSource.text"); //$NON-NLS-1$ } final CompilationUnit root= createAST(); if (root == null) { return SearchMessages.getString("FindOccurrencesEngine.cannotParse.text"); //$NON-NLS-1$ } final Name name= getNameNode(root, offset, length); if (name == null) return SearchMessages.getString("FindOccurrencesEngine.noJavaElement.text"); //$NON-NLS-1$ final IBinding target= name.resolveBinding(); final IDocument document= new Document(getSourceReference().getSource()); if (target == null) return null; final IWorkspaceRunnable runnable= new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { IJavaElement element= getInput(); ISearchResultView view= startSearch(element.getElementName(), name); OccurrencesFinder finder= new OccurrencesFinder(target); root.accept(finder); List matches= finder.getUsages(); List writeMatches= finder.getWriteUsages(); IResource file= getMarkerOwner(); for (Iterator each= matches.iterator(); each.hasNext();) { ASTNode node= (ASTNode) each.next(); addMatch( view, file, createMarker(file, document, node, writeMatches.contains(node), target instanceof IVariableBinding) ); } searchFinished(view); } }; run(runnable); return null; } public Name getNameNode(CompilationUnit root, int offset, int length) { ASTNode node= NodeFinder.perform(root, offset, length); if (node instanceof Name) return (Name)node; Name name= NameNodeFinder.perform(node); if (name == null || name.getStartPosition() != node.getStartPosition() || name.getLength() != node.getLength()) return null; return name; } private ISearchResultView startSearch(String fileName, final Name name) { SearchUI.activateSearchResultView(); ISearchResultView view= SearchUI.getSearchResultView(); String elementName= ASTNodes.asString(name); if (view != null) view.searchStarted( null, getSingularLabel(elementName, fileName), getPluralLabel(elementName, fileName), JavaPluginImages.DESC_OBJS_SEARCH_REF, "org.eclipse.jdt.ui.JavaFileSearch", //$NON-NLS-1$ new OccurrencesInFileLabelProvider(), new GotoMarkerAction(), new SearchGroupByKeyComputer(), fNullOperation ); return view; } private void addMatch(final ISearchResultView view, IResource file, IMarker marker) { if (view != null) view.addMatch("", getGroupByKey(marker), file, marker); //$NON-NLS-1$ } private void searchFinished(final ISearchResultView view) { if (view != null) view.searchFinished(); } private Object getGroupByKey(IMarker marker) { try { return marker.getAttribute(IMarker.LINE_NUMBER); } catch (CoreException e) { } return marker; } private IMarker createMarker(IResource file, IDocument document, ASTNode element, boolean writeAccess, boolean isVariable) throws CoreException { Map attributes= new HashMap(10); IMarker marker= file.createMarker(SearchUI.SEARCH_MARKER); int startPosition= element.getStartPosition(); MarkerUtilities.setCharStart(attributes, startPosition); MarkerUtilities.setCharEnd(attributes, startPosition + element.getLength()); addSpecialAttributes(attributes); if(writeAccess) attributes.put(IS_WRITEACCESS, new Boolean(true)); if(isVariable) attributes.put(IS_VARIABLE, new Boolean(true)); try { int line= document.getLineOfOffset(startPosition); MarkerUtilities.setLineNumber(attributes, line); IRegion region= document.getLineInformation(line); String lineContents= document.get(region.getOffset(), region.getLength()); MarkerUtilities.setMessage(attributes, lineContents.trim()); } catch (BadLocationException e) { } marker.setAttributes(attributes); return marker; } private String getPluralLabel(String nodeContents, String elementName) { String[] args= new String[] {nodeContents, "{0}", elementName}; //$NON-NLS-1$ return SearchMessages.getFormattedString("JavaSearchInFile.pluralPostfix", args); //$NON-NLS-1$ } private String getSingularLabel(String nodeContents, String elementName) { String[] args= new String[] {nodeContents, elementName}; //$NON-NLS-1$ return SearchMessages.getFormattedString("JavaSearchInFile.singularPostfix", args); //$NON-NLS-1$ } private void run(final IWorkspaceRunnable runnable) { BusyIndicator.showWhile(null, new Runnable() { public void run() { try { JavaCore.run(runnable, null); } catch (CoreException e) { JavaPlugin.log(e); } } } ); } private IRunnableWithProgress getNullOperation() { return new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { } }; } }
33,458
Bug 33458 StringIndexOutOfBoundsException from Junit HierarchyRunView
20030227 I am attempting to run my PDE JUnit tests for Debug and Ant Core. All produce similar stack traces to the following: java.lang.StringIndexOutOfBoundsException: String index out of range: -57 at java.lang.String.substring(String.java:1480) at org.eclipse.jdt.internal.junit.ui.HierarchyRunView.newTreeEntry (HierarchyRunView.java:305) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart$4.run (TestRunnerViewPart.java:477) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:31) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:94) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1752) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1487) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
resolved fixed
cf6929e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T11:59:24Z
2003-02-27T18:20:00Z
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/runner/MessageIds.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.junit.runner; /** * Message identifiers for messages sent by the * RemoteTestRunner. * * @see RemoteTestRunner */ public class MessageIds { /** * The header length of a message, all messages * have a fixed header length */ public static final int MSG_HEADER_LENGTH= 8; /** * Notification that a test trace has started. * The end of the trace is signaled by a Trace_END * message. In between the TRACE_START and TRACE_END * the stack trace is submitted as multiple lines. */ public static final String TRACE_START= "%TRACES "; //$NON-NLS-1$ /** * Notification that a trace for a reran test has started. * The end of the trace is signaled by a RTrace_END * message. */ public static final String RTRACE_START= "%RTRACES"; //$NON-NLS-1$ /** * Notification that a trace ends. */ public static final String TRACE_END= "%TRACEE "; //$NON-NLS-1$ /** * Notification that a trace of a reran trace ends. */ public static final String RTRACE_END= "%RTRACEE"; //$NON-NLS-1$ /** * Notification that a test run has started. * MessageIds.TEST_RUN_START+testCount.toString */ public static final String TEST_RUN_START= "%TESTC "; //$NON-NLS-1$ /** * Notification that a test has started. * MessageIds.TEST_START + testID + "," + testName */ public static final String TEST_START= "%TESTS "; //$NON-NLS-1$ /** * Notification that a test has started. * TEST_END + testID + "," + testName */ public static final String TEST_END= "%TESTE "; //$NON-NLS-1$ /** * Notification that a test had a error. * TEST_ERROR + testID + "," + testName. * After the notification follows the stack trace. */ public static final String TEST_ERROR= "%ERROR "; //$NON-NLS-1$ /** * Notification that a test had a failure. * TEST_FAILED + testID + "," + testName. * After the notification follows the stack trace. */ public static final String TEST_FAILED= "%FAILED "; //$NON-NLS-1$ /** * Notification that a test run has ended. * TEST_RUN_END+elapsedTime.toString(). */ public static final String TEST_RUN_END="%RUNTIME"; //$NON-NLS-1$ /** * Notification that a test run was successfully stopped. */ public static final String TEST_STOPPED="%TSTSTP "; //$NON-NLS-1$ /** * Notification that a test was reran. * TEST_RERAN+testId+" "+testClass+" "+testName+STATUS. * Status = "OK" or "FAILURE". */ public static final String TEST_RERAN= "%TSTRERN"; //$NON-NLS-1$ /** * Notification about a test inside the test suite. * TEST_TREE+ testId"," + testName","isSuite","testcount * isSuite = "true" or "false" */ public static final String TEST_TREE="%TSTTREE"; //$NON-NLS-1$ /** * Request to stop the current test run. */ public static final String TEST_STOP= ">STOP "; //$NON-NLS-1$ /** * Request to rerun a test. * TEST_RERUN+testId+" "+ClassName+" "+testName */ public static final String TEST_RERUN= ">RERUN "; //$NON-NLS-1$ }
33,458
Bug 33458 StringIndexOutOfBoundsException from Junit HierarchyRunView
20030227 I am attempting to run my PDE JUnit tests for Debug and Ant Core. All produce similar stack traces to the following: java.lang.StringIndexOutOfBoundsException: String index out of range: -57 at java.lang.String.substring(String.java:1480) at org.eclipse.jdt.internal.junit.ui.HierarchyRunView.newTreeEntry (HierarchyRunView.java:305) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart$4.run (TestRunnerViewPart.java:477) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:31) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:94) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1752) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1487) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
resolved fixed
cf6929e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T11:59:24Z
2003-02-27T18:20:00Z
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/runner/RemoteTestRunner.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.junit.runner; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.Socket; import java.util.Vector; import junit.extensions.TestDecorator; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestFailure; import junit.framework.TestListener; import junit.framework.TestResult; import junit.framework.TestSuite; import org.eclipse.jdt.internal.junit.ui.JUnitMessages; /** * A TestRunner that reports results via a socket connection. * See MessageIds for more information about the protocl. */ public class RemoteTestRunner implements TestListener { /** * Holder for information for a rerun request */ private static class RerunRequest { String fClassName; String fTestName; int fTestId; public RerunRequest(int testId, String className, String testName) { fTestId= testId; fClassName= className; fTestName= testName; } } private static final String SUITE_METHODNAME= "suite"; //$NON-NLS-1$ /** * The name of the test classes to be executed */ private String[] fTestClassNames; /** * The name of the test (argument -test) */ private String fTestName; /** * The current test result */ private TestResult fTestResult; /** * The client socket. */ private Socket fClientSocket; /** * Print writer for sending messages */ private PrintWriter fWriter; /** * Reader for incoming messages */ private BufferedReader fReader; /** * Host to connect to, default is the localhost */ private String fHost= ""; //$NON-NLS-1$ /** * Port to connect to. */ private int fPort= -1; /** * Is the debug mode enabled? */ private boolean fDebugMode= false; /** * Keep the test run server alive after a test run has finished. * This allows to rerun tests. */ private boolean fKeepAlive= false; /** * Has the server been stopped */ private boolean fStopped= false; /** * Queue of rerun requests. */ private Vector fRerunRequests= new Vector(10); /** * Reader thread that processes messages from the client. */ private class ReaderThread extends Thread { public ReaderThread() { super("ReaderThread"); //$NON-NLS-1$ } public void run(){ try { String message= null; while (true) { if ((message= fReader.readLine()) != null) { if (message.startsWith(MessageIds.TEST_STOP)){ fStopped= true; RemoteTestRunner.this.stop(); synchronized(RemoteTestRunner.this) { RemoteTestRunner.this.notifyAll(); } break; } else if (message.startsWith(MessageIds.TEST_RERUN)) { String arg= message.substring(MessageIds.MSG_HEADER_LENGTH); //format: testId className testName int c0= arg.indexOf(' '); //$NON-NLS-1$ int c1= arg.indexOf(' ', c0+1); String s= arg.substring(0, c0); int testId= Integer.parseInt(s); String className= arg.substring(c0+1, c1); String testName= arg.substring(c1+1, arg.length()); synchronized(RemoteTestRunner.this) { fRerunRequests.add(new RerunRequest(testId, className, testName)); RemoteTestRunner.this.notifyAll(); } } } } } catch (Exception e) { RemoteTestRunner.this.stop(); } } } /** * The main entry point. * Parameters<pre> * -classnames: the name of the test suite class * -testfilename: the name of a file containing classnames of test suites * -test: the test method name (format classname testname) * -host: the host to connect to default local host * -port: the port to connect to, mandatory argument * -keepalive: keep the process alive after a test run * </pre> */ public static void main(String[] args) { RemoteTestRunner testRunServer= new RemoteTestRunner(); testRunServer.init(args); testRunServer.run(); // fix for 14434 System.exit(0); } /** * Parse command line arguments. Hook for subclasses to process * additional arguments. */ protected void init(String[] args) { defaultInit(args); } /** * The class loader to be used for loading tests. * Subclasses may override to use another class loader. */ protected ClassLoader getClassLoader() { return getClass().getClassLoader(); } /** * Process the default arguments. */ protected final void defaultInit(String[] args) { for(int i= 0; i < args.length; i++) { if(args[i].toLowerCase().equals("-classnames") || args[i].toLowerCase().equals("-classname")){ //$NON-NLS-1$ //$NON-NLS-2$ Vector list= new Vector(); for (int j= i+1; j < args.length; j++) { if (args[j].startsWith("-")) //$NON-NLS-1$ break; list.add(args[j]); } fTestClassNames= (String[]) list.toArray(new String[list.size()]); } else if(args[i].toLowerCase().equals("-test")) { //$NON-NLS-1$ String testName= args[i+1]; int p= testName.indexOf(':'); if (p == -1) throw new IllegalArgumentException("Testname not separated by \'%\'"); //$NON-NLS-1$ fTestName= testName.substring(p+1); fTestClassNames= new String[]{ testName.substring(0, p) }; i++; } else if(args[i].toLowerCase().equals("-testnamefile")) { //$NON-NLS-1$ String testNameFile= args[i+1]; try { readTestNames(testNameFile); } catch (IOException e) { throw new IllegalArgumentException("Cannot read testname file."); //$NON-NLS-1$ } i++; } else if(args[i].toLowerCase().equals("-port")) { //$NON-NLS-1$ fPort= Integer.parseInt(args[i+1]); i++; } else if(args[i].toLowerCase().equals("-host")) { //$NON-NLS-1$ fHost= args[i+1]; i++; } else if(args[i].toLowerCase().equals("-keepalive")) { //$NON-NLS-1$ fKeepAlive= true; } else if(args[i].toLowerCase().equals("-debugging") || args[i].toLowerCase().equals("-debug")){ //$NON-NLS-1$ //$NON-NLS-2$ fDebugMode= true; } } if(fTestClassNames == null || fTestClassNames.length == 0) throw new IllegalArgumentException(JUnitMessages.getString("RemoteTestRunner.error.classnamemissing")); //$NON-NLS-1$ if (fPort == -1) throw new IllegalArgumentException(JUnitMessages.getString("RemoteTestRunner.error.portmissing")); //$NON-NLS-1$ if (fDebugMode) System.out.println("keepalive "+fKeepAlive); //$NON-NLS-1$ } private void readTestNames(String testNameFile) throws IOException { BufferedReader br= new BufferedReader(new FileReader(new File(testNameFile))); try { String line; Vector list= new Vector(); while ((line= br.readLine()) != null) { list.add(line); } fTestClassNames= (String[]) list.toArray(new String[list.size()]); } finally { br.close(); } if (fDebugMode) { System.out.println("Tests:"); //$NON-NLS-1$ for (int i= 0; i < fTestClassNames.length; i++) { System.out.println(" "+fTestClassNames[i]); //$NON-NLS-1$ } } } /** * Connects to the remote ports and runs the tests. */ protected void run() { if (!connect()) { return; } fTestResult= new TestResult(); fTestResult.addListener(this); runTests(fTestClassNames, fTestName); fTestResult.removeListener(this); if (fTestResult != null) { fTestResult.stop(); fTestResult= null; } if (fKeepAlive) waitForReruns(); shutDown(); } /** * Waits for rerun requests until an explicit stop request */ private synchronized void waitForReruns() { while (!fStopped) { try { wait(); if (!fStopped && fRerunRequests.size() > 0) { RerunRequest r= (RerunRequest)fRerunRequests.remove(0); rerunTest(r.fTestId, r.fClassName, r.fTestName); } } catch (InterruptedException e) { } } } /** * Returns the Test corresponding to the given suite. */ private Test getTest(String suiteClassName, String testName) { Class testClass= null; try { testClass= loadSuiteClass(suiteClassName); } catch (ClassNotFoundException e) { String clazz= e.getMessage(); if (clazz == null) clazz= suiteClassName; runFailed(JUnitMessages.getFormattedString("RemoteTestRunner.error.classnotfound", clazz)); //$NON-NLS-1$ return null; } catch(Exception e) { runFailed(JUnitMessages.getFormattedString("RemoteTestRunner.error.exception", e.toString() )); //$NON-NLS-1$ return null; } if (testName != null) { return createTest(testName, testClass); } Method suiteMethod= null; try { suiteMethod= testClass.getMethod(SUITE_METHODNAME, new Class[0]); } catch(Exception e) { // try to extract a test suite automatically return new TestSuite(testClass); } Test test= null; try { test= (Test)suiteMethod.invoke(null, new Class[0]); // static method } catch (InvocationTargetException e) { runFailed(JUnitMessages.getFormattedString("RemoteTestRunner.error.invoke", e.getTargetException().toString() )); //$NON-NLS-1$ return null; } catch (IllegalAccessException e) { runFailed(JUnitMessages.getFormattedString("RemoteTestRunner.error.invoke", e.toString() )); //$NON-NLS-1$ return null; } return test; } protected void runFailed(String message) { System.err.println(message); } /** * Loads the test suite class. */ private Class loadSuiteClass(String className) throws ClassNotFoundException { if (className == null) return null; return getClassLoader().loadClass(className); } /** * Runs a set of tests. */ private void runTests(String[] testClassNames, String testName) { // instantiate all tests Test[] suites= new Test[testClassNames.length]; for (int i= 0; i < suites.length; i++) { suites[i]= getTest(testClassNames[i], testName); } // count all testMethods and inform ITestRunListeners int count= countTests(suites); notifyTestRunStarted(count); if (count == 0) { notifyTestRunEnded(0); return; } long startTime= System.currentTimeMillis(); if (fDebugMode) System.out.print("start send tree..."); //$NON-NLS-1$ for (int i= 0; i < suites.length; i++) { sendTree(suites[i]); } if (fDebugMode) System.out.println("done send tree - time(ms): "+(System.currentTimeMillis()-startTime)); //$NON-NLS-1$ long testStartTime= System.currentTimeMillis(); for (int i= 0; i < suites.length; i++) { suites[i].run(fTestResult); } // inform ITestRunListeners of test end if (fTestResult == null || fTestResult.shouldStop()) notifyTestRunStopped(System.currentTimeMillis() - testStartTime); else notifyTestRunEnded(System.currentTimeMillis() - testStartTime); } private int countTests(Test[] tests) { int count= 0; for (int i= 0; i < tests.length; i++) { if (tests[i] != null) count= count + tests[i].countTestCases(); } return count; } /** * Reruns a test as defined by the fully qualified class name and * the name of the test. */ public void rerunTest(int testId, String className, String testName) { Test reloadedTest= null; try { Class reloadedTestClass= getClassLoader().loadClass(className); reloadedTest= createTest(testName, reloadedTestClass); } catch(Exception e) { reloadedTest= warning("Could not create test \'"+testName+"\'"); //$NON-NLS-1$ //$NON-NLS-2$ } TestResult result= new TestResult(); reloadedTest.run(result); notifyTestReran(result, Integer.toString(testId), className, testName); } /** * Returns a test which will fail and log a warning message. */ private Test warning(final String message) { return new TestCase("warning") { //$NON-NLS-1$ protected void runTest() { fail(message); } }; } private Test createTest(String testName, Class testClass) { Class[] classArgs= { String.class }; Test test; Constructor constructor= null; try { try { constructor= testClass.getConstructor(classArgs); test= (Test)constructor.newInstance(new Object[]{testName}); } catch (NoSuchMethodException e) { // try the no arg constructor supported in 3.8.1 constructor= testClass.getConstructor(new Class[0]); test= (Test)constructor.newInstance(new Object[0]); if (test instanceof TestCase) ((TestCase) test).setName(testName); } if (test != null) return test; } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } catch (NoSuchMethodException e) { } catch (ClassCastException e) { } return warning("Could not create test \'"+testName+"\' "); //$NON-NLS-1$ //$NON-NLS-2$ } /* * @see TestListener#addError(Test, Throwable) */ public final void addError(Test test, Throwable throwable) { notifyTestFailed(test, MessageIds.TEST_ERROR, getTrace(throwable)); } /* * @see TestListener#addFailure(Test, AssertionFailedError) */ public final void addFailure(Test test, AssertionFailedError assertionFailedError) { notifyTestFailed(test, MessageIds.TEST_FAILED, getTrace(assertionFailedError)); } /* * @see TestListener#endTest(Test) */ public void endTest(Test test) { notifyTestEnded(test); } /* * @see TestListener#startTest(Test) */ public void startTest(Test test) { notifyTestStarted(test); } private void sendTree(Test test){ if(test instanceof TestDecorator){ TestDecorator decorator= (TestDecorator) test; sendTree(decorator.getTest()); } else if(test instanceof TestSuite){ TestSuite suite= (TestSuite) test; notifyTestTreeEntry(getTestId(test)+','+suite.toString().trim() + ',' + true + ',' + suite.testCount()); for(int i=0; i < suite.testCount(); i++){ sendTree(suite.testAt(i)); } } else { notifyTestTreeEntry(getTestId(test)+ ',' + getTestName(test).trim() + ',' + false + ',' + test.countTestCases()); } } private String getTestId(Test test) { return Integer.toString(System.identityHashCode(test)); } private String getTestName(Test test) { return test.toString(); } /** * Returns the stack trace for the given throwable. */ private String getTrace(Throwable t) { StringWriter stringWriter= new StringWriter(); PrintWriter writer= new PrintWriter(stringWriter); t.printStackTrace(writer); StringBuffer buffer= stringWriter.getBuffer(); return buffer.toString(); } /** * Stop the current test run. */ protected void stop() { if (fTestResult != null) { fTestResult.stop(); } } /** * Connect to the remote test listener. */ private boolean connect() { if (fDebugMode) System.out.println("RemoteTestRunner: trying to connect" + fHost + ":" + fPort); //$NON-NLS-1$ //$NON-NLS-2$ Exception exception= null; for (int i= 1; i < 20; i++) { try{ fClientSocket= new Socket(fHost, fPort); fWriter= new PrintWriter(fClientSocket.getOutputStream(), false/*true*/); fReader= new BufferedReader(new InputStreamReader(fClientSocket.getInputStream())); new ReaderThread().start(); return true; } catch(IOException e){ exception= e; } try { Thread.sleep(2000); } catch(InterruptedException e) { } } runFailed(JUnitMessages.getFormattedString("RemoteTestRunner.error.connect", new String[]{fHost, Integer.toString(fPort)} )); //$NON-NLS-1$ exception.printStackTrace(); return false; } /** * Shutsdown the connection to the remote test listener. */ private void shutDown() { if (fWriter != null) { fWriter.close(); fWriter= null; } try { if (fReader != null) { fReader.close(); fReader= null; } } catch(IOException e) { if (fDebugMode) e.printStackTrace(); } try { if (fClientSocket != null) { fClientSocket.close(); fClientSocket= null; } } catch(IOException e) { if (fDebugMode) e.printStackTrace(); } } private void sendMessage(String msg) { if(fWriter == null) return; fWriter.println(msg); } private void notifyTestRunStarted(int testCount) { sendMessage(MessageIds.TEST_RUN_START + testCount); } private void notifyTestRunEnded(long elapsedTime) { sendMessage(MessageIds.TEST_RUN_END + elapsedTime); fWriter.flush(); //shutDown(); } private void notifyTestRunStopped(long elapsedTime) { sendMessage(MessageIds.TEST_STOPPED + elapsedTime ); fWriter.flush(); //shutDown(); } private void notifyTestStarted(Test test) { sendMessage(MessageIds.TEST_START + getTestId(test) + ','+test.toString()); fWriter.flush(); } private void notifyTestEnded(Test test) { sendMessage(MessageIds.TEST_END + getTestId(test)+','+getTestName(test)); } private void notifyTestFailed(Test test, String status, String trace) { sendMessage(status + getTestId(test) + ',' + getTestName(test)); sendMessage(MessageIds.TRACE_START); sendMessage(trace); sendMessage(MessageIds.TRACE_END); fWriter.flush(); } private void notifyTestTreeEntry(String treeEntry) { sendMessage(MessageIds.TEST_TREE + treeEntry); } private void notifyTestReran(TestResult result, String testId, String testClass, String testName) { TestFailure failure= null; if (result.errorCount() > 0) { failure= (TestFailure)result.errors().nextElement(); } if (result.failureCount() > 0) { failure= (TestFailure)result.failures().nextElement(); } if (failure != null) { Throwable t= failure.thrownException(); String trace= getTrace(t); sendMessage(MessageIds.RTRACE_START); sendMessage(trace); sendMessage(MessageIds.RTRACE_END); fWriter.flush(); } String status= "OK"; //$NON-NLS-1$ if (result.errorCount() > 0) status= "ERROR"; //$NON-NLS-1$ else if (result.failureCount() > 0) status= "FAILURE"; //$NON-NLS-1$ if (fPort != -1) { sendMessage(MessageIds.TEST_RERAN + testId+ " "+testClass+" "+testName+" "+status); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ fWriter.flush(); } } }
33,458
Bug 33458 StringIndexOutOfBoundsException from Junit HierarchyRunView
20030227 I am attempting to run my PDE JUnit tests for Debug and Ant Core. All produce similar stack traces to the following: java.lang.StringIndexOutOfBoundsException: String index out of range: -57 at java.lang.String.substring(String.java:1480) at org.eclipse.jdt.internal.junit.ui.HierarchyRunView.newTreeEntry (HierarchyRunView.java:305) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart$4.run (TestRunnerViewPart.java:477) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:31) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:94) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1752) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1487) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
resolved fixed
cf6929e
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T11:59:24Z
2003-02-27T18:20:00Z
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/RemoteTestRunnerClient.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * Julien Ruaux: [email protected] * Vincent Massol: [email protected] ******************************************************************************/ package org.eclipse.jdt.internal.junit.ui; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.Platform; import org.eclipse.jdt.internal.junit.runner.MessageIds; import org.eclipse.jdt.junit.ITestRunListener; /** * The client side of the RemoteTestRunner. Handles the * marshalling of th different messages. */ public class RemoteTestRunnerClient { public abstract class ListenerSafeRunnable implements ISafeRunnable { public void handleException(Throwable exception) { JUnitPlugin.log(exception); } } /** * An array of listeners that are informed about test events. */ private ITestRunListener[] fListeners; /** * The server socket */ private ServerSocket fServerSocket; private Socket fSocket; private int fPort= -1; private PrintWriter fWriter; private BufferedReader fBufferedReader; /** * RemoteTestRunner is sending trace. */ private boolean fInReadTrace= false; /** * RemoteTestRunner is sending the rerun trace. */ private boolean fInReadRerunTrace= false; /** * The failed test that is currently reported from the RemoteTestRunner */ private String fFailedTest; /** * The Id of the failed test */ private String fFailedTestId; /** * The failed trace that is currently reported from the RemoteTestRunner */ private String fFailedTrace; /** * The failed trace of a reran test */ private String fFailedRerunTrace; /** * The kind of failure of the test that is currently reported as failed */ private int fFailureKind; private boolean fDebug= false; /** * Reads the message stream from the RemoteTestRunner */ private class ServerConnection extends Thread { int fPort; public ServerConnection(int port) { super("ServerConnection"); //$NON-NLS-1$ fPort= port; } public void run() { try { if (fDebug) System.out.println("Creating server socket "+fPort); //$NON-NLS-1$ fServerSocket= new ServerSocket(fPort); fSocket= fServerSocket.accept(); fBufferedReader= new BufferedReader(new InputStreamReader(fSocket.getInputStream())); fWriter= new PrintWriter(fSocket.getOutputStream(), true); String message; while(fBufferedReader != null && (message= readMessage(fBufferedReader)) != null) receiveMessage(message); } catch (SocketException e) { notifyTestRunTerminated(); } catch (IOException e) { System.out.println(e); // fall through } shutDown(); } } /** * Start listening to a test run. Start a server connection that * the RemoteTestRunner can connect to. */ public synchronized void startListening( ITestRunListener[] listeners, int port) { fListeners = listeners; fPort = port; ServerConnection connection = new ServerConnection(port); connection.start(); } /** * Requests to stop the remote test run. */ public synchronized void stopTest() { if (isRunning()) { fWriter.println(MessageIds.TEST_STOP); fWriter.flush(); } } private synchronized void shutDown() { if (fDebug) System.out.println("shutdown "+fPort); //$NON-NLS-1$ if (fWriter != null) { fWriter.close(); fWriter= null; } try { if (fBufferedReader != null) { fBufferedReader.close(); fBufferedReader= null; } } catch(IOException e) { } try{ if(fSocket != null) { fSocket.close(); fSocket= null; } } catch(IOException e) { } try{ if(fServerSocket != null) { fServerSocket.close(); fServerSocket= null; } } catch(IOException e) { } } public boolean isRunning() { return fSocket != null; } private String readMessage(BufferedReader in) throws IOException { return in.readLine(); } private void receiveMessage(String message) { if (message.startsWith(MessageIds.TRACE_START)) { fInReadTrace= true; fFailedTrace= ""; //$NON-NLS-1$ return; } if (message.startsWith(MessageIds.TRACE_END)) { fInReadTrace = false; notifyTestFailed(); fFailedTrace = ""; //$NON-NLS-1$ return; } if (fInReadTrace) { fFailedTrace+= message + '\n'; return; } if (message.startsWith(MessageIds.RTRACE_START)) { fInReadRerunTrace= true; fFailedRerunTrace= ""; //$NON-NLS-1$ return; } if (message.startsWith(MessageIds.RTRACE_END)) { fInReadRerunTrace= false; return; } if (fInReadRerunTrace) { fFailedRerunTrace+= message + '\n'; return; } String arg= message.substring(MessageIds.MSG_HEADER_LENGTH); if (message.startsWith(MessageIds.TEST_RUN_START)) { int count = Integer.parseInt(arg); notifyTestRunStarted(count); return; } if (message.startsWith(MessageIds.TEST_START)) { notifyTestStarted(arg); return; } if (message.startsWith(MessageIds.TEST_END)) { notifyTestEnded(arg); return; } if (message.startsWith(MessageIds.TEST_ERROR)) { extractFailure(arg, ITestRunListener.STATUS_ERROR); return; } if (message.startsWith(MessageIds.TEST_FAILED)) { extractFailure(arg, ITestRunListener.STATUS_FAILURE); return; } if (message.startsWith(MessageIds.TEST_RUN_END)) { long elapsedTime = Long.parseLong(arg); testRunEnded(elapsedTime); return; } if (message.startsWith(MessageIds.TEST_STOPPED)) { long elapsedTime = Long.parseLong(arg); notifyTestRunStopped(elapsedTime); shutDown(); return; } if (message.startsWith(MessageIds.TEST_TREE)) { notifyTestTreeEntry(arg); return; } if (message.startsWith(MessageIds.TEST_RERAN)) { // format: testId" "className" "testName" "status // status: FAILURE, ERROR, OK int i= arg.indexOf(' '); int c= arg.indexOf(' ', i+1); //$NON-NLS-1$ int t= arg.indexOf(' ', c+1); //$NON-NLS-1$ String testId= arg.substring(0, i); String className= arg.substring(i+1, c); String testName= arg.substring(c+1, t); String status= arg.substring(t+1); int statusCode= ITestRunListener.STATUS_OK; if (status.equals("FAILURE")) //$NON-NLS-1$ statusCode= ITestRunListener.STATUS_FAILURE; else if (status.equals("ERROR")) //$NON-NLS-1$ statusCode= ITestRunListener.STATUS_ERROR; String trace= ""; //$NON-NLS-1$ if (statusCode != ITestRunListener.STATUS_OK) trace = fFailedRerunTrace; // assumption a rerun trace was sent before notifyTestReran(testId, className, testName, statusCode, trace); } } private void extractFailure(String arg, int status) { String s[]= extractTestId(arg); fFailedTestId= s[0]; fFailedTest= s[1]; fFailureKind= status; } /** * Returns an array with two elements. The first one is the testId, the second one the testName. */ String[] extractTestId(String arg) { int i= arg.indexOf(','); String[] result= new String[2]; result[0]= arg.substring(0, i); result[1]= arg.substring(i+1, arg.length()); return result; } private void notifyTestReran(final String testId, final String className, final String testName, final int statusCode, final String trace) { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { listener.testReran(testId, className, testName, statusCode, trace); } }); } } private void notifyTestTreeEntry(final String treeEntry) { for (int i= 0; i < fListeners.length; i++) { if (fListeners[i] instanceof ITestRunListener2) { ITestRunListener2 listener= (ITestRunListener2)fListeners[i]; listener.testTreeEntry(treeEntry); } } } private void notifyTestRunStopped(final long elapsedTime) { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { listener.testRunStopped(elapsedTime); } }); } } private void testRunEnded(final long elapsedTime) { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { listener.testRunEnded(elapsedTime); } }); } } private void notifyTestEnded(final String test) { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { String s[]= extractTestId(test); listener.testEnded(s[0], s[1]); } }); } } private void notifyTestStarted(final String test) { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { String s[]= extractTestId(test); listener.testStarted(s[0], s[1]); } }); } } private void notifyTestRunStarted(final int count) { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { listener.testRunStarted(count); } }); } } private void notifyTestFailed() { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { listener.testFailed(fFailureKind, fFailedTestId, fFailedTest, fFailedTrace); } }); } } private void notifyTestRunTerminated() { for (int i= 0; i < fListeners.length; i++) { final ITestRunListener listener= fListeners[i]; Platform.run(new ListenerSafeRunnable() { public void run() { listener.testRunTerminated(); } }); } } public void rerunTest(String testId, String className, String testName) { if (isRunning()) { fWriter.println(MessageIds.TEST_RERUN+testId+" "+className+" "+testName); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.flush(); } } }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test1/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test10/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test11/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test12/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test13/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test14/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test15/out/I.java
package p; /** typecomment template*/ interface I { void m(); void m1(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test16/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test17/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test18/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test19/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test2/out/I.java
package p; import java.util.List; /** typecomment template*/ interface I { List m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test20/out/I.java
package p; /** typecomment template*/ interface I { void m(); void m1(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test21/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test22/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test23/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test24/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test25/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test26/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test27/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test28/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test29/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test3/out/I.java
package p; /** typecomment template*/ interface I { void m(); }
32,626
Bug 32626 [refactor] extract interface causing exception
Got the following exception extracting an interface using RC1: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:307) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:247) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:357) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.ExtractInterfaceInputPage.performFinish (ExtractInterfaceInputPage.java:207) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:420) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:364) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:250) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:417) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.jface.window.Window.runEventLoop(Window.java:577) at org.eclipse.jface.window.Window.open(Window.java:557) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:60) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.startRefactoring (ExtractInterfaceAction.java:158) at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run (ExtractInterfaceAction.java:94) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:841) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1775) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1483) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1271) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1254) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: null argument;Variable typecommentnot defined at org.eclipse.jdt.internal.corext.Assert.isNotNull(Assert.java:99) at org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext.evaluate (CodeTemplateContext.java:46) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.getCompilationUnitC ontent(StubUtility.java:300) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterfaceCUSource(ExtractInterfaceRefactoring.java:443) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createExtractedInterface(ExtractInterfaceRefactoring.java:366) at org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceRefactorin g.createChange(ExtractInterfaceRefactoring.java:259) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:98) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) ... 42 more
resolved fixed
ac677f6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-03-04T12:28:06Z
2003-02-24T12:33:20Z
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test30/out/I.java
package p; /** typecomment template*/ interface I { void m(); }