auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void importToTruststore() { if (MapUtils.isEmpty(listIntermediate) || null == uploadedFileRoot || StringUtils.isBlank(alias)) { <START> HelperUtil.addMessageError(null, "Alias, Intermediate and Root are required."); <END> return; } SimpleCertificateResponseMessageType response = service.importToTruststore(alias, listIntermediate, uploadedFileRoot); if (null == response) { HelperUtil.addMessageError(null, "Fail to import to truststore."); } else if (response.isStatus()) { HelperUtil.addMessageInfo(null, "Import to truststore is successful"); } else { HelperUtil.addMessageError(null, response.getMessage()); } }</code><technical_language>message more clear</technical_language>

Target:
public void importToTruststore() { if (MapUtils.isEmpty(listIntermediate) || null == uploadedFileRoot || StringUtils.isBlank(alias)) { HelperUtil.addMessageError(null, "Alias, CA Root and CA Intermediate are required."); return; } SimpleCertificateResponseMessageType response = service.importToTruststore(alias, listIntermediate, uploadedFileRoot); if (null == response) { HelperUtil.addMessageError(null, "Fail to import to temporary truststore."); } else if (response.isStatus()) { HelperUtil.addMessageInfo(null, "Import to temporary truststore is successful"); } else { HelperUtil.addMessageError(null, response.getMessage()); } }
Source:
<code>public Future<Void> processRequest(RestRequest restRequest, Callback<Void> callback) { Exception exception = null; frontendMetrics.securityServiceProcessRequestRate.mark(); long startTimeMs = System.currentTimeMillis(); if (!isOpen) { <START> exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); <END> } else { if (restRequest == null) { throw new IllegalArgumentException("RestRequest is null"); } } FutureResult<Void> futureResult = new FutureResult<Void>(); if (callback != null) { callback.onCompletion(null, exception); } futureResult.done(null, exception); frontendMetrics.securityServiceProcessRequestTimeInMs.update( System.currentTimeMillis() - startTimeMs); return futureResult; }</code><technical_language>"Security service is closed.", related this patch</technical_language>

Target:
public Future<Void> processRequest(RestRequest restRequest, Callback<Void> callback) { Exception exception = null; frontendMetrics.securityServiceProcessRequestRate.mark(); long startTimeMs = System.currentTimeMillis(); if (!isOpen) { exception = new RestServiceException("Security service is closed", RestServiceErrorCode.ServiceUnavailable); } else { if (restRequest == null) { throw new IllegalArgumentException("RestRequest is null"); } } FutureResult<Void> futureResult = new FutureResult<Void>(); if (callback != null) { callback.onCompletion(null, exception); } futureResult.done(null, exception); frontendMetrics.securityServiceProcessRequestTimeInMs.update(System.currentTimeMillis() - startTimeMs); return futureResult; }
Source:
<code>private static String prepareUrl( final String resolvedUrl, final File deprecatedFile, final String url, File basedir, String defaultFilePath ) { if ( resolvedUrl != null && !NO_URL.equals( resolvedUrl ) ) { return resolvedUrl; } if ( deprecatedFile != null && url != null && !url.isEmpty() ) { throw new IllegalArgumentException( "You can't use both overrideFile and overrideUrl" ); } if ( deprecatedFile != null ) { if ( deprecatedFile.exists() ) { String result = deprecatedFile.toURI().toString(); <START> LOG.debug( "Loading overrides from file " + result ); <END> return result; } else { LOG.warn( "overrideFile [" + deprecatedFile.getAbsolutePath() + "] was configured but doesn't exist" ); } } if ( url != null ) { if ( UrlRequester.isStringUrl( url ) ) { LOG.debug( "Loading overrides from URL " + url ); return url; } else { LOG.warn( "Unsupported or invalid URL [" + url + "] found in overrideUrl; " + "supported are 'classpath:' URLs and anything your JVM supports " + "(file:, http: and https: should always work)" ); } } final Path basedirPath = basedir.toPath(); final Path defaultPath = basedirPath.resolve( defaultFilePath ); if ( Files.exists( defaultPath ) ) { String result = defaultPath.toUri().toString(); LOG.debug( "Loading overrides from file " + result ); return result; } LOG.debug( "No (valid) URL and no file [" + defaultPath.toAbsolutePath() + "] found; not loading any overrides" ); return NO_URL; }</code><technical_language>{} instead of string concat</technical_language>

