auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Integer runTest(TestInformation testInfo, ITestInvocationListener listener) throws DeviceNotAvailableException { mTestDevice = testInfo.getDevice(); Assert.assertNotNull(mTestDevice); Integer batteryLevel = checkBatteryLevel(mTestDevice); if (batteryLevel == null) { CLog.w("Failed to determine battery level for device %s.", mTestDevice.getSerialNumber()); listener.testFailed( mTestDescription, FailureDescription.create("Failed to determine battery level")); return null; } else if (batteryLevel < mMaxBattery) { CLog.w("Battery level %d is below the min level %d; holding for device %s to charge " + "to level %d", batteryLevel, mMaxBattery, mTestDevice.getSerialNumber(), mResumeLevel); } else { CLog.d("Battery level %d is above the minimum of %d; %s is good to go.", batteryLevel, mMaxBattery, mTestDevice.getSerialNumber()); return null; } if (mRebootChargeDevices) { CLog.d("Rebooting device %s prior to holding", mTestDevice.getSerialNumber()); mTestDevice.reboot(); } turnScreenOff(mTestDevice); Integer finalBattery = null; try { if (mStopRuntime) { stopDeviceRuntime(); } if (mStopLogcat) { mTestDevice.stopLogcat(); } finalBattery = runBatteryCharging(listener, mTestDescription); } finally { if (mStopRuntime) { startDeviceRuntime(); } } CLog.i( "Device %s is now charged to battery level %d; releasing.", mTestDevice.getSerialNumber(), batteryLevel); if (finalBattery != null) { return finalBattery - batteryLevel; } return null; }

Target:
private Integer runTest(TestInformation testInfo, ITestInvocationListener listener) throws DeviceNotAvailableException { mTestDevice = testInfo.getDevice(); Assert.assertNotNull(mTestDevice); Integer batteryLevel = checkBatteryLevel(mTestDevice); if (batteryLevel == null) { CLog.w("Failed to determine battery level for device %s.", mTestDevice.getSerialNumber()); listener.testFailed( mTestDescription, FailureDescription.create("Failed to determine battery level")); return null; } else if (batteryLevel < mMaxBattery) { CLog.w("Battery level %d is below the min level %d; holding for device %s to charge " + "to level %d", batteryLevel, mMaxBattery, mTestDevice.getSerialNumber(), mResumeLevel); } else { CLog.d("Battery level %d is above the minimum of %d; %s is good to go.", batteryLevel, mMaxBattery, mTestDevice.getSerialNumber()); return IGNORE_CHARGE; } if (mRebootChargeDevices) { CLog.d("Rebooting device %s prior to holding", mTestDevice.getSerialNumber()); mTestDevice.reboot(); } turnScreenOff(mTestDevice); Integer finalBattery = null; try { if (mStopRuntime) { stopDeviceRuntime(); } if (mStopLogcat) { mTestDevice.stopLogcat(); } finalBattery = runBatteryCharging(listener, mTestDescription); } finally { if (mStopRuntime) { startDeviceRuntime(); } } CLog.i( "Device %s is now charged to battery level %d; releasing.", mTestDevice.getSerialNumber(), batteryLevel); if (finalBattery != null) { return finalBattery - batteryLevel; } return null; }
Source:
public OpenShiftExplorerContentProvider() { listener = new IElementListener() { @Override public void elementChanged(IOpenshiftUIElement<?, ?> element) { if (element instanceof OpenshiftUIModel) { refreshViewer(ConnectionsRegistrySingleton.getInstance()); } else { refreshViewer(element); } if (element.getWrapped() instanceof IRoute) { viewer.update(element.getParent(), null); } } }; model.addListener(listener); }

Target:
public OpenShiftExplorerContentProvider() { this(OpenshiftUIModel.getInstance()); }
Source:
public void testGenerateAndConsolidateTokens() { String tenantID = "111111"; String metricName = "a.b.c.d"; Locator locator = Locator.createLocatorFromPathComponents(tenantID, metricName); List<List<IMetric>> batch = new ArrayList<>(); batch.add(Arrays.asList(new Metric(locator, 1, 1L, new TimeValue(5, TimeUnit.SECONDS), ""))); Set<Token> tokens = TokenDiscoveryWriter.generateAndConsolidateTokens(TokenDiscoveryWriter.getLocators(batch)); assertEquals("Invalid number of tokens", locator.getMetricName().split("\\.").length, tokens.size()); }

Target:
public void testGenerateAndConsolidateTokens() { String tenantID = "111111"; String metricName = "a.b.c.d"; Locator locator = Locator.createLocatorFromPathComponents(tenantID, metricName); List<List<IMetric>> batch = new ArrayList<>(); batch.add(Arrays.asList(new Metric(locator, 1, 1L, new TimeValue(5, TimeUnit.SECONDS), ""))); Set<Token> tokens = TokenDiscoveryWriter.getUniqueTokens(TokenDiscoveryWriter.getLocators(batch)); assertEquals("Invalid number of tokens", locator.getMetricName().split(Locator.METRIC_TOKEN_SEPARATOR_REGEX).length, tokens.size()); }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { Set<PermissionSubject> permissionSet = new HashSet<>(); for (Guid storageId : imageToDestinationDomainMap.values()) { permissionSet.add(new PermissionSubject(storageId, VdcObjectType.Storage, getActionType().getActionGroup())); } if (getClusterId() != null) { permissionSet.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CREATE_VM)); } return new ArrayList<>(permissionSet); }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<>(); permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CREATE_VM)); return permissionList; }
Source:
public boolean equals(Object o) { if (!(o instanceof OSCoreCtx)) { return false; } OSCoreCtx other = (OSCoreCtx) o; return other.sender_id.equals(sender_id) && other.recipient_id.equals(recipient_id); }

