auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void startServer(int id, String config) throws Exception { peers[id] = new MainThread(id, clientPorts[id], config); peers[id].start(); Assert.assertTrue("Server " + id + " is not up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT)); Assert.assertTrue("Error- Server started in Standalone Mode!", peers[id].isQuorumPeerRunning()); zkHandles[id] = ClientBase.createZKClient("127.0.0.1:" + clientPorts[id]); zkAdminHandles[id] = new ZooKeeperAdmin("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT, this); zkAdminHandles[id].addAuthInfo("digest", "super:test".getBytes()); LOG.info(String.format("Started server id %d with config:\n%s\nStat output:\n%s", <START> id, config, FourLetterWordMain.send4LetterWord("127.0.0.1", clientPorts[id], "stat"))); <END> }</code><technical_language>separate out 4lw call line</technical_language>

Target:
private void startServer(int id, String config) throws Exception { peers[id] = new MainThread(id, clientPorts[id], config); peers[id].start(); Assert.assertTrue("Server " + id + " is not up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT)); Assert.assertTrue("Error- Server started in Standalone Mode!", peers[id].isQuorumPeerRunning()); zkHandles[id] = ClientBase.createZKClient("127.0.0.1:" + clientPorts[id]); zkAdminHandles[id] = new ZooKeeperAdmin("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT, this); zkAdminHandles[id].addAuthInfo("digest", "super:test".getBytes()); String statCommandOut = FourLetterWordMain.send4LetterWord("127.0.0.1", clientPorts[id], "stat"); LOG.info(String.format("Started server id %d with config:\n%s\nStat output:\n%s", id, config, statCommandOut)); }
Source:
<code><START> protected int getTraversalId(EdgeIteratorState edge, int origEdgeId, boolean reverse) { <END> int baseNode = graph.getBaseNode(origEdgeId, edge.getAdjNode()); return GHUtility.createEdgeKey(baseNode, edge.getAdjNode(), origEdgeId, reverse); }</code><technical_language>hmm for node based traversal traversal id is node id I getTraversalId sense (more general) ? yes, replace edge parameter node id</technical_language>

Target:
protected int getTraversalId(EdgeIteratorState edge, int origEdgeId, boolean reverse) { int baseNode = graph.getOtherNode(origEdgeId, edge.getAdjNode()); return GHUtility.createEdgeKey(baseNode, edge.getAdjNode(), origEdgeId, reverse); }
Source:
<code>public void testGetInvalidTxSize() throws Exception { Transaction tx1 = txClient.startShort(); txClient.startLong(); txClient.invalidate(tx1.getWritePointer()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(out), new PrintStream(err)); txAdmin.doMain(new String[]{"--get-invalid-tx-size"}, conf); <START> List<String> expected = ImmutableList.of("Invalid list size: 1", <END> ""); Assert.assertEquals(Joiner.on("\n").join(expected), Bytes.toString(out.toByteArray())); Assert.assertEquals(0, err.toByteArray().length); }</code><technical_language>above, asserting printed output is brittle</technical_language>

Target:
public void testGetInvalidTxSize() throws Exception { Transaction tx1 = txClient.startShort(); txClient.startLong(); txClient.invalidate(tx1.getWritePointer()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(out), new PrintStream(err)); int status = txAdmin.doMain(new String[]{"--get-invalid-tx-size"}, conf); Assert.assertEquals(0, status); Assert.assertTrue(out.toString("UTF-8").contains("Invalid list size: 1\n")); }
Source:
<code>static String generateAndRetrieveIsoAsBase64Iso(String isoFileName, String driveLabel, String tempDirName) throws IOException { File tmpIsoStore = new File(tempDirName, isoFileName); <START> Script command = new Script("/usr/bin/genisoimage", Duration.standardSeconds(300), LOG); <END> command.add("-o", tmpIsoStore.getAbsolutePath()); command.add("-ldots"); command.add("-allow-lowercase"); command.add("-allow-multidot"); command.add("-cache-inodes"); command.add("-l"); command.add("-quiet"); command.add("-J"); command.add("-r"); command.add("-V", driveLabel); command.add(tempDirName); LOG.debug("Executing config drive creation command: " + command.toString()); String result = command.execute(); if (StringUtils.isNotBlank(result)) { String errMsg = "Unable to create iso file: " + isoFileName + " due to " + result; LOG.warn(errMsg); throw new CloudRuntimeException(errMsg); } File tmpIsoFile = new File(tmpIsoStore.getAbsolutePath()); if (tmpIsoFile.length() > (64L * 1024L * 1024L)) { throw new CloudRuntimeException("Config drive file exceeds maximum allowed size of 64MB"); } return fileToBase64String(tmpIsoFile); }</code><technical_language>include Daan's change (or @DaanHoogland push change?) genisoimage mkisofs if is available</technical_language>

