auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static List<TradeCurrency> getAllRevolutCurrencies() { ArrayList<TradeCurrency> currencies = new ArrayList<>(Arrays.asList( new FiatCurrency("AED"), new FiatCurrency("AUD"), new FiatCurrency("BGN"), new FiatCurrency("CAD"), new FiatCurrency("CHF"), new FiatCurrency("CZK"), new FiatCurrency("DKK"), new FiatCurrency("EUR"), new FiatCurrency("GBP"), new FiatCurrency("HKD"), new FiatCurrency("HRK"), new FiatCurrency("HUF"), new FiatCurrency("HUF"), <START> new FiatCurrency("ILS"), <END> new FiatCurrency("INR"), new FiatCurrency("ISK"), new FiatCurrency("JPY"), new FiatCurrency("JPY"), new FiatCurrency("MAD"), new FiatCurrency("MXN"), new FiatCurrency("NOK"), new FiatCurrency("NZD"), new FiatCurrency("PLN"), new FiatCurrency("QAR"), new FiatCurrency("RON"), new FiatCurrency("RSD"), new FiatCurrency("RUB"), new FiatCurrency("SAR"), new FiatCurrency("SEK"), new FiatCurrency("SGD"), new FiatCurrency("THB"), new FiatCurrency("TRY"), new FiatCurrency("USD"), new FiatCurrency("ZAR") )); currencies.sort(Comparator.comparing(TradeCurrency::getCode)); return currencies; }</code><technical_language>I INR in supported currencies</technical_language>

Target:
public static List<TradeCurrency> getAllRevolutCurrencies() { ArrayList<TradeCurrency> currencies = new ArrayList<>(Arrays.asList( new FiatCurrency("AED"), new FiatCurrency("AUD"), new FiatCurrency("BGN"), new FiatCurrency("CAD"), new FiatCurrency("CHF"), new FiatCurrency("CZK"), new FiatCurrency("DKK"), new FiatCurrency("EUR"), new FiatCurrency("GBP"), new FiatCurrency("HKD"), new FiatCurrency("HRK"), new FiatCurrency("HUF"), new FiatCurrency("ILS"), new FiatCurrency("ISK"), new FiatCurrency("JPY"), new FiatCurrency("MAD"), new FiatCurrency("MXN"), new FiatCurrency("NOK"), new FiatCurrency("NZD"), new FiatCurrency("PLN"), new FiatCurrency("QAR"), new FiatCurrency("RON"), new FiatCurrency("RSD"), new FiatCurrency("RUB"), new FiatCurrency("SAR"), new FiatCurrency("SEK"), new FiatCurrency("SGD"), new FiatCurrency("THB"), new FiatCurrency("TRY"), new FiatCurrency("USD"), new FiatCurrency("ZAR") )); currencies.sort(Comparator.comparing(TradeCurrency::getCode)); return currencies; }
Source:
<code>public void testRuleEndPortWhenNotEqual() { <START> assert !ruleEndPort(50).apply(ruleRef); <END> }</code><technical_language>assert assertTrue(..., message)</technical_language>

Target:
public void testRuleEndPortWhenNotEqual() { assertTrue(!ruleEndPort(50).apply(ruleRef), "expected end port not to be 50 for " + ruleRef); }
Source:
<code>default boolean updateTaskExecutionState(TaskExecutionState taskExecutionState) { <START> return updateTaskExecutionState(TaskExecutionStateWrapper.createFrom(taskExecutionState)); <END> }</code><technical_language>This a dangerous default, I surprised if some point call this accident instead of creating a failed TaskExecutionStateWrapper</technical_language>

Target:
default boolean updateTaskExecutionState(TaskExecutionState taskExecutionState) { return updateTaskExecutionState(new TaskExecutionStateTransition(taskExecutionState)); }
Source:
<code>private long openSharedGroupOrFail(Durability durability, byte[] key) { int i = 0; long start = System.nanoTime(); RuntimeException lastError = null; while (TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS) < INCREMENTAL_BACKOFF_LIMIT_MS) { try { long nativePtr = createNativeWithImplicitTransactions(nativeReplicationPtr, durability.value, key); if (i > 0) { RealmLog.w("IncompatibleLockFile was detected. Error was resolved after " + i + " retries"); } return nativePtr; <START> <END> } catch (IncompatibleLockFileException e) { i++; lastError = e; try { Thread.sleep(getSleepTime(i)); RealmLog.d("Waiting for another process to release the Realm file: " + path); } catch (InterruptedException ignored) { RealmLog.d("Waiting for Realm to open interrupted: " + path); } } } throw new RealmError("Could not open the Realm file: " + lastError.getMessage()); }</code><technical_language>remove blank line</technical_language>

Target:
private long openSharedGroupOrFail(Durability durability, byte[] key) { int i = 0; final long start = System.nanoTime(); RuntimeException lastError = null; while (TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS) < INCREMENTAL_BACKOFF_LIMIT_MS) { try { long nativePtr = createNativeWithImplicitTransactions(nativeReplicationPtr, durability.value, key); if (i > 0) { RealmLog.w("IncompatibleLockFile was detected. Error was resolved after " + i + " retries"); } return nativePtr; } catch (IncompatibleLockFileException e) { i++; lastError = e; try { Thread.sleep(getSleepTime(i)); RealmLog.d("Waiting for another process to release the Realm file: " + path); } catch (InterruptedException ignored) { RealmLog.d("Waiting for Realm to open interrupted: " + path); } } } throw new RealmError("Could not open the Realm file: " + lastError.getMessage()); }
Source:
<code>private static Object[] parametersForVarargs(Class<?>[] parameterTypes, Object[] parameters) { int fixedLen = parameterTypes.length - 1; Class<?> componentType = parameterTypes[fixedLen].getComponentType(); assert componentType != null; int arrayLength = parameters.length - fixedLen; if (arrayLength >= 0) { if (arrayLength == 1 && parameterTypes[fixedLen].isInstance(parameters[fixedLen])) { return parameters; } else { <START> Object array = DefaultTypeTransformation.castToVargsArray(parameters, arrayLength, parameterTypes[fixedLen]); <END> Object[] parameters2 = new Object[fixedLen + 1]; System.arraycopy(parameters, 0, parameters2, 0, fixedLen); parameters2[fixedLen] = array; return parameters2; } } else { return parameters; } }</code><technical_language>passing fixedLen arrayLength argument, castToVargsArray expects a 'firstVargsPos'</technical_language>

