Skip to content

Commit

Permalink
Fixes findMainClass errors in Groovy 4
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Mar 18, 2024
1 parent ac95fbe commit 8906586
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@ import groovyjarjarasm.asm.ClassReader
import groovyjarjarasm.asm.ClassVisitor
import groovyjarjarasm.asm.MethodVisitor
import groovyjarjarasm.asm.Opcodes
import org.springframework.asm.SpringAsmInfo
import groovyjarjarasm.asm.Type

import grails.util.BuildSettings
Expand Down Expand Up @@ -157,10 +156,15 @@ class MainClassFinder {
}
}
if (file.isDirectory()) {
Collection<File> files = file.listFiles()?.findAll { File f ->
(f.isDirectory() && !f.name.startsWith('.') && !f.hidden) ||
(f.isFile() && f.name.endsWith(GrailsResourceUtils.CLASS_EXTENSION))
}
File[] files = file.listFiles(new FileFilter() {

@Override
boolean accept(File f) {
(f.isDirectory() && !f.name.startsWith('.') && !f.hidden) ||
(f.isFile() && f.name.endsWith(GrailsResourceUtils.CLASS_EXTENSION))
}

})

if (files) {
for (File sub in files) {
Expand All @@ -187,7 +191,7 @@ class MainClassFinder {
boolean found = false

MainMethodFinder() {
super(SpringAsmInfo.ASM_VERSION)
super(Opcodes.ASM9)
}

@Override
Expand Down

0 comments on commit 8906586

Please sign in to comment.