auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onPullComplete() { IProgramRepository programRepository = new ProgramLocalDataSource(); IMediaRepository mediaRepository = new MediaRepository(); List<Media> mediaList = mediaRepository.getAll(); if(mediaList==null || mediaList.size()==0){ mPullUseCase.notifyComplete(); return; } Media media = mediaList.get(0); if(media!=null && media.getProgram()!=null && !media.getProgram() .equals(programRepository.getUserProgram().getId())){ System.out.println("The media data will be removed"); <START> PopulateDB.wipeMedia(Constants.MEDIA_FOLDER); <END> } mPullUseCase.notifyComplete(); }</code><technical_language>MediaRepository remove data of DataBase FileUtils (in this moment) for remove files local folder</technical_language>

Target:
public void onPullComplete() { IProgramRepository programRepository = new ProgramLocalDataSource(); IMediaRepository mediaRepository = new MediaRepository(); List<Media> mediaList = mediaRepository.getAll(); if(mediaList==null || mediaList.size()==0){ mPullUseCase.notifyComplete(); return; } Media media = mediaList.get(0); if(media!=null && media.getProgram()!=null && !media.getProgram() .equals(programRepository.getUserProgram().getId())){ System.out.println("The media data will be removed"); mediaRepository.deleteAll(); FileUtils.removeDir( PreferencesState.getInstance().getContext().getFilesDir().getAbsolutePath()+"/"+Constants.MEDIA_FOLDER); } mPullUseCase.notifyComplete(); }
Source:
<code>public boolean downloadTemplate() { HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(getTemplate().getUrl()); try { HttpResponse response = client.execute(get); org.apache.http.HttpEntity entity = response.getEntity(); if (entity == null) { s_logger.debug("Failed to get entity"); throw new CloudRuntimeException("Failed to get url: " + getTemplate().getUrl()); } File destFile = new File(getDownloadedFilePath()); if (!destFile.createNewFile()) { s_logger.warn("Reusing existing file " + destFile.getPath()); } try (FileOutputStream outputStream = new FileOutputStream(destFile)) { entity.writeTo(outputStream); } catch (IOException e) { s_logger.debug("downloadFromUrlToNfs:Exception:" + e.getMessage(), e); } } catch (IOException e) { <START> s_logger.debug("Failed to get url:" + getTemplate().getUrl() + ", due to " + e.toString()); <END> throw new CloudRuntimeException(e); } return true; }</code><technical_language>please log entire exception, re-throw message. stacktrace of nested exceptions heavily truncated this a log trace of problems</technical_language>

Target:
public boolean downloadTemplate() { HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(getTemplate().getUrl()); try { HttpResponse response = client.execute(get); org.apache.http.HttpEntity entity = response.getEntity(); if (entity == null) { s_logger.debug("Failed to get entity"); throw new CloudRuntimeException("Failed to get url: " + getTemplate().getUrl()); } File destFile = new File(getDownloadedFilePath()); if (!destFile.createNewFile()) { s_logger.warn("Reusing existing file " + destFile.getPath()); } try (FileOutputStream outputStream = new FileOutputStream(destFile)) { entity.writeTo(outputStream); } catch (IOException e) { s_logger.debug("downloadFromUrlToNfs:Exception:" + e.getMessage(), e); } } catch (IOException e) { s_logger.debug("Failed to get url:" + getTemplate().getUrl() + ", due to " + e.toString(), e); throw new CloudRuntimeException(e); } return true; }
Source:
<code>public void resendNotification(final ResponseData responseData) { if (EnumUtils.isValidEnum(NotificationType.class, responseData.getMessageType())) { LOGGER.info("Found response data for resending notification"); final NotificationType notificationType = NotificationType.valueOf(responseData.getMessageType()); this.notificationServiceMicrogrids.sendNotification(responseData.getOrganisationIdentification(), responseData.getDeviceIdentification(), responseData.getResultType().name(), responseData.getCorrelationUid(), this.getNotificationMessage(responseData.getMessageType()), notificationType); <START> LOGGER.info("Notification has been resend"); <END> responseData.setNumberOfNotificationsSent((short) (responseData.getNumberOfNotificationsSent() + 1)); this.responseDataRepository.save(responseData); } }</code><technical_language>resent</technical_language>

Target:
public void resendNotification(final ResponseData responseData) { if (!EnumUtils.isValidEnum(NotificationType.class, responseData.getMessageType())) { this.logUnknownNotificationTypeError(responseData.getCorrelationUid(), responseData.getMessageType(), this.notificationService.getClass().getName()); return; } final NotificationType notificationType = NotificationType.valueOf(responseData.getMessageType()); this.notificationService.sendNotification(responseData.getOrganisationIdentification(), responseData.getDeviceIdentification(), responseData.getResultType().name(), responseData.getCorrelationUid(), this.getNotificationMessage(responseData.getMessageType()), notificationType); }
Source:
<code>public void serviceConfigBlockGeneration() { ServicesConfigBlock servicesConfigBlock = DialogueClientOptions.toServicesConfigBlock( ImmutableMap.of(SERVICE_NAME, REMOTE_SERVICE_CONFIGURATION_EXTENDED_TIMEOUT)); assertThat(servicesConfigBlock.services()).containsOnlyKeys(SERVICE_NAME); PartialServiceConfiguration partialServiceConfiguration = servicesConfigBlock.services().get(SERVICE_NAME); assertThat(partialServiceConfiguration.uris()).hasSameElementsAs(SERVERS); assertThat(partialServiceConfiguration.security()).contains(SSL_CONFIGURATION); assertThat(partialServiceConfiguration.backoffSlotSize()) .contains(ClientOptionsConstants.STANDARD_BACKOFF_SLOT_SIZE); assertThat(partialServiceConfiguration.connectTimeout()).contains(ClientOptionsConstants.CONNECT_TIMEOUT); assertThat(partialServiceConfiguration.maxNumRetries()).contains(ClientOptionsConstants.STANDARD_MAX_RETRIES); assertThat(partialServiceConfiguration.readTimeout()).contains(ClientOptionsConstants.LONG_READ_TIMEOUT); <START> } <END></code><technical_language>Verify absence of proxy configuration</technical_language>

