auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Optional<ByteBuffer> calculateDigest(final DivolteEvent e, final Map<String,Optional<?>> context) { final T messageDigest = digestFactory.get(); final Consumer<ByteBuffer> digestUpdater = digestUpdaterFactory.apply(messageDigest); final Supplier<byte[]> digestFinalizer = digestFinalizerFactory.apply(messageDigest); digestPieces.stream() .map(x -> x.produce(e, context)) .filter(Optional::isPresent) <START> .map(Optional::get) <END> .forEachOrdered(digestUpdater); return Optional.of(ByteBuffer.wrap(digestFinalizer.get())); }</code><technical_language>Java lately, flapMap available</technical_language>

Target:
private Optional<ByteBuffer> calculateDigest(final DivolteEvent e, final Map<String,Optional<?>> context) { final T messageDigest = digestFactory.get(); final Consumer<ByteBuffer> digestUpdater = digestUpdaterFactory.apply(messageDigest); final Supplier<byte[]> digestFinalizer = digestFinalizerFactory.apply(messageDigest); digestPieces.stream() .map(x -> x.produce(e, context)) .flatMap(Streams::stream) .forEachOrdered(digestUpdater); return Optional.of(ByteBuffer.wrap(digestFinalizer.get())); }
Source:
<code><START> public TestAbfsInputStream() throws Exception { <END> super(); }</code><technical_language>needed; cut</technical_language>

Target:
public TestAbfsInputStream() throws Exception { super(); ReadBufferManager.getBufferManager().setThresholdAgeMilliseconds(REDUCED_READ_BUFFER_AGE_THRESHOLD); }
Source:
<code>private static int getSqlType(String dataType) { <START> String dataTypeOriginal = dataType; <END> dataType = normaliseTypeName(dataType); if (stringTypes.contains(dataType)) return java.sql.Types.VARCHAR; if (decimalTypes.contains(dataType)) return java.sql.Types.NUMERIC; if (dateTypes.contains(dataType)) return java.sql.Types.DATE; if (refCursorTypes.contains(dataType)) return OracleTypes.CURSOR; if (timestampTypes.contains(dataType)) return java.sql.Types.TIMESTAMP; throw new UnsupportedOperationException("Type " + dataTypeOriginal + " is not supported"); }</code><technical_language>Indentation is supposed spaces-only</technical_language>

Target:
private static int getSqlType(String dataType) { String dataTypeNormalised = normaliseTypeName(dataType); if (stringTypes.contains(dataTypeNormalised)) return java.sql.Types.VARCHAR; if (decimalTypes.contains(dataTypeNormalised)) return java.sql.Types.NUMERIC; if (dateTypes.contains(dataTypeNormalised)) return java.sql.Types.DATE; if (refCursorTypes.contains(dataTypeNormalised)) return OracleTypes.CURSOR; if (timestampTypes.contains(dataTypeNormalised)) return java.sql.Types.TIMESTAMP; throw new UnsupportedOperationException("Type " + dataType + " is not supported"); }
Source:
<code>protected void commonExecution(final AbstractScenarioSimulationCommand command, final boolean focusGridAfterExecution) { final Optional<GridWidget> gridWidget = context.getSelectedScenarioGridModel().map(AbstractScesimGridModel::getGridWidget); <START> gridWidget.ifPresent(grd -> context.getStatus().setCurrentGrid(grd)); <END> final CommandResult<ScenarioSimulationViolation> status = scenarioCommandManager.execute(context, command); if (Objects.equals(CommandResult.Type.ERROR, status.getType())) { String operation = new StringBuilder() .append("Command ") .append(command.getClass().getSimpleName()) .append(" failure") .toString(); commonNotifyError(status, operation); } else if (Objects.equals(CommandResultBuilder.SUCCESS, status) && (command instanceof AbstractScenarioGridCommand)) { scenarioCommandRegistry.register(context, (AbstractScenarioGridCommand) command); if (focusGridAfterExecution && gridWidget.isPresent()) { context.getScenarioGridPanelByGridWidget(gridWidget.get()).setFocus(true); } } }</code><technical_language>Is empty optional here? Is correct ignore this in case</technical_language>

Target:
protected void commonExecution(final AbstractScenarioSimulationCommand command, final boolean focusGridAfterExecution) { final Optional<AbstractScesimGridModel> selectedScenarioGridModel = context.getSelectedScenarioGridModel(); final Optional<GridWidget> gridWidget = selectedScenarioGridModel.isPresent() ? Optional.of(selectedScenarioGridModel.get().getGridWidget()) : Optional.empty(); gridWidget.ifPresent(grd -> context.getStatus().setCurrentGrid(grd)); final CommandResult<ScenarioSimulationViolation> status = scenarioCommandManager.execute(context, command); if (Objects.equals(CommandResult.Type.ERROR, status.getType())) { String operation = new StringBuilder() .append("Command ") .append(command.getClass().getSimpleName()) .append(" failure") .toString(); commonNotifyError(status, operation); } else if (Objects.equals(CommandResultBuilder.SUCCESS, status) && (command instanceof AbstractScenarioGridCommand)) { scenarioCommandRegistry.register(context, (AbstractScenarioGridCommand) command); if (focusGridAfterExecution && gridWidget.isPresent()) { context.getScenarioGridPanelByGridWidget(gridWidget.get()).setFocus(true); } } }
Source:
<code>public void fill(int stateInt, String startTs, String endTs, String targetDate) throws ParseException { int start; int end; <START> SimpleDateFormat dmy = new SimpleDateFormat("yyy-MM-dd"); <END> Date startDt = dmy.parse(startTs); Date endDt = dmy.parse(endTs); Date targetDt = dmy.parse(targetDate); if (startDt.before(targetDt) && !(( startTs.substring(0, startTs.indexOf("T")).equals(targetDate)))) { start = 0; } else { start = tsInt(startTs); } if (endDt.after(targetDt) && !(( endTs.substring(0, endTs.indexOf("T")).equals(targetDate)))){ end = this.samples.length; } else { end = tsInt(endTs); } for (int i=start;i<end;i++) { this.samples[i] = stateInt; } }</code><technical_language>Is this yyy correct</technical_language>

