auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Ehcache<String, String> getEhcache(final CacheLoaderWriter<String, String> cacheLoaderWriter, String name) { ExecutorService orderedExecutor = Executors.newSingleThreadExecutor(); ExecutorService unorderedExecutor = Executors.newCachedThreadPool(); TestTimeSource timeSource = new TestTimeSource(); cacheEventNotificationService = new CacheEventNotificationServiceImpl<String, String>(orderedExecutor, unorderedExecutor, store, timeSource); RuntimeConfiguration<String, String> runtimeConfiguration = new RuntimeConfiguration<String, String>(CACHE_CONFIGURATION, cacheEventNotificationService); final Ehcache<String, String> ehcache = new Ehcache<String, String>(runtimeConfiguration, this.store, cacheLoaderWriter, cacheEventNotificationService, LoggerFactory.getLogger(Ehcache.class + "-" + name)); ehcache.init(); assertThat("cache not initialized", ehcache.getStatus(), CoreMatchers.is(Status.AVAILABLE)); registerCacheEventListener(ehcache, cacheEventListener); return ehcache; }

Target:
protected Ehcache<String, String> getEhcache(final CacheLoaderWriter<String, String> cacheLoaderWriter, String name) { ExecutorService orderedExecutor = Executors.newSingleThreadExecutor(); ExecutorService unorderedExecutor = Executors.newCachedThreadPool(); TimeSource timeSource = SystemTimeSource.INSTANCE; cacheEventNotificationService = new CacheEventNotificationServiceImpl<String, String>(orderedExecutor, unorderedExecutor, store, timeSource); RuntimeConfiguration<String, String> runtimeConfiguration = new RuntimeConfiguration<String, String>(CACHE_CONFIGURATION, cacheEventNotificationService); final Ehcache<String, String> ehcache = new Ehcache<String, String>(runtimeConfiguration, this.store, cacheLoaderWriter, cacheEventNotificationService, LoggerFactory.getLogger(Ehcache.class + "-" + name)); ehcache.init(); assertThat("cache not initialized", ehcache.getStatus(), CoreMatchers.is(Status.AVAILABLE)); registerCacheEventListener(ehcache, cacheEventListener); return ehcache; }
Source:
public void testScrollToWithTwoArguments() { final Element element = mock(Element.class); doNothing().when(scrollHelper).scrollTo(element, element, 0); scrollHelper.scrollTo(element, element); verify(scrollHelper).scrollTo(element, element, 0); }

Target:
public void testScrollToWithTwoArguments() { final Element target = mock(Element.class); final Element container = mock(Element.class); doNothing().when(scrollHelper).scrollTo(any(), any(), anyInt()); scrollHelper.scrollTo(target, container); verify(scrollHelper).scrollTo(target, container, 0); }
Source:
private void loadIndicator(final WebElement element) { String aClass = element.getAttribute("class"); if (StringUtils.contains(aClass, "error")) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.ERROR; } else if (StringUtils.contains(aClass, "warn")) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.WARN; } else if (StringUtils.contains(aClass, "info")) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.INFO; } else if (StringUtils.contains(aClass, "success")) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.SUCCESS; } }

Target:
private void loadIndicator(final WebElement element) { String aClass = element.getAttribute("class"); if (StringUtils.contains(aClass, FIELD_INDICATOR_CLASS_ERROR)) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.ERROR; } else if (StringUtils.contains(aClass, FIELD_INDICATOR_CLASS_WARN)) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.WARN; } else if (StringUtils.contains(aClass, FIELD_INDICATOR_CLASS_INFO)) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.INFO; } else if (StringUtils.contains(aClass, FIELD_INDICATOR_CLASS_SUCCESS)) { indicatorType = AbstractWFieldIndicator.FieldIndicatorType.SUCCESS; } }
Source:
public void applyLatestConfigurations(StackId stackId) { clusterGlobalLock.writeLock().lock(); try { ClusterEntity clusterEntity = getClusterEntity(); Collection<ClusterConfigEntity> configEntities = clusterEntity.getClusterConfigEntities(); ImmutableMap<Object, ClusterConfigEntity> clusterConfigEntityMap = Maps.uniqueIndex( configEntities, Functions.identity()); for (ClusterConfigEntity clusterConfig : configEntities) { if (clusterConfig.isSelected()) { clusterConfig.setSelected(false); LOG.debug("Disabling configuration with tag {}", clusterConfig.getType(), clusterConfig.getTag()); } } Collection<ClusterConfigEntity> latestConfigMappingByStack = clusterDAO.getLatestConfigurations( clusterEntity.getClusterId(), stackId); Set<String> configTypesUpdated = new HashSet<>(); for (ClusterConfigEntity clusterConfig : latestConfigMappingByStack) { clusterConfig = clusterConfigEntityMap.get(clusterConfig); clusterConfig.setSelected(true); configTypesUpdated.add(clusterConfig.getType()); LOG.info("Setting with version tag created on to selected for stack {}", clusterConfig.getType(), clusterConfig.getTag(), new Date(clusterConfig.getTimestamp()), stackId); } for (ClusterConfigEntity clusterConfig : configEntities) { clusterDAO.merge(clusterConfig, true); } cacheConfigurations(); LOG.info( "Applied latest configurations for stack {}. The the following types were modified: {}", stackId, StringUtils.join(configTypesUpdated, ',')); } finally { clusterGlobalLock.writeLock().unlock(); } EntityManagerCacheInvalidationEvent event = new EntityManagerCacheInvalidationEvent(); jpaEventPublisher.publish(event); }

