auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BufferedImage getImage() { final GraphicsConfiguration gc = device.getDefaultConfiguration(); final Rectangle bounds = gc.getBounds(); BufferedImage screen = robot.createScreenCapture(bounds); int width = resolution.width; int height = resolution.height; BufferedImage img = new BufferedImage(width, height, screen.getType()); Graphics2D g = img.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(screen, 0, 0, width, height, 0, 0, screen.getWidth(), screen.getHeight(), null); g.dispose(); return img; }

Target:
public BufferedImage getImage() { final GraphicsConfiguration gc = device.getDefaultConfiguration(); final Rectangle bounds = gc.getBounds(); BufferedImage screen = robot.createScreenCapture(bounds); int width = resolution.width; int height = resolution.height; if (screen.getWidth() == width && screen.getHeight() == height) { return screen; } BufferedImage img = new BufferedImage(width, height, screen.getType()); Graphics2D g = img.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(screen, 0, 0, width, height, 0, 0, screen.getWidth(), screen.getHeight(), null); g.dispose(); return img; }
Source:
public void addEmptyAction() { var parametersMap = new HashMap<String, String>(); for (ActionParameter actionParameter: this.actionParameters) { parametersMap.put(actionParameter.getName(), actionParameter.getName()+Integer.toString(actions.size())); } var newAction = new ScriptGeneratorAction(parametersMap); this.actions.add(newAction); firePropertyChange("actions", null, null); }

Target:
public void addEmptyAction() { var parametersMap = new HashMap<ActionParameter, String>(); for (ActionParameter actionParameter: this.actionParameters) { parametersMap.put(actionParameter, actionParameter.getName()+Integer.toString(actions.size())); } var newAction = new ScriptGeneratorAction(parametersMap); firePropertyChange("actions", actions, actions.add(newAction)); }
Source:
public void close() { SQLException exception = null; try { List<Cleanable> clnables = new ArrayList<>(this.cleanables); this.cleanables.clear(); Collections.reverse(clnables); for (Cleanable cleanable : clnables) { try { cleanable.close(); } catch (SQLException e) { if (exception == null) { exception = e; } else { exception.addSuppressed(e); } } } } finally { if (exception != null) { throw new CloseException("Exception thrown while cleaning StatementContext", exception); } } }

Target:
public void close() { SQLException exception = null; try { List<Cleanable> cleanables = new ArrayList<>(this.cleanables); this.cleanables.clear(); Collections.reverse(cleanables); for (Cleanable cleanable : cleanables) { try { cleanable.close(); } catch (SQLException e) { if (exception == null) { exception = e; } else { exception.addSuppressed(e); } } } } finally { if (exception != null) { throw new CloseException("Exception thrown while cleaning StatementContext", exception); } } }
Source:
public OAuthAPIProvider( @Nullable @Named("che.oauth.service_mode") String oauthType, Injector injector) { this.oauthType = oauthType == null ? "" : oauthType; this.injector = injector; }

Target:
public OAuthAPIProvider( @Nullable @Named("che.oauth.service_mode") String oauthType, Injector injector) { this.oauthType = oauthType; this.injector = injector; }
Source:
public void simulateUsbUnplug() throws IOException, JadbException { try (InputStream stream = device.executeShell("dumpsys", "battery", "unplug")) { Stream.flushRead(stream); stream.close(); } }

Target:
public void simulateUsbUnplug() throws IOException, JadbException { try (InputStream stream = device.executeShell("dumpsys", "battery", "unplug")) { Stream.flushRead(stream); } }
Source:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isExprResult()) { ClassMemberDeclaration declaration = ClassMemberDeclaration.newDeclarationOnThis(n); if (declaration == null || declarationHasBeenAdded(declaration)) { return; } Node fnNode = NodeUtil.getEnclosingFunction(n); Node fnParent = fnNode.getParent(); String fnName = (fnParent.isGetProp()) ? fnParent.getQualifiedName() : fnParent.getString(); if ("constructor".equals(fnName) && declaration.jsDoc != null && declaration.jsDoc.getType() != null && declaration.rhsEqualToField()) { JSTypeExpression declarationType = declaration.jsDoc.getType(); Node params = fnNode.getSecondChild(); JSDocInfo constructorJsDoc = NodeUtil.getBestJSDocInfo(fnNode); for (Node param : params.children()) { JSTypeExpression paramType = constructorJsDoc.getParameterType(param.getString()); if (declaration.memberName.equals(param.getString()) && declarationType.equals(paramType)) { moveAccessModifier(declaration, param); markAsConst(declaration, param); n.detachFromParent(); compiler.reportCodeChange(); return; } } } moveFieldsIntoClasses(declaration); registerDeclaration(declaration); } }

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isExprResult()) { ClassMemberDeclaration declaration = ClassMemberDeclaration.newDeclarationOnThis(n); if (declaration == null || declarationHasBeenAdded(declaration)) { return; } Node fnNode = NodeUtil.getEnclosingFunction(n); Node fnParent = fnNode.getParent(); String fnName = fnParent.isGetProp()? fnParent.getQualifiedName() : fnParent.getString(); if ("constructor".equals(fnName) && declaration.jsDoc != null && declaration.jsDoc.getType() != null && declaration.rhsEqualToField()) { JSTypeExpression declarationType = declaration.jsDoc.getType(); Node params = fnNode.getSecondChild(); JSDocInfo constructorJsDoc = NodeUtil.getBestJSDocInfo(fnNode); for (Node param : params.children()) { JSTypeExpression paramType = constructorJsDoc.getParameterType(param.getString()); if (declaration.memberName.equals(param.getString()) && declarationType.equals(paramType)) { moveAccessModifier(declaration, param); markAsConst(declaration, param); n.detachFromParent(); compiler.reportCodeChange(); return; } } } moveFieldsIntoClasses(declaration); registerDeclaration(declaration); } }
Source:
public void putAll(K key, Map<? extends HK, ? extends HV> m) { if (m.isEmpty()) { return; } byte[] rawKey = rawKey(key); int size = Math.min(RedisTemplate.REDIS_MAX_ARGS / 2 - 1, m.size()); Map<byte[], byte[]> hashes = new LinkedHashMap<>(size); Iterator<? extends Entry<? extends HK, ? extends HV>> entries = m.entrySet().iterator(); while (entries.hasNext()) { Entry<? extends HK, ? extends HV> entry = entries.next(); hashes.put(rawHashKey(entry.getKey()), rawHashValue(entry.getValue())); if (!entries.hasNext() || hashes.size() == size) { execute(connection -> { connection.hMSet(rawKey, hashes); return null; }, true); hashes.clear(); } } }

