auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public <V> Setting<V> get(SimpleUri id, Class<V> valueType) { Setting setting = settings.get(id); Class settingValueClass = setting.getValueClass(); if (!settingValueClass.equals(valueType)) { throw new ClassCastException( "Expected a Setting of type " + valueType.getName() + ", found a Setting of type " + settingValueClass.getName() <START> ); <END> } return (Setting<V>) setting; }</code><technical_language>add name of setting in well</technical_language>

Target:
public <V> Setting<V> get(SimpleUri id, Class<V> valueType) { Setting setting = settings.get(id); if (setting == null) { return null; } Class settingValueClass = setting.getValueClass(); if (!settingValueClass.equals(valueType)) { throw new ClassCastException( "Expected a Setting of type " + valueType.getName() + ", found a Setting of type " + settingValueClass.getName() ); } return (Setting<V>) setting; }
Source:
<code>public void stop() { <START> entityFactory.abandonLeadership(entityIdentifier); <END> try { clusterConnection.close(); } catch (IOException ex) { throw new RuntimeException(ex); } }</code><technical_language>Is safe call holding it</technical_language>

Target:
public void stop() { entityFactory.abandonLeadership(entityIdentifier); entityFactory = null; try { clusterConnection.close(); } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
<code>ListOfMetrics(SweepMetric... metrics) { <START> this.metricsList = Arrays.stream(metrics).collect(Collectors.toList()); <END> }</code><technical_language>Arrays.asList(metrics) is simpler</technical_language>

Target:
ListOfMetrics(SweepMetric... metrics) { this.metricsList = Arrays.asList(metrics); }
Source:
<code>private Answer executeRequest(ShutDownVspCommand cmd) { try { isNuageVspElementLoaded(); _nuageVspElementClient.shutdownNetwork(cmd.getNetwork(), cmd.getDhcpOptions()); return new Answer(cmd, true, "Shutdown VPC " + cmd.getNetwork().getUuid()+ " on Nuage VSD " + _hostName); } catch (ConfigurationException e) { <START> s_logger.error("Failure during " + cmd + " on Nuage VSD " + _hostName, e); <END> return new Answer(cmd, e); } }</code><technical_language>Please add cmd.getDhcpOptions log message assist operational debugging</technical_language>

Target:
private Answer executeRequest(ShutDownVspCommand cmd) { try { isNuageVspElementLoaded(); _nuageVspElementClient.shutdownNetwork(cmd.getNetwork(), cmd.getDhcpOptions()); return new Answer(cmd, true, "Shutdown VPC " + cmd.getNetwork().getUuid()+ " on Nuage VSD " + _hostName); } catch (ConfigurationException e) { s_logger.error("Failure during " + cmd.toDetailString() + " on Nuage VSD " + _hostName, e); return new Answer(cmd, e); } }
Source:
<code>protected ITmfTreeViewerEntry updateElements(long start, long end, boolean selection) { <START> <END> if (selection) { fSelection = start; } if (getTrace() == null) { return null; } ITmfTreeViewerEntry root = getInput(); if (root == null) { root = createRoot(); } else if (fFilterStatus) { clearStateSystemEntries(root); } boolean changed = updateStateSystemEntries(root, fSelection); return selection || changed ? root : null; }</code><technical_language>start time is 0 opening a trace event time selected yet. This is reason children of state system shown opening a traces time opening view a trace is open</technical_language>

Target:
protected ITmfTreeViewerEntry updateElements(long start, long end, boolean selection) { if (selection) { fSelection = start; } else { fSelection = TmfTraceManager.getInstance().getSelectionBeginTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); } if (getTrace() == null) { return null; } ITmfTreeViewerEntry root = getInput(); if (root == null) { root = createRoot(); } else if (fFilterStatus) { clearStateSystemEntries(root); } boolean changed = updateStateSystemEntries(root, fSelection); return selection || changed ? root : null; }
Source:
<code>public void testMovingDirectoryWithErrorsAndDelays() throws Exception { int delay = 100; initNestedDirectory(7, 6, 9, 0); observer.checkAndNotify(); init(); addDelay(delay); File siblingDir = new File(monitoredDirectory, "child002"); observer.checkAndNotify(); timesToFail.set(10); Thread mover = new Thread( () -> { try { Thread.sleep(20); } catch (InterruptedException ignored) { } assertThat(grandchildDir.renameTo(siblingDir), is(true)); }); mover.start(); for (int i = 0; i < 4; i++) { runThreads(observer::checkAndNotify, 2); Thread.sleep(delay / 4); } Thread.sleep(delayBuf); observer.checkAndNotify(); Thread.sleep(delay + delayBuf); <START> Collection<Invocation> temp = Mockito.mockingDetails(fileListener).getInvocations(); <END> ArgumentCaptor<File> propertyKeyCaptor = ArgumentCaptor.forClass(File.class); Mockito.verify(fileListener, atLeast(0)).onFileCreate(propertyKeyCaptor.capture(), any()); Mockito.verify(fileListener, atLeast(0)).onFileDelete(propertyKeyCaptor.capture(), any()); assertThat(propertyKeyCaptor.getAllValues().size(), is(grandchildFiles.length * 2 + failures)); verify(fileListener, times(0)).onFileChange(any(File.class), any(Synchronization.class)); }</code><technical_language>Is this temp variable used</technical_language>