Target:
public void applyLatestConfigurations(StackId stackId) { clusterGlobalLock.writeLock().lock(); try { ClusterEntity clusterEntity = getClusterEntity(); Collection<ClusterConfigEntity> configEntities = clusterEntity.getClusterConfigEntities(); ImmutableMap<Object, ClusterConfigEntity> clusterConfigEntityMap = Maps.uniqueIndex( configEntities, Functions.identity()); for (ClusterConfigEntity clusterConfig : configEntities) { if (clusterConfig.isSelected()) { clusterConfig.setSelected(false); LOG.debug("Disabling configuration with tag {}", clusterConfig.getType(), clusterConfig.getTag()); } } Collection<ClusterConfigEntity> latestConfigMappingByStack = clusterDAO.getLatestConfigurations( clusterEntity.getClusterId(), stackId); Set<String> configTypesUpdated = new HashSet<>(); for (ClusterConfigEntity clusterConfig : latestConfigMappingByStack) { clusterConfig = clusterConfigEntityMap.get(clusterConfig); clusterConfig.setSelected(true); configTypesUpdated.add(clusterConfig.getType()); LOG.info("Setting with version tag created on to selected for stack {}", clusterConfig.getType(), clusterConfig.getTag(), new Date(clusterConfig.getTimestamp()), stackId); } clusterDAO.merge(configEntities, true); cacheConfigurations(); LOG.info( "Applied latest configurations for stack {}. The the following types were modified: {}", stackId, StringUtils.join(configTypesUpdated, ',')); } finally { clusterGlobalLock.writeLock().unlock(); } EntityManagerCacheInvalidationEvent event = new EntityManagerCacheInvalidationEvent(); jpaEventPublisher.publish(event); }
Source:
public void adsIncontentLeaderboard(String wikiName, String article) { String url = urlBuilder.getUrlForPath(wikiName, article); url = urlBuilder.appendQueryStringToURL(url, URL_PARAM_ENABLE_SITEWIDE); new AdsBaseObject(driver, url) .triggerAdSlot(AdsContent.INCONTENT_LEADERBOARD) .waitForCSSPseudoElementsContentToMatchValue("#"+AdsContent.INCONTENT_LEADERBOARD, "before", "\"advertisement\""); }

Target:
public void adsIncontentLeaderboard(String wikiName, String article) { String url = urlBuilder.getUrlForPath(wikiName, article); url = urlBuilder.appendQueryStringToURL(url, URL_PARAM_ENABLE_SITEWIDE); AdsBaseObject adsBaseObject = new AdsBaseObject(driver, url) .triggerAdSlot(AdsContent.INCONTENT_LEADERBOARD); String slotLabel = adsBaseObject.getPseudoElementValue( driver.findElement(By.cssSelector(AdsContent.getSlotSelector(AdsContent.INCONTENT_LEADERBOARD))), "before", "content"); Assertion.assertEquals(slotLabel, "\"advertisement\""); }
Source:
public Expression<?> visit(Path<?> expr, Context context) { if (expr.getMetadata().getPathType() == PathType.COLLECTION_ANY) { Path<?> parent = (Path<?>) expr.getMetadata().getParent().accept(this, context); expr = new PathImpl<Object>(expr.getType(), PathMetadataFactory.forCollectionAny(parent)); EntityPath<?> replacement = new EntityPathBase<Object>(expr.getType(), ExpressionUtils.createRootVariable(expr, replaced.size())); context.add(expr, replacement); replaced.add(expr); return replacement; } else if (expr.getMetadata().getParent() != null) { Context c = new Context(); Path<?> parent = (Path<?>) expr.getMetadata().getParent().accept(this, c); if (c.replace) { context.add(c); return replaceParent(expr, parent); } } return expr; }

Target:
public Expression<?> visit(Path<?> expr, Context context) { if (expr.getMetadata().getPathType() == PathType.COLLECTION_ANY) { Path<?> parent = (Path<?>) expr.getMetadata().getParent().accept(this, context); expr = new PathImpl<Object>(expr.getType(), PathMetadataFactory.forCollectionAny(parent)); EntityPath<?> replacement = new EntityPathBase<Object>(expr.getType(), ExpressionUtils.createRootVariable(expr, replacedCounter++)); context.add(expr, replacement); return replacement; } else if (expr.getMetadata().getParent() != null) { Context c = new Context(); Path<?> parent = (Path<?>) expr.getMetadata().getParent().accept(this, c); if (c.replace) { context.add(c); return replaceParent(expr, parent); } } return expr; }
Source:
public void setAdditionalExceptionMappings(Map<Class<? extends AuthenticationException>, Class<? extends AbstractAuthenticationFailureEvent>> mappings){ Assert.notEmpty(mappings, "The mappings Map must not be empty nor null"); for (Map.Entry<Class<? extends AuthenticationException>,Class<? extends AbstractAuthenticationFailureEvent>> entry : mappings.entrySet()) { Class<?> exceptionClazz = entry.getKey(); Class<?> eventClazz = entry.getValue(); Assert.isAssignable(AuthenticationException.class, exceptionClazz); Assert.isAssignable(AbstractAuthenticationFailureEvent.class, eventClazz); addMapping(exceptionClazz.getName(), (Class<? extends AbstractAuthenticationFailureEvent>) eventClazz); } }

Target:
public void setAdditionalExceptionMappings(Map<Class<? extends AuthenticationException>, Class<? extends AbstractAuthenticationFailureEvent>> mappings){ Assert.notEmpty(mappings, "The mappings Map must not be empty nor null"); for (Map.Entry<Class<? extends AuthenticationException>, Class<? extends AbstractAuthenticationFailureEvent>> entry : mappings.entrySet()) { Class<?> exceptionClass = entry.getKey(); Class<?> eventClass = entry.getValue(); Assert.notNull(exceptionClass, "exceptionClass cannot be null"); Assert.notNull(eventClass, "eventClass cannot be null"); addMapping(exceptionClass.getName(), (Class<? extends AbstractAuthenticationFailureEvent>) eventClass); } }
Source:
protected FileImporterContext(Builder builder) { session = builder.session; blob = builder.blob; parentPath = builder.parentPath; overwrite = builder.overwrite; mimeTypeCheck = builder.mimeTypeCheck; excludeOneToMany = builder.excludeOneToMany; fileName = StringUtils.isNotEmpty(builder.fileName) ? builder.fileName : blob.getFilename(); persistDocument = builder.persistDocument; }

Target:
protected FileImporterContext(Builder builder) { session = builder.session; blob = builder.blob; parentPath = builder.parentPath; overwrite = builder.overwrite; mimeTypeCheck = builder.mimeTypeCheck; excludeOneToMany = builder.excludeOneToMany; fileName = StringUtils.defaultIfEmpty(builder.fileName, blob.getFilename()); persistDocument = builder.persistDocument; }
Source:
public QueryResultCachePlugin( SolrCache solrCache, SolrCacheSource solrCacheSource, ExecutorService solrCacheExecutorService) { cacheSource = solrCacheSource; cacheExecutorService = solrCacheExecutorService; cacheCommitPhaser = new CacheCommitPhaser(solrCache); cacheBulkProcessor = new CacheBulkProcessor(solrCache); }

