auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public List<Contentlet> filterRelatedContent(Contentlet contentlet, Relationship rel, <END> User user, boolean respectFrontendRoles, Boolean pullByParent, int limit, int offset) throws DotDataException, DotSecurityException { if (!UtilMethods.isSet(contentlet.getIdentifier())) { return Collections.emptyList(); } final boolean isSameStructureRelationship = FactoryLocator.getRelationshipFactory() .sameParentAndChild(rel); if (isSameStructureRelationship) { if (pullByParent == null) { return (List<Contentlet>) CollectionsUtils .join(getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset), getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset)).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } if (pullByParent) { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } else { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset) .stream().filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } } else { if (rel.getChildStructureInode().equals(contentlet.getContentTypeId())) { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset); } else { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset); } } }</code><technical_language>This public</technical_language>

Target:
List<Contentlet> filterRelatedContent(Contentlet contentlet, Relationship rel, User user, boolean respectFrontendRoles, Boolean pullByParent, int limit, int offset) throws DotDataException, DotSecurityException { if (!UtilMethods.isSet(contentlet.getIdentifier())) { return Collections.emptyList(); } final boolean isSameStructureRelationship = FactoryLocator.getRelationshipFactory() .sameParentAndChild(rel); if (isSameStructureRelationship) { if (pullByParent == null) { return (List<Contentlet>) CollectionsUtils .join(getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset), getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset)).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } if (pullByParent) { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset).stream() .filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } else { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset) .stream().filter(Objects::nonNull) .collect(CollectionsUtils.toImmutableList()); } } else { if (rel.getChildStructureInode().equals(contentlet.getContentTypeId())) { return getRelatedParents(contentlet, rel, user, respectFrontendRoles, limit, offset); } else { return getRelatedChildren(contentlet, rel, user, respectFrontendRoles, limit, offset); } } }
Source:
<code>public void init() { fridgeTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FRIDGE_TEMPERATURE)); freezerTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FREEZER_TEMPERATURE)); fridgeTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override <START> public void onLowerBoundValue(Config params, boolean fireCommand) { <END> } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFridgeTemperature(rangeValue, params); } }); freezerTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFreezerTemperature(rangeValue, params); } }); registerBehavior(fridgeTemperature); registerBehavior(freezerTemperature); super.init(); }</code><technical_language>upper values nothing. a 0-100 range means zero 100 nothing, 1 99 sets related fridge temperature. This problem i related rangeintbehaviors in classes</technical_language>

Target:
public void init() { fridgeTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FRIDGE_TEMPERATURE)); freezerTemperature = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior(BEHAVIOR_FREEZER_TEMPERATURE)); fridgeTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { executeSetFridgeTemperature(fridgeTemperature.getMin(), params); } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { executeSetFridgeTemperature(fridgeTemperature.getMax(), params); } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFridgeTemperature(rangeValue, params); } }); freezerTemperature.addListener(new RangedIntBehaviorLogic.Listener() { @Override public void onLowerBoundValue(Config params, boolean fireCommand) { executeSetFreezerTemperature(freezerTemperature.getMin(), params); } @Override public void onUpperBoundValue(Config params, boolean fireCommand) { executeSetFreezerTemperature(freezerTemperature.getMax(), params); } @Override public void onRangeValue(int rangeValue, Config params, boolean fireCommand) { executeSetFreezerTemperature(rangeValue, params); } }); registerBehavior(fridgeTemperature); registerBehavior(freezerTemperature); super.init(); }
Source:
<code><START> String buildEntryFlagName(@Nonnull final Flags flags) { <END> final Flags.Flag[] sf = flags.getSystemFlags(); final String[] uf = flags.getUserFlags(); String s = "\"/flags/"; if (sf.length == 1) { s += ImapClientConstants.BACKSLASH; if (sf[0] == Flags.Flag.ANSWERED) { s += ANSWERED; } else if (sf[0] == Flags.Flag.DELETED) { s += DELETED; } else if (sf[0] == Flags.Flag.DRAFT) { s += DRAFT; } else if (sf[0] == Flags.Flag.FLAGGED) { s += FLAGGED; } else if (sf[0] == Flags.Flag.RECENT) { s += RECENT; } else if (sf[0] == Flags.Flag.SEEN) { s += SEEN; } } else { s += uf[0]; } s += ImapClientConstants.DQUOTA; return s; }</code><technical_language>is this method used</technical_language>

