auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute(final AccountAuthenticator aa) throws URISyntaxException, UnsupportedEncodingException { AuthenticateAccountStageDelegate callbackDelegate = new AuthenticateAccountStageDelegate() { @Override public void handleSuccess(boolean isSuccess) { aa.isSuccess = isSuccess; aa.runNextStage(); } @Override public void handleFailure(HttpResponse response) { Logger.debug(LOG_TAG, "handleFailure"); aa.abort(response.toString(), new Exception(response.getStatusLine().getStatusCode() + " error.")); try { BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); Logger.warn(LOG_TAG, "content: " + reader.readLine()); SyncResourceDelegate.consumeReader(reader); reader.close(); SyncResourceDelegate.consumeEntity(response.getEntity()); } catch (IllegalStateException e) { Logger.debug(LOG_TAG, "Error reading content.", e); } catch (IOException e) { Logger.debug(LOG_TAG, "Error reading content.", e); } } @Override public void handleError(Exception e) { Logger.debug(LOG_TAG, "handleError", e); aa.abort("HTTP failure.", e); } }; String authHash = Base64.encodeToString((aa.usernameHash + ":" + aa.password).getBytes(), Base64.DEFAULT); String authRequestUrl = aa.authServer + Constants.AUTH_SERVER_VERSION + aa.usernameHash + "/" + Constants.AUTH_SERVER_SUFFIX; authenticateAccount(callbackDelegate, authRequestUrl, authHash); }

Target:
public void execute(final AccountAuthenticator aa) throws URISyntaxException, UnsupportedEncodingException { AuthenticateAccountStageDelegate callbackDelegate = new AuthenticateAccountStageDelegate() { @Override public void handleSuccess(boolean isSuccess) { aa.isSuccess = isSuccess; aa.runNextStage(); } @Override public void handleFailure(HttpResponse response) { Logger.debug(LOG_TAG, "handleFailure"); aa.abort(response.toString(), new Exception(response.getStatusLine().getStatusCode() + " error.")); if (response.getEntity() == null) { return; } try { BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); Logger.warn(LOG_TAG, "content: " + reader.readLine()); SyncResourceDelegate.consumeReader(reader); } catch (IllegalStateException e) { Logger.debug(LOG_TAG, "Error reading content.", e); } catch (RuntimeException e) { Logger.debug(LOG_TAG, "Unexpected exception.", e); if (httpRequest != null) { httpRequest.abort(); } } catch (IOException e) { Logger.debug(LOG_TAG, "Error reading content.", e); } } @Override public void handleError(Exception e) { Logger.debug(LOG_TAG, "handleError", e); aa.abort("HTTP failure.", e); } }; String authHash = Base64.encodeToString((aa.usernameHash + ":" + aa.password).getBytes(), Base64.DEFAULT); String authRequestUrl = aa.authServer + Constants.AUTH_SERVER_VERSION + aa.usernameHash + "/" + Constants.AUTH_SERVER_SUFFIX; authenticateAccount(callbackDelegate, authRequestUrl, authHash); }
Source:
private Credentials getUserCredentials(HttpServletRequest request) throws AuthenticationException { String[] creds = new String( Base64.decodeBase64(request.getHeader(SSOUtils.HEADER_AUTHORIZATION).substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); return translateUser(creds[0], creds[1]); }

Target:
private Credentials getUserCredentials(HttpServletRequest request) { String header = request.getHeader(SSOUtils.HEADER_AUTHORIZATION).substring("Basic".length()); Credentials credentials = null; if (StringUtils.isNotEmpty(header)) { String[] creds = new String( Base64.decodeBase64(request.getHeader(SSOUtils.HEADER_AUTHORIZATION).substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); credentials = translateUser(creds[0], creds[1]); } return credentials; }
Source:
public ActionResult execute() { String frontendUrl = getRequestParamValue("frontendUrl"); if (frontendUrl == null) { frontendUrl = ""; } AuthInfo output; if (userInfo == null) { output = new AuthInfo( gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.STUDENT_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.INSTRUCTOR_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.ADMIN_HOME_PAGE) ); } else { String googleId = userInfo.getId(); AccountAttributes accountInfo = logic.getAccount(googleId); output = new AuthInfo(userInfo, accountInfo.getInstitute(), authType == AuthType.MASQUERADE, gateKeeper.getLogoutUrl(frontendUrl + "/web")); } String csrfToken = StringHelper.encrypt(req.getSession().getId()); String existingCsrfToken = HttpRequestHelper.getCookieValueFromRequest(req, Const.CsrfConfig.TOKEN_COOKIE_NAME); if (!csrfToken.equals(existingCsrfToken)) { Cookie csrfTokenCookie = new Cookie(Const.CsrfConfig.TOKEN_COOKIE_NAME, csrfToken); csrfTokenCookie.setSecure(!Config.isDevServer()); csrfTokenCookie.setPath("/"); resp.addCookie(csrfTokenCookie); } return new JsonResult(output); }

Target:
public ActionResult execute() { String frontendUrl = getRequestParamValue("frontendUrl"); if (frontendUrl == null) { frontendUrl = ""; } AuthInfo output; if (userInfo == null) { output = new AuthInfo( gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.STUDENT_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.INSTRUCTOR_HOME_PAGE), gateKeeper.getLoginUrl(frontendUrl + Const.WebPageURIs.ADMIN_HOME_PAGE) ); } else { String googleId = userInfo.getId(); AccountAttributes accountInfo = logic.getAccount(googleId); String institute = null; if (accountInfo != null) { institute = accountInfo.getInstitute(); } output = new AuthInfo(userInfo, institute, authType == AuthType.MASQUERADE, gateKeeper.getLogoutUrl(frontendUrl + "/web")); } String csrfToken = StringHelper.encrypt(req.getSession().getId()); String existingCsrfToken = HttpRequestHelper.getCookieValueFromRequest(req, Const.CsrfConfig.TOKEN_COOKIE_NAME); if (!csrfToken.equals(existingCsrfToken)) { Cookie csrfTokenCookie = new Cookie(Const.CsrfConfig.TOKEN_COOKIE_NAME, csrfToken); csrfTokenCookie.setSecure(!Config.isDevServer()); csrfTokenCookie.setPath("/"); resp.addCookie(csrfTokenCookie); } return new JsonResult(output); }
Source:
public List<String> getRequiredDirectoryNames() { return new ArrayList<String>() {{add(incomingDirectoryName); }}; }

