auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testPrintXpathFullOption() throws Exception { final String expected = addEndOfLine( "CLASS_DEF -> CLASS_DEF [3:0]", "`--OBJBLOCK -> OBJBLOCK [3:28]", " |--METHOD_DEF -> METHOD_DEF [8:4]", " | `--SLIST -> { [8:26]", " | |--VARIABLE_DEF -> VARIABLE_DEF [9:8]", " | | |--IDENT -> a [9:12]"); exit.checkAssertionAfterwards(() -> { Assert.assertThat("Unexpected output log", systemOut.getLog(), is(expected)); Assert.assertThat("Unexpected system error log", systemErr.getLog(), is("")); }); <START> Main.main("--tree-branch-for-xpath", "/CLASS_DEF END> + " getPath("InputMainXPath.java")); }</code><technical_language>I a problem, I noticed line of xpath. Is move definition of xpath special variable ? xpath single string</technical_language>

Target:
public void testPrintXpathFullOption() throws Exception { final String expected = addEndOfLine( "CLASS_DEF -> CLASS_DEF [3:0]", "`--OBJBLOCK -> OBJBLOCK [3:28]", " |--METHOD_DEF -> METHOD_DEF [8:4]", " | `--SLIST -> { [8:26]", " | |--VARIABLE_DEF -> VARIABLE_DEF [9:8]", " | | |--IDENT -> a [9:12]"); exit.checkAssertionAfterwards(() -> { Assert.assertThat("Unexpected output log", systemOut.getLog(), is(expected)); Assert.assertThat("Unexpected system error log", systemErr.getLog(), is("")); }); final String xpath = "/CLASS_DEF Main.main("--branch-matching-xpath", xpath, getPath("InputMainXPath.java")); }
Source:
<code>public void test_translations() { Translations translations = getManager().moviesService().translations(TestData.MOVIE_ID, null); assertThat(translations).isNotNull(); assertThat(translations.id).isEqualTo(TestData.MOVIE_ID); <START> assertThat(translations.translations.get(0).name).isNotNull(); <END> assertThat(translations.translations.get(0).iso_639_1).isNotNull(); assertThat(translations.translations.get(0).english_name).isNotNull(); }</code><technical_language>for loop Translation objects of valid</technical_language>

Target:
public void test_translations() { Translations translations = getManager().moviesService().translations(TestData.MOVIE_ID, null); assertThat(translations).isNotNull(); assertThat(translations.id).isEqualTo(TestData.MOVIE_ID); for (Translations.Translation translation : translations.translations) { assertThat(translation.name).isNotNull(); assertThat(translation.iso_639_1).isNotNull(); assertThat(translation.english_name).isNotNull(); } }
Source:
<code>protected ScriptWrapper(String name, String description, String engineName, String typeName, boolean enabled, File file) { super(); this.name = name; this.description = description; this.engineName = engineName; this.typeName = typeName; this.enabled = enabled; <START> this.file = file; <END> this.setFile(file); }</code><technical_language>Remove</technical_language>

Target:
protected ScriptWrapper(String name, String description, String engineName, String typeName, boolean enabled, File file) { super(); this.name = name; this.description = description; this.engineName = engineName; this.typeName = typeName; this.enabled = enabled; this.setFile(file); }
Source:
<code>public void setUp() throws Exception { project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); Group parentGroup = new Group(); background = new SingleSprite("background"); parentGroup.addActor(background.look); penActorSprite = new SingleSprite("penActor"); parentGroup.addActor(penActorSprite.look); project.getDefaultScene().addSprite(penActorSprite); embroideryActorSprite = new SingleSprite("embroideryActor"); <START> parentGroup.addActor(embroideryActorSprite.look); <END> project.getDefaultScene().addSprite(embroideryActorSprite); realSprite = new SingleSprite("testSprite"); parentGroup.addActor(realSprite.look); project.getDefaultScene().addSprite(realSprite); ProjectManager.getInstance().setProject(project); }</code><technical_language>opinion: add empty lines group initialization of sprites easier read</technical_language>

Target:
public void setUp() throws Exception { project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); background = new SingleSprite("background"); penActorSprite = new SingleSprite("penActor"); embroideryActorSprite = new SingleSprite("embroideryActor"); realSprite = new SingleSprite("testSprite"); project.getDefaultScene().addSprite(penActorSprite); project.getDefaultScene().addSprite(embroideryActorSprite); project.getDefaultScene().addSprite(realSprite); Group parentGroup = new Group(); parentGroup.addActor(background.look); parentGroup.addActor(penActorSprite.look); parentGroup.addActor(embroideryActorSprite.look); parentGroup.addActor(realSprite.look); ProjectManager.getInstance().setProject(project); }
Source:
<code>public Void call() throws IOException { Engine e = Engine.current(); if (e == null) { return null; } try { <START> Engine.class.getMethod("setNoReconnect", boolean.class); <END> } catch (NoSuchMethodException ex) { return null; } e.setNoReconnect(true); LOGGER.log(Level.INFO, "Disabled slave engine reconnects."); return null; }</code><technical_language>method 2009. I this check is worth it. <LINK_0></technical_language>

Target:
public Void call() throws IOException { Engine e = Engine.current(); if (e == null) { return null; } e.setNoReconnect(true); LOGGER.log(Level.INFO, "Disabled slave engine reconnects."); return null; }
Source:
<code>private InputStream getFileInputStream(File file) throws AudioException { if (file == null) { throw new IllegalArgumentException("file must not be null"); } if (file.exists()) { <START> this.length = file.length(); <END> try { return new FileInputStream(file); } catch (FileNotFoundException e) { throw new AudioException("Cannot open temporary audio file '" + file.getName() + "."); } } else { throw new AudioException("Temporary file '" + file.getName() + "' not found!"); } }</code><technical_language>initialization of length needs done time getClonedStream() is called. If handle file length changes work (IIRC) file size change file input stream created. So, I this line moved file = new File(outputFile); is want handle FileNotFoundException twice? reset size time... Hm WDYT</technical_language>