Target:
public void fill(int stateInt, String startTs, String endTs, String targetDate) throws ParseException { int start; int end; SimpleDateFormat dmy = new SimpleDateFormat("yyyy-MM-dd"); Date startDt = dmy.parse(startTs); Date endDt = dmy.parse(endTs); Date targetDt = dmy.parse(targetDate); if (startDt.before(targetDt) && !(( startTs.substring(0, startTs.indexOf("T")).equals(targetDate)))) { start = 0; } else { start = tsInt(startTs); } if (endDt.after(targetDt) && !(( endTs.substring(0, endTs.indexOf("T")).equals(targetDate)))){ end = this.samples.length; } else { end = tsInt(endTs); } for (int i=start;i<=end;i++) { this.samples[i] = stateInt; } }
Source:
<code>public void enterWildcardTag( @NotNull final se.tre.freki.query.SelectParser.WildcardTagContext ctx) { super.enterWildcardTag(ctx); if (isKey) { isKey = false; futurePredicateList.add(immediateFuture(WildcardTimeSeriesIdPredicate.wildcard())); } else { isKey = true; <START> futurePredicateList.add(immediateFuture(WildcardTimeSeriesIdPredicate.wildcard())); <END> } }</code><technical_language>myBool = !myBool;</technical_language>

Target:
public void enterWildcardTag( @NotNull final se.tre.freki.query.SelectParser.WildcardTagContext ctx) { super.enterWildcardTag(ctx); isKey = !isKey; futurePredicateList.add(immediateFuture(WildcardTimeSeriesIdPredicate.wildcard())); }
Source:
<code>public String getUnmodifiedInstance() { <START> return null; END> }</code><technical_language>suggestion return getInstance();</technical_language>

Target:
public String getUnmodifiedInstance() { return getInstance(); }
Source:
<code>public List<ClientModel> getClients() { <START> return session.realms().getClients(this, 0, session.realms().getClientsCount(this).intValue()); <END> }</code><technical_language>getClients(this, null, null)</technical_language>

