auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void go(AcceptsOneWidget container) { ProjectConfigDto projectConfig = appContext.getCurrentProject().getProjectConfig(); isPlainJava = "javac".equals(projectConfig.getType()); setReadOnlyMod(); container.setWidget(view); if (!categories.isEmpty()) { view.renderNodes(); return; } classpathContainer.getClasspathEntries(projectConfig.getPath()).then(new Operation<List<ClasspathEntryDto>>() { @Override public void apply(List<ClasspathEntryDto> entries) throws OperationException { categories.clear(); for (ClasspathEntryDto entry : entries) { if (SOURCE == entry.getEntryKind()) { categories.put(entry.getPath(), entry); } } view.setData(categories); view.renderNodes(); } }); }

Target:
public void go(AcceptsOneWidget container) { ProjectConfigDto projectConfig = appContext.getCurrentProject().getProjectConfig(); isPlainJava = JAVAC.equals(projectConfig.getType()); setReadOnlyMod(); container.setWidget(view); if (!categories.isEmpty()) { view.renderNodes(); return; } classpathContainer.getClasspathEntries(projectConfig.getPath()).then(new Operation<List<ClasspathEntryDto>>() { @Override public void apply(List<ClasspathEntryDto> entries) throws OperationException { categories.clear(); for (ClasspathEntryDto entry : entries) { if (SOURCE == entry.getEntryKind()) { categories.put(entry.getPath(), entry); } } view.setData(categories); view.renderNodes(); } }); }
Source:
private LazyResult queryFlat(int columnCount, ResultTarget result, long limitRows) { if (limitRows > 0 && offsetExpr != null) { int offset = offsetExpr.getValue(session).getInt(); if (offset > 0) { limitRows += offset; } } ArrayList<Row> forUpdateRows = null; if (isForUpdateMvcc) { forUpdateRows = Utils.newSmallArrayList(); } int sampleSize = getSampleSizeValue(session); LazyResultQueryFlat lazyResult = new LazyResultQueryFlat(expressionArray, sampleSize, columnCount); if (result == null) { return lazyResult; } while (lazyResult.next()) { if (isForUpdateMvcc) { topTableFilter.lockRowAdd(forUpdateRows); } result.addRow(lazyResult.currentRow()); if ((sort == null || sortUsingIndex) && limitRows > 0 && result.getRowCount() >= limitRows) { break; } } if (isForUpdateMvcc) { assert forUpdateRows != null; topTableFilter.lockRows(forUpdateRows); } return null; }

Target:
private LazyResult queryFlat(int columnCount, ResultTarget result, long limitRows) { if (limitRows > 0 && offsetExpr != null) { int offset = offsetExpr.getValue(session).getInt(); if (offset > 0) { limitRows += offset; } } ArrayList<Row> forUpdateRows = null; boolean lockRows = this.isForUpdateMvcc; if (lockRows) { forUpdateRows = Utils.newSmallArrayList(); } int sampleSize = getSampleSizeValue(session); LazyResultQueryFlat lazyResult = new LazyResultQueryFlat(expressionArray, sampleSize, columnCount); if (result == null) { return lazyResult; } while (lazyResult.next()) { if (lockRows) { topTableFilter.lockRowAdd(forUpdateRows); } result.addRow(lazyResult.currentRow()); if ((sort == null || sortUsingIndex) && limitRows > 0 && result.getRowCount() >= limitRows) { break; } } if (lockRows) { topTableFilter.lockRows(forUpdateRows); } return null; }
Source:
public void nullable_matcher() throws Exception { mock.oneArg((Character) null); mock.oneArg((Character) ' '); verify(mock, times(2)).oneArg(nullable(Character.class)); }

Target:
public void nullable_matcher() throws Exception { mock.oneArg((Character) null); mock.oneArg(Character.valueOf('€')); verify(mock, times(2)).oneArg(nullable(Character.class)); }
Source:
public Member getMemberByExtSourceNameAndExtLogin(PerunSession sess, Vo vo, String extSourceName, String extLogin) throws ExtSourceNotExistsException, UserExtSourceNotExistsException, MemberNotExistsException, UserNotExistsException, InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); Utils.notNull(extSourceName, "extSourceName"); Utils.notNull(extLogin, "extLogin"); getPerunBl().getVosManagerBl().checkVoExists(sess, vo); if(!AuthzResolver.isAuthorized(sess, Role.VOADMIN)) { throw new PrivilegeException(sess, "getMemberByExtSourceNameAndExtLogin"); } return getMembersManagerBl().getMemberByExtSourceNameAndExtLogin(sess, vo, extSourceName, extLogin); }

Target:
public Member getMemberByExtSourceNameAndExtLogin(PerunSession sess, Vo vo, String extSourceName, String extLogin) throws ExtSourceNotExistsException, UserExtSourceNotExistsException, MemberNotExistsException, UserNotExistsException, InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); Utils.notNull(extSourceName, "extSourceName"); Utils.notNull(extLogin, "extLogin"); getPerunBl().getVosManagerBl().checkVoExists(sess, vo); if(!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, vo)) { throw new PrivilegeException(sess, "getMemberByExtSourceNameAndExtLogin"); } return getMembersManagerBl().getMemberByExtSourceNameAndExtLogin(sess, vo, extSourceName, extLogin); }
Source:
public synchronized void checkQueueIntegrity() throws IOException { readHeaderWithoutFileSideEffects(); int position = first.position; int totalSize = HEADER_LENGTH; for (int i = 0; i < elementCount; i++) { if (i == elementCount - 1 && position != last.position) { throw new IOException("Corrupted Element lengths in queue resulted in mis-alignment."); } Element current = readElement(position); totalSize += current.length + Element.HEADER_LENGTH; if (current.length > (fileLength - HEADER_LENGTH)) { throw new IOException("Corrupted Element length larger than file."); } position = wrapPosition(current.position + Element.HEADER_LENGTH + current.length); } if (totalSize > fileLength) { throw new IOException("Element scan reports size larger than file."); } }

