auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static List<JavaBeanParameter> getParameters(Executable executable) { if ( executable.getParameterCount() == 0 ) { return Collections.emptyList(); } List<JavaBeanParameter> parameters = new ArrayList<>( executable.getParameterCount() ); Parameter[] parameterArray = executable.getParameters(); Class<?>[] parameterTypes = executable.getParameterTypes(); Type[] genericParameterTypes = executable.getGenericParameterTypes(); if ( parameterTypes.length == genericParameterTypes.length ) { for ( int i = 0; i < parameterArray.length; i++ ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], genericParameterTypes[i] ) ); } } else { int explicitlyDeclaredParameterIndex = 0; for ( int i = 0; i < parameterArray.length; i++ ) { if ( parameterArray[i].isSynthetic() || parameterArray[i].isImplicit() ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], parameterTypes[i] ) ); } else { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], genericParameterTypes[explicitlyDeclaredParameterIndex] ) ); explicitlyDeclaredParameterIndex++; } } } return CollectionHelper.toImmutableList( parameters ); }

Target:
private static List<JavaBeanParameter> getParameters(Executable executable) { if ( executable.getParameterCount() == 0 ) { return Collections.emptyList(); } List<JavaBeanParameter> parameters = new ArrayList<>( executable.getParameterCount() ); Parameter[] parameterArray = executable.getParameters(); Class<?>[] parameterTypes = executable.getParameterTypes(); Type[] genericParameterTypes = executable.getGenericParameterTypes(); if ( parameterTypes.length == genericParameterTypes.length ) { for ( int i = 0; i < parameterArray.length; i++ ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], getErasedTypeIfTypeVariable( genericParameterTypes[i] ) ) ); } } else { int explicitlyDeclaredParameterIndex = 0; for ( int i = 0; i < parameterArray.length; i++ ) { if ( parameterArray[i].isSynthetic() || parameterArray[i].isImplicit() ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], parameterTypes[i] ) ); } else { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], getErasedTypeIfTypeVariable( genericParameterTypes[explicitlyDeclaredParameterIndex] ) ) ); explicitlyDeclaredParameterIndex++; } } } return CollectionHelper.toImmutableList( parameters ); }
Source:
public void setAccessTokenExpiresSkew(Duration accessTokenExpiresSkew) { Assert.notNull(accessTokenExpiresSkew, "accessTokenExpiresSkew cannot be null"); this.accessTokenExpiresSkew = accessTokenExpiresSkew; updateAuthorizedClientManager(); }

Target:
public void setAccessTokenExpiresSkew(Duration accessTokenExpiresSkew) { Assert.notNull(accessTokenExpiresSkew, "accessTokenExpiresSkew cannot be null"); Assert.state(this.defaultAuthorizedClientManager, "The accessTokenExpiresSkew cannot be set when the constructor used is \"ServletOAuth2AuthorizedClientExchangeFilterFunction(OAuth2AuthorizedClientManager)\". " + "Instead, use the constructor \"ServletOAuth2AuthorizedClientExchangeFilterFunction(ClientRegistrationRepository, OAuth2AuthorizedClientRepository)\"."); this.accessTokenExpiresSkew = accessTokenExpiresSkew; updateDefaultAuthorizedClientManager(); }
Source:
public static void checkStringDataLength(Object dataValue) { int length = ((String) dataValue).length(); if (length > JDBC__MAX_VARCHAR_LENGTH) { throw newJdbcException("SQL data value length must be <= %d not %d\nValue: %s", JDBC__MAX_VARCHAR_LENGTH, length, dataValue); } }

Target:
private static void checkStringDataLength(Object dataValue) { int length = ((String) dataValue).length(); if (length > JDBC__MAX_VARCHAR_LENGTH) { throw newJdbcException("SQL data value length must be <= %d not %d\nValue: %s", JDBC__MAX_VARCHAR_LENGTH, length, dataValue); } }
Source:
private void stateTransition(State newState, Function<CircuitBreakerState, CircuitBreakerState> newStateGenerator) { CircuitBreakerState previousState = stateReference.getAndUpdate(currentState -> { if (currentState.getState() == newState) { return currentState; } return newStateGenerator.apply(currentState); }); if (previousState.getState() != newState) { publishStateTransitionEvent(StateTransition.transitionBetween(previousState.getState(), newState)); if (circuitBreakerConfig.getEnableAutomaticTransitionFromOpenToHalfOpen() && newState.equals(OPEN)) { OpenToHalfOpenAutoTransitioner.scheduleAutoTransitionToHalfOpen(this); } } }

Target:
private void stateTransition(State newState, Function<CircuitBreakerState, CircuitBreakerState> newStateGenerator) { CircuitBreakerState previousState = stateReference.getAndUpdate(currentState -> { if (currentState.getState() == newState) { return currentState; } return newStateGenerator.apply(currentState); }); if (previousState.getState() != newState) { publishStateTransitionEvent(StateTransition.transitionBetween(previousState.getState(), newState)); } }
Source:
public WfsMetadataImpl( Supplier<String> idSupplier, Supplier<String> coordinateOrderSupplier, List<String> featureMemberNodeNames, Class<T> descriptorClass) { this.idSupplier = idSupplier; this.coordinateOrderSupplier = coordinateOrderSupplier; this.descriptorClass = descriptorClass; this.featureMemberNodeNames = featureMemberNodeNames; this.descriptors = new HashSet<>(); if (featureMemberNodeNames != null && featureMemberNodeNames.size() > 0) { this.activeFeatureMemberNodeName = featureMemberNodeNames.get(0); } }