Target:
private InputStream getFileInputStream(File file) throws AudioException { if (file == null) { throw new IllegalArgumentException("file must not be null"); } if (file.exists()) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { throw new AudioException("Cannot open temporary audio file '" + file.getName() + "."); } } else { throw new AudioException("Temporary file '" + file.getName() + "' not found!"); } }
Source:
<code>public void extractFulltextTest() throws Exception { <START> try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { <END> BufferedWriter writeFile = new BufferedWriter(new FileWriter(file)); writeFile.write(testText); writeFile.close(); } String filePath = file.getAbsolutePath().toString(); when(message.getHeader(eq(FCREPO_URI))) .thenReturn("http://fedora/test/original_file"); when(message.getHeader(eq(CdrBinaryChecksum))) .thenReturn("1234"); when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(filePath); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("plain/text"); binary = mock(BinaryObject.class); parent = mock(FileObject.class); when(repository.getBinary(any(PID.class))).thenReturn(binary); when(binary.getParent()).thenReturn(parent); processor.process(exchange); ArgumentCaptor<InputStream> requestCaptor = ArgumentCaptor.forClass(InputStream.class); verify(parent).addDerivative(eq(slug), requestCaptor.capture(), eq(fileName), eq("plain/text"), eq(PcdmUse.ExtractedText)); InputStream request = requestCaptor.getValue(); String extractedText = new BufferedReader(new InputStreamReader(request)) .lines().collect(Collectors.joining("\n")); assertEquals(testText, extractedText); }</code><technical_language>I realized bos for anything. remove that, suggest instead moving declaration of writeFile try section autoclosed</technical_language>

Target:
public void extractFulltextTest() throws Exception { try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write(testText); } String filePath = file.getAbsolutePath().toString(); when(message.getHeader(eq(FCREPO_URI))) .thenReturn("http://fedora/test/original_file"); when(message.getHeader(eq(CdrBinaryChecksum))) .thenReturn("1234"); when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(filePath); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("plain/text"); binary = mock(BinaryObject.class); parent = mock(FileObject.class); when(repository.getBinary(any(PID.class))).thenReturn(binary); when(binary.getParent()).thenReturn(parent); processor.process(exchange); ArgumentCaptor<InputStream> requestCaptor = ArgumentCaptor.forClass(InputStream.class); verify(parent).addDerivative(eq(slug), requestCaptor.capture(), eq(fileName), eq("plain/text"), eq(PcdmUse.ExtractedText)); InputStream request = requestCaptor.getValue(); String extractedText = new BufferedReader(new InputStreamReader(request)) .lines().collect(Collectors.joining("\n")); assertEquals(testText, extractedText); }
Source:
<code>public boolean onTune(Uri channelUri) { synchronized (sLock) { if (sRating != null) { notifyContentBlocked(sRating); } if (sTuneCallback != null) { sTuneCallback.post(); sTuneCallback = null; } if (sRating == null) { notifyContentAllowed(); } } notifyVideoAvailable(); notifyTracksChanged(mTracks); notifyTrackSelected(TvTrackInfo.TYPE_AUDIO, sEngAudioTrack.getId()); notifyTrackSelected(TvTrackInfo.TYPE_SUBTITLE, null); <START> if (sOverlayViewSizeChangedCallback != null) { <END> notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, sDummyVideoTrack.getId()); } notifyTimeShiftStatusChanged(TvInputManager.TIME_SHIFT_STATUS_AVAILABLE); mRecordStartTimeMs = mCurrentPositionMs = mLastCurrentPositionUpdateTimeMs = System.currentTimeMillis(); mPausedTimeMs = 0; mHandler.sendEmptyMessageDelayed(MSG_SEEK, SEEK_DELAY_MS); mSpeed = 1; return true; }</code><technical_language>is this condition needed</technical_language>

Target:
public boolean onTune(Uri channelUri) { synchronized (sLock) { if (sRating != null) { notifyContentBlocked(sRating); } if (sTuneCallback != null) { sTuneCallback.post(); sTuneCallback = null; } if (sRating == null) { notifyContentAllowed(); } } notifyVideoAvailable(); notifyTracksChanged(mTracks); notifyTrackSelected(TvTrackInfo.TYPE_AUDIO, sEngAudioTrack.getId()); notifyTrackSelected(TvTrackInfo.TYPE_SUBTITLE, null); notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, sDummyVideoTrack.getId()); notifyTimeShiftStatusChanged(TvInputManager.TIME_SHIFT_STATUS_AVAILABLE); mRecordStartTimeMs = mCurrentPositionMs = mLastCurrentPositionUpdateTimeMs = System.currentTimeMillis(); mPausedTimeMs = 0; mHandler.sendEmptyMessageDelayed(MSG_SEEK, SEEK_DELAY_MS); mSpeed = 1; return true; }
Source:
<code>public void jsr107LoaderGetsRegistered() { MutableConfiguration<Object, Object> configuration = new MutableConfiguration<Object, Object>(); CacheLoader<Object, Object> mock = mock(CacheLoader.class); RecordingFactory<CacheLoader<Object, Object>> factory = factoryOf(mock); configuration.setReadThrough(true).setCacheLoaderFactory(factory); merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(true)); <START> verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>any()); <END> }</code><technical_language>this is a verification any(CacheLoaderWriter.class) ensure loader writer is null</technical_language>

Target:
public void jsr107LoaderGetsRegistered() { MutableConfiguration<Object, Object> configuration = new MutableConfiguration<Object, Object>(); CacheLoader<Object, Object> mock = mock(CacheLoader.class); RecordingFactory<CacheLoader<Object, Object>> factory = factoryOf(mock); configuration.setReadThrough(true).setCacheLoaderFactory(factory); merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(true)); verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>isNotNull()); }
Source:
<code>public void ping(){ if(selectedEndpoint != null) { boolean status = pingService.ping(selectedEndpoint.getServiceUrl()); Date timestamp = new Date(); <START> EndpointManagerCache.getInstance().addOrUpdateEndPoint(selectedEndpoint.getServiceUrl(), timestamp, status); <END> } }</code><technical_language>pass "new Date()" in, instead of intermediate variable</technical_language>