Target:
public boolean equals(Object o) { if (!(o instanceof OSCoreCtx)) { return false; } OSCoreCtx other = (OSCoreCtx) o; return Arrays.equals(other.sender_id, sender_id) && Arrays.equals(other.recipient_id, recipient_id); }
Source:
public void prepareRun(StageSubmitterContext context) throws Exception { config.validate(context.getInputSchema(), context.getFailureCollector()); }

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { FailureCollector failureCollector = context.getFailureCollector(); config.validate(context.getInputSchema(), failureCollector); failureCollector.getOrThrowException(); }
Source:
protected void addToOutgoingQueue(StreamsDatum datum) throws InterruptedException{ if(this.outQueues.size() == 1) { outQueues.get(0).put(datum); } else { StreamsDatum newDatum = null; List<BlockingQueue<StreamsDatum>> failedQueues = Lists.newLinkedList(); for(BlockingQueue<StreamsDatum> queue : this.outQueues) { try { newDatum = cloneStreamsDatum(datum); if(newDatum != null) { if(!queue.offer(newDatum, 500, TimeUnit.MILLISECONDS)) { failedQueues.add(queue); } } } catch (RuntimeException e) { LOGGER.debug("Failed to add StreamsDatum to outgoing queue : {}", datum); LOGGER.error("Exception while offering StreamsDatum to outgoing queue: {}", e); } } for(BlockingQueue<StreamsDatum> queue : failedQueues) { try { newDatum = cloneStreamsDatum(datum); if(newDatum != null) { queue.put(newDatum); } } catch (RuntimeException e) { LOGGER.debug("Failed to add StreamsDatum to outgoing queue : {}", datum); LOGGER.error("Exception while offering StreamsDatum to outgoing queue: {}", e); } } } }

Target:
protected void addToOutgoingQueue(StreamsDatum datum) throws InterruptedException{ if(this.outQueues.size() == 1) { outQueues.get(0).put(datum); } else { List<BlockingQueue<StreamsDatum>> toOutput = Lists.newLinkedList(this.outQueues); while(!toOutput.isEmpty()) { for (BlockingQueue<StreamsDatum> queue : toOutput) { StreamsDatum newDatum = cloneStreamsDatum(datum); if (newDatum != null) { if (queue.offer(newDatum, 500, TimeUnit.MILLISECONDS)) { toOutput.remove(queue); } } } } } }
Source:
private static int computeBufferCount(PartitioningHandle partitioning, int defaultConcurrency, List<Integer> partitionChannels) { int bufferCount; if (partitioning.equals(SINGLE_DISTRIBUTION)) { bufferCount = 1; checkArgument(partitionChannels.isEmpty(), "Gather exchange must not have partition channels"); } else if (partitioning.equals(FIXED_BROADCAST_DISTRIBUTION)) { bufferCount = defaultConcurrency; checkArgument(partitionChannels.isEmpty(), "Broadcast exchange must not have partition channels"); } else if (partitioning.equals(FIXED_ARBITRARY_DISTRIBUTION)) { bufferCount = defaultConcurrency; checkArgument(partitionChannels.isEmpty(), "Arbitrary exchange must not have partition channels"); } else if (partitioning.equals(FIXED_PASSTHROUGH_DISTRIBUTION)) { bufferCount = defaultConcurrency; checkArgument(partitionChannels.isEmpty(), "Passthrough exchange must not have partition channels"); } else { bufferCount = defaultConcurrency; } return bufferCount; }

Target:
private static int computeBufferCount(PartitioningHandle partitioning, int defaultConcurrency, List<Integer> partitionChannels) { int bufferCount; if (partitioning.equals(SINGLE_DISTRIBUTION)) { bufferCount = 1; checkArgument(partitionChannels.isEmpty(), "Gather exchange must not have partition channels"); } else if (partitioning.equals(FIXED_BROADCAST_DISTRIBUTION)) { bufferCount = defaultConcurrency; checkArgument(partitionChannels.isEmpty(), "Broadcast exchange must not have partition channels"); } else if (partitioning.equals(FIXED_ARBITRARY_DISTRIBUTION)) { bufferCount = defaultConcurrency; checkArgument(partitionChannels.isEmpty(), "Arbitrary exchange must not have partition channels"); } else if (partitioning.equals(FIXED_PASSTHROUGH_DISTRIBUTION)) { bufferCount = defaultConcurrency; checkArgument(partitionChannels.isEmpty(), "Passthrough exchange must not have partition channels"); } else if (partitioning.equals(FIXED_HASH_DISTRIBUTION) || partitioning.getConnectorId().isPresent()) { bufferCount = defaultConcurrency; } else { throw new IllegalArgumentException("Unsupported local exchange partitioning " + partitioning); } return bufferCount; }
Source:
private static void handleLaunchArguments(String[] args) { Path homePath = null; for (String arg : args) { boolean recognized = true; if (arg.startsWith(USE_SPECIFIED_DIR_AS_HOME)) { homePath = Paths.get(arg.substring(USE_SPECIFIED_DIR_AS_HOME.length())); } else if (arg.equals(USE_CURRENT_DIR_AS_HOME)) { homePath = Paths.get(""); } else if (arg.equals(START_HEADLESS)) { isHeadless = true; crashReportEnabled = false; splashEnabled = false; soundEnabled = false; } else if (arg.equals(NO_SAVE_GAMES)) { System.setProperty(SystemConfig.SAVED_GAMES_ENABLED_PROPERTY, "false"); } else if (arg.equals(NO_CRASH_REPORT)) { crashReportEnabled = false; } else if (arg.equals(NO_SOUND)) { soundEnabled = false; } else if (arg.equals(NO_SPLASH)) { splashEnabled = false; } else if (arg.equals(LOAD_LAST_GAME)) { loadLastGame = true; } else if (arg.startsWith(SERVER_PORT)) { System.setProperty(ConfigurationSubsystem.SERVER_PORT_PROPERTY, arg.substring(SERVER_PORT.length())); } else if (arg.startsWith(OVERRIDE_DEFAULT_CONFIG)) { System.setProperty(Config.PROPERTY_OVERRIDE_DEFAULT_CONFIG, arg.substring(OVERRIDE_DEFAULT_CONFIG.length())); } else { recognized = false; } System.out.println((recognized ? "Recognized" : "Invalid") + " argument: " + arg); } try { if (homePath != null) { PathManager.getInstance().useOverrideHomePath(homePath); } else { PathManager.getInstance().useDefaultHomePath(); } } catch (IOException e) { reportException(e); System.exit(0); } }