Target:
String buildEntryFlagName(@Nonnull final Flags flags) { final Flags.Flag[] sf = flags.getSystemFlags(); final String[] uf = flags.getUserFlags(); final StringBuilder s = new StringBuilder("\"/flags/"); if (sf.length == 1) { s.append(ImapClientConstants.BACKSLASH); if (sf[0] == Flags.Flag.ANSWERED) { s.append(ANSWERED); } else if (sf[0] == Flags.Flag.DELETED) { s.append(DELETED); } else if (sf[0] == Flags.Flag.DRAFT) { s.append(DRAFT); } else if (sf[0] == Flags.Flag.FLAGGED) { s.append(FLAGGED); } else if (sf[0] == Flags.Flag.RECENT) { s.append(RECENT); } else if (sf[0] == Flags.Flag.SEEN) { s.append(SEEN); } } else { s.append(uf[0]); } s.append(ImapClientConstants.DQUOTA); return s.toString(); }
Source:
<code>private Requirement getRequirements(SqlQueryDescriptor queryDescriptor) { List<Requirement> requirements = newArrayList(); requirements.addAll(queryDescriptor.getTableDefinitionNames() .stream() .map(requiredTableName -> new ImmutableTableRequirement(tableDefinitionsRepository.getForName(requiredTableName), Optional.of(queryDescriptor.getDatabaseName()))) .collect(toList())); requirements.addAll(queryDescriptor.getMutableTableDescriptors() .stream() <START> .map(descriptor -> MutableTableRequirement.builder(tableDefinitionsRepository.getForName(descriptor.tableDefinitionName)) <END> .withName(descriptor.name) .withState(descriptor.state) .withTableManager(queryDescriptor.getDatabaseName()) .build()) .collect(toList())); requirements.addAll(queryDescriptor.getRequirementClassNames() .stream() .map(this::getRequirementsFromClass) .collect(toList())); return compose(requirements); }</code><technical_language>replace this .map line .map(TableDescriptor::getTableDefinitionName) .map(tableDefinitionRepository::getForName) .map(MutableTableRequirement::builder) .map(builder -> ....) Is more readable</technical_language>

Target:
private Requirement getRequirements(SqlQueryDescriptor queryDescriptor) { List<Requirement> requirements = newArrayList(); requirements.addAll(queryDescriptor.getTableDefinitionNames() .stream() .map(requiredTableName -> new ImmutableTableRequirement(tableDefinitionsRepository.getForName(requiredTableName), Optional.of(queryDescriptor.getDatabaseName()))) .collect(toList())); requirements.addAll(queryDescriptor.getMutableTableDescriptors() .stream() .map(descriptor -> MutableTableRequirement.builder(tableDefinitionsRepository.getForName(descriptor.tableDefinitionName)) .withName(descriptor.name) .withState(descriptor.state) .withDatabase(queryDescriptor.getDatabaseName()) .build()) .collect(toList())); requirements.addAll(queryDescriptor.getRequirementClassNames() .stream() .map(this::getRequirementsFromClass) .collect(toList())); return compose(requirements); }
Source:
<code>public Set<String> allowedStripeIpAddresses(StripeGatewayConfig config) { <START> ImmutableSet.Builder<String> allowedStripeIpAddresses = ImmutableSet.builder(); for (String cidr : config.getAllowedCidrs()) { SubnetUtils subnet = new SubnetUtils(cidr); subnet.setInclusiveHostCount(true); allowedStripeIpAddresses.addAll(List.of(subnet.getInfo().getAllAddresses())); } return allowedStripeIpAddresses.build(); <END> }</code><technical_language>Firstly, do need include network broadcast addresses, setInclusiveHostCount(true) does? expert I thought receive requests source IP belong actual hosts. Secondly, do this Guava: java var allowedStripeIpAddresses = new HashSet<String>(); // for loop return Set.copyOf(allowedStripeIpAddresses); Alternatively, do this: java Set<SubnetUtils> subnets = config.getAllowedCidrs().stream().map(SubnetUtils::new).collect(toUnmodifiableSet()); subnets.forEach(subnet -> subnet.setInclusiveHostCount(true)); return subnets.stream().map(SubnetUtils::getInfo).map(SubnetUtils.SubnetInfo::getAllAddresses).flatMap(Arrays::stream).collect(toUnmodifiableSet()); if clearer. leave decision you. Of course, if turns out need do setInclusiveHostCount(true), simpler: java return config.getAllowedCidrs() .stream() .map(SubnetUtils::new) .map(SubnetUtils::getInfo) .map(SubnetUtils.SubnetInfo::getAllAddresses) .flatMap(Arrays::stream) .collect(toUnmodifiableSet());</technical_language>

Target:
public Set<String> allowedStripeIpAddresses(StripeGatewayConfig config) { return CidrUtils.getIpAddresses(config.getAllowedCidrs()); }
Source:
<code><START> protected VDSCommandType getRevertVDSCommandType() { <END> return VDSCommandType.DeleteImageGroup; }</code><technical_language>reminder: remove VDSCommandType return null (perform rollback previous task handler)</technical_language>

Target:
protected VDSCommandType getRevertVDSCommandType() { return null; }
Source:
<code>public void showProgress(final boolean show) { <START> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { <END> int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); mLoginFormView.animate().setDuration(shortAnimTime).alpha( show ? 0 : 1 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } } ); mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mProgressView.animate().setDuration(shortAnimTime).alpha( show ? 1 : 0 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); } } ); } else { mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }</code><technical_language>x: copypasta fail, minSdkVersion is KitKat bro</technical_language>