Target:
public List<String> getRequiredDirectoryNames() { List<String> directoryNames = new ArrayList<String>(); directoryNames.add(getIncomingDirectoryName()); directoryNames.add(getAcceptedDirectoryName()); directoryNames.add(getRejectedDirectoryName()); return directoryNames; }
Source:
protected void shutdownNodeSourceServices(Client initiator) { logger.info("[" + name + "] Shutdown finalization"); if (descriptor.getStatus().equals(NodeSourceStatus.NODES_DEPLOYED)) { nodeSourcePolicy.shutdown(initiator); infrastructureManager.internalShutDown(); } }

Target:
protected void shutdownNodeSourceServices(Client initiator) { logger.info("[" + this.name + "] Shutdown finalization"); if (this.descriptor.getStatus().equals(NodeSourceStatus.NODES_DEPLOYED)) { this.activeNodeSourcePolicy.shutdown(initiator); this.infrastructureManager.internalShutDown(); } }
Source:
protected Optional<UniqueConstraint> getPrimaryKey(DatabaseMetaData metaData, String schema, String table) throws SQLException { ResultSet rs = metaData.getPrimaryKeys(null, schema, table); Map<Integer, String> keySeqColumnName = new HashMap<>(); String pkName = null; while (rs.next()) { String columnName = rs.getString("COLUMN_NAME"); pkName = rs.getString("PK_NAME"); int keySeq = rs.getInt("KEY_SEQ"); keySeqColumnName.put(keySeq - 1, columnName); } List<String> pkFields = Arrays.asList(new String[keySeqColumnName.size()]); keySeqColumnName.forEach(pkFields::set); if (!pkFields.isEmpty()) { pkName = pkName != null ? pkName : "pk_" + String.join("_", pkFields); return Optional.of(UniqueConstraint.primaryKey(pkName, pkFields)); } return Optional.empty(); }

Target:
protected Optional<UniqueConstraint> getPrimaryKey(DatabaseMetaData metaData, String schema, String table) throws SQLException { ResultSet rs = metaData.getPrimaryKeys(null, schema, table); Map<Integer, String> keySeqColumnName = new HashMap<>(); String pkName = null; while (rs.next()) { String columnName = rs.getString("COLUMN_NAME"); pkName = rs.getString("PK_NAME"); int keySeq = rs.getInt("KEY_SEQ"); keySeqColumnName.put(keySeq - 1, columnName); } List<String> pkFields = Arrays.asList(new String[keySeqColumnName.size()]); keySeqColumnName.forEach(pkFields::set); if (!pkFields.isEmpty()) { pkName = pkName == null ? "pk_" + String.join("_", pkFields) : pkName; return Optional.of(UniqueConstraint.primaryKey(pkName, pkFields)); } return Optional.empty(); }
Source:
public void killQuery(String queryId, String message) { QueryId query = parseQueryId(queryId); try { Optional<QueryState> state = queryManager.getQueryState(query); if (!state.isPresent()) { throw new NoSuchElementException(); } if (state.get().isDone()) { throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId); } queryManager.failQuery(query, createKillQueryException(message)); if (!ADMINISTRATIVELY_KILLED.toErrorCode().equals(queryManager.getQueryInfo(query).getErrorCode())) { throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId); } } catch (NoSuchElementException e) { throw new PrestoException(NOT_FOUND, "Target query not found: " + queryId); } }

Target:
public void killQuery(String queryId, String message) { QueryId query = parseQueryId(queryId); try { QueryState state = queryManager.getQueryState(query); if (state.isDone()) { throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId); } queryManager.failQuery(query, createKillQueryException(message)); if (!ADMINISTRATIVELY_KILLED.toErrorCode().equals(queryManager.getQueryInfo(query).getErrorCode())) { throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId); } } catch (NoSuchElementException e) { throw new PrestoException(NOT_FOUND, "Target query not found: " + queryId); } }
Source:
private ApiResponseSet alertToSet(Alert alert) { Map<String, String> map = new HashMap<>(); map.put("id", String.valueOf(alert.getAlertId())); map.put("name", alert.getName()); map.put("description", alert.getDescription()); map.put("risk", Alert.MSG_RISK[alert.getRisk()]); map.put("confidence", Alert.MSG_CONFIDENCE[alert.getConfidence()]); map.put("url", alert.getUri()); map.put("other", alert.getOtherInfo()); map.put("param", alert.getParam()); map.put("attack", alert.getAttack()); map.put("evidence", alert.getEvidence()); map.put("reference", alert.getReference()); map.put("cweid", String.valueOf(alert.getCweId())); map.put("wascid", String.valueOf(alert.getWascId())); map.put("solution", alert.getSolution()); if (alert.getHistoryRef() != null) { map.put("messageId", String.valueOf(alert.getHistoryRef().getHistoryId())); } return new ApiResponseSet("alert", map); }

Target:
private ApiResponseSet alertToSet(Alert alert) { Map<String, String> map = new HashMap<>(); map.put("id", String.valueOf(alert.getAlertId())); map.put("pluginId", String.valueOf(alert.getPluginId())); map.put("alert", alert.getName()); map.put("name", alert.getName()); map.put("description", alert.getDescription()); map.put("risk", Alert.MSG_RISK[alert.getRisk()]); map.put("confidence", Alert.MSG_CONFIDENCE[alert.getConfidence()]); map.put("url", alert.getUri()); map.put("other", alert.getOtherInfo()); map.put("param", alert.getParam()); map.put("attack", alert.getAttack()); map.put("evidence", alert.getEvidence()); map.put("reference", alert.getReference()); map.put("cweid", String.valueOf(alert.getCweId())); map.put("wascid", String.valueOf(alert.getWascId())); map.put("solution", alert.getSolution()); if (alert.getHistoryRef() != null) { map.put("messageId", String.valueOf(alert.getHistoryRef().getHistoryId())); } return new ApiResponseSet("alert", map); }
Source:
public SVGReadParam() { super(); allowExternalResources = true; }