Target:
public void serviceConfigBlockGeneration() { ServicesConfigBlock servicesConfigBlock = DialogueClientOptions.toServicesConfigBlock( ImmutableMap.of(SERVICE_NAME, REMOTE_SERVICE_CONFIGURATION_EXTENDED_TIMEOUT)); assertThat(servicesConfigBlock.services()).containsOnlyKeys(SERVICE_NAME); PartialServiceConfiguration partialServiceConfiguration = servicesConfigBlock.services().get(SERVICE_NAME); assertThat(partialServiceConfiguration.uris()).hasSameElementsAs(SERVERS); assertThat(partialServiceConfiguration.security()).contains(SSL_CONFIGURATION); assertThat(partialServiceConfiguration.proxyConfiguration()).isEmpty(); assertThat(partialServiceConfiguration.backoffSlotSize()) .contains(ClientOptionsConstants.STANDARD_BACKOFF_SLOT_SIZE); assertThat(partialServiceConfiguration.connectTimeout()).contains(ClientOptionsConstants.CONNECT_TIMEOUT); assertThat(partialServiceConfiguration.maxNumRetries()).contains(ClientOptionsConstants.STANDARD_MAX_RETRIES); assertThat(partialServiceConfiguration.readTimeout()).contains(ClientOptionsConstants.LONG_READ_TIMEOUT); }
Source:
<code>public void restartMesos() { if(!nativeLibraryLoaded) { try { MesosNativeLibrary.load(nativeLibraryPath); } catch (UnsatisfiedLinkError error) { LOGGER.warning("Failed to load native Mesos library from '" + nativeLibraryPath + "': " + error.getMessage()); MesosNativeLibrary.load(); } nativeLibraryLoaded = true; } if (!master.equals(staticMaster) || !Mesos.getInstance().isSchedulerRunning()) { if (!master.equals(staticMaster)) { LOGGER.info("Mesos master changed, restarting the scheduler"); staticMaster = master; } else { LOGGER.info("Scheduler was down, restarting the scheduler"); } Mesos.getInstance().stopScheduler(); <START> Mesos.getInstance().startScheduler(Jenkins.getInstance().getRootUrl(), master, this.frameworkName, this); <END> } else { Mesos.getInstance().updateScheduler(this); LOGGER.info("Mesos master has not changed, leaving the scheduler running"); } }</code><technical_language>pass slave cloud attributes instead of passing "this"? This eliminate getters</technical_language>

Target:
public void restartMesos() { if(!nativeLibraryLoaded) { try { MesosNativeLibrary.load(nativeLibraryPath); } catch (UnsatisfiedLinkError error) { LOGGER.warning("Failed to load native Mesos library from '" + nativeLibraryPath + "': " + error.getMessage()); MesosNativeLibrary.load(); } nativeLibraryLoaded = true; } if (!master.equals(staticMaster) || !Mesos.getInstance().isSchedulerRunning()) { if (!master.equals(staticMaster)) { LOGGER.info("Mesos master changed, restarting the scheduler"); staticMaster = master; } else { LOGGER.info("Scheduler was down, restarting the scheduler"); } Mesos.getInstance().stopScheduler(); Mesos.getInstance().startScheduler(Jenkins.getInstance().getRootUrl(), this); } else { Mesos.getInstance().updateScheduler(this); LOGGER.info("Mesos master has not changed, leaving the scheduler running"); } }
Source:
<code>public void testSendSerialDataOtherProtocolsConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.ZIGBEE).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_NOT_OPEN)).when(xbeeDevice, "sendXBeePacket", transmitPacket); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { <START> xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); <END> fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }</code><technical_language>I XBEE_64BIT_ADDRESS</technical_language>

Target:
public void testSendSerialDataOtherProtocolsConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.ZIGBEE).when(xbeeDevice, "getXBeeProtocol"); Mockito.when(xbeeDevice.isOpen()).thenReturn(false); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }
Source:
<code>public static void init() { if (!glusterModeSupported()) { log.debug("Gluster mode not supported. Will not schedule jobs for refreshing Gluster data."); return; } log.debug("Initializing Gluster Jobs Manager"); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshLightWeightData", new Class[0], new Object[0], getGlusterRefreshRateLight(), getGlusterRefreshRateLight(), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshHeavyWeightData", new Class[0], new Object[0], getGlusterRefreshRateHeavy(), getGlusterRefreshRateHeavy(), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterHookSyncJob.getInstance(), "refreshHooks", new Class[0], new Object[0], getGlusterRefreshRateHooks(), <START> getGlusterRefreshRateHooks(), <END> TimeUnit.SECONDS); }</code><technical_language>I this is existing convention in class followed, refactor this a single method like: private static int getRefreshRate(ConfigValues configName); instead of method for light, heavy hooks. I request do this, if want :)</technical_language>

Target:
public static void init() { if (!glusterModeSupported()) { log.debug("Gluster mode not supported. Will not schedule jobs for refreshing Gluster data."); return; } log.debug("Initializing Gluster Jobs Manager"); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshLightWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateLight), getRefreshRate(ConfigValues.GlusterRefreshRateLight), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshHeavyWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterHookSyncJob.getInstance(), "refreshHooks", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHooks), getRefreshRate(ConfigValues.GlusterRefreshRateHooks), TimeUnit.SECONDS); }
Source:
<code>public void testCreate() throws StripeException { Calendar now = Calendar.getInstance(); Map<String, Object> card = new HashMap<String, Object>(); card.put("number", "4242424242424242"); card.put("exp_month", now.get(Calendar.MONTH)); card.put("exp_year", now.get(Calendar.YEAR) + 1); Map<String, Object> params = new HashMap<String, Object>(); params.put("card", card); <START> Token token = Token.create(params); <END> assertNotNull(token); verifyRequest( APIResource.RequestMethod.POST, "/v1/tokens", params ); }</code><technical_language>named resource</technical_language>