Target:
public void testMovingDirectoryWithErrorsAndDelays() throws Exception { initNestedDirectory(7, 6, 9, 0); observer.checkAndNotify(); init(); int toFail = 10; initSemaphore(toFail + grandchildFiles.length * 2); File siblingDir = new File(monitoredDirectory, "child002"); observer.checkAndNotify(); timesToFail.set(toFail); assertThat(grandchildDir.renameTo(siblingDir), is(true)); artificialDelay.release(totalSize + toFail); observer.checkAndNotify(); observer.checkAndNotify(); delayLatch.await(timeout, TimeUnit.MILLISECONDS); ArgumentCaptor<File> propertyKeyCaptor = ArgumentCaptor.forClass(File.class); Mockito.verify(fileListener, atLeast(0)).onFileCreate(propertyKeyCaptor.capture(), any()); Mockito.verify(fileListener, atLeast(0)).onFileDelete(propertyKeyCaptor.capture(), any()); assertThat(propertyKeyCaptor.getAllValues().size(), is(grandchildFiles.length * 2 + failures)); assertThat(failures, is(toFail)); verify(fileListener, never()).onFileChange(any(File.class), any(Synchronization.class)); assertThat(artificialDelay.getQueueLength(), is(0)); }
Source:
<code>public static CompletionStage<Report.Result> execute(final Report report, final Injector injector, final Instant scheduled) { verifyDependencies(report, injector); final ImmutableMultimap<ReportFormat, Recipient> formatToRecipients = report.getRecipientsByFormat() .entrySet() .stream() .collect(ImmutableSetMultimap.flatteningToImmutableSetMultimap( Map.Entry::getKey, e -> e.getValue().stream())); final ImmutableMultimap<Recipient, ReportFormat> recipientToFormats = formatToRecipients.inverse(); return renderAll(injector, formatToRecipients.keySet(), report.getSource(), scheduled) .thenCompose( formatToRendered -> sendAll(injector, recipientToFormats, formatToRendered) ).thenApply( <START> nothing -> null <END> ); }</code><technical_language>elaborate this is doing</technical_language>

Target:
public static CompletionStage<Report.Result> execute(final Report report, final Injector injector, final Instant scheduled) { final ImmutableMultimap<ReportFormat, Recipient> formatToRecipients = report.getRecipientsByFormat() .entrySet() .stream() .collect(ImmutableSetMultimap.flatteningToImmutableSetMultimap( Map.Entry::getKey, e -> e.getValue().stream())); final ImmutableMultimap<Recipient, ReportFormat> recipientToFormats = formatToRecipients.inverse(); return CompletableFuture.completedFuture(null).thenApply(nothing -> { verifyDependencies(report, injector); return null; }).thenCompose(nothing -> renderAll(injector, formatToRecipients.keySet(), report.getSource(), scheduled) ).thenCompose(formatToRendered -> sendAll(injector, recipientToFormats, formatToRendered) ).thenApply(nothing -> new DefaultReportResult() ); }
Source:
<code>public void testLoadAllNotes() { Note note; try { assertEquals(0, notebook.getAllNotes().size()); note = notebook.createNote(anonymous); Paragraph p1 = note.addParagraph(); Map config = p1.getConfig(); config.put("enabled", true); p1.setConfig(config); p1.setText("hello world"); note.persist(anonymous); } catch (IOException fe) { logger.warn("Failed to create note and paragraph. Safe to return, other tests might be failing as well", fe); return; <START> } <END> try { notebook.loadAllNotes(anonymous); assertEquals(1, notebook.getAllNotes().size()); } catch (IOException e) { fail("Subject is non-emtpy anonymous, shouldn't fail"); } }</code><technical_language>error message implies is intended failing condition for this test, return test pass. intention? I fine explicitly fail test if some pre-condition fail</technical_language>

Target:
public void testLoadAllNotes() { Note note; try { assertEquals(0, notebook.getAllNotes().size()); note = notebook.createNote(anonymous); Paragraph p1 = note.addParagraph(); Map config = p1.getConfig(); config.put("enabled", true); p1.setConfig(config); p1.setText("hello world"); note.persist(anonymous); } catch (IOException fe) { logger.warn("Failed to create note and paragraph. Possible problem with persisting note, safe to ignore", fe); } try { notebook.loadAllNotes(anonymous); assertEquals(1, notebook.getAllNotes().size()); } catch (IOException e) { fail("Subject is non-emtpy anonymous, shouldn't fail"); } }
Source:
<code>protected void updateMetricsOnFinish(TEnvironment env, long runtime, boolean success) { ProcedureMetrics metrics = getProcedureMetrics(env); if (metrics == null) { return; } if (success) { Histogram timeHisto = metrics.getTimeHisto(); if (timeHisto != null) { timeHisto.update(runtime); } <START> Histogram timeHistoOnMasterUI = metrics.getTimeHistoOnMasterUI(); <END> if (timeHistoOnMasterUI != null) { timeHistoOnMasterUI.update(runtime); } } else { Counter failedCounter = metrics.getFailedCounter(); if (failedCounter != null) { failedCounter.increment(); } } }</code><technical_language>"instance of" cast OperationMetricsForMasterUI. need add method interface</technical_language>

Target:
protected void updateMetricsOnFinish(TEnvironment env, long runtime, boolean success) { ProcedureMetrics metrics = getProcedureMetrics(env); if (metrics == null) { return; } if (success) { Histogram timeHisto = metrics.getTimeHisto(); if (timeHisto != null) { timeHisto.update(runtime); } if (metrics instanceof ProcedureMetricsForMasterUI) { ProcedureMetricsForMasterUI procedureMetricsForMasterUI = (ProcedureMetricsForMasterUI)metrics; if (procedureMetricsForMasterUI.getHistogramForMasterUI() != null) { procedureMetricsForMasterUI.getHistogramForMasterUI().update(runtime); } } } else { Counter failedCounter = metrics.getFailedCounter(); if (failedCounter != null) { failedCounter.increment(); } } }
Source:
<code>private void removeCheckpointFromDb() { Guid vmCheckpointId = getParameters().getVmBackup().getToCheckpointId(); log.info("Remove VmCheckpoint entity '{}'", vmCheckpointId); <START> vmCheckpointDao.removeAllDisksFromCheckpoint(vmCheckpointId); <END> vmCheckpointDao.remove(vmCheckpointId); }</code><technical_language>executed in a new transaction safe side</technical_language>

Target:
private void removeCheckpointFromDb() { Guid vmCheckpointId = getParameters().getVmBackup().getToCheckpointId(); log.info("Remove VmCheckpoint entity '{}'", vmCheckpointId); TransactionSupport.executeInNewTransaction(() -> { vmCheckpointDao.removeAllDisksFromCheckpoint(vmCheckpointId); vmCheckpointDao.remove(vmCheckpointId); return null; }); }
Source:
<code>public void testGoodCase() throws Exception { initialize(); BlobId convertedBlobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); <START> assertTrue("The converted BlobId should be the same as the original.", convertedBlobId.equals(originalBlobId)); <END> }</code><technical_language>assertEquals</technical_language>

