auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addCreateProjectPanel() { final VerticalPanel fp = new VerticalPanel(); fp.setStyleName(Gerrit.RESOURCES.css().createProjectPanel()); initCreateTxt(); initCreateButton(); initParentBox(); addGrid(fp); emptyCommit = new CheckBox(Util.C.checkBoxEmptyCommit()); permissionsOnly = new CheckBox(Util.C.checkBoxPermissionsOnly()); fp.add(emptyCommit); fp.add(permissionsOnly); final HorizontalPanel bp = new HorizontalPanel(); bp.add(create); <START> fp.add(bp); <END> vp.add(fp); initSuggestedParents(); add(vp); }</code><technical_language>Is HorizontalPanel 'bp' needed? enough add 'create' 'fp'? fp.add(create);</technical_language>

Target:
private void addCreateProjectPanel() { final VerticalPanel fp = new VerticalPanel(); fp.setStyleName(Gerrit.RESOURCES.css().createProjectPanel()); initCreateTxt(); initCreateButton(); initParentBox(); addGrid(fp); emptyCommit = new CheckBox(Util.C.checkBoxEmptyCommit()); permissionsOnly = new CheckBox(Util.C.checkBoxPermissionsOnly()); fp.add(emptyCommit); fp.add(permissionsOnly); fp.add(create); vp.add(fp); initSuggestedParents(); add(vp); }
Source:
<code>protected static String composeAttributeValueExtractionFailedMessage(Member member) { <START> return "Attribute value extraction failed for: " + member + ". Make sure attribute values or collection/array " + <END> "attribute value elements are all of the same and preferably concrete type. Consider custom attribute " + "extractors if it's impossible or undesirable to reduce the variety of types to a single type, see Custom " + "Attributes section in the reference manual for more details."; }</code><technical_language>decrease line lengths 80 characters more human readable</technical_language>

Target:
protected static String composeAttributeValueExtractionFailedMessage(Member member) { return "Attribute value extraction failed for: " + member + ". Make " + "sure attribute values or collection/array attribute value " + "elements are all of the same concrete type. Consider custom " + "attribute extractors if it's impossible or undesirable to " + "reduce the variety of types to a single type, see Custom " + "Attributes section in the reference manual for more details."; }
Source:
<code>private XStream createXStream() { XStream xStream = new XStream(); xStream.alias("accounts", ImmutablePair.class); <START> xStream.aliasField("activeAccount", ImmutablePair.class, "left"); <END> xStream.aliasField("configuredAccounts", ImmutablePair.class, "right"); xStream.alias("xmppAccount", XMPPAccount.class); return xStream; }</code><technical_language>another retrieve field name left & right in a compile safe fashion</technical_language>

Target:
private XStream createXStream() { XStream xStream = new XStream(); xStream.alias("accounts", AccountStoreInformation.class); xStream.alias("xmppAccount", XMPPAccount.class); return xStream; }
Source:
<code>public static void testAddChartsToNewDocument() throws InvalidFormatException, IOException { XWPFDocument document = new XWPFDocument(); XWPFChart chart = document.addChart(); assertEquals(1, document.getCharts().size()); assertNotNull(chart); assertNotNull(chart.getCTChartSpace()); assertNotNull(chart.getCTChart()); assertEquals(XWPFChart.HEIGHT,chart.getChartHeight()); <START> assertEquals(XWPFChart.WIDTH,chart.getChartWidth()); <END> XWPFChart chart2 = document.addChart(); assertEquals(2, document.getCharts().size()); assertNotNull(chart2); assertNotNull(chart2.getCTChartSpace()); assertNotNull(chart2.getCTChart()); chart.setChartHeight(500500); assertEquals(500500,chart.getChartHeight()); assertNotNull(XWPFTestDataSamples.writeOutAndReadBack(document)); }</code><technical_language>Constants renamed</technical_language>

Target:
public static void testAddChartsToNewDocument() throws InvalidFormatException, IOException { XWPFDocument document = new XWPFDocument(); XWPFChart chart = document.createChart(); assertEquals(1, document.getCharts().size()); assertNotNull(chart); assertNotNull(chart.getCTChartSpace()); assertNotNull(chart.getCTChart()); assertEquals(XWPFChart.DEFAULT_HEIGHT,chart.getChartHeight()); assertEquals(XWPFChart.DEFAULT_WIDTH,chart.getChartWidth()); XWPFChart chart2 = document.createChart(); assertEquals(2, document.getCharts().size()); assertNotNull(chart2); assertNotNull(chart2.getCTChartSpace()); assertNotNull(chart2.getCTChart()); chart.setChartHeight(500500); assertEquals(500500,chart.getChartHeight()); assertNotNull(XWPFTestDataSamples.writeOutAndReadBack(document)); }
Source:
<code>public static int setCodePointAt(int codePoint, Slice utf8, int position) { if (codePoint < 0) { throw new InvalidCodePointException(codePoint); } if (codePoint < 0x80) { utf8.setByte(position, codePoint); return 1; } if (codePoint < 0x800) { utf8.setByte(position, 0b1100_0000 | (codePoint >>> 6)); utf8.setByte(position + 1, 0b1000_0000 | (codePoint & 0b0011_1111)); return 2; } <START> if (0xD800 <= codePoint && codePoint <= 0xDFFF) { <END> throw new InvalidCodePointException(codePoint); } if (codePoint < 0x1_0000) { utf8.setByte(position, 0b1110_0000 | ((codePoint >>> 12) & 0b0000_1111)); utf8.setByte(position + 1, 0b1000_0000 | ((codePoint >>> 6) & 0b0011_1111)); utf8.setByte(position + 2, 0b1000_0000 | (codePoint & 0b0011_1111)); return 3; } if (codePoint < 0x11_0000) { utf8.setByte(position, 0b1111_0000 | ((codePoint >>> 18) & 0b0000_0111)); utf8.setByte(position + 1, 0b1000_0000 | ((codePoint >>> 12) & 0b0011_1111)); utf8.setByte(position + 2, 0b1000_0000 | ((codePoint >>> 6) & 0b0011_1111)); utf8.setByte(position + 3, 0b1000_0000 | (codePoint & 0b0011_1111)); return 4; } throw new InvalidCodePointException(codePoint); }</code><technical_language>0xD800 <= codePoint is unnecessary</technical_language>