Target:
private static String prepareUrl( final String resolvedUrl, final File deprecatedFile, final String url, File basedir, String defaultFilePath ) { if ( resolvedUrl != null && !NO_URL.equals( resolvedUrl ) ) { return resolvedUrl; } if ( deprecatedFile != null && url != null && !url.isEmpty() ) { throw new IllegalArgumentException( "You can't use both overrideFile and overrideUrl" ); } if ( deprecatedFile != null ) { if ( deprecatedFile.exists() ) { String result = deprecatedFile.toURI().toString(); LOG.debug( "Loading overrides from file {}", result ); return result; } else { LOG.warn( "overrideFile was configured but doesn't exist", deprecatedFile.getAbsolutePath() ); } } if ( url != null ) { if ( UrlRequester.isStringUrl( url ) ) { LOG.debug( "Loading overrides from URL {}", url ); return url; } else { LOG.warn( "Unsupported or invalid URL found in overrideUrl; " + "supported are 'classpath:' URLs and anything your JVM supports " + "(file:, http: and https: should always work)", url ); } } final Path basedirPath = basedir.toPath(); final Path defaultPath = basedirPath.resolve( defaultFilePath ); if ( Files.exists( defaultPath ) ) { String result = defaultPath.toUri().toString(); LOG.debug( "Loading overrides from file {}", result ); return result; } LOG.debug( "No (valid) URL and no file found; not loading any overrides", defaultPath.toAbsolutePath() ); return NO_URL; }
Source:
<code>public void zonedTimeFormatLegacy() throws ParseException { Date time = new Date(); DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'Z"); String str = dfDate.format(time); Date dtParsed = DateUtil.parseTZDateString(str); <START> assertEquals(time, dtParsed); <END> }</code><technical_language>I objects representing date is created a string include microseconds. This is i compared string representations</technical_language>

Target:
public void zonedTimeFormatLegacy() throws ParseException { Date time = new Date(); DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'Z"); String str = dfDate.format(time); Date dtParsed = DateUtil.parseTZDateString(str); assertEquals(time.toString(), dtParsed.toString()); }
Source:
<code>public Long getIssueTypeId(String issueTypeName) { List<IssueType> issueTypeList = new ArrayList<IssueType>(); Long issueTypeId = 10004L; issueTypeList = this.getIssueTypes(); for(IssueType issue : issueTypeList) { <START> LOGGER.warning("issueType: " + issue.getName() + " "+ issue.getId()); <END> if(issue.getName().equalsIgnoreCase(issueTypeName)) { issueTypeId = issue.getId(); break; } } return issueTypeId; }</code><technical_language>This logging pretty bad spam.</technical_language>

Target:
public Long getIssueTypeId(String issueTypeName) { List<IssueType> issueTypeList = new ArrayList<IssueType>(); Long issueTypeId = 10004L; issueTypeList = this.getIssueTypes(); for(IssueType issue : issueTypeList) { if(issue.getName().equalsIgnoreCase(issueTypeName)) { issueTypeId = issue.getId(); break; } } return issueTypeId; }
Source:
<code>private RequestFuture<ByteBuffer> initiateJoinGroup() { if (joinFuture == null) { disableHeartbeatThread(); state = MemberState.REBALANCING; if (lastRebalanceStartMs == -1L) lastRebalanceStartMs = time.milliseconds(); joinFuture = sendJoinGroupRequest(); joinFuture.addListener(new RequestFutureListener<ByteBuffer>() { @Override public void onSuccess(ByteBuffer value) { synchronized (AbstractCoordinator.this) { if (generation.generationId != OffsetCommitRequest.DEFAULT_GENERATION_ID) { log.info("Successfully joined group with generation {}", generation.generationId); state = MemberState.STABLE; rejoinNeeded = false; lastRebalanceEndMs = time.milliseconds(); sensors.successfulRebalanceSensor.record(lastRebalanceEndMs - lastRebalanceStartMs); lastRebalanceStartMs = -1L; if (heartbeatThread != null) heartbeatThread.enable(); } else { log.info("Generation data was cleared by heartbeat thread. Rejoin failed."); failure(); } } } @Override public void onFailure(RuntimeException e) { failure(); } <START> private void failure() { <END> synchronized (AbstractCoordinator.this) { state = MemberState.UNJOINED; sensors.failedRebalanceSensor.record(); } } }); } return joinFuture; }</code><technical_language>synchronized block failure means lock AbstractCoordinator.this. suggest leave locking caller leave failure it</technical_language>

Target:
private synchronized RequestFuture<ByteBuffer> initiateJoinGroup() { if (joinFuture == null) { disableHeartbeatThread(); state = MemberState.REBALANCING; if (lastRebalanceStartMs == -1L) lastRebalanceStartMs = time.milliseconds(); joinFuture = sendJoinGroupRequest(); joinFuture.addListener(new RequestFutureListener<ByteBuffer>() { @Override public void onSuccess(ByteBuffer value) { synchronized (AbstractCoordinator.this) { if (generation != Generation.NO_GENERATION) { log.info("Successfully joined group with generation {}", generation.generationId); state = MemberState.STABLE; rejoinNeeded = false; lastRebalanceEndMs = time.milliseconds(); sensors.successfulRebalanceSensor.record(lastRebalanceEndMs - lastRebalanceStartMs); lastRebalanceStartMs = -1L; if (heartbeatThread != null) heartbeatThread.enable(); } else { log.info("Generation data was cleared by heartbeat thread. Rejoin failed."); recordRebalanceFailure(); } } } @Override public void onFailure(RuntimeException e) { synchronized (AbstractCoordinator.this) { recordRebalanceFailure(); } } private void recordRebalanceFailure() { state = MemberState.UNJOINED; sensors.failedRebalanceSensor.record(); } }); } return joinFuture; }
Source:
<code>private void addBackgroundFromUri(Uri uri) { Scene currentScene = ProjectManager.getInstance().getCurrentlyEditedScene(); Sprite currentSprite = currentScene.getBackgroundSprite(); String resolvedFileName = StorageOperations.resolveFileName(getContentResolver(), uri); String lookDataName; String lookFileName; boolean useSpriteName = resolvedFileName == null || StorageOperations.getSanitizedFileName(resolvedFileName).equals(TMP_IMAGE_FILE_NAME); if (useSpriteName) { lookDataName = currentSprite.getName(); lookFileName = lookDataName + DEFAULT_IMAGE_EXTENSION; } else { lookDataName = StorageOperations.getSanitizedFileName(resolvedFileName); lookFileName = resolvedFileName; } lookDataName = new UniqueNameProvider().getUniqueNameInNameables(lookDataName, currentSprite.getLookList()); try { File imageDirectory = new File(currentScene.getDirectory(), IMAGE_DIRECTORY_NAME); File file = StorageOperations.copyUriToDir(getContentResolver(), uri, imageDirectory, lookFileName); LookData look = new LookData(lookDataName, file); currentSprite.getLookList().add(look); if (onNewLookListener != null) { onNewLookListener.addItem(look); <START> refreshScriptFragment(); <END> } } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); } }</code><technical_language>do need this? works perfectly fine for adding (see addLookFromUri(Uri uri)) is this different? for annoying, I want do start new cargo cults these</technical_language>

