auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setOldImportsAsPatternAndState(final String oldImports) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); List<String> oldPatterns = new ArrayList<>(); List<String> oldStates = new ArrayList<>(); if (oldImports != null) { List<String> oldImportsList = Arrays.asList(oldImports.split(DELIMITER)); for (String oldImport : oldImportsList) { <START> oldPatterns.add(oldImport); <END> oldStates.add(TRUE); } } propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_PATTERN, oldPatterns.toArray(new String[oldPatterns.size()])); propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_STATE, oldStates.toArray(new String[oldStates.size()])); }</code><technical_language>Apply trim() skip string.isEmpty()</technical_language>

Target:
private void setOldImportsAsPatternAndState(final String oldImports) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); List<String> oldPatterns = new ArrayList<>(); List<String> oldStates = new ArrayList<>(); if (oldImports != null) { List<String> oldImportsList = Arrays.asList(oldImports.split(DELIMITER)); for (String oldImport : oldImportsList) { String trimmedImport = oldImport.trim(); if (!trimmedImport.isEmpty()) { oldPatterns.add(trimmedImport); oldStates.add(TRUE); } } } propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_PATTERN, oldPatterns.toArray(new String[oldPatterns.size()])); propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_STATE, oldStates.toArray(new String[oldStates.size()])); }
Source:
<code>private void setNewHeaderColumnWidth(Integer size, String representationName) { try { ResourceSet set = new ResourceSetImpl(); Resource vsm = set.getResource(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + VSM_NAME, true), true); Group group = (Group) vsm.getContents().get(0); final TableDescription desc; <START> if (EDITION_TABLE_NAME.equals(representationName)) { desc = (TableDescription) group.getOwnedViewpoints().get(0).getOwnedRepresentations().get(0); } else { desc = (TableDescription) group.getOwnedViewpoints().get(0).getOwnedRepresentations().get(1); } <END> TransactionalEditingDomain domain = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)); domain.getCommandStack().execute(new RecordingCommand(domain) { @Override protected void doExecute() { desc.setInitialHeaderColumnWidth(size); } }); vsm.save(Collections.emptyMap()); } catch (IOException e) { fail(e.getMessage()); } }</code><technical_language>I done iteration a break representationName. is more robust if model evolves</technical_language>

Target:
private void setNewHeaderColumnWidth(Integer size, String representationName) { try { ResourceSet set = new ResourceSetImpl(); Resource vsm = set.getResource(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + VSM_NAME, true), true); Group group = (Group) vsm.getContents().get(0); EList<RepresentationDescription> ownedRepresentations = group.getOwnedViewpoints().get(0).getOwnedRepresentations(); Optional<RepresentationDescription> description = ownedRepresentations.stream().filter(d -> d.getName().equals(representationName)).findFirst(); if (description.isPresent()) { final TableDescription desc = (TableDescription) description.get(); TransactionalEditingDomain domain = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)); domain.getCommandStack().execute(new RecordingCommand(domain) { @Override protected void doExecute() { desc.setInitialHeaderColumnWidth(size); } }); vsm.save(Collections.emptyMap()); } } catch (IOException e) { fail(e.getMessage()); } }
Source:
<code>public boolean deleteFromModel(EObject self) { Boolean cancelled = null; ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(Display.getCurrent().getActiveShell()); int status = dialog.open(); if (status == Dialog.OK) { try { if (deletefromModel) { <START> DomainSpecification domainSpecification = (DomainSpecification) self; if (null != domainSpecification.getNamespacePrefix()) { EcoreUtil.remove(domainSpecification.getNamespacePrefix()); } <END> } } catch (java.lang.ClassCastException e) { } return deletefromModel; } return cancelled; }</code><technical_language>is problematic for a true/false function modify model - a product. deleting namespace element done in Sirius, deleting domain. patch 4 for proposal. proposed patch 4, I of code in this function is needed. Do need a global variable here</technical_language>

Target:
public boolean deleteFromModel(EObject self) { Boolean cancelled = null; ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(Display.getCurrent().getActiveShell()); int status = dialog.open(); if (status == Dialog.OK) { return deletefromModel; } return cancelled; }
Source:
<code>protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); <START> if (allDisks.size() == 1){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } <END> List<Disk> diskWithSnapshots = (List<Disk>)imagesHandler.aggregateDiskImagesSnapshots(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())); getQueryReturnValue().setReturnValue(diskWithSnapshots.get(0)); }</code><technical_language>do need this optimization</technical_language>

Target:
protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } DiskImage diskWithSnapshots = imagesHandler.aggregateDiskImagesSnapshots(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())).stream().findFirst().orElse(null); getQueryReturnValue().setReturnValue(diskWithSnapshots); }
Source:
<code>public ElideResponse get(String baseUrlEndPoint, String path, MultivaluedMap<String, String> queryParams, User opaqueUser, String apiVersion, UUID requestId) { <START> return get(baseUrlEndPoint, path, queryParams, null, opaqueUser, apiVersion, requestId); <END> }</code><technical_language>empty hashmap</technical_language>

Target:
public ElideResponse get(String baseUrlEndPoint, String path, MultivaluedMap<String, String> queryParams, User opaqueUser, String apiVersion, UUID requestId) { return get(baseUrlEndPoint, path, queryParams, Collections.emptyMap(), opaqueUser, apiVersion, requestId); }
Source:
<code>protected String getFilePath() { if (path != null){ return path.toOSString(); } IEditorPart ed = fWindow.getActivePage().getActiveEditor(); if(ed.getEditorInput() instanceof PathEditorInput) return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); else <START> return ResourceUtil.getFile(ed.getEditorInput()).getLocation().toString(); <END> }</code><technical_language>Braces in if-else statement</technical_language>