Target:
private void showProgress(final boolean show) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); loginFormView.setVisibility(show ? View.GONE : View.VISIBLE); loginFormView.animate().setDuration(shortAnimTime).alpha( show ? 0 : 1 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(@NonNull Animator animation) { loginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } } ); progressView.setVisibility(show ? View.VISIBLE : View.GONE); progressView.animate().setDuration(shortAnimTime).alpha( show ? 1 : 0 ).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(@NonNull Animator animation) { progressView.setVisibility(show ? View.VISIBLE : View.GONE); } } ); } else { progressView.setVisibility(show ? View.VISIBLE : View.GONE); loginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }
Source:
<code>public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .writer(variantWriter) .faultTolerant().skipLimit(50).skip(FlatFileParseException.class) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) <START> .listener(new VariantLoaderStatisticsListener()) <END> .build(); }</code><technical_language>VariantLoaderStepStatisticsListener relationship classes more clear</technical_language>

Target:
public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .writer(variantWriter) .faultTolerant().skipLimit(50).skip(FlatFileParseException.class) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStepStatisticsListener()) .build(); }
Source:
<code><START> public FetchCommand setRemoveDeletedRefs(boolean removeDeletedRefs) { <END> this.removeDeletedRefs = removeDeletedRefs; return this; }</code><technical_language>Missing checkCallable()</technical_language>

Target:
public FetchCommand setRemoveDeletedRefs(boolean removeDeletedRefs) { checkCallable(); this.removeDeletedRefs = removeDeletedRefs; return this; }
Source:
<code>public static boolean isLastNParameter(String theParamName, FhirContext theContext) { if (theParamName == null) { return false; } <START> if (theContext.getVersion().getVersion() == FhirVersionEnum.R5) { <END> if (theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_SUBJECT) || theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_PATIENT) || theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_CATEGORY) || theParamName.equals(org.hl7.fhir.r5.model.Observation.SP_CODE)) { return true; } else { return false; } } else if (theContext.getVersion().getVersion() == FhirVersionEnum.R4) { if (theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_SUBJECT) || theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_PATIENT) || theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_CATEGORY) || theParamName.equals(org.hl7.fhir.r4.model.Observation.SP_CODE)) { return true; } else { return false; } } else if (theContext.getVersion().getVersion() == FhirVersionEnum.DSTU3) { if (theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_SUBJECT) || theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_PATIENT) || theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_CATEGORY) || theParamName.equals(org.hl7.fhir.dstu3.model.Observation.SP_CODE)) { return true; } else { return false; } } else { throw new InvalidRequestException("$lastn operation is not implemented for FHIR Version " + theContext.getVersion().getVersion().getFhirVersionString()); } }</code><technical_language>This function do some tidying up, a hairy. theContext.getVersion().getVersion() ripped out a variable, of 4-level || checks broken out this reads better, e.g. if (isR5(version) && isLastNParamR5(theParamName))</technical_language>

Target:
public static boolean isLastNParameter(String theParamName, FhirContext theContext) { if (theParamName == null) { return false; } FhirVersionEnum version = theContext.getVersion().getVersion(); if (isR5(version) && isLastNParameterR5(theParamName)) { return true; } else if (isR4(version) && isLastNParameterR4(theParamName)) { return true; } else if (isDstu3(version) && isLastNParameterDstu3(theParamName)) { return true; } else { return false; } }
Source:
<code>private void discoverConfigsAndLoadBundles(CatalogContext catalogContext) { m_configsForProcessor.clear(); for (String configName : m_processorConfig.keySet()) { ImportConfiguration importConfig = m_processorConfig.get(configName); Properties properties = importConfig.getmoduleProperties(); String importBundleJar = properties.getProperty(ImportDataProcessor.IMPORT_MODULE); Preconditions.checkNotNull(importBundleJar, <START> "Import source is undefined or custom export plugin class missing."); <END> String procedure = properties.getProperty(ImportDataProcessor.IMPORT_PROCEDURE); Procedure catProc = catalogContext.procedures.get(procedure); if (catProc == null) { catProc = catalogContext.m_defaultProcs.checkForDefaultProcedure(procedure); } if (catProc == null) { importLog.info("Importer " + configName + " Procedure " + procedure + " is missing will disable this importer until the procedure becomes available."); continue; } if (loadImporterBundle(properties)) { m_configsForProcessor.put(configName, importConfig); } } if (!m_configsForProcessor.isEmpty()) { importLog.info("Loaded importer modules: " + m_loadedBundles.keySet() +", types: " + m_importersByType.keySet()); } }</code><technical_language>Custom import plugin</technical_language>

Target:
private void discoverConfigsAndLoadBundles(CatalogContext catalogContext) { m_configsForProcessor.clear(); for (String configName : m_processorConfig.keySet()) { ImportConfiguration importConfig = m_processorConfig.get(configName); Properties properties = importConfig.getmoduleProperties(); String importBundleJar = properties.getProperty(ImportDataProcessor.IMPORT_MODULE); Preconditions.checkNotNull(importBundleJar, "Import source is undefined or custom import plugin class missing."); String procedure = properties.getProperty(ImportDataProcessor.IMPORT_PROCEDURE); Procedure catProc = catalogContext.procedures.get(procedure); if (catProc == null) { catProc = catalogContext.m_defaultProcs.checkForDefaultProcedure(procedure); } if (catProc == null) { importLog.info("Importer " + configName + " Procedure " + procedure + " is missing will disable this importer until the procedure becomes available."); continue; } if (loadImporterBundle(properties)) { m_configsForProcessor.put(configName, importConfig); } } if (!m_configsForProcessor.isEmpty()) { importLog.info("Loaded importer modules: " + m_loadedBundles.keySet() +", types: " + m_importersByType.keySet()); } }
Source:
<code>public static String getLineSeparatorForFile(String filepath, Charset charset) throws IOException { final String result; if (new FileText(new File(filepath), charset.name()) .getFullText().chars().anyMatch(character -> character == '\r')) { <START> result = "\r\n"; <END> } else { result = "\n"; } return result; }</code><technical_language>please move this constant of this Util class, reuse FileTextTest.java</technical_language>

