auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Subfield.PathElement matchQuotedSubscript() { StringBuilder token = new StringBuilder(); boolean escaped = false; while (hasNextCharacter() && (escaped || peekCharacter() != QUOTE)) { if (escaped) { switch (peekCharacter()) { case QUOTE: case BACKSLASH: token.append(peekCharacter()); break; default: throw invalidSubfieldPath(); } escaped = false; } else { switch (peekCharacter()) { case BACKSLASH: escaped = true; break; case QUOTE: throw new IllegalStateException("Should be handled by loop condition"); default: token.append(peekCharacter()); } } nextCharacter(); } if (escaped) { if (hasNextCharacter()) { throw new IllegalStateException("Loop terminated after escape while there is still input"); } throw invalidSubfieldPath(); } match(QUOTE); String index = token.toString(); <START> if (index.equals("*")) { <END> return Subfield.allSubscripts(); } return new Subfield.StringSubscript(index); }</code><technical_language>index.equals(String.valueOf(WILDCARD))</technical_language>

Target:
private Subfield.PathElement matchQuotedSubscript() { StringBuilder token = new StringBuilder(); boolean escaped = false; while (hasNextCharacter() && (escaped || peekCharacter() != QUOTE)) { if (escaped) { switch (peekCharacter()) { case QUOTE: case BACKSLASH: token.append(peekCharacter()); break; default: throw invalidSubfieldPath(); } escaped = false; } else { if (peekCharacter() == BACKSLASH) { escaped = true; } else { token.append(peekCharacter()); } } nextCharacter(); } if (escaped) { throw invalidSubfieldPath(); } match(QUOTE); String index = token.toString(); if (index.equals(String.valueOf(WILDCARD))) { return Subfield.allSubscripts(); } return new Subfield.StringSubscript(index); }
Source:
<code>public int getStatus() { <START> if (m_hasTests) { <END> return exitCode.getExitCode(); } return HAS_NO_TEST; }</code><technical_language>I prefer: java if (!m_hasTests) { return HAS_NO_TEST; } return exitCode.getExitCode(); getStatus return exit code, in a specific case</technical_language>

Target:
public int getStatus() { if (!exitCodeListener.hasTests()) { return ExitCode.HAS_NO_TEST; } return exitCode.getExitCode(); }
Source:
<code>public void install() throws Exception { log.info("Installing Patient flag tags"); install(Tags.PATIENT_STATUS); log.info("Installing patient flag priorities"); install(Priorites.GREEN); install(Priorites.RED); install(Priorites.ORANGE); log.info("Installing flags"); install(Flags.DUE_FOR_FIRST_VIRAL_LOAD); install(Flags.OVERDUE_FOR_FIRST_VIRAL_LOAD); install(Flags.MISSED_APPOINTMENT); install(Flags.UPCOMING_APPOINTMENT); install(Flags.PATIENT_LOST); install(Flags.PATIENT_LOST_TO_FOLLOWUP); install(Flags.DUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.OVERDUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.DUE_FOR_FIRST_DNA_PCR); install(Flags.OVERDUE_FOR_FIRST_DNA_PCR); install(Flags.DUE_FOR_SECOND_DNA_PCR); install(Flags.OVERDUE_FOR_SECOND_DNA_PCR); install(Flags.DUE_FOR_RAPID_TEST); <START> install(Flags.OVER_DUE_FOR_THIRD_DNA_PCR); <END> install(Flags.OVERDUE_FOR_RAPID_TEST); install(Flags.HAS_DETECTABLE_VIRAL_LOAD); install(Flags.PATIENT_TRANSFERED_OUT); }</code><technical_language>Overdue is word. Follow convention is in "Rapid Test", "First DNA PCR" "Second DNA PCR"</technical_language>

Target:
public void install() throws Exception { log.info("Installing Patient flag tags"); install(Tags.PATIENT_STATUS); log.info("Installing patient flag priorities"); install(Priorites.GREEN); install(Priorites.RED); install(Priorites.ORANGE); log.info("Installing flags"); install(Flags.DUE_FOR_FIRST_VIRAL_LOAD); install(Flags.OVERDUE_FOR_FIRST_VIRAL_LOAD); install(Flags.MISSED_APPOINTMENT); install(Flags.UPCOMING_APPOINTMENT); install(Flags.PATIENT_LOST); install(Flags.PATIENT_LOST_TO_FOLLOWUP); install(Flags.DUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.OVERDUE_FOR_ROUTINE_VIRAL_LOAD); install(Flags.DUE_FOR_FIRST_DNA_PCR); install(Flags.OVERDUE_FOR_FIRST_DNA_PCR); install(Flags.DUE_FOR_SECOND_DNA_PCR); install(Flags.OVERDUE_FOR_SECOND_DNA_PCR); install(Flags.DUE_FOR_RAPID_TEST); install(Flags.DUE_FOR_THIRD_DNA_PCR); install(Flags.OVERDUE_FOR_THIRD_DNA_PCR); install(Flags.OVERDUE_FOR_RAPID_TEST); install(Flags.HAS_DETECTABLE_VIRAL_LOAD); install(Flags.PATIENT_TRANSFERED_OUT); }
Source:
<code>public GeodesyMLMoxy() { try { Properties properties = new Properties(); SessionEventListener sessionEventListener = new NullPolicySessionEventListener(); properties.put(JAXBContextProperties.SESSION_EVENT_LISTENER, sessionEventListener); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String mappingFilename = "moxy.xml"; <START> Source mapping_geodesyMl = new StreamSource(classLoader.getResourceAsStream(mappingFilename)); <END> Map<String, Source> metadata = new HashMap<String, Source>(); metadata.put("au.gov.xml.icsm.geodesyml.v_0_4", mapping_geodesyMl); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadata); jaxbContext = JAXBContextFactory.createContext(new Class[] {GeodesyMLType.class}, properties); } catch (JAXBException e) { throw new RuntimeException("Failed to initialise JAXBContext", e); } }</code><technical_language>naming, underscores, two-letter abbreviations in capitals: mappingGeodesyML</technical_language>

