auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object visit(ASTUserClass node, Object data) { if (Helper.isTestMethodOrClass(node)) { return data; } List<ASTVariableDeclaration> variableDecls = node.findDescendantsOfType(ASTVariableDeclaration.class); for (ASTVariableDeclaration varDecl : variableDecls) { findSafeLiterals(varDecl); } List<ASTFieldDeclaration> fieldDecl = node.findDescendantsOfType(ASTFieldDeclaration.class); for (ASTFieldDeclaration fDecl : fieldDecl) { findSafeLiterals(fDecl); } List<ASTNewObjectExpression> newObjects = node.findDescendantsOfType(ASTNewObjectExpression.class); for (ASTNewObjectExpression newObj : newObjects) { checkNewObjects(newObj, data); } <START> return data; <END> }</code><technical_language>#163 add a listOfStringLiteralVariables.clear() change listOfStringLiteralVariables a local var</technical_language>

Target:
public Object visit(ASTUserClass node, Object data) { if (Helper.isTestMethodOrClass(node)) { return data; } List<ASTVariableDeclaration> variableDecls = node.findDescendantsOfType(ASTVariableDeclaration.class); for (ASTVariableDeclaration varDecl : variableDecls) { findSafeLiterals(varDecl); } List<ASTFieldDeclaration> fieldDecl = node.findDescendantsOfType(ASTFieldDeclaration.class); for (ASTFieldDeclaration fDecl : fieldDecl) { findSafeLiterals(fDecl); } List<ASTNewObjectExpression> newObjects = node.findDescendantsOfType(ASTNewObjectExpression.class); for (ASTNewObjectExpression newObj : newObjects) { checkNewObjects(newObj, data); } listOfStringLiteralVariables.clear(); return data; }
Source:
<code>void join(RowMutationState newRow) { <START> for (Map.Entry<PColumn,byte[]> valueEntry : newRow.getColumnValues().entrySet()) { <END> getColumnValues().put(valueEntry.getKey(), valueEntry.getValue()); } getOrderOfStatementsInConnection().addAll(newRow.getOrderOfStatementsInConnection()); }</code><technical_language>this for loop replaced getColumnValues().putAll(newRow.getColumnValues())</technical_language>

Target:
void join(RowMutationState newRow) { getColumnValues().putAll(newRow.getColumnValues()); statementIndexes = joinSortedIntArrays(statementIndexes, newRow.getStatementIndexes()); }
Source:
<code>protected void execute(OperationContext context, ModelNode operation, InstallationManager instMgr, String patchStream) throws OperationFailedException { try { if (patchStream != null) { final InstalledIdentity installedIdentity = instMgr.getInstalledIdentity(patchStream, null); ageOutHistory(installedIdentity); } else { for (InstalledIdentity installedIdentity : instMgr.getInstalledIdentities()) { ageOutHistory(installedIdentity); } } } catch (PatchingException e) { <START> throw new OperationFailedException(PatchLogger.ROOT_LOGGER.failedToLoadIdentity(), e); <END> } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }</code><technical_language>Is this failure due a client mistake? If not, a RuntimeException of some sort thrown, OFE represents a client mistake is logged in server.log DEBUG. Also, some point exceptions trigger proper HTTP response codes (versus current 500) in http interface, OFE result in a 4xx. worry this for this patch; this other places in patching code. question is intended trigger a general review some point of throwing OFE in patching resources</technical_language>