Target:
protected String getFilePath() { if (path != null){ return path.toOSString(); } IEditorPart ed = fWindow.getActivePage().getActiveEditor(); if(ed.getEditorInput() instanceof PathEditorInput){ return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); } else { return ResourceUtil.getFile(ed.getEditorInput()).getLocation().toString(); } }
Source:
<code>void failWithNull() { <START> Class<M> cls1 = typeOf(createMessage()); <END> @SuppressWarnings("CheckReturnValue") AssertionError error = expectFailure(whenTesting -> whenTesting.that(null) .withType(cls1)); TruthFailureSubject assertError = assertThat(error); assertError.factValue(FactKey.ACTUAL.value()) .isEqualTo("null"); }</code><technical_language>is cls in this test case</technical_language>

Target:
void failWithNull() { Class<M> type = typeOf(createMessage()); @SuppressWarnings("CheckReturnValue") AssertionError error = expectFailure(whenTesting -> whenTesting.that(null) .withType(type)); TruthFailureSubject assertError = assertThat(error); assertError.factValue(FactKey.ACTUAL.value()) .isEqualTo("null"); }
Source:
<code><START> protected Integer calculateRecordsGraphQL(String jsonStr) { <END> Integer rec = null; try { JsonReader jsonReader = new JsonReader(new StringReader(jsonStr)); JsonElement jsonTree = JsonParser.parseString(jsonStr); if (!jsonTree.isJsonObject()) { return null; } JsonObject jsonObject = jsonTree.getAsJsonObject(); while (jsonReader.hasNext()) { JsonToken nextToken = jsonReader.peek(); if (JsonToken.BEGIN_OBJECT.equals(nextToken)) { jsonReader.beginObject(); jsonObject = jsonTree.getAsJsonObject(); } else if (JsonToken.NAME.equals(nextToken)) { String name = jsonReader.nextName(); jsonTree = jsonObject.get(name); if (name.equals("edges")) { if (jsonTree.isJsonArray()) { JsonArray jsonArray = jsonTree.getAsJsonArray(); rec = jsonArray.size(); } break; } } } } catch (IOException e) { log.error("Exception: {}", e); throw new IllegalStateException(e); } return rec; }</code><technical_language>of parsing methods need unit tests cover scenarios</technical_language>

Target:
protected Integer calculateRecordsGraphQL(String jsonStr) throws IOException { List<Integer> countList = JsonPath.read(jsonStr, "$..edges.length()"); Integer count = countList.size() > 0 ? countList.get(0) : 0; return count; }
Source:
<code>public boolean commit() { if (os != null) { unlock(); throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref)); } saveStatInformation(); try { FileUtils.rename(lck, ref, StandardCopyOption.ATOMIC_MOVE); haveLck = false; <START> token.close(); <END> return true; } catch (IOException e) { unlock(); return false; } }</code><technical_language>set token null now? If a token is succesfully closed link deleted references it</technical_language>

Target:
public boolean commit() { if (os != null) { unlock(); throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref)); } saveStatInformation(); try { FileUtils.rename(lck, ref, StandardCopyOption.ATOMIC_MOVE); haveLck = false; token.close(); token = null; return true; } catch (IOException e) { unlock(); return false; } }
Source:
<code>public static void loadDriver(String dbDriver) { String driverClass = s_drivers.get(dbDriver); if (driverClass == null) { s_logger.error("DB driver type " + dbDriver + " is not supported!"); throw new CloudRuntimeException("DB driver type " + dbDriver + " is not supported!"); } if (s_loadedDrivers.contains(dbDriver)) { s_logger.debug("DB driver " + driverClass + " was already loaded."); return; } try { Class.forName(driverClass).newInstance(); s_loadedDrivers.add(dbDriver); <START> s_logger.debug("Successfully loaded DB driver " + driverClass); <END> } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { s_logger.error("Failed to load DB driver " + driverClass); throw new CloudRuntimeException("Failed to load DB driver " + driverClass, e); } }</code><technical_language>add a check call debug if enabled</technical_language>

