Skip to content

Commit b00644c

Browse files
authored
Fix type casting in PluginSpec for ConfigScope [ci fast] (#6469)
Replace unsafe cast with explicit type checking and casting to ensure type safety when loading ConfigScope extension points. This prevents potential ClassCastException when loading classes that may not be ConfigScope implementations. Signed-off-by: Paolo Di Tommaso <[email protected]>
1 parent 3e3a938 commit b00644c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/nextflow/src/main/groovy/nextflow/plugin/spec/PluginSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ class PluginSpec {
4646
final definitions = []
4747

4848
for( final className : extensionPoints ) {
49-
final clazz = classLoader.loadClass(className) as Class<? extends ConfigScope>
49+
final clazz = classLoader.loadClass(className)
5050

5151
if( ConfigScope.class.isAssignableFrom(clazz) ) {
5252
final scopeName = clazz.getAnnotation(ScopeName)?.value()
5353
final description = clazz.getAnnotation(Description)?.value()
5454
if( !scopeName )
5555
continue
56-
final node = SchemaNode.Scope.of(clazz, description)
56+
final node = SchemaNode.Scope.of((Class<? extends ConfigScope>)clazz, description)
5757

5858
definitions.add(ConfigSpec.of(node, scopeName))
5959
}

0 commit comments

Comments
 (0)