Target:
private void addBackgroundFromUri(Uri uri) { Scene currentScene = ProjectManager.getInstance().getCurrentlyEditedScene(); Sprite currentSprite = currentScene.getBackgroundSprite(); String resolvedFileName = StorageOperations.resolveFileName(getContentResolver(), uri); String lookDataName; String lookFileName; boolean useSpriteName = resolvedFileName == null || StorageOperations.getSanitizedFileName(resolvedFileName).equals(TMP_IMAGE_FILE_NAME); if (useSpriteName) { lookDataName = currentSprite.getName(); lookFileName = lookDataName + DEFAULT_IMAGE_EXTENSION; } else { lookDataName = StorageOperations.getSanitizedFileName(resolvedFileName); lookFileName = resolvedFileName; } lookDataName = new UniqueNameProvider().getUniqueNameInNameables(lookDataName, currentSprite.getLookList()); try { File imageDirectory = new File(currentScene.getDirectory(), IMAGE_DIRECTORY_NAME); File file = StorageOperations.copyUriToDir(getContentResolver(), uri, imageDirectory, lookFileName); LookData look = new LookData(lookDataName, file); currentSprite.getLookList().add(look); if (onNewLookListener != null) { onNewLookListener.addItem(look); } } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); } }
Source:
<code>public void push() { <START> final Credentials oldCredentials = new Credentials("", "manu", "78"); <END> PullOrganisationCredentialsController pullOrganisationCredentialsController = new PullOrganisationCredentialsController(oldCredentials, mPushService); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMainExecutor mainExecutor = new UIThreadExecutor(); PullOrganisationCredentialsUseCase pullOrganisationCredentialsUseCase = new PullOrganisationCredentialsUseCase(asyncExecutor, mainExecutor, pullOrganisationCredentialsController); pullOrganisationCredentialsUseCase.execute( new PullOrganisationCredentialsUseCase.Callback() { @Override public void onComplete() { CheckCredentialsWithOrgUnitUseCase checkCredentialsWithOrgUnitUseCase = new CheckCredentialsWithOrgUnitUseCase(); checkCredentialsWithOrgUnitUseCase.execute(oldCredentials, new CheckCredentialsWithOrgUnitUseCase.Callback() { @Override public void onCorrectCredentials() { PushServiceStrategy.this.onCorrectCredentials(); } @Override public void onBadCredentials() { logout(); } }); } @Override public void onError(String message) { Log.e(TAG, "Error getting user credentials: " + message); } @Override public void onNetworkError() { Log.e(TAG, "Error getting user credentials: NetworkError"); } @Override public void onPullConversionError() { Log.e(TAG, "Error getting user credentials: PullConversionError"); } }); }</code><technical_language>@manuelplazaspalacio exists this hardcoded credentials</technical_language>

Target:
public void push() { IAuthenticationManager authenticationManager = new AuthenticationManager( PreferencesState.getInstance().getContext()); IMainExecutor mainExecutor = new UIThreadExecutor(); IAsyncExecutor asyncExecutor = new AsyncExecutor(); ICredentialsRepository credentialsLocalDataSoruce = new CredentialsLocalDataSource(); IOrganisationUnitRepository organisationDataSource = new OrganisationUnitDataSource(); IInvalidLoginAttemptsRepository iInvalidLoginAttemptsRepository = new InvalidLoginAttemptsRepositoryLocalDataSource(); LoginUseCase loginUseCase = new LoginUseCase(authenticationManager, mainExecutor, asyncExecutor, organisationDataSource, credentialsLocalDataSoruce, iInvalidLoginAttemptsRepository); final Credentials oldCredentials = credentialsLocalDataSoruce.getOrganisationCredentials(); loginUseCase.execute(oldCredentials, new ALoginUseCase.Callback() { @Override public void onLoginSuccess() { PushServiceStrategy.this.onCorrectCredentials(); } @Override public void onServerURLNotValid() { Log.e(TAG, "Error getting user credentials: URL not valid "); } @Override public void onInvalidCredentials() { logout(); } @Override public void onNetworkError() { Log.e(TAG, "Error getting user credentials: NetworkError"); } @Override public void onConfigJsonNotPresent() { Log.e(TAG, "Error getting user credentials: JsonNotPresent"); } @Override public void onUnexpectedError() { Log.e(TAG, "Error getting user credentials: unexpectedError "); } @Override public void onMaxLoginAttemptsReachedError() { } }); }
Source:
<code>public Email visit(QueryProcessingError queryProcessingError) { final FoxtrotException exception = queryProcessingError.getException(); switch (exception.getCode()) { case CARDINALITY_OVERFLOW: { return richEmailBuilder.build(templateIdFromEvent(queryProcessingError), Collections.emptyList(), exception.toMap()); } case TABLE_INITIALIZATION_ERROR: case TABLE_METADATA_FETCH_FAILURE: <START> case TABLE_NOT_FOUND: <END> case TABLE_ALREADY_EXISTS: case TABLE_MAP_STORE_ERROR: case INVALID_REQUEST: case DOCUMENT_NOT_FOUND: case MALFORMED_QUERY: case ACTION_RESOLUTION_FAILURE: case UNRESOLVABLE_OPERATION: case ACTION_EXECUTION_ERROR: case STORE_CONNECTION_ERROR: case STORE_EXECUTION_ERROR: case DATA_CLEANUP_ERROR: case EXECUTION_EXCEPTION: case CONSOLE_SAVE_EXCEPTION: case CONSOLE_FETCH_EXCEPTION: case AUTHORIZATION_EXCEPTION: case SOURCE_MAP_CONVERSION_FAILURE: case FQL_PERSISTENCE_EXCEPTION: case FQL_PARSE_ERROR: case PORT_EXTRACTION_ERROR: break; } return null; }</code><technical_language>replace error codes default block for other error code</technical_language>

