auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void should_fail_if_given_would_be_equal_to_actual_with_default_comparator() { ChronoLocalDateTime<JapaneseDate> inJapan = JapaneseChronology.INSTANCE.localDateTime(now); <START> assertThatThrownBy(() -> assertThat(now).isEqualTo(inJapan)).isInstanceOf(AssertionFailedError.class); <END> }</code><technical_language>inJapan is a LocalDateTime, AbstractLocalDateTimeAssert.isEqualTo(LocalDateTime other) is called AbstractAssert.isEqualTo(Object other) is assertion fail. I assertion pass want isEqualTo assertion consistent LocalDateTime.isEqual, this is if AbstractLocalDateTimeAssert.isEqualTo overrides AbstractAssert.isEqualTo (that is Object parameter). end test assertions be: java assertThat(now.equals(inJapan)).isFalse(); assertThat(now.isEqual(inJapan)).isTrue(); assertThat(now).isEqualTo(inJapan); Object inJapanObject = inJapan; assertThat(now).isEqualTo(inJapanObject);</technical_language>

Target:
public void should_fail_if_given_would_be_equal_to_actual_with_default_comparator() { ChronoLocalDateTime<JapaneseDate> inJapan = JapaneseChronology.INSTANCE.localDateTime(now); assertThat(now.equals(inJapan)).isFalse(); assertThat(now.isEqual(inJapan)).isTrue(); assertThat(now).isEqualTo(inJapan); Object inJapanObject = inJapan; assertThat(now).isEqualTo(inJapanObject); }
Source:
<code>private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singletonList( String.format("HTTP/1.1 %d %s", status, reason) ), new Select<String>( origin.head(), new Condition<String>() { @Override public boolean fits(final String element) { <START> return !RsWithStatus.FIRST.matcher(element).matches(); <END> } } ) ); }</code><technical_language>@dmzaytsev eghh... I it. checking single line for a regex matching.. this is 1) slow 2) redundant. need do is filter out line. I AtomicBoolean flag for</technical_language>

Target:
private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singletonList( String.format("HTTP/1.1 %d %s", status, reason) ), new Select<String>( origin.head(), new Condition<String>() { private final AtomicBoolean fit = new AtomicBoolean(false); @Override public boolean fits(final String element) { return this.fit.getAndSet(true); } } ) ); }
Source:
<code>SimpleList<Sequence> getSequencesForType(TypedOperation operation, int i, boolean onlyReceivers) { Type neededType = operation.getInputTypes().get(i); SimpleList<Sequence> literals = null; if (operation instanceof TypedClassOperation && !onlyReceivers) { ClassOrInterfaceType declaringCls = ((TypedClassOperation) operation).getDeclaringType(); assert declaringCls != null; if (classLiterals != null) { SimpleList<Sequence> sl = classLiterals.getSequences(declaringCls, neededType); if (!sl.isEmpty()) { literals = sl; } } if (packageLiterals != null) { Package pkg = declaringCls.getPackage(); if (pkg != null) { SimpleList<Sequence> sl = packageLiterals.getSequences(pkg, neededType); if (!sl.isEmpty()) { literals = (literals == null) ? sl : new ListOfLists<>(literals, sl); } } <START> } else if (classLiterals != null && Randomness.weightedCoinFlip(GenInputsAbstract.p_const)) { <END> return classLiterals.getSequences(declaringCls, neededType); } } SimpleList<Sequence> result = gralComponents.getSequencesForType(neededType, false, onlyReceivers); if (literals != null) { result = new ListOfLists<>(result, literals); } return result; }</code><technical_language>This change default behavior of Randoop. depend literals_level CLASS_OR_ALL</technical_language>

