auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> protected List<String[]> getOriginalTablesWithSchema(Connection connection, String schema) <END> { try (ResultSet resultSet = getTables(connection, schema, null)) { ImmutableList.Builder<String[]> list = ImmutableList.builder(); String[] arr; while (resultSet.next()) { String schemaName = resultSet.getString("TABLE_SCHEM"); String tableName = resultSet.getString("TABLE_NAME"); arr = new String[] {schemaName, tableName}; list.add(arr); } return list.build(); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }</code><technical_language>Returning List of arrays good. SchemaTableName</technical_language>

Target:
protected List<CaseSensitiveMappedSchemaTableName> getOriginalTablesWithSchema(Connection connection, String schema) { try (ResultSet resultSet = getTables(connection, schema, null)) { ImmutableList.Builder<CaseSensitiveMappedSchemaTableName> list = ImmutableList.builder(); while (resultSet.next()) { String schemaName = resultSet.getString("TABLE_SCHEM"); String tableName = resultSet.getString("TABLE_NAME"); list.add(new CaseSensitiveMappedSchemaTableName(schemaName, tableName)); } return list.build(); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
<code>public void onStateUpdateFromItem(State state) { <START> logger.debug("State update from item: '{}'", state); <END> callback.handleCommand((Command) applyOffset(state, false)); }</code><technical_language>add more _debug_ logging here. enough of state updates like, say. add here</technical_language>

Target:
public void onStateUpdateFromItem(State state) { callback.handleCommand((Command) applyOffset(state, false)); }
Source:
<code>public Optional<Shape> getShapeAt(final double x, final double y) { <START> return null; <END> }</code><technical_language>I this is test class, this is Optinal.empty() is for - avoiding necessity null ;-)</technical_language>

Target:
public Optional<Shape> getShapeAt(final double x, final double y) { return Optional.empty(); }
Source:
<code>public static InputStream openInputStream(String path) throws IOException { final InputStream inputStream; if (path.startsWith("http:") || path.startsWith("https:") || path.startsWith("ftp:")) { inputStream = getURLHelper(new URL(path)).openInputStream(); <START> } else if (IOUtil.hasScheme(path)) { <END> inputStream = Files.newInputStream(IOUtil.getPath(path)); } else { File file = new File(path); inputStream = new FileInputStream(file); } return inputStream; }</code><technical_language>SeekablePathStream well, Files.newInputStream() for some reason</technical_language>

Target:
public static InputStream openInputStream(String path) throws IOException { return openInputStream(path, null); }
Source:
<code>public void shouldGetPixelsFromAnyNonNullableCreatedBitmap() { Bitmap bitmap; int width = 10; int height = 10; int[] pixels = new int[width * height]; bitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); <START> assertThat(pixels).isNotNull(); <END> bitmap = Bitmap.createBitmap(bitmap); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); assertThat(pixels).isNotNull(); bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); assertThat(pixels).isNotNull(); bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, new Matrix(), false); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); assertThat(pixels).isNotNull(); bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); assertThat(pixels).isNotNull(); bitmap = Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); assertThat(pixels).isNotNull(); }</code><technical_language>This test right pixels null creating in test - I guess care getPixels() crash right</technical_language>

Target:
public void shouldGetPixelsFromAnyNonNullableCreatedBitmap() { Bitmap bitmap; int width = 10; int height = 10; int[] pixels = new int[width * height]; bitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); bitmap = Bitmap.createBitmap(bitmap); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, new Matrix(), false); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); bitmap = Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888); bitmap.getPixels(pixels, 0, width, 0, 0, width, height); }
Source:
<code>public void enrichDiskByJsonDescription(String jsonDiskDescription, Disk disk) throws IOException, DecoderException { Map<String, Object> diskDescriptionMap = JsonHelper.jsonToMap(jsonDiskDescription); String encodingStr = (String) diskDescriptionMap.get(DISK_ENCODING); if (encodingStr != null) { int encoding = Integer.parseInt(encodingStr); for (int priority = 0; priority < DESCRIPTION_FIELDS_PRIORITY.length; ++priority) { <START> if (((priority + 1) & encoding) != 0) { <END> String fieldName = DESCRIPTION_FIELDS_PRIORITY[priority]; String fieldValue = (String) diskDescriptionMap.get(fieldName); diskDescriptionMap.put(fieldName, decodeDiskProperty(fieldValue)); } } } disk.setDiskAlias((String) diskDescriptionMap.get(DISK_ALIAS)); disk.setDiskDescription((String) diskDescriptionMap.get(DISK_DESCRIPTION)); }</code><technical_language>please (1 << priority) instead of priority + 1</technical_language>

Target:
public void enrichDiskByJsonDescription(String jsonDiskDescription, Disk disk) throws IOException, DecoderException { Map<String, Object> diskDescriptionMap = JsonHelper.jsonToMap(jsonDiskDescription); String encodingStr = (String) diskDescriptionMap.get(DISK_ENCODING); if (encodingStr != null) { int encoding = Integer.parseInt(encodingStr); for (int priority = 0; priority < DESCRIPTION_FIELDS_PRIORITY.length; ++priority) { if (((1 << priority) & encoding) != 0) { String fieldName = DESCRIPTION_FIELDS_PRIORITY[priority]; String fieldValue = (String) diskDescriptionMap.get(fieldName); diskDescriptionMap.put(fieldName, decodeDiskProperty(fieldValue)); } } } disk.setDiskAlias((String) diskDescriptionMap.get(DISK_ALIAS)); disk.setDiskDescription((String) diskDescriptionMap.get(DISK_DESCRIPTION)); }
Source:
<code>public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, ByteArrayComparable comparator, TimeRange timeRange, Mutation mutation) throws IOException { <START> checkMutationType(mutation); <END> checkRow(mutation, row); return doCheckAndRowMutate(row, family, qualifier, op, comparator, null, timeRange, null, mutation); }</code><technical_language>put checkMutationType() checkRow() in doCheckAndRowMutate() method</technical_language>

