auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { <START> if (attacker.getRNG().nextFloat() < .05 && target.getHeldItemMainhand() != null) <END> { ItemEntity item = new ItemEntity(target.world, target.posX, target.posY, target.posZ, target.getHeldItemMainhand().copy()); item.getItem().setCount(1); item.setPickupDelay(40); target.world.addEntity(item); target.getHeldItemMainhand().shrink(1); } return super.hitEntity(stack, target, attacker); }</code><technical_language>Null values for item stacks. !target.getHeldItemMainhand().isEmpty() instead of target.getHeldItemMainhand() != null, _maybe_ put target.getHeldItemMainhand() in a variable multiple times</technical_language>

Target:
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { ItemStack held = target.getHeldItemMainhand(); if (attacker.getRNG().nextFloat() < .05 && !held.isEmpty()) { ItemEntity item = new ItemEntity(target.world, target.posX, target.posY, target.posZ, held.copy()); item.getItem().setCount(1); item.setPickupDelay(40); target.world.addEntity(item); held.shrink(1); } return super.hitEntity(stack, target, attacker); }
Source:
<code>protected void initWithProperties(String... propertyFiles) { <START> if (propertyFiles != null) { <END> for (String propertyFile : propertyFiles) propertyReports.add(reportFromResourceProperties(propertyFile)); } if (configuration == null) { configuration = new Configuration(reportDirectory, projectName); } configuration.setSortingMethod(SortingMethod.ALPHABETICAL); createEmbeddingsDirectory(); }</code><technical_language>this is for test I assume skip this condition is pass null element ")</technical_language>

Target:
protected void initWithProperties(String... propertyFiles) { for (String propertyFile : propertyFiles) this.classificationFiles.add(reportFromResourceProperties(propertyFile)); if (configuration == null) { configuration = new Configuration(reportDirectory, projectName); } configuration.setSortingMethod(SortingMethod.ALPHABETICAL); createEmbeddingsDirectory(); }
Source:
<code>private void createAndPopulateTable(Connection conn, String tableName, int rowCount) throws Exception { String ddl = "CREATE TABLE " + tableName + " (id integer not null primary key, val1 varchar(10), val2 varchar(10), val3 varchar(10))" + tableDDLOptions; <START> <END> conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + tableName + " (id, val1, val2, val3) VALUES (?, ?, ?, ?)"; PreparedStatement stmt = conn.prepareStatement(dml); for (int id = 1; id <= rowCount; ++id) { stmt.setInt(1, id); stmt.setString(2, "a" + id); stmt.setString(3, "ab" + id); stmt.setString(4, "abc" + id); stmt.executeUpdate(); } conn.commit(); }</code><technical_language>nit: 1 line empty line statements multiple empty lines code</technical_language>

Target:
private void createAndPopulateTable(Connection conn, String tableName, int rowCount) throws Exception { String ddl = "CREATE TABLE " + tableName + " (id integer not null primary key, val1 varchar, val2 varchar, val3 varchar)" + tableDDLOptions; conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + tableName + " (id, val1, val2, val3) VALUES (?, ?, ?, ?)"; PreparedStatement stmt = conn.prepareStatement(dml); for (int id = 1; id <= rowCount; ++id) { stmt.setInt(1, id); stmt.setString(2, "a" + id); stmt.setString(3, "ab" + id); stmt.setString(4, "abc" + id); stmt.executeUpdate(); } conn.commit(); }
Source:
<code>public void setSessionMessage(PortletRequest request, RequestStatus requestStatus, String type, String verb, String name) throws PortletException { String statusMessage; if (isNullOrEmpty(name)) { name = ""; } else { name = " " + name; } switch (requestStatus) { case SUCCESS: statusMessage = type + name + " " + verb + "d successfully!"; SessionMessages.add(request, "request_processed", statusMessage); break; case SENT_TO_MODERATOR: statusMessage = "Moderation request was sent to " + verb + " the " + type + name + "!"; SessionMessages.add(request, "request_processed", statusMessage); break; case FAILURE: setSW360SessionError(request, ErrorMessages.DOCUMENT_NOT_PROCESSED_SUCCESSFULLY); break; case IN_USE: if(type.equals("License")) { setSW360SessionError(request, ErrorMessages.LICENSE_USED_BY_RELEASE); } else { setSW360SessionError(request, ErrorMessages.DOCUMENT_USED_BY_PROJECT_OR_RELEASE); } break; case FAILED_SANITY_CHECK: setSW360SessionError(request, ErrorMessages.UPDATE_FAILED_SANITY_CHECK); <START> default: <END> throw new PortletException("Unknown request status"); } }</code><technical_language>A break; is missing this place causing PortletException thrown</technical_language>

