auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object processMessage(Message<?> message) { Object[] args = new Object[this.parameterTypes.length]; for (int i = 0; i < this.parameterTypes.length; i++) { Class<?> parameterType = this.parameterTypes[i]; if (Message.class.isAssignableFrom(parameterType)) { args[i] = message; } else if (Map.class.isAssignableFrom(parameterType)) { if (message.getPayload() instanceof Map && this.parameterTypes.length == 1) { args[i] = message.getPayload(); } else { args[i] = message.getHeaders(); } } else { if (this.payloadType != null && !ClassUtils.isAssignable(this.payloadType, message.getPayload().getClass())) { if (Message.class.isAssignableFrom(this.payloadType)) { args[i] = message; } else { args[i] = this.messageConverter.fromMessage(message, this.payloadType); } } else { args[i] = message.getPayload(); } } } try { return this.method.invoke(this.target, args); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof ClassCastException) { logger.error("Could not invoke the method due to a class cast exception, if using a lambda in the DSL, " + "consider using an overloaded EIP method that takes a Class<?> argument to explicitly " + "specify the type", e.getCause()); } throw new MessageHandlingException(message, e.getCause()); } catch (Exception e) { throw new MessageHandlingException(message, e); } }

Target:
public Object processMessage(Message<?> message) { Object[] args = new Object[this.parameterTypes.length]; for (int i = 0; i < this.parameterTypes.length; i++) { Class<?> parameterType = this.parameterTypes[i]; if (Message.class.isAssignableFrom(parameterType)) { args[i] = message; } else if (Map.class.isAssignableFrom(parameterType)) { if (message.getPayload() instanceof Map && this.parameterTypes.length == 1) { args[i] = message.getPayload(); } else { args[i] = message.getHeaders(); } } else { if (this.payloadType != null && !ClassUtils.isAssignable(this.payloadType, message.getPayload().getClass())) { if (Message.class.isAssignableFrom(this.payloadType)) { args[i] = message; } else { args[i] = this.messageConverter.fromMessage(message, this.payloadType); } } else { args[i] = message.getPayload(); } } } try { return this.method.invoke(this.target, args); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof ClassCastException) { logger.error("Could not invoke the method due to a class cast exception, if using a lambda in the DSL, " + "consider using an overloaded EIP method that takes a Class<?> argument to explicitly " + "specify the type. An example of when this often occurs is if the lambda is configured to " + "receive a Message<?> argument.", e.getCause()); } throw new MessageHandlingException(message, e.getCause()); } catch (Exception e) { throw new MessageHandlingException(message, e); } }
Source:
private void tryToUpdateForEndOfSequential(){ int curIndex = pager.getCurrentItem(); setCurrentUnit(pagerAdapter.getUnit(curIndex)); mPreviousBtn.setEnabled(curIndex > 0); mNextBtn.setEnabled(curIndex < pagerAdapter.getCount() - 1); findViewById(R.id.course_unit_nav_bar).requestLayout(); setTitle(selectedUnit.getDisplayName()); String currentSubsection = selectedUnit.getParent().getName(); if (curIndex + 1 <= pagerAdapter.getCount() - 1) { String nextUnitSubsection = unitList.get(curIndex + 1).getParent().getName(); if (currentSubsection.equalsIgnoreCase(nextUnitSubsection)) { mNextUnitLbl.setVisibility(View.GONE); mNextBtn.setText(R.string.assessment_next); } else { mNextUnitLbl.setText(nextUnitSubsection); mNextUnitLbl.setVisibility(View.VISIBLE); mNextBtn.setText(R.string.assessment_next_unit); } } else { mNextBtn.setText(R.string.assessment_next); mNextUnitLbl.setVisibility(View.GONE); } if (curIndex - 1 >= 0) { String prevUnitSubsection = unitList.get(curIndex - 1).getParent().getName(); if (currentSubsection.equalsIgnoreCase(prevUnitSubsection)) { mPreviousUnitLbl.setVisibility(View.GONE); mPreviousBtn.setText(R.string.assessment_previous); } else { mPreviousUnitLbl.setText(prevUnitSubsection); mPreviousUnitLbl.setVisibility(View.VISIBLE); mPreviousBtn.setText(R.string.assessment_previous_unit); } } else { mPreviousBtn.setText(R.string.assessment_previous); mPreviousUnitLbl.setVisibility(View.GONE); } }

Target:
private void tryToUpdateForEndOfSequential(){ int curIndex = pager.getCurrentItem(); setCurrentUnit(pagerAdapter.getUnit(curIndex)); mPreviousBtn.setEnabled(curIndex > 0); mNextBtn.setEnabled(curIndex < pagerAdapter.getCount() - 1); findViewById(R.id.course_unit_nav_bar).requestLayout(); setTitle(selectedUnit.getDisplayName()); String currentSubsectionId = selectedUnit.getParent().getId(); if (curIndex + 1 <= pagerAdapter.getCount() - 1) { String nextUnitSubsectionId = unitList.get(curIndex + 1).getParent().getId(); if (currentSubsectionId.equalsIgnoreCase(nextUnitSubsectionId)) { mNextUnitLbl.setVisibility(View.GONE); mNextBtn.setText(R.string.assessment_next); } else { mNextUnitLbl.setText(unitList.get(curIndex + 1).getParent().getName()); mNextUnitLbl.setVisibility(View.VISIBLE); mNextBtn.setText(R.string.assessment_next_unit); } } else { mNextBtn.setText(R.string.assessment_next); mNextUnitLbl.setVisibility(View.GONE); } if (curIndex - 1 >= 0) { String prevUnitSubsectionId = unitList.get(curIndex - 1).getParent().getId(); if (currentSubsectionId.equalsIgnoreCase(prevUnitSubsectionId)) { mPreviousUnitLbl.setVisibility(View.GONE); mPreviousBtn.setText(R.string.assessment_previous); } else { mPreviousUnitLbl.setText(unitList.get(curIndex - 1).getParent().getName()); mPreviousUnitLbl.setVisibility(View.VISIBLE); mPreviousBtn.setText(R.string.assessment_previous_unit); } } else { mPreviousBtn.setText(R.string.assessment_previous); mPreviousUnitLbl.setVisibility(View.GONE); } }
Source:
public void onNodeTimeout() { String dataNodeStr; try { dataNodeStr = toJSONObject().toString(); } catch (JSONException e) { dataNodeStr = null; } logger.info("Node [" + dataNodeStr + "] timed out, informing resource state"); if (dataNodeStatePolicy.onError()) { logger.info("Node [" + dataNodeStr + "] was determined to be down"); } }