Target:
SimpleList<Sequence> getSequencesForType(TypedOperation operation, int i, boolean onlyReceivers) { Type neededType = operation.getInputTypes().get(i); if (onlyReceivers && neededType.isNonreceiverType()) { throw new RandoopBug( String.format( "getSequencesForType(%s, %s, %s) neededType=%s", operation, i, onlyReceivers, neededType)); } SimpleList<Sequence> result = gralComponents.getSequencesForType(neededType, false, onlyReceivers); SimpleList<Sequence> literals = null; if (operation instanceof TypedClassOperation && !onlyReceivers) { ClassOrInterfaceType declaringCls = ((TypedClassOperation) operation).getDeclaringType(); assert declaringCls != null; if (classLiterals != null) { SimpleList<Sequence> sl = classLiterals.getSequences(declaringCls, neededType); if (!sl.isEmpty()) { literals = sl; } } boolean shouldOnlyIncludeConstantsFromDeclaringClass = GenInputsAbstract.input_selection == GenInputsAbstract.InputSelectionMode.CONSTANT_MINING && Randomness.weightedCoinFlip(GenInputsAbstract.p_const); if (!shouldOnlyIncludeConstantsFromDeclaringClass && packageLiterals != null) { Package pkg = declaringCls.getPackage(); if (pkg != null) { SimpleList<Sequence> sl = packageLiterals.getSequences(pkg, neededType); if (!sl.isEmpty()) { literals = (literals == null) ? sl : new ListOfLists<>(literals, sl); } } } } if (literals != null) { if (result == null) { result = literals; } else if (literals == null) { } else { result = new ListOfLists<>(result, literals); } } return result; }
Source:
<code><START> public void testStateChangeWithUnknownPlugin() throws InterruptedException { <END> this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return null; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getMySql().getComponent().setInstallerName( "unknown installer" ); processor.processMessage( new MsgCmdSetScopedInstance( app.getMySqlVm())); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getMySql(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testStateChangeWithUnknownPlugin() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return null; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getMySql().getComponent().setInstallerName( "unknown installer" ); processor.processMessage( new MsgCmdSetScopedInstance( app.getMySqlVm())); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getMySql(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); }
Source:
<code>public StreamingOutput getResponseStream() { return new StreamingOutput() { ObjectNode chunkNode; ArrayNode resultNode; ArrayNode rmdNode; @Override public void write(OutputStream os) throws IOException { <START> ArrayNode entityData=(ArrayNode)streamResponse.getEntityData(); <END> streamResponse.setEntityData(null); List<ResultMetadata> rmd=streamResponse.getResultMetadata(); streamResponse.setResultMetadata(null); Writer writer=new OutputStreamWriter(os); writer.write(streamResponse.toJson().toString()); writer.flush(); for(int i=0;i<entityData.size();i++) { ObjectNode chunkNode=JsonNodeFactory.instance.objectNode(); if(i==entityData.size()-1) { chunkNode.set("last",JsonNodeFactory.instance.booleanNode(true)); } chunkNode.set("processed",entityData.get(i)); if(i<rmd.size()) chunkNode.set("resultMetadata",rmd.get(i).toJson()); writer.write(chunkNode.toString()); } writer.flush(); } }; }</code><technical_language>instanceof ArrayNode check</technical_language>

Target:
public StreamingOutput getResponseStream() { return new StreamingOutput() { ObjectNode chunkNode; ArrayNode resultNode; ArrayNode rmdNode; @Override public void write(OutputStream os) throws IOException { JsonNode entityDataNode=streamResponse.getEntityData(); streamResponse.setEntityData(null); ArrayNode entityData; if(entityDataNode instanceof ArrayNode) { entityData=(ArrayNode)entityDataNode; } else { entityData=JsonNodeFactory.instance.arrayNode(); if (entityDataNode instanceof ObjectNode) { entityData.add(entityDataNode); } } List<ResultMetadata> rmd=streamResponse.getResultMetadata(); streamResponse.setResultMetadata(null); Writer writer=new OutputStreamWriter(os); writer.write(streamResponse.toJson().toString()); writer.flush(); for(int i=0;i<entityData.size();i++) { ObjectNode chunkNode=JsonNodeFactory.instance.objectNode(); if(i==entityData.size()-1) { chunkNode.set("last",JsonNodeFactory.instance.booleanNode(true)); } chunkNode.set("processed",entityData.get(i)); if(i<rmd.size()) chunkNode.set("resultMetadata",rmd.get(i).toJson()); writer.write(chunkNode.toString()); } writer.flush(); } }; }
Source:
<code>private void showVolumeProfiling() { if(getSelectedItem() == null) { return; <START> } <END> GlusterVolumeEntity selectedVolume = (GlusterVolumeEntity)getSelectedItem(); VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName()); if(getWindow() == null) { setWindow(profileStatsModel); setHelpTag(HelpTag.volume_profile_statistics); setHashName("volume_profile_statistics"); } else { return; } profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this); closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); profileStatsModel.queryBackend(true); }</code><technical_language>do if(getWindow() == null) { return; }</technical_language>

Target:
private void showVolumeProfiling() { if(getSelectedItem() == null || getWindow()!= null) { return; } GlusterVolumeEntity selectedVolume = (GlusterVolumeEntity)getSelectedItem(); VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName()); setWindow(profileStatsModel); setHelpTag(HelpTag.volume_profile_statistics); setHashName("volume_profile_statistics"); profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this); closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); profileStatsModel.queryBackend(true); profileStatsModel.queryBackend(false); }
Source:
<code>public XWikiDocument getDocument(DocumentReference docRef) throws XWikiException { <START> Preconditions.checkNotNull(docRef); <END> return getContext().getWiki().getDocument(docRef, getContext()); }</code><technical_language>please change Preconditions static import</technical_language>

Target:
public XWikiDocument getDocument(DocumentReference docRef) throws DocumentLoadException, DocumentNotExistsException { checkNotNull(docRef); if (exists(docRef)) { return getDocumentInternal(docRef); } else { throw new DocumentNotExistsException("Doc does not exist " + toString(docRef)); } }
Source:
<code>private NotificationHelper createFakeNotificationHelper(NotificationManagerCompat notificationManager, NotificationCompat.Builder builder) { NotificationHelper notificationHelper = mock(NotificationHelper.class); when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application); when(notificationHelper.getNotificationManager()).thenReturn(notificationManager); when(notificationHelper.createNotificationBuilder(any(Account.class), <START> any(NotificationChannelUtils.ChannelType.MISCELLANEOUS.getClass()))) <END> .thenReturn(builder); return notificationHelper; }</code><technical_language>If want match a specific ArgumentMatchers.eq(): suggestion eq(NotificationChannelUtils.ChannelType.MISCELLANEOUS))) If do, need call getClass() instance. write as: suggestion any(NotificationChannelUtils.ChannelType.class)))</technical_language>

Target:
private NotificationHelper createFakeNotificationHelper(NotificationManagerCompat notificationManager, NotificationCompat.Builder builder) { NotificationHelper notificationHelper = mock(NotificationHelper.class); when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application); when(notificationHelper.getNotificationManager()).thenReturn(notificationManager); when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils.ChannelType.class))) .thenReturn(builder); return notificationHelper; }
Source:
<code>public void inlineRowMapper() { <START> List<User> users = handle.createQuery("SELECT * FROM user ORDER BY id ASC") <END> .map((rs, ctx) -> new User(rs.getInt("id"), rs.getString("name"))) .list(); assertThat(users).hasSize(4); assertThat(users.get(3).name).isEqualTo("Data"); }</code><technical_language>write SELECT id, name instead of SELECT *</technical_language>