Target:
public List<ClientModel> getClients() { return session.realms().getClients(this); }
Source:
<code>public static <T> T get(final Observable<T> observable) { final SingleResultFuture<T> future = new SingleResultFuture<T>(); final CountDownLatch latch = new CountDownLatch(1); <START> observable.subscribe(new Observer<T>() { <END> private T result; @Override public void onCompleted() { future.init(result, null); } @Override public void onError(final Throwable e) { future.init(null, new MongoException("Error from observable", e)); } @Override public void onNext(final T t) { result = t; } }); try { latch.await(1, SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } return future.get(); }</code><technical_language>simplified return observable.timeout(1, SECONDS).toBlockingObservable().last();</technical_language>

Target:
public static <T> T get(final Observable<T> observable) { return observable.timeout(1, SECONDS).toBlockingObservable().last(); }
Source:
<code>public void testGenerateTaskManagerResourceIDWithLocalRpcService() throws Exception { final Configuration configuration = createConfiguration(); final String rpcAddress = ""; final int rpcPort = -1; final String taskManagerResourceID = TaskManagerRunner.getTaskManagerResourceID(configuration, rpcAddress, rpcPort); assertThat(taskManagerResourceID, notNullValue()); <START> assertThat(taskManagerResourceID.substring(0, taskManagerResourceID.length() - 7), <END> equalTo(InetAddress.getLocalHost().getHostName())); }</code><technical_language>containsString matcher</technical_language>

Target:
public void testGenerateTaskManagerResourceIDWithLocalRpcService() throws Exception { final Configuration configuration = createConfiguration(); final String rpcAddress = ""; final int rpcPort = -1; final String taskManagerResourceID = TaskManagerRunner.getTaskManagerResourceID(configuration, rpcAddress, rpcPort); assertThat(taskManagerResourceID, notNullValue()); assertThat(taskManagerResourceID, containsString(InetAddress.getLocalHost().getHostName())); }
Source:
<code>public long generateId(String sequence) { try { int retries = 25; while (retries-- > 0) { SequenceCounter result = oma.select(SequenceCounter.class).eq(SequenceCounter.NAME, sequence).queryFirst(); if (result == null) { try { result = new SequenceCounter(); result.setName(sequence); result.setNextValue(2); oma.update(result); return 1; } catch (HandledException e) { Exceptions.ignore(e); continue; } } int numRowsChanged = oma.getDatabase() .createQuery("UPDATE sequencecounter " + "SET nextValue = nextValue + 1 " + "WHERE name = ${name} " + " AND nextValue = ${value}") .set("name", sequence) .set("value", result.getNextValue()) .executeUpdate(); if (numRowsChanged == 1) { return result.getNextValue(); } <START> Wait.randomMillis(50, 50); <END> } throw Exceptions.handle() .to(LOG) .withSystemErrorMessage( "Failed to generate an unique sequence number for %s. Giving up after 25 retries.", sequence) .handle(); } catch (SQLException e) { throw Exceptions.handle() .to(LOG) .error(e) .withSystemErrorMessage( "Failed to generate an unique number for %s due to a database error: %s", sequence) .handle(); } }</code><technical_language>ordered chaos ... this a smal span min max</technical_language>

Target:
public long generateId(String sequence) { try { int retries = 25; while (retries-- > 0) { SequenceCounter result = oma.select(SequenceCounter.class).eq(SequenceCounter.NAME, sequence).queryFirst(); if (result == null) { try { result = new SequenceCounter(); result.setName(sequence); result.setNextValue(2); oma.update(result); return 1; } catch (HandledException e) { Exceptions.ignore(e); continue; } } int numRowsChanged = oma.getDatabase() .createQuery("UPDATE sequencecounter " + "SET nextValue = nextValue + 1 " + "WHERE name = ${name} " + " AND nextValue = ${value}") .set("name", sequence) .set("value", result.getNextValue()) .executeUpdate(); if (numRowsChanged == 1) { return result.getNextValue(); } Wait.randomMillis(50, 100); } throw Exceptions.handle() .to(LOG) .withSystemErrorMessage( "Failed to generate an unique sequence number for %s. Giving up after 25 retries.", sequence) .handle(); } catch (SQLException e) { throw Exceptions.handle() .to(LOG) .error(e) .withSystemErrorMessage( "Failed to generate an unique number for %s due to a database error: %s", sequence) .handle(); } }
Source:
<code>public static boolean isGenotypeInTransition(final Genotype g, final Transition transition) { Utils.nonNull(g, "Genotype cannot be null"); Utils.nonNull(transition, "Artifact mode cannot be null"); <START> return IntStream.range(1,g.getAlleles().size()).anyMatch(i -> g.getAllele(0).getDisplayString().equals(String.valueOf(transition.ref())) && <END> g.getAllele(i).getDisplayString().equals(String.valueOf(transition.call()))); }</code><technical_language>This doable Allele::basesMatch converting allele transition base Strings</technical_language>

Target:
public static boolean isGenotypeInTransition(final Genotype g, final Transition transition) { Utils.nonNull(g, "Genotype cannot be null"); Utils.nonNull(transition, "Artifact mode cannot be null"); return IntStream.range(1,g.getAlleles().size()).anyMatch(i -> g.getAllele(0).basesMatch(Allele.create((byte) transition.ref(), true)) && g.getAllele(i).basesMatch(Allele.create((byte) transition.call()))); }
Source:
<code><START> StandardRotationPolicy(DelegatingSessionFactory<?> factory, List<KeyDirectory> keyDirectories, <END> boolean fair) { Assert.notNull(factory, "factory cannot be null"); Assert.notNull(keyDirectories, "keyDirectories cannot be null"); Assert.isTrue(keyDirectories.size() > 0, "At least one KeyDirectory is required"); this.factory = factory; this.keyDirectories.addAll(keyDirectories); this.fair = fair; this.iterator = this.keyDirectories.iterator(); }</code><technical_language>Shound't this ctor public protected? I reason in protected methods below</technical_language>

Target:
public StandardRotationPolicy(DelegatingSessionFactory<?> factory, List<KeyDirectory> keyDirectories, boolean fair) { Assert.notNull(factory, "factory cannot be null"); Assert.notNull(keyDirectories, "keyDirectories cannot be null"); Assert.isTrue(keyDirectories.size() > 0, "At least one KeyDirectory is required"); this.factory = factory; this.keyDirectories.addAll(keyDirectories); this.fair = fair; this.iterator = this.keyDirectories.iterator(); }
Source:
<code>public Map<TableReference, TableReference> generateMapToFullTableNames(Set<TableReference> tableRefs) { Map<TableReference, TableReference> shortNameToFullTableName = Maps.newHashMapWithExpectedSize( tableRefs.size()); Set<TableReference> tablesToReload = Sets.newHashSet(); for (TableReference inputName : tableRefs) { if (inputName.isFullyQualifiedName()) { shortNameToFullTableName.put(inputName, inputName); } else { <START> TableReference candidate = tableMap.get().inverse().get(inputName); <END> if (candidate != null) { shortNameToFullTableName.put(inputName, candidate); } else if (unmappedTables.containsKey(inputName)) { shortNameToFullTableName.put(inputName, inputName); } else { tablesToReload.add(inputName); } } } if (!tablesToReload.isEmpty()) { updateTableMap(); Map<TableReference, TableReference> unmodifiableTableMap = ImmutableMap.copyOf(tableMap.get().inverse()); for (TableReference tableRef : tablesToReload) { if (unmodifiableTableMap.containsKey(tableRef)) { shortNameToFullTableName.put(tableRef, unmodifiableTableMap.get(tableRef)); } else { unmappedTables.put(tableRef, true); shortNameToFullTableName.put(tableRef, tableRef); } } } return shortNameToFullTableName; }</code><technical_language>fix is simple, adds some overhead, sense</technical_language>

Target:
public Map<TableReference, TableReference> generateMapToFullTableNames(Set<TableReference> tableRefs) { Map<TableReference, TableReference> shortToFullTableName = Maps.newHashMapWithExpectedSize(tableRefs.size()); Set<TableReference> tablesToReload = Sets.newHashSet(); Map<TableReference, TableReference> reverseTableMapSnapshot = ImmutableMap.copyOf(tableMap.get().inverse()); for (TableReference inputName : tableRefs) { if (inputName.isFullyQualifiedName()) { shortToFullTableName.put(inputName, inputName); } else if (reverseTableMapSnapshot.containsKey(inputName)) { shortToFullTableName.put(inputName, reverseTableMapSnapshot.get(inputName)); } else if (unmappedTables.contains(inputName)) { shortToFullTableName.put(inputName, inputName); } else { tablesToReload.add(inputName); } } if (!tablesToReload.isEmpty()) { updateTableMap(); Map<TableReference, TableReference> unmodifiableTableMap = ImmutableMap.copyOf(tableMap.get().inverse()); for (TableReference tableRef : tablesToReload) { if (unmodifiableTableMap.containsKey(tableRef)) { shortToFullTableName.put(tableRef, unmodifiableTableMap.get(tableRef)); } else { unmappedTables.add(tableRef); shortToFullTableName.put(tableRef, tableRef); } } } return shortToFullTableName; }
Source:
<code>public void buildVmVirtioScsi() { List<VmDevice> vmDevices = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSCSI.getName()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.Scsi); struct.put(VdsProperties.Model, VdsProperties.VirtioScsi); struct.put(VdsProperties.Index, Integer.toString(virtioScsiIndex)); if (vm.getNumOfIoThreads() > 0) { <START> struct.put(VdsProperties.ioTrheadId, Integer.toString(virtioScsiIndex)); <END> } vmInfoBuildUtils.addAddress(vmDevice, struct); virtioScsiIndex++; addDevice(struct, vmDevice, null); } }</code><technical_language>hmmm, this part - is done bound io threads <driver> created in VmDeviceUtils.addVirtioScsiController</technical_language>

Target:
public void buildVmVirtioScsi() { List<VmDevice> vmDevices = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSCSI.getName()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.Scsi); struct.put(VdsProperties.Model, VdsProperties.VirtioScsi); struct.put(VdsProperties.Index, Integer.toString(virtioScsiIndex)); vmInfoBuildUtils.addAddress(vmDevice, struct); virtioScsiIndex++; addDevice(struct, vmDevice, null); } }
Source:
<code>protected void internalReceiveCommand(String pvItemName, Command pvCommand) { <START> logger.debug("received command for item {}", pvCommand.toString(), pvItemName); <END> OneWireBindingConfig lvBindigConfig = getBindingConfig(pvItemName); if (lvBindigConfig instanceof AbstractOneWireDevicePropertyWritableBindingConfig) { AbstractOneWireDevicePropertyWritableBindingConfig lvWritableBindingConfig = (AbstractOneWireDevicePropertyWritableBindingConfig) lvBindigConfig; String lvStringValue = lvWritableBindingConfig.convertTypeToString(pvCommand); OneWireConnection.writeToOneWire(lvWritableBindingConfig.getDevicePropertyPath(), lvStringValue); } else if (lvBindigConfig instanceof AbstractOneWireControlBindingConfig) { AbstractOneWireControlBindingConfig lvControlBindingConfig = (AbstractOneWireControlBindingConfig) lvBindigConfig; lvControlBindingConfig.executeControl(this, pvCommand); } else { logger.debug("received command for item which is not writable or executable", pvCommand.toString(), pvItemName); } }</code><technical_language>toString() necessary (it costs *almost* do, leave debug method in case needed all)</technical_language>