Target:
public void testCreate() throws StripeException { final Calendar now = Calendar.getInstance(); final Map<String, Object> card = new HashMap<String, Object>(); card.put("number", "4242424242424242"); card.put("exp_month", now.get(Calendar.MONTH)); card.put("exp_year", now.get(Calendar.YEAR) + 1); final Map<String, Object> params = new HashMap<String, Object>(); params.put("card", card); final Token token = Token.create(params); assertNotNull(token); verifyRequest( APIResource.RequestMethod.POST, "/v1/tokens", params ); }
Source:
<code>private PoolEntry createPoolEntry() { if (totalConnections.incrementAndGet() > config.getMaximumPoolSize()) { totalConnections.decrementAndGet(); return MAXED_POOL_MARKER; } try { final PoolEntry poolEntry = newPoolEntry(); final long maxLifetime = config.getMaxLifetime(); if (maxLifetime > 0) { long inHours = TimeUnit.MILLISECONDS.toHours(maxLifetime); long randomIntervalInMillis = inHours * 10_000; <START> if (inHours == 0) { <END> randomIntervalInMillis = maxLifetime > 60_000 ? 10_000 : 0; } final long variance = randomIntervalInMillis > 0 ? ThreadLocalRandom.current().nextLong(randomIntervalInMillis) : 0; final long lifetime = maxLifetime - variance; poolEntry.setFutureEol(houseKeepingExecutorService.schedule(new Runnable() { @Override public void run() { softEvictConnection(poolEntry, "(connection reached maxLifetime)", false ); } }, lifetime, TimeUnit.MILLISECONDS)); } LOGGER.debug("{} - Added connection {}", poolName, poolEntry.connection); return poolEntry; } catch (Exception e) { totalConnections.decrementAndGet(); if (poolState == POOL_NORMAL) { LOGGER.debug("{} - Cannot acquire connection from data source", poolName, e); } return null; } }</code><technical_language>Drop conditional use: long randomIntervalInMillis = Math.max(10_000, inHours \* 10_000); locals final</technical_language>

Target:
private PoolEntry createPoolEntry() { if (totalConnections.incrementAndGet() > config.getMaximumPoolSize()) { totalConnections.decrementAndGet(); return MAXED_POOL_MARKER; } try { final PoolEntry poolEntry = newPoolEntry(); final long maxLifetime = config.getMaxLifetime(); if (maxLifetime > 0) { final long maxIntervalInMillis = maxLifetime > 10_000 ? Math.max(10_000, maxLifetime / 40) : 0; final long randomIntervalInMillis = maxIntervalInMillis > 0 ? ThreadLocalRandom.current().nextLong(maxIntervalInMillis) : 0; final long lifetime = maxLifetime - randomIntervalInMillis; poolEntry.setFutureEol(houseKeepingExecutorService.schedule(new Runnable() { @Override public void run() { softEvictConnection(poolEntry, "(connection reached maxLifetime)", false ); } }, lifetime, TimeUnit.MILLISECONDS)); } LOGGER.debug("{} - Added connection {}", poolName, poolEntry.connection); return poolEntry; } catch (Exception e) { totalConnections.decrementAndGet(); if (poolState == POOL_NORMAL) { LOGGER.debug("{} - Cannot acquire connection from data source", poolName, e); } return null; } }
Source:
<code>static boolean create(final CharSequence name, final RenderedImage image, final GridSampleDimension[] src, final GridSampleDimension[] dst) { final int numBands = image.getSampleModel().getNumBands(); if (src!=null && src.length!=numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, src.length, "SampleDimension")); } if (dst.length != numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, dst.length, "SampleDimension")); } int countGeophysics = 0; GridSampleDimension[] defaultSD = null; for (int i=0; i<numBands; i++) { GridSampleDimension sd = (src!=null) ? src[i] : null; if (sd == null) { if (defaultSD == null) { defaultSD = new GridSampleDimension[numBands]; create(name, RectIterFactory.create(image, null), image.getSampleModel(), null, null, null, null, defaultSD, null); } sd = defaultSD[i]; } sd = new RenderedSampleDimension(sd, image, i); dst[i] = sd; <START> countGeophysics++; <END> } if (countGeophysics == numBands) { return true; } throw new IllegalArgumentException(Errors.format(ErrorKeys.MIXED_CATEGORIES)); }</code><technical_language>a concept of geophysics rename variables else. is a lot of references in code: > find . -name "*.java" | xargs grep geophysics | wc -l 120</technical_language>

Target:
static boolean create(final CharSequence name, final RenderedImage image, final GridSampleDimension[] src, final GridSampleDimension[] dst) { final int numBands = image.getSampleModel().getNumBands(); if (src!=null && src.length!=numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, src.length, "SampleDimension")); } if (dst.length != numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, dst.length, "SampleDimension")); } int count = 0; GridSampleDimension[] defaultSD = null; for (int i=0; i<numBands; i++) { GridSampleDimension sd = (src!=null) ? src[i] : null; if (sd == null) { if (defaultSD == null) { defaultSD = new GridSampleDimension[numBands]; create(name, RectIterFactory.create(image, null), image.getSampleModel(), null, null, null, null, defaultSD, null); } sd = defaultSD[i]; } sd = new RenderedSampleDimension(sd, image, i); dst[i] = sd; count++; } if (count == numBands) { return true; } throw new IllegalArgumentException(Errors.format(ErrorKeys.MIXED_CATEGORIES)); }
Source:
<code>public String login( @ActionParam("username") String username, @ActionParam("password") String password) throws UserManagerException, ServletException { String ip = (String)this.getContext().getRawRequestContext().getLocalAttr("REMOTE_ADDR"); <START> for(String key : this.getContext().getRawRequestContext().getLocalAttrs().keySet()) { <END> System.out.println("Key: " + key + ", Value: " + this.getContext().getRawRequestContext().getLocalAttr(key)); } logger.info("Attempting to login for " + username + " from ip '" + ip + "'"); Session session = createSession(username, password, ip); logger.info("Session id " + session.getSessionId() + " created for user '" + username + "' and ip " + ip); return session.getSessionId(); }</code><technical_language>a bit cleaner store this.getContext().getRawRequestContext() in a local variable avoid calling this chain of calls multiple times</technical_language>