Target:
private static void handleLaunchArguments(String[] args) { Path homePath = null; for (String arg : args) { boolean recognized = true; if (arg.startsWith(USE_SPECIFIED_DIR_AS_HOME)) { homePath = Paths.get(arg.substring(USE_SPECIFIED_DIR_AS_HOME.length())); } else if (arg.equals(USE_CURRENT_DIR_AS_HOME)) { homePath = Paths.get(""); } else if (arg.equals(START_HEADLESS)) { isHeadless = true; crashReportEnabled = false; splashEnabled = false; } else if (arg.equals(NO_SAVE_GAMES)) { System.setProperty(SystemConfig.SAVED_GAMES_ENABLED_PROPERTY, "false"); } else if (arg.equals(NO_CRASH_REPORT)) { crashReportEnabled = false; } else if (arg.equals(NO_SOUND)) { soundEnabled = false; } else if (arg.equals(NO_SPLASH)) { splashEnabled = false; } else if (arg.equals(LOAD_LAST_GAME)) { loadLastGame = true; } else if (arg.startsWith(SERVER_PORT)) { System.setProperty(ConfigurationSubsystem.SERVER_PORT_PROPERTY, arg.substring(SERVER_PORT.length())); } else if (arg.startsWith(OVERRIDE_DEFAULT_CONFIG)) { System.setProperty(Config.PROPERTY_OVERRIDE_DEFAULT_CONFIG, arg.substring(OVERRIDE_DEFAULT_CONFIG.length())); } else { recognized = false; } System.out.println((recognized ? "Recognized" : "Invalid") + " argument: " + arg); } try { if (homePath != null) { PathManager.getInstance().useOverrideHomePath(homePath); } else { PathManager.getInstance().useDefaultHomePath(); } } catch (IOException e) { reportException(e); System.exit(0); } }
Source:
void localize() { applicationTitle.setText(dynamicMessages.applicationTitle()); copyrightNotice.setText(dynamicMessages.copyRightNotice()); versionLabel.setText(dynamicMessages.ovirtVersionAbout()); userNameLabel.setText(constants.userNameAboutLabel()); }

Target:
void localize() { applicationTitle.setText(dynamicMessages.applicationTitle()); copyrightNotice.setText(dynamicMessages.copyRightNotice()); versionLabel.setText(dynamicMessages.ovirtVersionAbout()); }
Source:
protected void refreshASTSettingsActions() { boolean enabled; switch (getCurrentInputKind()) { case ASTInputKindAction.USE_CACHE: enabled= false; break; default: enabled= true; break; } fCreateBindingsAction.setEnabled(enabled && getCurrentInputKind() != ASTInputKindAction.USE_RECONCILE); fStatementsRecoveryAction.setEnabled(enabled); fBindingsRecoveryAction.setEnabled(enabled); fIgnoreMethodBodiesAction.setEnabled(enabled); for (ASTView.ASTLevelToggle astVersionToggleAction : fASTVersionToggleActions) { astVersionToggleAction.setEnabled(enabled); } }

Target:
protected void refreshASTSettingsActions() { boolean enabled; switch (getCurrentInputKind()) { case ASTInputKindAction.USE_CACHE: enabled= false; break; default: enabled= true; break; } fCreateBindingsAction.setEnabled(enabled && getCurrentInputKind() != ASTInputKindAction.USE_RECONCILE); fStatementsRecoveryAction.setEnabled(enabled); fBindingsRecoveryAction.setEnabled(enabled); fIgnoreMethodBodiesAction.setEnabled(enabled); for (ASTView.ASTLevelToggle action : fASTVersionToggleActions) { action.setEnabled(enabled); } }
Source:
protected void updateAlarmTimeOnBind() { long dueTime = getNextAlarmDueElapsedTime(); long newDueTime = dueTime - (getUnboundIntervalInSeconds() * MILLISECONDS_IN_SECOND) + (getBoundIntervalInSeconds() * MILLISECONDS_IN_SECOND) - SystemClock.elapsedRealtime(); setNextAlarmDue(newDueTime); }

Target:
private void updateAlarmTimeOnBind() { long dueTime = getNextAlarmDueElapsedTime(); long newDueTime = dueTime - (getUnboundIntervalInSeconds() * MILLISECONDS_IN_SECOND) + (getBoundIntervalInSeconds() * MILLISECONDS_IN_SECOND) - SystemClock.elapsedRealtime(); setNextAlarmDue(newDueTime); }
Source:
public static AuthenticationToken getTokenFromFile(Configuration conf, String principal, String tokenFile) { FSDataInputStream in = null; try { URI[] uris = DistributedCacheHelper.getCacheFiles(conf); Path path = null; File tempFile = new File(ConfiguratorBase.tokenFileName); if (tempFile.exists()) { path = new Path(ConfiguratorBase.tokenFileName); } if (path == null && uris != null) for (URI u : uris) { if (u.toString().equals(tokenFile)) { path = new Path(u); break; } else if (u.toString().replace("#" + ConfiguratorBase.tokenFileName, "") .equals(tokenFile)) { path = new Path(u.toString().replace("#" + ConfiguratorBase.tokenFileName, "")); break; } } if (path == null) { throw new IllegalArgumentException( "Couldn't find password file called \"" + tokenFile + "\"or default in cache."); } FileSystem fs = FileSystem.get(conf); in = fs.open(path); } catch (IOException e) { throw new IllegalArgumentException( "Couldn't open password file called \"" + tokenFile + "\"."); } try (java.util.Scanner fileScanner = new java.util.Scanner(in)) { while (fileScanner.hasNextLine()) { Credentials creds = Credentials.deserialize(fileScanner.nextLine()); if (principal.equals(creds.getPrincipal())) { return creds.getToken(); } } throw new IllegalArgumentException( "Couldn't find token for user \"" + principal + "\" in file \"" + tokenFile + "\""); } }