Target:
public GeodesyMLMoxy() { try { Properties properties = new Properties(); SessionEventListener sessionEventListener = new NullPolicySessionEventListener(); properties.put(JAXBContextProperties.SESSION_EVENT_LISTENER, sessionEventListener); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String mappingFilename = "moxy.xml"; Source mappingGeodesyML = new StreamSource(classLoader.getResourceAsStream(mappingFilename)); Map<String, Source> metadata = new HashMap<String, Source>(); metadata.put("au.gov.xml.icsm.geodesyml.v_0_4", mappingGeodesyML); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadata); jaxbContext = JAXBContextFactory.createContext(new Class[] {GeodesyMLType.class}, properties); } catch (JAXBException e) { throw new RuntimeException("Failed to initialise JAXBContext", e); } }
Source:
<code>public LedgerEntryImpl duplicate() { <START> LedgerEntryImpl other = RECYCLER.get(); <END> other.ledgerId = ledgerId; other.entryId = entryId; other.length = length; other.entryBuf = entryBuf.retainedSlice(); return other; }</code><technical_language>this simplified return duplicate(this);</technical_language>

Target:
public LedgerEntryImpl duplicate() { return duplicate(this); }
Source:
<code>boolean allowAction(T obj) { activeObjects.add(obj); AtomicInteger cnt = actionsCnt.get(obj); if (cnt != null) cnt.incrementAndGet(); else <START> actionsCnt.put(obj, new AtomicInteger(1)); <END> return (!actionsCnt.containsKey(obj) || actionsCnt.get(obj).get() <= limit); }</code><technical_language>computeIfAbsent() method. I.e. actionsCnt.computeIfAbsent(obj, x -> new AtomicInteger()).incrementAndGet();</technical_language>

Target:
boolean allowAction(T obj) { activeObjects.add(obj); int cnt = actionsCnt.computeIfAbsent(obj, o -> new AtomicInteger(0)) .incrementAndGet(); return (cnt <= limit); }
Source:
<code>private void saveTiffHeader(Process inProcess) { try { URI imagesDirectory = serviceManager.getFileService().getImagesDirectory(inProcess); URI tiffWriterURI = Paths.get(new File(imagesDirectory).getPath(), "tiffwriter.conf").toUri(); if (new File(tiffWriterURI).exists()) { return; } TiffHeader tif = new TiffHeader(inProcess); try (BufferedWriter outfile = new BufferedWriter( new OutputStreamWriter(fileService.write(tiffWriterURI), StandardCharsets.UTF_8))) { outfile.write(tif.getTiffAlles()); } } catch (Exception e) { Helper.setFehlerMeldung("Download aborted", e); <START> logger.error(e.getMessage(), e); <END> } }</code><technical_language>setErrorMessage</technical_language>

Target:
private void saveTiffHeader(Process inProcess) { try { URI imagesDirectory = serviceManager.getFileService().getImagesDirectory(inProcess); URI tiffWriterURI = Paths.get(new File(imagesDirectory).getPath(), "tiffwriter.conf").toUri(); if (new File(tiffWriterURI).exists()) { return; } TiffHeader tif = new TiffHeader(inProcess); try (BufferedWriter outfile = new BufferedWriter( new OutputStreamWriter(fileService.write(tiffWriterURI), StandardCharsets.UTF_8))) { outfile.write(tif.getTiffAlles()); } } catch (IOException | RuntimeException e) { Helper.setErrorMessage("Download aborted", logger, e); } }
Source:
<code>protected void parseTickerFromJsonObject(int requestId, JSONObject jsonObject, Ticker ticker, CheckerInfo checkerInfo) throws Exception { ticker.bid = jsonObject.getDouble("bidPrice"); ticker.ask = jsonObject.getDouble("askPrice"); ticker.vol = jsonObject.getDouble("turnover24h") / 1e8; if (!jsonObject.isNull("highPrice")) ticker.high = jsonObject.getDouble("highPrice"); if (!jsonObject.isNull("lowPrice")) ticker.low = jsonObject.getDouble("lowPrice"); ticker.last = jsonObject.getDouble("lastPrice"); ticker.timestamp = ISO_DATE_FORMAT.parse(jsonObject.getString("timestamp")).getTime() + <START> TimeZone.getDefault().getOffset(System.currentTimeMillis()); <END> }</code><technical_language>problem is parsing SimpleDateFormat. If want date parsed in UTC set a proper timezone. This solved in a way: private final static SimpleDateFormat ISO_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH); static { ISO_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); } In addition added Locale.ENGLISH for locale safety</technical_language>

Target:
protected void parseTickerFromJsonObject(int requestId, JSONObject jsonObject, Ticker ticker, CheckerInfo checkerInfo) throws Exception { ticker.bid = jsonObject.getDouble("bidPrice"); ticker.ask = jsonObject.getDouble("askPrice"); ticker.vol = jsonObject.getDouble("turnover24h") / 1e8; if (!jsonObject.isNull("highPrice")) ticker.high = jsonObject.getDouble("highPrice"); if (!jsonObject.isNull("lowPrice")) ticker.low = jsonObject.getDouble("lowPrice"); ticker.last = jsonObject.getDouble("lastPrice"); ticker.timestamp = ISO_DATE_FORMAT.parse(jsonObject.getString("timestamp")).getTime(); }
Source:
<code>protected boolean setState(boolean state) { <START> BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); <END> return state ? bluetoothAdapter.enable() : bluetoothAdapter.disable(); }</code><technical_language>bluetoothAdapter null</technical_language>

Target:
protected boolean setState(boolean state) { return state ? bluetoothAdapter.enable() : bluetoothAdapter.disable(); }
Source:
<code><START> public static IcsToast makeText(Context context, int resId, int duration) { <END> return IcsToast.makeText(context, context.getResources().getString(resId), duration); }</code><technical_language>This version used. is provided for others (despite in internal package)</technical_language>

Target:
public static Toast makeText(Context context, int resId, int duration) { return makeText(context, context.getResources().getString(resId), duration); }
Source:
<code>public static final IntList lineMap(final byte[] buf, int ptr, int end) throws BinaryBlobException { <START> int start = ptr; <END> IntList map = new IntList((end - ptr) / 36); map.add(Integer.MIN_VALUE); boolean foundLF = true; for (; ptr < end; ptr++) { if (foundLF) { map.add(ptr); } if (buf[ptr] == '\0') { throw new BinaryBlobException(); } foundLF = (buf[ptr] == '\n'); } map.add(end); return map; }</code><technical_language>Unused</technical_language>

