auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ClusterCachesInfo(GridKernalContext ctx) { this.ctx = ctx; ctx.metric().list(CACHES_MON_LIST, CACHES_MON_LIST_DESC, CacheView.class, l -> cachesMonList = l, l -> cachesMonList = null); ctx.metric().list(CACHE_GRPS_MON_LIST, CACHE_GRPS_MON_LIST_DESC, CacheGroupView.class, l -> cachesGrpMonList = l, l -> cachesGrpMonList = null); <START> <END> log = ctx.log(getClass()); }</code><technical_language>List inconsistent disable in runtime, create new caches enable again</technical_language>

Target:
public ClusterCachesInfo(GridKernalContext ctx) { this.ctx = ctx; ctx.systemView().registerView(CACHES_VIEW, CACHES_VIEW_DESC, CacheView.class, registeredCaches.values(), CacheView::new); ctx.systemView().registerView(CACHE_GRPS_VIEW, CACHE_GRPS_VIEW_DESC, CacheGroupView.class, registeredCacheGrps.values(), CacheGroupView::new); log = ctx.log(getClass()); }
Source:
<code>public void authorize(Table table, Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv) throws HiveException, AuthorizationException { try { initWh(); } catch (MetaException ex) { throw hiveException(ex); } DropPrivilegeExtractor privExtractor = new DropPrivilegeExtractor(readRequiredPriv, writeRequiredPriv); readRequiredPriv = privExtractor.getReadReqPriv(); writeRequiredPriv = privExtractor.getWriteReqPriv(); if (privExtractor.hasDropPrivilege || requireCreatePrivilege(readRequiredPriv) || requireCreatePrivilege(writeRequiredPriv)) { authorize(hive_db.getDatabase(table.getCatName(), table.getDbName()), new Privilege[] {}, new Privilege[] { Privilege.ALTER_DATA }); } Path path = table.getDataLocation(); if (privExtractor.hasDropPrivilege() && (table.getTableType() != TableType.EXTERNAL_TABLE || getConf().getBoolean(HiveConf.ConfVars.METASTORE_AUTHORIZATION_EXTERNALTABLE_DROP_CHECK.varname, HiveConf.ConfVars.METASTORE_AUTHORIZATION_EXTERNALTABLE_DROP_CHECK.defaultBoolVal))) { checkDeletePermission(path, getConf(), authenticator.getUserName()); } try { String user = SecurityUtils.getUGI().getShortUserName(); if (MetaStoreServerUtils.checkUserHasHostProxyPrivileges(user, getConf(), HiveMetaStore.HMSHandler.getIPAddress())) { LOG.info("Path authentication is skipped for user with host proxy privilege." + user); } } catch (Exception ex) { <START> LOG.error("Cannot obtain username to check for host proxy privilege", ex); <END> } if (path != null) { authorize(path, readRequiredPriv, writeRequiredPriv); } }</code><technical_language>This warning msg</technical_language>

Target:
public void authorize(Table table, Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv) throws HiveException, AuthorizationException { try { initWh(); } catch (MetaException ex) { throw hiveException(ex); } DropPrivilegeExtractor privExtractor = new DropPrivilegeExtractor(readRequiredPriv, writeRequiredPriv); readRequiredPriv = privExtractor.getReadReqPriv(); writeRequiredPriv = privExtractor.getWriteReqPriv(); if (privExtractor.hasDropPrivilege || requireCreatePrivilege(readRequiredPriv) || requireCreatePrivilege(writeRequiredPriv)) { authorize(hive_db.getDatabase(table.getCatName(), table.getDbName()), new Privilege[] {}, new Privilege[] { Privilege.ALTER_DATA }); } Path path = table.getDataLocation(); if (privExtractor.hasDropPrivilege() && (table.getTableType() != TableType.EXTERNAL_TABLE || getConf().getBoolean(HiveConf.ConfVars.METASTORE_AUTHORIZATION_EXTERNALTABLE_DROP_CHECK.varname, HiveConf.ConfVars.METASTORE_AUTHORIZATION_EXTERNALTABLE_DROP_CHECK.defaultBoolVal))) { checkDeletePermission(path, getConf(), authenticator.getUserName()); } if (path != null) { authorize(path, readRequiredPriv, writeRequiredPriv); } }
Source:
<code>public TurboLabel(String repoId, String name) { this.actualName = name; this.colour = "ffffff"; this.repoId = repoId; <START> this.isInExclusiveGroup = checkIfInExclusiveGroup(); <END> }</code><technical_language>Instead of a boolean, enum called Grouping values {EXCLUSIVE, NON-EXCLUSIVE, NONE}</technical_language>

Target:
public TurboLabel(String repoId, String name) { this(repoId, DEFAULT_COLOR, name); }
Source:
<code>public ModelAndView index(Request request, Response response) { <START> boolean isSecurityEnabled = this.securityService.isSecurityEnabled(); <END> JsonObject showBanner = new JsonObject(); showBanner.addProperty("showBanner", isSecurityEnabled); Map<Object, Object> object = new HashMap<Object, Object>() {{ put("viewTitle", "User Summary"); put("meta", showBanner); }}; return new ModelAndView(object, null); }</code><technical_language>This right. I explicitly checking if <admin/> tag is present. if delegate SecurityConfig#noAdminsRequired security service</technical_language>

Target:
public ModelAndView index(Request request, Response response) { JsonObject noAdminsConfigured = new JsonObject(); noAdminsConfigured.addProperty("noAdminsConfigured", this.securityService.noAdminsConfigured()); Map<Object, Object> object = new HashMap<Object, Object>() {{ put("viewTitle", "User Summary"); put("meta", noAdminsConfigured); }}; return new ModelAndView(object, null); }
Source:
<code>protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfgBuilder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false)); cfgBuilder.encoding().key().mediaType(MediaType.APPLICATION_PROTOSTREAM_TYPE); cfgBuilder.encoding().value().mediaType(MediaType.APPLICATION_PROTOSTREAM_TYPE); createHotRodServers(NUM_NODES, cfgBuilder); waitForClusterToForm(); RemoteCache<String, String> metadataCache = client(0).getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME); metadataCache.put("sample_bank_account/bank.proto", Util.getResourceAsString("/sample_bank_account/bank.proto", getClass().getClassLoader())); assertFalse(metadataCache.containsKey(ProtobufMetadataManagerConstants.ERRORS_KEY_SUFFIX)); <START> cacheManagers.forEach(cm -> { <END> ProtobufMetadataManager metadataManager = cm.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class); metadataManager.registerMarshaller(new UserMarshaller()); metadataManager.registerMarshaller(new GenderMarshaller()); metadataManager.registerMarshaller(new AddressMarshaller()); metadataManager.registerMarshaller(new AccountMarshaller()); metadataManager.registerMarshaller(new TransactionMarshaller()); }); MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext(client(0))); }</code><technical_language>Lines 65-72 replaced for (EmbeddedCacheManager cm : cacheManagers) { MarshallerRegistration.registerMarshallers(ProtobufMetadataManagerImpl.getSerializationContextInternal(cm)); }</technical_language>