Target:
static String generateAndRetrieveIsoAsBase64Iso(String isoFileName, String driveLabel, String tempDirName) throws IOException { File tmpIsoStore = new File(tempDirName, isoFileName); Script command = new Script(getProgramToGenerateIso(), Duration.standardSeconds(300), LOG); command.add("-o", tmpIsoStore.getAbsolutePath()); command.add("-ldots"); command.add("-allow-lowercase"); command.add("-allow-multidot"); command.add("-cache-inodes"); command.add("-l"); command.add("-quiet"); command.add("-J"); command.add("-r"); command.add("-V", driveLabel); command.add(tempDirName); LOG.debug("Executing config drive creation command: " + command.toString()); String result = command.execute(); if (StringUtils.isNotBlank(result)) { String errMsg = "Unable to create iso file: " + isoFileName + " due to ge" + result; LOG.warn(errMsg); throw new CloudRuntimeException(errMsg); } File tmpIsoFile = new File(tmpIsoStore.getAbsolutePath()); if (tmpIsoFile.length() > (64L * 1024L * 1024L)) { throw new CloudRuntimeException("Config drive file exceeds maximum allowed size of 64MB"); } return fileToBase64String(tmpIsoFile); }
Source:
<code>public void adjustQuestionNumbers(int oldQuestionNumber, int newQuestionNumber, List<FeedbackQuestionAttributes> questions) { if (oldQuestionNumber > newQuestionNumber && oldQuestionNumber >= 1) { for (int i = oldQuestionNumber - 1; i >= newQuestionNumber; i--) { FeedbackQuestionAttributes question = questions.get(i - 1).getCopy(); question.questionNumber += 1; try { updateFeedbackQuestion(question, false); } catch (InvalidParametersException e) { Assumption.fail("Invalid question. " + e); } catch (EntityDoesNotExistException e) { Assumption.fail("Question disappeared. " + e); } } } else if (oldQuestionNumber < newQuestionNumber && oldQuestionNumber < questions.size()) { for (int i = oldQuestionNumber + 1; i <= newQuestionNumber; i++) { FeedbackQuestionAttributes question = questions.get(i - 1).getCopy(); question.questionNumber -= 1; try { updateFeedbackQuestion(question, false); } catch (InvalidParametersException e) { Assumption.fail("Invalid question." + e); } catch (EntityDoesNotExistException e) { Assumption.fail("Question disappeared. " + e); } } } <START> } <END></code><technical_language>branches similar</technical_language>

Target:
public void adjustQuestionNumbers(int oldQuestionNumber, int newQuestionNumber, List<FeedbackQuestionAttributes> questions) { if (oldQuestionNumber < 0 || newQuestionNumber < 0) { Assumption.fail("Invalid question number"); } if (oldQuestionNumber > newQuestionNumber) { increaseQuestionNumber(newQuestionNumber, oldQuestionNumber, questions); } else if (oldQuestionNumber < newQuestionNumber) { decreaseQuestionNumber(oldQuestionNumber, newQuestionNumber, questions); } }
Source:
<code><START> public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world) <END> { if (!wasLoaded && load) MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunkpos, world)); else if (wasLoaded && !load) MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(entity, chunkpos, world)); }</code><technical_language>This is more a question for forge team directly, this need some sort of fallback technically this is a "breaking change", forge RB</technical_language>

Target:
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world) { if (wasLoaded != load) fireChunkWatch(load, entity, chunkpos, world); }
Source:
<code>public void removeBrokerConnection(String brokerName) { synchronized (brokerConnections) { MqttBrokerConnection connection = brokerConnections.get(brokerName.toLowerCase()); if (connection == null) { return; } <START> brokerConnections.remove(brokerName); <END> for (MqttBrokersObserver o : brokersObservers) { o.brokerRemoved(connection); } } }</code><technical_language>brokerName equal brokerName.toLowerCase() in case observers get notified connection is in map. call brokerConnections.remove(brokerName.toLowerCase(), connection) check return value. If remove fails log.debug give a hint happened</technical_language>

Target:
public MqttBrokerConnection removeBrokerConnection(String brokerName) { synchronized (brokerConnections) { MqttBrokerConnection connection = brokerConnections.remove(brokerName.toLowerCase()); if (connection != null) { for (MqttBrokersObserver o : brokersObservers) { o.brokerRemoved(connection); } } return connection; } }
Source:
<code>public static String getFileNameFromURL(String url) { <START> int extension = url.lastIndexOf('.'); int path = Math.max(url.substring(0, extension).lastIndexOf('/'), 0) + 1; int param1 = url.indexOf('&', extension); int param2 = url.indexOf('?', extension); int param = (param2 >= 0 && param2 < param1) || (param1 == -1) ? param2 : param1; return param >= 0 ? url.substring(path, param) : url.substring(path); <END> }</code><technical_language>please of namings here. This is clean code hard follow doing</technical_language>

Target:
public static String getFileNameFromURL(String url) { int fileExtensionIndex = url.lastIndexOf('.'); int fileNameIndex = Math.max(url.substring(0, fileExtensionIndex).lastIndexOf('/'), 0) + 1; String fileName = url.substring(fileNameIndex); fileName = fileName.split("[?&#]")[0]; return fileName.contains(":") ? fileName.split(":")[1] : fileName; }
Source:
<code>protected void validateReleaseResources(Collection<YarnWorkerNode> workerNodes) throws Exception { assertThat(workerNodes.size(), is(1)); <START> verifyFutureCompleted(addContainerRequestFutures.get(0)); verifyFutureCompleted(removeContainerRequestFuture); verifyFutureCompleted(startContainerAsyncFuture); verifyFutureCompleted(stopContainerAsyncFuture); verifyFutureCompleted(releaseAssignedContainerFuture); assertFalse(addContainerRequestFutures.get(1).isDone()); <END> }</code><technical_language>suggestion verifyFutureCompleted(stopContainerAsyncFuture); verifyFutureCompleted(releaseAssignedContainerFuture); of verifications related releasing</technical_language>