Target:
private static Object[] parametersForVarargs(Class<?>[] parameterTypes, Object[] parameters) { int fixedLen = parameterTypes.length - 1; Class<?> componentType = parameterTypes[fixedLen].getComponentType(); assert componentType != null; if (componentType.isPrimitive()) { componentType = ClassUtils.primitiveToWrapper(componentType); } int arrayLength = parameters.length - fixedLen; if (arrayLength >= 0) { if (arrayLength == 1 && parameterTypes[fixedLen].isInstance(parameters[fixedLen])) { return parameters; } else if ((arrayLength > 0 && componentType.isInstance(parameters[fixedLen])) || arrayLength == 0) { Object array = DefaultTypeTransformation.castToVargsArray(parameters, fixedLen, parameterTypes[fixedLen]); Object[] parameters2 = new Object[fixedLen + 1]; System.arraycopy(parameters, 0, parameters2, 0, fixedLen); parameters2[fixedLen] = array; return parameters2; } } return parameters; }
Source:
<code>public static String toTypeString(TypeMirror type) { if ( type.getKind() == TypeKind.ARRAY ) { final TypeMirror typeMirror = ( (ArrayType) type ).getComponentType(); final List<? extends AnnotationMirror> annotationMirrors = typeMirror.getAnnotationMirrors(); if ( !annotationMirrors.isEmpty() ) { <START> String typeName = typeMirror.toString(); <END> if ( typeName.startsWith( "(" ) && typeName.endsWith( ")" ) ) { int seperator = typeName.indexOf( ":: " ); if ( seperator != -1 ) { return typeName.substring( seperator + 3, typeName.length() - 1 ) + "[]"; } } } } if ( type.getKind().isPrimitive() ) { return PRIMITIVES.get( type.getKind() ); } return type.toString(); }</code><technical_language>time in a row issues toString() of TypeMirror. Apparently, a Types interface some utils especially asElement(). Wondering if ((TypeElement) <some instance of Types, need find out get it>.asElement( typeMirror )).getQualifiedName() work more solid? I IDE handy throwing ideas</technical_language>

Target:
public static String toTypeString(TypeMirror type) { if ( type.getKind().isPrimitive() ) { return PRIMITIVES.get( type.getKind() ); } return type.toString(); }
Source:
<code>private Venue adapt(VenueDTO dto) { <START> List<VenueName> nameInformation = Lists.newArrayList(); <END> for (VenueNameDTO duple : dto.venueNames) { nameInformation.add(new VenueName(duple.name, new Language(duple.language))); } return new Venue(new VenueGroup(dto.group), new VenueType(dto.type), nameInformation); }</code><technical_language>names</technical_language>

Target:
private Venue adapt(VenueDTO dto) { List<VenueName> names = Lists.newArrayList(); for (VenueNameDTO duple : dto.venueNames) { names.add(new VenueName(duple.name, new Language(duple.language))); } return new Venue(new VenueGroup(dto.group), new VenueType(dto.type), names); }
Source:
<code>public void overwriteEnrichmentTags() { uploadEnrichmentTagOverwriter.overwriteEnrichmentTags(); verify(enrichmentTagRepository).deleteAll(); verify(uploadEnrichmentTagCopier).copyUploadedEnrichmentTags(); <START> verify(uploadEnrichmentTagRepository, never()).deleteAll(); <END> verifyNoMoreInteractions(enrichmentTagRepository, uploadEnrichmentTagCopier); }</code><technical_language>check for verify(uploadEnrichmentTagRepository, never()).deleteAll();? Is a precaution, in future try remove uploadedEnrichmentTags copied? is show uploadedET removed copying process</technical_language>

Target:
public void overwriteEnrichmentTags() { uploadEnrichmentTagOverwriter.overwriteEnrichmentTags(); verify(enrichmentTagRepository).deleteAll(); verify(uploadEnrichmentTagCopier).copyUploadedEnrichmentTags(); verifyZeroInteractions(uploadEnrichmentTagRepository); verifyNoMoreInteractions(enrichmentTagRepository, uploadEnrichmentTagCopier); }
Source:
<code>public static IfStatement ifDefined(Name var,Statement...s) { StringBuffer b=new StringBuffer(64); for(int i=0;i<var.length();i++) { <START> } <END> return new IfStatement(new SimpleExpression(buildNotUndefined(var)),s); }</code><technical_language>is this empty loop for</technical_language>

Target:
public static IfStatement ifDefined(Name var,Statement...s) { return new IfStatement(new SimpleExpression(buildNotUndefined(var)),s); }
Source:
<code>protected void bindValidityChecks(ActionsViewTable viewTable, Button btnGetValidityErrors, Button btnGenerateScript, Button btnSaveParam) { this.viewTable = viewTable; this.btnGetValidityErrors = btnGetValidityErrors; this.btnGenerateScript = btnGenerateScript; this.btnSaveParam = btnSaveParam; this.scriptGeneratorModel.getScriptGeneratorTable().removePropertyChangeListener(ACTIONS_PROPERTY, actionChangeListener); this.scriptGeneratorModel.getScriptGeneratorTable().addPropertyChangeListener(ACTIONS_PROPERTY, actionChangeListener); this.scriptGeneratorModel.removePropertyChangeListener(VALIDITY_ERROR_MESSAGE_PROPERTY, actionChangeListener); this.scriptGeneratorModel.addPropertyChangeListener(VALIDITY_ERROR_MESSAGE_PROPERTY, actionChangeListener); this.scriptGeneratorModel.removePropertyChangeListener(GENERATED_SCRIPT_FILEPATH_PROPERTY, generatedScriptListener); this.scriptGeneratorModel.addPropertyChangeListener(GENERATED_SCRIPT_FILEPATH_PROPERTY, generatedScriptListener); <START> this.scriptGeneratorModel.removePropertyChangeListener(GENERATED_DATA_EXCHANGE_FILEPATH_PROPERTY, generatedDataExchangeFileListener); <END> this.scriptGeneratorModel.addPropertyChangeListener(GENERATED_DATA_EXCHANGE_FILEPATH_PROPERTY, generatedDataExchangeFileListener); this.scriptGeneratorModel.removePropertyChangeListener("data files", loadDataFileListener); this.scriptGeneratorModel.addPropertyChangeListener("data files", loadDataFileListener); this.scriptGeneratorModel.removePropertyChangeListener("unsupported version",unsupportedFileVersionListener); this.scriptGeneratorModel.addPropertyChangeListener("unsupported version", unsupportedFileVersionListener); this.scriptGeneratorModel.removePropertyChangeListener("Script definition not matched", evt->{ MessageDialog.openError(Display.getDefault().getActiveShell(), "ERROR", CONFIG_NOT_MATCHED_ERROR); }); this.scriptGeneratorModel.addPropertyChangeListener("Script definition not matched", evt->{ MessageDialog.openError(Display.getDefault().getActiveShell(), "ERROR", CONFIG_NOT_MATCHED_ERROR); }); }</code><technical_language>need bind</technical_language>