Target:
public static final IntList lineMap(final byte[] buf, int ptr, int end) throws BinaryBlobException { IntList map = new IntList((end - ptr) / 36); map.add(Integer.MIN_VALUE); boolean foundLF = true; for (; ptr < end; ptr++) { if (foundLF) { map.add(ptr); } if (buf[ptr] == '\0') { throw new BinaryBlobException(); } foundLF = (buf[ptr] == '\n'); } map.add(end); return map; }
Source:
<code>public boolean queue(ByteBuffer buffer, int length) { boolean out = (mEndpoint.getDirection() == UsbConstants.USB_DIR_OUT); boolean result; <START> if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P <END> && length > MAX_USBFS_BUFFER_SIZE) { length = MAX_USBFS_BUFFER_SIZE; } synchronized (mLock) { mBuffer = buffer; mLength = length; if (buffer.isDirect()) { result = native_queue_direct(buffer, length, out); } else if (buffer.hasArray()) { result = native_queue_array(buffer.array(), length, out); } else { throw new IllegalArgumentException("buffer is not direct and has no array"); } if (!result) { mBuffer = null; mLength = 0; } } return result; }</code><technical_language>Ouch, a nasty</technical_language>

Target:
public boolean queue(ByteBuffer buffer, int length) { boolean out = (mEndpoint.getDirection() == UsbConstants.USB_DIR_OUT); boolean result; if (mConnection.getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P && length > MAX_USBFS_BUFFER_SIZE) { length = MAX_USBFS_BUFFER_SIZE; } synchronized (mLock) { mBuffer = buffer; mLength = length; if (buffer.isDirect()) { result = native_queue_direct(buffer, length, out); } else if (buffer.hasArray()) { result = native_queue_array(buffer.array(), length, out); } else { throw new IllegalArgumentException("buffer is not direct and has no array"); } if (!result) { mBuffer = null; mLength = 0; } } return result; }
Source:
<code>public Query restrict(Class<?> firstType, Class<?>... additionalTypes) { Assert.notNull(firstType, "firstType must not be null!"); Assert.notNull(additionalTypes, "additionalTypes must not be null"); if (restrictedTypes == null) { restrictedTypes = new HashSet<Class<?>>(); } restrictedTypes.add(firstType); for (Class<?> additionalType : additionalTypes) { restrictedTypes.add(additionalType); } if (!restrictedTypes.isEmpty()) { List<String> restrictedMappedTypes = new ArrayList<String>(); for (Class<?> restrictedType : restrictedTypes) { <START> restrictedMappedTypes.add(SimpleTypeInformationMapper.INSTANCE.createAliasFor(ClassTypeInformation <END> .from(restrictedType))); } addCriteria(Criteria.where(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY).in(restrictedMappedTypes)); } return this; }</code><technical_language>Early dereferencing of type aliases is gonna work adapt type mapper configured in MappingMongoConverter. types written in a read</technical_language>

Target:
public Query restrict(Class<?> firstType, Class<?>... additionalTypes) { Assert.notNull(firstType, "firstType must not be null!"); Assert.notNull(additionalTypes, "additionalTypes must not be null"); restrictedTypes.add(firstType); for (Class<?> additionalType : additionalTypes) { restrictedTypes.add(additionalType); } return this; }
Source:
<code>private IndexProvider put( Descriptor providerDescriptor, IndexProvider provider ) { IndexProvider existing = indexProviders.putIfAbsent( providerDescriptor, provider ); <START> indexProvidersByName.put( providerDescriptor.name(), provider ); <END> return existing; }</code><technical_language>put if absent here</technical_language>

Target:
private IndexProvider put( Descriptor providerDescriptor, IndexProvider provider ) { IndexProvider existing = indexProvidersByDescriptor.putIfAbsent( providerDescriptor, provider ); indexProvidersByName.putIfAbsent( providerDescriptor.name(), provider ); return existing; }
Source:
<code>public TrackerClient getTrackerClient(Request request, RequestContext requestContext, Ring<URI> ring, Map<URI, TrackerClient> trackerClients) { TrackerClient trackerClient; URI targetHostUri = KeyMapper.TargetHostHints.getRequestContextTargetHost(requestContext); if (targetHostUri != null) { trackerClient = trackerClients.get(targetHostUri); } else { trackerClient = getTrackerClientFromRing(request, requestContext, ring, trackerClients); } if (trackerClient == null) { trackerClient = trackerClients.values().stream().findAny().orElse(null); <START> warn(LOG, "Did not find a valid client from the ring, picked instead", trackerClient.getUri()); <END> } addToExcludedHosts(trackerClient, requestContext); return trackerClient; }</code><technical_language>a</technical_language>

Target:
public TrackerClient getTrackerClient(Request request, RequestContext requestContext, Ring<URI> ring, Map<URI, TrackerClient> trackerClients) { TrackerClient trackerClient; URI targetHostUri = KeyMapper.TargetHostHints.getRequestContextTargetHost(requestContext); if (targetHostUri != null) { trackerClient = getTrackerClientFromTarget(targetHostUri, requestContext, trackerClients); } else { trackerClient = getTrackerClientFromRing(request, requestContext, ring, trackerClients); } return trackerClient; }
Source:
<code>public List<PartitionOffset> indicateOffsetChange(Topic topic, String subscription, String brokersClusterName, long timestamp, boolean dryRun) { List<PartitionOffset> partitionOffsetList = new ArrayList<>(); kafkaNamesMapper.toKafkaTopics(topic).forEach(k -> { List<Integer> partitionsIds = brokerStorage.readPartitionsIds(k.name().asString()); for (Integer partitionId : partitionsIds) { KafkaConsumer<byte[], byte[]> consumer = createKafkaConsumer(k, partitionId); long offset = findClosestOffsetJustBeforeTimestamp(consumer, k, partitionId, timestamp); PartitionOffset partitionOffset = new PartitionOffset(k.name(), offset, partitionId); partitionOffsetList.add(partitionOffset); if (!dryRun) { <START> multiDcExecutor.execute(new SetSubscriptionOffsetRepositoryCommand(topic.getName(), subscription, <END> brokersClusterName, partitionOffset)); } } }); return partitionOffsetList; }</code><technical_language>Actually, write info offsets DC DCs. If offset is DC X write Zookeeper in this DC X, other ones</technical_language>