Target:
public void setSessionMessage(PortletRequest request, RequestStatus requestStatus, String type, String verb, String name) throws PortletException { String statusMessage; if (isNullOrEmpty(name)) { name = ""; } else { name = " " + name; } switch (requestStatus) { case SUCCESS: statusMessage = type + name + " " + verb + "d successfully!"; SessionMessages.add(request, "request_processed", statusMessage); break; case SENT_TO_MODERATOR: statusMessage = "Moderation request was sent to " + verb + " the " + type + name + "!"; SessionMessages.add(request, "request_processed", statusMessage); break; case FAILURE: setSW360SessionError(request, ErrorMessages.DOCUMENT_NOT_PROCESSED_SUCCESSFULLY); break; case IN_USE: if(type.equals("License")) { setSW360SessionError(request, ErrorMessages.LICENSE_USED_BY_RELEASE); } else { setSW360SessionError(request, ErrorMessages.DOCUMENT_USED_BY_PROJECT_OR_RELEASE); } break; case FAILED_SANITY_CHECK: setSW360SessionError(request, ErrorMessages.UPDATE_FAILED_SANITY_CHECK); break; default: throw new PortletException("Unknown request status"); } }
Source:
<code>public void multiIndex_incompatibleAnalyzer_overrideAnalyzer() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.phrase().onField( absoluteFieldPath ).matching( PHRASE_1_UNIQUE_TERM ) .analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE_LOWERCASE.name ) ) .toQuery(); <START> assertThat( query ).assertThat( query ).hasDocRefHitsAnyOrder( b -> { <END> b.doc( INDEX_NAME, DOCUMENT_1, DOCUMENT_2, DOCUMENT_3, DOCUMENT_4 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }</code><technical_language>assertThat( query ).assertThat( query )</technical_language>

Target:
public void multiIndex_incompatibleAnalyzer_overrideAnalyzer() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.phrase().onField( absoluteFieldPath ).matching( PHRASE_1_UNIQUE_TERM ) .analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE_LOWERCASE.name ) ) .toQuery(); assertThat( query ).hasDocRefHitsAnyOrder( b -> { b.doc( INDEX_NAME, DOCUMENT_1, DOCUMENT_2, DOCUMENT_3, DOCUMENT_4 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }
Source:
<code>public void run() { while ( !halted ) { try { pageCache.flushAndForce(); } catch ( Throwable e ) { error = e; break; } } done = true; Thread localHalter = halter; <START> if ( localHalter != null ) <END> { LockSupport.unpark( localHalter ); } }</code><technical_language>a BinaryLatch a CountDownLatch instead of this halter business</technical_language>

Target:
public void run() { try { while ( !halted ) { try { pageCache.flushAndForce(); } catch ( Throwable e ) { error = e; break; } } } finally { halt.release(); } }
Source:
<code>protected ModelAndView addGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { setPropertyAttributes(req, new Property()); <START> Comparator<Service> comparator = new Comparator<Service>() { <END> public int compare(Service a, Service b) { return a.getName().ordinal() < b.getName().ordinal() ? 1 : a.getName().ordinal() == b.getName().ordinal() ? 0 : -1; } }; SortedSet<Service> services = new TreeSet<Service>(comparator); for (Services service : Services.values()) { services.add(new Service(service, false)); } req.setAttribute("services", services); return render(req, resp, "editProperty.jsp", "Add Property"); }</code><technical_language>isnt similar code for showDetail, addPost editPost methods? Also, is code repeated in places? Instead of, say, a method this work</technical_language>

Target:
protected ModelAndView addGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { setPropertyAttributes(req, new Property()); req.setAttribute("services", getServices(new Property(), null)); return render(req, resp, "editProperty.jsp", "Add Property"); }
Source:
<code>private MethodSpec(Builder builder) { CodeBlock code = builder.code.build(); checkArgument(code.isEmpty() || !builder.modifiers.contains(Modifier.ABSTRACT), "abstract method %s cannot have code", builder.name); checkArgument(!builder.varargs || lastParameterIsArray(builder.parameters), "last parameter of varargs method %s must be an array", builder.name); this.name = checkNotNull(builder.name, "name == null"); this.javadoc = builder.javadoc.build(); this.annotations = Util.immutableList(builder.annotations); this.modifiers = Util.immutableSet(builder.modifiers); this.typeVariables = Util.immutableList(builder.typeVariables); this.returnType = builder.returnType; this.parameters = Util.immutableList(builder.parameters); this.varargs = builder.varargs; this.exceptions = Util.immutableList(builder.exceptions); <START> this.initializer = (builder.initializer == null) <END> ? CodeBlock.builder().build() : builder.initializer; this.code = code; }</code><technical_language>please leave this null if initializer. (We do similarly for field initializers also; I a mistake I treat empty code block code block!)</technical_language>

Target:
private MethodSpec(Builder builder) { CodeBlock code = builder.code.build(); checkArgument(code.isEmpty() || !builder.modifiers.contains(Modifier.ABSTRACT), "abstract method %s cannot have code", builder.name); checkArgument(!builder.varargs || lastParameterIsArray(builder.parameters), "last parameter of varargs method %s must be an array", builder.name); this.name = checkNotNull(builder.name, "name == null"); this.javadoc = builder.javadoc.build(); this.annotations = Util.immutableList(builder.annotations); this.modifiers = Util.immutableSet(builder.modifiers); this.typeVariables = Util.immutableList(builder.typeVariables); this.returnType = builder.returnType; this.parameters = Util.immutableList(builder.parameters); this.varargs = builder.varargs; this.exceptions = Util.immutableList(builder.exceptions); this.defaultValue = builder.defaultValue; this.code = code; }
Source:
<code>public void shouldGenerateUnifiedResourceName() throws Exception { URNPersistentIdentifier urnPersistentIdentifier = new URNPersistentIdentifier(); <START> String urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "14", "db", "378704842"); <END> assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:14-db-id3787048428", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "14", "db", "470035625"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:14-db-id4700356257", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("boc", "12", "db", "478704844"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:boc:12-db-id4787048447", urn); }</code><technical_language>Missing id in parameter id is part of this identifier value! This corrected for other tests too</technical_language>

Target:
public void shouldGenerateUnifiedResourceName() throws Exception { URNPersistentIdentifier urnPersistentIdentifier = new URNPersistentIdentifier(); String urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "14", "db", "id378704842"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:14-db-id3787048428", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "14", "db", "id470035625"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:14-db-id4700356257", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("boc", "12", "db", "478704844"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:boc:12-db-4787048440", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "14", "qucosa", "22579"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:14-qucosa-225799", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "d120", "qucosa", "22440"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:d120-qucosa-224404", urn); urn = urnPersistentIdentifier.generateUnifiedResourceName("bsz", "ch1", "qucosa", "22583"); assertEquals("Incorrect check digit in URN ", "urn:nbn:de:bsz:ch1-qucosa-225834", urn); }
Source:
<code><START> @Override public void connect() throws Exception { <END> DatanodeDetails dn = this.pipeline.getFirstNode(); connectToDatanode(dn, null); }</code><technical_language>purpose of modifying it</technical_language>

Target:
public void connect() throws Exception { DatanodeDetails dn = this.pipeline.getFirstNode(); connectToDatanode(dn, null); }
Source:
<code>public AvailableTimestamps(LastReturnedTimestamp lastReturnedTimestamp, PersistentUpperLimit upperLimit) { <START> DebugLogger.logger.info("Creating AvailableTimestamps object on thread {}. This should only happen once." <END> + " If you are running embedded AtlasDB, this should only happen once." + " If you are using Timelock, this should happen once per client per leadership election", Thread.currentThread().getName()); this.lastReturnedTimestamp = lastReturnedTimestamp; this.upperLimit = upperLimit; this.issueTimestampLock = new Object(); }</code><technical_language>nit: I This happen once. removed (probably hanging copypaste)</technical_language>

Target:
public AvailableTimestamps(LastReturnedTimestamp lastReturnedTimestamp, PersistentUpperLimit upperLimit) { DebugLogger.logger.info("Creating AvailableTimestamps object on thread {}." + " If you are running embedded AtlasDB, this should only happen once." + " If you are using Timelock, this should happen once per client per leadership election", Thread.currentThread().getName()); this.lastReturnedTimestamp = lastReturnedTimestamp; this.upperLimit = upperLimit; this.issueTimestampLock = new Object(); }
Source:
<code><START> public FeedbackResponseCommentAttributes() { <END> giverSection = "None"; receiverSection = "None"; showCommentTo = new ArrayList<>(); showGiverNameTo = new ArrayList<>(); isVisibilityFollowingFeedbackQuestion = true; commentText = new Text(""); }</code><technical_language>constructor private/package (in case of PMD complain)</technical_language>

Target:
FeedbackResponseCommentAttributes() { giverSection = Const.DEFAULT_SECTION; receiverSection = Const.DEFAULT_SECTION; showCommentTo = new ArrayList<>(); showGiverNameTo = new ArrayList<>(); isVisibilityFollowingFeedbackQuestion = true; createdAt = new Date(); }
Source:
<code>private void updateTvFolderName() { <START> tvFolderName.setText("Folder:" <END> + currentFile.getParentName() + " (" + (currentIndex + 1) + "/" + baseFiles.size() + ") " + currentFile.getName()); }</code><technical_language>Hardcoded "Folder:", sure? check [this](<LINK_0> out</technical_language>

Target:
private void updateTvFolderName() { Resources res = getResources(); String text = res.getString(R.string.image_viewer_bottom_bar, getResources().getString(R.string.folder), currentFile.getParentName(), currentIndex + 1, baseFiles.size(), currentFile.getName()); tvFolderName.setText(text); }
Source:
<code><START> public String getPhoneId() { <END> return "----"; }</code><technical_language>deviceId useful identify 2 separate installations of app. I Firebase Instance Id a good workaround separate out installations other id currently maintain unique CC installation</technical_language>

Target:
public String getPhoneId() { return DeviceIdentifier.getDeviceIdentifier(this); }
Source:
<code>protected boolean clearTimetable(String feedId) { <START> return timetables.keySet().removeAll(timetables.keySet().stream() <END> .filter(timeTable -> feedId.equals(timeTable.getFeedId())) .collect(Collectors.toSet())); }</code><technical_language>a removeIf more efficient</technical_language>

Target:
protected boolean clearTimetable(String feedId) { return timetables.keySet().removeIf(tripPattern -> feedId.equals(tripPattern.getFeedId())); }
Source:
<code>public Optional<T> getNextItem(T item) { int index = getItemIndex(item); if (index < 0) return Optional.empty(); return getItems().skip(index + 1).findFirst(); <START> } <END></code><technical_language>![MINOR](<LINK_1> 'Severity: MINOR') Cast of operands of this addition operation a "long". [![rule](<LINK_0>](<LINK_2></technical_language>

Target:
public Optional<T> getNextItem(T item) { int index = getItemIndex(item); if (index < 0) { return Optional.empty(); } return getItems().skip(index + 1).findFirst(); }
Source:
<code>protected void addExtraHeaders(Builder webResource) { if (additionalHeaders != null) { <START> for (String key : additionalHeaders.keySet()) { <END> webResource.header(key, additionalHeaders.get(key)); } } }</code><technical_language>entrySet</technical_language>

Target:
protected void addExtraHeaders(Builder webResource) { if (additionalHeaders != null) { for (Map.Entry<String, List<Object>> entry: additionalHeaders.entrySet()) { webResource.header(entry.getKey(), entry.getValue()); } } }
Source:
<code>public List<SMREntry> getSMRUpdates(UUID id) { MultiSMREntry resMultiSmrEntry = streamUpdates.computeIfAbsent(id, k -> { if (streamBuffers.containsKey(id)) { byte[] streamUpdatesBuf = streamBuffers.get(id); ByteBuf buf = Unpooled.wrappedBuffer(streamUpdatesBuf); int numUpdates = buf.readInt(); List<SMREntry> smrEntries = new ArrayList<>(numUpdates); <START> for (int update = 0; update < numUpdates; update++) { <END> smrEntries.add((SMREntry) Serializers.CORFU.deserialize(buf, null)); } MultiSMREntry multiSMREntry = new MultiSMREntry(smrEntries); multiSMREntry.setGlobalAddress(getGlobalAddress()); streamBuffers.remove(id); return multiSMREntry; } else { return null; } }); return resMultiSmrEntry == null ? Collections.emptyList() : resMultiSmrEntry.getUpdates(); }</code><technical_language>flip if logic remove else</technical_language>

Target:
public List<SMREntry> getSMRUpdates(UUID id) { MultiSMREntry resMultiSmrEntry = streamUpdates.computeIfAbsent(id, k -> { if (!streamBuffers.containsKey(id)) { return null; } byte[] streamUpdatesBuf = streamBuffers.get(id); ByteBuf buf = Unpooled.wrappedBuffer(streamUpdatesBuf); int numUpdates = buf.readInt(); List<SMREntry> smrEntries = new ArrayList<>(numUpdates); for (int update = 0; update < numUpdates; update++) { smrEntries.add((SMREntry) Serializers.CORFU.deserialize(buf, null)); } MultiSMREntry multiSMREntry = new MultiSMREntry(smrEntries); multiSMREntry.setGlobalAddress(getGlobalAddress()); streamBuffers.remove(id); return multiSMREntry; }); return resMultiSmrEntry == null ? Collections.emptyList() : resMultiSmrEntry.getUpdates(); }
Source:
<code>private boolean isFeatureInstalled(String featureName) throws Exception { return Arrays.stream(featuresService.listInstalledFeatures()) .map(Feature::getName) <START> .anyMatch(name -> name.equals(featureName)); <END> }</code><technical_language>suggestion .anyMatch(featureName::equals);</technical_language>

Target:
private boolean isFeatureInstalled(String featureName) throws Exception { return Arrays.stream(featuresService.listInstalledFeatures()) .map(Feature::getName) .anyMatch(featureName::equals); }
Source:
<code>private String encodePostdata(String postdata) { String res = null; if (postdata.contains("@")) { <START> String[] arr = postdata.split("@"); <END> try { res = URLEncoder.encode(readFromFile(arr[1]), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.error("string '{}' cannot be encoded", readFromFile(arr[1])); } if (!arr[0].isEmpty()) { res = arr[0] + "=" + res; } } else { if (!postdata.contains("=")) { try { res = URLEncoder.encode(postdata, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.error("string '{}' cannot be encoded", postdata); throw new IllegalArgumentException(postdata + " cannot be encoded"); } } else { StringBuilder urlAfterEncoding = new StringBuilder(); int index = postdata.indexOf('='); urlAfterEncoding.append(postdata.substring(0, index)); urlAfterEncoding.append("="); try { urlAfterEncoding.append(URLEncoder.encode(postdata.substring(index + 1, postdata.length()), StandardCharsets.UTF_8.name())); } catch (UnsupportedEncodingException e) { LOGGER.error("string '{}' cannot be encoded", postdata.substring(index + 1, postdata.length())); throw new IllegalArgumentException( postdata.substring(index + 1, postdata.length()) + " cannot be encoded"); } res = urlAfterEncoding.toString(); } } return res; }</code><technical_language>other parts potentially more @ chars in string</technical_language>

Target:
private String encodePostdata(String postdata) { if (postdata.contains("@")) { String contentFile = null; String[] arr = postdata.split("@", 2); String dataToEncode = readFromFile(arr[1]); try { contentFile = URLEncoder.encode(dataToEncode, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.error("string '{}' cannot be encoded", dataToEncode); } if (!arr[0].isEmpty()) { contentFile = arr[0] + "=" + contentFile; } return contentFile; } else { if (!postdata.contains("=")) { try { return URLEncoder.encode(postdata, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.error("string '{}' cannot be encoded", postdata); throw new IllegalArgumentException(postdata + " cannot be encoded"); } } else { int index = postdata.indexOf('='); try { return postdata.substring(0, index + 1) + URLEncoder .encode(postdata.substring(index + 1, postdata.length()), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.error("string '{}' cannot be encoded", postdata.substring(index + 1, postdata.length())); throw new IllegalArgumentException( postdata.substring(index + 1, postdata.length()) + " cannot be encoded"); } } } }
Source:
<code>public Response doExport(Action action) { validateParameters(action, "storageDomain.id|name"); <START> Disk disk = get(); <END> ExportRepoImageParameters exportParameters = new ExportRepoImageParameters(asGuid(disk.getImageId())); exportParameters.setStorageDomainId(asGuid(disk.getStorageDomains().getStorageDomains().get(0).getId())); exportParameters.setStoragePoolId(getDataCenterId(exportParameters.getStorageDomainId())); exportParameters.setImageGroupID(asGuid(disk.getId())); exportParameters.setDestinationDomainId(getStorageDomainId(action)); return doAction(VdcActionType.ExportRepoImage, exportParameters, action); }</code><technical_language>need for get()</technical_language>

Target:
public Response doExport(Action action) { validateParameters(action, "storageDomain.id|name"); return doAction(VdcActionType.ExportRepoImage, new ExportRepoImageParameters(guid, getStorageDomainId(action)), action); }
Source:
<code>public void initAddButtons() { final ImageButton addBalance = (ImageButton) mView.findViewById(R.id.add_balance_survey); final ImageButton addReceipt = (ImageButton) mView.findViewById(R.id.add_receipt_survey); mView.findViewById(R.id.add_stock_survey).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (isAddShowing) { hideAddMenu(addReceipt, addBalance); } else { showAddMenu(addReceipt, addBalance); } } }); addBalance.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> mStockSurveysPresenter.onAddBalanceClick(getActivity()); <END> } }); addReceipt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mStockSurveysPresenter.onAddReceiptClick(getActivity()); } }); }</code><technical_language>setting activity argument a presenter presenter is presentation logic a presenter Android Framework</technical_language>

Target:
public void initAddButtons() { final ImageButton addBalance = (ImageButton) mView.findViewById(R.id.add_balance_survey); final ImageButton addReceipt = (ImageButton) mView.findViewById(R.id.add_receipt_survey); mView.findViewById(R.id.add_stock_survey).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (isAddShowing) { hideAddMenu(addReceipt, addBalance); } else { showAddMenu(addReceipt, addBalance); } } }); addBalance.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mStockSurveysPresenter.onAddBalanceClick(); } }); addReceipt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mStockSurveysPresenter.onAddReceiptClick(); } }); }
Source:
<code>public String getKind() { <START> return isHidden() <END> ? (TaskAttribute.TYPE_PERSON.equals(getType()) ? TaskAttribute.KIND_PEOPLE : null) : TaskAttribute.KIND_DEFAULT; }</code><technical_language>I prefer if constructor of BugzillaAttribute accepted org.eclipse.mylyn.tasks.core.data.Flag enums. more descriptive boolean flags for read hidden</technical_language>