Target:
public void onNodeTimeout() { dataNodeStatePolicy.onError(); }
Source:
public final int formalKeyLookup(final String name) { if(!naturalKeyTable.containsKey(name)) { throw new IllegalArgumentException("Unrecognized formal key name: " + name); } return naturalKeyTable.get(name).intValue(); }

Target:
public final int formalKeyLookup(final String name) { final Integer value = naturalKeyTable.get(name); if (value == null) { throw new IllegalArgumentException("Unrecognized formal key name: " + name); } return value.intValue(); }
Source:
public SwitchUserWebFilter(ReactiveUserDetailsService userDetailsService, String successTargetUrl, @Nullable String failureTargetUrl) { Assert.notNull(userDetailsService, "userDetailsService must be specified"); Assert.notNull(successTargetUrl, "successTargetUrl must be specified"); this.userDetailsService = userDetailsService; this.successHandler = new RedirectServerAuthenticationSuccessHandler(successTargetUrl); this.failureHandler = Optional.ofNullable(failureTargetUrl). map(RedirectServerAuthenticationFailureHandler::new).orElse(null); this.securityContextRepository = new WebSessionServerSecurityContextRepository(); this.userDetailsChecker = new AccountStatusUserDetailsChecker(); }

Target:
public SwitchUserWebFilter(ReactiveUserDetailsService userDetailsService, String successTargetUrl, @Nullable String failureTargetUrl) { Assert.notNull(userDetailsService, "userDetailsService must be specified"); Assert.notNull(successTargetUrl, "successTargetUrl must be specified"); this.userDetailsService = userDetailsService; this.successHandler = new RedirectServerAuthenticationSuccessHandler(successTargetUrl); if (failureTargetUrl != null) { this.failureHandler = new RedirectServerAuthenticationFailureHandler(failureTargetUrl); } else { this.failureHandler = null; } this.securityContextRepository = new WebSessionServerSecurityContextRepository(); this.userDetailsChecker = new AccountStatusUserDetailsChecker(); }
Source:
public Stroll() { Gdx.app.log(TAG, "Started new stroll"); cRewards = 0; cEventGoing = false; cEventThreshold = BASE_THRESHOLD; cFinished = false; cEndStrollSubject = new Subject(); cNewEventSubject = new Subject(); cEndEventSubject = new Subject(); StandUp.getInstance().getUpdateSubject().addObserver(this); StandUp.getInstance().getAccelerationStatus().getSubject().addObserver(cUpdateMovementObserver); cStrollTimer = TimerStore.getInstance().getTimer(Timer.Global.STROLL.name()); cStrollTimer.getStopSubject().addObserver(cStrollStopObserver); cStrollTimer.reset(); }

Target:
public Stroll() { Gdx.app.log(TAG, "Started new stroll"); cRewards = new ArrayList<Integer>(); cEventGoing = false; cEventThreshold = getAmplifier(StandUp.getInstance(). getAccelerationStatus().getAccelerationState()); cFinished = false; cEndStrollSubject = new Subject(); cNewEventSubject = new Subject(); cEndEventSubject = new Subject(); StandUp.getInstance().getUpdateSubject().addObserver(this); StandUp.getInstance().getAccelerationStatus(). getSubject().addObserver(cUpdateMovementObserver); cStrollTimer = TimerStore.getInstance().getTimer(Timer.Global.STROLL.name()); cStrollTimer.getStopSubject().addObserver(cStrollStopObserver); cStrollTimer.reset(); }
Source:
public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(super.toConfig()); String streamId = getStreamId(); getOffsetDefault().ifPresent(od -> configs.put(String.format(OFFSET_DEFAULT_CONFIG_KEY, streamId), od.name().toLowerCase())); isResetOffset().ifPresent(resetOffset -> configs.put(String.format(RESET_OFFSET_CONFIG_KEY, streamId), Boolean.toString(resetOffset))); getPriority().ifPresent(priority -> configs.put(String.format(PRIORITY_CONFIG_KEY, streamId), Integer.toString(priority))); isBootstrap().ifPresent(bootstrap -> configs.put(String.format(BOOTSTRAP_CONFIG_KEY, streamId), Boolean.toString(bootstrap))); isBounded().ifPresent(bounded -> configs.put(String.format(BOUNDED_CONFIG_KEY, streamId), Boolean.toString(bounded))); shouldDeleteCommittedMessages().ifPresent(deleteCommittedMessages -> configs.put(String.format(DELETE_COMMITTED_MESSAGES_CONFIG_KEY, streamId), Boolean.toString(deleteCommittedMessages))); return Collections.unmodifiableMap(configs); }

Target:
public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(super.toConfig()); String streamId = getStreamId(); this.offsetDefaultOptional.ifPresent(od -> configs.put(String.format(OFFSET_DEFAULT_CONFIG_KEY, streamId), od.name().toLowerCase())); this.resetOffsetOptional.ifPresent(resetOffset -> configs.put(String.format(RESET_OFFSET_CONFIG_KEY, streamId), Boolean.toString(resetOffset))); this.priorityOptional.ifPresent(priority -> configs.put(String.format(PRIORITY_CONFIG_KEY, streamId), Integer.toString(priority))); this.isBootstrapOptional.ifPresent(bootstrap -> configs.put(String.format(BOOTSTRAP_CONFIG_KEY, streamId), Boolean.toString(bootstrap))); this.isBoundedOptional.ifPresent(bounded -> configs.put(String.format(BOUNDED_CONFIG_KEY, streamId), Boolean.toString(bounded))); this.deleteCommittedMessagesOptional.ifPresent(deleteCommittedMessages -> configs.put(String.format(DELETE_COMMITTED_MESSAGES_CONFIG_KEY, streamId), Boolean.toString(deleteCommittedMessages))); return Collections.unmodifiableMap(configs); }
Source:
public String getPrettyName() { return prettyName == null ? "" : prettyName; }