Target:
public WfsMetadataImpl( Supplier<String> idSupplier, Supplier<String> coordinateOrderSupplier, List<String> featureMemberNodeNames, Class<T> descriptorClass) { this.idSupplier = idSupplier; this.coordinateOrderSupplier = coordinateOrderSupplier; this.descriptorClass = descriptorClass; this.featureMemberNodeNames = featureMemberNodeNames; this.descriptors = new HashSet<>(); if (CollectionUtils.isNotEmpty(featureMemberNodeNames)) { this.activeFeatureMemberNodeName = featureMemberNodeNames.get(0); } }
Source:
protected Mark parseMark(Node root) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("parsing mark"); } Mark mark = factory.createMark(); mark.setFill(null); mark.setStroke(null); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } if (childName.equalsIgnoreCase(strokeString)) { mark.setStroke(parseStroke(child)); } else if (childName.equalsIgnoreCase(fillSt)) { mark.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("WellKnownName")) { if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting mark to " + getFirstChildValue(child)); Expression wellKnownName = parseCssParameter(child); if (wellKnownName instanceof Literal) { String expanded = wellKnownName.evaluate(null, String.class); if (expanded != null && expanded.startsWith("file://")) { URL url = onlineResourceLocator.locateResource(expanded); if (url != null) { wellKnownName = ff.literal(url.toExternalForm()); } } } mark.setWellKnownName(wellKnownName); } } return mark; }

Target:
protected Mark parseMark(Node root) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("parsing mark"); } Mark mark = factory.createMark(); mark.setFill(null); mark.setStroke(null); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } if (childName.equalsIgnoreCase(strokeString)) { mark.setStroke(parseStroke(child)); } else if (childName.equalsIgnoreCase(fillSt)) { mark.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("WellKnownName")) { if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting mark to " + getFirstChildValue(child)); Expression wellKnownName = parseCssParameter(child); if (wellKnownName instanceof Literal) { String expanded = wellKnownName.evaluate(null, String.class); if (expanded != null && expanded.startsWith("file://")) { URL url = onlineResourceLocator.locateResource(expanded); if (url != null) { wellKnownName = ff.literal(url.toExternalForm()); } else { LOGGER.log( Level.WARNING, "WellKnownName file reference could not be found: " + expanded); } } } mark.setWellKnownName(wellKnownName); } } return mark; }
Source:
FilteredOffset( Offset baseOffset, ColumnSelectorFactory columnSelectorFactory, boolean descending, Filter postFilter, ColumnSelectorBitmapIndexSelector bitmapIndexSelector ) { this.baseOffset = baseOffset; RowOffsetMatcherFactory rowOffsetMatcherFactory = new CursorOffsetHolderRowOffsetMatcherFactory( baseOffset.getBaseReadableOffset(), descending ); if (postFilter instanceof BooleanFilter) { filterMatcher = ((BooleanFilter) postFilter).makeMatcher( bitmapIndexSelector, columnSelectorFactory, rowOffsetMatcherFactory ); } else { if (postFilter.shouldUseIndex(bitmapIndexSelector)) { filterMatcher = rowOffsetMatcherFactory.makeRowOffsetMatcher( postFilter.getBitmapIndex(bitmapIndexSelector) ); } else { filterMatcher = postFilter.makeMatcher(columnSelectorFactory); } } incrementIfNeededOnCreationOrReset(); }

Target:
FilteredOffset( Offset baseOffset, ColumnSelectorFactory columnSelectorFactory, boolean descending, Filter postFilter, ColumnSelectorBitmapIndexSelector bitmapIndexSelector ) { this.baseOffset = baseOffset; RowOffsetMatcherFactory rowOffsetMatcherFactory = new CursorOffsetHolderRowOffsetMatcherFactory( baseOffset.getBaseReadableOffset(), descending ); if (postFilter instanceof BooleanFilter) { filterMatcher = ((BooleanFilter) postFilter).makeMatcher( bitmapIndexSelector, columnSelectorFactory, rowOffsetMatcherFactory ); } else { if (postFilter.shouldUseBitmapIndex(bitmapIndexSelector)) { filterMatcher = rowOffsetMatcherFactory.makeRowOffsetMatcher( postFilter.getBitmapIndex(bitmapIndexSelector) ); } else { filterMatcher = postFilter.makeMatcher(columnSelectorFactory); } } incrementIfNeededOnCreationOrReset(); }
Source:
private File getPackageDirectory() { if (packageDirectory != null && !packageDirectory.isEmpty()) { File dir = new File(packageDirectory); if (dir.isAbsolute()) { return dir; } else { File packageDir = new File(project.getBuild().getDirectory(), packageDirectory); return packageDir; } } else { File packageDir = new File(project.getBuild().getDirectory()); return packageDir; } }

Target:
private File getPackageDirectory() throws IOException { if (packageDirectory != null && !packageDirectory.isEmpty()) { File dir = new File(packageDirectory); if (dir.isAbsolute()) { return dir.getCanonicalFile(); } else { File packageDir = new File(project.getBuild().getDirectory(), packageDirectory); return packageDir.getCanonicalFile(); } } else { File packageDir = new File(project.getBuild().getDirectory()); return packageDir.getCanonicalFile(); } }
Source:
public void testToFlowElement_notautostart() throws Exception { final ReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(false)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertFalse(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get()); }

Target:
public void testToFlowElement_notautostart() { final ReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(false)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertFalse(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get()); }
Source:
public List<EPerson> findAll(Context context, MetadataField metadataSortField, String sortField, int pageSize, int offset) throws SQLException { String queryString = "SELECT " + EPerson.class.getSimpleName() .toLowerCase() + " FROM EPerson as " + EPerson.class .getSimpleName().toLowerCase(); List<MetadataField> sortFields = Collections.EMPTY_LIST; if (metadataSortField != null) {ItemRestRepositoryIT sortFields = Collections.singletonList(metadataSortField); } Query query = getSearchQuery(context, queryString, null, Collections.EMPTY_LIST, sortFields, sortField, pageSize, offset); return list(query); }

Target:
public List<EPerson> findAll(Context context, MetadataField metadataSortField, String sortField, int pageSize, int offset) throws SQLException { String queryString = "SELECT " + EPerson.class.getSimpleName() .toLowerCase() + " FROM EPerson as " + EPerson.class .getSimpleName().toLowerCase(); List<MetadataField> sortFields = Collections.EMPTY_LIST; if (metadataSortField != null) { sortFields = Collections.singletonList(metadataSortField); } Query query = getSearchQuery(context, queryString, null, Collections.EMPTY_LIST, sortFields, sortField, pageSize, offset); return list(query); }
Source:
private void initializeAdapter(){ if (adapter == null) { adapter = new CourseOutlineAdapter(getActivity(), environment.getDatabase() , environment.getStorage(), new CourseOutlineAdapter.DownloadListener() { @Override public void download(List<HasDownloadEntry> models) { if (AppConstants.offline_flag) { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); } else { downloadManager.downloadVideos( models, getActivity() , (VideoDownloadHelper.DownloadManagerCallback) getActivity()); } } @Override public void download(DownloadEntry videoData) { if (AppConstants.offline_flag) { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); } else { downloadManager.downloadVideo( videoData, getActivity() , (VideoDownloadHelper.DownloadManagerCallback) getActivity()); } } @Override public void viewDownloadStatus() { environment.getRouter().showDownloads(getActivity()); } }); } if (!(NetworkUtil.isConnected(getActivity()))) { AppConstants.offline_flag = true; } else { AppConstants.offline_flag = false; } }