Target:
public static AuthenticationToken getTokenFromFile(Configuration conf, String principal, String tokenFile) { FSDataInputStream in = null; try { Path path; File tempFile = new File(ConfiguratorBase.cachedFileName); if (tempFile.exists()) { path = new Path(ConfiguratorBase.cachedFileName); } else { path = new Path(tokenFile); } if (path == null) { throw new IllegalArgumentException("Couldn't find password file called \"" + tokenFile + "\" in the distributed cache or the specified path in the distributed filesystem."); } FileSystem fs = FileSystem.get(conf); in = fs.open(path); } catch (IOException e) { throw new IllegalArgumentException( "Couldn't open password file called \"" + tokenFile + "\"."); } try (java.util.Scanner fileScanner = new java.util.Scanner(in)) { while (fileScanner.hasNextLine()) { Credentials creds = Credentials.deserialize(fileScanner.nextLine()); if (principal.equals(creds.getPrincipal())) { return creds.getToken(); } } throw new IllegalArgumentException( "Couldn't find token for user \"" + principal + "\" in file \"" + tokenFile + "\""); } }
Source:
Map getNumaNodeMemFreeMap(int memFree, String memUsed) { int memFreePerNode = memFree / NUMBER_OF_NUMA_NODES; Map numaFreeMemMap = map(); numaFreeMemMap.put("memFree", Integer.valueOf(memFreePerNode)); numaFreeMemMap.put("memPercent", memUsed); Map numaNodeMemFreeMap = map(); numaNodeMemFreeMap.put("0", numaFreeMemMap); numaNodeMemFreeMap.put("1", numaFreeMemMap); return numaNodeMemFreeMap; }

Target:
Map getNumaNodeMemFreeMap(int memFree, String memUsed) { double memFreePerNode = ((double) memFree) / NUMBER_OF_NUMA_NODES; int nodeZeroMemFree = (int) Math.floor(memFreePerNode); int nodeOneMemFree = (int) Math.ceil(memFreePerNode); Map nodeZeroNumaFreeMemMap = map(); nodeZeroNumaFreeMemMap.put("memFree", Integer.valueOf(nodeZeroMemFree)); nodeZeroNumaFreeMemMap.put("memPercent", memUsed); Map nodeOneNumaFreeMemMap = map(); nodeOneNumaFreeMemMap.put("memFree", Integer.valueOf(nodeOneMemFree)); nodeOneNumaFreeMemMap.put("memPercent", memUsed); Map numaNodeMemFreeMap = map(); numaNodeMemFreeMap.put("0", nodeZeroNumaFreeMemMap); numaNodeMemFreeMap.put("1", nodeOneNumaFreeMemMap); return numaNodeMemFreeMap; }
Source:
private void addCostFunction(CostFunction costFunction) { if (costFunction.getMultiplier() <= 0) { LOG.info("exclude cost function {}", costFunction.getClass().getSimpleName()); } else { costFunctions.add(costFunction); } }

Target:
private void addCostFunction(CostFunction costFunction) { if (costFunction.getMultiplier() > 0) { costFunctions.add(costFunction); } }
Source:
private String readFailure( File failureFile ) throws IOException { try ( StoreChannel channel = fs.open( failureFile, OpenMode.READ ) ) { byte[] data = new byte[(int) channel.size()]; channel.read( ByteBuffer.wrap( data ) ); return UTF8.decode( withoutZeros( data ) ); } }

Target:
private String readFailure( File failureFile ) throws IOException { try ( StoreChannel channel = fs.open( failureFile, OpenMode.READ ) ) { byte[] data = new byte[(int) channel.size()]; channel.readAll( ByteBuffer.wrap( data ) ); return UTF8.decode( withoutZeros( data ) ); } }
Source:
public void removeHeaderFooterComponentWhenColumnIsRemoved() { HeaderRow h1 = grid.prependHeaderRow(); FooterRow f1 = grid.addFooterRowAt(0); Button headerButton = new Button("This one will be an orthan"); Button footerButton = new Button("This one will be an orthan"); h1.getCell("foo").setComponent(headerButton); f1.getCell("foo").setComponent(footerButton); Assert.assertEquals(grid, headerButton.getParent()); Assert.assertEquals(grid, footerButton.getParent()); grid.removeColumn("foo"); Assert.assertNull(headerButton.getParent()); Assert.assertNull(footerButton.getParent()); }

Target:
public void removeHeaderFooterComponentWhenColumnIsRemoved() { HeaderRow h1 = grid.prependHeaderRow(); FooterRow f1 = grid.addFooterRowAt(0); Button headerButton = new Button("This is a button, mkay?"); Button footerButton = new Button("This is a button, mkay?"); h1.getCell("foo").setComponent(headerButton); f1.getCell("foo").setComponent(footerButton); Assert.assertEquals(grid, headerButton.getParent()); Assert.assertEquals(grid, footerButton.getParent()); grid.removeColumn("foo"); Assert.assertNull(headerButton.getParent()); Assert.assertNull(footerButton.getParent()); }
Source:
public void loadEnvironmentConfig() { ConfigurationStrategy strategy = new ConfigurationEnvironmentStrategy(); Map<ConfigurationKey, String> conf = strategy.loadConfiguration(); assertThat(conf).isEmpty(); strategy = new ConfigurationEnvironmentStrategy(getMapForEnv()); conf = strategy.loadConfiguration(); assertThat(conf.isEmpty()).isFalse(); assertThat(strategy.isValid()).isTrue(); assertThat(conf.keySet()).hasSize(14); }

Target:
public void loadEnvironmentConfig() { ConfigurationStrategy strategy = new ConfigurationEnvironmentStrategy(); Map<ConfigurationKey, String> conf = strategy.loadConfiguration(); assertThat(conf).isEmpty(); strategy = new ConfigurationEnvironmentStrategy(getMapForEnv()); conf = strategy.loadConfiguration(); assertThat(conf).isNotEmpty(); assertThat(strategy.isValid()).isTrue(); assertThat(conf.keySet()).hasSize(14); }
Source:
protected SpawnResult actuallyExec(Spawn spawn, SpawnExecutionContext context) throws IOException, ExecException, InterruptedException { Path sandboxPath = sandboxBase.getRelative(getName()).getRelative(Integer.toString(context.getId())); sandboxPath.getParentDirectory().createDirectory(); sandboxPath.createDirectory(); Path sandboxExecRoot = sandboxPath.getRelative("execroot").getRelative(execRoot.getBaseName()); sandboxExecRoot.getParentDirectory().createDirectory(); sandboxExecRoot.createDirectory(); Map<String, String> environment = localEnvProvider.rewriteLocalEnv(spawn.getEnvironment(), binTools, "/tmp"); ImmutableSet<Path> writableDirs = getWritableDirs(sandboxExecRoot, environment); SandboxOutputs outputs = SandboxHelpers.getOutputs(spawn); Duration timeout = context.getTimeout(); WindowsSandboxUtil.CommandLineBuilder commandLineBuilder = WindowsSandboxUtil.commandLineBuilder(windowsSandbox, spawn.getArguments()) .setWritableFilesAndDirectories(writableDirs) .setUseDebugMode(getSandboxOptions().sandboxDebug) .setKillDelay(timeoutKillDelay); if (!timeout.isZero()) { commandLineBuilder.setTimeout(timeout); } Path statisticsPath = null; SandboxedSpawn sandbox = new WindowsSandboxedSpawn( sandboxPath, sandboxExecRoot, commandLineBuilder.build(), environment, SandboxHelpers.processInputFiles( spawn, context, execRoot, getSandboxOptions().symlinkedSandboxExpandsTreeArtifactsInRunfilesTree), outputs, writableDirs, treeDeleter); return runSpawn(spawn, sandbox, context, execRoot, timeout, statisticsPath); }

