auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void keyVaultWithVirtualMachineMSI() { final VirtualMachine vm = AZURE.virtualMachines().getByResourceGroup(SPRING_RESOURCE_GROUP, VM_NAME); final String host = vm.getPrimaryPublicIPAddress().ipAddress(); final List<String> commands = new ArrayList<>(); commands.add(String.format("cd /home/%s", VM_USER_USERNAME)); commands.add("apt-get install maven -y"); <START> commands.add("apt-get install git"); <END> commands.add("mkdir azure-sdk-for-java"); commands.add("cd azure-sdk-for-java"); commands.add("git init"); commands.add("git remote add origin <LINK_0>"); commands.add("git config core.sparsecheckout true"); commands.add("echo sdk/spring > .git/info/sparse-checkout"); commands.add("git pull origin master"); commands.add("cd sdk/spring/"); commands.add("mvn package -Dmaven.test.skip=true"); commands.add("cd azure-spring-boot-test-application/target/"); commands.add(String.format("nohup java -jar -Xdebug " + "-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n " + "-Dazure.keyvault.uri=%s %s &" + " >/log.txt 2>&1", AZURE_KEYVAULT_URI, "app.jar")); vm.runCommand(new RunCommandInput().withCommandId("RunShellScript").withScript(commands)); final ResponseEntity<String> response = curlWithRetry( String.format("http://%s:8080/get", host), 3, 60_000, String.class); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(KEY_VAULT_SECRET_VALUE, response.getBody()); LOGGER.info("key vault value is: {}", response.getBody()); LOGGER.info("--------------------->test virtual machine with MSI over"); }</code><technical_language>Please install java maven in this file: <LINK_1></technical_language>

