auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void registerDefaults() { register((Criterion) IScoreCriteria.DUMMY); register((Criterion) IScoreCriteria.TRIGGER); register((Criterion) IScoreCriteria.HEALTH); register((Criterion) IScoreCriteria.PLAYER_KILL_COUNT); register((Criterion) IScoreCriteria.TOTAL_KILL_COUNT); register((Criterion) IScoreCriteria.DEATH_COUNT); register((Criterion) IScoreCriteria.FOOD); register((Criterion) IScoreCriteria.AIR); register((Criterion) IScoreCriteria.ARMOR); register((Criterion) IScoreCriteria.XP); register((Criterion) IScoreCriteria.LEVEL); for (Map.Entry<TextFormatting, SpongeTextColor> entry : TextColorRegistryModule.enumChatColor.entrySet()) { final int colorIndex = entry.getKey().getColorIndex(); if (colorIndex < 0) { continue; } final String id = entry.getValue().getId(); final Criterion teamKillCriterion = (Criterion) IScoreCriteria.TEAM_KILL[colorIndex]; <START> register(teamKillCriterion); <END> teamKillMappings.put(id, teamKillCriterion); final Criterion killedByTeamCriterion = (Criterion) IScoreCriteria.KILLED_BY_TEAM[colorIndex]; register(killedByTeamCriterion); killedByTeamMappings.put(id, killedByTeamCriterion); } }</code><technical_language>I realise this before, prefix instance methods fields this. please? Again, enforced for API 8, ensure new API 7 in swing of things</technical_language>

Target:
public void registerDefaults() { IScoreCriteria.INSTANCES.values().forEach(scoreCriterion -> { final Criterion criterion = (Criterion) scoreCriterion; this.register(criterion); criterion.getTeamColor().ifPresent(color -> { this.teamKillMappings.put(color.getId(), criterion); this.killedByTeamMappings.put(color.getId(), criterion); }); }); }
Source:
<code>public DBObject convertStats(VariantStats variantStats) { <START> <END> BasicDBObject mongoStats = new BasicDBObject(MAF_FIELD, variantStats.getMaf()); mongoStats.append(MGF_FIELD, variantStats.getMgf()); mongoStats.append(MAFALLELE_FIELD, variantStats.getMafAllele()); mongoStats.append(MGFGENOTYPE_FIELD, variantStats.getMgfGenotype()); mongoStats.append(MISSALLELE_FIELD, variantStats.getMissingAlleles()); mongoStats.append(MISSGENOTYPE_FIELD, variantStats.getMissingGenotypes()); BasicDBObject genotypes = new BasicDBObject(); for (Map.Entry<Genotype, Integer> g : variantStats.getGenotypesCount().entrySet()) { String genotypeStr = g.getKey().toString().replace(".", "-1"); genotypes.append(genotypeStr, g.getValue()); } mongoStats.append(NUMGT_FIELD, genotypes); return mongoStats; }</code><technical_language>Remove blank line</technical_language>

Target:
private DBObject convertStats(VariantStats variantStats) { BasicDBObject mongoStats = new BasicDBObject(MAF_FIELD, variantStats.getMaf()); mongoStats.append(MGF_FIELD, variantStats.getMgf()); mongoStats.append(MAFALLELE_FIELD, variantStats.getMafAllele()); mongoStats.append(MGFGENOTYPE_FIELD, variantStats.getMgfGenotype()); mongoStats.append(MISSALLELE_FIELD, variantStats.getMissingAlleles()); mongoStats.append(MISSGENOTYPE_FIELD, variantStats.getMissingGenotypes()); BasicDBObject genotypes = new BasicDBObject(); for (Map.Entry<Genotype, Integer> g : variantStats.getGenotypesCount().entrySet()) { String genotypeStr = g.getKey().toString().replace(".", "-1"); genotypes.append(genotypeStr, g.getValue()); } mongoStats.append(NUMGT_FIELD, genotypes); return mongoStats; }
Source:
<code>public static ExecutionFailureInfo toFailure(Throwable failure) { <START> return toFailure(failure, new HashSet<>()); <END> }</code><technical_language>IdentityHashSet? (here & below)</technical_language>

Target:
public static ExecutionFailureInfo toFailure(Throwable failure) { return toFailure(failure, newIdentityHashSet()); }
Source:
<code><START> public Job<?,?> getProject() { <END> return project; }</code><technical_language>Binary-incompatible, I afraid, need do java @Deprecated public AbstractProject getProject() { return project instanceof AbstractProject ? (AbstractProject) project : null; } @Exported(name="project") public Job<?,?> getProject() { return project; }</technical_language>

Target:
public AbstractProject getProject() { return project instanceof AbstractProject ? (AbstractProject)project : null; }
Source:
<code>private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); <START> prefs = new Preferences(TestController.getTestConfigFile(false)); <END> KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); }</code><technical_language>This confusing. TestController.createRealPreference() TestController.createApplicationPreference() (can a name) for test preference</technical_language>

Target:
private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.createApplicationPreference(); KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); }
Source:
<code>private void persistGrillServiceState() throws IOException { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { LOG.info("Persisting state of service:" + service.getName()); <START> Path serviceWritePath = new Path(persistDir, service.getName() + ".out"); <END> ObjectOutputStream out = null; try { out = new ObjectOutputStream(fs.create(serviceWritePath)); service.writeExternal(out); } finally { out.close(); } Path servicePath = getServicePersistPath(service); fs.rename(serviceWritePath, servicePath); } }</code><technical_language>assuming instance of GrillService server? if add instance id file name</technical_language>