Target:
public String getKind() { if (flags.contains(Flag.ATTRIBUTE)) { return TaskAttribute.KIND_DEFAULT; } else if (flags.contains(Flag.PEOPLE)) { return TaskAttribute.KIND_PEOPLE; } else if (flags.contains(Flag.OPERATION)) { return TaskAttribute.KIND_OPERATION; } return null; }
Source:
<code>public Environment findOne(String specifiedApplication, String specifiedProfile, String specifiedLabel) { final String application = StringUtils.isEmpty(specifiedApplication) ? serverProperties.getDefaultApplicationName() : specifiedApplication; final String profile = StringUtils.isEmpty(specifiedProfile) ? serverProperties.getDefaultProfile() : specifiedProfile; final String label = StringUtils.isEmpty(specifiedLabel) ? serverProperties.getDefaultLabel() : specifiedLabel; StringBuilder objectKeyPrefix = new StringBuilder(application).append("-") .append(profile); if (!StringUtils.isEmpty(label)) { <START> objectKeyPrefix.append("-").append(label); <END> } final Environment environment = new Environment(application, profile); environment.setLabel(label); final S3ObjectIdBuilder s3ObjectIdBuilder = new S3ObjectIdBuilder() .withBucket(bucketName); S3ConfigFile s3ConfigFile = getS3ConfigFile(s3ObjectIdBuilder, objectKeyPrefix.toString()); if (s3ConfigFile == null) { throw new NoSuchRepositoryException( "No such repository: (" + s3ObjectIdBuilder .withKey(objectKeyPrefix.toString() + "(.properties | .yml)") .build().toString() + ")"); } environment.setVersion(s3ConfigFile.getVersion()); final Map config = s3ConfigFile.read(); config.putAll(serverProperties.getOverrides()); environment.add(new PropertySource(application, config)); return environment; }</code><technical_language>I see, profile, label. Interesting. In NativeEnvironmentRepository label is a directory. do similar -{label}</technical_language>