Target:
public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, ByteArrayComparable comparator, TimeRange timeRange, Mutation mutation) throws IOException { return doCheckAndRowMutate(row, family, qualifier, op, comparator, null, timeRange, null, mutation); }
Source:
<code>private void updateFromCheckpoint(LogData entry, boolean initialize) { UUID streamId = entry.getCheckpointedStreamId(); long lastUpdateToStream = entry.getCheckpointedStreamStartLogAddress(); if (Address.isAddress(lastUpdateToStream)) { long currentStreamTail = streamTails.getOrDefault(streamId, Address.NON_ADDRESS); <START> long newTail = Math.max(currentStreamTail, lastUpdateToStream); <END> streamTails.put(streamId, newTail); if (initialize) { END record we can use this info to compute the stream trim mark, if (entry.getCheckpointType() == CheckpointEntry.CheckpointEntryType.END) { streamsAddressSpaceMap.compute(streamId, (id, addressSpace) -> { if (addressSpace == null) { return new StreamAddressSpace(lastUpdateToStream, new Roaring64NavigableMap()); } addressSpace.setTrimMark(Long.max(addressSpace.getTrimMark(), lastUpdateToStream)); return addressSpace; }); } } else { if (!streamsAddressSpaceMap.containsKey(streamId)) { Roaring64NavigableMap addressMap = new Roaring64NavigableMap(); addressMap.addLong(newTail); streamsAddressSpaceMap.put(streamId, new StreamAddressSpace(Address.NON_EXIST, addressMap)); } } } }</code><technical_language>pretty hard read/understand this method. please invert if conditions in this method easier read/understand ![image](<LINK_0></technical_language>

Target:
private void updateFromCheckpoint(LogData entry, boolean initialize) { UUID streamId = entry.getCheckpointedStreamId(); long lastUpdateToStream = entry.getCheckpointedStreamStartLogAddress(); if (Address.isAddress(lastUpdateToStream)) { long currentStreamTail = streamTails.getOrDefault(streamId, Address.NON_ADDRESS); streamTails.put(streamId, Math.max(currentStreamTail, lastUpdateToStream)); if (initialize) { END record we can use this info to compute the stream trim mark, if (entry.getCheckpointType() == CheckpointEntry.CheckpointEntryType.END) { streamsAddressSpaceMap.compute(streamId, (id, addressSpace) -> { if (addressSpace == null) { return new StreamAddressSpace(lastUpdateToStream, new Roaring64NavigableMap()); } addressSpace.setTrimMark(Long.max(addressSpace.getTrimMark(), lastUpdateToStream)); return addressSpace; }); } } } }
Source:
<code>private void handleForwardMerge(DiskImage topImage, DiskImage baseImage, DiskImage imageFromVdsm) { topImage.setVolumeFormat(baseImage.getVolumeFormat()); topImage.setVolumeType(baseImage.getVolumeType()); topImage.setParentId(baseImage.getParentId()); getDestinationDiskImage().setSize(baseImage.getSize()); getDestinationDiskImage().setActualSizeInBytes(getImageInfoFromVdsm(getDestinationDiskImage()).getActualSizeInBytes()); baseDiskDao.update(topImage); imageDao.update(topImage.getImage()); updateDiskImageDynamic(imageFromVdsm, topImage); <START> updateVmConfigurationForImageChange(getDestinationDiskImage().getImage().getSnapshotId(), <END> getDestinationDiskImage().getImageId(), getDestinationDiskImage()); }</code><technical_language>do well</technical_language>

Target:
private void handleForwardMerge(DiskImage topImage, DiskImage baseImage, DiskImage imageFromVdsm) { topImage.setVolumeFormat(baseImage.getVolumeFormat()); topImage.setVolumeType(baseImage.getVolumeType()); topImage.setParentId(baseImage.getParentId()); getDestinationDiskImage().setSize(baseImage.getSize()); getDestinationDiskImage().setActualSizeInBytes(getImageInfoFromVdsm(getDestinationDiskImage()).getActualSizeInBytes()); baseDiskDao.update(topImage); imageDao.update(topImage.getImage()); updateDiskImageDynamic(imageFromVdsm, topImage); removeTopImageMemoryIfNeeded(topImage); updateVmConfigurationForImageChange(getDestinationDiskImage().getImage().getSnapshotId(), getDestinationDiskImage().getImageId(), getDestinationDiskImage()); }
Source:
<code>public Future<?> closeAsync() { if (executor.inEventLoop()) { return close0(); } else { return executor.submit(new Runnable() { @Override public void run() { <START> close0(); <END> } }).awaitUninterruptibly(); } }</code><technical_language>hmm... close0 returns a future.... need do</technical_language>

Target:
public Future<Void> closeAsync() { if (executor.inEventLoop()) { return close0(); } else { final Promise<Void> closeComplete = executor.newPromise(); executor.execute(new Runnable() { @Override public void run() { close0().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> f) throws Exception { if (f.isSuccess()) { closeComplete.setSuccess(null); } else { closeComplete.setFailure(f.cause()); } } }); } }); return closeComplete; } }
Source:
<code>public Response remove() { get(); RemoveDiskParameters parameters = new RemoveDiskParameters(); <START> parameters.setDiskId(guid); <END> return performAction(VdcActionType.RemoveDisk, parameters); }</code><technical_language>combine 2 lines constructor accepts disk-id</technical_language>

Target:
public Response remove() { get(); return performAction(VdcActionType.RemoveDisk, new RemoveDiskParameters(guid)); }
Source:
<code>private FormatableBitSet getDefaultValueMap(ExecRow defaultValueRow) throws StandardException { FormatableBitSet defaultValueMap = null; int size = 0; for (int i = 0; i < defaultValueRow.nColumns(); ++i) { if (!defaultValueRow.getColumn(i+1).isNull()) size++; } int index = 0; if (size > 0) { defaultValueMap = new FormatableBitSet(size); for (int i = 0; i < defaultValueRow.nColumns(); ++i) { <START> if (!defaultValueRow.getColumn(i+1).isNull()) { <END> defaultValueMap.set(index); } index++; } } return defaultValueMap; }</code><technical_language>check if defaultValueRow.getColumn(i+1) is null not, column's populated</technical_language>