Target:
protected void execute(OperationContext context, ModelNode operation, InstallationManager instMgr, String patchStream) throws OperationFailedException { try { if (patchStream != null) { final InstalledIdentity installedIdentity = instMgr.getInstalledIdentity(patchStream, null); ageOutHistory(installedIdentity); } else { for (InstalledIdentity installedIdentity : instMgr.getInstalledIdentities()) { ageOutHistory(installedIdentity); } } } catch (PatchingException e) { throw new IllegalStateException(PatchLogger.ROOT_LOGGER.failedToLoadIdentity(), e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
Source:
<code>public void executeOn(Project project, SensorContext context) { if (projectIssues != null && projectIssues.issues() != null) { for (org.sonar.api.issue.Issue i : projectIssues.issues()) { <START> System.out.println(i.ruleKey() + ": " + i.message()); <END> } } try { boolean notifyStash = config.hasToNotifyStash(); if (notifyStash) { String stashURL = stashRequestFacade.getStashURL(); int stashTimeout = config.getStashTimeout(); StashCredentials stashCredentials = stashRequestFacade.getCredentials(); try (StashClient stashClient = new StashClient(stashURL, stashCredentials, stashTimeout, config.getSonarQubeVersion())) { updateStashWithSonarInfo(stashClient, stashCredentials, project, context); } } } catch (StashConfigurationException e) { LOGGER.error("Unable to push SonarQube report to Stash: {}", e.getMessage()); LOGGER.debug(STACK_TRACE, e); } }</code><technical_language>Please, LOGGER instead of System.out.println</technical_language>

Target:
public void executeOn(Project project, SensorContext context) { try { boolean notifyStash = config.hasToNotifyStash(); if (notifyStash) { String stashURL = stashRequestFacade.getStashURL(); int stashTimeout = config.getStashTimeout(); StashCredentials stashCredentials = stashRequestFacade.getCredentials(); try (StashClient stashClient = new StashClient(stashURL, stashCredentials, stashTimeout, config.getSonarQubeVersion())) { updateStashWithSonarInfo(stashClient, stashCredentials); } } } catch (StashConfigurationException e) { LOGGER.error("Unable to push SonarQube report to Stash: {}", e.getMessage()); LOGGER.debug(STACK_TRACE, e); } }
Source:
<code>public void verifyQuerySucceedsAfterClear() throws Exception { Region cities = clientCacheRule.createProxyRegion("cities"); IntStream.range(0, 100).forEach(i -> cities.put(i, new City(i))); MemberVM.invokeInEveryMember(() -> { InternalCache internalCache = ClusterStartupRule.getCache(); Region region = internalCache.getRegion("cities"); assertThat(region.size()).isEqualTo(100); }, server1, server2); QueryService queryService = clientCache.getQueryService(); Query query = queryService.newQuery(MUMBAI_QUERY); Query query2 = queryService.newQuery(ID_10_QUERY); assertThat(((SelectResults) query.execute()).size()).isEqualTo(50); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(1); cities.clear(); MemberVM.invokeInEveryMember(() -> { InternalCache internalCache = ClusterStartupRule.getCache(); Region region = internalCache.getRegion("cities"); assertThat(region.size()).isEqualTo(0); }, server1, server2); assertThat(((SelectResults) query.execute()).size()).isEqualTo(0); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(0); MemberVM.invokeInEveryMember(() -> { InternalCache internalCache = ClusterStartupRule.getCache(); QueryService qs = internalCache.getQueryService(); Region region = internalCache.getRegion("cities"); <START> Index cityId = qs.getIndex(region, "cityId"); <END> IndexStatistics statistics = cityId.getStatistics(); assertThat(statistics.getNumberOfKeys()).isEqualTo(0); assertThat(statistics.getNumberOfValues()).isEqualTo(0); Index cityName = qs.getIndex(region, "cityName"); IndexStatistics statistics1 = cityName.getStatistics(); assertThat(statistics1.getNumberOfKeys()).isEqualTo(0); assertThat(statistics1.getNumberOfValues()).isEqualTo(0); }, server1, server2); }</code><technical_language>City class is defined in another package other tests. changes in City potentially break test. I recommend a class defined test itself. is easier maintain code</technical_language>

Target:
public void verifyQuerySucceedsAfterClear() throws Exception { IntStream.range(0, 100).forEach(i -> cities.put(i, new City(i))); QueryService queryService = clientCache.getQueryService(); Query query = queryService.newQuery(MUMBAI_QUERY); Query query2 = queryService.newQuery(ID_10_QUERY); assertThat(((SelectResults) query.execute()).size()).isEqualTo(50); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(1); cities.clear(); invokeInEveryMember(() -> { verifyIndexesAfterClear("cities", "cityId", "cityName"); }, server1, server2); assertThat(((SelectResults) query.execute()).size()).isEqualTo(0); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(0); }
Source:
<code>public void testNonNullFileText() throws IOException { final String charsetName = "ISO-8859-1"; <START> final FileText fileText = new FileText(new File("src/test/resources/com/puppycrawl/tools/" <END> + "checkstyle/api/import-control_complete.xml"), charsetName); final SortedSet<LocalizedMessage> messages = new TreeSet<>(); messages.add(new LocalizedMessage(0, 0, "a Bundle", "message.key", new Object[] {"arg"}, null, getClass(), null)); final FileProcessingResult processingResult = new FileProcessingResult(fileText, messages); assertEquals(charsetName, processingResult.getFileText().getCharset().name()); }</code><technical_language>test input file</technical_language>

Target:
public void testNonNullFileText() throws IOException { final String charsetName = "ISO-8859-1"; final File file = temporaryFolder.newFile("test.java"); final FileText fileText = new FileText(file, charsetName); final SortedSet<LocalizedMessage> messages = new TreeSet<>(); messages.add(new LocalizedMessage(0, 0, "a Bundle", "message.key", new Object[] {"arg"}, null, getClass(), null)); final FileProcessingResult processingResult = new FileProcessingResult( file.getAbsolutePath(), fileText, messages); assertNotNull(processingResult.getFileText()); }
Source:
<code>public FunctionalExtraction( final Function<String, String> extractionFunction, final boolean retainMissingValue, final String replaceMissingValueWith, final boolean injective ) { this.retainMissingValue = retainMissingValue; this.replaceMissingValueWith = Strings.isNullOrEmpty(replaceMissingValueWith) ? null : replaceMissingValueWith; Preconditions.checkArgument( !(this.retainMissingValue && !Strings.isNullOrEmpty(this.replaceMissingValueWith)), "Cannot specify a [replaceMissingValueWith] and set [retainMissingValue] to true" ); if (this.retainMissingValue) { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? (Strings.isNullOrEmpty(dimValue) ? null : dimValue) : retval; } }; } else { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); <START> return Strings.isNullOrEmpty(retval) ? FunctionalExtraction.this.replaceMissingValueWith : retval; <END> } }; } this.extractionType = injective ? ExtractionType.ONE_TO_ONE : ExtractionType.MANY_TO_ONE; }</code><technical_language>this.replaceMissingValueWith more consistent</technical_language>

Target:
public FunctionalExtraction( final Function<String, String> extractionFunction, final boolean retainMissingValue, final String replaceMissingValueWith, final boolean injective ) { this.retainMissingValue = retainMissingValue; this.replaceMissingValueWith = Strings.emptyToNull(replaceMissingValueWith); Preconditions.checkArgument( !(this.retainMissingValue && !Strings.isNullOrEmpty(this.replaceMissingValueWith)), "Cannot specify a [replaceMissingValueWith] and set [retainMissingValue] to true" ); if (this.retainMissingValue) { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? Strings.emptyToNull(dimValue) : retval; } }; } else { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? FunctionalExtraction.this.replaceMissingValueWith : retval; } }; } this.extractionType = injective ? ExtractionType.ONE_TO_ONE : ExtractionType.MANY_TO_ONE; }
Source:
<code>public void validateTerms(Set<ValueIndexTerm> queryTerms) throws IllegalArgumentException { checkNotNullAndNotEmpty(queryTerms); checkInvalidAndRequiredTerms(queryTerms, NAME, new String[]{ null, null, scorecardTerm.getTerm() }, (t) -> (t instanceof ValueModuleRootPathIndexTerm), (t) -> (t instanceof ValuePackageNameIndexTerm), <START> (t) -> (t.getTerm().equals(scorecardTerm.getTerm()))); <END> }</code><technical_language>Please Objects.equals(t.getTerm(), scorecardTerm.getTerm())</technical_language>