Target:
private void persistGrillServiceState() throws IOException { if (conf.getBoolean(GrillConfConstants.GRILL_SERVER_RESTART_ENABLED, GrillConfConstants.DEFAULT_GRILL_SERVER_RESTART_ENABLED)) { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { LOG.info("Persisting state of service:" + service.getName()); Path serviceWritePath = new Path(persistDir, service.getName() + ".out"); ObjectOutputStream out = null; try { out = new ObjectOutputStream(fs.create(serviceWritePath)); service.writeExternal(out); } finally { if (out != null) { out.close(); } } Path servicePath = getServicePersistPath(service); fs.rename(serviceWritePath, servicePath); LOG.info("Persisted service " + service.getName() + " to " + servicePath); } } }
Source:
<code><START> private void addPendingDatumIdExtra(Intent i, CommCareSession session) { <END> String pendingDatumId = session.getNeededDatum().getDataId(); i.putExtra(KEY_PENDING_SESSION_DATUM_ID, pendingDatumId); }</code><technical_language>This static</technical_language>

Target:
private static void addPendingDatumIdExtra(Intent i, CommCareSession session) { i.putExtra(KEY_PENDING_SESSION_DATUM_ID, session.getNeededDatum().getDataId()); }
Source:
<code>public void addContents(@NonNull Container container) { Jenkins jenkins = Jenkins.getInstance(); <START> add(container, "unlabeled", jenkins.unlabeledLoad); <END> add(container, "overall", jenkins.overallLoad); for (Label l: jenkins.getLabels()) { try { add(container, String.format("label/%s", URLEncoder.encode(l.getName(), "UTF-8")), l.loadStatistics); } catch (UnsupportedEncodingException e) { } } }</code><technical_language>nice lableled (sic) typo in Jenkins core</technical_language>

Target:
public void addContents(@NonNull Container container) { Jenkins jenkins = Jenkins.getInstance(); add(container, "no-label", jenkins.unlabeledLoad); add(container, "overall", jenkins.overallLoad); for (Label l : jenkins.getLabels()) { try { add(container, String.format("label/%s", URLEncoder.encode(l.getName(), "UTF-8")), l.loadStatistics); } catch (UnsupportedEncodingException e) { } } }
Source:
<code>private void detach() { if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle()); model.setHelpTag(HelpTag.detach_storage); model.setHashName("detach_storage"); model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg()); ArrayList<String> items = new ArrayList<String>(); boolean shouldAddressWarnning = false; for (Object item : getSelectedItems()) { StorageDomain a = (StorageDomain) item; items.add(a.getStoragePoolName()); <START> if (a.getStorageDomainType() == StorageDomainType.Data) { <END> shouldAddressWarnning = true; } } model.setItems(items); if (containsLocalStorage(model)) { model.getLatch().setIsAvailable(true); model.getLatch().setIsChangable(true); shouldAddressWarnning = false; model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString())); } if (shouldAddressWarnning) { model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote()); } UICommand tempVar = new UICommand("OnDetach", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }</code><technical_language>please a.getStorageDomainType().isDataDomain()</technical_language>

Target:
private void detach() { if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle()); model.setHelpTag(HelpTag.detach_storage); model.setHashName("detach_storage"); model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg()); ArrayList<String> items = new ArrayList<String>(); boolean shouldAddressWarnning = false; for (Object item : getSelectedItems()) { StorageDomain a = (StorageDomain) item; items.add(a.getStoragePoolName()); if (a.getStorageDomainType().isDataDomain()) { shouldAddressWarnning = true; break; } } model.setItems(items); if (containsLocalStorage(model)) { model.getLatch().setIsAvailable(true); model.getLatch().setIsChangable(true); shouldAddressWarnning = false; model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString())); } if (shouldAddressWarnning) { model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote()); } UICommand tempVar = new UICommand("OnDetach", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }
Source:
<code><START> MockSelector(MockServerLayout serverLayout, AtomicReference<MockSelectorState> state, Time time) <END> throws IOException { super(new NetworkMetrics(new MetricRegistry()), time, null); super.close(); this.serverLayout = serverLayout; this.state = state == null ? new AtomicReference<MockSelectorState>(MockSelectorState.Good) : state; this.time = time; }</code><technical_language>argument AtomicReference? If do need AtomicReference, class input turn atomic reference</technical_language>