Target:
public SVGReadParam() { super(); }
Source:
public void testDistinctCountGroupByPushdown() { PlanNode justScan = buildPlan(planBuilder -> tableScan(planBuilder, pinotTable, regionId, secondsSinceEpoch, city, fare)); PlanNode distinctAggregation = buildPlan(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(justScan).singleGroupingSet(v("city"), v("regionid")))); testPQL(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(distinctAggregation).singleGroupingSet(v("city")).addAggregation(v("count_regionid"), getRowExpression("count(regionid)", defaultSessionHolder))), "SELECT DISTINCTCOUNT(regionId) FROM realtimeOnly GROUP BY city TOP 10000"); }

Target:
public void testDistinctCountGroupByPushdown() { PlanNode justScan = buildPlan(planBuilder -> tableScan(planBuilder, pinotTable, regionId, secondsSinceEpoch, city, fare)); PlanNode distinctAggregation = buildPlan(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(justScan).singleGroupingSet(variable("city"), variable("regionid")))); testPQL( planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(distinctAggregation).singleGroupingSet(variable("city")).addAggregation(variable("count_regionid"), getRowExpression("count(regionid)", defaultSessionHolder))), "SELECT DISTINCTCOUNT(regionId) FROM realtimeOnly GROUP BY city TOP 10000"); }
Source:
public InputStatus pollNext(ReaderOutput<T> output) throws Exception { RecordsWithSplitIds<E> recordsWithSplitId = this.currentFetch; if (recordsWithSplitId == null) { recordsWithSplitId = getNextFetch(output); if (recordsWithSplitId == null) { idleSince = clock.absoluteTimeMillis(); return trace(finishedOrAvailableLater()); } } idleSince = -1L; while (true) { final E record = recordsWithSplitId.nextRecordFromSplit(); if (record != null) { context.metricGroup().getNumRecordsInCounter().inc(); recordEmitter.emitRecord(record, currentSplitOutput, currentSplitContext.state); LOG.trace("Emitted record: {}", record); return trace(InputStatus.MORE_AVAILABLE); } else if (!moveToNextSplit(recordsWithSplitId, output)) { return pollNext(output); } } }

Target:
public InputStatus pollNext(ReaderOutput<T> output) throws Exception { RecordsWithSplitIds<E> recordsWithSplitId = this.currentFetch; if (recordsWithSplitId == null) { recordsWithSplitId = getNextFetch(output); if (recordsWithSplitId == null) { return trace(finishedOrAvailableLater()); } } while (true) { final E record = recordsWithSplitId.nextRecordFromSplit(); if (record != null) { numRecordsInCounter.inc(); recordEmitter.emitRecord(record, currentSplitOutput, currentSplitContext.state); LOG.trace("Emitted record: {}", record); return trace(InputStatus.MORE_AVAILABLE); } else if (!moveToNextSplit(recordsWithSplitId, output)) { return pollNext(output); } } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (full ? 1231 : 1237); result = prime * result + ((leftRot == null) ? 0 : leftRot.hashCode()); result = prime * result + ((matrix == null) ? 0 : matrix.hashCode()); result = prime * result + ((rightRot == null) ? 0 : rightRot.hashCode()); result = prime * result + ((scale == null) ? 0 : scale.hashCode()); result = prime * result + ((translation == null) ? 0 : translation.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((matrix == null) ? 0 : matrix.hashCode()); return result; }
Source:
private ParseHttpRequest getParseHttpRequest(Request okHttpRequest) { ParseHttpRequest.Builder parseRequestBuilder = new ParseHttpRequest.Builder(); switch (okHttpRequest.method()) { case OKHTTP_GET: parseRequestBuilder.setMethod(ParseRequest.Method.GET); break; case OKHTTP_DELETE: parseRequestBuilder.setMethod(ParseRequest.Method.DELETE); break; case OKHTTP_POST: parseRequestBuilder.setMethod(ParseRequest.Method.POST); break; case OKHTTP_PUT: parseRequestBuilder.setMethod(ParseRequest.Method.PUT); break; default: throw new IllegalArgumentException( "Invalid http method " + okHttpRequest.method()); } parseRequestBuilder.setUrl(okHttpRequest.urlString()); for (Map.Entry<String, List<String>> entry : okHttpRequest.headers().toMultimap().entrySet()) { parseRequestBuilder.addHeader(entry.getKey(), entry.getValue().get(0)); } if (okHttpRequest.body() instanceof CountingOkHttpRequestBody) { CountingOkHttpRequestBody okHttpBody = (CountingOkHttpRequestBody) okHttpRequest.body(); parseRequestBuilder.setBody(okHttpBody.getParseHttpBody()); } return parseRequestBuilder.build(); }

Target:
private ParseHttpRequest getParseHttpRequest(Request okHttpRequest) { ParseHttpRequest.Builder parseRequestBuilder = new ParseHttpRequest.Builder(); switch (okHttpRequest.method()) { case OKHTTP_GET: parseRequestBuilder.setMethod(ParseRequest.Method.GET); break; case OKHTTP_DELETE: parseRequestBuilder.setMethod(ParseRequest.Method.DELETE); break; case OKHTTP_POST: parseRequestBuilder.setMethod(ParseRequest.Method.POST); break; case OKHTTP_PUT: parseRequestBuilder.setMethod(ParseRequest.Method.PUT); break; default: throw new IllegalArgumentException( "Invalid http method " + okHttpRequest.method()); } parseRequestBuilder.setUrl(okHttpRequest.urlString()); for (Map.Entry<String, List<String>> entry : okHttpRequest.headers().toMultimap().entrySet()) { parseRequestBuilder.addHeader(entry.getKey(), entry.getValue().get(0)); } ParseOkHttpRequestBody okHttpBody = (ParseOkHttpRequestBody) okHttpRequest.body(); if (okHttpBody != null) { parseRequestBuilder.setBody(okHttpBody.getParseHttpBody()); } return parseRequestBuilder.build(); }
Source:
public static String dumpModelAsXml(CamelContext context, NamedNode definition) throws JAXBException { JAXBContext jaxbContext; if (context == null) { jaxbContext = createJAXBContext(); } else { jaxbContext = context.getModelJAXBContextFactory().newJAXBContext(); } final Map<String, String> namespaces = new LinkedHashMap<>(); if (definition instanceof RoutesDefinition) { List<RouteDefinition> routes = ((RoutesDefinition) definition).getRoutes(); for (RouteDefinition route : routes) { extractNamespaces(route, namespaces); } } else if (definition instanceof RouteDefinition) { RouteDefinition route = (RouteDefinition) definition; extractNamespaces(route, namespaces); } Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); StringWriter buffer = new StringWriter(); marshaller.marshal(definition, buffer); Document dom = context.getTypeConverter().convertTo(Document.class, buffer.toString()); Element documentElement = dom.getDocumentElement(); for (String nsPrefix : namespaces.keySet()) { documentElement.setAttribute("xmlns:" + nsPrefix, namespaces.get(nsPrefix)); } Exchange exchange = ExchangeBuilder.anExchange(context).build(); exchange.setProperty(XmlConverter.OUTPUT_PROPERTIES_PREFIX + OutputKeys.INDENT, "yes"); exchange.setProperty(XmlConverter.OUTPUT_PROPERTIES_PREFIX + OutputKeys.STANDALONE, "yes"); String result = context.getTypeConverter().convertTo(String.class, exchange, dom); return result; }