Target:
public static String getLineSeparatorForFile(String filepath, Charset charset) throws IOException { final boolean[] crFound = {false}; new FileText(new File(filepath), charset.name()) .getFullText() .chars() .peek(character -> { if (character == '\r') { crFound[0] = true; } }) .filter(character -> character == '\n') .findFirst(); final String result; if (crFound[0]) { result = CRLF; } else { result = "\n"; } return result; }
Source:
<code>public <S extends ArtifactEntry> S save(S entity, boolean updateLastVersion) { entity.setArtifactCoordinates(entity.getArtifactCoordinates()); <START> <END> ArtifactCoordinates coordinates = entity.getArtifactCoordinates(); if (coordinates == null) { return super.save(entity); } if (updateLastVersion) { updateLastVersionTag(entity); } return super.save(entity); }</code><technical_language>@mkuligowski please revert this empty lines</technical_language>

Target:
public <S extends ArtifactEntry> S save(S entity, boolean updateLastVersion) { entity.setArtifactCoordinates(entity.getArtifactCoordinates()); if(artifactEntryIsSavedForTheFirstTime(entity)) { entity.setCreated(new Date()); } ArtifactCoordinates coordinates = entity.getArtifactCoordinates(); if (coordinates == null) { return super.save(entity); } if (updateLastVersion) { updateLastVersionTag(entity); } return super.save(entity); }
Source:
<code>private static String makeId(String id, IndexIngestionSpec ingestionSchema) { <START> return id != null ? id : String.format("index_%s_%s", makeDataSource(ingestionSchema), new DateTime().toString()); <END> }</code><technical_language>need toString()</technical_language>

Target:
private static String makeId(String id, IndexIngestionSpec ingestionSchema) { return id != null ? id : String.format("index_%s_%s", makeDataSource(ingestionSchema), new DateTime()); }
Source:
<code>public void testLock() throws Exception { RedisLockRegistry registry = new RedisLockRegistry(this.getConnectionFactoryForTest(), this.registryKey); for (int i = 0; i < 10; i++) { Lock lock = registry.obtain("foo"); lock.lock(); try { assertEquals(1, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); } finally { lock.unlock(); } } Thread.sleep(10); <START> registry.expireUnusedOlderThan(0); <END> assertEquals(0, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); }</code><technical_language>registry.expireUnusedOlderThan(-1000); instead of Thread.sleep() I blocking in tests for nothing</technical_language>

