auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AccountCreationPolicy setVerificationSuccessEmailStatus(EmailStatus accountVerificationSuccessEmailStatus) { Assert.notNull(accountVerificationSuccessEmailStatus, "verificationSuccessEmailStatus cannot be null."); <START> setProperty(ACCOUNT_VERIFICATION_SUCCESS_EMAIL_STATUS, accountVerificationSuccessEmailStatus.name()); <END> return this; }</code><technical_language>accountVerificationSuccessEmailStatus null</technical_language>

Target:
public AccountCreationPolicy setVerificationSuccessEmailStatus(EmailStatus accountVerificationSuccessEmailStatus) { Assert.notNull(accountVerificationSuccessEmailStatus, "accountVerificationSuccessEmailStatus cannot be null."); setProperty(ACCOUNT_VERIFICATION_SUCCESS_EMAIL_STATUS, accountVerificationSuccessEmailStatus.name()); return this; }
Source:
<code>public void measures_on_project_accessors_handled_as_methods() throws Exception { initAndScan(false); <START> ArgumentCaptor<Measure> captor = ArgumentCaptor.forClass(Measure.class); <END> verify(context, atLeastOnce()).saveMeasure(any(org.sonar.api.resources.File.class), captor.capture()); Map<String, Double> metrics = new HashMap<String, Double>(); for (Measure measure : captor.getAllValues()) { if (measure.getValue() != null) { if (metrics.get(measure.getMetricKey()) == null) { metrics.put(measure.getMetricKey(), measure.getValue()); } else { metrics.put(measure.getMetricKey(), metrics.get(measure.getMetricKey()) + measure.getValue()); } } } assertThat(metrics.get("classes").intValue()).isEqualTo(146); assertThat(metrics.get("functions").intValue()).isEqualTo(1429); assertThat(metrics.get("lines").intValue()).isEqualTo(32878); assertThat(metrics.get("ncloc").intValue()).isEqualTo(14007); assertThat(metrics.get("statements").intValue()).isEqualTo(6403); assertThat(metrics.get("complexity").intValue()).isEqualTo(3859); assertThat(metrics.get("comment_lines").intValue()).isEqualTo(7605); assertThat(metrics.get("public_api").intValue()).isEqualTo(1340); }</code><technical_language>Capture of arguments some metrics factorized</technical_language>

