auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void starting(Description description) { String seedProperty = System.getProperty(RANDOM_SEED_PROPERTY); Long seed; try { seed = Long.parseLong(seedProperty); } catch (NumberFormatException e) { log.info("Property '{}' was not set, using System.currentTimeMillis() as a seed.", RANDOM_SEED_PROPERTY); seed = System.currentTimeMillis(); } RandomUtils.instance().setSeed(seed); log.info("Running test with random seed: {}", RandomUtils.instance().getSeed()); }

Target:
public void starting(Description description) { String seedProperty = System.getProperty(RANDOM_SEED_PROPERTY); Long seed; try { seed = Long.parseLong(seedProperty); } catch (NumberFormatException e) { log.info("Property '{}' was not set, using System.currentTimeMillis() as a seed.", RANDOM_SEED_PROPERTY); seed = System.currentTimeMillis(); } log.info("Running test with random seed '{}'", seed); RandomUtils.instance().setSeed(seed); }
Source:
void dispose() { if (gc != null) { gc.dispose(); gc = null; } if (resources != null) { Enumeration<Resource> enumeration = resources.elements(); while (enumeration.hasMoreElements()) { Resource resource = enumeration.nextElement(); resource.dispose(); } resources = null; } if (printerFont != null) { printerFont.dispose(); printerFont = null; } if (printerRenderer != null) { printerRenderer.dispose(); printerRenderer = null; } }

Target:
void dispose() { if (gc != null) { gc.dispose(); gc = null; } if (resources != null) { Iterator<Resource> enumeration = resources.values().iterator(); while (enumeration.hasNext()) { Resource resource = enumeration.next(); resource.dispose(); } resources = null; } if (printerFont != null) { printerFont.dispose(); printerFont = null; } if (printerRenderer != null) { printerRenderer.dispose(); printerRenderer = null; } }
Source:
public synchronized void shutdown() { sweepOutcomeMetrics.shutdown(); if (daemon == null) { return; } log.info("Signalling background sweeper to shut down."); daemon.interrupt(); try { daemon.join(); daemon = null; } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } }

Target:
public synchronized void shutdown() { sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.SHUTDOWN); if (daemon == null) { return; } log.info("Signalling background sweeper to shut down."); daemon.interrupt(); try { daemon.join(); daemon = null; } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } }
Source:
private String getNodePath(ResourceBasedNode<?> node, String projectName) { String path = ""; if (node instanceof ModuleDescriptorNode) { path = ((ModuleDescriptorNode)node).getStorablePath(); } else if (node instanceof FolderReferenceNode) { path = ((FolderReferenceNode)node).getStorablePath(); } else if (node instanceof FileReferenceNode) { path = ((FileReferenceNode)node).getStorablePath(); } return path.substring(projectName.length() + 2); }

Target:
private String getNodePath(ResourceBasedNode<?> node, String projectName) { String path = ""; if (node instanceof ModuleNode) { path = ((ModuleNode)node).getStorablePath(); } else if (node instanceof FolderReferenceNode) { path = ((FolderReferenceNode)node).getStorablePath(); } else if (node instanceof FileReferenceNode) { path = ((FileReferenceNode)node).getStorablePath(); } if (!path.isEmpty()) { return path.substring(projectName.length() + 2); } else { return path; } }
Source:
public IResolver selectResolver(List<Diagnosis> diagnosis) { Map<String, Diagnosis> diagnosisMap = diagnosis.stream().collect(Collectors.toMap(Diagnosis::getName, d -> d)); if (diagnosisMap.containsKey(DIAGNOSIS_DATA_SKEW.text())) { LOG.warning("Data Skew diagnoses. This diagnosis does not have any resolver."); } else if (diagnosisMap.containsKey(DIAGNOSIS_SLOW_INSTANCE.text())) { return restartContainerResolver; } else if (diagnosisMap.containsKey(DIAGNOSIS_UNDER_PROVISIONING.text())) { LOG.warning("Under provisioning diagnoses. This diagnosis does not have any resolver."); } return null; }

Target:
public IResolver selectResolver(List<Diagnosis> diagnosis) { Map<String, Diagnosis> diagnosisMap = diagnosis.stream().collect(Collectors.toMap(Diagnosis::getName, d -> d)); if (diagnosisMap.containsKey(DIAGNOSIS_SLOW_INSTANCE.text())) { return restartContainerResolver; } LOG.warning("Unknown diagnoses. None resolver selected."); return null; }
Source:
public void createsFormRequestWithParams() throws IOException { final String key = "key"; final String akey = "anotherkey"; final String value = "value"; final String avalue = "a&b"; final String aavalue = "againanothervalue"; final RqForm req = new RqForm.Fake( new RqFake(), key, value, key, avalue, akey, aavalue ); MatcherAssert.assertThat( req.param(key), Matchers.hasItems(value, avalue) ); MatcherAssert.assertThat( req.param(akey), Matchers.hasItems(aavalue) ); MatcherAssert.assertThat( req.names(), Matchers.hasItems(key, akey) ); }

Target:
public void createsFormRequestWithParams() throws Exception { final String key = "key"; final String akey = "anotherkey"; final String value = "value"; final String avalue = "a&b"; final String aavalue = "againanothervalue"; final RqForm req = new RqForm.Fake( new RqFake(), key, value, key, avalue, akey, aavalue ); MatcherAssert.assertThat( req.param(key), Matchers.hasItems(value, avalue) ); MatcherAssert.assertThat( req.param(akey), Matchers.hasItems(aavalue) ); MatcherAssert.assertThat( req.names(), Matchers.hasItems(key, akey) ); }
Source:
public void stop() { if (trace) log.tracef("Stopping %s", this.getClass().getSimpleName()); synchronized (versionRequestMap) { if (trace) log.tracef("Stopping %s. isRunning=%s. %s", this.getClass().getSimpleName(), running, Arrays.toString(Thread.currentThread().getStackTrace())); cancelVersionRequests(); versionRequestMap.clear(); } if (isConflictResolutionInProgress()) conflictSpliterator.stop(); this.running = false; }

