auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected final void processAnnotationOnClass(MethodMetadata data, Class<?> targetType) { Arrays.stream(targetType.getAnnotations()) .forEach(annotation -> classAnnotationProcessors .getOrDefault(annotation.annotationType(), ClassAnnotationProcessor.DO_NOTHING) <START> .process(annotation, data)); <END> }</code><technical_language>This feels odd me. I for functional style, empty function feels forced. This accomplished a simple loop lookup require empty function: java for (Annotation annotation : targetType.getAnnotations()) { AnnotationProcessor processor = this.classAnnotationProcessors.get(annotation); if (processor != null) { process.process(annotation, data); } } understand if this is more a style choice</technical_language>

Target:
protected final void processAnnotationOnClass(MethodMetadata data, Class<?> targetType) { Arrays.stream(targetType.getAnnotations()) .forEach(annotation -> classAnnotationProcessors.stream() .filter(processor -> processor.test(annotation)) .forEach(processor -> processor.process(annotation, data))); }
Source:
<code>private void resolveDeltas(DeltaVisit visit, final int type, ObjectTypeAndSize info, ProgressMonitor progress) throws IOException { do { progress.update(1); info = openDatabase(visit.delta, info); switch (info.type) { case Constants.OBJ_OFS_DELTA: case Constants.OBJ_REF_DELTA: break; default: throw new IOException(MessageFormat.format( JGitText.get().unknownObjectType, info.type)); } visit.data = BinaryDelta.apply(visit.parent.data, <START> inflateAndReturn(Source.DATABASE, info.size)); <END> if (!checkCRC(visit.delta.crc)) throw new IOException(MessageFormat.format( JGitText.get().corruptionDetectedReReadingAt, visit.delta.position)); objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(visit.data.length)); objectDigest.update((byte) 0); objectDigest.update(visit.data); tempObjectId.fromRaw(objectDigest.digest(), 0); verifySafeObject(tempObjectId, type, visit.data, visit.data.length); PackedObjectInfo oe; oe = newInfo(tempObjectId, visit.delta, visit.parent.id); oe.setOffset(visit.delta.position); onInflatedObjectData(oe, type, visit.data); addObjectAndTrack(oe); visit.id = oe; visit.nextChild = firstChildOf(oe); visit = visit.next(); } while (visit != null); }</code><technical_language>this 2nd argument pull a new temporary byte[]. is inflated delta instruction sequence. BinaryDelta get size of result. Test max object limit, if result is big, abort allocate result apply delta command sequence. get visit.data created apply(), null out temporary byte[] garbage reclaimed</technical_language>

Target:
private void resolveDeltas(DeltaVisit visit, final int type, ObjectTypeAndSize info, ProgressMonitor progress) throws IOException { do { progress.update(1); info = openDatabase(visit.delta, info); switch (info.type) { case Constants.OBJ_OFS_DELTA: case Constants.OBJ_REF_DELTA: break; default: throw new IOException(MessageFormat.format( JGitText.get().unknownObjectType, info.type)); } byte[] delta = inflateAndReturn(Source.DATABASE, info.size); checkIfTooLarge(BinaryDelta.getResultSize(delta)); visit.data = BinaryDelta.apply(visit.parent.data, delta); delta = null; if (!checkCRC(visit.delta.crc)) throw new IOException(MessageFormat.format( JGitText.get().corruptionDetectedReReadingAt, visit.delta.position)); objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(visit.data.length)); objectDigest.update((byte) 0); objectDigest.update(visit.data); tempObjectId.fromRaw(objectDigest.digest(), 0); verifySafeObject(tempObjectId, type, visit.data); PackedObjectInfo oe; oe = newInfo(tempObjectId, visit.delta, visit.parent.id); oe.setOffset(visit.delta.position); onInflatedObjectData(oe, type, visit.data); addObjectAndTrack(oe); visit.id = oe; visit.nextChild = firstChildOf(oe); visit = visit.next(); } while (visit != null); }
Source:
<code>public void registerIn(final ActionRegistry registry) { registry.register(ValueChangedCommand.class, new CommandHandler<ValueChangedCommand>() { @Override public void handleCommand(final ValueChangedCommand command, final List response) { final ServerAttribute attribute = getServerModelStore().findAttributeById(command.getAttributeId()); if (attribute != null) { if (! Objects.equals(attribute.getValue(), command.getOldValue())) { LOG.debug("S: updating attribute with id '{}' to new value '{}' even though its old command value '{}' does not conform to the old value of '{}'. Client overrules server.", command.getAttributeId(), command.getNewValue(), command.getOldValue(), attribute.getValue()); } attribute.silently(new Runnable() { @Override public void run() { attribute.setValue(command.getNewValue()); } }); } else { <START> LOG.info("S: cannot find attribute with id '{}' to change value from '{}' to '{}'.", command.getAttributeId(), command.getOldValue(), command.getNewValue()); <END> } } }); }</code><technical_language>This error</technical_language>

Target:
public void registerIn(final ActionRegistry registry) { registry.register(ValueChangedCommand.class, new CommandHandler<ValueChangedCommand>() { @Override public void handleCommand(final ValueChangedCommand command, final List response) { final ServerAttribute attribute = getServerModelStore().findAttributeById(command.getAttributeId()); if (attribute != null) { if (! Objects.equals(attribute.getValue(), command.getOldValue())) { LOG.warn("S: updating attribute with id '{}' to new value '{}' even though its old command value '{}' does not conform to the old value of '{}'. Client overrules server.", command.getAttributeId(), command.getNewValue(), command.getOldValue(), attribute.getValue()); } attribute.silently(new Runnable() { @Override public void run() { attribute.setValue(command.getNewValue()); } }); } else { LOG.error("S: cannot find attribute with id '{}' to change value from '{}' to '{}'.", command.getAttributeId(), command.getOldValue(), command.getNewValue()); } } }); }
Source:
<code>public void clearHost(VDS host) { synchronized (this) { if (!resourcesByHost.containsKey(host.getId())) { return; } log.debug("Clearing pending resources for host {}", host.getId()); resourcesByHost.compute(host.getId(), (hostId, resources) -> { for (PendingResource resource : resources) { <START> resourcesByVm.computeIfPresent(resource.getVm(), (vmId, vmResources) -> { vmResources.remove(resource); return vmResources; }); <END> pendingResources.remove(resource); } resources.clear(); return resources; }); } notifyHostManagers(host.getId()); }</code><technical_language>This extracted in other places delete item dicts</technical_language>