Target:
public Environment findOne(String specifiedApplication, String specifiedProfile, String specifiedLabel) { final String application = StringUtils.isEmpty(specifiedApplication) ? serverProperties.getDefaultApplicationName() : specifiedApplication; final String profile = StringUtils.isEmpty(specifiedProfile) ? serverProperties.getDefaultProfile() : specifiedProfile; final String label = StringUtils.isEmpty(specifiedLabel) ? serverProperties.getDefaultLabel() : specifiedLabel; StringBuilder objectKeyPrefix = new StringBuilder(); if (!StringUtils.isEmpty(label)) { objectKeyPrefix.append(label).append("/"); } objectKeyPrefix.append(application).append("-").append(profile); final Environment environment = new Environment(application, profile); environment.setLabel(label); final S3ObjectIdBuilder s3ObjectIdBuilder = new S3ObjectIdBuilder() .withBucket(bucketName); S3ConfigFile s3ConfigFile = getS3ConfigFile(s3ObjectIdBuilder, objectKeyPrefix.toString()); if (s3ConfigFile == null) { throw new NoSuchRepositoryException( "No such repository: (" + s3ObjectIdBuilder .withKey(objectKeyPrefix.toString() + "(.properties | .yml | .json)") .build().toString() + ")"); } environment.setVersion(s3ConfigFile.getVersion()); final Map config = s3ConfigFile.read(); config.putAll(serverProperties.getOverrides()); environment.add(new PropertySource(application, config)); return environment; }
Source:
<code>public List<Class> getSupportedTypes() { <START> return new ArrayList<>(Arrays.asList(ZonedDateTime.class)); <END> }</code><technical_language>Collections.singletonList</technical_language>

