auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean validateUser(String username, String password) { if (defaultUser.equals(username) && defaultPassword.equals(password)) return true; <START> if (this.securityDomain == null) <END> throw MessagingLogger.ROOT_LOGGER.elytronSecurityDomainNotSet(); ServerAuthenticationContext context = this.securityDomain.createNewAuthenticationContext(); PasswordGuessEvidence evidence = new PasswordGuessEvidence(password != null ? password.toCharArray() : null); try { context.setAuthenticationName(username); if (context.verifyEvidence(evidence)) { return true; } else { MessagingLogger.ROOT_LOGGER.failedAuthentication(username); } } catch (IllegalArgumentException | IllegalStateException | RealmUnavailableException e) { MessagingLogger.ROOT_LOGGER.failedAuthenticationWithException(e, username, e.getMessage()); } finally { evidence.destroy(); } return false; }</code><technical_language>nitpicking this check in ctor securityDomain is final</technical_language>

Target:
public boolean validateUser(String username, String password) { if (defaultUser.equals(username) && defaultPassword.equals(password)) return true; return this.authenticate(username, password) != null; }
Source:
<code>private boolean executeSshPowerdown(String version) { boolean ret = false; try ( final EngineSSHClient sshClient = new EngineSSHClient(); final ByteArrayOutputStream cmdOut = new ByteArrayOutputStream(); final ByteArrayOutputStream cmdErr = new ByteArrayOutputStream(); ) { try { log.info("Opening SSH power down session on host {}", getVds().getHostName()); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); log.info("Executing SSH power down command on host {}", getVds().getHostName()); sshClient.executeCommand( Config.<String> getValue(ConfigValues.SshVdsPowerdownCommand, version), null, cmdOut, cmdErr ); ret = true; } catch (Exception ex) { log.error("SSH power down command failed on host '{}': {}\nStdout: {}\nStderr: {}", getVds().getHostName(), ex.getMessage(), cmdOut.toString(), <START> cmdErr.toString()); <END> log.debug("Exception", ex); } } catch(IOException e) { log.error("IOException", e); } return ret; }</code><technical_language>toString</technical_language>

Target:
private boolean executeSshPowerdown(String version) { boolean ret = false; try ( final EngineSSHClient sshClient = new EngineSSHClient(); final ByteArrayOutputStream cmdOut = new ByteArrayOutputStream(); final ByteArrayOutputStream cmdErr = new ByteArrayOutputStream(); ) { try { log.info("Opening SSH power down session on host {}", getVds().getHostName()); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); log.info("Executing SSH power down command on host {}", getVds().getHostName()); sshClient.executeCommand( Config.<String> getValue(ConfigValues.SshVdsPowerdownCommand, version), null, cmdOut, cmdErr ); ret = true; } catch (Exception ex) { log.error("SSH power down command failed on host '{}': {}\nStdout: {}\nStderr: {}", getVds().getHostName(), ex.getMessage(), cmdOut, cmdErr); log.debug("Exception", ex); } } catch(IOException e) { log.error("IOException", e); } return ret; }
Source:
<code><START> public void resolve() { <END> if (entry == null) { return; } NetworkBootProtocol bootproto = NetworkBootProtocol.NONE; String ipAddress = fetchIpAddress(); if (bootProtocolDhcp()) { bootproto = NetworkBootProtocol.DHCP; } else if (bootProtocolStatic()) { if (StringUtils.isNotEmpty(ipAddress)) { bootproto = NetworkBootProtocol.STATIC_IP; } } else if (StringUtils.isNotEmpty(ipAddress)) { bootproto = NetworkBootProtocol.STATIC_IP; } if (bootproto == NetworkBootProtocol.STATIC_IP) { String gateway = fetchGateway(); if (StringUtils.isNotEmpty(gateway)) { VdsBrokerObjectsBuilder.setGatewayIfNecessary(iface, host, gateway.toString()); } } iface.setBootProtocol(bootproto); }</code><technical_language>noticed jenkins complains this one. i sense declare this method final a template method</technical_language>

Target:
public void resolve() { if (entry == null) { return; } NetworkBootProtocol bootproto = NetworkBootProtocol.NONE; String ipAddress = fetchIpAddress(); if (bootProtocolDhcp()) { bootproto = NetworkBootProtocol.DHCP; } else if (StringUtils.isNotEmpty(ipAddress)) { bootproto = NetworkBootProtocol.STATIC_IP; } if (bootproto == NetworkBootProtocol.STATIC_IP) { String gateway = fetchGateway(); if (StringUtils.isNotEmpty(gateway)) { VdsBrokerObjectsBuilder.setGatewayIfNecessary(iface, host, gateway.toString()); } } iface.setBootProtocol(bootproto); }
Source:
<code>public void oldestKeyAfter() throws Exception { long now = Utils.currentTimeSeconds(); Utils.setMockClock(now); final ECKey key1 = new ECKey(); <START> key1.setCreationTimeSeconds(now); <END> Utils.rollMockClock(86400); final ECKey key2 = new ECKey(); final ArrayList<ECKey> keys = Lists.newArrayList(key1, key2); assertEquals(2, chain.importKeys(keys)); assertNull(chain.findOldestKeyAfter(now + 86400 * 2)); assertEquals(key1, chain.findOldestKeyAfter(now - 1)); assertEquals(key2, chain.findOldestKeyAfter(now + 86400 - 1)); }</code><technical_language>This is a no-op? i.e. creation time set mock clock in ECKey()</technical_language>

Target:
public void oldestKeyAfter() throws Exception { Utils.setMockClock(); long now = Utils.currentTimeSeconds(); final ECKey key1 = new ECKey(); Utils.rollMockClock(86400); final ECKey key2 = new ECKey(); final ArrayList<ECKey> keys = Lists.newArrayList(key1, key2); assertEquals(2, chain.importKeys(keys)); assertNull(chain.findOldestKeyAfter(now + 86400 * 2)); assertEquals(key1, chain.findOldestKeyAfter(now - 1)); assertEquals(key2, chain.findOldestKeyAfter(now + 86400 - 1)); }
Source:
<code>public static Rotation findReverse(Rotation rotation) { <START> Side frontResult = rotation.rotate(Side.FRONT); <END> Side topResult = rotation.rotate(Side.TOP); for (Rotation possibility : values()) { if (possibility.rotate(frontResult) == Side.FRONT && possibility.rotate(topResult) == Side.TOP) { return possibility; } } return null; }</code><technical_language>I suggest reverse of a rotation rotation undoes rotation. this code achieves this? If I is a a more direct of achieving it. I assume null a legitimate result, I suggest a RuntimeException thrown instead</technical_language>