Target:
private FormatableBitSet getDefaultValueMap(ExecRow defaultValueRow) throws StandardException { FormatableBitSet defaultValueMap = null; int size = defaultValueRow.size(); int index = 0; if (size > 0) { defaultValueMap = new FormatableBitSet(size); for (int i = 0; i < defaultValueRow.nColumns(); ++i) { if (defaultValueRow.getColumn(i+1) != null && !defaultValueRow.getColumn(i+1).isNull()) { defaultValueMap.set(index); } index++; } } return defaultValueMap; }
Source:
<code>protected final Path getRelativeDirectory() { SnomedRF2Folder folder = SnomedRefSetUtil.REFSET_TYPE_TO_FOLDER_MAP.get(refSetType); if (folder != null) { <START> if (refSetType == SnomedRefSetType.OWL_AXIOM) { <END> return Paths.get(releaseType.toString(), SnomedRF2Folder.TERMINOLOGY.getDisplayName()); } else { return Paths.get(releaseType.toString(), SnomedRF2Folder.REFSET.getDisplayName(), folder.getDisplayName()); } } throw new IllegalArgumentException("Unknown SNOMED CT reference set type: " + refSetType); }</code><technical_language>OWL_ONTOLOGY terminology folder well</technical_language>

Target:
protected final Path getRelativeDirectory() { SnomedRF2Folder folder = SnomedRefSetUtil.REFSET_TYPE_TO_FOLDER_MAP.get(refSetType); if (folder != null) { if (refSetType == SnomedRefSetType.OWL_AXIOM || refSetType == SnomedRefSetType.OWL_ONTOLOGY) { return Paths.get(releaseType.toString(), SnomedRF2Folder.TERMINOLOGY.getDisplayName()); } else { return Paths.get(releaseType.toString(), SnomedRF2Folder.REFSET.getDisplayName(), folder.getDisplayName()); } } throw new IllegalArgumentException("Unknown SNOMED CT reference set type: " + refSetType); }
Source:
<code>public void testInterruptsNotCached() throws Exception { <START> ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0); <END> AwaitingNettyClient nettyClient = new AwaitingNettyClient(); PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0); nettyClient.awaitForInterrupts = true; connectAndInterrupt(factory, connectionId); nettyClient.awaitForInterrupts = false; factory.createPartitionRequestClient(connectionId); }</code><technical_language>for stupid question, is this port for network traffic is a dummy value? If using, propose port 0 (random free port)</technical_language>

Target:
public void testInterruptsNotCached() throws Exception { ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0); try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) { PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0); nettyClient.awaitForInterrupts = true; connectAndInterrupt(factory, connectionId); nettyClient.awaitForInterrupts = false; factory.createPartitionRequestClient(connectionId); } }
Source:
<code>public void reportsExistence() throws IOException { final Bucket bucket = Mockito.mock(Bucket.class); final Ocket ocket = Mockito.mock(Ocket.class); Mockito.doReturn(true).when(ocket).exists(); final String label = "exists"; Mockito.doReturn(ocket).when(bucket).ocket(label); MatcherAssert.assertThat( new AwsDoc(bucket, label).exists(), <START> Matchers.equalTo(ocket.exists()) <END> ); }</code><technical_language>explain true</technical_language>

Target:
public void reportsExistence() throws IOException { final String label = "exists"; final AwsDoc doc = this.createDoc(label, label); MatcherAssert.assertThat(doc.exists(), Matchers.equalTo(true)); }
Source:
<code>public void testBlobEscape() throws Exception { assertThat(s3BlobStore.list(containerName)).isEmpty(); putBlobAndCheckIt("blob%"); PageSet<? extends StorageMetadata> res = s3BlobStore.list(containerName); Iterator<? extends StorageMetadata> iter = res.iterator(); StorageMetadata meta = iter.next(); assertThat(meta.getName()).isEqualTo("blob%"); <START> assertThat(!iter.hasNext()); <END> }</code><technical_language>assertThat(res).hasSize(1)</technical_language>

Target:
public void testBlobEscape() throws Exception { assertThat(s3BlobStore.list(containerName)).isEmpty(); putBlobAndCheckIt("blob%"); PageSet<? extends StorageMetadata> res = s3BlobStore.list(containerName); StorageMetadata meta = res.iterator().next(); assertThat(meta.getName()).isEqualTo("blob%"); assertThat(res).hasSize(1); }
Source:
<code>public void testSetLteNoWifiAlt() { ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile); assertFalse(mTestImsCall.isWifiCall()); assertFalse(mTestImsCall.getRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE); mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT, ServiceState.RIL_RADIO_TECHNOLOGY_LTE + ""); assertFalse(mTestImsCall.isWifiCall()); <START> assertTrue(mTestImsCall.getRadioTechnology() <END> == ServiceState.RIL_RADIO_TECHNOLOGY_LTE); }</code><technical_language>assertEquals</technical_language>

Target:
public void testSetLteNoWifiAlt() { ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile); assertFalse(mTestImsCall.isWifiCall()); assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE); mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT, ServiceState.RIL_RADIO_TECHNOLOGY_LTE + ""); assertFalse(mTestImsCall.isWifiCall()); assertEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE); }
Source:
<code>public boolean isActivated() { <START> return JenkinsLocationConfiguration.get().getUrl() == null; <END> }</code><technical_language>findbugs JenkinsLocationConfiguration.get() return null</technical_language>

Target:
public boolean isActivated() { JenkinsLocationConfiguration loc = JenkinsLocationConfiguration.get(); return loc == null || (loc != null && loc.getUrl() == null); }
Source:
<code>public OsgpMeterValue(final BigDecimal value, final OsgpUnit osgpUnit) { <START> super(); <END> this.value = value; this.osgpUnit = osgpUnit; }</code><technical_language>Call super() adds a line of code is unnecessary</technical_language>