Target:
public void ping() { if (selectedEndpoint != null) { boolean status = pingService.ping(selectedEndpoint.getServiceUrl()); EndpointManagerCache.getInstance().addOrUpdateEndpoint(selectedEndpoint.getServiceUrl(), new Date(), status); } }
Source:
<code>protected void applyChanges(IndexFamily to, IndexFamily from) throws IOException { to.setName(from.getName()); <START> to.setFake(from.hasFakeSequence()); <END> to.setUniqueDualIndex(from.isUniqueDualIndex()); to.setArchived(from.getArchived()); }</code><technical_language>safe change fake non-fake sequences. trouble working in mind</technical_language>

Target:
protected void applyChanges(IndexFamily to, IndexFamily from) throws IOException { to.setName(from.getName()); to.setUniqueDualIndex(from.isUniqueDualIndex()); to.setArchived(from.getArchived()); }
Source:
<code>public void validate(Map<String, String> attributes) throws ValidationException { String namespace = attributes.get(WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE); if (!isNullOrEmpty(namespace)) { if (namespace.length() > METADATA_NAME_MAX_LENGTH) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: must be no more than 63 characters"); } if (!METADATA_NAME_PATTERN.matcher(namespace).matches()) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: a DNS-1123 label must consist of lower case alphanumeric" + " characters or '-', and must start and end with an" + " alphanumeric character (e.g. 'my-name', or '123-abc', regex used for" + " validation is '" + METADATA_NAME_REGEX + "')"); } <START> <END> if (!EnvironmentContext.getCurrent().getSubject().isAnonymous()) { namespaceFactoryProvider.get().checkIfNamespaceIsAllowed(namespace); } } }</code><technical_language>if this is case is clear for this error caught pre-release tests.</technical_language>

Target:
public void validate(Map<String, String> attributes) throws ValidationException { String namespace = attributes.get(WORKSPACE_INFRASTRUCTURE_NAMESPACE_ATTRIBUTE); if (!isNullOrEmpty(namespace)) { if (namespace.length() > METADATA_NAME_MAX_LENGTH) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: must be no more than 63 characters"); } if (!METADATA_NAME_PATTERN.matcher(namespace).matches()) { throw new ValidationException( "The specified namespace " + namespace + " is invalid: a DNS-1123 label must consist of lower case alphanumeric" + " characters or '-', and must start and end with an" + " alphanumeric character (e.g. 'my-name', or '123-abc', regex used for" + " validation is '" + METADATA_NAME_REGEX + "')"); } namespaceFactoryProvider.get().checkIfNamespaceIsAllowed(namespace); } }
Source:
<code>public void testSlice() throws Exception { <START> Block block1 = readFile("test_dictionaries/string-dictionary.orc", VarcharType.VARCHAR); <END> Block block2 = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VarcharType.VARCHAR); compare(VarcharType.VARCHAR, block1, block2); }</code><technical_language>block1 block2 confusing is clear is tested. rename expected actual. - rename compare method assertEqualBlock - inline null1 null2 variables @Test public void testSlice() throws Exception { Block expected = readFile("test_dictionaries/string-dictionary.orc", VARCHAR); Block actual = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VARCHAR); assertEqualBlocks(VARCHAR, expected, actual); } private static void assertEqualBlocks(Type type, Block expected, Block actual) { assertEquals(expected.getPositionCount(), actual.getPositionCount()); for (int i = 0; i < expected.getPositionCount(); i++) { assertEquals(actual.isNull(i), expected.isNull(i)); if (!expected.isNull(i)) { assertEquals(type.compareTo(expected, i, actual, i), 0); } } }</technical_language>

Target:
public void testSlice() throws Exception { Block expected = readFile("test_dictionaries/string-dictionary.orc", VARCHAR); Block actual = readFile("test_dictionaries/string-row-group-dictionary.dwrf", VARCHAR); assertEqualBlocks(VARCHAR, expected, actual); }
Source:
<code>public static Query buildQuery(EntityProjection entityProjection, RequestScope scope) { <START> SQLSchema schema = new SQLSchema(entityProjection.getType(), scope.getDictionary()); <END> AggregationDataStoreHelper agHelper = new AggregationDataStoreHelper(schema, entityProjection); FilterExpression filterExpression = entityProjection.getFilterExpression(); FilterExpression whereFilter = agHelper.getWhereFilter(filterExpression); FilterExpression havingFilter = agHelper.getHavingFilter(filterExpression); Sorting sorting = entityProjection.getSorting(); Pagination pagination = entityProjection.getPagination(); Set<Dimension> dimensions = new LinkedHashSet<>(); Set<TimeDimension> timeDimensions = new LinkedHashSet<>(); agHelper.populateDimensionList(dimensions, timeDimensions); Set<Metric> metrics = new LinkedHashSet<>(); agHelper.populateMetricList(metrics); Map<Metric, ? extends Class<? extends Aggregation>> metricClassMap = agHelper.getMetricMap(metrics); return Query.builder() .schema(schema) .metrics(metricClassMap) .groupDimensions(dimensions) .timeDimensions(timeDimensions) .whereFilter(whereFilter) .havingFilter(havingFilter) .sorting(sorting) .pagination(pagination) .scope(scope) .build(); }</code><technical_language>SQLSchema I is specific SQLQueryEngine. This class dependencies query engine classes</technical_language>

Target:
public static Query buildQuery(EntityProjection entityProjection, RequestScope scope) { Schema schema = new Schema(entityProjection.getType(), scope.getDictionary()); AggregationDataStoreHelper agHelper = new AggregationDataStoreHelper(schema, entityProjection); return agHelper.getQuery(); }
Source:
<code>public SpongeBlockStatistic(String statId, String itemName, ITextComponent statName, Item item) { super(statId, itemName, statName, item); String args; if (statId.equals("stat.mineBlock.")) { args = Block.getBlockFromItem(item).getLocalizedName(); } else { args = new ItemStack(item).getDisplayName(); } <START> translation = new SpongeTranslation(statId.substring(0, statId.length() - 1), args); <END> }</code><technical_language>this initialize this in constructor while others lazy initialized in getter</technical_language>