Target:
protected void validateReleaseResources(Collection<YarnWorkerNode> workerNodes) throws Exception { assertThat(workerNodes.size(), is(1)); verifyFutureCompleted(stopContainerAsyncFuture); verifyFutureCompleted(releaseAssignedContainerFuture); }
Source:
<code>private static void checkSkipFailed(Object input1, Object input2) { ChannelOutboundHandlerAdapter failFirst = new ChannelOutboundHandlerAdapter() { private boolean alreadyFailed; @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (alreadyFailed) { <START> ctx.write(msg, promise); <END> } else { promise.tryFailure(new RuntimeException()); this.alreadyFailed = true; } } }; EmbeddedChannel ch = new EmbeddedChannel(failFirst, new ChunkedWriteHandler()); ChannelFuture r1 = ch.write(input1); ChannelFuture r2 = ch.writeAndFlush(input2).awaitUninterruptibly(); ch.close(); assertTrue(r1.cause() instanceof RuntimeException); assertTrue(r2.isSuccess()); int i = 0; int read = 0; for (;;) { ByteBuf buffer = ch.readOutbound(); if (buffer == null) { break; } while (buffer.isReadable()) { assertEquals(BYTES[i++], buffer.readByte()); read++; if (i == BYTES.length) { i = 0; } } buffer.release(); } assertEquals(BYTES.length, read); }</code><technical_language>ch.finish() assert return value</technical_language>

Target:
private static void checkSkipFailed(Object input1, Object input2) { ChannelOutboundHandlerAdapter failFirst = new ChannelOutboundHandlerAdapter() { private boolean alreadyFailed; @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (alreadyFailed) { ctx.write(msg, promise); } else { this.alreadyFailed = true; ReferenceCountUtil.release(msg); promise.tryFailure(new RuntimeException()); } } }; EmbeddedChannel ch = new EmbeddedChannel(failFirst, new ChunkedWriteHandler()); ChannelFuture r1 = ch.write(input1); ChannelFuture r2 = ch.writeAndFlush(input2).awaitUninterruptibly(); assertTrue(ch.finish()); assertTrue(r1.cause() instanceof RuntimeException); assertTrue(r2.isSuccess()); int i = 0; int read = 0; for (;;) { ByteBuf buffer = ch.readOutbound(); if (buffer == null) { break; } while (buffer.isReadable()) { assertEquals(BYTES[i++], buffer.readByte()); read++; if (i == BYTES.length) { i = 0; } } buffer.release(); } assertEquals(BYTES.length, read); }
Source:
<code>private Type type() { switch (operator) { case "IS_NULL": case "NOT_NULL": case "DISTINCT": return Type.UNARY_OPERAND; case "MIN": case "MAX": case "SUM": case "AVERAGE": case "COUNT": return Type.AGGREGATE; case "EQUALS_TO": case "NOT_EQUALS_TO": case "LIKE_TO": case "GREATER_THAN": case "LESS_THAN": case "GREATER_OR_EQUALS_TO": case "LESS_OR_EQUALS_TO": return Type.BINARY_OPERAND; <START> case "BETWEEN": return Type.LIST_OPERAND; case "IN": case "NOT_IN": <END> return Type.LIST_OPERAND; default: return Type.DEFAULT; } }</code><technical_language>3 operators grouped</technical_language>

Target:
private Type type() { switch (operator) { case "IS_NULL": case "NOT_NULL": case "DISTINCT": return Type.UNARY_OPERAND; case "MIN": case "MAX": case "SUM": case "AVERAGE": case "COUNT": return Type.AGGREGATE; case "EQUALS_TO": case "NOT_EQUALS_TO": case "LIKE_TO": case "GREATER_THAN": case "LESS_THAN": case "GREATER_OR_EQUALS_TO": case "LESS_OR_EQUALS_TO": return Type.BINARY_OPERAND; case "BETWEEN": return Type.RANGE_OPERAND; case "IN": case "NOT_IN": return Type.LIST_OPERAND; default: return Type.DEFAULT; } }
Source:
<code>private List<InterpreterResultMessage> replacePasswords(List<InterpreterResultMessage> original) { List<InterpreterResultMessage> replaced = new ArrayList<>(); for (InterpreterResultMessage msg : original) { <START> String replacedMessages = replacePasswords(msg.getData()); <END> replaced.add(new InterpreterResultMessage(msg.getType(), replacedMessages)); } return replaced; }</code><technical_language>do InterpreterResult.type is text, html table</technical_language>

Target:
private List<InterpreterResultMessage> replacePasswords(List<InterpreterResultMessage> original) { List<InterpreterResultMessage> replaced = new ArrayList<>(); for (InterpreterResultMessage msg : original) { switch(msg.getType()) { case HTML: case TEXT: case TABLE: { String replacedMessages = replacePasswords(msg.getData()); replaced.add(new InterpreterResultMessage(msg.getType(), replacedMessages)); break; } default: replaced.add(msg); } } return replaced; }
Source:
<code>public static void init() throws IOException { TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH); SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("Welcome", fBot); SWTBotUtils.switchToTracingPerspective(); WaitUtils.waitForJobs(); SWTBotUtils.createProject(TRACE_PROJECT_NAME); <START> test3_00Preparation(); <END> }</code><technical_language>is this moved? called test3_00Preparation if is shared everything</technical_language>

Target:
public static void init() throws IOException { TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH); SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("Welcome", fBot); SWTBotUtils.switchToTracingPerspective(); WaitUtils.waitForJobs(); SWTBotUtils.createProject(TRACE_PROJECT_NAME); importCustomParsers(); }
Source:
<code>private List<String> executeSystemTemplateRemoval(List<String> metacardList) throws IngestException, SourceUnavailableException { <START> LOGGER.debug("Preparing to removing the following system form metacards", metacardList); <END> DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(metacardList.toArray(new String[0]))); if (!deleteResponse.getProcessingErrors().isEmpty()) { console.println(ansi().fgBrightRed().a("Error removing system forms").reset()); throw new IngestException("Failed to delete list of system form metacards"); } List<String> deletedMetacardIds = retrieveListMetacardIds(deleteResponse.getDeletedMetacards()); LOGGER.debug("System forms deleted successfully", deletedMetacardIds); return deletedMetacardIds; }</code><technical_language>"Preparing remove system form metacards: {}"</technical_language>