Target:
public static int setCodePointAt(int codePoint, Slice utf8, int position) { if (codePoint < 0) { throw new InvalidCodePointException(codePoint); } if (codePoint < 0x80) { utf8.setByte(position, codePoint); return 1; } if (codePoint < 0x800) { utf8.setByte(position, 0b1100_0000 | (codePoint >>> 6)); utf8.setByte(position + 1, 0b1000_0000 | (codePoint & 0b0011_1111)); return 2; } if (MIN_SURROGATE <= codePoint && codePoint <= MAX_SURROGATE) { throw new InvalidCodePointException(codePoint); } if (codePoint < 0x1_0000) { utf8.setByte(position, 0b1110_0000 | ((codePoint >>> 12) & 0b0000_1111)); utf8.setByte(position + 1, 0b1000_0000 | ((codePoint >>> 6) & 0b0011_1111)); utf8.setByte(position + 2, 0b1000_0000 | (codePoint & 0b0011_1111)); return 3; } if (codePoint < 0x11_0000) { utf8.setByte(position, 0b1111_0000 | ((codePoint >>> 18) & 0b0000_0111)); utf8.setByte(position + 1, 0b1000_0000 | ((codePoint >>> 12) & 0b0011_1111)); utf8.setByte(position + 2, 0b1000_0000 | ((codePoint >>> 6) & 0b0011_1111)); utf8.setByte(position + 3, 0b1000_0000 | (codePoint & 0b0011_1111)); return 4; } throw new InvalidCodePointException(codePoint); }
Source:
<code>public static void initializeDefaults(IPreferenceStore store) { PreferenceConverter.setDefault(store, P_DEFAULT, DEFAULT); PreferenceConverter.setDefault(store, P_PROC_INSTR, PROC_INSTR); PreferenceConverter.setDefault(store, P_STRING, STRING); PreferenceConverter.setDefault(store, P_EXTERNALIZED_STRING, EXTERNALIZED_STRING); PreferenceConverter.setDefault(store, P_TAG, TAG); PreferenceConverter.setDefault(store, P_XML_COMMENT, XML_COMMENT); PreferenceConverter.setDefault(store, P_HEADER_KEY, HEADER_KEY); PreferenceConverter.setDefault(store, P_HEADER_OSGI, HEADER_OSGI); store.setDefault(P_HEADER_OSGI + IPDEColorConstants.P_BOLD_SUFFIX, true); PreferenceConverter.setDefault(store, P_HEADER_VALUE, HEADER_VALUE); PreferenceConverter.setDefault(store, P_HEADER_ATTRIBUTES, HEADER_ATTRIBUTES); store.setDefault(P_HEADER_ATTRIBUTES + IPDEColorConstants.P_ITALIC_SUFFIX, true); PreferenceConverter.setDefault(store, P_HEADER_ASSIGNMENT, HEADER_ASSIGNMENT); try { <START> Display display = Display.getDefault(); <END> Runnable runnable = () -> { if (!display.isDisposed() && display.getHighContrast()) { PreferenceConverter.setDefault(store, P_DEFAULT, DEFAULT_HIGH_CONTRAST); PreferenceConverter.setDefault(store, P_HEADER_VALUE, HEADER_VALUE_HIGH_CONTRAST); PreferenceConverter.setDefault(store, P_HEADER_ATTRIBUTES, HEADER_ASSIGNMENT_HIGH_CONTRAST); } }; if (display == Display.getCurrent()) { runnable.run(); } else { display.asyncExec(runnable); } } catch (SWTException e) { } }</code><technical_language>is recommended PlatformUI.getWorkbench().getDisplay()</technical_language>

Target:
public static void initializeDefaults(IPreferenceStore store) { PreferenceConverter.setDefault(store, P_DEFAULT, DEFAULT); PreferenceConverter.setDefault(store, P_PROC_INSTR, PROC_INSTR); PreferenceConverter.setDefault(store, P_STRING, STRING); PreferenceConverter.setDefault(store, P_EXTERNALIZED_STRING, EXTERNALIZED_STRING); PreferenceConverter.setDefault(store, P_TAG, TAG); PreferenceConverter.setDefault(store, P_XML_COMMENT, XML_COMMENT); PreferenceConverter.setDefault(store, P_HEADER_KEY, HEADER_KEY); PreferenceConverter.setDefault(store, P_HEADER_OSGI, HEADER_OSGI); store.setDefault(P_HEADER_OSGI + IPDEColorConstants.P_BOLD_SUFFIX, true); PreferenceConverter.setDefault(store, P_HEADER_VALUE, HEADER_VALUE); PreferenceConverter.setDefault(store, P_HEADER_ATTRIBUTES, HEADER_ATTRIBUTES); store.setDefault(P_HEADER_ATTRIBUTES + IPDEColorConstants.P_ITALIC_SUFFIX, true); PreferenceConverter.setDefault(store, P_HEADER_ASSIGNMENT, HEADER_ASSIGNMENT); try { Display display = PlatformUI.getWorkbench().getDisplay(); Runnable runnable = () -> { if (!display.isDisposed() && display.getHighContrast()) { PreferenceConverter.setDefault(store, P_DEFAULT, DEFAULT_HIGH_CONTRAST); PreferenceConverter.setDefault(store, P_HEADER_VALUE, HEADER_VALUE_HIGH_CONTRAST); PreferenceConverter.setDefault(store, P_HEADER_ATTRIBUTES, HEADER_ASSIGNMENT_HIGH_CONTRAST); } }; if (display == Display.getCurrent()) { runnable.run(); } else { display.asyncExec(runnable); } } catch (SWTException e) { } }
Source:
<code>public ByteBufOutputStream(ByteBuf buffer) { ObjectUtil.checkNotNull(buffer, "buffer"); <START> this.buffer = buffer; <END> startIndex = buffer.writerIndex(); }</code><technical_language>nit: merge lines checkNotNull return argument</technical_language>