Target:
public List<Class> getSupportedTypes() { return Collections.singletonList(ZonedDateTime.class); }
Source:
<code>public CloseableIterator<T> iterator() { <START> return createCacheQuery().iterator(); <END> }</code><technical_language>I this method similar execute optional processing rowProcessor</technical_language>

Target:
public CloseableIterator<T> iterator() { IndexedQuery<T> cacheQuery = createCacheQuery(); return new MappingIterator(cacheQuery.iterator(), t -> rowProcessor == null ? t : rowProcessor.apply((Object[]) t)); }
Source:
<code>void removeReplica(PartitionId partitionId) throws ReplicationException { PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.error("Partition not exist when remove from {}. ", partitionId, dataNodeId); throw new ReplicationException("Partition not found"); } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { logger.error("Exception on token write when remove Partition from {}: ", partitionId, dataNodeId, e); throw new ReplicationException("Exception on token write."); } } Store cloudStore = partitionStoreMap.get(partitionId.toPathString()); if (cloudStore != null) { try { <START> cloudStore.shutdown(); <END> } catch (StoreException ex) { throw new ReplicationException("Cloud not shutdown blobstore while removing replica"); } } else { logger.warn("Store not found for partition {}", partitionId); } logger.info("Partition removed from {}", partitionId, dataNodeId); }</code><technical_language>store removed StoreManager in some other place? Also, shut StoreManager.shutdownBlobStore</technical_language>