Target:
public void validateTerms(Set<ValueIndexTerm> queryTerms) throws IllegalArgumentException { checkNotNullAndNotEmpty(queryTerms); checkInvalidAndRequiredTerms(queryTerms, NAME, new String[]{ null, null, scorecardTerm.getTerm() }, (t) -> (t instanceof ValueModuleRootPathIndexTerm), (t) -> (t instanceof ValuePackageNameIndexTerm), (t) -> (Objects.equals(t.getTerm(), scorecardTerm.getTerm()))); }
Source:
<code>private boolean isHoldingLease() { final DateTime lease = getLease().withMillisOfSecond(0); return lease != null && lease.equals(latestOwnedLease.withMillisOfSecond(0)) && lease.plusMinutes(getLeaseTimeMinutes()) <START> .isAfterNow(); <END> }</code><technical_language>withMillisOfSecond(0) is necessary if is above</technical_language>

Target:
private boolean isHoldingLease() { final DateTime lease = getLease(); return lease != null && lease.equals(latestOwnedLease) && lease.plusMinutes(getLeaseTimeMinutes()).isAfterNow(); }
Source:
<code>protected void validateComponent(final List<Diagnostic> diags) { super.validateComponent(diags); <START> <END> if (BooleanUtils.isFalse(isFileTypeValid())) { String invalidMessage = String.format(I18nUtilities.format(null, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_TYPE), StringUtils.join(getFileTypes().toArray(new Object[getFileTypes().size()]), ",")); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } if (BooleanUtils.isFalse(isFileSizeValid())) { String invalidMessage = String.format(I18nUtilities.format(null, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_SIZE), FileUtil.readableFileSize(getMaxFileSize())); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } }</code><technical_language>This validation logic good. do of putting create error message in FileUtil shared file widgets</technical_language>

Target:
protected void validateComponent(final List<Diagnostic> diags) { super.validateComponent(diags); if (!isFileTypeValid()) { String invalidMessage = FileUtil.getInvalidFileTypeMessage(getFileTypes()); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } if (!isFileSizeValid()) { String invalidMessage = FileUtil.getInvalidFileSizeMessage(getMaxFileSize()); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } }
Source:
<code>public String run( ReportInfo ri ) { String ret = ""; Context context = null; try { context = new Context(); Iterator<Item> item_iter = null; try { item_iter = embargoService.findItemsByLiftMetadata(context); } catch (IllegalArgumentException e) { error(e, "No embargoed items found"); } catch (Exception e) { error(e); } while (item_iter != null && item_iter.hasNext()) { Item item = item_iter.next(); String handle = item.getHandle(); DCDate date = null; try { date = embargoService.getEmbargoTermsAsDate(context, item); } catch (Exception e) { } ret += String.format("%s embargoed till [%s]\n", handle, date != null ? date.toString() : "null"); } context.complete(); <START> } catch (SQLException e) { <END> try { if ( null != context ) { context.abort(); } } catch (Exception e1) { } } return ret; }</code><technical_language>This exception handled</technical_language>

Target:
public String run( ReportInfo ri ) { String ret = ""; Context context = null; try { context = new Context(); Iterator<Item> item_iter = null; try { item_iter = embargoService.findItemsByLiftMetadata(context); } catch (IllegalArgumentException e) { error(e, "No embargoed items found"); } catch (Exception e) { error(e); } while (item_iter != null && item_iter.hasNext()) { Item item = item_iter.next(); String handle = item.getHandle(); DCDate date = null; try { date = embargoService.getEmbargoTermsAsDate(context, item); } catch (Exception e) { error(e); } ret += String.format("%s embargoed till [%s]\n", handle, date != null ? date.toString() : "null"); } context.complete(); } catch (SQLException e) { error(e); try { if ( null != context ) { context.abort(); } } catch (Exception e1) { error(e); } } return ret; }
Source:
<code>public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) { ItemStack result; InventoryCrafting inventory = new InventoryCrafting(new Container() { public boolean canInteractWith(EntityPlayer player) { return false; } }, gridSize, gridSize); for (int i = 0; i < inventory.getSizeInventory(); i++) { inventory.setInventorySlotContents(i, stack); } if(!StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world).isEmpty()){ return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); } <START> try{result = CraftingManager.findMatchingRecipe(inventory, world).getRecipeOutput(); <END> }catch(NullPointerException e){ return ItemStack.EMPTY; } if(isResultStackReversible(result, gridSize, world)){ StorageBlockCraftingManager.getInstance().addRecipe(CraftingManager.findMatchingRecipe(inventory, world)); return result; } return ItemStack.EMPTY; }</code><technical_language>Again, try/catch is slow. Properly check result</technical_language>

