auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onLongPress(int x, int y, final PageTitle title, final HistoryEntry entry) { anchorView = new View(fragment.getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(1, 1); params.leftMargin = x; params.topMargin = y; anchorView.setLayoutParams(params); containerView.addView(anchorView); PopupMenu popupMenu = new PopupMenu(activity, anchorView); popupMenu.inflate(R.menu.menu_page_long_press); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_open_link: activity.displayNewPage(title, entry); return true; case R.id.menu_open_in_new_tab: fragment.openInNewTab(title, entry); return true; default: break; } return false; } }); popupMenu.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { if (anchorView != null) { containerView.removeView(anchorView); anchorView = null; } } }); popupMenu.show(); final int vibrateMillis = 50; <START> vibrator.vibrate(vibrateMillis); <END> }</code><technical_language>This is a nice attention detail I do wonder: - Is this people want? Is this worth adding extra permission for? - Do consistently vibrate CAB display app? if this a negative. I object this feature felt worth asking about</technical_language>

Target:
public void onLongPress(int x, int y, final PageTitle title, final HistoryEntry entry) { anchorView = new View(fragment.getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(1, 1); params.leftMargin = x; params.topMargin = y; anchorView.setLayoutParams(params); containerView.addView(anchorView); PopupMenu popupMenu = new PopupMenu(activity, anchorView); popupMenu.inflate(R.menu.menu_page_long_press); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_open_link: activity.displayNewPage(title, entry); return true; case R.id.menu_open_in_new_tab: fragment.openInNewTab(title, entry); return true; default: break; } return false; } }); popupMenu.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { if (anchorView != null) { containerView.removeView(anchorView); anchorView = null; } } }); popupMenu.show(); }
Source:
<code>public static InstallState getInstallState() { if (!Boolean.getBoolean("jenkins.install.runSetupWizard")) { if (Functions.getIsUnitTest()) { return InstallState.TEST; } if (Boolean.getBoolean("hudson.Main.development")) { return InstallState.DEVELOPMENT; } } VersionNumber lastRunVersion = new VersionNumber(getLastExecVersion()); if (lastRunVersion.compareTo(NEW_INSTALL_VERSION) == 0) { if (!Jenkins.getInstance().getItemMap().isEmpty() <START> || Jenkins.getInstance().getSecurityRealm() != SecurityRealm.NO_AUTHENTICATION) { <END> return InstallState.UPGRADE; } return InstallState.NEW; } VersionNumber currentRunVersion = new VersionNumber(getCurrentExecVersion()); if (lastRunVersion.isOlderThan(currentRunVersion)) { return InstallState.UPGRADE; } else if (lastRunVersion.isNewerThan(currentRunVersion)) { return InstallState.DOWNGRADE; } else { return InstallState.RESTART; } }</code><technical_language>this correctly handle 2.0 case, is a security realm default</technical_language>

Target:
public static InstallState getInstallState() { String stateOverride = System.getenv("jenkins.install.state"); if (stateOverride != null) { try { return InstallState.valueOf(stateOverride.toUpperCase()); } catch (RuntimeException e) { throw new IllegalStateException("Unknown install state override specified on the commandline: '" + stateOverride + "'."); } } if (!Boolean.getBoolean("jenkins.install.runSetupWizard")) { if (Functions.getIsUnitTest()) { return InstallState.TEST; } if (Boolean.getBoolean("hudson.Main.development")) { return InstallState.DEVELOPMENT; } } VersionNumber lastRunVersion = new VersionNumber(getLastExecVersion()); if (lastRunVersion.compareTo(NEW_INSTALL_VERSION) == 0) { Jenkins j = Jenkins.getInstance(); if (!j.getItemMap().isEmpty() || !mayBeJenkins2SecurityDefaults(j)) { return InstallState.UPGRADE; } return InstallState.NEW; } VersionNumber currentRunVersion = new VersionNumber(getCurrentExecVersion()); if (lastRunVersion.isOlderThan(currentRunVersion)) { return InstallState.UPGRADE; } else if (lastRunVersion.isNewerThan(currentRunVersion)) { return InstallState.DOWNGRADE; } else { return InstallState.RESTART; } }
Source:
<code>private void deleteSelfFromEntries(User user) { user.getEntries().stream() .filter(e -> e.getUsers().size() == 1 && !e.getIsPublished()) .forEach(entry -> { EntryDAO entryDAO; if (entry instanceof Workflow) { entryDAO = workflowDAO; } else if (entry instanceof Tool) { entryDAO = toolDAO; } else { throw new CustomWebApplicationException( MessageFormat.format("Unexpected entry type {0}", entry.getClass().toString()), HttpStatus.SC_INTERNAL_SERVER_ERROR); } <START> List<Event> eventsByEntryIDs = eventDAO.findEventsByEntryId(entry.getId()); <END> eventsByEntryIDs.forEach(eventDAO::delete); entryDAO.delete(entry); }); }</code><technical_language>EventDAO a delete user for example, done JPA delete</technical_language>

Target:
private void deleteSelfFromEntries(User user) { user.getEntries().stream() .filter(e -> e.getUsers().size() == 1 && !e.getIsPublished()) .forEach(entry -> { EntryDAO entryDAO; if (entry instanceof Workflow) { entryDAO = workflowDAO; } else if (entry instanceof Tool) { entryDAO = toolDAO; } else { throw new CustomWebApplicationException( MessageFormat.format("Unexpected entry type {0}", entry.getClass().toString()), HttpStatus.SC_INTERNAL_SERVER_ERROR); } eventDAO.deleteEventByEntryID(entry.getId()); entryDAO.delete(entry); }); }
Source:
<code>private boolean decodeScenarioParameters(Cardio2eScenarioTransaction receivedCardio2eTransaction, List<String> digestedTransaction) { boolean decodeComplete = false; switch (receivedCardio2eTransaction.getTransactionType()){ case ACK: if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setObjectNumber (Short.parseShort(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException e1) { <START> e1.printStackTrace(); <END> } } break; case NACK: decodeComplete = decodeNACK(receivedCardio2eTransaction, digestedTransaction); break; case SET: if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setObjectNumber (Short.parseShort(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException e1) { e1.printStackTrace(); } } if (digestedTransaction.size() == 4) { try { if (digestedTransaction.get(3).length() <= Cardio2eTransaction.CARDIO2E_MAX_SECURITY_CODE_LENGTH) { receivedCardio2eTransaction.setObjectNumber (Short.parseShort(digestedTransaction.get(2))); receivedCardio2eTransaction.setSecurityCode(digestedTransaction.get(3)); decodeComplete = true; } } catch (IllegalArgumentException e1) { e1.printStackTrace(); } } break; } return decodeComplete; }</code><technical_language>logger.error() instead of e.printStackTrace()</technical_language>