Target:
public void measures_on_project_accessors_handled_as_methods() throws Exception { initAndScan(false); Map<String, Double> metrics = getMetrics(); verifySameResults(metrics); assertThat(metrics.get("public_api").intValue()).isEqualTo(1340); assertThat(metrics.get("functions").intValue()).isEqualTo(1429); assertThat(metrics.get("complexity").intValue()).isEqualTo(3859); }
Source:
<code>private boolean hasKeepAliveForConnection() { String keepAlive = assertion.getKeepAlive(); if (NullChecker.isNullish(keepAlive)) { keepAlive = getKeepAliveProperty(); } return NullChecker.isNotNullish(keepAlive) <START> && (keepAlive.equalsIgnoreCase("TRUE") || keepAlive.equalsIgnoreCase("T")); <END> }</code><technical_language>![MAJOR](<LINK_1> Move "TRUE" string literal left side of this string comparison. [![rule](<LINK_2>](<LINK_0> ![MAJOR](<LINK_1> Move "T" string literal left side of this string comparison. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private boolean hasKeepAliveForConnection() { String keepAlive = assertion.getKeepAlive(); if (NullChecker.isNullish(keepAlive)) { keepAlive = getKeepAliveProperty(); } return ("TRUE".equalsIgnoreCase(keepAlive) || "T".equalsIgnoreCase(keepAlive)); }
Source:
<code>public void testRemoveIndexesOnTableDrop() throws Exception { IgniteEx ignite = startGrids(1); ignite.cluster().active(true); IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); query(cache, "create table t1 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create table t2 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create index t2_idx on t2 (p)"); <START> for (int i = 0; i < 5_000; i++) <END> query(cache, "insert into t2 (id, p, f) values (?, ?, ?)", i, i, i); forceCheckpoint(); CountDownLatch inxDeleteInAsyncTaskLatch = new CountDownLatch(1); LogListener lsnr = new CallbackExecutorLogListener( ".*?Execution of durable background task completed: DROP_SQL_INDEX-PUBLIC.T2_IDX-.*", () -> inxDeleteInAsyncTaskLatch.countDown() ); testLog.registerListener(lsnr); ignite.destroyCache("SQL_PUBLIC_T2"); awaitLatch( inxDeleteInAsyncTaskLatch, "Failed to await for index deletion in async task (either index failed to delete in 1 minute or async task not started)" ); }</code><technical_language>mind rewrite this bulk insert prepared statement save sec TC</technical_language>

Target:
public void testRemoveIndexesOnTableDrop() throws Exception { IgniteEx ignite = startGrids(1); ignite.cluster().active(true); IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); query(cache, "create table t1 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create table t2 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create index t2_idx on t2 (p)"); batchQuery(ignite, "insert into t2 (id, p, f) values (?, ?, ?)", batchInsertArgs(5_000, 3)); forceCheckpoint(); CountDownLatch inxDeleteInAsyncTaskLatch = new CountDownLatch(1); LogListener lsnr = new CallbackExecutorLogListener( ".*?Execution of durable background task completed: DROP_SQL_INDEX-PUBLIC.T2_IDX-.*", () -> inxDeleteInAsyncTaskLatch.countDown() ); testLog.registerListener(lsnr); ignite.destroyCache("SQL_PUBLIC_T2"); awaitLatch( inxDeleteInAsyncTaskLatch, "Failed to await for index deletion in async task (either index failed to delete in 1 minute or async task not started)" ); }
Source:
<code>public void userAuthenticated() { Intent intent = new Intent(mOpenMRS.getApplicationContext(), DashboardActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mOpenMRS.getApplicationContext().startActivity(intent); <START> Intent intent1 = new Intent(mOpenMRS.getApplicationContext(), FormListService.class); <END> mOpenMRS.getApplicationContext().startService(intent1); mPresenter.saveLocationsToDatabase(mLocationsList, mDropdownLocation.getSelectedItem().toString()); }</code><technical_language>Change intent1 a more meaningful name, e.g. formServiceIntent</technical_language>

Target:
public void userAuthenticated() { Intent intent = new Intent(mOpenMRS.getApplicationContext(), DashboardActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mOpenMRS.getApplicationContext().startActivity(intent); Intent formListServiceIntent = new Intent(mOpenMRS.getApplicationContext(), FormListService.class); mOpenMRS.getApplicationContext().startService(formListServiceIntent); mPresenter.saveLocationsToDatabase(mLocationsList, mDropdownLocation.getSelectedItem().toString()); }
Source:
<code>public void start() { configuration.getIgnoredCaches().forEach(this::ignoreCache); RestCacheManager restCacheManager = new RestCacheManager(cacheManager, this::isCacheIgnored); <START> server = Optional.of(new Server(configuration, restCacheManager)); <END> if(configuration.startTransport()) { NettyJaxrsServer nettyServer = createNetty(); nettyServer.start(); ResteasyDeployment deployment = nettyServer.getDeployment(); deployment.getRegistry().addSingletonResource(server.get(), DEFAULT_REST_PATH); deployment.getProviderFactory().register(new RestAccessLoggingHandler(), ContainerRequestFilter.class, ContainerResponseFilter.class); log.startRestServer(configuration.host(), configuration.port()); netty = Optional.of(nettyServer); } }</code><technical_language>server optional</technical_language>

Target:
public void start() { configuration.ignoredCaches().forEach(this::ignoreCache); RestCacheManager restCacheManager = new RestCacheManager(cacheManager, this::isCacheIgnored); server = new Server(configuration, restCacheManager); if(configuration.startTransport()) { NettyJaxrsServer nettyServer = createNetty(); addEncryption(configuration, nettyServer); nettyServer.start(); ResteasyDeployment deployment = nettyServer.getDeployment(); deployment.getRegistry().addSingletonResource(server, DEFAULT_REST_PATH); deployment.getProviderFactory().register(new RestAccessLoggingHandler(), ContainerRequestFilter.class, ContainerResponseFilter.class); log.startRestServer(configuration.host(), configuration.port()); netty = nettyServer; } }
Source:
<code><START> public Partition[] listPartitions() { <END> try { return readTopology().getPartitions(); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }</code><technical_language>throws ..</technical_language>

Target:
public Partition[] listPartitions() throws NakadiRuntimeException, SubscriptionNotInitializedException { try { return readTopology().getPartitions(); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }
Source:
<code>public CompletionTime processOneToOne(String tenantId, Span item) throws RetryAttemptException { if (item.getParentId() == null) { CompletionTime ct = new CompletionTime(); ct.setId(item.getId()); URL url = item.url(); if (url != null) { ct.setUri(url.getPath()); ct.setEndpointType(url.getProtocol() == null ? null : url.getProtocol().toUpperCase()); } else { ct.setEndpointType("Unknown"); } ct.setDuration(TimeUnit.MILLISECONDS.convert(item.getDuration(), TimeUnit.NANOSECONDS)); ct.setTimestamp(item.getTimestamp()/1000); List<Property> spanProperties = item.properties(); ct.getProperties().addAll(spanProperties); ct.setHostName(Span.ipv4Address(spanProperties)); <START> <END> if (log.isLoggable(Level.FINEST)) { log.finest("TraceCompletionTimeDeriver ret=" + ct); } return ct; } return null; }</code><technical_language>add a hostAddress property CompletionTime populate here. instead of setting host name</technical_language>

Target:
public CompletionTime processOneToOne(String tenantId, Span item) throws RetryAttemptException { if (item.getParentId() == null) { CompletionTime ct = new CompletionTime(); ct.setId(item.getId()); URL url = item.url(); if (url != null) { ct.setUri(url.getPath()); ct.setEndpointType(url.getProtocol() == null ? null : url.getProtocol().toUpperCase()); } else { ct.setEndpointType("Unknown"); } ct.setDuration(TimeUnit.MILLISECONDS.convert(item.getDuration(), TimeUnit.NANOSECONDS)); ct.setTimestamp(item.getTimestamp()/1000); List<Property> spanProperties = item.properties(); ct.getProperties().addAll(spanProperties); ct.setHostAddress(Span.ipv4Address(spanProperties)); if (log.isLoggable(Level.FINEST)) { log.finest("TraceCompletionTimeDeriver ret=" + ct); } return ct; } return null; }
Source:
<code>public void handleDownloadProgressMenuItem(Menu menu) { <START> final MenuItem newProgressMenuItem = menu.findItem(R.id.menu_item_download_progress); <END> final View progressView = newProgressMenuItem.getActionView(); final ProgressWheel newProgressWheel = (ProgressWheel) progressView.findViewById(R.id.progress_wheel); if (progressMenuItem != null) { newProgressMenuItem.setVisible(progressMenuItem.isVisible()); newProgressWheel.setProgress(progressWheel.getProgress()); } progressMenuItem = newProgressMenuItem; progressWheel = newProgressWheel; progressView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { environment.getRouter().showDownloads(getActivity()); } }); if (updateDownloadProgressRunnable == null) { updateDownloadProgressRunnable = new Runnable() { @Override public void run() { if (!NetworkUtil.isConnected(getContext()) || !environment.getDatabase().isAnyVideoDownloading(null)) { progressMenuItem.setVisible(false); } else { progressMenuItem.setVisible(true); environment.getStorage().getAverageDownloadProgress( new DataCallback<Integer>() { @Override public void onResult(Integer result) { int progressPercent = result; if (progressPercent >= 0 && progressPercent <= 100) { progressWheel.setProgressPercent(progressPercent); } } @Override public void onFail(Exception ex) { logger.error(ex); } }); } handler.postDelayed(this, DateUtils.SECOND_IN_MILLIS); } }; updateDownloadProgressRunnable.run(); } }</code><technical_language>downloadsMenuItem b a name</technical_language>

Target:
public void handleDownloadProgressMenuItem(Menu menu) { final MenuItem downloadsMenuItem = menu.findItem(R.id.menu_item_download_progress); final View progressView = downloadsMenuItem.getActionView(); final ProgressWheel progressWheel = (ProgressWheel) progressView.findViewById(R.id.progress_wheel); if (downloadsMenuItem != null) { downloadsMenuItem.setVisible(downloadsMenuItem.isVisible()); progressWheel.setProgress(progressWheel.getProgress()); } progressView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { environment.getRouter().showDownloads(getActivity()); } }); if (updateDownloadProgressRunnable == null) { updateDownloadProgressRunnable = new Runnable() { @Override public void run() { if (!NetworkUtil.isConnected(getContext()) || !environment.getDatabase().isAnyVideoDownloading(null)) { downloadsMenuItem.setVisible(false); } else { downloadsMenuItem.setVisible(true); environment.getStorage().getAverageDownloadProgress( new DataCallback<Integer>() { @Override public void onResult(Integer result) { int progressPercent = result; if (progressPercent >= 0 && progressPercent <= 100) { progressWheel.setProgressPercent(progressPercent); } } @Override public void onFail(Exception ex) { logger.error(ex); } }); } handler.postDelayed(this, DateUtils.SECOND_IN_MILLIS); } }; updateDownloadProgressRunnable.run(); } }
Source:
<code>private void addCopy(StringBuilder b) { if (assemblyUser != null) { String[] userParts = assemblyUser.split(":"); for (CopyEntry entry : copyEntries) { String dest = (basedir.equals("/") ? "" : basedir) + "/" + entry.destination; DockerFileKeyword.ADD.addTo(b, " --chown=" <START> + (userParts.length > 2 ? <END> userParts[0] + ":" + userParts[1] : userParts[0]), entry.source, dest); } } else { addCopyEntries(b, ""); } }</code><technical_language>2 ? > 1</technical_language>

Target:
private void addCopy(StringBuilder b) { if (assemblyUser != null) { String[] userParts = assemblyUser.split(":"); for (CopyEntry entry : copyEntries) { if (userParts.length > 2) { DockerFileKeyword.USER.addTo(b, "root"); } addCopyEntries(b, "", (userParts.length > 1 ? userParts[0] + ":" + userParts[1] : userParts[0])); if (userParts.length > 2) { DockerFileKeyword.USER.addTo(b, userParts[2]); } } } else { addCopyEntries(b, "", null); } }
Source:
<code>private static int compareImports(String import1, String import2) { int result = 0; final String separator = "\\."; final String[] import1Tokens = import1.split(separator); final String[] import2Tokens = import2.split(separator); <START> for (int i = 0; i != import1Tokens.length && i != import2Tokens.length; i++) { <END> final String import1Token = import1Tokens[i]; final String import2Token = import2Tokens[i]; result = import1Token.compareTo(import2Token); if (result != 0) { break; } } return result; }</code><technical_language>If allow this, imports un-even lengths issue, right? example is java.util.Map java.util.Map.Entry. 2 equal in position, .Entry end, 1 greater length other. method 2 imports completely equal is incorrect. add for loop like: if (result == 0 && import1Tokens.length != import2Tokens.length) { result = Integer.compare(import1Tokens.length, import2Tokens.length); }</technical_language>

Target:
private static int compareImports(String import1, String import2) { int result = 0; final String separator = "\\."; final String[] import1Tokens = import1.split(separator); final String[] import2Tokens = import2.split(separator); for (int i = 0; i != import1Tokens.length && i != import2Tokens.length; i++) { final String import1Token = import1Tokens[i]; final String import2Token = import2Tokens[i]; result = import1Token.compareTo(import2Token); if (result != 0) { break; } } if (result == 0) { result = Integer.compare(import1Tokens.length, import2Tokens.length); } return result; }
Source:
<code>protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { List<? extends AnnotationValue> annotationValue = annotationApiHelper.getAnnotationArrayValue( annotation, "groups" ); Set<ConstraintCheckError> issues = CollectionHelper.newHashSet(); for ( AnnotationValue value : annotationValue ) { <START> if ( value.getValue() instanceof DeclaredType && !( (DeclaredType) value.getValue() ).asElement().getKind().isInterface() ) { <END> issues.add( new ConstraintCheckError( element, annotation, "INVALID_GROUPS_VALUE_ANNOTATION_PARAMETERS" ) ); } } return issues; }</code><technical_language>!( value.getValue() instanceof DeclaredType ) || ... a test</technical_language>

Target:
protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { List<? extends AnnotationValue> annotationValue = annotationApiHelper.getAnnotationArrayValue( annotation, "groups" ); Set<ConstraintCheckError> issues = CollectionHelper.newHashSet(); for ( AnnotationValue value : annotationValue ) { TypeMirror typeValue = (TypeMirror) value.getValue(); if ( !TypeKind.DECLARED.equals( typeValue.getKind() ) || !( (DeclaredType) typeValue ).asElement().getKind().isInterface() ) { issues.add( new ConstraintCheckError( element, annotation, "INVALID_GROUPS_VALUE_ANNOTATION_PARAMETERS" ) ); } } return issues; }
Source:
<code>private void setupAlert() { alert = new Alert(Alert.AlertType.NONE); alert.setTitle(" "); alert.setHeaderText("Loading..."); alert.getButtonTypes().add(ButtonType.CANCEL); alert.getDialogPane().setContent(progressBar); <START> Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); <END> Image icon = new Image(this.getClass().getResourceAsStream(ICON)); stage.getIcons().add(icon); }</code><technical_language>is this for? If want set icon for Stage, please do in DNAInator class</technical_language>

Target:
private void setupAlert() { this.setTitle("DNAinator"); this.setHeaderText("Loading..."); this.getButtonTypes().add(ButtonType.CANCEL); this.initOwner(parent.getScene().getWindow()); this.getDialogPane().setContent(progressBar); }
Source:
<code>@Test public void getWithUrlThenPathThrows() { class Example { @GET Call<Object> method(@Url String url, @Path("hey") String hey) { return null; } } try { <START> buildRequest(Example.class, "foo/bar"); <END> } catch (IllegalArgumentException e) { assertThat(e).hasMessage("@Path parameters may not be used with @Url. (parameter #2)\n" + " for method Example.method"); } }</code><technical_language>fail</technical_language>

Target:
@Test public void getWithUrlThenPathThrows() { class Example { @GET Call<Object> method(@Url String url, @Path("hey") String hey) { return null; } } try { buildRequest(Example.class, "foo/bar"); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("@Path parameters may not be used with @Url. (parameter #2)\n" + " for method Example.method"); } }
Source:
<code><START> public static List<List<Migration>> findPaths( <END> Resource resource, Optional<UUID> fromState, Optional<UUID> targetState) { return findPaths(resource, fromState, targetState, new ArrayList<>()); }</code><technical_language>this method public add parameter guards - lets add if(fromState == null) throw new ArgumentNullException</technical_language>

Target:
public static List<List<Migration>> findPaths( Resource resource, Optional<UUID> fromState, Optional<UUID> targetState) { if (resource == null) throw new ArgumentNullException("resource"); if (fromState == null) throw new ArgumentNullException("fromState"); if (targetState == null) throw new ArgumentNullException("targetState"); return findPaths(resource, fromState, targetState, new ArrayList<>()); }
Source:
<code>public static List<TurboIssue> reconcile(List<TurboIssue> existing, List<TurboIssue> changed) { List<TurboIssue> existingCopy = new ArrayList<>(existing); for (TurboIssue issue : changed) { int id = issue.getId(); Optional<Integer> correspondingIssueIndex = findIssueWithId(existingCopy, id); <START> if (correspondingIssueIndex.isPresent()) { <END> TurboIssue existingIssue = existingCopy.get(correspondingIssueIndex.get()); TurboIssue newIssue = new TurboIssue(issue); newIssue.transferTransientState(existingIssue); newIssue.reconcile(existingIssue); existingCopy.set(correspondingIssueIndex.get(), newIssue); } else { existingCopy.add(new TurboIssue(issue)); } } return existingCopy; }</code><technical_language>code is easier understand if deal shorter branch first</technical_language>

Target:
public static List<TurboIssue> reconcile(List<TurboIssue> existing, List<TurboIssue> changed) { List<TurboIssue> existingCopy = new ArrayList<>(existing); for (TurboIssue issue : changed) { int id = issue.getId(); Optional<Integer> correspondingIssueIndex = findIssueWithId(existingCopy, id); if (!correspondingIssueIndex.isPresent()) { existingCopy.add(new TurboIssue(issue)); } else { TurboIssue existingIssue = existingCopy.get(correspondingIssueIndex.get()); TurboIssue newIssue = new TurboIssue(issue); newIssue.transferTransientState(existingIssue); newIssue.reconcile(existingIssue); existingCopy.set(correspondingIssueIndex.get(), newIssue); } } return existingCopy; }
Source:
<code>public String toString() { return "ExcelConfiguration[columnNameLineNumber=" + columnNameLineNumber + ", skipEmptyLines=" + skipEmptyLines + ", skipEmptyColumns=" + skipEmptyColumns +", detectColumnTypes=" <START> + detectColumnTypes + "]"; <END> }</code><technical_language>add numberOfLinesToScan</technical_language>

Target:
public String toString() { return "ExcelConfiguration[columnNameLineNumber=" + columnNameLineNumber + ", skipEmptyLines=" + skipEmptyLines + ", skipEmptyColumns=" + skipEmptyColumns +", detectColumnTypes=" + detectColumnTypes + ", numbersOfLinesToScan=" + numberOfLinesToScan + "]"; }
Source:
<code>private JpaClass(Class<C> clazz) { <START> logger.debug("init {}", clazz); <END> this.members = unmodifiableList(new ArrayList<>(inspectClass(clazz))); logger.debug("init {}: members.", clazz, members.size()); }</code><technical_language>this is redundant log statement</technical_language>

Target:
private JpaClass(Class<C> clazz) { this.members = unmodifiableList(new ArrayList<>(inspectClass(clazz))); logger.debug("init {}: members.", clazz, members.size()); }
Source:
<code>public void setFanDirection(int direction) { resetFanToOff(); <START> if (direction < FAN_DIRECTION_FACE || direction > FAN_DIRECTION_FLOOR_DEFROSTER) return; <END> for (ImageView v : mControlMap.keySet()) { if (direction == mControlMap.get(v)) { v.setImageDrawable(mFanMap.get(v).first); v.setAlpha(SELECTED_BUTTON_ALPHA); return; } } }</code><technical_language>If input is actionable: a) log? b) sense turn fan first</technical_language>