Target:
public ByteBufOutputStream(ByteBuf buffer) { this.buffer = ObjectUtil.checkNotNull(buffer, "buffer"); startIndex = buffer.writerIndex(); }
Source:
<code>public <S, A, P> A searchForAdversarialAction(Game<S, A, P> game, Integer... params) { SearchForAdversarialActionFunction<S, A> searchFn; if (params != null) { if ("MinimaxDecision".equals(searchFunctionName)) { searchFn = new MinimaxDecision<>(game); } else { searchFn = new AlphaBetaSearch<>(game); <START> } <END> } else { searchFn = new IterativeDeepeningAlphaBetaSearch<>(game, params[0], params[1], params[2]); } return searchFn.apply(game.initialState()); }</code><technical_language>NOTE: IterativeDeepeningAlphaBetaSearch is tested! this point params is null test is configured AlphaBetaSearch is is called test contains params for IterativeDeepening calls. This code re-configured be: public <S, A, P> A searchForAdversarialAction(Game<S, A, P> game, Integer... params) { SearchForAdversarialActionFunction<S, A> searchFn; if ("MinimaxDecision".equals(searchFunctionName)) { searchFn = new MinimaxDecision<>(game); } else if ("AlphaBetaSearch".equals(searchFunctionName)) { searchFn = new AlphaBetaSearch<>(game); } else { searchFn = new IterativeDeepeningAlphaBetaSearch<>(game, params[0], params[1], params[2]); } return searchFn.apply(game.initialState()); }</technical_language>

Target:
public <S, A, P> A searchForAdversarialAction(Game<S, A, P> game, Integer... params) { SearchForAdversarialActionFunction<S, A> searchFn; if ("MinimaxDecision".equals(searchFunctionName)) { searchFn = new MinimaxDecision<>(game); } else if ("AlphaBetaSearch".equals(searchFunctionName)) { searchFn = new AlphaBetaSearch<>(game); } else { searchFn = new IterativeDeepeningAlphaBetaSearch<>(game, params[0], params[1], params[2]); } return searchFn.apply(game.initialState()); }
Source:
<code>public void entersSuccessfully() throws IOException { <START> final MemberProfileJson memberprofilejson = <END> Mockito.mock(MemberProfileJson.class); Mockito.when( memberprofilejson.fetch( Mockito.anyString(), Mockito.anyString(), Mockito.any(Href.class) ) ).thenReturn( Json.createReader( new FileInputStream( PsLinkedinTest.class.getResource( "linkedinTestUser.json" ).getPath() ) ).readObject() ); MatcherAssert.assertThat( new PsLinkedin(memberprofilejson) .enter(REQUEST).next().urn(), Matchers.is("urn:linkedin:1") ); }</code><technical_language>@ikhvostenkov please name json</technical_language>

Target:
public void entersSuccessfully() throws IOException { MatcherAssert.assertThat( new PsLinkedin( this.mockRequest("linkedinTestUser.json"), "testApp", "testKey" ).enter(REQUEST).next().urn(), Matchers.is("urn:linkedin:1") ); }
Source:
<code>private Requester requester() { <START> return root.retrieve().method("POST").withPreview(ZZZAX); <END> }</code><technical_language>replace this return root.retrieve()..withPreview(ZZZAX);</technical_language>