Target:
public String getPrettyName() { return prettyName; }
Source:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { Map<String, TmfAnalysisRequirement> requirements = new HashMap<>(); String eventNameType = TmfXmlStrings.TYPE_EVENT_NAME; requirements.put(eventNameType, new TmfAnalysisRequirement(eventNameType)); NodeList eventHandlerElements = fSourceElement.getElementsByTagName(TmfXmlStrings.EVENT_HANDLER); for (int i = 0; i < eventHandlerElements.getLength(); i++) { String eventName = ((Element) eventHandlerElements.item(i)).getAttribute(eventNameType); requirements.get(eventNameType).addValue(eventName, AnalysisRequirementValueLevel.MANDATORY); } return requirements.values(); }

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { String eventNameType = TmfXmlStrings.TYPE_EVENT_NAME; TmfAnalysisRequirement requirement = new TmfAnalysisRequirement(eventNameType); for (Element eventHandler : XmlUtils.getChildElements(fSourceElement, TmfXmlStrings.EVENT_HANDLER)) { String eventName = eventHandler.getAttribute(eventNameType); requirement.addValue(eventName, ValuePriorityLevel.MANDATORY); } return Collections.singleton(requirement); }
Source:
public void setPrettyPrinterInitializer(AsyncPrettyPrinterInitializer initializer) { mPrettyPrinterInitializer = Util.throwIfNull(initializer); }

Target:
public void setPrettyPrinterInitializer(AsyncPrettyPrinterInitializer initializer) { Util.throwIfNotNull(mPrettyPrinterInitializer); mPrettyPrinterInitializer = Util.throwIfNull(initializer); }
Source:
protected boolean validate() { NetworkValidator validator = new NetworkValidator(vmDao, getNetworkDao().get(getNetwork().getId())); ValidationResult providerValidationResult = validateRemoveExternalNetwork(); return validate(validator.networkIsSet(getParameters().getId())) && validate(validator.notRemovingManagementNetwork()) && validate(validator.notIscsiBondNetwork()) && validate(validator.networkNotUsedByVms()) && validate(validator.networkNotUsedByTemplates()) && validate(providerValidationResult); }

Target:
protected boolean validate() { NetworkValidator validator = new NetworkValidator(vmDao, getNetworkDao().get(getNetwork().getId())); return validate(validator.networkIsSet(getParameters().getId())) && validate(validator.notRemovingManagementNetwork()) && validate(validator.notIscsiBondNetwork()) && validate(validator.networkNotUsedByVms()) && validate(validator.networkNotUsedByTemplates()) && validate(getRemoveExternalNetworkValidationResult()); }
Source:
public int hashCode() { if (elements == null) { return Objects.hash(comparer); } int r = 1; if (comparer != null) { r = 31 + comparer.hashCode(); for (Object e : elements) { r = 31 * r + (e == null ? 0 : comparer.hashCode(e)); } } else { Arrays.hashCode(elements); } return r; }

Target:
public int hashCode() { if (elements == null) { return Objects.hash(comparer); } int r; if (comparer != null) { r = 31 + comparer.hashCode(); for (Object e : elements) { r = 31 * r + (e == null ? 0 : comparer.hashCode(e)); } } else { r = Arrays.hashCode(elements); } return r; }
Source:
public String getCaptchaUrl(Site site) { return site.getFullPath("index.php") + "?title=Special:Captcha/image&wpCaptchaId=" + captchaId; }

Target:
public String getCaptchaUrl(Site site) { return site.getFullUrl("index.php") + "?title=Special:Captcha/image&wpCaptchaId=" + captchaId; }
Source:
public void visitMethod(MethodTree tree) { if (isConstructor(tree)) { final Set<String> methodParams = methodParams(tree); final Set<Tree> errors = Sets.newHashSet(); tree.accept(new BaseTreeVisitor() { @Override public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { if (classVisitor.annotatedVariables.contains(tree.identifier().symbol().name())) { errors.add(tree); } super.visitMemberSelectExpression(tree); } @Override public void visitIdentifier(IdentifierTree tree) { if (tree.symbol().isVariableSymbol()) { if (!methodParams.contains(tree.symbol().name())) { if (classVisitor.annotatedVariables.contains(tree.symbol().name())) { errors.add(tree); } } } super.visitIdentifier(tree); } }); for (Tree error : errors) { context.addIssue(error, this, RULE_MESSAGE); } } super.visitMethod(tree); }

Target:
public void visitMethod(MethodTree tree) { if (tree.is(MethodTree.Kind.CONSTRUCTOR)) { CheckUsageInConstructorVisitor visitor = new CheckUsageInConstructorVisitor(methodParams(tree)); tree.accept(visitor); for (Tree error : visitor.getErrors()) { context.addIssue(error, this, RULE_MESSAGE); } } super.visitMethod(tree); }
Source:
private void parse(File targetFile) throws IOException { BufferedReader br = new BufferedReader(new FileReader(targetFile)); String txt; while ((txt = br.readLine()) != null) { txt = txt.trim(); if (txt.length() > 0 && !txt.startsWith("#")) { rules.add(new IgnoreRule(txt)); } } }