Target:
public QueryResultCachePlugin( SolrCache solrCache, SolrCacheSource solrCacheSource, ExecutorService solrCacheExecutorService) { Validate.notNull(solrCache, "Valid SolrCache required."); Validate.notNull(solrCacheSource, "Valid SolrCacheSource required."); Validate.notNull(solrCacheExecutorService, "Valid ExecutorService required."); cacheSource = solrCacheSource; cacheExecutorService = solrCacheExecutorService; cacheBulkProcessor = new CacheBulkProcessor(solrCache); }
Source:
public URI buildEncoded() { for (int i = 0; i < qParams.size(); i++) { String amp = (i != qParams.size() - 1) ? "&" : ""; query.append(qParams.get(i) + amp); } try { String q = (query.length() == 0) ? "" : "?" + query; String uri = String.format("%s://%s:%s%s%s%s", new Object[]{scheme, host, port, path, encodedPath, q}); return new URI(uri); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }

Target:
public URI buildEncoded() { for (int i = 0; i < qParams.size(); i++) { String amp = (i != qParams.size() - 1) ? "&" : ""; query.append(qParams.get(i).toURLEncodedString() + amp); } try { String q = (query.length() == 0) ? "" : "?" + query; String uri = String.format("%s://%s:%s%s%s%s", scheme, host, port, path, encodedPath, q); return new URI(uri); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
Source:
public void createAuxiliaryConnections(Set<Integer> peers, int secondaryConnections) { m_numberOfConnections = secondaryConnections + 1; for (int hostId : peers) { if (hostId == m_localHostId) { continue; } for (int ii = 0; ii < secondaryConnections; ii++) { Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator(); if (it.hasNext()) { ForeignHost fh = it.next(); try { SocketChannel socket = m_joiner.requestForConnection(fh.m_listeningAddress); ForeignHost fhost = new ForeignHost(this, hostId, socket, Integer.MAX_VALUE, fh.m_listeningAddress, new PicoNetwork(socket)); putForeignHost(hostId, fhost); fhost.enableRead(VERBOTEN_THREADS); } catch (Exception e) { m_hostLog.error("Failed to connect to peer nodes.", e); throw new RuntimeException("Failed to establish socket connection with " + fh.m_listeningAddress.getAddress().getHostAddress(), e); } } } } }

Target:
public void createAuxiliaryConnections(Set<Integer> peers, int secondaryConnections) { for (int hostId : peers) { for (int ii = 0; ii < secondaryConnections; ii++) { Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator(); if (it.hasNext()) { ForeignHost fh = it.next(); try { SocketChannel socket = m_joiner.requestForConnection(fh.m_listeningAddress); ForeignHost fhost = new ForeignHost(this, hostId, socket, Integer.MAX_VALUE, fh.m_listeningAddress, new PicoNetwork(socket)); putForeignHost(hostId, fhost); fhost.enableRead(VERBOTEN_THREADS); } catch (Exception e) { m_hostLog.error("Failed to connect to peer nodes.", e); throw new RuntimeException("Failed to establish socket connection with " + fh.m_listeningAddress.getAddress().getHostAddress(), e); } } } } m_hasAllSecondaryConnectionCreated = true; }
Source:
public Long getNextSequenceValue() { return nextSequenceValue == null ? -1l : nextSequenceValue; }

Target:
public Long getNextSequenceValue() { if(nextSequenceValue == null) return -1l; return nextSequenceValue; }
Source:
public void test() { SpillCipher cipher = new AesSpillCipher(); PagesSerde serde = new TestingPagesSerdeFactory().createPagesSerdeForSpill(Optional.of(cipher)); List<Type> types = ImmutableList.of(VARCHAR); Page empty = new Page(VARCHAR.createBlockBuilder(null, 0).build()); assertPageEquals(types, serde.deserialize(serde.serialize(empty)), empty); BlockBuilder blockBuilder = VARCHAR.createBlockBuilder(null, 2); VARCHAR.writeString(blockBuilder, "hello"); VARCHAR.writeString(blockBuilder, "world"); Page nonEmpty = new Page(blockBuilder.build()); SerializedPage serialized = serde.serialize(nonEmpty); assertPageEquals(types, serde.deserialize(serialized), nonEmpty); assertTrue(ENCRYPTED.isSet(serialized.getPageCodecMarkers()), "page should be encrypted"); cipher.destroy(); assertFailure(() -> serde.serialize(nonEmpty), "Spill cipher already destroyed"); assertFailure(() -> serde.deserialize(serialized), "Spill cipher already destroyed"); }

Target:
public void test() { SpillCipher cipher = new AesSpillCipher(); PagesSerde serde = new TestingPagesSerdeFactory().createPagesSerdeForSpill(Optional.of(cipher)); List<Type> types = ImmutableList.of(VARCHAR); Page emptyPage = new Page(VARCHAR.createBlockBuilder(null, 0).build()); assertPageEquals(types, serde.deserialize(serde.serialize(emptyPage)), emptyPage); BlockBuilder blockBuilder = VARCHAR.createBlockBuilder(null, 2); VARCHAR.writeString(blockBuilder, "hello"); VARCHAR.writeString(blockBuilder, "world"); Page helloWorldPage = new Page(blockBuilder.build()); SerializedPage serialized = serde.serialize(helloWorldPage); assertPageEquals(types, serde.deserialize(serialized), helloWorldPage); assertTrue(ENCRYPTED.isSet(serialized.getPageCodecMarkers()), "page should be encrypted"); cipher.destroy(); assertFailure(() -> serde.serialize(helloWorldPage), "Spill cipher already destroyed"); assertFailure(() -> serde.deserialize(serialized), "Spill cipher already destroyed"); }
Source:
public void testApplicationBinding_noPrevious_noImportAdded() throws IllegalAccessException, InterruptedException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); Assert.assertEquals( 0, processor.applicationBindings.size()); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); MsgCmdChangeBinding msg = new MsgCmdChangeBinding( "ext", new HashSet<>( Arrays.asList( "demo" ))); processor.processMessage( msg ); Assert.assertEquals( 1, processor.applicationBindings.size()); Assert.assertEquals( new HashSet<>( Arrays.asList( "demo" )), processor.applicationBindings.get( "ext" )); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); }