Target:
public List<PartitionOffset> indicateOffsetChange(Topic topic, String subscription, String brokersClusterName, long timestamp, boolean dryRun) { List<PartitionOffset> partitionOffsetList = new ArrayList<>(); kafkaNamesMapper.toKafkaTopics(topic).forEach(k -> { List<Integer> partitionsIds = brokerStorage.readPartitionsIds(k.name().asString()); for (Integer partitionId : partitionsIds) { KafkaConsumer<byte[], byte[]> consumer = createKafkaConsumer(k, partitionId); long offset = findClosestOffsetJustBeforeTimestamp(consumer, k, partitionId, timestamp); PartitionOffset partitionOffset = new PartitionOffset(k.name(), offset, partitionId); partitionOffsetList.add(partitionOffset); if (!dryRun) { subscriptionOffsetChange.setSubscriptionOffset(topic.getName(), subscription, brokersClusterName, partitionOffset); } } }); return partitionOffsetList; }
Source:
<code>protected Object getFeatureValue(String newText) { if <START> (newText == null <END> || StringUtil.isEmpty(newText)) { return "0"; } else { return newText; } }</code><technical_language>StringUtil.isEmpty, null equality test is done</technical_language>

Target:
protected Object getFeatureValue(String newText) { if (StringUtil.isEmpty(newText)) { return getDefaultFeatureAsText(); } else { return newText; } }
Source:
<code>public void canRemoveFile() throws Exception { final Repo repo = MkContentsTest.repo(); final String path = "removeme.txt"; this.createFile(repo, path); final JsonObject json = MkContentsTest .content(path, "theDeleteMessage") .add("committer", MkContentsTest.committer()) .build(); final RepoCommit commit = repo.contents().remove(json); <START> MatcherAssert.assertThat(commit, Matchers.notNullValue()); <END> }</code><technical_language>assert commit message is theDeleteMessage</technical_language>

Target:
public void canRemoveFile() throws Exception { final Repo repo = MkContentsTest.repo(); final String path = "removeme.txt"; this.createFile(repo, path); final JsonObject json = MkContentsTest .content(path, "theDeleteMessage") .add("committer", MkContentsTest.committer()) .build(); final RepoCommit commit = repo.contents().remove(json); MatcherAssert.assertThat(commit, Matchers.notNullValue()); MatcherAssert.assertThat( commit.json().getString("message"), Matchers.equalTo("theDeleteMessage") ); }
Source:
<code>public void testServiceProviderProvidesService() throws Exception { try (Builder b = new Builder();) { b.addClasspath(IO.getFile("bin_test")); b.setPrivatePackage("test.annotationheaders.spi.provider"); b.build(); b.getJar() .getManifest() .write(System.out); assertTrue(b.check()); Attributes mainAttributes = b.getJar() .getManifest() .getMainAttributes(); Header req = Header.parseHeader(mainAttributes.getValue(Constants.REQUIRE_CAPABILITY)); assertEquals(2, req.size()); assertExtender(req, "osgi.serviceloader.registrar"); assertEE(req); Header cap = Header.parseHeader(mainAttributes.getValue(Constants.PROVIDE_CAPABILITY)); assertEquals(3, cap.size()); Props p = cap.get("osgi.service"); assertNotNull(p); assertNotNull(p.get("objectClass:List<String>")); <START> assertEquals("test.annotationheaders.spi.SPIService", p.get("objectClass:List<String>")); <END> assertEquals("active", p.get("effective:")); } }</code><technical_language>OSGiHeader parse this Parameters List<String>-ness if parsed out Attrs</technical_language>

Target:
public void testServiceProviderProvidesService() throws Exception { try (Builder b = new Builder();) { b.addClasspath(IO.getFile("bin_test")); b.setPrivatePackage("test.annotationheaders.spi.provider"); b.build(); b.getJar() .getManifest() .write(System.out); assertTrue(b.check()); Attributes mainAttributes = b.getJar() .getManifest() .getMainAttributes(); Header req = Header.parseHeader(mainAttributes.getValue(Constants.REQUIRE_CAPABILITY)); assertEquals(2, req.size()); assertExtender(req, "osgi.serviceloader.registrar"); assertEE(req); Parameters cap = OSGiHeader.parseHeader(mainAttributes.getValue(Constants.PROVIDE_CAPABILITY)); assertEquals(3, cap.size()); Attrs p = cap.get("osgi.service"); assertNotNull(p); assertNotNull(p.getTyped("objectClass")); assertThat(p.getTyped(Attrs.LIST_STRING, "objectClass")).contains("test.annotationheaders.spi.SPIService"); assertEquals("active", p.get("effective:")); } }
Source:
<code>public final SPromise toNearRefWithResultPromise(final Object[] args) { Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); SPromise result = SPromise.createPromise(current, promiseResolutionBreakpoint.executeCheckIsSetAndEnabled(), false, false); SResolver resolver = SPromise.createResolver(result); SteppingType step = getStepping(); DirectMessage msg = new DirectMessage(EventualMessage.getCurrentExecutingMessage(), EventualMessage.getCurrentExecutingMessageId(), current, selector, args, current, resolver, onReceive, messageReceiverBreakpoint.executeCheckIsSetAndEnabled(), promiseResolverBreakpoint.executeCheckIsSetAndEnabled()); <START> msg.setTriggerStepping(step); <END> current.send(msg); return result; }</code><technical_language>set constructor</technical_language>

Target:
public final SPromise toNearRefWithResultPromise(final Object[] args) { Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); SPromise result = SPromise.createPromise(current, promiseResolutionBreakpoint.executeCheckIsSetAndEnabled(), false, false); SResolver resolver = SPromise.createResolver(result); DirectMessage msg = new DirectMessage(EventualMessage.getCurrentExecutingMessageId(), current, selector, args, current, resolver, onReceive, hasMessageReceiverBreakpoint(resolver), promiseResolverBreakpoint.executeCheckIsSetAndEnabled()); current.send(msg, actorPool); return result; }
Source:
<code>private Map<String, String> getClusterSidePropertiesMap(Configuration flinkConfig) { final Map<String, String> propertiesMap = flinkConfig.toMap(); propertiesMap.remove(KubernetesConfigOptions.KUBE_CONFIG_FILE.key()); <START> propertiesMap.remove(DeploymentOptionsInternal.CONF_DIR.key()); <END> return propertiesMap; }</code><technical_language>I safer flinkConfig.removeConfig() removes fallback keys</technical_language>