Target:
public void testGoodCase() throws Exception { initialize(); BlobId convertedBlobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); assertEquals("The converted BlobId should be the same as the original.", originalBlobId, convertedBlobId); }
Source:
<code>private static List<CompositeRequirement> wrapAsCompositeRequirements(List<Requirement> requirements) { return requirements.stream().map((Requirement requirement) -> { if (requirement instanceof CompositeRequirement) { return (CompositeRequirement) requirement; } else { return new SingletonCompositeRequirement(requirement); } <START> }).collect(Collectors.toList()); <END> }</code><technical_language>static import, toImmutablelist</technical_language>

Target:
private static List<CompositeRequirement> wrapAsCompositeRequirements(List<Requirement> requirements) { return requirements.stream() .map((Requirement requirement) -> { if (requirement instanceof CompositeRequirement) { return (CompositeRequirement) requirement; } else { return new SingletonCompositeRequirement(requirement); } }).collect(toImmutableList()); }
Source:
<code>protected ZkServer startZkServer(final String zkAddress) { String zkDir = zkAddress.replace(':', '_'); final String logDir = "/tmp/" + zkDir + "/logs"; final String dataDir = "/tmp/" + zkDir + "/dataDir"; try { FileUtils.deleteDirectory(new File(dataDir)); FileUtils.deleteDirectory(new File(logDir)); } catch (IOException e) { e.printStackTrace(); } IDefaultNameSpace defaultNameSpace = zkClient -> { }; int port = Integer.parseInt(zkAddress.substring(zkAddress.lastIndexOf(':') + 1)); ZkServer zkServer = new ZkServer(dataDir, logDir, defaultNameSpace, port); System.out.println("Starting ZK server at " + zkAddress); try { zkServer.start(); <START> } catch (Exception e) { <END> e.printStackTrace(); } return zkServer; }</code><technical_language>reason catch exception print? I guess want stacktrace for debugging. please noted if exception is thrown, this change return a zkServer started. I this is expected, is it? I guest keeping throw exception test proceed</technical_language>

Target:
protected ZkServer startZkServer(final String zkAddress) { String zkDir = zkAddress.replace(':', '_'); final String logDir = "/tmp/" + zkDir + "/logs"; final String dataDir = "/tmp/" + zkDir + "/dataDir"; try { FileUtils.deleteDirectory(new File(dataDir)); FileUtils.deleteDirectory(new File(logDir)); } catch (IOException e) { e.printStackTrace(); } IDefaultNameSpace defaultNameSpace = zkClient -> { }; int port = Integer.parseInt(zkAddress.substring(zkAddress.lastIndexOf(':') + 1)); ZkServer zkServer = new ZkServer(dataDir, logDir, defaultNameSpace, port); System.out.println("Starting ZK server at " + zkAddress); zkServer.start(); return zkServer; }
Source:
<code>public void setUserTransactionOperationsProviderClassName(String providerClassName) { synchronized (this) { if(providerClassName == null) { this.userTransactionOperationsProvider = null; } else if(!providerClassName.equals(this.userTransactionOperationsProviderClassName)) { this.userTransactionOperationsProvider = null; } this.userTransactionOperationsProviderClassName = providerClassName; <START> } <END> }</code><technical_language>is initialized null. allowing callers set null</technical_language>

Target:
public void setUserTransactionOperationsProviderClassName(String providerClassName) { synchronized (this) { if (!userTransactionOperationsProviderClassName.equals(providerClassName)) { userTransactionOperationsProvider = null; } if(providerClassName == null) { userTransactionOperationsProviderClassName = defaultTransactionOperationsProviderClassName; } else { userTransactionOperationsProviderClassName = providerClassName; } } }
Source:
<code>public HighlightImpl(int beginIndex, int endIndex) { <START> this.valueIndex = 0; <END> this.beginIndex = beginIndex; this.endIndex = endIndex; }</code><technical_language>call other ctor</technical_language>

Target:
public HighlightImpl(int beginIndex, int endIndex) { this(beginIndex, endIndex, 0); }
Source:
<code>public ResponseEntity<?> getCursors(@PathVariable("subscriptionId") final String subscriptionId, final NativeWebRequest request) { <START> if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.HIGH_LEVEL_API)) { <END> return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } try { return ResponseEntity.status(HttpStatus.OK).body(cursorsCommitService.getSubscriptionCursors(subscriptionId)); } catch (final NakadiException e) { return Responses.create(e.asProblem(), request); } }</code><technical_language>Static import</technical_language>

Target:
public ResponseEntity<?> getCursors(@PathVariable("subscriptionId") final String subscriptionId, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final List<Cursor> cursors = cursorsService.getSubscriptionCursors(subscriptionId); return status(OK).body(cursors); } catch (final NakadiException e) { return create(e.asProblem(), request); } }
Source:
<code>public BookPageCrafting(String name, IRecipe... recipes) { super(name); output = recipes[0].getRecipeOutput(); for (IRecipe recipe : recipes) { if (recipe instanceof ShapedRecipeFactory.ShapedRecipe) { for (int i = 0; i < 9; i++) { Collection<Object> newList = new ArrayList<>(); if (inputs[i] != null) { if (inputs[i] instanceof Collection) { newList.addAll((Collection) inputs[i]); } else { <START> newList.add(inputs[i]); END> } } if (recipe.getIngredients().size() > i && recipe.getIngredients().get(i) != Ingredient.EMPTY) { newList.addAll(Arrays.asList(recipe.getIngredients().get(i).getMatchingStacks())); } inputs[i] = newList; } } else if (recipe instanceof ShapelessRecipeFactory.ShapelessRecipe) { NonNullList<Ingredient> recipeInputs = recipe.getIngredients(); for (int i = 0; i < 9; i++) { Collection<Object> newList = new ArrayList<>(); if (inputs[i] != null) { if (inputs[i] instanceof Collection) { newList.addAll((Collection) inputs[i]); } else { newList.add(inputs[i]); } } if (recipeInputs.size() > i) { newList.addAll(Arrays.asList(recipeInputs.get(i).getMatchingStacks())); } inputs[i] = newList; } } } recipe = recipes; }</code><technical_language>is this happen</technical_language>