Target:
private List<String> executeSystemTemplateRemoval(List<String> metacardList) throws IngestException, SourceUnavailableException { LOGGER.debug("Preparing to remove the following system form metacards: {}", metacardList); DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(metacardList.toArray(new String[0]))); if (deleteResponse.getProcessingErrors() != null && !deleteResponse.getProcessingErrors().isEmpty()) { for (ProcessingDetails details : deleteResponse.getProcessingErrors()) { if (details.hasException()) { throw new IngestException( "Failed to delete list of system form metacards", details.getException()); } } throw new IngestException("Failed to delete list of system form metacards"); } List<String> deletedMetacardIds = retrieveMetacardIds(deleteResponse.getDeletedMetacards()); LOGGER.debug("System forms deleted successfully {}", deletedMetacardIds); return deletedMetacardIds; }
Source:
<code>private void init() { if (task.isWindowableTask() && windowMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need window", task.taskName()); state.needWindow(); resume(); } }, windowMs, windowMs, TimeUnit.MILLISECONDS); } if (commitMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need commit", task.taskName()); state.needCommit(); resume(); } }, commitMs, commitMs, TimeUnit.MILLISECONDS); } <START> final SystemTimerScheduler timerScheduler = task.context().getTimerScheduler(); <END> if (timerScheduler != null) { timerScheduler.registerListener(() -> { state.needScheduler(); }); } }</code><technical_language>rename EpochTimeScheduler/SystemTimeScheduler</technical_language>

Target:
private void init() { if (task.isWindowableTask() && windowMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need window", task.taskName()); state.needWindow(); resume(); } }, windowMs, windowMs, TimeUnit.MILLISECONDS); } if (commitMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need commit", task.taskName()); state.needCommit(); resume(); } }, commitMs, commitMs, TimeUnit.MILLISECONDS); } final EpochTimeScheduler epochTimeScheduler = task.context().getTimerScheduler(); if (epochTimeScheduler != null) { epochTimeScheduler.registerListener(() -> { state.needScheduler(); }); } }
Source:
<code><START> public boolean verifyByPolling(long timeout, long period) { <END> try { if (_coolDown != 0) { Thread.sleep(_coolDown); } } catch (InterruptedException e) { LOG.error("cooldown in verifyByPolling interrupted"); } try { long start = System.currentTimeMillis(); boolean success; do { success = verifyState(); if (success) { return true; } TimeUnit.MILLISECONDS.sleep(period); } while ((System.currentTimeMillis() - start) <= timeout); LOG.error("verifier timeout out with timeout {}", timeout); } catch (Exception e) { LOG.error("Exception in verifier", e); } return false; }</code><technical_language>I add wait for verifyByZkCallback too. logic of verifyByZkCallback is 1. subscribe changes. 2. matter if change happens, verify state for once. 3. if subscription results in some notification, verify in parallel. 4. of paths succeed, verify succeeds. In this case, wait subscribe ensure waitTillVerify config takes effect. This problem verifying logic. if change subscribe, fine default verify check done least</technical_language>

Target:
public boolean verifyByPolling(long timeout, long period) { waitTillVerify(); try { long start = System.currentTimeMillis(); boolean success; do { success = verifyState(); if (success) { return true; } TimeUnit.MILLISECONDS.sleep(period); } while ((System.currentTimeMillis() - start) <= timeout); LOG.error("verifier timeout out with timeout {}", timeout); } catch (Exception e) { LOG.error("Exception in verifier", e); } return false; }
Source:
<code>public String getCommandUsage(CommandSender sender) { <START> return "return the current version of this server"; <END> }</code><technical_language>Erm</technical_language>

Target:
public String getCommandUsage(CommandSender sender) { return "Displays version information about the server"; }
Source:
<code>public String ocr(BufferedImage image) throws IOException { <START> File temp = File.createTempFile("tesseract", ".png"); <END> FileOutputStream fos = new FileOutputStream(temp); ImageIO.write(image, "png", fos); temp.deleteOnExit(); return ocr(temp.getAbsolutePath()); }</code><technical_language>good idea. done</technical_language>

Target:
public String ocr(BufferedImage image) throws IOException { String tempFilename = "tesseract." + UUID.randomUUID().toString() + ".png"; File tempFile = new File(getDataDir(), tempFilename); FileOutputStream fos = new FileOutputStream(tempFile); ImageIO.write(image, "png", fos); String result = ocr(tempFile.getAbsolutePath()); tempFile.delete(); return result; }
Source:
<code>private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), <START> getAvailablePlugins(model), getExistingImports(model), true); <END> dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); IPluginImport[] imports = new IPluginImport[models.length]; try { for (int i = 0; i < models.length; i++) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); imports[i] = importNode; } addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } }</code><technical_language>is a getExistingImports in PSD</technical_language>

Target:
private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model), getAvailablePluginImports(model), true); dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); IPluginImport[] imports = new IPluginImport[models.length]; try { for (int i = 0; i < models.length; i++) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); imports[i] = importNode; } addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } }
Source:
<code><START> public com.sequenceiq.cloudbreak.cloud.model.Image convert(ImageEntity source) { <END> com.sequenceiq.cloudbreak.cloud.model.Image image = new com.sequenceiq.cloudbreak.cloud.model.Image(source.getImageName(), Map.of(InstanceGroupType.GATEWAY, Optional.ofNullable(source.getUserdata()).orElse("")), source.getOs(), source.getOsType(), source.getImageCatalogUrl(), source.getImageCatalogName(), source.getImageId(), Collections.emptyMap()); return image; }</code><technical_language>remove package</technical_language>