Target:
private Map<String, String> getClusterSidePropertiesMap(Configuration flinkConfig) { final Configuration clusterSideConfig = flinkConfig.clone(); clusterSideConfig.removeConfig(KubernetesConfigOptions.KUBE_CONFIG_FILE); clusterSideConfig.removeConfig(DeploymentOptionsInternal.CONF_DIR); return clusterSideConfig.toMap(); }
Source:
<code>public WatermarkOutputMultiplexer(WatermarkOutput underlyingOutput) { this.underlyingOutput = underlyingOutput; this.watermarkPerOutputId = new HashMap<>(); <START> this.watermarkOutputs = new ArrayList(); <END> }</code><technical_language>suggestion this.watermarkOutputs = new ArrayList<>();</technical_language>

Target:
public WatermarkOutputMultiplexer(WatermarkOutput underlyingOutput) { this.underlyingOutput = underlyingOutput; this.watermarkPerOutputId = new HashMap<>(); this.watermarkOutputs = new ArrayList<>(); }
Source:
<code>public String getDescription() { <START> return "Moves event parameters from eventparms column to table"; <END> }</code><technical_language>reword "from eventparms column table" "from eventparms column event_parameters table." for clarity</technical_language>

Target:
public String getDescription() { return "Moves event parameters from the 'eventparms' column to the 'event_parameters' table."; }
Source:
<code>public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain chain) throws IOException, ServletException { X509Certificate[] certs = (X509Certificate[]) req.getAttribute("javax.servlet.request.X509Certificate"); if (certs == null || certs.length == 0) { throw new ServletException( "Couldn't get the attribute javax.servlet.request.X509Certificate from the request"); } String name = certs[0].getSubjectDN().getName(); Matcher m = REGEX_USERID.matcher(name); <START> String userName; <END> if (m.matches()) { userName = m.group(1); } else { throw new ServletException("Couldn't extract username from your certificate"); } final AuthRequest areq = AuthRequest.forUser(userName); final AuthResult arsp; try { arsp = accountManager.authenticate(areq); } catch (AccountException e) { String err = "Unable to authenticate user \"" + userName + "\""; log.error(err, e); throw new ServletException(err, e); } webSession.get().login(arsp, true); chain.doFilter(req, rsp); }</code><technical_language>s/matches/find</technical_language>

Target:
public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain chain) throws IOException, ServletException { X509Certificate[] certs = (X509Certificate[]) req.getAttribute("javax.servlet.request.X509Certificate"); if (certs == null || certs.length == 0) { throw new ServletException( "Couldn't get the attribute javax.servlet.request.X509Certificate from the request"); } String name = certs[0].getSubjectDN().getName(); Matcher m = REGEX_USERID.matcher(name); String userName; if (m.find()) { userName = m.group(1); } else { throw new ServletException("Couldn't extract username from your certificate"); } final AuthRequest areq = AuthRequest.forUser(userName); final AuthResult arsp; try { arsp = accountManager.authenticate(areq); } catch (AccountException e) { String err = "Unable to authenticate user \"" + userName + "\""; log.error(err, e); throw new ServletException(err, e); } webSession.get().login(arsp, true); chain.doFilter(req, rsp); }
Source:
<code>public void scenesGenerated(char[] scenesGenerated) { if (String.valueOf(scenesGenerated).equals("1111")) { this.scenesGenerated = true; stateChanged(ManagerStates.RUNNING); } if (String.valueOf(scenesGenerated).contains("2")) { String type = "nan"; switch (String.valueOf(scenesGenerated).indexOf("2")) { case 0: type = "namedScens"; break; case 1: type = "appScenes"; break; case 2: type = "zoneScenes"; break; case 3: type = "reachableScenes"; break; } <START> logger.warn("Not all scenes are generated, try it again. Scene type is not generated.", type); <END> stateChanged(ManagerStates.RUNNING); } }</code><technical_language>Is this user fix? If this debug level logging</technical_language>

Target:
public void scenesGenerated(char[] scenesGenerated) { if (String.valueOf(scenesGenerated).equals("1111")) { this.scenesGenerated = true; stateChanged(ManagerStates.RUNNING); } if (String.valueOf(scenesGenerated).contains("2")) { String type = "nan"; switch (String.valueOf(scenesGenerated).indexOf("2")) { case 0: type = "namedScens"; break; case 1: type = "appScenes"; break; case 2: type = "zoneScenes"; break; case 3: type = "reachableScenes"; break; } logger.debug("Not all scenes are generated, try it again. Scene type is not generated.", type); stateChanged(ManagerStates.RUNNING); } }
Source:
<code>public void commit() { if (connection == null) { <START> throw new IllegalStateException(); <END> } try { connection.commit(); } finally { connection.close(); } }</code><technical_language>This description of exception</technical_language>

Target:
public void commit() { endTransaction(true); }
Source:
<code>public List<V> getAll(K name) { checkNotNull(name, "name"); int h = hashingStrategy.hashCode(name); int i = index(h); HeaderEntry<K, V> e = entries[i]; if (e == null) { return Collections.emptyList(); } LinkedList<V> values = new LinkedList<V>(); <START> while (e != null) { <END> if (e.hash == h && hashingStrategy.equals(name, e.key)) { values.addFirst(e.getValue()); } e = e.next; } return values; }</code><technical_language>@anuraaga nit: a null check change this do {....} while (...) loop</technical_language>

Target:
public List<V> getAll(K name) { requireNonNull(name, "name"); int h = hashingStrategy.hashCode(name); int i = index(h); HeaderEntry<K, V> e = entries[i]; if (e == null) { return Collections.emptyList(); } LinkedList<V> values = new LinkedList<>(); do { if (e.hash == h && hashingStrategy.equals(name, e.key)) { values.addFirst(e.getValue()); } e = e.next; } while (e != null); return values; }
Source:
<code>public static synchronized void init(Context context) { if (context == null) { throw new IllegalArgumentException("Non-null context required."); } RealmCore.loadLibrary(context); <START> BaseRealm.applicationContext = context; <END> defaultConfiguration = new RealmConfiguration.Builder().build(); if (!realmInitialized) { RealmLog.add(BuildConfig.DEBUG ? new AndroidLogger(Log.DEBUG) : new AndroidLogger(Log.WARN)); } realmInitialized = true; }</code><technical_language>Check if context is application context, throws</technical_language>