Target:
public static void loadDriver(String dbDriver) { String driverClass = DRIVERS.get(dbDriver); if (driverClass == null) { LOGGER.error("DB driver type " + dbDriver + " is not supported!"); throw new CloudRuntimeException("DB driver type " + dbDriver + " is not supported!"); } if (LOADED_DRIVERS.contains(dbDriver)) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("DB driver " + driverClass + " was already loaded."); } return; } try { Class.forName(driverClass).newInstance(); LOADED_DRIVERS.add(dbDriver); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Successfully loaded DB driver " + driverClass); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.error("Failed to load DB driver " + driverClass); throw new CloudRuntimeException("Failed to load DB driver " + driverClass, e); } }
Source:
<code>private void renderChangeInfo(ChangeInfo info) { changeInfo = info; lastDisplayedUpdate = info.updated(); labels.set(info); renderOwner(info); renderActionTextDate(info); renderDiffBaseListBox(info); initReplyButton(info, revision); initIncludedInAction(info); initDownloadAction(info, revision); initProjectLinks(info); initBranchLink(info); initEditMode(info, revision); actions.display(info, revision); star.setValue(info.starred()); permalink.setHref(ChangeLink.permalink(changeId)); permalink.setText(String.valueOf(info.legacy_id())); topic.set(info, revision); commit.set(commentLinkProcessor, info, revision); related.set(info, revision); reviewers.set(info); if (Gerrit.isNoteDbEnabled()) { hashtags.set(info); } else { setVisible(hashtagTableRow, false); } StringBuilder sb = new StringBuilder(); sb.append(Util.M.changeScreenTitleId(info.id_abbreviated())); if (info.subject() != null) { sb.append(": "); sb.append(info.subject()); } setWindowTitle(sb.toString()); NativeMap<ActionInfo> actionMap = info.has_actions() ? info.actions() : NativeMap.<ActionInfo> create(); initChangeAction(info, actionMap); renderRevisionInfo(info, <START> actionMap); <END> }</code><technical_language>This is wrong map, change info revision info, need. right code removed: RevisionInfo revInfo = info.revision(revision); if (revInfo.draft()) { NativeMap<ActionInfo> actionMap = revInfo.has_actions() ? revInfo.actions() : NativeMap.<ActionInfo> create(); }</technical_language>

Target:
private void renderChangeInfo(ChangeInfo info) { changeInfo = info; lastDisplayedUpdate = info.updated(); labels.set(info); renderOwner(info); renderActionTextDate(info); renderDiffBaseListBox(info); initReplyButton(info, revision); initIncludedInAction(info); initChangeAction(info); initDownloadAction(info, revision); initProjectLinks(info); initBranchLink(info); initEditMode(info, revision); actions.display(info, revision); star.setValue(info.starred()); permalink.setHref(ChangeLink.permalink(changeId)); permalink.setText(String.valueOf(info.legacy_id())); topic.set(info, revision); commit.set(commentLinkProcessor, info, revision); related.set(info, revision); reviewers.set(info); if (Gerrit.isNoteDbEnabled()) { hashtags.set(info); } else { setVisible(hashtagTableRow, false); } StringBuilder sb = new StringBuilder(); sb.append(Util.M.changeScreenTitleId(info.id_abbreviated())); if (info.subject() != null) { sb.append(": "); sb.append(info.subject()); } setWindowTitle(sb.toString()); RevisionInfo revInfo = info.revision(revision); NativeMap<ActionInfo> actionMap = revInfo.has_actions() ? info.actions() : NativeMap.<ActionInfo> create(); renderRevisionInfo(info, actionMap); }
Source:
<code>public T build() { <START> final String lbl = label; <END> if (lbl == null) { throw new IllegalStateException("The label has not been set yet"); } switch (channelKind) { case STATE: return (T) new StateProfileTypeImpl(profileTypeUID, lbl, supportedItemTypes); case TRIGGER: return (T) new TriggerProfileTypeImpl(profileTypeUID, lbl, supportedItemTypes, supportedChannelTypeUIDs); default: throw new IllegalArgumentException("Unknown type " + channelKind); } }</code><technical_language>is label a constructor parameter builder, if apparently is mandatory for construction of a profiletype</technical_language>

Target:
public T build() { return profileTypeFactory.create(profileTypeUID, label, supportedItemTypes, supportedChannelTypeUIDs); }
Source:
<code>private void refresh(SessionInfo sessionInfo) { Date now = new Date(); <START> synchronized (sessionInfo) { <END> Date softLimit = (Date) sessionInfo.contentOfSession.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; } softLimit = DateUtils.addMinutes(softLimit, Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); sessionInfo.contentOfSession.put(SOFT_LIMIT_PARAMETER_NAME, softLimit); } }</code><technical_language>synchornize? worse case updated</technical_language>

Target:
private void refresh(SessionInfo sessionInfo) { Date now = new Date(); Date softLimit = (Date) sessionInfo.contentOfSession.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; } int softLimitValue = Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval); if (softLimitValue > 0) { sessionInfo.contentOfSession.put(SOFT_LIMIT_PARAMETER_NAME, DateUtils.addMinutes(now, softLimitValue)); } }
Source:
<code>private HttpHeaders generateWarningHeaders(final EventTypeBase eventType) { final HttpHeaders headers = new HttpHeaders(); final List<String> warnings = Lists.newArrayList(nakadiSettings.getWarnAllDataAccessMessage()); if (eventType.getCleanupPolicy().equals(CleanupPolicy.COMPACT) || <START> eventType.getCleanupPolicy().equals(CleanupPolicy.COMPACT_AND_DELETE)) { <END> warnings.add(nakadiSettings.getLogCompactionWarnMessage()); } final String warningMessage = warnings.stream() .filter(s -> !s.isEmpty()).collect(Collectors.joining(". ")); if (!warnings.isEmpty()) { headers.add(HttpHeaders.WARNING, String.format("299 nakadi \"%s\"", warningMessage)); } return headers; }</code><technical_language>Do skip warning for compact_and_delete event-types? If I understand correctly, data deleted for compact,delete event-types, retention time policies. Another approach change internal warn message</technical_language>

Target:
private HttpHeaders generateWarningHeaders(final EventTypeBase eventType) { final HttpHeaders headers = new HttpHeaders(); final List<String> warnings = Lists.newArrayList(nakadiSettings.getWarnAllDataAccessMessage()); if (eventType.getCleanupPolicy().equals(CleanupPolicy.COMPACT)) { warnings.add(nakadiSettings.getLogCompactionWarnMessage()); } final String warningMessage = warnings.stream() .filter(s -> !s.isEmpty()).collect(Collectors.joining(". ")); if (!warnings.isEmpty()) { headers.add(HttpHeaders.WARNING, String.format("299 nakadi \"%s\"", warningMessage)); } return headers; }
Source:
<code>public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { <START> Activator.getDefault().logError("Error closing editor for " + getName(), e); END> } } } } }</code><technical_language>externalize</technical_language>