Target:
private void parse(File targetFile) throws IOException { BufferedReader br = new BufferedReader(new FileReader(targetFile)); String txt; try { while ((txt = br.readLine()) != null) { txt = txt.trim(); if (txt.length() > 0 && !txt.startsWith("#")) { rules.add(new IgnoreRule(txt)); } } } catch (IOException e) { throw e; } finally { br.close(); } }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FUNCDEF, ctx -> { FunctionDef functionDef = (FunctionDef) ctx.syntaxNode(); ControlFlowGraph cfg = ControlFlowGraph.build(functionDef, ctx.pythonFile()); if (cfg == null) { return; } LiveVariablesAnalysis lva = analyze(cfg); Set<CfgBlock> unreachableBlocks = CfgUtils.unreachableBlocks(cfg); cfg.blocks().forEach(block -> { List<DeadStoreUtils.UnnecessaryAssignment> unnecessaryAssignments = DeadStoreUtils.findUnnecessaryAssignments(block, lva.getLiveVariables(block), functionDef); unnecessaryAssignments.stream() .filter((assignment -> isParameter(assignment.element))) .filter(assignment -> assignment.symbol.usages().stream().filter(Usage::isBindingUsage).count() > 1) .filter(assignment -> !isSymbolUsedInUnreachableBlocks(lva.getLiveVariables(block), unreachableBlocks, assignment.symbol)) .filter((assignment -> !isUsedInSubFunction(assignment.symbol, functionDef))) .forEach(assignment -> ctx.addIssue(assignment.element, String.format(MESSAGE_TEMPLATE, assignment.symbol.name()))); }); }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FUNCDEF, ctx -> { FunctionDef functionDef = (FunctionDef) ctx.syntaxNode(); ControlFlowGraph cfg = ControlFlowGraph.build(functionDef, ctx.pythonFile()); if (cfg == null) { return; } LiveVariablesAnalysis lva = LiveVariablesAnalysis.analyze(cfg); Set<CfgBlock> unreachableBlocks = CfgUtils.unreachableBlocks(cfg); cfg.blocks().forEach(block -> { List<DeadStoreUtils.UnnecessaryAssignment> unnecessaryAssignments = DeadStoreUtils.findUnnecessaryAssignments(block, lva.getLiveVariables(block), functionDef); unnecessaryAssignments.stream() .filter((assignment -> isParameter(assignment.element))) .filter(assignment -> assignment.symbol.usages().stream().filter(Usage::isBindingUsage).count() > 1) .filter(assignment -> !isSymbolUsedInUnreachableBlocks(lva, unreachableBlocks, assignment.symbol)) .filter((assignment -> !isUsedInSubFunction(assignment.symbol, functionDef))) .forEach(assignment -> ctx.addIssue(assignment.element, String.format(MESSAGE_TEMPLATE, assignment.symbol.name()))); }); }); }
Source:
protected void addPages() { try { gettingStartedPage = new GettingStartedHtmlPage(this); int index = addPage(gettingStartedPage); if (gettingStartedImage == null) { gettingStartedImage = JBossCentralActivator.getImageDescriptor( "/icons/gettingStarted.png").createImage(); } setPageImage(index, gettingStartedImage); if (!new EclipseUserAgent().getApplicationName().contains("rh-eclipse")) { softwarePage = new SoftwarePage(this); index = addPage(softwarePage); if (softwareImage == null) { softwareImage = JBossCentralActivator.getImageDescriptor( "/icons/software.png").createImage(); } setPageImage(index, softwareImage); } } catch (PartInitException e) { JBossCentralActivator.log(e, "Error adding page"); } }

Target:
protected void addPages() { try { gettingStartedPage = new GettingStartedHtmlPage(this); int index = addPage(gettingStartedPage); if (gettingStartedImage == null) { gettingStartedImage = JBossCentralActivator.getImageDescriptor( "/icons/gettingStarted.png").createImage(); } setPageImage(index, gettingStartedImage); String applicationName = JBossToolsUsageActivator.getDefault().getJBossToolsEclipseEnvironment().getEclipseUserAgent().getApplicationName(); if (!applicationName.contains("|Devstudio")) { softwarePage = new SoftwarePage(this); index = addPage(softwarePage); if (softwareImage == null) { softwareImage = JBossCentralActivator.getImageDescriptor( "/icons/software.png").createImage(); } setPageImage(index, softwareImage); } else { JBossCentralActivator.logWarning("JBoss Tools installed via a package manager. \"Software/Update\" is disabled for Red Hat Central. Detected application name with installed packages: \"" + applicationName + "\""); } } catch (PartInitException e) { JBossCentralActivator.log(e, "Error adding page"); } }
Source:
public static ControlFlowGraph build(Tree tree, CheckContext context) { if (failedTrees.contains(tree)) { return null; } try { switch (tree.getKind()) { case FUNCTION_DECLARATION: return build(((FunctionDeclarationTree) tree).body()); case FUNCTION_EXPRESSION: return build(((FunctionExpressionTree) tree).body()); case METHOD_DECLARATION: Tree body = ((MethodDeclarationTree) tree).body(); if (body.is(Tree.Kind.BLOCK)) { return build(((BlockTree) body)); } else { return null; } case SCRIPT: return build(((ScriptTree) tree)); default: throw new IllegalStateException("Unexpected tree kind " + tree.getKind()); } } catch (Exception e) { LOG.warn("Failed to build control flow graph for file at line caused by : {}", context.getPhpFile().toString(), ((PHPTree) tree).getLine(), e.getCause()); LOG.debug(() -> Throwables.getStackTraceAsString(e)); failedTrees.add(tree); } return null; }