Target:
private Requester requester() { return root.createRequest().withPreview(ZZZAX); }
Source:
<code>public void initialise() { RenderingConfig renderingConfig = config.getRendering(); renderingConfig.subscribe(RenderingConfig.BLOOM, this); requiresCondition(renderingConfig::isBloom); requiresFBO(HIGH_PASS_FBO_CONFIG, displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(HIGH_PASS_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(HIGH_PASS_FBO, displayResolutionDependentFBOs)); highPass = getMaterial(HIGH_PASS_MATERIAL); addDesiredStateChange(new EnableMaterial(HIGH_PASS_MATERIAL.toString())); int textureSlot = 0; <START> addDesiredStateChange(new SetInputTextureFromFBO(textureSlot, new ResourceUrn("engine:sceneOpaque"), ColorTexture, <END> displayResolutionDependentFBOs, HIGH_PASS_MATERIAL, "tex")); }</code><technical_language>ResourceUrn static final field please. is strictly needed this usage, this node more consistent others easier eventually a big bunch of of handle differently</technical_language>

Target:
public void initialise() { RenderingConfig renderingConfig = config.getRendering(); renderingConfig.subscribe(RenderingConfig.BLOOM, this); requiresCondition(renderingConfig::isBloom); requiresFBO(HIGH_PASS_FBO_CONFIG, displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(HIGH_PASS_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(HIGH_PASS_FBO, displayResolutionDependentFBOs)); highPass = getMaterial(HIGH_PASS_MATERIAL); addDesiredStateChange(new EnableMaterial(HIGH_PASS_MATERIAL.toString())); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFBO(textureSlot, READONLY_GBUFFER, ColorTexture, displayResolutionDependentFBOs, HIGH_PASS_MATERIAL, "tex")); }
Source:
<code>public List<BranchProperty> getPropertiesFor(SCMHead head) { List<BranchProperty> properties = new ArrayList<>(); for (Named named : namedExceptions) { if (named.isMatch(head)) { <START> properties.addAll(named.getProps()); <END> } } if (properties.isEmpty()) { properties.addAll(defaultProperties); } return properties; }</code><technical_language>This unrelated main purpose of PR, a breaking change branch jobs for existing projects end properties update. changes this method needed</technical_language>

Target:
public List<BranchProperty> getPropertiesFor(SCMHead head) { for (Named named : namedExceptions) { if (named.isMatch(head)) { return new ArrayList<>(named.getProps()); } } return new ArrayList<>(defaultProperties); }
Source:
<code><START> private static long[] byteRangeAsNullSafe(final Long[] ranges, <END> final SupportedCipherDetails cipherDetails) { final long plaintextMax = cipherDetails.getMaximumPlaintextSizeInBytes(); final long startPos; final long endPos; if (ranges[0] == null) { startPos = 0L; } else { startPos = ranges[0]; } if (ranges[1] == null) { endPos = plaintextMax; } else { endPos = ranges[1]; } return new long[] {startPos, endPos}; }</code><technical_language>this @VisibleForTesting (even if guava actual formal annotation)</technical_language>

Target:
static long[] byteRangeAsNullSafe(final Long[] ranges, final SupportedCipherDetails cipherDetails) { final long plaintextMax = cipherDetails.getMaximumPlaintextSizeInBytes(); final long startPos; final long endPos; if (ranges[0] == null) { startPos = 0L; } else { startPos = ranges[0]; } if (ranges[1] == null) { endPos = plaintextMax; } else { endPos = ranges[1]; } return new long[] {startPos, endPos}; }
Source:
<code>public RecipientListRouter rlRouter() { RecipientListRouter router = new RecipientListRouter(); router.setRecipients( <START> Arrays.asList(new Recipient[] { new Recipient(barChannel()), new Recipient(bazChannel()) })); <END> router.setDefaultOutputChannel(discards()); return router; }</code><technical_language>Minor. setChannels() Recipient</technical_language>

Target:
public RecipientListRouter rlRouter() { RecipientListRouter router = new RecipientListRouter(); router.setChannels(Arrays.asList(barChannel(), bazChannel())); router.setDefaultOutputChannel(discards()); return router; }
Source:
<code>private static long writeContainerForSamFileHeader(final int major, final SAMFileHeader samFileHeader, final OutputStream os) throws IOException { final byte[] data = toByteArray(samFileHeader); final int length = Math.max(1024, data.length + data.length / 2); final byte[] blockContent = new byte[length]; System.arraycopy(data, 0, blockContent, 0, Math.min(data.length, length)); <START> final Block block = Block.uncompressedFileHeaderBlock(blockContent); <END> final Container container = new Container(); container.blockCount = 1; container.blocks = new Block[]{block}; container.landmarks = new int[0]; container.slices = new Slice[0]; container.alignmentSpan = Slice.NO_ALIGNMENT_SPAN; container.alignmentStart = Slice.NO_ALIGNMENT_START; container.bases = 0; container.globalRecordCounter = 0; container.nofRecords = 0; container.sequenceId = 0; final ExposedByteArrayOutputStream byteArrayOutputStream = new ExposedByteArrayOutputStream(); block.write(major, byteArrayOutputStream); container.containerByteSize = byteArrayOutputStream.size(); final int containerHeaderByteSize = ContainerIO.writeContainerHeader(major, container, os); os.write(byteArrayOutputStream.getBuffer(), 0, byteArrayOutputStream.size()); return containerHeaderByteSize + byteArrayOutputStream.size(); }</code><technical_language>createRawFileHeaderBlock</technical_language>

Target:
private static long writeContainerForSamFileHeader(final int major, final SAMFileHeader samFileHeader, final OutputStream os) throws IOException { final byte[] data = toByteArray(samFileHeader); final int length = Math.max(1024, data.length + data.length / 2); final byte[] blockContent = new byte[length]; System.arraycopy(data, 0, blockContent, 0, Math.min(data.length, length)); final Block block = Block.createRawFileHeaderBlock(blockContent); final Container container = new Container(); container.blockCount = 1; container.blocks = new Block[]{block}; container.landmarks = new int[0]; container.slices = new Slice[0]; container.alignmentSpan = Slice.NO_ALIGNMENT_SPAN; container.alignmentStart = Slice.NO_ALIGNMENT_START; container.bases = 0; container.globalRecordCounter = 0; container.nofRecords = 0; container.sequenceId = 0; final ExposedByteArrayOutputStream byteArrayOutputStream = new ExposedByteArrayOutputStream(); block.write(major, byteArrayOutputStream); container.containerByteSize = byteArrayOutputStream.size(); final int containerHeaderByteSize = ContainerIO.writeContainerHeader(major, container, os); os.write(byteArrayOutputStream.getBuffer(), 0, byteArrayOutputStream.size()); return containerHeaderByteSize + byteArrayOutputStream.size(); }
Source:
<code>private TestSession logSessionInfo() { proxyLogger.fine("Was max sessions reached? " + (totalSessionsStarted >= maxSessionsAllowed) + " on node " + getId()); <START> proxyLogger.fine("Was this a forcible shutdown? " + (forceShutDown) + " on node " + getId()); <END> LOGGER.exiting(null); return null; }</code><technical_language>re-word this a forced shutdown</technical_language>

Target:
private TestSession logSessionInfo() { proxyLogger.fine("Was max sessions reached? " + (totalSessionsStarted >= maxSessionsAllowed) + " on node " + getId()); proxyLogger.fine("Was this a forced shutdown? " + (forceShutDown) + " on node " + getId()); LOGGER.exiting(null); return null; }
Source:
<code>public void testGetFirstRowItemCount_singleItemFullSpan() throws Throwable { int itemCount = 1; setUpPagedListView(itemCount); RecyclerView recyclerView = mPagedListView.getRecyclerView(); mActivityRule.runOnUiThread(() -> { <START> ((GridLayoutManager) recyclerView.getLayoutManager()).setSpanSizeLookup( <END> new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return SPAN_COUNT; } }); }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); assertEquals(itemCount, GridLayoutManagerUtils.getFirstRowItemCount(recyclerView)); }</code><technical_language>fold this setupPagedListView method? define a new method sets SpanSizeLookup. reasoning is wait for idle setupPagedListView() method. wait for this. test slower</technical_language>