Target:
public void testApplicationBinding_noPrevious_noImportAdded() throws IllegalAccessException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); Assert.assertEquals( 0, processor.applicationBindings.size()); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); MsgCmdChangeBinding msg = new MsgCmdChangeBinding( "ext", new HashSet<>( Arrays.asList( "demo" ))); processor.processMessage( msg ); Assert.assertEquals( 1, processor.applicationBindings.size()); Assert.assertEquals( new HashSet<>( Arrays.asList( "demo" )), processor.applicationBindings.get( "ext" )); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); }
Source:
public void onAccountChanged(AccountStore.OnAccountChanged event) { if (!isAdded()) { return; } if (event.isError()) { switch (event.error.type) { case SETTINGS_FETCH_ERROR: ToastUtils .showToast(getActivity(), R.string.error_fetch_account_settings, ToastUtils.Duration.LONG); break; case SETTINGS_POST_ERROR: ToastUtils.showToast(getActivity(), R.string.error_post_account_settings, ToastUtils.Duration.LONG); break; } } updateAnalyticsSyncUI(); }

Target:
public void onAccountChanged(AccountStore.OnAccountChanged event) { if (!isAdded()) { return; } if (event.isError()) { switch (event.error.type) { case SETTINGS_FETCH_ERROR: ToastUtils .showToast(getActivity(), R.string.error_fetch_account_settings, ToastUtils.Duration.LONG); break; case SETTINGS_POST_ERROR: ToastUtils.showToast(getActivity(), R.string.error_post_account_settings, ToastUtils.Duration.LONG); break; } } else if (event.causeOfChange == AccountAction.FETCH_SETTINGS) { updateAnalyticsSyncUI(); } }
Source:
public ProjectApi create(ProjectInput in) throws RestApiException { if(in.name == null) { throw new AssertionError("Name must be set in project creation input."); } String url = String.format("/projects/%s", in.name); String projectInput = projectsParser.generateProjectInput(in); JsonElement result = gerritRestClient.putRequest(url, projectInput); ProjectInfo info = projectsParser.parseSingleProjectInfo(result); return new ProjectApiRestClient(gerritRestClient, projectsParser, branchInfoParser, tagInfoParser, info.name); }

Target:
public ProjectApi create(ProjectInput in) throws RestApiException { if (in.name == null) { throw new IllegalArgumentException("Name must be set in project creation input."); } String url = String.format("/projects/%s", in.name); String projectInput = projectsParser.generateProjectInput(in); JsonElement result = gerritRestClient.putRequest(url, projectInput); ProjectInfo info = projectsParser.parseSingleProjectInfo(result); return new ProjectApiRestClient(gerritRestClient, projectsParser, branchInfoParser, tagInfoParser, info.name); }
Source:
private List<String> getChildrenCached(final String zkPath) { try { PathChildrenCache cache = SLOTS_CACHES.getOrDefault(zkPath, null); if (cache == null) { cache = new PathChildrenCache(zkHolder.get(), zkPath, false); cache.start(BUILD_INITIAL_CACHE); SLOTS_CACHES.put(zkPath, cache); } return cache.getCurrentData().stream() .map(childData -> { final String[] pathParts = childData.getPath().split("/"); return pathParts[pathParts.length - 1]; }) .collect(toList()); } catch (Exception e) { LOG.error("Zookeeper error when getting consumer nodes", e); throw new NakadiRuntimeException(e); } }

Target:
private List<String> getChildrenCached(final String zkPath) { final PathChildrenCache cache = SLOTS_CACHES.computeIfAbsent(zkPath, key -> { try { final PathChildrenCache newCache = new PathChildrenCache(zkHolder.get(), key, false); newCache.start(BUILD_INITIAL_CACHE); return newCache; } catch (final Exception e) { LOG.error("Zookeeper error when getting consumer nodes", e); throw new NakadiRuntimeException(e); } }); return cache.getCurrentData().stream() .map(childData -> { final String[] pathParts = childData.getPath().split("/"); return pathParts[pathParts.length - 1]; }) .collect(toList()); }
Source:
public Date addToDate(Date startDate, OrderFrequency frequency) { if (SECONDS_CODE.equals(code)) return DateUtils.addSeconds(startDate, duration); if (MINUTES_CODE.equals(code)) return DateUtils.addMinutes(startDate, duration); if (HOURS_CODE.equals(code)) return DateUtils.addHours(startDate, duration); if (DAYS_CODE.equals(code)) return DateUtils.addDays(startDate, duration); if (WEEKS_CODE.equals(code)) return DateUtils.addWeeks(startDate, duration); if (MONTHS_CODE.equals(code)) return DateUtils.addMonths(startDate, duration); if (YEARS_CODE.equals(code)) return DateUtils.addYears(startDate, duration); if (RECURRING_INTERVAL_CODE.equals(code)) { return DateUtils.addSeconds(startDate, (int) (duration * SECONDS_PER_DAY / frequency.getFrequencyPerDay())); } return null; }

Target:
public Date addToDate(Date startDate, OrderFrequency frequency) { if (SECONDS_CODE.equals(code)) return DateUtils.addSeconds(startDate, duration); if (MINUTES_CODE.equals(code)) return DateUtils.addMinutes(startDate, duration); if (HOURS_CODE.equals(code)) return DateUtils.addHours(startDate, duration); if (DAYS_CODE.equals(code)) return DateUtils.addDays(startDate, duration); if (WEEKS_CODE.equals(code)) return DateUtils.addWeeks(startDate, duration); if (MONTHS_CODE.equals(code)) return DateUtils.addMonths(startDate, duration); if (YEARS_CODE.equals(code)) return DateUtils.addYears(startDate, duration); if (RECURRING_INTERVAL_CODE.equals(code)) { if (frequency == null) throw new APIException("Frequency can not be null when duration in Recurring Interval"); return DateUtils.addSeconds(startDate, (int) (duration * SECONDS_PER_DAY / frequency.getFrequencyPerDay())); } throw new APIException(String.format("Unknown code '%s' for ISO8601 duration units", code)); }
Source:
protected boolean validate() { boolean returnValue = true; if (Guid.Empty.equals(getVmId())) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } if (returnValue) { List<VM> vmsForUser = getVmDao().getAllForUser(getAdUserId()); int vmCount = 0; for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { vmCount++; } } int limit = getVmPool().getMaxAssignedVmsPerUser(); if (vmCount >= limit) { addValidationMessage(EngineMessage.VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL); returnValue = false; } } if (!returnValue) { setActionMessageParameters(); vmPoolHandler.releaseVm(getVmId(), !isVmPrestarted()); } return returnValue; }