Target:
public static ControlFlowGraph build(Tree tree, CheckContext context) { if (failedTrees.contains(tree)) { return null; } try { switch (tree.getKind()) { case FUNCTION_DECLARATION: return build(((FunctionDeclarationTree) tree).body()); case FUNCTION_EXPRESSION: return build(((FunctionExpressionTree) tree).body()); case METHOD_DECLARATION: Tree body = ((MethodDeclarationTree) tree).body(); if (body.is(Tree.Kind.BLOCK)) { return build(((BlockTree) body)); } else { return null; } case SCRIPT: return build(((ScriptTree) tree)); default: throw new IllegalStateException("Unexpected tree kind " + tree.getKind()); } } catch (Exception e) { LOG.warn("Failed to build control flow graph for file at line (activate debug logs for more details)", context.getPhpFile().toString(), ((PHPTree) tree).getLine()); LOG.debug(() -> Throwables.getStackTraceAsString(e)); failedTrees.add(tree); } return null; }
Source:
void apply(File path, boolean delete, Properties templateProperties) throws IOException { if (path.getName().startsWith(".") || path.isHidden() || path.getName().endsWith("~")) { LOGGER.info("Skip {}", path.getAbsolutePath()); } if (path.isDirectory()) { File[] files = path.listFiles(); Arrays.sort(files); if (delete) { ArrayUtils.reverse(files); } for (File f : files) { apply(f, delete, templateProperties); } } else if (path.isFile()) { K8sSpecTemplate specTemplate = new K8sSpecTemplate(); String template = specTemplate.render(path); specTemplate.loadProperties(templateProperties); ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable<HasMetadata, Boolean> k8sObjects = client.load(IOUtils.toInputStream(template, StandardCharsets.UTF_8)); LOGGER.info("Apply with K8s Objects", path.getAbsolutePath(), k8sObjects.get().size()); LOGGER.debug(template); if (delete) { k8sObjects.inNamespace(namespace).delete(); } else { k8sObjects.inNamespace(namespace).createOrReplace(); } } else { LOGGER.error("Can't apply {}", path.getAbsolutePath()); } }

Target:
void apply(File path, boolean delete, Properties templateProperties) throws IOException { if (path.getName().startsWith(".") || path.isHidden() || path.getName().endsWith("~")) { LOGGER.info("Skip {}", path.getAbsolutePath()); } if (path.isDirectory()) { File[] files = path.listFiles(); Arrays.sort(files); if (delete) { ArrayUtils.reverse(files); } for (File f : files) { apply(f, delete, templateProperties); } } else if (path.isFile()) { K8sSpecTemplate specTemplate = new K8sSpecTemplate(); specTemplate.loadProperties(templateProperties); String template = specTemplate.render(path); ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable<HasMetadata, Boolean> k8sObjects = client.load(IOUtils.toInputStream(template, StandardCharsets.UTF_8)); LOGGER.info("Apply with K8s Objects", path.getAbsolutePath(), k8sObjects.get().size()); LOGGER.debug(template); if (delete) { k8sObjects.inNamespace(namespace).delete(); } else { k8sObjects.inNamespace(namespace).createOrReplace(); } } else { LOGGER.error("Can't apply {}", path.getAbsolutePath()); } }
Source:
public static void CustomOfflineSnackbar(View view) { Snackbar.make(view, "Offline Mode (No Internet)", Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.DKGRAY) .show(); }

Target:
public static void CustomOfflineSnackbar(View view) { Snackbar.make(view, R.string.SnackbarOfflineText, Snackbar.LENGTH_INDEFINITE) .setActionTextColor(Color.DKGRAY) .show(); }
Source:
public static HashCode buildTreeHashFromMap(Map<Integer, HashCode> map) { SortedMap<Integer, HashCode> sortedMap = ImmutableSortedMap.copyOf(map); ArrayList<HashCode> list = Lists.newArrayList(); for (Map.Entry<Integer, HashCode> entry : sortedMap.entrySet()) { list.add(entry.getValue()); } return hashList(list).remove(0); }

Target:
public static HashCode buildTreeHashFromMap(Map<Integer, HashCode> map) { checkArgument(!map.isEmpty(), "The map cannot be empty."); return hashList(ImmutableSortedMap.copyOf(map).values()); }
Source:
private void initContent() { setLayout(new FillLayout()); fGlobalPC = null; fTimeRangePC = null; mouseListenerGlobal = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = getGlobalPC(); switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = "Name = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += "Event Count = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; mouseListenerSelection = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = getTimeRangePC(); switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = "Name = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += "Event Count = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; setCurrentState(new PieChartViewerStateNoContentSelected(this)); }

Target:
private void initContent() { setLayout(new FillLayout()); fGlobalPC = null; fTimeRangePC = null; fMouseListener = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = (PieChart) event.widget; switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; setCurrentState(new PieChartViewerStateNoContentSelected(this)); }
Source:
public void testSetsTextViewCharSequence() { final PublishSubject<String> subject = PublishSubject.create(); subject.subscribe(ViewActions.setText(textView)); subject.onNext("Hello"); verify(textView, times(1)).setText("Hello"); subject.onNext("World"); verify(textView, times(1)).setText("World"); }

Target:
public void testSetsTextViewCharSequence() { final PublishSubject<String> subject = PublishSubject.create(); subject.subscribe(ViewActions.setText(textView)); subject.onNext("Hello"); verify(textView).setText("Hello"); subject.onNext("World"); verify(textView).setText("World"); }
Source:
public void handleData(final ITmfEvent event) { super.handleData(event); if (isCancelled()) { return; } try { if (fFilter == null || fFilter.matches(event)) { if (fTable != null) { ITmfEventField[] fields = fTable.extractItemFields(event); boolean needTab = false; for (ITmfEventField field: fields) { if (needTab) { fWriter.write('\t'); } fWriter.write(field.getValue().toString()); needTab = true; } } else { fWriter.write(event.getTimestamp().toString()); fWriter.write('\t'); fWriter.write(event.getSource()); fWriter.write('\t'); fWriter.write(event.getType().getName()); fWriter.write('\t'); fWriter.write(event.getReference()); fWriter.write('\t'); ITmfEventField content = event.getContent(); String value = content.getFormattedValue(); fWriter.write(value); } fWriter.write('\n'); } } catch (IOException ex) { fIOException = ex; fail(); } }