Target:
public void testGetFirstRowItemCount_singleItemFullSpan() throws Throwable { int itemCount = 1; setUpPagedListView(itemCount, new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return SPAN_COUNT; } }); RecyclerView recyclerView = mPagedListView.getRecyclerView(); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); assertEquals(itemCount, GridLayoutManagerUtils.getFirstRowItemCount(recyclerView)); }
Source:
<code>public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (resourceModel.hasDefined(attribute.getName()) && attribute instanceof ObjectTypeAttributeDefinition) { AttributeDefinition[] valueTypes = ((ObjectTypeAttributeDefinition) attribute).getValueTypes(); writer.writeStartElement(attribute.getXmlName()); for (AttributeDefinition valueType : valueTypes) { <START> if(resourceModel.get(attribute.getName()).hasDefined(valueType.getName())) { <END> ModelNode handler = resourceModel.get(attribute.getName()); if(!marshallSimpleTypeAsAttribute) { valueType.marshallAsElement(handler, marshallDefault, writer); } else { marshallAsAttribute(valueType, handler, marshallDefault, writer); } } } writer.writeEndElement(); } }</code><technical_language>new ModelNode op: if (resourceMode.hasDefined(attribute.getName(), valueType.getName())) { call chance of mutating a ModelNode wanted, I want start it</technical_language>

Target:
public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { assert attribute instanceof ObjectTypeAttributeDefinition; if (resourceModel.hasDefined(attribute.getName())) { AttributeDefinition[] valueTypes = ((ObjectTypeAttributeDefinition) attribute).getValueTypes(); writer.writeStartElement(attribute.getXmlName()); for (AttributeDefinition valueType : valueTypes) { if(resourceModel.hasDefined(attribute.getName(), valueType.getName())) { ModelNode handler = resourceModel.get(attribute.getName()); if(marshallSimpleTypeAsElement) { valueType.marshallAsElement(handler, marshallDefault, writer); } else { marshallAsAttribute(valueType, handler, marshallDefault, writer); } } } writer.writeEndElement(); } }
Source:
<code>private Map<String, String> extractRequestParams(HttpServletRequest httpServletRequest) { return Collections.list(httpServletRequest.getParameterNames()).stream() .filter(p -> !EXCLUDED_PARAMS.contains(p)) .collect(Collectors.toMap(Function.identity(), <START> name -> String.join(",", httpServletRequest.getParameterValues(name)))); <END> }</code><technical_language>escaping</technical_language>

Target:
private Map<String, String> extractRequestParams(HttpServletRequest httpServletRequest) { return list(httpServletRequest.getParameterNames()).stream() .filter(p -> !EXCLUDED_PARAMS.contains(p)) .collect(Collectors.toMap(Function.identity(), name -> joinWithComma(asList(httpServletRequest.getParameterValues(name))))); }
Source:
<code>public void testCreateOrphanBranchWithStartPoint() throws Exception { CheckoutCommand co = git.checkout().setOrphan(true) .setName("orphanbranch"); <START> co.setStartPoint("HEAD^").call(); <END> assertEquals(2, trash.list().length); this.assertNoHead(); this.assertStatus(1); }</code><technical_language>Please test return of call() too. I some existing test don't, I bad</technical_language>

Target:
public void testCreateOrphanBranchWithStartPoint() throws Exception { CheckoutCommand co = newOrphanBranchCommand(); Ref ref = co.setStartPoint("HEAD^").call(); assertCheckoutRef(ref); assertEquals(2, trash.list().length); this.assertNoHead(); this.assertRepositoryCondition(1); }
Source:
<code>public SearchStrategy strategize(SearchQuery query) { final String strategyString = config.withOverrides(query).getSearchStrategy(); switch (strategyString) { case AutoStrategy.NAME: <START> log.debug("Auto strategy is selected"); <END> return new AutoStrategy(query); case IndexOnlyStrategy.NAME: log.debug("Index-only execution strategy is selected"); return new IndexOnlyStrategy(query); case CursorBasedStrategy.NAME: log.debug("Cursor-based execution strategy is selected"); return new CursorBasedStrategy(query); default: throw new ISE("Unknown strategy[%s]", strategyString); } }</code><technical_language>nice include query ID in log messages</technical_language>

Target:
public SearchStrategy strategize(SearchQuery query) { final String strategyString = config.withOverrides(query).getSearchStrategy(); switch (strategyString) { case AutoStrategy.NAME: log.debug("Auto strategy is selected, query id [%s]", query.getId()); return AutoStrategy.of(query); case UseIndexesStrategy.NAME: log.debug("Use-index strategy is selected, query id [%s]", query.getId()); return UseIndexesStrategy.of(query); case CursorOnlyStrategy.NAME: log.debug("Cursor-only strategy is selected, query id [%s]", query.getId()); return CursorOnlyStrategy.of(query); default: throw new ISE("Unknown strategy[%s], query id [%s]", strategyString, query.getId()); } }
Source:
<code><START> public static EchoTagStatementTree newEchoTagStatement(SeparatedList<ExpressionTree> expressions, InternalSyntaxToken eosToken) { <END> return new EchoTagStatementTreeImpl(expressions, eosToken); }</code><technical_language>this method private</technical_language>

Target:
private static EchoTagStatementTree newEchoTagStatement(SeparatedList<ExpressionTree> expressions, InternalSyntaxToken eosToken) { return new EchoTagStatementTreeImpl(expressions, eosToken); }
Source:
<code>public void handle(GlowSession session, PlayerAbilitiesMessage message) { GlowPlayer player = session.getPlayer(); <START> if (!player.getAllowFlight()) { <END> return; } boolean flying = (message.getFlags() & 0x02) != 0; PlayerToggleFlightEvent event = EventFactory.getInstance().callEvent( new PlayerToggleFlightEvent(player, flying)); if (!event.isCancelled()) { player.setFlying(flying); } }</code><technical_language>Hm. This prevent player disabling flight if allowed fly in place. This packet other information flight status, returning break that. I logic this: 1. If flying flag is current flight status, do anything. 2. If flying flag is different, i. flying flag is set *true*, player is allowed fly, fire event ii. flying flag is set *false*, fire event 3. Check if event is cancelled. If i. event is cancelled, send abilities player return (sync) ii. event is cancelled, call setFlying method</technical_language>

Target:
public void handle(GlowSession session, PlayerAbilitiesMessage message) { GlowPlayer player = session.getPlayer(); boolean flyingFlag = (message.getFlags() & 0x02) != 0; boolean isFlying = player.isFlying(); boolean canFly = player.getAllowFlight(); if (isFlying != flyingFlag) { if (!flyingFlag || canFly) { PlayerToggleFlightEvent event = EventFactory.getInstance() .callEvent(new PlayerToggleFlightEvent(player, flyingFlag)); if (event.isCancelled()) { session.getServer().sendPlayerAbilities(player); } else { player.setFlying(flyingFlag); } } } }
Source:
<code>private Preference.OnPreferenceChangeListener buildAddArticlesPreferenceChangeListener() { return <START> new Preference.OnPreferenceChangeListener() { <END> @Override public boolean onPreferenceChange(Preference preference, Object newValue) { return true; } }; }</code><technical_language>Please lambdas possible</technical_language>

Target:
private Preference.OnPreferenceChangeListener buildAddArticlesPreferenceChangeListener() { return new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String title = "Test reading list"; int listSize = Integer.valueOf(newValue.toString().trim()) > MAX_ARTICLES ? MAX_ARTICLES : Integer.valueOf(newValue.toString().trim()); createReadingList(title, listSize); return true; } }; }
Source:
<code>public Release latest() throws IOException { return this.get( <START> this.latest.method(Request.GET) <END> .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getInt("id") ); }</code><technical_language>@weisebrazil indentations 4 spaces, 8</technical_language>