Target:
void removeReplica(PartitionId partitionId) throws ReplicationException { PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.error("Partition not exist when remove from {}. ", partitionId, dataNodeId); throw new ReplicationException("Partition not found"); } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { logger.error("Exception on token write when remove Partition from {}: ", partitionId, dataNodeId, e); throw new ReplicationException("Exception on token write."); } } Store cloudStore = partitionStoreMap.get(partitionId.toPathString()); if (cloudStore != null) { storeManager.shutdownBlobStore(partitionId); storeManager.removeBlobStore(partitionId); } else { logger.warn("Store not found for partition {}", partitionId); } logger.info("Partition removed from {}", partitionId, dataNodeId); }
Source:
<code>public boolean isOffsetCommittedByThisTopology(TopicPartition tp, OffsetAndMetadata committedOffset, Map<TopicPartition, OffsetManager> offsetManagers) { try { if (processingGuarantee == ProcessingGuarantee.AT_LEAST_ONCE && offsetManagers.containsKey(tp) && offsetManagers.get(tp).hasCommitted()) { return true; } final CommitMetadata committedMetadata = JSON_MAPPER.readValue(committedOffset.metadata(), CommitMetadata.class); return committedMetadata.getTopologyId().equals(context.getStormId()); } catch (IOException e) { <START> LOG.warn("Failed to deserialize [{}]. Error likely occurred because the last commit " <END> + "for this topic-partition was done using an earlier version of Storm. " + "Defaulting to behavior compatible with earlier version", committedOffset); LOG.trace("", e); return false; } }</code><technical_language>write in README part of this message this WARN is expected time a user starts this earlier version of spout commits Kafka done older version of spout</technical_language>

Target:
public boolean isOffsetCommittedByThisTopology(TopicPartition tp, OffsetAndMetadata committedOffset, Map<TopicPartition, OffsetManager> offsetManagers) { try { if (processingGuarantee == ProcessingGuarantee.AT_LEAST_ONCE && offsetManagers.containsKey(tp) && offsetManagers.get(tp).hasCommitted()) { return true; } final CommitMetadata committedMetadata = JSON_MAPPER.readValue(committedOffset.metadata(), CommitMetadata.class); return committedMetadata.getTopologyId().equals(context.getStormId()); } catch (IOException e) { LOG.warn("Failed to deserialize expected commit metadata [{}]." + " This error is expected to occur once per partition, if the last commit to each partition" + " was by an earlier version of the KafkaSpout, or by a process other than the KafkaSpout. " + "Defaulting to behavior compatible with earlier version", committedOffset); LOG.trace("", e); return false; } }
Source:
<code>public boolean onLongClick(final View view) { final InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); butt.setVisibility(View.INVISIBLE); edit.setVisibility(View.VISIBLE); if (edit.requestFocus()) { imm.showSoftInput(edit, InputMethodManager.SHOW_IMPLICIT); } edit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) { } @Override public void onTextChanged(final CharSequence s, final int start, final int before, final int count) { } @Override <START> public void afterTextChanged(final Editable s) { <END> final Editable text = edit.getText(); if (text.length() > 0) { final char customChar = text.charAt(0); if ('A' <= customChar && customChar <= 'Z' || 'a' <= customChar && customChar <= 'z' || '0' <= customChar && customChar <= '9' || customChar == ' ') { setCustomChar(Character.toUpperCase(customChar)); } else { final Context context = getContext(); Toast.makeText(context, context.getString(R.string.warn_invalid_character), Toast.LENGTH_SHORT).show(); } edit.setText(""); } else { edit.clearFocus(); } } }); edit.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(final View v, final boolean hasFocus) { if (!hasFocus) { edit.setVisibility(View.INVISIBLE); butt.setVisibility(View.VISIBLE); imm.hideSoftInputFromWindow(edit.getWindowToken(), 0); } } }); return true; }</code><technical_language>leave empty lines beginning end of a class method</technical_language>

Target:
public boolean onLongClick(final View view) { return handleLongClick(); }
Source:
<code>public ResponseEntity<?> handleConstraintViolationException(ConstraintViolationException ex) { <START> return createResponseEntity(HttpStatus.BAD_REQUEST, "Username should be a valid Email!"); <END> }</code><technical_language>Is this for this Exception? ConstraintViolationException sounds more generic invalid email field</technical_language>

Target:
public ResponseEntity<?> handleConstraintViolationException(ConstraintViolationException ex) { return createResponseEntity(HttpStatus.BAD_REQUEST, ex.getMessage()); }
Source:
<code>public Optional<Resource> getUsedResource(String accountId) throws NotFoundException, ServerException { final Account account = accountManager.getById(accountId); final List<WorkspaceImpl> accountWorkspaces = <START> Lists.newArrayList( <END> iterate( (maxItems, skipCount) -> workspaceManagerProvider .get() .getByNamespace(account.getName(), false, maxItems, skipCount)) .iterator()); if (!accountWorkspaces.isEmpty()) { return Optional.of( new ResourceImpl( WorkspaceResourceType.ID, accountWorkspaces.size(), WorkspaceResourceType.UNIT)); } else { return Optional.empty(); } }</code><technical_language>complex</technical_language>

Target:
public Optional<Resource> getUsedResource(String accountId) throws NotFoundException, ServerException { final Account account = accountManager.getById(accountId); final List<WorkspaceImpl> accountWorkspaces = Pages.stream( (maxItems, skipCount) -> workspaceManagerProvider .get() .getByNamespace(account.getName(), false, maxItems, skipCount)) .collect(Collectors.toList()); if (!accountWorkspaces.isEmpty()) { return Optional.of( new ResourceImpl( WorkspaceResourceType.ID, accountWorkspaces.size(), WorkspaceResourceType.UNIT)); } else { return Optional.empty(); } }
Source:
<code>private void validateClaims(Header header, Claims claims) { if (claims != null) { if (!this.ignoreExpiry) { <START> ValidationHelper.validateExpiration(header, claims, this.allowedClockSkewMillis, this.clock); <END> } if (!this.ignoreNotBefore) { ValidationHelper.validateNotBefore(header, claims, this.allowedClockSkewMillis, this.clock); } validateExpectedClaims(header, claims); } }</code><technical_language>static/helper methods in implementation please. methods object-oriented - more procedural harder test</technical_language>