Target:
public void setFanDirection(int direction) { resetFanToOff(); if (direction < FAN_DIRECTION_FACE || direction > FAN_DIRECTION_FLOOR_DEFROSTER) { Log.i(TAG, "Unexpected fan direction: " + direction); return; } for (Map.Entry<ImageView, Integer> entry : mControlMap.entrySet()) { if (direction == entry.getValue()) { ImageView v = entry.getKey(); v.setImageDrawable(mFanMap.get(v).first); v.setAlpha(SELECTED_BUTTON_ALPHA); return; } } }
Source:
<code>private boolean loadData() { if (currentChunk == null || !currentChunk.hasRemaining()) { if (currentChunk != null) { scheduledWriteChannel.resolveChunk(currentChunk, null); } try { currentChunk = scheduledWriteChannel.getNextChunk(); } catch (InterruptedException e) { <START> throw new IllegalStateException(e); <END> } } return currentChunk != null; }</code><technical_language>I a good idea throw IllegalStateException, read() apis of InputStream throw IOException</technical_language>

Target:
private boolean loadData() throws IOException { if (currentChunk == null || !currentChunk.hasRemaining()) { if (currentChunk != null) { asyncWritableChannel.resolveChunk(currentChunk, null); } try { currentChunk = asyncWritableChannel.getNextChunk(); } catch (InterruptedException e) { throw new IllegalStateException(e); } } if (currentChunk == null) { if (callback.exception != null) { if (callback.exception instanceof IOException) { throw (IOException) callback.exception; } else { throw new IllegalStateException(callback.exception); } } else if (bytesAvailable != 0) { throw new IllegalStateException("All the bytes available could not be read"); } } return currentChunk != null; }
Source:
<code>public final void applyToBuilder(SCMSourceBuilder<?, ?> builder) { if (!getDescriptor().isApplicableToBuilder(builder)) { } <START> decorateBuilder((SCMSourceBuilder) builder); <END> }</code><technical_language>guarding here</technical_language>