Target:
public void inlineRowMapper() { List<User> users = handle.createQuery("SELECT id, name FROM user ORDER BY id ASC") .map((rs, ctx) -> new User(rs.getInt("id"), rs.getString("name"))) .list(); assertThat(users).hasSize(4); assertThat(users.get(3).name).isEqualTo("Data"); }
Source:
<code>public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessablePermanent() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setPermanent(true); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); <START> <END> }</code><technical_language>double check group created</technical_language>

Target:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessablePermanent() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setPermanent(true); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isNoContent()); }
Source:
<code>public void waitForRequiredBundles(String symbolicNamePrefix) { await("Waiting for bundles with prefix to be ready: " + symbolicNamePrefix) .atMost(FEATURES_AND_BUNDLES_TIMEOUT, TimeUnit.MILLISECONDS) .pollDelay(1, TimeUnit.SECONDS) .until( <START> () -> <END> Arrays.stream(bundleContext.getBundles()) .filter(bundle -> bundle.getSymbolicName().startsWith(symbolicNamePrefix)) .allMatch(this::isBundleReady)); }</code><technical_language>Move this lambda in a private method increase readability</technical_language>

Target:
public void waitForRequiredBundles(String symbolicNamePrefix) { await("Waiting for bundles with prefix to be ready: " + symbolicNamePrefix) .atMost(FEATURES_AND_BUNDLES_TIMEOUT, TimeUnit.MILLISECONDS) .pollDelay(1, TimeUnit.SECONDS) .until(() -> areBundlesReady(symbolicNamePrefix)); }
Source:
<code>private void loadComment(Intent intent) { if (intent == null) { showErrorAndFinish(); return; } mLocalBlogId = intent.getIntExtra(ARG_LOCAL_BLOG_ID, 0); mCommentId = intent.getLongExtra(ARG_COMMENT_ID, 0); final String noteId = intent.getStringExtra(ARG_NOTE_ID); if (noteId == null) { mComment = CommentTable.getComment(mLocalBlogId, mCommentId); if (mComment == null) { showErrorAndFinish(); return; } configureViews(); } else { mNote = NotificationsTable.getNoteById(noteId); if (mNote != null) { requestFullCommentForNote(mNote); <START> } <END> } }</code><technical_language>I need show user happened, if manage obtain Note database. callling showErrorAndFinish(); in else statement</technical_language>

Target:
private void loadComment(Intent intent) { if (intent == null) { showErrorAndFinish(); return; } mLocalBlogId = intent.getIntExtra(ARG_LOCAL_BLOG_ID, 0); mCommentId = intent.getLongExtra(ARG_COMMENT_ID, 0); final String noteId = intent.getStringExtra(ARG_NOTE_ID); if (noteId == null) { mComment = CommentTable.getComment(mLocalBlogId, mCommentId); if (mComment == null) { showErrorAndFinish(); return; } configureViews(); } else { mNote = NotificationsTable.getNoteById(noteId); if (mNote != null) { requestFullCommentForNote(mNote); } else { showErrorAndFinish(); } } }
Source:
<code>private void checkServer() { <START> checkState(!this.client); <END> }</code><technical_language>ServerUtils.isMainThread() etc</technical_language>

Target:
private void checkServer() { checkState(ServerUtils.isCallingFromMainThread()); }
Source:
<code>private long getAvailableScopedStorageSize(StoragePathProvider storagePathProvider) { String scopedStoragePath = storagePathProvider.getScopedExternalFilesDirPath(); if (scopedStoragePath.isEmpty()) { return 0; } StatFs stat = new StatFs(scopedStoragePath); <START> long blockSize; <END> long availableBlocks; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { blockSize = stat.getBlockSizeLong(); availableBlocks = stat.getAvailableBlocksLong(); } else { blockSize = stat.getBlockSize(); availableBlocks = stat.getAvailableBlocks(); } return availableBlocks * blockSize; }</code><technical_language>I pre-emptively remove this changing minSdk in this release</technical_language>

Target:
private long getAvailableScopedStorageSize(StoragePathProvider storagePathProvider) { String scopedStoragePath = storagePathProvider.getScopedStorageRootDirPath(); if (scopedStoragePath.isEmpty()) { return 0; } StatFs stat = new StatFs(scopedStoragePath); return stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); }
Source:
<code>public void testTryGetDiskImageForNonPrivilegeUser() { DiskImage result = dao.getDiskImageByDiskAndImageIds(FixturesTool.IMAGE_GROUP_ID, FixturesTool.IMAGE_ID, UNPRIVILEGED_USER_ID, true); <START> assertEquals(null, <END> result); }</code><technical_language>assertNull</technical_language>

Target:
public void testTryGetDiskImageForNonPrivilegeUser() { DiskImage result = dao.getDiskImageByDiskAndImageIds(FixturesTool.IMAGE_GROUP_ID, FixturesTool.IMAGE_ID, UNPRIVILEGED_USER_ID, true); assertNull(null, result); }
Source:
<code>public void testSetup() throws Exception { <START> final FrameworkConfig config = PigRelBuilderTest.config().build(); <END> converter = PigConverter.create(config); }</code><technical_language>(Alt) move skip condition testSetup method above</technical_language>