Target:
public BookPageCrafting(String name, IRecipe... recipes) { super(name); output = recipes[0].getRecipeOutput(); for (IRecipe recipe : recipes) { if(recipe != null) { for (int i = 0; i < 9; i++) { Collection<Object> newList = new ArrayList<>(); if (inputs[i] != null) { if (inputs[i] instanceof Collection) { newList.addAll((Collection) inputs[i]); } else { newList.add(inputs[i]); } } if (recipe.getIngredients().size() > i && recipe.getIngredients().get(i) != Ingredient.EMPTY) { newList.addAll(Arrays.asList(recipe.getIngredients().get(i).getMatchingStacks())); } inputs[i] = newList; } } } recipe = recipes; }
Source:
<code>public void testReturnSameNameIfRepositoryDoesNotExist() { <START> POM pom = new POM("repository", <END> "description", "url", null); WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService; String newName = impl.createProjectName(this.ou1, pom.getName()); assertEquals("repository", newName); }</code><technical_language>param of this constructor represents project name. String "repository" a for is confusing :) Please change "projectName" similar. applies usages in this test class</technical_language>

Target:
public void testReturnSameNameIfRepositoryDoesNotExist() { String projectName = "projectA"; POM pom = new POM(projectName, "description", "url", null); WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService; String newName = impl.createFreshProjectName(this.ou1, pom.getName()); assertEquals(projectName, newName); }
Source:
<code>private synchronized void checkIfOpen() { if (status != TxStatus.OPEN) { <START> throw new IllegalStateException("Transation is no longer open!"); <END> } }</code><technical_language>I this approach putting current status in exception message useful for debugging if occurs</technical_language>

Target:
private synchronized void checkIfOpen() { if (status != TxStatus.OPEN) { throw new IllegalStateException("Transation is no longer open! status = " + status); } }
Source:
<code>private void disassociate(VirtualItem item) { unmapElement(item.getData(), item); item.setData(null); for (VirtualItem <START> item2 : <END> item.getItems()) { if (item2.getData() != null) { disassociate(item2); } } }</code><technical_language>rename childItem</technical_language>

Target:
private void disassociate(VirtualItem item) { unmapElement(item.getData(), item); item.setData(null); for (VirtualItem childItem : item.getItems()) { if (childItem.getData() != null) { disassociate(childItem); } } }
Source:
<code>public BuildersBaneEffect() { super(Outcome.DestroyPermanent); <START> this.staticText = "Destroy X target artifacts. Builder's Bane deals damage to each player equal to the number of artifacts he or she controlled put into a graveyard this way."; <END> }</code><technical_language>{this} instead of card name. Add full stop end of effect texts</technical_language>

Target:
public BuildersBaneEffect() { super(Outcome.DestroyPermanent); this.staticText = "Destroy X target artifacts. {this} deals damage to each player equal to the number of artifacts he or she controlled put into a graveyard this way"; }
Source:
<code>ApplyFunctionExpr(ApplyFunction function, String name, LambdaExpr expr, List<Expr> args) { this.function = function; this.name = name; this.argsExpr = ImmutableList.copyOf(args); this.lambdaExpr = expr; function.validateArguments(expr, args); ImmutableList.Builder<BindingDetails> argBindingDetailsBuilder = ImmutableList.builder(); BindingDetails accumulator = new BindingDetails(); for (Expr arg : argsExpr) { BindingDetails argDetails = arg.analyzeInputs(); argBindingDetailsBuilder.add(argDetails); accumulator = accumulator.with(argDetails); } lambdaBindingDetails = lambdaExpr.analyzeInputs(); <START> boolean isArrayOutput = function.hasArrayOutput() || (function instanceof ApplyFunction.BaseFoldFunction <END> && lambdaBindingDetails.isOutputArray()); bindingDetails = accumulator.with(lambdaBindingDetails) .withArrayArguments(function.getArrayInputs(argsExpr)) .withArrayInputs(true) .withArrayOutput(isArrayOutput); argsBindingDetails = argBindingDetailsBuilder.build(); }</code><technical_language>instanceof a code smell -- is a nice add a method ApplyFunction necessary info out</technical_language>

Target:
ApplyFunctionExpr(ApplyFunction function, String name, LambdaExpr expr, List<Expr> args) { this.function = function; this.name = name; this.argsExpr = ImmutableList.copyOf(args); this.lambdaExpr = expr; function.validateArguments(expr, args); ImmutableList.Builder<BindingDetails> argBindingDetailsBuilder = ImmutableList.builder(); BindingDetails accumulator = new BindingDetails(); for (Expr arg : argsExpr) { BindingDetails argDetails = arg.analyzeInputs(); argBindingDetailsBuilder.add(argDetails); accumulator = accumulator.with(argDetails); } lambdaBindingDetails = lambdaExpr.analyzeInputs(); bindingDetails = accumulator.with(lambdaBindingDetails) .withArrayArguments(function.getArrayInputs(argsExpr)) .withArrayInputs(true) .withArrayOutput(function.hasArrayOutput(lambdaExpr)); argsBindingDetails = argBindingDetailsBuilder.build(); }
Source:
<code>public Mono<CustomFormModel> getCustomModel(String modelId) { try { return getCustomFormModelWithResponse(modelId).flatMap(FluxUtil::toMono); <START> } catch (RuntimeException ex) { <END> return monoError(logger, ex); } }</code><technical_language>need catch exception here, done in overload</technical_language>

Target:
public Mono<CustomFormModel> getCustomModel(String modelId) { return getCustomModelWithResponse(modelId).flatMap(FluxUtil::toMono); }
Source:
<code>private CompletionStage<Void> applyChunk(Address sender, IntSet mySegments, StateChunk stateChunk) { if (!mySegments.contains(stateChunk.getSegmentId())) { <START> log.warnf("Discarding received cache entries for segment %d of cache %s because they do not belong to this node.", <END> stateChunk.getSegmentId(), cacheName); return CompletableFutures.completedNull(); } InboundTransferTask inboundTransfer; synchronized (transferMapsLock) { List<InboundTransferTask> inboundTransfers = transfersBySegment.get(stateChunk.getSegmentId()); if (inboundTransfers != null) { inboundTransfer = inboundTransfers.stream().filter(task -> task.getSource().equals(sender)).findFirst().orElse(null); } else { inboundTransfer = null; } } if (inboundTransfer != null) { return doApplyState(sender, stateChunk.getSegmentId(), stateChunk.getCacheEntries()) .thenAccept( v -> inboundTransfer.onStateReceived(stateChunk.getSegmentId(), stateChunk.isLastChunk())); } else { if (cache.wired().getStatus().allowInvocations()) { log.ignoringUnsolicitedState(sender, stateChunk.getSegmentId(), cacheName); } } return CompletableFutures.completedNull(); }</code><technical_language>this a log message while here? :)</technical_language>