Target:
public void stop() { if (trace) log.tracef("Stopping %s", this.getClass().getSimpleName()); this.running = false; synchronized (versionRequestMap) { if (trace) log.tracef("Stopping %s. isRunning=%s. %s", this.getClass().getSimpleName(), running, Arrays.toString(Thread.currentThread().getStackTrace())); cancelVersionRequests(); versionRequestMap.clear(); } if (isConflictResolutionInProgress() && conflictSpliterator != null) conflictSpliterator.stop(); }
Source:
private void initRecordingDialog() { Rect displayRectangle = new Rect(); Window window = this.getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle); LayoutInflater inflater = LayoutInflater.from(this); View builderView = inflater.inflate(R.layout.recording_dialog, null); int dialogMinWidth = (int) (displayRectangle.width() * 0.8f); int dialogMinHeight = (int) (displayRectangle.height() * 0.5f); builderView.setMinimumWidth(dialogMinWidth); builderView.setMinimumHeight(dialogMinHeight); soundLevelCircleMaxDiameter = (int) (dialogMinWidth * 0.8f); soundLevelView = (TextView) builderView.findViewById(R.id.view_sound_level); AlertDialog.Builder builder; builder = new AlertDialog.Builder(this); builder.setView(builderView); builder.setCancelable(false); builder.setPositiveButton(getString(R.string.dialog_button_done), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { stopRecord(); } }); recordingDialog = builder.create(); }

Target:
private void initRecordingDialog() { recordingDialog = new AudioVizDialog(this, new AudioVizDialog.Listener() { @Override public void onDoneClick() { stopRecord(); } }); recordingDialog.setMaxRecordLength(MAX_RECORD_LENGTH / 1000); }
Source:
protected void createButtonsForButtonBar(final Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); Button manageButton = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.TraceControl_ManageButtonText, true); manageButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(parent.getShell(), ControlRemoteProfilesPreferencePage.ID, new String[] { ControlRemoteProfilesPreferencePage.ID }, null); dialog.open(); } }); Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); button.setEnabled(false); }

Target:
protected void createButtonsForButtonBar(final Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); Button manageButton = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.TraceControl_ManageButtonText, true); manageButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(parent.getShell(), ControlRemoteProfilesPreferencePage.ID, new String[] { ControlRemoteProfilesPreferencePage.ID }, null); dialog.open(); if (fLocalComposite != null) { fFolderViewer.refresh(); } } }); Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); button.setEnabled(false); }
Source:
protected IStateHistoryBackend getBackendForQuerying(IStateHistoryBackend backend) throws IOException { if (!fReOpen) { return backend; } File historyTreeFile = fBackendMap.remove(backend); if (historyTreeFile == null) { return backend; } backend.dispose(); HistoryTreeBackend reOpenedBackend = new HistoryTreeBackend(SSID, historyTreeFile, PROVIDER_VERSION); fBackendMap.put(reOpenedBackend, historyTreeFile); return reOpenedBackend; }

Target:
protected IStateHistoryBackend getBackendForQuerying(IStateHistoryBackend backend) throws IOException { if (!fReOpen) { return backend; } File historyTreeFile = fBackendMap.remove(backend); if (historyTreeFile == null) { throw new IllegalStateException(); } backend.dispose(); HistoryTreeBackend reOpenedBackend = new HistoryTreeBackend(SSID, historyTreeFile, PROVIDER_VERSION); fBackendMap.put(reOpenedBackend, historyTreeFile); return reOpenedBackend; }
Source:
public static ChangeDetail reverse(ChangeInfo info) { info.revisions().copyKeysIntoChildren("name"); RevisionInfo rev = current(info); ChangeDetail r = new ChangeDetail(); r.setAllowsAnonymous(rev.has_fetch() && rev.fetch().containsKey("http")); r.setCanAbandon(can(info.actions(), "abandon")); r.setCanEditCommitMessage(can(info.actions(), "message")); r.setCanCherryPick(can(rev.actions(), "cherrypick")); r.setCanPublish(can(rev.actions(), "publish")); r.setCanRebase(can(rev.actions(), "rebase")); r.setCanRestore(can(info.actions(), "restore")); r.setCanRevert(can(info.actions(), "revert")); r.setCanDeleteDraft(can(rev.actions(), "/")); r.setCanEditTopicName(can(info.actions(), "topic")); r.setCanEdit(true); r.setChange(toChange(info)); r.setStarred(info.starred()); r.setPatchSets(toPatchSets(info)); r.setMessages(toMessages(info)); r.setAccounts(new AccountInfoCache(users(info))); r.setCurrentPatchSetId(new PatchSet.Id(info.legacy_id(), rev._number())); r.setSubmitTypeRecord(new SubmitTypeRecord()); r.getSubmitTypeRecord().status = SubmitTypeRecord.Status.RULE_ERROR; r.setDependsOn(new ArrayList<com.google.gerrit.common.data.ChangeInfo>()); r.setNeededBy(new ArrayList<com.google.gerrit.common.data.ChangeInfo>()); r.setPatchSetsWithDraftComments(new HashSet<PatchSet.Id>()); r.setSubmitRecords(new ArrayList<SubmitRecord>()); r.setCurrentPatchSetDetail(toPatchSetDetail(info)); return r; }