Target:
protected void bindValidityChecks(ActionsViewTable viewTable, Button btnGetValidityErrors, Button btnGenerateScript, Button btnSaveParam) { this.viewTable = viewTable; this.btnGetValidityErrors = btnGetValidityErrors; this.btnGenerateScript = btnGenerateScript; this.btnSaveParam = btnSaveParam; this.scriptGeneratorModel.getScriptGeneratorTable().removePropertyChangeListener(ACTIONS_PROPERTY, actionChangeListener); this.scriptGeneratorModel.getScriptGeneratorTable().addPropertyChangeListener(ACTIONS_PROPERTY, actionChangeListener); this.scriptGeneratorModel.removePropertyChangeListener(VALIDITY_ERROR_MESSAGE_PROPERTY, actionChangeListener); this.scriptGeneratorModel.addPropertyChangeListener(VALIDITY_ERROR_MESSAGE_PROPERTY, actionChangeListener); }
Source:
<code><START> public void showScoreAndAmmo() { <END> addText("Ammo: "+ screenController.getShark().getAmmo() +" Score: " + Highscores.getInstance().getScore(), TEXT_SCALE_SIZE_SMALL, Position.upperCornerPosition()); }</code><technical_language>this method private</technical_language>

Target:
private void showScoreAndAmmo() { addText("Ammo: "+ screenController.getShark().getAmmo() +" Score: " + Highscores.getInstance().getScore(), TEXT_SCALE_SIZE_SMALL, Position.upperCornerPosition()); }
Source:
<code>BitmapBuilder findObjects(Set<? extends ObjectId> start, BitmapBuilder seen, boolean ignoreMissingStart) throws MissingObjectException, IncorrectObjectTypeException, IOException { final BitmapBuilder bitmapResult = bitmapIndex.newBitmapBuilder(); for (ObjectId obj : start) { Bitmap bitmap = bitmapIndex.getBitmap(obj); if (bitmap != null) bitmapResult.or(bitmap); } boolean marked = false; for (ObjectId obj : start) { try { if (!bitmapResult.contains(obj)) { walker.markStart(walker.parseAny(obj)); marked = true; } } catch (MissingObjectException e) { if (ignoreMissingStart) continue; throw e; } } if (marked) { if (seen == null) { walker.setRevFilter(new AddToBitmapFilter(bitmapResult)); } else { walker.setRevFilter( new AddUnseenToBitmapFilter(seen, bitmapResult)); } <START> try { <END> while (walker.next() != null) { pm.update(1); countOfBitmapIndexMisses++; } RevObject ro; while ((ro = walker.nextObject()) != null) { bitmapResult.addObject(ro, ro.getType()); pm.update(1); } } catch (MissingObjectException e) { if (!ignoreMissingStart) { throw e; } } } return bitmapResult; }</code><technical_language>I scope of this try{} is wide. produces a small bitmap. this work? /** @return null walk finished */ @Nullable private static RevCommit next(RevWalk rw, boolean ignoreMissing) throws IOException { while (true) { try { return rw.next(); } catch (MissingObjectException e) { if (!ignoreMissing) { throw e; } } } } for nextObject. said, I checked if RevWalk is prepared continue noticing a missing object this. RevWalk need some changes more gracefully recover (or sense for ignoreMissing logic move there)</technical_language>

Target:
BitmapBuilder findObjects(Set<? extends ObjectId> start, BitmapBuilder seen, boolean ignoreMissingStart) throws MissingObjectException, IncorrectObjectTypeException, IOException { final BitmapBuilder bitmapResult = bitmapIndex.newBitmapBuilder(); for (ObjectId obj : start) { Bitmap bitmap = bitmapIndex.getBitmap(obj); if (bitmap != null) bitmapResult.or(bitmap); } boolean marked = false; for (ObjectId obj : start) { try { if (!bitmapResult.contains(obj)) { walker.markStart(walker.parseAny(obj)); marked = true; } } catch (MissingObjectException e) { if (ignoreMissingStart) continue; throw e; } } if (marked) { if (seen == null) { walker.setRevFilter(new AddToBitmapFilter(bitmapResult)); } else { walker.setRevFilter( new AddUnseenToBitmapFilter(seen, bitmapResult)); } while (next(walker, ignoreMissingStart) != null) { pm.update(1); countOfBitmapIndexMisses++; } RevObject ro; while ((ro = nextObject(walker, ignoreMissingStart)) != null) { bitmapResult.addObject(ro, ro.getType()); pm.update(1); } } return bitmapResult; }
Source:
<code>public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_SUBPROCESS_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, CANCELLING, <START> ""); <END> }</code><technical_language>suggestion EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_SUBPROCESS_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, CANCELLING, EMPTY_VALUE); }
Source:
<code>private RemoteATCommandResponsePacket createPacket(int frameId, ATCommandStatus status, XBee16BitAddress addr16, XBee64BitAddress addr64, String ni, XBee16BitAddress parentAddr, byte role, byte rssi) { byte[] value = new byte[2 + 8 + ni.length() + 1 + 2 + 1 + 1 + 2 + 2 + 4 + 1 ]; byte[] profile = new byte[]{(byte)0xC1, 0x05}; byte[] manufacturer = new byte[]{0x10, 0x1E}; byte[] dd = new byte[]{0x00, 0x03, 0x00, 0x00}; System.arraycopy(addr16.getValue(), 0, value, 0, 2); System.arraycopy(addr64.getValue(), 0, value, 2, 8); System.arraycopy(ni.getBytes(), 0, value, 10, ni.length()); value[10 + ni.length()] = 0x00; System.arraycopy(parentAddr.getValue(), 0, value, 11 + ni.length(), 2); value[13 + ni.length()] = role; value[14 + ni.length()] = 0x00; System.arraycopy(profile, 0, value, 15 + ni.length(), 2); System.arraycopy(manufacturer, 0, value, 17 + ni.length(), 2); System.arraycopy(dd, 0, value, 19 + ni.length(), 4); value[13 + ni.length()] = rssi; return new RemoteATCommandResponsePacket(frameId, addr64, addr16, "ND", status, value); <START> } <END></code><technical_language>include test throwing exception discovery process</technical_language>