Target:
private CompletionStage<Void> applyChunk(Address sender, IntSet mySegments, StateChunk stateChunk) { if (!mySegments.contains(stateChunk.getSegmentId())) { log.debugf("Discarding received cache entries for segment %d of cache %s because they do not belong to this node.", stateChunk.getSegmentId(), cacheName); return CompletableFutures.completedNull(); } InboundTransferTask inboundTransfer; synchronized (transferMapsLock) { List<InboundTransferTask> inboundTransfers = transfersBySegment.get(stateChunk.getSegmentId()); if (inboundTransfers != null) { inboundTransfer = inboundTransfers.stream().filter(task -> task.getSource().equals(sender)).findFirst().orElse(null); } else { inboundTransfer = null; } } if (inboundTransfer != null) { return doApplyState(sender, stateChunk.getSegmentId(), stateChunk.getCacheEntries()) .thenAccept( v -> inboundTransfer.onStateReceived(stateChunk.getSegmentId(), stateChunk.isLastChunk())); } else { if (cache.wired().getStatus().allowInvocations()) { log.ignoringUnsolicitedState(sender, stateChunk.getSegmentId(), cacheName); } } return CompletableFutures.completedNull(); }
Source:
<code>public String getDocumentTitle() { JavascriptExecutor js = (JavascriptExecutor) driver; <START> return (String) js.executeScript("return arguments[0].innerText", documentTitle); <END> }</code><technical_language>toString() instead of casting</technical_language>

Target:
public String getDocumentTitle() { return (String) jsActions.execute("return arguments[0].innerText", documentTitle); }
Source:
<code>private TreeViewer createTreeViewer(final Composite parent) { final int style = SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; EObjectFilter filter = new EObjectFilter(); filter.setIncludeLeadingWildcard(true); <START> try { Class<?> c = filter.getClass().getSuperclass(); Field f = c.getDeclaredField("useEarlyReturnIfMatcherIsNull"); f.setAccessible(true); f.setBoolean(filter, Boolean.FALSE); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException x) { } <END> tree = SWTUtil.createFilteredTree(parent, style, filter); ReflectionHelper.invokeMethodWithoutException(tree, "setQuickSelectionMode", new Class[] { Boolean.TYPE }, new Object[] { true }); final TreeViewer viewer = tree.getViewer(); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); viewer.getControl().setLayoutData(gridData); viewer.getTree().setHeaderVisible(false); viewer.getTree().setLinesVisible(false); viewer.setContentProvider(new SessionContentProvider()); viewer.setLabelProvider(new AdapterFactoryLabelProvider(ViewHelper.INSTANCE.createAdapterFactory())); return viewer; }</code><technical_language>Do want this? yes, org.eclipse.sirius.common.tools.api.util.ReflectionHelper hides messy details of dealing reflection. put in EObjectFilter class</technical_language>

Target:
private TreeViewer createTreeViewer(final Composite parent) { final int style = SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; EObjectFilter filter = new EObjectFilter(); filter.setIncludeLeadingWildcard(true); ReflectionHelper.setFieldValueWithoutException(filter, "useEarlyReturnIfMatcherIsNull", Boolean.FALSE); tree = SWTUtil.createFilteredTree(parent, style, filter); ReflectionHelper.invokeMethodWithoutException(tree, "setQuickSelectionMode", new Class[] { Boolean.TYPE }, new Object[] { true }); final TreeViewer viewer = tree.getViewer(); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); viewer.getControl().setLayoutData(gridData); viewer.getTree().setHeaderVisible(false); viewer.getTree().setLinesVisible(false); viewer.setContentProvider(new SessionContentProvider()); viewer.setLabelProvider(new AdapterFactoryLabelProvider(ViewHelper.INSTANCE.createAdapterFactory())); return viewer; }
Source:
<code><START> public ArrayList<ItemBatchOperation<?>> getOperations() { <END> return operations; }</code><technical_language>is this method needed for implementation (other implementation classes accessing operations list) is needed part of public api</technical_language>

Target:
public List<CosmosItemOperation> getOperations() { return UnmodifiableList.unmodifiableList(operations); }
Source:
<code>public StreamlineEvent injectCorrelationInformation(StreamlineEvent event, List<StreamlineEvent> parentEvents, String componentName) { Set<String> rootIds = new HashSet<>(); Set<String> parentIds = new HashSet<>(); if (!parentEvents.isEmpty()) { parentEvents.forEach(parentEvent -> { Set<String> rootIdsForParent = EventCorrelationInjector.getRootIds(parentEvent); if (rootIdsForParent != null && !rootIdsForParent.isEmpty()) { rootIds.addAll(rootIdsForParent); } else { rootIds.add(parentEvent.getId()); } parentIds.add(parentEvent.getId()); }); } Map<String, Object> header = new HashMap<>(); header.putAll(event.getHeader()); header.put(HEADER_KEY_ROOT_IDS, rootIds); header.put(HEADER_KEY_PARENT_IDS, parentIds); header.put(HEADER_KEY_SOURCE_COMPONENT_NAME, componentName); return StreamlineEventImpl.builder() .from(event) <START> .header(ImmutableMap.copyOf(header)) <END> .build(); }</code><technical_language>i immutable map created header() caller. add putHeader(k, v) if want avoid creating map above</technical_language>