Target:
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) { StorageBlockCraftingManager craftingManagerSB = StorageBlockCraftingManager.getInstance(); InventoryCrafting inventory = inventoryCrafting[3 - gridSize]; for (int i = 0; i < inventory.getSizeInventory(); i++) { inventory.setInventorySlotContents(i, stack); } ItemStack notEmptyRecipe = craftingManagerSB.findMatchingRecipe(inventory, world); if (!notEmptyRecipe.isEmpty()) { return notEmptyRecipe; } ItemStack result = getNNRecipeOutput(inventory, world); if (isResultStackReversible(result, world)) { craftingManagerSB.addRecipe(CraftingManager.findMatchingRecipe(inventory, world)); return result; } return ItemStack.EMPTY; }
Source:
<code><START> public void testResizeNodes() throws Exception { <END> final Node stage = createNode(AdHocSubprocess.class, 5.0, 5.0, 225.0, 225.0); final Node task = createNode(UserTask.class, 5.0, 5.0, 75.0, 75.0); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(stage, task, index, originalParent, originalIndex); command.resizeNodes(); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 225.0, 225.0)), command.originalParentBounds); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 75.0, 75.0)), command.originalBounds); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(STAGE_GAP, STAGE_GAP, STAGE_GAP + CHILD_WIDTH, STAGE_GAP + CHILD_HEIGHT), ((View) task.getContent()).getBounds()); command.undoResizeNodes(); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(5.0, 5.0, 75.0, 75.0), ((View) task.getContent()).getBounds()); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testResizeNodes() { final Node stage = createNode(AdHocSubprocess.class, 5.0, 5.0, 225.0, 225.0); final Node task = createNode(UserTask.class, 5.0, 5.0, 75.0, 75.0); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(stage, task, index, originalParent, originalIndex); command.resizeNodes(); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 225.0, 225.0)), command.originalParentBounds); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 75.0, 75.0)), command.originalBounds); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(STAGE_GAP, STAGE_GAP, STAGE_GAP + CHILD_WIDTH, STAGE_GAP + CHILD_HEIGHT), ((View) task.getContent()).getBounds()); command.undoResizeNodes(); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(5.0, 5.0, 75.0, 75.0), ((View) task.getContent()).getBounds()); }
Source:
<code>public void log(PerunSession sess, AuditEvent event) { if(TransactionSynchronizationManager.isActualTransactionActive()) { log.trace("Auditer stores audit message to current transaction. Message: {}.", event.getMessage()); List<List<List<AuditerMessage>>> topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { newTopLevelTransaction(); topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { log.error("Failed to log event in Auditer because topLevelTransaction was null."); return; <START> } <END> } List<List<AuditerMessage>> transactionChain = topLevelTransactions.get(topLevelTransactions.size() - 1); List<AuditerMessage> messages = transactionChain.get(transactionChain.size() - 1); messages.add(new AuditerMessage(sess, event)); } else { this.storeMessageToDb(sess, event); } }</code><technical_language>If this situation happen, I need some information able investigate why. For this reason, I add Audit event log</technical_language>

Target:
public void log(PerunSession sess, AuditEvent event) { if(TransactionSynchronizationManager.isActualTransactionActive()) { log.trace("Auditer stores audit message to current transaction. Message: {}.", event.getMessage()); List<List<List<AuditerMessage>>> topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { newTopLevelTransaction(); topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { log.error("Failed to log event: " + event + " in Auditer because topLevelTransaction was null."); return; } } List<List<AuditerMessage>> transactionChain = topLevelTransactions.get(topLevelTransactions.size() - 1); List<AuditerMessage> messages = transactionChain.get(transactionChain.size() - 1); messages.add(new AuditerMessage(sess, event)); } else { this.storeMessageToDb(sess, event); } }
Source:
<code>public ScheduledThreadPoolMetricsHandler(RuntimeCapability capability, final ServiceName serviceNameBase) { <START> super(METRICS, capability, null); <END> }</code><technical_language>is correct? 3rd parameter serviceNameBase</technical_language>

Target:
public ScheduledThreadPoolMetricsHandler(RuntimeCapability capability, final ServiceName serviceNameBase) { super(METRICS, capability, serviceNameBase); }
Source:
<code>private void handleFixtureComparison() throws UnsupportedEncodingException { for ( Class<?> fixture : fixturesFor ) { String expectedFixture = getMapperName( fixture ); <START> URL expectedFile = getClass().getClassLoader().getResource( expectedFixture ); <END> if ( expectedFile == null ) { fail( String.format( "No reference file could be found for Mapper %s. You should create a file %s", fixture.getName(), expectedFixture ) ); } else { File expectedResource = new File( URLDecoder.decode( expectedFile.getFile(), "UTF-8" ) ); forMapper( fixture ).hasSameMapperContent( expectedResource ); } fixture.getPackage().getName(); } }</code><technical_language>put fixture files in src/test/resources/fixtures so, clarify purpose of .java files putting there</technical_language>

Target:
private void handleFixtureComparison() throws UnsupportedEncodingException { for ( Class<?> fixture : fixturesFor ) { String expectedFixture = FIXTURES_ROOT + getMapperName( fixture ); URL expectedFile = getClass().getClassLoader().getResource( expectedFixture ); if ( expectedFile == null ) { fail( String.format( "No reference file could be found for Mapper %s. You should create a file %s", fixture.getName(), expectedFixture ) ); } else { File expectedResource = new File( URLDecoder.decode( expectedFile.getFile(), "UTF-8" ) ); forMapper( fixture ).hasSameMapperContent( expectedResource ); } fixture.getPackage().getName(); } }
Source:
<code>public void removeInstallation(Installation installation) { installation.setCategories(null); <START> updateInstallation(installation); <END> installationDao.delete(installation); }</code><technical_language>Instead of manually updating categories deleting change cascade setting? <LINK_0> xml <cascade> <cascade-persist/> </cascade></technical_language>