Target:
public static synchronized void init(Context context) { if (BaseRealm.applicationContext == null) { if (context == null) { throw new IllegalArgumentException("Non-null context required."); } RealmCore.loadLibrary(context); RealmLog.add(BuildConfig.DEBUG ? new AndroidLogger(Log.DEBUG) : new AndroidLogger(Log.WARN)); defaultConfiguration = new RealmConfiguration.Builder(context).build(); BaseRealm.applicationContext = context.getApplicationContext(); } }
Source:
<code>public void testNamespaceExists() throws Exception { try { <START> client.createNamespace(creds, namespaceName); <END> } catch (NamespaceExistsException ex) try { client.renameNamespace(creds, namespaceName, namespaceName); } catch (NamespaceExistsException ex) }</code><technical_language>Also, this test pass if exception is thrown</technical_language>

Target:
public void testNamespaceExists() throws Exception { client.createNamespace(creds, "foobar"); try { client.createNamespace(creds, namespaceName); fail("exception not thrown"); } catch (NamespaceExistsException ex) try { client.renameNamespace(creds, "foobar", namespaceName); fail("exception not thrown"); } catch (NamespaceExistsException ex) }
Source:
<code>public void eventsShouldBeReturned(final Map<String, String> settings) throws Throwable { final FindEventsAsyncRequest asyncRequest = FindEventsRequestFactory.fromScenarioContext(); final FindEventsResponse response = this.responseClient.getResponse(asyncRequest); assertNotNull("FindEventsRequestResponse should not be null", response); assertNotNull("Expected events", response.getEvents()); assertEquals("Number of events should match", Integer.parseInt(settings.get(EXPECTED_NUMBER_OF_EVENTS)), response.getEvents().size()); for (final Event event : response.getEvents()) { Event eventMatch = null; <START> for (final EventType item : this.getAllowedEventTypes()) { <END> if (item.toString().equals(event.getEventType().toString())) { eventMatch = event; break; } } assertNotNull("No match found for EventType", eventMatch); } }</code><technical_language>More nice I think, 'item' is renamed 'eventType'</technical_language>

Target:
public void eventsShouldBeReturned(final Map<String, String> settings) throws Throwable { final FindEventsAsyncRequest findEventsAsyncRequest = FindEventsRequestFactory.fromScenarioContext(); final FindEventsResponse findEventsResponse = this.smartMeteringManagementResponseClient .getResponse(findEventsAsyncRequest); assertNotNull("FindEventsRequestResponse should not be null", findEventsResponse); assertNotNull("Expected events", findEventsResponse.getEvents()); assertEquals("Number of events should match", Integer.parseInt(settings.get(EXPECTED_NUMBER_OF_EVENTS)), findEventsResponse.getEvents().size()); for (final Event event : findEventsResponse.getEvents()) { Event eventMatch = null; for (final EventType eventType : this.getAllowedEventTypes()) { if (eventType.equals(event.getEventType())) { eventMatch = event; break; } } assertNotNull("No match found for EventType", eventMatch); } }
Source:
<code>public void moveFile(String fileFrom, String fileTo) throws Exception { File fromLocalFile = getLocalFile(fileFrom); File toLocalFile = getLocalFile(fileTo); try { if (fromLocalFile.isDirectory()) { FileUtils.moveDirectory(fromLocalFile, toLocalFile); } else { FileUtils.moveFile(fromLocalFile, toLocalFile); } } catch (Exception e) { <START> throw new Exception("Move failed: " + fileFrom + " --&gt; " + fileTo, e); <END> } }</code><technical_language>Is this intentional</technical_language>

Target:
public void moveFile(String fileFrom, String fileTo) throws Exception { File fromLocalFile = getLocalFile(fileFrom); File toLocalFile = getLocalFile(fileTo); try { if (fromLocalFile.isDirectory()) { FileUtils.moveDirectory(fromLocalFile, toLocalFile); } else { FileUtils.moveFile(fromLocalFile, toLocalFile); } } catch (Exception e) { throw new Exception("Move failed: " + fileFrom + " --> " + fileTo, e); } }
Source:
<code>private Info dockerInfo() { try { return this.dockerClient.info(); } catch (DockerException | InterruptedException e) { <START> throw new AssertionError(e); <END> } }</code><technical_language>throw RuntimeException(e) throw Throwables.propogate(e) more idiomatic</technical_language>

Target:
private Info dockerInfo() { try { return this.dockerClient.info(); } catch (DockerException | InterruptedException e) { throw Throwables.propagate(e); } }
Source:
<code><START> private void reloadPluginWithSlug(@NonNull String slug) { <END> int index = mItems.indexOfPluginWithSlug(slug); if (index != -1) { notifyItemChanged(index); } }</code><technical_language>This is another synthetic accessor method creation. reloadPluginWithSlug method protected package-private avoid that</technical_language>

Target:
void reloadPluginWithSlug(@NonNull String slug) { int index = mItems.indexOfPluginWithSlug(slug); if (index != -1) { notifyItemChanged(index); } }
Source:
<code>void sendRejectedNotification(Application application, ApplicationComment comment) { Map<String, Object> model = new HashMap<>(); model.put(APPLICATION, application); model.put(VACATION_TYPE, getTranslation(application.getVacationType().getCategory().getMessageKey())); model.put(DAY_LENGTH, getTranslation(application.getDayLength().name())); model.put(COMMENT, comment); final Mail mailToApplicant = Mail.builder() .withRecipient(application.getPerson()) .withSubject("subject.application.rejected") .withTemplate("rejected", model) .build(); mailService.send(mailToApplicant); <START> final List<Person> relevantRecipientsToInform = applicationRecipientService.getRecipientsForAllowAndRemind(application); <END> final Mail mailToRelevantRecipients = Mail.builder() .withRecipient(relevantRecipientsToInform) .withSubject("subject.application.rejected_information") .withTemplate("rejected_information", model) .build(); mailService.send(mailToRelevantRecipients); }</code><technical_language>rename this method getRecipientsOfInterest</technical_language>

