auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Test public void withType() throws IOException { ClassWriter classWriter = ClassWriter.forClassName(className); FieldWriter listField = classWriter.addField(ParameterizedTypeName.create(List.class, WildcardName.create()), "list"); AnonymousClassWriter listWriter = AnonymousClassWriter.forClassName(ClassName.fromClass(ArrayList.class)); listWriter.addType(ParameterizedTypeName.create(Map.class, ClassName.fromClass(String.class), ClassName.fromClass(Integer.class))); MethodWriter listSizeMethod = listWriter.addMethod(int.class, "size"); listSizeMethod.annotate(Override.class); listSizeMethod.addModifiers(PUBLIC); listSizeMethod.body().addSnippet("return 1;"); listField.setInitializer("%s", listWriter); List<?> list = new ArrayList<Map<String, Integer>>() { @Override public int size() { return 1; } }; StringBuilder stringBuilder = new StringBuilder(); <START> assertThat(classWriter.writeTypeToAppendable(stringBuilder).toString()).isEqualTo("" <END> + "package com.foo;\n" + "\n" + "import java.util.ArrayList;\n" + "import java.util.List;\n" + "import java.util.Map;\n" + "\n" + "class Bar {\n" + " List<?> list = new ArrayList<Map<String, Integer>> () {\n" + " @Override\n" + " public int size() {\n" + " return 1;\n" + " }\n" + " };\n" + "}\n"); }</code><technical_language>call toString()</technical_language>