Target:
public void keyVaultWithVirtualMachineMSI() { final VirtualMachine vm = AZURE.virtualMachines().getByResourceGroup(SPRING_RESOURCE_GROUP, VM_NAME); final String host = vm.getPrimaryPublicIPAddress().ipAddress(); final List<String> commands = new ArrayList<>(); commands.add(String.format("cd /home/%s", VM_USER_USERNAME)); commands.add("mkdir azure-sdk-for-java"); commands.add("cd azure-sdk-for-java"); commands.add("git init"); commands.add("git remote add origin <LINK_0>"); commands.add("git config core.sparsecheckout true"); commands.add("echo sdk/spring > .git/info/sparse-checkout"); commands.add("git pull origin master"); commands.add("cd sdk/spring/"); commands.add("mvn package -Dmaven.test.skip=true"); commands.add("cd azure-spring-boot-test-application/target/"); commands.add(String.format("nohup java -jar -Xdebug " + "-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n " + "-Dazure.keyvault.uri=%s %s &" + " >/log.txt 2>&1", AZURE_KEYVAULT_URI, "app.jar")); vm.runCommand(new RunCommandInput().withCommandId("RunShellScript").withScript(commands)); final ResponseEntity<String> response = curlWithRetry( String.format("http://%s:8080/get", host), 3, 60_000, String.class); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(KEY_VAULT_SECRET_VALUE, response.getBody()); LOGGER.info("key vault value is: {}", response.getBody()); LOGGER.info("--------------------->test virtual machine with MSI over"); }
Source:
<code>public Drawable getDrawableIconForPackage(ComponentName componentName, UserHandle userHandle) { if (iconsPackPackageName.equalsIgnoreCase("default") <START> || iconsPackPackageName.equalsIgnoreCase("squircle") || iconsPackPackageName.equalsIgnoreCase("square") || iconsPackPackageName.equalsIgnoreCase("circle")) { <END> return this.getDefaultAppDrawable(componentName, userHandle); } String drawable = packagesDrawables.get(componentName.toString()); if (drawable != null) { int id = iconPackres.getIdentifier(drawable, "drawable", iconsPackPackageName); if (id > 0) { try { return iconPackres.getDrawable(id); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } } Drawable systemIcon = cacheGetDrawable(componentName.toString()); if (systemIcon != null) return systemIcon; systemIcon = this.getDefaultAppDrawable(componentName, userHandle); if (systemIcon instanceof BitmapDrawable) { Drawable generated = generateBitmap(systemIcon); cacheStoreDrawable(componentName.toString(), generated); return generated; } return systemIcon; }</code><technical_language>a method</technical_language>

Target:
public Drawable getDrawableIconForPackage(ComponentName componentName, UserHandle userHandle) { if (iconsPackPackageName.equalsIgnoreCase("default") || DrawableUtils.isIconsPackAdaptive(iconsPackPackageName)) { return this.getDefaultAppDrawable(componentName, userHandle); } String drawable = packagesDrawables.get(componentName.toString()); if (drawable != null) { int id = iconPackres.getIdentifier(drawable, "drawable", iconsPackPackageName); if (id > 0) { try { return iconPackres.getDrawable(id); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } } Drawable systemIcon = cacheGetDrawable(componentName.toString()); if (systemIcon != null) return systemIcon; systemIcon = this.getDefaultAppDrawable(componentName, userHandle); if (systemIcon instanceof BitmapDrawable) { Drawable generated = generateBitmap(systemIcon); cacheStoreDrawable(componentName.toString(), generated); return generated; } return systemIcon; }
Source:
<code>public final void handlerRemoved(ChannelHandlerContext ctx) throws Exception { if (decodeState == STATE_CALLING_CHILD_DECODE) { decodeState = STATE_HANDLER_REMOVED_PENDING; return; } ByteBuf buf = cumulation; if (buf != null) { cumulation = null; int readable = buf.readableBytes(); if (readable > 0) { ctx.fireChannelRead(buf); ctx.fireChannelReadComplete(); } else { buf.release(); } } handlerRemoved0(ctx); <START> decodeState = STATE_REMOVED; <END> }</code><technical_language>I this set in a finally block</technical_language>

Target:
public final void handlerRemoved(ChannelHandlerContext ctx) throws Exception { if (decodeState == STATE_CALLING_CHILD_DECODE) { decodeState = STATE_HANDLER_REMOVED_PENDING; return; } try { ByteBuf buf = cumulation; if (buf != null) { cumulation = null; int readable = buf.readableBytes(); if (readable > 0) { ctx.fireChannelRead(buf); ctx.fireChannelReadComplete(); } else { buf.release(); } } handlerRemoved0(ctx); } finally { decodeState = STATE_REMOVED; } }
Source:
<code>public AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { String id = element.getAttribute(ID_ATTRIBUTE); Assert.hasText(id, "The id attribute must be specified"); String messageTemplate = element.getAttribute(MESSAGE_TEMPLATE_ATTRIBUTE); Assert.hasText(messageTemplate, "The message-template attribute must be specified"); String step = element.getAttribute(STEP_ATTRIBUTE); Assert.hasText(id, "The step attribute must be specified"); String replyChannel = element.getAttribute(REPLY_CHANNEL_ATTRIBUTE); Assert.hasText(replyChannel, "The replyChannel attribute must be specified"); BeanDefinitionRegistry beanDefinitionRegistry = parserContext.getRegistry(); BeanDefinition chunkMessageChannelItemWriter = BeanDefinitionBuilder .genericBeanDefinition(ChunkMessageChannelItemWriter.class) .addPropertyReference(MESSAGING_OPERATIONS_PROPERTY, messageTemplate) .addPropertyReference(REPLY_CHANNEL_PROPERTY, replyChannel) .getBeanDefinition(); beanDefinitionRegistry.registerBeanDefinition(id, chunkMessageChannelItemWriter); BeanDefinition remoteChunkHandlerFactoryBean = BeanDefinitionBuilder .genericBeanDefinition(RemoteChunkHandlerFactoryBean.class) .addPropertyValue(CHUNK_WRITER_PROPERTY, chunkMessageChannelItemWriter) .addPropertyValue(STEP_PROPERTY, step) .getBeanDefinition(); <START> beanDefinitionRegistry.registerBeanDefinition(CHUNK_HANDLER_BEAN_NAME_PREFIX + step, remoteChunkHandlerFactoryBean); <END> return null; }</code><technical_language>Do need verify this bean registered (in case of multiple XML files)</technical_language>

Target:
public AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { String id = element.getAttribute(ID_ATTRIBUTE); Assert.hasText(id, "The id attribute must be specified"); String messageTemplate = element.getAttribute(MESSAGE_TEMPLATE_ATTRIBUTE); Assert.hasText(messageTemplate, "The message-template attribute must be specified"); String step = element.getAttribute(STEP_ATTRIBUTE); Assert.hasText(step, "The step attribute must be specified"); String replyChannel = element.getAttribute(REPLY_CHANNEL_ATTRIBUTE); Assert.hasText(replyChannel, "The reply-channel attribute must be specified"); BeanDefinitionRegistry beanDefinitionRegistry = parserContext.getRegistry(); BeanDefinition chunkMessageChannelItemWriter = BeanDefinitionBuilder .genericBeanDefinition(ChunkMessageChannelItemWriter.class) .addPropertyReference(MESSAGING_OPERATIONS_PROPERTY, messageTemplate) .addPropertyReference(REPLY_CHANNEL_PROPERTY, replyChannel) .getBeanDefinition(); beanDefinitionRegistry.registerBeanDefinition(id, chunkMessageChannelItemWriter); BeanDefinition remoteChunkHandlerFactoryBean = BeanDefinitionBuilder .genericBeanDefinition(RemoteChunkHandlerFactoryBean.class) .addPropertyValue(CHUNK_WRITER_PROPERTY, chunkMessageChannelItemWriter) .addPropertyValue(STEP_PROPERTY, step) .getBeanDefinition(); beanDefinitionRegistry.registerBeanDefinition(CHUNK_HANDLER_BEAN_NAME_PREFIX + step, remoteChunkHandlerFactoryBean); return null; }
Source:
<code>private void testContentAndLogin() throws Exception { <START> ______TS("content: no courses, 'welcome stranger' message"); <END> String unregUserId = TestProperties.TEST_UNREG_ACCOUNT; String unregPassword = TestProperties.TEST_UNREG_PASSWORD; BackDoor.deleteStudent(unregUserId); logout(); studentHome = getHomePageNew().clickStudentLogin().loginAsStudent(unregUserId, unregPassword); browser.waitForPageLoad(); assertTrue(studentHome.verifyStrangerMessage()); ______TS("login successfully"); logout(); studentHome = getHomePageNew().clickStudentLogin() .loginAsStudent(TestProperties.TEST_STUDENT1_ACCOUNT, TestProperties.TEST_STUDENT1_PASSWORD); browser.waitForPageLoad(); assertTrue(studentHome.verifyFirstPanelFeedbackSessionName("[SHomeUiT.CS1101]: Programming Methodology")); ______TS("login successfully as admin (masquerade mode)"); AppUrl detailsPageUrl = createUrl(Const.WebPageURIs.STUDENT_HOME_PAGE) .withUserId(testData.students.get("SHomeUiT.charlie.d@SHomeUiT.CS2104").googleId); StudentHomePageNew studentHomePage = loginAdminToPageNew(detailsPageUrl, StudentHomePageNew.class); browser.waitForPageLoad(); assertTrue(studentHomePage.verifyAdminPagePresent()); }</code><technical_language>This removed. This is longer specific student home page. a dedicated E2E test test flows pages accessible navbar</technical_language>

Target:
private void testContentAndLogin() { ______TS("login successfully"); getHomePage().clickStudentLogin().loginAsStudent( TestProperties.TEST_STUDENT1_ACCOUNT, TestProperties.TEST_STUDENT1_PASSWORD); browser.waitForPageLoad(); List<String> courseIds = getAllVisibleCourseIds(); for (int i = 0; i < courseIds.size(); i++) { String courseId = courseIds.get(i); assertTrue(verifyVisibleCourseToStudents(courseId, i)); String feedbackSessionName = testData.feedbackSessions.entrySet().stream() .filter(feedbackSession -> courseId.equals(feedbackSession.getValue().getCourseId())) .map(x -> x.getValue().getFeedbackSessionName()) .collect(Collectors.joining()); assertTrue(verifyVisibleFeedbackSessionToStudents(feedbackSessionName, i)); } }
Source:
<code>public void start() { <START> Runnable cb = getReloadCallback(); <END> future = executor.scheduleWithFixedDelay(this, WAIT, WAIT, TimeUnit.MILLISECONDS); List<DynamicStringProperty> reloadList = getReloadSettings(); if (reloadList != null) { for(DynamicStringProperty reload : reloadList) { if (reload != null) { reload.addCallback(cb); } } } ProcessEngineUtils.HA_ENABLED.addCallback(cb); }</code><technical_language>Knowing runnables necessary here.. GenericServiceLauncher: ... Runnable cb = (new Runnable() { @Override public void run() { reload(); } }); ... public void reload() { processDestroy(); } CatalogLauncher: public void reload() { // special reload logic }</technical_language>

Target:
public void start() { Runnable cb = (new Runnable() { @Override public void run() { reload(); } }); future = executor.scheduleWithFixedDelay(this, WAIT, WAIT, TimeUnit.MILLISECONDS); List<DynamicStringProperty> reloadList = getReloadSettings(); if (reloadList != null) { for(DynamicStringProperty reload : reloadList) { if (reload != null) { reload.addCallback(cb); } } } ProcessEngineUtils.HA_ENABLED.addCallback(cb); }
Source:
<code>private ListenableFuture<Void> startAsyncUpload(Digest digest, Chunker chunker) { try { chunker.reset(); } catch (IOException e) { return Futures.immediateFailedFuture(e); } UUID uploadId = UUID.randomUUID(); <START> String resourceName = buildUploadResourceName(instanceName, uploadId, digest); <END> AsyncUpload newUpload = new AsyncUpload( channel, callCredentialsProvider, callTimeoutSecs, retrier, resourceName, chunker); ListenableFuture<Void> currUpload = newUpload.start(); currUpload.addListener( () -> { if (currUpload.isCancelled()) { newUpload.cancel(); } }, MoreExecutors.directExecutor()); return currUpload; }</code><technical_language>check digest.getSizeBytes() is chunker.getSize() beginning</technical_language>

Target:
private ListenableFuture<Void> startAsyncUpload(Digest digest, Chunker chunker) { try { chunker.reset(); } catch (IOException e) { return Futures.immediateFailedFuture(e); } if (chunker.getSize() != digest.getSizeBytes()) { return Futures.immediateFailedFuture( new IllegalStateException( String.format( "Expected chunker size of %d, got %d", digest.getSizeBytes(), chunker.getSize()))); } UUID uploadId = UUID.randomUUID(); String resourceName = buildUploadResourceName(instanceName, uploadId, digest); AsyncUpload newUpload = new AsyncUpload( channel, callCredentialsProvider, callTimeoutSecs, retrier, resourceName, chunker); ListenableFuture<Void> currUpload = newUpload.start(); currUpload.addListener( () -> { if (currUpload.isCancelled()) { newUpload.cancel(); } }, MoreExecutors.directExecutor()); return currUpload; }
Source:
<code>private Stream<Pair<String, Calendar>> createCalendar(String key, byte[] icsContent) { CalendarBuilder builder = new CalendarBuilder(); try { ByteArrayInputStream inputStream = new ByteArrayInputStream(icsContent); return Stream.of(Pair.of(key, builder.build(inputStream))); } catch (IOException e) { if (LOGGER.isErrorEnabled()) { <START> String icsContentAsString; <END> try { icsContentAsString = new String(icsContent, Charset.forName("UTF-8")); } catch (Throwable t) { LOGGER.error("Error while decoding ics content", t); icsContentAsString = new String(Hex.encodeHex(icsContent)); } LOGGER.error("Error while reading input: " + icsContentAsString, e); } return Stream.of(); } catch (ParserException e) { if (LOGGER.isErrorEnabled()) { String icsContentAsString; try { icsContentAsString = new String(icsContent, Charset.forName("UTF-8")); } catch (Throwable t) { LOGGER.error("Error while decoding ics content", t); icsContentAsString = new String(Hex.encodeHex(icsContent)); } LOGGER.error("Error while parsing ICal object: " + icsContentAsString, e); } return Stream.of(); } }</code><technical_language>Extract "icsContentAsString" in other method this more readable, please ;-)</technical_language>

Target:
private Stream<Pair<String, Calendar>> createCalendar(String key, byte[] icsContent) { CalendarBuilder builder = new CalendarBuilder(); try { ByteArrayInputStream inputStream = new ByteArrayInputStream(icsContent); return Stream.of(Pair.of(key, builder.build(inputStream))); } catch (IOException e) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Error while reading input: " + icsContentToString(icsContent), e); } return Stream.of(); } catch (ParserException e) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Error while parsing ICal object: " + icsContentToString(icsContent), e); } return Stream.of(); } }
Source:
<code>public static String parseOperationRequest(String commandLine, final CommandLineParser.CallbackHandler handler) throws CommandFormatException { <START> return parseOperationRequestLine(commandLine, handler).getSubstitued(); <END> }</code><technical_language>This NPE if commandLine == null</technical_language>