Target:
public synchronized void checkQueueIntegrity() throws IOException { readHeaderWithoutMovingFilePointer(); int position = first.position; int totalSize = HEADER_LENGTH; for (int i = 0; i < elementCount; i++) { if (i == elementCount - 1 && position != last.position) { throw new IOException("Queue corruption: last (" + i + ") Element has actual position of " + position + " in file, but Queue header reports it should have " + last.position + "."); } Element current = readElement(position); totalSize += current.length + Element.HEADER_LENGTH; if (current.length > (fileLength - HEADER_LENGTH)) { throw new IOException("Queue corruption: Element " + i + " has length: " + current.length + " with cumulative element length of: " + totalSize + " in a file of " + "length: " + fileLength + "."); } position = wrapPosition(current.position + Element.HEADER_LENGTH + current.length); } if (totalSize > fileLength) { throw new IOException("Queue corruption: Total element reported size is: " + totalSize + " in a file of size: " + fileLength + '.'); } }
Source:
public FetchHints build() { if (!isIncludeProperties() && isIncludePropertyMetadata()) { includeAllProperties = true; } if (!includeEdgeIds && !includeEdgeVertexIds) { throw new VertexiumException("Cannot exclude both includeEdgeIds and includeEdgeVertexIds. Instead exclude edge refs."); } return new FetchHints( includeAllProperties, propertyNamesToInclude == null ? null : ImmutableSet.copyOf(propertyNamesToInclude), includeAllPropertyMetadata, metadataKeysToInclude == null ? null : ImmutableSet.copyOf(metadataKeysToInclude), includeHidden, includeAllEdgeRefs, includeOutEdgeRefs || includeAllEdgeRefs, includeInEdgeRefs || includeAllEdgeRefs, includeEdgeIds, includeEdgeVertexIds, edgeLabelsOfEdgeRefsToInclude == null ? null : ImmutableSet.copyOf(edgeLabelsOfEdgeRefsToInclude), includeEdgeLabelsAndCounts, includeExtendedDataTableNames, ignoreAdditionalVisibilities, includePreviousMetadata ); }

