In build.gradle files you can use File directly like
def file = new File("file.txt")
And even if you import java.io.File manually ide says it's unused
But at the same time ide says that File is java.io.File class
I wonder what approach was used to achieve this behavior
CodePudding user response:
Gradle builds on the standard java File class, so there is no need to import.
quote from docs:
In order to perform some action on a file, you need to know where it is, and that’s the information provided by file paths. Gradle builds on the standard Java File class, which represents the location of a single file, and provides new APIs for dealing with collections of paths.
More information, Check Working with Files at gradle official docs.