Target:
public void removeInstallation(Installation installation) { installationDao.delete(installation); }
Source:
<code>public void withAssertions_assertThat_iterator_Test() { <START> assertThat(Arrays.asList(ITEMS).iterator()).toIterable().contains(ITEMS[0]); <END> }</code><technical_language>iterator assertion, e.g: assertThat(Arrays.asList(ITEMS).iterator()).hasNext();</technical_language>

Target:
public void withAssertions_assertThat_iterator_Test() { assertThat(Arrays.asList(ITEMS).iterator()).hasNext(); }
Source:
<code>public <R> R execute(PartitionContext partitionContext, RetryPolicy retry, ServiceCallback<S, R> callback) { Stopwatch sw = new Stopwatch(_ticker).start(); int numAttempts = 0; Exception lastException; do { ServiceEndPoint endPoint = chooseEndPoint(getValidEndPoints(), partitionContext); try { R result = executeOnEndPoint(endPoint, callback); _numExecuteSuccesses.mark(); return result; } catch (Exception e) { _numExecuteAttemptFailures.mark(); if (!isRetriableException(e)) { throw Throwables.propagate(e); } lastException = e; } } while (retry.allowRetry(++numAttempts, sw.elapsedMillis())); <START> throw new MaxRetriesException( "Exception from the last retry attempt", lastException ); <END> }</code><technical_language>message a more descriptive Throwable constructor functionality consistent previous version</technical_language>

Target:
public <R> R execute(PartitionContext partitionContext, RetryPolicy retry, ServiceCallback<S, R> callback) { Stopwatch sw = new Stopwatch(_ticker).start(); int numAttempts = 0; Exception lastException; do { ServiceEndPoint endPoint = chooseEndPoint(getValidEndPoints(), partitionContext); try { R result = executeOnEndPoint(endPoint, callback); _numExecuteSuccesses.mark(); return result; } catch (Exception e) { _numExecuteAttemptFailures.mark(); if (!isRetriableException(e)) { throw Throwables.propagate(e); } LOG.info("Retriable exception from end point id: " + endPoint.getId(), e); lastException = e; } } while (retry.allowRetry(++numAttempts, sw.elapsedMillis())); throw new MaxRetriesException(lastException); }
Source:
<code>List<String> findDumpDatesOnline(String relativeDirectory) { List<String> result = new ArrayList<String>(); try (BufferedReader in = this.webResourceFetcher .getBufferedReaderForUrl(WmfDumpFile.DUMP_SITE_BASE_URL + relativeDirectory + this.projectName + "/")) { String inputLine; while ((inputLine = in.readLine()) != null) { <START> if (inputLine.startsWith("<tr><td class=\"n\">")) { <END> String dateStamp = inputLine.substring(27, 35); if (dateStamp.matches("\\d\\d\\d\\d\\d\\d\\d\\d")) { result.add(dateStamp); } } } } catch (IOException e) { logger.error("Failed to fetch available dump dates online."); } Collections.sort(result, Collections.reverseOrder()); return result; }</code><technical_language>I suggest defining this string a constant give a quick idea beginning of a line look</technical_language>

Target:
List<String> findDumpDatesOnline(String relativeDirectory) { List<String> result = new ArrayList<String>(); try (BufferedReader in = this.webResourceFetcher .getBufferedReaderForUrl(WmfDumpFile.DUMP_SITE_BASE_URL + relativeDirectory + this.projectName + "/")) { String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.startsWith("<tr><td class=\"n\">")) { String dateStamp = inputLine.substring(27, 35); if (dateStamp.matches(WmfDumpFileManager.DATE_STAMP_PATTERN)) { result.add(dateStamp); } } } } catch (IOException e) { logger.error("Failed to fetch available dump dates online."); } Collections.sort(result, Collections.reverseOrder()); return result; }
Source:
<code><START> public void creates_instances_with_arguments() { <END> assertEquals(new ConstructorInstantiator("someString").newInstance(SomeClass2.class).getClass(), SomeClass2.class); }</code><technical_language>Fantastic coverage, thank you</technical_language>

Target:
public void creates_instances_with_arguments() { assertEquals(new ConstructorInstantiator(false, "someString").newInstance(SomeClass2.class).getClass(), SomeClass2.class); }
Source:
<code>public void createBeanPool() throws Exception { boolean result = fragment.addBeanPool() .name(BEAN_POOL_TBA) .maxPoolSize("30") .timeout("8") .timeoutUnit("MINUTES") .finish(); Assert.assertTrue("Window should be closed", result); <START> new ResourceVerifier(BEAN_POOL_TBA_ADDRESS, client).verifyExists("Fails because of <LINK_0>"); <END> }</code><technical_language>Please change "Fails of ..." "Probably fails of ..."</technical_language>

Target:
public void createBeanPool() throws Exception { boolean result = fragment.addBeanPool() .name(BEAN_POOL_TBA) .maxPoolSize("30") .timeout("8") .timeoutUnit("MINUTES") .finish(); Assert.assertTrue("Window should be closed", result); new ResourceVerifier(BEAN_POOL_TBA_ADDRESS, client).verifyExists("Probably fails because of <LINK_0>"); }
Source:
<code>public void onEvent(RuntimeStatusEvent event) { if (event.isFailed()) { RuntimeState state = runtimes.remove(event.getIdentity().getWorkspaceId()); if (state != null) { eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(state.runtime.getContext().getIdentity() .getWorkspaceId()) <START> .withPrevStatus(WorkspaceStatus.STOPPING) <END> .withStatus(STOPPED) .withError("Error occurs on workspace runtime stop. Error: " + event.getError())); } } }</code><technical_language>_STOPPING_ ? if stop is abnormal flow _RUNNING -> STOPPED_</technical_language>