Target:
public final void applyToBuilder(SCMSourceBuilder<?, ?> builder) { SCMNavigatorTraitDescriptor d = getDescriptor(); if (d.getBuilderClass().isInstance(builder) && d.isApplicableToBuilder(builder)) { decorateBuilder(builder); } }
Source:
<code>public final ScriptResult executeAsync(final Object content) { final Script piece; if (content instanceof Script) { piece = (Script) content; <START> } else { <END> if (content instanceof org.eclipse.core.resources.IFile) { piece = new Script(((org.eclipse.core.resources.IFile) content).getName(), content); } else if (content instanceof java.io.File) { piece = new Script(((java.io.File) content).getName(), content); } else { piece = new Script(content); } } fCodePieces.add(piece); synchronized (this) { notifyAll(); } return piece.getResult(); }</code><technical_language>put this stuff in constructor of Script(Object), do need change code</technical_language>

Target:
public final ScriptResult executeAsync(final Object content) { final Script piece; if (content instanceof Script) { piece = (Script) content; } else { piece = new Script(content); } fCodePieces.add(piece); synchronized (this) { notifyAll(); } return piece.getResult(); }
Source:
<code>public ICPPEvaluation getInitializerEvaluation() { ICPPASTDeclarator declarator = (ICPPASTDeclarator)findDeclarator(); if(declarator != null) { IASTInitializer initializer = declarator.getInitializer(); if(hasImplicitlyCalledCtor(declarator)) { <START> ICPPConstructor constructor = (ICPPConstructor)CPPSemantics.findImplicitlyCalledConstructor(declarator); <END> ICPPEvaluation[] arguments = EvalConstructor.extractArguments(initializer, constructor); return new EvalConstructor(getType(), constructor, arguments, declarator); } else if(initializer instanceof IASTEqualsInitializer) { IASTEqualsInitializer equalsInitializer = (IASTEqualsInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)equalsInitializer.getInitializerClause(); return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTInitializerList) { ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)initializer; return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTConstructorInitializer) { ICPPASTConstructorInitializer ctorInitializer = (ICPPASTConstructorInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)ctorInitializer.getArguments()[0]; return evalOwner.getEvaluation(); } else if(initializer == null) { return null; } } return EvalFixed.INCOMPLETE; }</code><technical_language>Please avoid calling findImplicitlyCalledConstructor() (once in hasImplicitlyCalledCtor(), here). expensive operation</technical_language>