Target:
public void testSetup() throws Exception { Assume.assumeFalse("Skip: Pig/Hadoop tests do not work on Windows", System.getProperty("os.name").startsWith("Windows")); final FrameworkConfig config = PigRelBuilderTest.config().build(); converter = PigConverter.create(config); }
Source:
<code>public FileSystemResource(Path path) { <START> this.path = path; <END> }</code><technical_language>Args.notNull</technical_language>

Target:
public FileSystemResource(Path path) { Args.notNull(path, "path"); this.path = path; }
Source:
<code>public void errorPublisherTest(PublisherTestRun<T> body) throws Throwable { potentiallyPendingTest(createErrorStatePublisher(), body, "Skipping because no error state Publisher provided, and the test requires it. " + <START> "Please implement PublisherVerification#createErrorStatePublisher to run this test."); <END> }</code><technical_language>Good</technical_language>

Target:
public void errorPublisherTest(PublisherTestRun<T> body) throws Throwable { potentiallyPendingTest(createErrorStatePublisher(), body, SKIPPING_NO_ERROR_PUBLISHER_AVAILABLE); }
Source:
<code>public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (response.getStatusCode() == 429) { <START> return true; <END> } else { return backoffHandler.shouldRetryRequest(command, response); } }</code><technical_language>[the practices](<LINK_0>, a backoff if is a 429 error. However, returning true retry request immediately. apply backoff for 429 errors return false otherwise</technical_language>

Target:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (response.getStatusCode() == TOO_MANY_REQUESTS) { return backoffHandler.shouldRetryRequest(command, response); } else { return false; } }
Source:
<code>protected void onDraw(Canvas canvas) { canvas.save(); canvas.clipRect(0f, 0f, getWidth(), trackLineHeightPx, Region.Op.INTERSECT); canvas.drawRoundRect(trackLineBounds, trackLineCornerRadiusPx, trackLineCornerRadiusPx, trackBgPaint); <START> canvas.restore(); <END> super.onDraw(canvas); if (showTrackDrawable) { canvas.drawCircle(trackDrawableBounds.centerX(), trackDrawableBounds.centerY(), trackDrawableBounds.width() / 2f, trackBgPaint); } }</code><technical_language>want extract track line drawing code in a method, for track icon</technical_language>

Target:
protected void onDraw(Canvas canvas) { drawTrackLineOn(canvas); super.onDraw(canvas); if (showTrackDrawable) { drawTrackDrawableOn(canvas); } }
Source:
<code>public void testGetModelsAfter2000UsingFor() { List<String> models = ImperativeProgramming.getModelsAfter2000(cars); <START> assertEquals(models, Arrays.asList("Avenger", "Wrangler", "Focus", "Cascada")); <END> }</code><technical_language>arguments in incorrect order. assertEquals(expected, actual)</technical_language>

Target:
public void testGetModelsAfter2000UsingFor() { List<String> models = ImperativeProgramming.getModelsAfter2000(cars); assertEquals(Arrays.asList("Avenger", "Wrangler", "Focus", "Cascada"), models); }
Source:
<code>public void getExportedResourcesTest() throws IOException { File jar1 = new File(resourcesFolder, JAR_1); File jar2 = new File(resourcesFolder, JAR_2); File jar3Folder = new File(resourcesFolder, JAR_3_LOCATION); File jar3 = new File(jar3Folder, JAR_3); String configFileName = "config.xml"; File config = new File(muleFolder, configFileName); File hiddenFile = new File(munitFolder, HIDDEN_FILE); if (System.getProperty("os.name").toLowerCase().equals("win")) { Files.setAttribute(hiddenFile.toPath(), "dos:hidden", true); } jar1.createNewFile(); jar2.createNewFile(); jar3Folder.mkdirs(); jar3.createNewFile(); config.createNewFile(); hiddenFile.createNewFile(); List<String> actualExportedResources = resolver.getExportedResources(); assertThat("Exported resources does not contain all expected elements", actualExportedResources, <START> containsInAnyOrder(JAR_1, JAR_2, JAR_3_LOCATION + File.separator + JAR_3, configFileName)); <END> assertThat("Configs contain an unexpected elements", actualExportedResources.contains(hiddenFile), is(false)); assertThat("Exported resources contains more elements than expected", actualExportedResources.size(), equalTo(4)); }</code><technical_language>static import</technical_language>

Target:
public void getExportedResourcesTest() throws IOException { File jar1 = new File(resourcesFolder, JAR_1); File jar2 = new File(resourcesFolder, JAR_2); File jar3Folder = new File(resourcesFolder, JAR_3_LOCATION); File jar3 = new File(jar3Folder, JAR_3); String configFileName = "config.xml"; File config = new File(muleFolder, configFileName); File hiddenFile = new File(munitFolder, HIDDEN_FILE); if (System.getProperty("os.name").toLowerCase().equals("win")) { Files.setAttribute(hiddenFile.toPath(), "dos:hidden", true); } jar1.createNewFile(); jar2.createNewFile(); jar3Folder.mkdirs(); jar3.createNewFile(); config.createNewFile(); hiddenFile.createNewFile(); List<String> actualExportedResources = resolver.getExportedResources(); assertThat("Exported resources does not contain all expected elements", actualExportedResources, containsInAnyOrder(JAR_1, JAR_2, JAR_3_LOCATION + separator + JAR_3, configFileName)); assertThat("Configs contain an unexpected elements", actualExportedResources.contains(hiddenFile), is(false)); assertThat("Exported resources contains more elements than expected", actualExportedResources.size(), equalTo(4)); }
Source:
<code>public static XMLGregorianCalendar getXMLGregorianCalendarFrom(Date date) { if (date != null) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); try { XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); <START> LOG.info("{}-{}-{} {}:{}:{} {}", cal.getMonth(), cal.getDay(), cal.getYear(), cal.getHour(), <END> cal.getMinute(), cal.getSecond(), cal.getTimezone()); return cal; } catch (DatatypeConfigurationException ex) { LOG.error("Unable to convert date ", ex.getLocalizedMessage(), ex); } } return null; }</code><technical_language>convert this a debug</technical_language>