Target:
public SpongeBlockStatistic(String statId, String itemName, ITextComponent statName, Item item) { super(statId, itemName, statName, item); }
Source:
<code>@Override public double score(Iterator<LabelPair<Double>> iter) { PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(new Comparator<Pair<Double, Double>>() { <START> @Override public int compare(Pair<Double, Double> o1, Pair<Double, Double> o2) { <END> if (o1.getKey() < o2.getKey()) return -1; if (o1.getKey() > o2.getKey()) return 1; return 0; } }); long pos = 0; long neg = 0; while (iter.hasNext()) { LabelPair<Double> e = iter.next(); Double prediction = e.getPrediction(); Double truth = e.getTruth(); queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } return calculateROCAUC(queue, pos, neg, positiveClsLb); }</code><technical_language>lambda? Double.compare(o1.getKey(), o2.getKey())</technical_language>

Target:
@Override public double score(Iterator<LabelPair<Double>> iter) { PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getKey)); long pos = 0; long neg = 0; while (iter.hasNext()) { LabelPair<Double> e = iter.next(); Double prediction = e.getPrediction(); Double truth = e.getTruth(); queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } return calculateROCAUC(queue, pos, neg, positiveClsLb); }
Source:
<code>public void update() { if (!getWorld().isRemote) { ticksExisted++; int currentInput = getWorld().getStrongPower(pos); if (previousInput == 0 && currentInput != 0) { initiateTeleport(); } previousInput = currentInput; if (ticksExisted % 100 == 0) { ItemStack focusStack = getStackInSlot(0); if (!focusStack.isEmpty()) { ItemTelepositionFocus focus = (ItemTelepositionFocus) focusStack.getItem(); <START> Binding binding = focus.getBinding(focusStack); <END> if (binding == null) return; SubCommandTeleposer.teleposerSet.add(this); } else SubCommandTeleposer.teleposerSet.remove(this); } } }</code><technical_language>java if (focus.getBinding(focusStack) != null) SubCommandTeleposer.teleposerSet.add(this);</technical_language>

Target:
public void update() { if (!getWorld().isRemote) { int currentInput = getWorld().getStrongPower(pos); if (previousInput == 0 && currentInput != 0) { initiateTeleport(); } previousInput = currentInput; if (world.getTotalWorldTime() % 100 == 0) { ItemStack focusStack = getStackInSlot(0); if (!focusStack.isEmpty()) { if (((ItemTelepositionFocus) focusStack.getItem()).getBinding(focusStack) != null) SubCommandTeleposer.teleposerSet.add(this); else SubCommandTeleposer.teleposerSet.remove(this); } else SubCommandTeleposer.teleposerSet.remove(this); } } }
Source:
<code>public void testEmbeddedLuceneQueryExecution() throws Exception { QueryFactory queryFactory = Search.getQueryFactory(cache); Query cacheQuery = queryFactory.create(String.format("From %s where name = 'John1'", UserHS.class.getName())); final int loops = 100000; final long startTs = System.nanoTime(); for (int i = 0; i < loops; i++) { List<User> list = cacheQuery.list(); <START> assertEquals(1, list.size()); <END> assertEquals("John1", list.get(0).getName()); } final long duration = (System.nanoTime() - startTs) / loops; System.out.printf("Embedded HS execution took %d us per query\n", TimeUnit.NANOSECONDS.toMicros(duration)); }</code><technical_language>Extracting this out of loop is optimization impacts measurement. I want measure total query execution time including initial preparation/parsing time for query. system is free eventually internally optimize caching for parsed queries, here</technical_language>

Target:
public void testEmbeddedLuceneQueryExecution() throws Exception { final int loops = 100000; final long startTs = System.nanoTime(); for (int i = 0; i < loops; i++) { QueryFactory queryFactory = Search.getQueryFactory(cache); Query cacheQuery = queryFactory.create(String.format("From %s where name = 'John1'", UserHS.class.getName())); List<User> list = cacheQuery.list(); assertEquals(1, list.size()); assertEquals("John1", list.get(0).getName()); } final long duration = (System.nanoTime() - startTs) / loops; System.out.printf("Embedded HS execution took %d us per query\n", TimeUnit.NANOSECONDS.toMicros(duration)); }
Source:
<code>private Map<Set<ServerIdentity>, ModelNode> resolveCoreServiceOperations(ModelNode operation, PathAddress address, ModelNode domain, ModelNode host) { if (MANAGEMENT.equals(address.getElement(0).getValue()) && address.size() >= 2) { ModelNode op = operation.clone(); switch (address.getElement(1).getKey()) { case ACCESS: <START> case AUDIT: <END> op.get(OP_ADDR).set(address.toModelNode()); if (address.size() >= 3) { PathAddress newAddr = PathAddress.EMPTY_ADDRESS; for (PathElement element : address) { if (LOGGER.equals(element.getKey())) { return Collections.emptyMap(); } else { PathElement myElement = element; if (SERVER_LOGGER.equals(myElement.getKey())) { myElement = PathElement.pathElement(LOGGER, element.getValue()); } newAddr = newAddr.append(myElement); } } op.get(OP_ADDR).set(newAddr.toModelNode()); } return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); case SERVICE: if (CONFIGURATION_CHANGES.equals(address.getElement(1).getValue())) { if ("list-changes".equals(operation.get(OP).asString())) { return Collections.emptyMap(); } op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); } break; case SECURITY_REALM: op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); default: return Collections.emptyMap(); } } return Collections.emptyMap(); }</code><technical_language>"audit" is a valid key here</technical_language>