Target:
public static ChangeDetail reverse(ChangeInfo info) { info.revisions().copyKeysIntoChildren("name"); RevisionInfo rev = current(info); ChangeDetail r = new ChangeDetail(); r.setAllowsAnonymous(rev.has_fetch() && rev.fetch().containsKey("http")); r.setCanAbandon(can(info.actions(), "abandon")); r.setCanEditCommitMessage(can(info.actions(), "message")); r.setCanCherryPick(can(rev.actions(), "cherrypick")); r.setCanPublish(can(rev.actions(), "publish")); r.setCanRebase(can(rev.actions(), "rebase")); r.setCanRestore(can(info.actions(), "restore")); r.setCanRevert(can(info.actions(), "revert")); r.setCanDeleteDraft(can(rev.actions(), "/")); r.setCanEditTopicName(can(info.actions(), "topic")); r.setCanSubmit(can(rev.actions(), "submit")); r.setCanEdit(true); r.setChange(toChange(info)); r.setStarred(info.starred()); r.setPatchSets(toPatchSets(info)); r.setMessages(toMessages(info)); r.setAccounts(users(info)); r.setCurrentPatchSetId(new PatchSet.Id(info.legacy_id(), rev._number())); r.setCurrentPatchSetDetail(toPatchSetDetail(info)); r.setSubmitRecords(new ArrayList<SubmitRecord>()); r.setSubmitTypeRecord(new SubmitTypeRecord()); r.getSubmitTypeRecord().status = SubmitTypeRecord.Status.RULE_ERROR; r.setPatchSetsWithDraftComments(new HashSet<PatchSet.Id>()); r.setDependsOn(new ArrayList<com.google.gerrit.common.data.ChangeInfo>()); r.setNeededBy(new ArrayList<com.google.gerrit.common.data.ChangeInfo>()); return r; }
Source:
public void refreshStereotypeStructure() { if (stereoList.size() != 0) { for (Stereotype stereotype : stereoList) { refreshStereotypeCompartmentStructure(stereotype); } } }

Target:
public void refreshStereotypeStructure() { if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { refreshStereotypeCompartmentStructure(stereotype); } } }
Source:
public void authenticate() { final String principal = props.getProperty("druid.hdfs.security.kerberos.principal"); final String keytab = props.getProperty("druid.hdfs.security.kerberos.keytab"); if (!Strings.isNullOrEmpty(principal) && !Strings.isNullOrEmpty(keytab)) { UserGroupInformation.setConfiguration(conf); if (UserGroupInformation.isSecurityEnabled()) { try { if (UserGroupInformation.getCurrentUser().hasKerberosCredentials() == false || !UserGroupInformation.getCurrentUser().getUserName().equals(principal)) { log.info("trying to authenticate user [%s] with keytab [%s]", principal, keytab); UserGroupInformation.loginUserFromKeytab(principal, keytab); } } catch (IOException e) { throw new ISE(e, "Failed to authenticate user principal [%s] with keytab [%s]", principal, keytab); } } } }

Target:
public void authenticate() { String principal = hdfsKerberosConfig.getPrincipal(); String keytab = hdfsKerberosConfig.getKeytab(); if (!Strings.isNullOrEmpty(principal) && !Strings.isNullOrEmpty(keytab)) { UserGroupInformation.setConfiguration(hadoopConf); if (UserGroupInformation.isSecurityEnabled()) { try { if (UserGroupInformation.getCurrentUser().hasKerberosCredentials() == false || !UserGroupInformation.getCurrentUser().getUserName().equals(principal)) { log.info("Trying to authenticate user [%s] with keytab [%s]..", principal, keytab); UserGroupInformation.loginUserFromKeytab(principal, keytab); } } catch (IOException e) { throw new ISE(e, "Failed to authenticate user principal [%s] with keytab [%s]", principal, keytab); } } } }
Source:
public static PassthroughServer remove(URI uri) { URI keyURI = createKey(uri); ServerDescriptor serverDescriptor = servers.remove(keyURI); if (serverDescriptor != null) { serverDescriptor.server.stop(); LOGGER.info("Stopped PassthroughServer at {}", keyURI); for (Connection connection : serverDescriptor.getConnections().keySet()) { try { LOGGER.warn("Force close {}", formatConnectionId(connection)); connection.close(); } catch (IOException e) { } } return serverDescriptor.server; } else { return null; } }

Target:
public static PassthroughServer remove(URI uri) { URI keyURI = createKey(uri); ServerDescriptor serverDescriptor = SERVERS.remove(keyURI); if (serverDescriptor != null) { serverDescriptor.server.stop(); LOGGER.info("Stopped PassthroughServer at {}", keyURI); for (Connection connection : serverDescriptor.getConnections().keySet()) { try { LOGGER.warn("Force close {}", formatConnectionId(connection)); connection.close(); } catch (IOException e) { } } return serverDescriptor.server; } else { return null; } }
Source:
void validateJoinKeySchemas(Map<String, Schema> inputSchemas, Map<String, List<String>> joinKeys, FailureCollector collector) { perStageJoinKeys = joinKeys; conf.validateJoinKeySchemas(inputSchemas, joinKeys, collector); List<Schema> prevSchemaList = null; for (Map.Entry<String, List<String>> entry : perStageJoinKeys.entrySet()) { ArrayList<Schema> schemaList = new ArrayList<>(); String stageName = entry.getKey(); Schema schema = inputSchemas.get(stageName); if (schema == null) { return; } for (String joinKey : entry.getValue()) { Schema.Field field = schema.getField(joinKey); if (field == null) { collector.addFailure( String.format("Join key field '%s' is not present in input stage of '%s'.", joinKey, stageName), null) .withConfigProperty(conf.JOIN_KEYS); } schemaList.add(field.getSchema()); } if (prevSchemaList != null && !prevSchemaList.equals(schemaList)) { collector.addFailure( String.format("For stage '%s', Schemas of join keys '%s' are expected to be: '%s', but found: '%s'.", stageName, entry.getValue(), prevSchemaList.toString(), schemaList.toString()), null) .withConfigProperty(conf.JOIN_KEYS); } prevSchemaList = schemaList; } }