Target:
public Email visit(QueryProcessingError queryProcessingError) { final FoxtrotException exception = queryProcessingError.getException(); switch (exception.getCode()) { case CARDINALITY_OVERFLOW: { return richEmailBuilder.build(templateIdFromEvent(queryProcessingError), Collections.emptyList(), exception.toMap()); } default: break; } return null; }
Source:
<code>public void testQuantileAtValueBigint() { QuantileDigest qdigest = new QuantileDigest(1); addAll(qdigest, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 20)", toHexString(qdigest)), <START> DOUBLE, <END> 1.0); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 6)", toHexString(qdigest)), DOUBLE, 0.6); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), -1)", toHexString(qdigest)), DOUBLE, 0.0); }</code><technical_language>Suppose wrap of integer literals doubleToSortableLong, QDigest aggregation function does, this result</technical_language>

Target:
public void testQuantileAtValueBigint() { QuantileDigest qdigest = new QuantileDigest(1); addAll(qdigest, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 20)", toHexString(qdigest)), DOUBLE, null); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 6)", toHexString(qdigest)), DOUBLE, 0.6); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), -1)", toHexString(qdigest)), DOUBLE, null); }
Source:
<code>protected void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { Map<IPluginModelBase, String> map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); for (Entry<IPluginModelBase, String> entry : map.entrySet()) { IPluginModelBase model = entry.getKey(); if (fPluginTreeViewer.setChecked(model, true)) { setText(model, <START> entry.getValue().toString()); <END> } } fNumExternalChecked = map.size(); resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < getExternalModels().length); }</code><technical_language>remove</technical_language>

Target:
protected void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { Map<IPluginModelBase, String> map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); for (Entry<IPluginModelBase, String> entry : map.entrySet()) { IPluginModelBase model = entry.getKey(); if (fPluginTreeViewer.setChecked(model, true)) { setText(model, entry.getValue()); } } fNumExternalChecked = map.size(); resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < getExternalModels().length); }
Source:
<code>public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), CANCELLING, ""); <END> }</code><technical_language>suggestion assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), CANCELLING, EMPTY_VALUE); }
Source:
<code>static ImageDescriptor getImageDescriptor(String path) { <START> URL url = FileLocator.find(WebBrowserUIPlugin.getInstance().getBundle(), new Path(path), null); <END> return ImageDescriptor.createFromURL(url); }</code><technical_language>Prefer usage of FrameworkUtil get bundle</technical_language>

Target:
static ImageDescriptor getImageDescriptor(String path) { URL url = FileLocator.find(FrameworkUtil.getBundle(ImageResourceManager.class), new Path(path), null); return ImageDescriptor.createFromURL(url); }
Source:
<code>public void streamEventsbyNameAndType() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS+ "/backendA/ERROR"); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendA"); dummyService.doSomething(false); Thread.sleep(1000); try { dummyService.doSomething(true); } catch (IOException ex) { } CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendA"); Thread.sleep(1000); assertThat (circuitBreakerEventsBefore.getCircuitBreakerEvents().size() < circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); <START> assertThat (events.size() == 1); <END> }</code><technical_language>Assertj a fluent API. do assertThat(events.size()).isEqulTo(1);</technical_language>

Target:
public void streamEventsbyNameAndType() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS+ "/backendB/SUCCESS"); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendB"); publishEvents(); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendB"); Thread.sleep(1000); assertThat (circuitBreakerEventsBefore.getCircuitBreakerEvents().size()).isLessThan(circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); assertThat (events.size()).isEqualTo(1); }
Source:
<code>public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other instanceof ApproximateHistogramAggregatorFactory) { ApproximateHistogramAggregatorFactory castedOther = (ApproximateHistogramAggregatorFactory) other; if (Float.compare(castedOther.lowerLimit, lowerLimit) == 0 && numBuckets != castedOther.numBuckets && resolution != castedOther.resolution && Float.compare(castedOther.upperLimit, upperLimit) != 0) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException( "can't merge approx histogram aggregator factories [%s] and [%s]", this, other ); } } else { <START> throw new AggregatorFactoryNotMergeableException( <END> "can't merge [%s : %s] and [%s : %s]", this.getName(), this.getClass().getName(), other.getName(), other.getClass().getName() ); } }</code><technical_language>Possibly worth a constructor for exception takes AggregatorFactories this message</technical_language>