Target:
private void initializeAdapter() { if (adapter == null) { adapter = new CourseOutlineAdapter(getActivity(), environment.getDatabase(), environment.getStorage(), new CourseOutlineAdapter.DownloadListener() { @Override public void download(List<HasDownloadEntry> models) { CourseOutlineActivity activity = (CourseOutlineActivity) getActivity(); if (NetworkUtil.verifyDownloadPossible(activity)) { downloadManager.downloadVideos(models, getActivity(), (VideoDownloadHelper.DownloadManagerCallback) getActivity()); } } @Override public void download(DownloadEntry videoData) { CourseOutlineActivity activity = (CourseOutlineActivity) getActivity(); if (NetworkUtil.verifyDownloadPossible(activity)) { downloadManager.downloadVideo(videoData, activity, activity); } } @Override public void viewDownloadsStatus() { environment.getRouter().showDownloads(getActivity()); } }); } AppConstants.offline_flag = !NetworkUtil.isConnected(getActivity()); }
Source:
void assertSetEquals(List<String> expected, List<String> actual) { assertEquals(new HashSet<String>(expected), new HashSet<String>(actual)); }

Target:
void assertSetEquals(List<String> expected, List<String> actual) { assertEquals(new HashSet<>(expected), new HashSet<>(actual)); }
Source:
public void testMultipleBlobClose() throws Exception { String blobUrlPrefix = "test"; long maxBlobSize = AzureBlobAvroWriter.DATAFILEWRITER_OVERHEAD + 1000; long maxRecordsPerBlob = 10; BlobContainerAsyncClient mockContainerClient = PowerMockito.mock(BlobContainerAsyncClient.class); azureBlobAvroWriter = spy(new AzureBlobAvroWriter(mockContainerClient, mock(AzureBlobWriterMetrics.class), threadPool, THRESHOLD, 60000, blobUrlPrefix, mockDataFileWriter, mockAzureBlobOutputStream, mockBlockBlobAsyncClient, maxBlobSize, maxRecordsPerBlob)); DataFileWriter<IndexedRecord> mockDataFileWriter2 = mock(DataFileWriter.class); AzureBlobOutputStream mockAzureBlobOutputStream2 = mock(AzureBlobOutputStream.class); when(mockAzureBlobOutputStream.getSize()).thenReturn((long) 1); when(mockAzureBlobOutputStream.getSize()).thenReturn((long) 1); BlobAsyncClient mockBlobAsyncClient = mock(BlobAsyncClient.class); doReturn(mockBlobAsyncClient).when(mockContainerClient).getBlobAsyncClient(anyString()); doReturn(mockBlockBlobAsyncClient).when(mockBlobAsyncClient).getBlockBlobAsyncClient(); PowerMockito.whenNew(AzureBlobOutputStream.class).withAnyArguments().thenReturn(mockAzureBlobOutputStream2); PowerMockito.whenNew(DataFileWriter.class).withAnyArguments().thenReturn(mockDataFileWriter2); for (int i = 0; i <= maxRecordsPerBlob; i++) { azureBlobAvroWriter.write(ome); } azureBlobAvroWriter.close(); verify(mockAzureBlobOutputStream).close(); verify(mockAzureBlobOutputStream2).close(); verify(mockDataFileWriter).close(); verify(mockDataFileWriter2).close(); }

Target:
public void testMultipleBlobClose() throws Exception { String blobUrlPrefix = "test"; long maxBlobSize = AzureBlobAvroWriter.DATAFILEWRITER_OVERHEAD + 1000; long maxRecordsPerBlob = 10; BlobContainerAsyncClient mockContainerClient = PowerMockito.mock(BlobContainerAsyncClient.class); azureBlobAvroWriter = spy(new AzureBlobAvroWriter(mockContainerClient, mock(AzureBlobWriterMetrics.class), threadPool, THRESHOLD, 60000, blobUrlPrefix, mockDataFileWriter, mockAzureBlobOutputStream, mockBlockBlobAsyncClient, maxBlobSize, maxRecordsPerBlob, mockCompression, false)); DataFileWriter<IndexedRecord> mockDataFileWriter2 = mock(DataFileWriter.class); AzureBlobOutputStream mockAzureBlobOutputStream2 = mock(AzureBlobOutputStream.class); when(mockAzureBlobOutputStream.getSize()).thenReturn((long) 1); BlobAsyncClient mockBlobAsyncClient = mock(BlobAsyncClient.class); doReturn(mockBlobAsyncClient).when(mockContainerClient).getBlobAsyncClient(anyString()); doReturn(mockBlockBlobAsyncClient).when(mockBlobAsyncClient).getBlockBlobAsyncClient(); PowerMockito.whenNew(AzureBlobOutputStream.class).withAnyArguments().thenReturn(mockAzureBlobOutputStream2); PowerMockito.whenNew(DataFileWriter.class).withAnyArguments().thenReturn(mockDataFileWriter2); for (int i = 0; i <= maxRecordsPerBlob; i++) { azureBlobAvroWriter.write(ome); } azureBlobAvroWriter.close(); verify(mockDataFileWriter).close(); verify(mockDataFileWriter2).close(); }
Source:
public Iterator getLocations() { return this.cyclicIterator; }

