auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ReloadServiceInvoker(ClassLoader cl) throws ReflectiveOperationException { Class<?> frameworkClass = cl.loadClass("org.nuxeo.runtime.api.Framework"); Class<?> reloadServiceClass = cl.loadClass("org.nuxeo.runtime.reload.ReloadService"); Method getLocalService = frameworkClass.getDeclaredMethod("getLocalService", Class.class); reloadService = getLocalService.invoke(null, reloadServiceClass); deployBundles = reloadServiceClass.getDeclaredMethod("deployBundles", File[].class); <START> undeployBundles = reloadServiceClass.getDeclaredMethod("undeployBundles", String[].class); <END> runDeploymentPreprocessor = reloadServiceClass.getDeclaredMethod("runDeploymentPreprocessor"); installWebResources = reloadServiceClass.getDeclaredMethod("installWebResources", File.class); flush = reloadServiceClass.getDeclaredMethod("flush"); reload = reloadServiceClass.getDeclaredMethod("reload"); flushSeam = reloadServiceClass.getDeclaredMethod("flushSeamComponents"); reloadSeam = reloadServiceClass.getDeclaredMethod("reloadSeamComponents"); getOSGIBundleName = reloadServiceClass.getDeclaredMethod("getOSGIBundleName", File.class); }</code><technical_language>Change this if change methods signatures</technical_language>