Target:
public static XMLGregorianCalendar getXMLGregorianCalendarFrom(Date date) { if (date != null) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); try { XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); LOG.trace("{}-{}-{} {}:{}:{} {}", cal.getMonth(), cal.getDay(), cal.getYear(), cal.getHour(), cal.getMinute(), cal.getSecond(), cal.getTimezone()); return cal; } catch (DatatypeConfigurationException ex) { LOG.error("Unable to convert date ", ex.getLocalizedMessage(), ex); } } return null; }
Source:
<code>private List<String> readDataFromFile() { List<String> wordsFromFile = new ArrayList<String>(); BufferedReader br = null; try { br = new BufferedReader(new FileReader(dataPath)); String line; while ((line = br.readLine()) != null) { wordsFromFile.add(line); } } catch(IOException ex) { <START> ex.printStackTrace(); <END> } finally { try { if(br != null) br.close(); } catch (IOException e) { e.printStackTrace(); } } return wordsFromFile; }</code><technical_language>logging better, exception rethrown (even if wrapped RuntimeException)</technical_language>

Target:
private List<String> readDataFromFile() { List<String> wordsFromFile = new ArrayList<String>(); BufferedReader br = null; try { br = new BufferedReader(new FileReader(dataPath)); String line; while ((line = br.readLine()) != null) { wordsFromFile.add(line); } } catch(IOException ex) { log.error("Error is thrown during file reading!", ex); throw new RuntimeException(ex); } finally { try { if(br != null) br.close(); } catch (IOException ex) { log.error("Error is thrown during closing file stream!", ex); throw new RuntimeException(ex); } } return wordsFromFile; }
Source:
<code>private ArrayList<String> retrieveActiveComponentsList(String command) throws IOException { writeInputCommand(command); try { readResponseToFindActiveComponents(); <START> } catch (SocketTimeoutException e) { <END> log.error("Socket timeout Exception " + e); } return arrList; }</code><technical_language>need rethrow timeout exception</technical_language>

Target:
private ArrayList<String> retrieveActiveComponentsList(String command) throws CarbonToolsIntegrationTestException { writeInputCommand(command); readResponseToFindActiveComponents(); return arrList; }
Source:
<code>void should_fail_if_throwable_has_no_cause() { ThrowableAssert.ThrowingCallable code = () -> { <START> Throwable throwable = new Throwable("top level message"); <END> new ThrowableAssertAlternative<>(throwable) .havingCause(); }; AssertionsUtil.assertThatAssertionErrorIsThrownBy(code).withMessage("expecting java.lang.Throwable: top level message to have a cause but it did not"); }</code><technical_language>AssertionsUtil.expectAssertionError(ThrowingCallable shouldRaiseAssertionError) instead (// section). move Throwable throwable = new Throwable("top level message"); new ThrowableAssertAlternative<>(throwable) // section</technical_language>

Target:
void should_fail_if_throwable_has_no_cause() { Throwable throwable = new Throwable("top level message"); ThrowableAssertAlternative<Throwable> taa = new ThrowableAssertAlternative<>(throwable); AssertionError error = expectAssertionError(taa::havingCause); assertThat(error).hasMessage(shouldHaveCause(throwable).create()); }
Source:
<code><START> public <T extends Settings> T getSettings(Project project, ConnectorType connectorType, Class<T> settingsClass) { <END> notNull(project, "project"); notNull(connectorType, "connectorType"); try { return restTemplate.getForObject(Settings.URL, settingsClass, project.getId(), connectorType.getName()); } catch (GoodDataRestException | RestClientException e) { throw new ConnectorException("Unable to get " + connectorType + " integration settings", e); } }</code><technical_language>settingsClass null</technical_language>

Target:
public <T extends Settings> T getSettings(Project project, ConnectorType connectorType, Class<T> settingsClass) { notNull(project, "project"); notNull(connectorType, "connectorType"); notNull(settingsClass, "settingsClass"); try { return restTemplate.getForObject(Settings.URL, settingsClass, project.getId(), connectorType.getName()); } catch (GoodDataRestException | RestClientException e) { throw new ConnectorException("Unable to get " + connectorType + " integration settings", e); } }
Source:
<code>public OpenVRProvider() { <START> for (int c = 0; c < 2; c++) { <END> controllerDeviceIndex[c] = -1; controllerStateReference[c] = new VRControllerState_t(); inputStateRefernceArray[c] = new VRControllerState_t.ByReference(); inputStateRefernceArray[c].setAutoRead(false); inputStateRefernceArray[c].setAutoWrite(false); inputStateRefernceArray[c].setAutoSynch(false); texType[c] = new Texture_t(); } }</code><technical_language>"c"? unabbreviate it</technical_language>

Target:
public OpenVRProvider() { for (int handIndex = 0; handIndex < 2; handIndex++) { controllerDeviceIndex[handIndex] = -1; controllerStateReference[handIndex] = new VRControllerState_t(); inputStateRefernceArray[handIndex] = new VRControllerState_t.ByReference(); inputStateRefernceArray[handIndex].setAutoRead(false); inputStateRefernceArray[handIndex].setAutoWrite(false); inputStateRefernceArray[handIndex].setAutoSynch(false); texType[handIndex] = new Texture_t(); } }
Source:
<code>public void testStatelessCepQuery() { final MISTCepStatelessQuery exampleQuery = MISTCepStatelessQueryBuilder.newBuilder() .input(exampleCepInput) .condition(Conditions.gt("Temperature", 25)) <START> .action(CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Hot")) <END> .condition(Conditions.lt("Temperature", 10)) .action(CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Cold")) .build(); final List<CepStatelessRule> expectedRules = new ArrayList<CepStatelessRule>() {{ add(new CepStatelessRule(Conditions.gt("Temperature", 25), CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Hot"))); add(new CepStatelessRule(Conditions.lt("Temperature", 10), CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Cold"))); }}; Assert.assertEquals(expectedRules, exampleQuery.getCepStatelessRules()); }</code><technical_language>do set condition action separately? conditionAndAction method</technical_language>

