diff options
author | Luck <git@lucko.me> | 2024-07-18 18:13:46 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2024-07-18 18:13:46 +0100 |
commit | ed8eac595c26719571683cff7f3c9de2cfc28406 (patch) | |
tree | c23428d3539e6c315d89409094c001db057ba8cd /spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java | |
parent | 1b75abc56cdf01962b618e1f81d39c91558d2666 (diff) | |
download | spark-ed8eac595c26719571683cff7f3c9de2cfc28406.tar.gz spark-ed8eac595c26719571683cff7f3c9de2cfc28406.tar.bz2 spark-ed8eac595c26719571683cff7f3c9de2cfc28406.zip |
Refactor ClassFinder into interface
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java index a3bdceb..bf745df 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java @@ -33,6 +33,9 @@ import me.lucko.spark.common.sampler.source.ClassSourceLookup; import me.lucko.spark.common.sampler.source.SourceMetadata; import me.lucko.spark.common.tick.TickHook; import me.lucko.spark.common.tick.TickReporter; +import me.lucko.spark.common.util.classfinder.ClassFinder; +import me.lucko.spark.common.util.classfinder.FallbackClassFinder; +import me.lucko.spark.common.util.classfinder.InstrumentationClassFinder; import java.nio.file.Path; import java.util.Collection; @@ -150,6 +153,18 @@ public interface SparkPlugin { } /** + * Creates a class finder for the platform. + * + * @return the class finder + */ + default ClassFinder createClassFinder() { + return ClassFinder.combining( + new InstrumentationClassFinder(this), + FallbackClassFinder.INSTANCE + ); + } + + /** * Gets a list of known sources (plugins/mods) on the platform. * * @return a list of sources |