Target:
public FetchHints build() { if (!isIncludeProperties() && isIncludePropertyMetadata()) { includeAllProperties = true; } if ((includeAllEdgeRefs || includeOutEdgeRefs || includeInEdgeRefs) && !includeEdgeIds && !includeEdgeVertexIds) { throw new VertexiumException("Cannot exclude both includeEdgeIds and includeEdgeVertexIds. Instead exclude edge refs."); } return new FetchHints( includeAllProperties, propertyNamesToInclude == null ? null : ImmutableSet.copyOf(propertyNamesToInclude), includeAllPropertyMetadata, metadataKeysToInclude == null ? null : ImmutableSet.copyOf(metadataKeysToInclude), includeHidden, includeAllEdgeRefs, includeOutEdgeRefs || includeAllEdgeRefs, includeInEdgeRefs || includeAllEdgeRefs, includeEdgeIds, includeEdgeVertexIds, edgeLabelsOfEdgeRefsToInclude == null ? null : ImmutableSet.copyOf(edgeLabelsOfEdgeRefsToInclude), includeEdgeLabelsAndCounts, includeExtendedDataTableNames, ignoreAdditionalVisibilities, includePreviousMetadata ); }
Source:
public Publisher<?> readFrom(Class<Publisher<?>> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { ProvidersImpl providersImpl = (ProvidersImpl) (providers instanceof ThreadLocalProviders ? ((ThreadLocalProviders)providers).get() : providers); Message message = providersImpl.getMessage(); ExecutorService executor = Utils.getExecutorService(message); SsePublisher publisher = new SsePublisher(entityStream, executor, providersImpl); if (genericType instanceof ParameterizedType) { Type typeArgument = ((ParameterizedType)genericType).getActualTypeArguments()[0]; if (typeArgument.equals(InboundSseEvent.class)) { return publisher; } return new SseTypeSafeProcessor<Object>(new GenericType<Object>(typeArgument), publisher); } return null; }

Target:
public Publisher<?> readFrom(Class<Publisher<?>> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { ProvidersImpl providersImpl = (ProvidersImpl) (providers instanceof ThreadLocalProviders ? ((ThreadLocalProviders)providers).get() : providers); ExecutorService executor = Utils.getExecutorService(mc); SsePublisher publisher = new SsePublisher(entityStream, executor, providersImpl); if (genericType instanceof ParameterizedType) { Type typeArgument = ((ParameterizedType)genericType).getActualTypeArguments()[0]; if (typeArgument.equals(InboundSseEvent.class)) { return publisher; } return new SseTypeSafeProcessor<Object>(new GenericType<Object>(typeArgument), publisher); } return null; }
Source:
public void stop() throws Exception { if (getStopped()) { return; } setStopped(true); cancel(); }

Target:
public void stop() throws Exception { if (stopped.compareAndSet(false, true)) { cancel(); } }
Source:
public String getConfigurationValue(String miimonValue){ String extraOption = ""; if (value.equals(BondMode.BOND4.value)) { extraOption = " xmit_hash_policy=2"; } return MODE + value + " miimon=" + "100" + extraOption; }

Target:
public String getConfigurationValue(String miimonValue){ String extraOption = ""; if (value.equals(BondMode.BOND4.value)) { extraOption = " xmit_hash_policy=2"; } return MODE + value + " miimon=" + miimonValue + extraOption; }
Source:
static void dropCluster(String zkLayoutPath, String clusterName, String dcs, HelixAdminFactory helixAdminFactory) throws Exception { Map<String, ClusterMapUtils.DcZkInfo> dataCenterToZkAddress = ClusterMapUtils.parseDcJsonAndPopulateDcInfo(Utils.readStringFromFile(zkLayoutPath)); if (dcs != null && !dcs.isEmpty() && !dcs.equalsIgnoreCase("all")) { Set<String> dcsSet = Arrays.stream(dcs.replaceAll("\\p{Space}", "").split(",")).collect(Collectors.toSet()); dataCenterToZkAddress = dataCenterToZkAddress.entrySet() .stream() .filter(e -> dcsSet.contains(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } info("Dropping cluster from Helix", clusterName); for (Map.Entry<String, ClusterMapUtils.DcZkInfo> entry : dataCenterToZkAddress.entrySet()) { HelixAdmin admin = helixAdminFactory.getHelixAdmin(entry.getValue().getZkConnectStr()); admin.dropCluster(clusterName); info("Dropped cluster from {}", entry.getKey()); } }

Target:
static void dropCluster(String zkLayoutPath, String clusterName, String dcs, HelixAdminFactory helixAdminFactory) throws Exception { Map<String, ClusterMapUtils.DcZkInfo> dataCenterToZkAddress = parseAndUpdateDcInfoFromArg(dcs, zkLayoutPath); info("Dropping cluster from Helix", clusterName); for (Map.Entry<String, ClusterMapUtils.DcZkInfo> entry : dataCenterToZkAddress.entrySet()) { HelixAdmin admin = helixAdminFactory.getHelixAdmin(entry.getValue().getZkConnectStr()); admin.dropCluster(clusterName); info("Dropped cluster from {}", entry.getKey()); } }
Source:
public boolean startConvertion(Recording rec) { IRecordingConverter conv = rec.isInterview() ? interviewConverter : recordingConverter; taskExecutor.execute(() -> conv.startConversion(rec)); return true; }

Target:
boolean startConvertion(Recording rec) { IRecordingConverter conv = rec.isInterview() ? interviewConverter : recordingConverter; taskExecutor.execute(() -> conv.startConversion(rec)); return true; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (super.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case R.id.refresh_item: AutoUpdateManager.runImmediate(requireContext()); return true; case R.id.subscriptions_filter: FeedFilterDialog.showDialog(requireContext()); return true; case R.id.subscriptions_sort: FeedSortDialog.showDialog(requireContext()); case R.id.subscription_num_columns_2: setColumnNumber(2); return true; case R.id.subscription_num_columns_3: setColumnNumber(3); return true; case R.id.subscription_num_columns_4: setColumnNumber(4); return true; case R.id.subscription_num_columns_5: setColumnNumber(5); return true; default: return false; } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (super.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case R.id.refresh_item: AutoUpdateManager.runImmediate(requireContext()); return true; case R.id.subscriptions_filter: FeedFilterDialog.showDialog(requireContext()); return true; case R.id.subscriptions_sort: FeedSortDialog.showDialog(requireContext()); return true; case R.id.subscription_num_columns_2: setColumnNumber(2); return true; case R.id.subscription_num_columns_3: setColumnNumber(3); return true; case R.id.subscription_num_columns_4: setColumnNumber(4); return true; case R.id.subscription_num_columns_5: setColumnNumber(5); return true; default: return false; } }
Source:
public static Class<?> getPreferenceActivity() { if (Build.VERSION.SDK_INT > 10) { return PreferenceActivity.class; } else { return PreferenceActivityGingerbread.class; } }

Target:
public static Class<? extends Activity> getPreferenceActivity() { if (Build.VERSION.SDK_INT > 10) { return PreferenceActivity.class; } else { return PreferenceActivityGingerbread.class; } }
Source:
public void noQueuedTasksLossWhenRunningRequestCompleteOnSuspendedRC() throws InterruptedException { final AtomicInteger executedTaskCount = new AtomicInteger(); RequestController rc = suspendedRCWithQueuedTasks(TASKS_QTY, () -> { executedTaskCount.incrementAndGet(); }); CountDownLatch latch = new CountDownLatch(THREADS_QTY); createSynchronisedThreads(latch, () -> { rc.requestComplete(); }).forEach(Thread::start); latch.await(); rc.resume(); assertEquals(TASKS_QTY, executedTaskCount.intValue()); }

Target:
public void noQueuedTasksLossWhenRunningRequestCompleteOnSuspendedRC() throws InterruptedException { final AtomicInteger executedTaskCount = new AtomicInteger(); RequestController rc = suspendedRCWithQueuedTasks(TASKS_QTY, () -> { executedTaskCount.incrementAndGet(); }); CountDownLatch latch = new CountDownLatch(THREADS_QTY); List<Thread> threads = createSynchronisedThreads(latch, () -> { rc.requestComplete(); }); threads.forEach(Thread::start); latch.await(); rc.resume(); for (Thread t : threads) { t.join(); } for (int requestNo = 0; requestNo < TASKS_QTY; requestNo++) { rc.requestComplete(); } assertEquals(TASKS_QTY, executedTaskCount.intValue()); }
Source:
private void showAnalyticsExplanationDialog() { new AlertDialog.Builder(this) .setTitle(R.string.analytics_usage) .setMessage(R.string.analytics_usage_overview) .setNegativeButton(R.string.optout, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sharedPref.edit().putBoolean("pref_analytics_opt_in", false).apply(); } }) .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sharedPref.edit().putBoolean("pref_analytics_opt_in", true).apply(); GlucosioApplication application = (GlucosioApplication) getApplication(); Analytics analytics = application.getAnalytics(); analytics.reportScreen("Hello Activity"); } }) .show(); }

Target:
private void showAnalyticsExplanationDialog() { new AlertDialog.Builder(this) .setTitle(R.string.analytics_usage) .setMessage(R.string.analytics_usage_overview) .setCancelable(false) .setNegativeButton(R.string.optout, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sharedPref.edit().putBoolean("pref_analytics_opt_in", false).apply(); } }) .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sharedPref.edit().putBoolean("pref_analytics_opt_in", true).apply(); GlucosioApplication application = (GlucosioApplication) getApplication(); Analytics analytics = application.getAnalytics(); analytics.reportScreen("Hello Activity"); } }) .show(); }
Source:
public String getScreenTitle() { return "Welcome to Dashboards"; }

Target:
public String getScreenTitle() { return i18n.runtimeScreenTitle(); }
Source:
protected void starting() { if (mementos != null) { for (CacheMemento memento : mementos) { memento.cache(); } } }

Target:
protected void starting() { Arrays.stream(mementos).forEach(CacheMemento::cache); }
Source:
default Stream<T> takeRight(int n) { if(length() <= n) { return this; } else { return reverse().take(n).reverse(); } }

