Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ allprojects {

// Documentation required libraries
groovyDoc 'org.fusesource.jansi:jansi:2.4.0'
groovyDoc "org.apache.groovy:groovy-groovydoc:4.0.30"
groovyDoc "org.apache.groovy:groovy-ant:4.0.30"
groovyDoc "org.apache.groovy:groovy-groovydoc:5.0.4"
groovyDoc "org.apache.groovy:groovy-ant:5.0.4"
}

test {
Expand Down
18 changes: 9 additions & 9 deletions modules/nextflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ dependencies {
api(project(':nf-commons'))
api(project(':nf-httpfs'))
api(project(':nf-lang'))
api "org.apache.groovy:groovy:4.0.30"
api "org.apache.groovy:groovy-nio:4.0.30"
api "org.apache.groovy:groovy-xml:4.0.30"
api "org.apache.groovy:groovy-json:4.0.30"
api "org.apache.groovy:groovy-templates:4.0.30"
api "org.apache.groovy:groovy-yaml:4.0.30"
api "org.apache.groovy:groovy:5.0.4"
api "org.apache.groovy:groovy-nio:5.0.4"
api "org.apache.groovy:groovy-xml:5.0.4"
api "org.apache.groovy:groovy-json:5.0.4"
api "org.apache.groovy:groovy-templates:5.0.4"
api "org.apache.groovy:groovy-yaml:5.0.4"
api "org.slf4j:jcl-over-slf4j:2.0.17"
api "org.slf4j:jul-to-slf4j:2.0.17"
api "org.slf4j:log4j-over-slf4j:2.0.17"
Expand Down Expand Up @@ -58,11 +58,11 @@ dependencies {
testImplementation 'org.subethamail:subethasmtp:3.1.7'
testImplementation (project(':nf-lineage'))
// test configuration
testFixturesApi ("org.apache.groovy:groovy-test:4.0.30") { exclude group: 'org.apache.groovy' }
testFixturesApi ("org.apache.groovy:groovy-test:5.0.4") { exclude group: 'org.apache.groovy' }
testFixturesApi ("org.objenesis:objenesis:3.4")
testFixturesApi ("net.bytebuddy:byte-buddy:1.14.17")
testFixturesApi ("org.spockframework:spock-core:2.4-groovy-4.0") { exclude group: 'org.apache.groovy' }
testFixturesApi ('org.spockframework:spock-junit4:2.4-groovy-4.0') { exclude group: 'org.apache.groovy' }
testFixturesApi ("org.spockframework:spock-core:2.4-groovy-5.0") { exclude group: 'org.apache.groovy' }
testFixturesApi ('org.spockframework:spock-junit4:2.4-groovy-5.0') { exclude group: 'org.apache.groovy' }
testFixturesApi 'com.google.jimfs:jimfs:1.2'
// note: declare as separate dependency to avoid a circular dependency
lineageImplementation (project(':nf-lineage'))
Expand Down
2 changes: 1 addition & 1 deletion modules/nextflow/src/main/groovy/nextflow/Session.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ class Session implements ISession {
def fetchContainers() {

def result = [:]
if( config.process instanceof Map<String,?> ) {
if( config.process instanceof Map ) {

/*
* look for `container` definition at process level
Expand Down
6 changes: 4 additions & 2 deletions modules/nextflow/src/main/groovy/nextflow/cli/CmdLog.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class CmdLog extends CmdBase implements CacheBase {
/**
* Wrap a {@link TraceRecord} instance as a {@link Map} or a {@link Binding} object
*/
@Slf4j
private static class TraceAdaptor extends Binding {

static private int MAX_LINES = 100
Expand Down Expand Up @@ -299,13 +300,14 @@ class CmdLog extends CmdBase implements CacheBase {
def result = new StringBuilder()
path.withReader { reader ->
String line
while( (line=reader.readLine()) && c++<MAX_LINES ) {
// MAX_LINES must be cast to `int` in order to satisfy type checker
// seems to be caused by the delegate
while( (line=reader.readLine()) && c++ < (int)MAX_LINES ) {
result << line << '\n'
}
}

result.toString() ?: TraceRecord.NA

}
catch( IOError e ) {
log.debug "Failed to fetch content for file: $path -- Cause: ${e.message ?: e}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class ExecutorFactory {

@PackageScope Map<String, Class<? extends Executor>> executorsMap

private Map<Class<? extends Executor>,? extends Executor> executors = new HashMap<>()
private Map<Class<? extends Executor>,Executor> executors = new HashMap<>()

@PackageScope Map<Class<? extends Executor>,? extends Executor> getExecutors() { executors }
@PackageScope Map<Class<? extends Executor>,Executor> getExecutors() { executors }

ExecutorFactory() {
init0(Collections.<Class<Executor>>emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class CombineOp {
}

CombineOp setPivot( pivot ) {
this.pivot = (List<Integer>)(pivot instanceof List<Integer> ? pivot : [pivot])
this.pivot = (List<Integer>)(pivot instanceof List ? pivot : [pivot])
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class DumpOp {

DumpOp(Map opts, Closure<String> renderer) {
checkParams('dump', opts, PARAMS_DUMP)
this.source = source
this.tag = opts.tag
this.pretty = opts.pretty ?: false
this.renderer = renderer
Expand All @@ -75,11 +74,8 @@ class DumpOp {

DataflowWriteChannel apply() {

if( !isEnabled() ) {
if( source instanceof DataflowWriteChannel )
return (DataflowWriteChannel)source
if( !isEnabled() )
throw new IllegalArgumentException("Illegal dump operator source channel")
}

final target = CH.createBy(source)
final events = new HashMap(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class PublishOp {
this.source = source
this.publishOpts = opts
this.path = opts.path as String
if( opts.pathResolver instanceof Closure )
this.pathResolver = opts.pathResolver as Closure
if( opts.pathResolver instanceof Closure cl )
this.pathResolver = cl
if( opts.index )
this.indexOpts = new IndexOpts(opts.index as Map)
}
Expand Down Expand Up @@ -161,7 +161,7 @@ class PublishOp {
// if the closure contained publish statements, use
// the resulting mapping to create a saveAs closure
final mapping = dsl.build()
if( mapping instanceof Map<String,String> )
if( mapping instanceof Map )
return { filename -> filename in mapping ? outputDir.resolve(mapping[filename]) : null }

// if the resolved publish path is a string, resolve it
Expand All @@ -182,11 +182,11 @@ class PublishOp {
if( source instanceof Path ) {
publish0(source, target)
}
else if( source instanceof Collection<Path> ) {
else if( source instanceof Collection ) {
if( !target.endsWith('/') )
throw new ScriptRuntimeException("Invalid publish target '${target}' for workflow output '${name}' -- should be a directory (end with a `/`) when publishing a collection of files")
for( final path : source )
publish0(path, target)
publish0((Path) path, target)
}
else {
throw new ScriptRuntimeException("Invalid publish source for workflow output '${name}' -- expected a file or collection of files, but received: ${source} [${source.class.simpleName}]")
Expand Down Expand Up @@ -293,7 +293,7 @@ class PublishOp {
return value.collect { el ->
if( el instanceof Path )
return normalizePath(el, targetResolver)
if( el instanceof Collection<Path> )
if( el instanceof Collection )
return normalizeValue(el, targetResolver)
if( el instanceof Map )
return normalizeValue(el, targetResolver)
Expand All @@ -305,7 +305,7 @@ class PublishOp {
return value.collectEntries { k, v ->
if( v instanceof Path )
return [k, normalizePath(v, targetResolver)]
if( v instanceof Collection<Path> )
if( v instanceof Collection )
return [k, normalizeValue(v, targetResolver)]
if( v instanceof Map )
return [k, normalizeValue(v, targetResolver)]
Expand All @@ -332,7 +332,7 @@ class PublishOp {

// if the target resolver is a closure, use it to transform
// the source filename to the target path
if( targetResolver instanceof Closure<Path> ) {
if( targetResolver instanceof Closure ) {
// note: the closure can return null to e.g. not
// publish specific files
final relPath = sourceDir.relativize(path).toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class SplitOp {
multiSplit = true
pairedEnd = true
}
if( params.elem instanceof List<Integer> ) {
if( params.elem instanceof List ) {
indexes = params.elem as List<Integer>
multiSplit = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface DirListener {
* @param events the list of events to watch
* @return
*/
default WatchEvent.Kind<Path>[] stringToWatchEvents(String events = null){
default WatchEvent.Kind<Path>[] stringToWatchEvents(String events) {
def result = []
if( !events )
result << ENTRY_CREATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class PublishDir {

void setPath( def value ) {
final resolved = value instanceof Closure ? value.call() : value
if( resolved instanceof String || resolved instanceof GString )
if( resolved instanceof CharSequence )
nullPathWarn = checkNull(resolved.toString())
this.path = FileHelper.toCanonicalPath(resolved)
}
Expand All @@ -169,7 +169,7 @@ class PublishDir {
? tags.call()
: tags

if( result instanceof Map<String,String> )
if( result instanceof Map )
return result

throw new IllegalArgumentException("Invalid publishDir tags attribute: $tags")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class TaskConfig extends LazyMap implements Cloneable {
this.cache.clear()

// set the binding context for 'ext' map
if( target.ext instanceof LazyMap )
(target.ext as LazyMap).binding = context
if( getTarget().ext instanceof LazyMap ext )
ext.binding = context

// set the this object in the task context in order to allow task properties to be resolved in process script
context.put(TASK_CONTEXT_PROPERTY_NAME, this)
Expand Down Expand Up @@ -133,7 +133,7 @@ class TaskConfig extends LazyMap implements Cloneable {
}

final getRawValue(String key) {
return target.get(key)
return getTarget().get(key)
}

def get( String key ) {
Expand All @@ -142,11 +142,11 @@ class TaskConfig extends LazyMap implements Cloneable {

def result
if( key == 'ext' ) {
if( target.containsKey(key) )
result = target.get(key)
if( getTarget().containsKey(key) )
result = getTarget().get(key)
else {
result = new LazyMap()
target.put(key, result)
getTarget().put(key, result)
}
}
else
Expand All @@ -167,7 +167,7 @@ class TaskConfig extends LazyMap implements Cloneable {
super.setDynamic(flag)
}
}
target.put(key, value)
getTarget().put(key, value)
}
else if( key == 'ext' && value instanceof Map ) {
super.put( key, new LazyMap(value) )
Expand All @@ -181,8 +181,8 @@ class TaskConfig extends LazyMap implements Cloneable {
if( super.isDynamic() )
return true

if( target.ext instanceof LazyMap )
return (target.ext as LazyMap).isDynamic()
if( getTarget().ext instanceof LazyMap ext )
return ext.isDynamic()

return false
}
Expand Down Expand Up @@ -551,7 +551,7 @@ class TaskConfig extends LazyMap implements Cloneable {
*/
protected boolean getWhenGuard(boolean defValue=true) throws FailedGuardException {

final code = target.get(NextflowDSLImpl.PROCESS_WHEN)
final code = getTarget().get(NextflowDSLImpl.PROCESS_WHEN)
if( code == null )
return defValue

Expand All @@ -571,7 +571,7 @@ class TaskConfig extends LazyMap implements Cloneable {


protected TaskClosure getStubBlock() {
final code = target.get(NextflowDSLImpl.PROCESS_STUB)
final code = getTarget().get(NextflowDSLImpl.PROCESS_STUB)
if( !code )
return null
if( code instanceof TaskClosure )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ class TaskProcessor {
if( value instanceof Path ) {
files.add((Path)value)
}
else if( value instanceof Collection<Path> ) {
else if( value instanceof Collection ) {
files.addAll(value)
}
else if( value != null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,8 @@ class AssetManager implements Closeable {
return

List<String> filter = []
if( modules instanceof List<String> ) {
filter.addAll(modules)
if( modules instanceof List ) {
filter.addAll(modules as List<String>)
}
else if( modules instanceof String ) {
filter.addAll( modules.tokenize(', ') )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ trait IterableDef {
}

private DataflowWriteChannel accumulator(DataflowReadChannel source, int i) {
final mapper = { value -> accumulators[i].add(value); return accumulators[i].clone() }
final mapper = { value ->
final next = new ArrayList<>(accumulators[i])
next.add(value)
return next
}
return new MapOp(source, mapper).apply()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ProcessDef extends BindableDef implements IterableDef, ChainableDef {
def result = clone()
result.@processName = name
result.@simpleName = stripScope(name)
result.@processConfig.processName = name
result.@processConfig.setProcessName(name)
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ class ScriptBinding extends WorkflowBinding {
// create and populate args
args = new ArrayList<>()
if( vars.args ) {
if( !(vars.args instanceof List<String>) ) throw new IllegalArgumentException("ScriptBinding 'args' must be a List value")
if( vars.args !instanceof List )
throw new IllegalArgumentException("ScriptBinding 'args' must be a List value")
args.addAll((List<String>)vars.args)
}
vars.put('args', args)

// create and populate params
params = new ParamsMap()
if( vars.params ) {
if( !(vars.params instanceof Map) ) throw new IllegalArgumentException("ScriptBinding 'params' must be a Map value")
if( vars.params !instanceof Map )
throw new IllegalArgumentException("ScriptBinding 'params' must be a Map value")
params.putAll((Map)vars.params)
}
vars.params = params
Expand Down Expand Up @@ -210,6 +212,7 @@ class ScriptBinding extends WorkflowBinding {
/**
* Implements immutable params map
*/
@Slf4j
@CompileStatic
static class ParamsMap implements Map<String,Object> {

Expand Down Expand Up @@ -244,7 +247,7 @@ class ScriptBinding extends WorkflowBinding {
final msg = "Access to undefined parameter `$key` -- Initialise it to a default value eg. `params.$key = some_value`"
if( NF.isStrictMode() )
throw new AbortOperationException(msg)
log.warn1(msg, firstOnly: true)
log.warn1(msg)
return null
}
return target.get(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ class ProcessConfigBuilder extends ProcessBuilder {
continue

if( entry.key == 'ext' ) {
if( config.getProperty('ext') instanceof Map ) {
final ext = config.getProperty('ext')
if( ext instanceof Map ) {
// update missing 'ext' properties found in 'process' scope
final ext = config.getProperty('ext') as Map
entry.value.each { String k, v -> ext[k] = v }
ext.putAll(entry.value as Map)
}
continue
}
Expand Down
Loading
Loading