Target:
private boolean decodeScenarioParameters( Cardio2eScenarioTransaction receivedCardio2eTransaction, List<String> digestedTransaction) { boolean decodeComplete = false; switch (receivedCardio2eTransaction.getTransactionType()) { case ACK: if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setObjectNumber(Short .parseShort(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding SCENARIO transaction: '{}'", ex.toString()); } } break; case NACK: decodeComplete = decodeNACK(receivedCardio2eTransaction, digestedTransaction); break; case SET: if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setObjectNumber(Short .parseShort(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding SCENARIO transaction: '{}'", ex.toString()); } } if (digestedTransaction.size() == 4) { try { if (digestedTransaction.get(3).length() <= Cardio2eTransaction.CARDIO2E_MAX_SECURITY_CODE_LENGTH) { receivedCardio2eTransaction.setObjectNumber(Short .parseShort(digestedTransaction.get(2))); receivedCardio2eTransaction .setSecurityCode(digestedTransaction.get(3)); decodeComplete = true; } } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding SCENARIO transaction: '{}'", ex.toString()); } } break; } return decodeComplete; }
Source:
<code>private void initialize(final Bundle savedInstanceState) { <START> loadSettingsFromXml(); <END> if (!shouldShowDualPane) { setupNavigationDrawer(); setupActionBar(); setupActionBarToggle(); } setupActivityFromState(savedInstanceState); }</code><technical_language>I this is necessary initialise shouldShowDualPane need obscure purpose. applies setupNavigationDrawer()</technical_language>

Target:
private void initialize(final Bundle savedInstanceState) { shouldShowDualPane = getResources().getBoolean(R.bool.main_is_dualpane); if (!shouldShowDualPane) { navigationDrawer = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); setupActionBar(); setupActionBarToggle(); } setupActivityFromState(savedInstanceState); }
Source:
<code>public <T> void addParameter(VdcParameter param, T value) { <START> paramsMap.<T>put(param, value); <END> }</code><technical_language>please return this for addParameter, this enable: RunQuery(prms.addParameter(x, y).addParameter(x, y).addParameter(x,y))</technical_language>

Target:
public <T> VdcQueryParametersBase addParameter(VdcParameter param, T value) { paramsMap.<T>put(param, value); return this; }
Source:
<code>boolean removeUserBan(final int moderatorId, final String banId) { final String unbanName = bannedUserDao.lookupUsernameByBanId(banId).orElse(null); if (bannedUserDao.removeBan(banId) != 1) { return false; } if (unbanName == null) { throw new AssertionError( "Consistency error, unbanned " + banId + ", but " + "there was no matching name for that ban."); <START> } <END> moderatorAuditHistoryDao.addAuditRecord( ModeratorAuditHistoryDao.AuditArgs.builder() .actionName(ModeratorAuditHistoryDao.AuditAction.REMOVE_USER_BAN) .actionTarget(unbanName) .moderatorUserId(moderatorId) .build()); return true; }</code><technical_language>is this assertion error thrown removing ban? asked in a way: do attempt ban a user a null username</technical_language>

Target:
boolean removeUserBan(final int moderatorId, final String banId) { final String unbanName = bannedUserDao.lookupUsernameByBanId(banId).orElse(null); if (bannedUserDao.removeBan(banId) != 1) { return false; } if (unbanName == null) { throw new IllegalStateException( "Consistency error, unbanned " + banId + ", but " + "there was no matching name for that ban."); } moderatorAuditHistoryDao.addAuditRecord( ModeratorAuditHistoryDao.AuditArgs.builder() .actionName(ModeratorAuditHistoryDao.AuditAction.REMOVE_USER_BAN) .actionTarget(unbanName) .moderatorUserId(moderatorId) .build()); return true; }
Source:
<code>public void whenConsumerIsBlocked429() throws Exception { final FloodService.Flooder flooder = new FloodService.Flooder(eventType.getName(), FloodService.Type.CONSUMER_ET); NakadiControllerAT.blockFlooder(flooder); TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "") .start(); <START> Thread.sleep(2000); <END> Assert.assertEquals(MoreStatus.TOO_MANY_REQUESTS.getStatusCode(), client.getResponseCode()); Assert.assertEquals("300", client.getHeaderValue("Retry-After")); NakadiControllerAT.unblockFlooder(flooder); client = TestStreamingClient .create(URL, subscription.getId(), "") .start(); Thread.sleep(2000); Assert.assertEquals(HttpStatus.SC_OK, client.getResponseCode()); }</code><technical_language>decided plain sleeps wait specific thing. Please a other tests in class. do waitFor(() -> assertThat(MoreStatus.TOO_MANY_REQUESTS.getStatusCode(), client.getResponseCode()));</technical_language>

Target:
public void whenConsumerIsBlocked429() throws Exception { final FloodService.Flooder flooder = new FloodService.Flooder(eventType.getName(), FloodService.Type.CONSUMER_ET); SettingsControllerAT.blockFlooder(flooder); final TestStreamingClient client1 = TestStreamingClient .create(URL, subscription.getId(), "") .start(); waitFor(() -> { Assert.assertEquals(MoreStatus.TOO_MANY_REQUESTS.getStatusCode(), client1.getResponseCode()); Assert.assertEquals("300", client1.getHeaderValue("Retry-After")); }); SettingsControllerAT.unblockFlooder(flooder); final TestStreamingClient client2 = TestStreamingClient .create(URL, subscription.getId(), "") .start(); waitFor(() -> Assert.assertEquals(HttpStatus.SC_OK, client2.getResponseCode())); }
Source:
<code>public void setupTestCluster() throws Exception { assertTrue(baseDir.mkdirs() || baseDir.isDirectory()); File testDir = new File(baseDir, testName.getMethodName()); FileUtils.deleteQuietly(testDir); assertTrue(testDir.mkdir()); zooKeeper = new TestingServer(); <START> MiniAccumuloConfig config = new MiniAccumuloConfig(testDir, "superSecret"); <END> config.setExistingZooKeepers(zooKeeper.getConnectString()); accumulo = new MiniAccumuloCluster(config); }</code><technical_language>nice "superSecret" a static final constant</technical_language>