Target:
public static String dumpModelAsXml(CamelContext context, NamedNode definition) throws JAXBException { JAXBContext jaxbContext = getJAXBContext(context); final Map<String, String> namespaces = new LinkedHashMap<>(); if (definition instanceof RoutesDefinition) { List<RouteDefinition> routes = ((RoutesDefinition) definition).getRoutes(); for (RouteDefinition route : routes) { extractNamespaces(route, namespaces); } } else if (definition instanceof RouteDefinition) { RouteDefinition route = (RouteDefinition) definition; extractNamespaces(route, namespaces); } Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); StringWriter buffer = new StringWriter(); marshaller.marshal(definition, buffer); Document dom = context.getTypeConverter().convertTo(Document.class, buffer.toString()); Element documentElement = dom.getDocumentElement(); for (String nsPrefix : namespaces.keySet()) { documentElement.setAttribute("xmlns:" + nsPrefix, namespaces.get(nsPrefix)); } TypeConverterRegistry registry = context.getTypeConverterRegistry(); XmlConverter xmlConverter = registry.getInjector().newInstance(XmlConverter.class); Properties outputProperties = new Properties(); outputProperties.put(OutputKeys.INDENT, "yes"); outputProperties.put(OutputKeys.STANDALONE, "yes"); try { return xmlConverter.toStringFromDocument(dom, outputProperties); } catch (TransformerException e) { throw new IllegalStateException("Failed converting document object to string", e); } }
Source:
public String getLabelText() { int nbTraces = getTraces().size(); if (nbTraces > 0) { return getName() + " [" + getTraces().size() + "]"; } return getName(); }

Target:
public String getLabelText() { int nbTraces = getTraces().size(); if (nbTraces > 0) { return (getName() + " [" + nbTraces + ']'); } return getName(); }
Source:
public SlackNotifier(final String teamDomain, final String authToken, final String authTokenCredentialId, final String room, final String buildServerUrl, final String sendAs, final boolean startNotification, final boolean notifyAborted, final boolean notifyFailure, final boolean notifyNotBuilt, final boolean notifySuccess, final boolean notifyUnstable, final boolean notifyBackToNormal, final boolean notifyRepeatedFailure, final boolean includeTestSummary, CommitInfoChoice commitInfoChoice, boolean includeCustomMessage, String customMessage) { super(); this.teamDomain = teamDomain; this.authToken = authToken; this.authTokenCredentialId = authTokenCredentialId.trim(); this.buildServerUrl = buildServerUrl; this.room = room; this.sendAs = sendAs; this.startNotification = startNotification; this.notifyAborted = notifyAborted; this.notifyFailure = notifyFailure; this.notifyNotBuilt = notifyNotBuilt; this.notifySuccess = notifySuccess; this.notifyUnstable = notifyUnstable; this.notifyBackToNormal = notifyBackToNormal; this.notifyRepeatedFailure = notifyRepeatedFailure; this.includeTestSummary = includeTestSummary; this.commitInfoChoice = commitInfoChoice; this.includeCustomMessage = includeCustomMessage; this.customMessage = customMessage; }

Target:
public SlackNotifier(final String teamDomain, final String authToken, final String authTokenCredentialId, final String room, final String buildServerUrl, final String sendAs, final boolean startNotification, final boolean notifyAborted, final boolean notifyFailure, final boolean notifyNotBuilt, final boolean notifySuccess, final boolean notifyUnstable, final boolean notifyBackToNormal, final boolean notifyRepeatedFailure, final boolean includeTestSummary, CommitInfoChoice commitInfoChoice, boolean includeCustomMessage, String customMessage) { super(); this.teamDomain = teamDomain; this.authToken = authToken; this.authTokenCredentialId = StringUtils.trim(authTokenCredentialId); this.buildServerUrl = buildServerUrl; this.room = room; this.sendAs = sendAs; this.startNotification = startNotification; this.notifyAborted = notifyAborted; this.notifyFailure = notifyFailure; this.notifyNotBuilt = notifyNotBuilt; this.notifySuccess = notifySuccess; this.notifyUnstable = notifyUnstable; this.notifyBackToNormal = notifyBackToNormal; this.notifyRepeatedFailure = notifyRepeatedFailure; this.includeTestSummary = includeTestSummary; this.commitInfoChoice = commitInfoChoice; this.includeCustomMessage = includeCustomMessage; this.customMessage = customMessage; }
Source:
private void checkUpdateDataPermission(HttpServletRequest request) throws InsufficientPermissionException { Boolean auth = true; UserAccountBean userBean =(UserAccountBean) request.getSession().getAttribute(USER_BEAN_NAME); ArrayList userRoles = userBean.getRoles(); String submitted =(String) request.getParameter("submitted"); String checkInputs = (String)request.getParameter("checkInputs"); if(submitted !=null && submitted.equals("1") && checkInputs!=null && checkInputs.equals("1")) { for (int i = 0; i < userRoles.size(); i++) { StudyUserRoleBean studyRole = (StudyUserRoleBean) userRoles.get(i); if(studyRole.getRole().equals(Role.MONITOR)) { auth = false; } } } if(!auth) { addPageMessage(respage.getString("you_not_have_permission_update_a_CRF"), request); throw new InsufficientPermissionException(Page.MENU_SERVLET, resexception.getString("no_permission_to_perform_data_entry"), "1"); } }