Target:
private void validateJoinKeySchemas(Map<String, Schema> inputSchemas, Map<String, List<String>> joinKeys, FailureCollector collector) { perStageJoinKeys = joinKeys; conf.validateJoinKeySchemas(inputSchemas, joinKeys, collector); List<Schema> prevSchemaList = null; for (Map.Entry<String, List<String>> entry : perStageJoinKeys.entrySet()) { ArrayList<Schema> schemaList = new ArrayList<>(); String stageName = entry.getKey(); Schema schema = inputSchemas.get(stageName); if (schema == null) { return; } for (String joinKey : entry.getValue()) { Schema.Field field = schema.getField(joinKey); if (field == null) { collector.addFailure( String.format("Join key field '%s' is not present in input stage of '%s'.", joinKey, stageName), null) .withConfigProperty(JoinerConfig.JOIN_KEYS); } schemaList.add(field.getSchema()); } if (prevSchemaList != null && !prevSchemaList.equals(schemaList)) { collector.addFailure( String.format("For stage '%s', Schemas of join keys '%s' are expected to be: '%s', but found: '%s'.", stageName, entry.getValue(), prevSchemaList.toString(), schemaList.toString()), null) .withConfigProperty(JoinerConfig.JOIN_KEYS); } prevSchemaList = schemaList; } }
Source:
public void init() { MockitoAnnotations.initMocks(this); when(dockerImage.getCreated()).thenReturn(Instant.now().minus(2, ChronoUnit.HOURS).getEpochSecond()); when(dockerImage.getRepoTags()).thenReturn(Collections.emptyList()); }

Target:
public void init() { MockitoAnnotations.initMocks(this); when(dockerImageData.getCreated()).thenReturn(Instant.now().minus(2, ChronoUnit.HOURS)); }
Source:
public void physicalSend(Command command) throws IOException { if (logger.isTraceEnabled()) { tracePhysicalSend(transportConnection, command); } try { final ByteSequence bytes = outWireFormat.marshal(command); final int bufferSize = bytes.length; final ActiveMQBuffer buffer = transportConnection.createTransportBuffer(bufferSize); buffer.writeBytes(bytes.data, bytes.offset, bufferSize); synchronized (sendLock) { getTransportConnection().write(buffer, false, false); } bufferSent(); } catch (IOException e) { throw e; } catch (Throwable t) { ActiveMQServerLogger.LOGGER.error("error sending", t); } }

Target:
public void physicalSend(Command command) throws IOException { if (logger.isTraceEnabled()) { tracePhysicalSend(transportConnection, command); } try { final ByteSequence bytes = outWireFormat.marshal(command); final int bufferSize = bytes.length; final ActiveMQBuffer buffer = transportConnection.createTransportBuffer(bufferSize); buffer.writeBytes(bytes.data, bytes.offset, bufferSize); transportConnection.write(buffer, false, false); bufferSent(); } catch (IOException e) { throw e; } catch (Throwable t) { ActiveMQServerLogger.LOGGER.error("error sending", t); } }
Source:
public EditorPartPresenter getNextFor(EditorPartPresenter editorPart) { int indexForNext = partsOrder.indexOf(editorPart) + 1; return indexForNext >= partsOrder.size() ? (EditorPartPresenter)partsOrder.getFirst() : (EditorPartPresenter)partsOrder.get(indexForNext); }

Target:
public EditorPartPresenter getNextFor(EditorPartPresenter editorPart) { int indexForNext = partsOrder.indexOf(editorPart) + 1; return indexForNext >= partsOrder.size() ? partsOrder.getFirst() : partsOrder.get(indexForNext); }
Source:
private byte[] toBinaryIon(String text) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); IonReader ionReader = system().newReader(text); IonWriter ionWriter = system().newBinaryWriter(out); ionWriter.writeValues(ionReader); ionWriter.close(); return out.toByteArray(); }

Target:
private byte[] toBinaryIon(String text) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); IonReader ionReader = system().newReader(text); IonWriter ionWriter = system().newBinaryWriter(out); ionWriter.writeValues(ionReader); ionWriter.close(); ionReader.close(); return out.toByteArray(); }
Source:
protected void setupNotification() { notificationManager = NotificationManagerCompat.from(this); notificationBuilder = createNotification(); startForeground(getNotificationId(), notificationBuilder.build()); disposables.add(notificationUpdater .filter(s -> !s.isEmpty()) .publish(stringFlowable -> stringFlowable.limit(1) .concatWith(stringFlowable.skip(1).throttleLast(NOTIFICATION_SAMPLING_PERIOD, TimeUnit.MILLISECONDS))) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateNotification)); }

Target:
protected void setupNotification() { notificationManager = NotificationManagerCompat.from(this); notificationBuilder = createNotification(); startForeground(getNotificationId(), notificationBuilder.build()); final Function<Flowable<String>, Publisher<String>> throttleAfterFirstEmission = flow -> flow.limit(1) .concatWith(flow.skip(1).throttleLast(NOTIFICATION_SAMPLING_PERIOD, TimeUnit.MILLISECONDS)); disposables.add(notificationUpdater .filter(s -> !s.isEmpty()) .publish(throttleAfterFirstEmission) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateNotification)); }
Source:
public static synchronized Log getLog(String logTag) { logTag = getTruncatedLogTag(logTag); Log log = logMap.get(logTag); if (log != null) { return log; } if (checkApacheCommonsLoggingExists()) { log = new ApacheCommonsLogging(logTag); } else if (checkAndroidLoggingMocked()) { log = new AndroidLog(logTag); } else { log = new ConsoleLog(logTag); } logMap.put(logTag, log); return log; }

Target:
public static synchronized Log getLog(String logTag) { logTag = getTruncatedLogTag(logTag); Log log = logMap.get(logTag); if (log != null) { return log; } if (Environment.isJUnitTest()) { log = new ConsoleLog(logTag); } else if (checkApacheCommonsLoggingExists()) { log = new ApacheCommonsLogging(logTag); } else { log = new AndroidLog(logTag); } logMap.put(logTag, log); return log; }
Source:
private TopologyContext createTopologyContext(Map<String, Object> topoConf) { CustomIndexArray<String> taskToComponent = new CustomIndexArray<>(0,8); taskToComponent.set(7, "Xcom"); return new TopologyContext(null, topoConf, taskToComponent, null, null, null, null, null, null, 7, 6703, null, null, null, null, null, null); }