Target:
private ATCommandResponsePacket createPacket(int frameId, ATCommandStatus status, XBee16BitAddress addr16, XBee64BitAddress addr64, String ni, XBee16BitAddress parentAddr, byte role, byte rssi) { byte[] value = new byte[2 + 8 + ni.length() + 1 + 2 + 1 + 1 + 2 + 2 + 4 + 1 ]; byte[] profile = new byte[]{(byte)0xC1, 0x05}; byte[] manufacturer = new byte[]{0x10, 0x1E}; byte[] dd = new byte[]{0x00, 0x03, 0x00, 0x00}; System.arraycopy(addr16.getValue(), 0, value, 0, 2); System.arraycopy(addr64.getValue(), 0, value, 2, 8); System.arraycopy(ni.getBytes(), 0, value, 10, ni.length()); value[10 + ni.length()] = 0x00; System.arraycopy(parentAddr.getValue(), 0, value, 11 + ni.length(), 2); value[13 + ni.length()] = role; value[14 + ni.length()] = 0x00; System.arraycopy(profile, 0, value, 15 + ni.length(), 2); System.arraycopy(manufacturer, 0, value, 17 + ni.length(), 2); System.arraycopy(dd, 0, value, 19 + ni.length(), 4); value[13 + ni.length()] = rssi; return new ATCommandResponsePacket(frameId, status, "ND", value); }
Source:
<code><START> public void changeCurrentEdge(int amount) { <END> currentEdge += amount; }</code><technical_language>currentEdge allowed dip 0</technical_language>

Target:
public void changeCurrentEdge(int amount) { currentEdge = Math.max(currentEdge + amount, 0); }
Source:
<code>public void handle(GlowSession session, UseItemMessage message) { GlowPlayer player = session.getPlayer(); ItemStack holding = player.getInventory().getItem(message.getEquipmentSlot()); if (!InventoryUtil.isEmpty(holding)) { ItemType type = ItemTable.instance().getItem(holding.getType()); if (type != null) { if (type.getContext() == Context.AIR || type.getContext() == Context.ANY) { type.rightClickAir(player, holding); } else { if ((holding.getType() == Material.WATER_BUCKET <START> || holding.getType() == Material.LAVA_BUCKET) && player.getGameMode() != GameMode.CREATIVE) { <END> holding.setType(Material.BUCKET); } } } if (holding.getAmount() <= 0) { holding = InventoryUtil.createEmptyStack(); } player.getInventory().setItem(message.getEquipmentSlot(), holding); } }</code><technical_language>Put && player.getGameMode() != GameMode.CREATIVE) a new line</technical_language>

Target:
public void handle(GlowSession session, UseItemMessage message) { GlowPlayer player = session.getPlayer(); ItemStack holding = InventoryUtil .itemOrEmpty(player.getInventory().getItem(message.getEquipmentSlot())); PlayerInteractEvent event = EventFactory .onPlayerInteract(player, Action.RIGHT_CLICK_AIR, message.getEquipmentSlot()); if (event.useItemInHand() == null || event.useItemInHand() == Event.Result.DENY) { return; } if (!InventoryUtil.isEmpty(holding)) { ItemType type = ItemTable.instance().getItem(holding.getType()); if (type != null) { if (type.getContext() == Context.AIR || type.getContext() == Context.ANY) { type.rightClickAir(player, holding); } else { if ((holding.getType() == Material.WATER_BUCKET || holding.getType() == Material.LAVA_BUCKET) && player.getGameMode() != GameMode.CREATIVE) { holding.setType(Material.BUCKET); } } } if (holding.getAmount() <= 0) { holding = InventoryUtil.createEmptyStack(); } player.getInventory().setItem(message.getEquipmentSlot(), holding); } }
Source:
<code><START> public Method getJavaMethod() { <END> if (this.javaMethod == null) { Preconditions.notEmpty(getJavaMethods(), "No method with name: " + this.methodName); Preconditions.condition(getJavaMethods().size() == 1, "Multiple methods with name: " + this.methodName); this.javaMethod = getJavaMethods().get(0); } return this.javaMethod; }</code><technical_language>Please implement this method analogous org.junit.platform.engine.discovery.MethodSelector.getJavaMethod()</technical_language>