Target:
private void checkUpdateDataPermission(HttpServletRequest request) throws InsufficientPermissionException { Boolean auth = true; UserAccountBean userBean =(UserAccountBean) request.getSession().getAttribute(USER_BEAN_NAME); StudyBean currentStudy = (StudyBean) request.getSession().getAttribute("study"); ArrayList userRoles = userBean.getRoles(); String submitted =(String) request.getParameter("submitted"); String checkInputs = (String)request.getParameter("checkInputs"); if(submitted !=null && submitted.equals("1") && checkInputs!=null && checkInputs.equals("1")) { for (int i = 0; i < userRoles.size(); i++) { StudyUserRoleBean studyRole = (StudyUserRoleBean) userRoles.get(i); if(studyRole.getRole().equals(Role.MONITOR) && studyRole.getStudyId() == currentStudy.getId()) { auth = false; break; } } } if(!auth) { addPageMessage(respage.getString("you_not_have_permission_update_a_CRF"), request); throw new InsufficientPermissionException(Page.MENU_SERVLET, resexception.getString("no_permission_to_perform_data_entry"), "1"); } }
Source:
public String toString() { return Objects.toStringHelper(this) .omitNullValues() .add("revision", revision.getName()) .add("oldRevision", oldRevision.getName()) .add("path", path) .toString(); }

Target:
public String toString() { return Objects.toStringHelper(this) .omitNullValues() .add("revision", revision.getName()) .add("oldRevision", oldRevision != null ? oldRevision.getName() : null) .add("path", path) .toString(); }
Source:
public String getDeletedAtDateString() { if (this.deletedAt == null) { return Const.DELETION_DATE_NOT_APPLICABLE; } else { return TimeHelper.formatDateForInstructorCoursesPage(deletedAt, timeZone); } }

Target:
public String getDeletedAtDateString() { if (this.deletedAt == null) { return Const.DELETION_DATE_NOT_APPLICABLE; } return TimeHelper.formatDateForInstructorCoursesPage(deletedAt, timeZone); }
Source:
private void setWayGeometry_( PointList pillarNodes, long edgePointer, boolean reverse ) { if (pillarNodes != null && !pillarNodes.isEmpty()) { if (pillarNodes.getDimension() != nodeAccess.getDimension()) throw new IllegalArgumentException("Cannot use pointlist which is " + pillarNodes.getDimension() + "D for graph which is " + nodeAccess.getDimension() + "D"); long existingGeoRef = Helper.toUnsignedLong(edges.getInt(edgePointer + E_GEO)); int len = pillarNodes.getSize(); int dim = nodeAccess.getDimension(); if (existingGeoRef > 0) { long existingGeoRefPos = existingGeoRef * 4L; final int count = wayGeometry.getInt(existingGeoRefPos); if (len <= count) { if (len < count) { eraseWayGeometryAtGeoRef(count, existingGeoRef); } setWayGeometryAtGeoRef(pillarNodes, edgePointer, reverse, existingGeoRef); return; } } long nextGeoRef = nextGeoRef(len * dim); setWayGeometryAtGeoRef(pillarNodes, edgePointer, reverse, nextGeoRef); } else { edges.setInt(edgePointer + E_GEO, 0); } }

Target:
private void setWayGeometry_( PointList pillarNodes, long edgePointer, boolean reverse ) { if (pillarNodes != null && !pillarNodes.isEmpty()) { if (pillarNodes.getDimension() != nodeAccess.getDimension()) throw new IllegalArgumentException("Cannot use pointlist which is " + pillarNodes.getDimension() + "D for graph which is " + nodeAccess.getDimension() + "D"); long existingGeoRef = Helper.toUnsignedLong(edges.getInt(edgePointer + E_GEO)); int len = pillarNodes.getSize(); int dim = nodeAccess.getDimension(); if (existingGeoRef > 0) { long existingGeoRefPos = existingGeoRef * 4L; final int count = wayGeometry.getInt(existingGeoRefPos); if (len <= count) { setWayGeometryAtGeoRef(pillarNodes, edgePointer, reverse, existingGeoRef); return; } } long nextGeoRef = nextGeoRef(len * dim); setWayGeometryAtGeoRef(pillarNodes, edgePointer, reverse, nextGeoRef); } else { edges.setInt(edgePointer + E_GEO, 0); } }
Source:
private void moveProductsUpward() { $(allCarrouselDivs).addClass(stateTransitionStyleName); $(allCarrouselDivs).addClass(stateAboveStyleName); Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { removeProductClasses(); switchInteger(); setEnabled(productInt); return false; } }, 500); }

Target:
private void moveProductsUpward() { toggleClass(true); Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { removeProductClasses(); switchInteger(); setEnabled(productInt); return false; } }, animationTopDownDuration); }
Source:
public Artifact getRequirementFromArtifactId(ArtifactId artId) { for (Artifact art : directRequirements) { if (art.getId().equals(artId.getId())) { return art; } } return null; }