Target:
public ICPPEvaluation getInitializerEvaluation() { ICPPASTDeclarator declarator = (ICPPASTDeclarator)findDeclarator(); if(declarator != null) { IASTInitializer initializer = declarator.getInitializer(); ICPPConstructor constructor = getImplicitlyCalledCtor(declarator); if(constructor != null) { ICPPEvaluation[] arguments = EvalConstructor.extractArguments(initializer, constructor); return new EvalConstructor(getType(), constructor, arguments, declarator); } else if(initializer instanceof IASTEqualsInitializer) { IASTEqualsInitializer equalsInitializer = (IASTEqualsInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)equalsInitializer.getInitializerClause(); return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTInitializerList) { ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)initializer; return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTConstructorInitializer) { ICPPASTConstructorInitializer ctorInitializer = (ICPPASTConstructorInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)ctorInitializer.getArguments()[0]; return evalOwner.getEvaluation(); } else if(initializer == null) { return null; } } return EvalFixed.INCOMPLETE; }
Source:
<code>public synchronized void removeProgressListener(ProgressListener listener) { <START> if (listener == null) { <END> return; } Long token = progressListenerToOsTokenMap.remove(listener); if (token != null) { Iterator<Map.Entry<Long, ProgressListener>> it = listenerIdToProgressListenerMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Long, ProgressListener> entry = it.next(); if (entry.getValue().equals(listener)) { it.remove(); break; } } nativeRemoveProgressListener(configuration.getPath(), token); } }</code><technical_language>pesky booleans</technical_language>

Target:
public synchronized void removeProgressListener(ProgressListener listener) { if (listener == null) { return; } Long token = progressListenerToOsTokenMap.remove(listener); if (token != null) { Iterator<Map.Entry<Long, Pair<ProgressListener, Progress>>> it = listenerIdToProgressListenerMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Long, Pair<ProgressListener, Progress>> entry = it.next(); if (entry.getValue().first.equals(listener)) { it.remove(); break; } } nativeRemoveProgressListener(configuration.getPath(), token); } }
Source:
<code>public void setNumMultiPointRadiusVertices(int numMultiPointRadiusVertices) { <START> this.numMultiPointRadiusVertices = numMultiPointRadiusVertices; <END> }</code><technical_language>checking for non-negative numbers? establish a min max</technical_language>

Target:
public void setNumMultiPointRadiusVertices(int numMultiPointRadiusVertices) { if (numMultiPointRadiusVertices < MIN_NUM_POINT_RADIUS_VERTICES) { this.numMultiPointRadiusVertices = MIN_NUM_POINT_RADIUS_VERTICES; LOGGER.debug( "Admin supplied max number of vertices is too low. Defaulting to the minimum number of vertices", MIN_NUM_POINT_RADIUS_VERTICES); } else if (numMultiPointRadiusVertices > 32) { this.numMultiPointRadiusVertices = MAX_NUM_POINT_RADIUS_VERTICES; LOGGER.debug( "Admin supplied max number of vertices is too high. Defaulting to the maximum number of vertices", MAX_NUM_POINT_RADIUS_VERTICES); } else { this.numMultiPointRadiusVertices = numMultiPointRadiusVertices; } }
Source:
<code>@Override public Subscriber<Integer> createSubscriber() { return new SyncTriggeredDemandSubscriber<Integer>() { private long acc; @Override protected long foreach(final Integer element) { acc += element; return 1; } @Override public void onComplete() { <START> System.out.println("Accumulated: " + acc); <END> } }; }</code><technical_language>remove merge</technical_language>