Target:
public Image convert(ImageEntity source) { Image image = new Image(source.getImageName(), Map.of(InstanceGroupType.GATEWAY, Optional.ofNullable(source.getUserdata()).orElse("")), source.getOs(), source.getOsType(), source.getImageCatalogUrl(), source.getImageCatalogName(), source.getImageId(), Collections.emptyMap()); return image; }
Source:
<code><START> public Optional tileentityinventory$getTileEntity() { <END> return Optional.of(this); }</code><technical_language>Raw type</technical_language>

Target:
public Optional<? extends TileEntityCarrier> tileentityinventory$getTileEntity() { return Optional.of(this); }
Source:
<code>protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) { final ISegment segment = (ISegment) sel.getFirstElement(); if (segment != null) { IAction gotoStartTime = new Action(Messages.SegmentStoreTableViewer_goToStartEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getStart()), TmfTimestamp.fromNanos(segment.getStart()), fTrace)); } }; IAction gotoEndTime = new Action(Messages.SegmentStoreTableViewer_goToEndEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getEnd()), TmfTimestamp.fromNanos(segment.getEnd()), fTrace)); } }; IAction openCallsiteAction = new Action("Lookup source") { @Override public void run() { TableViewer table = getTableViewer(); ISelection items = table.getSelection(); if(items.isEmpty() || !(items instanceof StructuredSelection)) { return; } StructuredSelection sItems = ((StructuredSelection)items); final Object data = sItems.getFirstElement(); if (data instanceof ITmfSourceLookup) { TmfSourceLookupAction.lookupCallsite((ITmfSourceLookup) data); } } }; manager.add(gotoStartTime); manager.add(gotoEndTime); <START> if(segment instanceof ITmfSourceLookup) { <END> manager.add(openCallsiteAction); } } }</code><technical_language>formatting</technical_language>

Target:
protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) { final ISegment segment = (ISegment) sel.getFirstElement(); if (segment != null) { IAction gotoStartTime = new Action(Messages.SegmentStoreTableViewer_goToStartEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getStart()), TmfTimestamp.fromNanos(segment.getStart()), fTrace)); } }; IAction gotoEndTime = new Action(Messages.SegmentStoreTableViewer_goToEndEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getEnd()), TmfTimestamp.fromNanos(segment.getEnd()), fTrace)); } }; IContributionItem openCallsiteAction = OpenSourceCodeAction.create("Lookup source", getTableViewer()); manager.add(gotoStartTime); manager.add(gotoEndTime); if (openCallsiteAction != null) { manager.add(openCallsiteAction); } } }
Source:
<code>public void testUnknownStatistic() throws Throwable { assertStatisticUnknown(stats, "anything"); assertStatisticUntracked(stats, "anything"); <START> assertThatThrownBy(() -> <END> assertStatisticTracked(stats, "anything")); assertThatThrownBy(() -> assertStatisticHasValue(stats, "anything", 0)); }</code><technical_language>Do mind explaining a bit more for this. Thanks</technical_language>

Target:
public void testUnknownStatistic() throws Throwable { assertStatisticIsUnknown(stats, "anything"); assertStatisticIsUntracked(stats, "anything"); }
Source:
<code>private String readClasspathResource(String c) throws IOException { InputStream is = getClass().getResourceAsStream(c); try { return Util.read(is); } finally { if (is != null) { <START> is.close(); <END> } } }</code><technical_language>close done in Util.read(..)</technical_language>

Target:
private String readClasspathResource(String c) throws IOException { InputStream is = getClass().getResourceAsStream(c); return Util.read(is); }
Source:
<code>private static boolean isBuildPlanFinished(final NodeTemplateInstance nodeTemplateInstance) { <START> if (nodeTemplateInstance != null) { <END> final PlanInstance buildPlan = nodeTemplateInstance.getServiceTemplateInstance().getPlanInstances().stream() .filter((plan) -> plan.getType().equals(PlanType.BUILD)).findFirst().orElse(null); return buildPlan != null && buildPlan.getState().equals(PlanInstanceState.FINISHED); } else { return false; } }</code><technical_language>inverting if-condition allows early return saves a level of indentation</technical_language>

Target:
private static boolean isBuildPlanFinished(final NodeTemplateInstance nodeTemplateInstance) { if (Objects.isNull(nodeTemplateInstance)) { return false; } final PlanInstance buildPlan = nodeTemplateInstance.getServiceTemplateInstance().getPlanInstances().stream() .filter((plan) -> plan.getType().equals(PlanType.BUILD)).findFirst().orElse(null); return Objects.nonNull(buildPlan) && buildPlan.getState().equals(PlanInstanceState.FINISHED); }
Source:
<code>public static StatusFactory statusFactory() { <START> return new StatusFactory(PLUGIN_ID); <END> }</code><technical_language>is this needed for ? need create invocation</technical_language>

