NocWriter / runsql-gradle-plugin

Gradle plugin for running SQL scripts
Apache License 2.0
3 stars 1 forks source link

Plugin need Java 11 and does not run with Java 8 #5

Closed falkoschumann closed 3 years ago

falkoschumann commented 3 years ago

When I run with Java 8, I get an NoSuchMethodError:

Caused by: java.lang.NoSuchMethodError: java.util.List.toArray(Ljava/util/function/IntFunction;)[Ljava/lang/Object;
    at com.nocwriter.runsql.gradle.ScriptsReader.readScriptFile(ScriptsReader.java:65)
    at com.nocwriter.runsql.gradle.ScriptsReader.lambda$fetchScripts$0(ScriptsReader.java:38)
    at com.nocwriter.runsql.gradle.ScriptsReader.fetchScripts(ScriptsReader.java:36)
    at com.nocwriter.runsql.gradle.RunSQLTask.execute(RunSQLTask.java:49)

The ScriptsReader is used a method toArray() introduced in Java 11.

See https://github.com/NocWriter/runsql-gradle-plugin/blob/e1fcd574adfca1980716c052943453777c0b59b9/src/main/java/com/nocwriter/runsql/gradle/ScriptsReader.java#L65

See https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#toArray(java.util.function.IntFunction)

guynir commented 3 years ago

Hi Falko.

I will refactor this piece of code to match Java 8 specs.

falkoschumann commented 3 years ago

Thanks, but I clone your repository and compile again Java 8, there are more issues like that.

guynir commented 3 years ago

OK.

Thanks for informing me.

If you find further issues, I'd appreciate your reports.

I published a new version at Gradle's plugins portal (1.0.2) with the fix you suggested.

falkoschumann commented 3 years ago

I found 2 more issues and create pull request #6.