Target:
private TopologyContext createTopologyContext(Map<String, Object> topoConf) { CustomIndexArray<String> taskToComponent = new CustomIndexArray<>(7,7); taskToComponent.set(7, "Xcom"); return new TopologyContext(null, topoConf, taskToComponent, null, null, null, null, null, null, 7, 6703, null, null, null, null, null, null); }
Source:
boolean addReftable(Writer w) throws IOException { LockFile lock = new LockFile(stackPath); try { if (!lock.lockForAppend()) { return false; } if (!uptodate()) { return false; } String fn = filename(nextUpdateIndex(), nextUpdateIndex()); File tmpTable = File.createTempFile(fn + "_", ".ref", stackPath.getParentFile()); ReftableWriter.Stats stats; try (FileOutputStream fos = new FileOutputStream(tmpTable)) { ReftableWriter rw = new ReftableWriter(reftableConfig(), fos); w.call(rw); rw.finish(); stats = rw.getStats(); } fn += stats.refCount() > 0 ? ".ref" : ".log"; File dest = new File(reftableDir, fn); FileUtils.rename(tmpTable, dest, StandardCopyOption.ATOMIC_MOVE); lock.write((fn + "\n").getBytes(UTF_8)); if (!lock.commit()) { FileUtils.delete(dest); return false; } reload(); autoCompact(); } finally { lock.unlock(); } return true; }

Target:
boolean addReftable(Writer w) throws IOException { LockFile lock = new LockFile(stackPath); try { if (!lock.lockForAppend()) { return false; } if (!uptodate()) { return false; } String fn = filename(nextUpdateIndex(), nextUpdateIndex()); File tmpTable = File.createTempFile(fn + "_", ".ref", stackPath.getParentFile()); ReftableWriter.Stats s; try (FileOutputStream fos = new FileOutputStream(tmpTable)) { ReftableWriter rw = new ReftableWriter(reftableConfig(), fos); w.call(rw); rw.finish(); s = rw.getStats(); } fn += s.refCount() > 0 ? ".ref" : ".log"; File dest = new File(reftableDir, fn); FileUtils.rename(tmpTable, dest, StandardCopyOption.ATOMIC_MOVE); lock.write((fn + "\n").getBytes(UTF_8)); if (!lock.commit()) { FileUtils.delete(dest); return false; } reload(); autoCompact(); } finally { lock.unlock(); } return true; }
Source:
public Map<String, Accessor> getPropertyWriteAccessors(CollectionMappingStrategyPrism cmStrategy) { List<Accessor> candidates = new ArrayList<Accessor>(); candidates.addAll( getSetters() ); candidates.addAll( getAlternativeTargetAccessors() ); Map<String, Accessor> result = new LinkedHashMap<String, Accessor>(); for ( Accessor candidate : candidates ) { String targetPropertyName = Executables.getPropertyName( candidate ); if ( cmStrategy == CollectionMappingStrategyPrism.SETTER_PREFERRED || cmStrategy == CollectionMappingStrategyPrism.ADDER_PREFERRED ) { Accessor adderMethod = null; if ( Executables.isSetterMethod( candidate ) ) { Type targetType = typeFactory.getSingleParameter( (DeclaredType) typeMirror, candidate ).getType(); if ( cmStrategy == CollectionMappingStrategyPrism.ADDER_PREFERRED ) { adderMethod = getAdderForType( targetType, targetPropertyName ); } } else if ( Executables.isGetterMethod( candidate ) ) { Type targetType = typeFactory.getReturnType( (DeclaredType) typeMirror, candidate ); adderMethod = getAdderForType( targetType, targetPropertyName ); } if ( adderMethod != null ) { candidate = adderMethod; } } else if ( Executables.isFieldAccessor( candidate ) && ( Executables.isFinal( candidate ) || result.containsKey( targetPropertyName ) ) ) { continue; } result.put( targetPropertyName, candidate ); } return result; }

Target:
public Map<String, Accessor> getPropertyWriteAccessors( CollectionMappingStrategyPrism cmStrategy ) { List<Accessor> candidates = new ArrayList<Accessor>( getSetters() ); candidates.addAll( getAlternativeTargetAccessors() ); Map<String, Accessor> result = new LinkedHashMap<String, Accessor>(); for ( Accessor candidate : candidates ) { String targetPropertyName = Executables.getPropertyName( candidate ); Accessor readAccessor = getPropertyReadAccessors().get( targetPropertyName ); Type preferredType = determinePreferredType( readAccessor ); Type targetType = determineTargetType( candidate ); if ( cmStrategy == CollectionMappingStrategyPrism.SETTER_PREFERRED || cmStrategy == CollectionMappingStrategyPrism.ADDER_PREFERRED ) { Accessor adderMethod = null; if ( Executables.isSetterMethod( candidate ) && cmStrategy == CollectionMappingStrategyPrism.ADDER_PREFERRED ) { adderMethod = getAdderForType( targetType, targetPropertyName ); } else if ( Executables.isGetterMethod( candidate ) ) { adderMethod = getAdderForType( targetType, targetPropertyName ); } if ( adderMethod != null ) { candidate = adderMethod; } } else if ( Executables.isFieldAccessor( candidate ) && ( Executables.isFinal( candidate ) || result.containsKey( targetPropertyName ) ) ) { continue; } Accessor previousCandidate = result.get( targetPropertyName ); if ( previousCandidate == null || preferredType == null || ( targetType != null && typeUtils.isAssignable( preferredType.getTypeMirror(), targetType.getTypeMirror() ) ) ) { result.put( targetPropertyName, candidate ); } } return result; }
Source:
public void deleteSubscription(final String subscriptionId) throws DbWriteOperationsBlockedException, NoSuchSubscriptionException, NoSuchEventTypeException, ServiceTemporarilyUnavailableException, InternalNakadiException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot delete subscription: write operations on DB " + "are blocked by feature flag."); } final Subscription subscription = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionAdmin(subscription); subscriptionRepository.deleteSubscription(subscriptionId); final ZkSubscriptionClient zkSubscriptionClient = subscriptionClientFactory.createClient( subscription, LogPathBuilder.build(subscriptionId, "delete_subscription")); zkSubscriptionClient.deleteSubscription(); nakadiKpiPublisher.publish(subLogEventType, () -> new JSONObject() .put("subscription_id", subscriptionId) .put("status", "deleted")); subscriptionCache.invalidateSubscription(subscriptionId); }