Target:
public ReloadServiceInvoker(ClassLoader cl) throws ReflectiveOperationException { Class<?> frameworkClass = cl.loadClass("org.nuxeo.runtime.api.Framework"); Class<?> reloadServiceClass = cl.loadClass("org.nuxeo.runtime.reload.ReloadService"); Method getLocalService = frameworkClass.getDeclaredMethod("getLocalService", Class.class); reloadService = getLocalService.invoke(null, reloadServiceClass); deployBundles = reloadServiceClass.getDeclaredMethod("deployBundles", List.class); undeployBundles = reloadServiceClass.getDeclaredMethod("undeployBundles", List.class); runDeploymentPreprocessor = reloadServiceClass.getDeclaredMethod("runDeploymentPreprocessor"); installWebResources = reloadServiceClass.getDeclaredMethod("installWebResources", File.class); flush = reloadServiceClass.getDeclaredMethod("flush"); reload = reloadServiceClass.getDeclaredMethod("reload"); flushSeam = reloadServiceClass.getDeclaredMethod("flushSeamComponents"); reloadSeam = reloadServiceClass.getDeclaredMethod("reloadSeamComponents"); getOSGIBundleName = reloadServiceClass.getDeclaredMethod("getOSGIBundleName", File.class); }
Source:
<code>public static Collection<Object[]> namesParams() { return Arrays.asList(new Object[][] { { null, false, true }, { "a.a.a.a", false, true }, { "255.255.0", false, true }, { "255.255.0.0.0", false, true }, { "255.255.0.0.", false, true }, { "255.255.0.1", false, true }, { "255.0.255.0", false, true }, { "255.0.0.255", false, true }, { "224.0.255.0", false, true }, { "255.255.0.0", true, true }, { "255.255.255.255", true, true }, { "31 ", false, true }, { "33", false, true }, { "31/", false, true }, { "31*", false, true }, { " { "31", true, true }, { "/31", true, true }, { "1", true, true }, { "/1", true, true }, { "31", false, false }, { "1", false, false }, { "/31", false, false }, { "/1", false, false }, { "255.255.0.0", true, false }, <START> { "255.255.255.255", true, false }, END> }); }</code><technical_language>missing a lot of cases exist in common test</technical_language>

Target:
public static Collection<Object[]> namesParams() { return Arrays.asList(new Object[][] { { null, false, false, true }, { "", false, false, true }, { "a.a.a.a", false, false, true }, { "255.255.0", false, false, true }, { "255.255.0.0.0", false, false, true }, { "255.255.0.0.", false, false, true }, { "31 ", false, false, true }, { "33", false, false, true }, { "31/", false, false, true }, { "31*", false, false, true }, { " { "/31 ", false, false, true }, { "01", false, false, true }, { "01/", false, false, true }, { "33", false, false, true }, { "/33", false, false, true }, { "255.255.0.1", true, false, true }, { "255.0.255.0", true, false, true }, { "255.0.0.255", true, false, true }, { "224.0.255.0", true, false, true }, { "255.255.0.0", true, true, true }, { "255.255.255.255", true, true, true }, { "31", true, true, true }, { "/31", true, true, true }, { "2", true, true, true }, { "/2", true, true, true }, { "31", false, false, false }, { "/31", false, false, false }, { "2", false, false, false }, { "/2", false, false, false }, { "255.255.0.1", true, false, true }, { "255.255.0.1", true, false, false }, { "255.255.0.0", true, true, true }, { "255.255.0.0", true, true, false }, }); }
Source:
<code>void restartSessionIfNeeded() { <START> if (OneSignal.appEntryState.isNotificationClick()) <END> return; OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "Session restarted"); cleanSession(); onSessionStarted(); if (sessionListener != null) sessionListener.onSessionRestarted(); }</code><technical_language>do passing this param? i generate a hide dependency OneSignal.java file</technical_language>

Target:
void restartSessionIfNeeded() { if (OneSignal.getAppEntryState().isNotificationClick()) return; JSONArray lastNotifications = getLastNotificationsReceivedIds(); if (lastNotifications.length() > 0) setSession(Session.INDIRECT, null, lastNotifications); else setSession(Session.UNATTRIBUTED, null, null); }
Source:
<code>public Member createMember(PerunSession sess, Vo vo, User user, List<Group> groups) throws InternalErrorException, AlreadyMemberException, ExtendMembershipException, WrongAttributeValueException, WrongReferenceAttributeValueException { try { Member member = getMemberByUser(sess, vo, user); throw new AlreadyMemberException(member); } catch(MemberNotExistsException IGNORE) { } Member member = getMembersManagerImpl().createMember(sess, vo, user); getPerunBl().getAuditer().log(sess, "{} created.", member); String memberLoa = null; try { Attribute loa = getPerunBl().getAttributesManagerBl().getAttribute(sess, member, AttributesManager.NS_MEMBER_ATTR_VIRT + ":loa"); memberLoa = (String) loa.getValue(); } catch (AttributeNotExistsException e) { } catch (WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } this.canBeMemberInternal(sess, vo, user, memberLoa, true); this.extendMembership(sess, member); insertToMemberGroup(sess, member, vo); if(groups != null && !groups.isEmpty()) { for(Group group: groups) { try { perunBl.getGroupsManagerBl().addMember(sess, group, member); } catch (NotMemberOfParentGroupException ex) { throw new InternalErrorException("Member " + member + " can't be added to the group " + group + " because he is not member of it's parent group.", ex); <START> } catch (NotGroupMemberException | GroupNotExistsException e) { <END> throw new ConsistencyErrorException(e); } } } return member; }</code><technical_language>GroupOperationException</technical_language>

Target:
public Member createMember(PerunSession sess, Vo vo, User user, List<Group> groups) throws InternalErrorException, AlreadyMemberException, ExtendMembershipException, GroupOperationsException, WrongAttributeValueException, WrongReferenceAttributeValueException { try { Member member = getMemberByUser(sess, vo, user); throw new AlreadyMemberException(member); } catch(MemberNotExistsException IGNORE) { } Member member = getMembersManagerImpl().createMember(sess, vo, user); getPerunBl().getAuditer().log(sess, "{} created.", member); String memberLoa = null; try { Attribute loa = getPerunBl().getAttributesManagerBl().getAttribute(sess, member, AttributesManager.NS_MEMBER_ATTR_VIRT + ":loa"); memberLoa = (String) loa.getValue(); } catch (AttributeNotExistsException e) { } catch (WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } this.canBeMemberInternal(sess, vo, user, memberLoa, true); this.extendMembership(sess, member); insertToMemberGroup(sess, member, vo); if(groups != null && !groups.isEmpty()) { for(Group group: groups) { try { perunBl.getGroupsManagerBl().addMember(sess, group, member); } catch (GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } } return member; }
Source:
<code>public void testOneByte() throws IOException { final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null); final byte test = (byte) new TestRng(getName()).nextInt(); try { b.write(test); b.close(); assertEquals(1, b.length()); { final byte[] r = b.toByteArray(); assertNotNull(r); assertEquals(1, r.length); assertEquals(test, r[0]); } <START> { <END> try (ByteArrayOutputStream o = new ByteArrayOutputStream()) { b.writeTo(o, null); final byte[] r = o.toByteArray(); assertEquals(1, r.length); assertEquals(test, r[0]); } } } finally { b.destroy(); } }</code><technical_language>try block need extra surrounding block anymore. More of</technical_language>

Target:
public void testOneByte() throws IOException { final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null); final byte test = (byte) new TestRng(getName()).nextInt(); try { b.write(test); b.close(); assertEquals(1, b.length()); { final byte[] r = b.toByteArray(); assertNotNull(r); assertEquals(1, r.length); assertEquals(test, r[0]); } try (ByteArrayOutputStream o = new ByteArrayOutputStream()) { b.writeTo(o, null); final byte[] r = o.toByteArray(); assertEquals(1, r.length); assertEquals(test, r[0]); } } finally { b.destroy(); } }
Source:
<code>public void handle(Context context) throws Exception { if (blocks.isEmpty()) { noMatchHandler.handle(context); return; } String acceptHeader = context.getRequest().getHeaders().get(HttpHeaderNames.ACCEPT); if (Strings.isNullOrEmpty(acceptHeader)) { unspecifiedHandler.handle(context); } else { <START> List<String> types = blocks.keySet().stream().collect(Collectors2.toListReversed()); <END> String winner = MimeParse.bestMatch(types, acceptHeader); if (Strings.isNullOrEmpty(winner)) { noMatchHandler.handle(context); } else { context.getResponse().contentType(winner); blocks.get(winner).execute(); } } }</code><technical_language>replaced ImmutableList.of().reverse()</technical_language>

Target:
public void handle(Context context) throws Exception { if (blocks.isEmpty()) { noMatchHandler.handle(context); return; } String acceptHeader = context.getRequest().getHeaders().get(HttpHeaderNames.ACCEPT); if (Strings.isNullOrEmpty(acceptHeader)) { unspecifiedHandler.handle(context); } else { List<String> types = ImmutableList.copyOf(blocks.keySet()).reverse(); String winner = MimeParse.bestMatch(types, acceptHeader); if (Strings.isNullOrEmpty(winner)) { noMatchHandler.handle(context); } else { context.getResponse().contentType(winner); blocks.get(winner).execute(); } } }
Source:
<code>private void startAutoSaving() { logger.info("Auto Saving - Creating game snapshot"); PerformanceMonitor.startActivity("Auto Saving"); ComponentSystemManager componentSystemManager = CoreRegistry.get(ComponentSystemManager.class); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.preAutoSave(); } saveTransaction = createSaveTransaction(); saveThreadManager.offer(saveTransaction); <START> saveGamePreviewImage(); <END> for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.postAutoSave(); } scheduleNextAutoSave(); PerformanceMonitor.endActivity(); entitySetDeltaRecorder = new EntitySetDeltaRecorder(this.entityRefReplacingComponentLibrary); logger.info("Auto Saving - Snapshot created: Writing phase starts"); }</code><technical_language>IMHO this is frequent do automatic screenshots. Autosave is IIRC 30 seconds? 120 hour, 8 hours of gameplay get a thousand screenshots, average size of 100kb 100 MB of screenshots :-) stick generating automatic screenshot manual save (exiting world). Optionally add player settings automatically screenshots x convinced a demand for that</technical_language>

Target:
private void startAutoSaving() { logger.info("Auto Saving - Creating game snapshot"); PerformanceMonitor.startActivity("Auto Saving"); ComponentSystemManager componentSystemManager = CoreRegistry.get(ComponentSystemManager.class); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.preAutoSave(); } saveTransaction = createSaveTransaction(); saveThreadManager.offer(saveTransaction); for (ComponentSystem sys : componentSystemManager.iterateAll()) { sys.postAutoSave(); } scheduleNextAutoSave(); PerformanceMonitor.endActivity(); entitySetDeltaRecorder = new EntitySetDeltaRecorder(this.entityRefReplacingComponentLibrary); logger.info("Auto Saving - Snapshot created: Writing phase starts"); }
Source:
<code>public int hashCode() { return new HashCodeBuilder(5, 35) .append(alias) .append(description) .append(progress) <START> .append(referenceGenome.getId()) <END> .append(shortName) .toHashCode(); }</code><technical_language>Potential NPE. useful ID is set (such migration). append ReferenceGenome object here, base ReferenceGenome's hashCode alias (which is a unique key also)</technical_language>

Target:
public int hashCode() { return new HashCodeBuilder(5, 35) .append(alias) .append(description) .append(progress) .append(referenceGenome) .append(shortName) .toHashCode(); }
Source:
<code>private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem fs, final NavigableSet<Path> files, final CancelableProgressable reporter, final Path regionDir) throws IOException { long seqid = minSeqIdForTheRegion; if (LOG.isDebugEnabled()) { LOG.debug("Found " + (files == null ? 0 : files.size()) + " recovered edits file(s) under " + regionDir); } if (files == null || files.isEmpty()) { return minSeqIdForTheRegion; } for (Path edits: files) { if (edits == null || !fs.exists(edits)) { LOG.warn("Null or non-existent edits file: " + edits); continue; } if (isZeroLengthThenDelete(fs, fs.getFileStatus(edits), edits)) { continue; } long maxSeqId; String fileName = edits.getName(); maxSeqId = Math.abs(Long.parseLong(fileName.split("\\.")[0])); if (maxSeqId <= minSeqIdForTheRegion) { if (LOG.isDebugEnabled()) { String msg = "Maximum sequenceid for this wal is " + maxSeqId <START> + " and minimum sequenceid for the region " + this + " is " + minSeqIdForTheRegion <END> + ", skipped the whole file, path=" + edits; LOG.debug(msg); } continue; } try { seqid = Math.max(seqid, replayRecoveredEdits(edits, maxSeqIdInStores, reporter, fs)); } catch (IOException e) { handleException(fs, edits, e); } } return seqid; }</code><technical_language>For files corrupted suffix, skip replay attempt this point onwards? work, save some computation</technical_language>

Target:
private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem fs, final NavigableSet<Path> files, final CancelableProgressable reporter, final Path regionDir) throws IOException { long seqid = minSeqIdForTheRegion; if (LOG.isDebugEnabled()) { LOG.debug("Found " + (files == null ? 0 : files.size()) + " recovered edits file(s) under " + regionDir); } if (files == null || files.isEmpty()) { return minSeqIdForTheRegion; } for (Path edits: files) { if (edits == null || !fs.exists(edits)) { LOG.warn("Null or non-existent edits file: " + edits); continue; } if (isZeroLengthThenDelete(fs, fs.getFileStatus(edits), edits)) { continue; } long maxSeqId; String fileName = edits.getName(); maxSeqId = Math.abs(Long.parseLong(fileName)); if (maxSeqId <= minSeqIdForTheRegion) { if (LOG.isDebugEnabled()) { String msg = "Maximum sequenceid for this wal is " + maxSeqId + " and minimum sequenceid for the region " + this + " is " + minSeqIdForTheRegion + ", skipped the whole file, path=" + edits; LOG.debug(msg); } continue; } try { seqid = Math.max(seqid, replayRecoveredEdits(edits, maxSeqIdInStores, reporter, fs)); } catch (IOException e) { handleException(fs, edits, e); } } return seqid; }
Source:
<code>public static Object transformValue(int sqlType, int precision, int scale, ResultSet resultSet, String fieldName) throws SQLException { Object original = resultSet.getObject(fieldName); if (original != null) { switch (sqlType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: case Types.DECIMAL: BigDecimal decimal = (BigDecimal) original; <START> return decimal.unscaledValue().toByteArray(); <END> case Types.DATE: return resultSet.getDate(fieldName); case Types.TIME: return resultSet.getTime(fieldName); case Types.TIMESTAMP: return resultSet.getTimestamp(fieldName); case Types.ROWID: return resultSet.getString(fieldName); case Types.BLOB: Blob blob = (Blob) original; try { return blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } case Types.CLOB: Clob clob = (Clob) original; try { return clob.getSubString(1, (int) clob.length()); } finally { clob.free(); } } } return original; }</code><technical_language>Please move this logic here: <LINK_0></technical_language>