Target:
public static StatusFactory statusFactory() { return getDefault().getStatusFactory(); }
Source:
<code>void parseHeaders(final RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { <START> ObjectId sha1 = this.toObjectId(); <END> byte[] raw = commitCache.get(sha1); if (raw == null) { raw = walk.getCachedBytes(this); commitCache.put(sha1, raw); } parseCanonical(walk, raw); }</code><technical_language>This avoided. allocating a new ObjectId parse operation map support AnyObjectId lookup behavior? do that</technical_language>

Target:
void parseHeaders(final RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { byte[] raw; synchronized (commitCache) { raw = commitCache.get(this); } if (raw == null) { raw = walk.getCachedBytes(this); ObjectId sha1 = this.toObjectId(); synchronized (commitCache) { commitCache.put(sha1, raw); } } parseCanonical(walk, raw); }
Source:
<code>private void handleInconsistent() { log.warn("Could not freeze VM guest filesystems, <START> resuming with <END> inconsistent snapshot."); addCustomValue("SnapshotName", getSnapshotName()); addCustomValue("VmName", getVmName()); auditLogDirector.log(this, AuditLogType.FAILED_TO_FREEZE_VM); }</code><technical_language>proceeding inconsistent snapshot</technical_language>

Target:
private void handleInconsistent() { log.warn("Could not freeze VM guest filesystems, proceeding with an inconsistent snapshot."); addCustomValue("SnapshotName", getSnapshotName()); addCustomValue("VmName", getVmName()); auditLogDirector.log(this, AuditLogType.FAILED_TO_FREEZE_VM); }
Source:
<code>public Field getField(Class<?> clazz, String fieldName) throws IllegalStateException { Map<String, Field> stringFieldMap = classFields.get(clazz); if(stringFieldMap==null){ stringFieldMap = new HashMap<>(); <START> classFields.put(clazz, stringFieldMap); <END> } Field field = stringFieldMap.get(fieldName); if(field!=null){ return field; }else { DynamicEntityDao dynamicEntityDao = getPersistenceManager(clazz).getDynamicEntityDao(); SessionFactory sessionFactory = dynamicEntityDao.getDynamicDaoHelper(). getSessionFactory((HibernateEntityManager) dynamicEntityDao.getStandardEntityManager()); BLCFieldUtils fieldUtils = new BLCFieldUtils(sessionFactory, true, dynamicEntityDao.useCache(), dynamicEntityDao.getEjb3ConfigurationDao(), entityConfiguration, dynamicEntityDao.getDynamicDaoHelper()); Field fld = fieldUtils.getField(clazz, fieldName); stringFieldMap.put(fieldName, fld); return fld; } }</code><technical_language>Do need worried thread safety here? Also, I looked in BLCFieldUtils some caching for Field instances (in getSingleField()). part missing is class -> Field mapping? caching is getField()</technical_language>

Target:
public Field getField(Class<?> clazz, String fieldName) throws IllegalStateException { DynamicEntityDao dynamicEntityDao = getPersistenceManager(clazz).getDynamicEntityDao(); SessionFactory sessionFactory = dynamicEntityDao.getDynamicDaoHelper(). getSessionFactory((HibernateEntityManager) dynamicEntityDao.getStandardEntityManager()); if(fieldUtils==null) { fieldUtils = new BLCFieldUtils(sessionFactory, true, dynamicEntityDao.useCache(), dynamicEntityDao.getEjb3ConfigurationDao(), entityConfiguration, dynamicEntityDao.getDynamicDaoHelper()); } Field fld = fieldUtils.getField(clazz, fieldName); return fld; }
Source:
<code>Grid createRow(final HostVLan hostVLan) { Grid row = new Grid(1, 4); row.getColumnFormatter().setWidth(0, VLanPanel.CHECK_BOX_COLUMN_WIDTH); row.getColumnFormatter().setWidth(1, VLanPanel.NETWORK_NAME_COLUMN_WIDTH); <START> row.getColumnFormatter().setWidth(2, VLanPanel.OUT_OF_SYNC_WIDTH); <END> row.getColumnFormatter().setWidth(3, VLanPanel.ADDRESS_COLUMN_WIDTH); row.setWidth("100%"); row.setHeight("100%"); Style gridStyle = row.getElement().getStyle(); gridStyle.setBorderColor("white"); gridStyle.setBorderWidth(1, Unit.PX); gridStyle.setBorderStyle(BorderStyle.SOLID); HorizontalPanel chekboxPanel = new HorizontalPanel(); chekboxPanel.setWidth("100%"); if (isSelectionAvailable) { chekboxPanel.add(getCheckBox()); } chekboxPanel.add(new Image(ClientGinjectorProvider.getApplicationResources().splitRotateImage())); chekboxPanel.add(new Label(new HostVLanNameRenderer().render(hostVLan))); row.setWidget(0, 0, chekboxPanel); Label networkName = new Label(hostVLan.getNetworkName()); if (hostVLan.getInterface().getIsManagement()) { networkName.getElement().getStyle().setFontWeight(FontWeight.BOLD); networkName.setText("* " + hostVLan.getNetworkName()); } row.setWidget(0, 1, networkName); row.setWidget(0, 2, getSyncPanel(hostVLan.getInterface().getNetworkImplementationDetails().isInSync())); row.setWidget(0, 3, new Label(hostVLan.getAddress())); return row; }</code><technical_language>This change accordingly, other spots in this file..</technical_language>

Target:
Grid createRow(final HostVLan hostVLan) { HorizontalPanel checkboxPanel = new HorizontalPanel(); checkboxPanel.setWidth("100%"); if (isSelectionAvailable) { checkboxPanel.add(getCheckBox()); } checkboxPanel.add(new Image(resources.splitRotateImage())); checkboxPanel.add(new Label(new HostVLanNameRenderer().render(hostVLan))); Grid row = createVlanRowColumn(checkboxPanel, hostVLan.getInterface().getIsManagement(), hostVLan.getNetworkName(), createSyncPanel(hostVLan.getInterface().getNetworkImplementationDetails().isInSync()), new Label(hostVLan.getAddress())); Style gridStyle = row.getElement().getStyle(); gridStyle.setBorderColor("white"); gridStyle.setBorderWidth(1, Unit.PX); gridStyle.setBorderStyle(BorderStyle.SOLID); return row; }
Source:
<code>public boolean allowAutostitching() { <START> return ((DefaultMetadataOptions) getMetadataOptions()).getBoolean( <END> ALLOW_AUTOSTITCHING_KEY, ALLOW_AUTOSTITCHING_DEFAULT); }</code><technical_language>right. change setMetadataOptions *update* object reassign it, attempt a custom implementation of MetadataOptions work expected (not FormatHandler instances, anyway). So, if decide for of proposed refactorings of options API, apply instanceof fix</technical_language>

Target:
public boolean allowAutostitching() { MetadataOptions options = getMetadataOptions(); if (options instanceof DynamicMetadataOptions) { return ((DynamicMetadataOptions) options).getBoolean( ALLOW_AUTOSTITCHING_KEY, ALLOW_AUTOSTITCHING_DEFAULT); } return ALLOW_AUTOSTITCHING_DEFAULT; }
Source:
<code>public void shouldConvertValueObjectToDto() { final ProfileGenericDataRequestData source = new ProfileGenericDataRequestData(OBIS_CODE_VALUES, BEGIN_DATE.toDate(), END_DATE.toDate()); final ProfileGenericDataRequestDataDto result = this.mapper.map(source, ProfileGenericDataRequestDataDto.class); <START> assertEquals("mapped values should be identical", result.getBeginDate(), BEGIN_DATE.toDate()); <END> assertEquals("mapped values should be identical", result.getEndDate(), END_DATE.toDate()); assertEquals("mapped values should be identical", result.getObisCode().getA(), OBIS_CODE_VALUES.getA()); assertEquals("mapped values should be identical", result.getObisCode().getB(), OBIS_CODE_VALUES.getB()); assertEquals("mapped values should be identical", result.getObisCode().getC(), OBIS_CODE_VALUES.getC()); assertEquals("mapped values should be identical", result.getObisCode().getD(), OBIS_CODE_VALUES.getD()); assertEquals("mapped values should be identical", result.getObisCode().getE(), OBIS_CODE_VALUES.getE()); assertEquals("mapped values should be identical", result.getObisCode().getF(), OBIS_CODE_VALUES.getF()); }</code><technical_language>If string 8 times, is a good idea put in a constant</technical_language>

Target:
public void shouldConvertValueObjectToDto() { final ProfileGenericDataRequestData source = new ProfileGenericDataRequestData(OBIS_CODE_VALUES, BEGIN_DATE.toDate(), END_DATE.toDate()); final ProfileGenericDataRequestDataDto result = this.mapper.map(source, ProfileGenericDataRequestDataDto.class); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getBeginDate(), BEGIN_DATE.toDate()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getEndDate(), END_DATE.toDate()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getObisCode().getA(), OBIS_CODE_VALUES.getA()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getObisCode().getB(), OBIS_CODE_VALUES.getB()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getObisCode().getC(), OBIS_CODE_VALUES.getC()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getObisCode().getD(), OBIS_CODE_VALUES.getD()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getObisCode().getE(), OBIS_CODE_VALUES.getE()); assertEquals(MAPPED_FIELD_VALUE_MESSAGE, result.getObisCode().getF(), OBIS_CODE_VALUES.getF()); }
Source:
<code>protected void executeRuntimeStep(OperationContext context, ModelNode operation) { <START> String name = this.nameExtractor.apply(operation); <END> Metric<C> executable = this.executables.get(name); try { ModelNode result = this.executor.execute(context, executable); if (result != null) { context.getResult().set(result); } } catch (OperationFailedException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); }</code><technical_language>Replace with: String name = Operations.getAttributeName(operation);</technical_language>

Target:
protected void executeRuntimeStep(OperationContext context, ModelNode operation) { String name = Operations.getAttributeName(operation); Metric<C> executable = this.executables.get(name); try { ModelNode result = this.executor.execute(context, executable); if (result != null) { context.getResult().set(result); } } catch (OperationFailedException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); }
Source:
<code>public int getItemCount() { <START> return tourStops.size() * 100; <END> }</code><technical_language>Move 100 a constant for clarity</technical_language>

Target:
public int getItemCount() { return tourStops.size() * TourUtils.NUMBER_OF_TOUR_LOOP; }
Source:
<code>public static void storeProperties(Properties properties, OutputStream outStream, String comment) { try { OutputStreamWriter osw = new OutputStreamWriter(new BufferedOutputStream(outStream), "UTF-8"); Writer out = new BufferedWriter(osw); if (comment != null) out.write("\n#" + comment + "\n"); <START> out.write("#" + new Date() + "\n"); <END> for (Map.Entry<Object, Object> e : properties.entrySet()) { out.write(e.getKey() + "=" + e.getValue().toString().replaceAll("\\\\", "\\\\\\\\") + "\n"); } out.flush(); out.close(); } catch (FileNotFoundException fnfe) { log.error("target file not found" + fnfe); } catch (UnsupportedEncodingException ex) { log.error("unsupported encoding error hit" + ex); } catch (IOException ioex) { log.error("IO exception encountered trying to append to properties file" + ioex); } }</code><technical_language>idea this ticket is change storeProperties implementation simply call properties.store(outputstream, null) instead of custom buggy implementation</technical_language>

Target:
public static void storeProperties(Properties properties, OutputStream outStream, String comment) { try { Charset utf8 = Charset.forName("UTF-8"); properties.store(new OutputStreamWriter(outStream, utf8), comment); } catch (FileNotFoundException fnfe) { log.error("target file not found" + fnfe); } catch (UnsupportedEncodingException ex) { log.error("unsupported encoding error hit" + ex); } catch (IOException ioex) { log.error("IO exception encountered trying to append to properties file" + ioex); } }
Source:
<code>public int andCardinality(Container x) { if (this.getCardinality() == 0) return 0; else if (x.getCardinality() ==0) return 0; else { if (x instanceof ArrayContainer) <START> return and((ArrayContainer) x).getCardinality(); <END> else if (x instanceof BitmapContainer) return and((BitmapContainer) x).getCardinality(); return and((RunContainer) x).getCardinality(); } }</code><technical_language>andCardinality(Container) called instead of and(Container).getCardinality()</technical_language>

Target:
public int andCardinality(Container x) { if (this.getCardinality() == 0) return 0; else if (x.getCardinality() == 0) return 0; else { if (x instanceof ArrayContainer) return andCardinality((ArrayContainer) x); else if (x instanceof BitmapContainer) return andCardinality((BitmapContainer) x); return andCardinality((RunContainer) x); } }
Source:
<code>public byte[] generateCSR(String sigAlg, KeyPair keyPair) { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(outStream); <START> <END> try { PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder( new X500Principal("CN=Requested Test Certificate"), keyPair.getPublic()); JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder("SHA256withRSA"); ContentSigner signer = csBuilder.build(keyPair.getPrivate()); PKCS10CertificationRequest csr = p10Builder.build(signer); return csr.getEncoded(); } catch (Exception ex) { ex.printStackTrace(); } finally { if (null != outStream) { try { outStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (null != printStream) { printStream.close(); } } return new byte[0]; }</code><technical_language>Please remove unnecessary blank lines</technical_language>

Target:
public byte[] generateCSR(String sigAlg, KeyPair keyPair) { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(outStream); try { PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder( new X500Principal("CN=Requested Test Certificate"), keyPair.getPublic()); JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder("SHA256withRSA"); ContentSigner signer = csBuilder.build(keyPair.getPrivate()); PKCS10CertificationRequest csr = p10Builder.build(signer); return csr.getEncoded(); } catch (OperatorCreationException ex) { log.error("Error while Key generation operation", ex); } catch (IOException ex) { log.error("Error while generating CSR,ex"); } return new byte[0]; }
Source:
<code>private void decrementCurrentUsageInBytesIfRequired(long delta) { if(byteSized) { while(true) { long expect = currentUsageinBytes.get(); long update = expect - delta; if(update < 0l) { <START> throw new AssertionError("It's screwed"); <END> } if(currentUsageinBytes.compareAndSet(expect, update)) { break; } } } }</code><technical_language>I want this assertion</technical_language>

Target:
private void decrementCurrentUsageInBytesIfRequired(long delta) { if(byteSized) { long current = currentUsageinBytes.addAndGet(-delta); if(current < 0L) { throw new AssertionError("Current usage can never be negative"); } } }
Source:
<code>public void methodCallCanBeAnnotatedAsByName() { <START> db.getJdbi().useHandle(h -> { <END> h.getConfig(Enums.class).defaultByOrdinal(); Object byName = h.createQuery("select :name") .bind("name", Foobar.FOO.name()) .mapTo(QualifiedType.of(Foobar.class).with(EnumByName.class)) .findOnly(); assertThat(byName) .isEqualTo(Foobar.FOO); }); }</code><technical_language>grab Handle in a @Before removes need for a nested block in test</technical_language>

Target:
public void methodCallCanBeAnnotatedAsByName() { h.getConfig(Enums.class).setEnumStrategy(EnumStrategy.BY_ORDINAL); Object byName = h.createQuery("select :name") .bind("name", Foobar.FOO.name()) .mapTo(QualifiedType.of(Foobar.class).with(EnumByName.class)) .findOnly(); assertThat(byName) .isEqualTo(Foobar.FOO); }
Source:
<code>protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); bind(ObjectValidator.class).to(ApacheObjectValidator.class).in(Singleton.class); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerService.class); at("/r/aps").serve(AccessPointService.class); at("/r/operators").serve(OperatorService.class); at("/r/roaming-groups").serve(RoamingGroupService.class); <START> at("/r/network").serve(NetworkService.class); <END> } }); bindInterceptor(annotatedWith(Service.class), returns(only(Reply.class)), new HttpRequestErrorReporter("Internal Server Error")); }</code><technical_language>/r/networks</technical_language>