Target:
public OsgpMeterValue(final BigDecimal value, final OsgpUnit osgpUnit) { this.value = value; this.osgpUnit = osgpUnit; }
Source:
<code>public DateTime getFrom() { <START> return from; <END> }</code><technical_language>add "this" qualifier</technical_language>

Target:
public DateTime getFrom() { return this.from; }
Source:
<code>void testDtoListResponses() { FlowJsonObjectReader reader = new FlowJsonObjectReader(); TypeReference<SurveyGroupDto> typeReference = new TypeReference<SurveyGroupDto>() {}; List<SurveyGroupDto> surveyList = null; try { surveyList = reader.readDtoListObject(DTO_LIST_JSON_OBJECT, typeReference); } catch (IOException e) { } assertNotEquals(surveyList, null); assertEquals(surveyList.size(), 1); <START> assertEquals(surveyList.get(0).getName(),"1.10.36 all questions"); <END> }</code><technical_language>This is a minor detail assertZZZ methods work this assertZZZ(expected, actual), this is valid for of test files. please format file some "," space them</technical_language>

Target:
void testDtoListResponses() { FlowJsonObjectReader reader = new FlowJsonObjectReader(); TypeReference<SurveyGroupDto> typeReference = new TypeReference<SurveyGroupDto>() {}; List<SurveyGroupDto> surveyList = null; try { surveyList = reader.readDtoListObject(DTO_LIST_JSON_OBJECT, typeReference); } catch (IOException e) { } assertNotEquals(null, surveyList); assertEquals(1, surveyList.size()); assertEquals("1.10.36 all questions", surveyList.get(0).getName()); }
Source:
<code>public ServoSubsystem(String name, boolean isInverted, Servo... servos) { super(name); this.isInverted = false; this.servos = servos; <START> setInverted(isInverted); <END> set(0); }</code><technical_language>set this.isInverted = false; call setInverted</technical_language>

Target:
public ServoSubsystem(String name, boolean isInverted, Servo... servos) { super(name); this.servos = servos; this.isInverted = isInverted; set(0); }
Source:
<code>public HashSet<ProcessDefinitionVariable> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { <START> HashSet<ProcessDefinitionVariable> variables = new HashSet<ProcessDefinitionVariable>(); <END> ObjectCodec oc = jp.getCodec(); JsonNode nodes = oc.readTree(jp); for (int i = 0; i < nodes.size(); i++) { ProcessDefinitionVariable variable = new ProcessDefinitionVariable(nodes.get(i) .get("variableName") .asText(), nodes.get(i) .get("variableType") .asText()); variables.add(variable); } return variables; }</code><technical_language>@gmalanga variable definition need interface</technical_language>

Target:
public Set<ProcessDefinitionVariable> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { Set<ProcessDefinitionVariable> variables = new HashSet<ProcessDefinitionVariable>(); ObjectCodec oc = jp.getCodec(); JsonNode nodes = oc.readTree(jp); for (int i = 0; i < nodes.size(); i++) { ProcessDefinitionVariable variable = new ProcessDefinitionVariable(nodes.get(i) .get("variableName") .asText(), nodes.get(i) .get("variableType") .asText()); variables.add(variable); } return variables; }
Source:
<code>private String getNativesResourcesFilePart() { <START> return libraryNameMapper.mapLibraryName(SQLITE4JAVA).replace(".dylib", ".jnilib"); <END> }</code><technical_language>getLibName().replace(".dylib", ".jnilib")</technical_language>

Target:
private String getNativesResourcesFilePart() { return getLibName().replace(".dylib", ".jnilib"); }
Source:
<code>public void emit() { String src = group(1); String formatting = group(2); <START> List<String> positional = new ArrayList<String>(); <END> positional.add("alt"); positional.add("width"); positional.add("height"); Map<String, String> properties = getFormattingProperties(formatting, positional); if (!properties.containsKey("alt") || properties.get("alt").isEmpty()) { int end = src.lastIndexOf("."); if (end != -1) { String firstSrc = src.substring(0, end); int start = Math.max(firstSrc.lastIndexOf("/") + 1, 0); properties.put("alt", firstSrc.substring(start)); } else { properties.put("alt", src); } } if (group(0).startsWith("image::")) { Attributes imageblockattr = new Attributes(); imageblockattr.setCssClass("imageblock"); builder.beginBlock(BlockType.DIV, imageblockattr); Attributes contentattr = new Attributes(); contentattr.setCssClass("content"); builder.beginBlock(BlockType.DIV, contentattr); emitImage(builder, src, properties); builder.endBlock(); if (properties.containsKey("title")) { Attributes attr = new Attributes(); attr.setCssClass("title"); builder.beginBlock(BlockType.DIV, attr); if (properties.containsKey("caption")) { builder.characters(properties.get("caption")); } builder.characters(properties.get("title")); builder.endBlock(); } builder.endBlock(); } else { Attributes imageblockattr = new Attributes(); imageblockattr.setCssClass("image"); builder.beginSpan(SpanType.SPAN, imageblockattr); emitImage(builder, src, properties); builder.endSpan(); } }</code><technical_language>consider diamond operator</technical_language>

Target:
public void emit() { String src = group(1); String formatting = group(2); List<String> positional = new ArrayList<>(); positional.add("alt"); positional.add("width"); positional.add("height"); Map<String, String> properties = getFormattingProperties(formatting, positional); if (!properties.containsKey("alt") || properties.get("alt").isEmpty()) { int end = src.lastIndexOf("."); if (end != -1) { String firstSrc = src.substring(0, end); int start = Math.max(firstSrc.lastIndexOf("/") + 1, 0); properties.put("alt", firstSrc.substring(start)); } else { properties.put("alt", src); } } if (group(0).startsWith("image::")) { Attributes imageSpanAttributes = new Attributes(); imageSpanAttributes.setCssClass("imageblock"); builder.beginBlock(BlockType.DIV, imageSpanAttributes); Attributes contentAttr = new Attributes(); contentAttr.setCssClass("content"); builder.beginBlock(BlockType.DIV, contentAttr); emitImage(builder, src, properties); builder.endBlock(); if (properties.containsKey("title")) { Attributes attr = new Attributes(); attr.setCssClass("title"); builder.beginBlock(BlockType.DIV, attr); if (properties.containsKey("caption")) { builder.characters(properties.get("caption")); } builder.characters(properties.get("title")); builder.endBlock(); } builder.endBlock(); } else { Attributes imageblockattr = new Attributes(); imageblockattr.setCssClass("image"); builder.beginSpan(SpanType.SPAN, imageblockattr); emitImage(builder, src, properties); builder.endSpan(); } }
Source:
<code>public void setItem(ItemStack is) { if (is == null) { <START> is = new ItemStack(Material.AIR, 1); <END> } is.setAmount(1); metadata.set(MetadataIndex.ITEM_FRAME_ITEM, is); setRotation(Rotation.NONE); }</code><technical_language>is = InventoryUtil.itemOrEmpty(is)</technical_language>