Target:
public static String parseOperationRequest(String commandLine, final CommandLineParser.CallbackHandler handler) throws CommandFormatException { SubstitutedLine sl = parseOperationRequestLine(commandLine, handler); return sl == null ? null : sl.getSubstitued(); }
Source:
<code>public void sweepNextBatch(ShardAndStrategy shardStrategy, long sweepTs) { metrics.updateSweepTimestamp(shardStrategy, sweepTs); long lastSweptTs = progress.getLastSweptTimestamp(shardStrategy); if (sweepTs <= lastSweptTs + 1) { <START> log.warn("Last swept timestamp for is greater than or equal to the sweep timestamp {}.", <END> lastSweptTs, shardStrategy.toText(), sweepTs); return; } log.info("Beginning iteration of targeted sweep for {}, and sweep timestamp {}. Last previously swept timestamp" + " for this shard and strategy was {}.", shardStrategy.toText(), sweepTs, lastSweptTs); SweepBatch sweepBatch = getNextBatchToSweep(shardStrategy, lastSweptTs, sweepTs); deleter.sweep(sweepBatch.writes(), Sweeper.of(shardStrategy)); log.info("Put ranged tombstones and swept up to timestamp for {}.", sweepBatch.writes().size(), sweepBatch.lastSweptTimestamp(), shardStrategy.toText()); cleaner.clean(shardStrategy, lastSweptTs, sweepBatch.lastSweptTimestamp()); metrics.updateNumberOfTombstones(shardStrategy, sweepBatch.writes().size()); metrics.updateProgressForShard(shardStrategy, sweepBatch.lastSweptTimestamp()); }</code><technical_language>Hmm, this match condition</technical_language>