Target:
public void clearHost(VDS host) { synchronized (this) { if (!resourcesByHost.containsKey(host.getId())) { return; } log.debug("Clearing pending resources for host {}", host.getId()); resourcesByHost.compute(host.getId(), (hostId, resources) -> { for (PendingResource resource : resources) { removeFromSetMap(resourcesByVm, resource.getVm(), resource); pendingResources.remove(resource); } resources.clear(); return resources; }); } notifyHostManagers(host.getId()); }
Source:
<code>void schedule(final Project.NameKey project, final String ref, final URIish uri) { try { boolean visible = threadScoper.scope(new Callable<Boolean>(){ @Override public Boolean call() throws NoSuchProjectException { return controlFor(project).isVisible(); } }).call(); if (!visible) { return; } } catch (NoSuchProjectException err) { ReplicationQueue.log.error(String.format( "source project %s not available", project), err); return; } catch (Exception e) { throw Throwables.propagate(e); } if (!replicatePermissions) { PushOne e; synchronized (pending) { e = pending.get(uri); } if (e == null) { Repository git; try { git = gitManager.openRepository(project); } catch (IOException err) { ReplicationQueue.log.error(String.format( "source project %s not available", project), err); return; } try { Ref head = git.getRef(Constants.HEAD); if (head != null && head.isSymbolic() && GitRepositoryManager.REF_CONFIG.equals(head.getLeaf().getName())) { return; } } catch (IOException err) { ReplicationQueue.log.error(String.format( "cannot check type of project %s", project), err); return; } finally { git.close(); } } } <START> synchronized (inflight) { <END> synchronized (pending) { PushOne e = inflight.get(uri); if (e != null) { } e = pending.get(uri); if (e == null) { e = opFactory.create(project, uri); pool.schedule(e, delay, TimeUnit.SECONDS); pending.put(uri, e); } e.addRef(ref); } } }</code><technical_language>Lets avoid double locking. Instead a new object lock for of maps: private final Object stateLock = new Object(); replace of "synchronized (pending)" "synchronized (stateLock)". reference pending inflight wrapped synchronized (stateLock) statement</technical_language>