Target:
public void setItem(ItemStack is) { is = InventoryUtil.itemOrEmpty(is).clone(); is.setAmount(1); metadata.set(MetadataIndex.ITEM_FRAME_ITEM, is); setRotation(Rotation.NONE); }
Source:
<code>public static TransactionStatus fromDBObject(DBObject dbo) { TransactionStateType status = TransactionStateType.valueOf(TranslatorUtils.toString(dbo, STATUS_KEY)); String message = TranslatorUtils.toString(dbo, MESSAGE_KEY); Optional<Iterable<FragmentReportType>> fragmentReports = TranslatorUtils.toIterable(dbo, FRAGMENT_REPORTS_KEY, FragmentReportTranslator.fromDBObject()); if (fragmentReports.isPresent()) { <START> return new TransactionStatus(status, message, fragmentReports.get()); <END> } else { return new TransactionStatus(status, message); } }</code><technical_language>avoid if/else with, if argument is marked Nullable return new TransactionStatus(status, message, fragmentReports.orNull());</technical_language>

Target:
public static TransactionStatus fromDBObject(DBObject dbo) { TransactionStateType status = TransactionStateType.valueOf(TranslatorUtils.toString(dbo, STATUS_KEY)); String message = TranslatorUtils.toString(dbo, MESSAGE_KEY); Optional<Iterable<FragmentReportType>> fragmentReports = TranslatorUtils.toIterable( dbo, FRAGMENT_REPORTS_KEY, FragmentReportTranslator.fromDBObject() ); return new TransactionStatus(status, message, fragmentReports.orNull()); }
Source:
<code><START> public void appendAll(Collection<StreamInputPacketIndexEntry> preParsedIndex) <END> throws CTFReaderException { for (ICTFPacketInformation sipie : preParsedIndex) { append(checkNotNull(sipie)); } }</code><technical_language>ICTFPacketInformation instead of StreamInputPacketIndexEntry</technical_language>

Target:
public void appendAll(Collection<StreamInputPacketIndexEntry> preParsedIndex) throws CTFException { for (ICTFPacketInformation sipie : preParsedIndex) { append(checkNotNull(sipie)); } }
Source:
<code>public boolean matches(Object item) { boolean found = false; @SuppressWarnings("unchecked") Set<Feature> features = (Set<Feature>) item; for (Feature f : features) { if (f.name().equals(feature.name())) { found = true; break; } } <START> return found; <END> }</code><technical_language>Nice catch Kamil. Btw, done easier code? for (Feature f : features) { if (f.name().equals(feature.name())) { return true; } } return false;</technical_language>

Target:
public boolean matches(Object item) { @SuppressWarnings("unchecked") Set<Feature> features = (Set<Feature>) item; for (Feature f : features) { if (f.name().equals(feature.name())) { return true; } } return false; }
Source:
<code>public String loadContextSpecificPage(Model model, HttpSession session) { Member member = (Member) session.getAttribute("member"); if (member == null) { return "redirect:../denied"; } UserType context = member.getContext(); if (context == UserType.PLAYER) { <START> return "redirect:../profile"; <END> } else if (context == UserType.OFFICIAL) { return "redirect:../official"; } else if (context == UserType.COORDINATOR) { return "redirect:../coordinator"; } else { return "redirect:../admin"; } }</code><technical_language>This /profile worry relative paths</technical_language>

Target:
public String loadContextSpecificPage(Model model, HttpSession session) { Member member = (Member) session.getAttribute("member"); if (member == null) { return "redirect:/denied"; } UserType context = member.getContext(); if (context == UserType.PLAYER) { return "redirect:/profile"; } else if (context == UserType.OFFICIAL) { return "redirect:/official"; } else if (context == UserType.COORDINATOR) { return "redirect:/coordinator"; } else { return "redirect:/admin"; } }
Source:
<code>public static SubjectEntity[] getStorageEntities(List<CinderDisk> cinderDisks) { Set<SubjectEntity> storageSubjects = new HashSet<>(); for <START> (final CinderDisk <END> cinderDisk : cinderDisks) { SubjectEntity se = new SubjectEntity(VdcObjectType.Storage, cinderDisk.getStorageIds().get(0)); storageSubjects.add(se); } return storageSubjects.toArray(new SubjectEntity[storageSubjects.size()]); }</code><technical_language>need for final..</technical_language>

