LlamaLad7 / MixinExtras

Companion library to SpongePowered Mixin with many custom injectors for a more expressive experience.
MIT License
304 stars 17 forks source link

Java 8+ #9

Closed Gamebuster19901 closed 2 years ago

Gamebuster19901 commented 2 years ago

Is it possible to make this compatible with java 8+

I currently cannot use this because I get the following error:

gamebuster@gamebuster-Ryzen9-3900X-RTX-3080:~/Desktop/Modding/WildermythGameProvider$ ./gradlew build --info
Initialized native services in: /home/gamebuster/.gradle/native
The client will now receive all logging from the daemon (pid: 1159260). The daemon log file: /home/gamebuster/.gradle/daemon/7.1.1/daemon-1159260.out.log
Starting 24th build in daemon [uptime: 57 mins 53.899 secs, performance: 99%, non-heap usage: 51% of 256 MiB]
Using 24 worker leases.
Now considering [/home/gamebuster/Desktop/Modding/WildermythGameProvider] as hierarchies to watch
Watching the file system is enabled if available
Starting Build
Settings evaluated using settings file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/settings.gradle'.
Projects loaded. Root project using build file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/build.gradle'.
Included projects: [root project 'WildermythGameProvider']

> Configure project :
Evaluating root project 'WildermythGameProvider' using build file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/build.gradle'.
All projects evaluated.
Selected primary task 'build' from project :
Populating VCS workingDir MixinExtra_ekvol5eg59rv8qezjbdvgjak4/MixinExtras with ref 0.0.6: c948689427146f57d5bfb80eedc6efd62bdbcb7d
Now considering [/home/gamebuster/Desktop/Modding/WildermythGameProvider/.gradle/vcs-1/MixinExtra_ekvol5eg59rv8qezjbdvgjak4/MixinExtras, /home/gamebuster/Desktop/Modding/WildermythGameProvider] as hierarchies to watch

> Configure project :MixinExtras
Evaluating project ':MixinExtras' using build file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/.gradle/vcs-1/MixinExtra_ekvol5eg59rv8qezjbdvgjak4/MixinExtras/build.gradle.kts'.
Caching disabled for Kotlin DSL accessors for project ':MixinExtras' because:
  Build cache is disabled
Skipping Kotlin DSL accessors for project ':MixinExtras' as it is up-to-date.
Registering project ':MixinExtras' in composite build. Will substitute for module 'com.llamalad7:MixinExtras'.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':compileJava'.
> Could not resolve all task dependencies for configuration ':compileClasspath'.
   > Could not resolve com.llamalad7:MixinExtras:0.0.6.
     Required by:
         project :
      > No matching variant of project :MixinExtras was found. The consumer was configured to find an API of a library compatible with Java 9, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'apiElements' capability com.llamalad7:MixinExtras:0.0.6 declares an API of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 9
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'runtimeElements' capability com.llamalad7:MixinExtras:0.0.6 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 9
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 775ms

I also tried altering the build script myself to make it compatible with java 8, but I don't really know Kotlin, and it didn't work.

LlamaLad7 commented 2 years ago

Does this occur with any version java 9+, because I've used it in many java 16 and 17 projects with no issues.

Gamebuster19901 commented 2 years ago

It' occurs when using the release jar with java 9. I assume it's because the release jar was compiled with a later version.

Gamebuster19901 commented 2 years ago

Can confirm, if I compile with sourceCompatability and 'targetCompatabilityset to8`, I can use it with my java 9 project just fine.

https://github.com/WilderForge/MixinExtras/commit/413eb91c8a3ef11108be4bcc34b1d1e6f8bcc250

I can make it a PR if you want, but I'm not sure if it breaks anything, it's untested atm.

LlamaLad7 commented 2 years ago

Try with the latest release.

LlamaLad7 commented 2 years ago

I'm going to close this since it's been inactive for quite a while and I believe the issue is fixed in the last few releases. Feel free to reopen if you're still experiencing issues.