Target:
protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfgBuilder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false)); cfgBuilder.encoding().key().mediaType(MediaType.APPLICATION_PROTOSTREAM_TYPE); cfgBuilder.encoding().value().mediaType(MediaType.APPLICATION_PROTOSTREAM_TYPE); createHotRodServers(NUM_NODES, cfgBuilder); waitForClusterToForm(); RemoteCache<String, String> metadataCache = client(0).getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME); metadataCache.put("sample_bank_account/bank.proto", Util.getResourceAsString("/sample_bank_account/bank.proto", getClass().getClassLoader())); assertFalse(metadataCache.containsKey(ProtobufMetadataManagerConstants.ERRORS_KEY_SUFFIX)); for (EmbeddedCacheManager cm : cacheManagers) { MarshallerRegistration.registerMarshallers(ProtobufMetadataManagerImpl.getSerializationContextInternal(cm)); } MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext(client(0))); }
Source:
<code>public Stddev(String fieldName, Schema fieldSchema) { Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!AggregationUtils.isNumericType(fieldType)) { throw new IllegalArgumentException(String.format( <START> "Cannot compute standard devisation on field %s because its type %s is not numeric", fieldName, fieldType)); <END> } this.variance = new Variance(fieldName, fieldSchema); }</code><technical_language>typo</technical_language>

Target:
public Stddev(String fieldName, Schema fieldSchema) { Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!AggregationUtils.isNumericType(fieldType)) { throw new IllegalArgumentException(String.format( "Cannot compute standard deviation on field %s because its type %s is not numeric", fieldName, fieldType)); } this.variance = new Variance(fieldName, fieldSchema); }
Source:
<code>private static Pair<PackingPlan, Resource> doScalingTest(TopologyAPI.Topology topology, Map<String, Integer> componentChanges, long boltRam, int boltParallelism, long spoutRam, int spoutParallelism, int numContainersBeforeRepack, int totalInstancesExpected) { Pair<PackingPlan, Resource> packingInfo; PackingPlan packingPlan = getFirstFitDecreasingPackingPlan(topology); Assert.assertEquals(numContainersBeforeRepack, packingPlan.getContainers().size()); Assert.assertEquals(totalInstancesExpected, (int) packingPlan.getInstanceCount()); AssertPacking.assertContainers(packingPlan.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, spoutRam, null); AssertPacking.assertNumInstances(packingPlan.getContainers(), BOLT_NAME, boltParallelism); AssertPacking.assertNumInstances(packingPlan.getContainers(), SPOUT_NAME, spoutParallelism); PackingPlan newPackingPlan = getFirstFitDecreasingPackingPlanRepack(topology, packingPlan, componentChanges); packingInfo = new Pair<PackingPlan, Resource>( newPackingPlan, packingPlan.getMaxContainerResources()); <START> return packingInfo; <END> }</code><technical_language>need for this variable, below. return new Pair<PackingPlan, Resource>(newPackingPlan, packingPlan.getMaxContainerResources())</technical_language>

Target:
private static PackingPlan doScalingTest(TopologyAPI.Topology topology, Map<String, Integer> componentChanges, long boltRam, int boltParallelism, long spoutRam, int spoutParallelism, int numContainersBeforeRepack, int totalInstancesExpected) { PackingPlan packingPlan = getFirstFitDecreasingPackingPlan(topology); Assert.assertEquals(numContainersBeforeRepack, packingPlan.getContainers().size()); Assert.assertEquals(totalInstancesExpected, (int) packingPlan.getInstanceCount()); AssertPacking.assertContainers(packingPlan.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, spoutRam, null); AssertPacking.assertNumInstances(packingPlan.getContainers(), BOLT_NAME, boltParallelism); AssertPacking.assertNumInstances(packingPlan.getContainers(), SPOUT_NAME, spoutParallelism); PackingPlan newPackingPlan = getFirstFitDecreasingPackingPlanRepack(topology, packingPlan, componentChanges); AssertPacking.assertContainerRam(newPackingPlan.getContainers(), packingPlan.getMaxContainerResources().getRam()); return newPackingPlan; }
Source:
<code>public static String buildLink(String parentObjectId, String objectId, PORTLET_INFO portletInfo) { <START> return buildLink(parentObjectId, objectId, portletInfo, Util.getPortalRequestContext().getSiteName()); <END> }</code><technical_language>replaced CommonsUtils.getCurrentSite()</technical_language>

Target:
public static String buildLink(String parentObjectId, String objectId, PORTLET_INFO portletInfo) { return buildLink(parentObjectId, objectId, portletInfo, CommonsUtils.getCurrentSite().getName()); }
Source:
<code>public void startContainer(ContainerModel containerModel, Config config, int maxChangelogStreamPartitions) { LocalityManager localityManager = null; if (new ClusterManagerConfig(config).getHostAffinityEnabled()) { localityManager = SamzaContainer$.MODULE$.getLocalityManager(containerModel.getContainerId(), config); } log.info("About to create container: " + containerModel.getContainerId()); container = SamzaContainer$.MODULE$.apply( containerModel.getContainerId(), containerModel, config, maxChangelogStreamPartitions, localityManager, new JmxServer(), Util.<String, MetricsReporter>javaMapAsScalaMap(metricsReporterMap), taskFactory, <START> ApplicationRunner.getLocalRunner(config)); <END> log.info("About to start container: " + containerModel.getContainerId()); containerFuture = executorService.submit(() -> container.run()); }</code><technical_language>this getRemoteRunner? If I understand correctly, local runner is meant for standalone</technical_language>