Target:
protected SpawnResult actuallyExec(Spawn spawn, SpawnExecutionContext context) throws IOException, ExecException, InterruptedException { Path sandboxPath = sandboxBase.getRelative(getName()).getRelative(Integer.toString(context.getId())); sandboxPath.createDirectoryAndParents(); Path sandboxExecRoot = sandboxPath.getRelative("execroot").getRelative(execRoot.getBaseName()); sandboxExecRoot.createDirectoryAndParents(); Path tmpDir = createActionTemp(execRoot); Path commandTmpDir = tmpDir.getRelative("work"); commandTmpDir.createDirectory(); Map<String, String> environment = localEnvProvider.rewriteLocalEnv(spawn.getEnvironment(), binTools, commandTmpDir.getPathString()); ImmutableSet<Path> writableDirs = getWritableDirs(sandboxExecRoot, environment); SandboxOutputs outputs = SandboxHelpers.getOutputs(spawn); Duration timeout = context.getTimeout(); WindowsSandboxUtil.CommandLineBuilder commandLineBuilder = WindowsSandboxUtil.commandLineBuilder(windowsSandbox, spawn.getArguments()) .setWritableFilesAndDirectories(writableDirs) .setUseDebugMode(getSandboxOptions().sandboxDebug) .setKillDelay(timeoutKillDelay); if (!timeout.isZero()) { commandLineBuilder.setTimeout(timeout); } Path statisticsPath = null; SandboxedSpawn sandbox = new CopyingSandboxedSpawn( sandboxPath, sandboxExecRoot, commandLineBuilder.build(), environment, SandboxHelpers.processInputFiles( spawn, context, execRoot, getSandboxOptions().symlinkedSandboxExpandsTreeArtifactsInRunfilesTree), outputs, writableDirs, treeDeleter); return runSpawn(spawn, sandbox, context, execRoot, timeout, statisticsPath); }
Source:
AmqpMessageBody() { }

Target:
private AmqpMessageBody() { }
Source:
protected List<SPMAsyncTaskHandler> initTaskHandlers() { List<SPMAsyncTaskHandler> taskHandlers = new ArrayList<>(); if (getParameters().getImageIds() == null) { List<DiskImage> images = getAllImagesForDisk(); ImagesHandler.sortImageList(images); List<DiskImage> sortedImages = LinqUtils.filter(images, new Predicate<DiskImage>() { @Override public boolean eval(DiskImage image) { return getImages().contains(image); } }); getParameters().setImageIds(new ArrayList<>(ImagesHandler.getDiskImageIds(sortedImages))); } for (Guid imageId : getParameters().getImageIds()) { taskHandlers.add(new RemoveDiskSnapshotTaskHandler(this, imageId, getImageGroupId(), getVmId())); } return taskHandlers; }

Target:
protected List<SPMAsyncTaskHandler> initTaskHandlers() { List<SPMAsyncTaskHandler> taskHandlers = new ArrayList<>(); if (!getParameters().isImageIdsSorted()) { List<DiskImage> images = getAllImagesForDisk(); ImagesHandler.sortImageList(images); List<DiskImage> sortedImages = LinqUtils.filter(images, new Predicate<DiskImage>() { @Override public boolean eval(DiskImage image) { return getImages().contains(image); } }); getParameters().setImageIds(new ArrayList<>(ImagesHandler.getDiskImageIds(sortedImages))); getParameters().setImageIdsSorted(true); } for (Guid imageId : getParameters().getImageIds()) { taskHandlers.add(new RemoveDiskSnapshotTaskHandler(this, imageId, getImageGroupId(), getVmId())); } return taskHandlers; }
Source:
public void stop(JobInstance jobInstance) throws Exception { JobStatus currentStatus = getJobSamzaStatus(jobInstance); if (!currentStatus.hasBeenStarted()) { log.info("Job will not be stopped because it is currently {}.", jobInstance, currentStatus.toString()); return; } String scriptPath = getScriptPath(jobInstance, STOP_SCRIPT_NAME); int resultCode = scriptRunner.runScript(scriptPath, YarnRestJobStatusProvider.getQualifiedJobName(jobInstance)); if (resultCode != 0) { throw new SamzaException("Failed to stop job. Result code: " + resultCode); } }

Target:
public void stop(JobInstance jobInstance) throws Exception { JobStatus currentStatus = getJobSamzaStatus(jobInstance); if (!currentStatus.hasBeenStarted()) { log.info("Job will not be stopped because it is currently {}.", jobInstance, currentStatus.toString()); return; } String scriptPath = getScriptPath(jobInstance, STOP_SCRIPT_NAME); int resultCode = scriptRunner.runScript(scriptPath, YarnApplicationInfo.getQualifiedJobName(jobInstance)); if (resultCode != 0) { throw new SamzaException("Failed to stop job. Result code: " + resultCode); } }
Source:
private static InsnNode simplifyOneArgConsecutive(InsnNode insn1, InsnNode insn2, ArithNode modInsn) { if (insn1.getType() == InsnType.IGET && insn2.getArg(1).equals(insn1.getResult())) { FieldInfo field = (FieldInfo) ((IndexInsnNode) insn2).getIndex(); FieldArg fArg = new FieldArg(field, new InsnWrapArg(insn1)); return new ArithNode(modInsn.getOp(), fArg, modInsn.getArg(1)); } return null; }