Target:
MockSelector(MockServerLayout serverLayout, AtomicReference<MockSelectorState> state, Time time) throws IOException { super(new NetworkMetrics(new MetricRegistry()), time, null); super.close(); this.serverLayout = serverLayout; this.state = state == null ? new AtomicReference(MockSelectorState.Good) : state; this.time = time; }
Source:
<code>public void testRefreshWorkflowsByOrg() throws IOException { usersURLPrefix = "http://localhost:%d/users/" + id; checkInitialDB(); testRefreshWorkflowsByOrg1(); <START> assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(14); <END> testRefreshWorkflowsByOrg2(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(14); testRefreshWorkflowsByOrg3(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(14); testRefreshWorkflowsByOrg4(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(15); testRefreshWorkflowsByOrg5(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(16); }</code><technical_language>magic numbers, a minimum explain them. Better, avoid checking workflows</technical_language>

Target:
public void testRefreshWorkflowsByOrg() throws IOException { usersURLPrefix = "http://localhost:%d/users/" + id; checkInitialDB(); testRefreshWorkflowsByOrg1(); List<Workflow> currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isGreaterThanOrEqualTo(newDockstoreTestUser2Workflows.size()); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg2(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isEqualTo(0); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg3(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isEqualTo(0); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg4(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isGreaterThanOrEqualTo(newDockstore_TestUser2Workflows.size()); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg5(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isGreaterThanOrEqualTo(newDockstoreDotTestDotUser2Workflows.size()); }
Source:
<code>public void tearDown() { if (InstanceManager.containsDefault(ShutDownManager.class)) { ShutDownManager sm = InstanceManager.getDefault(jmri.ShutDownManager.class); <START> List<Runnable> rlist = sm.getRunnables(); while (!rlist.isEmpty()) { if (rlist.get(0) instanceof jmri.jmrit.logix.WarrantShutdownTask) { sm.deregister((ShutDownTask)rlist.get(0)); rlist = sm.getRunnables(); } } <END> } InstanceManager.getDefault(WarrantManager.class).dispose(); JUnitUtil.tearDown(); }</code><technical_language>If rlist.get(0) is a WarrantShutdownTask, this infinite loop. I suggest else statement throws exception breaks out of loop</technical_language>

Target:
public void tearDown() { if (InstanceManager.containsDefault(ShutDownManager.class)) { List<ShutDownTask> list = new ArrayList<>(); ShutDownManager sm = InstanceManager.getDefault(jmri.ShutDownManager.class); for (Runnable r : sm.getRunnables()) { if (r instanceof jmri.jmrit.logix.WarrantShutdownTask) { list.add((ShutDownTask)r); } } for ( ShutDownTask t : list) { sm.deregister(t); } } JUnitUtil.clearShutDownManager(); JUnitUtil.tearDown(); }
Source:
<code>public Builder(GraphQLDirective existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.onOperation = existing.isOnOperation(); this.onFragment = existing.isOnFragment(); this.onField = existing.isOnField(); <START> this.onVariableDefinition=existing.isOnVariableDefinition(); <END> this.locations = existing.validLocations(); this.arguments.putAll(getByName(existing.getArguments(), GraphQLArgument::getName)); }</code><technical_language>formatting is a bit</technical_language>

Target:
public Builder(GraphQLDirective existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.onOperation = existing.isOnOperation(); this.onFragment = existing.isOnFragment(); this.onField = existing.isOnField(); this.locations = existing.validLocations(); this.arguments.putAll(getByName(existing.getArguments(), GraphQLArgument::getName)); }
Source:
<code><START> protected Date determineStartDateByFrequency() { <END> if (lastBilledDate == null) { LOG.error("determineStartDateByFrequency, unable to calculate start date by frequency when the last billed date iis NULL"); throw new IllegalStateException("Can not calculate the start date when the last billed date is NULL"); } LocalDate localDateLastBilledDate = new LocalDate(lastBilledDate.getTime(), DateTimeZone.UTC); LocalDate localDateNextStartDate = localDateLastBilledDate.plusDays(1); Date sqlDateNextStartDate = new Date(localDateNextStartDate.toDate().getTime()); if (LOG.isDebugEnabled()) { LOG.debug("determineStartDateByFrequency, lastBilledDate is: " + lastBilledDate + " and next start date is: " + sqlDateNextStartDate); } return sqlDateNextStartDate; }</code><technical_language>concern I is this method is for determining next billing period start date. I want inadvertently affect offer parts of application</technical_language>

Target:
protected Date determineStartDateByFrequency() { if (lastBilledDate == null) { LOG.info("determineStartDateByFrequency, no previous billed date, so award start date is the next start date"); return awardStartDate; } return calculateNextDay(lastBilledDate); }
Source:
<code>public void cache(String value) { if (cache == null) cache = new ArrayTernaryTrie.Growing<>(false, 64, 64); <START> cache.put("\"" + value + "\"", value); <END> }</code><technical_language>needs encoded/escaped key</technical_language>

Target:
public boolean cache(String value) { if (cache == null) cache = new ArrayTernaryTrie.Growing<>(false, 64, 64); CachedString cached = new CachedString(value); if (cached.isCacheable()) { cache.put(cached.encoded, cached); return true; } return false; }
Source:
<code>public static Job createSystem(String name, final ICoreRunnable runnable) { <START> Job job = create(name == null ? "" : name, runnable); END> job.setSystem(true); return job; }</code><technical_language>Prohibit name == null. assert if called null</technical_language>

Target:
public static Job createSystem(String name, final ICoreRunnable runnable) { Job job = create(name, runnable); job.setSystem(true); return job; }
Source:
<code>private CreateLinkedTable parseCreateLinkedTable(boolean temp, boolean globalTemp, boolean force) { read(TABLE); boolean ifNotExists = readIfNotExists(); String tableName = readIdentifierWithSchema(); CreateLinkedTable command = new CreateLinkedTable(session, getSchema()); command.setTemporary(temp); command.setGlobalTemporary(globalTemp); command.setForce(force); command.setIfNotExists(ifNotExists); command.setTableName(tableName); command.setComment(readCommentIf()); read(OPEN_PAREN); command.setDriver(readString()); read(COMMA); command.setUrl(readString()); read(COMMA); command.setUser(readString()); read(COMMA); command.setPassword(readString()); read(COMMA); String originalTable = readString(); if (readIf(COMMA)) { command.setOriginalSchema(originalTable); originalTable = readString(); } command.setOriginalTable(originalTable); read(CLOSE_PAREN); <START> if(readIf("FETCH_SIZE")){ command.setFetchSize(readExpression().optimize(session)); } else if (readIf("EMIT")) { read("UPDATES"); command.setEmitUpdates(true); if(readIf("FETCH_SIZE")){ command.setFetchSize(readExpression().optimize(session)); } } else if (readIf("READONLY")) { command.setReadOnly(true); if(readIf("FETCH_SIZE")){ command.setFetchSize(readExpression().optimize(session)); } } <END> return command; }</code><technical_language>is overcomplicated, add a new separate if (readIf("FETCH_SIZE")) { existing conditions</technical_language>

Target:
private CreateLinkedTable parseCreateLinkedTable(boolean temp, boolean globalTemp, boolean force) { read(TABLE); boolean ifNotExists = readIfNotExists(); String tableName = readIdentifierWithSchema(); CreateLinkedTable command = new CreateLinkedTable(session, getSchema()); command.setTemporary(temp); command.setGlobalTemporary(globalTemp); command.setForce(force); command.setIfNotExists(ifNotExists); command.setTableName(tableName); command.setComment(readCommentIf()); read(OPEN_PAREN); command.setDriver(readString()); read(COMMA); command.setUrl(readString()); read(COMMA); command.setUser(readString()); read(COMMA); command.setPassword(readString()); read(COMMA); String originalTable = readString(); if (readIf(COMMA)) { command.setOriginalSchema(originalTable); originalTable = readString(); } command.setOriginalTable(originalTable); read(CLOSE_PAREN); if (readIf("EMIT")) { read("UPDATES"); command.setEmitUpdates(true); } else if (readIf("READONLY")) { command.setReadOnly(true); } if (readIf("FETCH_SIZE")) { command.setFetchSize(readNonNegativeInt()); } return command; }
Source:
<code><START> protected boolean isTokenRequest(final HttpServletRequest request) { <END> return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName, this.safeParameters)); }</code><technical_language>this class is final private</technical_language>

Target:
private boolean isTokenRequest(final HttpServletRequest request) { return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName, this.safeParameters)); }
Source:
<code>public ElasticSearchAdminImpl(ElasticSearchLocalConfig localConfig, ElasticSearchRemoteConfig remoteConfig, Map<String, ElasticSearchIndexConfig> indexConfig) { this.remoteConfig = remoteConfig; this.localConfig = localConfig; this.indexConfig = indexConfig; this.clientInitService = null; connect(); <START> initializeIndexes(); <END> }</code><technical_language>repeat this code, call new constructor passing null argument for clientInitService</technical_language>

Target:
public ElasticSearchAdminImpl(ElasticSearchLocalConfig localConfig, ElasticSearchRemoteConfig remoteConfig, Map<String, ElasticSearchIndexConfig> indexConfig) { this(localConfig, remoteConfig, indexConfig, null); }
Source:
<code>public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adapterType == IToggleBreakpointsTarget.class && adaptableObject instanceof ExtensionBasedTextEditor <START> || adaptableObject instanceof TextEditor) { <END> return (T) new DSPBreakpointAdapter(); } return null; }</code><technical_language>unsure of operator priority here, I guess people are. please wrap 2nd term of && parenthesis remove form of doubt</technical_language>

Target:
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adapterType == IToggleBreakpointsTarget.class && (adaptableObject instanceof ExtensionBasedTextEditor || adaptableObject instanceof TextEditor)) { return (T) new DSPBreakpointAdapter(); } return null; }
Source:
<code>public void damage(double amount, Block block, DamageCause cause) { if (!canTakeDamage() || !canTakeDamage(cause)) { return; } else { noDamageTicks = maximumNoDamageTicks; } amount = getEffectiveDamage(amount); EntityDamageByBlockEvent event = EventFactory.getInstance().onEntityDamage( new EntityDamageByBlockEvent(block, this, cause, amount)); <START> if (event.isCancelled()) { <END> return; } amount = event.getFinalDamage(); lastDamage = amount; setHealth(health - amount); playEffectKnownAndSelf(EntityEffect.HURT); if (health > 0) { Sound hurtSound = getHurtSound(); if (hurtSound != null && !isSilent()) { world.playSound(location, hurtSound, getSoundVolume(), getSoundPitch()); } } }</code><technical_language>some duplicate code here. pass in EntityDamageEvent a new function</technical_language>

Target:
public void damage(double amount, Block block, DamageCause cause) { if (noDamageTicks > 0 || health <= 0 || isInvulnerable() || !canTakeDamage(cause)) { return; } else { noDamageTicks = maximumNoDamageTicks; } amount = getEffectiveDamage(amount); EntityDamageByBlockEvent event = EventFactory.getInstance().onEntityDamage( new EntityDamageByBlockEvent(block, this, cause, amount)); if (callDamageEvent(event)) { return; } amount = event.getFinalDamage(); lastDamage = amount; setHealth(health - amount); playEffectKnownAndSelf(EntityEffect.HURT); if (health > 0) { Sound hurtSound = getHurtSound(); if (hurtSound != null && !isSilent()) { world.playSound(location, hurtSound, getSoundVolume(), getSoundPitch()); } } }
Source:
<code>public void addSubTask() { AbstractTask task = spy(new TaskTask("kind", "repoUrl", "parent")); AbstractTask subTask = spy(new TaskTask("kind", "repoUrl", "child")); lazyList.addTask(subTask); lazyList.addTask(task); lazyList.addTask(subTask, task); <START> verify(taskList, times(1)).addTask(task); <END> verify(taskList, times(1)).addTask(subTask, task); lazyList.commit(); verify(taskList, never()).addTask(subTask); verify(taskList, times(1)).addTask(task); }</code><technical_language>times(1) is unnecessary (verify(taskList) implies times(1))</technical_language>

Target:
public void addSubTask() { AbstractTask task = spy(new TaskTask("kind", "repoUrl", "parent")); AbstractTask subTask = spy(new TaskTask("kind", "repoUrl", "child")); lazyList.addTask(subTask); lazyList.addTask(task); lazyList.addTask(subTask, task); verify(taskList).addTask(task); verify(taskList).addTask(subTask, task); verifyNoMoreInteractions(taskList); lazyList.commit(); verifyNoMoreInteractions(taskList); }
Source:
<code>public boolean shortCircuit() { <START> return size() == 4; <END> }</code><technical_language>For safety future-proofing worth including set of potential answers a list enumeration in this class (or elsewhere) a count of set. This invisible/loose coupling a concept necessarily clear updated elsewhere</technical_language>

Target:
public boolean shortCircuit() { return size() == TreeReference.CONTEXT_TYPES.length; }
Source:
<code>public void poll() { if (getLogCount() > 0 && !inBank()) { burn(); } else if (!inBank()){ walkToBank(); } else if (inBank() && getLogCount() > 0) { leaveBank(); <START> } else { <END> bank(); } }</code><technical_language>else statement in poll() method means script something, want to. if script stuck of methods return proper values</technical_language>

Target:
public void poll() { if (getLogCount() > 0 && !inBank()) { burn(); } else if (!inBank() && getLogCount() == 0){ walkToBank(); } else if (inBank() && getLogCount() > 0) { leaveBank(); } else if (inBank() && getLogCount() == 0){ bank(); } }
Source:
<code>public CardPayment(String chargeId, long amount, PaymentState state, String returnUrl, String description, String reference, String email, String paymentProvider, String createdDate, RefundSummary refundSummary, SettlementSummary settlementSummary, CardDetails cardDetails, SupportedLanguage language, boolean delayedCapture, Long corporateCardSurcharge, Long totalAmount, String providerId, ExternalMetadata metadata) { super(chargeId, amount, state, returnUrl, description, reference, email, paymentProvider, createdDate); this.refundSummary = refundSummary; this.settlementSummary = settlementSummary; this.cardDetails = cardDetails; this.providerId = providerId; <START> this.metadata = metadata == null || metadata.getMetadata().isEmpty() ? Optional.empty() : Optional.of(metadata.getMetadata()); <END> this.paymentType = CARD.getFriendlyName(); this.language = language; this.delayedCapture = delayedCapture; this.corporateCardSurcharge = corporateCardSurcharge; this.totalAmount = totalAmount; }</code><technical_language>Aligning optional class member types this logic easier, assign worrying if null</technical_language>

Target:
public CardPayment(String chargeId, long amount, PaymentState state, String returnUrl, String description, String reference, String email, String paymentProvider, String createdDate, RefundSummary refundSummary, SettlementSummary settlementSummary, CardDetails cardDetails, SupportedLanguage language, boolean delayedCapture, Long corporateCardSurcharge, Long totalAmount, String providerId, ExternalMetadata metadata) { super(chargeId, amount, state, returnUrl, description, reference, email, paymentProvider, createdDate); this.refundSummary = refundSummary; this.settlementSummary = settlementSummary; this.cardDetails = cardDetails; this.providerId = providerId; this.metadata = metadata; this.paymentType = CARD.getFriendlyName(); this.language = language; this.delayedCapture = delayedCapture; this.corporateCardSurcharge = corporateCardSurcharge; this.totalAmount = totalAmount; }
Source:
<code>public void addFrame(String obfuscatedMethodName, String clearMethodName, String clearSignature, int obfuscatedLine, int obfuscatedLineEnd, int clearLine) { <START> for (int i = obfuscatedLine; i <= obfuscatedLineEnd; i++) { String key = obfuscatedMethodName + clearSignature + i; mFrames.put(key, new FrameData(clearMethodName, obfuscatedLine - clearLine)); } <END> }</code><technical_language>This inefficient in case line number range is large, in terms of runtime memory. Is a avoid duplicating FrameData entries? key = obfuscatedMethodName + clearSignature maps a FrameData entry a list of ranges resolve line number separately</technical_language>

Target:
public void addFrame(String obfuscatedMethodName, String clearMethodName, String clearSignature, int obfuscatedLine, int obfuscatedLineEnd, int clearLine) { String key = obfuscatedMethodName + clearSignature; FrameData data = mFrames.get(key); if (data == null) { data = new FrameData(clearMethodName); } data.lineNumbers.put( obfuscatedLine, new LineNumber(obfuscatedLine, obfuscatedLineEnd, clearLine)); mFrames.put(key, data); }
Source:
<code>void showTree(final Newick newick) { <START> try { <END> DrawableNewick subNewick = new DrawableNewick(newick.getSelectedSubGraph()); subNewick.getNewick().getRoot().getSourcesProperty().addListener(event -> { graphController.updateSelectedSources(subNewick.getNewick().getRoot().getSources()); }); List<DrawableEdge> edgeList = subNewick.edgeSet().stream() .map(edge -> new DrawableEdge(subNewick, edge)) .collect(Collectors.toList()); List<Label> nodeList = subNewick.vertexSet().stream() .map(NewickLabel::new) .collect(Collectors.toList()); newickContainer.getChildren().addAll(edgeList); newickContainer.getChildren().addAll(nodeList); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>is this done try catch</technical_language>

Target:
void showTree(final Newick newick) { DrawableNewick subNewick = new DrawableNewick(newick.getSelectedSubGraph()); subNewick.getNewick().getRoot().getSourcesProperty().addListener(event -> { graphController.updateSelectedSources(subNewick.getNewick().getRoot().getSources()); }); List<DrawableEdge> edgeList = subNewick.edgeSet().stream() .map(edge -> new DrawableEdge(subNewick, edge)) .collect(Collectors.toList()); List<Label> nodeList = subNewick.vertexSet().stream() .map(NewickLabel::new) .collect(Collectors.toList()); newickContainer.getChildren().addAll(edgeList); newickContainer.getChildren().addAll(nodeList); }
Source:
<code>protected void executeCommand() { <START> log.info("Executing ScheduleGlusterVolumeSnapshotCommand "); <END> if (!checkAndDisableCliScheduler()) { setSucceeded(false); return; } Time originalExecutionTime = getSchedule().getExecutionTime(); log.info("ScheduleGlusterVolumeSnapshotCommand--------originalExecutionTime {}", originalExecutionTime); try { String jobId = scheduleJob(); setSucceeded(true); getSchedule().setJobId(jobId); getSchedule().setExecutionTime(originalExecutionTime); glusterVolumeSnapshotScheduleDao.save(getSchedule()); } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, ex.getMessage()); } }</code><technical_language>logged in debug only</technical_language>

Target:
protected void executeCommand() { log.debug("Executing ScheduleGlusterVolumeSnapshotCommand "); if (!checkAndDisableCliScheduler()) { setSucceeded(false); return; } Time originalExecutionTime = getSchedule().getExecutionTime(); log.debug("ScheduleGlusterVolumeSnapshotCommand--------originalExecutionTime {}", originalExecutionTime); try { Guid jobId = scheduleJob(); setSucceeded(true); getSchedule().setJobId(jobId); getSchedule().setExecutionTime(originalExecutionTime); glusterVolumeSnapshotScheduleDao.save(getSchedule()); } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, ex.getMessage()); } }
Source:
<code>public Map<String, String> createImageServerContent(String scheme) throws IOException { <START> HashMap<String, <END> String> map = new HashMap<>(); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml", createServerEntry("WikiToDocTaskIntegrationTest1.xml")); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml&gimcontinue=49671%7Cpict1.gif", createServerEntry("WikiToDocTaskIntegrationTest2.xml")); return map; }</code><technical_language>Map here, code more readable, e.g. Map<String,String> map = new HashMap<>()</technical_language>

