auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isIncluded(Location reference, Location included) { return reference.getUri().equals(included.getUri()) START && !isSameRange(reference.getRange(), included.getRange()) END && isAfter(reference.getRange().getStart(), included.getRange().getStart()) && isAfter(included.getRange().getEnd(), reference.getRange().getEnd()); } Doesn't reference.equals(included) work?

Target:
private boolean isIncluded(Location reference, Location included) { return reference.getUri().equals(included.getUri()) && !reference.equals(included) && isAfter(reference.getRange().getStart(), included.getRange().getStart()) && isAfter(included.getRange().getEnd(), reference.getRange().getEnd()); }
Source:
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { START PresentationReconcilerCPP.this.setupDocument(newInput); END } It is sufficient to write: setupDocument(newInput);

Target:
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { setupDocument(newInput); }
Source:
public IVariable getVariable(int offset) throws DebugException { if (offset >= getLength()) { requestFailed(JDIDebugModelMessages.JDIArrayValue_6, new START IndexOutOfBoundsException()); END } return new JDIArrayEntryVariable(getJavaDebugTarget(), getArrayReference(), offset, fLogicalParent); } Here and below: please add requested offset value like: throw new IndexOutOfBoundsException(Integer.toString(offset));

Target:
public IVariable getVariable(int offset) throws DebugException { if (offset >= getLength()) { requestFailed(JDIDebugModelMessages.JDIArrayValue_6, new IndexOutOfBoundsException(Integer.toString(offset))); } return new JDIArrayEntryVariable(getJavaDebugTarget(), getArrayReference(), offset, fLogicalParent); }
Source:
START protected void assertEvaluationIsError() throws Exception { END IValue value = getValue(); assertEquals(value, IntegralValue.ERROR); } I'm not sure how much value there is in distinguishing these two cases. It may be simpler to just have a single function, assertEvaluationIsError(), which checks for either.

Target:
protected void assertEvaluationIsError() throws Exception { IValue value = getValue(); assertEquals(IntegralValue.ERROR, value); }
Source:
START public PcapTimestampScale getTimestampPrecision() { END if (getTsResolNg(fInterfaceID - 1) == 6) { return PcapTimestampScale.MICROSECOND; } return PcapTimestampScale.NANOSECOND; } This method does not belong in PcapNgFile because there is no global timestamp precision per file.

Target:
public PcapTimestampScale getTimestampPrecision() { return PcapTimestampScale.MICROSECOND; }
Source:
public static PcapFile getPcapFile(Path filePath) throws IOException, BadPcapFileException { START if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { try (PcapFile dummy = new PcapNgFile(filePath)) { return dummy; } } try (PcapFile dummy = new PcapOldFile(filePath)) { return dummy; } END } I think you should just return the file and the caller will handle the close. if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { return new PcapNgFile(filePath); } return new PcapOldFile(filePath);

Target:
public static PcapFile getPcapFile(Path filePath) throws IOException, BadPcapFileException { if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { return new PcapNgFile(filePath); } return new PcapOldFile(filePath); }
Source:
public START @NonNull ByteBuffer END getBody() { return fBody; } Remove @NonNull annotation.

Target:
public ByteBuffer getBody() { return fBody; }
Source:
protected static String getLineDelimiterPreference(IFile file) { IScopeContext[] scopeContext; if (file != null) { ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); ITextFileBuffer buffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); return TextUtilities.getDefaultLineDelimiter(buffer.getDocument()); } // workspace preference scopeContext = new IScopeContext[] { START InstanceScope.INSTANCE }; END return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext); } Please note, that this ignores product default settings, which is not good.