Target:
public Method getJavaMethod() { if (this.javaMethod == null) { if (StringUtils.isNotBlank(this.methodParameterTypes)) { this.javaMethod = ReflectionUtils.findMethod(getJavaClass(), this.methodName, this.methodParameterTypes).orElseThrow( () -> new PreconditionViolationException(String.format( "Could not find method with name [%s] and parameter types [%s] in class [%s].", this.methodName, this.methodParameterTypes, getJavaClass().getName()))); } else { this.javaMethod = ReflectionUtils.findMethod(getJavaClass(), this.methodName).orElseThrow( () -> new PreconditionViolationException( String.format("Could not find method with name [%s] in class [%s].", this.methodName, getJavaClass().getName()))); } } return this.javaMethod; }
Source:
<code>public void start(ServiceProvider<Service> serviceProvider) { <START> addDefaultSerializerIfNoneRegistered(serializers, Serializable.class, (Class) CompactJavaSerializer.class); <END> addDefaultSerializerIfNoneRegistered(serializers, Long.class, LongSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Integer.class, IntegerSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Float.class, FloatSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Double.class, DoubleSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Character.class, CharSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, String.class, StringSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, byte[].class, ByteArraySerializer.class); }</code><technical_language>Needs a trick similar done [here](<LINK_0></technical_language>

Target:
public void start(ServiceProvider<Service> serviceProvider) { addDefaultSerializerIfNoneRegistered(serializers, Serializable.class, CompactJavaSerializer.<Serializable>asTypedSerializer()); addDefaultSerializerIfNoneRegistered(serializers, Long.class, LongSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Integer.class, IntegerSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Float.class, FloatSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Double.class, DoubleSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, Character.class, CharSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, String.class, StringSerializer.class); addDefaultSerializerIfNoneRegistered(serializers, byte[].class, ByteArraySerializer.class); }
Source:
<code>static String getDesc(ConfigurationKey key) { try { Field field = ConfigurationKey.class.getDeclaredField(key.toString()); if (field != null && field.isEnumConstant()) { Description description = field.getAnnotation(Description.class); if (description == null) { return null; } return description.value(); } <START> } catch (Exception e) { <END> } return null; }</code><technical_language>FindBugs finds this line liking seems: Exception is caught Exception is thrown in org.jboss.weld.probe.Reports.getDesc(ConfigurationKey) org.jboss.weld.probe.Reports Reports.java:[lines 78-370]</technical_language>

Target:
static String getDesc(ConfigurationKey key) { try { Field field = ConfigurationKey.class.getDeclaredField(key.toString()); if (field != null && field.isEnumConstant()) { Description description = field.getAnnotation(Description.class); if (description == null) { return null; } return description.value(); } } catch (NoSuchFieldException | SecurityException | NullPointerException ignored) { } return null; }
Source:
<code>public UpdateRequest process(UpdateRequest request) throws PluginExecutionException, StopProcessingException { Map<String, ShareableMetacardImpl> previous = getPreviousShareableMetacards(request); request .getUpdates() .stream() .map(Map.Entry::getValue) .filter(ShareableMetacardImpl::canShare) .map(ShareableMetacardImpl::from) <START> .filter(shareableMC -> StringUtils.isEmpty(shareableMC.getOwner())) <END> .forEach(shareableMC -> shareableMC.setOwner(previous.get(shareableMC.getId()).getOwner())); return request; }</code><technical_language>shareableMC -> shareableMetacard</technical_language>

Target:
public UpdateRequest process(UpdateRequest request) throws PluginExecutionException, StopProcessingException { request .getUpdates() .stream() .map(Map.Entry::getValue) .filter(ShareableMetacardImpl::canShare) .map(ShareableMetacardImpl::createOrThrow) .filter(shareableMetacard -> StringUtils.isEmpty(shareableMetacard.getOwner())) .forEach( shareableMetacard -> copyOwner( getPreviousShareableMetacards(request).get(shareableMetacard.getId()), shareableMetacard)); return request; }
Source:
<code>private void recreateZKConnection() { try { zk.close(); } catch (InterruptedException e) { LOG.error("Error closing ZK connection : " + e); } finally { try { createNewZKConnection(); } catch (IOException e) { <START> LOG.error("Error creating new ZK COnnection for agent: " + e); <END> } } }</code><technical_language>others: log Exception arg</technical_language>

Target:
private void recreateZKConnection() { try { zk.close(); } catch (InterruptedException e) { LOG.error("Error closing ZK connection : ", e); } finally { try { createNewZKConnection(); } catch (IOException e) { LOG.error("Error creating new ZK COnnection for agent: ", e); } } }
Source:
<code>public void define(Context context) { NewRepository repository = context.createRepository(CheckList.REPOSITORY_KEY, Php.KEY).setName(REPOSITORY_NAME); <START> Set<Class> checkClasses = ImmutableSet.<Class>builder() <END> .addAll(CheckList.getChecks()) .addAll(CheckList.getPhpIniChecks()) .build(); new AnnotationBasedRulesDefinition(repository, Php.KEY).addRuleClasses(false, checkClasses); repository.done(); }</code><technical_language>@pynicolas refactor this piece CheckList class</technical_language>

Target:
public void define(Context context) { NewRepository repository = context.createRepository(CheckList.REPOSITORY_KEY, Php.KEY).setName(REPOSITORY_NAME); new AnnotationBasedRulesDefinition(repository, Php.KEY).addRuleClasses(false, CheckList.getAllChecks()); for (NewRule rule : repository.rules()) { String metadataKey = rule.key(); rule.setInternalKey(metadataKey); rule.setHtmlDescription(readRuleDefinitionResource(metadataKey + ".html")); addMetadata(rule, metadataKey); } repository.done(); }
Source:
<code>protected static String toCamelCase(String originalName) { String[] words = originalName.split("-"); StringBuilder nameBuilder = new StringBuilder(originalName.length()); nameBuilder.append(words[0]); for (int i = 1; i < words.length; i++) { nameBuilder.append(words[i].substring(0, 1).toUpperCase()); <START> nameBuilder.append(words[i].substring(1)); <END> } return nameBuilder.toString(); }</code><technical_language>config key "foo-----bar" for example ... throws IndexOutOfBounds I believe. start end hyphen</technical_language>

Target:
protected static String toCamelCase(String originalName) { String[] words = originalName.split("-+"); StringBuilder nameBuilder = new StringBuilder(originalName.length()); for (int i = 0; i < words.length; i++) { if (nameBuilder.length() == 0) { nameBuilder.append(words[i]); } else { nameBuilder.append(words[i].substring(0, 1).toUpperCase()); nameBuilder.append(words[i].substring(1)); } } return nameBuilder.toString(); }
Source:
<code>protected IStatus run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); try { register(root); List<Container> childrenPath = walkDirectory(subMonitor.split(50)); registerWatchService(childrenPath, subMonitor.split(50)); } catch (IOException e) { return new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, e.getMessage(), e); <START> } catch (OperationCanceledException e) { return new Status(IStatus.CANCEL, ResourcesPlugin.PI_RESOURCES, e.getMessage(), e); <END> } catch (CoreException e) { return new Status(e.getStatus().getSeverity(), ResourcesPlugin.PI_RESOURCES, e.getMessage(), e); } return Status.OK_STATUS; }</code><technical_language>need convert OperationCanceledException status. allow propagate</technical_language>