Target:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorClosingEditor + getName(), e); } } } } }
Source:
<code>public void checkSearchField() throws Exception { int nameLength = WORKSPACE_NAME.length(); int existingWorkspacesCount = getWorkspacesCount(); String sequenceForSearch = WORKSPACE_NAME.substring(nameLength - 5, nameLength); workspaces.waitVisibleWorkspacesCount(existingWorkspacesCount); workspaces.typeToSearchInput(sequenceForSearch); try { <START> workspaces.waitVisibleWorkspacesCount(EXPECTED_SORTED_WORKSPACES_COUNT); <END> } catch (TimeoutException ex) { fail("Known permanent failure <LINK_0>"); } List<Workspaces.WorkspaceListItem> items = workspaces.getVisibleWorkspaces(); assertEquals(items.get(0).getWorkspaceName(), WORKSPACE_NAME); workspaces.typeToSearchInput(""); workspaces.waitVisibleWorkspacesCount(getWorkspacesCount()); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME2); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); }</code><technical_language>Question name EXPECTED_SORTED_WORKSPACES_COUNT - I find statement sort projects. "EXPECTED_FOUND_WORKSPACES_COUNT</technical_language>

Target:
public void checkSearchField() throws Exception { int nameLength = WORKSPACE_NAME.length(); int existingWorkspacesCount = testWorkspaceServiceClient.getWorkspacesCount(); String sequenceForSearch = WORKSPACE_NAME.substring(nameLength - 5, nameLength); workspaces.waitVisibleWorkspacesCount(existingWorkspacesCount); workspaces.typeToSearchInput(sequenceForSearch); try { workspaces.waitVisibleWorkspacesCount(EXPECTED_SEARCHED_WORKSPACES_COUNT); } catch (TimeoutException ex) { fail("Known permanent failure <LINK_0>"); } List<Workspaces.WorkspaceListItem> items = workspaces.getVisibleWorkspaces(); assertEquals(items.get(0).getWorkspaceName(), WORKSPACE_NAME); workspaces.typeToSearchInput(""); workspaces.waitVisibleWorkspacesCount(testWorkspaceServiceClient.getWorkspacesCount()); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME2); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); }
Source:
<code>public long getActualFilter() { <START> <END> long mandatory = BluetoothPbapVcardComposer.FILTER_VERSION | BluetoothPbapVcardComposer.FILTER_N | BluetoothPbapVcardComposer.FILTER_TEL; if (!vcard21) mandatory |= BluetoothPbapVcardComposer.FILTER_FN; return filter | mandatory; }</code><technical_language>Code style: remove trailing spaces/tabs</technical_language>

Target:
public long getActualFilter() { if (filter == 0L) return -1L; long mandatory = BluetoothPbapVcardComposer.FILTER_VERSION | BluetoothPbapVcardComposer.FILTER_N | BluetoothPbapVcardComposer.FILTER_TEL; if (!vcard21) mandatory |= BluetoothPbapVcardComposer.FILTER_FN; return filter | mandatory; }
Source:
<code>public void setLineWidth(float width) { <START> if (width < 0) { throw new AssertionError(); } <END> mLineWidth = width; }</code><technical_language>this Utils.assertTrue</technical_language>

Target:
public void setLineWidth(float width) { Utils.assertTrue(width >= 0); mLineWidth = width; }
Source:
<code>public final Expr asExpr() { Expr expr = new Ident(getName()); for (InputAnchor in : getInputs()) <START> expr = new Apply(expr, in.asExpr()); <END> return expr; }</code><technical_language>If break this, add moustaches {}</technical_language>

Target:
public final Expr asExpr() { Expr expr = new Ident(getName()); for (InputAnchor in : getInputs()) { expr = new Apply(expr, in.asExpr()); } return expr; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.help) { <START> mLoginListener.help(); <END> return true; } return false; }</code><technical_language>mLoginListener need a null check</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.help) { if (mLoginListener != null) { mLoginListener.help(); } return true; } return false; }
Source:
<code>private void startMetricsService() { if (state != State.STARTING) { return; } log.infoInitializing(); connectionAttempts++; try { session = createSession(); } catch (Exception t) { Throwable rootCause = Throwables.getRootCause(t); log.warnCouldNotConnectToCassandra(rootCause.getLocalizedMessage()); long delay = 1L + ((connectionAttempts - 1L) % 4L); log.warnRetryingConnectingToCassandra(connectionAttempts, delay); lifecycleExecutor.schedule(this::startMetricsService, delay, SECONDS); return; } try { initSchema(); dataAcces = new DataAccessImpl(session); initTaskScheduler(); metricsService = new MetricsServiceImpl(); metricsService.setDataAccess(dataAcces); metricsService.setTaskScheduler(taskScheduler); metricsService.setDateTimeService(createDateTimeService()); metricsService.setDefaultTTL(getDefaultTTL()); MetricRegistry metricRegistry = MetricRegistryProvider.INSTANCE.getMetricRegistry(); <START> jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("hawkular.metrics").build(); <END> jmxReporter.start(); metricsService.startUp(session, keyspace, false, false, metricRegistry); initJobs(); metricsServiceReady.fire(new ServiceReadyEvent(metricsService.insertedDataEvents())); state = State.STARTED; log.infoServiceStarted(); } catch (Exception e) { log.fatalCannotConnectToCassandra(e); state = State.FAILED; } finally { if (state != State.STARTED && metricsService != null) { try { metricsService.shutdown(); } catch (Exception e) { log.errorCouldNotCloseServiceInstance(e); } } } }</code><technical_language>JmxReporter configurable? start is explicitly configured start</technical_language>