Target:
@Test public void withType() throws IOException { ClassWriter classWriter = ClassWriter.forClassName(className); FieldWriter listField = classWriter.addField(ParameterizedTypeName.create(List.class, WildcardName.create()), "list"); AnonymousClassWriter listWriter = AnonymousClassWriter.forClassName(ClassName.fromClass(ArrayList.class)); listWriter.addTypeVariable( ParameterizedTypeName.create(Map.class, ClassName.fromClass(String.class), ClassName.fromClass(Integer.class))); MethodWriter listSizeMethod = listWriter.addMethod(int.class, "size"); listSizeMethod.annotate(Override.class); listSizeMethod.addModifiers(PUBLIC); listSizeMethod.body().addSnippet("return 1;"); listField.setInitializer("%s", listWriter); assertThat(classWriter.toString()).isEqualTo("" + "package com.foo;\n" + "\n" + "import java.util.ArrayList;\n" + "import java.util.List;\n" + "import java.util.Map;\n" + "\n" + "class Bar {\n" + " List<?> list = new ArrayList<Map<String, Integer>>() {\n" + " @Override\n" + " public int size() {\n" + " return 1;\n" + " }\n" + " };\n" + "}\n"); }
Source:
<code>public void reportResultSummary( ImmutableList.Builder<String> addTo, TestResultSummary testResult) { addTo.add( String.format( locale, "%s %s %s: %s", testResult.getType().toString(), testResult.getTestCaseName(), testResult.getTestName(), testResult.getMessage())); if (testResult.getStacktrace() != null) { for (String line : Splitter.on("\n").split(testResult.getStacktrace())) { if (line.contains(testResult.getTestCaseName())) { addTo.add(ansi.asErrorText(line)); } else { addTo.add(line); } } } if (summaryVerbosity.getIncludeStdOut() && testResult.getStdOut() != null && testResult.getStdOut().length() > 0) { addTo.add("====STANDARD OUT====", testResult.getStdOut()); } if (summaryVerbosity.getIncludeStdErr() <START> && testResult.getStdErr() != null <END> && testResult.getStdErr().length() > 0) { addTo.add("====STANDARD ERR====", testResult.getStdErr()); } }</code><technical_language>simplify [Strings.isNullOrEmpty](<LINK_0></technical_language>

Target:
public void reportResultSummary( ImmutableList.Builder<String> addTo, TestResultSummary testResult) { addTo.add( String.format( locale, "%s %s %s: %s", testResult.getType().toString(), testResult.getTestCaseName(), testResult.getTestName(), testResult.getMessage())); if (testResult.getStacktrace() != null) { for (String line : Splitter.on("\n").split(testResult.getStacktrace())) { if (line.contains(testResult.getTestCaseName())) { addTo.add(ansi.asErrorText(line)); } else { addTo.add(line); } } } if (summaryVerbosity.getIncludeStdOut() && !Strings.isNullOrEmpty(testResult.getStdOut())) { addTo.add("====STANDARD OUT====", testResult.getStdOut()); } if (summaryVerbosity.getIncludeStdErr() && !Strings.isNullOrEmpty(testResult.getStdErr())) { addTo.add("====STANDARD ERR====", testResult.getStdErr()); } if (Strings.isNullOrEmpty(testResult.getMessage()) && Strings.isNullOrEmpty(testResult.getStacktrace()) && Strings.isNullOrEmpty(testResult.getStdOut()) && Strings.isNullOrEmpty(testResult.getStdErr())) { addTo.add("Test did not produce any output."); } }
Source:
<code>public void testTooLittleRepositoriesReturnThoseRepositories() throws Exception { TestSubscriber<List<GitHubRepository>> observer = new TestSubscriber<>(); viewModel.toGitHubRepositoryList() .apply(Arrays.asList(1, 2, 3)) .subscribe(observer); observer.awaitTerminalEvent(); <START> assertEquals("Invalid number of repositories", 3, observer.getEvents().get(0).size()); <END> }</code><technical_language>reason this fails is get(0) returns element list is list of 3 elements, verify list, logic in production code is ok</technical_language>

Target:
public void testTooLittleRepositoriesReturnThoseRepositories() throws Exception { TestSubscriber<List<GitHubRepository>> observer = new TestSubscriber<>(); viewModel.toGitHubRepositoryList() .apply(Arrays.asList(1, 2, 3, 4, 5)) .subscribe(observer); assertEquals("Invalid number of repositories", 5, ((List)observer.getEvents().get(0).get(0)).size()); }
Source:
<code>public void validLoginTest() throws InterruptedException { TextField repoOwnerField = GuiTest.find(IdGenerator.getLoginDialogOwnerFieldIdReference()); clickOn(repoOwnerField); selectAll(); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test"); clickOn("Sign in"); <START> awaitCondition(() -> "test/test (none)".equals(TestController.getUI().getTitle()), 10); <END> }</code><technical_language>throws InterruptedException, repositorySelector is gone</technical_language>

Target:
public void validLoginTest() { TextField repoOwnerField = GuiTest.find(IdGenerator.getLoginDialogOwnerFieldIdReference()); clickOn(repoOwnerField); selectAll(); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test"); clickOn("Sign in"); awaitCondition(() -> "test/test (none)".equals(TestController.getUI().getTitle()), 10); }
Source:
<code>public void shouldDeriveStartTransactionResponseFromBatchedResponse_singleTransaction() { <START> StartTransactionResponseV5 startTransactionResponse = getStartTransactionResponse(12, 1); <END> when(lockLeaseService.startTransactionsWithWatches(OptionalLong.empty(), 1)) .thenReturn(startTransactionResponse); StartIdentifiedAtlasDbTransactionResponse response = transactionStarter.startIdentifiedAtlasDbTransaction(); assertDerivableFromBatchedResponse(response, startTransactionResponse); }</code><technical_language>a meta point, if StartTransaction(Request|Response) is transferred wire, get rid of V5 etc</technical_language>

Target:
public void shouldDeriveStartTransactionResponseFromBatchedResponse_singleTransaction() { ConjureStartTransactionsResponse startTransactionResponse = getStartTransactionResponse(12, 1); when(lockLeaseService.startTransactionsWithWatches(Optional.empty(), 1)) .thenReturn(startTransactionResponse); StartIdentifiedAtlasDbTransactionResponse response = transactionStarter.startIdentifiedAtlasDbTransaction(); assertDerivableFromBatchedResponse(response, startTransactionResponse); }
Source:
<code>public List<InputSplit> generateSplits(List<ViewInfoWritable> views, Configuration configuration) { int numViewsInSplit = PhoenixConfigurationUtil.getMultiViewSplitSize(configuration); <START> if (numViewsInSplit < 1) { <END> numViewsInSplit = DEFAULT_MAPPER_SPLIT_SIZE; } int numberOfMappers = views.size() / numViewsInSplit; if (Math.ceil(views.size() % numViewsInSplit) > 0) { numberOfMappers++; } final List<InputSplit> psplits = Lists.newArrayListWithExpectedSize(numberOfMappers); for (int i = 0; i < numberOfMappers; i++) { psplits.add(new PhoenixMultiViewInputSplit(views.subList( i * numViewsInSplit, getUpperBound(numViewsInSplit, i, views.size())))); } return psplits; }</code><technical_language>numViewSplit <= 0, else run divide zero</technical_language>

Target:
public List<InputSplit> generateSplits(List<ViewInfoWritable> views, Configuration configuration) { int numViewsInSplit = PhoenixConfigurationUtil.getMultiViewSplitSize(configuration); if (numViewsInSplit < 1) { numViewsInSplit = DEFAULT_MAPPER_SPLIT_SIZE; } int numberOfMappers = getNumberOfMappers(views.size(),numViewsInSplit); final List<InputSplit> pSplits = Lists.newArrayListWithExpectedSize(numberOfMappers); for (int i = 0; i < numberOfMappers; i++) { pSplits.add(new PhoenixMultiViewInputSplit(views.subList( i * numViewsInSplit, getUpperBound(numViewsInSplit, i, views.size())))); } return pSplits; }
Source:
<code>private MetacardMapper getMetacardMapper(final QName featureTypeName) { return metacardMappers .stream() .filter(mapper -> mapper.getFeatureType().equals(featureTypeName.toString())) <START> .findAny() <END> .orElseGet( () -> { LOGGER.debug( "Could not find MetacardMapper for featureType {}. Returning a default implementation.", featureTypeName); return new MetacardMapperImpl(); }); }</code><technical_language>A slight improvement readability create a local variable represents filter. Ex. Predicate<MetacardMapper> doesFeatureNameMatch = (mapper) -> mapper.getFeatureType().equals(featureTypeName.toString());. a suggestion</technical_language>

Target:
private MetacardMapper getMetacardMapper(final QName featureTypeName) { final Predicate<MetacardMapper> matchesFeatureType = mapper -> mapper.getFeatureType().equals(featureTypeName.toString()); return metacardMappers .stream() .filter(matchesFeatureType) .findAny() .orElseGet( () -> { LOGGER.debug( "Could not find a MetacardMapper for featureType {}. Returning a default implementation.", featureTypeName); return new MetacardMapperImpl(); }); }
Source:
<code><START> private static void assertExperimentTraces(TmfTraceElement[] expectedTraces, List<TmfTraceElement> actualTraces) { for (TmfTraceElement experimentTraceElement : actualTraces) { boolean contain = false; for (TmfTraceElement traceElement : expectedTraces) { contain = equalTraceElement(experimentTraceElement, traceElement); if (contain) { break; } } assertTrue(contain); } } <END></code><technical_language>This is a reason -1, avoid O(n2) a map. smth like: private static void assertExperimentTraces(TmfTraceElement[] expectedTraces, List<TmfTraceElement> actualTraces) { Map<Pair<String, URI>, TmfTraceElement> map = new HashMap<>(); for (TmfTraceElement trace : expectedTraces) { map.put(new Pair<>(trace.getName(), trace.getLocation()), trace); } actualTraces.forEach(trace -> assertNotNull(map.get(new Pair<>(trace.getName(), trace.getLocation())))); }</technical_language>

Target:
private static void assertExperimentTraces(TmfTraceElement[] expectedTraces, List<TmfTraceElement> actualTraces) { Map<Pair<String, URI>, TmfTraceElement> expectedTracesMap = new HashMap<>(); for (TmfTraceElement traceElement : expectedTraces) { expectedTracesMap.put(new Pair<>(traceElement.getName(), traceElement.getLocation()), traceElement); } actualTraces.forEach(actualTraceElement -> assertNotNull(expectedTracesMap.get(new Pair<>(actualTraceElement.getName(), actualTraceElement.getLocation())))); }
Source:
<code>protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { <START> changeDiagramUIPreference(SiriusDiagramUiPreferencesKeys.PREF_OLD_UI.name(), false); <END> sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource); localSession.changeViewpointSelection(Sets.newHashSet(VIEWPOINT_NAME), Sets.<String> newHashSet()); diagram = localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(REPRESENTATION_DESCRIPTION_NAME).selectDiagramInstance(REPRESENTATION_NAME) .open(); representationContainer = diagram.getDRepresentation().eContainer(); semanticModel = new UIResource(designerProject, FILE_DIR, MODEL); }</code><technical_language>unnecessary: false is defaulkt value..</technical_language>

Target:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource); localSession.changeViewpointSelection(Sets.newHashSet(VIEWPOINT_NAME), Sets.<String> newHashSet()); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, REPRESENTATION_NAME, DDiagram.class); representationContainer = editor.getDRepresentation().eContainer(); semanticModel = new UIResource(designerProject, FILE_DIR, MODEL); }
Source:
<code>public void handleTimeout(ServiceEndpointHealthPollerObject clusterProxyHealthPollerObject) { String clusterIdentifer = clusterProxyHealthPollerObject.getClusterIdentifier(); String errorMessage; try { ClusterProxyRegistrationClient client = clusterProxyHealthPollerObject.getClient(); errorMessage = client.readConfig(clusterIdentifer).toString(); } catch (Exception e) { errorMessage = String.format("Failed to check cluster proxy endpoint health for %s, error: %s", clusterIdentifer, e.getMessage()); <START> LOGGER.debug(errorMessage); <END> } throw new CloudbreakServiceException("Operation timed out. Failed to check cluster proxy endpoint health. " + errorMessage); }</code><technical_language>I this error level message debug</technical_language>