Target:
public void setupTestCluster() throws Exception { assertTrue(BASE_DIR.mkdirs() || BASE_DIR.isDirectory()); File testDir = new File(BASE_DIR, testName.getMethodName()); FileUtils.deleteQuietly(testDir); assertTrue(testDir.mkdir()); zooKeeper = new TestingServer(); MiniAccumuloConfig config = new MiniAccumuloConfig(testDir, SECRET); config.getImpl().setExistingZooKeepers(zooKeeper.getConnectString()); accumulo = new MiniAccumuloCluster(config); accumulo.start(); }
Source:
<code>protected ActionContext createActionContext(DocumentModel doc) { ActionContext actionContext = new ELActionContext(); actionContext.setCurrentDocument(doc); <START> actionContext.setDocumentManager(doc.getCoreSession()); <END> if (doc.getCoreSession() != null) { actionContext.setCurrentPrincipal(doc.getCoreSession().getPrincipal()); } return actionContext; }</code><technical_language>put doc.getCoreSession() in a local variable please</technical_language>

Target:
protected ActionContext createActionContext(DocumentModel doc) { ActionContext actionContext = new ELActionContext(); actionContext.setCurrentDocument(doc); CoreSession coreSession = doc.getCoreSession(); actionContext.setDocumentManager(coreSession); if (coreSession != null) { actionContext.setCurrentPrincipal(coreSession.getPrincipal()); } return actionContext; }
Source:
<code>private void selectTrackableSort() { <START> <END> final Builder alert = new AlertDialog.Builder(this); alert.setTitle(res.getString(R.string.log_tb_sortby)); final String[] tbSortLabels = { res.getString(R.string.trackable_code), res.getString(R.string.trackable_name) }; final List<Comparator<TrackableLog>> comparators = new ArrayList<>(); comparators.add(new Comparator<TrackableLog>() { @Override public int compare(final TrackableLog lhs, final TrackableLog rhs) { return TextUtils.COLLATOR.compare(lhs.name, rhs.name); } }); comparators.add(new Comparator<TrackableLog>() { @Override public int compare(final TrackableLog lhs, final TrackableLog rhs) { return TextUtils.COLLATOR.compare(lhs.trackCode, rhs.trackCode); } }); alert.setSingleChoiceItems(tbSortLabels, trackableSortPositionSelected , new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int position) { trackableSort = comparators.get(position); trackableSortPositionSelected = position; updateTrackablesList(); dialog.dismiss(); } }); alert.create().show(); }</code><technical_language>Please remove extra blank line</technical_language>

Target:
private void selectTrackableSort() { final Builder alert = new AlertDialog.Builder(this); alert.setTitle(res.getString(R.string.log_tb_sortby)); final String[] tbSortLabels = new String[TrackableComparator.values().length]; for (final TrackableComparator tc: TrackableComparator.values()) { tbSortLabels[tc.getPosition()] = res.getString(tc.getLabel()); } alert.setSingleChoiceItems(tbSortLabels, Settings.getTrackableInventorySortMethod() , new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int position) { Settings.setTrackableInventorySortMethod(position); updateTrackablesList(); dialog.dismiss(); } }); alert.create().show(); }
Source:
<code>public int hashCode() { <START> return Objects.hash(position, sequence); <END> }</code><technical_language>problem Object.equals Arrays.equals</technical_language>

Target:
public int hashCode() { int result = Objects.hash(position); result = 31 * result + Arrays.hashCode(sequence); return result; }
Source:
<code>private void orderContainedClasses(JupiterEngineDescriptor jupiterEngineDescriptor, ClassOrderer classOrderer) { <START> Set<? extends TestDescriptor> children = jupiterEngineDescriptor.getChildren(); List<TestDescriptor> nonClassTestDescriptors = children.stream() .filter(testDescriptor -> !(testDescriptor instanceof ClassBasedTestDescriptor)) .collect(Collectors.toList()); List<DefaultClassDescriptor> classDescriptors = children.stream() .filter(ClassBasedTestDescriptor.class::isInstance) .map(ClassBasedTestDescriptor.class::cast) .map(DefaultClassDescriptor::new) .collect(toCollection(ArrayList::new)); Set<DefaultClassDescriptor> originalClassDescriptors = new LinkedHashSet<>(classDescriptors); classOrderer.orderClasses(new DefaultClassOrdererContext(classDescriptors, this.configuration)); int difference = classDescriptors.size() - originalClassDescriptors.size(); if (difference > 0) { logger.warn(() -> String.format("ClassOrderer [%s] added %s ClassDescriptor(s) which will be ignored.", classOrderer.getClass().getName(), difference)); } else if (difference < 0) { logger.warn(() -> String.format( "ClassOrderer [%s] removed %s ClassDescriptor(s) which will be retained with arbitrary ordering.", classOrderer.getClass().getName(), -difference)); } Set<TestDescriptor> sortedClassTestDescriptors = classDescriptors.stream() .filter(originalClassDescriptors::contains) .map(DefaultClassDescriptor::getTestDescriptor) .collect(toCollection(LinkedHashSet::new)); Stream.concat(sortedClassTestDescriptors.stream(), nonClassTestDescriptors.stream()) .forEach(jupiterEngineDescriptor::removeChild); Stream.concat(sortedClassTestDescriptors.stream(), nonClassTestDescriptors.stream()) .forEach(jupiterEngineDescriptor::addChild); <END> }</code><technical_language>some duplication MethodOrderingVisitor. avoiding that</technical_language>