Target:
protected static String getLineDelimiterPreference(IFile file) { if (file != null) { ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); ITextFileBuffer buffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); if (buffer != null) { return TextUtilities.getDefaultLineDelimiter(buffer.getDocument()); } } return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, null); }
Source:
private void updateEnableStates() { boolean enabledCodeMining= getCheckBox(PREF_CODEMINING_ENABLED).getSelection(); if (enabledCodeMining) { // Show references checkboxes boolean showReferences= getCheckBox(PREF_SHOW_REFERENCES).getSelection(); getCheckBox(PREF_SHOW_REFERENCES_ON_CLASSES).setEnabled(showReferences); getCheckBox(PREF_SHOW_REFERENCES_ON_FIELDS).setEnabled(showReferences); getCheckBox(PREF_SHOW_REFERENCES_ON_METHODS).setEnabled(showReferences); // Show implementations checkboxes boolean START showImplementations= getCheckBox(PREF_SHOW_IMPLEMENTATIONS).getSelection(); END } else { atLeastOneCheckBox.setEnabled(false); fFilteredPrefTree.setEnabled(false); } } The local variable is never used and results in a warning.

Target:
private void updateEnableStates() { boolean enabledCodeMining= getCheckBox(PREF_CODEMINING_ENABLED).getSelection(); if (enabledCodeMining) { // Show references checkboxes boolean showReferences= getCheckBox(PREF_SHOW_REFERENCES).getSelection(); getCheckBox(PREF_SHOW_REFERENCES_ON_CLASSES).setEnabled(showReferences); getCheckBox(PREF_SHOW_REFERENCES_ON_FIELDS).setEnabled(showReferences); getCheckBox(PREF_SHOW_REFERENCES_ON_METHODS).setEnabled(showReferences); // Show implementations checkboxes getCheckBox(PREF_SHOW_IMPLEMENTATIONS).getSelection(); } else { atLeastOneCheckBox.setEnabled(false); fFilteredPrefTree.setEnabled(false); } }
Source:
private void handlePropertyChangeEvent(PropertyChangeEvent event) { if (fPreferenceStore == null) { return; // Uninstalled during event notification } START if (fEditor != null && fEditor.affectsJavaCodeMining(event, false)) { END if (isJavaCodeMiningEnabled()) { enable(); } else { disable(); } } } I think it'd be better to directly use fEditor.affectsJavaCodeMining(event.getPropertyName())

Target:
private void handlePropertyChangeEvent(PropertyChangeEvent event) { if (fPreferenceStore == null) { return; // Uninstalled during event notification } if (fEditor != null && fEditor.affectsJavaCodeMining(event)) { if (isJavaCodeMiningEnabled()) { enable(); } else { disable(); } } }
Source:
START public static END Resource getResource(final ResourceSet resourceSet, final URI resourceURI) { Resource resource = null; try { resource = resourceSet.getResource(resourceURI, true); } catch (WrappedException e) { SiriusPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, e.getMessage(), e)); } return resource; } Should be private, no reason to expose this helper more than strictly necessary.

Target:
private static Resource getResource(final ResourceSet resourceSet, final URI resourceURI) { Resource resource = null; try { resource = resourceSet.getResource(resourceURI, true); } catch (WrappedException e) { SiriusPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, e.getMessage(), e)); } return resource; }
Source:
public int getVersion() { return START 2; END } Version 3 I think ?

Target:
public int getVersion() { return 3; }
Source:
protected boolean mergeImpl() throws IOException { if (implicitDirCache) { dircache = nonNullRepo().lockDirCache(); } if (!inCore) { checkoutMetadata = new HashMap<>(); } try { return mergeTrees(mergeBase(), sourceTrees[0], sourceTrees[1], false); } finally { if (implicitDirCache) { dircache.unlock(); } START checkoutMetadata = null; END } } Would it make sense to move above the unlock call? Could unlock throw and then not properly unset this?

Target:
protected boolean mergeImpl() throws IOException { if (implicitDirCache) { dircache = nonNullRepo().lockDirCache(); } if (!inCore) { checkoutMetadata = new HashMap<>(); } try { return mergeTrees(mergeBase(), sourceTrees[0], sourceTrees[1], false); } finally { checkoutMetadata = null; if (implicitDirCache) { dircache.unlock(); } } }
Source:
START public static Set<Bundle> getBundlesBySymbolicName(BundleContext bundleContext, String symbolicName) { return Arrays.stream(bundleContext.getBundles()) .filter(bundle -> bundle.adapt(BundleRevision.class).getSymbolicName().equals(symbolicName)) .collect(toSet()); } END This will NPE if BundleRevision.getSymbolicName() returns null, I would reverse the equals target to be symbolicName.equals(bundle.adapt(BundleRevision.class).getSymbolicName()) This does not scale well if you have large numbers of bundles. If this is a hotspot of your code you can consider using org.osgi.framework.wiring.FrameworkWiring.findProviders(Requirement) using an "osgi.identity" namespace requirement. If I recall correctly virgo uses Equinox regions. That can end up hiding bundles from a BundleContext perspective. Using FrameworkWiring.findProviders would bypass the equinox region hooks so you need to be aware of that.

Target:
public static Set<Bundle> getBundlesBySymbolicName(BundleContext bundleContext, String symbolicName) { return Arrays.stream(bundleContext.getBundles()) .filter(bundle -> symbolicName.equals(bundle.adapt(BundleRevision.class).getSymbolicName())) .collect(toSet()); }
Source:
private CommunicationChannel getComChannel(boolean local, Event sourceEvent, Connection connection) { CommunicationChannel channel = communicationModel.getChannels().get(sourceEvent); if START (channel == null) { END if(connection instanceof EventConnection) { //currently only add a channel if an event, data connection should attach to existing channels channel = new CommunicationChannel(); channel.setSourceEvent(sourceEvent); channel.setLocal(local); communicationModel.getChannels().put(sourceEvent, channel); } } else if (!local) { //force non local if needed channel.setLocal(false); } return channel; } not sure if this coding rule also applies to our Java code, but null should be lhs

Target:
private CommunicationChannel getComChannel(boolean local, Event sourceEvent, Connection connection) { CommunicationChannel channel = communicationModel.getChannels().get(sourceEvent); if (null == channel) { if(connection instanceof EventConnection) { //currently only add a channel if an event, data connection should attach to existing channels channel = new CommunicationChannel(); channel.setSourceEvent(sourceEvent); channel.setLocal(local); communicationModel.getChannels().put(sourceEvent, channel); } } else if (!local) { //force non local if needed channel.setLocal(false); } return channel; }
Source:
File getActiveFile() { IWorkbenchPage workbenchPage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getService(IWorkbenchPage.class); IEditorPart activeEditor = workbenchPage.getActiveEditor(); START if (activeEditor == null) END return null; IEditorInput editorInput = activeEditor.getEditorInput(); return Adapters.adapt(editorInput, File.class); } missing braces

Target:
File getActiveFile() { IWorkbenchPage workbenchPage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getService(IWorkbenchPage.class); IEditorPart activeEditor = workbenchPage.getActiveEditor(); if (activeEditor == null) { return null; } IEditorInput editorInput = activeEditor.getEditorInput(); return Adapters.adapt(editorInput, File.class); }
Source:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); if START (!refactoringStatus.isOK()) END { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus= RefactoringStatus.create(Resources.checkInSync(fResource)); } } return refactoringStatus; } I think refactoringStatus can be null as we see in org.eclipse.ltk.core.refactoring.RefactoringStatus.merge(RefactoringStatus)

Target:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); if (refactoringStatus != null && !refactoringStatus.isOK()) { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus= RefactoringStatus.create(Resources.checkInSync(fResource)); } } return refactoringStatus; }
Source:
public static boolean isShowingEntireContents(StyledText widget) { if (widget.getTopPixel() != 0) // more efficient shortcut return false; int lastVisiblePixel= computeLastVisiblePixel(widget); int bottom= widget.getLineIndex(lastVisiblePixel); START if (bottom + 1 < widget.getLineCount()) // There's definitely more lines below END return false; // Check whether the last line is fully visible int bottomLastPixel= getLinePixel(widget, bottom + 1) - 1; return bottomLastPixel <= lastVisiblePixel; } What's the policy on curly braces in JFace? In EGit we would require them.

Target:
public static boolean isShowingEntireContents(StyledText widget) { if (widget.getTopPixel() != 0) { // more efficient shortcut return false; } int lastVisiblePixel= computeLastVisiblePixel(widget); int bottom= widget.getLineIndex(lastVisiblePixel); if (bottom + 1 < widget.getLineCount()) { // There's definitely more lines below return false; } // Check whether the last line is fully visible int bottomLastPixel= getLinePixel(widget, bottom + 1) - 1; return bottomLastPixel <= lastVisiblePixel; }
Source:
public static void markAsLinkNote(View view) { EAnnotation specificStyles = view.getEAnnotation(ViewQuery.SPECIFIC_STYLES); START if (specificStyles == null) { specificStyles = EcoreFactory.eINSTANCE.createEAnnotation(); specificStyles.setSource(ViewQuery.SPECIFIC_STYLES); specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null); view.getEAnnotations().add(specificStyles); } else { specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null); } END } if (specificStyles == null) { specificStyles = EcoreFactory.eINSTANCE.createEAnnotation(); specificStyles.setSource(ViewQuery.SPECIFIC_STYLES); view.getEAnnotations().add(specificStyles); } specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null);

Target:
public static void markAsLinkNote(View view) { EAnnotation specificStyles = view.getEAnnotation(ViewQuery.SPECIFIC_STYLES); if (specificStyles == null) { specificStyles = EcoreFactory.eINSTANCE.createEAnnotation(); specificStyles.setSource(ViewQuery.SPECIFIC_STYLES); view.getEAnnotations().add(specificStyles); } specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null); }
Source:
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { EObject element = view.getElement(); if (element instanceof DRepresentationDescriptor) { markAsLinkNote(view); } START super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); END } I think it is better to call the super..decorateView in first

Target:
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); EObject element = view.getElement(); if (element instanceof DRepresentationDescriptor) { markAsLinkNote(view); } }
Source:
public void run() { START count--; END AbstractContributionItem[] copy = itemsToUpdateLater.toArray(new AbstractContributionItem[] {}); itemsToUpdateLater.clear(); for (AbstractContributionItem it : copy) { it.updateItemEnablement(); } } -- or set to zero?