Target:
public static Rotation findReverse(Rotation rotation) { Preconditions.checkNotNull(rotation); return REVERSE_ROTATIONS_MAP.get(rotation); }
Source:
<code>protected boolean runVm(Guid vmId, EngineLock lock) { return backend.runInternalAction( VdcActionType.RunVm, new RunVmParams(vmId), ExecutionHandler.createInternalJobContext(lock)).getSucceeded(); <START> } <END></code><technical_language>reorder methods? 1. harder review patch 2. methods interesting getVmDynamicDao interesting methods in this class startFailedAutoStartVms</technical_language>

Target:
private boolean runVm(Guid vmId, EngineLock lock) { return backend.runInternalAction( VdcActionType.RunVm, new RunVmParams(vmId), ExecutionHandler.createInternalJobContext(lock)).getSucceeded(); }
Source:
<code>public List<SqlOperator> getOperatorList() { <START> final ImmutableList.Builder<SqlOperator> b = ImmutableList.builder(); <END> for (List<String> schemaPath : schemaPaths) { CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, schemaPath, nameMatcher); if (schema != null) { for (String name : schema.getFunctionNames()) { schema.getFunctions(name, true).forEach(f -> b.add(toOp(new SqlIdentifier(name, SqlParserPos.ZERO), f))); } } } return b.build(); }</code><technical_language>this called builder instead of b</technical_language>

Target:
public List<SqlOperator> getOperatorList() { final ImmutableList.Builder<SqlOperator> builder = ImmutableList.builder(); for (List<String> schemaPath : schemaPaths) { CalciteSchema schema = SqlValidatorUtil.getSchema(rootSchema, schemaPath, nameMatcher); if (schema != null) { for (String name : schema.getFunctionNames()) { schema.getFunctions(name, true).forEach(f -> builder.add(toOp(new SqlIdentifier(name, SqlParserPos.ZERO), f))); } } } return builder.build(); }
Source:
<code>public void testPostEmptyMessage() throws Exception { WebResource resource = client().resource("/api/metrics/store"); WebResource.Builder builder = resource.type(MediaType.APPLICATION_JSON_TYPE); boolean badStatus = false; try { builder.post(Control.class, new Metric[]{}); } catch (UniformInterfaceException e) { badStatus = true; assertEquals("Unexpected status", 400, e.getResponse().getClientResponseStatus().getStatusCode()); } <START> if (!badStatus){ <END> fail("expected 400 status"); } }</code><technical_language>If expecting exception invoke fail() call builder.post() line 63</technical_language>

Target:
public void testPostEmptyMessage() throws Exception { WebResource resource = client().resource("/api/metrics/store"); WebResource.Builder builder = resource.type(MediaType.APPLICATION_JSON_TYPE); try { builder.post(Control.class, new Metric[]{}); fail("expected 400 status"); } catch (UniformInterfaceException e) { assertEquals("Unexpected status", 400, e.getResponse().getClientResponseStatus().getStatusCode()); } }
Source:
<code>protected static boolean sendFtpFile(String host, String username, String password, String directory, String filename, byte[] content) { try { FTPClient ftp = TransmissionUtils.ftpConnect(host, username, password); if (ftp == null || !ftp.isConnected()) { log.error("FTP client isn't connected. Please supply a client that has connected to the host."); return false; } if (directory == null) { } else if (!ftp.changeWorkingDirectory(directory)) { log.error("Desired path does not exist on the server"); ftp.logout(); <START> ftp.disconnect(); <END> return false; } try (OutputStream stream = ftp.storeFileStream(filename)) { stream.write(content); } if (!ftp.completePendingCommand() || !FTPReply.isPositiveCompletion(ftp.getReplyCode())) { log.error("Error storing file"); ftp.logout(); ftp.disconnect(); return false; } ftp.logout(); ftp.disconnect(); return true; } catch (IOException e) { log.error("Failed to FTP", e); } return false; }</code><technical_language>put logout+disconnect in a finally block connected try block wraps of this method</technical_language>

Target:
protected static boolean sendFtpFile(String host, String username, String password, String directory, String filename, byte[] content) { try { FTPClient ftp = TransmissionUtils.ftpConnect(host, username, password); if (ftp == null || !ftp.isConnected()) { log.error("FTP client isn't connected. Please supply a client that has connected to the host."); return false; } try { if (directory == null) { } else if (!ftp.changeWorkingDirectory(directory)) { log.error("Desired path does not exist on the server"); return false; } try (OutputStream stream = ftp.storeFileStream(filename)) { stream.write(content); } if (!ftp.completePendingCommand() || !FTPReply.isPositiveCompletion(ftp.getReplyCode())) { log.error("Error storing file"); return false; } return true; } finally { ftp.logout(); ftp.disconnect(); } } catch (IOException e) { log.error("Failed to FTP", e); } return false; }
Source:
<code>private void reportTaskStats() { ClientResponse cr = null; try { cr = client.callProcedure("@Statistics", "TASK", 0); } catch (Exception e) { log.error(e.getStackTrace()); } if (cr.getStatus() != ClientResponse.SUCCESS) { log.error("Failed to call Statistics proc at startup. Exiting."); log.error(((ClientResponseImpl) cr).toJSONString()); printJStack(); System.exit(-1); } long failures = 0; VoltTable t = cr.getResults()[0]; log.info(String.format("%15s%15s%15s%15s", "TASK NAME", "PARTITION ID", "INVOCATIONS", "FAILURES")); while (t.advanceRow()) { long f = t.getLong("PROCEDURE_FAILURES"); log.info(String.format("%15s%15s%15s%15s", t.getString("TASK_NAME"), t.getLong("PARTITION_ID"), t.getLong("SCHEDULER_INVOCATIONS"), f)); if (f > 0) failures += f; } if (failures > 0) { log.error(failures + " unexpected TASK failures"); <START> System.exit(-1); <END> } }</code><technical_language>want clean gracefully, "hardstop"</technical_language>