Target:
void schedule(final Project.NameKey project, final String ref, final URIish uri) { try { boolean visible = threadScoper.scope(new Callable<Boolean>(){ @Override public Boolean call() throws NoSuchProjectException { return controlFor(project).isVisible(); } }).call(); if (!visible) { return; } } catch (NoSuchProjectException err) { ReplicationQueue.log.error(String.format( "source project %s not available", project), err); return; } catch (Exception e) { throw Throwables.propagate(e); } if (!replicatePermissions) { PushOne e; synchronized (stateLock) { e = pending.get(uri); } if (e == null) { Repository git; try { git = gitManager.openRepository(project); } catch (IOException err) { ReplicationQueue.log.error(String.format( "source project %s not available", project), err); return; } try { Ref head = git.getRef(Constants.HEAD); if (head != null && head.isSymbolic() && GitRepositoryManager.REF_CONFIG.equals(head.getLeaf().getName())) { return; } } catch (IOException err) { ReplicationQueue.log.error(String.format( "cannot check type of project %s", project), err); return; } finally { git.close(); } } } synchronized (stateLock) { PushOne e = pending.get(uri); if (e == null) { e = opFactory.create(project, uri); pool.schedule(e, delay, TimeUnit.SECONDS); pending.put(uri, e); } e.addRef(ref); } }
Source:
<code>private void addTermAndAncestors(Term t, Observations o) { try { int id = this.boqa.getTermIndex(t); o.observations[id] = true; this.boqa.activateAncestors(id, o.observations); } catch (NullPointerException e) { this.logger.warn(String.format( <START> "Unable to find the boqa index of '%s'.", t)); <END> } }</code><technical_language>org.slf4j.Logger a nice feature, [_parameterized logging_](<LINK_0> write this as: this.logger.warn("Unable find boqa index of [{}].", t); is anchor, a convention put square brackets easier delimit variable values fixed logging message</technical_language>

Target:
private boolean addTermAndAncestors(Term t, Observations o) { try { int id = this.boqa.getTermIndex(t); o.observations[id] = true; this.boqa.activateAncestors(id, o.observations); } catch (Exception e) { this.logger.warn("Unable to find the boqa index of [{}].", t); return false; } return true; }
Source:
<code>Mono<Void> downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { <START> if (blockSize != null && (blockSize < 0 || blockSize > BLOB_MAX_DOWNLOAD_BLOCK_SIZE)) { <END> throw logger.logExceptionAsError(new IllegalArgumentException("Block size should not exceed 100MB")); } return Mono.using(() -> downloadToFileResourceSupplier(filePath), channel -> Mono.justOrEmpty(range) .switchIfEmpty(getFullBlobRange(accessConditions)) .flatMapMany(rg -> Flux.fromIterable(sliceBlobRange(rg, blockSize))) .flatMap(chunk -> this.download(chunk, accessConditions, rangeGetContentMD5, context) .subscribeOn(Schedulers.elastic()) .flatMap(dar -> FluxUtil.writeFile(dar.body(options), channel, chunk.offset() - (range == null ? 0 : range.offset())))) .then(), this::downloadToFileCleanup); }</code><technical_language>Side note: Objects.assertInBounds something</technical_language>

Target:
Mono<Void> downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { if (blockSize != null) { Utility.assertInBounds("blockSize", blockSize, 0, BLOB_MAX_DOWNLOAD_BLOCK_SIZE); } return Mono.using(() -> downloadToFileResourceSupplier(filePath), channel -> Mono.justOrEmpty(range) .switchIfEmpty(getFullBlobRange(accessConditions)) .flatMapMany(rg -> Flux.fromIterable(sliceBlobRange(rg, blockSize))) .flatMap(chunk -> this.download(chunk, accessConditions, rangeGetContentMD5, context) .subscribeOn(Schedulers.elastic()) .flatMap(dar -> FluxUtil.writeFile(dar.body(options), channel, chunk.offset() - (range == null ? 0 : range.offset())))) .then(), this::downloadToFileCleanup); }
Source:
<code>public void test_stats_collection() throws Exception { sendManagementCallToCollectStats("GetCounter", "InexistingRate", "AllCacheGetCount"); Cache<String, String> cache1 = cacheManager.getCache("cache-1", String.class, String.class); cache1.put("key1", "val"); cache1.put("key2", "val"); cache1.get("key1"); cache1.get("key2"); ContextualStatistics[] stats = waitForNextStats(); <START> System.out.println(Arrays.toString(stats)); <END> assertThat(stats.length, equalTo(1)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(Counter.class, "GetCounter").getValue(), equalTo(2L)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(CounterHistory.class, "AllCacheGetCount").getValue().length, equalTo(0)); cache1.get("key1"); cache1.get("key2"); stats = waitForNextStats(); System.out.println(Arrays.toString(stats)); assertThat(stats.length, equalTo(1)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(Counter.class, "GetCounter").getValue(), equalTo(4L)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(CounterHistory.class, "AllCacheGetCount").getValue().length, equalTo(1)); assertThat(stats[0].getStatistic(CounterHistory.class, "AllCacheGetCount").getValue()[0].getValue(), equalTo(4L)); }</code><technical_language>sysout ?</technical_language>

Target:
public void test_stats_collection() throws Exception { sendManagementCallToCollectStats("GetCounter", "InexistingRate", "AllCacheGetCount"); Cache<String, String> cache1 = cacheManager.getCache("cache-1", String.class, String.class); cache1.put("key1", "val"); cache1.put("key2", "val"); cache1.get("key1"); cache1.get("key2"); ContextualStatistics[] stats = waitForNextStats(); assertThat(stats.length, equalTo(1)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(Counter.class, "GetCounter").getValue(), equalTo(2L)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(CounterHistory.class, "AllCacheGetCount").getValue().length, equalTo(0)); cache1.get("key1"); cache1.get("key2"); stats = waitForNextStats(); assertThat(stats.length, equalTo(1)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(Counter.class, "GetCounter").getValue(), equalTo(4L)); assertThat(stats[0].getContext().get("cacheName"), equalTo("cache-1")); assertThat(stats[0].getStatistic(CounterHistory.class, "AllCacheGetCount").getValue().length, equalTo(1)); assertThat(stats[0].getStatistic(CounterHistory.class, "AllCacheGetCount").getValue()[0].getValue(), equalTo(4L)); }
Source:
<code>public RPropUpdater() { <START> this(DFLT_LEARNING_RATE, DFLT_INIT_UPDATE, DFLT_ACCELERATION_RATE, DFLT_DEACCELERATION_RATE); <END> }</code><technical_language>do assign fields default values</technical_language>

Target:
public RPropUpdater() { this(DFLT_INIT_UPDATE, DFLT_ACCELERATION_RATE, DFLT_DEACCELERATION_RATE); }
Source:
<code>public void visitJavadocToken(DetailNode ast) { String firstSentence = getFirstSentence(ast); final int endOfSentence = firstSentence.lastIndexOf(period); boolean temp = true; <START> if (period.equals(PERIOD)) { <END> temp = checkPeriodAtEnd(ast); } if (endOfSentence == -1 && temp) { if (!firstSentence.trim().startsWith(INHERIT_DOC)) { log(ast.getLineNumber(), MSG_SUMMARY_FIRST_SENTENCE); } } else { if(endOfSentence != -1) { firstSentence = firstSentence.substring(0, endOfSentence); if (containsForbiddenFragment(firstSentence)) { log(ast.getLineNumber(), MSG_SUMMARY_JAVADOC); } } } }</code><technical_language>checking 2? If user supplied custom period period else</technical_language>

Target:
public void visitJavadocToken(DetailNode ast) { String firstSentence = getFirstSentence(ast); final int endOfSentence = firstSentence.lastIndexOf(period); final String summaryDoc = getSummarySentence(ast); if (summaryDoc.isEmpty()) { log(ast.getLineNumber(), MSG_SUMMARY_JAVADOC_MISSING); } else if (!period.isEmpty() && !summaryDoc.contains(period) && !summaryDoc.equals(INHERIT_DOC)) { log(ast.getLineNumber(), MSG_SUMMARY_FIRST_SENTENCE); } if (endOfSentence != -1) { firstSentence = firstSentence.substring(0, endOfSentence); if (containsForbiddenFragment(firstSentence)) { log(ast.getLineNumber(), MSG_SUMMARY_JAVADOC); } } }
Source:
<code>private synchronized StreamObserver<RpcRequestProto> getRpcHandler(String location, String systemId) { if (!Strings.isNullOrEmpty(systemId)) { return rpcHandlerByMinionId.get(systemId); } Collection<StreamObserver<RpcRequestProto>> streamObservers = rpcHandlerByLocation.get(location); if (streamObservers.isEmpty()) { return null; } Iterator<StreamObserver<RpcRequestProto>> iterator = rpcHandlerIteratorMap.get(streamObservers); if (iterator == null) { iterator = Iterables.cycle(streamObservers).iterator(); <START> rpcHandlerIteratorMap.put(streamObservers, iterator); <END> } return iterator.next(); }</code><technical_language>this iterator behave underlying collection changes? clear entry map new handlers get registered</technical_language>

Target:
public synchronized StreamObserver<RpcRequestProto> getRpcHandler(String location, String systemId) { if (!Strings.isNullOrEmpty(systemId)) { return rpcHandlerByMinionId.get(systemId); } Iterator<StreamObserver<RpcRequestProto>> iterator = rpcHandlerIteratorMap.get(location); if (iterator == null) { return null; } return iterator.next(); }
Source:
<code>public void testWithCacheWithNoViolation() throws Exception { final Checker checker = new Checker(); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); checker.setModuleFactory(factory); checker.configure(createCheckConfig(TranslationCheck.class)); final File cacheFile = temporaryFolder.newFile(); checker.setCacheFile(cacheFile.getPath()); checker.setupChild(createCheckConfig(TranslationCheck.class)); final File file = temporaryFolder.newFile("file.java"); final List<File> files = new ArrayList<>(); files.add(file); checker.process(files); final Properties cache = new Properties(); cache.load(Files.newBufferedReader(cacheFile.toPath())); <START> assertTrue(cache.isEmpty()); <END> }</code><technical_language>I notice this before, this test is a lie. PropertyCacheFile instantiated a configuration, throw exception. reason cache is empty is destroy is called commit changes play Checker instead of a 'normal' lifecycle. specifically set configuration line checker.configure(createCheckConfig(TranslationCheck.class));. is a lie is configuration. if violations, cache is filled files checked. Is this test relying some code coverage? If so, rework this test that. If not, this a more normal workflow test contents of cache</technical_language>

