auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CPPASTLiteralExpression(int kind, char[] value) { fKind = kind; this.setValue(value); }

Target:
public CPPASTLiteralExpression(int kind, char[] value) { this(kind, value, CharArrayUtils.EMPTY); }
Source:
public IStatus discardComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = 1; String id = item.getId(); if (id.startsWith("base-")) { id = id.substring(5); side = 0; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; DiscardDraftRequest request = new DiscardDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); request.setUuid(comment.getId()); GerritOperation<VoidResult> operation = getOperationFactory().createDiscardDraftOperation(getTask(), request); return operation.run(monitor); } } throw new RuntimeException("Internal Exception. No line location for comment. Comment: " + comment.getId()); }

Target:
public IStatus discardComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = 1; String id = item.getId(); if (id.startsWith("base-")) { id = id.substring(5); side = 0; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; DiscardDraftRequest request = new DiscardDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); request.setUuid(comment.getId()); GerritOperation<VoidResult> operation = getOperationFactory().createDiscardDraftOperation(getTask(), request); return operation.run(monitor); } } throw new RuntimeException(Messages.GerritReviewBehavior_Internal_Exception + comment.getId()); }
Source:
private void verifyWeapon(Weapon weapon, WeaponType expectedWeaponType, Class<?> clazz) { System.out.println(clazz); System.out.println(weapon); assertTrue(clazz.isInstance(weapon), "Weapon must be an object of: " + clazz.getName()); assertEquals(expectedWeaponType, weapon.getWeaponType(), "Weapon must be of weaponType: " + expectedWeaponType); }

Target:
private void verifyWeapon(Weapon weapon, WeaponType expectedWeaponType, Class<?> clazz) { assertTrue(clazz.isInstance(weapon), "Weapon must be an object of: " + clazz.getName()); assertEquals(expectedWeaponType, weapon.getWeaponType(), "Weapon must be of weaponType: " + expectedWeaponType); }
Source:
public Object getPropertyValue(String name, int index) { Property reservedProperty = getReservedProperty(name); if (reservedProperty != null) { return reservedProperty.getValue(); } getFetchHints().assertPropertyIncluded(name); Property property = this.properties.getProperty(name, index); if (property == null) { return null; } return property.getValue(); }

Target:
public Object getPropertyValue(String name, int index) { return getPropertyValue(null, name, index); }
Source:
public void tearDown() { log.info("tearDown"); try { if (server != null) { log.debug("destroying server process"); try { int pid = getUnixPID(server.getProcess()); Runtime.getRuntime().exec("kill -INT " + pid).waitFor(); } catch (IllegalArgumentException e) { server.getProcess().destroy(); } server.getProcess().waitFor(); log.debug("destroyed server process"); } log.debug("waited for server process"); } catch (Throwable e) { throw new RuntimeException("Server shutdown error: ", e); } }

Target:
public void tearDown() { log.info("tearDown"); try { if (server != null) { log.debug("destroying server process"); server.interrupt(); log.debug("send shutdown command to the BTDomainAdmin"); X_OCTET sendbuf = (X_OCTET) connection.tpalloc("X_OCTET", null); sendbuf.setByteArray("shutdown,testsui,0,".getBytes()); connection.tpcall("BTDomainAdmin", sendbuf, 0); log.debug("destroyed server process"); server.getProcess().waitFor(); } log.debug("waited for server process"); } catch (Throwable e) { throw new RuntimeException("Server shutdown error: ", e); } }
Source:
private <T> T loadOsgiPlugin(Class<T> type, String className) { if (bundleContext == null) { throw new PluginLoadingException("Bundle context is null"); } Class<?> clazz = null; for (Bundle bundle : bundleContext.getBundles()) { try { clazz = bundle.loadClass(className); } catch (ClassNotFoundException e) { } } if (clazz == null) { throw new PluginLoadingException("Class " + className + " do not exist in any bundle"); } try { return type.cast(clazz.newInstance()); } catch (IllegalAccessException | InstantiationException e) { throw new PluginLoadingException("Cannot instantiate plugin for type " + className, e); } }

Target:
private <T> T loadOsgiPlugin(Class<T> type, String className) { if (bundleContext == null) { return null; } ServiceTracker<T, T> serviceTracker = getServiceTracker(type); @SuppressWarnings("unchecked") T[] services = serviceTracker.getServices((T[]) new Object[serviceTracker.size()]); for (T service : services) { if ((service != null) && (service.getClass().getName().equals(className))) { return service; } } return null; }
Source:
protected static void test_StartWebViewActivity_LoadsUrlAndShowsTitle(@NonNull String url, @Nullable String title) { final WebViewActivity activity = Robolectric.buildActivity(WebViewActivity.class) .withIntent(WebViewActivity.newIntent( RuntimeEnvironment.application, url,title)).setup().get(); final View contentView = Shadows.shadowOf(activity).getContentView(); assertNotNull(contentView); final WebView webView = (WebView) contentView.findViewById(R.id.webView); assertNotNull(webView); final ShadowWebView shadowWebView = Shadows.shadowOf(webView); assertEquals(shadowWebView.getLastLoadedUrl(), url); final ActionBar actionBar = activity.getSupportActionBar(); assertNotNull(actionBar); assertTrue(actionBar.isShowing()); if (!TextUtils.isEmpty(title)) { assertTrue(title.equals(actionBar.getTitle())); } activity.onBackPressed(); assertTrue(activity.isFinishing()); }