Target:
protected boolean validate() { boolean returnValue = true; if (getVmPool() == null) { addValidationMessage(EngineMessage.VM_POOL_NOT_FOUND); returnValue = false; } if (returnValue && Guid.Empty.equals(getVmId())) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } if (returnValue) { List<VM> vmsForUser = getVmDao().getAllForUser(getAdUserId()); int vmCount = 0; for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { vmCount++; } } int limit = getVmPool().getMaxAssignedVmsPerUser(); if (vmCount >= limit) { addValidationMessage(EngineMessage.VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL); returnValue = false; } } if (!returnValue) { setActionMessageParameters(); } return returnValue; }
Source:
public UserLogin login(Login login) { Session session = this.sessionFactory.getCurrentSession(); Query query = session.createQuery("from UserLogin where userName = :userName"); query.setParameter("userName", login.getUserName()); List list = query.list(); if (!list.isEmpty() && list.get(0) != null) { return (UserLogin) list.get(0); } else { return null; } }

Target:
public UserLogin login(Login login) { Session session = null; UserLogin userLogin = null; Query query = null; try { session = this.sessionFactory.getCurrentSession(); query = session.createQuery("from UserLogin where userName = :userName"); query.setParameter("userName", login.getUserName()); userLogin = (UserLogin) query.uniqueResult(); } catch (HibernateException e) { LOG.error("Exception during query execution by: " + e.getMessage(), e); } finally { closeSession(session, false); } return userLogin; }
Source:
public Serializable execute(TaskResult... results) throws IOException { File file = new File(outputPath); containerURL = AzureStorageConnectorUtils.createContainerURL(storageAccount, accountKey, containerName); if (optionalBlobName.isPresent()) { String azureBlobLocalRelativePath = Paths.get(outputPath, Paths.get(optionalBlobName.get()).getFileName().toString()) .toString(); if (outputPath.endsWith(File.separator)) { SchedulerExamplesUtils.createDirIfNotExists(file); downloadBlob(new File(azureBlobLocalRelativePath), optionalBlobName.get()); } else if (outputPath.equals(getLocalSpace())) { downloadBlob(new File(azureBlobLocalRelativePath), optionalBlobName.get()); } else { downloadBlob(file, optionalBlobName.get()); } } else { SchedulerExamplesUtils.createDirIfNotExists(file); downloadContainerBlobs(containerURL); } return (Serializable) Arrays.asList(outputPath); }

Target:
public Serializable execute(TaskResult... results) throws IOException { File file = new File(outputPath); containerURL = AzureStorageConnectorUtils.createContainerURL(storageAccount, accountKey, containerName); if (optionalBlobName.isPresent()) { String azureBlobLocalRelativePath = Paths.get(outputPath, Paths.get(optionalBlobName.get()).getFileName().toString()) .toString(); if (SchedulerExamplesUtils.isDirectoryPath(outputPath)) { SchedulerExamplesUtils.createDirIfNotExists(file); downloadBlob(new File(azureBlobLocalRelativePath), optionalBlobName.get()); } else if (outputPath.equals(getLocalSpace())) { downloadBlob(new File(azureBlobLocalRelativePath), optionalBlobName.get()); } else { downloadBlob(file, optionalBlobName.get()); } } else { SchedulerExamplesUtils.createDirIfNotExists(file); downloadContainerBlobs(containerURL); } return (Serializable) Arrays.asList(outputPath); }
Source:
public CompletableFuture<Boolean> checkAndUpdateConfigMap( String configMapName, Function<KubernetesConfigMap, Optional<KubernetesConfigMap>> function) { return FutureUtils.retry( () -> CompletableFuture.supplyAsync( () -> getConfigMap(configMapName) .map( configMap -> function.apply(configMap).map( updatedConfigMap -> { try { this.internalClient.configMaps() .inNamespace(namespace) .withName(configMapName) .lockResourceVersion(updatedConfigMap.getResourceVersion()) .replace(updatedConfigMap.getInternalResource()); } catch (Throwable throwable) { LOG.debug("Failed to update ConfigMap with data because of concurrent " + "modifications. Trying again.", configMap.getName(), configMap.getData()); throw throwable; } return true; }).orElse(false)) .orElseThrow(() -> new CompletionException( new KubernetesException("Not retry since " + configMapName + " does not exist."))), kubeClientExecutorService), maxRetryAttempts, throwable -> ExceptionUtils.findThrowable(throwable, KubernetesClientException.class).isPresent(), kubeClientExecutorService); }

Target:
public CompletableFuture<Boolean> checkAndUpdateConfigMap( String configMapName, Function<KubernetesConfigMap, Optional<KubernetesConfigMap>> function) { return FutureUtils.retry( () -> CompletableFuture.supplyAsync( () -> getConfigMap(configMapName) .map( configMap -> function.apply(configMap).map( updatedConfigMap -> { try { this.internalClient.configMaps() .inNamespace(namespace) .withName(configMapName) .lockResourceVersion(updatedConfigMap.getResourceVersion()) .replace(updatedConfigMap.getInternalResource()); } catch (Throwable throwable) { LOG.debug("Failed to update ConfigMap with data because of concurrent " + "modifications. Trying again.", configMap.getName(), configMap.getData()); throw throwable; } return true; }).orElse(false)) .orElseThrow(() -> new CompletionException( new KubernetesException("Cannot retry checkAndUpdateConfigMap with configMap " + configMapName + " because it does not exist."))), kubeClientExecutorService), maxRetryAttempts, throwable -> ExceptionUtils.findThrowable(throwable, KubernetesClientException.class).isPresent(), kubeClientExecutorService); }
Source:
public static double[] trimDistribution(final double[] distribution) { int endOfDistribution = 0; for (endOfDistribution = distribution.length-1;endOfDistribution >= 0;endOfDistribution--) { if (distribution[endOfDistribution] != 0) { break; } } final double[] trimmedDistribution = new double[endOfDistribution+1]; for (int i = 0;i <= endOfDistribution;i++) { trimmedDistribution[i] = distribution[i]; } return trimmedDistribution; }