Target:
public StreamlineEvent injectCorrelationInformation(StreamlineEvent event, List<StreamlineEvent> parentEvents, String componentName) { Set<String> rootIds = new HashSet<>(); Set<String> parentIds = new HashSet<>(); if (!parentEvents.isEmpty()) { parentEvents.forEach(parentEvent -> { Set<String> rootIdsForParent = EventCorrelationInjector.getRootIds(parentEvent); if (rootIdsForParent != null && !rootIdsForParent.isEmpty()) { rootIds.addAll(rootIdsForParent); } else { rootIds.add(parentEvent.getId()); } parentIds.add(parentEvent.getId()); }); } Map<String, Object> header = new HashMap<>(); header.putAll(event.getHeader()); header.put(HEADER_KEY_ROOT_IDS, rootIds); header.put(HEADER_KEY_PARENT_IDS, parentIds); header.put(HEADER_KEY_SOURCE_COMPONENT_NAME, componentName); return StreamlineEventImpl.builder() .from(event) .header(header) .build(); }
Source:
<code>default PeekableIntIterator peekableIterator() { <START> return new PeekableIteratorAdapter(iterator()); <END> }</code><technical_language>nit: IntelliJ is complaining raw types return new PeekableIteratorAdapter<>(iterator());</technical_language>

Target:
default PeekableIntIterator peekableIterator() { return new PeekableIteratorAdapter<>(iterator()); }
Source:
<code>public String toString() { <START> return name + (version != null ? ":" + version : ""); <END> }</code><technical_language>Mb is common format for toString method? <LINK_0></technical_language>

Target:
public String toString() { return "AgentImpl{" + "name='" + name + '\'' + ", version='" + version + "\'}"; }
Source:
<code>public void afterPropertiesSet() throws Exception { if (StringUtils.hasText(this.location)) { this.script = this.applicationContext.getResource(this.location); } ScriptSource scriptSource = new RefreshableResourceScriptSource(this.script, this.refreshCheckDelay); if (!StringUtils.hasText(this.lang)) { String filename = this.script.getFilename(); int index = filename.lastIndexOf(".") + 1; if (index < 1) { throw new BeanCreationException("'lang' isn't provided and there is 'file extension' for script " + "resource: " + this.script); } this.lang = filename.substring(index); } if (groovyScriptExecutingMessageProcessorConstructor != null && "groovy".equals(this.lang.toLowerCase())) { <START> this.delegate = (AbstractScriptExecutingMessageProcessor) groovyScriptExecutingMessageProcessorConstructor <END> .newInstance(scriptSource, this.variableGenerator); } else { this.delegate = new ScriptExecutingMessageProcessor(scriptSource, this.variableGenerator, ScriptExecutorFactory.getScriptExecutor(this.lang)); } this.delegate.setBeanFactory(this.applicationContext); this.delegate.setBeanClassLoader(this.applicationContext.getClassLoader()); }</code><technical_language>Raw type; needs <?></technical_language>

Target:
public void afterPropertiesSet() throws Exception { if (StringUtils.hasText(this.location)) { this.script = this.applicationContext.getResource(this.location); } ScriptSource scriptSource = new RefreshableResourceScriptSource(this.script, this.refreshCheckDelay); if (!StringUtils.hasText(this.lang)) { String filename = this.script.getFilename(); int index = filename.lastIndexOf(".") + 1; if (index < 1) { throw new BeanCreationException("'lang' isn't provided and there is 'file extension' for script " + "resource: " + this.script); } this.lang = filename.substring(index); } if (this.applicationContext.containsBean(ScriptExecutingProcessorFactory.BEAN_NAME)) { ScriptExecutingProcessorFactory processorFactory = this.applicationContext.getBean(ScriptExecutingProcessorFactory.BEAN_NAME, ScriptExecutingProcessorFactory.class); this.delegate = processorFactory.createMessageProcessor(this.lang, scriptSource, this.variableGenerator); } else { this.delegate = new ScriptExecutingMessageProcessor(scriptSource, this.variableGenerator, ScriptExecutorFactory.getScriptExecutor(this.lang)); } this.delegate.setBeanFactory(this.applicationContext); this.delegate.setBeanClassLoader(this.applicationContext.getClassLoader()); }
Source:
<code>public String toString() { if (this != defaultInstance) { return String.format("%30s: slot %s, fbo %s, textureType %s, material %s, parameter '%s'", this.getClass().getSimpleName(), <START> textureSlot, fbo.getId(), textureType.name(), materialUrn.toString(), shaderParameterName); <END> } else { return String.format("%30s: slot %s, textureId 0, material %s, parameter '%s'", this.getClass().getSimpleName(), textureSlot, materialUrn.toString(), shaderParameterName); } }</code><technical_language>mentioned earlier, need name/urn here</technical_language>

Target:
public String toString() { if (this != defaultInstance) { return String.format("%30s: slot %s, fbo %s (fboId: %s), textureType %s, material %s, parameter '%s'", this.getClass().getSimpleName(), textureSlot, fbo.getName(), fbo.getId(), textureType.name(), materialUrn.toString(), shaderParameterName); } else { return String.format("%30s: slot %s, textureId 0, material %s, parameter '%s'", this.getClass().getSimpleName(), textureSlot, materialUrn.toString(), shaderParameterName); } }
Source:
<code>protected void onGooglePlayServicesReady() { SupportMapFragment fragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); map = fragment.getMap(); map.setMyLocationEnabled(true); map.setOnMarkerClickListener(new OnMarkerClick()); ModelCallback<Request> markerFactoryCallback = new ModelCallback<Request>() { @Override public void onModelFound(Request request) { if (request.getClient() == null) { <START> Log.d("debug", "bad pointer...skipping this marker"); <END> } else { Marker marker = map.addMarker(MapUtil.getSpeechBubbleMarkerOptions(request.getClient(), iconGenerator, SpeechBubble.ColorType.BLACK)); markerRequestMap.put(marker, request); } } @Override public void onModelError(Throwable e) { RequestMapActivity.this.onError(e); } }; User user = (User) ParseUser.getCurrentUser(); user.findNearbyRequests(Request.State.OPEN, markerFactoryCallback); map.addMarker(MapUtil.getSpeechBubbleMarkerOptions(user.getGoogleMapsLocation(), getResources().getString(R.string.you), iconGenerator, SpeechBubble.ColorType.PURPLE)); MapUtil.panAndZoomToCurrentUser(map, MapUtil.DEFAULT_ZOOM_LEVEL); }</code><technical_language>java if (request.getClient() == null) { onError(new InvalidStateException("Request a Client")) return; }</technical_language>