Target:
void sendRejectedNotification(Application application, ApplicationComment comment) { Map<String, Object> model = new HashMap<>(); model.put(APPLICATION, application); model.put(VACATION_TYPE, getTranslation(application.getVacationType().getCategory().getMessageKey())); model.put(DAY_LENGTH, getTranslation(application.getDayLength().name())); model.put(COMMENT, comment); final Mail mailToApplicant = Mail.builder() .withRecipient(application.getPerson()) .withSubject("subject.application.rejected") .withTemplate("rejected", model) .build(); mailService.send(mailToApplicant); final List<Person> relevantRecipientsToInform = applicationRecipientService.getRecipientsOfInterest(application); final Mail mailToRelevantRecipients = Mail.builder() .withRecipient(relevantRecipientsToInform) .withSubject("subject.application.rejected_information") .withTemplate("rejected_information", model) .build(); mailService.send(mailToRelevantRecipients); }
Source:
<code>public void execute() throws OseeCoreException { Conditions.checkNotNull(comment, "comment"); if (objects.isEmpty() && deleteObjects.isEmpty()) { throw new OseeArgumentException("objects/deleteObjects cannot be empty"); } for (Object obj : new CopyOnWriteArrayList<Object>(objects)) { if (obj instanceof IAtsWorkItem) { IAtsWorkItem workItem = (IAtsWorkItem) obj; IAtsStateManager stateMgr = getStateMgr(workItem); if (stateMgr.isDirty()) { AtsCore.getStateFactory().writeToStore(workItem, this); } if (workItem.getLog().isDirty()) { AtsCore.getLogFactory().writeToStore(workItem, AtsCore.getAttrResolver(), this); } } } for (Object obj : deleteObjects) { if (obj instanceof IAtsWorkItem) { ArtifactReadable artifact = AtsServerImpl.get().getArtifact((IAtsWorkItem) obj); getTxFactory().deleteArtifact(artifact); } else { <START> throw new OseeArgumentException("ATsChangeSet: Unhandled deleteObject type: " + obj); <END> } } transaction.commit(); for (IExecuteListener listener : listeners) { listener.changesStored(this); } }</code><technical_language>minor typo ATsChangeSet AtsChangeSet</technical_language>

Target:
public void execute() throws OseeCoreException { Conditions.checkNotNull(comment, "comment"); if (objects.isEmpty() && deleteObjects.isEmpty()) { throw new OseeArgumentException("objects/deleteObjects cannot be empty"); } for (Object obj : new CopyOnWriteArrayList<Object>(objects)) { if (obj instanceof IAtsWorkItem) { IAtsWorkItem workItem = (IAtsWorkItem) obj; IAtsStateManager stateMgr = getStateMgr(workItem); if (stateMgr.isDirty()) { AtsCore.getStateFactory().writeToStore(workItem, this); } if (workItem.getLog().isDirty()) { AtsCore.getLogFactory().writeToStore(workItem, AtsCore.getAttrResolver(), this); } } } for (Object obj : deleteObjects) { if (obj instanceof IAtsWorkItem) { ArtifactReadable artifact = AtsServerImpl.get().getArtifact((IAtsWorkItem) obj); getTxFactory().deleteArtifact(artifact); } else { throw new OseeArgumentException("AtsChangeSet: Unhandled deleteObject type: " + obj); } } transaction.commit(); for (IExecuteListener listener : listeners) { listener.changesStored(this); } }
Source:
<code>protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { String value = (String) annotationApiHelper.getAnnotationValue( annotation, "value" ).getValue(); <START> if ( !BIG_DECIMAL_PATTERN.matcher( value ).matches() ) { <END> return CollectionHelper.asSet( new ConstraintCheckError( element, annotation, "INVALID_DECIMAL_MIN_MAX_ANNOTATION_PARAMETERS" ) ); } return Collections.emptySet(); }</code><technical_language>reason pattern? java try { new BigDecimal( ); return Collections.emptySet(); } catch (NumberFormatException nfe) { // return error }</technical_language>

Target:
protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { String value = (String) annotationApiHelper.getAnnotationValue( annotation, "value" ).getValue(); try { new BigDecimal( value ); return Collections.emptySet(); } catch (NumberFormatException nfe) { return CollectionHelper.asSet( new ConstraintCheckError( element, annotation, "INVALID_DECIMAL_MIN_MAX_ANNOTATION_PARAMETERS" ) ); } }
Source:
<code>private List<String> arrayToList(String[] array) { <START> <END> List<String> List = new ArrayList<String>(); for (int i = 0; i < array.length; i++) { List.add(array[i]); } return List; }</code><technical_language>return Arrays.asList(arrays);</technical_language>

Target:
private List<String> arrayToList(String[] array) { return Arrays.asList(array); }
Source:
<code>public void shouldReturnEc2Location() { Supplier<Optional<HostLocation>> hostLocationSupplier = new HostLocationSupplier(ec2SnitchSupplier, ec2LocationSupplier, Optional.empty()); <START> assertThat(hostLocationSupplier.get()) .hasValue(ec2LocationSupplier.get().get()); <END> }</code><technical_language>this work? suggestion assertThat(hostLocationSupplier.get()) .isEqualTo(ec2LocationSupplier.get());</technical_language>

Target:
public void shouldReturnEc2Location() { Supplier<Optional<HostLocation>> hostLocationSupplier = new HostLocationSupplier(ec2SnitchSupplier, ec2LocationSupplier, Optional.empty()); assertThat(hostLocationSupplier.get()).isEqualTo(ec2LocationSupplier.get()); }
Source:
<code>private boolean checkDrProducer() { long bytesPend = 0, segsPend = 0; try { StatsSource ss = getStatsSource(StatsSelector.DRPRODUCERPARTITION); if (ss != null) { <START> int ix_totalBytes = getIndex(ss, DRProducerStatsBase.Columns.TOTAL_BYTES); <END> int ix_lastQueued = getIndex(ss, DRProducerStatsBase.Columns.LAST_QUEUED_DRID); int ix_lastAcked = getIndex(ss, DRProducerStatsBase.Columns.LAST_ACK_DRID); for (Object[] row : ss.getStatsRows(false, System.currentTimeMillis())) { long totalBytes = asLong(row[ix_totalBytes]); long lastQueuedDrId = asLong(row[ix_lastQueued]); long lastAckedDrId = asLong(row[ix_lastAcked]); bytesPend += totalBytes; if (lastQueuedDrId > lastAckedDrId) { segsPend += lastQueuedDrId - lastAckedDrId; } } } } catch (Exception ex) { warn("checkDrProducer", ex); } drprod_bytesPend = bytesPend; drprod_segsPend = segsPend; return isActive("DR producer: outstanding segments %d, bytes %d", segsPend, bytesPend); }</code><technical_language>camelCase</technical_language>

Target:
private boolean checkDrProducer() { long bytesPend = 0, rowsPend = 0; try { StatsSource ss = getStatsSource(StatsSelector.DRPRODUCERPARTITION); if (ss != null) { int ixTotalBytes = getIndex(ss, DRProducerStatsBase.Columns.TOTAL_BYTES); int ixLastQueued = getIndex(ss, DRProducerStatsBase.Columns.LAST_QUEUED_DRID); int ixLastAcked = getIndex(ss, DRProducerStatsBase.Columns.LAST_ACK_DRID); for (Object[] row : ss.getStatsRows(false, System.currentTimeMillis())) { long totalBytes = asLong(row[ixTotalBytes]); long lastQueuedDrId = asLong(row[ixLastQueued]); long lastAckedDrId = asLong(row[ixLastAcked]); bytesPend += totalBytes; if (lastQueuedDrId > lastAckedDrId) { rowsPend += lastQueuedDrId - lastAckedDrId; } } } } catch (Exception ex) { warn("checkDrProducer", ex); } drprodBytesPend = bytesPend; drprodRowsPend = rowsPend; return isActive("DR producer: outstanding rows %d, bytes %d", rowsPend, bytesPend); }
Source:
<code>public boolean isCidrFormatValid(String cidr) { <START> return (cidr != null && cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN)); <END> }</code><technical_language>need for surrounding brackets</technical_language>