Target:
private static InsnNode simplifyOneArgConsecutive(InsnNode insn1, InsnNode insn2, ArithNode modInsn) { if (insn1.getType() == InsnType.IGET && insn2.getType() == InsnType.IPUT && insn1.getResult().getSVar().getUseCount() == 2 && insn2.getArg(1).equals(insn1.getResult())) { FieldInfo field = (FieldInfo) ((IndexInsnNode) insn2).getIndex(); FieldArg fArg = new FieldArg(field, new InsnWrapArg(insn1)); return new ArithNode(modInsn.getOp(), fArg, modInsn.getArg(1)); } return null; }
Source:
public static void runFinalization() { boolean shouldRunGC; synchronized(lock) { shouldRunGC = runGC; runGC = false; } if (shouldRunGC) { Runtime.getRuntime().gc(); } Runtime.getRuntime().runFinalization(); justRanFinalization = true; }

Target:
public static void runFinalization() { boolean shouldRunGC; synchronized(lock) { shouldRunGC = runGC; runGC = false; } if (shouldRunGC) { Runtime.getRuntime().gc(); } Runtime.getRuntime().runFinalization(); synchronized(lock) { justRanFinalization = true; } }
Source:
public int hashCode() { return inputOffsets != null ? inputOffsets.hashCode() : 0; }

Target:
public int hashCode() { return Objects.hash(checkpointId, inputOffsets, stateCheckpoints); }
Source:
public void delete(OmCalendar c) { c.setDeleted(true); List<Appointment> appointments = appointmentDao.getAppointmentsinCalendar(c.getId()); for (Appointment appointment : appointments) appointmentDao.delete(appointment, appointment.getOwner().getId()); update(c); }

Target:
public void delete(OmCalendar c) { c.setDeleted(true); appointmentDao.deletebyCalendar(c.getId()); update(c); }
Source:
private boolean isAboutToExpire(Date expires) { Date validity = getTokenValidityTime().getTime(); return (expires != null && expires.before(validity)); }

Target:
private boolean isAboutToExpire(Date expires) { Date validity = getTokenValidityTime().getTime(); return expires != null && expires.before(validity); }
Source:
public Flux<Message> getDeliveredMessages() { return messages; }

Target:
public Flux<Delivery> getDeliveredMessages() { return deliveries .doOnNext(this::removeQueuedDelivery); }
Source:
public void testIllegalState() { final DetailAST init = new DetailAST(); init.setType(TokenTypes.STATIC_INIT); final DetailAST objBlock = new DetailAST(); objBlock.setType(TokenTypes.OBJBLOCK); objBlock.addChild(init); final DetailAST iface = new DetailAST(); iface.setType(TokenTypes.INTERFACE_DEF); iface.addChild(objBlock); final InterfaceMemberImpliedModifierCheck check = new InterfaceMemberImpliedModifierCheck(); try { check.visitToken(init); Assert.fail("IllegalStateException is expected"); } catch (IllegalStateException ex) { assertEquals("Error message is unexpected", init.toString(), ex.getMessage()); } }

Target:
public void testIllegalState() { final DetailAST init = new DetailAST(); init.setType(TokenTypes.STATIC_INIT); final DetailAST objBlock = new DetailAST(); objBlock.setType(TokenTypes.OBJBLOCK); objBlock.addChild(init); final DetailAST interfaceAst = new DetailAST(); interfaceAst.setType(TokenTypes.INTERFACE_DEF); interfaceAst.addChild(objBlock); final InterfaceMemberImpliedModifierCheck check = new InterfaceMemberImpliedModifierCheck(); try { check.visitToken(init); Assert.fail("IllegalStateException is expected"); } catch (IllegalStateException ex) { assertEquals("Error message is unexpected", init.toString(), ex.getMessage()); } }
Source:
private boolean isValidAttributes(RepositoryNode node, IElement elem) { if (node == null) { return true; } HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(node.getId()); DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution( hcConnection.getDistribution(), false); if (elem != null) { if ((elem.getClass().getName().contains("MapReduceProcess")) && "Cloudera_CDH580_Spark2".equals(hcConnection.getDfVersion())) { return false; } } if (attributesMap != null && !attributesMap.isEmpty()) { if (hcConnection != null) { if (hadoopDistribution != null) { DistributionVersion distributionVersion = hadoopDistribution.getVersion(hcConnection.getDfVersion(), false); if (distributionVersion != null && distributionVersion.hadoopComponent != null) { boolean validated = true; Object isSpark = attributesMap.get(ISSPARK); if (isSpark != null && Boolean.valueOf(isSpark.toString())) { validated = (validated && distributionVersion.hadoopComponent instanceof SparkComponent); if (!validated) { return false; } } Object useYarn = attributesMap.get(USEYARN); if (useYarn != null && Boolean.valueOf(useYarn.toString())) { validated = (validated && distributionVersion.hadoopComponent.isHadoop2()); if (!validated) { return false; } } } } } } return true; }