Target:
public void testLock() throws Exception { RedisLockRegistry registry = new RedisLockRegistry(this.getConnectionFactoryForTest(), this.registryKey); for (int i = 0; i < 10; i++) { Lock lock = registry.obtain("foo"); lock.lock(); try { assertEquals(1, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); } finally { lock.unlock(); } } registry.expireUnusedOlderThan(-1000); assertEquals(0, TestUtils.getPropertyValue(registry, "locks", Map.class).size()); }
Source:
<code>private static void putAdapterPerf(HBaseRequestAdapter adapter, Put put) { System.out.println("Size: " + adapter.adapt(put).toProto(requestContext).getSerializedSize()); System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { adapter.adapt(put); } long time = System.nanoTime() - start; System.out.println( String.format("adapted: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { RowMutation adapted = adapter.adapt(put); <START> BigtableGrpc.getMutateRowMethod().streamRequest(adapted.toProto(requestContext)); <END> } long time = System.nanoTime() - start; System.out.println( String.format("adapted, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { RowMutation adapted = adapter.adapt(put); adapted.toProto(requestContext).getSerializedSize(); BigtableGrpc.getMutateRowMethod().streamRequest(adapted.toProto(requestContext)); } long time = System.nanoTime() - start; System.out.println(String.format( "adapted, getSerializedSize, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } }</code><technical_language>This wrong for perf class. work updating this class in a PR</technical_language>

Target:
private static void putAdapterPerf(HBaseRequestAdapter adapter, Put put) { System.out.println("Size: " + adapter.adapt(put).toProto(requestContext).getSerializedSize()); System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { adapter.adapt(put); } long time = System.nanoTime() - start; System.out.println( String.format("adapted: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { RowMutation adapted = adapter.adapt(put); BigtableGrpc.getMutateRowMethod().streamRequest(adapted.toProto(requestContext)); } long time = System.nanoTime() - start; System.out.println( String.format("adapted, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } System.gc(); { long start = System.nanoTime(); for (int i = 0; i < count; i++) { MutateRowRequest adapted = adapter.adapt(put).toProto(requestContext); adapted.getSerializedSize(); BigtableGrpc.getMutateRowMethod().streamRequest(adapted); } long time = System.nanoTime() - start; System.out.println(String.format( "adapted, getSerializedSize, streamRequest: %,d rows merged in %,d ms. %,d nanos per row.", count, time / 1000000, time / count)); } }
Source:
<code><START> public synchronized void flush() { <END> try { buffer.put(FLUSH_LOG); synchronized (o){ o.wait(); } } catch (InterruptedException e) { log.error(e.getMessage(), e); } }</code><technical_language>I is unnecessary synchronized</technical_language>

Target:
public synchronized void flush() { try { synchronized (lock){ buffer.put(FLUSH_LOG); lock.wait(); } } catch (InterruptedException e) { log.error("Failed during flushing", e); Thread.currentThread().interrupt(); } }
Source:
<code>public <T> T getBitmapResult(final BitmapIndexSelector selector, final BitmapResultFactory<T> bitmapResultFactory) { if (requiredBindings.isEmpty()) { if (expr.eval(ExprUtils.nilBindings()).asBoolean()) { return bitmapResultFactory.wrapAllTrue(Filters.allTrue(selector)); } else { return bitmapResultFactory.wrapAllFalse(Filters.allFalse(selector)); } } else { final String column = Iterables.getOnlyElement(requiredBindings); return Filters.matchPredicate( column, selector, bitmapResultFactory, <START> str -> expr.eval(name -> str).asBoolean() END> ); } }</code><technical_language>add some more description "name" refers (relating ObjectBinding), a confused I this</technical_language>

Target:
public <T> T getBitmapResult(final BitmapIndexSelector selector, final BitmapResultFactory<T> bitmapResultFactory) { if (requiredBindings.isEmpty()) { if (expr.eval(ExprUtils.nilBindings()).asBoolean()) { return bitmapResultFactory.wrapAllTrue(Filters.allTrue(selector)); } else { return bitmapResultFactory.wrapAllFalse(Filters.allFalse(selector)); } } else { final String column = Iterables.getOnlyElement(requiredBindings); return Filters.matchPredicate( column, selector, bitmapResultFactory, value -> expr.eval(identifierName -> { assert column.equals(identifierName); return value; }).asBoolean() ); } }
Source:
<code>public <START> Response<TreeSet<String>> <END> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (input.add == null && input.remove == null)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }</code><technical_language>? extends Set</technical_language>

Target:
public Response<? extends Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (input.add == null && input.remove == null)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }
Source:
<code>public void onEvent(Event e) { if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); if (daemonName != null && daemonName.equals(getName())) { doAddAndRemoveEngines(); return; } } if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); <START> if (daemonName.startsWith(getName() + '-')) { <END> Matcher m = Pattern.compile(getName() + "-(.+)$").matcher(daemonName); if (m.find()) { final String engineName = m.group(1); LOG.warn("An error was detected while reloading engine {}, this engine will be removed. Fix the error and try again.", engineName); m_correlator.removeCorrelationEngine(engineName); for (PluginConfiguration p : m_pluginConfigurations) { final RuleSet set = p.getRuleSets().stream().filter(r -> r.getName().equals(engineName)).findFirst().orElse(null); if (set != null) { p.getRuleSets().remove(set); } } } } } }</code><technical_language>This redundant if matcher next line</technical_language>

Target:
public void onEvent(Event e) { if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); if (daemonName != null && daemonName.equals(getName())) { doAddAndRemoveEngines(); return; } } if (e.getUei().equals(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI)) { final String daemonName = getDaemonNameFromReloadDaemonEvent(e); Matcher m = Pattern.compile(getName() + "-(.+)$").matcher(daemonName); if (m.find()) { final String engineName = m.group(1); LOG.warn("An error was detected while reloading engine {}, this engine will be removed. Fix the error and try again.", engineName); m_correlator.removeCorrelationEngine(engineName); for (PluginConfiguration p : m_pluginConfigurations) { final RuleSet set = p.getRuleSets().stream().filter(r -> r.getName().equals(engineName)).findFirst().orElse(null); if (set != null) { p.getRuleSets().remove(set); } } } } }
Source:
<code>private void getSearchItems() { ArrayList<Suggestion> suggestions = new ArrayList<>(); Query<Preferences> query = mBucketPreferences.query(); try (ObjectCursor<Preferences> cursor = query.execute()) { while (cursor.moveToNext()) { List<String> recents = cursor.getObject().getRecentSearches(); for (String recent : recents) { suggestions.add(new Suggestion(recent, HISTORY)); } } } mSuggestionAdapter.updateItems(suggestions); <START> } <END></code><technical_language>java private void getSearchItems() { Preferences preferences = getPreferences(); ArrayList<Suggestion> suggestions = new ArrayList<>(); for (String : preferences.getRecentSearches()) { suggestions.add(new Suggestion(recent, HISTORY)); } mSuggestionAdapter.updateItems(suggestions); }</technical_language>