Target:
private void startMetricsService() { if (state != State.STARTING) { return; } log.infoInitializing(); connectionAttempts++; try { session = createSession(); } catch (Exception t) { Throwable rootCause = Throwables.getRootCause(t); log.warnCouldNotConnectToCassandra(rootCause.getLocalizedMessage()); long delay = 1L + ((connectionAttempts - 1L) % 4L); log.warnRetryingConnectingToCassandra(connectionAttempts, delay); lifecycleExecutor.schedule(this::startMetricsService, delay, SECONDS); return; } try { initSchema(); dataAcces = new DataAccessImpl(session); initTaskScheduler(); metricsService = new MetricsServiceImpl(); metricsService.setDataAccess(dataAcces); metricsService.setTaskScheduler(taskScheduler); metricsService.setDateTimeService(createDateTimeService()); metricsService.setDefaultTTL(getDefaultTTL()); MetricRegistry metricRegistry = MetricRegistryProvider.INSTANCE.getMetricRegistry(); if (!Boolean.parseBoolean(disableMetricsJmxReporting)) { jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("hawkular.metrics").build(); jmxReporter.start(); } metricsService.startUp(session, keyspace, false, false, metricRegistry); initJobs(); metricsServiceReady.fire(new ServiceReadyEvent(metricsService.insertedDataEvents())); state = State.STARTED; log.infoServiceStarted(); } catch (Exception e) { log.fatalCannotConnectToCassandra(e); state = State.FAILED; } finally { if (state != State.STARTED && metricsService != null) { try { metricsService.shutdown(); } catch (Exception e) { log.errorCouldNotCloseServiceInstance(e); } } } }
Source:
<code><START> AxisDirection(final int signum) { <END> this.signum = signum; }</code><technical_language>Again, why</technical_language>

Target:
private AxisDirection(final int signum) { this.signum = signum; }
Source:
<code>public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { List<ResourceTraversal> result= new ArrayList<>(); if (context instanceof RemoteResourceMappingContext) { for (IPackageFragment <START> fFragment : <END> fFragments) { result.addAll(Arrays.asList(getRemotePackageFragmentTraversals(fFragment, (RemoteResourceMappingContext)context, monitor))); } } else { for (IPackageFragment fFragment : fFragments) { result.addAll(Arrays.asList(getPackageFragmentTraversals(fFragment))); } } return result.toArray(new ResourceTraversal[result.size()]); }</code><technical_language>rename fragment</technical_language>

Target:
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { List<ResourceTraversal> result= new ArrayList<>(); if (context instanceof RemoteResourceMappingContext) { for (IPackageFragment fragment : fFragments) { result.addAll(Arrays.asList(getRemotePackageFragmentTraversals(fragment, (RemoteResourceMappingContext)context, monitor))); } } else { for (IPackageFragment fragment : fFragments) { result.addAll(Arrays.asList(getPackageFragmentTraversals(fragment))); } } return result.toArray(new ResourceTraversal[result.size()]); }
Source:
<code>protected ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) <START> throws Exception { <END> String password = form.getFieldValue("password"); Application application = (Application) request.getAttribute(Application.class.getName()); String sptoken = form.getFieldValue("sptoken"); application.resetPassword(sptoken, password); return new DefaultViewModel(getNextUri()).setRedirect(true); }</code><technical_language>IntelliJ's defaults next line</technical_language>

Target:
protected ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) throws Exception { String password = form.getFieldValue("password"); Application application = (Application) request.getAttribute(Application.class.getName()); String sptoken = form.getFieldValue("sptoken"); application.resetPassword(sptoken, password); return new DefaultViewModel(nextUri).setRedirect(true); }
Source:
<code><START> public void stop(BundleContext bc) throws Exception { <END> }</code><technical_language>java LOGGER.info("Groovy console stopping...");</technical_language>

Target:
public void stop(BundleContext bc) throws Exception { LOGGER.info(I18N.tr("Groovy console stoping...")); }
Source:
<code><START> private static NotificationDispatcher getNotificationDispatcher(MuleContextWithRegistry muleContext) <END> throws RegistrationException { return muleContext.getRegistry().lookupObject(NotificationDispatcher.class); }</code><technical_language>handle RegistrationException throwing</technical_language>

Target:
private static NotificationDispatcher getNotificationDispatcher(MuleContextWithRegistry muleContext) { try { return muleContext.getRegistry().lookupObject(NotificationDispatcher.class); } catch (RegistrationException e) { throw new MuleRuntimeException(e); } }
Source:
<code>public void someUnitTest() { <START> assertTrue(this::doSomething); <END> }</code><technical_language>This needlessly complex. a boolean supplier assertTrue. call doSomething() directly</technical_language>

Target:
void someUnitTest() { assertTrue(doSomething()); }
Source:
<code>private void queueWants(final Collection<Ref> want) throws TransportException { final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>(); for (final Ref r : want) { final ObjectId id = r.getObjectId(); <START> if (id == null) { throw new TransportException(MessageFormat .format(JGitText.get().cannotRead, r.getName())); } <END> try { final RevObject obj = revWalk.parseAny(id); if (obj.has(COMPLETE)) continue; if (inWorkQueue.add(id)) { obj.add(IN_WORK_QUEUE); workQueue.add(obj); } } catch (MissingObjectException e) { if (inWorkQueue.add(id)) workQueue.add(id); } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e); } } }</code><technical_language>thought in other files: this condition is more API error a protocol higher-level error, a RuntimeException NPE instead of TransportException</technical_language>