Target:
public void sweepNextBatch(ShardAndStrategy shardStrategy, long sweepTs) { metrics.updateSweepTimestamp(shardStrategy, sweepTs); long lastSweptTs = progress.getLastSweptTimestamp(shardStrategy); if (lastSweptTs + 1 >= sweepTs) { log.warn("Last swept timestamp for is inconsistent with the sweep timestamp {}, since there can be " + "no timestamps between the two values.", SafeArg.of("lastSweptTs", lastSweptTs), SafeArg.of("shardStrategy", shardStrategy.toText()), SafeArg.of("sweepTs", sweepTs)); return; } log.info("Beginning iteration of targeted sweep for {}, and sweep timestamp {}. Last previously swept timestamp" + " for this shard and strategy was {}.", SafeArg.of("shardStrategy", shardStrategy.toText()), SafeArg.of("sweepTs", sweepTs), SafeArg.of("lastSweptTs", lastSweptTs)); SweepBatch sweepBatch = getNextBatchToSweep(shardStrategy, lastSweptTs, sweepTs); deleter.sweep(sweepBatch.writes(), Sweeper.of(shardStrategy)); log.info("Put ranged tombstones and swept up to timestamp for {}.", SafeArg.of("tombstones", sweepBatch.writes().size()), SafeArg.of("lastSweptTs", sweepBatch.lastSweptTimestamp()), SafeArg.of("shardStrategy", shardStrategy.toText())); cleaner.clean(shardStrategy, lastSweptTs, sweepBatch.lastSweptTimestamp()); metrics.updateNumberOfTombstones(shardStrategy, sweepBatch.writes().size()); metrics.updateProgressForShard(shardStrategy, sweepBatch.lastSweptTimestamp()); }
Source:
<code>private void addItemCollectionOnTarget( Collection<T> items, T target, String targetItemNotFoundErrorMessage, SerializableBiFunction<Integer, Boolean, Integer> insertItemsIndexProvider) { Objects.requireNonNull(items, NULL_COLLECTION_ERROR_MESSAGE); if (items.isEmpty()) { return; } final ListDataProvider<T> dataProvider = getDataProvider(); if (!contains(target, dataProvider)) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } final Collection<T> backendItems = dataProvider.getItems(); if (backendItems instanceof List) { final List<T> itemList = (List<T>) backendItems; final AtomicBoolean containsTargetItem = new AtomicBoolean(false); items.forEach(item -> { if (equals(item, target, dataProvider)) { containsTargetItem.set(true); } else { removeItemIfPresent(item, dataProvider); } }); int targetItemIndex = getItemIndex(target, dataProvider::getId); if (containsTargetItem.get()) { itemList.remove(targetItemIndex); } final int indexToInsertItems = insertItemsIndexProvider.apply( targetItemIndex, containsTargetItem.get()); itemList.addAll(indexToInsertItems, items); dataProvider.refreshAll(); } else { throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, <START> backendItems.getClass().getSimpleName())); <END> } }</code><technical_language>commonly do, this exception thrown in beginning of method in a "if instance of list" check. remove need for this if-else on. I thrown null check, contains</technical_language>

Target:
private void addItemCollectionOnTarget( Collection<T> items, T target, String targetItemNotFoundErrorMessage, SerializableBiFunction<Integer, Boolean, Integer> insertItemsIndexProvider) { Objects.requireNonNull(items, NULL_COLLECTION_ERROR_MESSAGE); if (items.isEmpty()) { return; } final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); if (!(backendItems instanceof List)) { throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); } if (!contains(target, dataProvider)) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } final List<T> itemList = (List<T>) backendItems; final AtomicBoolean containsTargetItem = new AtomicBoolean(false); items.forEach(item -> { if (equals(item, target, dataProvider)) { containsTargetItem.set(true); } else { removeItemIfPresent(item, dataProvider); } }); int targetItemIndex = getItemIndex(target, dataProvider::getId); if (containsTargetItem.get()) { itemList.remove(targetItemIndex); } final int indexToInsertItems = insertItemsIndexProvider.apply( targetItemIndex, containsTargetItem.get()); itemList.addAll(indexToInsertItems, items); dataProvider.refreshAll(); }
Source:
<code>@Override public int size() { int sz = 0; Iterator<ScanQueryView> iter = new QueryDataIterator(); <START> while(iter.hasNext()) sz++; <END> return sz; }</code><technical_language>Variable {{iter}} is updated insude loop(do call next())</technical_language>

Target:
@Override public int size() { int sz = 0; QueryDataIterator iter = new QueryDataIterator(); while (iter.hasNext()) sz++; return sz; }
Source:
<code>private Intent createCourseOutlineIntent(Activity activity, EnrolledCoursesResponse model, String courseComponentId, String lastAccessedId, boolean isVideosMode) { Bundle courseBundle = new Bundle(); courseBundle.putSerializable(EXTRA_COURSE_DATA, model); courseBundle.putString(EXTRA_COURSE_COMPONENT_ID, courseComponentId); <START> final Intent courseDetail; <END> { if (config.isTabsDashboardEnabled()) { courseDetail = new Intent(activity, NewCourseOutlineActivity.class); } else { courseDetail = new Intent(activity, CourseOutlineActivity.class); } } courseDetail.putExtra(EXTRA_BUNDLE, courseBundle); courseDetail.putExtra(EXTRA_LAST_ACCESSED_ID, lastAccessedId); courseDetail.putExtra(EXTRA_IS_VIDEOS_MODE, isVideosMode); return courseDetail; }</code><technical_language>Good time rename this variable, courseDetail is confusing, simple intent sense here</technical_language>

Target:
private Intent createCourseOutlineIntent(Activity activity, EnrolledCoursesResponse model, String courseComponentId, String lastAccessedId, boolean isVideosMode) { Bundle courseBundle = new Bundle(); courseBundle.putSerializable(EXTRA_COURSE_DATA, model); courseBundle.putString(EXTRA_COURSE_COMPONENT_ID, courseComponentId); final Intent intent; { if (config.isTabsDashboardEnabled()) { intent = new Intent(activity, NewCourseOutlineActivity.class); } else { intent = new Intent(activity, CourseOutlineActivity.class); } } intent.putExtra(EXTRA_BUNDLE, courseBundle); intent.putExtra(EXTRA_LAST_ACCESSED_ID, lastAccessedId); intent.putExtra(EXTRA_IS_VIDEOS_MODE, isVideosMode); return intent; }
Source:
<code>public List<Map<String, WebElement>> getRowsMappedToHeadings(List<String> headings) { List<List<WebElement>> rows = getRows(); return rows.stream() <START> .map(row -> row.stream().collect(toMap(e -> headings.get(row.indexOf(e)), e -> e))) <END> .collect(toList()); }</code><technical_language>instead of e -> e is a Functions.identity()</technical_language>