Target:
private void getSearchItems() { Preferences preferences = getPreferences(); if (preferences != null) { ArrayList<Suggestion> suggestions = new ArrayList<>(); for (String recent : preferences.getRecentSearches()) { suggestions.add(new Suggestion(recent, HISTORY)); } mSuggestionAdapter.updateItems(suggestions); } else { Log.e("getSearchItems", "Could not get preferences entity"); } }
Source:
<code>private void collect(IClassInfo ci, Set<Class> collector) { if (ci.hasAnnotation(IgnoreBean.class)) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is annotated with '{}'.", ci.name(), IgnoreBean.class.getSimpleName()); } return; } if (!ci.isInstanciable()) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is not instanciable.", ci.name()); } return; } if (!(ci.hasNoArgsConstructor() || ci.hasInjectableConstructor())) { if (LOG.isDebugEnabled()) { <START> LOG.debug("Skipping bean candidate '{0}' because it has no empty or injectable constructor().", ci.name()); <END> } return; } try { collector.add(ci.resolveClass()); } catch (Exception ex) { LOG.warn("Could not resolve class [{}]", ci.name(), ex); } }</code><technical_language>logger placeholder is {}, {0}</technical_language>

Target:
private void collect(IClassInfo ci, Set<Class> collector) { if (ci.hasAnnotation(IgnoreBean.class)) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is annotated with '{}'.", ci.name(), IgnoreBean.class.getSimpleName()); } return; } if (!ci.isInstanciable()) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it is not instanciable.", ci.name()); } return; } if (!(ci.hasNoArgsConstructor() || ci.hasInjectableConstructor())) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping bean candidate '{}' because it has no empty or injectable constructor().", ci.name()); } return; } try { collector.add(ci.resolveClass()); } catch (Exception ex) { LOG.warn("Could not resolve class [{}]", ci.name(), ex); } }
Source:
<code>public Key(ManagedBean mbean, String name) { <START> checkNotNull(mbean, "Managd bean"); <END> this.type = checkNotNull(mbean.getType(), "Managed bean type"); this.name = checkNotNull(name, "Name"); }</code><technical_language>Typo. I arg name in this situation, i.e. checkNotNull(mbean, "mbean")</technical_language>

Target:
public Key(ManagedBean mbean, String name) { this(checkNotNull(mbean, "mbean").getType(), name); }
Source:
<code>private void onShutDown() { try { partitionMonitor.ifPresent(StreamPartitionCountMonitor::stop); inputStreamRegexMonitor.ifPresent(StreamRegexMonitor::stop); systemAdmins.stop(); containerProcessManager.stop(); coordinatorStreamStore.close(); } catch (Throwable e) { LOG.error("Exception while stopping task manager {}", e); } <START> LOG.info("Stopped task manager"); <END> if (jmxServer != null) { try { jmxServer.stop(); LOG.info("Stopped Jmx Server"); } catch (Throwable e) { LOG.error("Exception while stopping jmx server {}", e); } } }</code><technical_language>this _cluster based job coordinator_</technical_language>

Target:
private void onShutDown() { try { partitionMonitor.ifPresent(StreamPartitionCountMonitor::stop); inputStreamRegexMonitor.ifPresent(StreamRegexMonitor::stop); systemAdmins.stop(); containerProcessManager.stop(); coordinatorStreamStore.close(); } catch (Throwable e) { LOG.error("Exception while stopping cluster based job coordinator", e); } LOG.info("Stopped cluster based job coordinator"); if (jmxServer != null) { try { jmxServer.stop(); LOG.info("Stopped Jmx Server"); } catch (Throwable e) { LOG.error("Exception while stopping jmx server", e); } } }
Source:
<code>public ModuleMetadata findOne(String metadataPath) { ModuleMetadata metadata = null; try { byte[] data = zkConnection.getClient().getData().forPath(metadataPath); if (data != null) { Map<String, String> metadataMap = mapBytesUtility.toMap(data); String moduleId = getModuleId(metadataPath); String containerId = getContainerId(metadataPath); <START> Map<String, String> resolvedProperties = resolveModuleOptionValues(metadataMap); <END> String moduleDeploymentsPath = metadataPath.substring(0, metadataPath.lastIndexOf("/")); Map<String, String> deploymentProps = mapBytesUtility.toMap(zkConnection.getClient().getData().forPath( moduleDeploymentsPath)); String deploymentProperties = (deploymentProps.isEmpty()) ? "" : MapUtils.toProperties(deploymentProps).toString(); String moduleProperties = (resolvedProperties.isEmpty()) ? "" : MapUtils.toProperties(resolvedProperties).toString(); metadata = new ModuleMetadata(moduleId, containerId, moduleProperties, deploymentProperties); } } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } return metadata; }</code><technical_language>term "options" in new code</technical_language>

Target:
public ModuleMetadata findOne(String metadataPath) { ModuleMetadata metadata = null; try { byte[] data = zkConnection.getClient().getData().forPath(metadataPath); if (data != null) { Map<String, String> metadataMap = mapBytesUtility.toMap(data); String moduleId = getModuleId(metadataPath); String containerId = getContainerId(metadataPath); metadata = new ModuleMetadata(moduleId, containerId, getResolvedModuleOptions(metadataMap), getDeploymentProperties(metadataPath)); } } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } return metadata; }
Source:
<code>public void testRestServerState() { Assert.assertFalse("Service should be down by default ", serverState.isServiceUp()); serverState.markServiceUp(); Assert.assertTrue("Service is expected to be up ", serverState.isServiceUp()); serverState.markServiceDown(); <START> Assert.assertFalse("Service is expected to be down ", serverState.isServiceUp()); <END> }</code><technical_language>check returned healthcheck uri</technical_language>