Target:
public void testStatelessCepQuery() { final MISTCepStatelessQuery exampleQuery = new MISTCepStatelessQuery.Builder() .input(exampleCepInput) .addStatelessRule(new CepStatelessRule.Builder() .setCondition(ComparisonCondition.gt("Temperature", 25)) .setAction(new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Hot") .build()) .build() ) .addStatelessRule(new CepStatelessRule.Builder() .setCondition(ComparisonCondition.lt("Temperature", 10)) .setAction(new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Cold") .build()) .build() ) .build(); Assert.assertEquals(exampleCepInput, exampleQuery.getCepInput()); final List<CepStatelessRule> statelessRules = exampleQuery.getCepStatelessRules(); Assert.assertEquals(statelessRules.size(), 2); final CepStatelessRule rule0 = statelessRules.get(0); Assert.assertEquals(rule0.getCondition(), ComparisonCondition.gt("Temperature", 25)); Assert.assertEquals(rule0.getAction(), new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Hot") .build()); final CepStatelessRule rule1 = statelessRules.get(1); Assert.assertEquals(rule1.getCondition(), ComparisonCondition.lt("Temperature", 10)); Assert.assertEquals(rule1.getAction(), new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Cold") .build()); }
Source:
<code>public void test_reconnection() throws Exception { long count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); Assert.assertThat(count, Matchers.equalTo(1L)); String productInstanceId = getProductInstanceId(); setDelay(6000, proxies); Thread.sleep(6000); setDelay(0L, proxies); Cache<String, String> cache = cacheManager.getCache("dedicated-cache-1", String.class, String.class); String initiate_reconnect = cache.get("initiate reconnect"); assertThat(initiate_reconnect, Matchers.nullValue()); while (!Thread.currentThread().isInterrupted()) { count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); if (count == 1) { break; } else { Thread.sleep(1_000); } } if (Thread.currentThread().isInterrupted()) { fail(); <START> } else { <END> assertThat(getProductInstanceId(), equalTo(productInstanceId)); } }</code><technical_language>need for a else1 a fail. assert. assertThat(Thread.currentThread().isInterrupted()).isFalse()</technical_language>

Target:
public void test_reconnection() throws Exception { long count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); Assert.assertThat(count, Matchers.equalTo(1L)); String instanceId = getInstanceId(); setDelay(6000, proxies); Thread.sleep(6000); setDelay(0L, proxies); Cache<String, String> cache = cacheManager.getCache("dedicated-cache-1", String.class, String.class); String initiate_reconnect = cache.get("initiate reconnect"); assertThat(initiate_reconnect, Matchers.nullValue()); while (!Thread.currentThread().isInterrupted()) { count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); if (count == 1) { break; } else { Thread.sleep(1_000); } } assertThat(Thread.currentThread().isInterrupted(), is(false)); assertThat(getInstanceId(), equalTo(instanceId)); }
Source:
<code>public void stopLocationUpdates() { <START> if (!isMonitoringLocation() || !googleApiClient.isConnected()) { <END> return; } fusedLocationProviderApi.removeLocationUpdates(googleApiClient, locationListener); locationListener = null; }</code><technical_language>I for a locationListener set googleApiClient connected. In case, locationListener set null. I a good state in. safe, wrap removeLocationUpdates call</technical_language>

Target:
public void stopLocationUpdates() { if (!isMonitoringLocation()) { return; } if (googleApiClient.isConnected()) { fusedLocationProviderApi.removeLocationUpdates(googleApiClient, locationListener); } locationListener = null; }
Source:
<code>public EcjProblem(@Nonnull CategorizedProblem problem) { this.problem = problem; if (problem.getOriginatingFileName() == null) { sourceInfo = SourceInfo.UNKNOWN; } else { int lineProblem = problem.getSourceLineNumber(); SourceInfoFactory sourceInfoFactory = Jack.getSession().getSourceInfoFactory(); if (problem instanceof DefaultProblem) { int columnProblem = ((DefaultProblem) problem).getSourceColumnNumber(); sourceInfo = sourceInfoFactory.create(columnProblem, <START> columnProblem, lineProblem, <END> lineProblem, String.valueOf(problem.getOriginatingFileName())); } else { sourceInfo = sourceInfoFactory.create(lineProblem, lineProblem, String.valueOf(problem.getOriginatingFileName())); } } }</code><technical_language>sure. I is preferable end column unknown, no</technical_language>