Target:
public static Object transformValue(int sqlType, int precision, int scale, ResultSet resultSet, String fieldName) throws SQLException { Object original = resultSet.getObject(fieldName); if (original != null) { switch (sqlType) { case Types.SMALLINT: case Types.TINYINT: return ((Number) original).intValue(); case Types.NUMERIC: BigDecimal decimal = (BigDecimal) original; if (scale != 0) { return decimal.doubleValue(); } else if (precision > 9) { return decimal.longValue(); } else { return decimal.intValue(); } case Types.DECIMAL: return original; case Types.DATE: return resultSet.getDate(fieldName); case Types.TIME: return resultSet.getTime(fieldName); case Types.TIMESTAMP: return resultSet.getTimestamp(fieldName); case Types.ROWID: return resultSet.getString(fieldName); case Types.BLOB: Blob blob = (Blob) original; try { return blob.getBytes(1, (int) blob.length()); } finally { blob.free(); } case Types.CLOB: Clob clob = (Clob) original; try { return clob.getSubString(1, (int) clob.length()); } finally { clob.free(); } } } return original; }
Source:
<code>static LabelTypes getLegacyTypes(ReviewDb db) throws SQLException { Statement stmt = ((JdbcSchema) db).getConnection().createStatement(); List<LabelType> types = Lists.newArrayListWithExpectedSize(2); try { ResultSet rs = stmt.executeQuery( "SELECT approval_categories.category_id," + " approval_categories.name AS category_name, abbreviated_name," + " function_name, copy_min_score, value," + " approval_category_values.name AS text" + " FROM approval_categories" <START> + " JOIN approval_category_values ON approval_categories.category_id" <END> + " = approval_category_values.category_id" + " ORDER BY position, category_name, value"); try { String last = null; LabelType curr = null; List<LabelValue> values = Lists.newArrayListWithCapacity(5); while (rs.next()) { String id = rs.getString("category_id"); if (id != last) { if (curr != null) { types.add(newLabel(curr, values)); values.clear(); } curr = new LabelType(getLabelName(rs.getString("category_name")), ImmutableList.<LabelValue> of()); curr.setId(id); curr.setAbbreviatedName(rs.getString("abbreviated_name")); curr.setFunctionName(rs.getString("function_name")); curr.setCopyMinScore(rs.getBoolean("copy_min_score")); } values.add( new LabelValue(rs.getShort("value"), rs.getString("text"))); last = id; if (rs.isLast()) { types.add(newLabel(curr, values)); } } } finally { rs.close(); } } finally { stmt.close(); } return new LabelTypes(types); }</code><technical_language>this a join is pretty damn ugly read. servers 1 2 categories. naive nested loops queries (one read approval_categories, a nested loop read approval_category_values for category_id) easier follow. upgrade time is dominated fast database write out mutations for migratePatchSetApprovals</technical_language>