Target:
private Map<Set<ServerIdentity>, ModelNode> resolveCoreServiceOperations(ModelNode operation, PathAddress address, ModelNode domain, ModelNode host) { if (MANAGEMENT.equals(address.getElement(0).getValue()) && address.size() >= 2) { ModelNode op = operation.clone(); switch (address.getElement(1).getKey()) { case ACCESS: if (AUDIT.equals(address.getElement(1).getValue())) { op.get(OP_ADDR).set(address.toModelNode()); if (address.size() >= 3) { PathAddress newAddr = PathAddress.EMPTY_ADDRESS; for (PathElement element : address) { if (LOGGER.equals(element.getKey())) { return Collections.emptyMap(); } else { PathElement myElement = element; if (SERVER_LOGGER.equals(myElement.getKey())) { myElement = PathElement.pathElement(LOGGER, element.getValue()); } newAddr = newAddr.append(myElement); } } op.get(OP_ADDR).set(newAddr.toModelNode()); } return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); } break; case SERVICE: if (CONFIGURATION_CHANGES.equals(address.getElement(1).getValue())) { if ("list-changes".equals(operation.get(OP).asString())) { return Collections.emptyMap(); } op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); } break; case SECURITY_REALM: op.get(OP_ADDR).set(address.toModelNode()); return Collections.singletonMap(getAllRunningServers(host, localHostName, serverProxies), op); default: return Collections.emptyMap(); } } return Collections.emptyMap(); }
Source:
<code>public void sendMailShouldEnqueueEmailWithRootStateAndDelayWhenSpecified() throws Exception { MailImpl mail = new MailImpl(); mail.setSender(mailAddress); mail.setRecipients(ImmutableList.of(mailAddress)); mail.setMessage(MimeMessageBuilder.defaultMimeMessage()); testee.sendMail(mail, 5, TimeUnit.MINUTES); ArgumentCaptor<Mail> mailArgumentCaptor = ArgumentCaptor.forClass(Mail.class); ArgumentCaptor<Long> delayArgumentCaptor = ArgumentCaptor.forClass(Long.class); ArgumentCaptor<TimeUnit> timeUnitArgumentCaptor = ArgumentCaptor.forClass(TimeUnit.class); verify(spoolMailQueue).enQueue(mailArgumentCaptor.capture(), delayArgumentCaptor.capture(), timeUnitArgumentCaptor.capture()); verifyNoMoreInteractions(spoolMailQueue); <START> assertThat(mailArgumentCaptor.getValue().getState()).isEqualTo(Mail.DEFAULT); <END> assertThat(delayArgumentCaptor.getValue()).isEqualTo(5L); assertThat(timeUnitArgumentCaptor.getValue()).isEqualTo(TimeUnit.MINUTES); }</code><technical_language>If need assertions, SoftAssertions 1. Create relevant junit class: @Rule public JUnitSoftAssertions softly = new JUnitSoftAssertions(); 2. in test assertThat: (those a simple assertThat need it) softly.assertThat(...) softly.assertThat(...) softly.assertThat(...) .... allows display of test error in a single run debugging easier</technical_language>

Target:
public void sendMailShouldEnqueueEmailWithRootStateAndDelayWhenSpecified() throws Exception { MailImpl mail = new MailImpl(); mail.setSender(mailAddress); mail.setRecipients(ImmutableList.of(mailAddress)); mail.setMessage(MimeMessageBuilder.defaultMimeMessage()); testee.sendMail(mail, 5, TimeUnit.MINUTES); ArgumentCaptor<Mail> mailArgumentCaptor = ArgumentCaptor.forClass(Mail.class); ArgumentCaptor<Long> delayArgumentCaptor = ArgumentCaptor.forClass(Long.class); ArgumentCaptor<TimeUnit> timeUnitArgumentCaptor = ArgumentCaptor.forClass(TimeUnit.class); verify(spoolMailQueue).enQueue(mailArgumentCaptor.capture(), delayArgumentCaptor.capture(), timeUnitArgumentCaptor.capture()); verifyNoMoreInteractions(spoolMailQueue); softly.assertThat(mailArgumentCaptor.getValue().getState()).isEqualTo(Mail.DEFAULT); softly.assertThat(delayArgumentCaptor.getValue()).isEqualTo(5L); softly.assertThat(timeUnitArgumentCaptor.getValue()).isEqualTo(TimeUnit.MINUTES); }
Source:
<code>void closeAttemptExceptionWillBeThrownDownTheCallStack() { FailingAutoClosableExtenstionContext failingExtensionContext = mock(FailingAutoClosableExtenstionContext.class); <START> doCallRealMethod().when(failingExtensionContext).close(); <END> JupiterEngineExecutionContext newContext = originalContext.extend().withExtensionContext( failingExtensionContext).build(); assertThrows(Exception.class, newContext::close); }</code><technical_language>a mock a real class? prefer mock a stubbed exception in this case</technical_language>

Target:
void closeAttemptExceptionWillBeThrownDownTheCallStack() throws Exception { ExtensionContext failingExtensionContext = mock(ExtensionContext.class, withSettings().extraInterfaces(AutoCloseable.class)); Exception expectedException = new Exception("test message"); doThrow(expectedException).when(((AutoCloseable) failingExtensionContext)).close(); JupiterEngineExecutionContext newContext = originalContext.extend() .withExtensionContext(failingExtensionContext) .build(); try { newContext.close(); fail("`close()` method did not raised an exception"); } catch (Exception actual) { assertSame(expectedException, actual); assertEquals("test message", actual.getMessage()); } }
Source:
<code>public void postStart() { <START> for (Map.Entry<ScopedState, Object> e : getStateCache().getAdvancedCache().entrySet()) { <END> if (CACHE_SCOPE.equals(e.getKey().getScope())) localCreateCache(e.getKey().getName(), (CacheState) e.getValue()); } stateCacheListener = new GlobalConfigurationStateListener(this); getStateCache().addListener(stateCacheListener, new ScopeFilter(CACHE_SCOPE)); if (globalConfiguration.globalState().enabled()) { try (FileInputStream fis = new FileInputStream(getPersistentFile())) { ConfigurationBuilderHolder holder = parserRegistry.parse(fis); for (Map.Entry<String, ConfigurationBuilder> entry : holder.getNamedConfigurationBuilders().entrySet()) { String name = entry.getKey(); Configuration configuration = entry.getValue().build(); createCache(name, configuration, EnumSet.of(CacheContainerAdmin.AdminFlag.PERSISTENT)); } } catch (FileNotFoundException e) { } catch (IOException e) { throw new CacheConfigurationException(e); } } }</code><technical_language>need call getAdvancedCache</technical_language>