Target:
public void run() { count = 0; AbstractContributionItem[] copy = itemsToUpdateLater.toArray(new AbstractContributionItem[] {}); itemsToUpdateLater.clear(); for (AbstractContributionItem it : copy) { it.updateItemEnablement(); } }
Source:
private ProjectTrackerPreferenceSnapshot takeSnapshot() { String branch = getBranch(); if (StringUtils.isEmptyOrNull(branch)) return null; List<String> projectPaths = getAssociatedProjectsPaths(); START if (projectPaths == null) END return null; return new ProjectTrackerPreferenceSnapshot(repository, branch, projectPaths); } What about projectPaths.isEmpty()? Maybe use @NonNull List<String> getAssociatedProjectsPaths() returning Collections.emptyList() instead of null and then test here for projectPaths.isEmpty().

Target:
private ProjectTrackerPreferenceSnapshot takeSnapshot() { String branch = getBranch(); if (StringUtils.isEmptyOrNull(branch)) return null; List<String> projectPaths = getAssociatedProjectsPaths(); if (projectPaths.isEmpty()) { return null; } return new ProjectTrackerPreferenceSnapshot(repository, branch, projectPaths); }
Source:
private void handleMultipleRepositoryCheckoutError( Map<Repository, CheckoutResult> results) { START PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { END @Override public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new MultiBranchOperationResultDialog(shell, results).open(); } }); } Lambda?