Target:
private void orderContainedClasses(JupiterEngineDescriptor jupiterEngineDescriptor, ClassOrderer classOrderer) { orderChildrenTestDescriptors(jupiterEngineDescriptor, ClassBasedTestDescriptor.class, DefaultClassDescriptor::new, descriptorWrappers -> classOrderer.orderClasses( new DefaultClassOrdererContext(descriptorWrappers, this.configuration)), difference -> String.format("ClassOrderer [%s] added %s ClassDescriptor(s) which will be ignored.", classOrderer.getClass().getName(), difference), difference -> String.format( "ClassOrderer [%s] removed %s ClassDescriptor(s) which will be retained with arbitrary ordering.", classOrderer.getClass().getName(), -difference)); }
Source:
<code>public void doExecute() throws MojoExecutionException { getLog().debug("Verifying packaged files ..."); try { if (!skipValidation) { getProjectVerifier().verify(); } else { <START> getLog().debug("skipping verify validation for Mule application"); <END> } } catch (ValidationException e) { throw new MojoExecutionException("Verify exception", e); } }</code><technical_language>Skipping</technical_language>

Target:
public void doExecute() throws MojoExecutionException { getLog().debug("Verifying packaged files..."); try { if (!skipValidation) { getProjectVerifier().verify(); } else { getLog().debug("Skipping verify validation for Mule application"); } } catch (ValidationException e) { throw new MojoExecutionException("Verify exception", e); } }
Source:
<code>public void registerClasses( Kryo kryo ) { FeatureSerializer simpleSerializer = new FeatureSerializer(); PersistableSerializer persistSerializer = new PersistableSerializer(); <START> <END> kryo.register( SimpleFeature.class, simpleSerializer, 1200); kryo.register( SimpleFeatureImpl.class, simpleSerializer, 1201); kryo.register( AvroSimpleFeature.class, simpleSerializer, 1202); kryo.register( Persistable.class, persistSerializer); kryo.register( TieredSFCIndexStrategy.class, persistSerializer); kryo.register( SingleTierSubStrategy.class, persistSerializer); kryo.register( HilbertSFC.class, persistSerializer); }</code><technical_language>easy register persistables PersistableFactory.getInstance().getClassIdMapping().entrySet().forEach(e -> kryo.register(e.getKey, simpleSerializer, e.getValue())); in place of specific concrete class registration</technical_language>

Target:
public void registerClasses( Kryo kryo ) { FeatureSerializer simpleSerializer = new FeatureSerializer(); PersistableSerializer persistSerializer = new PersistableSerializer(); PersistableFactory.getInstance().getClassIdMapping().entrySet().forEach(e -> kryo.register(e.getKey(), persistSerializer, e.getValue())); kryo.register( SimpleFeatureImpl.class, simpleSerializer); }
Source:
<code>private void flatMap(IndexedRecord input, ProcessContext context) throws IOException { python.set("inputJSON", new PyString(input.toString())); python.exec("input = json.loads(inputJSON)"); python.exec("outputList = []"); python.exec(properties.pythonCode.getValue()); python.exec("outputJSON = [ json.dumps(outputElement) for outputElement in outputList ]"); PyObject outputList = python.get("outputJSON"); if (outputList instanceof PyList) { PyList list = (PyList) outputList; for (Object output : list) { <START> JsonSchemaInferrer jsonSchemaInferrer = new JsonSchemaInferrer(new ObjectMapper()); <END> Schema jsonSchema = jsonSchemaInferrer.inferSchema(output.toString()); JsonGenericRecordConverter jsonGenericRecordConverter = new JsonGenericRecordConverter(jsonSchema); GenericRecord outputRecord = jsonGenericRecordConverter.convertToAvro(output.toString()); context.output(outputRecord); } } }</code><technical_language>a cache mechanism here</technical_language>

Target:
private void flatMap(IndexedRecord input, ProcessContext context) throws IOException { python.set("inputJSON", new PyString(input.toString())); python.exec("input = json.loads(inputJSON)"); python.exec("outputList = []"); python.exec(properties.pythonCode.getValue()); python.exec("outputJSON = [ json.dumps(outputElement) for outputElement in outputList ]"); PyObject outputList = python.get("outputJSON"); if (outputList instanceof PyList) { PyList list = (PyList) outputList; for (Object output : list) { if (jsonGenericRecordConverter == null) { JsonSchemaInferrer jsonSchemaInferrer = new JsonSchemaInferrer(new ObjectMapper()); Schema jsonSchema = jsonSchemaInferrer.inferSchema(output.toString()); jsonGenericRecordConverter = new JsonGenericRecordConverter(jsonSchema); } GenericRecord outputRecord = jsonGenericRecordConverter.convertToAvro(output.toString()); context.output(outputRecord); } } }
Source:
<code>public final void error() { for (InputAnchor in : getInputs()) { if (!in.isConnected()) { argumentSpace.getChildren().get(getArgumentIndex(in)) <START> .getStyleClass().add("error"); <END> } else if (in.isConnected()) { argumentSpace.getChildren().get(getArgumentIndex(in)) .getStyleClass().remove("error"); } } this.getStyleClass().add("error"); }</code><technical_language>line refactor</technical_language>

Target:
public final void error() { for (InputAnchor in : getInputs()) { ObservableList<Node> children = argumentSpace.getChildren(); Node arg = children.get(getArgumentIndex(in)); if (!in.isConnected()) { arg.getStyleClass().add("error"); } else if (in.isConnected()) { arg.getStyleClass().remove("error"); } } this.getStyleClass().add("error"); }
Source:
<code>public static void appLaunched(Context mContext, String packageName) { SharedPreferences prefs = mContext.getSharedPreferences("app_rater", 0); if (prefs.getBoolean("don't_show_again", false)) { return; } SharedPreferences.Editor editor = prefs.edit(); long launchCount = prefs.getLong("launch_count", 0) + 1; editor.putLong("launch_count", launchCount); Long dateFirstLaunch = prefs.getLong("date_first_launch", 0); if (dateFirstLaunch == 0) { dateFirstLaunch = System.currentTimeMillis(); editor.putLong("date_first_launch", dateFirstLaunch); } Long dateNeutralClick = prefs.getLong("date_neutral", 0); if (launchCount >= LAUNCHES_UNTIL_PROMPT) { if (System.currentTimeMillis() >= Math.max(dateFirstLaunch <START> + (DAYS_UNTIL_PROMPT * 24 * 60 * 60 * 1000), dateNeutralClick <END> + (DAYS_UNTIL_NEUTRAL_CLICK * 24 * 60 * 60 * 1000))) { showRateDialog(mContext, packageName, false); } } editor.apply(); }</code><technical_language>I create a new method convert days in milliseconds, daysToMilliseconds(int days)</technical_language>