Target:
public Iterator<StorageLocation> getLocations() { return new Iterator<StorageLocation>() { private final int numStorageLocations = storageLocations.size(); private int remainingIterations = numStorageLocations; @Override public boolean hasNext() { return remainingIterations > 0; } @Override public StorageLocation next() { if (!hasNext()) { throw new NoSuchElementException(); } remainingIterations--; final StorageLocation nextLocation = storageLocations.get(startIndex.getAndUpdate(n -> (n + 1) % numStorageLocations)); return nextLocation; } }; }
Source:
private void waitForIndexSynced() { List<Cache<String, Object>> caches = caches(); caches.forEach(c -> { SearchManager sm = Search.getSearchManager(c); DataContainer<String, Object> dataContainer = c.getAdvancedCache().getDataContainer(); Map<Class<?>, AtomicInteger> countPerEntity = new HashMap<>(); dataContainer.forEach(e -> { Class<?> entity = e.getValue().getClass(); countPerEntity.computeIfAbsent(entity, aClass -> new AtomicInteger(0)).incrementAndGet(); }); countPerEntity.forEach((entity, count) -> { CacheQuery<Object> q = sm.getQuery("FROM " + entity.getName()); eventually(() -> q.list().size() == count.get()); }); }); }

Target:
private void waitForIndexSynced() { List<Cache<String, Object>> caches = caches(); caches.forEach(c -> { SearchManager sm = Search.getSearchManager(c); DataContainer<String, Object> dataContainer = c.getAdvancedCache().getDataContainer(); Map<Class<?>, Integer> countPerEntity = new HashMap<>(); dataContainer.forEach(e -> { Class<?> entity = e.getValue().getClass(); countPerEntity.merge(entity, 1, Integer::sum); }); countPerEntity.forEach((entity, count) -> { CacheQuery<Object> q = sm.getQuery("FROM " + entity.getName()); eventually(() -> q.list().size() == count); }); }); }
Source:
private ChannelFuture maybeWriteResponseMetadata() { try { responseMetadataChangeLock.lock(); verifyResponseAlive(); if (!HttpHeaders.isContentLengthSet(responseMetadata)) { HttpHeaders.setTransferEncodingChunked(responseMetadata); } logger .trace("Sending response metadata with status on channel {}", responseMetadata.getStatus(), ctx.channel()); responseMetadataWritten.set(true); return writeToChannel(responseMetadata, ChannelWriteType.Unsafe); } catch (Exception e) { return ctx.newFailedFuture(e); } finally { responseMetadataChangeLock.unlock(); } }

Target:
private ChannelFuture maybeWriteResponseMetadata() { responseMetadataChangeLock.lock(); try { verifyResponseMetadataAlive(); if (!HttpHeaders.isContentLengthSet(responseMetadata)) { HttpHeaders.setTransferEncodingChunked(responseMetadata); } logger .trace("Sending response metadata with status on channel {}", responseMetadata.getStatus(), ctx.channel()); responseMetadataWritten.set(true); return writeToChannel(responseMetadata, ChannelWriteType.Unsafe); } catch (Exception e) { return ctx.newFailedFuture(e); } finally { responseMetadataChangeLock.unlock(); } }
Source:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && n.getChildCount() == 2 && n.getFirstChild().matchesQualifiedName("require") && n.getChildAtIndex(1).isString()) { visitRequireCall(t, n, parent); } if (n.isIf()) { FindModuleExportsOrExports commonjsFinder = new FindModuleExportsOrExports(); NodeTraversal.traverse(compiler, n.getFirstChild(), commonjsFinder); if (commonjsFinder.isFound()) { visitCommonJSIfCondition(n); } else { FindDefineAMD amdFinder = new FindDefineAMD(); NodeTraversal.traverse(compiler, n.getFirstChild(), amdFinder); if (amdFinder.isFound()) { visitAMDIfCondition(n); } } } if (n.isScript()) { scriptNodeCount++; visitScript(t, n); } if (n.isGetProp() && "module.exports".equals(n.getQualifiedName())) { Var v = t.getScope().getVar(MODULE); if (v == null) { moduleExportRefs.add(n); } } if (n.isName() && EXPORTS.equals(n.getString())) { Var v = t.getScope().getVar(n.getString()); if (v == null || v.isGlobal()) { exportRefs.add(n); } } }

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && n.getChildCount() == 2 && n.getFirstChild().matchesQualifiedName("require") && n.getChildAtIndex(1).isString()) { visitRequireCall(t, n, parent); } if (n.isIf()) { FindModuleExportStatements commonjsFinder = new FindModuleExportStatements(); Node condition = n.getFirstChild(); NodeTraversal.traverse(compiler, condition, commonjsFinder); if (commonjsFinder.isFound()) { visitCommonJSIfStatement(n); } else { FindDefineAmdStatements amdFinder = new FindDefineAmdStatements(); NodeTraversal.traverse(compiler, condition, amdFinder); if (amdFinder.isFound()) { visitAMDIfStatement(n); } } } if (n.isScript()) { scriptNodeCount++; visitScript(t, n); } if (n.isGetProp() && "module.exports".equals(n.getQualifiedName())) { Var v = t.getScope().getVar(MODULE); if (v == null) { moduleExportRefs.add(n); } } if (n.isName() && EXPORTS.equals(n.getString())) { Var v = t.getScope().getVar(n.getString()); if (v == null || v.isGlobal()) { exportRefs.add(n); } } }
Source:
@Override public ListServicesCmd.Exec createListServicesCmdExec() { return new ListServicesCmdExec(getBaseResource(), getDockerClientConfig()); }