Target:
public void deleteSubscription(final String subscriptionId) throws DbWriteOperationsBlockedException, NoSuchSubscriptionException, NoSuchEventTypeException, ServiceTemporarilyUnavailableException, InternalNakadiException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot delete subscription: write operations on DB " + "are blocked by feature flag."); } final Subscription subscription = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionAdmin(subscription); subscriptionRepository.deleteSubscription(subscriptionId); final ZkSubscriptionClient zkSubscriptionClient = subscriptionClientFactory.createClient( subscription, LogPathBuilder.build(subscriptionId, "delete_subscription")); zkSubscriptionClient.deleteSubscription(); nakadiKpiPublisher.publish(subLogEventType, () -> new JSONObject() .put("subscription_id", subscriptionId) .put("status", "deleted")); }
Source:
private static boolean shouldSkipInputFileNameCheck(String path, String fileName) { return "package-info.java".equals(fileName) || "package.html".equals(fileName) || path.contains(File.separatorChar + "inputs" + File.separatorChar) || path.contains(File.separatorChar + "translation" + File.separatorChar) || ".DS_Store".equals(fileName); }

Target:
private static boolean shouldSkipInputFileNameCheck(String path, String fileName) { return "package-info.java".equals(fileName) || "package.html".equals(fileName) || path.contains(File.separatorChar + "inputs" + File.separatorChar) || path.contains(File.separatorChar + "translation" + File.separatorChar); }
Source:
public void testStatsForEmptyValues() { tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of())) .check(outputStats -> outputStats.equalTo( PlanNodeStatsEstimate.builder() .setOutputRowCount(0) .addSymbolStatistics( new Symbol("a"), SymbolStatsEstimate.builder() .setLowValue(NaN) .setHighValue(NaN) .setNullsFraction(0.0) .setDistinctValuesCount(0.0) .build()) .build())); }

Target:
public void testStatsForEmptyValues() { tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of())) .check(outputStats -> outputStats.equalTo( PlanNodeStatsEstimate.builder() .setOutputRowCount(0) .addSymbolStatistics(new Symbol("a"), SymbolStatsEstimate.ZERO_STATS) .build())); }
Source:
protected void searchForSelectedParam() { HtmlParameterStats item = this.getParamsPanel().getSelectedParam(); if (item != null) { ExtensionSearch extSearch = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSearch.class); if (extSearch != null) { if (HtmlParameter.Type.url.equals(item.getType())) { extSearch.search("[?&]" + item.getName() + "=.*", ExtensionSearch.Type.URL, true, false); } else if (HtmlParameter.Type.cookie.equals(item.getType())) { extSearch.search( item.getName() + "=.*", ExtensionSearch.Type.Header, true, false); } else if (HtmlParameter.Type.header.equals(item.getType())) { extSearch.search(item.getName() + ":.*", ExtensionSearch.Type.Header, true, false); } else if (HtmlParameter.Type.multipart.equals(item.getType())) { extSearch.search("(?i)\\s*content-disposition\\s*:.*\\s+name\\s*\\=?\\s*\\\"?" + item.getName(), ExtensionSearch.Type.Request, true, false); } else { extSearch.search( item.getName() + "=.*", ExtensionSearch.Type.Request, true, false); } } } }

Target:
protected void searchForSelectedParam() { HtmlParameterStats item = this.getParamsPanel().getSelectedParam(); if (item != null) { ExtensionSearch extSearch = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSearch.class); if (extSearch != null) { if (HtmlParameter.Type.url.equals(item.getType())) { extSearch.search("[?&]" + Pattern.quote(item.getName()) + "=.*", ExtensionSearch.Type.URL, true, false); } else if (HtmlParameter.Type.cookie.equals(item.getType())) { extSearch.search(Pattern.quote(item.getName()) + "=.*", ExtensionSearch.Type.Header, true, false); } else if (HtmlParameter.Type.header.equals(item.getType())) { extSearch.search(Pattern.quote(item.getName()) + ":.*", ExtensionSearch.Type.Header, true, false); } else if (HtmlParameter.Type.multipart.equals(item.getType())) { extSearch.search("(?i)\\s*content-disposition\\s*:.*\\s+name\\s*\\=?\\s*\\\"?" + Pattern.quote(item.getName()), ExtensionSearch.Type.Request, true, false); } else { extSearch.search(Pattern.quote(item.getName()) + "=.*", ExtensionSearch.Type.Request, true, false); } } } }
Source:
public void testMultipleBlockRemoveNotify() throws InterruptedException { final int numOfObserver = 3; final int numOfBlockPut = 10; final int numOfKeysPerBlock = 10; final int timeoutInMillisecond = 500; final int blockIdBase = 0x80; final CountDownLatch countDownLatch = new CountDownLatch(numOfObserver * numOfBlockPut); final MemoryStoreImpl memoryStoreImpl = (MemoryStoreImpl) memoryStore; for (int i = 0; i < numOfObserver; i++) { final MemoryStoreTestUtils.BlockRemoveListenerImpl listener = new MemoryStoreTestUtils.BlockRemoveListenerImpl(countDownLatch, numOfKeysPerBlock); memoryStore.registerBlockUpdateListener(listener); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; final Map<Long, Object> data = new HashMap<>(); final long keyIdStart = (numOfKeysPerBlock * blockId); for (int j = 0; j < numOfKeysPerBlock; j++) { final long keyId = keyIdStart + j; data.put(keyId, new Long(keyId)); } memoryStoreImpl.putBlock(blockId, data); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; memoryStoreImpl.removeBlock(blockId); } countDownLatch.await(timeoutInMillisecond, TimeUnit.MILLISECONDS); assertEquals(0, countDownLatch.getCount()); }