Target:
public void testRestServerState() { Assert.assertEquals("Health check Uri mismatch ", healthCheckUri, serverState.getHealthCheckUri()); Assert.assertFalse("Service should be down by default ", serverState.isServiceUp()); serverState.markServiceUp(); Assert.assertTrue("Service is expected to be up ", serverState.isServiceUp()); serverState.markServiceDown(); Assert.assertFalse("Service is expected to be down ", serverState.isServiceUp()); }
Source:
<code>private void queryServer(String query) { KeybaseKeyServer server = new KeybaseKeyServer(); try { ArrayList<ImportKeysListEntry> searchResult = server.search(query); mEntryList.clear(); mEntryList.addAll(searchResult); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, null); } catch (KeyServer.InsufficientQuery e) { <START> Log.e(Constants.TAG, "InsufficientQuery", e); <END> mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.QueryException e) { Log.e(Constants.TAG, "QueryException", e); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.TooManyResponses e) { Log.e(Constants.TAG, "TooManyResponses", e); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } }</code><technical_language>remove Log.e(), logging in production builds real errors. I included in KeyserverLoader is fault. remove there? :)</technical_language>

Target:
private void queryServer(String query) { KeybaseKeyServer server = new KeybaseKeyServer(); try { ArrayList<ImportKeysListEntry> searchResult = server.search(query); mEntryList.clear(); mEntryList.addAll(searchResult); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, null); } catch (KeyServer.InsufficientQuery e) { mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.QueryException e) { mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } catch (KeyServer.TooManyResponses e) { mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e); } }
Source:
<code><START> public QuerySensitiveTreeElementWrapper(QuerySensitiveTreeElement<T> wrapped, QueryContext context) { <END> this.wrapped = wrapped; this.context = context; }</code><technical_language>this a private constructor</technical_language>

Target:
private QuerySensitiveTreeElementWrapper(QuerySensitiveTreeElement<T> wrapped, QueryContext context) { this.wrapped = wrapped; this.context = context; }
Source:
<code>public ChassisIdle(Chassis chassis) { this.selfChassis = chassis; Motor[] motors = chassis.getMotors(); <START> for (Motor motor : motors) <END> { addCommands(new MotorIdle(motor)); } }</code><technical_language>format</technical_language>

Target:
public ChassisIdle(Chassis chassis) { this("ChassisIdle", chassis); }
Source:
<code>protected String createJobName(String cmd, InterpreterContext context) { String pTitle = context.getParagraphTitle(); if (!StringUtils.isEmpty(pTitle)) { return pTitle; } else { String[] lines = cmd.split("\n"); <START> return lines[lines.length - 1]; <END> } }</code><technical_language>is end some unexpected characters, eg. STORE same1 '/tmp/tutorial-join-results' PigStorage(); / () ;</technical_language>

Target:
protected String createJobName(String cmd, InterpreterContext context) { String pTitle = context.getParagraphTitle(); if (!StringUtils.isBlank(pTitle)) { return pTitle; } else { String[] lines = cmd.split("\n"); for (int i = lines.length - 1; i >= 0; --i) { if (!StringUtils.isBlank(lines[i])) { return lines[i]; } } return "empty_job"; } }
Source:
<code>public <T extends DiscoverySelector> List<T> getSelectorsByType(Class<T> selectorType) { info(() -> "Getting selectors from sub-request for: " + selectorType); return Stream.concat(request.getSelectorsByType(selectorType) .stream() .filter(selector -> !(selector instanceof ClassSelector || selector instanceof MethodSelector || selector instanceof BundleSelector)), selectors.stream() .filter(selector -> selectorType.isInstance(selector) && !(selector instanceof BundleSelector))) .map(selectorType::cast) .collect(toList()); <START> } <END></code><technical_language>wondering if a useful optimisation retain this a short-circuit main return statement</technical_language>