Target:
static LabelTypes getLegacyTypes(ReviewDb db) throws SQLException { List<LabelType> types = Lists.newArrayListWithCapacity(2); Statement catStmt = null; PreparedStatement valStmt = null; ResultSet catRs = null; try { catStmt = ((JdbcSchema) db).getConnection().createStatement(); catRs = catStmt.executeQuery( "SELECT category_id, name, abbreviated_name, function_name, " + " copy_min_score" + " FROM approval_categories" + " ORDER BY position, name"); valStmt = ((JdbcSchema) db).getConnection().prepareStatement( "SELECT name, value" + " FROM approval_category_values" + " WHERE category_id = ?"); while (catRs.next()) { String id = catRs.getString("category_id"); valStmt.setString(1, id); List<LabelValue> values = Lists.newArrayListWithCapacity(5); ResultSet valRs = valStmt.executeQuery(); try { while (valRs.next()) { values.add(new LabelValue( valRs.getShort("value"), valRs.getString("name"))); } } finally { valRs.close(); } LabelType type = new LabelType(getLabelName(catRs.getString("name")), values); type.setId(id); type.setAbbreviatedName(catRs.getString("abbreviated_name")); type.setFunctionName(catRs.getString("function_name")); type.setCopyMinScore(catRs.getBoolean("copy_min_score")); types.add(type); } } finally { if (valStmt != null) { valStmt.close(); } if (catRs != null) { catRs.close(); } if (catStmt != null) { catStmt.close(); } } return new LabelTypes(types); }
Source:
<code>public static void initializeBeanInstance(Object instance) { Collection<Field> fields = collectInjectedFields(instance.getClass()); for (Field field : fields) { LOG.debug("injecting field {}", field); try { field.setAccessible(true); Object value = BEANS.get(field.getType()); field.set(instance, value); } catch (Exception e) { throw translateException("Exception while injecting field", e); } } Collection<Method> initMethods = collectInjectedMethods(instance.getClass()); for (Method method : initMethods) { LOG.debug("invoking injected method {}", method); try { method.setAccessible(true); method.invoke(instance, <START> BeanInstanceUtil.getInjectionArguments(method.getParameterTypes())); <END> } catch (Exception e) { throw translateException("Exception while invoking @InjectBean method", e); } } Collection<Method> postConstructMethods = collectPostConstructMethods(instance.getClass()); for (Method method : postConstructMethods) { LOG.debug("invoking post-construct method {}", method); try { method.setAccessible(true); method.invoke(instance); } catch (Exception e) { throw translateException("Exception while invoking @PostConstruct method {}", e); } } }</code><technical_language>"BeanInstanceUtil." prefix is necessary</technical_language>

Target:
public static void initializeBeanInstance(Object instance) { Collection<Field> fields = collectInjectedFields(instance.getClass()); for (Field field : fields) { LOG.debug("injecting field {}", field); try { field.setAccessible(true); Object value = BEANS.get(field.getType()); field.set(instance, value); } catch (Exception e) { throw translateException("Exception while injecting field {}", field, e); } } Collection<Method> initMethods = collectInjectedMethods(instance.getClass()); for (Method method : initMethods) { LOG.debug("invoking injected method {}", method); try { method.setAccessible(true); method.invoke(instance, getInjectionArguments(method.getParameterTypes())); } catch (Exception e) { throw translateException("Exception while invoking @InjectBean method {}", method, e); } } Collection<Method> postConstructMethods = collectPostConstructMethods(instance.getClass()); for (Method method : postConstructMethods) { LOG.debug("invoking post-construct method {}", method); try { method.setAccessible(true); method.invoke(instance); } catch (Exception e) { throw translateException("Exception while invoking @PostConstruct method {}", method, e); } } }
Source:
<code>public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) { try { fMembersOrderPreferenceCache = fMembersOrderPreferenceCachePromise.getValue(); } catch (InvocationTargetException e) { log(e); } catch <START> (InterruptedException e) <END> { log(e); } } return fMembersOrderPreferenceCache; }</code><technical_language>Thread.currentThread().interrupt(); is missing here</technical_language>