Target:
public void putAll(K key, Map<? extends HK, ? extends HV> m) { if (m.isEmpty()) { return; } byte[] rawKey = rawKey(key); Map<byte[], byte[]> hashes = new LinkedHashMap<>(m.size()); for (Map.Entry<? extends HK, ? extends HV> entry : m.entrySet()) { hashes.put(rawHashKey(entry.getKey()), rawHashValue(entry.getValue())); } execute(connection -> { connection.hMSet(rawKey, hashes); return null; }, true); }
Source:
public static SortedMap<Short, List<Container>> groupByKey(RoaringBitmap... bitmaps) { Map<Short, List<Container>> grouped = new HashMap<>(); for (RoaringBitmap bitmap : bitmaps) { RoaringArray ra = bitmap.highLowContainer; for (int i = 0; i < ra.size; ++i) { Container container = ra.values[i]; short key = ra.keys[i]; List<Container> slice = grouped.computeIfAbsent(key, k -> new ArrayList<>()); slice.add(container); } } SortedMap<Short, List<Container>> sorted = new TreeMap<>(Util::compareUnsigned); sorted.putAll(grouped); return sorted; }

Target:
public static SortedMap<Short, List<Container>> groupByKey(RoaringBitmap... bitmaps) { Map<Short, List<Container>> grouped = new HashMap<>(); for (RoaringBitmap bitmap : bitmaps) { RoaringArray ra = bitmap.highLowContainer; for (int i = 0; i < ra.size; ++i) { Container container = ra.values[i]; Short key = ra.keys[i]; List<Container> slice = grouped.get(key); if (null == slice) { slice = new ArrayList<>(); grouped.put(key, slice); } slice.add(container); } } SortedMap<Short, List<Container>> sorted = new TreeMap<>(Util::compareUnsigned); sorted.putAll(grouped); return sorted; }
Source:
public static boolean isRestBaseEnabled() { if (Prefs.forceRestBase()) { return Prefs.useRestBase(); } boolean useRestBase = shouldUseRestBase(); Prefs.setUseRestBase(useRestBase); return useRestBase; }

Target:
public boolean isRestBaseEnabled() { return Prefs.useRestBase(); }
Source:
public void setPortalEntity() { for(EntityRef portal : entityManager.getEntitiesWith(PortalComponent.class, LocationComponent.class)){ portalEntity = portal; } }

Target:
private void setPortalEntity() { for (EntityRef portal : entityManager.getEntitiesWith(PortalComponent.class, LocationComponent.class)) { portalEntity = portal; break; } }
Source:
protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(daoAuthProvider()); auth.eraseCredentials(false); auth.inMemoryAuthentication().withUser("admin").password("admin").roles("QUADRIGA_USER_ADMIN"); super.configure(auth); }

Target:
protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(daoAuthProvider()); auth.eraseCredentials(false); auth.inMemoryAuthentication().withUser(propertyManager.getProperty("admin_username")).password(propertyManager.getProperty("admin_password")).roles("QUADRIGA_USER_ADMIN"); super.configure(auth); }
Source:
public IWorkbenchPart[] getDirtyWorkbenchParts() { List<IWorkbenchPart> result = new ArrayList<>(3); IWorkbenchPartReference[] allParts = getSortedParts(true, true, true); boolean autoSave = WorkbenchPlugin.getDefault().getPreferenceStore() .getBoolean(IPreferenceConstants.SAVE_AUTOMATICALLY); for (int i = 0; i < allParts.length; i++) { IWorkbenchPartReference reference = allParts[i]; IWorkbenchPart part = reference.getPart(false); if (autoSave && part instanceof IAutoSaveableEditorPart) { if (((IAutoSaveableEditorPart) part).isDirty() && ((IAutoSaveableEditorPart) part).getAutoSavePolicy()) { result.add(part); } } else { ISaveablePart saveable = SaveableHelper.getSaveable(part); if (saveable != null) { if (saveable.isDirty()) { result.add(part); } } } } return result.toArray(new IWorkbenchPart[result.size()]); }

Target:
public IWorkbenchPart[] getDirtyWorkbenchParts() { List<IWorkbenchPart> result = new ArrayList<>(3); IWorkbenchPartReference[] allParts = getSortedParts(true, true, true); for (int i = 0; i < allParts.length; i++) { IWorkbenchPartReference reference = allParts[i]; IWorkbenchPart part = reference.getPart(false); ISaveablePart saveable = SaveableHelper.getSaveable(part); if (saveable != null) { if (saveable.isDirty()) { result.add(part); } } } return result.toArray(new IWorkbenchPart[result.size()]); }
Source:
public MoveDescription( final Collection<Unit> units, final Route route, final Map<Unit, Unit> unitsToTransports, final Map<Unit, Collection<Unit>> dependentUnits) { super(Collections.unmodifiableCollection(units)); this.route = Preconditions.checkNotNull(route); if (route.getEnd() == null || route.getStart() == null || route.hasNoSteps()) { throw new IllegalStateException("Invalid route: " + route); } this.unitsToTransports = Collections.unmodifiableMap(unitsToTransports); this.dependentUnits = Collections.unmodifiableMap( dependentUnits.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> Set.copyOf(e.getValue())))); }

Target:
public MoveDescription( final Collection<Unit> units, final Route route, final Map<Unit, Unit> unitsToTransports, final Map<Unit, Collection<Unit>> dependentUnits) { super(Collections.unmodifiableCollection(units)); this.route = Preconditions.checkNotNull(route); Preconditions.checkArgument(route.hasSteps()); this.unitsToTransports = Collections.unmodifiableMap(unitsToTransports); this.dependentUnits = Collections.unmodifiableMap( dependentUnits.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> Set.copyOf(e.getValue())))); }
Source:
public EntityInteractHandler getItemHandler() { return (p, entity, item, offhand) -> { if (!(entity instanceof WanderingTrader) && entity instanceof Merchant) { if (p.getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(item, false); } Villager v = (Villager) entity; v.setVillagerExperience(0); v.setProfession(Profession.NONE); Location l = v.getLocation().clone(); Double offset = ThreadLocalRandom.current().nextDouble(0, 0.5); boolean flip = false; double o1 = 0; double o2 = offset / 2; double o3 = 0; for(int i = 0; i < 10; i++) { flip = !flip; if(flip) { o1 = offset; o3 = offset * -1; } else { o1 = offset * -1; o3 = offset; } v.getWorld().spawnParticle(Particle.CRIMSON_SPORE, l, 3, o1, o2, o3,0.0d); if(i == 1 || i ==5) v.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, l, 3, 0.04d, 1d, 0.04d); } } }; }