Target:
protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); bind(ObjectValidator.class).to(ApacheObjectValidator.class).in(Singleton.class); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerService.class); at("/r/aps").serve(AccessPointService.class); at("/r/operators").serve(OperatorService.class); at("/r/roaming-groups").serve(RoamingGroupService.class); at("/r/venues").serve(VenueService.class); at("/r/ip-types").serve(IpTypeService.class); at("/r/auth-types").serve(AuthTypeEndpoint.class); } }); bindInterceptor(annotatedWith(Service.class), returns(only(Reply.class)), new HttpRequestErrorReporter("Internal Server Error")); }
Source:
<code>public void visitFunctionDef(FunctionDef functionDef) { Optional.ofNullable(functionDef.name().symbol()).ifPresent(symbol -> { SymbolUsage symbolUsage = symbolToUsages.getOrDefault(symbol, new SymbolUsage()); symbolUsage.isWrite = true; <START> symbolToUsages.put(symbol, symbolUsage); <END> }); }</code><technical_language>I replaced by: symbolToUsages.computeIfAbsent(symbol, s -> new SymbolUsage()).isWrite = true;</technical_language>

Target:
public void visitFunctionDef(FunctionDef functionDef) { Optional.ofNullable(functionDef.name().symbol()).ifPresent(symbol -> symbolToUsages.computeIfAbsent(symbol, s -> new SymbolUsage()).isWrite = true); }