Target:
protected void onGooglePlayServicesReady() { SupportMapFragment fragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); map = fragment.getMap(); map.setMyLocationEnabled(true); map.setOnMarkerClickListener(new OnMarkerClick()); ModelCallback<Request> markerFactoryCallback = new ModelCallback<Request>() { @Override public void onModelFound(Request request) { if (request.getClient() == null) { onError(new IllegalStateException("Request does not have a Client")); return; } else { Marker marker = map.addMarker(MapUtil.getSpeechBubbleMarkerOptions(request.getClient(), iconGenerator, SpeechBubble.ColorType.BLACK)); markerRequestMap.put(marker, request); } } @Override public void onModelError(Throwable e) { RequestMapActivity.this.onError(e); } }; User user = (User) ParseUser.getCurrentUser(); user.findNearbyRequests(Request.State.OPEN, markerFactoryCallback); if (user.getGoogleMapsLocation() != null) { map.addMarker(MapUtil.getSpeechBubbleMarkerOptions(user.getGoogleMapsLocation(), getResources().getString(R.string.you), iconGenerator, SpeechBubble.ColorType.PURPLE)); MapUtil.panAndZoomToCurrentUser(map, MapUtil.DEFAULT_ZOOM_LEVEL); } }
Source:
<code>public List<vm_pools> getAllForAdGroup(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("ad_group_id", id); <START> return getCallsHandler().executeReadList("GetVm_poolsByAdGroup_id", new VmPoolRowMapper(), parameterSource); <END> }</code><technical_language>need "new" - classes stateless, risk of (or more threads changing a state of a single instance, u hold a single instance of a mapper. aware fact "new" is expensive operation</technical_language>

Target:
public List<vm_pools> getAllForAdGroup(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("ad_group_id", id); return getCallsHandler().executeReadList("GetVm_poolsByAdGroup_id", vmPoolRowMapper, parameterSource); }
Source:
<code>public void testGetEObjectChildrenWithGenerics() throws IOException { final GenericsMatchInputData mockModel = new GenericsMatchInputData(); final Resource leftResource = mockModel.getLeft(); final Resource rightResource = mockModel.getRight(); assertNotNull(leftResource); assertNotNull(rightResource); final IComparisonScope resourceScope = new DefaultComparisonScope(leftResource, rightResource, null); final Iterator<EObject> leftContent = EcoreUtil.getAllProperContents(leftResource, false); final Iterator<EObject> rightContent = EcoreUtil.getAllProperContents(rightResource, false); final Iterator<EObject> allEObjects = Iterators.concat(leftContent, rightContent); <START> boolean empty = true; <END> while (allEObjects.hasNext()) { empty = false; final EObject root = allEObjects.next(); final Iterator<? extends EObject> scopeChildren = resourceScope.getChildren(root); final List<EObject> children = Lists.newArrayList(Iterators.filter(EcoreUtil .getAllProperContents(root, false), EObject.class)); while (scopeChildren.hasNext()) { assertTrue(children.remove(scopeChildren.next())); } for (EObject outOfScope : children) { assertTrue(outOfScope instanceof EGenericType); assertTrue(EMFComparePredicates.IS_EGENERIC_TYPE_WITHOUT_PARAMETERS.apply(outOfScope)); } } assertFalse(empty); }</code><technical_language>"assertTrue(allEObjects.hasNext())" right instead of this boolean</technical_language>

Target:
public void testGetEObjectChildrenWithGenerics() throws IOException { final GenericsMatchInputData mockModel = new GenericsMatchInputData(); final Resource leftResource = mockModel.getLeft(); final Resource rightResource = mockModel.getRight(); assertNotNull(leftResource); assertNotNull(rightResource); final IComparisonScope resourceScope = new DefaultComparisonScope(leftResource, rightResource, null); final Iterator<EObject> leftContent = EcoreUtil.getAllProperContents(leftResource, false); final Iterator<EObject> rightContent = EcoreUtil.getAllProperContents(rightResource, false); final Iterator<EObject> allEObjects = Iterators.concat(leftContent, rightContent); assertTrue(allEObjects.hasNext()); while (allEObjects.hasNext()) { final EObject root = allEObjects.next(); final Iterator<? extends EObject> scopeChildren = resourceScope.getChildren(root); final List<EObject> children = Lists.newArrayList(Iterators.filter(EcoreUtil .getAllProperContents(root, false), EObject.class)); while (scopeChildren.hasNext()) { assertTrue(children.remove(scopeChildren.next())); } for (EObject outOfScope : children) { assertTrue(outOfScope instanceof EGenericType); assertTrue(EMFComparePredicates.IS_EGENERIC_TYPE_WITHOUT_PARAMETERS.apply(outOfScope)); } } }
Source:
<code>public String getActivationEventType() { return "RuleFlow-Milestone-" + getProcessInstance().getProcessId() <START> + "-" + getMilestoneNode().getUniqueId() + "-" + ((WorkflowProcessInstanceImpl) getProcessInstance()).getCorrelationKey(); <END> }</code><technical_language>similar here, append correlation key is running in case context</technical_language>

Target:
public String getActivationEventType() { String caseId = (String) getProcessInstance().getKnowledgeRuntime().getEnvironment().get(EnvironmentName.CASE_ID); String eventType = "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); return (caseId != null) ? eventType + "-" + caseId : eventType; }
Source:
<code>public void testListDatacenters() throws Exception { server.enqueue(jsonResponse("/datacenters.json")); Iterable<Datacenter> datacenters = api.getInfrastructureApi().listDatacenters().concat(); assertEquals(size(datacenters), 2); assertEquals(server.getRequestCount(), 2); Uris.UriBuilder uriBuilder = Uris .uriBuilder("/caas/2.4/6ac1e746-b1ea-4da5-a24e-caf1a978789d/infrastructure/datacenter"); <START> Set<String> zones = ctx.utils().injector().getInstance(ZoneIdsSupplier.class).get(); <END> for (String zone : zones) { uriBuilder.addQuery("id", zone); } assertSent(HttpMethod.GET, uriBuilder.toString()); }</code><technical_language>Is a configured for this? (perhaps in base class) configure some zones this test properly verifies behaviour</technical_language>

Target:
public void testListDatacenters() throws Exception { server.enqueue(jsonResponse("/datacenters.json")); Iterable<Datacenter> datacenters = api.getInfrastructureApi().listDatacenters().concat(); assertEquals(size(datacenters), 2); assertEquals(server.getRequestCount(), 2); assertSent(HttpMethod.GET, expectedListDatacentersUriBuilder().toString()); }
Source:
<code>public AvailabilityType getAvailabilityBMXInternal() { boolean availability = false; try { <START> URL url = new URL(ApacheServerComponent.getBMXUrl()); <END> HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.connect(); if(urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) availability = true; else availability = false; }catch (ConnectException e) { LOG.info("The Apache server is down !"); } catch (MalformedURLException e) { LOG.error("Malformed URL : " + ApacheServerComponent.getBMXUrl()); } catch (IOException e) { e.printStackTrace(); } if(!availability) return AvailabilityType.DOWN; else return AvailabilityType.UP; }</code><technical_language>resourceContext.getParentResourceComponent() instead of a static method</technical_language>

Target:
public AvailabilityType getAvailabilityBMXInternal() { boolean availability = false; HttpURLConnection urlConn = null; try { URL url = new URL(resourceContext.getParentResourceComponent().getBMXUrl()); urlConn = (HttpURLConnection) url.openConnection(); urlConn.connect(); if(urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) availability = true; else availability = false; } catch (ConnectException e) { LOG.info("The Apache server is down !"); } catch (MalformedURLException e) { LOG.error("Malformed URL : " + resourceContext.getParentResourceComponent().getBMXUrl()); } catch (IOException e) { LOG.error("IO Error on : " + resourceContext.getParentResourceComponent().getBMXUrl()); } finally { if (urlConn != null) { try { urlConn.disconnect(); } catch (Exception e) { } } } if(!availability) return AvailabilityType.DOWN; else return AvailabilityType.UP; }
Source:
<code><START> public static void checkStreamCipher(Cipher cipher) { <END> if (cipher.getTransformation() != CipherTransformation.AES_CTR_NOPADDING && cipher.getTransformation() != CipherTransformation.AES_CBC_NOPADDING && cipher.getTransformation() != CipherTransformation .AES_CBC_PKCS5PADDING) { throw new UnsupportedCipherException("AES/CTR/NoPadding is required"); } }</code><technical_language>Is this method needed? CipherTransformation is enum, invalid cipher.getTransformation() return is null. Also, if keeping this code, exception message is out of date</technical_language>

Target:
public static void checkStreamCipher(Cipher cipher) { if (cipher.getTransformation() != CipherTransformation.AES_CTR_NOPADDING) { throw new UnsupportedCipherException("AES/CTR/NoPadding is required"); } }
Source:
<code>private static SyntaxErrorEvent generateInvalidVariableError(Object offendingSymbol, int line, int charPositionInLine, RecognitionException e, CommonToken token) { String chars = token.getText().length() == 1 ? "character" : "sequence of characters"; if( charPositionInLine == 0 ) { if( "in".equals( token.getText() ) || REUSABLE_KEYWORDS.contains( token.getText() ) ) { return new SyntaxErrorEvent( FEELEvent.Severity.ERROR, Msg.createMessage( Msg.INVALID_VARIABLE_NAME_START, "keyword", token.getText() ), e, line, charPositionInLine, offendingSymbol ); } else { return new SyntaxErrorEvent( FEELEvent.Severity.ERROR, Msg.createMessage( Msg.INVALID_VARIABLE_NAME_START, chars, token.getText() ), e, line, charPositionInLine, offendingSymbol ); } } else if( "in".equals( token.getText() ) ) { return new SyntaxErrorEvent(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.INVALID_VARIABLE_NAME, "keyword", token.getText()), e, line, charPositionInLine, offendingSymbol); <START> } else if( "}".equals( token.getText() ) ) { <END> return new SyntaxErrorEvent(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.MISSING_EXPRESSION), e, line, charPositionInLine, offendingSymbol); } else { return new SyntaxErrorEvent( FEELEvent.Severity.ERROR, Msg.createMessage( Msg.INVALID_VARIABLE_NAME, chars, token.getText() ), e, line, charPositionInLine, offendingSymbol ); } }</code><technical_language>this condition is enough determine proper error message. need check this done part of a context, a writing a random variable name includes "}" raise this error if is a context. I a do that</technical_language>