Target:
public EntityInteractHandler getItemHandler() { return (e, item, offhand) -> { if (e.getRightClicked() instanceof Villager) { Villager v = (Villager) e.getRightClicked(); if (v.getProfession() == Profession.NONE || v.getProfession() == Profession.NITWIT) { return; } if (e.getPlayer().getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(item, false); } v.setVillagerExperience(0); v.setProfession(Profession.NONE); double offset = ThreadLocalRandom.current().nextDouble(0.5); v.getWorld().spawnParticle(Particle.CRIMSON_SPORE, v.getLocation(), 10, 0, offset / 2, 0,0.0d); v.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, v.getLocation(), 5, 0.04d, 1d, 0.04d); } }; }
Source:
public static boolean isEnabled( IConfiguration configuration, IBackupRestoreConfig backupRestoreConfig) { boolean enabled = false; try { enabled = (configuration.isIncrementalBackupEnabled() && (SnapshotBackup.isBackupEnabled(configuration) || (backupRestoreConfig.enableV2Backups() && SnapshotMetaTask.isBackupEnabled( configuration, backupRestoreConfig)))); if (!enabled) { Set<Path> backupPaths = AbstractBackup.getBackupDirectories( configuration, INCREMENTAL_BACKUP_FOLDER); for (Path backupDirPath : backupPaths) { FileUtils.cleanDirectory(backupDirPath.toFile()); } } } catch (Exception e) { logger.warn( "Error while trying to find if incremental backup is enabled: " + e.getMessage()); e.printStackTrace(); } return enabled; }

Target:
public static boolean isEnabled( IConfiguration configuration, IBackupRestoreConfig backupRestoreConfig) { boolean enabled = false; try { enabled = (configuration.isIncrementalBackupEnabled() && (SnapshotBackup.isBackupEnabled(configuration) || (backupRestoreConfig.enableV2Backups() && SnapshotMetaTask.isBackupEnabled( configuration, backupRestoreConfig)))); logger.info("Incremental backups are enabled: {}", enabled); if (!enabled) { cleanOldBackups(configuration); } } catch (Exception e) { logger.error( "Error while trying to find if incremental backup is enabled: " + e.getMessage()); } return enabled; }
Source:
private void registerJavaTypeSerializers() { registerConstant(Date.class, new DateSerializer()); registerConstant(BigInteger.class, new BigIntegerSerializer()); registerConstant(BigDecimal.class, new BigDecimalSerializer()); registerConstant(Class.class, new ClassSerializer()); registerConstant(Enum.class, new EnumSerializer()); registerConstant(ArrayList.class, new ArrayListStreamSerializer()); registerConstant(LinkedList.class, new LinkedListStreamSerializer()); MapStreamSerializer mapSerializer = new MapStreamSerializer(); registerConstant(HashMap.class, mapSerializer); registerConstant(ConcurrentHashMap.class, mapSerializer); registerConstant(HashSet.class, new SetStreamSerializer()); safeRegister(Serializable.class, javaSerializerAdapter); safeRegister(Externalizable.class, javaExternalizableAdapter); safeRegister(HazelcastJsonValue.class, new HazelcastJsonValueSerializer()); }

Target:
private void registerJavaTypeSerializers() { registerConstant(Class.class, new ClassSerializer()); registerConstant(Date.class, new DateSerializer()); registerConstant(BigInteger.class, new BigIntegerSerializer()); registerConstant(BigDecimal.class, new BigDecimalSerializer()); registerConstant(Enum.class, new EnumSerializer()); registerConstant(ArrayList.class, new ArrayListStreamSerializer()); registerConstant(LinkedList.class, new LinkedListStreamSerializer()); registerConstant(CopyOnWriteArrayList.class, new CopyOnWriteArrayListStreamSerializer()); registerConstant(HashMap.class, new HashMapStreamSerializer()); registerConstant(ConcurrentSkipListMap.class, new ConcurrentSkipListMapStreamSerializer()); registerConstant(ConcurrentHashMap.class, new ConcurrentHashMapStreamSerializer()); registerConstant(LinkedHashMap.class, new LinkedHashMapStreamSerializer()); registerConstant(TreeMap.class, new TreeMapStreamSerializer()); registerConstant(HashSet.class, new HashSetStreamSerializer()); registerConstant(TreeSet.class, new TreeSetStreamSerializer()); registerConstant(LinkedHashSet.class, new LinkedHashSetStreamSerializer()); registerConstant(CopyOnWriteArraySet.class, new CopyOnWriteArraySetStreamSerializer()); registerConstant(ConcurrentSkipListSet.class, new ConcurrentSkipListSetStreamSerializer()); registerConstant(ArrayDeque.class, new ArrayDequeStreamSerializer()); registerConstant(LinkedBlockingQueue.class, new LinkedBlockingQueueStreamSerializer()); registerConstant(ArrayBlockingQueue.class, new ArrayBlockingQueueStreamSerializer()); registerConstant(PriorityBlockingQueue.class, new PriorityBlockingQueueStreamSerializer()); registerConstant(DelayQueue.class, new DelayQueueStreamSerializer()); registerConstant(SynchronousQueue.class, new SynchronousQueueStreamSerializer()); registerConstant(LinkedTransferQueue.class, new LinkedTransferQueueStreamSerializer()); safeRegister(Serializable.class, javaSerializerAdapter); safeRegister(Externalizable.class, javaExternalizableAdapter); safeRegister(HazelcastJsonValue.class, new HazelcastJsonValueSerializer()); }
Source:
public static void main(String[] args) { A a = new A(); System.out.println(a.SayHi("a string 0", "a string 1", "a string 2", "a string 3", "a string 4", "a string 5", "a string 6", "a string 7", "a string 8", "a string 9")); iface b = (iface)a; System.out.println(b.SayHi("a string 0", "a string 1", "a string 2", "a string 3", "a string 4", "a string 5", "a string 6", "a string 7", "a string 8", "a string 9")); }