Target:
private void test_StartWebViewActivity_LoadsUrlAndShowsTitle(@NonNull String url, @Nullable String title) throws PackageManager.NameNotFoundException { final WebViewActivity activity = Robolectric.buildActivity(WebViewActivity.class) .withIntent(WebViewActivity.newIntent( RuntimeEnvironment.application, url, title)).setup().get(); final View contentView = Shadows.shadowOf(activity).getContentView(); assertNotNull(contentView); final WebView webView = (WebView) contentView.findViewById(R.id.webView); assertNotNull(webView); final ShadowWebView shadowWebView = Shadows.shadowOf(webView); assertEquals(shadowWebView.getLastLoadedUrl(), url); final ActionBar actionBar = activity.getSupportActionBar(); assertNotNull(actionBar); assertThat(actionBar).isShowing(); if (!TextUtils.isEmpty(title)) { assertThat(actionBar).hasTitle(title); } }
Source:
private void downloadMedia(Media m) { String imageUrl = m.getImageUrl(), fileName = m.getFilename(); if (imageUrl == null || fileName == null || getContext() == null || getActivity() == null) { Timber.d("Skipping download media as either imageUrl %s or filename %s activity is null", imageUrl, fileName); return; } fileName = fileName.replaceFirst("^File:", ""); Uri imageUri = Uri.parse(imageUrl); DownloadManager.Request req = new DownloadManager.Request(imageUri); req.setDescription(getString(R.string.app_name)); req.setTitle(m.getDisplayTitle()); req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName); req.allowScanningByMediaScanner(); req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ContextCompat.checkSelfPermission(getContext(), WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED && getView() != null) { PermissionUtils.checkPermissionsAndPerformAction(getActivity(), WRITE_EXTERNAL_STORAGE, () -> enqueueRequest(req), () -> Toast.makeText(getContext(),R.string.donwload_failed_we_cannot_download_the_file_without_storage_permission,Toast.LENGTH_SHORT).show(), R.string.storage_permission, R.string.write_storage_permission_rationale); } else { enqueueRequest(req); } }

Target:
private void downloadMedia(Media m) { String imageUrl = m.getImageUrl(), fileName = m.getFilename(); if (imageUrl == null || fileName == null || getContext() == null || getActivity() == null) { Timber.d("Skipping download media as either imageUrl %s or filename %s activity is null", imageUrl, fileName); return; } fileName = fileName.replaceFirst("^File:", ""); Uri imageUri = Uri.parse(imageUrl); DownloadManager.Request req = new DownloadManager.Request(imageUri); req.setDescription(getString(R.string.app_name)); req.setTitle(m.getDisplayTitle()); req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName); req.allowScanningByMediaScanner(); req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); PermissionUtils.checkPermissionsAndPerformAction(getActivity(), WRITE_EXTERNAL_STORAGE, () -> enqueueRequest(req), () -> Toast.makeText(getContext(), R.string.download_failed_we_cannot_download_the_file_without_storage_permission, Toast.LENGTH_SHORT).show(), R.string.storage_permission, R.string.write_storage_permission_rationale); }
Source:
public ResourceKind getKind(){ if(node.has(ResourcePropertyKeys.KIND)){ return ResourceKind.valueOf(node.get(ResourcePropertyKeys.KIND).asString()); } return null; }

Target:
public ResourceKind getKind(){ ModelNode kindNode = get(ResourcePropertyKeys.KIND); if(kindNode.isDefined()){ return ResourceKind.valueOf(kindNode.asString()); } return null; }
Source:
public void setLunId(String value) { if (!privateLunId.equals(value)) { privateLunId = value; onPropertyChanged(new PropertyChangedEventArgs("LUN ID")); } }

Target:
public void setLunId(String value) { if (privateLunId != null && !privateLunId.equals(value)) { privateLunId = value; onPropertyChanged(new PropertyChangedEventArgs("LUN ID")); } }
Source:
public void createIndexes(Connection connection, String namespace) throws SQLException { if ("agency".equals(name)) { LOG.info("Skipping indexes for table", name); return; } LOG.info("Indexing..."); String tableName; if (namespace == null) { throw new IllegalStateException("Schema namespace must be provided!"); } else { tableName = namespace.endsWith(".") ? namespace + name : String.join(".", namespace, name); } String indexColumns = getIndexFields(); String indexName = String.join("_", tableName.replace(".", "_"), "idx"); String indexSql = String.format("create index %s on %s (%s)", indexName, tableName, indexColumns); LOG.info(indexSql); connection.createStatement().execute(indexSql); for (Field field : fields) { if (field.shouldBeIndexed()) { Statement statement = connection.createStatement(); String fieldIndex = String.join("_", tableName.replace(".", "_"), field.name, "idx"); String sql = String.format("create index %s on %s (%s)", fieldIndex, tableName, field.name); LOG.info(sql); statement.execute(sql); } } }

Target:
public void createIndexes(Connection connection, String namespace) throws SQLException { if ("agency".equals(name) || "feed_info".equals(name)) { LOG.info("Skipping indexes for table", name); return; } LOG.info("Indexing {}...", name); String tableName; if (namespace == null) { throw new IllegalStateException("Schema namespace must be provided!"); } else { tableName = namespace.endsWith(".") ? namespace + name : String.join(".", namespace, name); } String indexColumns = getIndexFields(); String indexName = String.join("_", tableName.replace(".", "_"), "idx"); String indexSql = String.format("create index %s on %s (%s)", indexName, tableName, indexColumns); LOG.info(indexSql); connection.createStatement().execute(indexSql); for (Field field : fields) { if (field.shouldBeIndexed()) { Statement statement = connection.createStatement(); String fieldIndex = String.join("_", tableName.replace(".", "_"), field.name, "idx"); String sql = String.format("create index %s on %s (%s)", fieldIndex, tableName, field.name); LOG.info(sql); statement.execute(sql); } } }
Source:
public Object getProperty(final Object object) { try { AccessPermissionChecker.checkAccessPermission(field); } catch (AccessControlException ex) { throw new IllegalArgumentException("Illegal access to field" + " " + field.getName()); } try { return field.get(object); } catch (IllegalAccessException e) { throw new GroovyRuntimeException("Cannot get the property '" + name + "'.", e); } }