Target:
public void onEvent(RuntimeStatusEvent event) { if (event.isFailed()) { RuntimeState state = runtimes.remove(event.getIdentity().getWorkspaceId()); if (state != null) { eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(state.runtime.getContext().getIdentity() .getWorkspaceId()) .withPrevStatus(WorkspaceStatus.RUNNING) .withStatus(STOPPED) .withError("Error occurs on workspace runtime stop. Error: " + event.getError())); } } }
Source:
<code>private static boolean <START> isLargeFile(DiffInfo <END> diffInfo) { JsArray<Region> c = diffInfo.content(); int lenA = 0, lenB = 0; for (int i = 0; i < c.length(); i++) { Region r = c.get(i); if (r.ab() != null) { int n = r.ab().length(); lenA += n; lenB += n; } else { if (r.a() != null) { lenA += r.a().length(); } if (r.b() != null) { lenB += r.b().length(); } } if (lenA > 500 || lenB > 500) { return true; } } return false; }</code><technical_language>Move GetDiff</technical_language>

Target:
private static boolean isLargeFile(DiffInfo diffInfo) { return (diffInfo.meta_a() != null && diffInfo.meta_a().lines() > 500) || (diffInfo.meta_b() != null && diffInfo.meta_b().lines() > 500); }
Source:
<code>public MachineService(MachineManager machineManager) { this.machineManager = machineManager; <START> this.dtoFactory = getInstance(); <END> }</code><technical_language>remove this string</technical_language>

Target:
public MachineService(MachineManager machineManager) { this.machineManager = machineManager; this.dtoFactory = DtoFactory.getInstance(); }
Source:
<code>public void setState(final Map<String, Object> loadedState) { super.setState(loadedState); <START> count = (Integer)loadedState.get("count"); <END> }</code><technical_language>(Integer)? (long)</technical_language>

Target:
public void setState(final Map<String, Object> loadedState) { super.setState(loadedState); count = (long)loadedState.get("count"); }
Source:
<code>public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer == null || you == null) { return false; } you.lookAtCards("Discard", targetPlayer.getHand(), game); TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS); target.setNotTarget(true); <START> you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game); <END> targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); return true; }</code><technical_language>bad outcome Outcome.Discard</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer == null || you == null) { return false; } you.lookAtCards("Discard", targetPlayer.getHand(), game); TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS); target.setNotTarget(true); you.choose(Outcome.Discard, targetPlayer.getHand(), target, game); targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); return true; }
Source:
<code>protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { instance = vmTemplateDao.getInstanceTypeByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { <START> instance = vmTemplateDao.getInstanceType(getParameters().getId()); <END> } getQueryReturnValue().setReturnValue(instance); }</code><technical_language>if this is a user query, need send user isFiltered above, means need implementation for this in dao db</technical_language>