Target:
public static void main(String[] args) { A a = new A(); System.out.println(a.SayHi("a string 0", "a string 1", "a string 2", "a string 3", "a string 4", "a string 5", "a string 6", "a string 7", "a string 8", "a string 9")); Iface b = a; System.out.println(b.SayHi("a string 0", "a string 1", "a string 2", "a string 3", "a string 4", "a string 5", "a string 6", "a string 7", "a string 8", "a string 9")); }
Source:
private String extractWhat(DispatchCommand dcmd) { String commandName = dcmd.getCommandName(); String[] args = dcmd.getArguments(); for (int i = 1; i < args.length; i++) { commandName = commandName + "." + args[i]; } return commandName; }

Target:
private String extractWhat(DispatchCommand dcmd) { String commandName = dcmd.getCommandName(); for (String arg : dcmd.getArguments()) { commandName = commandName + "." + arg; } return commandName; }
Source:
public void testDesignatedFile() throws Exception{ MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); File designatedFile = new File(TEST_UTIL.getDataTestDir().toUri().getPath(), "designated_file"); HRegionServer designatedServer = cluster.getRegionServer(0); try(FileWriter fos = new FileWriter(designatedFile)) { String designatedHostname = designatedServer.getServerName().getHostname(); int designatedServerPort = designatedServer.getServerName().getPort(); String excludeServerName = designatedHostname + ":" + designatedServerPort; fos.write(excludeServerName); } int regionsInDesignatedServer = designatedServer.getNumberOfOnlineRegions(); HRegionServer regionServer = cluster.getRegionServer(1); String rsName = regionServer.getServerName().getHostname(); int port = regionServer.getServerName().getPort(); String rs = rsName + ":" + port; int regionsInRegionServer = regionServer.getNumberOfOnlineRegions(); RegionMoverBuilder rmBuilder = new RegionMoverBuilder(rs, TEST_UTIL.getConfiguration()) .designatedFile(designatedFile.getCanonicalPath()); try (RegionMover rm = rmBuilder.build()) { LOG.info("Unloading regions", rs); rm.unload(); assertEquals(0, regionServer.getNumberOfOnlineRegions()); assertEquals(regionsInDesignatedServer + regionsInRegionServer, designatedServer.getNumberOfOnlineRegions()); LOG.info("Before:{} After:{}", regionsInDesignatedServer, designatedServer.getNumberOfOnlineRegions()); } }

Target:
public void testDesignatedFile() throws Exception{ MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); File designatedFile = new File(TEST_UTIL.getDataTestDir().toUri().getPath(), "designated_file"); HRegionServer designatedServer = cluster.getRegionServer(0); try(FileWriter fos = new FileWriter(designatedFile)) { String designatedHostname = designatedServer.getServerName().getHostname(); int designatedServerPort = designatedServer.getServerName().getPort(); String excludeServerName = designatedHostname + ":" + designatedServerPort; fos.write(excludeServerName); } int regionsInDesignatedServer = designatedServer.getNumberOfOnlineRegions(); HRegionServer regionServer = cluster.getRegionServer(1); String rsName = regionServer.getServerName().getHostname(); int port = regionServer.getServerName().getPort(); String rs = rsName + ":" + port; int regionsInRegionServer = regionServer.getNumberOfOnlineRegions(); RegionMoverBuilder rmBuilder = new RegionMoverBuilder(rs, TEST_UTIL.getConfiguration()) .designatedFile(designatedFile.getCanonicalPath()); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading regions", rs); rm.unload(); assertEquals(0, regionServer.getNumberOfOnlineRegions()); assertEquals(regionsInDesignatedServer + regionsInRegionServer, designatedServer.getNumberOfOnlineRegions()); LOG.debug("Before:{} After:{}", regionsInDesignatedServer, designatedServer.getNumberOfOnlineRegions()); } }
Source:
protected final String getDotFunctionCallString(final String functionName, final ExpressionOperatorParameter parameters) { StringBuilder callString = new StringBuilder(children.get(0).getJavaString(parameters)).append(functionName).append("("); for (int i = 1; i < children.size(); ++i) { callString.append(children.get(i).getJavaString(parameters)); if (i != children.size() - 1) { callString.append(","); } } callString.append(")"); return callString.toString(); }

Target:
protected final String getDotFunctionCallString(final String functionName, final ExpressionOperatorParameter parameters) { StringBuilder callString = new StringBuilder(children.get(0).getJavaString(parameters)).append(functionName).append("("); Iterator<ExpressionOperator> it = children.iterator(); it.next(); if (it.hasNext()) { callString.append(it.next().getJavaString(parameters)); while (it.hasNext()) { callString.append(","); callString.append(it.next().getJavaString(parameters)); } } callString.append(")"); return callString.toString(); }
Source:
public Range toMetadataRange() { Text metadataPrevRow; if (textPrevEndRow == null) metadataPrevRow = TabletsSection.getRow(getTableId(), new Text("")); else metadataPrevRow = TabletsSection.getRow(getTableId(), this.textPrevEndRow); return new Range(metadataPrevRow, getPrevEndRow() == null, getMetadataEntry(), true); }

Target:
public Range toMetadataRange() { Text metadataPrevRow = TabletsSection.getRow(getTableId(), getPrevEndRow() == null ? EMPTY_TEXT : getPrevEndRow()); return new Range(metadataPrevRow, getPrevEndRow() == null, getMetadataEntry(), true); }
Source:
public void test() { TestApplication app = new TestApplication(); Map mysqlConf = MutableMap.of("creationScriptContents", SCRIPT); MySqlNode mySqlNode = new MySqlNode(mysqlConf, app); Drupal drupal = new Drupal(app); drupal.setConfig(Drupal.DATABASE_HOST, "127.0.0.1"); drupal.setConfig(Drupal.DATABASE_SCHEMA, "drupal"); drupal.setConfig(Drupal.DATABASE_USER, "drupal"); drupal.setConfig(Drupal.DATABASE_PORT, DependentConfiguration.attributeWhenReady(mySqlNode, MySqlNode.MYSQL_PORT)); drupal.setConfig(Drupal.DATABASE_PASSWORD, "password"); drupal.setConfig(Drupal.ADMIN_EMAIL, "alarmnummer@gmail.com"); drupal.setConfig(Drupal.DATABASE_UP, DependentConfiguration.attributeWhenReady(mySqlNode, MySqlNode.SERVICE_UP)); Entities.startManagement(app); app.start(Arrays.asList(location)); HttpTestUtils.assertContentEventuallyContainsText("http://" + location.getAddress().getHostName() + "/index.php", "Welcome"); }