Target:
public void startContainer(ContainerModel containerModel, Config config, int maxChangelogStreamPartitions) { LocalityManager localityManager = null; if (new ClusterManagerConfig(config).getHostAffinityEnabled()) { localityManager = SamzaContainer$.MODULE$.getLocalityManager(containerModel.getContainerId(), config); } log.info("About to create container: " + containerModel.getContainerId()); container = SamzaContainer$.MODULE$.apply( containerModel.getContainerId(), containerModel, config, maxChangelogStreamPartitions, localityManager, new JmxServer(), Util.<String, MetricsReporter>javaMapAsScalaMap(metricsReporterMap), taskFactory, null); log.info("About to start container: " + containerModel.getContainerId()); containerFuture = executorService.submit(() -> container.run()); }
Source:
<code>private MutateRowsRequest.Entry toEntry(RowMutation rowMutation) { <START> return rowMutation.toBulkProto(RequestContext.create("p", "i", "a")).getEntries(0); <END> }</code><technical_language>pass a real name constructor here</technical_language>

Target:
private MutateRowsRequest.Entry toEntry(RowMutation rowMutation) { return rowMutation.toBulkProto(requestContext).getEntries(0); }
Source:
<code>public void write(JsonWriter out, Layer value) throws IOException { out.beginObject(); out.name("fromY"); out.value(value.fromY); out.name("toY"); out.value(value.toY); out.name("blockState"); <START> out.value(GameData.getBlockStateIDMap().get(value.blockState)); <END> out.endObject(); }</code><technical_language>store string-based ID for block type, meta stored number for now, ideally stored string (I some commands accept this kind of strings)</technical_language>

Target:
public void write(JsonWriter out, Layer value) throws IOException { out.beginObject(); out.name("fromY"); out.value(value.fromY); out.name("toY"); out.value(value.toY); out.name("blockRegistryName"); String blockRegistryName = Block.REGISTRY.getNameForObject(value.blockState.getBlock()).toString(); out.value(blockRegistryName); value.blockState.getProperties().forEach((p, v) -> { try { out.name(p.getName()); out.value(getValueName(p, v)); } catch (IOException e) { throw new UncheckedIOException("Input error while converting to Json a BlockState instance of block " + blockRegistryName + " for config of flat cube type world.", e); } }); out.endObject(); }
Source:
<code>static Pair<Float, Float> fill(@NonNull final View container, @NonNull final View view, @NonNull final Size bufferSize) { if (container.getWidth() == 0 || container.getHeight() == 0 || view.getWidth() == 0 || view.getHeight() == 0 || bufferSize.getWidth() == 0 || bufferSize.getHeight() == 0) { return new Pair<>(1F, 1F); } final int viewRotationDegrees = (int) RotationTransform.getRotation(view); final boolean isNaturalPortrait = isNaturalPortrait(view.getContext(), viewRotationDegrees); final int bufferWidth; final int bufferHeight; if <START> (isNaturalPortrait) { <END> bufferWidth = bufferSize.getHeight(); bufferHeight = bufferSize.getWidth(); } else { bufferWidth = bufferSize.getWidth(); bufferHeight = bufferSize.getHeight(); } float scaleX = bufferWidth / (float) view.getWidth(); float scaleY = bufferHeight / (float) view.getHeight(); int bufferRotatedWidth; int bufferRotatedHeight; if (viewRotationDegrees == 0 || viewRotationDegrees == 180) { bufferRotatedWidth = bufferWidth; bufferRotatedHeight = bufferHeight; } else { bufferRotatedWidth = bufferHeight; bufferRotatedHeight = bufferWidth; } final float scale = Math.max(container.getWidth() / (float) bufferRotatedWidth, container.getHeight() / (float) bufferRotatedHeight); scaleX *= scale; scaleY *= scale; return new Pair<>(scaleX, scaleY); }</code><technical_language>Is this for determining camera sensor orientation? If case, CameraCharacteristics.SENSOR_ORIENTATION instead? do this for if difficult get CameraCharacteristics.SENSOR_ORIENTATION value</technical_language>