Target:
private boolean isValidAttributes(RepositoryNode node, IElement elem) { if (node == null) { return true; } HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(node.getId()); DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false); if ((elem != null) && (elem instanceof org.talend.designer.core.ui.editor.process.Process)) { if ((ComponentCategory.CATEGORY_4_MAPREDUCE.getName() .equals(((org.talend.designer.core.ui.editor.process.Process) elem).getComponentsType())) && "Cloudera_CDH580_Spark2".equals(hcConnection.getDfVersion())) { return false; } } if (attributesMap != null && !attributesMap.isEmpty()) { if (hcConnection != null) { if (hadoopDistribution != null) { DistributionVersion distributionVersion = hadoopDistribution.getVersion(hcConnection.getDfVersion(), false); if (distributionVersion != null && distributionVersion.hadoopComponent != null) { boolean validated = true; Object isSpark = attributesMap.get(ISSPARK); if (isSpark != null && Boolean.valueOf(isSpark.toString())) { validated = (validated && distributionVersion.hadoopComponent instanceof SparkComponent); if (!validated) { return false; } } Object useYarn = attributesMap.get(USEYARN); if (useYarn != null && Boolean.valueOf(useYarn.toString())) { validated = (validated && distributionVersion.hadoopComponent.isHadoop2()); if (!validated) { return false; } } } } } } return true; }
Source:
public Object[][] incorrectContentTestData() { return new Object[][] { {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " true", "Parsing of environment configuration failed. Unsupported type 'class java.lang.Boolean'.*(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " - MYSQL_ROOT_PASSWORD: root\n", "Parsing of environment configuration failed. Unsupported value '\\[\\{MYSQL_ROOT_PASSWORD=root}]'.*(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " MYSQL_ROOT_PASSWORD", "Parsing of environment configuration failed. Unsupported value 'MYSQL_ROOT_PASSWORD'.*(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " - MYSQL_ROOT_PASSWORD=root\n" + " - MYSQL_DATABASE\n", "Parsing of environment configuration failed. Unsupported value 'MYSQL_DATABASE'.*(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " =value ", "Parsing of environment configuration failed. Unsupported value '=value'.*(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " VAR=val=1", "Parsing of environment configuration failed. Unsupported value 'VAR=val=1'.*(?s).*" }, }; }

Target:
public Object[][] incorrectContentTestData() { return new Object[][] { {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " true", "Parsing of environment configuration failed. Unsupported type 'class java.lang.Boolean'\\.(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " - MYSQL_ROOT_PASSWORD: root\n", "Parsing of environment configuration failed. Unsupported value '\\[\\{MYSQL_ROOT_PASSWORD=root}]'\\.(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " MYSQL_ROOT_PASSWORD", "Parsing of environment configuration failed. Unsupported value 'MYSQL_ROOT_PASSWORD'\\.(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " VAR=val=1", "Parsing of environment configuration failed. Unsupported value 'VAR=val=1'\\.(?s).*" }, {"services: \n" + " dev-machine: \n" + " image: codenvy/ubuntu_jdk8\n" + " environment:\n" + " - MYSQL_ROOT_PASSWORD=root\n" + " - MYSQL_DATABASE\n", "Parsing of environment configuration failed. Unsupported value 'MYSQL_DATABASE'\\.(?s).*" }, }; }
Source:
public Iterable<Payload> slice(Payload input, long size) { checkNotNull(input); checkArgument(size >= 0, "length is negative"); ContentMetadata meta = BaseMutableContentMetadata.fromContentMetadata(input.getContentMetadata()) .toBuilder() .contentLength(size) .contentMD5(null) .build(); if (input.getRawContent() instanceof File) { return doSlice((File) input.getRawContent(), meta); } else if (input.getRawContent() instanceof String) { return doSlice((String) input.getRawContent(), meta); } else if (input.getRawContent() instanceof byte[]) { return doSlice((byte[]) input.getRawContent(), meta); } else if (input.getRawContent() instanceof InputStream) { return doSlice((InputStream) input.getRawContent(), meta); } else { return doSlice(input, meta); } }

Target:
public Iterable<Payload> slice(Payload input, long size) { checkNotNull(input, "input"); checkArgument(size >= 0, "size must be non-negative but was: %s", size); ContentMetadata meta = BaseMutableContentMetadata.fromContentMetadata(input.getContentMetadata()) .toBuilder() .contentLength(size) .contentMD5(null) .build(); Object rawContent = input.getRawContent(); if (rawContent instanceof File) { return doSlice((File) rawContent, meta); } else if (rawContent instanceof String) { return doSlice((String) rawContent, meta); } else if (rawContent instanceof byte[]) { return doSlice((byte[]) rawContent, meta); } else if (rawContent instanceof InputStream) { return doSlice((InputStream) rawContent, meta); } else { return doSlice(input, meta); } }
Source:
protected Boolean getInvalidConfiguration() { return invalidConfiguration; }

Target:
protected boolean getInvalidConfiguration() { return invalidConfiguration; }
Source:
private double[] getFilteredValues(double[] data) { int rows = (int) getRowCount(); double[] values = new double[rows]; BitSet masked = mask.getMaskedRows(this); int c = 0; for (int i=0; i<(int) plotterTable.getRowCount(); i++) { if (!masked.get(i)) { values[c++] = data[i]; } } return values; }

Target:
private double[] getFilteredValues(double[] data) { int rows = (int) getRowCount(); double[] values = new double[rows]; BitSet masked = mask.getMaskedRows(this); int c = 0; for (int i=0; i<(int) plotterDataTable.getRowCount(); i++) { if (!masked.get(i)) { values[c++] = data[i]; } } return values; }
Source:
void addPreference(String userID, String productID, float score) { reviewCount++; if (!userIDs.containsKey(userID)) userIDs.put(userID, ++userCount); if (!productIDsBi.containsKey(productID)) productIDsBi.put(productID, ++productCount); Long longUserID = userIDs.get(userID); Long longProductID = productIDsBi.get(productID); addPreferenceToUser((GenericUserPreferenceArray) usersPreferences.get(longUserID),new GenericPreference(longUserID, longProductID, score)); }

Target:
private void addPreference(String userID, String productID, float score) { reviewCount++; if (!userIDs.containsKey(userID)) userIDs.put(userID, ++userCount); if (!productIDsBi.containsKey(productID)) productIDsBi.put(productID, ++productCount); Long longUserID = userIDs.get(userID); Long longProductID = productIDsBi.get(productID); addPreferenceToUser((GenericUserPreferenceArray) usersPreferences.get(longUserID),new GenericPreference(longUserID, longProductID, score)); }
Source:
public void initialBlockingBookieRead() throws BKException { synchronized (this) { if (initialReadonlyBookiesFuture == null && initialWritableBookiesFuture == null) { CompletableFuture<?> writable = this.registrationClient.watchWritableBookies( bookies -> processWritableBookiesChanged(bookies.getValue())); CompletableFuture<?> readonly = this.registrationClient.watchReadOnlyBookies( bookies -> processReadOnlyBookiesChanged(bookies.getValue())); initialWritableBookiesFuture = writable; initialReadonlyBookiesFuture = readonly; } } try { FutureUtils.result(initialWritableBookiesFuture, EXCEPTION_FUNC); } catch (BKInterruptedException ie) { Thread.currentThread().interrupt(); throw ie; } try { FutureUtils.result(initialReadonlyBookiesFuture, EXCEPTION_FUNC); } catch (BKInterruptedException ie) { Thread.currentThread().interrupt(); throw ie; } catch (Exception e) { log.error("Failed getReadOnlyBookies: ", e); } }

Target:
public void initialBlockingBookieRead() throws BKException { CompletableFuture<?> writable; CompletableFuture<?> readonly; synchronized (this) { if (initialReadonlyBookiesFuture == null) { assert initialWritableBookiesFuture == null; writable = this.registrationClient.watchWritableBookies( bookies -> processWritableBookiesChanged(bookies.getValue())); readonly = this.registrationClient.watchReadOnlyBookies( bookies -> processReadOnlyBookiesChanged(bookies.getValue())); initialWritableBookiesFuture = writable; initialReadonlyBookiesFuture = readonly; } else { writable = initialWritableBookiesFuture; readonly = initialReadonlyBookiesFuture; } } try { FutureUtils.result(writable, EXCEPTION_FUNC); } catch (BKInterruptedException ie) { Thread.currentThread().interrupt(); throw ie; } try { FutureUtils.result(readonly, EXCEPTION_FUNC); } catch (BKInterruptedException ie) { Thread.currentThread().interrupt(); throw ie; } catch (Exception e) { log.error("Failed getReadOnlyBookies: ", e); } }
Source:
private SelectionListener onAdd(Combo combo) { return new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { String selected = combo.getText(); RegistryAccountDialog dialog = new RegistryAccountDialog( getShell(), WizardMessages.getString( "ImagePullPushPage.login.title"), "index.docker.io", WizardMessages.getString( "RegistryAccountDialog.add.explanation")); if (dialog.open() == Window.OK) { IRegistryAccount acc = dialog.getSignonInformation(); RegistryAccountManager.getInstance().add(acc); selected = acc.getUsername() + "@" + acc.getServerAddress(); } combo.setItems(getAccountComboItems()); combo.setText(selected); } }; }

Target:
private SelectionListener onAdd(Combo combo) { return new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { String selected = combo.getText(); RegistryAccountDialog dialog = new RegistryAccountDialog( getShell(), WizardMessages.getString( "ImagePullPushPage.login.title"), AbstractRegistry.DOCKERHUB_REGISTRY, WizardMessages.getString( "RegistryAccountDialog.add.explanation")); if (dialog.open() == Window.OK) { IRegistryAccount acc = dialog.getSignonInformation(); RegistryAccountManager.getInstance().add(acc); selected = acc.getUsername() + "@" + acc.getServerAddress(); } combo.setItems(getAccountComboItems()); combo.setText(selected); } }; }
Source:
public Builder setChannelTimeoutMs(long timeoutMs) { this.timeoutMs = timeoutMs; return this; }

Target:
public Builder setChannelTimeoutMs(long timeoutMs) { Preconditions.checkArgument(timeoutMs >= -1, "ChannelTimeoutMs has to be positive, or -1 for none."); this.timeoutMs = timeoutMs; return this; }
Source:
public void testNormalizeUserName(String input, String expected) { Assert.assertEquals(validator.normalizeUserName(input), expected); }

Target:
public void testNormalizeUserName(String input, String expected) { Assert.assertEquals(normalizeUserName(input), expected); }
Source:
public void evaluate_shouldReturnAllPatientsThatHaveNeverTakenListedDrugs() throws Exception { List drugSetList = new ArrayList<Concept>(); drugSetList.add(new Concept(88)); drugSetList.add(new Concept(792)); cohortDefinition.setDrugSets(drugSetList); cohortDefinition.setWhich("NONE"); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); System.out.println("Taking Drugs None" + cohort.getMemberIds() + " " + cohortDefinition + "==="); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(2, cohort.size()); }

Target:
public void evaluate_shouldReturnAllPatientsThatHaveNeverTakenListedDrugs() throws Exception { List drugSetList = new ArrayList<Concept>(); drugSetList.add(new Concept(88)); drugSetList.add(new Concept(792)); cohortDefinition.setDrugSets(drugSetList); cohortDefinition.setWhich("NONE"); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(3, cohort.size()); }
Source:
public boolean equals(Object o) { if (o instanceof MITrigger) { MITrigger other = (MITrigger) o; return (null != value) ? value.equals(other.value) : null == other.value; } return false; }

Target:
public boolean equals(Object o) { if (o instanceof MITrigger) { MITrigger other = (MITrigger) o; return Objects.equals(value, other.value); } return false; }
Source:
private MethodSpec createNewBindToTargetMethod() { MethodSpec.Builder result = MethodSpec.methodBuilder(BIND_TO_TARGET) .addModifiers(PROTECTED, STATIC); if (hasMethodBindings()) { result.addParameter(targetTypeName, "target", FINAL); } else { result.addParameter(targetTypeName, "target"); } if (bindNeedsFinder()) { if (hasMethodBindings()) { result.addParameter(FINDER, "finder", FINAL); } else { result.addParameter(FINDER, "finder"); } result.addParameter(Object.class, "source"); } if (bindNeedsResources()) { result.addParameter(RESOURCES, "res"); } if (bindNeedsTheme()) { result.addParameter(THEME, "theme"); } if (bindNeedsUnbinder()) { result.addParameter(getHierarchyUnbinder(), "unbinder"); } generateBindViewBody(result); return result.build(); }

Target:
private MethodSpec createNewBindToTargetMethod() { MethodSpec.Builder result = MethodSpec.methodBuilder(BIND_TO_TARGET) .addModifiers(PROTECTED, STATIC); if (hasMethodBindings()) { result.addParameter(targetTypeName, "target", FINAL); } else { result.addParameter(targetTypeName, "target"); } if (bindNeedsFinder()) { result.addParameter(FINDER, "finder") .addParameter(Object.class, "source"); } if (bindNeedsResources()) { result.addParameter(RESOURCES, "res"); } if (bindNeedsTheme()) { result.addParameter(THEME, "theme"); } generateBindViewBody(result); return result.build(); }
Source:
public List<Field> requiredFields () { return Arrays.stream(fields) .filter(field -> REQUIRED == field.requirement) .collect(Collectors.toList()); }

Target:
public List<Field> requiredFields () { List<Field> requiredFields = new ArrayList<>(); for (Field f : fields) if (f.requirement == REQUIRED) requiredFields.add(f); return requiredFields; }