Target:
public void test() { Map mysqlConf = MutableMap.of("creationScriptContents", SCRIPT); MySqlNode mySqlNode = new MySqlNode(mysqlConf, app); Drupal drupal = new Drupal(app); drupal.setConfig(Drupal.DATABASE_HOST, "127.0.0.1"); drupal.setConfig(Drupal.DATABASE_SCHEMA, "drupal"); drupal.setConfig(Drupal.DATABASE_USER, "drupal"); drupal.setConfig(Drupal.DATABASE_PORT, DependentConfiguration.attributeWhenReady(mySqlNode, MySqlNode.MYSQL_PORT)); drupal.setConfig(Drupal.DATABASE_PASSWORD, "password"); drupal.setConfig(Drupal.ADMIN_EMAIL, "alarmnummer@gmail.com"); drupal.setConfig(Drupal.DATABASE_UP, DependentConfiguration.attributeWhenReady(mySqlNode, MySqlNode.SERVICE_UP)); Entities.startManagement(app); app.start(Arrays.asList(location)); HttpTestUtils.assertContentEventuallyContainsText("http://" + drupal.getAttribute(Drupal.HOSTNAME) + "/index.php", "Welcome"); }
Source:
public <R> R getOwnedEntities(MambuEntityType parentEntity, String parentId, MambuEntityType ownedEntity, String relatedEntityId, ParamsMap params, boolean requiresFullDetails) throws MambuApiException { if (parentEntity == null || ownedEntity == null) { throw new IllegalArgumentException("Parent Entity and Owned Entity cannot be null"); } Class<?> parentClass = parentEntity.getEntityClass(); Class<?> ownedClass = ownedEntity.getEntityClass(); ApiDefinition apiDefinition ; apiDefinition = createApiDefinitionForGetOwnedEntities(requiresFullDetails, parentClass, ownedClass); return execute(apiDefinition, parentId, relatedEntityId, params); }

Target:
public <R> R getOwnedEntities(MambuEntityType parentEntity, String parentId, MambuEntityType ownedEntity, String relatedEntityId, ParamsMap params, boolean requiresFullDetails) throws MambuApiException { if (parentEntity == null || ownedEntity == null) { throw new IllegalArgumentException("Parent Entity and Owned Entity cannot be null"); } Class<?> parentClass = parentEntity.getEntityClass(); Class<?> ownedClass = ownedEntity.getEntityClass(); ApiDefinition apiDefinition = createApiDefinitionForGetOwnedEntities(requiresFullDetails, parentClass, ownedClass); return execute(apiDefinition, parentId, relatedEntityId, params); }
Source:
public Answer execute(final OvsCreateTunnelCommand command, final LibvirtComputingResource libvirtComputingResource) { final String bridge = command.getNetworkName(); try { if (!libvirtComputingResource.findOrCreateTunnelNetwork(bridge)) { s_logger.debug("Error during bridge setup"); return new OvsCreateTunnelAnswer(command, false, "Cannot create network", bridge); } libvirtComputingResource.configureTunnelNetwork(command.getNetworkId(), command.getFrom(), command.getNetworkName()); final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout().getMillis(), s_logger); scriptCommand.add("create_tunnel"); scriptCommand.add("--bridge", bridge); scriptCommand.add("--remote_ip", command.getRemoteIp()); scriptCommand.add("--key", command.getKey().toString()); scriptCommand.add("--src_host", command.getFrom().toString()); scriptCommand.add("--dst_host", command.getTo().toString()); final String result = scriptCommand.execute(); if (result != null) { return new OvsCreateTunnelAnswer(command, true, result, null, bridge); } else { return new OvsCreateTunnelAnswer(command, false, result, bridge); } } catch (final Exception e) { s_logger.warn("Caught execption when creating ovs tunnel", e); return new OvsCreateTunnelAnswer(command, false, e.getMessage(), bridge); } }

Target:
public Answer execute(final OvsCreateTunnelCommand command, final LibvirtComputingResource libvirtComputingResource) { final String bridge = command.getNetworkName(); try { if (!libvirtComputingResource.findOrCreateTunnelNetwork(bridge)) { s_logger.debug("Error during bridge setup"); return new OvsCreateTunnelAnswer(command, false, "Cannot create network", bridge); } libvirtComputingResource.configureTunnelNetwork(command.getNetworkId(), command.getFrom(), command.getNetworkName()); final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout(), s_logger); scriptCommand.add("create_tunnel"); scriptCommand.add("--bridge", bridge); scriptCommand.add("--remote_ip", command.getRemoteIp()); scriptCommand.add("--key", command.getKey().toString()); scriptCommand.add("--src_host", command.getFrom().toString()); scriptCommand.add("--dst_host", command.getTo().toString()); final String result = scriptCommand.execute(); if (result != null) { return new OvsCreateTunnelAnswer(command, true, result, null, bridge); } else { return new OvsCreateTunnelAnswer(command, false, result, bridge); } } catch (final Exception e) { s_logger.warn("Caught execption when creating ovs tunnel", e); return new OvsCreateTunnelAnswer(command, false, e.getMessage(), bridge); } }
Source:
private HashMap<String, ArrayList<String>> getMappedIssuesToFiles(Collection<PostJobIssue> allIssues) { HashMap<String, ArrayList<String>> issueToFilesMap = new HashMap<>(); if (!this.includeFilesInOverview) { return issueToFilesMap; } for (PostJobIssue issue : allIssues) { String title = this.printIssueMarkdown(issue); if (!issueToFilesMap.containsKey(title)) { issueToFilesMap.put(title, new ArrayList<>()); } if (issueToFilesMap.get(title).size() >= MAX_FILES_PER_ISSUE) { continue; } Integer issueLine = issue.line(); if (issueLine == null) { issueLine = 0; } issueToFilesMap.get(title).add(this.parseFileName(issue.componentKey(), issueLine)); } return issueToFilesMap; }