Target:
public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other instanceof ApproximateHistogramAggregatorFactory) { ApproximateHistogramAggregatorFactory castedOther = (ApproximateHistogramAggregatorFactory) other; return new ApproximateHistogramFoldingAggregatorFactory( name, name, Math.max(resolution, castedOther.resolution), numBuckets, Math.min(lowerLimit, castedOther.lowerLimit), Math.max(upperLimit, castedOther.upperLimit) ); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
Source:
<code><START> private List<Feature> getFeatures() { <END> if (features.isEmpty()) { plugins.setSerialEventBusOnEventListenerPlugins(bus); features.addAll(featureSupplier.get()); bus.send(new TestRunStarted(bus.getInstant())); features.forEach(feature -> bus.send(new TestSourceRead(bus.getInstant(), feature.getUri(), feature.getSource()))); } return features; }</code><technical_language>A test nice too</technical_language>

Target:
private List<Feature> getFeatures() { if (features == null) { plugins.setSerialEventBusOnEventListenerPlugins(bus); features = featureSupplier.get(); bus.send(new TestRunStarted(bus.getInstant())); features.forEach(feature -> bus.send(new TestSourceRead(bus.getInstant(), feature.getUri(), feature.getSource()))); } return features; }
Source:
<code>public void init( final PlaceRequest placeRequest, final Command completeCommand ) { this.placeRequest = placeRequest; Set<Option> optionsFromModeParameter = getOptionsFromModeParameter( placeRequest.getParameter( "mode", "" ) ); if ( optionsFromModeParameter.isEmpty() ) { options.addAll( getOptionsFromModeParameter( getWindowParameter( "explorer_mode" ) ) ); } else { options.addAll( optionsFromModeParameter ); } if ( options.isEmpty() ) { load(new Command() { @Override public void execute() { completeCommand.execute(); } <START> }); <END> } else { completeCommand.execute(); } }</code><technical_language>@Rikkola do need a new Command here</technical_language>

Target:
public void init( final PlaceRequest placeRequest, final Command completeCommand ) { this.placeRequest = placeRequest; Set<Option> optionsFromModeParameter = getOptionsFromModeParameter( placeRequest.getParameter( "mode", "" ) ); if ( optionsFromModeParameter.isEmpty() ) { options.addAll( getOptionsFromModeParameter( getWindowParameter( "explorer_mode" ) ) ); } else { options.addAll( optionsFromModeParameter ); } if ( options.isEmpty() ) { load( completeCommand ); } else { completeCommand.execute(); } }
Source:
<code>private ValidationResult nicActuallyExistsOrReferencesNewBond(NetworkAttachment attachment) { String nicName = attachment.getNicName(); Guid nicId = attachment.getNicId(); boolean nicActuallyExistsOrReferencesNewBond = isNicActuallyExistsOrReferencesNewBond(nicName, nicId); <START> return ValidationResult.failWith(EngineMessage.HOST_NETWORK_INTERFACE_HAVING_ID_AND_NAME_DOES_NOT_EXIST, <END> ReplacementUtils.createSetVariableString(VAR_NIC_ID, nicId), ReplacementUtils.createSetVariableString(VAR_NIC_NAME, nicName) ).when(!nicActuallyExistsOrReferencesNewBond); }</code><technical_language>I ID_OR_NAME, is important</technical_language>

Target:
private ValidationResult nicActuallyExistsOrReferencesNewBond(NetworkAttachment attachment) { String nicName = attachment.getNicName(); Guid nicId = attachment.getNicId(); boolean nicActuallyExistsOrReferencesNewBond = isNicActuallyExistsOrReferencesNewBond(nicName, nicId); return ValidationResult.failWith(EngineMessage.HOST_NETWORK_INTERFACE_HAVING_ID_OR_NAME_DOES_NOT_EXIST, ReplacementUtils.createSetVariableString(VAR_NIC_ID, nicId), ReplacementUtils.createSetVariableString(VAR_NIC_NAME, nicName) ).when(!nicActuallyExistsOrReferencesNewBond); }
Source:
<code>public void createsIssueEvent() throws Exception { final MkIssueEvents events = this.issueEvents(); final String login = "jack"; final String type = "locked"; <START> final long before = now(); <END> final Event.Smart event = new Event.Smart( events.create(type, 2, login, null) ); final long after = now(); MatcherAssert.assertThat( event.type(), Matchers.equalTo(type) ); MatcherAssert.assertThat( event.author().login(), Matchers.equalTo(login) ); MatcherAssert.assertThat( event.url().toString(), Matchers.equalTo("<LINK_0>") ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }</code><technical_language>@cvrebert this.now()</technical_language>

Target:
public void createsIssueEvent() throws Exception { final MkIssueEvents events = this.issueEvents(); final String login = "jack"; final String type = "locked"; final long before = MkIssueEventsTest.now(); final Event.Smart event = new Event.Smart( events.create( type, 2, login, MkIssueEventsTest.ABSENT_STR ) ); final long after = MkIssueEventsTest.now(); MatcherAssert.assertThat( event.type(), Matchers.equalTo(type) ); MatcherAssert.assertThat( event.author().login(), Matchers.equalTo(login) ); MatcherAssert.assertThat( event.url().toString(), Matchers.equalTo("<LINK_0>") ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }
Source:
<code>private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) { Symbol symbol = new Symbol("column"); PlanNode tableScan = new TableScanNode( new PlanNodeId(name), <START> new TableHandle(new ConnectorId("test"), new TestingMetadata.TestingTableHandle()), <END> ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), Optional.empty(), TupleDomain.all(), null); RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of()); PlanNode join = new JoinNode( new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(tableScan.getOutputSymbols()) .addAll(remote.getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED)); return createFragment(join); }</code><technical_language>static import</technical_language>