Target:
default Stream<T> takeRight(int n) { if (n <= 0) { return empty(); } else if (length() <= n) { return this; } else { return reverse().take(n).reverse(); } }
Source:
public void onSelectionChanged(int selectedItemCnt) { int numberMergeSelections = adapter.numberMergeSelections; if (adapter.isMergeSelection && selectedItemCnt >= numberMergeSelections) { ToastUtil.showError(getContext(), "We can only merge " + numberMergeSelections + " projects"); } updateSelectionToggle(actionMode.getMenu().findItem(R.id.toggle_selection)); actionMode.setTitle(getResources() .getQuantityString(getActionModeTitleId(actionModeType), selectedItemCnt, selectedItemCnt)); }

Target:
public void onSelectionChanged(int selectedItemCnt) { updateSelectionToggle(actionMode.getMenu().findItem(R.id.toggle_selection)); actionMode.setTitle(getResources() .getQuantityString(getActionModeTitleId(actionModeType), selectedItemCnt, selectedItemCnt)); }
Source:
public void registerAdditionalCatalog(Achievement achievement) { this.achievementMappings.put(achievement.getId().toLowerCase(), achievement); }

Target:
public void registerAdditionalCatalog(Achievement achievement) { checkNotNull(achievement, "null achievement"); this.achievementMappings.put(achievement.getId().toLowerCase(Locale.ENGLISH), achievement); }
Source:
public Observable<Void> register(final InstanceInfo instanceInfo) { if (moveToState(STATE.Idle, STATE.Registered)) { return firstRegistration(instanceInfo); } if (getState() == STATE.Registered) { return registrationUpdate(instanceInfo); } STATE currentState = getState(); if (STATE.Closed == currentState) { return Observable.error(CHANNEL_CLOSED_EXCEPTION); } else { Exception exception = new IllegalStateException("Unknown state error when registering, current state: " + currentState); return sendErrorOnTransport(exception).doOnTerminate(new Action0() { @Override public void call() { close(); } }); } }

Target:
public Observable<Void> register(final InstanceInfo instanceInfo) { if (moveToState(STATE.Idle, STATE.Registered)) { return firstRegistration(instanceInfo); } if (getState() == STATE.Registered) { return registrationUpdate(instanceInfo); } STATE currentState = getState(); if (STATE.Closed == currentState) { return Observable.error(CHANNEL_CLOSED_EXCEPTION); } else { final Exception exception = new IllegalStateException("Unknown state error when registering, current state: " + currentState); return sendErrorOnTransport(exception).doOnTerminate(new Action0() { @Override public void call() { close(exception); } }); } }
Source:
public void deactivate() { try { consumer.stop(); clearConsumer(); consumer.close(); reliableConsumer.close(); } catch (JCSMPException e) { DTThrowable.rethrow(e); } }

Target:
public void deactivate() { reliableConsumer.close(); }
Source:
public static boolean isQueryResultEmpty(Connection connection, String query) throws JdbcException { PreparedStatement stmt = null; try { stmt = connection.prepareStatement(query); ResultSet rs = stmt.executeQuery(); try { return rs.isAfterLast(); } finally { rs.close(); } } catch (Exception e) { throw new JdbcException("could not obtain value using query ["+query+"]",e); } finally { if (stmt!=null) { try { stmt.close(); } catch (Exception e) { throw new JdbcException("could not close statement of query ["+query+"]",e); } } } }

Target:
public static boolean isQueryResultEmpty(Connection connection, String query) throws JdbcException { try (PreparedStatement stmt = connection.prepareStatement(query)) { try (ResultSet rs = stmt.executeQuery()) { return rs.isAfterLast(); } catch (SQLException e) { throw new JdbcException("could not obtain value using query [" + query + "]", e); } } catch (SQLException e) { throw new JdbcException("could not obtain value using query [" + query + "]", e); } }
Source:
private static boolean isAmbiguousMethod( Symbol.MethodSymbol symbol, @Nullable ExpressionTree receiver, VisitorState state) { if (symbol.isStatic()) { if (symbol.params().size() != 1) { return false; } Symbol.ClassSymbol classSymbol = ASTHelpers.enclosingClass(symbol); if (classSymbol == null) { return false; } Set<Symbol.MethodSymbol> matching = ASTHelpers.findMatchingMethods( symbol.name, sym -> sym != null && !sym.isStatic() && sym.getParameters().isEmpty(), classSymbol.type, state.getTypes()); return !matching.isEmpty(); } else { if (!symbol.params().isEmpty()) { return false; } if (receiver == null) { return false; } Type receiverType = ASTHelpers.getType(receiver); if (receiverType == null) { return false; } Set<Symbol.MethodSymbol> matching = ASTHelpers.findMatchingMethods( symbol.name, sym -> sym != null && sym.isStatic() && sym.getParameters().size() == 1 && state.getTypes() .isAssignable(receiverType, sym.params().get(0).type), receiverType, state.getTypes()); return !matching.isEmpty(); } }

Target:
private static boolean isAmbiguousMethod( Symbol.MethodSymbol symbol, @Nullable ExpressionTree receiver, VisitorState state) { if (symbol.isStatic()) { if (symbol.params().size() != 1) { return false; } Symbol.ClassSymbol classSymbol = ASTHelpers.enclosingClass(symbol); if (classSymbol == null) { return false; } Set<Symbol.MethodSymbol> matching = ASTHelpers.findMatchingMethods( symbol.name, sym -> sym != null && !sym.isStatic() && sym.getParameters().isEmpty(), classSymbol.type, state.getTypes()); return !matching.isEmpty(); } else { if (!symbol.params().isEmpty()) { return false; } if (receiver == null) { return false; } Type receiverType = ASTHelpers.getType(receiver); if (receiverType == null) { return false; } Set<Symbol.MethodSymbol> matching = ASTHelpers.findMatchingMethods( symbol.name, sym -> sym != null && sym.isStatic() && sym.getParameters().size() == 1 && state.getTypes() .isAssignable( state.getTypes().erasure(receiverType), state.getTypes() .erasure(sym.params().get(0).type)), receiverType, state.getTypes()); return !matching.isEmpty(); } }
Source:
public MessagePacker writePayload(byte[] src, int off, int len) throws IOException { if (buffer.size() - position < len || len > 8192) { flush(); out.write(src, off, len); totalFlushBytes += len; } else { buffer.putBytes(position, src, off, len); position += len; } return this; }