Target:
public static void appLaunched(Context mContext, String packageName) { SharedPreferences prefs = mContext.getSharedPreferences(APP_RATER_PREF_TITLE, 0); if (prefs.getBoolean(APP_RATER_PREF_DONT_SHOW, false)) { return; } SharedPreferences.Editor editor = prefs.edit(); long launchCount = prefs.getLong(APP_RATER_PREF_LAUNCH_COUNT, 0) + 1; editor.putLong(APP_RATER_PREF_LAUNCH_COUNT, launchCount); Long dateFirstLaunch = prefs.getLong(APP_RATER_PREF_DATE_FIRST_LAUNCH, 0); if (dateFirstLaunch == 0) { dateFirstLaunch = System.currentTimeMillis(); editor.putLong(APP_RATER_PREF_DATE_FIRST_LAUNCH, dateFirstLaunch); } Long dateNeutralClick = prefs.getLong(APP_RATER_PREF_DATE_NEUTRAL, 0); if (launchCount >= LAUNCHES_UNTIL_PROMPT) { if (System.currentTimeMillis() >= Math.max(dateFirstLaunch + daysToMilliseconds(DAYS_UNTIL_PROMPT), dateNeutralClick + daysToMilliseconds(DAYS_UNTIL_NEUTRAL_CLICK))) { showRateDialog(mContext, packageName, false); } } editor.apply(); }
Source:
<code>public WebappDaoFactoryConfig() { preferredLocales = Arrays.asList(Locale.getDefault()); <START> preferredLanguages = Arrays.asList("en-US", "en", "EN"); <END> defaultNamespace = "<LINK_0>"; nonUserNamespaces = new HashSet<String>(); nonUserNamespaces.add(VitroVocabulary.vitroURI); }</code><technical_language>@wwelling : Is guarantee default locale language included in list of languages</technical_language>

Target:
public WebappDaoFactoryConfig() { preferredLanguages = Arrays.asList("en-US", "en", "EN"); preferredLocales = LanguageFilteringUtils.languagesToLocales(preferredLanguages); defaultNamespace = "<LINK_0>"; nonUserNamespaces = new HashSet<String>(); nonUserNamespaces.add(VitroVocabulary.vitroURI); }
Source:
<code>public Object instantiate(Target<?> target, Parameters parameters) { try { if(isSupportedCollection(target)) { return multiInstantiator.instantiate(target, parameters); } Parameter parameter = parameters.namedAfter(target); return converterForTarget(target).convert(parameter.getValue(), target.getClassType()); } catch (ConversionException ex) { logger.warn("Could not convert target", ex); errors.add(ex.getValidationMessage().withCategory(target.getName())); } catch (IllegalStateException e) { <START> logger.warn("An error occured while getting validation message", e); <END> return setPropertiesAfterConversions(target, parameters); } return null; }</code><technical_language>logger#debug in cases... do think</technical_language>

Target:
public Object instantiate(Target<?> target, Parameters parameters) { try { if(isSupportedCollection(target)) { return multiInstantiator.instantiate(target, parameters); } Parameter parameter = parameters.namedAfter(target); return converterForTarget(target).convert(parameter.getValue(), target.getClassType()); } catch (ConversionException ex) { logger.debug("Could not convert target", ex); errors.add(ex.getValidationMessage().withCategory(target.getName())); } catch (IllegalStateException e) { logger.debug("An error occured while getting validation message", e); return setPropertiesAfterConversions(target, parameters); } return null; }
Source:
<code>protected Command getCommand() { Request request = getSourceRequest(); if (request instanceof MoveArrowRequest) { ICommand moveArrowCommand = new AbstractTransactionalCommand(editingDomain, "Move arrow", null) { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Connector connector = (Connector) durationLinkEditPart.getNotationView(); <START> IntValueStyle deltaStyle = (IntValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), "delta"); <END> if (deltaStyle == null) { deltaStyle = (IntValueStyle) connector.createStyle(NotationPackage.eINSTANCE.getIntValueStyle()); deltaStyle.setName("delta"); } Point moveDelta = ((MoveArrowRequest) request).getMoveDelta(); Orientation arrowOrientation = ((MoveArrowRequest) request).getArrowOrientation(); if (arrowOrientation == Orientation.VERTICAL) { deltaStyle.setIntValue(deltaStyle.getIntValue() + moveDelta.x); } else { deltaStyle.setIntValue(deltaStyle.getIntValue() + moveDelta.y); } return CommandResult.newOKCommandResult(); } }; return new ICommandProxy(moveArrowCommand); } return super.getCommand(); }</code><technical_language>a trick here: Named Styles compatible CSS, means if a CSS exists declares "delta" property, IntValueStyle non-null. However, a transient style, changes style ignored. want this user-driven (And CSS-driven), need iterate View's style list manually (Instead of getNamedStyle method)</technical_language>

Target:
protected Command getCommand() { Request request = getSourceRequest(); if (request instanceof MoveArrowRequest) { ICommand moveArrowCommand = new AbstractTransactionalCommand(editingDomain, "Move arrow", null) { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Connector connector = (Connector) durationLinkEditPart.getNotationView(); @SuppressWarnings("unchecked") Optional<IntValueStyle> deltaOptional = connector.getStyles().stream().filter(IntValueStyle.class::isInstance).filter(style -> "delta".equals(((IntValueStyle) style).getName())).findFirst(); IntValueStyle deltaStyle = deltaOptional.orElseGet(() -> { IntValueStyle style = (IntValueStyle) connector.createStyle(NotationPackage.eINSTANCE.getIntValueStyle()); style.setName("delta"); return style; }); Point moveDelta = ((MoveArrowRequest) request).getMoveDelta(); Orientation arrowOrientation = ((MoveArrowRequest) request).getArrowOrientation(); if (arrowOrientation == Orientation.VERTICAL) { deltaStyle.setIntValue(deltaStyle.getIntValue() + moveDelta.x); } else { deltaStyle.setIntValue(deltaStyle.getIntValue() + moveDelta.y); } return CommandResult.newOKCommandResult(); } }; return new ICommandProxy(moveArrowCommand); } return super.getCommand(); }
Source:
<code>public FongoDB(Fongo fongo, String name) { <START> super(fongo.getMongoClient(), name); <END> this.fongo = fongo; }</code><technical_language>need for this</technical_language>