Target:
protected IStatus run(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); try { if (register(root)) { List<Container> childrenPath = walkDirectory(subMonitor.split(50)); registerWatchService(childrenPath, subMonitor.split(50)); } else { monitor.setCanceled(true); return Status.CANCEL_STATUS; } } catch (IOException e) { return new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, e.getMessage(), e); } catch (CoreException e) { return new Status(e.getStatus().getSeverity(), ResourcesPlugin.PI_RESOURCES, e.getMessage(), e); } return Status.OK_STATUS; }
Source:
<code>private TablePopulationRequirements getMVInfoMessage(Table table, MaterializedViewInfo mv) { <START> TablePopulationRequirements retval; <END> if (! mv.getIssafewithnonemptysources()) { String viewName = mv.getTypeName(); String sourceName = mv.getParent().getTypeName(); String errorMessage = createViewDisallowedMessage(viewName, sourceName); retval = new TablePopulationRequirements(viewName); retval.setErrorMessage(errorMessage); if ( ! m_newTables.contains(sourceName)) { retval.addTableName(sourceName); } return retval; } return null; }</code><technical_language>Merge declaration block-scoped initialization statement (first use)</technical_language>

Target:
private TablePopulationRequirements getMVInfoMessage(Table table, MaterializedViewInfo mv) { TablePopulationRequirements retval; if (! mv.getIssafewithnonemptysources()) { String viewName = mv.getTypeName(); String sourceName = mv.getParent().getTypeName(); String errorMessage = createViewDisallowedMessage(viewName, sourceName); retval = new TablePopulationRequirements(viewName); retval.setErrorMessage(errorMessage); retval.addTableName(sourceName); return retval; } return null; }
Source:
<code>public void rowKeyIsSetInRequest() throws IOException { Get get = makeValidGet(dataHelper.randomData(PREFIX_DATA)); Query query = Query.create(TABLE_ID); getAdapter.adapt(get, throwingReadHooks, query); ByteString adaptedRowKey = query.toProto(requestContext).getRows().getRowKeys(0); Assert.assertEquals( <START> new String(get.getRow(), StandardCharsets.UTF_8), <END> adaptedRowKey.toStringUtf8()); }</code><technical_language>Spacing again..</technical_language>

Target:
public void rowKeyIsSetInRequest() throws IOException { Get get = makeValidGet(dataHelper.randomData(PREFIX_DATA)); getAdapter.adapt(get, throwingReadHooks, query); ByteString adaptedRowKey = query.toProto(requestContext).getRows().getRowKeys(0); Assert.assertEquals( new String(get.getRow(), StandardCharsets.UTF_8), adaptedRowKey.toStringUtf8()); }
Source:
<code>public String ac_psu_remove_pool_$_1(Args args) { if(Glob.isGlob(args.argv(0))) { Glob glob = new Glob(args.argv(0)); List<String> names = getPools(glob.toPattern()).stream().map((Pool pool) -> pool.getName()).collect(Collectors.toList()); <START> for(String name : names) <END> removePool(name); } else removePool(args.argv(0)); return ""; }</code><technical_language>please curly bases e single statement, e.g: for (...) { removePool(name); }</technical_language>

Target:
public String ac_psu_create_linkGroup_$_1(Args args) { createLinkGroup(args.argv(0), args.hasOption("reset")); return ""; }
Source:
<code>private static Value buildPortInfo( OutputPortInfo portInfo, Set< String > referredTypesSet ) { Value result = Value.create(); result.setFirstChild( PortInfoType.NAME, portInfo.id() ); if( portInfo.location() != null ) { result.setFirstChild( PortInfoType.LOCATION, portInfo.location().toString() ); } <START> if( portInfo.protocol() != null ) { <END> result.setFirstChild( PortInfoType.PROTOCOL, portInfo.protocol().toString() ); } if( portInfo.getDocumentation() != null ) { result.setFirstChild( PortInfoType.DOCUMENTATION, portInfo.getDocumentation() ); } ValueVector interfaces = result.getChildren( PortInfoType.INTERFACE ); portInfo.getInterfaceList().forEach( i -> interfaces.add( buildInterfaceInfo( i, referredTypesSet ) ) ); return result; }</code><technical_language>this protocolId rest</technical_language>

Target:
private static Value buildPortInfo( OutputPortInfo portInfo, Set< String > referredTypesSet ) { Value result = Value.create(); result.setFirstChild( PortInfoType.NAME, portInfo.id() ); if( portInfo.location() != null ) { result.setFirstChild( PortInfoType.LOCATION, portInfo.location().toString() ); } if( portInfo.protocol() != null ) { result.setFirstChild( PortInfoType.PROTOCOL, portInfo.protocolId() ); } if( portInfo.getDocumentation() != null ) { result.setFirstChild( PortInfoType.DOCUMENTATION, portInfo.getDocumentation() ); } ValueVector interfaces = result.getChildren( PortInfoType.INTERFACE ); portInfo.getInterfaceList().forEach( i -> interfaces.add( buildInterfaceInfo( i, referredTypesSet ) ) ); return result; }
Source:
<code>private void checkThisEObjectInCompletion(EObject element, final String expectedType) { IInterpreterContext interContext = SiriusInterpreterContextFactory.createInterpreterContext(element, preconditionAttribute); ContentContext context = new ContentContext("[/]", 1, interContext); List<ContentProposal> contentProposals = acceleoPrososalProvider.getProposals(acceleoIntepreter, context); ContentProposal contentProposal = Iterables.find(contentProposals, new Predicate<ContentProposal>() { @Override public boolean apply(ContentProposal input) { return input.getProposal().equals("thisEObject"); } }, null); assertNotNull("The 'thisEObject' is not found", contentProposal); <START> assertEquals(contentProposal.getDisplay(), "thisEObject:" + expectedType); <END> }</code><technical_language>method parameters reversed, expected current one. add error message, "wrong 'thisEObject' expected type"</technical_language>