Target:
public ListServicesCmd.Exec createListServicesCmdExec() { return new ListServicesCmdExec(getBaseResource(), getDockerClientConfig()); }
Source:
public void testErrorMessage() { String[] cmd = TestUtil.getJavaCommand(RepeatTextWithTimeout.class, "2", "1000", "Hello, World"); boolean failed = false; try { PtyProcess.exec(cmd); } catch (IOException e) { failed = true; } Assert.assertTrue("Library should be failed to loaded unless -DPTY_LIB_FOLDER=os specified", failed); }

Target:
public void testErrorMessage() throws IOException { TestUtil.unsetLocalPtyLib(); String[] cmd = TestUtil.getJavaCommand(RepeatTextWithTimeout.class, "2", "1000", "Hello, World"); PtyProcess.exec(cmd); }
Source:
public Comparator<String> getComparator() { return Ordering.natural(); }

Target:
public Comparator<String> getComparator() { return Comparator.nullsFirst(Comparator.naturalOrder()); }
Source:
public String getTextBlockContent() { if (!isTextBlock()) { throw new IllegalArgumentException("This is not a text block"); } int start = determineContentStart(getImage()); String content = getImage().substring(start, getImage().length() - TEXTBLOCK_DELIMITER.length()); content = content.replaceAll("\r\n|\r", "\n"); int prefixLength = Integer.MAX_VALUE; List<String> lines = Arrays.asList(content.split("\\n")); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); if (!StringUtils.isAllBlank(line) || i == lines.size() - 1) { prefixLength = Math.min(prefixLength, countLeadingWhitespace(line)); } } if (prefixLength == Integer.MAX_VALUE) { prefixLength = 0; } StringBuilder sb = new StringBuilder(content.length()); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); if (!StringUtils.isAllBlank(line) && line.length() >= prefixLength) { line = line.substring(prefixLength); } line = removeTrailingWhitespace(line); sb.append(line); boolean isLastLine = i == lines.size() - 1; boolean isFirstLine = i == 0; if (!isLastLine || !isFirstLine && !StringUtils.isAllBlank(line)) { sb.append('\n'); } } String result = sb.toString(); result = result .replaceAll("\\\\\n", "") .replaceAll("\\\\n", "\n") .replaceAll("\\\\t", "\t") .replaceAll("\\\\b", "\b") .replaceAll("\\\\r", "\r") .replaceAll("\\\\f", "\f") .replaceAll("\\\\s", " ") .replaceAll("\\\\\"", "\"") .replaceAll("\\\\'", "'"); return result; }

Target:
public String getTextBlockContent() { if (!isTextBlock()) { return getImage(); } return determineTextBlockContent(getImage()); }
Source:
public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putSerializable(BUNDLE_BASE_SHAPE, baseShape); bundle.putSerializable(BUNDLE_SHAPE_DRAW_TYPE, shapeDrawType); bundle.putSerializable(BUNDLE_OUTLINE_WIDTH, shapeOutlineWidth); }

Target:
public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putSerializable(BUNDLE_BASE_SHAPE, baseShape); bundle.putSerializable(BUNDLE_SHAPE_DRAW_TYPE, shapeDrawType); bundle.putInt(BUNDLE_OUTLINE_WIDTH, shapeOutlineWidth); }
Source:
public boolean clearValue(String name) { boolean result = getMapHelper().getValue(getCurrentValues(), name) != null; getMapHelper().removeFrom(name, getCurrentValues()); return result; }

Target:
public boolean clearValue(String name) { return getMapHelper().removeFrom(name, getCurrentValues()); }
Source:
public void testTouchCorrectionWithInvalidDelayBetweenMovements() { long invalidActionUpTimestamp = secondMovementTimestamp + 15; triggerTouchDownEvent(initalPositionX, initalPositionY); triggerMovementEvent(firstMovementTimestamp, firstMovementPositionX, firstMovementPositionY); triggerMovementEvent(secondMovementTimestamp, secondMovementPositionX, firstMovementPositionY); triggerTouchUpEvent(invalidActionUpTimestamp); verify(imageView, times(2)).setX(anyFloat()); }

Target:
public void testTouchCorrectionWithInvalidDelayBetweenMovements() { long tooLateTimestamp = secondMovementTimestamp + 15; triggerTouchDownEvent(initalPositionX, initalPositionY); triggerMovementEvent(firstMovementTimestamp, firstMovementPositionX, firstMovementPositionY); verify(imageView, times(1)).setX(firstMovementPositionX); triggerMovementEvent(secondMovementTimestamp, secondMovementPositionX, secondMovementPositionY); verify(imageView, times(1)).setX(secondMovementPositionX); triggerTouchUpEvent(tooLateTimestamp); verify(imageView, times(1)).setX(actionUpMovementPositionX); verify(imageView, times(3)).setX(anyFloat()); }
Source:
private void createPageContent() { setTitle(windowTitle); if (isThisProjectWizzard()) { dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); createProjectRegistrationSummary(); return; } else { UserRegistrationWizard wizard = (UserRegistrationWizard) getWizard(); UserRegistrationPage userRegistrationPage = wizard.userRegistrationPage; dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); if (wizard.userWelcomePage.getRegisterNewId()) { userRegistrationPage .createUserRegistrationSummary(dynamicComposite); } createProjectRegistrationSummary(); return; } }