Target:
public Object getProperty(final Object object) { AccessPermissionChecker.checkAccessPermission(field); try { return field.get(object); } catch (IllegalAccessException e) { throw new GroovyRuntimeException("Cannot get the property '" + name + "'.", e); } }
Source:
public void testConcurrentStart(int eagerManager, int lazyManager) throws Exception { TestResourceTracker.testThreadStarted(this); String name1 = TestResourceTracker.getNextNodeName(); String name2 = TestResourceTracker.getNextNodeName(); JChannel ch1 = createChannel(name1, 0); JChannel ch2 = createChannel(name2, 1); EmbeddedCacheManager cm1 = createCacheManager(name1, ch1); EmbeddedCacheManager cm2 = createCacheManager(name2, ch2); try { assertEquals(ComponentStatus.INSTANTIATED, extractGlobalComponentRegistry(cm1).getStatus()); assertEquals(ComponentStatus.INSTANTIATED, extractGlobalComponentRegistry(cm2).getStatus()); log.debugf("Channels created. Starting the caches"); Future<Object> repl1Future = fork(() -> manager(eagerManager).getCache("repl")); Thread.sleep(1000); Future<Object> repl2Future = fork(() -> manager(lazyManager).getCache("repl")); repl1Future.get(10, SECONDS); repl2Future.get(10, SECONDS); Cache<String, String> c1r = cm1.getCache("repl"); Cache<String, String> c2r = cm2.getCache("repl"); blockUntilViewsReceived(10000, cm1, cm2); waitForRehashToComplete(c1r, c2r); c1r.put("key", "value"); assertEquals("value", c2r.get("key")); } finally { cm1.stop(); cm2.stop(); ch1.close(); ch2.close(); } }

Target:
public void testConcurrentStart(int eagerManager, int lazyManager) throws Exception { TestResourceTracker.testThreadStarted(this); String name1 = TestResourceTracker.getNextNodeName(); String name2 = TestResourceTracker.getNextNodeName(); JChannel ch1 = createChannel(name1, 0); JChannel ch2 = createChannel(name2, 1); EmbeddedCacheManager cm1 = createCacheManager(name1, ch1); EmbeddedCacheManager cm2 = createCacheManager(name2, ch2); try { assertEquals(ComponentStatus.INSTANTIATED, extractGlobalComponentRegistry(cm1).getStatus()); assertEquals(ComponentStatus.INSTANTIATED, extractGlobalComponentRegistry(cm2).getStatus()); log.debugf("Channels created. Starting the caches"); Future<Object> repl1Future = fork(() -> manager(eagerManager).getCache("repl")); Thread.sleep(500); Future<Object> repl2Future = fork(() -> manager(lazyManager).getCache("repl")); repl1Future.get(10, SECONDS); repl2Future.get(10, SECONDS); Cache<String, String> c1r = cm1.getCache("repl"); Cache<String, String> c2r = cm2.getCache("repl"); blockUntilViewsReceived(10000, cm1, cm2); waitForRehashToComplete(c1r, c2r); c1r.put("key", "value"); assertEquals("value", c2r.get("key")); } finally { cm1.stop(); cm2.stop(); ch1.close(); ch2.close(); } }
Source:
private JLabel getAddedCountValueLabel() { if (addedCountValueLabel == null) { addedCountValueLabel = new javax.swing.JLabel(); addedCountValueLabel.setText(ZERO_REQUESTS_LABEL_TEXT); } return addedCountValueLabel; }

Target:
private JLabel getAddedCountValueLabel() { if (addedCountValueLabel == null) { addedCountValueLabel = new JLabel(); addedCountValueLabel.setText(ZERO_REQUESTS_LABEL_TEXT); } return addedCountValueLabel; }
Source:
protected void onSuccess(String response) { if(response == null) { RuntimeException responseEmpty = new IllegalArgumentException("End user params are missing"); wootricApiCallback.onApiError(responseEmpty); return; } try { JSONArray jsonArray = new JSONArray(response); if(jsonArray.length() > 0) { JSONObject jsonObject = jsonArray.getJSONObject(0); long endUserId = jsonObject.getLong("id"); wootricApiCallback.onGetEndUserIdSuccess(endUserId); } else { wootricApiCallback.onEndUserNotFound(); } } catch (JSONException e) { wootricApiCallback.onApiError(e); } }

Target:
protected void onSuccess(String response) { if(response != null) { try { JSONArray jsonArray = new JSONArray(response); if(jsonArray.length() > 0) { JSONObject jsonObject = jsonArray.getJSONObject(0); long endUserId = jsonObject.getLong("id"); wootricApiCallback.onGetEndUserIdSuccess(endUserId); } else { wootricApiCallback.onEndUserNotFound(); } } catch (JSONException e) { wootricApiCallback.onApiError(e); } } else { wootricApiCallback.onApiError(new IllegalArgumentException("End user params are missing")); } }
Source:
public void onLoad() { offset = world.rand.nextInt(10); }

Target:
public void onLoad() { super.onLoad(); offset = world.rand.nextInt(10); }
Source:
public CSVParser(final Optional<String> listDelimiter) { this.listDelimiter = listDelimiter.isPresent() ? listDelimiter.get() : Parsers.DEFAULT_LIST_DELIMITER; Preconditions.checkState( !this.listDelimiter.equals(String.valueOf(au.com.bytecode.opencsv.CSVParser.DEFAULT_SEPARATOR)), "Cannot have list delimiter of [%s]", au.com.bytecode.opencsv.CSVParser.DEFAULT_SEPARATOR ); this.listSplitter = Splitter.on(this.listDelimiter); this.valueFunction = new Function<String, Object>() { @Override public Object apply(String input) { if (input.contains(CSVParser.this.listDelimiter)) { return Lists.newArrayList( Iterables.transform( listSplitter.split(input), ParserUtils.nullEmptyStringFunction ) ); } else { return ParserUtils.nullEmptyStringFunction.apply(input); } } }; }

Target:
public CSVParser(final Optional<String> listDelimiter) { this.listDelimiter = listDelimiter.isPresent() ? listDelimiter.get() : Parsers.DEFAULT_LIST_DELIMITER; this.listSplitter = Splitter.on(this.listDelimiter); this.valueFunction = new Function<String, Object>() { @Override public Object apply(String input) { if (input.contains(CSVParser.this.listDelimiter)) { return Lists.newArrayList( Iterables.transform( listSplitter.split(input), ParserUtils.nullEmptyStringFunction ) ); } else { return ParserUtils.nullEmptyStringFunction.apply(input); } } }; }
Source:
public List<RuntimeException> getTerminatedBy() { return new ArrayList<RuntimeException>(terminatedBy); }

Target:
public List<TerminationRequest> getTerminatedBy() { return new ArrayList<TerminationRequest>(terminatedBy); }
Source:
public CellDebugPrint() { strings = new Vector<Vector<Vector<String>>>();; }