Target:
private void checkThisEObjectInCompletion(EObject element, final String expectedType) { IInterpreterContext interContext = SiriusInterpreterContextFactory.createInterpreterContext(element, preconditionAttribute); ContentContext context = new ContentContext("[/]", 1, interContext); List<ContentProposal> contentProposals = acceleoPrososalProvider.getProposals(acceleoIntepreter, context); ContentProposal contentProposal = Iterables.find(contentProposals, new Predicate<ContentProposal>() { @Override public boolean apply(ContentProposal input) { return input.getProposal().equals("thisEObject"); } }, null); assertNotNull("The 'thisEObject' is not found", contentProposal); assertEquals("thisEObject:" + expectedType, contentProposal.getDisplay()); }
Source:
<code>public static Class<? extends Comparable> valuesType(@Nullable String type) { if (type == null) { return String.class; <START> } else if ("string".equals(type)) { <END> return String.class; } else if ("int".equals(type)) { return Integer.class; } else if ("long".equals(type)) { return Long.class; } throw new ValidationException("Not a valid provided type: " + type); }</code><technical_language>refer constants string literals</technical_language>

Target:
public static Class<? extends Comparable> valuesType(@Nullable String type) { if (type == null) { return String.class; } else if (STRING_TYPE.equals(type)) { return String.class; } else if (INT_TYPE.equals(type)) { return Integer.class; } else if (LONG_TYPE.equals(type)) { return Long.class; } throw new ValidationException("Not a valid provided type: " + type); }
Source:
<code>public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); if (listener!=null) { <START> listener.omDismissed(); <END> } }</code><technical_language>related typo</technical_language>

Target:
public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); if (listener!=null) { listener.onDismissed(); } }
Source:
<code>public boolean onSingleTapConfirmed(MotionEvent e) { if (mMapView.getCallout().isShowing()) { mMapView.getCallout().dismiss(); } if (graphicsOverlay.getGraphics().size() > 0) { if (graphicsOverlay.getGraphics().get(0).isSelected()) { isPinSelected = false; graphicsOverlay.getGraphics().get(0).setSelected(false); } } final android.graphics.Point screenPoint = new android.graphics.Point((int) e.getX(), (int) e.getY()); final ListenableFuture<List<Graphic>> identifyGraphic = mMapView.identifyGraphicsOverlayAsync(graphicsOverlay, screenPoint, 1.0, 1); identifyGraphic.addDoneListener(new Runnable() { @Override public void run() { try { List<Graphic> graphic = identifyGraphic.get(); <START> int identifyResultSize = graphic.size(); <END> if (!graphic.isEmpty()) { if (!isPinSelected) { isPinSelected = true; graphic.get(0).setSelected(true); Toast.makeText(getApplicationContext(), getString(R.string.reverse_geocode_message), Toast.LENGTH_SHORT).show(); mMapView.setOnTouchListener(new DragTouchListemer(getApplicationContext(), mMapView)); } mCalloutContent.setText(mGraphicPointAddress); mCallout = mMapView.getCallout(); mCallout.setContent(mCalloutContent); mCallout.setLocation(mGraphicPoint); mCallout.show(); } } catch (InterruptedException | ExecutionException ie) { ie.printStackTrace(); } } }); return super.onSingleTapConfirmed(e); }</code><technical_language>identifyResultSize unused, if remove</technical_language>

Target:
public boolean onSingleTapConfirmed(MotionEvent e) { if (mMapView.getCallout().isShowing()) { mMapView.getCallout().dismiss(); } if (graphicsOverlay.getGraphics().size() > 0) { if (graphicsOverlay.getGraphics().get(0).isSelected()) { isPinSelected = false; graphicsOverlay.getGraphics().get(0).setSelected(false); } } final android.graphics.Point screenPoint = new android.graphics.Point((int) e.getX(), (int) e.getY()); final ListenableFuture<List<Graphic>> identifyGraphic = mMapView.identifyGraphicsOverlayAsync(graphicsOverlay, screenPoint, 1.0, 1); identifyGraphic.addDoneListener(new Runnable() { @Override public void run() { try { List<Graphic> graphic = identifyGraphic.get(); if (!graphic.isEmpty()) { if (!isPinSelected) { isPinSelected = true; graphic.get(0).setSelected(true); Toast.makeText(getApplicationContext(), getString(R.string.reverse_geocode_message), Toast.LENGTH_SHORT).show(); mMapView.setOnTouchListener(new DragTouchListener(getApplicationContext(), mMapView)); } mCalloutContent.setText(mGraphicPointAddress); mCallout = mMapView.getCallout(); mCallout.setContent(mCalloutContent); mCallout.setLocation(mGraphicPoint); mCallout.show(); } } catch (InterruptedException | ExecutionException ie) { ie.printStackTrace(); } } }); return super.onSingleTapConfirmed(e); }
Source:
<code>public void onEventMainThread(@NonNull ProfilePhotoUpdatedEvent event) { if (!environment.getConfig().isTabsLayoutEnabled() || !environment.getConfig().isUserProfilesEnabled()) { <START> return; <END> } final ImageView profileImage = toolbarCallbacks.getProfileView(); if (event.getUsername().equalsIgnoreCase(profile.username)) { if (null == event.getUri()) { Glide.with(this) .load(R.drawable.profile_photo_placeholder) .into(profileImage); } else { Glide.with(this) .load(event.getUri()) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) .into(profileImage); } } }</code><technical_language>Starting here, code in this function is copied places ProfilePhotoUpdatedEvent is consumed. move this code a Util class standardize usage in other classes well</technical_language>