Target:
public FongoDB(Fongo fongo, String name) { super(fongo.getMongo(), name); this.fongo = fongo; }
Source:
<code><START> public static boolean isChimeric(final SAMRecord r1, final SAMRecord r2, final int maxInsertSize, final Set<PairOrientation> expectedOrientations) { <END> return (Math.abs(r1.getInferredInsertSize()) > maxInsertSize || !r1.getReferenceIndex().equals(r2.getReferenceIndex()) || expectedOrientations.contains(SamPairUtil.getPairOrientation(r1)) || r1.getAttribute("SA") != null || r2.getAttribute("SA") != null); }</code><technical_language>Similarly, I this test reads mapped, explicitly state read mapped</technical_language>

Target:
public static boolean isChimeric(final SAMRecord r1, final SAMRecord r2, final int maxInsertSize, final Set<PairOrientation> expectedOrientations) { return !(r1.getReadUnmappedFlag() || r2.getMateUnmappedFlag()) && (Math.abs(r1.getInferredInsertSize()) > maxInsertSize || !r1.getReferenceIndex().equals(r2.getReferenceIndex()) || expectedOrientations.contains(SamPairUtil.getPairOrientation(r1)) || r1.getAttribute("SA") != null || r2.getAttribute("SA") != null); }
Source:
<code>public void updateApplicationKeyTypeMetaData(int applicationId, String keyType, String keyManagerName, OAuthApplicationInfo updatedAppInfo) throws APIManagementException { <START> if (applicationId != -1 && updatedAppInfo != null) { <END> String addApplicationKeyMapping = SQLConstants.UPDATE_APPLICATION_KEY_TYPE_MAPPINGS_METADATA_SQL; try (Connection connection = APIMgtDBUtil.getConnection()) { connection.setAutoCommit(false); try { try (PreparedStatement ps = connection.prepareStatement(addApplicationKeyMapping)) { String content = new Gson().toJson(updatedAppInfo); ps.setBinaryStream(1, new ByteArrayInputStream(content.getBytes())); ps.setInt(2, applicationId); ps.setString(3, keyType); ps.setString(4, keyManagerName); ps.executeUpdate(); } connection.commit(); } catch (SQLException e) { connection.rollback(); } } catch (SQLException e) { handleException("Error updating the Application Metadata of the AM_APPLICATION_KEY_MAPPING table " + "where " + "APPLICATION_ID = " + applicationId + " and KEY_TYPE = " + keyType, e); } } }</code><technical_language>applicationId > 0 it</technical_language>

Target:
public void updateApplicationKeyTypeMetaData(int applicationId, String keyType, String keyManagerName, OAuthApplicationInfo updatedAppInfo) throws APIManagementException { if (applicationId > 0 && updatedAppInfo != null) { String addApplicationKeyMapping = SQLConstants.UPDATE_APPLICATION_KEY_TYPE_MAPPINGS_METADATA_SQL; try (Connection connection = APIMgtDBUtil.getConnection()) { connection.setAutoCommit(false); try { try (PreparedStatement ps = connection.prepareStatement(addApplicationKeyMapping)) { String content = new Gson().toJson(updatedAppInfo); ps.setBinaryStream(1, new ByteArrayInputStream(content.getBytes())); ps.setInt(2, applicationId); ps.setString(3, keyType); ps.setString(4, keyManagerName); ps.executeUpdate(); } connection.commit(); } catch (SQLException e) { connection.rollback(); } } catch (SQLException e) { handleException("Error updating the Application Metadata of the AM_APPLICATION_KEY_MAPPING table " + "where " + "APPLICATION_ID = " + applicationId + " and KEY_TYPE = " + keyType, e); } } }
Source:
<code><START> public IOService next() { <END> return INSTANCE.IOIteratorNext(this); }</code><technical_language>IOIterator return IOServices? If not, a valid option next a parameter targetClass (subclass of IOObject) rewrap returned IOObject</technical_language>

Target:
public IORegistryEntry next() { return INSTANCE.IOIteratorNext(this); }
Source:
<code>private AsyncCleanerService(Elide elide, Integer maxRunTimeSeconds, Integer queryCleanupDays, Integer cancelDelaySeconds, AsyncQueryDAO asyncQueryDao) { int queryRunTimeThresholdMinutes = Math.round((maxRunTimeSeconds * 2) / 60); ScheduledExecutorService cleaner = Executors.newSingleThreadScheduledExecutor(); AsyncQueryCleanerThread cleanUpTask = new AsyncQueryCleanerThread(queryRunTimeThresholdMinutes, elide, queryCleanupDays, asyncQueryDao); Random random = new Random(); <START> int initialDelayMinutes = random.ints(0, maxInitialDelayMinutes).limit(1).findFirst().getAsInt(); <END> log.debug("Initial Delay for cleaner service is {}", initialDelayMinutes); cleaner.scheduleWithFixedDelay(cleanUpTask, 0, Math.max(defaultCleanupDelayMinutes, queryRunTimeThresholdMinutes), TimeUnit.MINUTES); ScheduledExecutorService cancellation = Executors.newSingleThreadScheduledExecutor(); AsyncQueryCancelThread cancelTask = new AsyncQueryCancelThread(maxRunTimeSeconds, elide, asyncQueryDao); cancellation.scheduleWithFixedDelay(cancelTask, 0, cancelDelaySeconds, TimeUnit.SECONDS); }</code><technical_language>This variable is more, removed</technical_language>