Target:
private void validateClaims(Header header, Claims claims) { if (claims != null) { if (!this.ignoreExpiry) { validateExpiration(header, claims); } if (!this.ignoreNotBefore) { validateNotBefore(header, claims); } validateExpectedClaims(header, claims); } }
Source:
<code>public void shouldCreateRunnerInstance() throws Throwable { RunnerProvider provider = new RunnerProvider(); <START> InternalRunner runner = provider.newInstance("org.mockito.internal.runners.DefaultInternalRunner", this.getClass(), null); <END> assertNotNull(runner); }</code><technical_language>runner is in package factory I a String</technical_language>

Target:
public void shouldCreateRunnerInstance() throws Throwable { RunnerProvider provider = new RunnerProvider(); InternalRunner runner = provider.newInstance(DefaultInternalRunner.class.getName(), this.getClass(), null); assertNotNull(runner); }
Source:
<code>private static void checkConfigNameForRestart(String yamlFile) { boolean wasPreviouslyLaunched = launchedYamlFile != null; <START> if (wasPreviouslyLaunched && !launchedYamlFile.equals(yamlFile)) { <END> throw new UnsupportedOperationException("We can't launch two Cassandra configurations in the same JVM instance"); } launchedYamlFile = yamlFile; }</code><technical_language>Thread-safe, of concern/importance</technical_language>

Target:
private static void checkConfigNameForRestart(String yamlFile) { boolean wasPreviouslyLaunched = cassandraRef.get() != null; if (wasPreviouslyLaunched && !launchedYamlFile.equals(yamlFile)) { throw new UnsupportedOperationException("We can't launch two Cassandra configurations in the same JVM instance"); } launchedYamlFile = yamlFile; }
Source:
<code>public void testEventStyling() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); resetTimeRange(bot); Rectangle bounds = fBounds; ImageHelper precollapse = ImageHelper.grabImage(bounds); SWTBotTimeGraph tg = new SWTBotTimeGraph(fViewBot.bot()); tg.getEntry("Plumber guy").collapse(); TimeGraphViewStub view = getView(); ImageHelper ref = ImageHelper.waitForNewImage(bounds, precollapse); view.setFilterRegex("row?"); UIThreadRunnable.syncExec(() -> view.restartZoomThread()); ImageHelper highlighted = ImageHelper.waitForNewImage(bounds, ref); view.setFilterRegex(null); UIThreadRunnable.syncExec(() -> view.restartZoomThread()); ImageHelper reset = ImageHelper.waitForNewImage(bounds, highlighted); <START> ImageHelper diff = ref.diff(reset); assertTrue((double)diff.getHistogram().count(new RGB(0,0,0))/diff.getHistogram().size() > 0.99); <END> ImageHelper delta = highlighted.diff(reset); tg.expandAll(); assertTrue("Some highlighting", delta.getHistogram().elementSet().size() > 1); }</code><technical_language>This a separate patch</technical_language>

Target:
public void testEventStyling() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); resetTimeRange(bot); Rectangle bounds = fBounds; ImageHelper precollapse = ImageHelper.grabImage(bounds); SWTBotTimeGraph tg = new SWTBotTimeGraph(fViewBot.bot()); tg.getEntry("Plumber guy").collapse(); TimeGraphViewStub view = getView(); ImageHelper ref = ImageHelper.waitForNewImage(bounds, precollapse); view.setFilterRegex("row?"); UIThreadRunnable.syncExec(() -> view.restartZoomThread()); ImageHelper highlighted = ImageHelper.waitForNewImage(bounds, ref); view.setFilterRegex(null); UIThreadRunnable.syncExec(() -> view.restartZoomThread()); ImageHelper reset = ImageHelper.waitForNewImage(bounds, highlighted); assertEquals(ref.getHistogram(), reset.getHistogram()); ImageHelper delta = highlighted.diff(reset); tg.expandAll(); assertTrue("Some highlighting", delta.getHistogram().elementSet().size() > 1); }
Source:
<code>public Boolean geteofCompliesPDFA() { <START> return true; <END> }</code><technical_language>Add TODO forget implement this in future</technical_language>

Target:
public Boolean geteofCompliesPDFA() { return ((COSDocument) baseObject).getEofComplyPDFA(); }
Source:
<code>private void when_badCharacters_then_escaped(String badText) throws Exception { <START> System.out.println("badText: " + badText); <END> jmxPublisher.publishLong(newDescriptor() .withPrefix(badText) .withMetric("metric"), 1L); jmxPublisher.publishLong(newDescriptor() .withMetric(badText) .withTag("tag1", "a"), 2L); jmxPublisher.whenComplete(); helper.assertMBeans(asList( of(domainPrefix + ":type=Metrics,instance=inst1,prefix=" + JmxPublisher.escapeObjectNameValue(badText), singletonList(entry("metric", 1L))), of(domainPrefix + ":type=Metrics,instance=inst1,tag0=\"tag1=a\"", singletonList(entry(badText, 2L))) )); }</code><technical_language>remove this line</technical_language>

