Automatically convert integers to doubles when argument type is double#823
Merged
Conversation
…ment type is `double`
5946aa3 to
dece396
Compare
DriesSchaumont
requested changes
Apr 23, 2025
| value = value.doubleValue() | ||
| } | ||
| if (value instanceof Float) { | ||
| if (value instanceof Float || value instanceof Integer || value instanceof Long) { |
Contributor
There was a problem hiding this comment.
Is Short and/or Double also a problem?
Contributor
Author
There was a problem hiding this comment.
I tried to resolve this by using a more idiomatic casting mechanism, namely:
// ...
} else if (par.type == "double") {
// cast to double if need be
if (value !instanceof Double) {
try {
value = value as Double
} catch (NumberFormatException e) {
expectedClass = "Double"
}
}
} // ...WDYT?
Co-authored-by: Dries Schaumont <5946712+DriesSchaumont@users.noreply.github.com>
DriesSchaumont
approved these changes
Apr 23, 2025
Contributor
DriesSchaumont
left a comment
There was a problem hiding this comment.
Looks OK. One thing I am wondering about is how hard it would be to refactor the if else structure into a hashmap and a loop.
Contributor
Author
|
let's do additional improvements in viash develop, or even in nf-viash ^^ |
rcannood
added a commit
that referenced
this pull request
Apr 24, 2025
* post release changes, update release guide * port of #823 * add pr number * copied 0.8.8 changelog entry * update version and changelog * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Robrecht Cannoodt <rcannood@gmail.com>
colobas
pushed a commit
to colobas/viash
that referenced
this pull request
May 13, 2025
rcannood
pushed a commit
that referenced
this pull request
Jun 12, 2025
#832) * Fix author names in paper (#644) * add paper * update paper * add more orcids * move figures * rename pipeline to workflow * add section on benefits * rewrite state of the field * solve issue with figure 3 * update bibtex * update bibtex again * broaden domain * update figure 2 based on @wilkinson's feedback * minor changes in paper (#628) * minor change * fix refactoring error * Add JOSS release info * update readme * Fix author names --------- Co-authored-by: Daniel S. Katz <d.katz@ieee.org> * use reflection to get viash to fix issue in nextflow edge (#812) * use reflection to get viash to fix issue in nextflow edge * add entry to changelog * Backport: Make sure scripts in Nextflow have the right extension (#815) * Backport: Make sure scripts in Nextflow have the right extension * fix changelog * Edit -- I'm going to port it in the different direction * Pass session as an argument (#818) * pass session as an argument * fix import * Prepare for release * post release changes, update release guide * Add entry for 0.8.7 * port of #823 * add pr number * copied 0.8.8 changelog entry * update version and changelog * Update CHANGELOG.md * Update CHANGELOG.md * post release changes * cherry pick 5271a3b * fix test * Remove deprecated things (#833) * wip deprecate things * fix components * fix test * update tests and yamls * fix test (recent versions of git require a message) * remove test code for removed functionality * Update CHANGELOG.md --------- Co-authored-by: Hendrik Cannoodt <hendrik.cannoodt@gmail.com> Co-authored-by: Daniel S. Katz <d.katz@ieee.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
This PR allows users to pass an integer to a double argument without Nextflow throwing an error about it being the wrong type.
This fix needs to be ported to Viash 0.9 and dev as well.
Related issue(s)
Closes #xxxx
Type of Change
Checklist
Requirements:
Tests:
Documentation:
Test Environment