Target:
public Artifact getRequirementFromArtifactId(ArtifactId artId) { for (Artifact art : directRequirements) { if (art.equals(artId)) { return art; } } return null; }
Source:
public static void main(final String... args) { LOGGER.info("\n==========================================================" + "\n " + "\n Welcome to the Spring Integration Dynamic Poller Sample! " + "\n " + "\n For more information please visit: " + "\n <LINK_0> " + "\n " + "\n==========================================================" ); final AbstractApplicationContext context = new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook(); final Scanner scanner = new Scanner(System.in); final DynamicPeriodicTrigger trigger = context.getBean(DynamicPeriodicTrigger.class); LOGGER.info("\n=========================================================" + "\n " + "\n Please press 'q + Enter' to quit the application. " + "\n " + "\n=========================================================" ); System.out.print("Please enter a non-negative numeric value and press <enter>: "); while (!scanner.hasNext("q")) { int triggerPeriod = scanner.nextInt(); System.out.println(String.format("Setting trigger period to '%s' ms", triggerPeriod)); trigger.setPeriod(triggerPeriod); System.out.print("Please enter a non-negative numeric value and press <enter>: "); } LOGGER.info("Exiting application...bye."); System.exit(0); }

Target:
public static void main(final String... args) { LOGGER.info("\n==========================================================" + "\n " + "\n Welcome to the Spring Integration Dynamic Poller Sample! " + "\n " + "\n For more information please visit: " + "\n <LINK_0> " + "\n " + "\n==========================================================" ); final AbstractApplicationContext context = new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook(); final Scanner scanner = new Scanner(System.in); final DynamicPeriodicTrigger trigger = context.getBean(DynamicPeriodicTrigger.class); LOGGER.info("\n=========================================================" + "\n " + "\n Please press 'q + Enter' to quit the application. " + "\n " + "\n=========================================================" ); System.out.print("Please enter a non-negative numeric value and press <enter>: "); while (true) { final String input = scanner.nextLine(); if("q".equals(input.trim())) { break; } try { int triggerPeriod = Integer.valueOf(input); System.out.println(String.format("Setting trigger period to '%s' ms", triggerPeriod)); trigger.setPeriod(triggerPeriod); } catch (Exception e) { LOGGER.error("An exception was caught: " + e); } System.out.print("Please enter a non-negative numeric value and press <enter>: "); } LOGGER.info("Exiting application...bye."); System.exit(0); }
Source:
public DataCenter reInitializeDataCenter(String dcId) throws RuntimeException { log.info("about to reinitialize dc"); DataCenter dataCenter = new DataCenter(); dataCenter.setId(dcId); updateDataCenter(dataCenter); return dataCenter; }

Target:
private DataCenter reInitializeDataCenter(String dcId) throws RuntimeException { log.info("about to reinitialize dc"); DataCenter dataCenter = new DataCenter(); dataCenter.setId(dcId); updateDataCenter(dataCenter); return dataCenter; }
Source:
public Response previewSnapshot(Action action) { validateParameters(action, "snapshot.id"); TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(guid, asGuid(action.getSnapshot().getId())); if (action.isSetRestoreMemory()) { tryBackParams.setRestoreMemory(action.isRestoreMemory()); } if (action.isSetDisks()) { List<DiskImage> disks = getParent().mapDisks(action.getDisks()); if (disks != null) { String noImageId = disks.stream() .filter(disk -> disk.getImageId().toString().equals("00000000-0000-0000-0000-000000000000")) .map(disk -> disk.getId().toString()) .collect(Collectors.joining(",")); if (!noImageId.isEmpty()) { badRequest("Missing image ids for disks: " + noImageId); } } tryBackParams.setImageIds(getDisksGuidSet(disks)); } Response response = doAction(ActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action); return response; }

Target:
public Response previewSnapshot(Action action) { validateParameters(action, "snapshot.id"); TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(guid, asGuid(action.getSnapshot().getId())); if (action.isSetRestoreMemory()) { tryBackParams.setRestoreMemory(action.isRestoreMemory()); } if (action.isSetDisks()) { List<DiskImage> disks = getParent().mapDisks(action.getDisks()); if (disks != null) { String noImageId = disks.stream() .filter(disk -> disk.getImageId().equals(Guid.Empty)) .map(disk -> disk.getId().toString()) .collect(Collectors.joining(",")); if (!noImageId.isEmpty()) { badRequest("Missing image ids for disks: " + noImageId); } } tryBackParams.setImageIds(getDisksGuidSet(disks)); } Response response = doAction(ActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action); return response; }
Source:
private void processStateEvent(NodeStateEvent event) { assert adminExecutor.inEventLoop(); DefaultNode node = event.node; NodeState oldState = event.oldState; NodeState newState = event.newState; if (pending.containsKey(node)) { pendingStateEvents.put(node, event); } else if (newState == null || newState == NodeState.FORCED_DOWN) { ChannelPool pool = pools.remove(node); if (pool != null) { LOG.debug( "[{}] was {}, destroying pool", logPrefix, node, newState == null ? "removed" : "forced down"); pool.closeAsync() .exceptionally( error -> { Loggers.warnWithException(LOG, "[{}] Error closing pool", logPrefix, error); return null; }); } } else if (oldState == NodeState.FORCED_DOWN && newState == NodeState.UP && node.getDistance() != NodeDistance.IGNORED) { LOG.debug("[{}] was forced back UP, initializing pool", logPrefix, node); createOrReconnectPool(node); } }

Target:
private void processStateEvent(NodeStateEvent event) { assert adminExecutor.inEventLoop(); DefaultNode node = event.node; NodeState oldState = event.oldState; NodeState newState = event.newState; if (pending.containsKey(node)) { pendingStateEvents.put(node, event); } else if (newState == null || newState == NodeState.FORCED_DOWN) { ChannelPool pool = pools.remove(node); if (pool != null) { LOG.debug( "[{}] was {}, destroying pool", logPrefix, node, newState == null ? "removed" : newState.name()); pool.closeAsync() .exceptionally( error -> { Loggers.warnWithException(LOG, "[{}] Error closing pool", logPrefix, error); return null; }); } } else if (oldState == NodeState.FORCED_DOWN && newState == NodeState.UP && node.getDistance() != NodeDistance.IGNORED) { LOG.debug("[{}] was forced back UP, initializing pool", logPrefix, node); createOrReconnectPool(node); } }
Source:
static double getSamplingValue(SamplingConfig.Identifier identifier) { return new BigDecimal(Long.valueOf(getSamplingId(identifier).substring(0, 8), 16)) .divide(new BigDecimal(0xFFFFFFFFL), 4, RoundingMode.FLOOR) .doubleValue(); }