Target:
public void testMultipleBlockRemoveNotify() throws InterruptedException { final int numOfObserver = 3; final int numOfBlockPut = 10; final int numOfKeysPerBlock = 10; final int timeoutMS = 500; final int blockIdBase = 0x80; final CountDownLatch countDownLatch = new CountDownLatch(numOfObserver * numOfBlockPut); final MemoryStoreImpl memoryStoreImpl = (MemoryStoreImpl) memoryStore; for (int i = 0; i < numOfObserver; i++) { final BlockUpdateListener listener = new MemoryStoreTestUtils.BlockUpdateListenerImpl(null, countDownLatch, numOfKeysPerBlock); memoryStore.registerBlockUpdateListener(listener); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; final Map<Long, Object> data = new HashMap<>(); final long keyIdStart = (numOfKeysPerBlock * blockId); for (int keyOffset = 0; keyOffset < numOfKeysPerBlock; keyOffset++) { final long keyId = keyIdStart + keyOffset; data.put(keyId, keyId); } memoryStoreImpl.putBlock(blockId, data); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; memoryStoreImpl.removeBlock(blockId); } assertTrue(countDownLatch.await(timeoutMS, TimeUnit.MILLISECONDS)); }
Source:
public void stop() { nettyServer.ifPresent(n -> n.stop()); nettyServer = Optional.empty(); ip = Optional.empty(); port = Optional.empty(); }

Target:
public void stop() { nettyServer.ifPresent(NettyJaxrsServer::stop); nettyServer = Optional.empty(); ip = Optional.empty(); port = Optional.empty(); }
Source:
public void delete(int operatorId, long windowId) throws IOException { if (!getStore().isConnected()) { getStore().connect(); } try { store.remove(generateKey(operatorId, windowId)); logger.info("deleted object from store key region {}", generateKey(operatorId, windowId)); } catch (Throwable t) { logger.info("while deleting {}", operatorId, windowId, t); DTThrowable.rethrow(t); } }

Target:
public void delete(int operatorId, long windowId) throws IOException { if (!getStore().isConnected()) { getStore().connect(); } try { getStore().remove(generateKey(operatorId, windowId)); logger.debug("deleted object from store key region {}", generateKey(operatorId, windowId)); } catch (Exception ex) { throw new RuntimeException(ex); } }
Source:
private void setupAsyncResponse(AsyncResponse asyncResponse, ListenableFuture<Response> future) { bindAsyncResponse(asyncResponse, future, executor) .withTimeout(ASYNC_TIMEOUT, () -> Response .status(Status.BAD_GATEWAY) .type(TEXT_PLAIN_TYPE) .entity("Request to remote Presto server timed out") .build()); }

Target:
private void setupAsyncResponse(AsyncResponse asyncResponse, ListenableFuture<Response> future) { bindAsyncResponse(asyncResponse, future, executor) .withTimeout(ASYNC_TIMEOUT, () -> Response .status(BAD_GATEWAY) .type(TEXT_PLAIN_TYPE) .entity("Request to remote Presto server timed out after" + ASYNC_TIMEOUT) .build()); }
Source:
public Expression between(@NonNull Expression expression1, @NonNull Expression expression2) { if(expression1 == null || expression2 == null) { throw new IllegalArgumentException("expression is null"); } Expression aggr = new AggregateExpression(Arrays.asList(expression1, expression2)); return new BinaryExpression(this, aggr, BinaryExpression.OpType.Between); }

Target:
public Expression between(@NonNull Expression expression1, @NonNull Expression expression2) { if (expression1 == null || expression2 == null) { throw new IllegalArgumentException("expression1 or expression2 is null."); } Expression aggr = new AggregateExpression(Arrays.asList(expression1, expression2)); return new BinaryExpression(this, aggr, BinaryExpression.OpType.Between); }
Source:
private boolean isVmNameUnique(ImportVmData data) { for (Object item : getItems()) { ImportVmData importVmData = (ImportVmData) item; if (data != importVmData && data.getVm().getName().equals(importVmData.getVm().getName())) { return false; } } return true; }

Target:
private boolean isVmNameUnique(ImportVmData data) { return getItems().stream().noneMatch(item -> data != item && data.getVm().getName().equals(((ImportVmData) item).getVm().getName())); }
Source:
public void doVersionUpgradeImport(ImportMigrationContext context) { final ImportMigrationConfigurationAdminContext adminContext = new ImportMigrationConfigurationAdminContext( context, this, configurationAdmin, getConfigurations(context), false); adminContext .memoryEntries() .filter( s -> (s.getFactoryPid() != null && s.getFactoryPid().equals(CONTENT_DIRECTORY_MONITOR_FPID)) || s.getPid().equals(URL_RESOURCE_READER_PID)) .forEach(ImportMigrationConfigurationAdminEntry::restore); }