Target:
private void queueWants(final Collection<Ref> want) throws TransportException { final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>(); for (final Ref r : want) { final ObjectId id = r.getObjectId(); if (id == null) { throw new NullPointerException(MessageFormat.format( JGitText.get().transportProvidedRefWithNoObjectId, r.getName())); } try { final RevObject obj = revWalk.parseAny(id); if (obj.has(COMPLETE)) continue; if (inWorkQueue.add(id)) { obj.add(IN_WORK_QUEUE); workQueue.add(obj); } } catch (MissingObjectException e) { if (inWorkQueue.add(id)) workQueue.add(id); } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e); } } }
Source:
<code>public void statusOrdering() { List<TurboIssue> issues = new ArrayList<>(); for (int i = 0; i < 8; i++) { TurboIssue issue = new TurboIssue(FilterEvalTests.REPO, i, ""); if (i < 4) { issue.setOpen(true); } else { issue.setOpen(false); } issues.add(issue); } IModel model = TestUtils.singletonModel( new Model(FilterEvalTests.REPO, issues, new ArrayList<>(), new ArrayList<>(), new ArrayList<>())); List<TurboIssue> renderedIssues = new ArrayList<>(issues); Collections.sort(renderedIssues, Qualifier.getSortComparator(model, "status", false, false)); assertEquals(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), renderedIssues.stream() .map(TurboIssue::getId) .collect(Collectors.toList())); Collections.sort(renderedIssues, Qualifier.getSortComparator(model, "status", true, false)); assertEquals(Arrays.asList(4, 5, 6, 7, 0, 1, 2, 3), renderedIssues.stream() .map(TurboIssue::getId) .collect(Collectors.toList())); Collections.sort(renderedIssues, Qualifier.getSortComparator(model, "st", false, false)); assertEquals(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), renderedIssues.stream() .map(TurboIssue::getId) <START> .collect(Collectors.toList())); <END> }</code><technical_language>BTW, code segments added similar. extract a method</technical_language>

Target:
public void statusOrdering() { List<TurboIssue> issues = new ArrayList<>(); for (int i = 0; i < 8; i++) { TurboIssue issue = new TurboIssue(FilterEvalTests.REPO, i, ""); if (i < 4) { issue.setOpen(true); } else { issue.setOpen(false); } issues.add(issue); } IModel model = TestUtils.singletonModel( new Model(FilterEvalTests.REPO, issues, new ArrayList<>(), new ArrayList<>(), new ArrayList<>())); List<TurboIssue> renderedIssues = new ArrayList<>(issues); assertSorted(renderedIssues, Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), model, "status", false, false); assertSorted(renderedIssues, Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), model, "st", false, false); assertSorted(renderedIssues, Arrays.asList(4, 5, 6, 7, 0, 1, 2, 3), model, "status", true, false); }
Source:
<code><START> public static String getClassURL() { <END> return String.format("%s/v1/%s", Stripe.getApiBase(), "apple_pay/domains"); }</code><technical_language>I notice of other models this method static. mind making instance method for consistency? Also, if change private visibility? I reason leak this interface out of package</technical_language>

Target:
private static String getClassURL() { return String.format("%s/v1/%s", Stripe.getApiBase(), "apple_pay/domains"); }
Source:
<code>private void updateCurrentMemory(VM newVm) { int currentMemory = getVm().getMemSizeMb(); int newAmountOfMemory = newVm.getMemSizeMb(); if (getVm().getStatus().isNotRunning()) { newVmStatic.setMemSizeMb(newAmountOfMemory); return; } if (getVm().getStatus() != VMStatus.Up) { newVmStatic.setMemSizeMb(currentMemory); log.warn("Memory update {}MB -> {}MB of VM ({}) left out. Memory can't be updated in current VM state ({}).", currentMemory, newAmountOfMemory, getVm().getName(), getVm().getId(), getVm().getStatus()); return; } if (!VmCommonUtils.isMemoryToBeHotplugged(getVm(), newVm)) { return; } final int memoryAddedMb = newAmountOfMemory - currentMemory; final int factor = Config.<Integer>getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb); final boolean <START> isMemoryDividable = <END> memoryAddedMb % factor == 0; if (!isMemoryDividable) { addCustomValue("memoryAdded", String.valueOf(memoryAddedMb)); addCustomValue("requiredFactor", String.valueOf(factor)); auditLogDirector.log(this, AuditLogType.FAILED_HOT_SET_MEMORY_NOT_DIVIDABLE); return; } hotSetMemory(currentMemory, newAmountOfMemory); }</code><technical_language>please rename memoryDividable</technical_language>

Target:
private void updateCurrentMemory(VM newVm) { int currentMemory = getVm().getMemSizeMb(); int newAmountOfMemory = newVm.getMemSizeMb(); if (getVm().getStatus().isNotRunning()) { newVmStatic.setMemSizeMb(newAmountOfMemory); return; } if (getVm().getStatus() != VMStatus.Up) { newVmStatic.setMemSizeMb(currentMemory); log.warn("Memory update {}MB -> {}MB of VM ({}) left out. Memory can't be updated in current VM state ({}).", currentMemory, newAmountOfMemory, getVm().getName(), getVm().getId(), getVm().getStatus()); return; } if (!VmCommonUtils.isMemoryToBeHotplugged(getVm(), newVm)) { return; } final int memoryAddedMb = newAmountOfMemory - currentMemory; final int factor = Config.<Integer>getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb); final boolean memoryDividable = memoryAddedMb % factor == 0; if (!memoryDividable) { addCustomValue("memoryAdded", String.valueOf(memoryAddedMb)); addCustomValue("requiredFactor", String.valueOf(factor)); auditLogDirector.log(this, AuditLogType.FAILED_HOT_SET_MEMORY_NOT_DIVIDABLE); return; } hotSetMemory(currentMemory, newAmountOfMemory); }
Source:
<code><START> public void save(File file, String content) { <END> try { File dir = file.getAbsoluteFile().getParentFile(); if (!dir.exists() && !dir.mkdirs()) { throw KExceptionManager.criticalError("Could not create directory " + dir); } FileUtils.writeStringToFile(file, content); } catch (IOException e) { throw KExceptionManager.criticalError("Could not write to file " + file.getAbsolutePath(), e); } }</code><technical_language>I part of this diff, this function static</technical_language>