Target:
public void handleData(final ITmfEvent event) { super.handleData(event); if (isCancelled()) { return; } try { if (fFilter == null || fFilter.matches(event)) { if (fTable != null) { ITmfEventField[] fields = fTable.getItemFields(event); boolean needTab = false; for (ITmfEventField field: fields) { if (needTab) { fWriter.write('\t'); } Object value = field.getValue(); printValue(value); needTab = true; } } else { fWriter.write(event.getTimestamp().toString()); fWriter.write('\t'); fWriter.write(event.getSource()); fWriter.write('\t'); fWriter.write(event.getType().getName()); fWriter.write('\t'); fWriter.write(event.getReference()); fWriter.write('\t'); ITmfEventField content = event.getContent(); printValue(content.getValue()); } fWriter.write('\n'); } } catch (IOException ex) { fIOException = ex; fail(); } }
Source:
public MachineSource saveToSnapshot(String owner) throws MachineException { try { final String repository = generateRepository(); String comment = format("Suspended at %1$ta %1$tb %1$td %1$tT %1$tZ %1$tY", System.currentTimeMillis()); if (owner != null) { comment = comment + " by " + owner; } final String LATEST_TAG = "latest"; docker.commit(container, registry + '/' + repository, LATEST_TAG, comment, owner); Thread.sleep(2000); final ProgressLineFormatterImpl progressLineFormatter = new ProgressLineFormatterImpl(); String digest = docker.push(repository, LATEST_TAG, registry, currentProgressStatus -> { try { outputConsumer.writeLine(progressLineFormatter.format(currentProgressStatus)); } catch (IOException ignored) { } }); docker.removeImage(registry + '/' + repository, false); return new DockerMachineSource(repository).setRegistry(registry).setDigest(digest).setTag(LATEST_TAG); } catch (IOException e) { throw new MachineException(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MachineException(e.getLocalizedMessage(), e); } }

Target:
public MachineSource saveToSnapshot(String owner) throws MachineException { try { final String repository = generateRepository(); if(!snapshotUseRegistry) { commitContainer(owner, repository, LATEST_TAG); return new DockerMachineSource(repository).withTag(LATEST_TAG); } final String repositoryName = registry + '/' + repository; commitContainer(owner, repositoryName, LATEST_TAG); Thread.sleep(2000); final ProgressLineFormatterImpl lineFormatter = new ProgressLineFormatterImpl(); final String digest = docker.push(PushParams.create(repository) .withTag(LATEST_TAG) .withRegistry(registry), progressMonitor -> { try { outputConsumer.writeLine(lineFormatter.format(progressMonitor)); } catch (IOException ignored) { } }); docker.removeImage(RemoveImageParams.create(repositoryName).withForce(false)); return new DockerMachineSource(repository).withRegistry(registry).withDigest(digest).withTag(LATEST_TAG); } catch (IOException ioEx) { throw new MachineException(ioEx); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MachineException(e.getLocalizedMessage(), e); } }
Source:
public void testFirstWantValidCapabilityNames() throws PackProtocolException { List<String> validNames = Arrays.asList( "c", "cap", "C", "CAP", "1", "1cap", "cap-64k_test", "-", "-cap", "_", "_cap", "agent=pack.age/Version", "cap(this_is_valid!)"); for (String capability: validNames) { FirstWant r = FirstWant.fromLine(makeFirstWantLine(capability)); assertEquals(r.getCapabilities().size(), 1); assertTrue(r.getCapabilities().contains(capability)); } }

Target:
public void testFirstWantValidCapabilityNames() throws PackProtocolException { List<String> validNames = Arrays.asList( "c", "cap", "C", "CAP", "1", "1cap", "cap-64k_test", "-", "-cap", "_", "_cap", "agent=pack.age/Version"); for (String capability: validNames) { FirstWant r = FirstWant.fromLine(makeFirstWantLine(capability)); assertEquals(r.getCapabilities().size(), 1); assertTrue(r.getCapabilities().contains(capability)); } }
Source:
private void executeCoordinatorTasks() { applicationEventReceiver = new ApplicationEventReceiver(); applicationEventReceiver.setExecutorService(executorService); applicationEventReceiver.execute(); if (log.isInfoEnabled()) { log.info("Application event receiver thread started"); } clusterStatusTopicReceiver = new ClusterStatusTopicReceiver(); clusterStatusTopicReceiver.setExecutorService(executorService); clusterStatusTopicReceiver.execute(); if (log.isInfoEnabled()) { log.info("Cluster status event receiver thread started"); } instanceStatusTopicReceiver = new InstanceStatusTopicReceiver(); instanceStatusTopicReceiver.setExecutorService(executorService); instanceStatusTopicReceiver.execute(); if (log.isInfoEnabled()) { log.info("Instance status event receiver thread started"); } initializerTopicReceiver = new InitializerTopicReceiver(); initializerTopicReceiver.setExecutorService(executorService); initializerTopicReceiver.execute(); if (log.isInfoEnabled()) { log.info("Initializer event receiver thread started"); } if (log.isInfoEnabled()) { log.info("Scheduling topology synchronizer task"); } ComponentStartUpSynchronizer componentStartUpSynchronizer = ServiceReferenceHolder.getInstance().getComponentStartUpSynchronizer(); if (componentStartUpSynchronizer.isEnabled()) { componentStartUpSynchronizer.addEventListener(new ComponentActivationEventListener() { @Override public void activated(Component component) { if (component == Component.CloudController) { scheduleEventSynchronizers(); } } }); } else { scheduleEventSynchronizers(); } }

Target:
private void executeCoordinatorTasks() { applicationEventReceiver = new ApplicationEventReceiver(); applicationEventReceiver.setExecutorService(executorService); applicationEventReceiver.execute(); if (log.isInfoEnabled()) { log.info("Application event receiver thread started"); } clusterStatusTopicReceiver = new ClusterStatusTopicReceiver(); clusterStatusTopicReceiver.setExecutorService(executorService); clusterStatusTopicReceiver.execute(); if (log.isInfoEnabled()) { log.info("Cluster status event receiver thread started"); } instanceStatusTopicReceiver = new InstanceStatusTopicReceiver(); instanceStatusTopicReceiver.setExecutorService(executorService); instanceStatusTopicReceiver.execute(); if (log.isInfoEnabled()) { log.info("Instance status event receiver thread started"); } initializerTopicReceiver = new InitializerTopicReceiver(); initializerTopicReceiver.setExecutorService(executorService); initializerTopicReceiver.execute(); if (log.isInfoEnabled()) { log.info("Initializer event receiver thread started"); } if (log.isInfoEnabled()) { log.info("Scheduling topology synchronizer task"); } Runnable topologySynchronizer = new TopologyEventSynchronizer(); scheduler.scheduleAtFixedRate(topologySynchronizer, 0, 1, TimeUnit.MINUTES); }
Source:
private static NamedDataSchema checkForErrorsAndGetTopLevelSchema( File file, String schemaFullname, PegasusSchemaParser parser, StringBuilder errorMessages) { StringBuilder errorMessageBuilder = parser.errorMessageBuilder(); if (errorMessageBuilder.length() > 0) { errorMessages.append("Failed to parse schema: ") .append(file.getAbsolutePath()) .append("\nfullname: ") .append(schemaFullname) .append("\nerrors: ") .append(errorMessageBuilder.toString()) .append("\n"); return null; } List<DataSchema> topLevelSchemas = parser.topLevelDataSchemas(); if (topLevelSchemas.size() != 1) { errorMessages.append("Expected one top level schema for: ") .append(file.getAbsolutePath()) .append(" but got ") .append(topLevelSchemas.size()) .append(" schemas.") .append("\n"); return null; } DataSchema sourceSchema = topLevelSchemas.get(0); if (!(sourceSchema instanceof NamedDataSchema)) { errorMessages.append("Parsed top-level schema does not match the schema file name. File: ") .append(file.getAbsolutePath()) .append("\n parsedSchemaName: ") .append(sourceSchema.getUnionMemberKey()) .append("\n"); return null; } return (NamedDataSchema) sourceSchema; }

Target:
private static NamedDataSchema checkForErrorsAndGetTopLevelSchema( File file, String schemaFullname, PegasusSchemaParser parser, StringBuilder errorMessages) { StringBuilder errorMessageBuilder = parser.errorMessageBuilder(); if (errorMessageBuilder.length() > 0) { errorMessages.append("Failed to parse schema: ") .append(file.getAbsolutePath()) .append("\nfullname: ") .append(schemaFullname) .append("\nerrors: ") .append(errorMessageBuilder.toString()) .append("\n"); return null; } List<DataSchema> topLevelSchemas = parser.topLevelDataSchemas(); if (topLevelSchemas.size() != 1) { errorMessages.append("Expected one top level schema for: ") .append(file.getAbsolutePath()) .append(" but got ") .append(topLevelSchemas.size()) .append(" schemas.") .append("\n"); return null; } DataSchema sourceSchema = topLevelSchemas.get(0); if (!(sourceSchema instanceof NamedDataSchema) || !((NamedDataSchema) sourceSchema).getFullName().equals(schemaFullname)) { errorMessages.append("Parsed top-level schema does not match the schema file name. File: ") .append(file.getAbsolutePath()) .append("\n parsedSchemaName: ") .append(sourceSchema.getUnionMemberKey()) .append("\n"); return null; } return (NamedDataSchema) sourceSchema; }
Source:
public void run() { try { if(ESReindexationProcessStatus.inFullReindexation()) return; } catch (DotDataException e2) { Logger.warn(this, "can't determine if we're in full reindex",e2); } int minutes = Config.getIntProperty("DIST_REINDEX_JOURNAL_CLEANUP_MINUTES", 30); try { Logger.debug(this, "About to delete dist_reindex_journal entries older than "+ minutes +" minute(s)"); HibernateUtil.startTransaction(); APILocator.getDistributedJournalAPI().distReindexJournalCleanup(minutes, false, true, DateType.MINUTE); HibernateUtil.closeAndCommitTransaction(); } catch (Exception e) { Logger.error(this, "Error ocurred while trying to delete dist_reindex_journal entries older than "+ minutes +" minute(s)", e); try { HibernateUtil.rollbackTransaction(); } catch (DotHibernateException e1) { Logger.error(this, e1.getMessage(), e1); } } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.error(this, e.getMessage(), e); } } }