Target:
private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) { Symbol symbol = new Symbol("column"); PlanNode tableScan = new TableScanNode( new PlanNodeId(name), new TableHandle(new ConnectorId("test"), new TestingTableHandle()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), Optional.empty(), TupleDomain.all(), null); RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of()); PlanNode join = new JoinNode( new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(tableScan.getOutputSymbols()) .addAll(remote.getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED)); return createFragment(join); }
Source:
<code>public Map<String, String> getUserOptions() { <START> return ofNullable(userOptions) <END> .<Map<String, String>> map(HashMap::new) .orElse(emptyMap()); }</code><technical_language>Please Optional.ofNullable()</technical_language>

Target:
public Map<String, String> getUserOptions() { return Optional.ofNullable(userOptions) .<Map<String, String>> map(HashMap::new) .orElse(Collections.emptyMap()); }
Source:
<code>void writeLine(String str, boolean mayLog) { if (mayLog) { log.debug(str); } ns.write(str + "\r\n"); if (ns.writeQueueFull()) { <START> ns.pause(); <END> ns.drainHandler(v -> { ns.resume(); }); } }</code><technical_language>is this needed ? this pause reading netsocket</technical_language>

Target:
void writeLine(String str, boolean mayLog) { if (mayLog) { log.debug(str); } ns.write(str + "\r\n"); }
Source:
<code>public void whenExpectingAssumptionViolatedExceptionStatementsThrowingItShouldPass() { Statement statementThrowingAssumptionViolatedException = new Fail(new AssumptionViolatedException("expected")); <START> ExpectException expectException = new ExpectException(statementThrowingAssumptionViolatedException, AssumptionViolatedException.class); <END> try { expectException.evaluate(); } catch (Throwable e) { fail("should not throw anything, but was thrown: " + e); } }</code><technical_language>If want long variable name for Statement arg please wrap this line readable: ExpectException expectException = new ExpectException( statementThrowingAssumptionViolatedException, AssumptionViolatedException.class); I prefer delegate delegateStatement is role of Statement is for sut. variable is declared line up, long name needed code harder scan IMHO</technical_language>

Target:
public void whenExpectingAssumptionViolatedExceptionStatementsThrowingItShouldPass() { Statement delegate = new Fail(new AssumptionViolatedException("expected")); ExpectException expectException = new ExpectException(delegate, AssumptionViolatedException.class); try { expectException.evaluate(); } catch (Throwable e) { fail("should not throw anything, but was thrown: " + e); } }
Source:
<code><START> public java.lang.String getVersion() { <END> return myVersion; }</code><technical_language>ders more. pls find scrub</technical_language>

Target:
public String getVersion() { return myVersion; }
Source:
<code>public void prepare(Properties options) { Objects.requireNonNull(mapper, "mapper can not be null"); Objects.requireNonNull(topicSelector, "topicSelector can not be null"); <START> producer = new KafkaProducer<K, V>(options); <END> }</code><technical_language>Nit: I new KafkaProducer<>(options) work</technical_language>

Target:
public void prepare(Properties options) { Objects.requireNonNull(mapper, "mapper can not be null"); Objects.requireNonNull(topicSelector, "topicSelector can not be null"); producer = new KafkaProducer<>(options); }
Source:
<code>public static void injectParameters(Object type, Properties parameters) { if ( ParameterizedType.class.isInstance( type ) ) { if ( parameters == null ) { <START> ConcurrentHashMapBackedProperties concurrentParams = new ConcurrentHashMapBackedProperties(parameters); <END> ( (ParameterizedType) type ).setParameterValues( concurrentParams ); } else { ( (ParameterizedType) type ).setParameterValues( parameters ); } } else if ( parameters != null && !parameters.isEmpty() ) { throw new MappingException( "type is not parameterized: " + type.getClass().getName() ); } }</code><technical_language>do this new ConcurrentHashMapBackedProperties parameters is null, parameters is null</technical_language>