Target:
public List<Map<String, WebElement>> getRowsMappedToHeadings(List<String> headings) { List<List<WebElement>> rows = getRows(); return rows.stream() .map(row -> row.stream() .collect(toMap(e -> headings.get(row.indexOf(e)), identity()))) .collect(toList()); }
Source:
<code>public int getItemCount() { <START> int SHIMMER_ITEM_NUMBER = 10; <END> return showShimmer ? SHIMMER_ITEM_NUMBER : recentFiles.size(); }</code><technical_language>if screen is big enough more 10 items visible once</technical_language>

Target:
public int getItemCount() { if (showShimmer) { return Constants.SHIMMER_ITEM_NUMBER; } else { return recentFiles.size(); } }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) <END> return true; if (o == null || getClass() != o.getClass()) return false; ArtifactCoordinates that = (ArtifactCoordinates) o; if (!getArtifactId().equals(that.getArtifactId())) return false; if (!getGroupId().equals(that.getGroupId())) return false; return getVersion().equals(that.getVersion()); }</code><technical_language>please {}</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ArtifactCoordinates that = (ArtifactCoordinates) o; if (!getArtifactId().equals(that.getArtifactId())) { return false; } if (!getGroupId().equals(that.getGroupId())) { return false; } return getVersion().equals(that.getVersion()); }
Source:
<code>void gatherInformation(MajorCompactionRequest request) { gatherCalled = true; Collection<SummarizerConfiguration> configs = SummarizerConfiguration.fromTableProperties(request.getTableProperties()); if (configs.size() == 0) { summaryConfigured = false; } else { Set<SummarizerConfiguration> configsSet = configs instanceof Set ? (Set<SummarizerConfiguration>) configs : new HashSet<>(configs); for (FileRef fref : request.getFiles().keySet()) { Map<SummarizerConfiguration,Summary> sMap = new HashMap<>(); Collection<Summary> summaries; try { summaries = request.getSummaries(Collections.singletonList(fref), conf -> configsSet.contains(conf)); } catch (IOException e) { throw new UncheckedIOException(e); } for (Summary summary : summaries) { sMap.put(summary.getSummarizerConfiguration(), summary); } boolean needsCompaction = false; for (SummarizerConfiguration sc : configs) { Summary summary = sMap.get(sc); if (summary == null && selectNoSummary) { needsCompaction = true; break; } if (summary != null && summary.getFileStatistics().getExtra() > 0 && selectExtraSummary) { needsCompaction = true; break; } } if (!needsCompaction) { <START> okFiles.add(fref); <END> } } } }</code><technical_language>okFiles is set (to Collections.emptyMap()). Map returned method immutable</technical_language>

Target:
void gatherInformation(MajorCompactionRequest request) { gatherCalled = true; Collection<SummarizerConfiguration> configs = SummarizerConfiguration.fromTableProperties(request.getTableProperties()); if (configs.size() == 0) { summaryConfigured = false; } else { Set<SummarizerConfiguration> configsSet = configs instanceof Set ? (Set<SummarizerConfiguration>) configs : new HashSet<>(configs); okFiles = new HashSet<>(); for (FileRef fref : request.getFiles().keySet()) { Map<SummarizerConfiguration,Summary> sMap = new HashMap<>(); Collection<Summary> summaries; try { summaries = request.getSummaries(Collections.singletonList(fref), conf -> configsSet.contains(conf)); } catch (IOException e) { throw new UncheckedIOException(e); } for (Summary summary : summaries) { sMap.put(summary.getSummarizerConfiguration(), summary); } boolean needsCompaction = false; for (SummarizerConfiguration sc : configs) { Summary summary = sMap.get(sc); if (summary == null && selectNoSummary) { needsCompaction = true; break; } if (summary != null && summary.getFileStatistics().getExtra() > 0 && selectExtraSummary) { needsCompaction = true; break; } } if (!needsCompaction) { okFiles.add(fref); } } } }
Source:
<code>public boolean check(final AuthenticationInfo authenticationInfo) { <START> if (authenticationInfo == null || Strings.isNullOrEmpty(authenticationInfo.getUsername()) || Strings.isNullOrEmpty(authenticationInfo.getPassword())) { <END> return false; } AuthConfiguration userAuthConfiguration = env.getUserAuthConfiguration(); return userAuthConfiguration.getAuthUsername().equals(authenticationInfo.getUsername()) && userAuthConfiguration.getAuthPassword().equals(authenticationInfo.getPassword()); }</code><technical_language>constants left variable right in = equals conditional expressions</technical_language>

Target:
public boolean check(final AuthenticationInfo authenticationInfo) { if (null == authenticationInfo || Strings.isNullOrEmpty(authenticationInfo.getUsername()) || Strings.isNullOrEmpty(authenticationInfo.getPassword())) { return false; } AuthConfiguration userAuthConfiguration = env.getUserAuthConfiguration(); return userAuthConfiguration.getAuthUsername().equals(authenticationInfo.getUsername()) && userAuthConfiguration.getAuthPassword().equals(authenticationInfo.getPassword()); }
Source:
<code>public void testCSVImportWrongOrder() throws Exception { String[] csv = {"id,relationship.type,relation.isAuthorOfPublication,collection,dc.identifier.other", "+,Publication,dc.identifier.other:8675309," + col1.getHandle() + ",2", <START> "+,Person,," + col1.getHandle() + ",1",}; <END> assertEquals(1, performImportScript(csv, false)); }</code><technical_language>this 8675309 in dc.identifier.other column</technical_language>