Target:
public void run() { try { if(ESReindexationProcessStatus.inFullReindexation()) return; } catch (DotDataException e2) { Logger.warn(this, "can't determine if we're in full reindex",e2); } int minutes = Config.getIntProperty("DIST_REINDEX_JOURNAL_CLEANUP_MINUTES", 30); try { Logger.debug(this, "About to delete dist_reindex_journal entries older than "+ minutes +" minute(s)"); HibernateUtil.startTransaction(); APILocator.getDistributedJournalAPI().distReindexJournalCleanup(minutes, false, true, DateType.MINUTE); HibernateUtil.closeAndCommitTransaction(); } catch (Exception e) { Logger.error(this, "Error ocurred while trying to delete dist_reindex_journal entries older than "+ minutes +" minute(s)", e); try { HibernateUtil.rollbackTransaction(); } catch (DotHibernateException e1) { Logger.error(this, e1.getMessage(), e1); } } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.error(this, e.getMessage(), e); } DbConnectionFactory.closeConnection(); } }
Source:
public Object[] factory() { return Arrays.stream(StorageType.values()) .flatMap(type -> Stream.builder() .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.DIST_SYNC).transactional(true).lockingMode(LockingMode.OPTIMISTIC)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.DIST_SYNC).transactional(true).lockingMode(LockingMode.PESSIMISTIC)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.DIST_SYNC).transactional(false)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.REPL_SYNC).transactional(true).lockingMode(LockingMode.OPTIMISTIC)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.REPL_SYNC).transactional(true).lockingMode(LockingMode.PESSIMISTIC)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.REPL_SYNC).transactional(false)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.SCATTERED_SYNC).transactional(false)) .build() ).toArray(); }

Target:
public Object[] factory() { return Arrays.stream(StorageType.values()) .flatMap(type -> Stream.builder() .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.DIST_SYNC).transactional(true).lockingMode(LockingMode.OPTIMISTIC)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.DIST_SYNC).transactional(true).lockingMode(LockingMode.PESSIMISTIC)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.DIST_SYNC).transactional(false)) .add(new ClusterExpirationFunctionalTest().storageType(type).cacheMode(CacheMode.SCATTERED_SYNC).transactional(false)) .build() ).toArray(); }
Source:
public InvalidOperatorNegationException() { super(HttpStatus.SC_FORBIDDEN, "Invalid Usage of NOT in FilterExpression."); }