Target:
public void onEventMainThread(@NonNull ProfilePhotoUpdatedEvent event) { if (!environment.getConfig().isTabsLayoutEnabled() || !environment.getConfig().isUserProfilesEnabled()) { return; } final ImageView profileImage = toolbarCallbacks.getProfileView(); if (event.getUsername().equalsIgnoreCase(profile.username)) { UserProfileUtils.loadProfileImage(getContext(), event, profileImage); } }
Source:
<code><START> public static Map getStatusMap(String message, int code) { <END> Map resultMap = new HashMap(); Map statusMap = new HashMap(); statusMap.put("message", message); statusMap.put("code", Integer.valueOf(code)); resultMap.put("status", statusMap); return resultMap; }</code><technical_language>good Map<String, Object> remove suppressed warnings</technical_language>

Target:
public static Map getStatusMap(String message, int code) { Map<String, Object> resultMap = new HashMap(); Map<String, Object> statusMap = new HashMap(); statusMap.put("message", message); statusMap.put("code", Integer.valueOf(code)); resultMap.put("status", statusMap); return resultMap; }
Source:
<code>public Bndrun init(File runFile, String task, File workingDir) throws Exception { if (!runFile.exists()) { logger.error("Could not find bnd run file {}", runFile); return null; } String bndrun = getNamePart(runFile); File temporaryDir = workingDir.toPath() .resolve("tmp") .resolve(task) .resolve(bndrun) .toFile(); File cnf = new File(temporaryDir, Workspace.CNFDIR); aQute.lib.io.IO.mkdirs(cnf); Bndrun run = Bndrun.createBndrun(null, runFile); run.setBase(temporaryDir); Workspace workspace = run.getWorkspace(); workspace.setBuildDir(cnf); workspace.setOffline(session.getSettings() .isOffline()); workspace.addBasicPlugin(getFileSetRepository()); run.setParent(getProcessor(workspace)); for (RepositoryPlugin repo : workspace.getRepositories()) { repo.list(null); } setRunrequiresFromProjectArtifact(run); setEEfromBuild(run); <START> run.getProperties() <END> .put(BndrunContainer.class.getName(), this); return run; }</code><technical_language>I add BndrunContainer object run's plugins. is put real objects this in plugins. Putting in properties confusing generally expect property values String. java run.addBasicPlugin(this);</technical_language>

Target:
public Bndrun init(File runFile, String task, File workingDir) throws Exception { if (!runFile.exists()) { logger.error("Could not find bnd run file {}", runFile); return null; } String bndrun = getNamePart(runFile); File temporaryDir = workingDir.toPath() .resolve("tmp") .resolve(task) .resolve(bndrun) .toFile(); File cnf = new File(temporaryDir, Workspace.CNFDIR); aQute.lib.io.IO.mkdirs(cnf); Bndrun run = Bndrun.createBndrun(null, runFile); run.setBase(temporaryDir); Workspace workspace = run.getWorkspace(); workspace.setBase(temporaryDir); workspace.setBuildDir(cnf); workspace.setOffline(session.getSettings() .isOffline()); run.setParent(getProcessor(workspace)); run.getInfo(workspace); setRunrequiresFromProjectArtifact(run); setEEfromBuild(run); run.addBasicPlugin(this); return run; }
Source:
<code><START> public StreamableMessageSource<TrackedEventMessage<?>> getMessageSource() { <END> return messageSource; }</code><technical_language>semantically correct, return type StreamableMessageSource<? extends TrackedEventMessage<?>>. in builder yet, is a compatible change changed some point</technical_language>

Target:
public StreamableMessageSource<? extends TrackedEventMessage<?>> getMessageSource() { return messageSource; }
Source:
<code>protected LinkedHashMap<String, U> retrieveAll(final boolean readFromSession) { return super.retrieveAll(readFromSession).entrySet().stream().filter( it -> it.getValue() <START> .getAttribute(SESSION_CLIENT_ID) <END> .equals(context.getRequestParameter(REQUEST_CLIENT_ID))) .collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> { throw new IllegalStateException("Duplicate key"); }, LinkedHashMap::new)); }</code><technical_language>I more sense authentication attributes instead of user attributes</technical_language>

Target:
protected LinkedHashMap<String, U> retrieveAll(final boolean readFromSession) { return super.retrieveAll(readFromSession).entrySet().stream().filter( it -> it.getValue() .getAuthenticationAttribute(SESSION_CLIENT_ID) .equals(context.getRequestParameter(REQUEST_CLIENT_ID))) .collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> { throw new IllegalStateException("Duplicate key"); }, LinkedHashMap::new)); }
Source:
<code><START> public void eventDispatched(IStartedDMEvent event) { <END> if (event instanceof org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_0.ContainerStartedDMEvent) { handleContainerStartedEvent(event.getDMContext()); } else if (event instanceof org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent) { handleContainerStartedEvent(event.getDMContext()); } }</code><technical_language>if (event.getDMContext() instanceof IContainerDMContext) if dealing a container a thread</technical_language>

Target:
public void eventDispatched(IStartedDMEvent event) { if (event.getDMContext() instanceof IContainerDMContext) { IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(event.getDMContext(), IMemoryDMContext.class); if (memoryDmc != null) { initialize(memoryDmc); } } }
Source:
<code>public void initializationAlwaysFailsAfterTheFirstAsynchronousTry() { AlwaysFailingInitializer initializer = new AlwaysFailingInitializer(); initializer.initialize(true); assertThatThrownBy(() -> initializer.initialize(false)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("Multiple calls tried to initialize the same instance."); tickSchedulerFiveTimes(initializer); <START> assertThat(initializer.initializationAttempts).isEqualTo(1 + 5); <END> }</code><technical_language>private static final int = 5</technical_language>

Target:
public void initializationAlwaysFailsAfterTheFirstAsynchronousTry() { AlwaysFailingInitializer initializer = new AlwaysFailingInitializer(); initializer.initialize(true); assertThatThrownBy(() -> initializer.initialize(false)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("Multiple calls tried to initialize the same instance."); tickSchedulerFiveTimes(initializer); assertThat(initializer.initializationAttempts).isEqualTo(1 + FIVE); }