Target:
public void testWithCacheWithNoViolation() throws Exception { final Checker checker = new Checker(); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); checker.setModuleFactory(factory); checker.configure(createCheckConfig(TranslationCheck.class)); final File cacheFile = temporaryFolder.newFile(); checker.setCacheFile(cacheFile.getPath()); checker.setupChild(createCheckConfig(TranslationCheck.class)); final File tmpFile = temporaryFolder.newFile("file.java"); final List<File> files = new ArrayList<>(1); files.add(tmpFile); checker.process(files); checker.destroy(); final Properties cache = new Properties(); cache.load(Files.newBufferedReader(cacheFile.toPath())); final int expectedNumberOfObjectsInCache = 2; assertEquals(expectedNumberOfObjectsInCache, cache.size()); final String expectedConfigHash = "68EE3C3B4593FD8D86159C670C504542E20C6FA0"; assertEquals(expectedConfigHash, cache.getProperty(PropertyCacheFile.CONFIG_HASH_KEY)); assertNotNull(cache.getProperty(tmpFile.getPath())); }
Source:
<code>public TreeDataProcessor() { super(Keys.TREE_TYPE, input -> input.getItem() == ItemTypes.PLANKS || input.getItem() == ItemTypes.LEAVES || input.getItem() == ItemTypes.LEAVES2 || input.getItem() == ItemTypes.LOG || input.getItem() == ItemTypes.LOG2 || input.getItem() == ItemTypes.SAPLING <START> || input.getItem() == ItemTypes.WOODEN_SLAB || input.getItem() == ItemTypes.BOAT <END> || input.getItem() == ItemTypes.ACACIA_BOAT || input.getItem() == ItemTypes.BIRCH_BOAT || input.getItem() == ItemTypes.DARK_OAK_BOAT || input.getItem() == ItemTypes.JUNGLE_BOAT || input.getItem() == ItemTypes.SPRUCE_BOAT); }</code><technical_language>move argument of this a private static method this nicer</technical_language>

Target:
public TreeDataProcessor() { super(Keys.TREE_TYPE, input -> input.getItem() == ItemTypes.PLANKS || input.getItem() == ItemTypes.LEAVES || input.getItem() == ItemTypes.LEAVES2 || input.getItem() == ItemTypes.LOG || input.getItem() == ItemTypes.LOG2 || input.getItem() == ItemTypes.SAPLING || input.getItem() == ItemTypes.WOODEN_SLAB || boatMapping.containsKey((ItemType) input.getItem())); }
Source:
<code>protected List<String> getTablesToDropConstraints() { <START> return null; <END> }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Return empty collection instead of null. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
protected List<String> getTablesToDropConstraints() { return new ArrayList<>(); }
Source:
<code>private ColumnStatistics(Estimate nullsFraction, List<RangeColumnStatistics> rangeColumnStatistics) { this.nullsFraction = requireNonNull(nullsFraction, "nullsFraction can not be null"); requireNonNull(rangeColumnStatistics, "rangeColumnStatistics can not be null"); if (rangeColumnStatistics.size() > 1) { throw new IllegalArgumentException("Statistics for multiple ranges are not supported"); <START> } <END> if (rangeColumnStatistics.isEmpty()) { rangeColumnStatistics = SINGLE_UNKNOWN_RANGE_STATISTICS; } if (nullsFraction.isValueUnknown() ^ rangeColumnStatistics.get(0).getFraction().isValueUnknown()) { throw new IllegalArgumentException("All or none fraction/nullsFraction must be set"); } this.rangeColumnStatistics = unmodifiableList(rangeColumnStatistics); }</code><technical_language>need modify this class move multiple ranges, I do a point in storing in list. IMO constructors private, Builder provides enough flexibility</technical_language>

Target:
private ColumnStatistics(Estimate nullsFraction, List<RangeColumnStatistics> rangeColumnStatistics) { this.nullsFraction = requireNonNull(nullsFraction, "nullsFraction can not be null"); requireNonNull(rangeColumnStatistics, "rangeColumnStatistics can not be null"); if (!rangeColumnStatistics.stream().allMatch(Objects::nonNull)) { throw new NullPointerException("elements of rangeColumnStatistics can not be null"); } if (rangeColumnStatistics.size() > 1) { throw new IllegalArgumentException("Statistics for multiple ranges are not supported"); } if (rangeColumnStatistics.isEmpty()) { rangeColumnStatistics = SINGLE_UNKNOWN_RANGE_STATISTICS; } if (nullsFraction.isValueUnknown() != rangeColumnStatistics.get(0).getFraction().isValueUnknown()) { throw new IllegalArgumentException("All or none fraction/nullsFraction must be set"); } this.rangeColumnStatistics = unmodifiableList(new ArrayList<>(rangeColumnStatistics)); }
Source:
<code>private ExecutingPlan(final Plan plan, final DolphinDriver dolphinDriver) { this.pendingTaskSubmissions = new ConcurrentHashMap<>(); this.planEvaluatorIds = new ArrayList<>(plan.getEvaluatorsToAdd()); <START> this.activeContexts = new ArrayList<>(); <END> this.planEvaluatorIdsToContexts = new ConcurrentHashMap<>(); this.runningTasks = new ConcurrentHashMap<>(); this.activeContextLatch = new CountDownLatch(plan.getEvaluatorsToAdd().size()); this.dataTransferLatch = new CountDownLatch(plan.getTransferSteps().size()); this.moveLatch = new CountDownLatch(plan.getTransferSteps().size()); this.runningTaskLatch = new CountDownLatch(plan.getEvaluatorsToAdd().size()); this.synchronizedExecutionLatch = new CountDownLatch(1); this.dolphinDriver = dolphinDriver; }</code><technical_language>This initialized new ArrayList<>(plan.getEvaluatorsToAdd().size())</technical_language>