Target:
private void reportTaskStats() { ClientResponse cr = null; try { cr = client.callProcedure("@Statistics", "TASK", 0); } catch (Exception e) { log.error("Fetching TASK statistics failed:", e); } if (cr.getStatus() != ClientResponse.SUCCESS) { log.error("Failed to call Statistics proc at startup. Exiting."); printJStack(); hardStop(((ClientResponseImpl) cr).toJSONString()); } long failures = 0; VoltTable t = cr.getResults()[0]; log.info(String.format("%15s%15s%15s%15s", "TASK NAME", "PARTITION ID", "INVOCATIONS", "FAILURES")); while (t.advanceRow()) { long f = t.getLong("PROCEDURE_FAILURES"); log.info(String.format("%15s%15s%15s%15s", t.getString("TASK_NAME"), t.getLong("PARTITION_ID"), t.getLong("SCHEDULER_INVOCATIONS"), f)); if (f > 0) failures += f; } if (failures > 0) { hardStop(failures + " unexpected TASK failures"); } }
Source:
<code>private void showCreateCloverDirectoryDialog() { String state = Environment.getExternalStorageState(); if (!Environment.MEDIA_MOUNTED.equals(state)) { showMessage(context.getString(R.string.error_external_storage_is_not_mounted)); return; } if (getPermissionHelper().hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { if (settingsFile.getParentFile().exists()) { return; } } if (!AndroidUtils.isApi16()) { onPermissionGrantedForDirectoryCreation(); return; } AlertDialog dialog = new AlertDialog.Builder(context) .setTitle(context.getString(R.string.clover_directory_may_not_exist_title)) .setMessage(context.getString(R.string.clover_directory_may_not_exist_message)) .setPositiveButton(context.getString(R.string.create), (dialog1, which) -> { <START> getPermissionHelper().requestPermission(Manifest.permission.READ_EXTERNAL_STORAGE, granted -> { <END> if (granted) { onPermissionGrantedForDirectoryCreation(); } }); }) .setNegativeButton(context.getString(R.string.do_not), null) .create(); dialog.show(); }</code><technical_language>This WRITE_EXTERNAL_STORAGE, making directories is writing, reading</technical_language>

Target:
private void showCreateCloverDirectoryDialog() { String state = Environment.getExternalStorageState(); if (!Environment.MEDIA_MOUNTED.equals(state)) { showMessage(context.getString(R.string.error_external_storage_is_not_mounted)); return; } if (getPermissionHelper().hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { if (settingsFile.getParentFile().exists()) { return; } } if (!AndroidUtils.isApi16()) { onPermissionGrantedForDirectoryCreation(); return; } AlertDialog dialog = new AlertDialog.Builder(context) .setTitle(context.getString(R.string.clover_directory_may_not_exist_title)) .setMessage(context.getString(R.string.clover_directory_may_not_exist_message)) .setPositiveButton(context.getString(R.string.create), (dialog1, which) -> { getPermissionHelper().requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, granted -> { if (granted) { onPermissionGrantedForDirectoryCreation(); } }); }) .setNegativeButton(context.getString(R.string.do_not), null) .create(); dialog.show(); }
Source:
<code>public RequestManager get(View view) { if (view.getContext() == null) { <START> throw new IllegalArgumentException("Unable to obtain a request manager for a view without" <END> + " a Context"); } Activity activity = findActivity(view.getContext()); if (activity == null) { return get(view.getContext().getApplicationContext()); } if (activity instanceof FragmentActivity) { Fragment fragment = findSupportFragment(view, (FragmentActivity) activity); if (fragment == null) { return get(activity); } return get(fragment); } android.app.Fragment fragment = findFragment(view, activity); if (fragment == null) { return get(activity); } return get(fragment); }</code><technical_language>java throw new IllegalArgumentException( "Unable obtain a request manager for a view a Context"); readabilty, full-text-search for message; fit margin</technical_language>

Target:
public RequestManager get(View view) { if (Util.isOnBackgroundThread()) { return get(view.getContext().getApplicationContext()); } Preconditions.checkNotNull(view); Preconditions.checkNotNull(view.getContext(), "Unable to obtain a request manager for a view without a Context"); Activity activity = findActivity(view.getContext()); if (activity == null) { return get(view.getContext().getApplicationContext()); } if (activity instanceof FragmentActivity) { Fragment fragment = findSupportFragment(view, (FragmentActivity) activity); if (fragment == null) { return get(activity); } return get(fragment); } android.app.Fragment fragment = findFragment(view, activity); if (fragment == null) { return get(activity); } return get(fragment); }
Source:
<code>private boolean isNestedNewResourceCreation(ExpressionTree expr) { if (expr.is(Tree.Kind.NEW_CLASS)) { Arguments arguments = ((NewClassTree) expr).arguments(); if (arguments.stream().noneMatch(UnclosedResourcesCheck::isCloseable)) { return true; } <START> return arguments.stream().filter(UnclosedResourcesCheck::isCloseable).allMatch(this::isNestedNewResourceCreation); <END> } return false; }</code><technical_language>match returns true if stream is empty need for previous if</technical_language>

Target:
private boolean isNestedNewResourceCreation(ExpressionTree expr) { if (expr.is(Tree.Kind.NEW_CLASS)) { return ((NewClassTree) expr).arguments().stream() .filter(UnclosedResourcesCheck::isCloseable) .allMatch(this::isNestedNewResourceCreation); } return false; }
Source:
<code>private int completeZNode(String buffer, String token, List<String> candidates) { String path = token; int idx = path.lastIndexOf("/") + 1; String prefix = path.substring(idx); try { String dir = idx == 1 ? "/" : path.substring(0, idx - 1); List<String> children = zk.getChildren(dir, false); <START> candidates = children.stream().filter(child -> child.startsWith(prefix)).collect(Collectors.toList()); <END> } catch (InterruptedException e) { return 0; } catch (KeeperException e) { return 0; } Collections.sort(candidates); return candidates.size() == 0 ? buffer.length() : buffer.lastIndexOf("/") + 1; }</code><technical_language>Personally I find a real benefit code better. do want change this loop? is more resources fore loop. This is hot path question is more general. Streams appealing overhead is worth</technical_language>

Target:
private int completeZNode(String buffer, String token, List<String> candidates) { String path = token; int idx = path.lastIndexOf("/") + 1; String prefix = path.substring(idx); try { String dir = idx == 1 ? "/" : path.substring(0, idx - 1); List<String> children = zk.getChildren(dir, false); for (String child : children) { if (child.startsWith(prefix)) { candidates.add(child); } } } catch (InterruptedException e) { return 0; } catch (KeeperException e) { return 0; } Collections.sort(candidates); return candidates.size() == 0 ? buffer.length() : buffer.lastIndexOf("/") + 1; }
Source:
<code>private static <S extends OafEntity, T extends SpecificRecord>JavaRDD<T> filterAndParseToAvro(JavaRDD<S> source, ResultApprover resultApprover, OafEntityToAvroConverter<S, T> entityConverter) { <START> return parseToAvro(source.filter(x -> resultApprover.approve(x)), entityConverter); <END> }</code><technical_language>IDE hints replace filter(x -> resultApprover.approve(x)) filter(resultApprover::approve)</technical_language>

Target:
private static <S extends OafEntity, T extends SpecificRecord>JavaRDD<T> filterAndParseToAvro(JavaRDD<S> source, ResultApprover resultApprover, OafEntityToAvroConverter<S, T> entityConverter) { return parseToAvro(source.filter(resultApprover::approve), entityConverter); }
Source:
<code>public List<Blob> render(DocumentModel doc, RenditionDefinition definition) { if (log.isDebugEnabled()) { log.debug(String.format("Asking \"%s\" rendition lazy rendering for document %s (id=%s).", definition.getName(), doc.getPathAsString(), doc.getId())); } String key = buildRenditionKey(doc, definition); String sourceDocumentModificationDate = getSourceDocumentModificationDate(doc, definition); List<Blob> blobs = null; TransientStore ts = getTransientStore(); if (!ts.exists(key)) { blobs = handleNewRendition(key, doc, definition, sourceDocumentModificationDate); } else { String storedSourceDocumentModificationDate = (String) ts.getParameter(key, SOURCE_DOCUMENT_MODIFICATION_DATE_KEY); blobs = ts.getBlobs(key); if (ts.isCompleted(key)) { handleCompletedRendition(key, doc, definition, sourceDocumentModificationDate, storedSourceDocumentModificationDate, blobs); } else { handleIncompleteRendition(key, doc, definition, sourceDocumentModificationDate, storedSourceDocumentModificationDate); } } if (log.isDebugEnabled()) { String blobInfo; if (blobs == null) { blobInfo = null; } else if (blobs.size() == 1) { Blob blob = blobs.get(0); blobInfo = String.format("[filename=%s, MIME type=%s]", blob.getFilename(), blob.getMimeType()); } else { blobInfo = blobs.toString(); } <START> log.debug(String.format("Returning blobs: %s.", blobInfo)); <END> } return blobs; }</code><technical_language>initialize blobs Collections.emptyList() handle case build debug message. like: blobs.stream() .map(blob -> String.format("[filename=%s, MIME type=%s]", blob.getFilename(), blob.getMimeType())) .collect(Collectors.joining(",", "[", "]"));</technical_language>

Target:
public List<Blob> render(DocumentModel doc, RenditionDefinition definition) { if (log.isDebugEnabled()) { log.debug(String.format("Asking \"%s\" rendition lazy rendering for document %s (id=%s).", definition.getName(), doc.getPathAsString(), doc.getId())); } String key = buildRenditionKey(doc, definition); String sourceDocumentModificationDate = getSourceDocumentModificationDate(doc, definition); List<Blob> blobs = null; TransientStore ts = getTransientStore(); if (!ts.exists(key)) { blobs = handleNewRendition(key, doc, definition, sourceDocumentModificationDate); } else { String storedSourceDocumentModificationDate = (String) ts.getParameter(key, SOURCE_DOCUMENT_MODIFICATION_DATE_KEY); blobs = ts.getBlobs(key); if (ts.isCompleted(key)) { handleCompletedRendition(key, doc, definition, sourceDocumentModificationDate, storedSourceDocumentModificationDate, blobs); } else { handleIncompleteRendition(key, doc, definition, sourceDocumentModificationDate, storedSourceDocumentModificationDate); } } if (log.isDebugEnabled()) { String blobInfo = null; if (blobs != null) { blobInfo = blobs.stream() .map(blob -> String.format("{filename=%s, MIME type=%s}", blob.getFilename(), blob.getMimeType())) .collect(Collectors.joining(",", "[", "]")); } log.debug(String.format("Returning blobs: %s.", blobInfo)); } return blobs; }
Source:
<code>public RoundDecimalExpression(List<Expression> children) { super(children); int numChildren = children.size(); LiteralExpression secondChild = null; if(numChildren > 1) { secondChild = (LiteralExpression)children.get(1); } <START> if(secondChild != null && secondChild.getValue() instanceof Integer) { <END> scale = (Integer)secondChild.getValue(); } }</code><technical_language>throw if secondChild is INTEGER</technical_language>

Target:
public RoundDecimalExpression(List<Expression> children) { super(children); int numChildren = children.size(); LiteralExpression secondChild = null; if(numChildren > 1) { secondChild = (LiteralExpression)children.get(1); } if(secondChild != null && secondChild.getValue() != null) { Object obj = secondChild.getValue(); if(obj instanceof Integer) { scale = (Integer)obj; } else { throw new IllegalDataException("Invalid value " + obj + " of type " + secondChild.getDataType() + " passed at position 2 "); } } }
Source:
<code>private void logProviderCall(String methodName, Uri uri) { String format = "%s.%s %s"; <START> String path = uri == null ? null : uri.getPath(); <END> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { Timber.d(format, CardContentProvider.class.getSimpleName(), methodName, path); } else { format += " (%s)"; Timber.d(format, CardContentProvider.class.getSimpleName(), methodName, path, getCallingPackage()); } }</code><technical_language>call this method write operations (everything query) raise logging level Timber.d() Timber.i(). log user readable permanent log file CollectionHelper.getInstance().getCol(getContext()).log(message)</technical_language>

Target:
private void logProviderCall(String methodName, Uri uri) { String format = "%s.%s %s"; String path = uri == null ? null : uri.getPath(); String msg; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { msg = String.format(format, CardContentProvider.class.getSimpleName(), methodName, path); } else { msg = String.format(format + " (%s)", CardContentProvider.class.getSimpleName(), methodName, path, getCallingPackage()); } Timber.i(msg); Collection col = CollectionHelper.getInstance().getCol(getContext()); if (col != null) { col.log(msg); } }
Source:
<code>private boolean isWrapperType(Class<?> clazz) { <START> TypeResolver typeResolver = new TypeResolutionHelper().getTypeResolver(); <END> for ( ValidatedValueUnwrapper<?> handler : validatedValueHandlers ) { ResolvedType handlerType = typeResolver.resolve( handler.getClass() ); List<ResolvedType> typeParameters = handlerType.typeParametersFor( ValidatedValueUnwrapper.class ); if ( TypeHelper.isAssignable( typeParameters.get( 0 ).getErasedType(), clazz ) ) { return true; } } return false; }</code><technical_language>pass TypeResolutionHelper validator factory constructor. object maintains a costly cache, is a single instance is passed construction time objects in need of it</technical_language>

Target:
private boolean isWrapperType(Class<?> clazz) { if ( validatedValueHandlersManager.getValidatedValueHandler( clazz ) != null ) { return true; } return false; }
Source:
<code>protected ISelection resolveSelection(IEditorPart part, ITextSelection changedSelection, StructuredViewer viewer) throws CoreException { Object elementToSelect = null; if (changedSelection instanceof TextSelection && part instanceof CEditor) { <START> ICElement cdtElement = SelectionConverter.getElementAtOffset(CDTUiBridge.getInputCElement((CEditor) part), <END> changedSelection); elementToSelect = cdtElement; } if (elementToSelect != null) { StructuredSelection currentSelection = (StructuredSelection) viewer.getSelection(); if (currentSelection.size() <= 1) { for (ViewerFilter filter : Arrays.asList(viewer.getFilters())) { if (filter instanceof CDTDeclarationsFilter && elementToSelect instanceof IMethod) { elementToSelect = ((IMethod) elementToSelect).getTranslationUnit(); } } } return new StructuredSelection(elementToSelect); } else { return null; } }</code><technical_language>check if celement is null</technical_language>

Target:
protected ISelection resolveSelection(IEditorPart part, ITextSelection changedSelection, StructuredViewer viewer) throws CoreException { Object elementToSelect = null; if (changedSelection instanceof TextSelection && part instanceof CEditor) { ICElement element = CDTUiBridge.getInputCElement((CEditor) part); if (element != null) { ICElement cdtElement = SelectionConverter.getElementAtOffset(element, changedSelection); elementToSelect = cdtElement; } } if (elementToSelect != null) { StructuredSelection currentSelection = (StructuredSelection) viewer.getSelection(); if (currentSelection.size() <= 1) { for (ViewerFilter filter : Arrays.asList(viewer.getFilters())) { if (filter instanceof CDTDeclarationsFilter && elementToSelect instanceof IMethod) { elementToSelect = ((IMethod) elementToSelect).getTranslationUnit(); } } } return new StructuredSelection(elementToSelect); } else { return null; } }
Source:
<code><START> public void enableOkButton() { <END> modal.enableOkButton(); }</code><technical_language>I this package-private: suggestion void enableOkButton() {</technical_language>

Target:
void enableOkButton() { modal.enableOkButton(); }
Source:
<code>public void testUnexpectedTaskManagerTerminationAfterRunnerCloseWillBeIgnored() throws Exception { final CompletableFuture<Void> terminationFuture = new CompletableFuture<>(); final TestingTaskExecutorService taskExecutorService = TestingTaskExecutorService.newBuilder() .setTerminationFuture(terminationFuture) .withManualTerminationFutureCompletion() .build(); final TaskManagerRunner taskManagerRunner = createTaskManagerRunner( createConfiguration(), <START> (configuration, resourceID, rpcService, highAvailabilityServices, heartbeatServices, metricRegistry, blobCacheService, localCommunicationOnly, externalResourceInfoProvider, fatalErrorHandler) -> taskExecutorService); <END> taskManagerRunner.closeAsync(); terminationFuture.completeExceptionally(new FlinkException("Test exception.")); assertThat(systemExitTrackingSecurityManager.getSystemExitFuture(), willNotComplete(Duration.ofMillis(10L))); }</code><technical_language>Good idea. do</technical_language>

Target:
public void testUnexpectedTaskManagerTerminationAfterRunnerCloseWillBeIgnored() throws Exception { final CompletableFuture<Void> terminationFuture = new CompletableFuture<>(); final TestingTaskExecutorService taskExecutorService = TestingTaskExecutorService.newBuilder() .setTerminationFuture(terminationFuture) .withManualTerminationFutureCompletion() .build(); final TaskManagerRunner taskManagerRunner = createTaskManagerRunner( createConfiguration(), createTaskExecutorServiceFactory(taskExecutorService)); taskManagerRunner.closeAsync(); terminationFuture.completeExceptionally(new FlinkException("Test exception.")); assertThat(systemExitTrackingSecurityManager.getSystemExitFuture(), willNotComplete(Duration.ofMillis(10L))); }
Source:
<code>public String getSectionTitle(int position) { Speaker speaker = getItem(position); String name = speaker.getName(); return name.substring(0, 1); <START> } <END></code><technical_language>This is valid for sorted name, break for other sort criterias</technical_language>

Target:
public String getSectionTitle(int position) { Speaker speaker = getItem(position); sortType = SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, SORTED_BY_NAME); String title; switch (sortType){ case SORTED_BY_NAME: title = speaker.getName(); break; case SORTED_BY_ORGANIZATION: title = speaker.getOrganisation(); break; default: title = speaker.getCountry(); break; } if (TextUtils.isEmpty(title)) { return "-"; } return String.valueOf(title.charAt(0)); }
Source:
<code>private Provider<?> getProvider() { if (provider == null) { <START> provider = providerDao.get(getNetwork().getProvidedBy().getProviderId()); <END> } return provider; }</code><technical_language>I method is invoked 'plugToExternalNetwork', complete I check 'getNetwork' is 'null' 'is external'</technical_language>

Target:
private Provider<?> getProvider() { if (provider == null ) { Network network = getNetwork(); if (network != null && network.isExternal()) provider = providerDao.get(network.getProvidedBy().getProviderId()); } return provider; }
Source:
<code>public static UploadBlock blockFromJson(JSONObject jsonObject){ if (jsonObject == null){ return null; } long offset = 0; long size = 0; int index = 0; String context = null; <START> ArrayList<UploadData> uploadDatas = new ArrayList<UploadData>(); <END> try { offset = jsonObject.getLong("offset"); size = jsonObject.getLong("size"); index = jsonObject.getInt("index"); context = jsonObject.getString("context"); JSONArray dataJsonArray = jsonObject.getJSONArray("uploadDatas"); for (int i = 0; i < dataJsonArray.length(); i++) { JSONObject dataJson = dataJsonArray.getJSONObject(i); UploadData data = UploadData.dataFromJson(dataJson); if (data != null){ uploadDatas.add(data); } } } catch (JSONException e){}; UploadBlock block = new UploadBlock(offset, size, index, uploadDatas); if (context != null && context.length() > 0){ block.context = context; } return block; }</code><technical_language>uploadDatas => uploadDataList</technical_language>

Target:
public static UploadBlock blockFromJson(JSONObject jsonObject){ if (jsonObject == null){ return null; } long offset = 0; long size = 0; int index = 0; String context = null; ArrayList<UploadData> uploadDataList = new ArrayList<UploadData>(); try { offset = jsonObject.getLong("offset"); size = jsonObject.getLong("size"); index = jsonObject.getInt("index"); context = jsonObject.getString("context"); JSONArray dataJsonArray = jsonObject.getJSONArray("uploadDataList"); for (int i = 0; i < dataJsonArray.length(); i++) { JSONObject dataJson = dataJsonArray.getJSONObject(i); UploadData data = UploadData.dataFromJson(dataJson); if (data != null){ uploadDataList.add(data); } } } catch (JSONException e){}; UploadBlock block = new UploadBlock(offset, size, index, uploadDataList); if (context != null && context.length() > 0){ block.context = context; } return block; }
Source:
<code>public void addRemoveModuleTest() throws IOException, CommandFailedException, CliException, SAXException { File testJar = createTestJar(); AddModule addModule = new AddModule.Builder(TEST_MODULE_NAME) .resource(testJar) .resourceDelimiter(":") .dependency("org.hibernate") .dependency("org.jboss.as.controller") .mainClass("test.mainclass") .property("foo", "bar") .property("john", "doe") .build(); client.apply(addModule); File asRoot = new File(getPathToAs()); File module = new File(asRoot, "modules" + File.separator + TEST_MODULE_NAME.replaceAll("\\.", File.separator)); <START> assertTrue("Module " + module.getAbsolutePath() + " doesn't exist on path", module.exists()); <END> File moduleTestJar = new File(module, "main" + File.separator + testJar.getName()); assertTrue("File " + moduleTestJar.getAbsolutePath() + " doesn't exist", moduleTestJar.exists()); File moduleXml = new File(module, "main" + File.separator + "module.xml"); assertTrue("File " + moduleXml.getName() + " doesn't exist in " + module.getAbsolutePath(), moduleXml.exists()); assertXmlIdentical(EXPECTED_MODULE_XML, Files.toString(moduleXml, Charsets.UTF_8)); RemoveModule removeModule = new RemoveModule(TEST_MODULE_NAME); client.apply(removeModule); assertFalse("Module exists on path " + module.getAbsolutePath(), module.exists()); }</code><technical_language>I this style of assertion failure messages confusing. prefer "should" style; in this case, Module ... exist path</technical_language>

Target:
public void addRemoveModuleTest() throws IOException, CommandFailedException, CliException, SAXException { File testJar1 = createTestJar("testJar1.jar", "folder with spaces"); File testJar2 = createTestJar("testJar2.jar", null); AddModule addModule = new AddModule.Builder(TEST_MODULE_NAME) .resource(testJar1) .resource(testJar2) .resourceDelimiter(":") .dependency("org.hibernate") .dependency("org.jboss.as.controller") .mainClass("test.mainclass") .property("foo", "bar") .property("john", "doe") .build(); client.apply(addModule); File asRoot = new File(getPathToAs()); File module = new File(asRoot, "modules" + File.separator + TEST_MODULE_NAME.replaceAll("\\.", File.separator)); assertTrue("Module " + module.getAbsolutePath() + " should exist on path", module.exists()); File moduleTestJar1 = new File(module, "main" + File.separator + testJar1.getName()); assertTrue("File " + moduleTestJar1.getAbsolutePath() + " should exist", moduleTestJar1.exists()); File moduleTestJar2 = new File(module, "main" + File.separator + testJar2.getName()); assertTrue("File " + moduleTestJar2.getAbsolutePath() + " should exist", moduleTestJar2.exists()); File moduleXml = new File(module, "main" + File.separator + "module.xml"); assertTrue("File " + moduleXml.getName() + " should exist in " + module.getAbsolutePath(), moduleXml.exists()); assertXmlIdentical(EXPECTED_MODULE_XML, Files.toString(moduleXml, Charsets.UTF_8)); RemoveModule removeModule = new RemoveModule(TEST_MODULE_NAME); client.apply(removeModule); assertFalse("Module shouldn't exist on path " + module.getAbsolutePath(), module.exists()); }
Source:
<code>public void setReorderMode(ReorderMode reorderMode) { if (reorderMode == ReorderMode.FAST && fastModeExtent == null) { throw new IllegalArgumentException("An EditSession without a fast mode tried to use it for reordering!"); } if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) { throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!"); } flushSession(); this.reorderMode = reorderMode; switch (reorderMode) { case MULTI_STAGE: if (fastModeExtent != null) { fastModeExtent.setPostEditSimulationEnabled(false); } reorderExtent.setEnabled(true); <START> break; <END> case FAST: fastModeExtent.setPostEditSimulationEnabled(true); if (reorderExtent != null) { reorderExtent.setEnabled(false); } break; case NONE: if (fastModeExtent != null) { fastModeExtent.setPostEditSimulationEnabled(false); } if (reorderExtent != null) { reorderExtent.setEnabled(false); } break; } }</code><technical_language>I this if block in case NONE: belong switch statement, in if (reorderMode != FAST). disabling reorderExtent. right for switch</technical_language>

Target:
public void setReorderMode(ReorderMode reorderMode) { if (reorderMode == ReorderMode.FAST && fastModeExtent == null) { throw new IllegalArgumentException("An EditSession without a fast mode tried to use it for reordering!"); } if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) { throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!"); } if (commitRequired()) { flushSession(); } this.reorderMode = reorderMode; switch (reorderMode) { case MULTI_STAGE: if (fastModeExtent != null) { fastModeExtent.setPostEditSimulationEnabled(false); } reorderExtent.setEnabled(true); break; case FAST: fastModeExtent.setPostEditSimulationEnabled(true); if (reorderExtent != null) { reorderExtent.setEnabled(false); } break; case NONE: if (fastModeExtent != null) { fastModeExtent.setPostEditSimulationEnabled(false); } if (reorderExtent != null) { reorderExtent.setEnabled(false); } break; } }
Source:
<code>public EventPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String type = event.get().getType(); <START> Class clazz = EventPayload.class; <END> if ("CommitCommentEvent".equals(type)) { clazz = CommitCommentPayload.class; } else if ("CreateEvent".equals(type)) { clazz = CreatePayload.class; } else if ("DeleteEvent".equals(type)) { clazz = DeletePayload.class; } else if ("DownloadEvent".equals(type)) { clazz = DownloadPayload.class; } else if ("FollowEvent".equals(type)) { clazz = FollowPayload.class; } else if ("ForkEvent".equals(type)) { clazz = ForkPayload.class; } else if ("ForkApplyEvent".equals(type)) { clazz = ForkApplyPayload.class; } else if ("GistEvent".equals(type)) { clazz = GistPayload.class; } else if ("GollumEvent".equals(type)) { clazz = GollumPayload.class; } else if ("IssueCommentEvent".equals(type)) { clazz = IssueCommentPayload.class; } else if ("IssuesEvent".equals(type)) { clazz = IssuesPayload.class; } else if ("MemberEvent".equals(type)) { clazz = MemberPayload.class; } else if ("PublicEvent".equals(type)) { clazz = PublicPayload.class; } else if ("PullRequestEvent".equals(type)) { clazz = PullRequestPayload.class; } else if ("PushEvent".equals(type)) { clazz = PushPayload.class; } else if ("TeamAddEvent".equals(type)) { clazz = TeamAddPayload.class; } else if ("WatchEvent".equals(type)) { clazz = WatchPayload.class; } if (clazz == EventPayload.class) { return new EventPayload(); } return context.deserialize(json, clazz); }</code><technical_language>This Class<? extends EventPayload> clazz remove a compiler warning</technical_language>

Target:
public EventPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String type = event.get().getType(); Class<? extends EventPayload> clazz = EventPayload.class; if ("CommitCommentEvent".equals(type)) clazz = CommitCommentPayload.class; else if ("CreateEvent".equals(type)) clazz = CreatePayload.class; else if ("DeleteEvent".equals(type)) clazz = DeletePayload.class; else if ("DownloadEvent".equals(type)) clazz = DownloadPayload.class; else if ("FollowEvent".equals(type)) clazz = FollowPayload.class; else if ("ForkEvent".equals(type)) clazz = ForkPayload.class; else if ("ForkApplyEvent".equals(type)) clazz = ForkApplyPayload.class; else if ("GistEvent".equals(type)) clazz = GistPayload.class; else if ("GollumEvent".equals(type)) clazz = GollumPayload.class; else if ("IssueCommentEvent".equals(type)) clazz = IssueCommentPayload.class; else if ("IssuesEvent".equals(type)) clazz = IssuesPayload.class; else if ("MemberEvent".equals(type)) clazz = MemberPayload.class; else if ("PublicEvent".equals(type)) clazz = PublicPayload.class; else if ("PullRequestEvent".equals(type)) clazz = PullRequestPayload.class; else if ("PushEvent".equals(type)) clazz = PushPayload.class; else if ("TeamAddEvent".equals(type)) clazz = TeamAddPayload.class; else if ("WatchEvent".equals(type)) clazz = WatchPayload.class; if (clazz == EventPayload.class) return new EventPayload(); return context.deserialize(json, clazz); }
Source:
<code>public HttpResponse doCompleteInstall(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Jenkins j = Jenkins.getActiveInstance(); User u = j.getUser("admin"); if(u != null && u.getProperty(AuthenticationKey.class) != null) { Iterator<Map.Entry<Descriptor<UserProperty>,UserProperty>> entries = u.getProperties().entrySet().iterator(); while(entries.hasNext()) { Map.Entry<?, ?> entry = entries.next(); if(entry.getValue() instanceof AuthenticationKey) { entries.remove(); } } <START> } <END> j.setInstallState(InstallState.INITIAL_SETUP_COMPLETED); InstallUtil.saveLastExecVersion(); PluginServletFilter.removeFilter(FORCE_SETUP_WIZARD_FILTER); j.setSetupWizard(null); return HttpResponses.okJSON(); }</code><technical_language>I suppose want save user it. change persisted</technical_language>

Target:
public HttpResponse doCompleteInstall(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Jenkins j = Jenkins.getActiveInstance(); User u = j.getUser("admin"); if(u != null && u.getProperty(AuthenticationKey.class) != null) { Iterator<Map.Entry<Descriptor<UserProperty>,UserProperty>> entries = u.getProperties().entrySet().iterator(); while(entries.hasNext()) { Map.Entry<?, ?> entry = entries.next(); if(entry.getValue() instanceof AuthenticationKey) { entries.remove(); } } u.save(); } j.setInstallState(InstallState.INITIAL_SETUP_COMPLETED); InstallUtil.saveLastExecVersion(); PluginServletFilter.removeFilter(FORCE_SETUP_WIZARD_FILTER); j.setSetupWizard(null); return HttpResponses.okJSON(); }
Source:
<code>public HikariPool(final HikariConfig config) { super(config); this.connectionBag = new ConcurrentBag<>(this); this.suspendResumeLock = config.isAllowPoolSuspension() ? new SuspendResumeLock() : SuspendResumeLock.FAUX_LOCK; this.houseKeepingExecutorService = initializeHouseKeepingExecutorService(); checkFailFast(); if (config.getMetricsTrackerFactory() != null) { setMetricsTrackerFactory(config.getMetricsTrackerFactory()); } else { setMetricRegistry(config.getMetricRegistry()); } setHealthCheckRegistry(config.getHealthCheckRegistry()); handleMBeans(this, true); ThreadFactory threadFactory = config.getThreadFactory(); LinkedBlockingQueue<Runnable> addQueue = new LinkedBlockingQueue<>(config.getMaximumPoolSize()); this.addConnectionQueue = unmodifiableCollection(addQueue); this.addConnectionExecutor = createAddConnectionExecutor(threadFactory, addQueue); this.closeConnectionExecutor = createThreadPoolExecutor(config.getMaximumPoolSize(), poolName + " connection " + "closer", <START> threadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); <END> this.leakTaskFactory = new ProxyLeakTaskFactory(config.getLeakDetectionThreshold(), houseKeepingExecutorService); this.houseKeeperTask = houseKeepingExecutorService.scheduleWithFixedDelay(new HouseKeeper(), 100L, housekeepingPeriodMs, MILLISECONDS); }</code><technical_language>Please do reformat line 131-133, is unncessary</technical_language>

Target:
public HikariPool(final HikariConfig config) { super(config); this.connectionBag = new ConcurrentBag<>(this); this.suspendResumeLock = config.isAllowPoolSuspension() ? new SuspendResumeLock() : SuspendResumeLock.FAUX_LOCK; this.houseKeepingExecutorService = initializeHouseKeepingExecutorService(); checkFailFast(); if (config.getMetricsTrackerFactory() != null) { setMetricsTrackerFactory(config.getMetricsTrackerFactory()); } else { setMetricRegistry(config.getMetricRegistry()); } setHealthCheckRegistry(config.getHealthCheckRegistry()); handleMBeans(this, true); ThreadFactory threadFactory = config.getThreadFactory(); LinkedBlockingQueue<Runnable> addQueue = new LinkedBlockingQueue<>(config.getMaximumPoolSize()); this.addConnectionQueue = unmodifiableCollection(addQueue); this.addConnectionExecutor = createAddConnectionExecutor(threadFactory, addQueue); this.closeConnectionExecutor = createThreadPoolExecutor(config.getMaximumPoolSize(), poolName + " connection closer", threadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); this.leakTaskFactory = new ProxyLeakTaskFactory(config.getLeakDetectionThreshold(), houseKeepingExecutorService); this.houseKeeperTask = houseKeepingExecutorService.scheduleWithFixedDelay(new HouseKeeper(), 100L, housekeepingPeriodMs, MILLISECONDS); if (isBlockedInitialization(config)) { blockUntilPoolInitialized(config); } }
Source:
<code>public int compare(SearchResult o1, SearchResult o2) { if ((o1.getComponent() instanceof FeedItem) && (o2.getComponent() instanceof FeedItem)) <START> return ((FeedItem) o2.getComponent()).getPubDate().compareTo(((FeedItem) o1.getComponent()).getPubDate()); <END> return 0; }</code><technical_language>Talking style, IMO extracting getComponent() getPubDate() variables this line easier read</technical_language>

Target:
public int compare(SearchResult o1, SearchResult o2) { if ((o1.getComponent() instanceof FeedItem) && (o2.getComponent() instanceof FeedItem)) { FeedItem item1 = (FeedItem) o1.getComponent(); FeedItem item2 = (FeedItem) o2.getComponent(); return item2.getPubDate().compareTo(item1.getPubDate()); } return 0; }
Source:
<code>public static int addGracePeriod(int interval) { <START> return interval + (int) (interval * 0.2); <END> }</code><technical_language>avoid magic numbers (0.2 set meaningful constant)</technical_language>

Target:
public static int addGracePeriod(int interval) { return interval + (int) (interval * GRACE_PERIOD); }
Source:
<code>protected String addRulesBoltDependenciesFactory () { String rulesProcessorBuilderRef = addRulesProcessorBuilder(); String dependenciesFactoryId = "dependenciesFactory" + UUID_FOR_COMPONENTS; <START> String dependenciesFactoryClassName = "com.hortonworks.iotas.streams.runtime.rule.RulesDependencyFactory"; <END> List constructorArgs = new ArrayList(); Map ref = getRefYaml(rulesProcessorBuilderRef); constructorArgs.add(ref); constructorArgs.add("GROOVY"); this.addToComponents(this.createComponent(dependenciesFactoryId, dependenciesFactoryClassName, null, constructorArgs, null)); return dependenciesFactoryId; }</code><technical_language>This RulesDependenciesFactory. I find RulesDependencyFactory in code base. Please check fix</technical_language>

Target:
protected String addRulesBoltDependenciesFactory () { String rulesProcessorBuilderRef = addRulesProcessorBuilder(); String dependenciesFactoryId = "dependenciesFactory" + UUID_FOR_COMPONENTS; String dependenciesFactoryClassName = "com.hortonworks.iotas.streams.runtime.rule.RulesDependenciesFactory"; List constructorArgs = new ArrayList(); Map ref = getRefYaml(rulesProcessorBuilderRef); constructorArgs.add(ref); constructorArgs.add("GROOVY"); this.addToComponents(this.createComponent(dependenciesFactoryId, dependenciesFactoryClassName, null, constructorArgs, null)); return dependenciesFactoryId; }
Source:
<code>public void getMetadataInvalid() { <START> config.getMetadata(null); <END> assertNotNull(logger.getMsg()); }</code><technical_language>assertNull return</technical_language>

Target:
public void getMetadataInvalid() { assertNull(config.getMetadata(null)); assertNotNull(logger.getMsg()); }
Source:
<code>public ImmutableSet<EventClass> rejections() { <START> ImmutableSet<EventClass> result = <END> commands.methods() .stream() .flatMap(m -> m.rejections().stream()) .collect(toImmutableSet()); return result; }</code><technical_language>Do need result local variable here? prefer style: return commands .methods() .stream() .map(CommandAcceptingMethod::rejections) .flatMap(ImmutableSet::stream) .collect(toImmutableSet());</technical_language>

Target:
public ImmutableSet<EventClass> rejections() { ImmutableSet<EventClass> result = commands.methods() .stream() .map(CommandAcceptingMethod::rejections) .flatMap(ImmutableSet::stream) .collect(toImmutableSet()); return result; }