Target:
private static SyntaxErrorEvent generateInvalidVariableError(Object offendingSymbol, int line, int charPositionInLine, RecognitionException e, CommonToken token) { String chars = token.getText().length() == 1 ? "character" : "sequence of characters"; if( charPositionInLine == 0 ) { if( "in".equals( token.getText() ) || REUSABLE_KEYWORDS.contains( token.getText() ) ) { return new SyntaxErrorEvent( FEELEvent.Severity.ERROR, Msg.createMessage( Msg.INVALID_VARIABLE_NAME_START, "keyword", token.getText() ), e, line, charPositionInLine, offendingSymbol ); } else { return new SyntaxErrorEvent( FEELEvent.Severity.ERROR, Msg.createMessage( Msg.INVALID_VARIABLE_NAME_START, chars, token.getText() ), e, line, charPositionInLine, offendingSymbol ); } } else if( "in".equals( token.getText() ) ) { return new SyntaxErrorEvent(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.INVALID_VARIABLE_NAME, "keyword", token.getText()), e, line, charPositionInLine, offendingSymbol); } else if( "}".equals( token.getText() ) && e != null && e.getRecognizer() instanceof Parser && ((Parser)e.getRecognizer()).getRuleInvocationStack().contains( "key" ) ) { return new SyntaxErrorEvent(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.MISSING_EXPRESSION, e.getCtx().getText()), e, line, charPositionInLine, offendingSymbol); } else { return new SyntaxErrorEvent( FEELEvent.Severity.ERROR, Msg.createMessage( Msg.INVALID_VARIABLE_NAME, chars, token.getText() ), e, line, charPositionInLine, offendingSymbol ); } }