Target:
public void doVersionUpgradeImport(ImportMigrationContext context) { final ImportMigrationConfigurationAdminContext adminContext = new ImportMigrationConfigurationAdminContext( context, this, configurationAdmin, getConfigurations(context), false); adminContext .memoryEntries() .filter( s -> CONTENT_DIRECTORY_MONITOR_FPID.equals(s.getFactoryPid()) || s.getPid().equals(URL_RESOURCE_READER_PID)) .forEach(ImportMigrationConfigurationAdminEntry::restore); }
Source:
public LandmarkStorage(GraphHopperStorage graph, Directory dir, int landmarks, final Weighting weighting, TraversalMode traversalMode) { this.graph = graph; this.minimumNodes = Math.min(graph.getNodes() / 2, 500_000); this.encoder = weighting.getFlagEncoder(); this.weighting = weighting; this.lmSelectionWeighting = new ShortestWeighting(encoder) { @Override public double calcWeight(EdgeIteratorState edge, boolean reverse, int prevOrNextEdgeId) { double res = weighting.calcWeight(edge, reverse, prevOrNextEdgeId); if (res >= Double.MAX_VALUE) return Double.POSITIVE_INFINITY; return edge.getDistance(); } }; this.traversalMode = TraversalMode.NODE_BASED; final String name = AbstractWeighting.weightingToFileName(weighting); this.landmarkWeightDA = dir.find("landmarks_" + name); this.landmarks = landmarks; this.LM_ROW_LENGTH = landmarks * 4; this.FROM_OFFSET = 0; this.TO_OFFSET = 2; this.landmarkIDs = new ArrayList<>(); this.subnetworkStorage = new SubnetworkStorage(dir, "landmarks_" + name); }

Target:
public LandmarkStorage(GraphHopperStorage graph, Directory dir, int landmarks, final Weighting weighting, TraversalMode traversalMode) { this.graph = graph; this.minimumNodes = Math.min(graph.getNodes() / 2, 500_000); this.encoder = weighting.getFlagEncoder(); this.weighting = weighting; this.lmSelectionWeighting = new ShortestWeighting(encoder) { @Override public double calcWeight(EdgeIteratorState edge, boolean reverse, int prevOrNextEdgeId) { double res = weighting.calcWeight(edge, reverse, prevOrNextEdgeId); if (res >= Double.MAX_VALUE) return Double.POSITIVE_INFINITY; return 1; } @Override public String toString() { return "LM_BFS|" + encoder; } }; this.traversalMode = TraversalMode.NODE_BASED; final String name = AbstractWeighting.weightingToFileName(weighting); this.landmarkWeightDA = dir.find("landmarks_" + name); this.landmarks = landmarks; this.LM_ROW_LENGTH = landmarks * 4; this.FROM_OFFSET = 0; this.TO_OFFSET = 2; this.landmarkIDs = new ArrayList<>(); this.subnetworkStorage = new SubnetworkStorage(dir, "landmarks_" + name); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { Fragment currentFragment = getSupportFragmentManager().findFragmentByTag("currentContent"); if (item.getItemId() == android.R.id.home && !(currentFragment instanceof ConnectFragment)) { toggle(); if(getSlidingMenu().isMenuShowing() && menu.isAdded()){ setTitle(((ITitleable)menu).getTitle()); } return true; } return false; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { Fragment currentFragment = getSupportFragmentManager().findFragmentByTag(Transitions.currentContent); if (item.getItemId() == android.R.id.home && !(currentFragment instanceof ConnectFragment)) { toggle(); if(getSlidingMenu().isMenuShowing() && menu.isAdded()){ setTitle(((ITitleable)menu).getTitle()); } return true; } return false; }
Source:
private static byte[][] generateCache() { return new byte[40][Fragment.MAX_LENGTH]; }

Target:
private static byte[][] generateCache() { return new byte[Chunk.MAX_SIZE/Fragment.MAX_LENGTH][Fragment.MAX_LENGTH]; }
Source:
public void testScanningForPackfiles() throws Exception { ObjectId unknownID = ObjectId .fromString("c0ffee09d0b63d694bf49bc1e6847473f42d4a8c"); GC gc = new GC(db); gc.setExpireAgeMillis(0); gc.setPackExpireAgeMillis(0); try (FileRepository receivingDB = new FileRepository( db.getDirectory())) { FileBasedConfig cfg = receivingDB.getConfig(); cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); cfg.save(); ObjectId id = commitFile("file.txt", "test", "master").getId(); gc.gc(); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.getObjectDatabase().hasPackedObject(id)); File packsFolder = new File(receivingDB.getObjectsDirectory(), "pack"); File tmpFile = new File(packsFolder, "1.tmp"); RevCommit id2 = commitFile("file.txt", "test2", "master"); fsTick(null); assertTrue(tmpFile.createNewFile()); assertFalse(receivingDB.hasObject(unknownID)); gc.gc(); Thread.sleep(2600); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.hasObject(id2)); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void testScanningForPackfiles() throws Exception { ObjectId unknownID = ObjectId .fromString("c0ffee09d0b63d694bf49bc1e6847473f42d4a8c"); GC gc = new GC(db); gc.setExpireAgeMillis(0); gc.setPackExpireAgeMillis(0); try (FileRepository receivingDB = new FileRepository( db.getDirectory())) { FileBasedConfig cfg = receivingDB.getConfig(); cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); cfg.save(); ObjectId id = commitFile("file.txt", "test", "master").getId(); gc.gc(); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.getObjectDatabase().hasPackedObject(id)); File packsFolder = new File(receivingDB.getObjectsDirectory(), "pack"); File tmpFile = new File(packsFolder, "1.tmp"); RevCommit id2 = commitFile("file.txt", "test2", "master"); fsTick(null); assertTrue(tmpFile.createNewFile()); assertFalse(receivingDB.hasObject(unknownID)); gc.gc(); Thread.sleep(2600); File[] ret = packsFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".pack"); } }); assertTrue(ret.length == 1); Assume.assumeTrue(tmpFile.lastModified() == ret[0].lastModified()); assertFalse(receivingDB.hasObject(unknownID)); assertTrue(receivingDB.hasObject(id2)); } }
Source:
private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.contains(ResourcesPlugin.getWorkspace().getRoot())) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { set.removeSet(resource); } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }

Target:
private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.contains(ResourcesPlugin.getWorkspace().getRoot())) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { IProject project = resource.getProject(); if (project != null) { set.removeSet(project); } } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }
Source:
public String toString() { return this.name; }

Target:
public String toString() { return this.moduleId; }