Target:
public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) { try { fMembersOrderPreferenceCache= fMembersOrderPreferenceCachePromise.getValue(); } catch (InvocationTargetException | InterruptedException e) { log(e); fMembersOrderPreferenceCache= createMemberOrderPreferenceCache(); } } return fMembersOrderPreferenceCache; }
Source:
<code>public Optional<Entity> createEntity(EntityType type, Vector3d position) { try { net.minecraft.entity.Entity entity = (net.minecraft.entity.Entity) type.getEntityClass().getConstructor(net.minecraft.world.World.class).newInstance(this); entity.setPosition(position.getX(), position.getY(), position.getZ()); if (spawnEntityInWorld(entity)) { return Optional.of((Entity) entity); } } catch (Exception ignored) { } return Optional.absent(); <START> } <END></code><technical_language>safer EntityList.createEntityByName(String, World)</technical_language>

Target:
public Optional<Entity> createEntity(EntityType type, Vector3d position) { try { net.minecraft.entity.Entity entity = (net.minecraft.entity.Entity) type.getEntityClass().getConstructor(net.minecraft.world.World.class).newInstance(this); entity.setPosition(position.getX(), position.getY(), position.getZ()); if (this.spawnEntityInWorld(entity)) { return Optional.of((Entity) entity); } } catch (Exception ignored) { } return Optional.absent(); }
Source:
<code>public List<ValueType> peekAll() { try (final Handle handle = rdbi.open()) { final Pipeline pipeline = handle.jedis().pipelined(); List<ValueType> currentList = new ArrayList<ValueType>(); final int size = handle.jedis().llen(key).intValue(); final List<Response<String>> responses = Lists.newArrayListWithCapacity(size); for (int i = 0; i < size; i++) { <START> responses.add(pipeline.lindex(key, i)); <END> } pipeline.sync(); for(final Response<String> res : responses) { ValueType value = serializationHelper.decode(res.get()); currentList.add(value); } return currentList; } }</code><technical_language>i is get lrange(...) in shot, bother fetching size (again, a two-step leaving open concurrency problems. imagine while thread A is in middle of iterating a peekAll, thread B starts rapidly popping members out.)</technical_language>

Target:
public List<ValueType> peekAll() { try (final Handle handle = rdbi.open()) { List<String> strList = handle.jedis().lrange(key, 0, maxSize); List<ValueType> currentList = strList.stream().map(str -> serializationHelper.decode(str)).collect(toList()); return currentList; } }
Source:
<code>private String generateOsgiFilter(String transformerId) { <START> return "(|" <END> + "(" + Constants.SERVICE_SHORTNAME + "=" + transformerId + ")" + "(" + Constants.SERVICE_ID + "=" + transformerId + ")" + ")"; }</code><technical_language>String.format this a neater easier read</technical_language>

Target:
private String generateOsgiFilter(String transformerId) { return String.format( "(|(%s=%s)(%s=%s))", Constants.SERVICE_SHORTNAME, transformerId, Constants.SERVICE_ID, transformerId); }
Source:
<code>Mono<VerifyResult> verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { if (serviceCryptoAvailable()) { return serviceClient.verify(algorithm, digest, signature, context); } else { <START> return Mono.error(new UnsupportedOperationException("Verify operation on Local RSA key is not" <END> + " supported currently.")); } }</code><technical_language>monoError() in FluxUtil log error. Do in other places too</technical_language>

Target:
Mono<VerifyResult> verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { if (serviceCryptoAvailable()) { return serviceClient.verify(algorithm, digest, signature, context); } else { return FluxUtil.monoError(logger, new UnsupportedOperationException("Verify operation on Local RSA key is not" + " supported currently.")); } }
Source:
<code><START> public BucketSplitInfo(int bucketCount, IntPredicate bucketFilter) <END> { this.bucketCount = bucketCount; this.bucketFilter = bucketFilter; }</code><technical_language>This private</technical_language>

Target:
private BucketSplitInfo(int bucketCount, IntPredicate bucketFilter) { this.bucketCount = requireNonNull(bucketCount, "bucketCount is null"); this.bucketFilter = requireNonNull(bucketFilter, "bucketFilter is null"); }
Source:
<code>static MarketDataNode buildDependencyTree( MarketDataRequirements requirements, BaseMarketData suppliedData, <START> Map<Class<? extends MarketDataId<?>>, MarketDataBuilder<?, ?>> builders) { <END> return MarketDataNode.root(children(requirements, suppliedData, builders)); }</code><technical_language>supplied data builders passed lots of methods. is a case for creating a separate class contains state, changing methods static instance</technical_language>

Target:
static MarketDataNode buildDependencyTree( MarketDataRequirements requirements, BaseMarketData suppliedData, Map<Class<? extends MarketDataId<?>>, MarketDataBuilder<?, ?>> builders) { DependencyTreeBuilder treeBuilder = DependencyTreeBuilder.of(suppliedData, requirements, builders); return MarketDataNode.root(treeBuilder.childNodes()); }
Source:
<code>public void testTargetMinimumSizeFilter(final List<Target> targets, final int minimumTargetSize) throws IOException { final File targetFile = createTargetFile(targets, Collections.emptySet()); final List<Target> leftInTargets = targets.stream() .filter(t -> t.getInterval().size() >= minimumTargetSize) .collect(Collectors.toList()); final List<Target> leftOutTargets = targets.stream() .filter(t -> t.getInterval().size() < minimumTargetSize) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); final File rejectionFile = createTempFile("reject", ".tab"); runCommandLine(new String[] { "-" + TargetArgumentCollection.TARGET_FILE_SHORT_NAME, targetFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterTargets.MINIMUM_TARGET_SIZE_SHORT_NAME, String.valueOf(minimumTargetSize), "-" + FilterTargets.REJECT_OUTPUT_FILE_SHORT_NAME, rejectionFile.getPath(), }); final TargetCollection<Target> outputTargetCollection = TargetArgumentCollection.readTargetCollection(outputFile); final List<Target> outputTargets = outputTargetCollection.targets(); Assert.assertEquals(leftInTargets.size(), outputTargets.size()); <START> for (int i = 0; i < outputTargets.size(); i++) { <END> Assert.assertEquals(outputTargets.get(i), leftInTargets.get(i)); Assert.assertEquals(outputTargets.get(i).getInterval(), leftInTargets.get(i).getInterval()); } checkRejectedTargets(leftOutTargets, rejectionFile, FilterTargets.TargetFilter.MinimumTargetSize); }</code><technical_language>Extract private void checkLeftInTargets(final List<Target> expected, final List<Target> actual)</technical_language>