Target:
public static double[] trimDistribution(final double[] distribution) { int endOfDistribution = 0; for (endOfDistribution = distribution.length - 1; endOfDistribution >= 0; endOfDistribution--) { if (distribution[endOfDistribution] != 0) { break; } } return Arrays.copyOfRange(distribution, 0, endOfDistribution); }
Source:
private void validateDirectPrerequisiteFileTypes( ConfiguredTargetAndData prerequisite, Attribute attribute) { if (attribute.isSkipAnalysisTimeFileTypeCheck()) { return; } FileTypeSet allowedFileTypes = attribute.getAllowedFileTypesPredicate(); if (allowedFileTypes == null) { return; } if (!attribute.isNonEmpty() && !attribute.isSingleArtifact()) { return; } if (allowedFileTypes != FileTypeSet.NO_FILE) { NestedSet<Artifact> artifacts = prerequisite.getConfiguredTarget().getProvider(FileProvider.class).getFilesToBuild(); if (attribute.isSingleArtifact() && !artifacts.isSingleton()) { attributeError( attribute.getName(), "'" + prerequisite.getTarget().getLabel() + "' must produce a single file"); return; } for (Artifact sourceArtifact : artifacts.toList()) { if (allowedFileTypes.apply(sourceArtifact.getFilename())) { return; } if (sourceArtifact.isTreeArtifact()) { return; } } attributeError( attribute.getName(), "'" + prerequisite.getTarget().getLabel() + "' does not produce any " + getRuleClassNameForLogging() + " " + attribute.getName() + " files (expected " + allowedFileTypes + ")"); } }

Target:
private void validateDirectPrerequisiteFileTypes( ConfiguredTargetAndData prerequisite, Attribute attribute) { if (attribute.isSkipAnalysisTimeFileTypeCheck()) { return; } FileTypeSet allowedFileTypes = attribute.getAllowedFileTypesPredicate(); if (allowedFileTypes == null) { return; } if (allowedFileTypes == FileTypeSet.ANY_FILE && !attribute.isNonEmpty() && !attribute.isSingleArtifact()) { return; } if (allowedFileTypes != FileTypeSet.NO_FILE) { NestedSet<Artifact> artifacts = prerequisite.getConfiguredTarget().getProvider(FileProvider.class).getFilesToBuild(); if (attribute.isSingleArtifact() && !artifacts.isSingleton()) { attributeError( attribute.getName(), "'" + prerequisite.getTarget().getLabel() + "' must produce a single file"); return; } if (artifacts.toList().isEmpty() && !attribute.isNonEmpty()) { return; } for (Artifact sourceArtifact : artifacts.toList()) { if (allowedFileTypes.apply(sourceArtifact.getFilename())) { return; } if (sourceArtifact.isTreeArtifact()) { return; } } attributeError( attribute.getName(), "'" + prerequisite.getTarget().getLabel() + "' does not produce any " + getRuleClassNameForLogging() + " " + attribute.getName() + " files (expected " + allowedFileTypes + ")"); } }
Source:
public static boolean isResurrected(ChangeItem changeItem) { return (changeItem.getBaselineVersion().isValid() && isDeleted( changeItem.getBaselineVersion())) || (changeItem.getChangeType().equals( ChangeType.TUPLE_CHANGE) && changeItem.getDestinationVersion().isValid() && isDeleted( changeItem.getDestinationVersion()) && changeItem.getCurrentVersion().getModType().equals( ModificationType.INTRODUCED)); }

Target:
public static boolean isResurrected(ChangeItem changeItem) { return (changeItem.getBaselineVersion().isValid() && isDeleted( changeItem.getBaselineVersion())) || changeItem.getCurrentVersion().getModType().equals( ModificationType.INTRODUCED); }
Source:
public Commit remove( final String path, final String message, final String sha, final String branch, final Map<String, String> committer, final Map<String, String> author) throws IOException { return new Commit.Smart(null); }

Target:
public Commit remove( final String path, final String message, final String sha, final String branch, final Map<String, String> committer, final Map<String, String> author) throws IOException { return new Commit() { @Override public Repo repo() { return null; } @Override public String sha() { return null; } @Override public int compareTo(final Commit comm) { return 0; } @Override public JsonObject json() throws IOException { return null; } }; }
Source:
public void testIndex() { Response response = dataUseResource.getSchema(); assertStatusAndHeader(response, Response.Status.OK, MediaType.APPLICATION_JSON); String content = response.getEntity().toString().trim(); Assert.assertTrue(content.contains("Data Use")); }

Target:
public void testIndex() { Response response = dataUseResource.getSchema(); assertStatusAndHeader(response, Response.Status.OK, MediaType.APPLICATION_JSON); String content = response.getEntity().toString().trim(); Assert.assertTrue(content.contains("Data Use")); try { new JSONObject(content); } catch (JSONException e) { fail("The response entity is not valid json"); } }
Source:
protected void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { if (VmSettings.ACTOR_TRACING) { baseMessageId = currentThread.generateMessageBaseId(size); currentThread.currentMessageId = baseMessageId; } assert size > 0; try { execute(firstMessage, currentThread, dbg, -1); stopNextMessage = firstMessage.isStepOver(); if (size > 1) { int i = 0; for (EventualMessage msg : mailboxExtension) { execute(msg, currentThread, dbg, i); stopNextMessage = msg.isStepOver(); i++; } } } finally { if (VmSettings.ACTOR_TRACING) { currentThread.createdMessages += size; ActorExecutionTrace.mailboxExecuted(firstMessage, mailboxExtension, baseMessageId, currentMailboxNo, firstMessageTimeStamp, mailboxExtensionTimeStamps, executionTimeStamps, actor); } } }