Target:
public String login( @ActionParam("username") String username, @ActionParam("password") String password) throws UserManagerException, ServletException { String ip = (String)this.getContext().getRawRequestContext().getLocalAttr("REMOTE_ADDR"); logger.info("Attempting to login for " + username + " from ip '" + ip + "'"); Session session = createSession(username, password, ip); logger.info("Session id " + session.getSessionId() + " created for user '" + username + "' and ip " + ip); return session.getSessionId(); }
Source:
<code>public Repository clone() { <START> return startTracking(); <END> }</code><technical_language>Basically, RepositoryImpl is for tracks, thus, sense return parent.startTracking() create a clone</technical_language>

Target:
public Repository clone() { return parent.startTracking(); }
Source:
<code>private void stateResolveConstraints(ResolverBundle rb) { ResolverImport[] imports = rb.getImportPackages(); for (ResolverImport <START> import1 : <END> imports) { ResolverExport export = (ResolverExport) import1.getSelectedSupplier(); BaseDescription supplier = export == null ? null : export.getExportPackageDescription(); state.resolveConstraint(import1.getVersionConstraint(), supplier); } BundleConstraint[] requires = rb.getRequires(); for (BundleConstraint require : requires) { ResolverBundle bundle = (ResolverBundle) require.getSelectedSupplier(); BaseDescription supplier = bundle == null ? null : bundle.getBundleDescription(); state.resolveConstraint(require.getVersionConstraint(), supplier); } GenericConstraint[] genericRequires = rb.getGenericRequires(); for (GenericConstraint genericRequire : genericRequires) { VersionSupplier[] matchingCapabilities = genericRequire.getMatchingCapabilities(); if (matchingCapabilities == null) { state.resolveConstraint(genericRequire.getVersionConstraint(), null); } else { for (VersionSupplier matchingCapabilitie : matchingCapabilities) { state.resolveConstraint(genericRequire.getVersionConstraint(), matchingCapabilitie.getBaseDescription()); } } } }</code><technical_language>name resolverImport</technical_language>

Target:
private void stateResolveConstraints(ResolverBundle rb) { ResolverImport[] imports = rb.getImportPackages(); for (ResolverImport resolverImport : imports) { ResolverExport export = (ResolverExport) resolverImport.getSelectedSupplier(); BaseDescription supplier = export == null ? null : export.getExportPackageDescription(); state.resolveConstraint(resolverImport.getVersionConstraint(), supplier); } BundleConstraint[] requires = rb.getRequires(); for (BundleConstraint require : requires) { ResolverBundle bundle = (ResolverBundle) require.getSelectedSupplier(); BaseDescription supplier = bundle == null ? null : bundle.getBundleDescription(); state.resolveConstraint(require.getVersionConstraint(), supplier); } GenericConstraint[] genericRequires = rb.getGenericRequires(); for (GenericConstraint genericRequire : genericRequires) { VersionSupplier[] matchingCapabilities = genericRequire.getMatchingCapabilities(); if (matchingCapabilities == null) { state.resolveConstraint(genericRequire.getVersionConstraint(), null); } else { for (VersionSupplier matchingCapabilitie : matchingCapabilities) { state.resolveConstraint(genericRequire.getVersionConstraint(), matchingCapabilitie.getBaseDescription()); } } } }
Source:
<code>public Response getPages(@PathParam("language") String languageCode, @PathParam("package") String packageCode, @HeaderParam("Authorization") String authTokenHeader) throws MalformedURLException { log.info("Requesting draft pages for package: " + packageCode + " for language: " + languageCode); <START> AuthorizationRecord.checkAccessToDrafts(authService.getAuthorizationRecord("", authTokenHeader), clock.currentDateTime()); <END> Optional<GodToolsTranslation> godToolsTranslationOptional = draftTranslation.retrieve(languageCode, packageCode, false); if(!godToolsTranslationOptional.isPresent()) { return Response .status(Response.Status.NOT_FOUND) .build(); } return Response .ok(godToolsTranslationOptional.get().getPageStructureList()) .build(); }</code><technical_language>Is authTokenParam needed anymore</technical_language>

Target:
public Response getPages(@PathParam("language") String languageCode, @PathParam("package") String packageCode, @HeaderParam("Authorization") String authTokenHeader) throws MalformedURLException { log.info("Requesting draft pages for package: " + packageCode + " for language: " + languageCode); AuthorizationRecord.checkAccessToDrafts(authService.getAuthorizationRecord(null, authTokenHeader), clock.currentDateTime()); Optional<GodToolsTranslation> godToolsTranslationOptional = draftTranslation.retrieve(languageCode, packageCode, false); if(!godToolsTranslationOptional.isPresent()) { return Response .status(Response.Status.NOT_FOUND) .build(); } return Response .ok(godToolsTranslationOptional.get().getPageStructureList()) .build(); }
Source:
<code>public List<? extends Module> getJacksonModules() { return ImmutableList.of( new SimpleModule("KafkaEightSimpleConsumerFirehoseModule") .registerSubtypes( <START> new NamedType(KafkaEightSimpleConsumerFirehoseFactory.class, "kafka-0.8-simpaleConsumer") <END> ) ); }</code><technical_language>typo in name "kafka-0.8-simpleConsumer"</technical_language>