Target:
protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { instance = vmTemplateDao.getInstanceTypeByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { instance = vmTemplateDao.getInstanceType(getParameters().getId(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(instance); }
Source:
<code>public ParametersAction(@Nonnull List<ParameterValue> parameters) { <START> wasInitializedWithNullParameters = parameters == null; <END> this.parameters = parameters != null ? parameters : Collections.<ParameterValue>emptyList(); String paramNames = SystemProperties.getString(SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME); safeParameters = new TreeSet<>(); if (paramNames != null) { safeParameters.addAll(Arrays.asList(paramNames.split(","))); } }</code><technical_language>This is print a stack trace</technical_language>

Target:
public ParametersAction(@Nonnull List<ParameterValue> parameters) { wasInitializedWithNullParameters = parameters == null; if (wasInitializedWithNullParameters && LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Parameters action has been initialized with null parameters. " + "It is a bug in a plugin or script, which created this action (see JENKINS-39495). " + "See next system log entries to see for which Run it has been created", new IllegalStateException("Parameters list is null for the action")); } this.parameters = parameters != null ? new ArrayList<>(parameters) : Collections.<ParameterValue>emptyList(); String paramNames = SystemProperties.getString(SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME); safeParameters = new TreeSet<>(); if (paramNames != null) { safeParameters.addAll(Arrays.asList(paramNames.split(","))); } }
Source:
<code>public void testTierManagerStateSync() throws Exception { clusterControl.terminateOnePassive(); ClusteringServiceConfiguration configuration = ClusteringServiceConfigurationBuilder.cluster(URI.create(STRIPE_URI)) .autoCreate() .defaultServerResource("test") .resourcePool("foo", 8L, MB) .build(); ClusteringService service = new ClusteringServiceFactory().create(configuration); service.start(null); EhcacheClientEntity clientEntity = getEntity(service); clusterControl.startOneServer(); clusterControl.waitForRunningPassivesInStandby(); clusterControl.terminateActive(); <START> clusterControl.waitForActive(); <END> clientEntity.validate(configuration.getServerConfiguration()); service.stop(); }</code><technical_language>wait for Active</technical_language>

Target:
public void testTierManagerStateSync() throws Exception { clusterControl.terminateOnePassive(); ClusteringServiceConfiguration configuration = ClusteringServiceConfigurationBuilder.cluster(URI.create(STRIPE_URI)) .autoCreate() .defaultServerResource("test") .resourcePool("foo", 8L, MB) .build(); ClusteringService service = new ClusteringServiceFactory().create(configuration); service.start(null); EhcacheClientEntity clientEntity = getEntity(service); clusterControl.startOneServer(); clusterControl.waitForRunningPassivesInStandby(); clusterControl.terminateActive(); clientEntity.validate(configuration.getServerConfiguration()); service.stop(); }
Source:
<code>public OutputColumns getOutputColumns() { final String name = _column.getName() + " (" + _dictionary.getName() + " removed)"; switch (_removedMatches) { case LIST: return new OutputColumns(new String[] { name, OUTPUT_COLUMN_REMOVED_MATCHES }, new Class[] { String.class, List.class }); <START> default: <END> return new OutputColumns(String.class, new String[] { name, OUTPUT_COLUMN_REMOVED_MATCHES }); } }</code><technical_language>While meaning is (right now), default instead of a concrete easy reader of code. Consider (in general, here) settings, tomorrow three. arrange code if adjacent options instead of "if else" kind of structure</technical_language>

Target:
public OutputColumns getOutputColumns() { final String[] columnNames = new String[2]; final Class<?>[] columnTypes = new Class[2]; columnNames[0] = _column.getName() + " (" + _dictionary.getName() + " removed)"; columnTypes[0] = String.class; columnNames[1] = OUTPUT_COLUMN_REMOVED_MATCHES; switch (_removedMatchesType) { case STRING: columnTypes[1] = String.class; break; case LIST: columnTypes[1] = List.class; break; default: throw new UnsupportedOperationException("Unsupported output type: " + _removedMatchesType); } return new OutputColumns(columnNames, columnTypes); }
Source:
<code>public void adjustUserName(LdapProviderType ldapProviderType) { StringBuilder userDNSb = new StringBuilder(); if ( ldapProviderType.equals(LdapProviderType.activeDirectory) ) { userDNSb.append("CN=").append(userName).append(",CN=Users"); } else if (ldapProviderType.equals(LdapProviderType.rhds) || ldapProviderType.equals(LdapProviderType.openLdap)) { userDNSb.append("uid=").append(userName).append(",ou=People"); } else { userDNSb.append("uid=").append(userName).append(",cn=Users").append(",cn=Accounts"); } <START> if (baseDN != null && !baseDN.isEmpty()) { <END> String dcDN = getDcDN(baseDN); if (!dcDN.isEmpty()) { userDNSb.append(",").append(dcDN); } } userName = userDNSb.toString(); }</code><technical_language>StringUtils isEmpty</technical_language>

Target:
public void adjustUserName(LdapProviderType ldapProviderType) { StringBuilder userDNSb = new StringBuilder(); if ( ldapProviderType.equals(LdapProviderType.activeDirectory) ) { userDNSb.append("CN=").append(userName).append(",CN=Users"); } else if (ldapProviderType.equals(LdapProviderType.rhds) || ldapProviderType.equals(LdapProviderType.openLdap)) { userDNSb.append("uid=").append(userName).append(",ou=People"); } else { userDNSb.append("uid=").append(userName).append(",cn=Users").append(",cn=Accounts"); } if (StringUtils.isNotEmpty(baseDN)) { String dcDN = getDcDN(baseDN); if (!dcDN.isEmpty()) { userDNSb.append(",").append(dcDN); } } userName = userDNSb.toString(); }
Source:
<code>public Set<CronTaskConfigurationDto> getCronTaskConfigurations() { <START> return cronTaskConfigurations != null ? cronTaskConfigurations : new LinkedHashSet<>(); <END> }</code><technical_language>a bad result if cronTaskConfigurations == null do getCronTaskConfigurations().add(configuration). do this: return cronTaskConfigurations != null ? cronTaskConfigurations : cronTaskConfigurations = new LinkedHashSet<>();</technical_language>

Target:
public Set<CronTaskConfigurationDto> getCronTaskConfigurations() { return cronTaskConfigurations != null ? cronTaskConfigurations : (cronTaskConfigurations = new LinkedHashSet<>()); }
Source:
<code>public String getEventTitle(BigDecimal latitude, BigDecimal longitude) throws IOException { <START> JsonObject feature = this.geoservePlaces.getNearestPlace(latitude, longitude); <END> Double distance = feature.getJsonObject("properties").getJsonNumber("distance").doubleValue(); System.out.println("-------------------\n\n\ndistance: " + distance); System.out.println("\ndistanceThreshold: " + this.distanceThreshold + "\n\n\n--------------"); if (distance > this.distanceThreshold) { return this.geoserveRegions.getFeRegionName(latitude, longitude); } return this.formatEventTitle(feature); }</code><technical_language>restructure this a try/catch places logic. try { // get nearest place if < threshold { return formatPlace(...) } } catch (exception) return getFeRegion(...)</technical_language>

Target:
public String getEventTitle(BigDecimal latitude, BigDecimal longitude) throws IOException { try { JsonObject feature = this.geoservePlaces.getNearestPlace(latitude, longitude); Double distance = feature.getJsonObject("properties").getJsonNumber("distance").doubleValue(); if (distance < this.distanceThreshold) { return this.formatEventTitle(feature); } } catch (Exception e) { LOGGER.log(Level.WARNING, "[" + this.getName() + "] failed to get nearest place from geoserve places service."); } return this.geoserveRegions.getFeRegionName(latitude, longitude); }
Source:
<code>void processStatusException() { final Error expectedError = Error.getDefaultInstance(); final Metadata metadata = MetadataConverter.toMetadata(expectedError); final StatusException statusException = INVALID_ARGUMENT.asException(metadata); <START> assertEquals(expectedError, StreamObservers.fromStreamError(statusException) <END> .get()); }</code><technical_language>Please a static import for StreamObservers.fromStreamError(...)</technical_language>

Target:
void processStatusException() { final Error expectedError = Error.getDefaultInstance(); final Metadata metadata = MetadataConverter.toMetadata(expectedError); final StatusException statusException = INVALID_ARGUMENT.asException(metadata); assertEquals(expectedError, fromStreamError(statusException).get()); }
Source:
<code>public void getCanceledJobs() throws IOException, SignatureException, XmlProcessingException { final String bucketName = "test_get_canceled_jobs"; try { client.putBucket(new PutBucketRequest(bucketName)); final List<Ds3Object> objectsOne = new ArrayList<>(); final Ds3Object obj = new Ds3Object("testOne", 2); objectsOne.add(obj); final Ds3ClientHelpers.Job jobOne = wrap(client).startWriteJob(bucketName, objectsOne); final UUID jobOneId = jobOne.getJobId(); final CancelJobSpectraS3Response cancelResponse = client .cancelJobSpectraS3(new CancelJobSpectraS3Request(jobOneId)); final GetCanceledJobsSpectraS3Response getCanceledJobsResponse = client .getCanceledJobsSpectraS3(new GetCanceledJobsSpectraS3Request()); List<UUID> canceledJobsUUIDs = new ArrayList<>(); <START> for (CanceledJob job : getCanceledJobsResponse.getCanceledJobListResult().getCanceledJobs()) { <END> canceledJobsUUIDs.add(job.getId()); } assertTrue(canceledJobsUUIDs.contains(jobOneId)); } finally { deleteAllContents(client, bucketName); } }</code><technical_language>Missing final CanceledJob</technical_language>

Target:
public void getCanceledJobs() throws IOException, SignatureException, XmlProcessingException { try { final Ds3ClientHelpers.Job jobOne = HELPERS.startWriteJob(BUCKET_NAME, Lists.newArrayList(new Ds3Object("test", 2))); final UUID jobOneId = jobOne.getJobId(); client.cancelJobSpectraS3(new CancelJobSpectraS3Request(jobOneId)); final GetCanceledJobsSpectraS3Response getCanceledJobsResponse = client .getCanceledJobsSpectraS3(new GetCanceledJobsSpectraS3Request()); final List<UUID> canceledJobsUUIDs = new ArrayList<>(); for (final CanceledJob job : getCanceledJobsResponse.getCanceledJobListResult().getCanceledJobs()) { canceledJobsUUIDs.add(job.getId()); } assertTrue(canceledJobsUUIDs.contains(jobOneId)); } finally { deleteAllContents(client, BUCKET_NAME); } }
Source:
<code>public static List<PathElement> parse( String key ) { if ( "*".equals(key) ) { return Arrays.<PathElement>asList( new StarAllPathElement( key ) ); } <START> else if ( StringUtils.countMatches( key, "*" ) == 1 ) { <END> return Arrays.<PathElement>asList( new StarSinglePathElement( key ) ); } else if ( StringUtils.countMatches( key, "*" ) == 2 ) { return Arrays.<PathElement>asList( new StarDoublePathElement( key ) ); } else if ( key.contains("*") ) { return Arrays.<PathElement>asList( new StarRegexPathElement( key ) ); } else { return Arrays.<PathElement>asList( new LiteralPathElement( key ) ); } }</code><technical_language>if returns success, get countMatches a variable, check determine type of StarPathElement create</technical_language>

Target:
public static List<PathElement> parse(String key) { if ( "*".equals( key ) ) { return Arrays.<PathElement>asList(new StarAllPathElement(key)); } int numOfStars = StringUtils.countMatches(key, "*"); if (numOfStars == 1) { return Arrays.<PathElement>asList(new StarSinglePathElement(key)); } else if (numOfStars == 2) { return Arrays.<PathElement>asList(new StarDoublePathElement(key)); } else if (numOfStars > 2) { return Arrays.<PathElement>asList(new StarRegexPathElement(key)); } else { return Arrays.<PathElement>asList(new LiteralPathElement(key)); } }
Source:
<code><START> @Override public void onRetryUploadForMediaCollection(ArrayList<Object> mediaFiles) { <END> ArrayList<Integer> mediaIdsToRetry = new ArrayList<>(); for (Object mediaFile : mediaFiles) { int localMediaId = StringUtils.stringToInt(((HashMap<String, Object>) mediaFile).get("id").toString(), 0); if (localMediaId != 0) { MediaModel media = mMediaStore.getMediaWithLocalId(localMediaId); if (media == null) { AppLog.e(T.MEDIA, "Can't find media with local id: " + localMediaId); AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(getString(R.string.cannot_retry_deleted_media_item_fatal)); builder.setPositiveButton(R.string.yes, (dialog, id) -> { dialog.dismiss(); }); builder.setNegativeButton(getString(R.string.no), (dialog, id) -> dialog.dismiss()); AlertDialog dialog = builder.create(); dialog.show(); return; } if (media.getUrl() != null && media.getUploadState().equals(MediaUploadState.UPLOADED.toString())) { if (mEditorMediaUploadListener != null) { mEditorMediaUploadListener.onMediaUploadSucceeded(String.valueOf(media.getId()), FluxCUtils.mediaFileFromMediaModel(media)); } } else { UploadService.cancelFinalNotification(this, mEditPostRepository.getPost()); UploadService.cancelFinalNotificationForMedia(this, mSite); mediaIdsToRetry.add(localMediaId); } } } if (!mediaIdsToRetry.isEmpty()) { mEditorMedia.retryFailedMediaAsync(mediaIdsToRetry); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }</code><technical_language>@mzorz methods moved another class for testability line reduction reasons? LMK</technical_language>

Target:
@Override public void onRetryUploadForMediaCollection(ArrayList<Object> mediaFiles) { mStoriesEventListener.onRetryUploadForMediaCollection(this, mediaFiles, mEditorMediaUploadListener); }
Source:
<code>public int hashCode() { int result = principal.hashCode(); result = 31 * result + privileges.hashCode(); <START> return result; <END> }</code><technical_language>following? return HashCode.compute(principal,privileges);</technical_language>

Target:
public int hashCode() { return HashCode.compute(principal, privileges); }