Target:
public Release latest() throws IOException { return this.get( this.request.uri().path("/latest") .back().method(Request.GET) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getInt("id") ); }
Source:
<code>String loginPhase2(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpPost post = new HttpPost(config.gitHubOAuthAccessTokenUrl); post.setHeader("Accept", "application/json"); List<NameValuePair> nvps = new ArrayList<>(3); nvps.add(new BasicNameValuePair("client_id", config.gitHubClientId)); nvps.add(new BasicNameValuePair("client_secret", config.gitHubClientSecret)); nvps.add(new BasicNameValuePair("code", request.getParameter("code"))); post.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); try { HttpResponse postResponse = http.execute(post); if (postResponse.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { log.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed with status " + postResponse.getStatusLine()); response.sendError(HttpURLConnection.HTTP_UNAUTHORIZED, "Request for access token not <START> authorised"); <END> EntityUtils.consume(postResponse.getEntity()); return null; } return getAccessToken(getAccessTokenJson(postResponse)); } catch (IOException e) { log.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed", e); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Request for access token not authorised"); return null; } }</code><technical_language>I else write 'authorized'</technical_language>

Target:
String loginPhase2(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpPost post = new HttpPost(config.gitHubOAuthAccessTokenUrl); post.setHeader("Accept", "application/json"); List<NameValuePair> nvps = new ArrayList<>(3); nvps.add(new BasicNameValuePair("client_id", config.gitHubClientId)); nvps.add(new BasicNameValuePair("client_secret", config.gitHubClientSecret)); nvps.add(new BasicNameValuePair("code", request.getParameter("code"))); post.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); try { HttpResponse postResponse = http.execute(post); if (postResponse.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { log.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed with status " + postResponse.getStatusLine()); response.sendError(HttpURLConnection.HTTP_UNAUTHORIZED, "Request for access token not authorized"); EntityUtils.consume(postResponse.getEntity()); return null; } return getAccessToken(getAccessTokenJson(postResponse)); } catch (IOException e) { log.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed", e); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Request for access token not authorized"); return null; } }
Source:
<code>public Void call() throws Exception { <START> log.tracef("Received cluster event(s) %s, notifying cluster listener with id %s", events, identifier); <END> clusterCacheNotifier.notifyClusterListeners(events, identifier); return null; }</code><technical_language>if (trace) ..</technical_language>

Target:
public Void call() throws Exception { if (log.isTraceEnabled()) { log.tracef("Received cluster event(s) %s, notifying cluster listener with id %s", events, identifier); } clusterCacheNotifier.notifyClusterListeners(events, identifier); return null; }
Source:
<code>public RouterSpec<R> subFlowMapping(String key, IntegrationFlow subFlow) { Assert.hasText(key); Assert.notNull(subFlow); Assert.state(!(StringUtils.hasText(this.prefix) || StringUtils.hasText(this.suffix)), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); <START> DirectChannel channel = new DirectChannel(); <END> this.subFlows.add(channel); IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel); subFlow.accept(flowBuilder); this.subFlows.add(flowBuilder.get()); if (this.mappingProvider == null) { this.mappingProvider = new RouterSubFlowMappingProvider(this.target); this.subFlows.add(this.mappingProvider); } this.mappingProvider.addMapping(key, channel); return _this(); }</code><technical_language>Need give channels this a beanName for logging etc</technical_language>

Target:
public RouterSpec<R> subFlowMapping(String key, IntegrationFlow subFlow) { Assert.hasText(key); Assert.notNull(subFlow); Assert.state(!(StringUtils.hasText(this.prefix) || StringUtils.hasText(this.suffix)), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); DirectChannel channel = new DirectChannel(); IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel); subFlow.accept(flowBuilder); this.subFlows.add(flowBuilder); if (this.mappingProvider == null) { this.mappingProvider = new RouterSubFlowMappingProvider(this.target); this.subFlows.add(this.mappingProvider); } this.mappingProvider.addMapping(key, channel); return _this(); }
Source:
<code>public void createNewVertex(VKmer createdVertexId, NeighborInfo reverseNeighborInfo, NeighborInfo forwardNeighborInfo) { <START> @SuppressWarnings({ "rawtypes", "unchecked" }) <END> Vertex<VKmer, VertexValueWritable, NullWritable, SplitRepeatMessage> newVertex = (Vertex) BspUtils .createVertex(getContext().getConfiguration()); VertexValueWritable vertexValue = new VertexValueWritable(); vertexValue.getEdgeMap(reverseNeighborInfo.et).put(reverseNeighborInfo.kmer, new ReadIdSet(reverseNeighborInfo.readIds)); vertexValue.getEdgeMap(forwardNeighborInfo.et).put(forwardNeighborInfo.kmer, new ReadIdSet(forwardNeighborInfo.readIds)); vertexValue.setInternalKmer(getVertexId()); newVertex.setVertexId(createdVertexId); newVertex.setVertexValue(vertexValue); addVertex(createdVertexId, newVertex); }</code><technical_language>do need suppressions? if cast incoming a (Vertex) all</technical_language>

Target:
public void createNewVertex(VKmer createdVertexId, NeighborInfo reverseNeighborInfo, NeighborInfo forwardNeighborInfo) { Vertex<VKmer, VertexValueWritable, NullWritable, SplitRepeatMessage> newVertex = BspUtils .createVertex(getContext().getConfiguration()); VertexValueWritable vertexValue = new VertexValueWritable(); vertexValue.getEdgeMap(reverseNeighborInfo.et).put(reverseNeighborInfo.kmer, new ReadIdSet(reverseNeighborInfo.readIds)); vertexValue.getEdgeMap(forwardNeighborInfo.et).put(forwardNeighborInfo.kmer, new ReadIdSet(forwardNeighborInfo.readIds)); vertexValue.setInternalKmer(getVertexId()); newVertex.setVertexId(createdVertexId); newVertex.setVertexValue(vertexValue); addVertex(createdVertexId, newVertex); }
Source:
<code>List<AqlSearchResult.SearchEntry> SearchByFileSpec(FileSpec file) throws IOException { List<AqlSearchResult.SearchEntry> results = null; <START> AqlHelperBase aqlHelper = new AqlHelperBase(client, log); <END> log.info("Searching for artifacts..."); switch (file.getSpecType()) { case PATTERN: { aqlHelper = new PatternAqlHelper(client, log); break; } case BUILD: { aqlHelper = new BuildAqlHelper(client, log); break; } case AQL: { break; } } aqlHelper.convertFileSpecToAql(file); results = aqlHelper.run(); results = (results == null ? new ArrayList<>() : results); log.info(String.format("Found %s artifacts.", results.size())); return results; }</code><technical_language>appears in some cases, *AqlHelperBase* object is created is replaced.. I suggest moving this initialisation **case AQL: {** section</technical_language>

Target:
List<AqlSearchResult.SearchEntry> SearchByFileSpec(FileSpec file) throws IOException { List<AqlSearchResult.SearchEntry> results = null; AqlHelperBase aqlHelper = null; log.info("Searching for artifacts..."); switch (file.getSpecType()) { case PATTERN: { aqlHelper = new PatternAqlHelper(client, log, file); break; } case BUILD: { aqlHelper = new BuildAqlHelper(client, log, file); break; } case AQL: { aqlHelper = new AqlHelperBase(client, log, file); break; } } results = aqlHelper.run(); log.info(String.format("Found %s artifacts.", results.size())); return results; }
Source:
<code>private static String makeStateFuncFullName(String stateFuncSimpleName, DataType stateType, List<DataType> argumentTypes) { List<DataType> args = Lists.newArrayList(stateType); args.addAll(argumentTypes); <START> return fullFunctionName(stateFuncSimpleName, args); <END> }</code><technical_language>In cases I find static imports code harder read, especially of IDE</technical_language>

Target:
private static String makeStateFuncFullName(String stateFuncSimpleName, DataType stateType, List<DataType> argumentTypes) { List<DataType> args = Lists.newArrayList(stateType); args.addAll(argumentTypes); return Metadata.fullFunctionName(stateFuncSimpleName, args); }
Source:
<code>void restOfInit(IClientConfig clientConfig) { <START> refeshIntervalMills = Integer.parseInt(clientConfig.getProperty( <END> CommonClientConfigKey.ServerListRefreshInterval, LISTOFSERVERS_CACHE_REPEAT_INTERVAL).toString()); boolean primeConnection = this.isEnablePrimingConnections(); this.setEnablePrimingConnections(false); enableAndInitLearnNewServersFeature(); updateListOfServers(); if (primeConnection && this.getPrimeConnections() != null) { this.getPrimeConnections() .primeConnections(getServerList(true)); } this.setEnablePrimingConnections(primeConnection); }</code><technical_language>support typed property, this simply java clientConfig.get(CommonClientConfigKey.ServerListRefreshInterval, LISTOFSERVERS_CACHE_REPEAT_INTERVAL);</technical_language>

Target:
void restOfInit(IClientConfig clientConfig) { refeshIntervalMills =clientConfig.get(CommonClientConfigKey.ServerListRefreshInterval, LISTOFSERVERS_CACHE_REPEAT_INTERVAL); boolean primeConnection = this.isEnablePrimingConnections(); this.setEnablePrimingConnections(false); enableAndInitLearnNewServersFeature(); updateListOfServers(); if (primeConnection && this.getPrimeConnections() != null) { this.getPrimeConnections() .primeConnections(getServerList(true)); } this.setEnablePrimingConnections(primeConnection); }
Source:
<code>public void onShutdownRequest() { log.info("Shutting down (when running in rest-api dev mode)..."); if (server!=null) { try { <START> server.stop(); <END> server.join(); } catch (Exception e) { log.debug("Stopping server gave an error (not usually a concern): "+e); } } if (mgmt instanceof ManagementContextInternal) { ((ManagementContextInternal)mgmt).terminate(); } }</code><technical_language>Stop server **during** request? result in a client error</technical_language>

Target:
public void onShutdownRequest() { log.info("Shutting down server (when running in rest-api dev mode, using background thread)"); new Thread(new Runnable() { public void run() { Time.sleep(Duration.millis(250)); log.debug("Shutting down server in background thread, closing "+server+" and "+mgmt); if (server!=null) { try { server.stop(); server.join(); } catch (Exception e) { log.debug("Stopping server gave an error (not usually a concern): "+e); } } if (mgmt instanceof ManagementContextInternal) { ((ManagementContextInternal)mgmt).terminate(); } } }).start(); }
Source:
<code>public <T> T withRepository(final RepositoryCallback<T> callable) throws IOException, InterruptedException { <START> return workspace.act(new MasterToSlaveFileCallable<T>() { <END> @Override public T invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { final Repository repository = new RepositoryBuilder().setWorkTree(f).build(); return callable.invoke(repository, channel); } }); }</code><technical_language>stephenc: > I concerned anonymous class pull outer class reference. sense switch explicit named static class identify minimal set of class references send remoting reference</technical_language>

Target:
public <T> T withRepository(final RepositoryCallback<T> callable) throws IOException, InterruptedException { return workspace.act(new WithRepository<>(callable)); }
Source:
<code>private Object getBindableBean(String boundElementName) { try { if (!this.boundElements.containsKey(boundElementName)) { this.boundElements.put(boundElementName, this.applicationContext.getBean(boundElementName)); } return this.boundElements.get(boundElementName); } catch (NoSuchBeanDefinitionException e) { <START> throw new IllegalStateException("Target bean doesn't exist for the bound element name: " + boundElementName); <END> } }</code><technical_language>add NoSuchBeanDefinitionException cause</technical_language>

Target:
private Object getBindableBean(String boundElementName) { try { if (!this.boundElements.containsKey(boundElementName)) { this.boundElements.put(boundElementName, this.applicationContext.getBean(boundElementName)); } return this.boundElements.get(boundElementName); } catch (NoSuchBeanDefinitionException e) { throw new IllegalStateException(TARGET_BEAN_NOT_EXISTS + ": " + boundElementName, e); } }
Source:
<code>private void rebuildIndexes(String dataTable, Configuration conf) { String schema = SchemaUtil.getSchemaNameFromFullName(dataTable); String table = SchemaUtil.getTableNameFromFullName(dataTable); for(String index: rebuildMap.get(dataTable)) { String outFile = "/tmp/index_rebuild_"+index+"_" + UUID.randomUUID().toString(); String indexName = SchemaUtil.getTableNameFromFullName(index); <START> conf.set(QueryServices.TRANSACTIONS_ENABLED, Boolean.TRUE.toString()); <END> indexingTool.setConf(conf); String args = {"-s", schema, "-dt", table, "-it", indexName, "-direct", "-runfg", "-op", outFile}; try { LOGGER.info("Rebuilding index "+ index); if(!dryRun) { indexingTool.run(args); } } catch (Exception e) { LOGGER.severe("Something went wrong while building the index "+ index +" "+e); } } }</code><technical_language>enabling transactions here</technical_language>

Target:
private int rebuildIndexes(String dataTable, Configuration conf) { String schema = SchemaUtil.getSchemaNameFromFullName(dataTable); String table = SchemaUtil.getTableNameFromFullName(dataTable); for(Map.Entry<String, String> indexMap : rebuildMap.get(dataTable).entrySet()) { String index = indexMap.getKey(); String tenantId = indexMap.getValue(); String indexName = SchemaUtil.getTableNameFromFullName(index); String outFile = "/tmp/index_rebuild_" + indexName + (tenantId.equals(GLOBAL_INDEX_ID)?"":"_"+tenantId) +"_"+ UUID.randomUUID().toString(); String[] args = { "-s", schema, "-dt", table, "-it", indexName, "-direct", "-op", outFile }; indexingTool.setConf(conf); List<String> list = Arrays.asList(args); if (!tenantId.equals(GLOBAL_INDEX_ID)) { list.add("-tenant"); list.add(tenantId); } if (syncRebuild) { list.add("-runfg"); } args = list.toArray(new String[list.size()]); try { LOGGER.info("Rebuilding index " + indexName); if (!dryRun) { indexingTool.run(args); } } catch (Exception e) { LOGGER.severe("Something went wrong while building the index " + index + " " + e); return -1; } } return 0; }
Source:
<code>public static int indexBitLength(int numberOfBuckets) { Preconditions.checkArgument(isPowerOf2(numberOfBuckets), "numberOfBuckets must be a power of 2, actual: %s", numberOfBuckets); <START> return 31 - Integer.numberOfLeadingZeros(numberOfBuckets); <END> }</code><technical_language>Integer.numberOfTrailingZeros is simpler of it</technical_language>

Target:
public static int indexBitLength(int numberOfBuckets) { Preconditions.checkArgument(isPowerOf2(numberOfBuckets), "numberOfBuckets must be a power of 2, actual: %s", numberOfBuckets); return Integer.numberOfTrailingZeros(numberOfBuckets); }
Source:
<code>public boolean isOpen() { <START> return this.eventSink.isClosed(); <END> }</code><technical_language>method name @Path misleading, considering return eventSink.isClosed(). adding a "!" reversing checks in client</technical_language>

Target:
public boolean isOpen() { synchronized (openLock) { return !eventSink.isClosed(); } }
Source:
<code>public void launchesTerminated(ILaunch[] launches) { for (ILaunch launch : launches) { if (launch.equals(fLaunch)) { setEnabled(false); <START> DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); <END> } } }</code><technical_language>big deal, if modify anyway, add a break here</technical_language>

Target:
public void launchesTerminated(ILaunch[] launches) { for (ILaunch launch : launches) { if (launch.equals(fLaunch)) { setEnabled(false); DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); break; } } }
Source:
<code>public Set<SamplingUnit> getQueryEnabledRollups(final String metricName) { final Set<SamplingUnit> disabledUnits = queryBlacklistEntry(metricName) .map(RollupQueryBlacklistEntry::getPeriods) .orElse(ImmutableSet.of()); <START> if (disabledUnits.isEmpty()) { <END> return ALL_SAMPLING_UNITS; } return ALL_SAMPLING_UNITS .stream() .filter(unit -> !disabledUnits.contains(unit)) .collect(ImmutableSet.toImmutableSet()); }</code><technical_language>If periods key is absent imply ALL, explicit empty array confusing denote excludes possibly of communicating NONE</technical_language>

Target:
public Set<SamplingUnit> getQueryEnabledRollups(final String metricName) { return queryWhitelistEntry(metricName) .map(RollupQueryWhitelistEntry::getPeriods) .orElse(ImmutableSet.of()); }
Source:
<code>public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { List<ForgeTimings<T>> timingsList = getSortedTimings(); if (timingsList.isEmpty()) { sender.sendMessage(TextComponentHelper.createComponentTranslation(sender, "commands.forge.tracking.noData")); } else { List<ForgeTimings<T>> subList = new ArrayList<>(); int count = 0; for (ForgeTimings<T> e : timingsList) { T te = e.getObject().get(); if (te == null) continue; subList.add(e); if (++count >= 10) break; } for (ForgeTimings<T> e : subList) { T te = e.getObject().get(); if (te == null) continue; <START> sender.sendMessage(buildTrackString(sender, e)); <END> } } }</code><technical_language>java subList.stream() .map(timings -> timings.getObject().get()) .filter(Objects::nonNull) .limit(10) .forEach(obj -> sender.sendMessage(buildTrackString(sender, obj))); neater, right</technical_language>

Target:
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { List<ForgeTimings<T>> timingsList = getSortedTimings(); if (timingsList.isEmpty()) { sender.sendMessage(TextComponentHelper.createComponentTranslation(sender, "commands.forge.tracking.noData")); } else { timingsList.stream() .filter(timings -> timings.getObject().get() != null) .limit(10) .forEach(timings -> sender.sendMessage(buildTrackString(sender, timings)) ); } }