Skip to content

Commit

Permalink
Drop ServiceLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Jan 13, 2025
1 parent 8d83b16 commit 5e26897
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.

This file was deleted.

10 changes: 5 additions & 5 deletions plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import PluginCompat.*
import sbt.librarymanagement.DependencyFilter

import java.io.File
import java.util.ServiceLoader

/** Plugin for generating the Java sources for Avro schemas and protocols. */
object SbtAvro extends AutoPlugin {
Expand Down Expand Up @@ -253,10 +252,11 @@ object SbtAvro extends AutoPlugin {
this.getClass.getClassLoader
)

val compiler = ServiceLoader
.load(classOf[AvroCompiler], avroClassLoader)
.iterator()
.next()
val compiler = avroClassLoader
.loadClass(avroCompiler.value)
.getDeclaredConstructor()
.newInstance()
.asInstanceOf[AvroCompiler]

compiler.setStringType(avroStringType.value)
compiler.setFieldVisibility(avroFieldVisibility.value.toUpperCase)
Expand Down

0 comments on commit 5e26897

Please sign in to comment.