Target:
private ListMultimap<String, String> getMappedIssuesToFiles(Collection<PostJobIssue> allIssues) { ListMultimap<String, String> issueToFilesMap = ArrayListMultimap.create(); if (this.includeFilesInOverview <= 0) { return issueToFilesMap; } for (PostJobIssue issue : allIssues) { String title = this.printIssueMarkdown(issue); Integer issueLine = issue.line(); if (issueLine == null) { issueLine = 0; } issueToFilesMap.get(title).add(this.issuePathResolver.getIssuePath(issue) + ":" + issueLine); } this.sortMappedIssuesToFiles(issueToFilesMap); return issueToFilesMap; }
Source:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { BaseImagesCommand cloneCinderDiskCommand = (BaseImagesCommand) command; ImagesContainterParametersBase parameters = (ImagesContainterParametersBase) cloneCinderDiskCommand.getParameters(); ImageStatus imageStatus = cloneCinderDiskCommand.getCinderBroker().getDiskStatus(parameters.getDestinationImageId()); DiskImage disk = (CinderDisk) DbFacade.getInstance().getDiskDao().get(parameters.getContainerId()); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case OK: setCommandEndStatus(command, false, status, childCmdIds); break; case ILLEGAL: setCommandEndStatus(command, true, status, childCmdIds); break; } } }

Target:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { BaseImagesCommand cloneCinderDiskCommand = (BaseImagesCommand) command; ImagesContainterParametersBase parameters = (ImagesContainterParametersBase) cloneCinderDiskCommand.getParameters(); ImageStatus imageStatus = cloneCinderDiskCommand.getCinderBroker().getDiskStatus(parameters.getDestinationImageId()); DiskImage disk = (CinderDisk) diskDao.get(parameters.getContainerId()); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case OK: setCommandEndStatus(command, false, status, childCmdIds); break; case ILLEGAL: setCommandEndStatus(command, true, status, childCmdIds); break; } } }
Source:
public void testMultiIntervalSerde() throws Exception { String jsonStr = "{\n" + " \"dataSource\": \"test\",\n" + " \"intervals\": [\"2014/2015\", \"2016/2017\"]\n" + "}\n"; DatasourceIngestionSpec actual = MAPPER.readValue( MAPPER.writeValueAsString( MAPPER.readValue(jsonStr, DatasourceIngestionSpec.class) ), DatasourceIngestionSpec.class ); List<Interval> intervals = ImmutableList.of(Interval.parse("2014/2015"), Interval.parse("2016/2017")); DatasourceIngestionSpec expected = new DatasourceIngestionSpec( "test", null, intervals, null, null, null, null, null ); Assert.assertEquals(expected, actual); jsonStr = "{\n" + " \"dataSource\": \"test\",\n" + " \"intervals\": [\"2014/2015\", \"2016/2017\"],\n" + " \"filter\": { \"type\": \"selector\", \"dimension\": \"dim\", \"value\": \"value\"},\n" + " \"granularity\": \"day\",\n" + " \"dimensions\": [\"d1\", \"d2\"],\n" + " \"metrics\": [\"m1\", \"m2\", \"m3\"],\n" + " \"ignoreWhenNoSegments\": true\n" + "}\n"; expected = new DatasourceIngestionSpec( "test", null, intervals, new SelectorDimFilter("dim", "value"), QueryGranularity.DAY, Lists.newArrayList("d1", "d2"), Lists.newArrayList("m1", "m2", "m3"), true ); actual = MAPPER.readValue( MAPPER.writeValueAsString( MAPPER.readValue(jsonStr, DatasourceIngestionSpec.class) ), DatasourceIngestionSpec.class ); Assert.assertEquals(expected, actual); }

Target:
public void testMultiIntervalSerde() throws Exception { String jsonStr = "{\n" + " \"dataSource\": \"test\",\n" + " \"intervals\": [\"2014/2015\", \"2016/2017\"]\n" + "}\n"; DatasourceIngestionSpec actual = MAPPER.readValue( MAPPER.writeValueAsString( MAPPER.readValue(jsonStr, DatasourceIngestionSpec.class) ), DatasourceIngestionSpec.class ); List<Interval> intervals = ImmutableList.of(Interval.parse("2014/2015"), Interval.parse("2016/2017")); DatasourceIngestionSpec expected = new DatasourceIngestionSpec( "test", null, intervals, null, null, null, null, false ); Assert.assertEquals(expected, actual); jsonStr = "{\n" + " \"dataSource\": \"test\",\n" + " \"intervals\": [\"2014/2015\", \"2016/2017\"],\n" + " \"filter\": { \"type\": \"selector\", \"dimension\": \"dim\", \"value\": \"value\"},\n" + " \"granularity\": \"day\",\n" + " \"dimensions\": [\"d1\", \"d2\"],\n" + " \"metrics\": [\"m1\", \"m2\", \"m3\"],\n" + " \"ignoreWhenNoSegments\": true\n" + "}\n"; expected = new DatasourceIngestionSpec( "test", null, intervals, new SelectorDimFilter("dim", "value"), QueryGranularity.DAY, Lists.newArrayList("d1", "d2"), Lists.newArrayList("m1", "m2", "m3"), true ); actual = MAPPER.readValue( MAPPER.writeValueAsString( MAPPER.readValue(jsonStr, DatasourceIngestionSpec.class) ), DatasourceIngestionSpec.class ); Assert.assertEquals(expected, actual); }
Source:
public StringIteratorInputStream(Iterator<String> data) { this.data = data; }

Target:
public StringIteratorInputStream(Iterator<String> data) { this.data = requireNonNull(data, "data is null"); }
Source:
public TypeSerializer<T> getSerializer() { if (serializer != null) { return serializer; } else { throw new RuntimeException("SerializerFactory ahas not been initialized from configuration."); } }

Target:
public TypeSerializer<T> getSerializer() { if (serializer != null) { return serializer; } else { throw new RuntimeException("SerializerFactory has not been initialized from configuration."); } }
Source:
public void seek(final long position) throws IOException { if (this.position == position) { return; } if ((position > this.position && (position - this.position < this.bufferedStream.getBytesInBufferAvailable())) || (position < this.position && (this.position - position < this.bufferedStream.getPositionInBuffer()))) { this.bufferedStream.changePos((int) (position - this.position)); } else { wrappedStream.seek(position); bufferedStream = new ExtBufferedInputStream(wrappedStream, bufferSize); } this.position = position; }