Target:
public void handleTimeout(ServiceEndpointHealthPollerObject clusterProxyHealthPollerObject) { String clusterIdentifer = clusterProxyHealthPollerObject.getClusterIdentifier(); String errorMessage; try { ClusterProxyRegistrationClient client = clusterProxyHealthPollerObject.getClient(); errorMessage = client.readConfig(clusterIdentifer).toString(); } catch (Exception e) { errorMessage = String.format("Failed to check cluster proxy endpoint health for %s, error: %s", clusterIdentifer, e.getMessage()); LOGGER.error(errorMessage); } throw new CloudbreakServiceException("Operation timed out. Failed to check cluster proxy endpoint health. " + errorMessage); }
Source:
<code>public void keyPressed() <START> { <END> Iterable<Node> pNodes = aSelectionModel.getSelectedNodes(); if(aDiagramBuilder.canAttachToPackage(pNodes)) { aProcessor.executeNewOperation(aDiagramBuilder.createAttachToPackageOperation(pNodes)); } else if(aDiagramBuilder.canDetachFromPackage(pNodes)) { aProcessor.executeNewOperation(aDiagramBuilder.createDetachFromPackageOperation(pNodes)); } pNodes.forEach(pNode -> aCanvas.getDiagram().placeOnTop(pNode)); aCanvas.paintPanel(); }</code><technical_language>Check if aCanvas.getDiagram().getType() != DiagramType.CLASS return immediately. Then, downcast aDiagramBuilder ClassDiagramBuilder</technical_language>

Target:
public void keyPressed() { if(aCanvas.getDiagram().getType() != DiagramType.CLASS) { return; } List<Node> selectedNodes = aSelectionModel.getSelectedNodes(); if(((ClassDiagramBuilder)aDiagramBuilder).canAttachToPackage(selectedNodes)) { aProcessor.executeNewOperation(((ClassDiagramBuilder)aDiagramBuilder).createAttachToPackageOperation(selectedNodes)); } else if(((ClassDiagramBuilder)aDiagramBuilder).canDetachFromPackage(selectedNodes)) { aProcessor.executeNewOperation(((ClassDiagramBuilder)aDiagramBuilder).createDetachFromPackageOperation(selectedNodes)); } selectedNodes.forEach(node -> aCanvas.getDiagram().placeOnTop(node)); aCanvas.paintPanel(); }
Source:
<code>public void run() { try { if (sourceAggregator.queryPromise.isDone()) { return; } if (!sourceAggregator.channelWritable) { sourceAggregator.needScheduling = true; return; } <START> List<QueryTaskSource> taskSources = taskSourceProvider.get(); <END> int bundlesProcessed = readFrame(taskSources, AggregateConfig.FRAME_READER_READS); if (bundlesProcessed > 0) { sourceAggregator.queryPromise.tryProgress(0, bundlesProcessed); } if (sourceAggregator.completed == sourceAggregator.totalTasks) { if (!sourceAggregator.queryPromise.trySuccess()) { log.warn("Tried to complete queryPromise , but failed", sourceAggregator.queryPromise); } } else { if (bundlesProcessed > 0) { pollFailures = 0; sourceAggregator.executor.execute(this); } else { pollFailures += 1; rescheduleSelfWithBackoff(); } } } catch (Throwable e) { if (!sourceAggregator.queryPromise.tryFailure(e)) { log.warn("Tried to fail queryPromise , but failed", sourceAggregator.queryPromise, e); } } }</code><technical_language>slightly concerned amount of list / iterator garbage this churn out</technical_language>