Target:
@Override public Subscriber<Integer> createSubscriber() { return new SyncTriggeredDemandSubscriber<Integer>() { private long acc; @Override protected long foreach(final Integer element) { acc += element; return 1; } @Override public void onComplete() { } }; }
Source:
<code>public MePage go() { while (!isElementDisplayed(appSettings)) { clickOn(R.id.nav_sites); <START> clickOn(onView(allOf(withId(R.id.me_item), withEffectiveVisibility(Visibility.VISIBLE)))); <END> } if (!isSelfHosted()) { displayName.check(matches(isDisplayed())); } return this; }</code><technical_language>clickOn is custom click action, I love modifying element passing here. feels cleaner update clickOn method handle scenarios this. do think</technical_language>

Target:
public MePage go() { while (!isElementDisplayed(appSettings)) { clickOn(R.id.nav_sites); clickOn(R.id.me_item); } if (!isSelfHosted()) { displayName.check(matches(isDisplayed())); } return this; }
Source:
<code>public HashMap<ItemIdentifier, Integer> getItemsAndCount() { HashMap<ItemIdentifier, Integer> result = new HashMap<ItemIdentifier, Integer>(); for(int i=0; i < _drawer.getDrawerCount(); i++) { if (!_drawer.isDrawerEnabled(i)) continue; IDrawer drawer = _drawer.getDrawer(i); if(drawer != null && !drawer.isEmpty()) { int count = drawer.getStoredItemCount(); <START> ItemIdentifier ident = ItemIdentifier.get(drawer.getStoredItemCopy()); <END> if(result.containsKey(ident)) { result.put(ident, result.get(ident) + count); } else { result.put(ident, count); } } } return result; }</code><technical_language>drawer.getStoredItemPrototype() well</technical_language>

Target:
public HashMap<ItemIdentifier, Integer> getItemsAndCount() { HashMap<ItemIdentifier, Integer> result = new HashMap<ItemIdentifier, Integer>(); for(int i=0; i < _drawer.getDrawerCount(); i++) { if (!_drawer.isDrawerEnabled(i)) continue; IDrawer drawer = _drawer.getDrawer(i); if(drawer != null && !drawer.isEmpty()) { int count = drawer.getStoredItemCount(); if (count > 0) { ItemIdentifier ident = ItemIdentifier.get(drawer.getStoredItemPrototype()); if (result.containsKey(ident)) { result.put(ident, result.get(ident) + count); } else { result.put(ident, count); } } } } return result; }
Source:
<code>public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); <START> return filterToBestSuggestions(df); <END> }</code><technical_language>select query, dym ? current impl cirrus side expects 2 fields (<LINK_0></technical_language>

Target:
public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); df = filterToBestSuggestions(df); return df.select("wikiid", "query", "dym"); }
Source:
<code>private String[] updateTagsWithEntityID(String[] tags, String entityID) { if (entityID == null) { entityID = System.getenv(DD_ENTITY_ID_ENV_VAR); } <START> if (entityID != null) { <END> final String entityTag = new StringBuilder(ENTITY_ID_TAG_NAME).append(":").append(entityID).toString(); if (tags == null) { tags = new String[]{entityTag}; } else { tags = Arrays.copyOf(tags, tags.length+1); tags[tags.length] = entityTag; } } return tags; }</code><technical_language>check set empty string</technical_language>

Target:
private String[] updateTagsWithEntityID(String[] tags, String entityID) { if(entityID == null || entityID.trim().isEmpty()) { entityID = System.getenv(DD_ENTITY_ID_ENV_VAR); } if(entityID != null && !entityID.trim().isEmpty()) { final String entityTag = new StringBuilder(ENTITY_ID_TAG_NAME).append(":").append(entityID).toString(); if (tags == null) { tags = new String[]{entityTag}; } else { tags = Arrays.copyOf(tags, tags.length+1); tags[tags.length] = entityTag; } } return tags; }
Source:
<code>public Builder addRequestHandler(RequestHandler requestHandler) { if (requestHandler == null) { throw new IllegalArgumentException("RequestHandler must not be null."); } if (requestHandlers == null) { <START> requestHandlers = new ArrayList(); <END> } if (requestHandlers.contains(requestHandler)) { throw new IllegalStateException("RequestHandler already registered."); } requestHandlers.add(requestHandler); return this; }</code><technical_language>Missing generics</technical_language>

Target:
public Builder addRequestHandler(RequestHandler requestHandler) { if (requestHandler == null) { throw new IllegalArgumentException("RequestHandler must not be null."); } if (requestHandlers == null) { requestHandlers = new ArrayList<RequestHandler>(); } if (requestHandlers.contains(requestHandler)) { throw new IllegalStateException("RequestHandler already registered."); } requestHandlers.add(requestHandler); return this; }
Source:
<code>protected void performPlugCommnad(VDSCommandType commandType, DiskImage diskImage, VmDevice vmDevice, boolean isUpdateDb) { <START> Backend.getInstance().getResourceManager().RunVdsCommand( <END> commandType, new HotPlugDiskVDSParameters(getVm().getrun_on_vds().getValue(), getVm().getId(), diskImage, vmDevice)); if (isUpdateDb) { vmDevice.setIsPlugged(!vmDevice.getIsPlugged()); getVmDeviceDao().update(vmDevice); } setSucceeded(true); }</code><technical_language>i discovered use: runVdsCommand(VDSCommandType commandType, VDSParametersBase parameters)</technical_language>