Target:
public CellDebugPrint() { strings = new ArrayList<ArrayList<ArrayList<String>>>();; }
Source:
protected void doExecute() { DiagramDescription diagramdesc = DescriptionFactory.eINSTANCE.createDiagramDescription(); diagramdesc.setName(BASE_ID + ".default.layer"); viewpoint.getOwnedRepresentations().add(diagramdesc); Layer layer = DescriptionFactory.eINSTANCE.createLayer(); diagramdesc.setDefaultLayer(layer); ToolSection toolSection = createToolSection(layer); ContainerMapping packageMapping = createPackageMapping(layer, toolSection); ContainerMapping classMapping = createClassMapping(layer, toolSection); NodeMapping attribute = createAttribute(classMapping, toolSection); EdgeMapping edgeMappingInheritance = createEdgeMappingInheritance(layer, toolSection, classMapping); EdgeMapping edgeMappingReference = createEdgeMappingReference(layer, toolSection, classMapping); createDeleteTool(toolSection, classMapping, packageMapping, attribute, edgeMappingInheritance, edgeMappingReference); createEditTool(toolSection, classMapping, packageMapping, attribute, edgeMappingInheritance, edgeMappingReference); }

Target:
protected void doExecute() { DiagramDescription diagramdesc = DescriptionFactory.eINSTANCE.createDiagramDescription(); diagramdesc.setName(baseId + "diagram"); viewpoint.getOwnedRepresentations().add(diagramdesc); Layer layer = DescriptionFactory.eINSTANCE.createLayer(); layer.setName(baseId + ".default.layer"); diagramdesc.setDefaultLayer(layer); ToolSection toolSection = createToolSection(layer); ContainerMapping packageMapping = createPackageMapping(layer, toolSection); ContainerMapping classMapping = createClassMapping(layer, toolSection); NodeMapping attribute = createAttribute(classMapping, toolSection); EdgeMapping edgeMappingInheritance = createEdgeMappingInheritance(layer, toolSection, classMapping); EdgeMapping edgeMappingReference = createEdgeMappingReference(layer, toolSection, classMapping); createDeleteTool(toolSection, classMapping, packageMapping, attribute, edgeMappingInheritance, edgeMappingReference); createEditTool(toolSection, classMapping, packageMapping, attribute, edgeMappingInheritance, edgeMappingReference); }
Source:
public boolean mustRecycleReceivers() { return false; }