Target:
public Map<String, String> createImageServerContent(String scheme) throws IOException { Map<String, String> map = new HashMap<>(); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml", createServerEntry("WikiToDocTaskIntegrationTest1.xml")); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml&gimcontinue=49671%7Cpict1.gif", createServerEntry("WikiToDocTaskIntegrationTest2.xml")); return map; }
Source:
<code>public PeriodicMeterReadsContainer(final PeriodType periodType, final List<PeriodicMeterReads> meterReads) { <START> this.meterReads = Collections.unmodifiableList(meterReads); <END> this.periodType = periodType; }</code><technical_language>I this of making collection immutable, is immutable perspective of this.meterReads. collection provided parameter modified, causing changes this object</technical_language>

Target:
public PeriodicMeterReadsContainer(final PeriodType periodType, final List<PeriodicMeterReads> meterReads) { this.meterReads = new ArrayList<PeriodicMeterReads>(meterReads); this.periodType = periodType; }
Source:
<code>public final Response act(final Request req) throws IOException { final Iterable<String> hdit = req.head(); String aliashd = ""; <START> for (final String hdr:hdit) { <END> if (hdr.contains("TkAuth")) { aliashd = this.base.user( URN.create(hdr.replace("TkAuth: ", "") .replaceAll("%3A", ":") ) ).aliases().iterate().iterator().next().name(); } } return new RsWithHeader( this.take.act(req), String.format(this.header, aliashd) ); }</code><technical_language>@kujtimiihoxha I suggest RqHeaders.Smart instead of iterating for right header</technical_language>