Target:
public void run() { try { if (sourceAggregator.queryPromise.isDone()) { return; } if (!sourceAggregator.channelWritable) { sourceAggregator.needScheduling = true; return; } List<QueryTaskSource> taskSources = queryTaskSourceSupplier.get(); int bundlesProcessed = readBundles(taskSources, AggregateConfig.FRAME_READER_READS); if (bundlesProcessed > 0) { sourceAggregator.queryPromise.tryProgress(0, bundlesProcessed); } if (sourceAggregator.completed == sourceAggregator.totalTasks) { if (!sourceAggregator.queryPromise.trySuccess()) { log.warn("Tried to complete queryPromise , but failed", sourceAggregator.queryPromise); } } else { if (bundlesProcessed > 0) { pollFailures = 0; sourceAggregator.executor.execute(this); } else { pollFailures += 1; rescheduleSelfWithBackoff(); } } } catch (Throwable e) { if (!sourceAggregator.queryPromise.tryFailure(e)) { log.warn("Tried to fail queryPromise , but failed", sourceAggregator.queryPromise, e); } } }
Source:
<code>private static void setScreenshotBitmaps(View fragmentView) { SnackbarUtil.hideActiveSnack(); View screenShotView = fragmentView.getRootView(); screenShotView.setDrawingCacheEnabled(true); screenShotView.layout(0, 0, screenShotView.getMeasuredWidth(), screenShotView.getMeasuredHeight()); screenshot = Bitmap.createBitmap(screenShotView.getMeasuredWidth(), screenShotView .getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(screenshot); screenShotView.draw(canvas); screenShotView.setDrawingCacheEnabled(false); screenshotDark = screenshot.copy(Bitmap.Config.ARGB_8888, true); canvas = new Canvas(screenshotDark); Paint paint = new Paint(Color.WHITE); <START> ColorFilter filter = new LightingColorFilter(0xFF5F5F5F, 0x00000000); <END> paint.setColorFilter(filter); canvas.drawBitmap(screenshotDark, new Matrix(), paint); ImageView introImageView = (ImageView) introWindow.getContentView().findViewById(R.id.intro_background_image); introImageView.setImageBitmap(screenshotDark); SnackbarUtil.showActiveSnack(); }</code><technical_language>colors final static values top of class, values in colors.xml</technical_language>

Target:
private static void setScreenshotBitmaps(View fragmentView) { SnackbarUtil.hideActiveSnack(); View screenShotView = fragmentView.getRootView(); screenShotView.setDrawingCacheEnabled(true); screenShotView.layout(0, 0, screenShotView.getMeasuredWidth(), screenShotView.getMeasuredHeight()); screenshot = Bitmap.createBitmap(screenShotView.getMeasuredWidth(), screenShotView .getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(screenshot); screenShotView.draw(canvas); screenShotView.setDrawingCacheEnabled(false); screenshotDark = screenshot.copy(Bitmap.Config.ARGB_8888, true); canvas = new Canvas(screenshotDark); Paint paint = new Paint(Color.WHITE); ColorFilter filter = new LightingColorFilter(COLOR_MULTIPLY, COLOR_ADD); paint.setColorFilter(filter); canvas.drawBitmap(screenshotDark, new Matrix(), paint); ImageView introImageView = (ImageView) introWindow.getContentView().findViewById(R.id.intro_background_image); introImageView.setImageBitmap(screenshotDark); SnackbarUtil.showActiveSnack(); }
Source:
<code>public void stopGracefully() { log.info("Stopping gracefully (status: [%s])", status); stopRequested = true; if (status == Status.PUBLISHING) { runThread.interrupt(); return; } try { if (pauseLock.tryLock(15, TimeUnit.SECONDS)) { try { if (pauseRequested) { pauseRequested = false; shouldResume.signalAll(); } } finally { pauseLock.unlock(); } } else { log.warn("While stopping: failed to acquire pauseLock before timeout, interrupting run thread"); runThread.interrupt(); return; } <START> if (pollRetryLock.tryLock(15, TimeUnit.SECONDS)) { <END> try { isAwaitingRetry.signalAll(); } finally { pollRetryLock.unlock(); } } else { log.warn("While stopping: failed to acquire pollRetryLock before timeout, interrupting run thread"); runThread.interrupt(); } } catch (Exception e) { Throwables.propagate(e); } }</code><technical_language>conventions are, sense extract 15 seconds pauseLock.tryLock above, de-hardcode</technical_language>

Target:
public void stopGracefully() { log.info("Stopping gracefully (status: [%s])", status); stopRequested = true; synchronized (statusLock) { if (status == Status.PUBLISHING) { runThread.interrupt(); return; } } try { if (pauseLock.tryLock(LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { try { if (pauseRequested) { pauseRequested = false; shouldResume.signalAll(); } } finally { pauseLock.unlock(); } } else { log.warn("While stopping: failed to acquire pauseLock before timeout, interrupting run thread"); runThread.interrupt(); return; } if (pollRetryLock.tryLock(LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { try { isAwaitingRetry.signalAll(); } finally { pollRetryLock.unlock(); } } else { log.warn("While stopping: failed to acquire pollRetryLock before timeout, interrupting run thread"); runThread.interrupt(); } } catch (Exception e) { Throwables.propagate(e); } }
Source:
<code>private void prepareHeadersForTeamPanelsInSectionPanel( InstructorFeedbackResultsSectionPanel sectionPanel) { switch (viewType) { case GIVER_QUESTION_RECIPIENT: sectionPanel.setStatisticsHeaderText("Statistics for Given Responses"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; case RECIPIENT_QUESTION_GIVER: sectionPanel.setStatisticsHeaderText("Received Responses Statistics"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; default: <START> sectionPanel.setDetailedResponsesHeaderText(""); <END> } }</code><technical_language>wondering, is a reason detailedResponsesHeaderText a default, statisticsHeaderText doesn't</technical_language>

Target:
private void prepareHeadersForTeamPanelsInSectionPanel( InstructorFeedbackResultsSectionPanel sectionPanel) { switch (viewType) { case GIVER_QUESTION_RECIPIENT: sectionPanel.setStatisticsHeaderText("Statistics for Given Responses"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; case RECIPIENT_QUESTION_GIVER: sectionPanel.setStatisticsHeaderText("Received Responses Statistics"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; default: Assumption.fail("There should be no headers for the view type"); } }
Source:
<code>public MetadataStore getMetadataStore(String namespace, Config config, MetricsRegistry metricsRegistry) { <START> return new ZkMetadataStore(config, metricsRegistry, getZookeeperNamespace(namespace, config)); <END> }</code><technical_language>Minor: order of constructor parameters consistent factory method params (i.e., namespace, config, metrics)</technical_language>

Target:
public MetadataStore getMetadataStore(String namespace, Config config, MetricsRegistry metricsRegistry) { return new ZkMetadataStore(namespace, config, metricsRegistry); }
Source:
<code>public void setup(Context.OperatorContext context) { currentWindowRecoveryState = Lists.newLinkedList(); <START> referenceTimes = Maps.newHashMap(); <END> sleepMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); scanner.setup(context); windowDataManager.setup(context); super.setup(context); long largestRecoveryWindow = windowDataManager.getLargestRecoveryWindow(); if (largestRecoveryWindow == Stateless.WINDOW_ID || context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) > largestRecoveryWindow) { scanner.startScanning(Collections.unmodifiableMap(referenceTimes)); } }</code><technical_language>referenceTimes is marked transient, stored checkpointing restored a checkpoint in case of failover. is necessary check referenceTimes for null</technical_language>

Target:
public void setup(Context.OperatorContext context) { currentWindowRecoveryState = Lists.newLinkedList(); if (referenceTimes == null) { referenceTimes = Maps.newHashMap(); } sleepMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); scanner.setup(context); windowDataManager.setup(context); super.setup(context); long largestRecoveryWindow = windowDataManager.getLargestRecoveryWindow(); if (largestRecoveryWindow == Stateless.WINDOW_ID || context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) > largestRecoveryWindow) { scanner.startScanning(Collections.unmodifiableMap(referenceTimes)); } }
Source:
<code>protected FeignException(int status, String message, Request request, Throwable cause, byte[] content) { super(message, cause); this.status = status; this.content = content; <START> this.request = checkNotNull(request, "request"); <END> }</code><technical_language>a real message here. This result in NPE a message of "request". change read "request is required"</technical_language>

Target:
protected FeignException(int status, String message, Request request, Throwable cause, byte[] content) { super(message, cause); this.status = status; this.content = content; this.request = checkRequestNotNull(request); }
Source:
<code>public void treatFailedCachedActionAsCacheMiss_local() throws Exception { RemoteOptions options = Options.getDefaults(RemoteOptions.class); ActionResult failedAction = ActionResult.newBuilder().setExitCode(1).build(); when(cache.getCachedActionResult(any(ActionKey.class))).thenReturn(failedAction); RemoteSpawnRunner runner = spy( new RemoteSpawnRunner( execRoot, options, Options.getDefaults(ExecutionOptions.class), new AtomicReference<>(localRunner), true, null, "build-req-id", "command-id", cache, null, retrier, digestUtil, logDir)); Spawn spawn = newSimpleSpawn(); SpawnExecutionContext policy = new FakeSpawnExecutionContext(spawn); SpawnResult res = Mockito.mock(SpawnResult.class); when(res.exitCode()).thenReturn(1); when(res.status()).thenReturn(Status.EXECUTION_FAILED); when(localRunner.exec(eq(spawn), eq(policy))).thenReturn(res); runner.exec(spawn, policy); verify(localRunner).exec(eq(spawn), eq(policy)); verify(runner) .execLocallyAndUpload( eq(spawn), eq(policy), any(SortedMap.class), eq(cache), any(ActionKey.class), any(Action.class), any(Command.class), eq(true)); <START> verify(cache, never()) <END> .upload( any(ActionKey.class), any(Action.class), any(Command.class), any(Path.class), any(Collection.class), any(FileOutErr.class)); verify(cache, never()) .download( any(ActionResult.class), any(Path.class), eq(outErr)); }</code><technical_language>upload called uploadLocalResults is true. Generally, if a failed action cached succeeds locally want overwrite failed result successful result in cache. This typically for flaky tests</technical_language>

Target:
public void treatFailedCachedActionAsCacheMiss_local() throws Exception { RemoteOptions options = Options.getDefaults(RemoteOptions.class); ActionResult failedAction = ActionResult.newBuilder().setExitCode(1).build(); when(cache.getCachedActionResult(any(ActionKey.class))).thenReturn(failedAction); RemoteSpawnRunner runner = spy( new RemoteSpawnRunner( execRoot, options, Options.getDefaults(ExecutionOptions.class), new AtomicReference<>(localRunner), true, null, "build-req-id", "command-id", cache, null, retrier, digestUtil, logDir)); Spawn spawn = newSimpleSpawn(); SpawnExecutionContext policy = new FakeSpawnExecutionContext(spawn); SpawnResult succeeded = new SpawnResult.Builder() .setStatus(Status.SUCCESS) .setExitCode(0) .setRunnerName("test") .build(); when(localRunner.exec(eq(spawn), eq(policy))).thenReturn(succeeded); runner.exec(spawn, policy); verify(localRunner).exec(eq(spawn), eq(policy)); verify(runner) .execLocallyAndUpload( eq(spawn), eq(policy), any(SortedMap.class), eq(cache), any(ActionKey.class), any(Action.class), any(Command.class), eq(true)); verify(cache) .upload( any(ActionKey.class), any(Action.class), any(Command.class), any(Path.class), any(Collection.class), any(FileOutErr.class)); verify(cache, never()) .download( any(ActionResult.class), any(Path.class), eq(outErr)); }
Source:
<code>protected Number calculateVerticalDiff(final ILayerCell cell, final int toColumn, final IConfigRegistry configRegistry) { Number diff = super.calculateVerticalDiff(cell, toColumn, configRegistry); if (command instanceof PapyrusFillHandlePasteCommand) { <START> if ((command.direction == MoveDirectionEnum.LEFT && !((PapyrusFillHandlePasteCommand) command).isIncrement()) <END> || (command.direction == MoveDirectionEnum.RIGHT && !((PapyrusFillHandlePasteCommand) command).isIncrement())) { if (diff instanceof Byte) { diff = 0 - diff.byteValue(); } else if (diff instanceof Short) { diff = 0 - diff.shortValue(); } else if (diff instanceof Integer) { diff = 0 - diff.intValue(); } else if (diff instanceof Long) { diff = 0 - diff.longValue(); } else if (diff instanceof Float) { diff = 0 - diff.floatValue(); } else if (diff instanceof Double) { diff = 0 - diff.doubleValue(); } else if (diff instanceof BigInteger) { diff = BigInteger.ZERO.subtract((BigInteger) diff); } else if (diff instanceof BigDecimal) { diff = BigDecimal.ZERO.subtract((BigDecimal) diff); } } } return diff; }</code><technical_language>invert conditions</technical_language>

Target:
protected Number calculateVerticalDiff(final ILayerCell cell, final int toColumn, final IConfigRegistry configRegistry) { Number diff = super.calculateVerticalDiff(cell, toColumn, configRegistry); if (command instanceof PapyrusFillHandlePasteCommand) { if ((MoveDirectionEnum.LEFT == command.direction && !((PapyrusFillHandlePasteCommand) command).isIncrement()) || (MoveDirectionEnum.RIGHT == command.direction && !((PapyrusFillHandlePasteCommand) command).isIncrement())) { if (diff instanceof Byte) { diff = 0 - diff.byteValue(); } else if (diff instanceof Short) { diff = 0 - diff.shortValue(); } else if (diff instanceof Integer) { diff = 0 - diff.intValue(); } else if (diff instanceof Long) { diff = 0 - diff.longValue(); } else if (diff instanceof Float) { diff = 0 - diff.floatValue(); } else if (diff instanceof Double) { diff = 0 - diff.doubleValue(); } else if (diff instanceof BigInteger) { diff = BigInteger.ZERO.subtract((BigInteger) diff); } else if (diff instanceof BigDecimal) { diff = BigDecimal.ZERO.subtract((BigDecimal) diff); } } } return diff; }
Source:
<code><START> private static String buildQueryString(final Map<String, List<String>> queryString) { <END> return queryString.entrySet().stream() .map(parameter -> buildQueryStringOfParameter(parameter.getKey(), parameter.getValue())) .filter(keyValue -> !keyValue.isEmpty()) .collect(joining("&")); }</code><technical_language>This a breaking change, provide if possible</technical_language>

Target:
public static String buildQueryString(final Map<String, List<String>> queryString) { return queryString.entrySet().stream() .map(parameter -> buildQueryStringOfParameter(parameter.getKey(), parameter.getValue())) .filter(keyValue -> !keyValue.isEmpty()) .collect(joining("&")); }
Source:
<code>private String calculateCommitMessage() { if(commitMessage != null) { return commitMessage; } <START> if (amending) { <END> return previousCommitMessage; } String calculatedCommitMessage = null; Set<IResource> resources = new HashSet<IResource>(); for (CommitItem item : items) { IResource resource = item.file.getProject(); resources.add(resource); } try { ICommitMessageProvider messageProvider = getCommitMessageProvider(); if(messageProvider != null) { IResource[] resourcesArray = resources.toArray(new IResource[0]); if (messageProvider.getMessage(resourcesArray) != null) { calculatedCommitMessage = messageProvider.getMessage(resourcesArray); } else { calculatedCommitMessage = ""; } } } catch (CoreException coreException) { Activator.error(coreException.getLocalizedMessage(), coreException); } return calculatedCommitMessage; }</code><technical_language>style nit: curly braces single line blocks</technical_language>

Target:
private String calculateCommitMessage() { if(commitMessage != null) { return commitMessage; } if (amending) return previousCommitMessage; String calculatedCommitMessage = null; Set<IResource> resources = new HashSet<IResource>(); for (CommitItem item : items) { IResource resource = item.file.getProject(); resources.add(resource); } try { ICommitMessageProvider messageProvider = getCommitMessageProvider(); if(messageProvider != null) { IResource[] resourcesArray = resources.toArray(new IResource[0]); calculatedCommitMessage = messageProvider.getMessage(resourcesArray); } } catch (CoreException coreException) { Activator.error(coreException.getLocalizedMessage(), coreException); } if (calculatedCommitMessage != null) return calculatedCommitMessage; else return ""; }
Source:
<code><START> public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { <END> actionName = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); image = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); }</code><technical_language>need save displayName</technical_language>

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { displayName = ExtUtil.readString(in); actionName = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); image = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); extras = (Hashtable<String, String>) ExtUtil.read(in, new ExtWrapMap(String.class, String.class)); responses = (Vector<String>)ExtUtil.read(in, new ExtWrapList(String.class), pf); }
Source:
<code>public void configure(ResourceInfo resourceInfo, FeatureContext context) { final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod()); final Annotation[][] parameterAnnotations = am.getParameterAnnotations(); final Class<?>[] parameterTypes = am.getParameterTypes(); final Type[] parameterGenericTypes = am.getGenericParameterTypes(); for (int i = 0; i < parameterAnnotations.length; i++) { for (final Annotation annotation : parameterAnnotations[i]) { <START> final Type paramType = (parameterTypes[i].equals(Optional.class)) <END> ? ((ParameterizedType) parameterGenericTypes[i]).getActualTypeArguments()[0] : parameterTypes[i]; if (annotation instanceof Auth && authFilterMap.containsKey(paramType)) { if (parameterTypes[i].equals(Optional.class)) { context.register(new WebApplicationExceptionCatchingFilter(authFilterMap.get(paramType))); return; } else { context.register(authFilterMap.get(parameterTypes[i])); return; } } } } }</code><technical_language>I extract this block outer loop I compare classes == instead of equals. java for (int i = 0; i < parameterAnnotations.length; i++) { final Class<?> type = parameterTypes[i]; // If parameter type is Optional, extract type // parameter. Otherwise, parameter type itself. final Type paramType = type == Optional.class ? ((ParameterizedType) parameterGenericTypes[i]).getActualTypeArguments()[0] : type;</technical_language>

Target:
public void configure(ResourceInfo resourceInfo, FeatureContext context) { final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod()); final Annotation[][] parameterAnnotations = am.getParameterAnnotations(); final Class<?>[] parameterTypes = am.getParameterTypes(); final Type[] parameterGenericTypes = am.getGenericParameterTypes(); for (int i = 0; i < parameterAnnotations.length; i++) { final Class<?> type = parameterTypes[i]; final Type paramType = type == Optional.class ? ((ParameterizedType) parameterGenericTypes[i]).getActualTypeArguments()[0] : type; for (final Annotation annotation : parameterAnnotations[i]) { if (annotation instanceof Auth && authFilterMap.containsKey(paramType)) { if (type == Optional.class) { final ContainerRequestFilter filter = authFilterMap.get(paramType); context.register(new WebApplicationExceptionCatchingFilter(filter)); return; } else { context.register(authFilterMap.get(type)); return; } } } } }
Source:
<code>private void renderOptimizeRangeRequests() { <START> line("private RangeRequest optimizeColumnSelection(RangeRequest range) {"); { <END> line("if (range.getColumnNames().isEmpty()) {"); { line("return range.getBuilder().retainColumns(allColumns).build();"); } line("}"); line("return range;"); } line("}"); line(); line("private Iterable<RangeRequest> optimizeColumnSelections(Iterable<RangeRequest> ranges) {"); { line("return Iterables.transform(ranges, this::optimizeColumnSelection);"); } line("}"); }</code><technical_language>I want this named optimizeRangeRequest? A ColumnSelection is a (which I added renderer code for on)</technical_language>

Target:
private void renderOptimizeRangeRequests() { line("private RangeRequest optimizeRangeRequest(RangeRequest range) {"); { line("if (range.getColumnNames().isEmpty()) {"); { line("return range.getBuilder().retainColumns(allColumns).build();"); } line("}"); line("return range;"); } line("}"); line(); line("private Iterable<RangeRequest> optimizeRangeRequests(Iterable<RangeRequest> ranges) {"); { line("return Iterables.transform(ranges, this::optimizeRangeRequest);"); } line("}"); }
Source:
<code>public BlockUseHandler getItemHandler() { return e -> { e.cancel(); Player p = e.getPlayer(); if (p.hasPermission("slimefun.inventory.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission( p, e.getClickedBlock().get().getLocation(), ProtectableAction.ACCESS_INVENTORIES)) && Slimefun.hasUnlocked(p, item, false) ) { SlimefunPlugin.getGPSNetwork().openTransmitterControlPanel(p); <START> } else { <END> SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); } }; }</code><technical_language>else next line bracket</technical_language>

Target:
public BlockUseHandler getItemHandler() { return e -> { e.cancel(); Player p = e.getPlayer(); if (p.hasPermission("slimefun.gps.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission( p, e.getClickedBlock().get().getLocation(), ProtectableAction.ACCESS_INVENTORIES)) ) { SlimefunPlugin.getGPSNetwork().openTransmitterControlPanel(p); } else { SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); } }; }
Source:
<code>public void onDateSet(DatePicker view, int year, int month, int day) { GregorianCalendar calendar = new GregorianCalendar(year, month, day); try { <START> showSpinner(R.string.box_sharesdk_fetching_collaborators, R.string.boxsdk_Please_wait); <END> mController.executeRequest(BoxItem.class, mController.getCreatedSharedLinkRequest(mShareItem).setUnsharedAt(calendar.getTime())).addOnCompletedListener(mBoxItemListener); } catch (Exception e){ dismissSpinner(); mController.showToast(getActivity(), "invalid time selected"); } }</code><technical_language>this a message related shared link update</technical_language>

Target:
public void onDateSet(DatePicker view, int year, int month, int day) { GregorianCalendar calendar = new GregorianCalendar(year, month, day); try { showSpinner(R.string.box_sharesdk_updating_link_access, R.string.boxsdk_Please_wait); mController.executeRequest(BoxItem.class, mController.getCreatedSharedLinkRequest(mShareItem).setUnsharedAt(calendar.getTime())).addOnCompletedListener(mBoxItemListener); } catch (Exception e){ dismissSpinner(); mController.showToast(getActivity(), "invalid time selected"); } }
Source:
<code>private void setNonOperational(VDS server) { <START> Map<String, String> customValues = new HashMap<String, String>(); <END> customValues.put(GlusterConstants.COMMAND, "gluster peer probe"); SetNonOperationalVdsParameters nonOpParams = new SetNonOperationalVdsParameters(server.getId(), NonOperationalReason.GLUSTER_COMMAND_FAILED, customValues); nonOpParams.setSaveToDb(true); Backend.getInstance().runInternalAction(VdcActionType.SetNonOperationalVds, nonOpParams, ExecutionHandler.createInternalJobContext()); }</code><technical_language>Collections.singltonMap</technical_language>

Target:
private void setNonOperational(VDS server) { SetNonOperationalVdsParameters nonOpParams = new SetNonOperationalVdsParameters(server.getId(), NonOperationalReason.GLUSTER_COMMAND_FAILED, Collections.singletonMap(GlusterConstants.COMMAND, "gluster peer probe")); nonOpParams.setSaveToDb(true); Backend.getInstance().runInternalAction(VdcActionType.SetNonOperationalVds, nonOpParams, ExecutionHandler.createInternalJobContext()); }
Source:
<code><START> public static void move(State state, ObjectInstance containerInstance, ObjectInstance spaceInstance) { <END> String oldSpace = ContainerFactory.getSpaceName(containerInstance); ObjectInstance oldSpaceObject = state.getObject(oldSpace); ContainerFactory.changeContainerSpace(containerInstance, spaceInstance.getName()); SpaceFactory.addContainer(spaceInstance, containerInstance); SpaceFactory.removeContainer(oldSpaceObject, containerInstance); if (SpaceFactory.getOnOff(spaceInstance) && !ContainerFactory.isEmptyContainer(containerInstance)) { if (SpaceFactory.isHeating(spaceInstance) && ContainerFactory.isHeatingContainer(containerInstance)) { for (String name : ContainerFactory.getContentNames(containerInstance)) { if (!IngredientFactory.isMeltedAtRoomTemperature(state.getObject(name))) { IngredientFactory.meltIngredient(state.getObject(name)); } } } else if (SpaceFactory.isBaking(spaceInstance) && ContainerFactory.isBakingContainer(containerInstance)) { for (String name : ContainerFactory.getContentNames(containerInstance)) { IngredientFactory.bakeIngredient(state.getObject(name)); } } } }</code><technical_language>this need public? classes need of it</technical_language>

Target:
private static void move(State state, ObjectInstance containerInstance, ObjectInstance spaceInstance) { String oldSpace = ContainerFactory.getSpaceName(containerInstance); ObjectInstance oldSpaceObject = state.getObject(oldSpace); ContainerFactory.changeContainerSpace(containerInstance, spaceInstance.getName()); SpaceFactory.addContainer(spaceInstance, containerInstance); SpaceFactory.removeContainer(oldSpaceObject, containerInstance); if (SpaceFactory.getOnOff(spaceInstance) && !ContainerFactory.isEmptyContainer(containerInstance)) { if (SpaceFactory.isHeating(spaceInstance) && ContainerFactory.isHeatingContainer(containerInstance)) { for (String name : ContainerFactory.getContentNames(containerInstance)) { if (!IngredientFactory.isMeltedAtRoomTemperature(state.getObject(name))) { IngredientFactory.meltIngredient(state.getObject(name)); } } } else if (SpaceFactory.isBaking(spaceInstance) && ContainerFactory.isBakingContainer(containerInstance)) { for (String name : ContainerFactory.getContentNames(containerInstance)) { IngredientFactory.bakeIngredient(state.getObject(name)); } } } }
Source:
<code>private static <T> void printIndented(Iterable<T> strings) { <START> for (T extension : strings) { <END> System.out.println(" " + extension); } }</code><technical_language>other name (for example item) instead of extension</technical_language>

Target:
private static <T> void printIndented(Iterable<T> strings) { for (T item : strings) { System.out.println(" " + item); } }
Source:
<code>private void populateRepositoryRefresh() { this.refreshLayout = new GridPane(); this.refreshLayout.setHgap(20); this.refreshLayout.setVgap(10); this.refreshRepositoriesLabel = new Label( translate("Fetch updates for the repositories to retrieve the newest script versions")); this.refreshRepositoriesLabel.setWrapText(true); this.refreshRepositoriesButton = new Button("Refresh Repositories"); this.refreshRepositoriesButton.setOnAction(event -> { this.vBox.setDisable(true); <START> this.getChildren().add(this.overlay); <END> repositoryManager.triggerRepositoryChange(); }); this.refreshLayout.add(refreshRepositoriesLabel, 0, 0); this.refreshLayout.add(refreshRepositoriesButton, 1, 0); GridPane.setHgrow(refreshRepositoriesLabel, Priority.ALWAYS); }</code><technical_language>Alternatively use: java this.overlay.toFront();</technical_language>

Target:
private void populateRepositoryRefresh() { this.refreshLayout = new GridPane(); this.refreshLayout.setHgap(20); this.refreshLayout.setVgap(10); this.refreshRepositoriesLabel = new Label( translate("Fetch updates for the repositories to retrieve the newest script versions")); this.refreshRepositoriesLabel.setWrapText(true); this.refreshRepositoriesButton = new Button("Refresh Repositories"); this.refreshRepositoriesButton.setOnAction(event -> { this.vBox.setDisable(true); this.overlay.toFront(); repositoryManager.triggerRepositoryChange(); }); this.refreshLayout.add(refreshRepositoriesLabel, 0, 0); this.refreshLayout.add(refreshRepositoriesButton, 1, 0); GridPane.setHgrow(refreshRepositoriesLabel, Priority.ALWAYS); }
Source:
<code>public List<Map<String, Object>> search(String tenant, Map<String, List<String>> query) throws Exception { final Timer.Context eventSearchTimerContext = eventSearchTimer.time(); String result = elasticsearchRestHelper.fetchEvents(tenant, query); <START> eventSearchTimerContext.stop(); <END> return getEventResults(result); }</code><technical_language>This stop in finally of a try fetchEvents call</technical_language>

Target:
public List<Map<String, Object>> search(String tenant, Map<String, List<String>> query) { ArrayList<Map<String, Object>> searchResults = new ArrayList<>(); Timer.Context eventSearchTimerContext = eventSearchTimer.time(); try { String result = elasticsearchRestHelper.fetchEvents(tenant, query); searchResults.addAll(getEventResults(result)); } catch(IOException e){ String format = "Query for given event in elasticsearch failed. Exception message: %s"; log.error(String.format(format, e.getMessage())); throw new RuntimeException(String.format(format, e.getMessage()), e); } finally{ eventSearchTimerContext.stop(); } return searchResults; }
Source:
<code>public AbstractPlanNode toPlanNode() { RexProgram program = getProgram(); if (program.getCondition() != null) { <START> throw new IllegalStateException( <END> "VoltDBCalc(with Condition).toPlanNode is not implemented."); } AbstractPlanNode child = inputRelNodeToPlanNode(this, 0); NodeSchema schema = RexConverter.convertToVoltDBNodeSchema(program); ProjectionPlanNode ppn = new ProjectionPlanNode(schema); ppn.addAndLinkChild(child); return ppn; }</code><technical_language>a CalcitePlanningException instead of IllegalStateException</technical_language>

Target:
public AbstractPlanNode toPlanNode() { RexProgram program = getProgram(); if (program.getCondition() != null) { throw new CalcitePlanningException( "VoltDBCalc(with Condition).toPlanNode is not implemented."); } AbstractPlanNode child = inputRelNodeToPlanNode(this, 0); NodeSchema schema = RexConverter.convertToVoltDBNodeSchema(program); ProjectionPlanNode ppn = new ProjectionPlanNode(schema); ppn.addAndLinkChild(child); return ppn; }
Source:
<code>public SClass read(final SObject rcvr) { Object cachedValue = read.read(rcvr); assert cachedValue != null; if (cachedValue != Nil.nilObject) { return (SClass) cachedValue; } <START> if (!rcvr.isObjectSlotAllocated(slotDef)) { <END> CompilerDirectives.transferToInterpreterAndInvalidate(); ObjectTransitionSafepoint.INSTANCE.ensureSlotAllocatedToAvoidDeadlock(rcvr, slotDef); } synchronized (rcvr) { try { guard.entryMatches(rcvr); cachedValue = read.read(rcvr); } catch (InvalidAssumptionException e) { CompilerDirectives.transferToInterpreterAndInvalidate(); cachedValue = rcvr.readSlot(slotDef); } if (cachedValue == Nil.nilObject) { return instantiateAndWriteUnsynced(rcvr); } else { assert cachedValue instanceof SClass; return (SClass) cachedValue; } } }</code><technical_language>this test compile out? a point guaranteed specific layout (which guard tested before). want test instead of rcvr object, changed in time</technical_language>

Target:
public SClass read(final SObject rcvr) { Object cachedValue = read.read(rcvr); assert cachedValue != null; if (cachedValue != Nil.nilObject) { return (SClass) cachedValue; } if (!objectSlotIsAllocated) { CompilerDirectives.transferToInterpreterAndInvalidate(); ObjectTransitionSafepoint.INSTANCE.ensureSlotAllocatedToAvoidDeadlock(rcvr, slotDef); } synchronized (rcvr) { try { guard.entryMatches(rcvr); cachedValue = read.read(rcvr); } catch (InvalidAssumptionException e) { CompilerDirectives.transferToInterpreterAndInvalidate(); cachedValue = rcvr.readSlot(slotDef); } if (cachedValue == Nil.nilObject) { return instantiateAndWriteUnsynced(rcvr); } else { assert cachedValue instanceof SClass; return (SClass) cachedValue; } } }