Target:
public MessagePacker writePayload(byte[] src, int off, int len) throws IOException { if (buffer.size() - position < len || len > bufferFlushThreshold) { flush(); out.write(src, off, len); totalFlushBytes += len; } else { buffer.putBytes(position, src, off, len); position += len; } return this; }
Source:
public static Identity extractIdentity(EndpointContext context) { InetSocketAddress peerAddress = context.getPeerAddress(); if (context.get(OSCoreEndpointContextInfo.OSCORE_SENDER_ID) != null) { String oscoreIdentity = "sid=" + context.get(OSCoreEndpointContextInfo.OSCORE_SENDER_ID) + ",rid=" + context.get(OSCoreEndpointContextInfo.OSCORE_RECIPIENT_ID); return Identity.oscoreOnly(peerAddress, oscoreIdentity.toLowerCase()); } Principal senderIdentity = context.getPeerIdentity(); if (senderIdentity != null) { if (senderIdentity instanceof PreSharedKeyIdentity) { return Identity.psk(peerAddress, ((PreSharedKeyIdentity) senderIdentity).getIdentity()); } else if (senderIdentity instanceof RawPublicKeyIdentity) { PublicKey publicKey = ((RawPublicKeyIdentity) senderIdentity).getKey(); return Identity.rpk(peerAddress, publicKey); } else if (senderIdentity instanceof X500Principal || senderIdentity instanceof X509CertPath) { String x509CommonName = extractCN(senderIdentity.getName()); return Identity.x509(peerAddress, x509CommonName); } throw new IllegalStateException("Unable to extract sender identity : unexpected type of Principal"); } return Identity.unsecure(peerAddress); }

Target:
public static Identity extractIdentity(EndpointContext context) { InetSocketAddress peerAddress = context.getPeerAddress(); Principal senderIdentity = context.getPeerIdentity(); if (senderIdentity != null) { if (senderIdentity instanceof PreSharedKeyIdentity) { return Identity.psk(peerAddress, ((PreSharedKeyIdentity) senderIdentity).getIdentity()); } else if (senderIdentity instanceof RawPublicKeyIdentity) { PublicKey publicKey = ((RawPublicKeyIdentity) senderIdentity).getKey(); return Identity.rpk(peerAddress, publicKey); } else if (senderIdentity instanceof X500Principal || senderIdentity instanceof X509CertPath) { String x509CommonName = extractCN(senderIdentity.getName()); return Identity.x509(peerAddress, x509CommonName); } throw new IllegalStateException("Unable to extract sender identity : unexpected type of Principal"); } else { if (context.get(OSCoreEndpointContextInfo.OSCORE_SENDER_ID) != null) { String oscoreIdentity = "sid=" + context.get(OSCoreEndpointContextInfo.OSCORE_SENDER_ID) + ",rid=" + context.get(OSCoreEndpointContextInfo.OSCORE_RECIPIENT_ID); return Identity.oscoreOnly(peerAddress, oscoreIdentity.toLowerCase()); } } return Identity.unsecure(peerAddress); }
Source:
public boolean[] read(TProtocol protocol) throws Exception { Preconditions.checkNotNull(protocol, "protocol is null"); return new TProtocolReader(protocol).readBoolArray(); }

Target:
public boolean[] read(TProtocol protocol) throws Exception { checkNotNull(protocol, "protocol is null"); return new TProtocolReader(protocol).readBoolArray(); }
Source:
protected Cache decorateCache(Cache cache) { return this.cacheDecorator != null ? this.cacheDecorator.decorateCache(cache) : cache; }

Target:
protected Cache decorateCache(Cache cache) { for (CacheDecorator cacheDecorator : cacheDecorators) { cache = cacheDecorator.decorateCache(cache); } return cache; }
Source:
public void generateProjectRepositoriesMap() throws IOException { repository_map.clear(); for (RepositoryInfo r : getRepositories()) { Project proj; String repoPath; try { repoPath = PathUtils.getPathRelativeToSourceRoot( new File(r.getDirectoryName()), 0); } catch (ForbiddenSymlinkException e) { LOGGER.log(Level.FINER, e.getMessage()); continue; } if ((proj = Project.getProject(repoPath)) != null) { List<RepositoryInfo> values = repository_map.computeIfAbsent(proj, k -> new ArrayList<>()); values.add(r); } } }

Target:
private void generateProjectRepositoriesMap() throws IOException { repository_map.clear(); for (RepositoryInfo r : getRepositories()) { Project proj; String repoPath; try { repoPath = PathUtils.getPathRelativeToSourceRoot( new File(r.getDirectoryName()), 0); } catch (ForbiddenSymlinkException e) { LOGGER.log(Level.FINER, e.getMessage()); continue; } if ((proj = Project.getProject(repoPath)) != null) { List<RepositoryInfo> values = repository_map.computeIfAbsent(proj, k -> new ArrayList<>()); values.add(r); } } }
Source:
private IncrementalProjectBuilder getBuilder(IBuildConfiguration buildConfiguration, ICommand command, int buildSpecIndex, MultiStatus status) throws CoreException { BuildCommand buildCommand = (BuildCommand) command; InternalBuilder result = buildCommand.getBuilder(buildConfiguration); String builderName = command.getBuilderName(); IProject project = buildConfiguration.getProject(); if (result == null) { BuilderPersistentInfo info = null; synchronized (builderInitializationLock) { BuilderPersistentInfo builderInitInProgress = getBuilderInitInProgress(project, builderName); if (builderInitInProgress != null) { info = builderInitInProgress; } else { info = removePersistentBuilderInfo(builderName, buildConfiguration, buildSpecIndex); setBuilderInitInProgress(project, builderName, info); } } result = initializeBuilder(builderName, buildConfiguration, info, status); result.setCommand(command); result.setBuildConfig(buildConfiguration); result.startupOnInitialize(); buildCommand.addBuilder(buildConfiguration, (IncrementalProjectBuilder) result); result = buildCommand.getBuilder(buildConfiguration); setBuilderInitInProgress(project, builderName, null); } if (result == null) { return null; } result.setBuildConfig(buildConfiguration); if (!validateNature(result, builderName)) { result.setLastBuiltTree(null); return null; } return (IncrementalProjectBuilder) result; }