Target:
public boolean mustRecycleReceivers() { return true; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { PlotCommit commit = (PlotCommit) getSelection(event).getFirstElement(); final Repository repo = getRepository(event); try { PushBranchWizard wizard = null; Ref goodRef = null; for (int i = 0; i < commit.getRefCount(); i++) { Ref currentRef = commit.getRef(i); if (goodRef == null && currentRef.getName().startsWith(Constants.R_HEADS)) { goodRef = currentRef; } } if (goodRef == null) { wizard = new PushBranchWizard(repo, commit.getId()); } else { wizard = new PushBranchWizard(repo, goodRef); } WizardDialog dlg = new WizardDialog( HandlerUtil.getActiveShellChecked(event), wizard); dlg.setHelpAvailable(true); dlg.open(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, true); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { PlotCommit commit = (PlotCommit) getSelection(event).getFirstElement(); final Repository repo = getRepository(event); try { PushBranchWizard wizard = null; Ref localBranch = null; for (int i = 0; i < commit.getRefCount(); i++) { Ref currentRef = commit.getRef(i); if (localBranch == null && currentRef.getName().startsWith(Constants.R_HEADS)) { localBranch = currentRef; } } if (localBranch == null) { wizard = new PushBranchWizard(repo, commit.getId()); } else { wizard = new PushBranchWizard(repo, localBranch); } WizardDialog dlg = new WizardDialog( HandlerUtil.getActiveShellChecked(event), wizard); dlg.setHelpAvailable(true); dlg.open(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, true); } return null; }
Source:
private static boolean isEmptyArray(ExpressionTree expression) { if (!expression.is(Tree.Kind.NEW_ARRAY)) { return false; } NewArrayTree nat = (NewArrayTree) expression; return nat.dimensions().stream().allMatch(PublicStaticMutableMembersCheck::isZeroDimension) && nat.initializers().isEmpty(); }

Target:
private static boolean isEmptyArray(ExpressionTree expression) { if (!expression.is(Tree.Kind.NEW_ARRAY)) { return false; } NewArrayTree nat = (NewArrayTree) expression; return hasEmptyInitializer(nat) || hasOnlyZeroDimensions(nat.dimensions()); }
Source:
public static <T extends TypedSPI> T getCachedInstance(final Class<T> typedService, final String type) { T instance = TYPED_SERVICES.containsKey(typedService) ? (T) TYPED_SERVICES.get(typedService).get(type) : null; if (instance == null) { throw new JobConfigurationException("Cannot find a cached typed service instance by the interface: @" + typedService.getName() + "and type: " + type); } return instance; }

Target:
public static <T extends TypedSPI> T getCachedInstance(final Class<T> typedService, final String type) { T instance = TYPED_SERVICES.containsKey(typedService) ? (T) TYPED_SERVICES.get(typedService).get(type) : null; if (null == instance) { throw new JobConfigurationException("Cannot find a cached typed service instance by the interface: @" + typedService.getName() + "and type: " + type); } return instance; }
Source:
public int getVariableOptionIndex(){ return variableOptionIndex; }

Target:
int getVariableOptionIndex(){ return variableOptionIndex; }
Source:
private void trackOverridingChains(@Nonnull JDefinedClass currentClass, @Nonnull State state) { for (JMethod method : currentClass.getMethods()) { if (!method.isStatic() && !method.isPrivate() && !(method instanceof JConstructor)) { String signature = getSignatureId(method); if (!state.currentMethods.containsKey(signature)) { state.newMethods.add(method); } state.currentMethods.put(signature, method); } } for (JDefinedClass derived : DirectlyDerivedClassesMarker.getDirectlyDerivedClasses(currentClass)) { trackOverridingChains(derived, state); } for (JMethod method : currentClass.getMethods()) { if (!method.isStatic() && !method.isPrivate() && !(method instanceof JConstructor)) { String signature = getSignatureId(method); assert state.currentMethods.containsKey(signature); JMethod candidate = state.currentMethods.get(signature); if (candidate != null) { assert candidate == method; state.effectivelyFinalMethods.add(method); } if (state.newMethods.contains(method)) { state.currentMethods.remove(signature); } else { state.currentMethods.put(signature, null); } } } }

Target:
private void trackOverridingChains(@Nonnull JDefinedClass currentClass, @Nonnull State state) { for (JMethod method : currentClass.getMethods()) { if (method.getMethodIdWide().getKind() == MethodKind.INSTANCE_VIRTUAL) { String signature = getSignatureId(method); if (!state.currentMethods.containsKey(signature)) { state.newMethods.add(method); } state.currentMethods.put(signature, method); } } for (JDefinedClass derived : DirectlyDerivedClassesMarker.getDirectlyDerivedClasses(currentClass)) { trackOverridingChains(derived, state); } for (JMethod method : currentClass.getMethods()) { if (method.getMethodIdWide().getKind() == MethodKind.INSTANCE_VIRTUAL) { String signature = getSignatureId(method); assert state.currentMethods.containsKey(signature); JMethod candidate = state.currentMethods.get(signature); if (candidate != null) { assert candidate == method; state.effectivelyFinalMethods.add(method); } if (state.newMethods.contains(method)) { state.currentMethods.remove(signature); } else { state.currentMethods.put(signature, null); } } } }
Source:
int getLifetime() { return lifetime; }

Target:
public int getLifetime() { return lifetime; }
Source:
public Void visitVariable(VariableTree node, Void p) { warnAboutTypeAnnotationsTooEarly(node, node.getModifiers()); Tree typeTree = node.getType(); while (typeTree.getKind() == Tree.Kind.ARRAY_TYPE) { typeTree = ((ArrayTypeTree) typeTree).getType(); } visitAnnotatedType(node.getModifiers().getAnnotations(), typeTree, node); Pair<Tree, AnnotatedTypeMirror> preAssignmentContext = visitorState.getAssignmentContext(); AnnotatedTypeMirror variableType; if (getCurrentPath().getParentPath() != null && getCurrentPath().getParentPath().getLeaf().getKind() == Tree.Kind.LAMBDA_EXPRESSION) { variableType = atypeFactory.getAnnotatedType(node); } else { variableType = atypeFactory.getAnnotatedTypeLhs(node); } visitorState.setAssignmentContext(Pair.of(node, variableType)); try { if (atypeFactory.getDependentTypesHelper() != null) { atypeFactory.getDependentTypesHelper().checkType(variableType, node); } if (node.getInitializer() != null) { commonAssignmentCheck(node, node.getInitializer(), "assignment.type.incompatible"); } else { validateTypeOf(node); } return super.visitVariable(node, p); } finally { visitorState.setAssignmentContext(preAssignmentContext); } }

Target:
public Void visitVariable(VariableTree node, Void p) { warnAboutTypeAnnotationsTooEarly(node, node.getModifiers()); visitAnnotatedType(node.getModifiers().getAnnotations(), node.getType()); Pair<Tree, AnnotatedTypeMirror> preAssignmentContext = visitorState.getAssignmentContext(); AnnotatedTypeMirror variableType; if (getCurrentPath().getParentPath() != null && getCurrentPath().getParentPath().getLeaf().getKind() == Tree.Kind.LAMBDA_EXPRESSION) { variableType = atypeFactory.getAnnotatedType(node); } else { variableType = atypeFactory.getAnnotatedTypeLhs(node); } visitorState.setAssignmentContext(Pair.of(node, variableType)); try { if (atypeFactory.getDependentTypesHelper() != null) { atypeFactory.getDependentTypesHelper().checkType(variableType, node); } if (node.getInitializer() != null) { commonAssignmentCheck(node, node.getInitializer(), "assignment.type.incompatible"); } else { validateTypeOf(node); } return super.visitVariable(node, p); } finally { visitorState.setAssignmentContext(preAssignmentContext); } }
Source:
public boolean historyAvailable() { if (testObject.getRun().getParent().getBuilds().isEmpty()) return false; else return true; }

Target:
public boolean historyAvailable() { if (testObject.getRun().getParent().getBuilds().size() > 1) return true; else return false; }
Source:
private boolean extractZsetIncrementHeader(Message<?> message) { if (message.getHeaders().containsKey(RedisHeaders.ZSET_INCREMENT_SCORE)) { return this.zsetIncrementScoreExpression.getValue(this.evaluationContext, message, Boolean.class); } return false; }

Target:
private boolean extractZsetIncrementHeader(Message<?> message) { Boolean value = this.zsetIncrementScoreExpression.getValue(this.evaluationContext, message, Boolean.class); return value != null ? value : false; }
Source:
beginRecognizeCustomForms(Flux<ByteBuffer> data, String modelId, long length, FormContentType formContentType, boolean includeTextDetails, Duration pollInterval) { Objects.requireNonNull(data, "'data' is required and cannot be null."); Objects.requireNonNull(modelId, "'modelId' is required and cannot be null."); Objects.requireNonNull(formContentType, "'formContentType' is required and cannot be null."); final Duration interval = pollInterval != null ? pollInterval : DEFAULT_DURATION; return new PollerFlux<OperationResult, IterableStream<RecognizedForm>>( interval, analyzeFormStreamActivationOperation(data, modelId, length, formContentType, includeTextDetails), createAnalyzeFormPollOperation(modelId), (activationResponse, context) -> Mono.error(new RuntimeException("Cancellation is not supported")), fetchAnalyzeFormResultOperation(modelId, includeTextDetails)); }

Target:
beginRecognizeCustomForms(Flux<ByteBuffer> data, String modelId, long length, FormContentType formContentType, boolean includeTextDetails, Duration pollInterval) { final Duration interval = pollInterval != null ? pollInterval : DEFAULT_DURATION; return new PollerFlux<OperationResult, IterableStream<RecognizedForm>>( interval, analyzeFormStreamActivationOperation(data, modelId, length, formContentType, includeTextDetails), createAnalyzeFormPollOperation(modelId), (activationResponse, context) -> Mono.error(new RuntimeException("Cancellation is not supported")), fetchAnalyzeFormResultOperation(modelId, includeTextDetails)); }
Source:
private void addMessageToSitesTree(final HistoryReference historyReference, final HttpMessage message) { if (View.isInitialised() && !EventQueue.isDispatchThread()) { EventQueue.invokeLater(new Runnable() { @Override public void run() { addMessageToSitesTree(historyReference, message); } }); return; } StructuralNode node = SessionStructure.addPath( Model.getSingleton().getSession(), historyReference, message, true); if (node != null) { try { addUriToAddedNodesModel(SessionStructure.getNodeName(message), message.getRequestHeader().getMethod(), ""); } catch (URIException e) { log.error("Error while recording added node: " + e.getMessage(), e); } } }

Target:
private void addMessageToSitesTree(final HistoryReference historyReference, final HttpMessage message) { if (View.isInitialised() && !EventQueue.isDispatchThread()) { EventQueue.invokeLater(new Runnable() { @Override public void run() { addMessageToSitesTree(historyReference, message); } }); return; } StructuralNode node = SessionStructure.addPath( Model.getSingleton().getSession(), historyReference, message, true); if (node != null) { try { addUriToAddedNodesModel(SessionStructure.getNodeName(message), message.getRequestHeader().getMethod(), ""); } catch (URIException e) { log.error("Error while adding node to added nodes model: " + e.getMessage(), e); } } }
Source:
public void applyRightFloor(final PatchSetApproval a) { final IdentifiedUser user = userFactory.create(a.getAccountId()); short minAllowed = 0, maxAllowed = 0; for (final ProjectRight r : getAllRights(a.getCategoryId())) { final AccountGroup.Id grp = r.getAccountGroupId(); if (user.getEffectiveGroups().contains(grp)) { minAllowed = (short) Math.min(minAllowed, r.getMinValue()); maxAllowed = (short) Math.max(maxAllowed, r.getMaxValue()); } } for (final RefRight refRight : getRefRights(a.getCategoryId())) { final AccountGroup.Id grp = refRight.getAccountGroupId(); if (user.getEffectiveGroups().contains(grp)) { minAllowed = (short) Math.min(minAllowed, refRight.getMinValue()); maxAllowed = (short) Math.max(maxAllowed, refRight.getMaxValue()); } } if (a.getValue() < minAllowed) { a.setValue(minAllowed); dirty(a); } else if (a.getValue() > maxAllowed) { a.setValue(maxAllowed); dirty(a); } }

Target:
public void applyRightFloor(final PatchSetApproval a) { final IdentifiedUser user = userFactory.create(a.getAccountId()); short projectMinAllowed = 0, projectMaxAllowed = 0; for (final ProjectRight r : getAllProjectRights(a.getCategoryId())) { final AccountGroup.Id grp = r.getAccountGroupId(); if (user.getEffectiveGroups().contains(grp)) { projectMinAllowed = (short) Math.min(projectMinAllowed, r.getMinValue()); projectMaxAllowed = (short) Math.max(projectMaxAllowed, r.getMaxValue()); } } short refMinAllowed = 0, refMaxAllowed = 0; String destRef = change.getDest().get(); for (final RefRight refRight : getRefRights(a.getCategoryId())) { if (RefControl.matches(destRef, refRight.getRefPattern())) { final AccountGroup.Id grp = refRight.getAccountGroupId(); if (user.getEffectiveGroups().contains(grp)) { refMinAllowed = (short) Math.min(refMinAllowed, refRight.getMinValue()); refMaxAllowed = (short) Math.max(refMaxAllowed, refRight.getMaxValue()); } } } short minAllowed = (short) Math.max(refMinAllowed, projectMinAllowed); short maxAllowed = (short) Math.min(refMaxAllowed, projectMaxAllowed); if (a.getValue() < minAllowed) { a.setValue(minAllowed); dirty(a); } else if (a.getValue() > maxAllowed) { a.setValue(maxAllowed); dirty(a); } }
Source:
public void CompletePcapPacketTest() throws IOException, BadPcapFileException, BadPacketException { PcapTestTrace trace = PcapTestTrace.MOSTLY_UDP; assumeTrue(trace.exists()); try (PcapFile file = trace.getTrace();) { file.seekPacket(36); PcapPacket packet = file.parseNextPacket(); if (packet == null) { fail("CompletePcapPacketTest has failed!"); return; } assertEquals(PcapProtocol.PCAP, packet.getProtocol()); assertTrue(packet.hasProtocol(PcapProtocol.PCAP)); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.TCP)); assertTrue(packet.validate()); assertEquals(86567859, packet.hashCode()); assertFalse(packet.equals(null)); assertFalse(packet.equals(file.parseNextPacket())); assertEquals(EXPECTED_FIELDS, packet.getFields()); assertEquals(EXPECTED_TOSTRING, packet.toString()); assertEquals("Frame 36: 75 bytes on wire, 75 bytes captured", packet.getLocalSummaryString()); assertEquals("Source Port: 2719, Destination Port: 53", packet.getGlobalSummaryString()); assertEquals(new PcapEndpoint(packet, true), packet.getSourceEndpoint()); assertEquals(new PcapEndpoint(packet, false), packet.getDestinationEndpoint()); ByteBuffer payload = packet.getPayload(); if (payload == null) { fail("CompletePcapPacketTest has failed!"); return; } assertEquals(36, packet.getIndex()); assertEquals(75, packet.getOriginalLength()); assertEquals(75, packet.getIncludedLength()); assertEquals(1120469632829277L, packet.getTimestamp()); assertFalse(packet.isTruncated()); } }

Target:
public void CompletePcapPacketTest() throws IOException, BadPcapFileException, BadPacketException { PcapTestTrace trace = PcapTestTrace.MOSTLY_UDP; assumeTrue(trace.exists()); try (PcapFile file = trace.getTrace();) { file.seekPacket(36); PcapPacket packet = file.parseNextPacket(); if (packet == null) { fail("CompletePcapPacketTest has failed!"); return; } assertEquals(PcapProtocol.PCAP, packet.getProtocol()); assertTrue(packet.hasProtocol(PcapProtocol.PCAP)); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.TCP)); assertTrue(packet.validate()); assertEquals(665277927, packet.hashCode()); assertFalse(packet.equals(null)); assertFalse(packet.equals(file.parseNextPacket())); assertEquals(EXPECTED_FIELDS, packet.getFields()); assertEquals(EXPECTED_TOSTRING, packet.toString()); assertEquals("Frame 36: 75 bytes on wire, 75 bytes captured", packet.getLocalSummaryString()); assertEquals("Source Port: 2719, Destination Port: 53", packet.getGlobalSummaryString()); assertEquals(new PcapEndpoint(packet, true), packet.getSourceEndpoint()); assertEquals(new PcapEndpoint(packet, false), packet.getDestinationEndpoint()); ByteBuffer payload = packet.getPayload(); if (payload == null) { fail("CompletePcapPacketTest has failed!"); return; } assertEquals(36, packet.getIndex()); assertEquals(75, packet.getOriginalLength()); assertEquals(75, packet.getIncludedLength()); assertEquals(1120469632829277L, packet.getTimestamp()); assertFalse(packet.isTruncated()); } }
Source:
public Builder<ChannelFactory> configure(OperationContext context, ModelNode model) throws OperationFailedException { Resource resource = context.getCurrentAddress().equals(this.address) ? context.readResourceFromRoot(this.address, false) : PlaceholderResource.INSTANCE; List<ValueDependency<ProtocolConfiguration>> list = new ArrayList<>(); for (Resource.ResourceEntry entry : resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey())) { InjectedValueDependency<ProtocolConfiguration> protocolConfigurationInjectedValueDependency = new InjectedValueDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement()), ProtocolConfiguration.class); list.add(protocolConfigurationInjectedValueDependency); } this.protocols = list; String channelName = this.address.getParent().getLastElement().getValue(); this.parentChannel = new InjectedValueDependency<>(JGroupsRequirement.CHANNEL.getServiceName(context, channelName), Channel.class); this.parentFactory = new InjectedValueDependency<>(JGroupsRequirement.CHANNEL_SOURCE.getServiceName(context, channelName), ChannelFactory.class); return this; }