Target:
private ExecutingPlan(final Plan plan, final DolphinDriver dolphinDriver) { this.pendingTaskSubmissions = new ConcurrentHashMap<>(); this.planEvaluatorIds = new ArrayList<>(plan.getEvaluatorsToAdd()); this.activeContexts = new ArrayList<>(plan.getEvaluatorsToAdd().size()); this.planEvaluatorIdsToContexts = new ConcurrentHashMap<>(); this.runningTasks = new ConcurrentHashMap<>(); this.activeContextLatch = new CountDownLatch(plan.getEvaluatorsToAdd().size()); this.dataTransferLatch = new CountDownLatch(plan.getTransferSteps().size()); this.moveLatch = new CountDownLatch(plan.getTransferSteps().size()); this.runningTaskLatch = new CountDownLatch(plan.getEvaluatorsToAdd().size()); this.synchronizedExecutionLatch = new CountDownLatch(1); this.dolphinDriver = dolphinDriver; }
Source:
<code>public void testSeDeSchema() { final Map<String, String> options = getAllOptions(); String schemaRegistryUrl = options.get(DebeziumAvroFormatFactory.IDENTIFIER + "." + RegistryAvroOptions.SCHEMA_REGISTRY_URL.key()); String schemaRegistrySubject = options.get(DebeziumAvroFormatFactory.IDENTIFIER + "." + RegistryAvroOptions.SCHEMA_REGISTRY_SUBJECT.key()); final DebeziumAvroDeserializationSchema expectedDeser = new DebeziumAvroDeserializationSchema( ROW_TYPE, InternalTypeInfo.of(ROW_TYPE), <START> schemaRegistryUrl); <END> final DynamicTableSource actualSource = createTableSource(options); assert actualSource instanceof TestDynamicTableFactory.DynamicTableSourceMock; TestDynamicTableFactory.DynamicTableSourceMock scanSourceMock = (TestDynamicTableFactory.DynamicTableSourceMock) actualSource; DeserializationSchema<RowData> actualDeser = scanSourceMock.valueFormat .createRuntimeDecoder( ScanRuntimeProviderContext.INSTANCE, SCHEMA.toRowDataType()); assertEquals(expectedDeser, actualDeser); final DebeziumAvroSerializationSchema expectedSer = new DebeziumAvroSerializationSchema( ROW_TYPE, schemaRegistryUrl, schemaRegistrySubject ); final DynamicTableSink actualSink = createTableSink(options); assert actualSink instanceof TestDynamicTableFactory.DynamicTableSinkMock; TestDynamicTableFactory.DynamicTableSinkMock sinkMock = (TestDynamicTableFactory.DynamicTableSinkMock) actualSink; SerializationSchema<RowData> actualSer = sinkMock.valueFormat .createRuntimeEncoder( new SinkRuntimeProviderContext(false), SCHEMA.toRowDataType()); Assert.assertEquals(expectedSer, actualSer); }</code><technical_language>REGISTRY_URL instead of extract options. This is for asserting a constant value</technical_language>

Target:
public void testSeDeSchema() { final Map<String, String> options = getAllOptions(); DebeziumAvroDeserializationSchema expectedDeser = new DebeziumAvroDeserializationSchema( ROW_TYPE, InternalTypeInfo.of(ROW_TYPE), REGISTRY_URL); DeserializationSchema<RowData> actualDeser = createDeserializationSchema(options); assertEquals(expectedDeser, actualDeser); DebeziumAvroSerializationSchema expectedSer = new DebeziumAvroSerializationSchema( ROW_TYPE, REGISTRY_URL, SUBJECT ); SerializationSchema<RowData> actualSer = createSerializationSchema(options); Assert.assertEquals(expectedSer, actualSer); }
Source:
<code>public int hashCode() { int result; long temp; <START> temp = Double.doubleToLongBits(resolution); <END> result = (int) (temp ^ (temp >>> 32)); return result; }</code><technical_language>static Double.hasCode</technical_language>

Target:
public int hashCode() { return new Double(resolution).hashCode(); }
Source:
<code>public Page<Launcher> getLaunchersWithSchedules(Pageable pageable) { Iterable<Launcher> allLaunchers = this.launcherRepository.findAll(); List<Launcher> launchers = new ArrayList<>(); Iterator<Launcher> launcherIterator = allLaunchers.iterator(); while(launcherIterator.hasNext()) { Launcher launcher = launcherIterator.next(); if (launcher.getScheduler() != null) { launchers.add(launcher); } } <START> return new PageImpl(launchers, pageable, launchers.size()) ; <END> }</code><technical_language>Add typing PageImpl remove warning</technical_language>

Target:
public Page<Launcher> getLaunchersWithSchedules(Pageable pageable) { Iterable<Launcher> allLaunchers = this.launcherRepository.findAll(); List<Launcher> launchers = new ArrayList<>(); Iterator<Launcher> launcherIterator = allLaunchers.iterator(); while(launcherIterator.hasNext()) { Launcher launcher = launcherIterator.next(); if (launcher.getScheduler() != null) { launchers.add(launcher); } } return new PageImpl<>(launchers, pageable, launchers.size()) ; }
Source:
<code>public void threadDump() { <START> System.out.println("Performing thread dump"); <END> ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true); Arrays.stream(threadInfos).forEach(System.out::println); }</code><technical_language>Is this "after timeout" test</technical_language>

