auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Topup retrieve(String id, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { <START> return request(RequestMethod.GET, instanceURL(Topup.class, id), null, Topup.class, options); <END> }</code><technical_language>this implemented method: <pre> public static Topup retrieve(String id, Map<String, Object> params, RequestOptions options); </pre></technical_language>

Target:
public static Topup retrieve(String id, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { return retrieve(id, null, options); }
Source:
<code>public @Nullable DataRadioStation getBestNameMatch(String query) { DataRadioStation bestStation = null; query = query.toUpperCase(); double smallesDistance = Double.MAX_VALUE; for (DataRadioStation station : listStations) { <START> Cosine distMeasure = new Cosine(); <END> double distance = distMeasure.distance(station.Name.toUpperCase(), query); if (distance < smallesDistance) { bestStation = station; smallesDistance = distance; } } return bestStation; }</code><technical_language>created loop</technical_language>

Target:
public @Nullable DataRadioStation getBestNameMatch(String query) { DataRadioStation bestStation = null; query = query.toUpperCase(); double smallesDistance = Double.MAX_VALUE; Cosine distMeasure = new Cosine(); for (DataRadioStation station : listStations) { double distance = distMeasure.distance(station.Name.toUpperCase(), query); if (distance < smallesDistance) { bestStation = station; smallesDistance = distance; } } return bestStation; }
Source:
<code>public static int calculateBlockSizeInBytes(long breakerLimit, int shardsUsedOnNode) { int blockSize = Math.min((int) (breakerLimit * BREAKER_LIMIT_PERCENTAGE), MAX_BLOCK_SIZE_IN_BYTES); <START> return Math.max(100, blockSize / Math.max(shardsUsedOnNode, 1)); <END> }</code><technical_language>100 from</technical_language>

Target:
public static int calculateBlockSizeInBytes(long breakerLimit, int shardsUsedOnNode) { int blockSize = Math.min((int) (breakerLimit * BREAKER_LIMIT_PERCENTAGE), MAX_BLOCK_SIZE_IN_BYTES); return blockSize / Math.max(shardsUsedOnNode, 1); }
Source:
<code>public String[] transform(final InputRow inputRow) { String subtractedString = inputRow.getValue(baseColumn); for (final InputColumn<?> inputColumn : substringColumns) { <START> if (inputColumn.getDataType() == List.class) { <END> final List<?> list = (List) inputRow.getValue(inputColumn); for (final Object element : list) { subtractedString = subtract(subtractedString, element); } } else { subtractedString = subtract(subtractedString, inputRow.getValue(inputColumn)); } } return new String[] { subtractedString }; }</code><technical_language>previous remark line :)</technical_language>

Target:
public String[] transform(final InputRow inputRow) { String subtractedString = inputRow.getValue(baseColumn); for (final InputColumn<?> inputColumn : substringColumns) { final Object value = inputRow.getValue(inputColumn); if (value instanceof List) { for (final Object element : (List<?>) value) { subtractedString = subtract(subtractedString, element); } } else { subtractedString = subtract(subtractedString, value); } } return new String[] { subtractedString }; }
Source:
<code><START> public Builder setIdentity(PrivateKey privateKey, Certificate[] certificateChain, <END> CertificateType... certificateTypes) { if (privateKey == null) { throw new NullPointerException("The private key must not be null"); } else if (certificateChain == null) { throw new NullPointerException("The certificate chain must not be null"); } else if (certificateChain.length < 1) { throw new IllegalArgumentException("The certificate chain must not be empty"); } else { config.privateKey = privateKey; config.certChain = toX509Certificates(certificateChain); config.publicKey = config.certChain[0].getPublicKey(); if (certificateTypes == null || certificateTypes.length == 0) { config.identityCertificateTypes = new ArrayList<>(1); config.identityCertificateTypes.add(CertificateType.X_509); } else { config.identityCertificateTypes = Arrays.asList(certificateTypes); if (!config.identityCertificateTypes.contains(CertificateType.X_509)) { config.certChain = null; } } return this; } }</code><technical_language>I missed implement this ? java if (certificateTypes == null return setIdentity(privateKey, certificateChain, null) else return setIdentity(privateKey, certificateChain, Arrays.asList(certificateTypes))</technical_language>

Target:
public Builder setIdentity(PrivateKey privateKey, Certificate[] certificateChain, CertificateType... certificateTypes) { if (certificateTypes == null) { return setIdentity(privateKey, certificateChain, (List<CertificateType>) null); } else { return setIdentity(privateKey, certificateChain, Arrays.asList(certificateTypes)); } }
Source:
<code>protected void readExternalData(byte protoVer, ObjectInput in) throws IOException { int len = in.readInt(); <START> keys = new String[len]; <END> valBytesArray = new byte[len][]; for (int i = 0; i < len; i++) { keys[i] = U.readString(in); valBytesArray[i] = U.readByteArray(in); } }</code><technical_language>Do need empty arrays in case if len == 0</technical_language>

Target:
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException { int len = in.readInt(); keys = new String[len]; valBytesArr = new byte[len][]; for (int i = 0; i < len; i++) { keys[i] = U.readString(in); valBytesArr[i] = U.readByteArray(in); } }
Source:
<code>void close() throws Exception { final ErrorHandler errorHandler = mock(ErrorHandler.class); final CountedErrorHandler countedErrorHandler = mock(CountedErrorHandler.class); final MediaDriver driver = mock(MediaDriver.class); when(driver.context()).thenReturn(new MediaDriver.Context().errorHandler(errorHandler)); final AssertionError driverException = new AssertionError("driver"); throwOnClose(driver, driverException); final Archive archive = mock(Archive.class); when(archive.context()).thenReturn(new Archive.Context().countedErrorHandler(countedErrorHandler)); final ArithmeticException archiveException = new ArithmeticException("archive"); throwOnClose(archive, archiveException); final ClusterBackup clusterBackup = mock(ClusterBackup.class); <START> final BatchUpdateException clusterBackupException = new BatchUpdateException(); <END> throwOnClose(clusterBackup, clusterBackupException); final ClusterBackupMediaDriver clusterBackupMediaDriver = new ClusterBackupMediaDriver(driver, archive, clusterBackup); final AssertionError ex = assertThrows(AssertionError.class, clusterBackupMediaDriver::close); assertSame(driverException, ex); final InOrder inOrder = inOrder(errorHandler, countedErrorHandler); inOrder.verify(countedErrorHandler).onError(clusterBackupException); inOrder.verify(errorHandler).onError(archiveException); inOrder.verifyNoMoreInteractions(); }</code><technical_language>Is BatchUpdateException type correct</technical_language>

Target:
void close() throws Exception { final ErrorHandler errorHandler = mock(ErrorHandler.class); final CountedErrorHandler countedErrorHandler = mock(CountedErrorHandler.class); final MediaDriver driver = mock(MediaDriver.class); when(driver.context()).thenReturn(new MediaDriver.Context().errorHandler(errorHandler)); final AssertionError driverException = new AssertionError("driver"); throwOnClose(driver, driverException); final Archive archive = mock(Archive.class); when(archive.context()).thenReturn(new Archive.Context().countedErrorHandler(countedErrorHandler)); final ArithmeticException archiveException = new ArithmeticException("archive"); throwOnClose(archive, archiveException); final ClusterBackup clusterBackup = mock(ClusterBackup.class); final IllegalStateException clusterBackupException = new IllegalStateException(); throwOnClose(clusterBackup, clusterBackupException); final ClusterBackupMediaDriver clusterBackupMediaDriver = new ClusterBackupMediaDriver(driver, archive, clusterBackup); final AssertionError ex = assertThrows(AssertionError.class, clusterBackupMediaDriver::close); assertSame(driverException, ex); final InOrder inOrder = inOrder(errorHandler, countedErrorHandler); inOrder.verify(countedErrorHandler).onError(clusterBackupException); inOrder.verify(errorHandler).onError(archiveException); inOrder.verifyNoMoreInteractions(); }
Source:
<code>public static <V extends Persistable & Versionable> PaxosStateLog<V> createWithMigration( PaxosStorageParameters params, Persistable.Hydrator<V> hydrator, LegacyOperationMarkers legacyOperationMarkers, OptionalLong migrateFrom) { String logDirectory = params.fileBasedLogDirectory() .orElseThrow(() -> new SafeIllegalStateException("We currently need to have file-based storage")); NamespaceAndUseCase namespaceUseCase = params.namespaceAndUseCase(); PaxosStateLogMigrator.MigrationContext<V> migrationContext = ImmutableMigrationContext.<V>builder() .sourceLog(new PaxosStateLogImpl<>(logDirectory)) .destinationLog(SqlitePaxosStateLog.create(namespaceUseCase, params.sqliteDataSource())) .hydrator(hydrator) .migrationState(SqlitePaxosStateLogMigrationState.create(namespaceUseCase, params.sqliteDataSource())) .migrateFrom(migrateFrom) .build(); Instant start = Instant.now(); log.info("Starting migration for namespace and use case {}.", SafeArg.of("namespaceAndUseCase", params.namespaceAndUseCase())); long cutoff = PaxosStateLogMigrator.migrateAndReturnCutoff(migrationContext); log.info("Migration for namespace and use case took {}.", SafeArg.of("namespaceAndUseCase", params.namespaceAndUseCase()), SafeArg.of("duration", Duration.between(start, Instant.now()))); SplittingParameters<V> splittingParameters = ImmutableSplittingParameters.<V>builder() .legacyLog(migrationContext.sourceLog()) .currentLog(migrationContext.destinationLog()) .cutoffInclusive(cutoff) .legacyOperationMarkers(legacyOperationMarkers) .build(); <START> return SplittingPaxosStateLog.create(splittingParameters); <END> }</code><technical_language>OK. need a piece blocks startup this is called for namespaces (but I guess handled elsewhere)</technical_language>

Target:
public static <V extends Persistable & Versionable> PaxosStateLog<V> createWithMigration( PaxosStorageParameters params, Persistable.Hydrator<V> hydrator, LegacyOperationMarkers legacyOperationMarkers, OptionalLong migrateFrom) { String logDirectory = params.fileBasedLogDirectory() .orElseThrow(() -> new SafeIllegalStateException("We currently need to have file-based storage")); NamespaceAndUseCase namespaceUseCase = params.namespaceAndUseCase(); PaxosStateLogMigrator.MigrationContext<V> migrationContext = ImmutableMigrationContext.<V>builder() .sourceLog(PaxosStateLogImpl.createFileBacked(logDirectory)) .destinationLog(SqlitePaxosStateLog.create(namespaceUseCase, params.sqliteDataSource())) .hydrator(hydrator) .migrationState(SqlitePaxosStateLogMigrationState.create(namespaceUseCase, params.sqliteDataSource())) .migrateFrom(migrateFrom) .build(); log.info("Starting migration for namespace and use case if migration has not run before.", SafeArg.of("namespaceAndUseCase", params.namespaceAndUseCase())); long cutoff = PaxosStateLogMigrator.migrateAndReturnCutoff(migrationContext); SplittingParameters<V> splittingParameters = ImmutableSplittingParameters.<V>builder() .legacyLog(migrationContext.sourceLog()) .currentLog(migrationContext.destinationLog()) .cutoffInclusive(cutoff) .legacyOperationMarkers(legacyOperationMarkers) .build(); return SplittingPaxosStateLog.create(splittingParameters); }
Source:
<code>public void testDecompressionSkip() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerFrameDeflateDecoder(false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedBinaryFrame = new BinaryWebSocketFrame( true, WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedPayload); assertTrue(decoderChannel.writeInbound(compressedBinaryFrame)); BinaryWebSocketFrame inboundBinaryFrame = decoderChannel.readInbound(); assertNotNull(inboundBinaryFrame); assertNotNull(inboundBinaryFrame.content()); assertEquals(compressedPayload, inboundBinaryFrame.content()); assertEquals(5, inboundBinaryFrame.rsv()); assertTrue(inboundBinaryFrame.release()); <START> assertTrue(encoderChannel.finish()); <END> assertFalse(decoderChannel.finish()); }</code><technical_language>call encoderChannel.finishAndReleaseAll() fix LEAK</technical_language>

Target:
public void testDecompressionSkip() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerFrameDeflateDecoder(false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedBinaryFrame = new BinaryWebSocketFrame( true, WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedPayload); assertTrue(decoderChannel.writeInbound(compressedBinaryFrame)); BinaryWebSocketFrame inboundBinaryFrame = decoderChannel.readInbound(); assertNotNull(inboundBinaryFrame); assertNotNull(inboundBinaryFrame.content()); assertEquals(compressedPayload, inboundBinaryFrame.content()); assertEquals(5, inboundBinaryFrame.rsv()); assertTrue(inboundBinaryFrame.release()); assertTrue(encoderChannel.finishAndReleaseAll()); assertFalse(decoderChannel.finish()); }
Source:
<code>public RebalanceException(String message) { <START> super(message); <END> }</code><technical_language>If need stack trace, consider calling super(message, null, false, false) avoid some overhead</technical_language>

Target:
public RebalanceException(String message) { super(message, null, false, false); }
Source:
<code>public String getFromExpression(ConversionContext conversionContext) { <START> throw new IllegalStateException( "Not supported." ); <END> }</code><technical_language>is this case</technical_language>

Target:
public String getFromExpression(ConversionContext conversionContext) { return bigDecimal( conversionContext ) + ".valueOf( <SOURCE> )"; }
Source:
<code>public ImmutableComputableGraph setValue(@Nonnull final String nodeKey, @Nonnull final Duplicable newValue) throws IllegalArgumentException, UnsupportedOperationException { <START> assertNodeExists(Utils.nonNull(nodeKey, "The key of the node can not be null.")); <END> CacheNode node = nodesMap.get(nodeKey); if (!node.isExternallyMutable()) { throw new UnsupportedOperationException("Can not explicitly set the value of a non-primitive cache node."); } final Map<String, CacheNode> updatedNodesMap = new HashMap<>(); updatedNodesMap.put(nodeKey, node.duplicateWithUpdatedValue(newValue)); final ImmutableComputableGraph out = duplicateWithUpdatedNodes( addDuplicateOfOutdatedDescendents(nodeKey, updatedNodesMap)); if (cacheAutoUpdate) { Map<String, Duplicable> accumulatedValues = out.accumulateEvaluationsForDepthSortedNodeList( cgs.getEvalStrategyByMutatedNode(nodeKey), true); return out.updateCachesFromAccumulatedValues(accumulatedValues); } else { return out; } }</code><technical_language>embed non-null check assertNodeExists()</technical_language>

Target:
public ImmutableComputableGraph setValue(@Nonnull final String nodeKey, @Nonnull final Duplicable newValue) throws IllegalArgumentException, UnsupportedOperationException { assertNodeExists(nodeKey); CacheNode node = nodesMap.get(nodeKey); if (!node.isExternallyComputable()) { throw new UnsupportedOperationException("Can not explicitly set the value of a non-primitive cache node."); } final Map<String, CacheNode> updatedNodesMap = new HashMap<>(); updatedNodesMap.put(nodeKey, node.duplicateWithUpdatedValue(newValue)); final ImmutableComputableGraph out = duplicateWithUpdatedNodes( addDuplicateOfOutdatedDescendents(nodeKey, updatedNodesMap)); if (cacheAutoUpdate) { Map<String, Duplicable> accumulatedValues = out.evaluateInTopologicalOrder( cgs.getTopologicalOrderForNodeMutation(nodeKey)); return out.updateCachesFromAccumulatedValues(accumulatedValues); } else { return out; } }
Source:
<code>public URLDownload(URL source) { this.source = source; this.addHeader("User-Agent", URLDownload.USER_AGENT); if (source.toString().contains(Medra.API_URL)) { <START> this.addHeader("Accept", Medra.CONTENT_TYPE_JSON); <END> } }</code><technical_language>application/x-bibtex header for other DOI fetcher well? fetching a lot easier</technical_language>

Target:
public URLDownload(URL source) { this.source = source; this.addHeader("User-Agent", URLDownload.USER_AGENT); }
Source:
<code>ListenableFuture<Void> setZoomPercentage(@FloatRange(from = 0f, to = 1f) float percentage) { synchronized (mActiveLock) { if (!mIsActive) { throw new IllegalStateException( "Camera is not active."); } float clampedPercentage = MathUtils.clamp(percentage, 0.0f, 1.0f); if (getMaxDigitalZoom() == MIN_ZOOM) { clampedPercentage = 0.0f; } float ratio = getRatioByPercentage(clampedPercentage); <START> setLiveDataValue(mZoomPercentageLiveData, <END> clampedPercentage); ListenableFuture<Void> result = setZoomRatioInternal(ratio, false); if (percentage > 1.0f || (percentage < 0f)) { synchronized (mCompleterLock) { mPendingZoomRatioCompleter = null; mPendingZoomCropRegion = null; } String outOfRangeDesc = "Requested zoomPercentage " + percentage + " is not within" + " valid range [0..1]"; result = Futures.immediateFailedFuture( new CameraControl.ArgumentOutOfRangeException(outOfRangeDesc)); Log.w(TAG, outOfRangeDesc); } return result; } }</code><technical_language>update in setZoomRatioInternal()? Is of float rounding error</technical_language>

Target:
ListenableFuture<Void> setZoomPercentage(@FloatRange(from = 0f, to = 1f) float percentage) { synchronized (mActiveLock) { if (!mIsActive) { return Futures.immediateFailedFuture( new OperationCanceledException("Camera is not active.")); } float clampedPercentage = MathUtils.clamp(percentage, 0.0f, 1.0f); if (getMaxDigitalZoom() == MIN_ZOOM) { clampedPercentage = 0.0f; } float ratio = getRatioByPercentage(clampedPercentage); setLiveDataValue(mZoomPercentageLiveData, clampedPercentage); ListenableFuture<Void> result = setZoomRatioInternal(ratio, false); if (percentage > 1.0f || (percentage < 0f)) { synchronized (mCompleterLock) { mPendingZoomRatioCompleter = null; mPendingZoomCropRegion = null; } String outOfRangeDesc = "Requested zoomPercentage " + percentage + " is not within" + " valid range [0..1]"; result = Futures.immediateFailedFuture( new CameraControl.ArgumentOutOfRangeException(outOfRangeDesc)); Log.w(TAG, outOfRangeDesc); } return result; } }
Source:
<code>private static void deleteContestData(DSLContext ctx, long contestPK) { ctx.deleteFrom(CONTEST_TEAM_MEMBER) .where(CONTEST_TEAM_MEMBER.CONTEST_ID.eq(contestPK)) .execute(); ctx.deleteFrom(CONTEST_TRANSLATION) .where(CONTEST_TRANSLATION.CONTEST_ID.eq(contestPK)) .execute(); ctx.deleteFrom(CONTEST_DISCUSSION) .where(CONTEST_DISCUSSION.CONTEST_ID.eq(contestPK)) .execute(); Long threadId = ctx.select(CONTEST.DISCUSSION_GROUP_ID) .from(CONTEST) .where(CONTEST.CONTEST_PK.eq(contestPK)) .fetchOne() <START> .value1(); <END> ctx.deleteFrom(COMMENT) .where(COMMENT.THREAD_ID.eq(threadId)) .execute(); ctx.deleteFrom(THREAD) .where(THREAD.THREAD_ID.eq(threadId)) .execute(); ctx.deleteFrom(ACTIVITY_SUBSCRIPTION) .where(ACTIVITY_SUBSCRIPTION.CLASS_NAME_ID.eq(ActivityEntryType.CONTEST.getPrimaryTypeId())) .and(ACTIVITY_SUBSCRIPTION.CLASS_PK.eq(contestPK)); ctx.deleteFrom(ACTIVITY_ENTRY) .where(ACTIVITY_ENTRY.PRIMARY_TYPE.eq(ActivityEntryType.CONTEST.getPrimaryTypeId())) .and(ACTIVITY_ENTRY.CLASS_PRIMARY_KEY.eq(contestPK)); }</code><technical_language>In another function .fetchInto(Long.class); for consistency into(Long.class) here</technical_language>

Target:
private static void deleteContestData(DSLContext ctx, long contestPK) { ctx.deleteFrom(CONTEST_TEAM_MEMBER) .where(CONTEST_TEAM_MEMBER.CONTEST_ID.eq(contestPK)) .execute(); ctx.deleteFrom(CONTEST_TRANSLATION) .where(CONTEST_TRANSLATION.CONTEST_ID.eq(contestPK)) .execute(); ctx.deleteFrom(CONTEST_DISCUSSION) .where(CONTEST_DISCUSSION.CONTEST_ID.eq(contestPK)) .execute(); Long threadId = ctx.select(CONTEST.DISCUSSION_GROUP_ID) .from(CONTEST) .where(CONTEST.CONTEST_PK.eq(contestPK)) .fetchOne() .into(Long.class); ThreadClientUtil.deleteThread(threadId); ActivitiesClientUtil.batchDelete(ActivityEntryType.CONTEST, Collections.singletonList(contestPK)); }
Source:
<code>public Vector<Integer> getCasesMatchingValueSet(String indexName, String[] targetValueSet) { String[] args = new String[1 + targetValueSet.length]; args[0] = indexName; for(int i =0 ; i < targetValueSet.length ; ++i) { args[i + 1] = targetValueSet[i]; } String inSet = getInSet(targetValueSet.length); if (SqlStorage.STORAGE_OUTPUT_DEBUG) { String query = String.format("SELECT %s FROM %s WHERE %s = ? AND %s in " + inSet, COL_CASE_RECORD_ID, TABLE_NAME, COL_INDEX_NAME, COL_INDEX_TARGET); DbUtil.explainSql(db, query, args); } <START> Cursor c = db.query(TABLE_NAME, new String[]{COL_CASE_RECORD_ID}, COL_INDEX_NAME + " = ? AND " + COL_INDEX_TARGET + " in " + inSet, args, null, null, null); <END> return SqlStorage.fillIdWindow(c, COL_CASE_RECORD_ID); }</code><technical_language>String formatting nice</technical_language>

Target:
public Vector<Integer> getCasesMatchingValueSet(String indexName, String[] targetValueSet) { String[] args = new String[1 + targetValueSet.length]; args[0] = indexName; for (int i = 0; i < targetValueSet.length; ++i) { args[i + 1] = targetValueSet[i]; } String inSet = getArgumentBasedVariableSet(targetValueSet.length); String whereExpr = String.format("%s = ? AND %s IN %s", COL_INDEX_NAME, COL_INDEX_TARGET, inSet); if (SqlStorage.STORAGE_OUTPUT_DEBUG) { String query = String.format("SELECT %s FROM %s WHERE %s", COL_CASE_RECORD_ID, TABLE_NAME, whereExpr); DbUtil.explainSql(db, query, args); } Cursor c = db.query(TABLE_NAME, new String[]{COL_CASE_RECORD_ID}, whereExpr, args, null, null, null); return SqlStorage.fillIdWindow(c, COL_CASE_RECORD_ID); }
Source:
<code>public void deletePolicyByGroup(Group group, AuthorizationPolicy policy) { ioService.startBatch(fileSystem, new CommentedOption("system", "Delete Policy")); try (StringWriter sw = new StringWriter()){ <START> AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller(); <END> NonEscapedProperties entries = new NonEscapedProperties(); marshaller.remove(group, policy, entries); entries.store(sw, "Authorization Policy", "Last update: " + new Date().toString()); String policyContent = sw.toString(); Path policyPath = getAuthzPath().resolve(POLICY_FILE); ioService.write(policyPath, policyContent); } catch (Exception e) { logger.error("Authz policy write error.", e); } finally { ioService.endBatch(); } }</code><technical_language>Consider creating unit test for this public method</technical_language>

Target:
public void deletePolicyByGroup(Group group, AuthorizationPolicy policy) { AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller(); NonEscapedProperties entries = new NonEscapedProperties(); marshaller.remove(group, policy, entries); savePolicyIntoVfs(entries, "system", "Delete Policy"); }
Source:
<code>private static void processSampleQC(String sampleQc, Sample s, User u, QualityControlService qcService) throws Exception { if (!isStringEmptyOrNull(sampleQc)) { try { SampleQC sqc = new SampleQC(); sqc.setSample(s); sqc.setResults(Double.valueOf(sampleQc)); sqc.setCreator(u); sqc.setDate(new Date()); sqc.setType(qcService.getQcType(QcTarget.Sample, "QuBit")); if (s.getQCs().stream().noneMatch(existing -> existing.getType().getQcTypeId() == sqc.getType().getQcTypeId())) { qcService.createQC(sqc); <START> log.info("Added sample QC: {}", sqc.toString()); <END> } } catch (NumberFormatException nfe) { throw new InputFormException("Supplied Sample QC concentration for sample '" + sampleQc + "' is invalid", nfe); } } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Invoke method(s) conditionally. [![rule](<LINK_1>](<LINK_3> ![MAJOR](<LINK_0> 'Severity: MAJOR') need call "toString()" method formatting string conversion is done Formatter. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static void processSampleQC(String sampleQc, Sample s, User u, QualityControlService qcService) throws Exception { if (!isStringEmptyOrNull(sampleQc)) { try { SampleQC sqc = new SampleQC(); sqc.setSample(s); sqc.setResults(Double.valueOf(sampleQc)); sqc.setCreator(u); sqc.setDate(new Date()); sqc.setType(qcService.getQcType(QcTarget.Sample, "QuBit")); if (s.getQCs().stream().noneMatch(existing -> existing.getType().getQcTypeId() == sqc.getType().getQcTypeId())) { qcService.createQC(sqc); log.info("Added sample QC: {}", sqc); } } catch (NumberFormatException nfe) { throw new InputFormException("Supplied Sample QC concentration for sample '" + sampleQc + "' is invalid", nfe); } } }
Source:
<code>public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return Response.fromResponse(attachDiskToVm(disk)) .entity(resolveCreated(Guid.createGuidFromString(disk.getId()), getEntityIdResolver(null), <START> VM.class)).build(); <END> }else { return super.add(disk); } }</code><technical_language>createResource() if wrote resolver-by-id? this code is hard read</technical_language>

Target:
public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return Response.fromResponse(attachDiskToVm(disk)) .entity(lookupEntity(Guid.createGuidFromString(disk.getId()))) .build(); }else { validateParameters(disk, "format", "interface"); if (!disk.isSetLunStorage() || disk.getLunStorage().getLogicalUnits().isEmpty()) { validateParameters(disk, "provisionedSize|size"); } return performCreation(addAction, getAddParameters(map(disk), disk), getEntityIdResolver(disk.getName())); } }
Source:
<code><START> public CatalogEntitySummary getApplication(String applicationId) throws Exception { <END> return getEntity(applicationId); }</code><technical_language>add throws Exception - removed getEntity(), this method delegates to</technical_language>

Target:
public CatalogEntitySummary getApplication(String applicationId) { return getEntity(applicationId); }
Source:
<code>protected List<ForgeTimings<T>> getSortedTimings() { ArrayList<ForgeTimings<T>> list = new ArrayList<>(); list.addAll(tracker.getTimingData()); <START> list.sort((o1, o2) -> Double.compare(o2.getAverageTimings(), o1.getAverageTimings())); <END> return list; }</code><technical_language>java list.sort(Comparator.comparingDouble(ForgeTimings::getAverageTimings).reversed());</technical_language>

Target:
protected List<ForgeTimings<T>> getSortedTimings() { ArrayList<ForgeTimings<T>> list = new ArrayList<>(); list.addAll(tracker.getTimingData()); list.sort(Comparator.comparingDouble(ForgeTimings::getAverageTimings)); Collections.reverse(list); return list; }
Source:
<code>public int hashCode() { return Objects.hash(sqls, sqlFirehoseDatabaseConnector, objectMapper, foldCase); <START> } <END></code><technical_language>EqualsVerifier test please for equals hashcode</technical_language>

Target:
public int hashCode() { return Objects.hash(sqls, sqlFirehoseDatabaseConnector, foldCase); }
Source:
<code>public LogoutResponse buildLogoutResponse( String issuerOrEntityId, String statusCodeValue, String inResponseTo) { if (issuerOrEntityId == null) { throw new IllegalArgumentException("Issuer cannot be null"); } if (statusCodeValue == null) { throw new IllegalArgumentException("Status Code cannot be null"); } return SamlProtocol.createLogoutResponse( SamlProtocol.createIssuer(issuerOrEntityId), SamlProtocol.createStatus(statusCodeValue), inResponseTo, <START> "a" + UUID.randomUUID().toString()); <END> }</code><technical_language>consistent SamlProtocol underscore instead of "a". <LINK_0></technical_language>

Target:
public LogoutResponse buildLogoutResponse( String issuerOrEntityId, String statusCodeValue, String inResponseTo) { Validate.notNull(issuerOrEntityId, ISSUER_CANNOT_BE_NULL_MSG); Validate.notNull(statusCodeValue, "Status Code cannot be null"); return SamlProtocol.createLogoutResponse( SamlProtocol.createIssuer(issuerOrEntityId), SamlProtocol.createStatus(statusCodeValue), inResponseTo, "_" + UUID.randomUUID().toString()); }
Source:
<code>public boolean isAsFileTabOpened() { return seleniumWebDriverHelper .waitVisibilityAndGetAttribute( <START> By.xpath(AS_FILE_BUTTON_XPATH + "/parent::md-tab-item"), "aria-selected") <END> .equals("true"); }</code><technical_language>clear element xpath AS_FILE_BUTTON_XPATH + "/parent::md-tab-item" is linked to</technical_language>

Target:
public boolean isAsFileTabOpened() { final String asFileButtonParentContainer = AS_FILE_BUTTON_XPATH + "/parent::md-tab-item"; return seleniumWebDriverHelper .waitVisibilityAndGetAttribute(By.xpath(asFileButtonParentContainer), "aria-selected") .equals("true"); }
Source:
<code>public TransportConnection(SignalFxEndpoint endpoint, int timeoutMs) { super(endpoint, timeoutMs, new BasicHttpClientConnectionManager()); this.transportRequestConfig = RequestConfig.custom().setSocketTimeout(0) .setConnectionRequestTimeout(this.requestConfig.getConnectionRequestTimeout()) .setConnectTimeout(this.requestConfig.getConnectTimeout()) .setProxy(this.requestConfig.getProxy()).build(); <START> if (log.isDebugEnabled()) { <END> log.debug("constructed request config: " + this.transportRequestConfig.toString()); } }</code><technical_language>need gate logging statements this check (it's log.debug() do), methods calling parameters expensive logging in a hot path. case (and else) drop those</technical_language>

Target:
public TransportConnection(SignalFxEndpoint endpoint, int timeoutMs) { super(endpoint, timeoutMs, new BasicHttpClientConnectionManager()); this.transportRequestConfig = RequestConfig.custom().setSocketTimeout(0) .setConnectionRequestTimeout(this.requestConfig.getConnectionRequestTimeout()) .setConnectTimeout(this.requestConfig.getConnectTimeout()) .setProxy(this.requestConfig.getProxy()).build(); log.debug("constructed request config: {}", this.transportRequestConfig.toString()); }
Source:
<code>public void validate_implicit_unwrapping_having_two_type_parameters_and_only_one_maximally_specific_value_extractor_is_ok() { Validator validator = TestUtil.getConfigurationUnderTest() .addValueExtractor( new UnwrapByDefaultWrapperWithTwoTypeArgumentsFirstValueExtractor() ) .buildValidatorFactory() .getValidator(); Set<ConstraintViolation<BeanWithWrapperWithTwoTypeArguments>> constraintViolations = validator.validate( new BeanWithWrapperWithTwoTypeArguments() ); assertThat( constraintViolations ).containsOnlyViolations( <START> violationOf( Min.class ).withProperty( "wrapper" ) <END> ); }</code><technical_language>this container element node somehow</technical_language>

Target:
public void validate_implicit_unwrapping_having_two_type_parameters_and_only_one_maximally_specific_value_extractor_is_ok() { Validator validator = TestUtil.getConfigurationUnderTest() .addValueExtractor( new UnwrapByDefaultWrapperWithTwoTypeArgumentsFirstValueExtractor() ) .buildValidatorFactory() .getValidator(); Set<ConstraintViolation<BeanWithWrapperWithTwoTypeArguments>> constraintViolations = validator.validate( new BeanWithWrapperWithTwoTypeArguments() ); assertThat( constraintViolations ).containsOnlyViolations( violationOf( Min.class ) .withPropertyPath( pathWith() .property( "wrapper" ) .containerElement( "first", false, null, null, WrapperWithTwoTypeArguments.class, 0 ) ) ); }
Source:
<code>public void testCancelDuringPreparation() throws InterruptedException, ExecutionException { final Props jobProps = new Props(); jobProps.put("command", "echo hello"); jobProps.put("working.dir", "/tmp"); jobProps.put("user.to.proxy", "test"); jobProps.put("azkaban.flow.projectname", "test"); jobProps.put("azkaban.flow.flowid", "test"); jobProps.put("azkaban.job.id", "test"); jobProps.put("azkaban.flow.execid", "1"); final Props sysProps = new Props(); sysProps.put("execute.as.user", "false"); final SleepBeforeRunJob job = new SleepBeforeRunJob("test", sysProps, jobProps, this.log); final ExecutorService executorService = Executors.newSingleThreadExecutor(); final Future future = executorService.submit(job); Thread.sleep(2000); try { this.job.cancel(); } catch (final Exception e) { this.log.error(e.getMessage()); } future.get(); <START> assertEquals(this.job.getProgress(), 0.0, 0.001); <END> }</code><technical_language>nit: @HappyRay suggested, try assertj</technical_language>

Target:
public void testCancelDuringPreparation() throws InterruptedException, ExecutionException { final Props jobProps = new Props(); jobProps.put("command", "echo hello"); jobProps.put("working.dir", "/tmp"); jobProps.put("user.to.proxy", "test"); jobProps.put("azkaban.flow.projectname", "test"); jobProps.put("azkaban.flow.flowid", "test"); jobProps.put("azkaban.job.id", "test"); jobProps.put("azkaban.flow.execid", "1"); final Props sysProps = new Props(); sysProps.put("execute.as.user", "false"); final SleepBeforeRunJob sleepBeforeRunJob = new SleepBeforeRunJob("test", sysProps, jobProps, this.log); final ExecutorService executorService = Executors.newSingleThreadExecutor(); final Future future = executorService.submit(sleepBeforeRunJob); Thread.sleep(1000); assertThatThrownBy(() -> sleepBeforeRunJob.cancel()).hasMessage("Not started."); future.get(); assertThat(sleepBeforeRunJob.getProgress()).isEqualTo(0.0); }
Source:
<code><START> public static String resolveSymlink(@Nonnull File link) throws IOException { <END> try { Path path = link.toPath(); return Files.readSymbolicLink(path).toString(); } catch (UnsupportedOperationException | FileSystemException x) { return null; } catch (IOException x) { throw x; } catch (Exception x) { throw new IOException(x); } }</code><technical_language>source compatible IIRC (javac fails is a catch block for impossible exception), impact PCT. usages of externally, e.g. in Support Core plugin: <LINK_0> I propose detach a separate PR if feel important enough</technical_language>

Target:
public static String resolveSymlink(@Nonnull File link) throws IOException { try { Path path = fileToPath(link); return Files.readSymbolicLink(path).toString(); } catch (UnsupportedOperationException | FileSystemException x) { return null; } catch (IOException x) { throw x; } catch (Exception x) { throw new IOException(x); } }
Source:
<code>public void testValueForNestedXrefDefaultDepth() { Entity gender = new DynamicEntity(genderEntityType); gender.set("id", "1"); gender.set("label", "male"); Entity person = new DynamicEntity(personGenderEntityType); person.set("gender", gender); Object scriptExceptionObj = jsMagmaScriptEvaluator.eval("$('gender.xref.label').value()", person); assertEquals(scriptExceptionObj.toString(), <START> "javax.script.ScriptException: TypeError: Cannot read property \"label\" from undefined in <eval> at line number 431"); <END> }</code><technical_language>expose internal ScriptException instead of ScriptException depend Java scripting API</technical_language>

Target:
public void testValueForNestedXrefDefaultDepth() { Entity gender = new DynamicEntity(genderEntityType); gender.set("id", "1"); gender.set("label", "male"); Entity person = new DynamicEntity(personGenderEntityType); person.set("gender", gender); Object scriptExceptionObj = jsMagmaScriptEvaluator.eval("$('gender.xref.label').value()", person); assertEquals(scriptExceptionObj.toString(), "org.molgenis.script.core.ScriptException: <eval>:434 TypeError: Cannot read property \"label\" from undefined"); }
Source:
<code>public List<String> getTags() { <START> return tags; <END> }</code><technical_language>Change unmodifiableSet if switch a set. suggestion return Collections.unmodifiableList(tags);</technical_language>

Target:
public List<String> getTags() { return Collections.unmodifiableList(tags); }
Source:
<code>private void updateProblemIndication(Diagnostic diagnostic) { Assert.isNotNull(diagnostic); int lastEditorPage = getPageCount() - 1; if (lastEditorPage >= 0 && getItemControl(lastEditorPage) instanceof ProblemIndicationComposite) { ((ProblemIndicationComposite)getItemControl(lastEditorPage)).setDiagnostic(diagnostic); <START> if (diagnostic.getSeverity() != Diagnostic.OK && diagnostic.getSeverity() != Diagnostic.WARNING) { setActivePage(lastEditorPage); updateLayout(false, true); } <END> } else if (diagnostic.getSeverity() != Diagnostic.OK && !getControl().isDisposed()) { ProblemIndicationComposite problemIndicationComposite = new ProblemIndicationComposite( getControl(), SWT.NONE); problemIndicationComposite.setDiagnostic(diagnostic); createItem(++lastEditorPage, problemIndicationComposite); getControl().getItem(lastEditorPage) .setText(CommonUIPlugin.getPlugin().getString("_UI_Problems_label")); if (diagnostic.getSeverity() != Diagnostic.WARNING) { setActivePage(lastEditorPage); updateLayout(false, true); } showTabs(); } }</code><technical_language>Is move lines 1380 1383 outer if-clause remove lines 1391 1394</technical_language>

Target:
private void updateProblemIndication(Diagnostic diagnostic) { ProblemIndicationComposite problemIndicationComposite = getProblemIndicationFor(diagnostic); if (problemIndicationComposite != null) { problemIndicationComposite.setDiagnostic(diagnostic); if (diagnostic.getSeverity() != Diagnostic.OK && diagnostic.getSeverity() != Diagnostic.WARNING) { int lastEditorPage = getPageCount() - 1; setActivePage(lastEditorPage); updateLayout(false, true); } } }
Source:
<code>public void addContainedEntity(IndexedTypeIdentifier entity) { final IndexedTypesSet oldSet = containedEntityTypes; final IndexedTypesSet newSet = IndexedTypesSets.composite( oldSet, entity ); <START> if ( ! oldSet.equals( newSet ) ) { <END> this.containedEntityTypes = newSet; triggerWorkspaceReconfiguration(); } }</code><technical_language>simply if ( !oldSet.contains( entity ) )</technical_language>

Target:
public void addContainedEntity(IndexedTypeIdentifier entity) { final IndexedTypeSet oldSet = containedEntityTypes; final IndexedTypeSet newSet = IndexedTypesSets.composite( oldSet, entity ); if ( ! oldSet.equals( newSet ) ) { this.containedEntityTypes = newSet; triggerWorkspaceReconfiguration(); } }
Source:
<code>public final void write(String mountPath, boolean shuttingDown) throws IOException, ReplicationException { long writeStartTimeMs = SystemTime.getInstance().milliseconds(); List<ReplicaTokenInfo> tokensPersisted = new ArrayList<>(); for (PartitionInfo info : partitionGroupedByMountPath.get(mountPath)) { for (RemoteReplicaInfo remoteReplica : info.getRemoteReplicaInfos()) { FindToken tokenToPersist = remoteReplica.getTokenToPersist(); if (tokenToPersist != null) { tokensPersisted.add(new ReplicaTokenInfo(remoteReplica)); } } } try { <START> persistTokens(mountPath, tokensPersisted); <END> } finally { replicationMetrics.remoteReplicaTokensPersistTime.update( SystemTime.getInstance().milliseconds() - writeStartTimeMs); } for (ReplicaTokenInfo replicaTokenInfo : tokensPersisted) { replicaTokenInfo.getReplicaInfo().onTokenPersisted(); if (shuttingDown) { logger.info("Persisted token {}", replicaTokenInfo.getReplicaToken()); } } }</code><technical_language>called write persist</technical_language>

Target:
public final void write(String mountPath, boolean shuttingDown) throws IOException, ReplicationException { long writeStartTimeMs = SystemTime.getInstance().milliseconds(); List<ReplicaTokenInfo> tokensPersisted = new ArrayList<>(); for (PartitionInfo info : partitionGroupedByMountPath.get(mountPath)) { for (RemoteReplicaInfo remoteReplica : info.getRemoteReplicaInfos()) { FindToken tokenToPersist = remoteReplica.getTokenToPersist(); if (tokenToPersist != null) { tokensPersisted.add(new ReplicaTokenInfo(remoteReplica)); } } } try { persist(mountPath, tokensPersisted); } finally { replicationMetrics.remoteReplicaTokensPersistTime.update( SystemTime.getInstance().milliseconds() - writeStartTimeMs); } for (ReplicaTokenInfo replicaTokenInfo : tokensPersisted) { replicaTokenInfo.getReplicaInfo().onTokenPersisted(); if (shuttingDown) { logger.info("Persisted token {}", replicaTokenInfo.getReplicaToken()); } } }
Source:
<code>public List<SMREntry> current() { ILogData data = streamView.current(); <END> <START> if (data != null && data.isHole()) { throw new HoleInStreamException(); } if (data == null || data.getType() != DataType.DATA || !(data.getPayload(runtime) instanceof ISMRConsumable)) { return Collections.emptyList(); } return ((ISMRConsumable) data.getPayload(runtime)).getSMRUpdates(streamView.getId()); }</code><technical_language>signaling this condition exception, a approach a globally unique instance signals a hole</technical_language>

Target:
public List<SMREntry> current() { ILogData data = streamView.current(); if (data == null || data.getType() != DataType.DATA || !(data.getPayload(runtime) instanceof ISMRConsumable)) { return Collections.emptyList(); } return ((ISMRConsumable) data.getPayload(runtime)).getSMRUpdates(streamView.getId()); }
Source:
<code>@Test public void testDistinctCountOnMetricRenamed() { String sql = "select \"B\", count(distinct \"A\") from " + "(select \"unit_sales\" as \"A\", \"store_state\" as \"B\" from \"foodmart\") " + "group by \"B\""; String expectedSubExplain = "PLAN=EnumerableInterpreter\n" + " BindableAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n" + " DruidQuery(table=[[foodmart, foodmart]], " + "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], groups=[{63, 89}], " + "aggs=[[]])\n" + "\n" <START> + ""; <END> testCountWithApproxDistinct(true, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); testCountWithApproxDistinct(false, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); }</code><technical_language>concat empty str</technical_language>

Target:
@Test public void testDistinctCountOnMetricRenamed() { String sql = "select \"B\", count(distinct \"A\") from " + "(select \"unit_sales\" as \"A\", \"store_state\" as \"B\" from \"foodmart\") " + "group by \"B\""; String expectedSubExplain = "PLAN=EnumerableInterpreter\n" + " BindableAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n" + " DruidQuery(table=[[foodmart, foodmart]], " + "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], groups=[{63, 89}], " + "aggs=[[]])"; testCountWithApproxDistinct(true, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); testCountWithApproxDistinct(false, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); }
Source:
<code>public Response addCloudConfig(@PathParam("clusterId") String clusterId, String content) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { return notFound("Cluster is not properly setup!"); } HelixAdmin admin = getHelixAdmin(); ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } try { CloudConfig cloudConfig = new CloudConfig.Builder(record).build(); admin.addCloudConfig(clusterId, cloudConfig); } catch (HelixException ex) { _logger.error("Error in adding a CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } catch (Exception ex) { _logger.error("Cannot add CloudConfig to cluster: " + clusterId, ex); <START> return badRequest(ex.getMessage()); <END> } return OK(); }</code><technical_language>This is badRequest. related internal server error</technical_language>

Target:
public Response addCloudConfig(@PathParam("clusterId") String clusterId, String content) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { return notFound("Cluster is not properly setup!"); } HelixAdmin admin = getHelixAdmin(); ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } try { CloudConfig cloudConfig = new CloudConfig.Builder(record).build(); admin.addCloudConfig(clusterId, cloudConfig); } catch (HelixException ex) { _logger.error("Error in adding a CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } catch (Exception ex) { _logger.error("Cannot add CloudConfig to cluster: " + clusterId, ex); return serverError(ex); } return OK(); }
Source:
<code>protected boolean isBlockingUserInput() { View cover = this.findViewById(R.id.form_entry_cover); if(cover != null && cover.getVisibility() == View.VISIBLE) { return true; } else { return false; <START> } <END> }</code><technical_language>change return cover != null && cover.getVisibility() == View.VISIBLE</technical_language>

Target:
protected boolean isBlockingUserInput() { View cover = this.findViewById(R.id.form_entry_cover); return cover != null && cover.getVisibility() == View.VISIBLE; }
Source:
<code>private static void addVarArgTypeSignature(TypeSignature typeSignature, Map<String, TypeVariableConstraint> typeVariableConstraints, List<TypeSignature> builder, int actualArity) { TypeVariableConstraint typeVariableConstraint = resolveTypeVariableConstraint( typeSignature, typeVariableConstraints ); if (typeVariableConstraint != null && typeVariableConstraint.isAnyAllowed()) { var newConstraintName = "_generated_" + typeVariableConstraint + actualArity; TypeSignature newTypeSignature; if (typeSignature.getParameters().isEmpty()) { <START> newTypeSignature = new TypeSignature(newConstraintName); <END> } else { newTypeSignature = replaceTypeVariable( typeSignature, typeVariableConstraint.getName(), newConstraintName ); } typeVariableConstraints.put(newConstraintName, typeVariableOfAnyType(newConstraintName)); builder.add(newTypeSignature); } else { builder.add(typeSignature); } }</code><technical_language>this case result in here? <LINK_0> replaceTypeVariable()</technical_language>

Target:
private static void addVarArgTypeSignature(TypeSignature typeSignature, Map<String, TypeVariableConstraint> typeVariableConstraints, List<TypeSignature> builder, int actualArity) { TypeVariableConstraint typeVariableConstraint = resolveTypeVariableConstraint( typeSignature, typeVariableConstraints ); if (typeVariableConstraint != null && typeVariableConstraint.isAnyAllowed()) { var newConstraintName = "_generated_" + typeVariableConstraint + actualArity; var newTypeSignature = replaceTypeVariable( typeSignature, typeVariableConstraint.getName(), newConstraintName ); typeVariableConstraints.put(newConstraintName, typeVariableOfAnyType(newConstraintName)); builder.add(newTypeSignature); } else { builder.add(typeSignature); } }
Source:
<code>public void onPageScrolled(int oldScrollY, int scrollY, boolean isHumanScroll) { <START> oldScrollY = (int) (oldScrollY / app.getScreenDensity()); <END> scrollY = (int) (scrollY / app.getScreenDensity()); if (isHumanScroll) { if (scrollY > oldScrollY) { scrollFluxDown += (scrollY - oldScrollY); } else { scrollFluxUp += (oldScrollY - scrollY); } } if (scrollY > pageHeightReached) { pageHeightReached = scrollY; } }</code><technical_language>I if this simplify complicate code consider deferring division log time</technical_language>

Target:
public void onPageScrolled(int oldScrollY, int scrollY, boolean isHumanScroll) { if (isHumanScroll) { if (scrollY > oldScrollY) { scrollFluxDown += (scrollY - oldScrollY); } else { scrollFluxUp += (oldScrollY - scrollY); } } maxScrollY = Math.max(maxScrollY, scrollY); }