Target:
private void handleMultipleRepositoryCheckoutError( Map<Repository, CheckoutResult> results) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new MultiBranchOperationResultDialog(shell, results).open(); } ); }
Source:
private boolean allBranchOperationsSucceeded( final @NonNull Map<Repository, CheckoutResult> results) { return START results.entrySet().stream() // .map(Map.Entry::getValue) // .allMatch(r END -> r.getStatus() == CheckoutResult.Status.OK); } How about results.values().stream().allMatch(...) ?

Target:
private boolean allBranchOperationsSucceeded( final @NonNull Map<Repository, CheckoutResult> results) { return results.values().stream() .allMatch(r -> r.getStatus() == CheckoutResult.Status.OK); }
Source:
private boolean anyRepositoryIsInDetachedHeadState( final @NonNull Map<Repository, CheckoutResult> results) { return START results.entrySet().stream() // .map(Map.Entry::getKey) // .anyMatch(RepositoryUtil::isDetachedHead); END } Same here: results.keySet().stream().anyMatch(...)

Target:
private boolean anyRepositoryIsInDetachedHeadState( final @NonNull Map<Repository, CheckoutResult> results) { return results.keySet().stream() .anyMatch(RepositoryUtil::isDetachedHead); }
Source:
public List<Ref> getRefsByPrefix(String... prefixes) throws IOException { List<Ref> result = new ArrayList<>(); START if (prefixes.length == 0) { END result.addAll(getRefsByPrefix(ALL)); } else { for (String prefix : prefixes) { result.addAll(getRefsByPrefix(prefix)); } } return Collections.unmodifiableList(result); } Do we need this special case? Why not use the 'else' case unconditionally (so that calling getRefsByPrefix(new String[]{}) would produce an empty list)?

Target:
public List<Ref> getRefsByPrefix(String... prefixes) throws IOException { List<Ref> result = new ArrayList<>(); for (String prefix : prefixes) { result.addAll(getRefsByPrefix(prefix)); } return Collections.unmodifiableList(result); }
Source:
START public void testGetRefsByPrefixes() throws IOException { END List<Ref> refs = db.getRefDatabase().getRefsByPrefix("refs/heads/p", "refs/tags/A"); assertEquals(3, refs.size()); checkContainsRef(refs, db.exactRef("refs/heads/prefix/a")); checkContainsRef(refs, db.exactRef("refs/heads/pa")); checkContainsRef(refs, db.exactRef("refs/tags/A")); } A few more cases discussed during review: * can we have a test for getRefsByPrefix()? * what about ordering of the result? It seems like it's well defined, so should this use something like assertArrayEquals? * what happens with overlapping prefixes?

Target:
public void testGetRefsByPrefixes() throws IOException { List<Ref> refs = db.getRefDatabase().getRefsByPrefix(); assertEquals(0, refs.size()); refs = db.getRefDatabase().getRefsByPrefix("refs/heads/p", "refs/tags/A"); assertEquals(3, refs.size()); checkContainsRef(refs, db.exactRef("refs/heads/prefix/a")); checkContainsRef(refs, db.exactRef("refs/heads/pa")); checkContainsRef(refs, db.exactRef("refs/tags/A")); }
Source:
public void setMessage (String message) { checkWidget (); if (message == null) error (SWT.ERROR_NULL_ARGUMENT); this.message = message; START if (GTK.GTK_VERSION >= OS.VERSION (3, 4, 0)) { END if ((style & SWT.SINGLE) != 0) { byte buffer = Converter.wcsToMbcs (message, true); GTK.gtk_entry_set_placeholder_text (handle, buffer); return; } } redraw (false); } SWT requires 3.4 already so the guard can be removed.

Target:
public void setMessage (String message) { checkWidget (); if (message == null) error (SWT.ERROR_NULL_ARGUMENT); this.message = message; if ((style & SWT.SINGLE) != 0) { byte buffer = Converter.wcsToMbcs (message, true); GTK.gtk_entry_set_placeholder_text (handle, buffer); return; } redraw (false); }
Source:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); START installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new DurationConstraintLinkSelectionHandlesEditPolicy(this, getEditingDomain())); END } Modifying generated code is risky. We should extend the EditParts (with a CustomDurationConstraintLinkEditPart), and instantiate these custom parts in org.eclipse.papyrus.uml.diagram.sequence.providers.CustomEditPartProvider Also, DurationObservationLinkEditPart should be modified in the same way

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); }
Source:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration, boolean isJUnit) { configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, START !isJUnit); END boolean useDefaultArea = !isJUnit || LaunchArgumentsHelper.getDefaultJUnitWorkspaceIsContainer(); configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, useDefaultArea); String location; if (isJUnit && !useDefaultArea) { location = LaunchArgumentsHelper.getDefaultJUnitConfigurationLocation(); } else { location = DEFAULT_DIR + configuration.getName(); } configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, location); } please just seto to true. Before: true for tests but false for users. After it should be just true by default for all.