Target:
public void testCSVImportWrongOrder() throws Exception { String[] csv = {"id,relationship.type,relation.isAuthorOfPublication,collection,dc.identifier.other", "+,Publication,dc.identifier.other:8675309," + col1.getHandle() + ",2", "+,Person,," + col1.getHandle() + ",8675309",}; assertEquals(1, performImportScript(csv, false)); }
Source:
<code>public static ApplicationIndexHomePage gotoPage() { <START> ApplicationHomePage.gotoPage("Applications"); <END> return new ApplicationIndexHomePage(); }</code><technical_language>depend AWM for this. application index is AWM app. getUtil().gotoPage()</technical_language>

Target:
public static ApplicationIndexHomePage gotoPage() { getUtil().gotoPage("Applications", "WebHome"); return new ApplicationIndexHomePage(); }
Source:
<code>private AuthenticationProvider getAuthenticationProvider(OAuth2Authentication oauth2User) { <START> return AuthenticationProvider.GITHUB; <END> }</code><technical_language>Get AuthenticationProvider issuer in token</technical_language>

Target:
private String getAuthenticationProvider(OAuth2Authentication oauth2User) { return AuthenticationProvider.GITHUB.name(); }
Source:
<code>private Object processFlexNegotiation(Channel channel, ByteBuf buf) { if ((byte) buf.readUnsignedByte() != (byte) 0xB0) { return null; } <START> byte flexProtocolVersion, flexStructVersion; <END> flexProtocolVersion = (byte) buf.readUnsignedByte(); flexStructVersion = (byte) buf.readUnsignedByte(); if ((flexProtocolVersion == (byte) 0x0A || flexProtocolVersion == (byte) 0x14) && (flexStructVersion == (byte) 0x0A || flexStructVersion == (byte) 0x14)) { flexBitfieldDataSize = buf.readUnsignedByte(); if (flexBitfieldDataSize > 122) { return null; } buf.readBytes(flexBitfield, 0, (int) Math.ceil((double) flexBitfieldDataSize / 8)); flexDataSize = 0; for (int i = 0; i < flexBitfieldDataSize; i++) { if (checkFlexBitfield(i)) { flexDataSize += FLEX_FIELDS_SIZES[i]; } } } else { flexProtocolVersion = 0x14; flexStructVersion = 0x14; } ByteBuf response = Unpooled.buffer(9); response.writeCharSequence("*<FLEX", StandardCharsets.US_ASCII); response.writeByte(0xB0); response.writeByte(flexProtocolVersion); response.writeByte(flexStructVersion); sendNtcbReply(channel, response); return null; }</code><technical_language>Completely unnecessary separated declaration</technical_language>