Target:
private void createPageContent() { setTitle(windowTitle); if (isThisProjectWizard()) { dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); createProjectRegistrationSummary(); return; } else { UserProjectRegistrationWizard wizard = (UserProjectRegistrationWizard) getWizard(); UserRegistrationPage userRegistrationPage = wizard.userRegistrationPage; dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); if (wizard.userWelcomePage.getRegisterNewId()) { userRegistrationPage .createUserRegistrationSummary(dynamicComposite); } createProjectRegistrationSummary(); return; } }
Source:
public RemoteCommand(CommandConfiguration _commandConfig, ConnectionConfiguration connectConfig, ConnectionConfiguration extraConnection) { commandConfig = _commandConfig; connectionConfig = connectConfig; ConnectionManager manager = ConnectionManagerFactory.getConnectionManager(); try { connection = manager.openConnection(connectConfig); commandConfig.setHostname(connectConfig.getHostname()); if (extraConnection != null) { secondConnection = manager.openConnection(extraConnection); commandConfig.setHostname(extraConnection.getHostname()); } } catch (JSchException e) { status = CommandStatus.INFOERROR; e.printStackTrace(); return; } status = CommandStatus.PROCESSING; }

Target:
public RemoteCommand(CommandConfiguration _commandConfig, ConnectionConfiguration connectConfig, ConnectionConfiguration extraConnection) { commandConfig = _commandConfig; connectionConfig = connectConfig; ConnectionManager manager = ConnectionManagerFactory.getConnectionManager(); try { if (manager.getConnection(connectConfig.getName()) == null) { connection.set(manager.openConnection(connectConfig)); } else { connection.set(manager.getConnection(connectConfig.getName())); if (connection.get().getExecChannel() != null) connection.get().getExecChannel().disconnect(); if (connection.get().getSftpChannel() != null) connection.get().getSftpChannel().disconnect(); } commandConfig.setHostname(connectConfig.getAuthorization().getHostname()); if (extraConnection != null) { secondConnection = manager.openConnection(extraConnection); commandConfig.setHostname(extraConnection.getAuthorization().getHostname()); } } catch (JSchException e) { status = CommandStatus.INFOERROR; logger.error("There was a connection failure in the construction of Remote Command!"); logger.error("Returning info error", e); return; } status = CommandStatus.PROCESSING; }
Source:
protected boolean canDoAction() { if (getVm().getstatus() != VMStatus.MigratingFrom) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING); return false; } return true; }

Target:
protected boolean canDoAction() { if (getVm() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (getVm().getstatus() != VMStatus.MigratingFrom) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING); return false; } return true; }
Source:
private List<IRecord> set(BrowserAction action) { ElementRecord element = getElement(action.getID()); if (element == null) return new LinkedList<IRecord>(); return setAttributes(element, action.getAttributes()); }

Target:
private List<IRecord> set(BrowserAction action) { ElementRecord element = getElement(action.getID()); if (element == null) return Collections.emptyList(); return setAttributes(element, action.getAttributes()); }
Source:
public static Interceptor tokenAuth(String accessToken) { requireNonNull(accessToken, "accessToken is null"); return chain -> chain.proceed(chain.request().newBuilder() .addHeader("Authorization", "Bearer " + accessToken) .build()); }