Target:
public Builder<ChannelFactory> configure(OperationContext context, ModelNode model) throws OperationFailedException { Resource resource = context.getCurrentAddress().equals(this.address) ? context.readResourceFromRoot(this.address, false) : PlaceholderResource.INSTANCE; final Set<Resource.ResourceEntry> children = resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey()); final List<ValueDependency<ProtocolConfiguration>> list = new ArrayList<>(children.size()); for (Resource.ResourceEntry entry : children) { list.add(new InjectedValueDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement()), ProtocolConfiguration.class)); } this.protocols = list; String channelName = this.address.getParent().getLastElement().getValue(); this.parentChannel = new InjectedValueDependency<>(JGroupsRequirement.CHANNEL.getServiceName(context, channelName), Channel.class); this.parentFactory = new InjectedValueDependency<>(JGroupsRequirement.CHANNEL_SOURCE.getServiceName(context, channelName), ChannelFactory.class); return this; }
Source:
public ActiveMQMessage getAMQMessage() { if (message == null) { if (data != null) { try { message = (ActiveMQMessage) wireFormat.unmarshal(new ChannelBufferWrapper(data)); } catch (IOException e) { throw new ActiveMQPropertyConversionException(e.getMessage()); } return message; } else { return new ActiveMQMessage(); } } return message; }