Target:
protected void performPlugCommnad(VDSCommandType commandType, DiskImage diskImage, VmDevice vmDevice, boolean isUpdateDb) { runVdsCommand(commandType, new HotPlugDiskVDSParameters(getVm().getrun_on_vds().getValue(), getVm().getId(), diskImage, vmDevice)); if (isUpdateDb) { vmDevice.setIsPlugged(!vmDevice.getIsPlugged()); getVmDeviceDao().update(vmDevice); } setSucceeded(true); }
Source:
<code>public void should_fail_list_asserts_on_non_list_objects_even_with_asList() { Object nonList = new Object(); <START> thrown.expectAssertionErrorWithMessageContaining(format("an instance of:%n <java.util.List>%nbut was instance of:%n <java.lang.Object>")); <END> assertThat(nonList).asList().isSorted(); }</code><technical_language>Is avoid format pass message ? is of %n presence</technical_language>

Target:
public void should_fail_list_asserts_on_non_list_objects_even_with_asList() { Object nonList = new Object(); thrown.expectAssertionErrorWithMessageContaining("an instance of:%n <java.util.List>%nbut was instance of:%n <java.lang.Object>"); assertThat(nonList).asList().isSorted(); }
Source:
<code>public AbfsOutputStream( final AbfsClient client, final String path, final long position, final int bufferSize, final boolean supportFlush, final boolean disableOutputStreamFlush) { this.client = client; this.path = path; this.position = position; this.closed = false; this.supportFlush = supportFlush; this.disableOutputStreamFlush = disableOutputStreamFlush; this.lastError = null; this.lastFlushOffset = 0; this.bufferSize = bufferSize; this.buffer = byteBufferPool.getBuffer(false, bufferSize).array(); this.bufferIndex = 0; this.writeOperations = new ConcurrentLinkedDeque<>(); this.maxConcurrentRequestCount = 4 * Runtime.getRuntime().availableProcessors(); this.threadExecutor = new ThreadPoolExecutor(maxConcurrentRequestCount, maxConcurrentRequestCount, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); <START> this.completionService = new ExecutorCompletionService<AuthorizationStatus>(this.threadExecutor); <END> }</code><technical_language>explicit type needed</technical_language>

Target:
public AbfsOutputStream( final AbfsClient client, final String path, final long position, final int bufferSize, final boolean supportFlush, final boolean disableOutputStreamFlush) { this.client = client; this.path = path; this.position = position; this.closed = false; this.supportFlush = supportFlush; this.disableOutputStreamFlush = disableOutputStreamFlush; this.lastError = null; this.lastFlushOffset = 0; this.bufferSize = bufferSize; this.buffer = byteBufferPool.getBuffer(false, bufferSize).array(); this.bufferIndex = 0; this.writeOperations = new ConcurrentLinkedDeque<>(); this.maxConcurrentRequestCount = 4 * Runtime.getRuntime().availableProcessors(); this.threadExecutor = new ThreadPoolExecutor(maxConcurrentRequestCount, maxConcurrentRequestCount, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); this.completionService = new ExecutorCompletionService<>(this.threadExecutor); }
Source:
<code>public Response load(String payload) { try { <START> loadHandler.handle(extractRegisterNameFromRequest(), payload); <END> return Response.ok().build(); } catch (Exception e) { if (e.getCause() instanceof EntryValidator.EntryValidationException) { EntryValidator.EntryValidationException errorCause = (EntryValidator.EntryValidationException) e.getCause(); return Response.status(400).entity(errorCause.getMessage() + "\nEntity: '" + errorCause.getEntry().toString() + "'").build(); } else { return Response.serverError().entity(e).build(); } } }</code><technical_language>I if register name part of config for mint</technical_language>

Target:
public Response load(String payload) { try { loadHandler.handle(extractRegisterNameFromRequest(), payload); return Response.ok().build(); } catch (EntryValidationException e) { return Response.status(400).entity(e.getMessage() + " Error entry: '" + e.getEntry().toString() + "'").build(); } catch (Exception e) { return Response.serverError().entity(e).build(); } }
Source:
<code>public Run getByAlias(String alias) throws IOException { Criteria criteria = currentSession().createCriteria(RunImpl.class); criteria.add(Restrictions.eq("alias", alias)); @SuppressWarnings("unchecked") List<Run> records = criteria.list(); <START> if (records.size() == 1) { <END> return records.iterator().next(); } else { throw new IOException("Found more than one run by this name"); } }</code><technical_language>return uniqueResult instead of checking</technical_language>

Target:
public Run getByAlias(String alias) throws IOException { Criteria criteria = currentSession().createCriteria(RunImpl.class); criteria.add(Restrictions.eq("alias", alias)); return (Run) criteria.uniqueResult(); }
Source:
<code>public void jetWordCount() { try { dataStoreOut = DataStoreFactory.getDataStore(Long.class, ResultPageView.class, new Configuration()); } catch (GoraException e) { e.printStackTrace(); } Query<Long, ResultPageView> query = dataStoreOut.newQuery(); JetEngine<Long, ResultPageView, Long, ResultPageView> jetEngine = new JetEngine<>(); Pattern delimiter = Pattern.compile("\\W+"); Pipeline p = Pipeline.create(); p.drawFrom(jetEngine.createDataSource(dataStoreOut, query)) .flatMap(e -> traverseArray(delimiter.split(e.getValue().getUrl().toString().toLowerCase()))) .filter(word -> !word.isEmpty()) .groupingKey(wholeItem()) .aggregate(counting()) .drainTo(Sinks.map("COUNTS")); JetInstance jet = Jet.newJetInstance();; try { System.out.print("\nCounting words... "); jet.newJob(p).join(); IMap<String, Long> counts = jet.getMap("COUNTS"); <START> if (counts.get("the") != 2) { <END> throw new AssertionError("Wrong count of 'the'"); } System.out.println("Count of 'the' is valid"); } finally { Jet.shutdownAll(); } }</code><technical_language>assertEquals(), instead of if condition</technical_language>