Target:
private IncrementalProjectBuilder getBuilder(IBuildConfiguration buildConfiguration, ICommand command, int buildSpecIndex, MultiStatus status) throws CoreException { BuildCommand buildCommand = (BuildCommand) command; InternalBuilder result = buildCommand.getBuilder(buildConfiguration); String builderName = command.getBuilderName(); IProject project = buildConfiguration.getProject(); if (result == null) { BuilderPersistentInfo info = null; synchronized (builderInitializationLock) { BuilderPersistentInfo builderInitInProgress = getBuilderInitInfo(project, builderName); if (builderInitInProgress != null) { info = builderInitInProgress; } else { info = removePersistentBuilderInfo(builderName, buildConfiguration, buildSpecIndex); setBuilderInitInfo(project, builderName, info); } } result = buildCommand.getBuilder(buildConfiguration); if (result == null) { result = initializeBuilder(command, builderName, buildConfiguration, info, status); } synchronized (builderInitializationLock) { InternalBuilder other = buildCommand.getBuilder(buildConfiguration); if (other == null) { buildCommand.addBuilder(buildConfiguration, (IncrementalProjectBuilder) result); } else { result = other; } setBuilderInitInfo(project, builderName, null); } } if (result == null) { return null; } result.setBuildConfig(buildConfiguration); if (!validateNature(result, builderName)) { result.setLastBuiltTree(null); return null; } return (IncrementalProjectBuilder) result; }
Source:
public void createPartControl(Composite parent) { fTreeViewer = new TreeViewer(parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL); fTreeViewer.setUseHashlookup(true); fDrillDownAdapter = new DrillDownAdapter(fTreeViewer); fTreeViewer.setContentProvider(new PluginsContentProvider(this)); fTreeViewer.setLabelProvider(new PluginsLabelProvider()); fTreeViewer.setComparator(new ListUtil.PluginComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if (e1 instanceof PendingUpdateAdapter) return -1; else if (e2 instanceof PendingUpdateAdapter) return 1; return super.compare(viewer, e1, e2); } }); initDragAndDrop(); makeActions(); initFilters(); IActionBars actionBars = getViewSite().getActionBars(); contributeToActionBars(actionBars); registerGlobalActions(actionBars); hookContextMenu(); hookDoubleClickAction(); fTreeViewer.addSelectionChangedListener(e -> handleSelectionChanged(e.getSelection())); PDECore.getDefault().getSearchablePluginsManager().addPluginModelListener(this); fTreeViewer.setInput(fRoot = getDeferredTreeRoot()); PDECore.getDefault().getModelManager().addPluginModelListener(this); PDEPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyListener); getViewSite().setSelectionProvider(fTreeViewer); PlatformUI.getWorkbench().getHelpSystem().setHelp(fTreeViewer.getControl(), IHelpContextIds.PLUGINS_VIEW); }