Target:
public static SubjectEntity[] getStorageEntities(List<CinderDisk> cinderDisks) { Set<SubjectEntity> storageSubjects = new HashSet<>(); for (CinderDisk cinderDisk : cinderDisks) { SubjectEntity se = new SubjectEntity(VdcObjectType.Storage, cinderDisk.getStorageIds().get(0)); storageSubjects.add(se); } return storageSubjects.toArray(new SubjectEntity[storageSubjects.size()]); }
Source:
<code>public void fetchLastAccessed(final LastAccessManagerCallback callback, final View view, final String courseId){ try{ if(!callback.isFetchingLastAccessed()) { if(courseId!=null && getProfile()!=null && getProfile().username!=null){ String prefName = PrefManager.getPrefNameForLastAccessedBy(getProfile() .username, courseId); final PrefManager prefManager = new PrefManager(MainApplication.instance(), prefName); final String prefModuleId = prefManager.getLastAccessedSubsectionId(); logger.debug("Last Accessed Module ID from Preferences " +prefModuleId); callback.showLastAccessedView(prefModuleId, courseId, null); GetLastAccessedTask getLastAccessedTask = new GetLastAccessedTask(MainApplication.instance()) { @Override public void onFinish(SyncLastAccessedSubsectionResponse result) { String server_moduleId = null; <START> if(result!=null && result.getLastVisitedModuleId()!=null){ <END> server_moduleId = result.getLastVisitedModuleId(); logger.debug("Last Accessed Module ID from Server Get " +server_moduleId); if(prefManager.isSyncedLastAccessedSubsection()){ prefManager.putLastAccessedSubsection(server_moduleId, true); callback.showLastAccessedView(server_moduleId, courseId, null); }else{ if(prefModuleId!=null && prefModuleId.length()>0){ syncLastAccessedWithServer(prefManager, view, courseId, prefModuleId, callback); } } }else{ if(prefModuleId!=null && prefModuleId.length()>0){ syncLastAccessedWithServer(prefManager, view, courseId, prefModuleId, callback); } } callback.setFetchingLastAccessed( false ); } @Override public void onException(Exception ex) { callback.setFetchingLastAccessed( false ); logger.error(ex); } }; callback.setFetchingLastAccessed( true ); getLastAccessedTask.execute(courseId); } } }catch(Exception e){ logger.error(e); } }</code><technical_language>This is kind of long. this pulled a separate method</technical_language>

Target:
public void fetchLastAccessed(final LastAccessManagerCallback callback, final View view, final String courseId){ try{ if(!callback.isFetchingLastAccessed()) { if(courseId!=null && getProfile()!=null && getProfile().username!=null){ String prefName = PrefManager.getPrefNameForLastAccessedBy(getProfile() .username, courseId); final PrefManager prefManager = new PrefManager(MainApplication.instance(), prefName); final String prefModuleId = prefManager.getLastAccessedSubsectionId(); logger.debug("Last Accessed Module ID from Preferences " +prefModuleId); callback.showLastAccessedView(prefModuleId, courseId, null); GetLastAccessedTask getLastAccessedTask = new GetLastAccessedTask(MainApplication.instance()) { @Override public void onFinish(SyncLastAccessedSubsectionResponse result) { syncWithServerOnSuccess(result, prefModuleId, prefManager, courseId, callback, view); } @Override public void onException(Exception ex) { callback.setFetchingLastAccessed( false ); logger.error(ex); } }; callback.setFetchingLastAccessed( true ); getLastAccessedTask.execute(courseId); } } }catch(Exception e){ logger.error(e); } }
Source:
<code><START> public static byte[] gzip(final byte[] data) { <END> final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (final GZIPOutputStream gos = new GZIPOutputStream(byteArrayOutputStream) { { def.setLevel(GZIP_COMPRESSION_LEVEL); } }) { IOUtil.copyStream(new ByteArrayInputStream(data), gos); } catch (final IOException e) { throw new RuntimeException(e); } return byteArrayOutputStream.toByteArray(); }</code><technical_language>operations copy byteArrayOutputStreams a lot of unnecessary array copies worth performance problems in future profiling</technical_language>

Target:
public static byte[] gzip(final byte[] data) { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (final GZIPOutputStream gos = new GZIPOutputStream(byteArrayOutputStream) { { def.setLevel(GZIP_COMPRESSION_LEVEL); } }) { IOUtil.copyStream(new ByteArrayInputStream(data), gos); } catch (final IOException e) { throw new RuntimeIOException(e); } return byteArrayOutputStream.toByteArray(); }
Source:
<code><START> public static double[] getVoxelScreenSize( final AffineTransform3D screenTransform, final Source< ? > source, final int timepoint, final int mipmapIndex ) <END> { final double[] pixelSize = new double[ 3 ]; final AffineTransform3D sourceToScreen = new AffineTransform3D(); sourceToScreen.set( screenTransform ); final AffineTransform3D sourceTransform = new AffineTransform3D(); source.getSourceTransform( timepoint, mipmapIndex, sourceTransform ); sourceToScreen.concatenate( sourceTransform ); final double[] zero = new double[] { 0, 0, 0 }; final double[] tzero = new double[ 3 ]; final double[] one = new double[ 3 ]; final double[] tone = new double[ 3 ]; final double[] diff = new double[ 3 ]; sourceToScreen.apply( zero, tzero ); for ( int i = 0; i < 3; ++i ) { for ( int d = 0; d < 3; ++d ) one[ d ] = d == i ? 1 : 0; sourceToScreen.apply( one, tone ); LinAlgHelpers.subtract( tone, tzero, diff ); pixelSize[ i ] = LinAlgHelpers.length( diff ); } return pixelSize; }</code><technical_language>Please provide method signature (calling new one, max). is public is reason break API</technical_language>

Target:
public static double getVoxelScreenSize( final AffineTransform3D screenTransform, final Source< ? > source, final int timepoint, final int mipmapIndex ) { double pixelSize = 0; final AffineTransform3D sourceToScreen = new AffineTransform3D(); sourceToScreen.set( screenTransform ); final AffineTransform3D sourceTransform = new AffineTransform3D(); source.getSourceTransform( timepoint, mipmapIndex, sourceTransform ); sourceToScreen.concatenate( sourceTransform ); final double[] zero = new double[] { 0, 0, 0 }; final double[] tzero = new double[ 3 ]; final double[] one = new double[ 3 ]; final double[] tone = new double[ 3 ]; final double[] diff = new double[ 2 ]; sourceToScreen.apply( zero, tzero ); for ( int i = 0; i < 3; ++i ) { for ( int d = 0; d < 3; ++d ) one[ d ] = d == i ? 1 : 0; sourceToScreen.apply( one, tone ); LinAlgHelpers.subtract( tone, tzero, tone ); diff[0] = tone[0]; diff[1] = tone[1]; final double l = LinAlgHelpers.length( diff ); if ( l > pixelSize ) pixelSize = l; } return pixelSize; }
Source:
<code>void testNewTargetGroupsForOneUnitAndOneEnemyUnit() { final GamePlayer germany = GameDataTestUtil.germany(twwGameData); final List<Unit> units = GameDataTestUtil.germanInfantry(twwGameData).create(1, germany); final GamePlayer britain = GameDataTestUtil.britain(twwGameData); final List<Unit> enemyUnits = GameDataTestUtil.britishInfantry(twwGameData).create(1, britain); final List<TargetGroup> result = TargetGroup.newTargetGroups(units, enemyUnits); <START> assertEquals(1, result.size()); <END> }</code><technical_language>nit: assertEquals(1, results.size()) -> assertThat(result, hasSize(1))</technical_language>