Target:
public static Interceptor tokenAuth(String accessToken) { requireNonNull(accessToken, "accessToken is null"); checkArgument(CharMatcher.inRange((char) 33, (char) 126).matchesAllOf(accessToken)); return chain -> chain.proceed(chain.request().newBuilder() .addHeader(AUTHORIZATION, "Bearer " + accessToken) .build()); }
Source:
private DeliveryState determineDeliveryState(final Source source, final boolean useModified, final Exception e) { Outcome defaultOutcome = getEffectiveDefaultOutcome(source); if (e instanceof ActiveMQAddressFullException && useModified && (outcomeSupported(source, Modified.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Modified)) { Modified modified = new Modified(); modified.setDeliveryFailed(true); modified.setUndeliverableHere(false); return modified; } else { if (outcomeSupported(source, Rejected.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Rejected) { ErrorCondition condition = new ErrorCondition(); if (e instanceof ActiveMQSecurityException) { condition.setCondition(AmqpError.UNAUTHORIZED_ACCESS); } else { condition.setCondition(Symbol.valueOf("failed")); } condition.setDescription(e.getMessage()); Rejected rejected = new Rejected(); rejected.setError(condition); return rejected; } else if (source.getDefaultOutcome() instanceof DeliveryState) { return ((DeliveryState) source.getDefaultOutcome()); } else { return Accepted.getInstance(); } } }

Target:
private DeliveryState determineDeliveryState(final Source source, final boolean useModified, final Exception e) { Outcome defaultOutcome = getEffectiveDefaultOutcome(source); if (isAddressFull(e) && useModified && (outcomeSupported(source, Modified.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Modified)) { Modified modified = new Modified(); modified.setDeliveryFailed(true); return modified; } else { if (outcomeSupported(source, Rejected.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Rejected) { return createRejected(e); } else if (source.getDefaultOutcome() instanceof DeliveryState) { return ((DeliveryState) source.getDefaultOutcome()); } else { return createRejected(e); } } }
Source:
public void parseFile() throws CTFReaderException { Reader metadataTextInput = null; try (FileInputStream fis = new FileInputStream(getMetadataPath()); FileChannel metadataFileChannel = fis.getChannel();) { if (isPacketBased(metadataFileChannel)) { metadataTextInput = readBinaryMetaData(metadataFileChannel); } else { metadataTextInput = new FileReader(getMetadataPath()); } readMetaDataText(metadataTextInput); } catch (FileNotFoundException e) { throw new CTFReaderException("Cannot find metadata file!"); } catch (IOException | ParseException e) { throw new CTFReaderException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } }

Target:
public void parseFile() throws CTFReaderException { try (FileInputStream fis = new FileInputStream(getMetadataPath()); FileChannel metadataFileChannel = fis.getChannel(); Reader metadataTextInput = (isPacketBased(metadataFileChannel) ? readBinaryMetaData(metadataFileChannel) : new FileReader(getMetadataPath()));) { readMetaDataText(metadataTextInput); } catch (FileNotFoundException e) { throw new CTFReaderException("Cannot find metadata file!"); } catch (IOException | ParseException e) { throw new CTFReaderException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } }
Source:
public double calcEdgeWeight(EdgeIteratorState edgeState, boolean reverse) { double distance = edgeState.getDistance(); double seconds = calcSeconds(distance, edgeState, reverse); if (Double.isInfinite(seconds)) return Double.POSITIVE_INFINITY; double distanceInfluence = distance * this.distanceInfluence; if (Double.isInfinite(distanceInfluence)) return Double.POSITIVE_INFINITY; return seconds / priorityConfig.calcPriority(edgeState, reverse) + distanceInfluence; }

Target:
public double calcEdgeWeight(EdgeIteratorState edgeState, boolean reverse) { final double distance = edgeState.getDistance(); double seconds = calcSeconds(distance, edgeState, reverse); if (Double.isInfinite(seconds)) return Double.POSITIVE_INFINITY; double distanceCosts = distance * distanceInfluence; if (Double.isInfinite(distanceCosts)) return Double.POSITIVE_INFINITY; return seconds / priorityCalculator.calcPriority(edgeState, reverse) + distanceCosts; }
Source:
public MantaClient(final ConfigContext config, final MantaConnectionFactoryConfigurator connectionFactoryConfigurator) { dumpConfig(config); ConfigContext.validate(config); this.url = config.getMantaURL(); this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(config.getMantaUser()); final KeyPair keyPair = new KeyPairFactory(config).createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (ObjectUtils.firstNonNull( config.disableNativeSignatures(), DefaultsConfigContext.DEFAULT_DISABLE_NATIVE_SIGNATURES)) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.signerRef = new WeakReference<>(signer); final MantaConnectionFactory connectionFactory = new MantaConnectionFactory( config, keyPair, signer, connectionFactoryConfigurator); final MantaApacheHttpClientContext connectionContext = new MantaApacheHttpClientContext(connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); this.beanSupervisor = new MantaMBeanSupervisor(); }

Target:
public MantaClient(final ConfigContext config, final MantaConnectionFactoryConfigurator connectionFactoryConfigurator) { dumpConfig(config); ConfigContext.validate(config); this.url = config.getMantaURL(); this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(config.getMantaUser()); this.beanSupervisor = new MantaMBeanSupervisor(); final KeyPair keyPair = new KeyPairFactory(config).createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (BooleanUtils.isTrue(config.disableNativeSignatures())) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.signerRef = new WeakReference<>(signer); final MantaConnectionFactory connectionFactory = new MantaConnectionFactory( config, keyPair, signer, connectionFactoryConfigurator); final MantaApacheHttpClientContext connectionContext = new MantaApacheHttpClientContext(connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); beanSupervisor.expose(this.config); beanSupervisor.expose(connectionFactory); }
Source:
private boolean isLastValueChangeHandler() { int count = detailCache.getHandlerCount(); int last = count - 1; for (int i = 0; i < count; i++) { if (this == detailCache.getHandler(i)) { return i == last; } } return false; }

Target:
private boolean isLastValueChangeHandler() { int count = detailCache.getHandlerCount(); return count > 0 && detailCache.getHandler(count - 1) == this; }
Source:
public View getView(int position, View convertView, ViewGroup parent) { if(actionEnabled && position == actionPosition) { TextImageAudioView tiav =(TextImageAudioView)convertView; if(tiav == null) { tiav = new TextImageAudioView(context); } tiav.setDisplay(detail.getCustomAction().getDisplay()); tiav.setBackgroundResource(R.drawable.list_bottom_tab); int padding = (int) context.getResources().getDimension(R.dimen.entity_padding); tiav.setPadding(padding, padding, padding, padding); return tiav; } Entity<TreeReference> entity = current.get(position); if(usesGridView){ AdvancedEntityView emv =(AdvancedEntityView)convertView; if(emv == null) { emv = new AdvancedEntityView(context, detail, entity, currentSearchTerms, mImageLoader, controller); } else{ emv.setViews(context, detail, entity); } return emv; } else{ EntityView emv =(EntityView)convertView; if (emv == null) { emv = new EntityView(context, detail, entity, tts, currentSearchTerms, controller, position, mFuzzySearchEnabled); } else { emv.setSearchTerms(currentSearchTerms); emv.refreshViewsForNewEntity(entity, entity.getElement().equals(selected), position); } return emv; } }

Target:
public View getView(int position, View convertView, ViewGroup parent) { if(actionEnabled && position == actionPosition) { TextImageAudioView tiav =(TextImageAudioView)convertView; if(tiav == null) { tiav = new TextImageAudioView(context); } tiav.setDisplay(detail.getCustomAction().getDisplay()); tiav.setBackgroundResource(R.drawable.list_bottom_tab); int padding = (int) context.getResources().getDimension(R.dimen.entity_padding); tiav.setPadding(padding, padding, padding, padding); return tiav; } Entity<TreeReference> entity = current.get(position); if(usesGridView){ GridEntityView emv =(GridEntityView)convertView; if(emv == null) { emv = new GridEntityView(context, detail, entity, currentSearchTerms, mImageLoader, controller); } else{ emv.setViews(context, detail, entity); } return emv; } else{ EntityView emv =(EntityView)convertView; if (emv == null) { emv = new EntityView(context, detail, entity, tts, currentSearchTerms, controller, position, mFuzzySearchEnabled); } else { emv.setSearchTerms(currentSearchTerms); emv.refreshViewsForNewEntity(entity, entity.getElement().equals(selected), position); } return emv; } }
Source:
private int getSeparator(String qualified) { return qualified.lastIndexOf("@") != -1 ? qualified.lastIndexOf("@") : qualified.indexOf("\\"); }

Target:
private int getSeparator(String qualified) { int result = -1; if (userNameFormat == UserNameFormat.UPN && qualified.indexOf("\\") == -1) { result = qualified.lastIndexOf("@"); } else if (userNameFormat == UserNameFormat.DOWN_LEVEL_LOGON_NAME && qualified.indexOf("@") == -1) { result = qualified.lastIndexOf("\\"); } return result; }
Source:
public void testCreateNote() throws IOException { Map<String, Object> data = Maps.newHashMap(); data.put("name", "test"); data.put("interpreter", "spark"); Map<String, String> paragraph = Maps.newHashMap(); paragraph.put("title", "title"); paragraph.put("text", "text"); data.put("paragraphs", Lists.newArrayList(paragraph)); PostMethod post = httpPost("/notebook", gson.toJson(data)); assertThat(post, isCreated()); LOG.info("Notebook create response {}", post.getResponseBodyAsString()); Map<String, String> response = (Map<String, String>) gson.fromJson(post.getResponseBodyAsString(), data.getClass()); String noteId = response.get("body"); assertNotNull(noteId); post.releaseConnection(); GetMethod get = httpGet("/notebook/" + noteId); assertThat(get, isAllowed()); Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() { }.getType()); Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body"); assertEquals(resp2Body.get("name"), data.get("name")); get.releaseConnection(); String interpreter = ZeppelinServer.notebook.getInterpreterSettingManager().getDefaultInterpreterSetting(noteId).getName(); assertEquals(interpreter, data.get("interpreter")); List<Paragraph> paragraphs = ZeppelinServer.notebook.getNote(noteId).getParagraphs(); assertEquals(paragraphs.size(), 2); assertEquals(paragraphs.get(0).getTitle(), paragraph.get("title")); assertEquals(paragraphs.get(0).getText(), paragraph.get("text")); ZeppelinServer.notebook.removeNote(noteId, anonymous); }

Target:
public void testCreateNote() throws IOException { Map<String, Object> data = Maps.newHashMap(); data.put("name", "test"); data.put("defaultInterpreter", "python"); Map<String, String> paragraph = Maps.newHashMap(); paragraph.put("title", "title"); paragraph.put("text", "text"); data.put("paragraphs", Lists.newArrayList(paragraph)); PostMethod post = httpPost("/notebook", gson.toJson(data)); assertThat(post, isAllowed()); LOG.info("Notebook create response {}", post.getResponseBodyAsString()); Map<String, String> response = (Map<String, String>) gson.fromJson(post.getResponseBodyAsString(), data.getClass()); String noteId = response.get("body"); assertNotNull(noteId); post.releaseConnection(); GetMethod get = httpGet("/notebook/" + noteId); assertThat(get, isAllowed()); Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() { }.getType()); Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body"); assertEquals(resp2Body.get("name"), data.get("name")); get.releaseConnection(); String interpreter = ZeppelinServer.notebook.getInterpreterSettingManager().getDefaultInterpreterSetting(noteId).getName(); assertEquals(interpreter, data.get("defaultInterpreter")); List<Paragraph> paragraphs = ZeppelinServer.notebook.getNote(noteId).getParagraphs(); assertEquals(paragraphs.size(), 2); assertEquals(paragraphs.get(0).getTitle(), paragraph.get("title")); assertEquals(paragraphs.get(0).getText(), paragraph.get("text")); ZeppelinServer.notebook.removeNote(noteId, anonymous); }
Source:
public Set<CollectionEntry> getCollectionEntries() { return getEntries().stream().map(entry -> new CollectionEntry(entry)).collect(Collectors.toSet()); }

Target:
public List<CollectionEntry> getCollectionEntries() { return collectionEntries; }
Source:
public Vector3d toVector3() { return null; }

Target:
public Vector3d toVector3() { return new SpongeVector3d(x, y, 0); }
Source:
public YearWeek plusWeeks(long weeksToAdd) { if (weeksToAdd == 0) { return this; } if (weeksToAdd < 0) { return minusWeeks(-weeksToAdd); } YearWeek yearWeek = this; while (weeksToAdd-- > 0) { int weeksInYear = yearWeek.is53WeekYear() ? 53 : 52; if (yearWeek.week < weeksInYear) { yearWeek = YearWeek.of(yearWeek.year, yearWeek.week + 1); } else { yearWeek = YearWeek.of(yearWeek.year + 1, 1); } } return yearWeek; }

Target:
public YearWeek plusWeeks(long weeksToAdd) { if (weeksToAdd == 0) { return this; } LocalDate mondayOfWeek = atDay(DayOfWeek.MONDAY).plusWeeks(weeksToAdd); return YearWeek.from(mondayOfWeek); }
Source:
protected boolean apply(FieldValue a, FieldValue b) { if(a instanceof EnumValue && b instanceof TextValue) { String aStr = ((EnumValue) a).getValueId().asString(); String bStr = ((TextValue)b).asString(); return aStr.equals(bStr); } return a.equals(b); }

Target:
protected boolean apply(FieldValue a, FieldValue b) { if(a instanceof EnumValue && b instanceof TextValue) { return relevancyCalculation(((EnumValue) a).getValueId().asString(),((TextValue) b).asString()); } else if (a instanceof TextValue && b instanceof EnumValue) { return relevancyCalculation(((TextValue) a).asString(),((EnumValue) b).getValueId().asString()); } return a.equals(b); }
Source:
public Map<Capability, ServerConfig> getConfigs() { if (configs == null) { configs = new EnumMap<>(Capability.class); } Map<Capability, ServerConfig> resultMap = new EnumMap<>(Capability.class); resultMap.putAll(configs); return resultMap; }

Target:
public Map<Capability, ServerConfig> getConfigs() { if (configs == null) { configs = new EnumMap<>(Capability.class); } return new EnumMap<>(configs); }
Source:
protected boolean canDoAction() { if (!(validate(hostExists()) && validate(hostStatusValid()))){ return false; } return true; }

Target:
protected boolean canDoAction() { return validate(hostExists()) && validate(hostStatusValid()); }