Target:
static Pair<Float, Float> fill(@NonNull final View container, @NonNull final View view, @NonNull final Size bufferSize) { if (container.getWidth() == 0 || container.getHeight() == 0 || view.getWidth() == 0 || view.getHeight() == 0 || bufferSize.getWidth() == 0 || bufferSize.getHeight() == 0) { return new Pair<>(1F, 1F); } final int viewRotationDegrees = (int) RotationTransform.getRotationDegrees(view); final boolean isNaturalPortrait = isNaturalPortrait(view.getContext(), viewRotationDegrees); final int bufferWidth; final int bufferHeight; if (isNaturalPortrait) { bufferWidth = bufferSize.getHeight(); bufferHeight = bufferSize.getWidth(); } else { bufferWidth = bufferSize.getWidth(); bufferHeight = bufferSize.getHeight(); } float scaleX = bufferWidth / (float) view.getWidth(); float scaleY = bufferHeight / (float) view.getHeight(); int bufferRotatedWidth; int bufferRotatedHeight; if (viewRotationDegrees == 0 || viewRotationDegrees == 180) { bufferRotatedWidth = bufferWidth; bufferRotatedHeight = bufferHeight; } else { bufferRotatedWidth = bufferHeight; bufferRotatedHeight = bufferWidth; } final float scale = Math.max(container.getWidth() / (float) bufferRotatedWidth, container.getHeight() / (float) bufferRotatedHeight); scaleX *= scale; scaleY *= scale; return new Pair<>(scaleX, scaleY); }
Source:
<code>public void testSupportHandlerManager() { SupportHandlerManager handlerManager = new SupportHandlerManager(); SupportProviderManager providerManager = new SupportProviderManager(); SupportProduct product = providerManager.getProduct("org.eclipse.mylyn.tasks.tests.productnormal"); IStatus status = new ProductStatus(product); SupportRequest request = new SupportRequest(providerManager, status, product); handlerManager.preProcess(request); assertTrue(((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()); IProgressMonitor monitor = new NullOperationMonitor(); handlerManager.process(request.getDefaultContribution(), monitor); assertNotNull(request.getDefaultContribution()); AttributeTaskMapper mapper = ((AttributeTaskMapper) request.getDefaultContribution()); assertTrue(!mapper.isHandled()); TaskData taskData = null; try { taskData = mapper.createTaskData(monitor); } catch (CoreException e) { fail("unexpected CoreException " + e.getMessage()); } assertNotNull(taskData); mapper.setTaskData(taskData); handlerManager.postProcess(mapper, monitor); <START> @SuppressWarnings("null") <END> TaskAttribute serv = taskData.getRoot().getMappedAttribute(TaskAttribute.SEVERITY); assertEquals("enhancement", serv.getValue()); }</code><technical_language>code restructured instead</technical_language>

Target:
public void testSupportHandlerManager() throws CoreException { SupportHandlerManager handlerManager = new SupportHandlerManager(); SupportProviderManager providerManager = new SupportProviderManager(); SupportProduct product = providerManager.getProduct("org.eclipse.mylyn.tasks.tests.productnormal"); IStatus status = new ProductStatus(product); SupportRequest request = new SupportRequest(providerManager, status, product); handlerManager.preProcess(request); assertTrue(((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()); IProgressMonitor monitor = new NullOperationMonitor(); handlerManager.process(request.getDefaultContribution(), monitor); assertNotNull(request.getDefaultContribution()); AttributeTaskMapper mapper = ((AttributeTaskMapper) request.getDefaultContribution()); assertTrue(!mapper.isHandled()); TaskData taskData = null; taskData = mapper.createTaskData(monitor); assertNotNull(taskData); mapper.setTaskData(taskData); handlerManager.postProcess(mapper, monitor); TaskAttribute serv = taskData.getRoot().getMappedAttribute(TaskAttribute.SEVERITY); assertEquals("enhancement", serv.getValue()); }
Source:
<code>private boolean isDiscardedValueExpression(IASTExpression expr) { IASTNode parent = expr.getParent(); if (expr.getParent() instanceof IASTExpressionStatement) return true; if (checkNestedLeftSide(expr)) { return true; } if (expr.getPropertyInParent() != IASTExpressionList.NESTED_EXPRESSION) { <START> while (parent instanceof IASTUnaryExpression) { <END> int operator = ((IASTUnaryExpression) parent).getOperator(); if (operator != IASTUnaryExpression.op_bracketedPrimary) { return false; } parent = parent.getParent(); } if (parent instanceof IASTExpressionStatement) { return true; } } return false; }</code><technical_language>If move this loop beginning of function, handle a case like: (foo()), bar(); (where foo is nodiscard)</technical_language>

Target:
private boolean isDiscardedValueExpression(IASTExpression expr) { IASTNode parent = expr.getParent(); IASTNode child = expr; while (parent instanceof IASTUnaryExpression) { int operator = ((IASTUnaryExpression) parent).getOperator(); if (operator != IASTUnaryExpression.op_bracketedPrimary) { return false; } child = parent; parent = parent.getParent(); } if (parent instanceof IASTExpressionStatement) { return true; } if (child instanceof IASTExpression && checkNestedLeftSide((IASTExpression) child)) { return true; } return false; }
Source:
<code>public void flush(final int writeOffset) { size = VarInt.read(last.data, processingOffset, writeOffset, nextOffset); if (nextOffset.integer > -5 && nextOffset.integer < 1) { if (writeOffset == last.data.length) { nextOffset.integer = 0; processingOffset = 0; last.writingOffset = writeOffset; return; } } else if (nextOffset.integer == -5) { throw new RuntimeException("problemo!"); } if (size == 0) { nextOffset.integer = 0; processingOffset = 0; last.writingOffset = writeOffset; return; } processingOffset = nextOffset.integer; if (processingOffset + size <= writeOffset) { switch (last.data[processingOffset]) { case MessageType.BEGIN_WINDOW_VALUE: Tuple bwt = Tuple.getTuple(last.data, processingOffset, size); if (last.starting_window == -1) { last.starting_window = baseSeconds | bwt.getWindowId(); last.ending_window = last.starting_window; } else { last.ending_window = baseSeconds | bwt.getWindowId(); } break; case MessageType.RESET_WINDOW_VALUE: Tuple rwt = Tuple.getTuple(last.data, processingOffset, size); baseSeconds = (long)rwt.getBaseSeconds() << 32; break; <START> default: <END> break; } processingOffset += size; size = 0; } else { if (writeOffset == last.data.length) { nextOffset.integer = 0; processingOffset = 0; size = 0; } } last.writingOffset = writeOffset; notifyListeners(); }</code><technical_language>is change necessary? messages received a network socket, is get incomplete message flush is necessary. is need deal condition messages delivered in memory queue</technical_language>

Target:
public void flush(final int writeOffset) { if (dataFromSocket) { flushFromSocket(writeOffset); } else { flushInMemoryQueue(writeOffset); } last.writingOffset = writeOffset; notifyListeners(); }
Source:
<code>private static boolean isThriftSupported(boolean dse, VersionNumber version) { return <START> (!dse && version.compareTo(VersionNumber.parse("3.10")) < 0) <END> || (dse && version.compareTo(VersionNumber.parse("5.1")) < 0); }</code><technical_language>I C* 4.0 version thrift. present in 3.10, in trunk</technical_language>

Target:
private static boolean isThriftSupported(boolean dse, VersionNumber version) { return dse || version.compareTo(VersionNumber.parse("4.0")) < 0; }
Source:
<code>private String enableCapabilities() throws TransportException { final StringBuilder line = new StringBuilder(); if (noProgress) wantCapability(line, OPTION_NO_PROGRESS); if (includeTags) includeTags = wantCapability(line, OPTION_INCLUDE_TAG); if (allowOfsDelta) wantCapability(line, OPTION_OFS_DELTA); if (wantCapability(line, OPTION_MULTI_ACK_DETAILED)) { multiAck = MultiAck.DETAILED; if (statelessRPC) noDone = wantCapability(line, OPTION_NO_DONE); } else if (wantCapability(line, OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (thinPack) thinPack = wantCapability(line, OPTION_THIN_PACK); if (wantCapability(line, OPTION_SIDE_BAND_64K)) sideband = true; else if (wantCapability(line, OPTION_SIDE_BAND)) sideband = true; if (statelessRPC && multiAck != MultiAck.DETAILED) { throw new PackProtocolException(uri, MessageFormat.format( JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED)); } if (filterBlobLimit >= 0) { <START> if (!wantCapability(line, OPTION_FILTER)) { <END> throw new PackProtocolException(uri, JGitText.get().filterRequiresCapability); } } addUserAgentCapability(line); return line.toString(); }</code><technical_language>optional: simplify avoiding nested ifs: if (filterBlobLimit >= 0 && !wantCapability(...)) { throw ... }</technical_language>

Target:
private String enableCapabilities() throws TransportException { final StringBuilder line = new StringBuilder(); if (noProgress) wantCapability(line, OPTION_NO_PROGRESS); if (includeTags) includeTags = wantCapability(line, OPTION_INCLUDE_TAG); if (allowOfsDelta) wantCapability(line, OPTION_OFS_DELTA); if (wantCapability(line, OPTION_MULTI_ACK_DETAILED)) { multiAck = MultiAck.DETAILED; if (statelessRPC) noDone = wantCapability(line, OPTION_NO_DONE); } else if (wantCapability(line, OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (thinPack) thinPack = wantCapability(line, OPTION_THIN_PACK); if (wantCapability(line, OPTION_SIDE_BAND_64K)) sideband = true; else if (wantCapability(line, OPTION_SIDE_BAND)) sideband = true; if (statelessRPC && multiAck != MultiAck.DETAILED) { throw new PackProtocolException(uri, MessageFormat.format( JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED)); } if (filterBlobLimit >= 0 && !wantCapability(line, OPTION_FILTER)) { throw new PackProtocolException(uri, JGitText.get().filterRequiresCapability); } addUserAgentCapability(line); return line.toString(); }
Source:
<code><START> @Override public void onResume() { <END> super.onResume(); if (mGoogleApiClient != null && mGoogleApiClient.isConnected() && !mIsResolvingError && !mShouldResolveError) { startSignInProcess(); } }</code><technical_language>@Override annotation a separate line onResume method</technical_language>

Target:
public void onResume() { super.onResume(); if (mGoogleApiClient != null && mGoogleApiClient.isConnected() && !mIsResolvingError && !mShouldResolveError) { startFlow(); } }
Source:
<code>void initializeRow(List<Patch> patches, int row) { Patch patch = patches.get(row - 1); <START> PatchSetKeys psk = new PatchSetKeys(patchesToKeys(patches), row - 1, <END> PatchTable.this.psid.getParentKey()); setRowItem(row, patch); Widget nameCol; if (patch.getPatchType() == Patch.PatchType.UNIFIED) { nameCol = new PatchLink.SideBySide(patch.getFileName(), psk); } else { nameCol = new PatchLink.Unified(patch.getFileName(), psk); } if (patch.getSourceFileName() != null) { final String text; if (patch.getChangeType() == Patch.ChangeType.RENAMED) { text = Util.M.renamedFrom(patch.getSourceFileName()); } else if (patch.getChangeType() == Patch.ChangeType.COPIED) { text = Util.M.copiedFrom(patch.getSourceFileName()); } else { text = Util.M.otherFrom(patch.getSourceFileName()); } final Label line = new Label(text); line.setStyleName("SourceFilePath"); final FlowPanel cell = new FlowPanel(); cell.add(nameCol); cell.add(line); nameCol = cell; } table.setWidget(row, C_PATH, nameCol); int C_UNIFIED = C_SIDEBYSIDE + 1; if (patch.getPatchType() == Patch.PatchType.UNIFIED) { table.setWidget(row, C_SIDEBYSIDE, new PatchLink.SideBySide(Util.C .patchTableDiffSideBySide(), psk)); } else if (patch.getPatchType() == Patch.PatchType.BINARY) { C_UNIFIED = C_SIDEBYSIDE + 2; } table.setWidget(row, C_UNIFIED, new PatchLink.Unified(Util.C .patchTableDiffUnified(), psk)); }</code><technical_language>NAK. a patch set PV, 4000 files in list, creating 4000 copies of array of 4000 entries long, requiring 16,000,000 array slots, in a browser, in JavaScript. Please do that</technical_language>

Target:
void initializeRow(List<Patch> patches, int row) { Patch patch = patches.get(row - 1); setRowItem(row, patch); Widget nameCol; if (patch.getPatchType() == Patch.PatchType.UNIFIED) { nameCol = new PatchLink.SideBySide(patch.getFileName(), patch.getKey(), row - 1, PatchTable.this); } else { nameCol = new PatchLink.Unified(patch.getFileName(), patch.getKey(), row - 1, PatchTable.this); } if (patch.getSourceFileName() != null) { final String text; if (patch.getChangeType() == Patch.ChangeType.RENAMED) { text = Util.M.renamedFrom(patch.getSourceFileName()); } else if (patch.getChangeType() == Patch.ChangeType.COPIED) { text = Util.M.copiedFrom(patch.getSourceFileName()); } else { text = Util.M.otherFrom(patch.getSourceFileName()); } final Label line = new Label(text); line.setStyleName("SourceFilePath"); final FlowPanel cell = new FlowPanel(); cell.add(nameCol); cell.add(line); nameCol = cell; } table.setWidget(row, C_PATH, nameCol); int C_UNIFIED = C_SIDEBYSIDE + 1; if (patch.getPatchType() == Patch.PatchType.UNIFIED) { table.setWidget(row, C_SIDEBYSIDE, new PatchLink.SideBySide(Util.C.patchTableDiffSideBySide(), patch.getKey(), row - 1, PatchTable.this)); } else if (patch.getPatchType() == Patch.PatchType.BINARY) { C_UNIFIED = C_SIDEBYSIDE + 2; } table.setWidget(row, C_UNIFIED, new PatchLink.Unified(Util.C.patchTableDiffUnified(), patch.getKey(), row - 1, PatchTable.this)); }
Source:
<code>private void generateDummyResponse() { <START> DummyTransactionResponseMessage response = new DummyTransactionResponseMessage(this); <END> response.m_sourceHSId = m_initiator.getHSId(); m_initiator.deliver(response); }</code><technical_language>mark transaction state done. Otherwise, SpScheduler.updateReplicas() repair correctly, deadlock system</technical_language>

Target:
private void generateDummyResponse() { doCommonSPICompleteActions(); DummyTransactionResponseMessage response = new DummyTransactionResponseMessage(this); response.m_sourceHSId = m_initiator.getHSId(); m_initiator.deliver(response); }
Source:
<code>protected void registerTriggerProducers() { registerTriggerProducer(Touch.class, (TriggerProducer) Engine.engine .getEventListener()); <START> registerTriggerProducer(Time.class, new TimeEmitter()); <END> }</code><technical_language>Dan suggests LibGDx's implementation of Timer support Time</technical_language>

Target:
protected void registerTriggerProducers() { registerTriggerSource(Touch.class, (TriggerSource) Engine.engine .getEventListener()); registerTriggerSource(Time.class, new TimeSource()); }
Source:
<code>private FwdPassReturn activateHelper(final boolean training, final INDArray prevOutputActivations, final INDArray prevMemCellState, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); Preconditions.checkState(input.shape().length == 3, <START> "3D input expected to RNN layer expected, got " + input.shape().length); <END> applyDropOutIfNecessary(training, workspaceMgr); cacheMode = CacheMode.NONE; if (forBackprop && cachedFwdPass != null) { FwdPassReturn ret = cachedFwdPass; cachedFwdPass = null; return ret; } final INDArray recurrentWeights = getParamWithNoise(GravesLSTMParamInitializer.RECURRENT_WEIGHT_KEY, training, workspaceMgr); final INDArray inputWeights = getParamWithNoise(GravesLSTMParamInitializer.INPUT_WEIGHT_KEY, training, workspaceMgr); final INDArray biases = getParamWithNoise(GravesLSTMParamInitializer.BIAS_KEY, training, workspaceMgr); FwdPassReturn fwd = LSTMHelpers.activateHelper(this, this.conf, this.layerConf().getGateActivationFn(), this.input, recurrentWeights, inputWeights, biases, training, prevOutputActivations, prevMemCellState, forBackprop || (cacheMode != CacheMode.NONE && training), true, GravesLSTMParamInitializer.INPUT_WEIGHT_KEY, maskArray, true, null, cacheMode, workspaceMgr); if (training && cacheMode != CacheMode.NONE) { cachedFwdPass = fwd; } return fwd; }</code><technical_language>Good check, this optimized (and is correct preconditions). This results in 3 objects created (2xlong[] shape, a String) of error is encountered. Instead, this (no object creation error is encountered) Preconditions.checkState(input.rank() == 3, "3D ... %s", input.rank())</technical_language>

Target:
private FwdPassReturn activateHelper(final boolean training, final INDArray prevOutputActivations, final INDArray prevMemCellState, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); Preconditions.checkState(input.rank() == 3, "3D input expected to RNN layer expected, got %s", input.rank()); applyDropOutIfNecessary(training, workspaceMgr); cacheMode = CacheMode.NONE; if (forBackprop && cachedFwdPass != null) { FwdPassReturn ret = cachedFwdPass; cachedFwdPass = null; return ret; } final INDArray recurrentWeights = getParamWithNoise(GravesLSTMParamInitializer.RECURRENT_WEIGHT_KEY, training, workspaceMgr); final INDArray inputWeights = getParamWithNoise(GravesLSTMParamInitializer.INPUT_WEIGHT_KEY, training, workspaceMgr); final INDArray biases = getParamWithNoise(GravesLSTMParamInitializer.BIAS_KEY, training, workspaceMgr); FwdPassReturn fwd = LSTMHelpers.activateHelper(this, this.conf, this.layerConf().getGateActivationFn(), this.input, recurrentWeights, inputWeights, biases, training, prevOutputActivations, prevMemCellState, forBackprop || (cacheMode != CacheMode.NONE && training), true, GravesLSTMParamInitializer.INPUT_WEIGHT_KEY, maskArray, true, null, cacheMode, workspaceMgr); if (training && cacheMode != CacheMode.NONE) { cachedFwdPass = fwd; } return fwd; }
Source:
<code>private void printStatusMessage() { StringBuilder msg = new StringBuilder(); msg.append("Nuxeo Platform Started\n"); if (getStatusMessage(msg)) { log.info(msg); } else { log.error(msg); <START> boolean strict = System.getProperty("nuxeo.start.strict") != null; <END> if (strict) { throw new IllegalStateException("Startup aborted due to previous failures (strict mode)"); } } }</code><technical_language>boolean strict = Boolean.getBoolean("nuxeo.start.strict")</technical_language>

Target:
private void printStatusMessage() { StringBuilder msg = new StringBuilder(); msg.append("Nuxeo Platform Started\n"); if (getStatusMessage(msg)) { log.info(msg); } else { log.error(msg); if (Boolean.getBoolean("nuxeo.start.strict")) { throw new IllegalStateException("Startup aborted due to previous failures (strict mode)"); } } }
Source:
<code>private void checkNetworkAndShowScreen(){ ConnectivityManager cm = (ConnectivityManager)this.getSystemService(Context.CONNECTIVITY_SERVICE); <START> NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); <END> boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); if (isConnected) { setContentView(R.layout.activity_category); setSupportActionBar(findViewById(R.id.toolbar)); setTitle(R.string.category_drawer); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } else{ setContentView(R.layout.offline_cloud_layout); findViewById(R.id.buttonToRefresh).setOnClickListener(view -> checkNetworkAndShowScreen()); } }</code><technical_language>For code maintainability, Utils.isNetworkConnected? cut rewriting of code :)</technical_language>

Target:
private void checkNetworkAndShowScreen(){ if (Utils.isNetworkConnected(this)) { onlineView.setVisibility(View.VISIBLE); offlineView.setVisibility(View.GONE); } else{ offlineView.setVisibility(View.VISIBLE); onlineView.setVisibility(View.GONE); } }
Source:
<code>public void validateDiskInBackupDomain() { initializeCommand(new DiskImage(), VmEntityType.VM); initSrcStorageDomain(); initDestStorageDomain(StorageType.NFS); <START> command.getStorageDomain().isBackup(); <END> ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); }</code><technical_language>command.getStorageDomain().isBackup() is necessary</technical_language>

Target:
public void validateDiskInBackupDomain() { initializeCommand(new DiskImage(), VmEntityType.VM); initSrcStorageDomain(); StorageDomain destDomain = new StorageDomain(); destDomain.setStorageType(StorageType.NFS); destDomain.setStatus(StorageDomainStatus.Active); destDomain.setBackup(true); doReturn(destDomain).when(command).getStorageDomain(); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); }
Source:
<code>public String toCodeStringPostStatement() { StringBuilder b = new StringBuilder(); String exceptionClassName = getExceptionName(); if (exceptionClassName == null) { exceptionClassName = "Exception"; } <START> appendTryBehavior(b, exceptionClassName); <END> if (Modifier.isPublic(exception.getClass().getModifiers())) { b.append("} catch (" + exceptionClassName + " e) {" + Globals.lineSep); b.append(" b.append("}" + Globals.lineSep); } else { Class<?> publicSuperClass = nearestVisibleSuperclass(exception.getClass()); String publicSuperClassName = publicSuperClass.getCanonicalName(); b.append("} catch (" + publicSuperClassName + " e) {" + Globals.lineSep); b.append(" appendCatchBehavior(b, exceptionClassName); b.append("}" + Globals.lineSep); } return b.toString(); }</code><technical_language>If this is catch half, is post-statement, is appendTryBehavior called</technical_language>

Target:
public final String toCodeStringPostStatement() { StringBuilder b = new StringBuilder(); if (catchClassName == null) { catchClassName = "Exception"; } String exceptionClassName = getExceptionName(); appendTryBehavior(b, exceptionClassName); b.append("} catch (" + catchClassName + " e) {" + Globals.lineSep); b.append(" appendCatchBehavior(b, exceptionClassName); b.append("}" + Globals.lineSep); return b.toString(); }
Source:
<code><START> private Long countInternal(final Bson filter, @Nullable final CountOptions options) { <END> AtomicReference<Long> success = new AtomicReference<>(null); AtomicReference<ObjectServerError> error = new AtomicReference<>(null); OsJNIResultCallback<Long> callback = new OsJNIResultCallback<Long>(success, error) { @Override protected Long mapSuccess(Object result) { return (Long) result; } }; String filterString = JniBsonProtocol.encode(filter, codecRegistry); int limit = (options == null) ? 0 : options.getLimit(); nativeCount(nativePtr, filterString, limit, callback); return ResultHandler.handleResult(success, error); }</code><technical_language>intentionally remove public possibility call count options filter</technical_language>

Target:
private Long countInternal(final Bson filter, @Nullable final CountOptions options) { AtomicReference<Long> success = new AtomicReference<>(null); AtomicReference<ObjectServerError> error = new AtomicReference<>(null); OsJNIResultCallback<Long> callback = new OsJNIResultCallback<Long>(success, error) { @Override protected Long mapSuccess(Object result) { return (Long) result; } }; final String filterString = JniBsonProtocol.encode(filter, codecRegistry); final int limit = (options == null) ? 0 : options.getLimit(); nativeCount(nativePtr, filterString, limit, callback); return ResultHandler.handleResult(success, error); }
Source:
<code>public void unregister(String serviceName) { log.info("Unregistering EventReceiverFirehoseMetric for service [%s]", serviceName); <START> metrics.remove(serviceName); <END> }</code><technical_language>check return log if found</technical_language>

Target:
public void unregister(String serviceName) { log.info("Unregistering EventReceiverFirehoseMetric for service [%s]", serviceName); if (metrics.remove(serviceName) == null) { log.warn("Unregistering a non-exist service. Service [%s] never exists."); } }
Source:
<code><START> public DecorationOverlayIcon(Image baseImage, <END> ImageDescriptor[] overlaysArray, Point sizeValue) { this.baseImage = baseImage; this.overlays = overlaysArray; this.size = sizeValue; }</code><technical_language>Consider marking this constructor @Deprecated, is necessary allocate Image resource here</technical_language>

Target:
public DecorationOverlayIcon(Image baseImage, ImageDescriptor[] overlaysArray, Point sizeValue) { this.referenceImageOrDescriptor = baseImage; this.overlays = overlaysArray; this.baseImageData = new Supplier<ImageData>() { private ImageData value; @Override public ImageData get() { if (value == null) { value = baseImage.getImageData(); } return value; } }; this.size = new Supplier<Point>() { @Override public Point get() { return sizeValue; } }; }
Source:
<code>private void errorEncountered(Exception e) throws UserStoreException { <START> String msg = "Exception while creating multi tenant builder "; <END> throw new UserStoreException(msg, e); }</code><technical_language>remove this String definition String directly, once. This applies of lines</technical_language>

Target:
private void errorEncountered(Exception e) throws UserStoreException { throw new UserStoreException("Exception while creating multi tenant builder", e); }
Source:
<code>public Fragment getItem(int pos) { CourseComponent unit = getUnit(pos); CourseUnitFragment unitFragment; if (unit instanceof VideoBlockModel && ((VideoBlockModel) unit).getData().encodedVideos.getPreferredVideoInfo() != null) { unitFragment = CourseUnitVideoFragment.newInstance((VideoBlockModel) unit); } else if (unit instanceof VideoBlockModel && ((VideoBlockModel) unit).getData().encodedVideos.getYoutubeVideoInfo() != null) { unitFragment = CourseUnitOnlyOnYoutubeFragment.newInstance(unit); <START> } else if (unit.getType() == BlockType.DISCUSSION) { <END> unitFragment = CourseUnitDiscussionFragment.newInstance(unit, courseData); } else if (!unit.isMultiDevice()) { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(unit); } else if (unit.getType() != BlockType.VIDEO && unit.getType() != BlockType.HTML && unit.getType() != BlockType.OTHERS && unit.getType() != BlockType.PROBLEM) { unitFragment = CourseUnitEmptyFragment.newInstance(unit); } else if (unit instanceof HtmlBlockModel) { unitFragment = CourseUnitWebViewFragment.newInstance((HtmlBlockModel) unit); } else { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(unit); } unitFragment.setHasComponentCallback(callback); return unitFragment; }</code><technical_language>This changed unit instanceof DiscussionBlockModel, parser checks availability of fields in order create this model. reinstate unit.getType() != BlockType.DISCUSSION check in else if clause next one</technical_language>

Target:
public Fragment getItem(int pos) { CourseComponent unit = getUnit(pos); CourseUnitFragment unitFragment; if (unit instanceof VideoBlockModel && ((VideoBlockModel) unit).getData().encodedVideos.getPreferredVideoInfo() != null) { unitFragment = CourseUnitVideoFragment.newInstance((VideoBlockModel) unit); } else if (unit instanceof VideoBlockModel && ((VideoBlockModel) unit).getData().encodedVideos.getYoutubeVideoInfo() != null) { unitFragment = CourseUnitOnlyOnYoutubeFragment.newInstance(unit); } else if (unit instanceof DiscussionBlockModel) { unitFragment = CourseUnitDiscussionFragment.newInstance(unit, courseData); } else if (!unit.isMultiDevice()) { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(unit); } else if (unit.getType() != BlockType.VIDEO && unit.getType() != BlockType.HTML && unit.getType() != BlockType.OTHERS && unit.getType() != BlockType.DISCUSSION && unit.getType() != BlockType.PROBLEM) { unitFragment = CourseUnitEmptyFragment.newInstance(unit); } else if (unit instanceof HtmlBlockModel) { unitFragment = CourseUnitWebViewFragment.newInstance((HtmlBlockModel) unit); } else { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(unit); } unitFragment.setHasComponentCallback(callback); return unitFragment; }
Source:
<code>public int compareTo(final Type type) { if (type instanceof ConstT) { <START> if (this.constructor.compareTo(((ConstT) type).constructor) == 0) { <END> if (this.args.length == ((ConstT) type).args.length) { for (int i = 0; i < this.args.length; i++) { if (this.args[i].compareTo(((ConstT) type).args[i]) != 0) { return -1; } } return 0; } else { return -1; } } else { return this.constructor.compareTo(((ConstT) type).constructor); } } else { return -1; } }</code><technical_language>For String, equals instead of compareTo() == 0: > compareTo returns 0 equals(Object) method return true</technical_language>

Target:
public int compareTo(final Type type) { if (type == null) { throw new NullPointerException(); } else if (type instanceof ConstT) { final ConstT cType = (ConstT) type; if (this.constructor.equals(cType.constructor)) { if (this.args.length == cType.args.length) { for (int i = 0; i < this.args.length; i++) { if (this.args[i].compareTo(cType.args[i]) != 0) { return -1; } } return 0; } else { return -1; } } else { return this.constructor.compareTo(cType.constructor); } } else { return -1; } }
Source:
<code><START> public String getCapabilities() { <END> return capabilities; }</code><technical_language>I recommend "never return null" rule for getCapabilities(), ie: public String getCapabilities() { return StringUtils.notNullStr(capabilities); }</technical_language>

Target:
public String getCapabilities() { return StringUtils.notNullStr(capabilities); }
Source:
<code>public void isAccountNull(){ ValidationResult validationResult = concurAccountValidationService.checkAccount(ConcurAccountValidationTestConstants.VALID_CHART, null); <START> assertEquals("Validation was expected to fail but returned true", false, validationResult.isValid()); <END> assertEquals( "Error message was expected for null account number", ConcurConstants.AccountingStringValidationErrorMessages.ERROR_ACCT_DOES_NOT_EXIST + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString()); }</code><technical_language>This is nitpicky, assertFalse instead of assertEquals for these</technical_language>

Target:
public void isAccountNull(){ ValidationResult validationResult = concurAccountValidationService.checkAccount(ConcurAccountValidationTestConstants.VALID_CHART, null); Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid()); Assert.assertEquals( "Error message was expected for null account number", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString()); }
Source:
<code>public static void assertPlan(Session session, Metadata metadata, StatsProvider statsProvider, Plan actual, Lookup lookup, PlanMatchPattern pattern) { CostProvider costProvider = node -> UNKNOWN_COST; MatchResult matches = actual.getRoot().accept(new PlanMatchingVisitor(session, metadata, statsProvider, lookup), pattern); if (!matches.isMatch()) { <START> String formattedPlan = textLogicalPlan(actual.getRoot(), actual.getTypes(), metadata.getFunctionRegistry(), actual.getStatsAndCosts(), session, 0); <END> PlanNode resolvedPlan = resolveGroupReferences(actual.getRoot(), lookup); String resolvedFormattedPlan = textLogicalPlan(resolvedPlan, actual.getTypes(), metadata.getFunctionRegistry(), actual.getStatsAndCosts(), session, 0); throw new AssertionError(format( "Plan does not match, expected [\n\n%s\n] but found [\n\n%s\n] which resolves to [\n\n%s\n]", pattern, formattedPlan, resolvedFormattedPlan)); } }</code><technical_language>remove statsAndCosts field Plan simply pass StatsAndCosts.empty() here. forget remove CostProvider costProvider = node -> UNKNOWN_COST;, needed</technical_language>

Target:
public static void assertPlan(Session session, Metadata metadata, StatsProvider statsProvider, Plan actual, Lookup lookup, PlanMatchPattern pattern) { MatchResult matches = actual.getRoot().accept(new PlanMatchingVisitor(session, metadata, statsProvider, lookup), pattern); if (!matches.isMatch()) { String formattedPlan = textLogicalPlan(actual.getRoot(), actual.getTypes(), metadata.getFunctionRegistry(), StatsAndCosts.empty(), session, 0); PlanNode resolvedPlan = resolveGroupReferences(actual.getRoot(), lookup); String resolvedFormattedPlan = textLogicalPlan(resolvedPlan, actual.getTypes(), metadata.getFunctionRegistry(), StatsAndCosts.empty(), session, 0); throw new AssertionError(format( "Plan does not match, expected [\n\n%s\n] but found [\n\n%s\n] which resolves to [\n\n%s\n]", pattern, formattedPlan, resolvedFormattedPlan)); } }