Target:
void testNewTargetGroupsForOneUnitAndOneEnemyUnit() { final GamePlayer germany = GameDataTestUtil.germany(twwGameData); final List<Unit> units = GameDataTestUtil.germanInfantry(twwGameData).create(1, germany); final GamePlayer britain = GameDataTestUtil.britain(twwGameData); final List<Unit> enemyUnits = GameDataTestUtil.britishInfantry(twwGameData).create(1, britain); final List<TargetGroup> result = TargetGroup.newTargetGroups(units, enemyUnits); assertThat(result, hasSize(1)); }
Source:
<code><START> public synchronized MetricsPhoenixTTLSource getPhoenixTTLSource() { <END> if (INSTANCE.phoenixTTLSource == null) { INSTANCE.phoenixTTLSource = new MetricsPhoenixTTLSourceImpl(); } return INSTANCE.phoenixTTLSource; }</code><technical_language>Do double-check locking instead, improve performance reduce contention here</technical_language>

Target:
public MetricsPhoenixTTLSource getPhoenixTTLSource() { if (INSTANCE.phoenixTTLSource == null) { synchronized (MetricsPhoenixTTLSource.class) { if (INSTANCE.phoenixTTLSource == null) { INSTANCE.phoenixTTLSource = new MetricsPhoenixTTLSourceImpl(); } } } return INSTANCE.phoenixTTLSource; }
Source:
<code>protected void initButton(final Button button) { button.setToolTipText("Create Working Branch"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { disableAll = true; refreshEnablement(button); Result result = AtsBranchUtil.createWorkingBranch_Validate(getTeamArt()); boolean appropriate = selectTargetedVersionIfAppropriate(result, button); if (appropriate) { return; } if (result.isFalse()) { AWorkbench.popup(result); disableAll = false; refreshEnablement(button); return; } try { String workingBranchName = AtsClientService.get().getBranchService().getBranchName(getTeamArt()); String baselineBranchName = getTeamArt().getParentTeamWorkflow().getBranch().toString(); <START> if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Create Working Branch", <END> "Creating working branch,\n\n\"<" + workingBranchName + ">\"\n\nfrom parent branch, \n\n\"<" + baselineBranchName + ">\"\n\nIs that correct?\n\n" + "---\nNOTE: Working branches are necessary when OSEE Artifact changes " + "are made during implementation.")) { disableAll = false; refreshEnablement(button); return; } button.setText("Creating Branch..."); button.redraw(); button.getParent().layout(); AtsBranchUtil.createWorkingBranch_Create(getTeamArt(), false); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); disableAll = false; refreshEnablement(button); } } }); }</code><technical_language>remove <>. branch names quoted. Create working branch "My Branch Name" ..</technical_language>

Target:
protected void initButton(final Button button) { button.setToolTipText("Create Working Branch"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { disableAll = true; refreshEnablement(button); Result result = AtsBranchUtil.createWorkingBranch_Validate(getTeamArt()); boolean appropriate = selectTargetedVersionIfAppropriate(result, button); if (appropriate) { return; } if (result.isFalse()) { AWorkbench.popup(result); disableAll = false; refreshEnablement(button); return; } try { String workingBranchName = AtsClientService.get().getBranchService().getBranchName(getTeamArt()); String baselineBranchName = getTeamArt().getParentTeamWorkflow().getBranch().toString(); if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Create Working Branch", "Creating working branch,\n\n\"" + workingBranchName + "\"\n\nfrom parent branch, \n\n\"" + baselineBranchName + "\"\n\nIs that correct?\n\n" + "---\nNOTE: Working branches are necessary when OSEE Artifact changes " + "are made during implementation.")) { disableAll = false; refreshEnablement(button); return; } button.setText("Creating Branch..."); button.redraw(); button.getParent().layout(); AtsBranchUtil.createWorkingBranch_Create(getTeamArt(), false); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); disableAll = false; refreshEnablement(button); } } }); }
Source:
<code>protected void doStart() throws Exception { if (config == null) { List<SerializerFeature> serializerFeatureList = new ArrayList<SerializerFeature>(); config = new FastJsonConfig(); if (prettyPrint) { serializerFeatureList.add(SerializerFeature.PrettyFormat); } if (serializeNulls) { serializerFeatureList.add(SerializerFeature.WriteMapNullValue); serializerFeatureList.add(SerializerFeature.WriteNullBooleanAsFalse); serializerFeatureList.add(SerializerFeature.WriteNullListAsEmpty); serializerFeatureList.add(SerializerFeature.WriteNullNumberAsZero); serializerFeatureList.add(SerializerFeature.WriteNullStringAsEmpty); } <START> if (null != this.dateFormatPattern) { <END> serializerFeatureList.add(SerializerFeature.WriteDateUseDateFormat); config.setDateFormat(this.dateFormatPattern); } } }</code><technical_language>tend flip this != null is</technical_language>