Target:
public org.apache.activemq.command.ActiveMQMessage getAMQMessage() { return message; }
Source:
public void should_use_parameterized_task_work_dir() throws Exception { runner.setProperty("sonar.task", "views"); runner.setProperty("sonar.working.directory", "generated/reports"); dirs.init(runner); File workDir = new File(runner.property("sonar.working.directory", null)); assertThat(workDir).isNotNull(); assertThat(workDir.getCanonicalPath()).contains("generated/reports"); }

Target:
public void should_use_parameterized_task_work_dir() throws Exception { runner.setProperty("sonar.task", "views"); runner.setProperty("sonar.working.directory", "generated/reports"); dirs.init(runner); File workDir = new File(runner.property("sonar.working.directory", null)); assertThat(workDir).isNotNull(); assertThat(workDir.getCanonicalPath().replace("\\", "/")).contains("generated/reports"); }
Source:
protected List<String> getTabCompleteOptions(Server server, CommandSource sender, String commandLabel, String[] args) { boolean isConsole = sender.isPlayer(); if (args.length == 1) { if (isConsole || sender.isAuthorized("essentials.time.set", ess)) { return Lists.newArrayList("set", "add"); } else { return Collections.emptyList(); } } else if (args.length == 2) { if (args[0].equalsIgnoreCase("set")) { return Lists.newArrayList("sunrise", "day", "morning", "noon", "afternoon", "sunset", "night", "midnight"); } else if (args[0].equalsIgnoreCase("add")) { return Lists.newArrayList("500", "1000", "1500", "2000", "2500", "3000"); } else { return Collections.emptyList(); } } else if (args.length == 3 && (args[0].equalsIgnoreCase("set") || args[0].equalsIgnoreCase("add"))) { List<String> worlds = Lists.newArrayList(); for (World world : server.getWorlds()) { if (isConsole || sender.isAuthorized("essentials.time.world." + normalizeWorldName(world), ess)) { worlds.add(world.getName()); } } if (isConsole || sender.isAuthorized("essentials.time.world.all", ess)) { worlds.add("*"); } return worlds; } else { return Collections.emptyList(); } }

Target:
protected List<String> getTabCompleteOptions(Server server, CommandSource sender, String commandLabel, String[] args) { if (args.length == 1) { if (sender.isAuthorized("essentials.time.set", ess)) { return subCommands; } else { return Collections.emptyList(); } } else if (args.length == 2) { if (args[0].equalsIgnoreCase("set")) { return timeNames; } else if (args[0].equalsIgnoreCase("add")) { return timeNumbers; } else { return Collections.emptyList(); } } else if (args.length == 3 && (args[0].equalsIgnoreCase("set") || args[0].equalsIgnoreCase("add"))) { List<String> worlds = Lists.newArrayList(); for (World world : server.getWorlds()) { if (sender.isAuthorized("essentials.time.world." + normalizeWorldName(world), ess)) { worlds.add(world.getName()); } } if (sender.isAuthorized("essentials.time.world.all", ess)) { worlds.add("*"); } return worlds; } else { return Collections.emptyList(); } }
Source:
public void isAliveShouldReturnTrueWhenRemoteRepositoryNotCached() { RemoteRepository remoteRepository = createMockedRemoteRepository(); boolean alive = remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository); assertTrue(alive); }