Target:
public void postStart() { for (Map.Entry<ScopedState, Object> e : getStateCache().entrySet()) { if (CACHE_SCOPE.equals(e.getKey().getScope())) localCreateCache(e.getKey().getName(), (CacheState) e.getValue()); } GlobalConfigurationStateListener stateCacheListener = new GlobalConfigurationStateListener(this); getStateCache().addListener(stateCacheListener, new ScopeFilter(CACHE_SCOPE)); if (globalConfiguration.globalState().enabled()) { try (FileInputStream fis = new FileInputStream(getPersistentFile())) { ConfigurationBuilderHolder holder = parserRegistry.parse(fis); for (Map.Entry<String, ConfigurationBuilder> entry : holder.getNamedConfigurationBuilders().entrySet()) { String name = entry.getKey(); Configuration configuration = entry.getValue().build(); createCache(name, configuration, EnumSet.of(CacheContainerAdmin.AdminFlag.PERSISTENT)); } } catch (FileNotFoundException e) { } catch (IOException e) { throw new CacheConfigurationException(e); } } }
Source:
<code>private void addVariableToGroup() { final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); <START> if (selection.size() == 1) { <END> final Object selectedNode = selection.getFirstElement(); if (selectedNode instanceof IPath) { final IPath currentGroup = (IPath) selectedNode; if (currentGroup != null) getModel().addVariable(createVariable(), NAME_VARIABLE_CONTENT, null, currentGroup); } else if (selectedNode instanceof Variable) { final Variable currentVariable = (Variable) selectedNode; getModel().addVariable(createVariable(), NAME_VARIABLE_CONTENT, null, currentVariable.getPath()); } } else { getModel().addVariable(createVariable(), NAME_VARIABLE_CONTENT, null, new Path(VariablesTreeContentProvider.NAME_DEFAULT_VARIABLES_GROUP)); } }</code><technical_language>I guess plugin.xml expression takes care of this, need check</technical_language>