Target:
public void testTargetMinimumSizeFilter(final List<Target> targets, final int minimumTargetSize) throws IOException { final File targetFile = createTargetFile(targets, Collections.emptySet()); final List<Target> leftInTargets = targets.stream() .filter(t -> t.getInterval().size() >= minimumTargetSize) .collect(Collectors.toList()); final List<Target> leftOutTargets = targets.stream() .filter(t -> t.getInterval().size() < minimumTargetSize) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); final File rejectionFile = createTempFile("reject", ".tab"); runCommandLine(new String[] { "-" + TargetArgumentCollection.TARGET_FILE_SHORT_NAME, targetFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterTargets.MINIMUM_TARGET_SIZE_SHORT_NAME, String.valueOf(minimumTargetSize), "-" + FilterTargets.REJECT_OUTPUT_FILE_SHORT_NAME, rejectionFile.getPath(), }); checkLeftInTargets(leftInTargets, outputFile); checkRejectedTargets(leftOutTargets, rejectionFile, FilterTargets.TargetFilter.MinimumTargetSize); }
Source:
<code>public void waitSampleByName(String... sampleNames) { asList(sampleNames) .forEach( name -> { <START> String sampleXpath = format(SAMPLE_ITEM_TEMPLATE_XPATH, sampleNames); <END> seleniumWebDriverHelper.waitVisibility(By.xpath(sampleXpath)); }); }</code><technical_language>confusion: sampleNames > name</technical_language>

Target:
public void waitSampleByName(String... sampleNames) { asList(sampleNames) .forEach( sampleName -> { String sampleXpath = format(SAMPLE_ITEM_TEMPLATE_XPATH, sampleName); seleniumWebDriverHelper.waitVisibility(By.xpath(sampleXpath)); }); }
Source:
<code>private static void filterCylicDependencies(List<ProjectConfiguratorContribution> configurators) { Map<String, ProjectConfiguratorContribution> idToConfigurator = configurators.stream() .collect(Collectors.toMap(ProjectConfiguratorContribution::getFullyQualifiedId, Function.identity())); MutableGraph<ProjectConfiguratorContribution> graph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); configurators.forEach(c -> graph.addNode(c)); for (ProjectConfiguratorContribution configurator : configurators) { Iterator<String> it = configurator.getRunsBefore().iterator(); <START> while (it.hasNext()) { <END> String id = it.next(); ProjectConfiguratorContribution target = idToConfigurator.get(id); graph.putEdge(configurator, target); if (Graphs.hasCycle(graph)) { LOGGER.trace(CoreTraceScopes.PROJECT_CONFIGURATORS, "Configurator dependency (" + configurator.getFullyQualifiedId() + " -> " + id + ") removed because it introduces dependency cycle"); graph.removeEdge(configurator, target); it.remove(); } } it = configurator.getRunsAfter().iterator(); while (it.hasNext()) { String id = it.next(); ProjectConfiguratorContribution target = idToConfigurator.get(id); graph.putEdge(target, configurator); if (Graphs.hasCycle(graph)) { LOGGER.trace(CoreTraceScopes.PROJECT_CONFIGURATORS, "Configurator dependency (" + id + " -> " + configurator.getFullyQualifiedId() + ") removed because it introduces dependency cycle"); graph.removeEdge(target, configurator); it.remove(); } } } }</code><technical_language>Duplicate code loop - edge direction is different</technical_language>

Target:
private static void filterCylicDependencies(List<ProjectConfiguratorContribution> configurators) { Map<String, ProjectConfiguratorContribution> idToConfigurator = configurators.stream() .collect(Collectors.toMap(ProjectConfiguratorContribution::getFullyQualifiedId, Function.identity())); MutableGraph<ProjectConfiguratorContribution> dependencyGraph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); configurators.forEach(c -> dependencyGraph.addNode(c)); for (ProjectConfiguratorContribution configurator : configurators) { filterCylicDependencies(configurator, configurator.getRunsBefore(), idToConfigurator, dependencyGraph, false); filterCylicDependencies(configurator, configurator.getRunsAfter(), idToConfigurator, dependencyGraph, true); } }
Source:
<code>public static Set<ArtifactVersion> ensureDefaultAndPreviousVersionAvailable(final Set<ArtifactVersion> versions) { final ArtifactVersion defaultVersion = parseVersion(NewSwitchYardProjectWizard.DEFAULT_RUNTIME_VERSION); <START> if (!versions.contains(defaultVersion)) { <END> versions.add(defaultVersion); } final ArtifactVersion previousVersion = parseVersion(NewSwitchYardProjectWizard.PREVIOUS_RUNTIME_VERSION); if (!versions.contains(previousVersion)) { versions.add(previousVersion); } return versions; }</code><technical_language>realizing now: if is a Set need check if is contained</technical_language>

Target:
public static Set<ArtifactVersion> ensureDefaultAndPreviousVersionAvailable(final Set<ArtifactVersion> versions) { final ArtifactVersion defaultVersion = parseVersion(NewSwitchYardProjectWizard.DEFAULT_RUNTIME_VERSION); versions.add(defaultVersion); final ArtifactVersion previousVersion = parseVersion(NewSwitchYardProjectWizard.PREVIOUS_RUNTIME_VERSION); versions.add(previousVersion); return versions; }
Source:
<code>private static OMElement loadConfigXML() throws EventBrokerConfigurationException { String carbonConfigHome = CarbonBaseUtils.getCarbonConfigDirPath(); <START> String path = Paths.get(carbonConfigHome, EventBrokerConstants.EB_CONF).toString(); <END> BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(new File(path))); XMLStreamReader parser = XMLInputFactory.newInstance(). createXMLStreamReader(inputStream); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); omElement.build(); return omElement; } catch (FileNotFoundException e) { throw new EventBrokerConfigurationException(EventBrokerConstants.EB_CONF + "cannot be found in the path : " + path, e); } catch (XMLStreamException e) { throw new EventBrokerConfigurationException("Invalid XML for " + EventBrokerConstants.EB_CONF + " located in the path : " + path, e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ingored) { throw new EventBrokerConfigurationException("Can not close the input stream"); } } }</code><technical_language>Paths.get(carbonConfigHome, EventBrokerConstants.EB_CONF).toFile() need create a File Object in line 86</technical_language>