Target:
protected void internalReceiveCommand(String pvItemName, Command pvCommand) { logger.debug("received command for item {}", pvCommand, pvItemName); OneWireBindingConfig lvBindigConfig = getBindingConfig(pvItemName); if (lvBindigConfig instanceof AbstractOneWireDevicePropertyWritableBindingConfig) { AbstractOneWireDevicePropertyWritableBindingConfig lvWritableBindingConfig = (AbstractOneWireDevicePropertyWritableBindingConfig) lvBindigConfig; String lvStringValue = lvWritableBindingConfig.convertTypeToString(pvCommand); OneWireConnection.writeToOneWire(lvWritableBindingConfig.getDevicePropertyPath(), lvStringValue); } else if (lvBindigConfig instanceof AbstractOneWireControlBindingConfig) { AbstractOneWireControlBindingConfig lvControlBindingConfig = (AbstractOneWireControlBindingConfig) lvBindigConfig; lvControlBindingConfig.executeControl(this, pvCommand); } else { logger.debug("received command for item which is not writable or executable", pvCommand, pvItemName); } }
Source:
<code>public NodeMetadata apply(Deployment from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); <START> builder.ids(from.name()); <END> builder.name(from.name()); builder.hostname(getHostname(from)); if (from.status() != null) { builder.status(serverStateToNodeStatus.get(from.status())); } Set<String> publicIpAddresses = Sets.newLinkedHashSet(); if (from.virtualIPs() != null) { for (Deployment.VirtualIP virtualIP : from.virtualIPs()) { publicIpAddresses.add(virtualIP.address()); } builder.publicAddresses(publicIpAddresses); } Set<String> privateIpAddresses = Sets.newLinkedHashSet(); if (from.roleInstanceList() != null) { for (Deployment.RoleInstance roleInstance : from.roleInstanceList()) { privateIpAddresses.add(roleInstance.ipAddress()); } builder.privateAddresses(privateIpAddresses); } return builder.build(); }</code><technical_language>Is deployment name unique? Is _real_ id of node int provider? call separately id() providerId() methods</technical_language>