Target:
public void threadDump() { if(doThreadDump) { System.out.println("Performing thread dump"); ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true); Arrays.stream(threadInfos).forEach(System.out::println); } }
Source:
<code>public void testRemoveModel() throws ExecutionException, InterruptedException { final String repoId = "dummy1/dummy1"; MultiModel models = new MultiModel(new Preferences(true)); models.queuePendingRepository(repoId); RepoIO testIO = new RepoIO(true, false); testIO.openRepository(repoId).thenApply(models::addPending); <START> TestUtils.delay(3); <END> assertEquals(true, models.getModelById(repoId).isPresent()); models.removeRepoModelById(repoId); TestUtils.delay(3); assertEquals(false, models.getModelById(repoId).isPresent()); }</code><technical_language>sleep in tests is bad, randomness timing issues. Is replace this PlatformEx.waitOnFxThread()</technical_language>

Target:
public void testRemoveModel() throws ExecutionException, InterruptedException { final String repoId = "dummy1/dummy1"; MultiModel models = new MultiModel(new Preferences(true)); models.queuePendingRepository(repoId); RepoIO testIO = new RepoIO(true, false); testIO.openRepository(repoId).thenApply(models::addPending).get(); assertEquals(true, models.getModelById(repoId).isPresent()); models.removeRepoModelById(repoId); assertEquals(false, models.getModelById(repoId).isPresent()); }
Source:
<code>private void qos(Network network, VdsNetworkInterface iface, NetworkQoS expectedQos, boolean hostNetworkQosSupported) { configRule.mockConfigValue(ConfigValues.HostNetworkQosSupported, version, hostNetworkQosSupported); SetupNetworksVdsCommandParameters parameters = new SetupNetworksVdsCommandParameters(Guid.newGuid(), Collections.singletonList(network), Collections.<String> emptyList(), Collections.<VdsNetworkInterface> emptyList(), Collections.<String> emptySet(), Collections.singletonList(iface)); createCommand(parameters).execute(); verifyMethodPassedToHost(); Map<String, Object> networkStruct = assertNeworkWasSent(network); NetworkQosMapper qosMapper = new NetworkQosMapper(networkStruct, VdsProperties.HOST_QOS_INBOUND, VdsProperties.HOST_QOS_OUTBOUND); <START> NetworkQoS deserialize = qosMapper.deserialize(); <END> if (deserialize != null) { deserialize.setId(expectedQos.getId()); } assertEquals(expectedQos, deserialize); }</code><technical_language>This "correction" is wrong, vdsm report QoS ID (which is a pure implementation detail of engine). assert equal values instead</technical_language>

Target:
private void qos(Network network, VdsNetworkInterface iface, NetworkQoS expectedQos, boolean hostNetworkQosSupported) { configRule.mockConfigValue(ConfigValues.HostNetworkQosSupported, version, hostNetworkQosSupported); SetupNetworksVdsCommandParameters parameters = new SetupNetworksVdsCommandParameters(Guid.newGuid(), Collections.singletonList(network), Collections.<String> emptyList(), Collections.<VdsNetworkInterface> emptyList(), Collections.<String> emptySet(), Collections.singletonList(iface)); createCommand(parameters).execute(); verifyMethodPassedToHost(); Map<String, Object> networkStruct = assertNeworkWasSent(network); NetworkQosMapper qosMapper = new NetworkQosMapper(networkStruct, VdsProperties.HOST_QOS_INBOUND, VdsProperties.HOST_QOS_OUTBOUND); NetworkQoS deserialize = qosMapper.deserialize(); assertTrue((expectedQos == null && deserialize == null) || expectedQos.equalValues(deserialize)); }
Source:
<code>@Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); startGridsMultiThreaded(SRVS); client.set(true); Ignite client1 = startClientGrid(SRVS); <START> assertTrue(client1.configuration().isClientMode()); <END> client.set(true); Ignite client2 = startClientGrid(SRVS + 1); assertTrue(client2.configuration().isClientMode()); client2.createNearCache(TX_CACHE1, new NearCacheConfiguration<>().setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy<>())); client2.createNearCache(TX_CACHE2, new NearCacheConfiguration<>().setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy<>())); client2.createNearCache(ATOMIC_CACHE, new NearCacheConfiguration<>().setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy<>())); }</code><technical_language>this assertion is unnecessary</technical_language>

Target:
@Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); startGridsMultiThreaded(SRVS); Ignite client1 = startClientGrid(SRVS); assertTrue(client1.configuration().isClientMode()); Ignite client2 = startClientGrid(SRVS + 1); assertTrue(client2.configuration().isClientMode()); client2.createNearCache(TX_CACHE1, new NearCacheConfiguration<>().setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy<>())); client2.createNearCache(TX_CACHE2, new NearCacheConfiguration<>().setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy<>())); client2.createNearCache(ATOMIC_CACHE, new NearCacheConfiguration<>().setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy<>())); }
Source:
<code>public void loadState() { String currentFolder = UIFactory.getFileDialogPersistence().getProperty(id+":folder"); if(currentFolder!=null) { setCurrentDirectory(new File(currentFolder)); } String currentFilter = UIFactory.getFileDialogPersistence().getProperty(id+":filter"); if(currentFilter!=null) { <START> if(!setCurrentFilter(Integer.valueOf(currentFilter))) { <END> if(getFileChooser().isAcceptAllFileFilterUsed()) { getFileChooser().setFileFilter(getFileChooser().getAcceptAllFileFilter()); } } } }</code><technical_language>some thoughts lines : - if blocks whould merged - if currentFilter is null</technical_language>