Target:
private AsyncCleanerService(Elide elide, Integer maxRunTimeSeconds, Integer queryCleanupDays, Integer cancelDelaySeconds, AsyncQueryDAO asyncQueryDao) { int queryRunTimeThresholdMinutes = Math.round((maxRunTimeSeconds * 2) / 60); ScheduledExecutorService cleaner = Executors.newSingleThreadScheduledExecutor(); AsyncQueryCleanerThread cleanUpTask = new AsyncQueryCleanerThread(queryRunTimeThresholdMinutes, elide, queryCleanupDays, asyncQueryDao, new DateUtil()); Random random = new Random(); int initialDelayMinutes = random.ints(0, maxInitialDelayMinutes).limit(1).findFirst().getAsInt(); log.debug("Initial Delay for cleaner service is {}", initialDelayMinutes); cleaner.scheduleWithFixedDelay(cleanUpTask, initialDelayMinutes, Math.max(defaultCleanupDelayMinutes, queryRunTimeThresholdMinutes), TimeUnit.MINUTES); ScheduledExecutorService cancellation = Executors.newSingleThreadScheduledExecutor(); AsyncQueryCancelThread cancelTask = new AsyncQueryCancelThread(maxRunTimeSeconds, elide, asyncQueryDao); cancellation.scheduleWithFixedDelay(cancelTask, 0, cancelDelaySeconds, TimeUnit.SECONDS); }
Source:
<code>private void testParameter(List<String> args) { if (containsHelpRequest(args) || args.isEmpty()) { testParameterHelp(); } else if (!args.isEmpty()) { String entry = reqVal(args, "--entry"); String version = reqVal(args, "--version"); String descriptorType = null; final List<String> adds = optVals(args, "--add"); final List<String> removes = optVals(args, "--remove"); if (getEntryType().toLowerCase().equals("tool")) { descriptorType = reqVal(args, "--descriptor-type"); descriptorType = descriptorType.toLowerCase(); <START> if (!descriptorType.equals(CWL_STRING) && !descriptorType.equals(WDL_STRING)) { <END> errorMessage("Only \'CWL\' and \'WDL\' are valid descriptor types", CLIENT_ERROR); } } handleTestParameter(entry, version, adds, removes, descriptorType); } }</code><technical_language>a big deal, in future useful loop enum in case forced add another descriptor type road</technical_language>

Target:
private void testParameter(List<String> args) { if (containsHelpRequest(args) || args.isEmpty()) { testParameterHelp(); } else if (!args.isEmpty()) { String entry = reqVal(args, "--entry"); String version = reqVal(args, "--version"); String descriptorType = null; final List<String> adds = optVals(args, "--add"); final List<String> removes = optVals(args, "--remove"); if (getEntryType().toLowerCase().equals("tool")) { descriptorType = reqVal(args, "--descriptor-type"); descriptorType = descriptorType.toLowerCase(); boolean validType = false; for (Type type : Type.values()) { if (type.toString().equals(descriptorType) && !descriptorType.equals("none")) { validType = true; break; } } if (!validType) { errorMessage("Only \'CWL\' and \'WDL\' are valid descriptor types", CLIENT_ERROR); } } handleTestParameter(entry, version, adds, removes, descriptorType); } }
Source:
<code>private void addLabel(PropertyType type, String value) { Label description = new Label(type.description()); description.getStyleClass().add("property-header"); Label label = new Label(value); <START> label.getStyleClass().add("property-info"); <END> propertyPane.getChildren().add(new VBox(description, label)); }</code><technical_language>Label in this class need this style class? If so, PropertyPaneController Label more in CSS</technical_language>

Target:
private void addLabel(PropertyType type, String value) { Label description = new Label(type.description()); description.getStyleClass().add("property-header"); Node label = new Label(value); label.getStyleClass().add("property-info"); if (value != null && value.length() > MAX_PROPERTY_SIZE) { ScrollPane sp = new ScrollPane(label); sp.setFitToWidth(true); sp.setPrefHeight(WIDTH); label = sp; } propertyPane.getChildren().add(new VBox(description, label)); }
Source:
<code>public MetadataResult<ComponentMetadataDescriptor<T>> getMetadata(MetadataContext context, ParameterValueResolver metadataKeyResolver, ReflectionCache reflectionCache) { try { Object keyValue; MetadataResult keyValueResult = getMetadataKeyObjectValue(metadataKeyResolver); if (!keyValueResult.isSuccess()) { return keyValueResult; } keyValue = keyValueResult.get(); <START> if (keyValue == null && !keyIdObjectResolver.isKeyRequired()) { <END> return failure(newFailure().withFailureCode(INVALID_METADATA_KEY).withMessage("MetadataKey resolved to null") .onComponent()); } MetadataAttributes.MetadataAttributesBuilder builder = MetadataAttributes.builder(); if (!keyIdObjectResolver.isKeyLess()) { builder.withKey(keyIdObjectResolver.reconstructKeyFromType(keyValue, reflectionCache)); } return getMetadata(context, keyValue, builder); } catch (MetadataResolvingException e) { return failure(newFailure(e).onComponent()); } }</code><technical_language>I this fail if key is required. this fail key is required</technical_language>

Target:
public MetadataResult<ComponentMetadataDescriptor<T>> getMetadata(MetadataContext context, ParameterValueResolver metadataKeyResolver, ReflectionCache reflectionCache) { try { Object keyValue; MetadataResult keyValueResult = getMetadataKeyObjectValue(metadataKeyResolver); if (!keyValueResult.isSuccess()) { return keyValueResult; } keyValue = keyValueResult.get(); if (keyValue == null && keyIdObjectResolver.isKeyRequired()) { return failure(newFailure().withFailureCode(INVALID_METADATA_KEY).withMessage("MetadataKey resolved to null") .onComponent()); } MetadataAttributes.MetadataAttributesBuilder builder = MetadataAttributes.builder(); if (!keyIdObjectResolver.isKeyLess()) { builder.withKey(keyIdObjectResolver.reconstructKeyFromType(keyValue, reflectionCache)); } return getMetadata(context, keyValue, builder); } catch (MetadataResolvingException e) { return failure(newFailure(e).onComponent()); } }
Source:
<code>public boolean isConnected() { <START> return this == CONNECTED || this == RECONNECTED || this == READ_ONLY; <END> }</code><technical_language>prefer this abstract method enum return correct</technical_language>