Target:
private Object processFlexNegotiation(Channel channel, ByteBuf buf) { if ((byte) buf.readUnsignedByte() != (byte) 0xB0) { return null; } short flexProtocolVersion = buf.readUnsignedByte(); short flexStructVersion = buf.readUnsignedByte(); if ((flexProtocolVersion == 0x0A || flexProtocolVersion == 0x14) && (flexStructVersion == 0x0A || flexStructVersion == 0x14)) { flexBitfieldDataSize = buf.readUnsignedByte(); if (flexBitfieldDataSize > 122) { return null; } buf.readBytes(flexBitfield, 0, (int) Math.ceil((double) flexBitfieldDataSize / 8)); flexDataSize = 0; for (int i = 0; i < flexBitfieldDataSize; i++) { if (checkFlexBitfield(i)) { flexDataSize += FLEX_FIELDS_SIZES[i]; } } } else { flexProtocolVersion = 0x14; flexStructVersion = 0x14; } ByteBuf response = Unpooled.buffer(9); response.writeCharSequence("*<FLEX", StandardCharsets.US_ASCII); response.writeByte(0xB0); response.writeByte(flexProtocolVersion); response.writeByte(flexStructVersion); sendNtcbReply(channel, response); return null; }
Source:
<code>public boolean performNextOperation(int completedChildCount) { restoreCommandState(); switch (getParameters().getVmBackup().getPhase()) { case STARTING: <START> if (runVmBackup()) { updateVmBackupPhase(VmBackupPhase.READY); } else { setCommandStatus(CommandStatus.FAILED); } <END> log.info("Ready to start image transfers using backup URLs"); break; case READY: return true; case FINALIZING: finalizeVmBackup(); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommandIfNeeded(); return true; }</code><technical_language>IMHO inserted "runVmBackup()". "setCommandStatus(CommandStatus.FAILED);" instead of "return false;". "updateVmBackupPhase(VmBackupPhase.READY);" instead of "return true;"</technical_language>

Target:
public boolean performNextOperation(int completedChildCount) { restoreCommandState(); switch (getParameters().getVmBackup().getPhase()) { case STARTING: if (runVmBackup()) { updateVmBackupPhase(VmBackupPhase.READY); log.info("Ready to start image transfers using backup URLs"); } else { setCommandStatus(CommandStatus.FAILED); } break; case READY: return true; case FINALIZING: finalizeVmBackup(); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommandIfNeeded(); return true; }
Source:
<code>public static <T> Call<T> response(final Response<T> response) { return new Call<T>() { @Override public Response<T> execute() throws IOException { return response; } @Override public void enqueue(Callback<T> callback) { callback.onResponse(response); } @Override public void cancel() { } @SuppressWarnings("CloneDoesntCallSuperClone") @Override public Call<T> clone() { <START> return response(response); <END> } }; }</code><technical_language>return this</technical_language>

Target:
public static <T> Call<T> response(final Response<T> response) { return new Call<T>() { @Override public Response<T> execute() throws IOException { return response; } @Override public void enqueue(Callback<T> callback) { callback.onResponse(response); } @Override public void cancel() { } @SuppressWarnings("CloneDoesntCallSuperClone") @Override public Call<T> clone() { return this; } }; }
Source:
<code>public Optional<FieldSortExpectations<Float>> getFieldSortExpectations() { return Optional.of( new FieldSortExpectations<>( 1.01f, 3.2f, 5.1f, <START> Float.MIN_VALUE, 2.0f, 4.00001f, Float.MAX_VALUE <END> ) ); }</code><technical_language>for doubles, -Float.MAX_VALUE instead of Float.MIN_VALUE</technical_language>

Target:
public Optional<FieldSortExpectations<Float>> getFieldSortExpectations() { return Optional.of( new FieldSortExpectations<>( 1.01f, 3.2f, 5.1f, -Float.MIN_VALUE, 2.0f, 4.00001f, Float.MAX_VALUE ) ); }
Source:
<code>private boolean validateLocation(String location) { if(StringUtils.isBlank(location)) { return true; } File file = new File(location); if(!ocBinary.getName().equals(file.getName())) { cliLocationEditor.setErrorMessage(NLS.bind("{0} is not the OpenShift Client ''{1}'' executable.", file.getName(), ocBinary.getName())); return false; } if(!file.exists()) { cliLocationEditor.setErrorMessage(NLS.bind("{0} was not found.", file)); return false; } if(!file.canExecute()) { cliLocationEditor.setErrorMessage(NLS.bind("{0} does not have execute permissions.", file)); return false; } if (!new OCBinaryValidator(location).isCompatibleForPublishing()) { <START> setMessage("Your Openshift 3 client executable is pre-1.1.1 and may cause rsync problems", WARNING); <END> } return true; }</code><technical_language>afaics if is pre-1.1.1 match hit post-1.1.1. Suggest warning like: "OpenShift client is 1.1.1 rsync problems if is pre-1.1.1"</technical_language>

Target:
private boolean validateLocation(String location) { if(StringUtils.isBlank(location)) { return true; } File file = new File(location); if(!ocBinary.getName().equals(file.getName())) { cliLocationEditor.setErrorMessage(NLS.bind("{0} is not the OpenShift Client ''{1}'' executable.", file.getName(), ocBinary.getName())); return false; } if(!file.exists()) { cliLocationEditor.setErrorMessage(NLS.bind("{0} was not found.", file)); return false; } if(!file.canExecute()) { cliLocationEditor.setErrorMessage(NLS.bind("{0} does not have execute permissions.", file)); return false; } setValid(false); ocVersionLabel.setText("Checking version"); Job job = new UIUpdatingJob("Checking oc binary") { private Version version; @Override protected IStatus run(IProgressMonitor monitor) { version = new OCBinaryValidator(location).getVersion(monitor); return Status.OK_STATUS; } @Override protected IStatus updateUI(IProgressMonitor monitor) { if (!ocMessageComposite.isDisposed() && !monitor.isCanceled()) { setValid(true); ocVersionLabel.setText(NLS.bind("Your client version is {0}.{1}.{2}", new Object[] {version.getMajor(), version.getMinor(), version.getMicro()})); ocMessageLabel.setText(NLS.bind("OpenShift client version 1.1.1 or higher is required to avoid rsync issues.", version)); ocMessageComposite.setVisible(!OCBinaryValidator.isCompatibleForPublishing(version)); } return super.updateUI(monitor); } }; job.schedule(); return true; }
Source:
<code>public void testCreate() throws IOException, StripeException { final Account account = Account.retrieve(ACCOUNT_ID, null); <START> PersonCollection personsTmp = getPersonCollectionFixture(account); <END> final Map<String, Object> params = new HashMap<String, Object>(); params.put("first_name", "John"); final Person person = account.persons().create(params); assertNotNull(person); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/accounts/%s/persons", account.getId()), params ); }</code><technical_language>move call Account.retrieve() getPersonCollectionFixture() remove argument</technical_language>

Target:
public void testCreate() throws IOException, StripeException { final Account account = Account.retrieve(ACCOUNT_ID, null); final PersonCollection personsTmp = getPersonCollectionFixture(account); final Map<String, Object> params = new HashMap<String, Object>(); params.put("first_name", "John"); final Person person = account.persons().create(params); assertNotNull(person); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/accounts/%s/persons", account.getId()), params ); }
Source:
<code>public boolean next(List<Cell> list) throws IOException{ if (failure.get() != null) { timer.cancel(); throw failure.get(); } Entry entry; try { entry = queue.take(); final boolean more = entry.more; List<TxnView> txns = waitFor(entry.txns); compactionState.mutate(entry.cells, txns, list, purgeDeletedRows); if (!more) { timer.cancel(); <START> if (context != null) <END> context.close(); } return more; } catch (Exception e) { timer.cancel(); throw new IOException(e); } }</code><technical_language>guards needed</technical_language>

Target:
public boolean next(List<Cell> list) throws IOException{ if (failure.get() != null) { timer.cancel(); throw failure.get(); } Entry entry; try { entry = queue.take(); final boolean more = entry.more; List<TxnView> txns = waitFor(entry.txns); compactionState.mutate(entry.cells, txns, list, purgeDeletedRows); if (!more) { timer.cancel(); context.close(); } return more; } catch (Exception e) { timer.cancel(); throw new IOException(e); } }
Source:
<code>private CoordinatorStats doRun( Map<String, CoordinatorCompactionConfig> compactionConfigs, int numAvailableCompactionTaskSlots, CompactionSegmentIterator iterator ) { int numSubmittedCompactionTasks = 0; while (iterator.hasNext() && numSubmittedCompactionTasks < numAvailableCompactionTaskSlots) { final List<DataSegment> segmentsToCompact = iterator.next(); final String dataSourceName = segmentsToCompact.get(0).getDataSource(); if (segmentsToCompact.size() > 1) { final CoordinatorCompactionConfig config = compactionConfigs.get(dataSourceName); final String taskId = indexingServiceClient.compactSegments( segmentsToCompact, config.getTaskPriority(), config.getTuningConfig(), config.getTaskContext() ); LOG.info("Submit a compactTask[%s] for segments[%s]", taskId, segmentsToCompact); if (++numSubmittedCompactionTasks == numAvailableCompactionTaskSlots) { <START> break; <END> } } else if (segmentsToCompact.size() == 1) { throw new ISE("Found one segments[%s] to compact", segmentsToCompact); } else { throw new ISE("Failed to find segments for dataSource[%s]", dataSourceName); } } return makeStats(numSubmittedCompactionTasks, iterator); }</code><technical_language>do check/break , is covered in while clause condition</technical_language>

Target:
private CoordinatorStats doRun( Map<String, CoordinatorCompactionConfig> compactionConfigs, int numAvailableCompactionTaskSlots, CompactionSegmentIterator iterator ) { int numSubmittedTasks = 0; for (; iterator.hasNext() && numSubmittedTasks < numAvailableCompactionTaskSlots; numSubmittedTasks++) { final List<DataSegment> segmentsToCompact = iterator.next(); final String dataSourceName = segmentsToCompact.get(0).getDataSource(); if (segmentsToCompact.size() > 1) { final CoordinatorCompactionConfig config = compactionConfigs.get(dataSourceName); final String taskId = indexingServiceClient.compactSegments( segmentsToCompact, config.getTaskPriority(), config.getTuningConfig(), config.getTaskContext() ); LOG.info("Submitted a compactTask[%s] for segments[%s]", taskId, segmentsToCompact); } else if (segmentsToCompact.size() == 1) { throw new ISE("Found one segments[%s] to compact", segmentsToCompact); } else { throw new ISE("Failed to find segments for dataSource[%s]", dataSourceName); } } return makeStats(numSubmittedTasks, iterator); }
Source:
<code>public static boolean sourceLikeCram(final SeekableStream strm) { String source = strm.getSource(); if (source == null) { return false; } source = source.toLowerCase(); <START> return source.endsWith(".cram") || source.contains(".cram?") || source.contains(".cram&") || source.contains(".cram%26"); <END> }</code><technical_language>Consider built-in parsing in URL/URI classes</technical_language>

Target:
public static boolean sourceLikeCram(final SeekableStream strm) { String source = strm.getSource(); if (source == null) { return false; } try { final URL sourceURL = new URL(source); final String urlPath = sourceURL.getPath().toLowerCase(); String queryParams = sourceURL.getQuery(); if (queryParams != null) { queryParams = queryParams.toLowerCase(); } return urlPath.endsWith(".cram") || (queryParams != null && (queryParams.endsWith(".cram") || queryParams.contains(".cram?") || queryParams.contains(".cram&") || queryParams.contains(".cram%26")) ); } catch (MalformedURLException e) { source = source.toLowerCase(); return source.endsWith(".cram") || source.contains(".cram?") || source.contains(".cram&") || source.contains(".cram%26"); } }
Source:
<code>public void triggerMatrixBuildsRemotely() { MatrixProject job = jenkins.jobs.create(MatrixProject.class); job.configure(); job.addParameter(StringParameter.class).setName("ID").setDefault("0"); job.runSequentially.check(); jenkins.control("/pseudoRemoteTrigger").click(); jenkins.control("/pseudoRemoteTrigger/authToken").fillIn("authToken", "TOKEN"); job.addUserAxis("X", "1 2 3"); job.addShellStep("#!/bin/bash\n" + "echo Job request ${ID}\n"); job.save(); FreeStyleJob job2 = jenkins.jobs.create(FreeStyleJob.class); job2.addBuildStep(ShellBuildStep.class); String s = "#!/bin/bash -x\n" + "for i in {1.." + NO_BUILDS + "}\n" + "do\n" + "\tcurl " + job.url.toString() + "buildWithParameters?token=TOKEN\\&ID=$i\n" + "done"; jenkins.control("/builder/command").setAtOnce(s); job2.save(); job2.startBuild().waitUntilFinished(); jenkins.visit("view/All/builds"); List<WebElement> list = all(by.href("/job/" + job.name + "/")); <START> assertThat("All triggered builds have not been run or put in build queue.", list.size() == NO_BUILDS); <END> }</code><technical_language>BuildHistory needs some changes logic belongs there</technical_language>

Target:
public void triggerMatrixBuildsRemotely() { GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins); sc.open(); sc.useRealm(ServletSecurityRealm.class); sc.save(); MatrixProject job = jenkins.jobs.create(MatrixProject.class); job.configure(); job.addParameter(StringParameter.class).setName("ID").setDefault("0"); job.runSequentially.check(); jenkins.control("/pseudoRemoteTrigger").click(); jenkins.control("/pseudoRemoteTrigger/authToken").fillIn("authToken", "TOKEN"); job.addUserAxis("X", "1 2 3"); job.addShellStep("#!/bin/bash\n" + "echo Job request ${ID}\n"); job.save(); FreeStyleJob job2 = jenkins.jobs.create(FreeStyleJob.class); job2.addBuildStep(ShellBuildStep.class); String s = "#!/bin/bash -x\n" + "for i in {1.." + NO_BUILDS + "}\n" + "do\n" + "\tcurl " + job.url.toString() + "buildWithParameters?token=TOKEN\\&ID=$i\n" + "done"; jenkins.control("/builder/command").setAtOnce(s); job2.save(); job2.startBuild().waitUntilFinished(); int nrOfBuilds = jenkins.getBuildHistory().numberOfInclusions(job.name); assertThat("All triggered builds have not been run or put in build queue.", nrOfBuilds == NO_BUILDS); }
Source:
<code>private boolean hasNotAllowedTwoEmptyLinesBefore(DetailAST token) { boolean result = false; if (!allowMultipleEmptyLines) { <START> result = hasEmptyLineBefore(token) && isPrePreviousLineEmpty(token); <END> } return result; }</code><technical_language>this changed? logic same</technical_language>

Target:
private boolean hasNotAllowedTwoEmptyLinesBefore(DetailAST token) { return !allowMultipleEmptyLines && hasEmptyLineBefore(token) && isPrePreviousLineEmpty(token); }
Source:
<code>public GrimlockDinobotLeader(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT,CardType.CREATURE}, "{1}{R}{G}{W}"); this.addSuperType(SuperType.LEGENDARY); <START> this.subtype.add("Autobot"); <END> this.power = new MageInt(4); this.toughness = new MageInt(4); this.transformable = true; this.secondSideCardClazz = GrimlockFerociousKing.class; this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 0, Duration.WhileOnBattlefield, filter, false))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 0, Duration.WhileOnBattlefield, filter2, true))); this.addAbility(new TransformAbility()); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TransformSourceEffect(true), new ManaCostsImpl("{2}"))); }</code><technical_language>Please new method of adding more subtypes a card. String methods deprecated</technical_language>

Target:
public GrimlockDinobotLeader(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT,CardType.CREATURE}, "{1}{R}{G}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.AUTOBOT); this.power = new MageInt(4); this.toughness = new MageInt(4); this.transformable = true; this.secondSideCardClazz = GrimlockFerociousKing.class; this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 0, Duration.WhileOnBattlefield, filter, false))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 0, Duration.WhileOnBattlefield, filter2, true))); this.addAbility(new TransformAbility()); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TransformSourceEffect(true), new ManaCostsImpl("{2}"))); }