Target:
public final Response act(final Request req) throws IOException { return new RsWithHeader( this.take.act(req), String.format( "X-Netbout-Alias: %s", new RqAlias(this.base, req).alias().name() ) ); }
Source:
<code>public boolean equals(Object obj) { if (obj == this) { return true; <START> } else if (obj != null && obj.getClass() == InternalContainerResource.class) { <END> InternalContainerResource that = (InternalContainerResource) obj; return Objects.equals(this.memory, that.memory) && Objects.equals(this.vcores, that.vcores); } return false; }</code><technical_language>replace "InternalContainerResource.class" "getClass()"</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj instanceof InternalContainerResource) { final InternalContainerResource other = (InternalContainerResource) obj; return this.memory == other.memory && this.vcores == other.vcores; } return false; }
Source:
<code>public AvailabilityType getAvailability() { ReadAttribute op = new ReadAttribute(getAddress(), "cache-status"); Result res = getASConnection().execute(op); if (res != null && res.isSuccess()) { <START> if (res.getResult().equals("RUNNING")) { <END> return AvailabilityType.UP; } } return AvailabilityType.DOWN; }</code><technical_language>(re string comparison)</technical_language>

Target:
public AvailabilityType getAvailability() { ReadAttribute op = new ReadAttribute(getAddress(), "cache-status"); Result res = getASConnection().execute(op); if (res != null && res.isSuccess()) { if ("RUNNING".equals(res.getResult())) { return AvailabilityType.UP; } } return AvailabilityType.DOWN; }
Source:
<code>public void testSquash() throws Exception { <START> new Git(db).commit().setMessage("initial commit").call(); <END> new Git(db).branchCreate().setName("side").call(); writeTrashFile("file1", "content1"); new Git(db).add().addFilepattern("file1").call(); new Git(db).commit().setMessage("file1 commit").call(); writeTrashFile("file2", "content2"); new Git(db).add().addFilepattern("file2").call(); new Git(db).commit().setMessage("file2 commit").call(); new Git(db).checkout().setName("side").call(); writeTrashFile("side", "content"); new Git(db).add().addFilepattern("side").call(); new Git(db).commit().setMessage("side commit").call(); assertArrayEquals( new String[] { "Squash commit -- not updating HEAD", "Automatic merge went well; stopped before committing as requested", "" }, execute("git merge master --squash")); }</code><technical_language>initial commit is created in setup() method</technical_language>