Target:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration, boolean isJUnit) { configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, true); boolean useDefaultArea = !isJUnit || LaunchArgumentsHelper.getDefaultJUnitWorkspaceIsContainer(); configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, useDefaultArea); String location; if (isJUnit && !useDefaultArea) { location = LaunchArgumentsHelper.getDefaultJUnitConfigurationLocation(); } else { location = DEFAULT_DIR + configuration.getName(); } configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, location); }
Source:
private static List<? extends ICodeMining> logCodeMiningProviderException(Throwable e) { String PLUGIN_ID= "org.eclipse.jface.text"; //$NON-NLS-1$ ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); START return new ArrayList<>(); END } Still, I don't think this method should return a value. Without the context of usage, it's not clear why there is a return value.

Target:
private static void logCodeMiningProviderException(Throwable e) { String PLUGIN_ID= "org.eclipse.jface.text"; //$NON-NLS-1$ ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); }
Source:
public static Collection<Stereotype> getAllSuperStereotypes(Stereotype stereotype) { Set<Stereotype> result = new START HashSet<>(); END if (stereotype != null) { getAllSuperStereotypes(stereotype, result); } return result; } type!

Target:
public static Collection<Stereotype> getAllSuperStereotypes(Stereotype stereotype) { Set<Stereotype> result = new HashSet<Stereotype>(); if (stereotype != null) { getAllSuperStereotypes(stereotype, result); } return result; }
Source:
private void createPaintListener(final Table rawTable) { // Tell SWT we will completely handle painting for some columns. // rawTable.addListener(SWT.EraseItem, new Listener() { @Override public void handleEvent(final Event event) { if START (0 <= event.index && event.index <= 5) END event.detail &= ~SWT.FOREGROUND; } }); rawTable.addListener(SWT.PaintItem, new Listener() { @Override public void handleEvent(final Event event) { doPaint(event); } }); } Why the heck are we painting all columns ourselves? We only need to draw column 1 containing the graphical commit tree. This suggests a nice two-liner to fix this: replace above by event.index == 1 and...

Target:
private void createPaintListener(final Table rawTable) { // Tell SWT we will completely handle painting for some columns. // rawTable.addListener(SWT.EraseItem, new Listener() { @Override public void handleEvent(final Event event) { if (event.index == 1) { event.detail &= ~SWT.FOREGROUND; } } }); rawTable.addListener(SWT.PaintItem, new Listener() { @Override public void handleEvent(final Event event) { if (event.index == 1) { doPaint(event); } } }); }
Source:
START public int getLineVerticalIndent(int index) { END checkWidget(); if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineVerticalIndent(index, verticalIndent); } Throws AIOOB exception when called with index = line count.

Target:
public int getLineVerticalIndent(int index) { checkWidget(); if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineVerticalIndent(index); }
Source:
START private String hostName(String host, int port) { END if (port == SSH_PORT) { return host; } return String.format("[%s]:%d", host, port); } static?

Target:
private static String hostName(String host, int port) { if (port == SSH_PORT) { return host; } return String.format("[%s]:%d", host, port); //$NON-NLS-1$ }
Source:
private void enableAllFields() { languageLabel.setEnabled(true); START if(algorithmGroup != null) algorithmGroup.setEnabled(true); END commentLabel.setEnabled(true); commentText.setEnabled(true); languageCombo.setEnabled(true); } better make these methods protected and move the algorithmGroup soly to the algorithmgroup class and override the methods where it is used here

Target:
protected void enableAllFields() { languageLabel.setEnabled(true); algorithmGroup.setEnabled(true); commentLabel.setEnabled(true); commentText.setEnabled(true); languageCombo.setEnabled(true); }
Source:
public synchronized void addChild(AbstractCalledFunction child, AggregatedCalledFunction aggregatedChild) { // Update the child's statistics with itself START fSelfTime -= aggregatedChild.getDuration(); END if (child.getDepth() >= 0) { aggregatedChild.getFunctionStatistics().update(child); } AggregatedCalledFunction node = fChildren.get(aggregatedChild.getSymbol()); if (node == null) { fChildren.put(aggregatedChild.getSymbol(), aggregatedChild); } else { merge(node, aggregatedChild); } } The self time should also not be decremented.

Target:
public synchronized void addChild(AbstractCalledFunction child, AggregatedCalledFunction aggregatedChild) { // Update the child's statistics with itself if (child.getDepth() >= 0) { fSelfTime -= aggregatedChild.getDuration(); aggregatedChild.getFunctionStatistics().update(child); } AggregatedCalledFunction node = fChildren.get(aggregatedChild.getSymbol()); if (node == null) { fChildren.put(aggregatedChild.getSymbol(), aggregatedChild); } else { merge(node, aggregatedChild); } }
Source:
public FsckError check(ProgressMonitor pm) throws IOException { if (pm == null) { pm = NullProgressMonitor.INSTANCE; } FsckError errors = new FsckError(); if (!connectivityOnly) { checkPacks(pm, errors); } checkConnectivity(pm, errors); START objChecker.reset(); END return errors; } In the spirit of defensive programming, I think it would be easiest to have this reset() call to right before checkPacks. (Fewer hard-to-reproduce issues due to a caller leaving some state in the objChecker.)

Target:
public FsckError check(ProgressMonitor pm) throws IOException { if (pm == null) { pm = NullProgressMonitor.INSTANCE; } FsckError errors = new FsckError(); if (!connectivityOnly) { objChecker.reset(); checkPacks(pm, errors); } checkConnectivity(pm, errors); return errors; }
Source:
public static void assertValidSubmoduleUri(String uri) throws SubmoduleValidationException { if (uri.startsWith("-")) { //$NON-NLS-1$ throw new SubmoduleValidationException( MessageFormat.format( JGitText.get().submoduleUrlInvalid, uri), START ObjectChecker.ErrorType.GITMODULES_URL); END } } Ack

Target:
public static void assertValidSubmoduleUri(String uri) throws SubmoduleValidationException { if (uri.startsWith("-")) { //$NON-NLS-1$ throw new SubmoduleValidationException( MessageFormat.format( JGitText.get().submoduleUrlInvalid, uri), GITMODULES_URL); } }
Source:
Object doConvert(BoxedValue input) throws CoreException { if (input instanceof EclString) { String value = ((EclString) input).getValue(); START if (value.equals("inf") || value.equals("+inf")) { END return Double.POSITIVE_INFINITY; } if (value.equals("-inf")) { return Double.NEGATIVE_INFINITY; } } return BoxedValues.toDouble(input); } Lets check if Java allows uppercase literals and if so accept them too.

Target:
Object doConvert(BoxedValue input) throws CoreException { if (input instanceof EclString) { final String value = ((EclString) input).getValue(); return Double.valueOf(value); } return BoxedValues.toDouble(input); }
Source:
protected @Nullable String getSegmentType(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; // FIXME work around this trace START ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); END if (trace != null) { Object symbol = calledFunction.getSymbol(); return String.valueOf(symbol); } } return null; } why do you need the trace here?

Target:
protected @Nullable String getSegmentType(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; return String.valueOf(calledFunction.getSymbol()); } return null; }
Source:
public void testFirstWantValidCapabilityNames() throws PackProtocolException { List<String> validNames = Arrays.asList( "c", "cap", "C", "CAP", "1", "1cap", "cap-64k_test", "-", "-cap", "_", "_cap", "agent=pack.age/Version", START "cap(this_is_valid!)"); END for (String capability: validNames) { FirstWant r = FirstWant.fromLine(makeFirstWantLine(capability)); assertEquals(r.getCapabilities().size(), 1); assertTrue(r.getCapabilities().contains(capability)); } } I don't think this example is valid.

Target:
public void testFirstWantValidCapabilityNames() throws PackProtocolException { List<String> validNames = Arrays.asList( "c", "cap", "C", "CAP", "1", "1cap", "cap-64k_test", "-", "-cap", "_", "_cap", "agent=pack.age/Version"); for (String capability: validNames) { FirstWant r = FirstWant.fromLine(makeFirstWantLine(capability)); assertEquals(r.getCapabilities().size(), 1); assertTrue(r.getCapabilities().contains(capability)); } }
Source:
public DsfGdbAdaptor(GdbTrace trace, String gdbExec, String traceFile, String tracedExecutable) { this.fGdbTrace = trace; this.gdb72Executable = gdbExec; this.fTraceFilePath = traceFile; this.fTraceFile = traceFile.substring(traceFile.lastIndexOf(IPath.SEPARATOR) + 1); this.tracedExecutable = tracedExecutable; try { launchDGBPostMortemTrace(); } catch (CoreException e) { START GdbTraceCorePlugin.logError(CORE_EXCEPTION, e); END } } e.getMessage()

Target:
public DsfGdbAdaptor(GdbTrace trace, String gdbExec, String traceFile, String tracedExecutable) { this.fGdbTrace = trace; this.gdb72Executable = gdbExec; this.fTraceFilePath = traceFile; this.fTraceFile = traceFile.substring(traceFile.lastIndexOf(IPath.SEPARATOR) + 1); this.tracedExecutable = tracedExecutable; try { launchDGBPostMortemTrace(); } catch (CoreException e) { GdbTraceCorePlugin.logError(e.getMessage(), e); } }
Source:
public void dispose() { if (fLaunch != null && fLaunch.canTerminate() && !isTerminating) { isTerminating = true; try { fLaunch.terminate(); } catch (DebugException e) { START GdbTraceCorePlugin.logError(GDB_EXCEPTION, END e); } fLaunch = null; } } e.getMessage()

Target:
public void dispose() { if (fLaunch != null && fLaunch.canTerminate() && !isTerminating) { isTerminating = true; try { fLaunch.terminate(); } catch (DebugException e) { GdbTraceCorePlugin.logError(e.getMessage(), e); } fLaunch = null; } }
Source:
public void dispose() { fCurrentEntries = START checkNotNull(Collections.emptyList()); END fTableViewer = null; fComparator = null; } Can remove checkNotNull, we have external @NonNull annotation on Collections.emptyList().

Target:
public void dispose() { fCurrentEntries = Collections.emptyList(); fTableViewer = null; fComparator = null; }
Source:
public int findCloseOffset(String line, int lineOffset) { if (nestedBlock == null) { START return findCloseOffset(line, lineOffset); END } return nestedBlock.findCloseOffset(line, lineOffset); } This line is untested. Can this ever happen? Looks like this could result in a stack overflow since it calls itself with the same parameters.

Target:
public int findCloseOffset(String line, int lineOffset) { if (nestedBlock == null) { return super.findCloseOffset(line, lineOffset); } return nestedBlock.findCloseOffset(line, lineOffset); }
Source:
private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { START Shell shell = Display.getCurrent().getActiveShell(); END this.dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); } What about new Shell(); Does this work?

Target:
private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { this.dialog = PreferencesUtil.createPreferenceDialogOn(new Shell(), "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }
Source:
Builder addClientCapabilities(Collection<String> clientCapabilities) { for (String cap: clientCapabilities) { // TODO(ifrade): Do this is done on parse time if (cap.startsWith("agent=")) { //$NON-NLS-1$ setAgent(cap.substring("agent=".length())); //$NON-NLS-1$ } else { clientCaps.add(cap); } } START clientCaps.addAll(clientCapabilities); END return this; } This adds the caps a second time.

Target:
Builder addClientCapabilities(Collection<String> clientCapabilities) { for (String cap: clientCapabilities) { // TODO(ifrade): Do this is done on parse time if (cap.startsWith("agent=")) { //$NON-NLS-1$ setAgent(cap.substring("agent=".length())); //$NON-NLS-1$ } else { clientCaps.add(cap); } } return this; }
Source:
private static boolean canMatchPacket(final ITmfEvent event) { /* Make sure all required fields are present to match with this event */ ITmfEventField content = event.getContent(); return START ((content.getFieldValue(Long.class, TcpEventStrings.SEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.ACKSEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.FLAGS) == null)); END } Shouldn't the whole expression be negated?

Target:
private static boolean canMatchPacket(final ITmfEvent event) { /* Make sure all required fields are present to match with this event */ ITmfEventField content = event.getContent(); return !((content.getFieldValue(Long.class, TcpEventStrings.SEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.ACKSEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.FLAGS) == null)); }
Source:
private static boolean isVisibleEventColumn(TableColumn column) { if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) { return false; } return START (!column.getResizable() && column.getWidth() == 0); END } needs to be negated, right?

Target:
private static boolean isVisibleEventColumn(TableColumn column) { if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) { return false; } return !(!column.getResizable() && column.getWidth() == 0); }
Source:
protected boolean verifyChildrenSpecific(N parent, int index, N child) { return START (parent.getChildStart(index) != child.getNodeStart() && parent.getChildEnd(index) != child.getNodeEnd()); END } OOPS!

Target:
protected boolean verifyChildrenSpecific(N parent, int index, N child) { return (parent.getChildStart(index) == child.getNodeStart() && parent.getChildEnd(index) == child.getNodeEnd()); }
Source:
private boolean isBinaryEquivalent(IntegerDeclaration other) { if (fAlignment != other.fAlignment) { return false; } if (fLength != other.fLength) { return false; } if (fSigned != other.fSigned) { return false; } // no need for base // no need for encoding // no need for clock // byte inversion is ok on byte order if the element is one byte long START return !(fLength == BYTE_ALIGN) && fByteOrder.equals(other.fByteOrder); END } This is not equivalent.

Target:
private boolean isBinaryEquivalent(IntegerDeclaration other) { if (fAlignment != other.fAlignment) { return false; } if (fLength != other.fLength) { return false; } if (fSigned != other.fSigned) { return false; } // no need for base // no need for encoding // no need for clock // byte inversion is ok on byte order if the element is one byte long return !((fLength != BYTE_ALIGN) && !fByteOrder.equals(other.fByteOrder)); }
Source:
private static boolean canMatchPacket(final ITmfEvent event) { /* Make sure all required fields are present to match with this event */ ITmfEventField content = event.getContent(); START return ((content.getFieldValue(Long.class, TcpEventStrings.SEQ) != null) || END (content.getFieldValue(Long.class, TcpEventStrings.ACKSEQ) != null) || (content.getFieldValue(Long.class, TcpEventStrings.FLAGS) != null)); } This is not equivalent. || should be &&

Target:
private static boolean canMatchPacket(final ITmfEvent event) { /* Make sure all required fields are present to match with this event */ ITmfEventField content = event.getContent(); return ((content.getFieldValue(Long.class, TcpEventStrings.SEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.ACKSEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.FLAGS) == null)); }
Source:
protected boolean checkLevelExists(int level) { START return !(level < levelQuarks.size() || level >= 0); END } This is not equivalent

Target:
protected boolean checkLevelExists(int level) { return !(level >= levelQuarks.size() || level < 0); // if (level >= levelQuarks.size() || level < 0) { // return false; // } // return true; }
Source:
private static boolean isVisibleEventColumn(TableColumn column) { if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) { return false; } START return (column.getResizable() && column.getWidth() > 0); END } This is not equivalent

Target:
private static boolean isVisibleEventColumn(TableColumn column) { if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) { return false; } return (!column.getResizable() && column.getWidth() == 0); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } HistogramBucket other = (HistogramBucket) obj; if (fNbEvents != other.fNbEvents) { return false; } START return (fNbEvents == 0 && Arrays.equals(fEvents, other.fEvents)); END } This is not equivalent. && should be ||

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } HistogramBucket other = (HistogramBucket) obj; if (fNbEvents != other.fNbEvents) { return false; } return !(fNbEvents != 0 && !Arrays.equals(fEvents, other.fEvents)); }
Source:
protected SimpleName getNewName(ASTRewrite rewrite) { AST ast= rewrite.getAST(); SimpleName nameNode= START ast.newSimpleName(String.valueOf("provider")); END //$NON-NLS-1$ // TypeConstants.PROVIDER return nameNode; } Is this a left-over from trying to use the char[] constant from jdt.core? I suggest to make it a regular String constant in this class.

Target:
protected SimpleName getNewName(ASTRewrite rewrite) { AST ast= rewrite.getAST(); SimpleName nameNode= ast.newSimpleName("provider"); //$NON-NLS-1$ // TypeConstants.PROVIDER return nameNode; }
Source:
protected IStatus validateItem(Object item) { for (int i = 0; i < fdisabledModels.length; i++) { START if (((IPluginModelBase) item).equals(fdisabledModels[i])) { END return new Status(IStatus.CANCEL, IPDEUIConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ } } return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ } cast not needed for equals

Target:
protected IStatus validateItem(Object item) { if (fdisabledModels != null && fdisabledModels.contains(item)) { return new Status(IStatus.CANCEL, IPDEUIConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ } return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ }
Source:
START private TemplateStoreInitializer END getTemplateStoreInitializer() { if (fJavaPluginInitializer == null) { fJavaPluginInitializer = new TemplateStoreInitializer(); fJavaPluginInitializer.activate(); } return fJavaPluginInitializer; } Shouldn't this be synchronized?

Target:
private synchronized TemplateStoreInitializer getTemplateStoreInitializer() { if (fJavaPluginInitializer == null) { fJavaPluginInitializer = new TemplateStoreInitializer(); fJavaPluginInitializer.activate(); } return fJavaPluginInitializer; }
Source:
public long getValueReference() { if (getFmiVariable() != null){ return START (int)getFmiVariable().getValueReference(); END } return super.getValueReference(); } I do not know the code but are you sure of the cast ? Since the result type is long it could be good but I am not sure

Target:
public long getValueReference() { if (getFmiVariable() != null){ return (long)getFmiVariable().getValueReference(); } return super.getValueReference(); }
Source:
public long getValueReference() { if (getFmiVariable() != null) { START return (int) END getFmiVariable().getValueReference(); } return super.getValueReference(); } idem

Target:
public long getValueReference() { if (getFmiVariable() != null) { return getFmiVariable().getValueReference(); } return super.getValueReference(); }
Source:
private static List<String> mapValuesToListIgnoreCase(String keyName, Map<String, List<String>> m) { List<String> fields = new LinkedList<>(); m.entrySet().stream().filter(e -> keyName.equalsIgnoreCase(e.getKey())) START .forEach(e -> fields.addAll(e.getValue())); END return fields; } Are we sure that we can never have e.getValue() == null ?

Target:
private static List<String> mapValuesToListIgnoreCase(String keyName, Map<String, List<String>> m) { List<String> fields = new LinkedList<>(); m.entrySet().stream().filter(e -> keyName.equalsIgnoreCase(e.getKey())) .filter(e -> e.getValue() != null) .forEach(e -> fields.addAll(e.getValue())); return fields; }
Source:
private void checkAlignment(String START errorMessage, int END expectedAlignment, int actualAlignment) { switch (expectedAlignment) { case PositionConstants.LEFT: assertEquals("wrong text wrap alignment.", PositionConstants.LEFT, actualAlignment); break; case PositionConstants.RIGHT: assertEquals("wrong text wrap alignment.", PositionConstants.RIGHT, actualAlignment); break; case PositionConstants.CENTER: assertEquals("wrong text wrap alignment.", PositionConstants.CENTER, actualAlignment); break; default: break; }; } use this parameter to replace hard coded texts

Target:
private void checkAlignment(String errorMessage, int expectedAlignment, int actualAlignment) { switch (expectedAlignment) { case PositionConstants.LEFT: assertEquals(errorMessage, PositionConstants.LEFT, actualAlignment); break; case PositionConstants.RIGHT: assertEquals(errorMessage, PositionConstants.RIGHT, actualAlignment); break; case PositionConstants.CENTER: assertEquals(errorMessage, PositionConstants.CENTER, actualAlignment); break; default: break; }; }
Source:
public JavaReferenceCodeMining(IJavaElement element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showReferencesAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, null); this.showReferencesAtLeastOne= showReferencesAtLeastOne; START action= e -> new FindReferencesAction(editor).run(element); END } Shouldn't it be set in the doResolve instead?

Target:
public JavaReferenceCodeMining(IJavaElement element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showReferencesAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, null); this.editor= editor; this.showReferencesAtLeastOne= showReferencesAtLeastOne; }
Source:
START public Consumer<MouseEvent> getAction() { END if (refCount > 0) { return action; } return null; } If action is set in the doResolve depending on the refCount: * refCount can remain a variable instead of a field * the condition become useless and you can just return `action`

Target:
public Consumer<MouseEvent> getAction() { return action; }
Source:
public JavaImplementationCodeMining(IType element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showImplementationsAtLeastOne) throws JavaModelException, BadLocationException { START super(element, document, provider, e -> new FindImplementorsAction(editor).run(element)); END this.showImplementationsAtLeastOne= showImplementationsAtLeastOne; } This should only be set if the number of implementation is not 0. I suggest you set this in the doResolve() according to the result.

Target:
public JavaImplementationCodeMining(IType element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showImplementationsAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, null); this.editor= editor; this.showImplementationsAtLeastOne= showImplementationsAtLeastOne; }
Source:
private void notifyClick(final Point p) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); START notify(SWT.Selection); END notify(SWT.MouseDown, createMouseEvent(p.x, p.y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(p.x, p.y, 1, SWT.BUTTON1, 1)); } I don't see a SWT.Selection event when I click, except if there was a non-empty selection before, then clicking clears the selection.

Target:
private void notifyClick(final Point p) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(p.x, p.y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(p.x, p.y, 1, SWT.BUTTON1, 1)); }
Source:
public void test() { final HelloWorld hello = new HelloWorld(); START assertTrue("Hello World".equals(hello.test())); END } Couldn't we use assertEquals(...) here instead for better reports in case of failur?

Target:
public void test() { final HelloWorld hello = new HelloWorld(); assertEquals("Hello World", hello.test()); }