Target:
public NodeMetadata apply(Deployment from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.id(from.name()); builder.providerId(from.name()); builder.name(from.name()); builder.hostname(getHostname(from)); if (from.status() != null) { builder.status(serverStateToNodeStatus.get(from.status())); } Set<String> publicIpAddresses = Sets.newLinkedHashSet(); if (from.virtualIPs() != null) { for (Deployment.VirtualIP virtualIP : from.virtualIPs()) { publicIpAddresses.add(virtualIP.address()); } builder.publicAddresses(publicIpAddresses); } Set<String> privateIpAddresses = Sets.newLinkedHashSet(); if (from.roleInstanceList() != null) { for (RoleInstance roleInstance : from.roleInstanceList()) { privateIpAddresses.add(roleInstance.ipAddress()); } builder.privateAddresses(privateIpAddresses); } return builder.build(); }
Source:
<code>public static void main(String[] args) { try { OptionParser parser = new OptionParser(); <START> ArgumentAcceptingOptionSpec<String> accountJsonFilePathOpt = <END> parser.accepts("jsonPath", "The path to the account json file to write to") .withRequiredArg() .describedAs("account_json_file_path") .ofType(String.class); ArgumentAcceptingOptionSpec<Short> firstAccountIdOpt = parser.accepts("firstAccountId", "The account ID to assign to the first account generated. " + "The account ID will be incremented by one for each additional account") .withRequiredArg() .describedAs("first_account_id") .ofType(Short.class); NonOptionArgumentSpec<String> serviceIdsArg = parser.nonOptions("The service IDs to create accounts for").ofType(String.class); parser.accepts("help", "print this help message."); parser.accepts("h", "print this help message."); OptionSet options = parser.parse(args); if (options.has("help") || options.has("h")) { parser.printHelpOn(System.out); System.exit(0); } ToolUtils.ensureOrExit(Arrays.asList(accountJsonFilePathOpt, firstAccountIdOpt, serviceIdsArg), options, parser); generateAccounts((List<String>) options.nonOptionArguments(), options.valueOf(accountJsonFilePathOpt), options.valueOf(firstAccountIdOpt)); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>a properties file rest of tools</technical_language>

Target:
public static void main(String[] args) throws Exception { OptionParser parser = new OptionParser(); ArgumentAcceptingOptionSpec<String> accountJsonFilePathOpt = parser.accepts("jsonPath", "The path to the account json file to write to") .withRequiredArg() .describedAs("account_json_file_path") .ofType(String.class); ArgumentAcceptingOptionSpec<Short> firstAccountIdOpt = parser.accepts("firstAccountId", "The account ID to assign to the first account generated. " + "The account ID will be incremented by one for each additional account") .withRequiredArg() .describedAs("first_account_id") .ofType(Short.class); NonOptionArgumentSpec<String> serviceIdsArg = parser.nonOptions("The service IDs to create accounts for").ofType(String.class); parser.accepts("help", "print this help message."); parser.accepts("h", "print this help message."); OptionSet options = parser.parse(args); if (options.has("help") || options.has("h")) { parser.printHelpOn(System.out); System.exit(0); } ToolUtils.ensureOrExit(Arrays.asList(accountJsonFilePathOpt, firstAccountIdOpt, serviceIdsArg), options, parser); generateAccounts((List<String>) options.nonOptionArguments(), options.valueOf(accountJsonFilePathOpt), options.valueOf(firstAccountIdOpt)); }
Source:
<code>public List<Identifier> getIdentifiers() { if (isValidPatientId()) { return loadTestDataService.getAllIdentiersBy(getPatientId()); <START> } else { <END> return new ArrayList<>(); } }</code><technical_language>A method return statement instead of two. a local variable get result return local variable. Change in other methods well</technical_language>

Target:
public List<Identifier> getIdentifiers() { return loadTestDataService.getAllIdentiersBy(getPatientId()); }
Source:
<code>public synchronized void addAdditionalResult() throws IOException { if (mResult == null) { return; } Map<String, MethodStatistics> nameStatistics = processMethodProfiles(mResult.getRecordStartMs(), mResult.getEndMs(), <START> javaAgentInput -> { <END> if (javaAgentInput.getType().contains("RPC")) { final int classNameDivider = javaAgentInput.getMethod().lastIndexOf("."); javaAgentInput.setMethod( javaAgentInput.getMethod().substring(classNameDivider + 1)); } return javaAgentInput.getType() + ":" + javaAgentInput.getMethod(); }); for (Map.Entry<String, MethodStatistics> entry : nameStatistics.entrySet()) { final MasterBenchTaskResultStatistics stats = new MasterBenchTaskResultStatistics(); stats.encodeResponseTimeNsRaw(entry.getValue().getTimeNs()); stats.mNumSuccess = entry.getValue().getNumSuccess(); stats.mMaxResponseTimeNs = entry.getValue().getMaxTimeNs(); mResult.putStatisticsForMethod(entry.getKey(), stats); } }</code><technical_language>If class renamed, this profileInput</technical_language>

Target:
public synchronized void addAdditionalResult() throws IOException { if (mResult == null) { return; } Map<String, MethodStatistics> nameStatistics = processMethodProfiles(mResult.getRecordStartMs(), mResult.getEndMs(), profileInput -> { String method = profileInput.getMethod(); if (profileInput.getType().contains("RPC")) { final int classNameDivider = profileInput.getMethod().lastIndexOf("."); method = profileInput.getMethod().substring(classNameDivider + 1); } return profileInput.getType() + ":" + method; }); for (Map.Entry<String, MethodStatistics> entry : nameStatistics.entrySet()) { final MasterBenchTaskResultStatistics stats = new MasterBenchTaskResultStatistics(); stats.encodeResponseTimeNsRaw(entry.getValue().getTimeNs()); stats.mNumSuccess = entry.getValue().getNumSuccess(); stats.mMaxResponseTimeNs = entry.getValue().getMaxTimeNs(); mResult.putStatisticsForMethod(entry.getKey(), stats); } }
Source:
<code>protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { if (buf.readableBytes() < KEEP_ALIVE_LENGTH) { return null; } if (buf.getUnsignedByte(buf.readerIndex()) == 0xD0) { ChannelBuffer frame = buf.readBytes(KEEP_ALIVE_LENGTH); if (channel != null) { channel.write(frame); } long deviceId = ((Long.reverseBytes((frame.getLong(0)))) >> 32) & 0xFFFFFFFFL; <START> return ChannelBuffers.copiedBuffer("$ID:" + String.valueOf(deviceId), StandardCharsets.US_ASCII); <END> } else { int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("\r\n")); if (index != -1) { ChannelBuffer frame = buf.readBytes(index - buf.readerIndex()); buf.skipBytes(2); return frame; } } return null; }</code><technical_language>This is a correct of handling this situation. If need this frame, need pass decode is</technical_language>

Target:
protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { if (buf.readableBytes() < KEEP_ALIVE_LENGTH) { return null; } if (buf.getUnsignedByte(buf.readerIndex()) == 0xD0) { ChannelBuffer frame = buf.readBytes(KEEP_ALIVE_LENGTH); if (channel != null) { channel.write(frame); } return frame; } else { int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("\r\n")); if (index != -1) { ChannelBuffer frame = buf.readBytes(index - buf.readerIndex()); buf.skipBytes(2); return frame; } } return null; }
Source:
<code>public void checkPermission(AuthorizationPermission perm) { <START> checkPermission(null, perm, Optional.empty()); <END> }</code><technical_language>I mixing Optional old-style nullable parameters, null for both. (Or Optional for both, of course.)</technical_language>

Target:
public void checkPermission(AuthorizationPermission perm) { checkPermission(null, perm, null); }
Source:
<code>public void testStaticHeader() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); <START> checkConfig.addAttribute("headerFile", getPath("inputheaderjava.header")); <END> checkConfig.addAttribute("ignoreLines", ""); final String[] expected = { "1: " + getCheckMessage(MSG_MISSING), }; verify(checkConfig, getPath("InputHeader.java"), expected); }</code><technical_language>inputheader => InputHeader</technical_language>

Target:
public void testStaticHeader() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.header")); checkConfig.addAttribute("ignoreLines", ""); final String[] expected = { "1: " + getCheckMessage(MSG_MISSING), }; verify(checkConfig, getPath("InputHeader.java"), expected); }
Source:
<code>protected void addAllExpectedMsgs() { <START> addExpectedNameMsg(1, 7, Severity.WARNING, Messages.CLASS + Messages.NAME, 2, NAME_LENGTH_LIMIT); <END> addExpectedNameMsg(7, 54, Severity.WARNING, Messages.ENUM_CASE + Messages.NAME, 1, NAME_LENGTH_LIMIT); addExpectedNameMsg(10, 6, Severity.WARNING, Messages.FUNCTION + Messages.NAME, 1, NAME_LENGTH_LIMIT); addExpectedNameMsg(10, 9, Severity.WARNING, Messages.CONSTANT + Messages.NAME, 2, NAME_LENGTH_LIMIT); addExpectedNameMsg(10, 12, Severity.WARNING, Messages.CONSTANT + Messages.NAME, 2, NAME_LENGTH_LIMIT); addExpectedNameMsg(15, 1, Severity.WARNING, Messages.LABEL + Messages.NAME, 2, NAME_LENGTH_LIMIT); addExpectedNameMsg(24, 10, Severity.WARNING, Messages.PROTOCOL + Messages.NAME, 1, NAME_LENGTH_LIMIT); addExpectedNameMsg(27, 8, Severity.WARNING, Messages.STRUCT + Messages.NAME, 1, NAME_LENGTH_LIMIT); addExpectedNameMsg(38, 11, Severity.WARNING, Messages.TYPEALIAS + Messages.NAME, 2, NAME_LENGTH_LIMIT); addExpectedNameMsg(41, 9, Severity.WARNING, Messages.VARIABLE + Messages.NAME, 1, NAME_LENGTH_LIMIT); addExpectedNameMsg(48, 86, Severity.WARNING, Messages.TYPE + Messages.NAME, 2, NAME_LENGTH_LIMIT); addExpectedNameMsg(52, 5, Severity.WARNING, Messages.CONSTANT + Messages.NAME, 1, NAME_LENGTH_LIMIT); addExpectedNameMsg(56, 10, Severity.WARNING, Messages.ENUM_CASE + Messages.NAME, 1, NAME_LENGTH_LIMIT); }</code><technical_language>move severity limit addExpectedNameMsg</technical_language>