Target:
private void when_badCharacters_then_escaped(String badText) throws Exception { jmxPublisher.publishLong(newDescriptor() .withPrefix(badText) .withMetric("metric"), 1L); jmxPublisher.publishLong(newDescriptor() .withMetric(badText) .withTag("tag1", "a"), 2L); jmxPublisher.whenComplete(); helper.assertMBeans(asList( of(domainPrefix + ":type=Metrics,instance=inst1,prefix=" + JmxPublisher.escapeObjectNameValue(badText), singletonList(entry("metric", 1L))), of(domainPrefix + ":type=Metrics,instance=inst1,tag0=\"tag1=a\"", singletonList(entry(badText, 2L))) )); }
Source:
<code>public APIQuerySubmissionResult submit(final MISTQuery queryToSubmit) throws IOException { final NettyTransceiver clientToDriver = new NettyTransceiver(new InetSocketAddress(serverAddr, serverPort)); final MistTaskProvider proxyToDriver = SpecificRequestor.getClient(MistTaskProvider.class, clientToDriver); final TaskList taskList = proxyToDriver.getTasks(new QueryInfo()); <START> final java.util.List<IPAddress> tasks = taskList.getTasks(); <END> final LogicalPlan logicalPlan = querySerializer.queryToLogicalPlan(queryToSubmit); final IPAddress task = tasks.get(0); final NettyTransceiver clientToTask = new NettyTransceiver( new InetSocketAddress(task.getHostAddress().toString(), task.getPort())); final ClientToTaskMessage proxyToTask = SpecificRequestor.getClient(ClientToTaskMessage.class, clientToTask); final QuerySubmissionResult querySubmissionResult = proxyToTask.sendQueries(logicalPlan); APIQuerySubmissionResult apiQuerySubmissionResult = new APIQuerySubmissionResultImpl(querySubmissionResult.getQueryId()); return apiQuerySubmissionResult; }</code><technical_language>java.util.List? I necessary if duplicate name other duplicate imported java.util.List is typical List of</technical_language>

Target:
public APIQuerySubmissionResult submit(final MISTQuery queryToSubmit) throws IOException { final NettyTransceiver clientToDriver = new NettyTransceiver(new InetSocketAddress(serverAddr, serverPort)); final MistTaskProvider proxyToDriver = SpecificRequestor.getClient(MistTaskProvider.class, clientToDriver); final TaskList taskList = proxyToDriver.getTasks(new QueryInfo()); final List<IPAddress> tasks = taskList.getTasks(); final LogicalPlan logicalPlan = querySerializer.queryToLogicalPlan(queryToSubmit); final IPAddress task = tasks.get(0); final NettyTransceiver clientToTask = new NettyTransceiver( new InetSocketAddress(task.getHostAddress().toString(), task.getPort())); final ClientToTaskMessage proxyToTask = SpecificRequestor.getClient(ClientToTaskMessage.class, clientToTask); final QuerySubmissionResult querySubmissionResult = proxyToTask.sendQueries(logicalPlan); APIQuerySubmissionResult apiQuerySubmissionResult = new APIQuerySubmissionResultImpl(querySubmissionResult.getQueryId()); return apiQuerySubmissionResult; }
Source:
<code><START> public E read(String line) { <END> try { return builder.makeRecord(parser.parseLine(line), null); } catch (IOException e) { throw new DatasetIOException("Cannot parse line: " + line, e); } }</code><technical_language>This call read(String line, E reuse) pass in null for reuse duplicate method</technical_language>

Target:
public E read(String line) { return read(line, null); }
Source:
<code>public void testDetermineOutputType() { Assert.assertEquals(OutputType.VCF, VariantContextWriterBuilder.determineOutputTypeFromFile(this.vcf)); Assert.assertEquals(OutputType.BCF, VariantContextWriterBuilder.determineOutputTypeFromFile(this.bcf)); <START> Assert.assertEquals(OutputType.VCF_STREAM, VariantContextWriterBuilder.determineOutputTypeFromFile(new File("/dev/stdout"))); <END> try { final Path link = Files.createTempFile("foo.", ".tmp"); Files.deleteIfExists(link); Files.createSymbolicLink(link, this.vcf.toPath()); link.toFile().deleteOnExit(); Assert.assertEquals(OutputType.VCF, VariantContextWriterBuilder.determineOutputTypeFromFile(link.toFile())); link.toFile().delete(); } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } }</code><technical_language>in discussion mentioned /tmp/foo.vcf.gz. work? test it</technical_language>

Target:
public void testDetermineOutputType() { Assert.assertEquals(OutputType.VCF, VariantContextWriterBuilder.determineOutputTypeFromFile(this.vcf)); Assert.assertEquals(OutputType.BCF, VariantContextWriterBuilder.determineOutputTypeFromFile(this.bcf)); Assert.assertEquals(OutputType.VCF_STREAM, VariantContextWriterBuilder.determineOutputTypeFromFile(new File("/dev/stdout"))); for (final File f: this.blockCompressedVCFs) { Assert.assertEquals(OutputType.BLOCK_COMPRESSED_VCF, VariantContextWriterBuilder.determineOutputTypeFromFile(f)); } try { final Path link = Files.createTempFile("foo.", ".tmp"); Files.deleteIfExists(link); Files.createSymbolicLink(link, this.vcf.toPath()); link.toFile().deleteOnExit(); Assert.assertEquals(OutputType.VCF, VariantContextWriterBuilder.determineOutputTypeFromFile(link.toFile())); link.toFile().delete(); } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } }
Source:
<code>private void increment(String tag, Map<String, AtomicLong> toIncrement) { final AtomicLong counter = getOrCreateCounter(tag, toIncrement); counter.set(counter.incrementAndGet()); <START> toIncrement.put(tag, counter); <END> }</code><technical_language>Unnecessary put method calls, getOrCreateCounter takes care of creating AtomicLong counter for you, need put again</technical_language>

Target:
private void increment(String tag, Map<String, AtomicLong> toIncrement) { final AtomicLong counter = getOrCreateCounter(tag, toIncrement); counter.incrementAndGet(); }
Source:
<code>public void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey) throws ScriptException { correctlySpends(txContainingThis, scriptSigIndex, scriptPubKey, <START> new HashSet<VerifyFlag>(Arrays.asList(VerifyFlag.values()))); <END> }</code><technical_language>This a static variable, also: EnumSet.allOf(VerifyFlag.class)</technical_language>

Target:
public void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey) throws ScriptException { correctlySpends(txContainingThis, scriptSigIndex, scriptPubKey, ALL_VERIFY_FLAGS); }