Target:
protected void doStart() throws Exception { if (config == null) { List<SerializerFeature> serializerFeatureList = new ArrayList<SerializerFeature>(); config = new FastJsonConfig(); if (prettyPrint) { serializerFeatureList.add(SerializerFeature.PrettyFormat); } if (serializeNulls) { serializerFeatureList.add(SerializerFeature.WriteMapNullValue); serializerFeatureList.add(SerializerFeature.WriteNullBooleanAsFalse); serializerFeatureList.add(SerializerFeature.WriteNullListAsEmpty); serializerFeatureList.add(SerializerFeature.WriteNullNumberAsZero); serializerFeatureList.add(SerializerFeature.WriteNullStringAsEmpty); } if (this.dateFormatPattern != null) { serializerFeatureList.add(SerializerFeature.WriteDateUseDateFormat); config.setDateFormat(this.dateFormatPattern); } } }
Source:
<code>public DeterministicKeyChain makeSpendingFriendKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, ImmutableList<ChildNumber> accountPath) throws UnreadableWalletException { DeterministicKeyChain chain; if (isMarried) throw new UnsupportedOperationException("Married Friend Keychains are not allowed"); else if(accountPath.get(0).equals(ChildNumber.NINE_HARDENED) && <START> accountPath.get(2).equals(new ChildNumber(15, true))) <END> chain = new FriendKeyChain(seed, crypter, accountPath); else return new DeterministicKeyChain(seed, crypter, Script.ScriptType.P2PKH, accountPath); return chain; }</code><technical_language>15 means in this context? more once, store in a variable</technical_language>

Target:
public DeterministicKeyChain makeSpendingFriendKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, ImmutableList<ChildNumber> accountPath) throws UnreadableWalletException { DeterministicKeyChain chain; if (isMarried) throw new UnsupportedOperationException("Married Friend Keychains are not allowed"); else if(accountPath.get(0).equals(ChildNumber.NINE_HARDENED) && accountPath.get(2).equals(DerivationPathFactory.FEATURE_PURPOSE_DASHPAY)) chain = new FriendKeyChain(seed, crypter, accountPath); else return new DeterministicKeyChain(seed, crypter, Script.ScriptType.P2PKH, accountPath); return chain; }
Source:
<code>public void handleEvent(MotechEvent event) { String configName = EventSubjects.getConfigName(event.getSubject()); DateTime startDate = (DateTime) event.getParameters().get(START_DATE); DateTime endDate = (DateTime) event.getParameters().get(END_DATE); Range<DateTime> dateRange = new Range<>(startDate, endDate); <START> CommcareFormImporterImpl importer = new CommcareFormImporterImpl(eventRelay, formService); <END> int formsToImport = importer.countForImport(dateRange, configName); LOGGER.info("{} commcare forms to be imported.", formsToImport); importer.startImport(dateRange, configName); }</code><technical_language>this a class field, importer is for task-triggered imports</technical_language>

Target:
public void handleEvent(MotechEvent event) { CommcareFormImporterImpl importer = importerFactory.getCommcareFormImporter(); String configName = EventSubjects.getConfigName(event.getSubject()); DateTime startDate = (DateTime) event.getParameters().get(START_DATE); DateTime endDate = (DateTime) event.getParameters().get(END_DATE); Range<DateTime> dateRange = new Range<>(startDate, endDate); int formsToImport = importer.countForImport(dateRange, configName); LOGGER.info("{} commcare forms to be imported.", formsToImport); importer.startImport(dateRange, configName); }
Source:
<code>public void testInsertUrlSuccessful() { String goolgeString = "<LINK_0>"; URL googleUrl = null; try { googleUrl = URI.create(goolgeString).toURL(); } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } handle.createUpdate("INSERT INTO foo VALUES (:url)") .bind("url", googleUrl) .execute(); Assertions.assertThat(handle.createQuery("SELECT * FROM foo").mapTo(URL.class).findOnly()).isEqualTo(googleUrl); }</code><technical_language>Test method throw exception swallowing unexpected exception</technical_language>

Target:
public void testInsertUrlSuccessful() throws MalformedURLException { String googleString = "<LINK_0>"; URL googleUrl = new URL(googleString); handle.createUpdate("INSERT INTO foo VALUES (:url)") .bind("url", googleUrl) .execute(); URL actualUrl = handle.createQuery("SELECT url FROM foo").mapTo(URL.class).findOnly(); Assertions.assertThat(actualUrl).hasToString(googleUrl.toString()); }
Source:
<code><START> private ArrayList<PathAndTime> listTemporaryMacrosPathAndTime(File macroDirectory) { <END> ArrayList<PathAndTime> pathAndTime = new ArrayList<>(); try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(macroDirectory.toURI()), new DirectoryStream.Filter<Path>() { @Override public boolean accept(Path entry) { String name = entry.getFileName().toString().toLowerCase(); return name.startsWith(TEMP_MACRO_PREFIX) && name.endsWith(JS_EXT); } })) { for (Path p : directoryStream) { pathAndTime.add(new PathAndTime(p, Files.getLastModifiedTime(p).to(TimeUnit.NANOSECONDS))); } } catch (IOException e1) { Activator.log(e1); } Collections.sort(pathAndTime, new Comparator<PathAndTime>() { @Override public int compare(PathAndTime o1, PathAndTime o2) { return Long.compare(o2.fLastModified, o1.fLastModified); } }); return pathAndTime; }</code><technical_language>List<></technical_language>

Target:
private List<PathAndTime> listTemporaryMacrosPathAndTime(File macroDirectory) { List<PathAndTime> pathAndTime = new ArrayList<>(); try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(macroDirectory.toURI()), new DirectoryStream.Filter<Path>() { @Override public boolean accept(Path entry) { String name = entry.getFileName().toString().toLowerCase(); return name.startsWith(TEMP_MACRO_PREFIX) && name.endsWith(JS_EXT); } })) { for (Path p : directoryStream) { pathAndTime.add(new PathAndTime(p, Files.getLastModifiedTime(p).to(TimeUnit.NANOSECONDS))); } } catch (IOException e1) { Activator.log(e1); } Collections.sort(pathAndTime, new Comparator<PathAndTime>() { @Override public int compare(PathAndTime o1, PathAndTime o2) { return Long.compare(o2.fLastModified, o1.fLastModified); } }); return pathAndTime; }