Target:
public void loadState() { String currentFolder = UIFactory.getFileDialogPersistence().getProperty(id+":folder"); if(currentFolder!=null) { setCurrentDirectory(new File(currentFolder)); } String currentFilter = UIFactory.getFileDialogPersistence().getProperty(id+":filter"); if(currentFilter!=null && !setCurrentFilter(Integer.valueOf(currentFilter))) { if(getFileChooser().isAcceptAllFileFilterUsed()) { getFileChooser().setFileFilter(getFileChooser().getAcceptAllFileFilter()); } } }
Source:
<code>public IndexReader select( IndexReader[] instances, IndexQuery... predicates ) { if ( predicates.length > 1 ) { return instances[LUCENE]; } IndexQuery predicate = predicates[0]; <START> if ( predicate instanceof IndexQuery.ExactPredicate ) <END> { IndexQuery.ExactPredicate exactPredicate = (IndexQuery.ExactPredicate) predicate; return select( instances, exactPredicate.value() ); } if ( predicate instanceof IndexQuery.RangePredicate ) { switch ( predicate.valueGroup() ) { case GEOMETRY: return instances[SPATIAL]; case DATE: case LOCAL_DATE_TIME: case ZONED_DATE_TIME: case LOCAL_TIME: case ZONED_TIME: case DURATION: return instances[TEMPORAL]; default: } } if ( predicate instanceof IndexQuery.ExistsPredicate ) { return null; } return instances[LUCENE]; }</code><technical_language>Please static imports qualifier add context improve readability. This is true for Values.isGeometryValue()</technical_language>

Target:
public IndexReader select( IndexReader[] instances, IndexQuery... predicates ) { if ( predicates.length > 1 ) { return instances[LUCENE]; } IndexQuery predicate = predicates[0]; if ( predicate instanceof ExactPredicate ) { ExactPredicate exactPredicate = (ExactPredicate) predicate; return select( instances, exactPredicate.value() ); } if ( predicate instanceof RangePredicate ) { switch ( predicate.valueGroup() ) { case GEOMETRY: return instances[SPATIAL]; case DATE: case LOCAL_DATE_TIME: case ZONED_DATE_TIME: case LOCAL_TIME: case ZONED_TIME: case DURATION: return instances[TEMPORAL]; default: } } if ( predicate instanceof ExistsPredicate ) { return null; } return instances[LUCENE]; }
Source:
<code>public void check(final IProgressMonitor monitor) { if (null != monitor) { monitor.subTask("Validate 'build.properties' file for architecture '" + architectureFile.getName() + "'."); } final IBuildModel buildModel = ProjectManagementService.getPluginBuild(project); if (null != buildModel) { boolean containsProfile = false; final String profilePath = architectureFile.getProjectRelativePath().toString(); final IBuild build = buildModel.getBuild(); final IBuildEntry buildEntry = build.getEntry(IBuildEntry.BIN_INCLUDES); final String[] tokens = buildEntry.getTokens(); for (int i = 0; i < tokens.length && !containsProfile; i++) { containsProfile = profilePath.startsWith(tokens[i]); } if (!containsProfile) { final IFile buildPropertiesFile = ProjectManagementService.getBuildFile(project); MarkersService.createMarker( buildPropertiesFile, ArchitecturePluginValidationConstants.ARCHITECTURE_PLUGIN_VALIDATION_TYPE, "The build does not contains entry for file '" + profilePath + <START> "'", END> IMarker.SEVERITY_ERROR); } } if (null != monitor) { monitor.worked(1); } }</code><technical_language>missing dot</technical_language>

Target:
public void check(final IProgressMonitor monitor) { if (null != monitor) { monitor.subTask("Validate 'build.properties' file for architecture '" + architectureFile.getName() + "'."); } final IBuildModel buildModel = ProjectManagementService.getPluginBuild(project); if (null != buildModel) { boolean containsProfile = false; final String profilePath = architectureFile.getProjectRelativePath().toString(); final IBuild build = buildModel.getBuild(); final IBuildEntry buildEntry = build.getEntry(IBuildEntry.BIN_INCLUDES); final String[] tokens = buildEntry.getTokens(); for (int i = 0; i < tokens.length && !containsProfile; i++) { containsProfile = profilePath.startsWith(tokens[i]); } if (!containsProfile) { final IFile buildPropertiesFile = ProjectManagementService.getBuildFile(project); MarkersService.createMarker( buildPropertiesFile, ArchitecturePluginValidationConstants.ARCHITECTURE_PLUGIN_VALIDATION_TYPE, "The build does not contains entry for file '" + profilePath + "'.", IMarker.SEVERITY_ERROR); } } if (null != monitor) { monitor.worked(1); } }
Source:
<code>private static PsiElement[] tryGetProperty(HaxeMethodDeclaration method) { final HaxeMethodModel methodModel = method.getModel(); final HaxeClassModel declaringClass = methodModel.getDeclaringClass(); final String methodName = method.getName(); HaxeMemberModel classField = null; if (StringUtils.startsWith(methodName, GETTER_PREFIX)) { classField = declaringClass.getField(methodName.substring(GETTER_PREFIX.length())); } else if (StringUtils.startsWith(methodName, SETTER_PREFIX)) { <START> classField = declaringClass.getField(methodName.substring(GETTER_PREFIX.length())); <END> } return classField == null ? null : new PsiElement[]{classField.getBasePsi()}; }</code><technical_language>Cut 'n' paste error? SETTER_PREFIX</technical_language>

Target:
private static PsiElement[] tryGetProperty(HaxeMethodDeclaration method) { final HaxeMethodModel methodModel = method.getModel(); final HaxeClassModel declaringClass = methodModel.getDeclaringClass(); final String methodName = method.getName(); HaxeMemberModel classField = null; if (StringUtils.startsWith(methodName, GETTER_PREFIX)) { classField = declaringClass.getField(methodName.substring(GETTER_PREFIX.length())); } else if (StringUtils.startsWith(methodName, SETTER_PREFIX)) { classField = declaringClass.getField(methodName.substring(SETTER_PREFIX.length())); } return classField == null ? null : new PsiElement[]{classField.getBasePsi()}; }
Source:
<code>public void handleDelete(ActionParameters params) throws ActionException { params.requireAdminUser(); final int id = params.getRequiredParamInt(PARAM_ID); final MaplayerGroup theme = oskariMapLayerGroupService.find(id); final List<Integer> maplayerIds = oskariMapLayerGroupService.findMaplayersByGroup(id); if(!maplayerIds.isEmpty()) { <START> throw new ActionParamsException("Maplayers linked to theme", JSONHelper.createJSONObject("code", "not_empty")); <END> } oskariMapLayerGroupService.delete(id); ResponseHelper.writeResponse(params, theme.getAsJSON()); }</code><technical_language>Rename variable (theme -> group)</technical_language>