Target:
public void testSquash() throws Exception { git.branchCreate().setName("side").call(); writeTrashFile("file1", "content1"); git.add().addFilepattern("file1").call(); git.commit().setMessage("file1 commit").call(); writeTrashFile("file2", "content2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("file2 commit").call(); git.checkout().setName("side").call(); writeTrashFile("side", "content"); git.add().addFilepattern("side").call(); git.commit().setMessage("side commit").call(); assertArrayEquals( new String[] { "Squash commit -- not updating HEAD", "Automatic merge went well; stopped before committing as requested", "" }, execute("git merge master --squash")); }
Source:
<code>protected boolean processInteract(PlayerEntity player, Hand hand) { if (!this.world.isRemote() && isLord(player) && minionData != null) { ItemStack heldItem = player.getHeldItem(hand); if (heldItem.getItem() instanceof MinionUpgradeItem) { int upgradeLevel = ((MinionUpgradeItem) heldItem.getItem()).getLevel(); if (this.minionData.level < upgradeLevel) { this.minionData.level++; if (!player.abilities.isCreativeMode) heldItem.shrink(1); player.sendStatusMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_upgrade"), false); <START> player.sendStatusMessage(new TranslationTextComponent("text.vampirism.minion.upgraded"), true); <END> HelperLib.sync(this); } else { player.sendMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_wrong")); } return true; } } return super.processInteract(player, hand); }</code><technical_language>of status messages, message in actionbar (true) read if chat is big</technical_language>