Target:
public InvalidOperatorNegationException() { super(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Invalid usage of NOT in FilterExpression."); }
Source:
public BitVectorImpl(long initialSize) { if (initialSize < 0) { throw new IllegalArgumentException("Wrong bit vector size '" + initialSize + "'. Bit vector size must be non-negative."); } this.array = new long[getMinimumArraySize(initialSize)]; this.size = 0; }

Target:
public BitVectorImpl(long initialSize) { if (initialSize < 0) { throw new IllegalArgumentException("Wrong bit vector size '" + initialSize + "'. Bit vector size must be non-negative."); } this.arrayOfBits = new long[getMinimumArraySize(initialSize)]; this.size = initialSize; }
Source:
public void testDistributedSQLForOnlyVALUEIterationType() throws InterruptedException { dsDistributedMap4.put(1, new User(1, "TestName1", "TestSurname1", 10)); dsDistributedMap4.put(2, new User(2, "TestName2", "TestSurname2", 20)); dsDistributedMap4.put(3, new User(3, "TestName3", "TestSurname3", 30)); dsDistributedMap4.put(4, new User(4, "TestName4", "TestSurname4", 40)); dsDistributedMap4.put(5, new User(5, "TestName5", "TestSurname5", 50)); Message<?> msg = null; for (int i = 0; i < 10; i++) { msg = dsMapChannel4.receive(); if (((Collection) msg.getPayload()).iterator().hasNext()) { break; } Thread.sleep(1_000); } Assert.assertNotNull(msg); Assert.assertNotNull(msg.getPayload()); Assert.assertTrue(msg.getPayload() instanceof Collection); Assert.assertEquals(3, ((User) (((Collection) msg.getPayload()).iterator().next())).getId()); Assert.assertEquals("TestName3", ((User) (((Collection) msg.getPayload()).iterator().next())).getName()); Assert.assertEquals("TestSurname3", ((User) (((Collection) msg.getPayload()).iterator().next())).getSurname()); }

Target:
public void testDistributedSQLForOnlyVALUEIterationType() throws InterruptedException { dsDistributedMap4.put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1", 10)); dsDistributedMap4.put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2", 20)); dsDistributedMap4.put(3, new HazelcastIntegrationTestUser(3, "TestName3", "TestSurname3", 30)); dsDistributedMap4.put(4, new HazelcastIntegrationTestUser(4, "TestName4", "TestSurname4", 40)); dsDistributedMap4.put(5, new HazelcastIntegrationTestUser(5, "TestName5", "TestSurname5", 50)); Message<?> msg = dsMapChannel4.receive(2_000); Assert.assertNotNull(msg); Assert.assertNotNull(msg.getPayload()); Assert.assertTrue(msg.getPayload() instanceof Collection); Assert.assertEquals(3, ((HazelcastIntegrationTestUser) (((Collection<?>) msg.getPayload()).iterator().next())).getId()); Assert.assertEquals("TestName3", ((HazelcastIntegrationTestUser) (((Collection<?>) msg.getPayload()).iterator().next())).getName()); Assert.assertEquals("TestSurname3", ((HazelcastIntegrationTestUser) (((Collection<?>) msg.getPayload()).iterator().next())).getSurname()); }
Source:
static public void checkInterfaceMethods(final HaxeClassModel clazz, final HaxeClassReferenceModel intReference, final AnnotationHolder holder) { final List<HaxeMethodModel> missingMethods = new ArrayList<HaxeMethodModel>(); final List<String> missingMethodsNames = new ArrayList<String>(); if (intReference.getHaxeClass() != null) { for (HaxeMethodModel method : intReference.getHaxeClass().getMethods()) { if (!method.isStatic()) { if (!clazz.hasMethodSelf(method.getName())) { missingMethods.add(method); missingMethodsNames.add(method.getName()); } } } } if (missingMethods.size() > 0) { Annotation annotation = holder.createErrorAnnotation(intReference.getPsi(), "Not implemented methods: " + StringUtils.join(missingMethodsNames, ", ")); annotation.registerFix(new HaxeSemanticIntentionAction("Implement methods") { @Override public void run() { clazz.addMethodsFromPrototype(missingMethods); } }); } }

Target:
static public void checkInterfaceMethods(final HaxeClassModel clazz, final HaxeClassReferenceModel intReference, final AnnotationHolder holder) { final List<HaxeMethodModel> missingMethods = new ArrayList<HaxeMethodModel>(); final List<String> missingMethodsNames = new ArrayList<String>(); if (intReference.getHaxeClass() != null) { for (HaxeMethodModel method : intReference.getHaxeClass().getMethods()) { if (!method.isStatic()) { if (!clazz.hasMethodSelf(method.getName())) { missingMethods.add(method); missingMethodsNames.add(method.getName()); } } } } if (missingMethods.size() > 0) { Annotation annotation = holder.createErrorAnnotation(intReference.getPsi(), "Not implemented methods: " + StringUtils.join(missingMethodsNames, ", ")); annotation.registerFix(new HaxeFixer("Implement methods") { @Override public void run() { clazz.addMethodsFromPrototype(missingMethods); } }); } }
Source:
public void waitForMessage() { try { latch.await(); } catch (final InterruptedException e) { throw new RuntimeException("Unexpected exception", e); } latch = new CountDownLatch(1); }

Target:
void waitForMessage() { try { latch.await(); } catch (final InterruptedException e) { throw new RuntimeException("Unexpected exception", e); } latch = new CountDownLatch(1); }
Source:
private void checkIndex(int index) { if (index < 0) { throw new IAE("Index[%s] < 0", index); } if (index >= size) { throw new IAE(StringUtils.safeFormat("Index[%s] >= size[%s]", index, size)); } }

Target:
private void checkIndex(int index) { if (index < 0) { throw new IAE("Index[%s] < 0", index); } if (index >= size) { throw new IAE("Index[%d] >= size[%d]", index, size); } }