Target:
public List<? extends Module> getJacksonModules() { return ImmutableList.of( new SimpleModule("KafkaEightSimpleConsumerFirehoseModule") .registerSubtypes( new NamedType(KafkaEightSimpleConsumerFirehoseFactory.class, "kafka-0.8-simpleConsumer") ) ); }
Source:
<code>private void assertMatchesNone(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(CatchUpStation.matches(job, message)) .isFalse(); <START> <END> } }</code><technical_language>Please remove this empty line</technical_language>

Target:
private void assertMatchesNone(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(job.matches(message)) .isFalse(); } }
Source:
<code>public static void copyTo(Described from, Described to) { Identified.copyTo(from, to); to.description = from.description; to.firstSeen = from.firstSeen; to.genres = ImmutableSet.copyOf(from.genres); to.image = from.image; to.lastFetched = from.lastFetched; to.mediaType = from.mediaType; to.publisher = from.publisher; to.specialization = from.specialization; to.tags = Sets.newHashSet(from.tags); to.thisOrChildLastUpdated = from.thisOrChildLastUpdated; to.thumbnail = from.thumbnail; to.title = from.title; to.scheduleOnly = from.scheduleOnly; to.presentationChannel = from.presentationChannel; to.images = from.images; to.shortDescription = from.shortDescription; to.mediumDescription = from.mediumDescription; to.longDescription = from.longDescription; to.localizedDescriptions = ImmutableSet.copyOf(from.localizedDescriptions); to.localizedTitles = ImmutableSet.copyOf(from.localizedTitles); to.reviews = ImmutableSet.copyOf(from.reviews); to.ratings = ImmutableSet.copyOf(from.ratings); to.audienceStatistics = from.audienceStatistics; to.activelyPublished = from.activelyPublished; to.priority = from.priority; to.awards = ImmutableSet.copyOf(from.awards); <START> to.distributions = ImmutableSet.copyOf(from.distributions); <END> to.language = from.language; }</code><technical_language>Earlier distributions a list, a set. pick sense consistent</technical_language>

Target:
public static void copyTo(Described from, Described to) { Identified.copyTo(from, to); to.description = from.description; to.firstSeen = from.firstSeen; to.genres = ImmutableSet.copyOf(from.genres); to.image = from.image; to.lastFetched = from.lastFetched; to.mediaType = from.mediaType; to.publisher = from.publisher; to.specialization = from.specialization; to.tags = Sets.newHashSet(from.tags); to.thisOrChildLastUpdated = from.thisOrChildLastUpdated; to.thumbnail = from.thumbnail; to.title = from.title; to.scheduleOnly = from.scheduleOnly; to.presentationChannel = from.presentationChannel; to.images = from.images; to.shortDescription = from.shortDescription; to.mediumDescription = from.mediumDescription; to.longDescription = from.longDescription; to.localizedDescriptions = ImmutableSet.copyOf(from.localizedDescriptions); to.localizedTitles = ImmutableSet.copyOf(from.localizedTitles); to.reviews = ImmutableSet.copyOf(from.reviews); to.ratings = ImmutableSet.copyOf(from.ratings); to.audienceStatistics = from.audienceStatistics; to.activelyPublished = from.activelyPublished; to.priority = from.priority; to.awards = ImmutableSet.copyOf(from.awards); to.distributions = ImmutableList.copyOf(from.distributions); to.language = from.language; }
Source:
<code><START> public static boolean isValidNumber(Object value) { <END> if (!(value instanceof Number)) { return false; } Number number = (Number) value; if (number instanceof Double) { if (Double.isNaN(number.doubleValue()) || Double.isInfinite(number.doubleValue())) { return false; } } if (number instanceof Float) { if (Float.isNaN(number.floatValue()) || Float.isInfinite(number.floatValue())) { return false; } } return true; }</code><technical_language>is nullable, a null check is a good thing. If I remember correctly, (((Object) null) instanceof Number) == false) obvious..</technical_language>

Target:
public static boolean isValidNumber(Object value) { if (value == null) { return false; } if (value instanceof Number) { return isValidNumber((Number) value); } if (value instanceof String) { return isNumeric(value); } return false; }
Source:
<code>public String getCustomDefaultContributorRoleName(){ if (dvObject instanceof Dataverse && isCustomDefaultConributorRole() ){ <START> return defaultContributorRoleAlias.equals("none") ? "None" : roleService.findCustomRoleByAliasAndOwner(defaultContributorRoleAlias,dvObject.getId()).getName(); <END> } else { return ""; } }</code><technical_language>this English word "None" moved bundle translated</technical_language>

Target:
public String getCustomDefaultContributorRoleName(){ if (dvObject instanceof Dataverse && isCustomDefaultContributorRole() ){ return defaultContributorRoleAlias.equals(DataverseRole.NONE) ? BundleUtil.getStringFromBundle("permission.default.contributor.role.none.name") : roleService.findCustomRoleByAliasAndOwner(defaultContributorRoleAlias,dvObject.getId()).getName(); } else { return ""; } }
Source:
<code>public void hsync() throws IOException { <START> if (rateLimiter.isPresent() && !rateLimiter.get().tryAcquire()) { <END> logger.atFine().log( "hsync(): Rate limited. Minimum interval between consecutive calls is %d milliseconds." + " Doing nothing this time.", syncableOutputStreamOptions.getMinSyncTimeIntervalMs()); return; } long startTime = System.nanoTime(); logger.atFine().log( "hsync(): Committing tail file %s to final destination %s", curGcsPath, finalGcsPath); throwIfNotOpen(); commitCurrentFile(); ++curComponentIndex; curGcsPath = getNextTemporaryPath(); logger.atFine().log( "hsync(): Opening next temporary tail file %s as component number %s", curGcsPath, curComponentIndex); curDelegate = new GoogleHadoopOutputStream(ghfs, curGcsPath, statistics, TEMPFILE_CREATE_OPTIONS); long finishTime = System.nanoTime(); logger.atFine().log("Took %d ns to hsync()", finishTime - startTime); }</code><technical_language>This implementation violates hsync contract guarantee data is persisted, do instead blocking acquire method wait write is allowed RateLimiter</technical_language>