Target:
protected void addAllExpectedMsgs() { addExpectedNameMsg(1, 7, Messages.CLASS + Messages.NAME, 2); addExpectedNameMsg(7, 54, Messages.ENUM_CASE + Messages.NAME, 1); addExpectedNameMsg(10, 6, Messages.FUNCTION + Messages.NAME, 1); addExpectedNameMsg(10, 9, Messages.CONSTANT + Messages.NAME, 2); addExpectedNameMsg(10, 12, Messages.CONSTANT + Messages.NAME, 2); addExpectedNameMsg(15, 1, Messages.LABEL + Messages.NAME, 2); addExpectedNameMsg(24, 10, Messages.PROTOCOL + Messages.NAME, 1); addExpectedNameMsg(27, 8, Messages.STRUCT + Messages.NAME, 1); addExpectedNameMsg(38, 11, Messages.TYPEALIAS + Messages.NAME, 2); addExpectedNameMsg(41, 9, Messages.VARIABLE + Messages.NAME, 1); addExpectedNameMsg(48, 86, Messages.TYPE + Messages.NAME, 2); addExpectedNameMsg(52, 5, Messages.CONSTANT + Messages.NAME, 1); addExpectedNameMsg(56, 10, Messages.ENUM_CASE + Messages.NAME, 1); }
Source:
<code>private void loadLFN(String lfn) { VisualizationServiceAsync vs = VisualizationService.Util.getInstance(); <START> Layout.getInstance().setNoticeMessage( <END> "Downloading file " + lfn.substring(lfn.lastIndexOf('/') + 1) + " from storage element. Please wait …", 0); vs.getVisualizationItemFromLFN( lfn, new AsyncCallback<VisualizationItem>() { @Override public void onFailure(Throwable caught) { Layout.getInstance().setWarningMessage( "Cannot load file: " + caught.getMessage()); } @Override public void onSuccess(VisualizationItem result) { displayFile(result); } }); }</code><technical_language>this message disappear (be hidden some point)</technical_language>

Target:
private void loadLFN(String lfn) { VisualizationServiceAsync vs = VisualizationService.Util.getInstance(); Layout.getInstance().setNoticeMessage( "Downloading file " + lfn.substring(lfn.lastIndexOf('/') + 1) + " from storage element. Please wait, this may take a while …", 0); vs.getVisualizationItemFromLFN( lfn, new AsyncCallback<VisualizationItem>() { @Override public void onFailure(Throwable caught) { Layout.getInstance().setWarningMessage( "Cannot load file: " + caught.getMessage()); } @Override public void onSuccess(VisualizationItem result) { displayFile(result); } }); }
Source:
<code>protected void initialize(Map conf, String localDir) throws Exception { _conf = new HashMap(); _conf.putAll(conf); _state = new LocalState(localDir); _allowedHosts = listIntoSet((List<String>) conf.get(CONF_MESOS_ALLOWED_HOSTS)); _disallowedHosts = listIntoSet((List<String>) conf.get(CONF_MESOS_DISALLOWED_HOSTS)); Boolean preferReservedResources = (Boolean) conf.get(CONF_MESOS_PREFER_RESERVED_RESOURCES); if (preferReservedResources != null) { _preferReservedResources = preferReservedResources; } _container = Optional.fromNullable((String) conf.get(CONF_MESOS_CONTAINER_DOCKER_IMAGE)); _scheduler = new NimbusScheduler(this); _generatedConfPath = Paths.get( Optional.fromNullable((String) conf.get(Config.STORM_LOCAL_DIR)).or("./"), "generated-conf"); if (!_generatedConfPath.toFile().exists() && !_generatedConfPath.toFile().mkdirs()) { <START> throw new RuntimeException("Couldn't create generated-conf dir"); <END> } createLocalServerPort(); setupHttpServer(); _conf.put(Config.NIMBUS_HOST, _configUrl.getHost()); File generatedConf = Paths.get(_generatedConfPath.toString(), "storm.yaml").toFile(); Yaml yaml = new Yaml(); FileWriter writer = new FileWriter(generatedConf); yaml.dump(_conf, writer); }</code><technical_language>nice, fixed greate typo ;)</technical_language>

Target:
protected void initialize(Map conf, String localDir) throws Exception { _conf = new HashMap(); _conf.putAll(conf); _state = new LocalState(localDir); _allowedHosts = listIntoSet((List<String>) conf.get(CONF_MESOS_ALLOWED_HOSTS)); _disallowedHosts = listIntoSet((List<String>) conf.get(CONF_MESOS_DISALLOWED_HOSTS)); Boolean preferReservedResources = (Boolean) conf.get(CONF_MESOS_PREFER_RESERVED_RESOURCES); if (preferReservedResources != null) { _preferReservedResources = preferReservedResources; } _container = Optional.fromNullable((String) conf.get(CONF_MESOS_CONTAINER_DOCKER_IMAGE)); _scheduler = new NimbusScheduler(this); _generatedConfPath = Paths.get( Optional.fromNullable((String) conf.get(Config.STORM_LOCAL_DIR)).or("./"), "generated-conf"); if (!_generatedConfPath.toFile().exists() && !_generatedConfPath.toFile().mkdirs()) { throw new RuntimeException("Couldn't create generated-conf dir, _generatedConfPath=" + _generatedConfPath.toString()); } createLocalServerPort(); setupHttpServer(); _conf.put(Config.NIMBUS_HOST, _configUrl.getHost()); File generatedConf = Paths.get(_generatedConfPath.toString(), "storm.yaml").toFile(); Yaml yaml = new Yaml(); FileWriter writer = new FileWriter(generatedConf); yaml.dump(_conf, writer); }
Source:
<code>public PortletLifecycleState getLifecycleState() { PortletLifecycleState rslt = null; final Date now = new Date(); <START> for (IPortletLifecycleEntry entry : lifecycleEntries) { <END> if (entry.getDate().before(now)) { rslt = entry.getLifecycleState(); } else { break; } } return rslt; }</code><technical_language>art: Java Stream API? java return lifecycleEntries .stream() .filter(entry -> entry.getDate().before(now)) .reduce((_, entry) -> entry.getLifecycleState()) .orElse(null);</technical_language>