Target:
private static OMElement loadConfigXML() throws EventBrokerConfigurationException { String carbonConfigHome = CarbonBaseUtils.getCarbonConfigDirPath(); File confFile = Paths.get(carbonConfigHome, EventBrokerConstants.EB_CONF).toFile(); String path = confFile.toString(); BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(confFile)); XMLStreamReader parser = XMLInputFactory.newInstance(). createXMLStreamReader(inputStream); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); omElement.build(); return omElement; } catch (FileNotFoundException e) { throw new EventBrokerConfigurationException(EventBrokerConstants.EB_CONF + "cannot be found in the path : " + path, e); } catch (XMLStreamException e) { throw new EventBrokerConfigurationException("Invalid XML for " + EventBrokerConstants.EB_CONF + " located in the path : " + path, e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ingored) { throw new EventBrokerConfigurationException("Can not close the input stream"); } } }
Source:
<code><START> public void testIsDrawable_ReusableSubprocess() throws Exception { <END> testIsDrawable(AdHocSubprocess.class, ReusableSubprocess.class, true); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testIsDrawable_ReusableSubprocess() { testIsDrawable(AdHocSubprocess.class, ReusableSubprocess.class, true); }
Source:
<code>public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); try { if (blobReadInfo.isPrefetched()) { ByteBuffer outputBuffer = blobReadInfo.getPrefetchedBuffer(); <START> outputBuffer.flip(); <END> long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuffer.limit((int) (relativeOffset + sizeToRead)); outputBuffer.position((int) (relativeOffset)); written = channel.write(outputBuffer); } else { blobReadInfo.downloadBlob(blobStore, Channels.newOutputStream(channel)); written = blobReadInfo.getBlobSize(); } } catch (StoreException ex) { throw new IOException("Download of cloud blob " + blobReadInfoList.get(index).getBlobId().getID() + " failed"); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobReadInfo.getBlobId().getID()); return written; }</code><technical_language>Do need this flip()</technical_language>

Target:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); try { if (blobReadInfo.isPrefetched()) { ByteBuffer outputBuffer = blobReadInfo.getPrefetchedBuffer(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuffer.limit((int) (relativeOffset + sizeToRead)); outputBuffer.position((int) (relativeOffset)); written = channel.write(outputBuffer); } else { blobReadInfo.downloadBlob(blobStore, Channels.newOutputStream(channel)); written = blobReadInfo.getBlobSize(); } } catch (StoreException ex) { throw new IOException("Download of cloud blob " + blobReadInfoList.get(index).getBlobId().getID() + " failed"); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobReadInfo.getBlobId().getID()); return written; }
Source:
<code>private void write(Connection connection, Connection.ResponseCallback responseCallback) throws ConnectionException, BusyConnectionException { connectionHandler = null; while (true) { QueryState previous = queryStateRef.get(); if (previous.isCancelled()) { connection.release(); return; } if (previous.inProgress || queryStateRef.compareAndSet(previous, previous.startNext())) break; } <START> requestSent = true; <END> connectionHandler = connection.write(responseCallback, false); connectionHandler.startTimeout(); if (queryStateRef.get() == QueryState.CANCELLED_WHILE_IN_PROGRESS && connectionHandler.cancelHandler()) connection.release(); }</code><technical_language>This is a bit coarse-grained IMO. For exceptions thrown Connection#write(ResponseCallback, boolean) if detect error in Connection#writeHandler, request sent. Thinking of a handle that</technical_language>

Target:
private void write(Connection connection, Connection.ResponseCallback responseCallback) throws ConnectionException, BusyConnectionException { connectionHandler = null; while (true) { QueryState previous = queryStateRef.get(); if (previous.isCancelled()) { connection.release(); return; } if (previous.inProgress || queryStateRef.compareAndSet(previous, previous.startNext())) break; } connectionHandler = connection.write(responseCallback, false); connectionHandler.startTimeout(); if (queryStateRef.get() == QueryState.CANCELLED_WHILE_IN_PROGRESS && connectionHandler.cancelHandler()) connection.release(); }
Source:
<code>public void update(SolGame game) { SolShip nearestEnemy = game.getFactionMan().getNearestEnemy(game, this); myPilot.update(game, this, nearestEnemy); myHull.update(game, myItemContainer, myPilot, this, nearestEnemy); game.getPartMan().updateAllHullEmittersOfType(this, "collision", colliding); updateAbility(game); updateIdleTime(game); updateShield(game); if(factionInfo.getDisposition().get(factionID) < -5) getPilot().setFaction("ehar"); else getPilot().setFaction("laani"); <START> <END> if (myArmor != null && !myItemContainer.contains(myArmor)) { myArmor = null; } if (myTradeContainer != null) { myTradeContainer.update(game); } if (isControlsEnabled() && myRepairer != null && myIdleTime > ShipRepairer.REPAIR_AWAIT) { myHull.life += myRepairer.tryRepair(game, myItemContainer, myHull.life, myHull.config); } float ts = game.getTimeStep(); if (myFireAwait > 0) { myFireAwait -= ts; } mySmokeSrc.setWorking(myFireAwait > 0 || myHull.life < SMOKE_PERC * myHull.config.getMaxLife()); boolean onFire = myFireAwait > 0 || myHull.life < FIRE_PERC * myHull.config.getMaxLife(); myFireSrc.setWorking(onFire); if (onFire) { game.getSoundManager().play(game, game.getSpecialSounds().burning, null, this); } if (!isControlsEnabled()) { myControlEnableAwait -= ts; if (isControlsEnabled()) { game.getSoundManager().play(game, game.getSpecialSounds().controlEnabled, null, this); } } myElectricitySrc.setWorking(!isControlsEnabled()); if (myAbility instanceof Teleport) { ((Teleport) myAbility).maybeTeleport(game, this); } colliding = false; }</code><technical_language>unnecessary space</technical_language>