Target:
public EcjProblem(@Nonnull CategorizedProblem problem) { this.problem = problem; if (problem.getOriginatingFileName() == null) { sourceInfo = SourceInfo.UNKNOWN; } else { int lineProblem = problem.getSourceLineNumber(); SourceInfoFactory sourceInfoFactory = Jack.getSession().getSourceInfoFactory(); if (problem instanceof DefaultProblem) { int columnProblem = ((DefaultProblem) problem).getSourceColumnNumber(); sourceInfo = sourceInfoFactory.create(columnProblem, SourceInfo.UNKNOWN_COLUMN_NUMBER, lineProblem, SourceInfo.UNKNOWN_LINE_NUMBER, String.valueOf(problem.getOriginatingFileName())); } else { sourceInfo = sourceInfoFactory.create(lineProblem, SourceInfo.UNKNOWN_LINE_NUMBER, String.valueOf(problem.getOriginatingFileName())); } } }
Source:
<code>private String validateNewNamespaceArgument(ByteBuffer namespaceArg, TableOperation op, Validator<String> userValidator) throws ThriftTableOperationException { String namespace = namespaceArg == null ? null : ByteBufferUtil.toString(namespaceArg); if ((namespace != null) && (namespace.length() > MAX_NAMESPACE_LEN)) { throw new ThriftTableOperationException(null, namespace, op, <START> TableOperationExceptionType.OTHER, <END> "Namespaces must be less than or equal to " + MAX_NAMESPACE_LEN + " characters. " + "'" + namespace + "' is " + namespace.length() + " characters long."); } return _validateArgument(namespace, op, Namespaces.VALID_NAME.and(userValidator)); }</code><technical_language>is INVALID_NAME type instead of OTHER. (Same for NAMESPACE validation method)</technical_language>

Target:
private String validateNewNamespaceArgument(ByteBuffer namespaceArg, TableOperation op, Validator<String> userValidator) throws ThriftTableOperationException { String namespace = namespaceArg == null ? null : ByteBufferUtil.toString(namespaceArg); if ((namespace != null) && (namespace.length() > MAX_NAMESPACE_LEN)) { throw new ThriftTableOperationException(null, namespace, op, TableOperationExceptionType.INVALID_NAME, "Namespaces must be less than or equal to " + MAX_NAMESPACE_LEN + " characters. " + "'" + namespace + "' is " + namespace.length() + " characters long."); } return _validateArgument(namespace, op, Namespaces.VALID_NAME.and(userValidator)); }
Source:
<code>public void getParts() { Iterator<DoubleSegment> edges = RECTANGLE.getParts().iterator(); <START> assertEquals(TOP_EDGE, edges.next()); <END> assertEquals(LEFT_EDGE, edges.next()); assertEquals(RIGHT_EDGE, edges.next()); assertEquals(BOTTOM_EDGE, edges.next()); assertFalse(edges.hasNext()); }</code><technical_language>I assertEquals(Arrays.asList(...), edges)</technical_language>

Target:
public void getParts() { assertEquals( asList(TOP_EDGE, LEFT_EDGE, RIGHT_EDGE, BOTTOM_EDGE), RECTANGLE.getParts() ); }
Source:
<code>public ResponseEntity<ResourceSupport> createTemplateItem(HttpServletRequest request, @PathVariable UUID uuid, @RequestBody(required = false) JsonNode itemBody) throws SQLException, AuthorizeException { if (itemBody == null) { <START> throw new BadRequestException("The new item should be included as json in te body of this request"); <END> } Context context = ContextUtil.obtainContext(request); Collection collection = getCollection(context, uuid); ItemRest inputItemRest; try { ObjectMapper mapper = new ObjectMapper(); inputItemRest = mapper.readValue(itemBody.toString(), ItemRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } ItemRest templateItem = collectionRestRepository.createTemplateItem(context, collection, inputItemRest); context.commit(); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, null, new ItemResource(templateItem, utils)); }</code><technical_language>Minor typo: 'the body'</technical_language>

Target:
public ResponseEntity<ResourceSupport> createTemplateItem(HttpServletRequest request, @PathVariable UUID uuid, @RequestBody(required = false) JsonNode itemBody) throws SQLException, AuthorizeException { if (itemBody == null) { throw new BadRequestException("The new item should be included as json in the body of this request"); } Context context = ContextUtil.obtainContext(request); Collection collection = getCollection(context, uuid); ItemRest inputItemRest; try { ObjectMapper mapper = new ObjectMapper(); inputItemRest = mapper.readValue(itemBody.toString(), ItemRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } ItemRest templateItem = collectionRestRepository.createTemplateItem(context, collection, inputItemRest); context.commit(); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, null, new ItemResource(templateItem, utils)); }
Source:
<code>public void canGetJobRequest() throws GenieException { final JobRequest job1Request = this.service.getJobRequest(JOB_1_ID); Assert.assertThat( job1Request.getCommandArgs().orElseThrow(IllegalArgumentException::new), Matchers.is("-f query.q") ); <START> Assert.assertThat( <END> job1Request.getClusterCriterias().size(), Matchers.is(2) ); final Set<String> clusterCriterion0Tags = job1Request.getClusterCriterias().get(0).getTags(); Assert.assertThat( clusterCriterion0Tags.size(), Matchers.is(4) ); Assert.assertThat( clusterCriterion0Tags, Matchers.is(Sets.newHashSet("genie.id:cluster1", "genie.name:h2query", "sla", "yarn")) ); Assert.assertThat( this.service.getJobRequest(JOB_2_ID).getCommandArgs().orElseThrow(IllegalArgumentException::new), Matchers.is("-f spark.jar") ); Assert.assertThat( this.service.getJobRequest(JOB_3_ID).getCommandArgs().orElseThrow(IllegalArgumentException::new), Matchers.is("-f spark.jar") ); try { this.service.getJobRequest(UUID.randomUUID().toString()); Assert.fail(); } catch (final GenieException ge) { Assert.assertTrue(ge instanceof GenieNotFoundException); } }</code><technical_language>check of for equality? (currently a mix of size checking equality for field)</technical_language>