Target:
public static void save(File file, String content) { try { File dir = file.getAbsoluteFile().getParentFile(); if (!dir.exists() && !dir.mkdirs()) { throw KExceptionManager.criticalError("Could not create directory " + dir); } FileUtils.writeStringToFile(file, content); } catch (IOException e) { throw KExceptionManager.criticalError("Could not write to file " + file.getAbsolutePath(), e); } }
Source:
<code>public Tuple toTuple(Message msg, ProtobufExtensionRegistry extensionRegistry) { if (msg == null) { return null; } Descriptor msgDescriptor = msg.getDescriptorForType(); <START> Set<FieldDescriptor> fdSet = new LinkedHashSet<FieldDescriptor>(); <END> fdSet.addAll(msgDescriptor.getFields()); if(extensionRegistry != null) { fdSet.addAll(extensionRegistry.getExtensionDescriptorFields(msgDescriptor)); } Tuple tuple = tupleFactory_.newTuple(fdSet.size()); int curField = 0; try { for (FieldDescriptor fieldDescriptor : fdSet) { Object fieldValue = getFieldValue(msg, fieldDescriptor); if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) { tuple.set(curField++, messageToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } else { tuple.set(curField++, singleFieldToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } } } catch (ExecException e) { LOG.warn("Could not convert msg " + msg + " to tuple", e); } return tuple; }</code><technical_language>this need a set</technical_language>

Target:
public Tuple toTuple(Message msg, ProtobufExtensionRegistry extensionRegistry) { if (msg == null) { return null; } Descriptor msgDescriptor = msg.getDescriptorForType(); List<FieldDescriptor> fdSet = msgDescriptor.getFields(); if(extensionRegistry != null) { List<FieldDescriptor> extFdSet = extensionRegistry.getExtensionDescriptorFields(msgDescriptor); List<FieldDescriptor> newFdSet = new ArrayList<FieldDescriptor>(fdSet.size() + extFdSet.size()); newFdSet.addAll(fdSet); newFdSet.addAll(extFdSet); fdSet = newFdSet; } Tuple tuple = tupleFactory_.newTuple(fdSet.size()); int curField = 0; try { for (FieldDescriptor fieldDescriptor : fdSet) { Object fieldValue = getFieldValue(msg, fieldDescriptor); if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) { tuple.set(curField++, messageToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } else { tuple.set(curField++, singleFieldToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } } } catch (ExecException e) { LOG.warn("Could not convert msg " + msg + " to tuple", e); } return tuple; }
Source:
<code>public static void inject(Object instance, Object... components) { List<Field> fields = ReflectionUtil.getAllFields(instance.getClass(), Inject.class); for (Field f : fields) { for (Object component : components) { if (f.getType().isInstance(component)) { <START> ReflectionUtil.setAccessibly(instance, f, component); <END> break; } } } }</code><technical_language>Injecting multiple named executors work well, throw exception 2 more components match field? test create a proper ComponentRegistry call wireDependencies in cases</technical_language>

Target:
public static void inject(Object instance, Object... components) { List<Field> fields = ReflectionUtil.getAllFields(instance.getClass(), Inject.class); for (Field f : fields) { Object matching = null; for (Object component : components) { Object currentMatch = null; if (component instanceof NamedComponent) { NamedComponent nc = (NamedComponent) component; if (!f.getType().isInstance(nc.component)) { continue; } ComponentName componentName = f.getAnnotation(ComponentName.class); if (componentName != null && componentName.value().equals(nc.name)) { currentMatch = nc.component; } } else if (f.getType().isInstance(component)) { currentMatch = component; } if (currentMatch != null) { if (matching != null) { throw new IllegalArgumentException("Two components match the field " + f + ": " + matching + " and " + component); } ReflectionUtil.setAccessibly(instance, f, currentMatch); matching = currentMatch; } } } }
Source:
<code>private List<Partition> batchGetPartition(String databaseName, String tableName, List<String> partitionNames) { try { List<PartitionValueList> partitionValueLists = partitionNames.stream() .map(p -> new PartitionValueList().withValues(toPartitionValues(p))).collect(toList()); List<List<PartitionValueList>> batchedPartitionValueLists = Lists.partition(partitionValueLists, BATCH_GET_PARTITION_MAX_PAGE_SIZE); List<Future<BatchGetPartitionResult>> batchGetPartitionFutures = new ArrayList<>(); List<Partition> result = new ArrayList<>(); <START> for (List<PartitionValueList> partitions : batchedPartitionValueLists) { <END> batchGetPartitionFutures.add(glueClient.batchGetPartitionAsync(new BatchGetPartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionsToGet(partitions))); } for (Future<BatchGetPartitionResult> future : batchGetPartitionFutures) { BatchGetPartitionResult batchResult = future.get(); batchResult.getPartitions().stream().forEach(p -> result.add(GlueToPrestoConverter.convertPartition(p))); } return result; } catch (AmazonServiceException | InterruptedException | ExecutionException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }</code><technical_language>is this getPartitions()? do thing</technical_language>

Target:
private List<Partition> batchGetPartition(String databaseName, String tableName, List<String> partitionNames) { try { List<PartitionValueList> partitionValueLists = partitionNames.stream() .map(partitionName -> new PartitionValueList().withValues(toPartitionValues(partitionName))).collect(toList()); List<List<PartitionValueList>> batchedPartitionValueLists = Lists.partition(partitionValueLists, BATCH_GET_PARTITION_MAX_PAGE_SIZE); List<Future<BatchGetPartitionResult>> batchGetPartitionFutures = new ArrayList<>(); List<Partition> result = new ArrayList<>(); for (List<PartitionValueList> partitions : batchedPartitionValueLists) { batchGetPartitionFutures.add(glueClient.batchGetPartitionAsync(new BatchGetPartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionsToGet(partitions))); } for (Future<BatchGetPartitionResult> future : batchGetPartitionFutures) { BatchGetPartitionResult batchResult = future.get(); batchResult.getPartitions().stream().forEach(partition -> result.add(GlueToPrestoConverter.convertPartition(partition))); } return result; } catch (AmazonServiceException | InterruptedException | ExecutionException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
<code>public Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, Drawable drawable, double scaleFactor){ int wMode = MeasureSpec.getMode(widthMeasureSpec); int hMode = MeasureSpec.getMode(heightMeasureSpec); int maxWidth = wMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) : mMaxWidth; int maxHeight = hMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) : mMaxHeight; float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; int width = (int) Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); int height = (int) (width / ratio); height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = (int) (height * ratio); if (width > maxWidth) { width = maxWidth; height = (int) (width / ratio); } <START> Pair<Integer,Integer> mPair = new Pair<Integer,Integer>(new Double(width * scaleFactor).intValue(), new Double(height * scaleFactor).intValue()); <END> return mPair; }</code><technical_language>Minor, "new Double(width \* scaleFactor).intValue()" is a weird get Integer. "width \* scaleFactor"</technical_language>

Target:
public Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, Drawable drawable, double scaleFactor){ int wMode = MeasureSpec.getMode(widthMeasureSpec); int hMode = MeasureSpec.getMode(heightMeasureSpec); int maxWidth = wMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) : mMaxWidth; int maxHeight = hMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) : mMaxHeight; float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; int width = (int) Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); int height = (int) (width / ratio); height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = (int) (height * ratio); if (width > maxWidth) { width = maxWidth; height = (int) (width / ratio); } Pair<Integer,Integer> mPair = new Pair<Integer,Integer>((int)(width * scaleFactor), (int)(height * scaleFactor)); return mPair; }
Source:
<code>private Set<File> findDotProjectFiles(List<File> files, Repository repo) { Set<File> result = new HashSet<File>(); <START> Path workingTreeRoot = repo.getWorkTree().toPath(); <END> for (File changedFile : files) { if (changedFile.isFile()) { File projectFile = searchProjectFileUpwardsInRepo(changedFile .toPath().getParent(), workingTreeRoot); if (projectFile != null) { result.add(projectFile); } } } return result; }</code><technical_language>Path File.toPath[] in Java 5</technical_language>