Target:
public static void injectParameters(Object type, Properties parameters) { if ( ParameterizedType.class.isInstance( type ) ) { if ( parameters == null ) { ( (ParameterizedType) type ).setParameterValues( EMPTY_PROPERTIES ); } else { ConcurrentHashMapBackedProperties concurrentParams = new ConcurrentHashMapBackedProperties(parameters); ( (ParameterizedType) type ).setParameterValues( concurrentParams ); } } else if ( parameters != null && !parameters.isEmpty() ) { throw new MappingException( "type is not parameterized: " + type.getClass().getName() ); } }
Source:
<code>public void poll() { if <START> (isMonitoringNeeded(vdsManager.getCopyVds().getStatus())) <END> { VmsListFetcher fetcher = new VmsStatisticsFetcher(vdsManager); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { getVmsMonitoring().perform(fetcher.getChangedVms(), fetchTime, vdsManager, true); processDevices(fetcher.getVdsmVms().stream(), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }</code><technical_language>is a reason clone VDS object? adding a method getVdsStatus VdsManager simply return status of #cachedVds</technical_language>

Target:
public void poll() { if (isMonitoringNeeded(vdsManager.getStatus())) { VmsListFetcher fetcher = new VmsStatisticsFetcher(vdsManager); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { getVmsMonitoring().perform(fetcher.getChangedVms(), fetchTime, vdsManager, true); processDevices(fetcher.getVdsmVms().stream(), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }
Source:
<code><START> public synchronized boolean removeSwitch(final long ovxDpid) { <END> this.dpidCounter.releaseIndex((int) (0x000000 << 32 | ovxDpid)); OVXSwitch sw = this.getSwitch(ovxDpid); boolean down = sw.tearDown(); if (down) { sw.unregister(); } return down; }</code><technical_language>If validation step in api throws exception this is necessary</technical_language>

Target:
public synchronized void removeSwitch(final long ovxDpid) { this.dpidCounter.releaseIndex((int) (0x000000 << 32 | ovxDpid)); OVXSwitch sw = this.getSwitch(ovxDpid); sw.tearDown(); sw.unregister(); }
Source:
<code>public void seal() throws IOException { int size = (_bitmapWriters.length + 1) * Integer.BYTES; for (RoaringBitmapWriter<MutableRoaringBitmap> writer : _bitmapWriters) { size += writer.get().serializedSizeInBytes(); Preconditions.checkState(size > 0, "Inverted index file: %s exceeds 2GB limit", _invertedIndexFile); } ByteBuffer buffer = null; try (FileChannel channel = new RandomAccessFile(_invertedIndexFile, "rw").getChannel()) { <START> buffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, size).order(LITTLE_ENDIAN); <END> int bitmapOffset = (_bitmapWriters.length + 1) * Integer.BYTES; buffer.putInt(Integer.reverseBytes(bitmapOffset)); for (RoaringBitmapWriter<MutableRoaringBitmap> writer : _bitmapWriters) { bitmapOffset += writer.getUnderlying().serializedSizeInBytes(); buffer.putInt(Integer.reverseBytes(bitmapOffset)); } for (RoaringBitmapWriter<MutableRoaringBitmap> bitmap : _bitmapWriters) { bitmap.getUnderlying().serialize(buffer); } } catch (Exception e) { FileUtils.deleteQuietly(_invertedIndexFile); throw e; } finally { if (null != buffer && CleanerUtil.UNMAP_SUPPORTED) { CleanerUtil.getCleaner().freeBuffer(buffer); } } }</code><technical_language>Ok, I swapping bytes writing. So, this is writing bytes in LE file index load, read in format work. In this case, choose format for writing do today. usage of RoaringBitmapWriter enforce LE format</technical_language>

Target:
public void seal() throws IOException { int startOfBitmaps = (_bitmapWriters.length + 1) * Integer.BYTES; ByteBuffer bitmapBuffer = null; ByteBuffer offsetBuffer = null; try (FileChannel channel = new RandomAccessFile(_invertedIndexFile, "rw").getChannel()) { offsetBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, startOfBitmaps) .order(ByteOrder.BIG_ENDIAN); bitmapBuffer = channel.map(FileChannel.MapMode.READ_WRITE, startOfBitmaps, Integer.MAX_VALUE - startOfBitmaps) .order(ByteOrder.LITTLE_ENDIAN); offsetBuffer.putInt(startOfBitmaps); for (RoaringBitmapWriter<RoaringBitmap> writer : _bitmapWriters) { writer.get().serialize(bitmapBuffer); offsetBuffer.putInt(startOfBitmaps + bitmapBuffer.position()); } channel.truncate(startOfBitmaps + bitmapBuffer.position()); } catch (Exception e) { FileUtils.deleteQuietly(_invertedIndexFile); throw e; } finally { if (CleanerUtil.UNMAP_SUPPORTED) { CleanerUtil.BufferCleaner cleaner = CleanerUtil.getCleaner(); if (bitmapBuffer != null) { cleaner.freeBuffer(bitmapBuffer); } if (offsetBuffer != null) { cleaner.freeBuffer(offsetBuffer); } } } }
Source:
<code>private String doRegister() { URI envsUri = UriComponentsBuilder.newInstance().uri(jaasEndpoint).path("/envs").build().toUri(); TestEnvironmentEntity testEnvironmentEntity = buildTestEnvironmentEntityWith(TestEnvironmentStatus.PENDING); ResponseEntity<String> responseEntity = null; boolean posted = false; do { try { responseEntity = restTemplate.postForEntity(envsUri, testEnvironmentEntity, String.class); posted = true; } catch (HttpClientErrorException e) { if (!isEnvIdUnacceptable(e)) { throw e; } envId = UUID.randomUUID().toString(); <START> testEnvironmentEntity.setEnvironmentId(envId); <END> } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Received cookie value - {}", TestEnvUtils.SESSION_COOKIE, sessionCookie); return sessionCookie; }</code><technical_language>please, log meaningful INFO log message here, id before, ofter, changed</technical_language>

Target:
private String doRegister() { URI envsUri = UriComponentsBuilder.newInstance().uri(jaasEndpoint).path("/envs").build().toUri(); TestEnvironmentEntity testEnvironmentEntity = buildTestEnvironmentEntityWith(TestEnvironmentStatus.PENDING); ResponseEntity<String> responseEntity = null; boolean posted = false; do { try { responseEntity = restTemplate.postForEntity(envsUri, testEnvironmentEntity, String.class); posted = true; } catch (HttpClientErrorException e) { if (!isEnvIdUnacceptable(e)) { throw e; } envId = UUID.randomUUID().toString(); LOGGER.warn("Changing env id from to {}", testEnvironmentEntity.getEnvironmentId(), envId); testEnvironmentEntity.setEnvironmentId(envId); } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Environment successfully registered to JaaS with session cookie - {}", envId, sessionCookie); return sessionCookie; }
Source:
<code>public void collectChannels(Connection connection) { if(connection.getSourceElement().isMapped() && connection.getDestinationElement().isMapped() && connection.getSourceElement().getResource() != connection.getDestinationElement().getResource()) { List<Event> sourceEvents = getSourceEvents(connection); Resource sourceResource = connection.getSourceElement().getResource(); Resource destinationResource = connection.getDestinationElement().getResource(); FBNetworkElement mappedElement = connection.getDestinationElement().getOpposite(); boolean local = sourceResource.getDevice() == destinationResource.getDevice(); for (Event sourceEvent : sourceEvents) { CommunicationChannel channel = getComChannel(local, sourceEvent, connection); if(null != channel) { CommunicationChannelDestination destination = channel.getDestination(destinationResource); destination.getConnection().add(connection); int portIndex = getPortIndex(connection, sourceEvent); List<IInterfaceElement> destinationPortList = destination.getDestinationPorts().get(portIndex); if <START> (destinationPortList == null) { <END> destinationPortList = new ArrayList<>(); destination.getDestinationPorts().put(portIndex, destinationPortList); } destinationPortList.add(mappedElement.getInterfaceElement(connection.getDestination().getName())); } } } }</code><technical_language>null lhs</technical_language>

Target:
public void collectChannels(Connection connection) { if(connection.getSourceElement().isMapped() && connection.getDestinationElement().isMapped() && connection.getSourceElement().getResource() != connection.getDestinationElement().getResource()) { List<Event> sourceEvents = getSourceEvents(connection); Resource sourceResource = connection.getSourceElement().getResource(); Resource destinationResource = connection.getDestinationElement().getResource(); FBNetworkElement mappedElement = connection.getDestinationElement().getOpposite(); boolean local = sourceResource.getDevice() == destinationResource.getDevice(); for (Event sourceEvent : sourceEvents) { CommunicationChannel channel = getComChannel(local, sourceEvent, connection); if(null != channel) { CommunicationChannelDestination destination = channel.getDestination(destinationResource); destination.getConnection().add(connection); int portIndex = getPortIndex(connection, sourceEvent); List<IInterfaceElement> destinationPortList = destination.getDestinationPorts().get(portIndex); if (null == destinationPortList) { destinationPortList = new ArrayList<>(); destination.getDestinationPorts().put(portIndex, destinationPortList); } destinationPortList.add(mappedElement.getInterfaceElement(connection.getDestination().getName())); } } } }
Source:
<code>private void handlePackError(IOException e, PackFile p) { String warnTmpl = null; if ((e instanceof CorruptObjectException) || (e instanceof PackInvalidException)) { warnTmpl = JGitText.get().corruptPack; removePack(p); } else if (e instanceof FileNotFoundException) { warnTmpl = JGitText.get().packWasDeleted; removePack(p); } if (warnTmpl != null) { LOG.warn(MessageFormat.format(warnTmpl, p.getPackFile() <START> .getAbsolutePath())); <END> } else { LOG.error(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile() .getAbsolutePath()), e); } }</code><technical_language>I allow log stack trace switching log level DEBUG enable analysing problems anticipate</technical_language>

Target:
private void handlePackError(IOException e, PackFile p) { String warnTmpl = null; if ((e instanceof CorruptObjectException) || (e instanceof PackInvalidException)) { warnTmpl = JGitText.get().corruptPack; removePack(p); } else if (e instanceof FileNotFoundException) { warnTmpl = JGitText.get().packWasDeleted; removePack(p); } if (warnTmpl != null) { if (LOG.isDebugEnabled()) { LOG.warn(MessageFormat.format(warnTmpl, p.getPackFile().getAbsolutePath()), e); } else { LOG.warn(MessageFormat.format(warnTmpl, p.getPackFile().getAbsolutePath())); } } else { LOG.error(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile() .getAbsolutePath()), e); } }
Source:
<code>private void checkSuperInvokedBeforeThisOrSuper(SuperTreeImpl superTree) { if (isInConstructor(superTree)) { int line = superTree.getFirstToken().line(); int column = superTree.getFirstToken().column(); MethodDeclarationTree method = getEnclosingConstructor(superTree); Set<IssueLocation> secondaryLocations = new HashSet<>(); Set<SuperTreeImpl> superTrees = new SuperDetector().detectIn(method); superTrees.stream() .filter(s -> !s.getParent().is(Kind.CALL_EXPRESSION)) <START> .filter(s -> isBefore(s.getFirstToken(), line, column)) <END> .map(IssueLocation::new) .forEach(secondaryLocations::add); Set<IdentifierTree> thisTrees = new ThisDetector().detectIn(method); thisTrees.stream() .filter(s -> isBefore(s.identifierToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); if (!secondaryLocations.isEmpty()) { PreciseIssue issue = addIssue(superTree, MESSAGE_SUPER_BEFORE_THIS_OR_SUPER); secondaryLocations.forEach(issue::secondary); } } }</code><technical_language>@ivandalbosco This is a corner case this approach lead FPs, e.g.: class B51 extends A51 { constructor() { for (let i = 0; i < 1; super.x = 42) { super(); i++; } } }</technical_language>

Target:
private void checkSuperInvokedBeforeThisOrSuper(SuperTreeImpl superTree) { int line = superTree.getFirstToken().line(); int column = superTree.getFirstToken().column(); MethodDeclarationTree method = getEnclosingConstructor(superTree); Set<IssueLocation> secondaryLocations = new HashSet<>(); Set<SuperTreeImpl> superTrees = new SuperDetector().detectIn(method); superTrees.stream() .filter(s -> !s.getParent().is(Kind.CALL_EXPRESSION)) .filter(s -> isBefore(s.getFirstToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); Set<IdentifierTree> thisTrees = new ThisDetector().detectIn(method); thisTrees.stream() .filter(s -> isBefore(s.identifierToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); if (!secondaryLocations.isEmpty()) { PreciseIssue issue = addIssue(superTree, MESSAGE_SUPER_BEFORE_THIS_OR_SUPER); secondaryLocations.forEach(issue::secondary); } }