Target:
public void update(SolGame game) { SolShip nearestEnemy = game.getFactionMan().getNearestEnemy(game, this); myPilot.update(game, this, nearestEnemy); myHull.update(game, myItemContainer, myPilot, this, nearestEnemy); game.getPartMan().updateAllHullEmittersOfType(this, "collision", colliding); updateAbility(game); updateIdleTime(game); updateShield(game); if (FactionInfo.getDisposition().get(factionID) < -5) { getPilot().stringToFaction("ehar"); } else { getPilot().stringToFaction("laani"); } if (myArmor != null && !myItemContainer.contains(myArmor)) { myArmor = null; } if (myTradeContainer != null) { myTradeContainer.update(game); } if (isControlsEnabled() && myRepairer != null && myIdleTime > ShipRepairer.REPAIR_AWAIT) { myHull.life += myRepairer.tryRepair(game, myItemContainer, myHull.life, myHull.config); } float ts = game.getTimeStep(); if (myFireAwait > 0) { myFireAwait -= ts; } mySmokeSrc.setWorking(myFireAwait > 0 || myHull.life < SMOKE_PERC * myHull.config.getMaxLife()); boolean onFire = myFireAwait > 0 || myHull.life < FIRE_PERC * myHull.config.getMaxLife(); myFireSrc.setWorking(onFire); if (onFire) { game.getSoundManager().play(game, game.getSpecialSounds().burning, null, this); } if (!isControlsEnabled()) { myControlEnableAwait -= ts; if (isControlsEnabled()) { game.getSoundManager().play(game, game.getSpecialSounds().controlEnabled, null, this); } } myElectricitySrc.setWorking(!isControlsEnabled()); if (myAbility instanceof Teleport) { ((Teleport) myAbility).maybeTeleport(game, this); } colliding = false; }
Source:
<code>public static void free(ByteBuffer buffer) { try { if (buffer.isDirect()) { clean((DirectBuffer) buffer); } } <START> catch (Exception e) { <END> throw Throwables.propagate(e); } }</code><technical_language>Is try-catch needed here</technical_language>

Target:
public static void free(ByteBuffer buffer) { if (buffer.isDirect()) { clean((DirectBuffer) buffer); } }
Source:
<code>private boolean pageDenotesContentConsumption(WebrequestData data){ if (data.getRawXAnalyticsHeader().isEmpty()) return true; String special = <START> <END> Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "special").trim(); String preview = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "preview").trim(); if (preview.isEmpty() && special.isEmpty()){ return true; } else if (preview.equalsIgnoreCase("1")) { return false; } if ( !special.isEmpty() ) { Iterator it = SPECIAL_PAGES_ACCEPTED.iterator(); while (it.hasNext()) { String item = (String) it.next(); if (item.equals(special.toLowerCase())){ return true; } } } return false; }</code><technical_language>extra spaces</technical_language>

Target:
private boolean pageDenotesContentConsumption(WebrequestData data){ if (data.getRawXAnalyticsHeader().isEmpty()) return true; String special = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "special").trim().toLowerCase(); String preview = Utilities.getValueForKey(data.getRawXAnalyticsHeader(), "preview").trim(); if (preview.isEmpty() && special.isEmpty()){ return true; } else if (preview.equals("1")) { return false; } return SPECIAL_PAGES_ACCEPTED.contains(special); }
Source:
<code>private void dumpResults(Result result) { if (result.getFailureCount() > 0) { System.err.println(); dumpList("Failures: ", result.getFailures()); dumpList("Errors: ", result.getFailures()); } if (result.getIgnoreCount() > 0) { System.err.println(); dumpIgnored(); } <START> int failedCount = result.getFailureCount(); <END> System.err.println(); System.err.println(MessageFormat.format("{0} out of {1} tests failed ({2} tests skipped)", new Object[] { failedCount, result.getRunCount() + result.getIgnoreCount(), result.getIgnoreCount() })); }</code><technical_language>inline this</technical_language>

Target:
private void dumpResults(Result result) { if (result.getFailureCount() > 0) { System.err.println(); dumpFailureList(result.getFailures()); dumpErrorList(result.getFailures()); } if (result.getIgnoreCount() > 0) { System.err.println(); dumpIgnored(); } int failedCount = result.getFailureCount(); System.err.println(); System.err.println(MessageFormat.format("{0} out of {1} tests failed ({2} tests skipped)", result.getFailureCount(), result.getRunCount() + result.getIgnoreCount(), result.getIgnoreCount())); }
Source:
<code><START> private IClasspathAttribute[] <END> cleanupClasspathAttributes( IClasspathAttribute[] extras ) { boolean clean = true; for( IClasspathAttribute ca : extras ) { if( ca == null ) { clean = false; break; } } if( clean ) { return extras; } return Arrays.stream(extras) .filter( Objects::nonNull ) .toArray( IClasspathAttribute[]::new ); }</code><technical_language>this is simpler: private IClasspathAttribute[] cleanupClasspathAttributes(IClasspathAttribute[] extras) { if(Arrays.stream(extras).allMatch(Objects::nonNull)) { return extras; } return Arrays.stream(extras).filter(Objects::nonNull).toArray(IClasspathAttribute[]::new); }</technical_language>

Target:
private IClasspathAttribute[] cleanupClasspathAttributes(IClasspathAttribute[] extras) { if(Arrays.stream(extras).allMatch(Objects::nonNull)) { return extras; } return Arrays.stream(extras).filter(Objects::nonNull).toArray(IClasspathAttribute[]::new); }