Target:
public void canGetJobRequest() throws GenieException { final JobRequest job1Request = this.service.getJobRequest(JOB_1_ID); Assert.assertThat( job1Request.getCommandArgs().orElseThrow(IllegalArgumentException::new), Matchers.is("-f query.q") ); Assert.assertThat( job1Request.getClusterCriterias().size(), Matchers.is(2) ); final Set<String> clusterCriterion0Tags = job1Request.getClusterCriterias().get(0).getTags(); Assert.assertThat( clusterCriterion0Tags.size(), Matchers.is(4) ); Assert.assertThat( clusterCriterion0Tags, Matchers.is(Sets.newHashSet("genie.id:cluster1", "genie.name:h2query", "sla", "yarn")) ); final Set<String> clusterCriterion1Tags = job1Request.getClusterCriterias().get(1).getTags(); Assert.assertThat( clusterCriterion1Tags.size(), Matchers.is(2) ); Assert.assertThat( clusterCriterion1Tags, Matchers.is(Sets.newHashSet("sla", "adhoc")) ); final Set<String> commandCriterionTags = job1Request.getCommandCriteria(); Assert.assertThat( commandCriterionTags, Matchers.is(Sets.newHashSet("type:spark", "ver:1.6.0", "genie.name:spark")) ); Assert.assertThat( this.service.getJobRequest(JOB_2_ID).getCommandArgs().orElseThrow(IllegalArgumentException::new), Matchers.is("-f spark.jar") ); Assert.assertThat( this.service.getJobRequest(JOB_3_ID).getCommandArgs().orElseThrow(IllegalArgumentException::new), Matchers.is("-f spark.jar") ); try { this.service.getJobRequest(UUID.randomUUID().toString()); Assert.fail(); } catch (final GenieException ge) { Assert.assertTrue(ge instanceof GenieNotFoundException); } }
Source:
<code>private void setLambdaVariableNames(IJavaValue value, ObjectReference underlyingThisObject) { try { IType type = JavaDebugUtils.resolveType(value.getJavaType()); ASTParser parser = <START> ASTParser.newParser(AST.JLS8); <END> parser.setResolveBindings(true); parser.setSource(type.getTypeRoot()); CompilationUnit cu = (CompilationUnit) parser.createAST(null); cu.accept(new ASTVisitor(false) { @Override public boolean visit(LambdaExpression lambdaExpression) { IMethodBinding binding = lambdaExpression.resolveMethodBinding(); IVariableBinding[] synVars = binding.getSyntheticOuterLocals(); if (synVars == null || synVars.length == 0) { return true; } List<Field> allFields = underlyingThisObject.referenceType().fields(); ListIterator<Field> listIterator = allFields.listIterator(); int i = 0; if (getUnderlyingMethod().isStatic()) { if (synVars.length == allFields.size()) { while (listIterator.hasNext()) { FieldImpl field = (FieldImpl) listIterator.next(); String newName = synVars[i].getName(); FieldImpl newField = new FieldImpl((VirtualMachineImpl) field.virtualMachine(), (ReferenceTypeImpl) field.declaringType(), field.getFieldID(), newName, field.signature(), field.genericSignature(), field.modifiers()); listIterator.set(newField); } } } else { if (synVars.length + 1 == allFields.size()) { while (listIterator.hasNext()) { FieldImpl field = (FieldImpl) listIterator.next(); String newName = field.name(); if (i > 0) { newName = synVars[i - 1].getName(); } else { newName = "this"; } FieldImpl newField = new FieldImpl((VirtualMachineImpl) field.virtualMachine(), (ReferenceTypeImpl) field.declaringType(), field.getFieldID(), newName, field.signature(), field.genericSignature(), field.modifiers()); listIterator.set(newField); i++; } } } return true; } }); } catch (CoreException e) { logError(e); } }</code><technical_language>This is deprecated. I JLS11 - work Java 8 constructs</technical_language>

Target:
private void setLambdaVariableNames(IJavaValue value, ObjectReference underlyingThisObject) { try { IType type = JavaDebugUtils.resolveType(value.getJavaType()); ASTParser parser = ASTParser.newParser(AST.JLS11); parser.setResolveBindings(true); parser.setSource(type.getTypeRoot()); CompilationUnit cu = (CompilationUnit) parser.createAST(null); cu.accept(new LambdaASTVisitor(false, underlyingThisObject, getUnderlyingMethod())); } catch (CoreException e) { logError(e); } }
Source:
<code>public void testBracketsInGroup() throws Exception { createFiles("[", "]", "[]", "][", "[[]", "[]]", "[[]]"); writeTrashFile(".gitattributes", "[[]] bar1\n"); writeTrashFile(".gitattributes", "[\\[]] bar2\n"); writeTrashFile(".gitattributes", "[[\\]] bar3\n"); <START> writeTrashFile(".gitattributes", "[\\[\\]] bar4\n"); <END> assertSameAsCGit(); }</code><technical_language>I presume want line in .gitattributes? I need do a single writeTrashFile lines: writeTrashFile(".gitattributes", "[[]] bar\n" + "[\\[]] bar2\n" + ... );</technical_language>

Target:
public void testBracketsInGroup() throws Exception { createFiles("[", "]", "[]", "][", "[[]", "[]]", "[[]]"); writeTrashFile(".gitattributes", "[[]] bar1\n" + "[\\[]] bar2\n" + "[[\\]] bar3\n" + "[\\[\\]] bar4\n"); assertSameAsCGit(); }