Target:
public void hsync() throws IOException { long startTimeNs = System.nanoTime(); if (syncRateLimiter != null) { logger.atFine().log( "hsync(): Rate limited (%s) with blocking permit acquisition for %s", syncRateLimiter, finalGcsPath); syncRateLimiter.acquire(); } hsyncInternal(startTimeNs); }
Source:
<code>protected void fetchChannelAndInvoke(int retryCount, Set<SocketAddress> failedServers) { <START> if (retryCount < modifications.size()) { <END> byte[] key = modifications.get(retryCount).getKey(); channelFactory.fetchChannelAndInvoke(key, failedServers, cacheName, this); } else { super.fetchChannelAndInvoke(retryCount, failedServers); } }</code><technical_language>simplify this key owner try. IMO retries rare enough worry server retrying a key owner, send request unrelated server if 2nd modification's key is owned failed server</technical_language>

Target:
protected void fetchChannelAndInvoke(int retryCount, Set<SocketAddress> failedServers) { if (modifications.isEmpty()) { super.fetchChannelAndInvoke(retryCount, failedServers); } else { channelFactory.fetchChannelAndInvoke(modifications.get(0).getKey(), failedServers, cacheName, this); } }
Source:
<code>public static List<String> getFeatureList(Schema inputSchema, @Nullable String featuresToInclude, @Nullable String featuresToExclude, String predictionField) { if (!Strings.isNullOrEmpty(featuresToExclude) && !Strings.isNullOrEmpty(featuresToInclude)) { throw new IllegalArgumentException("Cannot specify values for both featuresToInclude and featuresToExclude. " + "Please specify fields for one"); } List<String> fields = new ArrayList<>(); List<Schema.Field> inputSchemaFields = inputSchema.getFields(); if (!Strings.isNullOrEmpty(featuresToInclude)) { List<String> features = Lists.newArrayList(Splitter.on(',').trimResults().split(featuresToInclude)); for (String field : features) { Schema.Field inputField = inputSchema.getField(field); if (!field.equals(predictionField) && inputField != null) { fields.add(field); } } <START> } else { <END> Set<String> excludeFeatures = new HashSet<>(); if (!Strings.isNullOrEmpty(featuresToExclude)) { excludeFeatures.addAll(Lists.newArrayList(Splitter.on(',').trimResults().split(featuresToExclude))); } for (Schema.Field field : inputSchemaFields) { String fieldName = field.getName(); if (!fieldName.equals(predictionField) && (excludeFeatures.isEmpty() || !excludeFeatures.contains(fieldName))) { fields.add(fieldName); } } } return fields; }</code><technical_language>I meant if structure code this: java if (!Strings.isNullOrEmpty(featuresToinclude)) { ... return fields; } Set<String> excludeFeatures = new HashSet<>(); ... return fields; code indented, easier read</technical_language>

Target:
static Map<String, Integer> getFeatureList(Schema inputSchema, @Nullable String featuresToInclude, @Nullable String featuresToExclude, String predictionField) { if (!Strings.isNullOrEmpty(featuresToExclude) && !Strings.isNullOrEmpty(featuresToInclude)) { throw new IllegalArgumentException("Cannot specify values for both featuresToInclude and featuresToExclude. " + "Please specify fields for one."); } Map<String, Integer> fields = new HashMap<>(); if (!Strings.isNullOrEmpty(featuresToInclude)) { Iterable<String> tokens = Splitter.on(',').trimResults().split(featuresToInclude); String[] features = Iterables.toArray(tokens, String.class); for (int i = 0; i < features.length; i++) { String field = features[i]; Schema.Field inputField = inputSchema.getField(field); if (!field.equals(predictionField) && inputField != null) { fields.put(field, i); } } return fields; } Set<String> excludeFeatures = new HashSet<>(); if (!Strings.isNullOrEmpty(featuresToExclude)) { excludeFeatures.addAll(Lists.newArrayList(Splitter.on(',').trimResults().split(featuresToExclude))); } Object[] inputSchemaFields = inputSchema.getFields().toArray(); for (int i = 0; i < inputSchemaFields.length; i++) { String field = ((Schema.Field) inputSchemaFields[i]).getName(); if (!field.equals(predictionField) && !excludeFeatures.contains(field)) { fields.put(field, i); } } return fields; }
Source:
<code>public void testKeyValueBackupAndRestore() throws Exception { if(!mIsBackupSupported){ return; } assertNull(mDevice.installPackage(mBuild.getTestApp(TEST_APP_APK), true)); mDevice.executeShellCommand(CLEAR_DATA_IN_PACKAGE_UNDER_TEST_COMMAND); mDevice.executeAdbCommand("logcat", "-c"); mDevice.executeShellCommand(START_ACTIVITY_UNDER_TEST_COMMAND); saveDataValuesReportedByApp(); assertNotAllValuesAreDefault(); String backupnowOutput = mDevice.executeShellCommand( "bmgr <START> run " + PACKAGE_UNDER_TEST); <END> assertBackupIsSuccessful(backupnowOutput); mDevice.uninstallPackage(PACKAGE_UNDER_TEST); assertNull(mDevice.installPackage(mBuild.getTestApp(TEST_APP_APK), true)); mDevice.executeAdbCommand("logcat", "-c"); mDevice.executeShellCommand(START_ACTIVITY_UNDER_TEST_COMMAND); assertValuesAreRestored(); }</code><technical_language>"run" package argument, "bmgr run" is sufficient</technical_language>