Target:
public <T extends DiscoverySelector> List<T> getSelectorsByType(Class<T> selectorType) { info(() -> "Getting selectors from sub-request for: " + selectorType); return Stream.concat( request.getSelectorsByType(selectorType) .stream() .filter(selector -> !(selector instanceof ClassSelector || selector instanceof MethodSelector || selector instanceof BundleSelector)), selectors.stream() .filter(selectorType::isInstance)) .map(selectorType::cast) .collect(toList()); }
Source:
<code>@Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn, String[] tblTypes) throws SQLException { conn.ensureNotClosed(); final List<JdbcColumnMeta> meta = Arrays.asList( new JdbcColumnMeta(null, null, "TABLE_CAT", String.class), new JdbcColumnMeta(null, null, "TABLE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TABLE_NAME", String.class), new JdbcColumnMeta(null, null, "TABLE_TYPE", String.class), new JdbcColumnMeta(null, null, "REMARKS", String.class), new JdbcColumnMeta(null, null, "TYPE_CAT", String.class), new JdbcColumnMeta(null, null, "TYPE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TYPE_NAME", String.class), new JdbcColumnMeta(null, null, "SELF_REFERENCING_COL_NAME", String.class), new JdbcColumnMeta(null, null, "REF_GENERATION", String.class)); boolean tblTypeMatch = false; if (tblTypes == null) tblTypeMatch = true; else { for (String type : tblTypes) { if (TYPE_TABLE.equals(type) || TYPE_VIEW.equals(type)) { tblTypeMatch = true; break; } } } if (!isValidCatalog(catalog) || !tblTypeMatch) return new JdbcThinResultSet(Collections.<List<Object>>emptyList(), meta); <START> JdbcMetaTablesResult res = conn.sendRequest(new JdbcMetaTablesRequest(schemaPtrn, tblNamePtrn, tblTypes)). <END> response(); List<List<Object>> rows = new LinkedList<>(); for (JdbcTableMeta tblMeta : res.meta()) rows.add(tableRow(tblMeta)); return new JdbcThinResultSet(rows, meta); }</code><technical_language>code style . preceding method call (method response) line method name</technical_language>

Target:
@Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn, String[] tblTypes) throws SQLException { conn.ensureNotClosed(); final List<JdbcColumnMeta> meta = asList( new JdbcColumnMeta(null, null, "TABLE_CAT", String.class), new JdbcColumnMeta(null, null, "TABLE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TABLE_NAME", String.class), new JdbcColumnMeta(null, null, "TABLE_TYPE", String.class), new JdbcColumnMeta(null, null, "REMARKS", String.class), new JdbcColumnMeta(null, null, "TYPE_CAT", String.class), new JdbcColumnMeta(null, null, "TYPE_SCHEM", String.class), new JdbcColumnMeta(null, null, "TYPE_NAME", String.class), new JdbcColumnMeta(null, null, "SELF_REFERENCING_COL_NAME", String.class), new JdbcColumnMeta(null, null, "REF_GENERATION", String.class)); boolean tblTypeMatch = false; if (tblTypes == null) tblTypeMatch = true; else { for (String type : tblTypes) { if (TYPE_TABLE.equals(type) || TYPE_VIEW.equals(type)) { tblTypeMatch = true; break; } } } if (!isValidCatalog(catalog) || !tblTypeMatch) return new JdbcThinResultSet(Collections.<List<Object>>emptyList(), meta); JdbcMetaTablesResult res = conn.sendRequest(new JdbcMetaTablesRequest(schemaPtrn, tblNamePtrn, tblTypes)) .response(); List<List<Object>> rows = new LinkedList<>(); for (JdbcTableMeta tblMeta : res.meta()) rows.add(tableRow(tblMeta)); return new JdbcThinResultSet(rows, meta); }
Source:
<code>public TimeLockServices createTimeLockServices( String client, Supplier<ManagedTimestampService> rawTimestampServiceSupplier, Supplier<RemoteLockService> rawLockServiceSupplier) { AsyncOrLegacyTimelockService asyncOrLegacyTimelockService; AsyncTimelockService asyncTimelockService = instrumentInLeadershipProxy( AsyncTimelockService.class, () -> AsyncTimeLockServicesCreator.createRawAsyncTimelockService(client, rawTimestampServiceSupplier), client); asyncOrLegacyTimelockService = AsyncOrLegacyTimelockService.createFromAsyncTimelock( new AsyncTimelockResource(asyncTimelockService)); Supplier<RemoteLockService> lockServiceSupplier = asyncLockConfiguration.disableLegacySafetyChecksWarningPotentialDataCorruption() ? rawLockServiceSupplier : JavaSuppliers.compose(NonTransactionalLockService::new, rawLockServiceSupplier); return TimeLockServices.create( asyncTimelockService, <START> instrumentInLeadershipProxy(RemoteLockService.class, lockServiceSupplier, client), <END> asyncOrLegacyTimelockService, asyncTimelockService); }</code><technical_language>nit: move leader proxy wrapping above, code structure for wrapping is more uniform for lock / timestamp</technical_language>

Target:
public TimeLockServices createTimeLockServices( String client, Supplier<ManagedTimestampService> rawTimestampServiceSupplier, Supplier<RemoteLockService> rawLockServiceSupplier) { AsyncOrLegacyTimelockService asyncOrLegacyTimelockService; AsyncTimelockService asyncTimelockService = instrumentInLeadershipProxy( AsyncTimelockService.class, () -> AsyncTimeLockServicesCreator.createRawAsyncTimelockService(client, rawTimestampServiceSupplier), client); asyncOrLegacyTimelockService = AsyncOrLegacyTimelockService.createFromAsyncTimelock( new AsyncTimelockResource(asyncTimelockService)); RemoteLockService remoteLockService = instrumentInLeadershipProxy( RemoteLockService.class, asyncLockConfiguration.disableLegacySafetyChecksWarningPotentialDataCorruption() ? rawLockServiceSupplier : JavaSuppliers.compose(NonTransactionalLockService::new, rawLockServiceSupplier), client); return TimeLockServices.create( asyncTimelockService, remoteLockService, asyncOrLegacyTimelockService, asyncTimelockService); }