Target:
protected boolean processInteract(PlayerEntity player, Hand hand) { if (!this.world.isRemote() && isLord(player) && minionData != null) { ItemStack heldItem = player.getHeldItem(hand); if (heldItem.getItem() instanceof MinionUpgradeItem && ((MinionUpgradeItem) heldItem.getItem()).getFaction() == this.getFaction()) { if (this.minionData.level + 1 >= ((MinionUpgradeItem) heldItem.getItem()).getMinLevel() && this.minionData.level + 1 <= ((MinionUpgradeItem) heldItem.getItem()).getMaxLevel()) { this.minionData.level++; if (!player.abilities.isCreativeMode) heldItem.shrink(1); player.sendStatusMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_upgrade"), false); HelperLib.sync(this); } else { player.sendMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_wrong")); } return true; } } return super.processInteract(player, hand); }
Source:
<code>public List<AnviltopServices.MutateRowResponse> delete(List<Delete> deletes) throws IOException { List<AnviltopServices.MutateRowResponse> responses; try { responses = Futures.allAsList(issueDeleteRequests(deletes)).get(); } catch (ExecutionException | InterruptedException e) { <START> throw new IOException("Error in batch put", e); <END> } return responses; }</code><technical_language>put -> delete</technical_language>

Target:
public List<AnviltopServices.MutateRowResponse> delete(List<Delete> deletes) throws IOException { List<AnviltopServices.MutateRowResponse> responses; try { responses = Futures.allAsList(issueDeleteRequests(deletes)).get(); } catch (ExecutionException | InterruptedException e) { throw new IOException("Error in batch delete", e); } return responses; }
Source:
<code>public void deleteDraft() throws Exception { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput.CommentInput comment = newCommentInfo( "file1", Comment.Side.REVISION, 1, "comment 1"); CommentInfo returned = addDraft(changeId, revId, comment); deleteDraft(changeId, revId, returned.id); Map<String, List<CommentInfo>> drafts = getDraftComments(changeId, revId); <START> assertThat(drafts.isEmpty()).isTrue(); <END> }</code><technical_language>assertThat(drafts).isEmpty();</technical_language>

Target:
public void deleteDraft() throws Exception { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput.CommentInput comment = newCommentInfo( "file1", Comment.Side.REVISION, 1, "comment 1"); CommentInfo returned = addDraft(changeId, revId, comment); deleteDraft(changeId, revId, returned.id); Map<String, List<CommentInfo>> drafts = getDraftComments(changeId, revId); assertThat(drafts).isEmpty(); }
Source:
<code>private static boolean validNodeFor( Node pNode, Diagram pGraph ) { for( Node node : pGraph.getNodePrototypes() ) { <START> if( pNode.getClass() == node.getClass() || pNode.getClass() == PointNode.class ) <END> { return true; } } return false; }</code><technical_language>I suggest moving pNode.getClass() == PointNode.class for loop</technical_language>