Target:
private Set<File> findDotProjectFiles(List<File> files, Repository repo) { Set<File> result = new HashSet<File>(); String workingTreeRootPath = repo.getWorkTree().toString(); for (File changedFile : files) { if (changedFile.isFile()) { File projectFile = searchProjectFileUpwardsInRepo( changedFile.getParentFile(), workingTreeRootPath); if (projectFile != null) result.add(projectFile); } } return result; }
Source:
<code>public Object[] factory() { <START> List<Object> tests = new ArrayList<>(3 * 3 * 2); <END> for (TransactionMode txMode : TransactionMode.values()) { if (txMode == NONE) { continue; } for (LockingMode lockingMode : LockingMode.values()) { tests.add(new MultipleCacheTxFunctionalTest<byte[], byte[]>().keyValueGenerator(BYTE_ARRAY_GENERATOR).transactionMode(txMode).lockingMode(lockingMode)); tests.add(new MultipleCacheTxFunctionalTest<String, String>().keyValueGenerator(STRING_GENERATOR).transactionMode(txMode).lockingMode(lockingMode)); tests.add(new MultipleCacheTxFunctionalTest<Object[], Object[]>().keyValueGenerator(GENERIC_ARRAY_GENERATOR).transactionMode(txMode).javaSerialization().lockingMode(lockingMode)); } } return tests.toArray(); }</code><technical_language>re: flatMap</technical_language>

Target:
public Object[] factory() { return Arrays.stream(TransactionMode.values()) .filter(tMode -> tMode != NONE) .flatMap(txMode -> Arrays.stream(LockingMode.values()) .flatMap(lockingMode -> Stream.builder() .add(new MultipleCacheTxFunctionalTest<byte[], byte[]>() .keyValueGenerator(BYTE_ARRAY_GENERATOR) .transactionMode(txMode) .lockingMode(lockingMode)) .add(new MultipleCacheTxFunctionalTest<String, String>() .keyValueGenerator(STRING_GENERATOR) .transactionMode(txMode) .lockingMode(lockingMode)) .add(new MultipleCacheTxFunctionalTest<Object[], Object[]>() .keyValueGenerator(GENERIC_ARRAY_GENERATOR).javaSerialization() .transactionMode(txMode) .lockingMode(lockingMode)) .build())).toArray(); }