Target:
static double getSamplingValue(SamplingConfig.Identifier identifier) { String token = getSamplingId(identifier).substring(0, 8); return (double) Long.parseLong(token, 16) / (double) 0xFFFFFFFFL; }
Source:
private List<File> getHadoopConfigurationFileItems(String localHadoopConfigurationDirectory) { final File file = new File(localHadoopConfigurationDirectory); if (file.exists() && file.isDirectory()) { return Arrays.stream(file.listFiles()).filter(File::isFile).collect(Collectors.toList()); } else { return Collections.emptyList(); } }

Target:
private List<File> getHadoopConfigurationFileItems(String localHadoopConfigurationDirectory) { final List<String> expectedFileNames = new ArrayList<>(); expectedFileNames.add("core-site.xml"); expectedFileNames.add("hdfs-site.xml"); final File directory = new File(localHadoopConfigurationDirectory); if (directory.exists() && directory.isDirectory()) { return Arrays.stream(directory.listFiles()) .filter(file -> file.isFile() && expectedFileNames.stream().anyMatch(name -> file.getName().equals(name))) .collect(Collectors.toList()); } else { return Collections.emptyList(); } }
Source:
public Pool createAndEnrichPools(Pool pool, List<Pool> existingPools) { List<Pool> pools = poolRules.createAndEnrichPools(pool, existingPools); log.debug("Creating pools: ", pools.size()); boolean isPoolLocked = pool.isLocked(); for (Pool p : pools) { createPool(p); } for (Pool tempPool : pools) { if (isPoolLocked) { tempPool.setLocked(true); } } return pool; }

Target:
public Pool createAndEnrichPools(Pool pool, List<Pool> existingPools) { List<Pool> pools = poolRules.createAndEnrichPools(pool, existingPools); log.debug("Creating pools: ", pools.size()); for (Pool p : pools) { createPool(p); } return pool; }
Source:
protected Map<String, String> getCurrentExtras(Configuration configuration, Cluster cluster) { Map<String, String> extras = new HashMap<String, String>(); extras.put(Properties.PROPERTY_CONFIG_NAME, configuration.name); extras.put(Properties.PROPERTY_PLUGIN_NAME, state.getPlugin()); extras.put(Properties.PROPERTY_CLUSTER_SIZE, String.valueOf(cluster.getSize())); extras.put(Properties.PROPERTY_CLUSTER_MAX_SIZE, String.valueOf(state.getMaxClusterSize())); extras.put(Properties.PROPERTY_SLAVE_INDEX, String.valueOf(state.getSlaveIndex())); Cluster.Group group = cluster.getGroup(state.getSlaveIndex()); extras.put(Properties.PROPERTY_GROUP_NAME, group.name); extras.put(Properties.PROPERTY_GROUP_SIZE, String.valueOf(group.size)); for (Cluster.Group g : cluster.getGroups()) { for(int i = 0; i != g.size; i++){ extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + "." + i, state.getSlaveAddress(cluster, g.name, i).getAddress().toString().substring(1)); } } for (Cluster.Group g : cluster.getGroups()) { extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + Properties.PROPERTY_SIZE_SUFFIX, String.valueOf(group.size)); } extras.put(Properties.PROPERTY_PROCESS_ID, String.valueOf(Utils.getProcessID())); return extras; }

Target:
protected Map<String, String> getCurrentExtras(Configuration configuration, Cluster cluster) { Map<String, String> extras = new HashMap<String, String>(); extras.put(Properties.PROPERTY_CONFIG_NAME, configuration.name); extras.put(Properties.PROPERTY_PLUGIN_NAME, state.getPlugin()); extras.put(Properties.PROPERTY_CLUSTER_SIZE, String.valueOf(cluster.getSize())); extras.put(Properties.PROPERTY_CLUSTER_MAX_SIZE, String.valueOf(state.getMaxClusterSize())); extras.put(Properties.PROPERTY_SLAVE_INDEX, String.valueOf(state.getSlaveIndex())); Cluster.Group group = cluster.getGroup(state.getSlaveIndex()); extras.put(Properties.PROPERTY_GROUP_NAME, group.name); extras.put(Properties.PROPERTY_GROUP_SIZE, String.valueOf(group.size)); for (Cluster.Group g : cluster.getGroups()) { for(int i = 0; i != g.size; i++){ SlaveConnectionInfo ifaces = state.getSlaveAddresses(cluster, g.name, i); for (String s: ifaces.getInterfaceNames()) { extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + "." + i + "." + s, ifaces.getAddressesAsString(s, ",")); } } } for (Cluster.Group g : cluster.getGroups()) { extras.put(Properties.PROPERTY_GROUP_PREFIX + g.name + Properties.PROPERTY_SIZE_SUFFIX, String.valueOf(group.size)); } extras.put(Properties.PROPERTY_PROCESS_ID, String.valueOf(Utils.getProcessID())); return extras; }
Source:
protected Protos.Resource rangeResource(String name, long begin, long end) { List<Protos.Resource> reservedResources = new LinkedList<>(); for (Protos.Resource resource : offer.getResourcesList()) { if (resource.hasRole() && !resource.getRole().equals("*")) { reservedResources.add(resource); } } String role = "*"; for (Protos.Resource resource : reservedResources) { if (resource.getName().equalsIgnoreCase(name)) { Protos.Value.Ranges ranges = resource.getRanges(); for (Protos.Value.Range range : ranges.getRangeList()) { if (range.getBegin() <= begin && range.getEnd() >= end) { role = resource.getRole(); break; } } } } return Protos.Resource.newBuilder() .setType(Protos.Value.Type.RANGES) .setName(name) .setRanges(Protos.Value.Ranges.newBuilder() .addRange(Protos.Value.Range.newBuilder() .setBegin(begin) .setEnd(end) ).build() ) .setRole(role) .build(); }