Target:
protected void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { if (VmSettings.ACTOR_TRACING) { baseMessageId = currentThread.generateMessageBaseId(size); currentThread.currentMessageId = baseMessageId; } assert size > 0; try { execute(firstMessage, currentThread, dbg, -1); if (size > 1) { int i = 0; for (EventualMessage msg : mailboxExtension) { execute(msg, currentThread, dbg, i); i++; } } } finally { if (VmSettings.ACTOR_TRACING) { currentThread.createdMessages += size; ActorExecutionTrace.mailboxExecuted(firstMessage, mailboxExtension, baseMessageId, currentMailboxNo, firstMessageTimeStamp, mailboxExtensionTimeStamps, executionTimeStamps, actor); } } }
Source:
public static void onRitualDeath(LivingDropsEvent event){ if(!ConfigHandler.values.wellOfSufferingDrops){ if(event.getSource().equals(WayofTime.bloodmagic.ritual.RitualManager.RITUAL_DAMAGE)) { event.getDrops().clear(); } } }

Target:
public static void onRitualDeath(LivingDropsEvent event){ if(!ConfigHandler.values.wellOfSufferingDrops){ if(event.getSource().equals(RitualManager.RITUAL_DAMAGE)) { event.getDrops().clear(); } } }
Source:
public void testInvokeMapperCancellation() throws Exception { MapReduceTask<String, String, String, Integer> task = invokeMapReduce(null, new LatchMapper(), new WordCountReducer()); final Future<Map<String, Integer>> future = task.executeAsynchronously(); Future<Boolean> cancelled = fork(new Callable<Boolean>() { @Override public Boolean call() throws Exception { eventually(new Condition() { @Override public boolean isSatisfied() throws Exception { return counter.get() >= nodeCount(); } }); Thread.sleep(1500); return future.cancel(true); } }); boolean mapperCancelled = false; Throwable root = null; try { future.get(); } catch (Exception e) { root = e; while(root.getCause() != null){ root = root.getCause(); } mapperCancelled = root.getClass().equals(RuntimeException.class); } assert mapperCancelled : "Mapper not cancelled, root cause " + root; assert cancelled.get(); assert future.isDone(); boolean canceled = future.cancel(true); assert !canceled; future.get(); }

Target:
public void testInvokeMapperCancellation() throws Exception { counter = new AtomicInteger(); MapReduceTask<String, String, String, Integer> task = invokeMapReduce(null, new LatchMapper(), new WordCountReducer()); final Future<Map<String, Integer>> future = task.executeAsynchronously(); Future<Boolean> cancelled = fork(new Callable<Boolean>() { @Override public Boolean call() throws Exception { eventually(new Condition() { @Override public boolean isSatisfied() throws Exception { return counter.get() >= nodeCount(); } }); return future.cancel(true); } }); boolean mapperCancelled = false; Throwable root = null; try { future.get(); } catch (Exception e) { root = e; while(root.getCause() != null){ root = root.getCause(); } mapperCancelled = root.getClass().equals(RuntimeException.class); } assert mapperCancelled : "Mapper not cancelled, root cause " + root; assert cancelled.get(); assert future.isDone(); boolean canceled = future.cancel(true); assert !canceled; future.get(); }
Source:
public void visitClass(PsiClass clazz) { super.visitClass(clazz); if (clazz.hasAnnotation(lombok.Value.class.getName())) { final PsiModifierList modifierList = clazz.getModifierList(); if (modifierList != null && modifierList.hasExplicitModifier(FINAL)) { final Optional<PsiElement> psiFinal = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> FINAL.equals(psiElement.getText())) .findFirst(); psiFinal.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant final field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(FINAL)) ); } } }

Target:
public void visitClass(PsiClass clazz) { super.visitClass(clazz); if (clazz.hasAnnotation(lombok.Value.class.getName())) { final PsiModifierList modifierList = clazz.getModifierList(); if (modifierList != null && modifierList.hasExplicitModifier(FINAL)) { final Optional<PsiElement> psiFinal = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> FINAL.equals(psiElement.getText())) .findFirst(); psiFinal.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant final class modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(FINAL)) ); } } }
Source:
public long getBackoffPeriod(int numberOfAttempts) { double randomCoeff = ThreadLocalRandom.current().nextDouble() + 0.5; return (long) (Math.min(500 * Math.pow(2, numberOfAttempts), MAX_EXPECTED_BACKOFF) * randomCoeff); }

Target:
public long getBackoffPeriod(int numberOfAttempts) { double randomCoeff = ThreadLocalRandom.current().nextDouble(1 - UNCERTAINTY, 1 + UNCERTAINTY); return (long) (Math.min(500 * Math.pow(2, numberOfAttempts), MAX_EXPECTED_BACKOFF) * randomCoeff); }
Source:
public void test_can_parse_next_major_release_version() { int internalId = Version.CURRENT.internalId + 1000000; Version futureVersion = Version.fromId(internalId); assertThat(futureVersion.major, is((byte) (Version.CURRENT.major + 1))); assertThat(futureVersion.minor, is(Version.CURRENT.minor)); assertThat(futureVersion.revision, is(Version.CURRENT.revision)); assertThat(futureVersion.luceneVersion, is(org.apache.lucene.util.Version.fromBits( Version.CURRENT.luceneVersion.major + 1, Version.CURRENT.luceneVersion.minor, Version.CURRENT.luceneVersion.bugfix) )); }

Target:
public void test_can_parse_next_major_release_version() { int internalId = Version.CURRENT.internalId + 1000000; Version futureVersion = Version.fromId(internalId); assertThat(futureVersion.major, is((byte) (Version.CURRENT.major + 1))); assertThat(futureVersion.minor, is(Version.CURRENT.minor)); assertThat(futureVersion.revision, is(Version.CURRENT.revision)); assertThat(futureVersion.luceneVersion, is(org.apache.lucene.util.Version.fromBits( Version.CURRENT.luceneVersion.major + 1, 0, 0) )); }
Source:
public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (needsFuel()) { fuel = data.getLong("fuel"); } powered = data.getBoolean("powered"); pointPos = NBTPlugin.readBlockPos(data, "point"); prevX = data.getInteger("prevX"); prevY = data.getInteger("prevY"); prevZ = data.getInteger("prevZ"); }