Target:
private void addVariableToGroup() { final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); if (selection.size() == 1) { final Object selectedNode = selection.getFirstElement(); if (selectedNode instanceof IPath) { final IPath currentGroup = (IPath) selectedNode; getModel().addVariable(createVariable(), DEFAULT_VARIABLE_CONTENT, null, currentGroup); } else if (selectedNode instanceof Variable) { final Variable currentVariable = (Variable) selectedNode; getModel().addVariable(createVariable(), DEFAULT_VARIABLE_CONTENT, null, currentVariable.getPath()); } } else { getModel().addVariable(createVariable(), DEFAULT_VARIABLE_CONTENT, null, Path.ROOT); } }
Source:
<code>private void requestLocationUpdates() { mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Set<String> mProviders = GeoUtils.evaluateProviders(mLocationManager); for (String provider : mProviders) { if ((provider.equals(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equals(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { if (location == null) { <START> Location lastKnownLocation = mLocationManager.getLastKnownLocation(provider); <END> this.location = toGeoPointData(lastKnownLocation); Log.i("HereFunctionHandler", "last known location: " + this.location.getDisplayText()); } mLocationManager.requestLocationUpdates(provider, 0, 0, this, Looper.getMainLooper()); } } locationUpdatesRequested = true; }</code><technical_language>if lastKnownLocation is null</technical_language>

Target:
public void requestLocationUpdates() { mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Set<String> mProviders = GeoUtils.evaluateProviders(mLocationManager); for (String provider : mProviders) { if ((provider.equals(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equals(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { if (location == null) { Location lastKnownLocation = mLocationManager.getLastKnownLocation(provider); if (lastKnownLocation != null) { this.location = toGeoPointData(lastKnownLocation); Log.i("HereFunctionHandler", "last known location: " + this.location.getDisplayText()); } } mLocationManager.requestLocationUpdates(provider, 0, 0, this, Looper.getMainLooper()); } } locationUpdatesRequested = true; locationUpdatesHaveBeenRequested = true; }
Source:
<code>public void smallDataWithValidChecksum_timesOutInCreateRepeatedly() throws Exception { InputStream inputStream = mock(ByteArrayInputStream.class); doAnswer((Answer<Integer>) invocation -> { ++nRetries; throw new SocketTimeoutException(); }).when(inputStream).read(any(), anyInt(), anyInt()); when(reconnector.connect(any(), any())).thenReturn(connection); when(connection.getInputStream()).thenReturn(inputStream); when(connection.getHeaderField("Accept-Ranges")).thenReturn("bytes"); thrown.expect(SocketTimeoutException.class); try { streamFactory.create(connection, AURL, GOOD_CHECKSUM, reconnector); } catch (Exception e) { <START> assertThat(nRetries).isGreaterThan(3); END> throw e; } }</code><technical_language>RetryingInputStream.MAX_RESUMES in isGreaterThan()</technical_language>

Target:
public void smallDataWithValidChecksum_timesOutInCreateRepeatedly() throws Exception { InputStream inputStream = mock(ByteArrayInputStream.class); doAnswer((Answer<Integer>) invocation -> { ++nRetries; throw new SocketTimeoutException(); }).when(inputStream).read(any(), anyInt(), anyInt()); when(reconnector.connect(any(), any())).thenReturn(connection); when(connection.getInputStream()).thenReturn(inputStream); when(connection.getHeaderField("Accept-Ranges")).thenReturn("bytes"); thrown.expect(SocketTimeoutException.class); Field field = RetryingInputStream.class.getDeclaredField("MAX_RESUMES"); field.setAccessible(true); int maxResumes = (int) field.get(null); try { streamFactory.create(connection, AURL, GOOD_CHECKSUM, reconnector); } catch (Exception e) { assertThat(nRetries).isGreaterThan(maxResumes); throw e; } }
Source:
<code>public Object getValueAndReset() { <START> Map<String, Object> ret = new ConcurrentHashMap<>(); <END> for (Map.Entry<String, ReducedMetric> e : value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; }</code><technical_language>HashMap good I think</technical_language>

Target:
public Object getValueAndReset() { Map<String, Object> ret = new HashMap<>(); for (Map.Entry<String, ReducedMetric> e : value.entrySet()) { Object val = e.getValue().getValueAndReset(); if (val != null) { ret.put(e.getKey(), val); } } return ret; }
Source:
<code>public void testMappingOfConsolidatedForm() { ObjectMapper mapper = new ObjectMapper(); try { TrialData data = mapper.readValue( "{\"trialSettings\":{\"userInput\":{}},\"environments\":{\"environments\":[{\"managementDetailValues\":{\"8170\":null,\"8192\":\"2\",\"8194\":\"1\"},\"" + "trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"4\",\"8194\":\"3\"},\"trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"" <START> + "6\",\"8194\":\"5\"},\"trialDetailValues\":{}}],\"noOfEnvironments\":\"3\"},\"basicDetails\":{\"basicDetails\":{\"8007\":\"test\",\"8050\":\"" <END> + "07/10/2014\",\"8060\":\"\"},\"folderId\":1,\"folderName\":\"Program Trials\",\"folderNameLabel\":\"Program Trials\",\"userID\":-1,\"userName\":\"Daniel Villafuerte\"}}", TrialData.class); Assert.assertNotNull(data); } catch (IOException e) { Assert.fail(e.getMessage()); } }</code><technical_language>remove 8050(Start date) too? 8007 (Part of BMS-4542)</technical_language>

Target:
public void testMappingOfConsolidatedForm() { ObjectMapper mapper = new ObjectMapper(); try { TrialData data = mapper.readValue( "{\"trialSettings\":{\"userInput\":{}},\"environments\":{\"environments\":[{\"managementDetailValues\":{\"8170\":null,\"8192\":\"2\",\"8194\":\"1\"},\"" + "trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"4\",\"8194\":\"3\"},\"trialDetailValues\":{}},{\"managementDetailValues\":{\"8170\":null,\"8192\":\"" + "6\",\"8194\":\"5\"},\"trialDetailValues\":{}}],\"noOfEnvironments\":\"3\"},\"basicDetails\":{\"folderId\":1,\"folderName\":\"Program Trials\",\"folderNameLabel\":\"Program Trials\",\"userID\":-1,\"userName\":\"Daniel Villafuerte\"}}", TrialData.class); Assert.assertNotNull(data); } catch (IOException e) { Assert.fail(e.getMessage()); } }
Source:
<code>public HdfsStorageService(OrcDataEnvironment environment, Path baseLocation) { <START> this.fileSystem = requireNonNull(environment, "requireNonNull is null").getFileSystem(); <END> Path baseDataDir = requireNonNull(baseLocation, "baseLocation is null"); this.baseStorageDir = new Path(baseDataDir, "storage"); this.baseQuarantineDir = new Path(baseDataDir, "quarantine"); }</code><technical_language>java this.fileSystem = requireNonNull(environment, "requireNonNull is null").getFileSystem(EMPTY_CONTEXT, baseLocation);</technical_language>

Target:
public HdfsStorageService(OrcDataEnvironment environment, Path baseLocation) { requireNonNull(baseLocation, "baseLocation is null"); this.baseStorageDir = new Path(baseLocation, "storage"); this.baseQuarantineDir = new Path(baseLocation, "quarantine"); this.environment = requireNonNull(environment, "environment is null"); }
Source:
<code>private static StateItem createState(LinuxStyle style) { int rgbInt = (int) style.toMap().getOrDefault(ITimeEventStyle.FILL_COLOR(), 0); RGB color = new RGB(rgbInt >> 24 & 0xff, rgbInt >> 16 & 0xff, rgbInt >> 8 & 0xff); <START> return new StateItem(color, style.getLabel()); <END> }</code><technical_language>here, do override getStyleMap method()</technical_language>

Target:
private static StateItem createState(LinuxStyle style) { int rgbInt = (int) style.toMap().getOrDefault(ITimeEventStyleStrings.fillColor(), 0); RGB color = new RGB(rgbInt >> 24 & 0xff, rgbInt >> 16 & 0xff, rgbInt >> 8 & 0xff); return new StateItem(color, style.getLabel()); }
Source:
<code>public void testDeploymentDoesntFailBecauseOfNPE() throws Exception { try { <START> deployer.deploy("test_jar"); <END> } catch (Exception e) { if (e instanceof DeploymentException) { StringWriter out = new StringWriter(); e.printStackTrace(new PrintWriter(out)); String stackTrace = out.getBuffer().toString(); if (stackTrace.contains("Caused by: java.lang.NullPointerException")) { throw e; } } else { throw e; } } }</code><technical_language>test expects deployment fail, Assert.fail line this one, e.g., like: Assert.fail("Expected DeploymentException thrown");</technical_language>

Target:
public void testDeploymentDoesntFailBecauseOfNPE() throws Exception { try { deployer.deploy("test_jar"); Assert.fail("Expected DeploymentException not thrown"); } catch (Exception e) { Assert.assertTrue(e instanceof DeploymentException); Assert.assertTrue(e.getMessage().contains(JSFLogger.ROOT_LOGGER.invalidDefaultJSFImpl("idontexist").getMessage())); } }
Source:
<code>public String skipString() throws IOException { <START> return tokenizer.readString(); <END> }</code><technical_language>tokenizer.skipString() I guess. need convert Utf8 String here, stream.skip()</technical_language>

Target:
public void skipString() throws IOException { readString(); }
Source:
<code>public Builder<T> waitDuration(Duration waitDuration) { if (waitDuration.toMillis() >= 0) { <START> this.intervalFunction = (x) -> waitDuration.toMillis(); <END> } return this; }</code><technical_language>throw exception if is < 0</technical_language>

Target:
public Builder<T> waitDuration(Duration waitDuration) { if (waitDuration.toMillis() >= 0) { this.intervalFunction = (x) -> waitDuration.toMillis(); } else { throw new IllegalArgumentException("waitDurationInOpenState must be a positive value"); } return this; }
Source:
<code>public void redraw (int x, int y, int width, int height, boolean all) { if (display.inPaint) { <START> display.asyncExec(() -> redraw(x, y, width, height, all)); <END> return; } checkWidget (); NSRect rect = new NSRect(); rect.x = x; rect.y = y; rect.width = width; rect.height = height; view.setNeedsDisplayInRect(rect); }</code><technical_language>contents of widget moved time redraw() invoked time asyncExec runs, in case x, y, width, height arguments need corrected a (more aggressive) version of redraw needs used. - widget disposed time outer redraw() invoked time asyncExec runs, in case this trigger exception. - widget repainted for other reasons this time, in case this repaint redundant</technical_language>

Target:
public void redraw(int x, int y, int width, int height, boolean all) { checkWidget(); if (display.inPaint) { display.asyncExec(() -> { if (!isDisposed()) setNeedsDisplayInRect(x, y, width, height); }); return; } setNeedsDisplayInRect(x, y, width, height); }
Source:
<code>boolean hasDoNotSetOnAnyLevel( List<ExecutableElement> methodElements, TypeElement daoLevelInterface) { boolean hasDoNotSetStatement = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, false) || insertHasDoNotSet(v, false) || setEntityHasDoNotSet(v, false) || queryHasDoNotSet(v, false)); boolean hasDoNotSetStatementSetExplicitly = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, true) || insertHasDoNotSet(v, true) || setEntityHasDoNotSet(v, true) || queryHasDoNotSet(v, true)); boolean hasSetToNullStatementSetExplicitlyForAll = methodElements .stream() .filter(this::isOperationWithNullSavingStrategy) .allMatch( v -> updateHasSetToNullExplicitly(v) || insertHasSetToNullExplicitly(v) || setEntitySetToNullExplicitly(v) || queryHasSetToNullExplicitly(v)); if (hasDaoLevelSetToNullStatement(daoLevelInterface) && hasDoNotSetStatementSetExplicitly) { return true; } else if (hasDaoLevelDoNotSetStatement(daoLevelInterface) && !hasSetToNullStatementSetExplicitlyForAll) { return true; } else { return hasDaoLevelUnset(daoLevelInterface) && hasDoNotSetStatement; } <START> } <END></code><technical_language>This is a bit hard follow, I more of inherent complexity, I do :) a naming suggestions (as fit): hasDoNotSetStatement => anyMethodHasOrDefaultsToDoNotSet hasDoNotSetStatementSetExplicitly => anyMethodHasDoNotSetExplicitly hasSetToNullStatementSetExplicitlyForAll => allMethodsHaveSetToNull (no need "explicitly" here, SET_TO_NULL is explicit) hasDaoLevelSetToNullStatement => daoHasSetToNull hasDaoLevelDoNotSetStatement => daoHasDoNotSet hasDaoLevelUnset => daoIsNotAnnotated</technical_language>

Target:
public boolean hasDoNotSetOnAnyLevel( List<ExecutableElement> methodElements, TypeElement daoLevelInterface) { boolean anyMethodHasOrDefaultsToDoNotSet = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, false) || insertHasDoNotSet(v, false) || setEntityHasDoNotSet(v, false) || queryHasDoNotSet(v, false)); boolean anyMethodHasDoNotSetExplicitly = methodElements .stream() .anyMatch( v -> updateHasDoNotSet(v, true) || insertHasDoNotSet(v, true) || setEntityHasDoNotSet(v, true) || queryHasDoNotSet(v, true)); boolean allMethodsHaveSetToNull = methodElements .stream() .filter(this::isOperationWithNullSavingStrategy) .allMatch( v -> updateHasSetToNullExplicitly(v) || insertHasSetToNullExplicitly(v) || setEntitySetToNullExplicitly(v) || queryHasSetToNullExplicitly(v)); if (daoHasSetToNull(daoLevelInterface) && anyMethodHasDoNotSetExplicitly) { return true; } else if (daoHasDoNotSet(daoLevelInterface) && !allMethodsHaveSetToNull) { return true; } else { return daoIsNotAnnotated(daoLevelInterface) && anyMethodHasOrDefaultsToDoNotSet; } }
Source:
<code>public void updateTokenRanges(Set<Range<LightweightOppToken>> newRanges) { Preconditions.checkArgument(!newRanges.isEmpty(), "Set of ranges must not be empty!"); <START> if (!Sets.symmetricDifference(ranges, newRanges).isEmpty()) { <END> ranges = newRanges; statsPerTable.clear(); } }</code><technical_language>newRanges.equals(ranges) here. Clearer intention more efficient return difference(union(set1, set2), intersection(set1, set2)) symmetricDifference</technical_language>

Target:
public void updateTokenRanges(Set<Range<LightweightOppToken>> newRanges) { Preconditions.checkArgument(!newRanges.isEmpty(), "Set of ranges must not be empty!"); if (!newRanges.equals(ranges)) { ranges = newRanges; statsPerTable.clear(); } }
Source:
<code>public Requirements(List<Requirement<?>> requirements, Class<?> clazz, String configID) { super(); if (requirements == null){ throw new IllegalArgumentException("The requirements list was null"); } if (clazz == null) { throw new IllegalArgumentException("The class containing requirements is null"); } this.requirements = requirements; <START> sortRequirements(this.requirements); <END> this.clazz = clazz; this.configID = configID; }</code><technical_language>this.requirements = requirements.sort(new PriorityComparator()); ? instead of creating duplicite comparator sort requirements</technical_language>

Target:
public Requirements(List<Requirement<?>> requirements, Class<?> clazz, String configID) { super(); if (requirements == null){ throw new IllegalArgumentException("The requirements list was null"); } if (clazz == null) { throw new IllegalArgumentException("The class containing requirements is null"); } requirements.sort(new PriorityComparator()); this.requirements = requirements; this.clazz = clazz; this.configID = configID; }