Target:
private static boolean validNodeFor( Node pNode, Diagram pGraph ) { if ( pNode.getClass() == PointNode.class ) { return true; } for( Node node : pGraph.getNodePrototypes() ) { if( pNode.getClass() == node.getClass() ) { return true; } } return false; }
Source:
<code>private void doConcurrentDestroyInTx() throws Exception { for (int i = 0; i < totalNumberOfBuckets; i++) { synchronized (list) { list.add(i); } } <START> Thread[] threads = new Thread[totalNumberOfBuckets]; for (int i = 0; i < totalNumberOfBuckets; i++) { threads[i] = new Thread(this::doDestroyOpInTx); } for (int i = 0; i < totalNumberOfBuckets; i++) { threads[i].start(); } for (int i = 0; i < totalNumberOfBuckets; i++) { threads[i].join(); } } <END></code><technical_language>of this replaced ExecutorService</technical_language>

Target:
private void doConcurrentDestroyInTx() throws Exception { for (int i = 0; i < totalNumberOfBuckets; i++) { queue.add(i); } ExecutorService pool = Executors.newCachedThreadPool(); Collection<Callable<Object>> tasks = new ArrayList<>(); Callable<Object> task = () -> { doDestroyOpInTx(); return null; }; for (int i = 0; i < totalNumberOfBuckets; i++) { tasks.add(task); } List<Future<Object>> futures = pool.invokeAll(tasks); for (Future future : futures) { future.get(); } }
Source:
<code>public void test() { List<Command<?>> commands = new ArrayList<Command<?>>(); Person person = new Person("PAUL"); ListHolder listHolder = new ListHolder(); <START> List<String> list = new ArrayList<String>(); <END> list.add("eins"); list.add("zwei"); list.add("drei"); listHolder.setList(list); commands.add(KieServices.Factory.get().getCommands().newInsert(person)); commands.add(KieServices.Factory.get().getCommands().newInsert(listHolder)); commands.add(KieServices.Factory.get().getCommands().newFireAllRules()); session.execute(KieServices.Factory.get().getCommands().newBatchExecution(commands, null)); Assertions.assertThat(firedRules.isRuleFired("PERSON_PAUL")).isTrue(); Assertions.assertThat(firedRules.isRuleFired("PERSON_PETER")).isTrue(); }</code><technical_language>Arrays.asList()</technical_language>

Target:
public void test() { session.setGlobal("LOGGER", LOGGER); List<Command<?>> commands = new ArrayList<Command<?>>(); Person person = new Person("PAUL"); ListHolder listHolder = new ListHolder(); List<String> list = Arrays.asList("eins", "zwei", "drei"); listHolder.setList(list); commands.add(getCommands().newInsert(person)); commands.add(getCommands().newInsert(listHolder)); commands.add(getCommands().newFireAllRules()); session.execute(getCommands().newBatchExecution(commands, null)); Assertions.assertThat(firedRules.isRuleFired("PERSON_PAUL")).isTrue(); Assertions.assertThat(firedRules.isRuleFired("PERSON_PETER")).isTrue(); }
Source:
<code>public GwtInput (CanvasElement canvas, GwtApplicationConfiguration config) { this.canvas = canvas; this.config = config; if (config.useAccelerometer) { if (GwtApplication.agentInfo().isFirefox()) setupAccelerometer(); <START> else <END> GwtPermissions.queryPermission(GwtAccelerometer.PERMISSION, new GwtPermissions.GwtPermissionResult() { @Override public void granted() { setupAccelerometer(); } @Override public void denied() { } @Override public void prompt() { setupAccelerometer(); } }); } hookEvents(); }</code><technical_language>add braces for if else clause</technical_language>

Target:
public GwtInput (CanvasElement canvas, GwtApplicationConfiguration config) { this.canvas = canvas; this.config = config; if (config.useAccelerometer) { if (GwtApplication.agentInfo().isFirefox()) { setupAccelerometer(); } else { GwtPermissions.queryPermission(GwtAccelerometer.PERMISSION, new GwtPermissions.GwtPermissionResult() { @Override public void granted() { setupAccelerometer(); } @Override public void denied() { } @Override public void prompt() { setupAccelerometer(); } }); } } hookEvents(); }
Source:
<code>public void shutdownContainer(String containerId) throws NoSuchContainerException { Container container = this.containerRepository.findOne(containerId); if (container != null) { String containerHost = container.getAttributes().getIp(); String containerPort = container.getAttributes().get(ContainerAttributes.PORT_KEY); RestTemplate restTemplate = new RestTemplate(new SimpleClientHttpRequestFactory()); <START> restTemplate.postForObject(CONTAINER_HOST_URI_PROTOCOL + containerHost + ":" + containerPort <END> + managementContextPath + SHUTDOWN_ENDPOINT, Object.class, Object.class); } else { throw new NoSuchContainerException("Container could not be found with id " + containerId); } }</code><technical_language>default, do expose HTTP port allows for client shut a process? this do? System.exit? Do anticipate (at a minimum) requiring some sort of authentication in future</technical_language>

Target:
public void shutdownContainer(String containerId) throws NoSuchContainerException, ContainerShutdownException { Container container = this.containerRepository.findOne(containerId); if (container != null) { String containerHost = container.getAttributes().getIp(); String containerManagementPort = container.getAttributes().getManagementPort(); RestTemplate restTemplate = new RestTemplate(new SimpleClientHttpRequestFactory()); try { restTemplate.postForObject(CONTAINER_HOST_URI_PROTOCOL + containerHost + ":" + containerManagementPort + managementContextPath + SHUTDOWN_ENDPOINT, Object.class, Object.class); } catch (RestClientException e) { throw new ContainerShutdownException(e.getMessage()); } } else { throw new NoSuchContainerException("Container could not be found with id " + containerId); } }