Target:
public void testKeyValueBackupAndRestore() throws Exception { if(!mIsBackupSupported){ return; } assertNull(mDevice.installPackage(mBuild.getTestApp(TEST_APP_APK), true)); mDevice.executeShellCommand(CLEAR_DATA_IN_PACKAGE_UNDER_TEST_COMMAND); mDevice.executeAdbCommand("logcat", "-c"); mDevice.executeShellCommand(START_ACTIVITY_UNDER_TEST_COMMAND); saveDataValuesReportedByApp(); assertNotAllValuesAreDefault(); String backupnowOutput = mDevice.executeShellCommand("bmgr run "); assertBackupIsSuccessful(backupnowOutput); mDevice.uninstallPackage(PACKAGE_UNDER_TEST); assertNull(mDevice.installPackage(mBuild.getTestApp(TEST_APP_APK), true)); mDevice.executeAdbCommand("logcat", "-c"); mDevice.executeShellCommand(START_ACTIVITY_UNDER_TEST_COMMAND); assertValuesAreRestored(); }
Source:
<code>public OauthAuthenticationResult authenticate(HttpRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest cannot be null."); Class httpRequestClass = httpRequest.getClass(); if (HttpServletRequest.class.isAssignableFrom(httpRequestClass)) { this.httpServletRequest = (HttpServletRequest) httpRequest; } else if (HttpRequest.class.isAssignableFrom(httpRequestClass)) { <START> this.httpServletRequest = new OauthHttpServletRequest((HttpRequest) httpRequest); <END> } else { throw new IllegalArgumentException(String.format(HTTP_REQUEST_NOT_SUPPORTED_MSG, httpRequest.getClass(), HttpRequest.class.getName(), HttpServletRequest.class.getName())); } OauthAuthenticationRequestFactory factory = new OauthAuthenticationRequestFactory(); AuthenticationRequest request = factory.createFrom(httpServletRequest); AuthenticationResult result = application.authenticateAccount(request); Assert.isInstanceOf(OauthAuthenticationResult.class, result); return (OauthAuthenticationResult) result; }</code><technical_language>cast HttpRequest is required httpRequest is HttpRequest type</technical_language>

Target:
public OauthAuthenticationResult authenticate(HttpRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest cannot be null."); Class httpRequestClass = httpRequest.getClass(); if (HttpServletRequest.class.isAssignableFrom(httpRequestClass)) { this.httpServletRequest = (HttpServletRequest) httpRequest; } else if (HttpRequest.class.isAssignableFrom(httpRequestClass)) { this.httpServletRequest = new OauthHttpServletRequest(httpRequest); } else { throw new IllegalArgumentException(String.format(HTTP_REQUEST_NOT_SUPPORTED_MSG, httpRequest.getClass(), HttpRequest.class.getName(), HttpServletRequest.class.getName())); } OauthAuthenticationRequestFactory factory = new OauthAuthenticationRequestFactory(); AuthenticationRequest request = factory.createFrom(httpServletRequest); AuthenticationResult result = application.authenticateAccount(request); Assert.isInstanceOf(OauthAuthenticationResult.class, result); return (OauthAuthenticationResult) result; }
Source:
<code>protected void initialize(String value) { assert value != null && value.trim().length() > 0; JComboBox element = weakRef.get(); if (element != null) { <START> element.setSelectedIndex(Integer.parseInt(value)); <END> } }</code><technical_language>This needs a check for valid range</technical_language>

Target:
protected void initialize(String value) { assert value != null && value.trim().length() > 0; JComboBox element = weakRef.get(); if (element != null) { int index = Integer.parseInt(value); if (index >= 0 && index < element.getItemCount()) { this.selectedIndex = index; element.setSelectedIndex(this.selectedIndex); } } }
Source:
<code>public void destroy() { <START> if (channel.isConnected()) { <END> channel.disconnect(); } }</code><technical_language>Style-nit: curly braces single statements</technical_language>

Target:
public void destroy() { if (channel.isConnected()) channel.disconnect(); }
Source:
<code><START> public boolean equals(Object obj) { <END> if (obj instanceof MethodKey) { MethodKey toCompare = (MethodKey) obj; return toCompare.name.equals(name) && toCompare.parameterTypes.equals(parameterTypes); } return false; }</code><technical_language>final,</technical_language>

Target:
public final boolean equals(Object obj) { if (obj instanceof MethodKey) { MethodKey toCompare = (MethodKey) obj; return toCompare.name.equals(name) && toCompare.parameterTypes.equals(parameterTypes); } return false; }
Source:
<code>UserPostListingURL(Type type, String user, PostSort order, Integer limit, String before, String after) { this.type = type; this.user = user; <START> this.order = order; <END> this.limit = limit; this.before = before; this.after = after; }</code><technical_language>idea check for RISING in this constructor, default else</technical_language>

Target:
UserPostListingURL(Type type, String user, PostSort order, Integer limit, String before, String after) { this.type = type; this.user = user; this.order = order == PostSort.RISING ? PostSort.NEW : order; this.limit = limit; this.before = before; this.after = after; }
Source:
<code>private TokenizedPattern expandMacros() { TokenizedPattern currentPattern = filterPattern; for(Map.Entry<String, Function<Repository, String>> macro : macros.entrySet()) { String macroString = macro.getKey(); String patternString = currentPattern.getPattern(); if <START> (patternString.contains(macroString)) { <END> String replacingString = macro.getValue().apply(repository); String newString = patternString.replace(macroString, replacingString); currentPattern = new TokenizedPattern(newString); } } return currentPattern; }</code><technical_language>code I currentPattern.containsPattern() work</technical_language>

Target:
private TokenizedPattern expandMacros() { TokenizedPattern currentPattern = filterPattern; for(Map.Entry<String, Function<Repository, String>> macro : macros.entrySet()) { String macroString = macro.getKey(); if (currentPattern.containsPattern(macroString)) { String replacingString = macro.getValue().apply(repository); String newString = currentPattern.getPattern() .replace(macroString, replacingString); currentPattern = createPattern(newString); } } return currentPattern; }
Source:
<code>public static void configureORCFileSet(String configuredSchema, FileSetProperties.Builder properties) <START> throws IOException, UnsupportedTypeException { <END> String lowerCaseSchema = configuredSchema.toLowerCase(); String hiveSchema = parseHiveSchema(lowerCaseSchema, configuredSchema); hiveSchema = hiveSchema.substring(1, hiveSchema.length() - 1); co.cask.cdap.api.data.schema.Schema schemaObj = co.cask.cdap.api.data.schema.Schema.parseJson(configuredSchema); StringBuilder builder = new StringBuilder(); HiveSchemaConverter.appendType(builder, schemaObj); String orcSchema = builder.toString(); properties.setInputFormat(OrcInputFormat.class) .setOutputFormat(OrcOutputFormat.class) .setExploreInputFormat("org.apache.hadoop.hive.ql.io.orc.OrcInputFormat") .setExploreOutputFormat("org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat") .setSerDe("org.apache.hadoop.hive.ql.io.orc.OrcSerde") .setExploreSchema(hiveSchema) .setEnableExploreOnCreate(true) .setInputProperty("orc.mapred.output.schema", orcSchema) .setOutputProperty("orc.mapred.output.schema", orcSchema) .build(); }</code><technical_language>instead of throwing exceptions, catch in this method throw IllegalArgumentException informative message is invalid why</technical_language>

Target:
public static void configureORCFileSet(String configuredSchema, FileSetProperties.Builder properties) { String lowerCaseSchema = configuredSchema.toLowerCase(); String hiveSchema = parseHiveSchema(lowerCaseSchema, configuredSchema); hiveSchema = hiveSchema.substring(1, hiveSchema.length() - 1); String orcSchema = parseOrcSchema(configuredSchema); properties.setInputFormat(OrcInputFormat.class) .setOutputFormat(OrcOutputFormat.class) .setExploreInputFormat("org.apache.hadoop.hive.ql.io.orc.OrcInputFormat") .setExploreOutputFormat("org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat") .setSerDe("org.apache.hadoop.hive.ql.io.orc.OrcSerde") .setExploreSchema(hiveSchema) .setEnableExploreOnCreate(true) .setInputProperty("orc.mapred.output.schema", orcSchema) .setOutputProperty("orc.mapred.output.schema", orcSchema) .build(); }
Source:
<code>public void checkAnotBEarlyStop() { int lgK = 10; int k = 1<<lgK; int u = 4*k; long v = 0; int trials = 10; UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build(); UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build(); AnotB aNotB = SetOperation.builder().buildANotB(); for (int t = 0; t < trials; t++) { for (int i=0; i<u; i++) { usk1.update(i + v); usk2.update(i + v + (u/2)); } v += u + (u/2); CompactSketch csk1 = usk1.compact(true, null); CompactSketch csk2 = usk2.compact(true, null); Sketch rsk = PairwiseSetOperations.aNotB(csk1, csk2); <START> double result1 = rsk.getEstimate(); END> aNotB.update(csk1, csk2); CompactSketch csk3 = aNotB.getResult(true, null); double result2 = csk3.getEstimate(); assertEquals(result1, result2, 0.0); usk1.reset(); usk2.reset(); } }</code><technical_language>is significance a null pointer here</technical_language>

Target:
public void checkAnotBEarlyStop() { int lgK = 10; int k = 1<<lgK; int u = 4*k; long v = 0; int trials = 10; UpdateSketch usk1 = UpdateSketch.builder().setNominalEntries(k).build(); UpdateSketch usk2 = UpdateSketch.builder().setNominalEntries(k).build(); AnotB aNotB = SetOperation.builder().buildANotB(); for (int t = 0; t < trials; t++) { for (int i=0; i<u; i++) { usk1.update(i + v); usk2.update(i + v + (u/2)); } v += u + (u/2); CompactSketch csk1 = usk1.compact(true, null); CompactSketch csk2 = usk2.compact(true, null); Sketch rsk = PairwiseSetOperations.aNotB(csk1, csk2); double result1 = rsk.getEstimate(); CompactSketch csk3 = aNotB.aNotB(csk1, csk2); double result2 = csk3.getEstimate(); assertEquals(result1, result2, 0.0); usk1.reset(); usk2.reset(); } }
Source:
<code>public void checkField(Field field) { if(field.getArguments()==null||field.getArguments().size()<=1){ return; } <START> Set<String> arguments=new HashSet<>(field.getArguments().size()); <END> for (Argument argument : field.getArguments()) { if(arguments.contains(argument.getName())){ addError(ValidationErrorType.DuplicateArgumentNames, field.getSourceLocation(), duplicateArgumentNameMessage(argument.getName())); }else{ arguments.add(argument.getName()); } } }</code><technical_language>sizing collections is needed. easier read code is. I wont this PR of this needed</technical_language>

Target:
public void checkField(Field field) { if (field.getArguments() == null || field.getArguments().size() <= 1) { return; } Set<String> arguments = new HashSet<>(); for (Argument argument : field.getArguments()) { if (arguments.contains(argument.getName())) { addError(ValidationErrorType.DuplicateArgumentNames, field.getSourceLocation(), duplicateArgumentNameMessage(argument.getName())); } else { arguments.add(argument.getName()); } } }
Source:
<code>private MyModel[] createModel() { <START> MyModel[] elements = new MyModel[11]; <END> for (int i = 0; i < elements.length - 1; i++) { elements[i] = new MyModel(i); } elements[elements.length - 1] = new MyModel(42); return elements; }</code><technical_language>list</technical_language>

Target:
private List<MyModel> createModel() { List<MyModel> elements = new ArrayList<MyModel>(); for (int i = 0; i < 10; i++) { elements.add(new MyModel(i)); } return elements; }