Target:
public void seek(final long position) throws IOException { if (this.position == position) { return; } long delta = position - this.position; if (this.bufferedStream.canChangePos(delta)) { this.bufferedStream.changePos((int) delta); this.position = position; } else { seekInternal(position); } }
Source:
private int showSliderSettings(int row) { for (String key : settings.getSliderSettings()) { Label label = new Label(settings.getDescription(key)); Slider slider = new Slider(); double value = settings.getSlider(key); Label valueLabel = new Label(Math.round(value * 100) + "%"); slider.setValue(100 * value); slider.setMaxWidth(200); slider.setMin(0); slider.setMax(100); slider.valueProperty().addListener(e -> { settings.setSlider(key, slider.getValue() / 100); valueLabel.setText(Math.round(slider.getValue()) + "%"); }); HBox box = new HBox(); box.setSpacing(10); box.getChildren().addAll(slider, valueLabel); gridPane.add(label, 0, row); gridPane.add(box, 1, row); row++; } return row; }

Target:
private int showSliderSettings(int row) { for (String key : settings.getSliderSettings()) { Label label = new Label(settings.getDescription(key)); label.setTooltip(new Tooltip(key)); Slider slider = new Slider(); double value = settings.getSlider(key); Label valueLabel = new Label(Math.round(value * 100) + "%"); slider.setValue(100 * value); slider.setMaxWidth(200); slider.setMin(0); slider.setMax(100); slider.valueProperty().addListener(e -> { settings.setSlider(key, slider.getValue() / 100); valueLabel.setText(Math.round(slider.getValue()) + "%"); }); HBox box = new HBox(); box.setSpacing(10); box.getChildren().addAll(slider, valueLabel); gridPane.add(label, 0, row); gridPane.add(box, 1, row); row++; } return row; }
Source:
public IContentProposal[] getProposals(final String arg0, final int arg1) { IContentProposal[] proposals = null; if (currentEObject != null) { final List<ContentProposal> contentProposalsList = Lists.newArrayList(); ContentInstanceContext context = new ContentInstanceContext(currentEObject, arg0, arg1, editingDomain); if (interpreter instanceof IProposalProvider) { contentProposalsList.addAll(((IProposalProvider) interpreter).getProposals(interpreter, context)); } final List<IProposalProvider> providers = ProposalProviderRegistry.getProvidersFor(interpreter); for (IProposalProvider provider : providers) { contentProposalsList.addAll(provider.getProposals(interpreter, context)); } String proposalStart = null; if (!interpreter.provides(arg0)) { proposalStart = arg0; } else { String prefix = CompoundInterpreter.INSTANCE.getVariablePrefix(arg0); ContentContextHelper helper = new ContentContextHelper(arg0, arg1, prefix); proposalStart = helper.getProposalStart(); } proposals = new ContentProposalConverter(proposalStart).convertToJFaceContentProposals(contentProposalsList); } return proposals; }

Target:
public IContentProposal[] getProposals(final String arg0, final int arg1) { if (currentEObject != null) { final List<ContentProposal> contentProposalsList; if (StringUtil.isEmpty(arg0)) { contentProposalsList = CompoundInterpreter.INSTANCE.getAllNewEmtpyExpressions(); } else { contentProposalsList = Lists.newArrayList(); if (interpreter instanceof IProposalProvider) { contentProposalsList.addAll(((IProposalProvider) interpreter).getProposals(interpreter, new ContentInstanceContext(currentEObject, arg0, arg1, editingDomain))); } final List<IProposalProvider> providers = ProposalProviderRegistry.getProvidersFor(interpreter); for (IProposalProvider provider : providers) { contentProposalsList.addAll(provider.getProposals(interpreter, new ContentInstanceContext(currentEObject, arg0, arg1, editingDomain))); } } String prefix = CompoundInterpreter.INSTANCE.getVariablePrefix(arg0); ContentContextHelper helper = new ContentContextHelper(arg0, arg1, prefix); return new ContentProposalConverter(helper.getProposalStart()).convertToJFaceContentProposals(contentProposalsList); } else { return null; } }
Source:
public WebDriver window(int index) { try { return Wait().until(windowToBeAvailableAndSwitchToIt(index)); } catch (TimeoutException e) { throw new NoSuchWindowException("Window with index not found: " + index); } }

Target:
public WebDriver window(int index) { try { return Wait().until(windowToBeAvailableAndSwitchToIt(index)); } catch (TimeoutException e) { throw new NoSuchWindowException("No window found with index: " + index, e); } }
Source:
@Nullable static String errorCode(Throwable error) { if (error instanceof RpcException) { int code = ((RpcException) error).getCode(); switch (code) { case RpcException.UNKNOWN_EXCEPTION: return "UNKNOWN_EXCEPTION"; case RpcException.NETWORK_EXCEPTION: return "NETWORK_EXCEPTION"; case RpcException.TIMEOUT_EXCEPTION: return "TIMEOUT_EXCEPTION"; case RpcException.BIZ_EXCEPTION: return "BIZ_EXCEPTION"; case RpcException.FORBIDDEN_EXCEPTION: return "FORBIDDEN_EXCEPTION"; case RpcException.SERIALIZATION_EXCEPTION: return "SERIALIZATION_EXCEPTION"; default: return String.valueOf(code); } } return null; }

Target:
@Nullable static String errorCode(Throwable error) { if (error instanceof RpcException) { return String.valueOf(((RpcException) error).getCode()); } return null; }
Source:
public void shareWrongStoreWithMapTest() throws Exception { CompilerHelper helper = new CompilerHelper(); Map<String, Object> kieMap = new HashMap<>(); String compilationID = UUID.randomUUID().toString(); kieMap.put("compilation.ID", compilationID); File dir = new File(System.getProperty("user.dir") + File.separator + "dir" + File.separator); URL url = dir.toURL(); ClassLoader cl = new URLClassLoader(new URL[]{url}); helper.shareStoreWithMap(cl, compilationID, kieMap, log); StringBuilder sbTypes = new StringBuilder(compilationID).append(".").append("ProjectClassloaderStore"); kieMap.get(sbTypes.toString()); Map store = (Map) kieMap.get(sbTypes.toString()); assertThat(store).isNull(); }