Target:
public void isAliveShouldReturnTrueWhenRemoteRepositoryNotCached() { Cache cache = getCache(); Boolean cacheValue = cache.get(REMOTE_REPOSITORY_URL, Boolean.class); boolean alive = remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository); assertThat(cacheValue).isNull(); assertThat(alive).isTrue(); }
Source:
public void onEvent(LockState state) { if (state != LockState.AVAILABLE && UPDATER.compareAndSet(this, LockState.AVAILABLE, state)) { for (ExtendedLockPromise lockPromise : lockPromiseList) { lockPromise.cancel(state); } } if (isAvailable()) { notifier.complete(null); } }

Target:
public void onEvent(LockState state) { if (state != LockState.ACQUIRED && UPDATER.compareAndSet(this, LockState.ACQUIRED, state)) { for (ExtendedLockPromise lockPromise : lockPromiseList) { lockPromise.cancel(state); } } if (isAvailable()) { notifier.complete(null); } }
Source:
@Test public void configuratorTest() { driver.configuratorSetActionAcknowledgmentTimeout(5); assertJSONElementContains(Setting.WAIT_ACTION_ACKNOWLEDGMENT_TIMEOUT, 5); driver.configuratorSetKeyInjectionDelay(4); assertJSONElementContains(Setting.KEY_INJECTION_DELAY, 4); driver.configuratorSetScrollAcknowledgmentTimeout(3); assertJSONElementContains(Setting.WAIT_SCROLL_ACKNOWLEDGMENT_TIMEOUT, 3); driver.configuratorSetWaitForIdleTimeout(6); assertJSONElementContains(Setting.WAIT_FOR_IDLE_TIMEOUT, 6); driver.configuratorSetWaitForSelectorTimeout(1); assertJSONElementContains(Setting.WAIT_FOR_SELECTOR_TIMEOUT, 1); }

Target:
@Test public void configuratorTest() { driver.configuratorSetActionAcknowledgmentTimeout(500); assertJSONElementContains(Setting.WAIT_ACTION_ACKNOWLEDGMENT_TIMEOUT, 500); driver.configuratorSetKeyInjectionDelay(400); assertJSONElementContains(Setting.KEY_INJECTION_DELAY, 400); driver.configuratorSetScrollAcknowledgmentTimeout(300); assertJSONElementContains(Setting.WAIT_SCROLL_ACKNOWLEDGMENT_TIMEOUT, 300); driver.configuratorSetWaitForIdleTimeout(600); assertJSONElementContains(Setting.WAIT_FOR_IDLE_TIMEOUT, 600); driver.configuratorSetWaitForSelectorTimeout(1000); assertJSONElementContains(Setting.WAIT_FOR_SELECTOR_TIMEOUT, 1000); }
Source:
public boolean isAllowable() { long now = System.currentTimeMillis(); if (now > lastResetTime + interval) { token = buildLongAdder(rate); lastResetTime = now; } boolean flag = false; while (token.sum() > 0 && !flag) { token.decrement(); flag = true; } return flag; }

Target:
public boolean isAllowable() { long now = System.currentTimeMillis(); if (now > lastResetTime + interval) { token = buildLongAdder(rate); lastResetTime = now; } if (token.sum() < 0) { return false; } token.decrement(); return true; }
Source:
private void checkComponentIndex(int cIndex) { if (cIndex < 0 || cIndex > componentCount) { ensureAccessible(); throw new IndexOutOfBoundsException(String.format( "cIndex: %d (expected: >= 0 && <= numComponents(%d))", cIndex, componentCount)); } }

Target:
private void checkComponentIndex(int cIndex) { ensureAccessible(); if (cIndex < 0 || cIndex > componentCount) { throw new IndexOutOfBoundsException(String.format( "cIndex: %d (expected: >= 0 && <= numComponents(%d))", cIndex, componentCount)); } }
Source:
synchronized void setPlaybackParams(final PlaybackParams params) { PlaybackParams current = null; try { current = getPlaybackParams(); } catch (IllegalStateException e) { } MediaPlayer currentPlayer = getCurrentPlayer(); try { currentPlayer.setPlaybackParams(params); mPlaybackParams = params; } catch (IllegalStateException e) { mPlaybackParamsToSetAfterSetDataSource = params; } if (current != null && current.getSpeed() != params.getSpeed()) { notifyPlayerEvent(new PlayerEventNotifier() { @Override public void notify(PlayerEventCallback cb) { cb.onPlaybackSpeedChanged(mMediaPlayerConnectorImpl, params.getSpeed()); } }); final int currentState = mPlayer.getFirst().mMp2State; if (currentState != PLAYER_STATE_IDLE && currentState != PLAYER_STATE_ERROR) { if (params.getSpeed() == 0f) { setMp2State(currentPlayer, PLAYER_STATE_PAUSED); } else { setMp2State(currentPlayer, PLAYER_STATE_PLAYING); } } } }

Target:
synchronized void setPlaybackParams(final PlaybackParams params) { if (params == null || params.getSpeed() == 0f) { throw new IllegalArgumentException(); } PlaybackParams current = getPlaybackParams(); MediaPlayerSource firstPlayer = mPlayer.getFirst(); if (firstPlayer.mMp2State != PLAYER_STATE_PLAYING) { mPlaybackParamsToSetWhenStarting = params; } else { firstPlayer.mPlayer.setPlaybackParams(params); mPlaybackParamsToSetWhenStarting = null; } if (current != null && current.getSpeed() != params.getSpeed()) { notifyPlayerEvent(new PlayerEventNotifier() { @Override public void notify(PlayerEventCallback cb) { cb.onPlaybackSpeedChanged(mMediaPlayerConnectorImpl, params.getSpeed()); } }); } mPlaybackParams = params; }