Target:
public void jetWordCount() throws GoraException { dataStoreOut = DataStoreFactory.getDataStore(Long.class, ResultPageView.class, utility.getConfiguration()); Query<Long, ResultPageView> query = dataStoreOut.newQuery(); JetEngine<Long, ResultPageView, Long, ResultPageView> jetEngine = new JetEngine<>(); Pattern delimiter = Pattern.compile("\\W+"); Pipeline p = Pipeline.create(); p.drawFrom(jetEngine.createDataSource(dataStoreOut, query)) .flatMap(e -> traverseArray(delimiter.split(e.getValue().getUrl().toString()))) .filter(word -> !word.isEmpty()) .groupingKey(wholeItem()) .aggregate(counting()) .drainTo(Sinks.map("COUNTS")); JetInstance jet = Jet.newJetInstance();; jet.newJob(p).join(); IMap<String, Long> counts = jet.getMap("COUNTS"); assertEquals(3L, (long)counts.get("the")); }
Source:
<code>protected void render0(FunctionRenderContext context) { Object[] jsonPathElements = new Object[context.getArgumentsSize() - 2]; <START> for (int i = 2; i < context.getArgumentsSize(); i++) { <END> try { jsonPathElements[i - 2] = Integer.parseInt(JpqlFunctionUtil.unquoteSingleQuotes(context.getArgument(i))); } catch (NumberFormatException e) { jsonPathElements[i - 2] = JpqlFunctionUtil.unquoteSingleQuotes(context.getArgument(i)); } } context.addChunk("(select "); context.addChunk("json_mergepatch("); context.addArgument(0); context.addChunk(",'"); for (int i = 0; i < jsonPathElements.length; i++) { startJsonPathElement(context, jsonPathElements, i); } context.addChunk("' || "); context.addChunk("column_value"); context.addChunk(" || '"); for (int i = jsonPathElements.length - 1; i >= 0; i--) { endJsonPathElement(context, jsonPathElements, i); } context.addChunk("')"); context.addChunk(" from table(sys.ODCIVARCHAR2LIST("); context.addArgument(1); context.addChunk(")))"); }</code><technical_language>Please start 0 jsonPathElements.length add offset context.getArgument(i + 2) subtracting it</technical_language>

Target:
protected void render0(FunctionRenderContext context) { List<Object> jsonPathElements = AbstractJsonGetFunction.retrieveJsonPathElements(context, 2); context.addChunk("(select "); context.addChunk("json_mergepatch("); context.addArgument(0); context.addChunk(",'"); for (int i = 0; i < jsonPathElements.size(); i++) { startJsonPathElement(context, jsonPathElements, i); } context.addChunk("' || "); context.addChunk("column_value"); context.addChunk(" || '"); for (int i = jsonPathElements.size() - 1; i >= 0; i--) { endJsonPathElement(context, jsonPathElements, i); } context.addChunk("')"); context.addChunk(" from table(sys.ODCIVARCHAR2LIST("); context.addArgument(1); context.addChunk(")))"); }
Source:
<code>public void testLimitOfSalesforceBulQueryReader() throws Exception { SalesforceInputProperties properties = createCommonSalesforceInputPropertiesForModule(); SalesforceDataprepSource source = new SalesforceDataprepSource(); source.initialize(null, properties); source.validate(null); properties.getDatasetProperties().selectColumnIds.setValue(Arrays.asList("IsDeleted", "Id", "Name")); try (Reader reader = source.createReader(null);) { ((SalesforceBulkQueryReader) reader).setLimit(1); <START> boolean available = reader.start(); <END> available = reader.advance(); IndexedRecord record = (IndexedRecord) reader.getCurrent(); assertEquals(3, record.getSchema().getFields().size()); available = reader.advance(); } }</code><technical_language>I point of this variable, is all. test is missing reader provide anymore records one</technical_language>

Target:
public void testLimitOfSalesforceBulQueryReader() throws Exception { SalesforceInputProperties properties = createCommonSalesforceInputPropertiesForModule(); SalesforceDataprepSource source = new SalesforceDataprepSource(); source.initialize(null, properties); source.validate(null); properties.getDatasetProperties().selectColumnIds.setValue(Arrays.asList("IsDeleted", "Id", "Name")); try (Reader reader = source.createReader(null);) { ((SalesforceBulkQueryReader) reader).setLimit(1); reader.start(); reader.advance(); IndexedRecord record = (IndexedRecord) reader.getCurrent(); assertEquals(3, record.getSchema().getFields().size()); try{ reader.advance(); fail(); } catch (IOException e) { } } }
Source:
<code>private static Block serializeStruct(Type type, BlockBuilder builder, Object object) { if (object == null) { <START> requireNonNull(builder, "parent builder is null").appendNull(); <END> return null; } List<Type> typeParameters = type.getTypeParameters(); BlockBuilder currentBuilder; boolean builderSynthesized = false; if (builder == null) { builderSynthesized = true; builder = type.createBlockBuilder(null, 1); } currentBuilder = builder.beginBlockEntry(); for (int i = 0; i < typeParameters.size(); i++) { Optional<String> fieldName = type.getTypeSignature().getParameters().get(i).getNamedTypeSignature().getName(); String name = ""; if (fieldName.isPresent()) { name = fieldName.get().toLowerCase(ENGLISH); } Object value = ((Map) object).get(name); serializeObject(typeParameters.get(i), currentBuilder, value); } builder.closeEntry(); if (builderSynthesized) { return (Block) type.getObject(builder, 0); } else { return null; } }</code><technical_language>requireNonNull(builder, "builder is null"); builder.appendNull();</technical_language>

Target:
private static Block serializeStruct(Type type, BlockBuilder builder, Object object) { if (object == null) { requireNonNull(builder, "builder is null"); builder.appendNull(); return null; } boolean builderSynthesized = false; if (builder == null) { builderSynthesized = true; builder = type.createBlockBuilder(null, 1); } BlockBuilder currentBuilder = builder.beginBlockEntry(); List<Type> typeParameters = type.getTypeParameters(); for (int i = 0; i < typeParameters.size(); i++) { Optional<String> fieldName = type.getTypeSignature().getParameters().get(i).getNamedTypeSignature().getName(); String name = ""; if (fieldName.isPresent()) { name = fieldName.get().toLowerCase(ENGLISH); } Object value = ((Map) object).get(name); serializeObject(typeParameters.get(i), currentBuilder, value); } builder.closeEntry(); if (builderSynthesized) { return (Block) type.getObject(builder, 0); } return null; }