Target:
public void shareWrongStoreWithMapTest() throws Exception { CompilerHelper helper = new CompilerHelper(); String compilationID = UUID.randomUUID().toString(); Map<String,Object> kieMap = Collections.singletonMap("compilation.ID", compilationID); File dir = new File(System.getProperty("user.dir") + File.separator + "dir" + File.separator); URL url = dir.toURL(); ClassLoader cl = new URLClassLoader(new URL[]{url}); helper.shareStoreWithMap(cl, compilationID, kieMap, log); StringBuilder sbTypes = new StringBuilder(compilationID).append(".").append("ProjectClassloaderStore"); kieMap.get(sbTypes.toString()); Map store = (Map) kieMap.get(sbTypes.toString()); assertThat(store).isNull(); }
Source:
public static TypeName forTypeMirror(TypeMirror mirror) { return mirror.accept(new SimpleTypeVisitor6<TypeName, Void>() { @Override protected TypeName defaultAction(TypeMirror e, Void p) { throw new IllegalArgumentException(e.toString()); } @Override public ArrayTypeName visitArray(ArrayType t, Void p) { return new ArrayTypeName(t.getComponentType().accept(this, null)); } @Override public TypeName visitDeclared(DeclaredType t, Void p) { return t.getTypeArguments().isEmpty() ? ClassName.fromTypeElement((TypeElement) t.asElement()) : new ParameterizedTypeName( ClassName.fromTypeElement((TypeElement) t.asElement()), FluentIterable.from(t.getTypeArguments()).transform(FOR_TYPE_MIRROR)); } @Override public PrimitiveName visitPrimitive(PrimitiveType t, Void p) { return PrimitiveName.forTypeMirror(t); } @Override public TypeName visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) { return TypeVariableName.forTypeMirror(t); } @Override public WildcardName visitWildcard(WildcardType t, Void p) { return WildcardName.forTypeMirror(t); } @Override public NullName visitNull(NullType t, Void p) { return NullName.NULL; } @Override public TypeName visitNoType(NoType t, Void p) { switch (t.getKind()) { case VOID: return VoidName.VOID; case PACKAGE: throw new IllegalArgumentException(); default: throw new IllegalStateException(); } } }, null); }

Target:
public static TypeName forTypeMirror(TypeMirror mirror) { return mirror.accept(new SimpleTypeVisitor6<TypeName, Void>() { @Override protected TypeName defaultAction(TypeMirror e, Void p) { throw new IllegalArgumentException(e.toString()); } @Override public ArrayTypeName visitArray(ArrayType t, Void p) { return new ArrayTypeName(t.getComponentType().accept(this, null)); } @Override public TypeName visitDeclared(DeclaredType t, Void p) { return t.getTypeArguments().isEmpty() ? ClassName.fromTypeElement((TypeElement) t.asElement()) : new ParameterizedTypeName( ClassName.fromTypeElement((TypeElement) t.asElement()), FluentIterable.from(t.getTypeArguments()).transform(FOR_TYPE_MIRROR)); } @Override public PrimitiveName visitPrimitive(PrimitiveType t, Void p) { return PrimitiveName.forTypeMirror(t); } @Override public TypeName visitTypeVariable(TypeVariable t, Void p) { return TypeVariableName.forTypeMirror(t); } @Override public WildcardName visitWildcard(WildcardType t, Void p) { return WildcardName.forTypeMirror(t); } @Override public NullName visitNull(NullType t, Void p) { return NullName.NULL; } @Override public TypeName visitNoType(NoType t, Void p) { switch (t.getKind()) { case VOID: return VoidName.VOID; case PACKAGE: throw new IllegalArgumentException(); default: throw new IllegalStateException(); } } }, null); }
Source:
public Content(PluginInfo pluginInfo, PluginInfo.Release pluginRelease) { this.pluginId = pluginInfo.getId(); this.description = pluginInfo.getDescription(); this.provider = pluginInfo.getProvider(); this.version = pluginRelease.getVersion(); this.releaseDate = pluginRelease.getDate(); this.parsedRequires = pluginRelease.getParsedRequires(); this.binaryUrl = pluginRelease.getUrl(); this.sha512sum = pluginRelease.getSha512sum(); this.preferred = pluginRelease.isPreferred(); this.lastModified = pluginRelease.getLastModified().toString(); }

Target:
public Content(PluginInfo pluginInfo, PluginInfo.Release pluginRelease) { this.pluginId = pluginInfo.getId(); this.description = pluginInfo.getDescription(); this.provider = pluginInfo.getProvider(); this.version = pluginRelease.getVersion(); this.releaseDate = pluginRelease.getDate(); this.requires = pluginRelease.getRequires(); this.parsedRequires = pluginRelease.getParsedRequires(); this.binaryUrl = pluginRelease.getUrl(); this.sha512sum = pluginRelease.getSha512sum(); this.preferred = pluginRelease.isPreferred(); Instant lastModified = pluginRelease.getLastModified(); this.lastModified = lastModified != null ? lastModified.toString() : null; }
Source:
public void distinctAsync_rememberQueryParams() { final Realm realm = looperThread.realm; realm.beginTransaction(); final int TEST_SIZE = 10; for (int i = 0; i < TEST_SIZE; i++) { realm.createObject(AllJavaTypes.class, i); } realm.commitTransaction(); RealmResults<AllJavaTypes> results = realm.where(AllJavaTypes.class) .notEqualTo(AllJavaTypes.FIELD_ID, TEST_SIZE / 2) .distinctAsync(AllJavaTypes.FIELD_ID); results.addChangeListener(new RealmChangeListener<RealmResults<AllJavaTypes>>() { @Override public void onChange(RealmResults<AllJavaTypes> results) { assertEquals(TEST_SIZE - 1, results.size()); looperThread.testComplete(); } }); }

Target:
public void distinctAsync_rememberQueryParams() { final Realm realm = looperThread.realm; realm.beginTransaction(); final int TEST_SIZE = 10; for (int i = 0; i < TEST_SIZE; i++) { realm.createObject(AllJavaTypes.class, i); } realm.commitTransaction(); RealmResults<AllJavaTypes> results = realm.where(AllJavaTypes.class) .notEqualTo(AllJavaTypes.FIELD_ID, TEST_SIZE / 2) .distinctAsync(AllJavaTypes.FIELD_ID); results.addChangeListener(new RealmChangeListener<RealmResults<AllJavaTypes>>() { @Override public void onChange(RealmResults<AllJavaTypes> results) { assertEquals(TEST_SIZE - 1, results.size()); assertEquals(0, results.where().equalTo(AllJavaTypes.FIELD_ID, TEST_SIZE / 2).count()); looperThread.testComplete(); } }); }