Target:
public void createPartControl(Composite parent) { fTreeViewer = new TreeViewer(parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); fTreeViewer.setUseHashlookup(true); fDrillDownAdapter = new DrillDownAdapter(fTreeViewer); fTreeViewer.setContentProvider(new PluginsContentProvider(this)); fTreeViewer.setLabelProvider(new PluginsLabelProvider()); fTreeViewer.setComparator(new ListUtil.PluginComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if (e1 instanceof PendingUpdateAdapter) return -1; else if (e2 instanceof PendingUpdateAdapter) return 1; return super.compare(viewer, e1, e2); } }); initDragAndDrop(); makeActions(); initFilters(); IActionBars actionBars = getViewSite().getActionBars(); contributeToActionBars(actionBars); registerGlobalActions(actionBars); hookContextMenu(); hookDoubleClickAction(); fTreeViewer.addSelectionChangedListener(e -> handleSelectionChanged(e.getSelection())); PDECore.getDefault().getSearchablePluginsManager().addPluginModelListener(this); fTreeViewer.setInput(fRoot = getDeferredTreeRoot()); PDECore.getDefault().getModelManager().addPluginModelListener(this); PDEPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyListener); getViewSite().setSelectionProvider(fTreeViewer); PlatformUI.getWorkbench().getHelpSystem().setHelp(fTreeViewer.getControl(), IHelpContextIds.PLUGINS_VIEW); }
Source:
public boolean chkAuthorization(String userName, Object conceptCollectionObj, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { IConceptCollection collection; String conceptCollectionId = null; if (conceptCollectionObj.getClass().equals(String.class)) { conceptCollectionId = (String) conceptCollectionObj; collection = conceptCollectionManager.getConceptCollection(conceptCollectionId); } else { collection = (IConceptCollection) conceptCollectionObj; } String conceptCollectionOwner = collection.getOwner().getUserName(); if (userName.equals(conceptCollectionOwner)) { return true; } if (userRoles.length == 0) return false; List<String> roles = Arrays.asList(userRoles); List<IConceptCollectionCollaborator> ccCollaboratorList = conceptCollectionManager .showCollaboratingUsers(conceptCollectionId); if (ccCollaboratorList == null || ccCollaboratorList.isEmpty()) return false; for (IConceptCollectionCollaborator ccCollaborator : ccCollaboratorList) { String collaboratorName = ccCollaborator.getCollaborator().getUserObj().getUserName(); if (userName == null || !userName.equals(collaboratorName)) continue; List<IQuadrigaRole> collaboratorRoles = ccCollaborator.getCollaborator().getCollaboratorRoles(); if (collaboratorRoles != null) { for (IQuadrigaRole collabRole : collaboratorRoles) { String collaboratorRoleId = collabRole.getId(); if (roles != null) { if (roles.contains(collaboratorRoleId)) { return true; } } } } } return false; }

Target:
public boolean chkAuthorization(String userName, Object conceptCollectionObj, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { IConceptCollection collection; if (conceptCollectionObj instanceof String) { String conceptCollectionId = (String) conceptCollectionObj; collection = conceptCollectionManager.getConceptCollection(conceptCollectionId); } else { try { collection = (IConceptCollection) conceptCollectionObj; } catch (ClassCastException cce) { throw new IllegalObjectException(cce); } } String conceptCollectionOwner = collection.getOwner().getUserName(); if (userName.equals(conceptCollectionOwner)) { return true; } if (userRoles.length == 0) return false; List<String> roles = Arrays.asList(userRoles); List<IConceptCollectionCollaborator> ccCollaboratorList = conceptCollectionManager .showCollaboratingUsers(collection.getConceptCollectionId()); if (ccCollaboratorList == null || ccCollaboratorList.isEmpty()) return false; for (IConceptCollectionCollaborator ccCollaborator : ccCollaboratorList) { String collaboratorName = ccCollaborator.getCollaborator().getUserObj().getUserName(); if (userName == null || !userName.equals(collaboratorName)) continue; List<IQuadrigaRole> collaboratorRoles = ccCollaborator.getCollaborator().getCollaboratorRoles(); if (collaboratorRoles != null) { for (IQuadrigaRole collabRole : collaboratorRoles) { String collaboratorRoleId = collabRole.getId(); if (roles != null) { if (roles.contains(collaboratorRoleId)) { return true; } } } } } return false; }
Source:
public void onBackPressed(){ if (mEtSubject.getText().length() > 0 || mEtMessage.formattedToText().length() > 0) { long draftId = saveDraft(); Intent resultIntent = new Intent(); resultIntent.putExtra(HomeActivity.SAVED_ID, draftId); setResult(HomeActivity.RESULT_SAVE_DRAFT, resultIntent); finish(); } else { super.onBackPressed(); } }

Target:
public void onBackPressed(){ if (!mEtSubject.getText().toString().isEmpty() || !mEtMessage.formattedToText().isEmpty()) { long draftId = saveDraft(); Intent resultIntent = new Intent(); resultIntent.putExtra(HomeActivity.SAVED_ID, draftId); setResult(HomeActivity.RESULT_SAVE_DRAFT, resultIntent); finish(); } else { super.onBackPressed(); } }
Source:
protected String doPost(String apiUrl, Map<String,String> data) throws Exception { String fullUrl = BASE_URL + apiUrl; OkHttpClient okHttpClient = new OkHttpClient(); FormBody.Builder formBodyBuilder = new FormBody.Builder(); if (data!=null) { if (data.size() > 0) { for (Map.Entry<String,String> entry : data.entrySet()) { formBodyBuilder.add(entry.getKey(), entry.getValue()); } } } if (_clientId != null) { formBodyBuilder.add("clientUUID", _clientId); } System.out.println("Full Url is :"+ fullUrl); RequestBody body = formBodyBuilder.build(); Request.Builder formBody = new Request.Builder() .url(fullUrl) .post(body) .addHeader("Content-Type", "application/json; charset=utf-8"); Request request = formBody.build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string().trim(); }

Target:
protected String doPost(String apiUrl, Map<String,String> data) throws Exception { String fullUrl = BASE_URL + apiUrl; FormBody.Builder formBodyBuilder = new FormBody.Builder(); if ((data != null) && !data.isEmpty()) { for (Map.Entry<String,String> entry : data.entrySet()) { formBodyBuilder.add(entry.getKey(), entry.getValue()); } } if (_clientId != null) { formBodyBuilder.add("clientUUID", _clientId); } RequestBody body = formBodyBuilder.build(); Request.Builder formBody = new Request.Builder() .url(fullUrl) .post(body) .addHeader("Content-Type", "application/json; charset=utf-8"); Request request = formBody.build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string().trim(); }
Source:
private StreamPartitionCountMonitor getPartitionCountMonitor(Config config, SystemAdmins systemAdmins) { StreamMetadataCache streamMetadata = new StreamMetadataCache(systemAdmins, 0, SystemClock.instance()); Set<SystemStream> inputStreamsToMonitor = new TaskConfigJava(config).getAllInputStreams(); if (inputStreamsToMonitor.isEmpty()) { throw new SamzaException("Input streams to a job can not be empty."); } Map<String, Pattern> inputRegexesToMonitor = inputStreamsToMonitor.stream() .collect(Collectors.toMap(x -> x.getSystem(), x -> new JobConfig(config).getRegexToMonitor(x.getSystem()))) .entrySet() .stream() .filter(x -> x.getValue().isDefined()) .collect(Collectors.toMap(Map.Entry::getKey, x -> Pattern.compile(x.getValue().get()))); return new StreamPartitionCountMonitor(inputStreamsToMonitor, inputRegexesToMonitor, streamMetadata, metrics, new JobConfig(config).getMonitorPartitionChangeFrequency(), new JobConfig(config).getMonitorInputRegexFrequency(), new StreamPartitionCountMonitor.Callback() { @Override public void onSystemStreamPartitionChange(Set<SystemStream> streamsChanged) { if (hasDurableStores) { log.error("Input topic partition count changed in a job with durable state. Failing the job."); state.status = SamzaApplicationState.SamzaAppStatus.FAILED; } coordinatorException = new PartitionChangeException("Input topic partition count changes detected."); } @Override public void onNewInputStreamsDiscovered(Set<SystemStream> newStreams) { log.error("New input system-streams discovered. Failing the job. New input streams: {}", newStreams, " Existing input streams:", inputStreamsToMonitor); state.status = SamzaApplicationState.SamzaAppStatus.FAILED; coordinatorException = new InputStreamsDiscoveredException("New input streams added: " + newStreams); } }); }

Target:
private Optional<StreamPartitionCountMonitor> getPartitionCountMonitor(Config config, SystemAdmins systemAdmins) { StreamMetadataCache streamMetadata = new StreamMetadataCache(systemAdmins, 0, SystemClock.instance()); Set<SystemStream> inputStreamsToMonitor = new TaskConfigJava(config).getAllInputStreams(); if (inputStreamsToMonitor.isEmpty()) { throw new SamzaException("Input streams to a job can not be empty."); } return Optional.of(new StreamPartitionCountMonitor(inputStreamsToMonitor, streamMetadata, metrics, new JobConfig(config).getMonitorPartitionChangeFrequency(), streamsChanged -> { if (hasDurableStores) { log.error("Input topic partition count changed in a job with durable state. Failing the job."); state.status = SamzaApplicationState.SamzaAppStatus.FAILED; } coordinatorException = new PartitionChangeException("Input topic partition count changes detected."); })); }
Source:
private static OperatingSystem mapOperatingSystem(VDS entity) { final OperatingSystem model = new OperatingSystem(); if (StringUtils.isNotBlank(entity.getHostOs())) { OS hostOs = OS.fromPackageVersionString(entity.getHostOs()); Version version = new Version(); version.setMajor(hostOs.getVersion().getMajor()); if (hostOs.getVersion().getMinor() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setMinor(hostOs.getVersion().getMinor()); } if (hostOs.getVersion().getBuild() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setBuild(hostOs.getVersion().getBuild()); } version.setFullVersion(hostOs.getFullVersion()); model.setVersion(version); model.setType(hostOs.getName()); } model.setCustomKernelCmdline(Objects.toString(entity.getCurrentKernelCmdline(), "")); model.setReportedKernelCmdline(entity.getKernelArgs()); return model; }

Target:
private static OperatingSystem mapOperatingSystem(VDS entity) { final OperatingSystem model = new OperatingSystem(); if (StringUtils.isNotBlank(entity.getHostOs())) { OS hostOs = OS.fromPackageVersionString(entity.getHostOs()); Version version = new Version(); if (hostOs.getVersion().getMajor() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setMajor(hostOs.getVersion().getMajor()); } if (hostOs.getVersion().getMinor() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setMinor(hostOs.getVersion().getMinor()); } if (hostOs.getVersion().getBuild() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setBuild(hostOs.getVersion().getBuild()); } version.setFullVersion(hostOs.getFullVersion()); model.setVersion(version); model.setType(hostOs.getName()); } model.setCustomKernelCmdline(Objects.toString(entity.getCurrentKernelCmdline(), "")); model.setReportedKernelCmdline(entity.getKernelArgs()); return model; }
Source:
public List<CcJudgmentKeyword> findAllByPhrasePart(String phrasePart) { Query query = entityManager.createQuery("select keyword from " + CcJudgmentKeyword.class.getName() + " keyword where lower(keyword.phrase) like :phrasePart"); query.setParameter("phrasePart", phrasePart.toLowerCase() + "%"); List<CcJudgmentKeyword> keywords = query.getResultList(); return keywords; }

Target:
public List<CcJudgmentKeyword> findAllByPhrasePart(String phrasePart) { Query query = entityManager.createQuery("select keyword from " + CcJudgmentKeyword.class.getName() + " keyword where lower(keyword.phrase) like :phrasePart order by keyword.phrase asc"); query.setParameter("phrasePart", phrasePart.toLowerCase() + "%"); List<CcJudgmentKeyword> keywords = query.getResultList(); return keywords; }
Source:
public void getEngineTimeStamp(AsyncQuery aQuery) { aQuery.setHandleFailure(true); Frontend.getInstance().runQuery(VdcQueryType.GetEngineTimestamp, new VdcQueryParametersBase(), aQuery); }

Target:
public void getEngineTimeStamp(AsyncQuery aQuery) { Frontend.getInstance().runQuery(VdcQueryType.GetEngineTimestamp, new VdcQueryParametersBase(), aQuery); }
Source:
public void waitProjectExplorer(int timeout) { try { seleniumWebDriverHelper.waitVisibility(By.id(PROJECT_EXPLORER_TREE_ITEMS), timeout); } catch (TimeoutException ex) { if (seleniumWebDriverHelper.isVisible(By.id("ide-loader-progress-bar"))) { fail("Known issue <LINK_0>", ex); } } }

Target:
public void waitProjectExplorer(int timeout) { try { seleniumWebDriverHelper.waitVisibility(By.id(PROJECT_EXPLORER_TREE_ITEMS), timeout); } catch (TimeoutException ex) { if (seleniumWebDriverHelper.isVisible(By.id("ide-loader-progress-bar"))) { fail("Known issue <LINK_0>", ex); } throw ex; } }
Source:
private boolean skipSla(IScheduledTask task, long numActive) { if (slaAwareKillNonProd || task.getAssignedTask().getTask().isProduction()) { return numActive < minRequiredInstances; } return true; }

Target:
private boolean skipSla(IScheduledTask task, long numActive) { if (slaAwareKillNonProd || tierManager.getTier(task.getAssignedTask().getTask()).isProduction()) { return numActive < minRequiredInstances; } return true; }
Source:
public StyledString getStyledText(Object element) { if(element instanceof IFile){ StyledString sb = new StyledString(); sb.append(((IFile)element).getName(), FILE_NAME_STYLER).append(" - "); sb.append(((IFile)element).getParent().getFullPath().toString(), PATH_STYLER); return sb; }else if(element instanceof NodePathTextSourceReference){ StyledString sb = new StyledString(); sb.append(getNodePath((NodePathTextSourceReference)element)); return sb; } return null; }

Target:
public StyledString getStyledText(Object element) { if(element instanceof IFile){ StyledString sb = new StyledString(); sb.append(((IFile)element).getName(), FILE_NAME_STYLER).append(" - "); sb.append(((IFile)element).getParent().getFullPath().toString(), PATH_STYLER); return sb; }else if(element instanceof NodePathTextSourceReference){ return getNodePath((NodePathTextSourceReference)element); } return null; }