Target:
public PortletLifecycleState getLifecycleState() { final Date now = new Date(); final IPortletLifecycleEntry currentEntry = lifecycleEntries .stream() .filter(entry -> entry.getDate().before(now)) .reduce( (e1, e2) -> e1.getDate().after(e2.getDate()) ? e1 : e2) .orElse(null); return currentEntry != null ? currentEntry.getLifecycleState() : null; }
Source:
<code>protected boolean validateOptionsGroup() { if (fCreateExperimentCheckbox != null && fCreateExperimentCheckbox.getSelection()) { String name = <START> fExperimentNameText.getText(); <END> if ((fTraceExperimentElement != null) && (name != null)) { TmfExperimentElement element = fTraceExperimentElement.getExperiment(name); if (element != null) { setMessage(null); setErrorMessage(NLS.bind(Messages.ImportTraceWizard_ErrorExperimentAlreadyExists, name)); return false; } } } setErrorMessage(null); return true; }</code><technical_language>this null</technical_language>

Target:
protected boolean validateOptionsGroup() { if (fCreateExperimentCheckbox != null && fCreateExperimentCheckbox.getSelection()) { String name = fExperimentNameText.getText().trim(); if (name.isEmpty()) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_ErrorEmptyExperimentName); return false; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); if ((workspace != null) && (!workspace.validateName(name, IResource.FILE).isOK())) { setMessage(null); setErrorMessage(NLS.bind(Messages.ImportTraceWizard_ErrorExperimentNameInvalid, name)); return false; } if (fExperimentFolderElement != null) { TmfExperimentElement element = fExperimentFolderElement.getExperiment(name); if (element != null) { setMessage(null); setErrorMessage(NLS.bind(Messages.ImportTraceWizard_ErrorExperimentAlreadyExists, name)); return false; } IFolder expResource = fExperimentFolderElement.getResource(); IResource res = expResource.findMember(name); if (res != null) { setMessage(null); setErrorMessage(NLS.bind(Messages.ImportTraceWizard_ErrorResourceAlreadyExists, name)); return false; } } } setErrorMessage(null); return true; }
Source:
<code>public void doRssLatest( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { final List<Run> lastBuilds = new ArrayList<>(); <START> for (AbstractProject<?, ?> p : Jenkins.get().allItems(AbstractProject.class)) { <END> if (p.getLastBuild() != null) { lastBuilds.add(p.getLastBuild()); } } RSS.rss(req, rsp, getDisplayName() + " last builds only", getUrl(), RunList.fromRuns(lastBuilds)); }</code><technical_language>I Oleg meant this code takes account AbstractProjects, account, for example, FreeStyleProjects</technical_language>

Target:
public void doRssLatest( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { final List<Run> lastBuilds = new ArrayList<>(); for (AbstractProject<?, ?> p : Jenkins.get().allItems(AbstractProject.class)) { if (p.getLastBuild() != null) { for (AbstractBuild<?, ?> b = p.getLastBuild(); b != null; b = b.getPreviousBuild()) { if (b.getBuiltOn() == getNode()) { lastBuilds.add(b); break; } } } } RSS.rss(req, rsp, getDisplayName() + " last builds only", getUrl(), RunList.fromRuns(lastBuilds)); }
Source:
<code><START> public static AvailableOfflineStatus fromValue(int value) { <END> switch (value) { case 0: return NOT_AVAILABLE_OFFLINE; case 1: return AVAILABLE_OFFLINE; case 2: return AVAILABLE_OFFLINE_PARENT; } return null; }</code><technical_language>existing .ordinal() method values()[index] get need a attribute (though control need care add new enum values end preserve existing indexes)</technical_language>

Target:
public static AvailableOfflineStatus fromValue(int value) { if (value > -1 && value < values().length) { return values()[value]; } else { return null; } }
Source:
<code>Map<String, FileInfo> toFileInfoMap(Change change, PatchSet patchSet, @Nullable PatchSet base) throws PatchListNotAvailableException { ObjectId a = (base == null) ? null : ObjectId.fromString(base.getRevision().get()); ObjectId b = ObjectId.fromString(patchSet.getRevision().get()); PatchListKey patchListKey = new PatchListKey(change.getProject(), a, b, Whitespace.IGNORE_NONE); <START> if (base != null && patchSet != null) { <END> patchListKey.setPatchSetIds(base.getId().get(), patchSet.getId().get()); } PatchList list = patchListCache.get(patchListKey); Map<String, FileInfo> files = Maps.newTreeMap(); for (PatchListEntry e : list.getPatches()) { FileInfo d = new FileInfo(); d.status = e.getChangeType() != Patch.ChangeType.MODIFIED ? e.getChangeType().getCode() : null; d.oldPath = e.getOldName(); if (e.getPatchType() == Patch.PatchType.BINARY) { d.binary = true; } else { d.linesInserted = e.getInsertions() > 0 ? e.getInsertions() : null; d.linesDeleted = e.getDeletions() > 0 ? e.getDeletions() : null; } FileInfo o = files.put(e.getNewName(), d); if (o != null) { d.status = Patch.ChangeType.REWRITE.getCode(); if (o.binary != null && o.binary) { d.binary = true; } if (o.linesInserted != null) { d.linesInserted = o.linesInserted; } if (o.linesDeleted != null) { d.linesDeleted = o.linesDeleted; } } } return files; }</code><technical_language>base == null setPatchSetIds called. So, if patchSet != null bPatchSetId set. Is this intentional a mistake</technical_language>

Target:
Map<String, FileInfo> toFileInfoMap(Change change, PatchSet patchSet, @Nullable PatchSet base) throws PatchListNotAvailableException { ObjectId a = (base == null) ? null : ObjectId.fromString(base.getRevision().get()); ObjectId b = ObjectId.fromString(patchSet.getRevision().get()); PatchListKey patchListKey = null; if(base != null ) { patchListKey = new PatchListKey(change.getProject(), a, b, base.getId().get(), patchSet.getId().get(), Whitespace.IGNORE_NONE); } else { patchListKey = new PatchListKey(change.getProject(), a, b, Whitespace.IGNORE_NONE); } PatchList list = patchListCache.get(patchListKey); Map<String, FileInfo> files = Maps.newTreeMap(); for (PatchListEntry e : list.getPatches()) { FileInfo d = new FileInfo(); d.status = e.getChangeType() != Patch.ChangeType.MODIFIED ? e.getChangeType().getCode() : null; d.oldPath = e.getOldName(); if (e.getPatchType() == Patch.PatchType.BINARY) { d.binary = true; } else { d.linesInserted = e.getInsertions() > 0 ? e.getInsertions() : null; d.linesDeleted = e.getDeletions() > 0 ? e.getDeletions() : null; } FileInfo o = files.put(e.getNewName(), d); if (o != null) { d.status = Patch.ChangeType.REWRITE.getCode(); if (o.binary != null && o.binary) { d.binary = true; } if (o.linesInserted != null) { d.linesInserted = o.linesInserted; } if (o.linesDeleted != null) { d.linesDeleted = o.linesDeleted; } } } return files; }
Source:
<code>public Object execute(K k, Rewriter rewriter, CompiledDefinition compiledDefinition) { if (kRunOptions.search()) { Rule pattern; if (kRunOptions.pattern != null) { pattern = KRun.compilePattern(files, kem, kRunOptions.pattern, kRunOptions, compiledDefinition, Source.apply("<command line>")); } else { pattern = KRun.compilePattern(files, kem, kRunOptions.DEFAULT_KORE_PATTERN, kRunOptions, compiledDefinition, Source.apply("<command line>")); } return new SearchResult(rewriter.search(k, Optional.ofNullable(kRunOptions.depth), Optional.ofNullable(kRunOptions.bound), pattern)); } <START> if (kRunOptions.exitCodePattern != null) { <END> Rule pattern = KRun.compilePattern(files, kem, kRunOptions.exitCodePattern, kRunOptions, compiledDefinition, Source.apply("<command line: --exit-code>")); Tuple2<K, List<? extends Map<? extends KVariable, ? extends K>>> res = rewriter.executeAndMatch(k, Optional.ofNullable(kRunOptions.depth), pattern); return Tuple2.apply(res._1(), KRun.getExitCode(kem, res._2())); } return rewriter.execute(k, Optional.ofNullable(kRunOptions.depth)).k(); }</code><technical_language>need handle case --pattern is --search</technical_language>

Target:
public Object execute(K k, Rewriter rewriter, CompiledDefinition compiledDefinition) { Rule pattern = null, parsedPattern = null; if (kRunOptions.pattern != null) { parsedPattern = KRun.parsePattern(files, kem, kRunOptions.pattern, compiledDefinition, Source.apply("<command line>")); pattern = KRun.compilePattern(files, kem, kRunOptions.pattern, kRunOptions, compiledDefinition, Source.apply("<command line>")); } if (kRunOptions.search()) { if (pattern == null) { pattern = new Rule(KORE.KVariable("X"), BooleanUtils.TRUE, BooleanUtils.TRUE, KORE.Att()); parsedPattern = pattern; } return new SearchResult(rewriter.search(k, Optional.ofNullable(kRunOptions.depth), Optional.ofNullable(kRunOptions.bound), pattern, kRunOptions.searchType()), parsedPattern); } if (kRunOptions.exitCodePattern != null) { Rule exitCodePattern = KRun.compilePattern(files, kem, kRunOptions.exitCodePattern, kRunOptions, compiledDefinition, Source.apply("<command line: --exit-code>")); Tuple2<K, List<? extends Map<? extends KVariable, ? extends K>>> res; if (pattern != null) { res = rewriter.executeAndMatch(k, Optional.ofNullable(kRunOptions.depth), pattern); return new Tuple2<>(new SearchResult(res._2(), parsedPattern), KRun.getExitCode(kem, rewriter.match(res._1(), exitCodePattern))); } res = rewriter.executeAndMatch(k, Optional.ofNullable(kRunOptions.depth), exitCodePattern); return Tuple2.apply(res._1(), KRun.getExitCode(kem, res._2())); } if (pattern != null) { Tuple2<K, List<? extends Map<? extends KVariable, ? extends K>>> res = rewriter.executeAndMatch(k, Optional.ofNullable(kRunOptions.depth), pattern); return new SearchResult(res._2(), parsedPattern); } return rewriter.execute(k, Optional.ofNullable(kRunOptions.depth)).k(); }
Source:
<code><START> public DtmfSinkFacade getDetector() { <END> return this.detector; }</code><technical_language>Return DtmfEventSubject instead. Users of this method want subscribe DTMF Events only</technical_language>

Target:
public DtmfEventSubject getDetector() { return this.detector; }
Source:
<code>public ReportsOverview() { <START> add(createHeader(), createMainContent(), createSelectionContent()); <END> projectName.addChangeListener(evt -> { Project selectedProject = getSelectedProject(); numberOfReports.setText( String.valueOf(repository.countReports(selectedProject))); projectVersion.getElement().removeAllChildren(); getProjectVersionOptions().forEach(projectVersion::addOption); dataProvider.setData(new ArrayList<>( repository.findReports(buildReportsQuery()))); table.updateContent(); }); projectVersion.addChangeListener(evt -> { dataProvider.setData(new ArrayList<>( repository.findReports(buildReportsQuery()))); table.updateContent(); }); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Remove this call a constructor overridable "add" method. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public ReportsOverview() { add(createHeader(), createMainContent(), createSelectionContent()); allVersions = new Option(); allVersions.setText("All versions"); allVersions.setValue(ALL_VERSIONS_KEY); projectName.addChangeListener(evt -> { Project selectedProject = getSelectedProject(); numberOfReports.setText( String.valueOf(repository.countReports(selectedProject))); projectVersion.getElement().removeAllChildren(); getProjectVersionOptions().forEach(projectVersion::addOption); table.setData(repository.findReports(getSelectedProject(), getSelectedProjectVersion())); }); projectVersion.addChangeListener(evt -> { table.setData(repository.findReports(getSelectedProject(), getSelectedProjectVersion())); }); }