Target:
public boolean isCidrFormatValid(String cidr) { return cidr != null && cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN); }
Source:
<code>private Long handleOffsets(String number) throws NumberFormatException, IllegalArgumentException{ long now = System.currentTimeMillis(); if (number.startsWith("+")) { String offset = number.substring(1); Duration duration = new Duration(offset); <START> return now + duration.getValue(); <END> } else if (number.startsWith("-")) { String offset = number.substring(1); Duration duration = new Duration(offset); return now - duration.getValue(); } else { return Long.parseLong(number); } }</code><technical_language>I do this is correct. I need get in millis of duration</technical_language>

Target:
private Long handleOffsets(String number) throws NumberFormatException, IllegalArgumentException{ long now = System.currentTimeMillis(); if (number.startsWith("+")) { String offset = number.substring(1).trim(); Duration duration = new Duration(offset); return now + duration.toMillis(); } else if (number.startsWith("-")) { String offset = number.substring(1).trim(); Duration duration = new Duration(offset); return now - duration.toMillis(); } else { return Long.parseLong(number); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { CustomSiriusEditor editor = getCurrentEditor(); if (editor != null) { QuickOutlineDescriptor descriptor = VSMDefaultQuickOutlineDescriptorFactory.createDescriptor(editor); ViewpointInformationPresenter presenter = ViewpointInformationPresenterFactory.createInformationPresenter(editor.getControl(), descriptor, <START> editor.getEditingDomain().getResourceSet() .getResources().get(0).getContents().get(0)); <END> presenter.showInformation(); } return null; }</code><technical_language>a more robust: prone NPEs. I wrote this a draft test if work. final code prepared handle null intermediate values, empty ResourceSet empty resources</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { CustomSiriusEditor editor = getCurrentEditor(); if (editor != null) { Object root = null; try { root = editor.getEditingDomain().getResourceSet().getResources().get(0).getContents().get(0); } catch (NullPointerException npe) { } if (root != null) { SiriusInformationPresenter presenter = SiriusInformationPresenterFactory.createInformationPresenter(editor.getControl(), createDescriptor(editor), root); presenter.showInformation(); } } return null; }
Source:
<code>IJavaCompletionProposal[] getSuggestions(Set<String> pkgs, IInvocationContext context) { List<RepositoryPlugin> ps = listRepositories(); final BndBuildPathHandler handler = getBuildPathHandler(context); <START> SetMultimap<String, String> bundles = MultimapBuilder.treeKeys() <END> .treeSetValues() .build(); String wsName = null; for (String pkg : pkgs) { for (RepositoryPlugin p : ps) { Set<Capability> caps = null; if (p instanceof Repository) { caps = searchRepository((Repository) p, pkg); } else if (p instanceof WorkspaceRepository) { try { caps = searchRepository(getWorkspaceRepo(), pkg); wsName = p.getName(); } catch (Exception e) { logger.logError("Error trying to fetch the repository for the current workspace", e); } } if (caps == null) { continue; } for (Capability cap : caps) { final String bsn = capabilityToBSN(cap); try { if (!handler.containsBundle(bsn)) { bundles.put(bsn, p.getName()); } } catch (Exception e) { e.printStackTrace(); } } } } if (bundles.isEmpty()) { return null; } IJavaCompletionProposal[] retval = new IJavaCompletionProposal[bundles.keySet() .size()]; int i = 0; for (Map.Entry<String, Collection<String>> bundle : bundles.asMap() .entrySet()) { final int relevance = bundle.getValue() .contains(wsName) ? ADD_BUNDLE_WORKSPACE : ADD_BUNDLE; retval[i++] = new AddBundleCompletionProposal(bundle.getKey(), relevance, context); } return retval; }</code><technical_language>google collections</technical_language>

Target:
IJavaCompletionProposal[] getSuggestions(Set<String> pkgs, IInvocationContext context) throws CoreException { List<RepositoryPlugin> ps = listRepositories(); final BndBuildPathHandler handler = getBuildPathHandler(context); MultiMap<String, String> bundles = new MultiMap<>(); String wsName = null; boolean loggedWorkspaceError = false; for (String pkg : pkgs) { for (RepositoryPlugin p : ps) { Collection<Capability> caps = null; if (p instanceof Repository) { caps = searchRepository((Repository) p, pkg); } else if (p instanceof WorkspaceRepository) { try { caps = searchRepository(getWorkspaceRepo(), pkg); wsName = p.getName(); } catch (Exception e) { if (!loggedWorkspaceError) { logger.logError("Error trying to fetch the repository for the current workspace", e); loggedWorkspaceError = true; } } } if (caps == null) { continue; } for (Capability cap : caps) { final String bsn = capabilityToBSN(cap); if (bsn != null && !handler.containsBundle(bsn)) { bundles.add(bsn, p.getName()); } } } } if (bundles.isEmpty()) { return null; } IJavaCompletionProposal[] retval = new IJavaCompletionProposal[bundles.size()]; int i = 0; for (Map.Entry<String, List<String>> bundle : bundles.entrySet()) { final int relevance = bundle.getValue() .contains(wsName) ? ADD_BUNDLE_WORKSPACE : ADD_BUNDLE; retval[i++] = new AddBundleCompletionProposal(bundle.getKey(), bundle.getValue(), relevance, context); } return retval; }