Target:
public void handleDelete(ActionParameters params) throws ActionException { params.requireAdminUser(); final int id = params.getRequiredParamInt(PARAM_ID); final MaplayerGroup maplayerGroup = oskariMapLayerGroupService.find(id); final List<Integer> maplayerIds = oskariMapLayerGroupService.findMaplayersByGroup(id); if(!maplayerIds.isEmpty()) { throw new ActionParamsException("Maplayers linked to maplayer group", JSONHelper.createJSONObject("code", "not_empty")); } oskariMapLayerGroupService.delete(id); ResponseHelper.writeResponse(params, maplayerGroup.getAsJSON()); }
Source:
<code>private String addAppKeyToJson(String jsonString, ParamsMap params) { if (params == null) <START> return jsonString; <END> String appKey = params.get(APPLICATION_KEY); if (appKey == null || appKey.length() == 0) return jsonString; final String appKeyStart = "{\"" + APPLICATION_KEY + "\":\""; final String appKeyEnd = "\", "; final String appKeyString = appKeyStart.concat(appKey).concat(appKeyEnd); final int beginIndex = jsonString.indexOf("{"); final String jsonWithAppKey = appKeyString.concat(jsonString.substring(beginIndex + 1)); return jsonWithAppKey; }</code><technical_language>Please add {...} below</technical_language>

Target:
private String addAppKeyToJson(String jsonString, ParamsMap params) { if (params == null) { return jsonString; } String appKey = params.get(APPLICATION_KEY); if (appKey == null || appKey.length() == 0) { return jsonString; } final String appKeyString = "\"" + APPLICATION_KEY + "\":\"" + appKey + "\", "; if (jsonString == null || jsonString.length() == 0) { return "{" + appKeyString.replace(',', '}'); } int jsonLength = jsonString.length(); int appKeyLength = appKeyString.length(); StringBuffer jsonWithAppKey = new StringBuffer(jsonLength + appKeyLength + 16); jsonWithAppKey.append(jsonString); final int position = jsonWithAppKey.indexOf("{"); jsonWithAppKey.insert(position + 1, appKeyString); return jsonWithAppKey.toString(); }
Source:
<code>public boolean isFlowRunning(int projectId, String flowId) { boolean isRunning = false; isRunning = isRunning || isFlowRunningHelper(projectId, flowId, queuedFlowMap.values()); isRunning = isRunning || isFlowRunningHelper(projectId, flowId, runningFlows.values()); <START> return false; <END> }</code><technical_language>this method return false</technical_language>

Target:
public boolean isFlowRunning(int projectId, String flowId) { boolean isRunning = false; isRunning = isRunning || isFlowRunningHelper(projectId, flowId, queuedFlows.getAllEntries()); isRunning = isRunning || isFlowRunningHelper(projectId, flowId, runningFlows.values()); return isRunning; }
Source:
<code><START> public Optional<Map<String, String>> getMetadataMap() { <END> return Optional.empty(); }</code><technical_language>Consider removing "Optional" part. return empty map, if present</technical_language>

Target:
public Map<String, String> getMetadataMap() { return Collections.emptyMap(); }
Source:
<code>public List<AgentInfo> getAllLocalWithFullInfo() { Map<String, AgentInfo> agentInfoMap = createLocalAgentMap(); Set<AgentIdentity> allAttachedAgents = getAgentManager().getAllAttachedAgents(); <START> List<AgentInfo> agentList = new ArrayList<>(allAttachedAgents.size()); <END> for (AgentIdentity eachAgentIdentity : allAttachedAgents) { AgentControllerIdentityImplementation agentControllerIdentity = cast(eachAgentIdentity); agentList.add(createAgentInfo(agentControllerIdentity, agentInfoMap)); } return agentList; }</code><technical_language>stream here</technical_language>

Target:
public List<AgentInfo> getAllLocalWithFullInfo() { Map<String, AgentInfo> agentInfoMap = createLocalAgentMap(); return getAgentManager().getAllAttachedAgents() .stream() .map(identity -> createAgentInfo(cast(identity), agentInfoMap)) .collect(toList()); }
Source:
<code>protected void start() { if (log.isDebugEnabled()) log.debug("Starting feed for {}", this, entity); if (activated!=null && activated.booleanValue()) { throw new IllegalStateException(String.format("Attempt to start feed %s of entity %s when already running", this, entity)); } activated = true; preStart(); <START> synchronized (poller) { <END> if (active==null || active.booleanValue()) { poller.start(); } } }</code><technical_language>prefer synchronize poller - risks interfering synchronization poller internally, adds tighter coupling. that, calling "alien code" of poller.start() / poller.stop() while holding lock ideal. tricky do annoying threading stuff here, demanding caller annoying threading stuff. (mostly?) safe now, poller do synchronization - call submit tasks</technical_language>

Target:
protected void start() { if (log.isDebugEnabled()) log.debug("Starting feed for {}", this, entity); if (activated) { throw new IllegalStateException(String.format("Attempt to start feed %s of entity %s when already running", this, entity)); } activated = true; preStart(); synchronized (pollerStateMutex) { if (!suspended) { poller.start(); } } }
Source:
<code>public ArrayMutableBlockBuffer(Vector3i start, Vector3i size) { <START> this(size.getX() * size.getY() * size.getZ() > LOCAL_PALETTE_THRESHOLD ? <END> new BimapPalette() : GlobalPalette.instance, start, size); }</code><technical_language>This check is thinking</technical_language>

Target:
public ArrayMutableBlockBuffer(Vector3i start, Vector3i size) { this(size.getX() * size.getY() * size.getZ() > SMALL_AREA_THRESHOLD ? new BimapPalette() : GlobalPalette.instance, start, size); }