Target:
protected Protos.Resource rangeResource(String name, long begin, long end) { List<Protos.Resource> reservedResources = new LinkedList<>(); for (Protos.Resource resource : offer.getResourcesList()) { if (resource.hasRole() && !resource.getRole().equals("*")) { reservedResources.add(resource); } } String role = "*"; for (Protos.Resource resource : reservedResources) { if (resource.getName().equals(name)) { Protos.Value.Ranges ranges = resource.getRanges(); for (Protos.Value.Range range : ranges.getRangeList()) { if (range.getBegin() <= begin && range.getEnd() >= end) { role = resource.getRole(); break; } } } } return Protos.Resource.newBuilder() .setType(Protos.Value.Type.RANGES) .setName(name) .setRanges(Protos.Value.Ranges.newBuilder() .addRange(Protos.Value.Range.newBuilder() .setBegin(begin) .setEnd(end) ).build() ) .setRole(role) .build(); }
Source:
public Iterator<DataFactory<ENTITY>> iterator() { return Iterators.iterator( new DataFactory<ENTITY>() { @Override public Data<ENTITY> create( Configuration config ) { return new Data<ENTITY>() { @Override public CharReadable stream() { return last = factory.apply( config ); } @Override public Decorator<ENTITY> decorator() { return decorator; } }; } } ); }

Target:
public Iterator<DataFactory<ENTITY>> iterator() { return Iterators.iterator( config -> new Data<ENTITY>() { @Override public CharReadable stream() { return last = factory.apply( config ); } @Override public Decorator<ENTITY> decorator() { return decorator; } } ); }
Source:
public void onResearchFireworkDamage(final EntityDamageByEntityEvent e) { if (e.getEntityType() == EntityType.PLAYER && e.getDamager() instanceof Firework) if (((Firework) e.getDamager()).getFireworkMeta().getPersistentDataContainer() .get(new NamespacedKey(SlimefunPlugin.instance, "slime"), PersistentDataType.INTEGER) != null && ((Firework) e.getDamager()).getFireworkMeta().getPersistentDataContainer() .get(new NamespacedKey(SlimefunPlugin.instance, "slime"), PersistentDataType.INTEGER) == 1) e.setCancelled(true); }

Target:
public void onResearchFireworkDamage(final EntityDamageByEntityEvent e) { Firework fw = null; if (e.getDamager() instanceof Firework) { fw = (Firework) e.getDamager(); if (!fw.getMetadata("slime").isEmpty() && fw.getMetadata("slime").get(0).asBoolean()) e.setCancelled(true); } }
Source:
public static <K, A> PriorityQueue<K, A> empty(Monoid<K> m, Equal<K> e) { return priorityQueue(e, FingerTree.empty(m, (P2<K, A> p) -> p._1())); }

Target:
public static <K, A> PriorityQueue<K, A> empty(Monoid<K> m, Equal<K> e) { return priorityQueue(e, FingerTree.empty(m, P2.__1())); }
Source:
private RexNode simplifyCoalesce(RexCall call) { final Set<String> digests = new HashSet<>(); final List<RexNode> operands = new ArrayList<>(); for (RexNode operand : call.getOperands()) { operand = withUnknownAsFalse(false).simplify_(operand); if (digests.add(operand.digest) && (!RexUtil.isNull(operand) || !unknownAsFalse)) { operands.add(operand); } if (!operand.getType().isNullable()) { break; } } switch (operands.size()) { case 0: return rexBuilder.makeNullLiteral(call.type); case 1: return operands.get(0); default: if (operands.equals(call.operands)) { return call; } return call.clone(call.type, operands); } }

Target:
private RexNode simplifyCoalesce(RexCall call) { final Set<String> digests = new HashSet<>(); final List<RexNode> operands = new ArrayList<>(); final RexSimplify simplify = withUnknownAsFalse(false); for (RexNode operand : call.getOperands()) { operand = simplify.simplify_(operand); if (digests.add(operand.digest)) { operands.add(operand); } if (!operand.getType().isNullable()) { break; } } switch (operands.size()) { case 0: return rexBuilder.makeNullLiteral(call.type); case 1: return operands.get(0); default: if (operands.equals(call.operands)) { return call; } return call.clone(call.type, operands); } }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> this.importedNames.clear()); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_FROM, ctx -> { PyImportFromTree importFrom = (PyImportFromTree) ctx.syntaxNode(); for (PyAliasedNameTree aliasedName : importFrom.importedNames()) { addImportedName(aliasedName); } }); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_NAME, ctx -> { PyImportNameTree importName = (PyImportNameTree) ctx.syntaxNode(); for (PyAliasedNameTree aliasedName : importName.modules()) { addImportedName(aliasedName); } }); context.registerSyntaxNodeConsumer(Tree.Kind.ASSIGNMENT_STMT, ctx -> { PyAssignmentStatementTree assignment = (PyAssignmentStatementTree) ctx.syntaxNode(); PyExpressionTree assignedValue = assignment.assignedValue(); for (int i = 0; i < assignment.lhsExpressions().size(); i++) { List<PyExpressionTree> expressions = assignment.lhsExpressions().get(i).expressions(); if (expressions.size() == 1 && CheckUtils.areEquivalent(assignedValue, expressions.get(0)) && !isException(assignment, assignedValue)) { ctx.addIssue(assignment.equalTokens().get(i), MESSAGE); } } }); context.registerSyntaxNodeConsumer(Tree.Kind.ANNOTATED_ASSIGNMENT, ctx -> { PyAnnotatedAssignmentTree assignment = (PyAnnotatedAssignmentTree) ctx.syntaxNode(); PyExpressionTree assignedValue = assignment.assignedValue(); PyExpressionTree variable = assignment.variable(); if (CheckUtils.areEquivalent(assignedValue, variable) && !isException(assignment, assignedValue)) { ctx.addIssue(assignment.equalToken(), MESSAGE); } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> this.importedNames.clear()); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_FROM, ctx -> ((PyImportFromTree) ctx.syntaxNode()).importedNames().forEach(this::addImportedName)); context.registerSyntaxNodeConsumer(Tree.Kind.IMPORT_NAME, ctx -> ((PyImportNameTree) ctx.syntaxNode()).modules().forEach(this::addImportedName)); context.registerSyntaxNodeConsumer(Tree.Kind.ASSIGNMENT_STMT, this::checkAssignement); context.registerSyntaxNodeConsumer(Tree.Kind.ANNOTATED_ASSIGNMENT, this::checkAnnotatedAssignment); }