Target:
public boolean isConnected() { return true; }
Source:
<code>public WorkspaceImpl updateWorkspace(String id, Workspace update) throws ConflictException, ServerException, NotFoundException, ValidationException { requireNonNull(id, "Required non-null workspace id"); requireNonNull(update, "Required non-null workspace update"); checkArgument( update.getConfig() != null || update.getDevfile() != null, <START> "Required non-null workspace configuration or devfile update"); <END> if (update.getConfig() != null) { validator.validateConfig(update.getConfig()); } validator.validateAttributes(update.getAttributes()); WorkspaceImpl workspace = workspaceDao.get(id); if (workspace.getConfig() != null) { workspace.setConfig(new WorkspaceConfigImpl(update.getConfig())); } if (workspace.getDevfile() != null) { workspace.setDevfile(new DevfileImpl(update.getDevfile())); } workspace.setAttributes(update.getAttributes()); workspace.getAttributes().put(UPDATED_ATTRIBUTE_NAME, Long.toString(currentTimeMillis())); workspace.setTemporary(update.isTemporary()); return normalizeState(workspaceDao.update(workspace), true); }</code><technical_language>sense check config + devfile present</technical_language>

Target:
public WorkspaceImpl updateWorkspace(String id, Workspace update) throws ConflictException, ServerException, NotFoundException, ValidationException { requireNonNull(id, "Required non-null workspace id"); requireNonNull(update, "Required non-null workspace update"); checkArgument( update.getConfig() != null ^ update.getDevfile() != null, "Required non-null workspace configuration or devfile update but not both"); if (update.getConfig() != null) { validator.validateConfig(update.getConfig()); } validator.validateAttributes(update.getAttributes()); WorkspaceImpl workspace = workspaceDao.get(id); if (workspace.getConfig() != null) { workspace.setConfig(new WorkspaceConfigImpl(update.getConfig())); } if (workspace.getDevfile() != null) { workspace.setDevfile(new DevfileImpl(update.getDevfile())); } workspace.setAttributes(update.getAttributes()); workspace.getAttributes().put(UPDATED_ATTRIBUTE_NAME, Long.toString(currentTimeMillis())); workspace.setTemporary(update.isTemporary()); return normalizeState(workspaceDao.update(workspace), true); }
Source:
<code>public SparseHll(Slice serialized) { BasicSliceInput input = serialized.getInput(); checkArgument(input.readUnsignedByte() == (SPARSE_TAG | VERSION), "Wrong type/version"); indexBitLength = input.readByte(); numberOfHashes = input.readShort(); numberOfOverflows = input.readShort(); shortHashes = new short[numberOfHashes]; for (int i = 0; i < numberOfHashes; i++) { shortHashes[i] = input.readShort(); } overflows = new short[numberOfOverflows]; for (int i = 0; i < numberOfOverflows; i++) { overflows[i] = input.readShort(); } <START> } <END></code><technical_language>Validate input is exhausted</technical_language>

Target:
public SparseHll(Slice serialized) { BasicSliceInput input = serialized.getInput(); checkArgument(input.readByte() == Format.SPARSE_V1.getTag(), "invalid format tag"); indexBitLength = input.readByte(); checkArgument(indexBitLength >= 1 && indexBitLength <= 13, "indexBitLength is out of range"); numberOfHashes = input.readShort(); numberOfOverflows = input.readShort(); shortHashes = new short[numberOfHashes]; for (int i = 0; i < numberOfHashes; i++) { shortHashes[i] = input.readShort(); } overflows = new short[numberOfOverflows]; for (int i = 0; i < numberOfOverflows; i++) { overflows[i] = input.readShort(); } checkArgument(!input.isReadable(), "input is too big"); }
Source:
<code>@Override protected UnifyResult apply(UnifyRuleCall call) { final MutableScan query = (MutableScan) call.query; final MutableCalc target = (MutableCalc) call.target; final MutableScan targetInput = (MutableScan) target.getInput(); final Pair<RexNode, List<RexNode>> targetExplained = explainCalc(target); final RexNode targetCond = targetExplained.left; final List<RexNode> targetProjs = targetExplained.right; final RexBuilder rexBuilder = call.getCluster().getRexBuilder(); <START> if (query.equals(targetInput) && targetCond.isAlwaysTrue()) { <END> final RexShuttle shuttle = getRexShuttle(targetProjs); final List<RexNode> compenProjs; try { compenProjs = (List<RexNode>) shuttle.apply(rexBuilder.identityProjects(query.rowType)); } catch (MatchFailed e) { return null; } if (RexUtil.isIdentity(compenProjs, target.rowType)) { return call.result(target); } else { RexProgram compenRexProgram = RexProgram.create( target.rowType, compenProjs, null, query.rowType, rexBuilder); MutableCalc compenCalc = MutableCalc.of(target, compenRexProgram); return tryMergeParentCalcAndGenResult(call, compenCalc); } } return null; }</code><technical_language>change if(!query.equals(targetInput) || !targetCond.isAlwaysTrue()) { return null; } .....</technical_language>

Target:
@Override protected UnifyResult apply(UnifyRuleCall call) { final MutableScan query = (MutableScan) call.query; final MutableCalc target = (MutableCalc) call.target; final MutableScan targetInput = (MutableScan) target.getInput(); final Pair<RexNode, List<RexNode>> targetExplained = explainCalc(target); final RexNode targetCond = targetExplained.left; final List<RexNode> targetProjs = targetExplained.right; final RexBuilder rexBuilder = call.getCluster().getRexBuilder(); if (!query.equals(targetInput) || !targetCond.isAlwaysTrue()) { return null; } final RexShuttle shuttle = getRexShuttle(targetProjs); final List<RexNode> compenProjs; try { compenProjs = (List<RexNode>) shuttle.apply( rexBuilder.identityProjects(query.rowType)); } catch (MatchFailed e) { return null; } if (RexUtil.isIdentity(compenProjs, target.rowType)) { return call.result(target); } else { RexProgram compenRexProgram = RexProgram.create( target.rowType, compenProjs, null, query.rowType, rexBuilder); MutableCalc compenCalc = MutableCalc.of(target, compenRexProgram); return tryMergeParentCalcAndGenResult(call, compenCalc); } }