Target:
public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (needsFuel()) fuel = data.getLong("fuel"); powered = data.getBoolean("powered"); pointPos = NBTPlugin.readBlockPos(data, "point"); prevX = data.getInteger("prevX"); prevY = data.getInteger("prevY"); prevZ = data.getInteger("prevZ"); }
Source:
public static PostDiscoveryFilter includeMatching(String infixTagExpression) { TagExpression tagExpression = TagExpression.parseFrom(infixTagExpression).tagExpressionOrThrow( (message) -> new PreconditionViolationException( "Unable to parse tag expression [" + infixTagExpression + "]: " + message)); logger.config(() -> "parsed tag expression: " + tagExpression); return descriptor -> FilterResult.includedIf(tagExpression.evaluate(descriptor.getTags())); }

Target:
private static PostDiscoveryFilter includeMatching(String infixTagExpression) { TagExpression tagExpression = TagExpression.parseFrom(infixTagExpression).tagExpressionOrThrow( (message) -> new PreconditionViolationException( "Unable to parse tag expression [" + infixTagExpression + "]: " + message)); logger.config(() -> "parsed tag expression: " + tagExpression); return descriptor -> FilterResult.includedIf(tagExpression.evaluate(descriptor.getTags())); }
Source:
private NamedFields getNamedFields(final Model rdf, final URI uri) throws IOException, HttpException { final RDFNode indexingTransform = rdf.listObjectsOfProperty(createResource(uri.toString()), INDEXING_TRANSFORM_PREDICATE).next(); final String transformKey = indexingTransform.asLiteral().getString(); LOGGER.debug("Discovered transform key: {}", transformKey); final HttpGet transformedResourceRequest = new HttpGet(uri.toString() + "/fcr:transform/" + transformKey); LOGGER.debug("Retrieving transformed resource from: {}", transformedResourceRequest.getURI()); final HttpResponse response = httpClient.execute(transformedResourceRequest); if (response.getStatusLine().getStatusCode() != SC_OK) { throw new HttpException(response.getStatusLine().toString()); } try ( Reader r = new InputStreamReader(response.getEntity().getContent(), "UTF8")) { return gson.fromJson(r, typeToken); } }

Target:
private NamedFields getNamedFields(final Model rdf, final URI uri) throws IOException, HttpException { final NodeIterator nodeIterator = rdf.listObjectsOfProperty(createResource(uri.toString()), INDEXING_TRANSFORM_PREDICATE); if (!nodeIterator.hasNext()) { throw new AbsentTransformPropertyException("Property lookup failed for uri: " + uri); } final RDFNode indexingTransform = nodeIterator.next(); final String transformKey = indexingTransform.asLiteral().getString(); LOGGER.debug("Discovered transform key: {}", transformKey); final HttpGet transformedResourceRequest = new HttpGet(uri.toString() + "/fcr:transform/" + transformKey); LOGGER.debug("Retrieving transformed resource from: {}", transformedResourceRequest.getURI()); final HttpResponse response = httpClient.execute(transformedResourceRequest); if (response.getStatusLine().getStatusCode() != SC_OK) { throw new HttpException(response.getStatusLine().toString()); } try ( Reader r = new InputStreamReader(response.getEntity().getContent(), "UTF8")) { return gson.fromJson(r, typeToken); } }
Source:
private List<DiskImage> createChildSnapshots(List<DiskImage> parentSnapshots) { List<DiskImage> children = new ArrayList<>(parentSnapshots.size()); parentSnapshots .stream() .forEach(parent -> { DiskImage child = createDiskImage(STORAGE_DOMAIN_ID); child.setParentId(parent.getImageId()); children.add(child); }); return children; }

Target:
private List<DiskImage> createChildSnapshots(List<DiskImage> parentSnapshots) { return parentSnapshots .stream() .map(parent -> { DiskImage child = createDiskImage(STORAGE_DOMAIN_ID); child.setParentId(parent.getImageId()); return child; }) .collect(Collectors.toList()); }
Source:
public StreamVariantsRequest getStreamVariantsRequest(String variantSetId) { return StreamVariantsRequest.newBuilder() .setVariantSetId(variantSetId) .setReferenceName(referenceName) .setStart(start) .setEnd(end) .build(); }

Target:
StreamVariantsRequest getStreamVariantsRequest(String variantSetId) { return StreamVariantsRequest.newBuilder() .setVariantSetId(variantSetId) .setReferenceName(referenceName) .setStart(start) .setEnd(end) .build(); }
Source:
private MCompositePart createCompositePart(MPart originalPart) { MCompositePart compPart = ms.createModelElement(MCompositePart.class); compPart.setElementId("Split Host(" + originalPart.getLabel() + ")"); compPart.setLabel(originalPart.getLabel()); compPart.setTooltip(originalPart.getTooltip()); compPart.setIconURI(originalPart.getIconURI()); compPart.setCloseable(true); compPart.setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.splitteraddon.SplitHost"); Object overriddenImage = originalPart.getTransientData().get(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY); if (overriddenImage != null) compPart.getTransientData().put(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY, overriddenImage); compPart.getTags().add(EPartService.REMOVE_ON_HIDE_TAG); return compPart; }

Target:
private MCompositePart createCompositePart(MPart originalPart) { MCompositePart compPart = ms.createModelElement(MCompositePart.class); compPart.setElementId("Split Host(" + originalPart.getLabel() + ")"); compPart.setLabel(originalPart.getLabel()); compPart.setTooltip(originalPart.getTooltip()); compPart.setIconURI(originalPart.getIconURI()); compPart.setCloseable(true); compPart.setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.splitteraddon.SplitHost"); Object overriddenImage = originalPart.getTransientData().get(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY); if (overriddenImage != null) { compPart.getTransientData().put(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY, overriddenImage); } compPart.getTags().add(EPartService.REMOVE_ON_HIDE_TAG); return compPart; }
Source:
protected Optional<DecorrelationResult> visitPlan(PlanNode node, Void context) { return Optional.of(new DecorrelationResult( node, ImmutableSet.of(), ImmutableList.of())); }

Target:
protected Optional<DecorrelationResult> visitPlan(PlanNode node, Void context) { return Optional.of(new DecorrelationResult( node, ImmutableSet.of(), ImmutableList.of(), ImmutableMultimap.of(), false)); }