Skip to content

Java 25 support #1922

@bcmedeiros

Description

@bcmedeiros

Java 25 is the latest LTS and was released a couple of months ago in Sep 2025: https://openjdk.org/projects/jdk/25/

If you need AOP support, version 7.0.0 doesn't currently work. A related issue has already been reported, but I think we should track Java 25 support independently.

#1822

Workaround:
If you don't need AOP features, you can use:

<dependency>
    <groupId>com.google.inject</groupId>
    <artifactId>guice</artifactId>
    <version>7.0.0</version>
    <classifier>no_aop</classifier>
</dependency>

As pointed below, there's no no_aop anymore. The issue was resolved because of some dependency management declarations in the POM and is probably not a general issue.

The only issue I can now reproduce is the following warning:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:/home/bruno/.m2/repository/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release

Running this code:

static class C1 {
    private final String s1;
    @Inject C1(String s) { s1 = s; }

    public String getS1() { return s1; }
}

void main() {

    var module = new AbstractModule() {
        @Override
        protected void configure() {
            bind(String.class).toInstance("Hello, Guice!");
            bind(C1.class);
            bindInterceptor(Matchers.any(), Matchers.any(), new MethodInterceptor() {
                @Override
                public Object invoke(MethodInvocation methodInvocation) throws Throwable {
                    IO.println("Invoking " + methodInvocation.getMethod());
                    return methodInvocation.proceed();
                }
            });
        }
    };

    var injector = Guice.createInjector(module);

    var c1 = injector.getInstance(C1.class);
    IO.println(c1.getS1());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions