Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal field modifiers in class: 0x1A when using io.quarkus.logging.Log in interface default method #29072

Closed
syr opened this issue Nov 4, 2022 · 2 comments · Fixed by #29090
Assignees
Labels
area/logging kind/bug Something isn't working
Milestone

Comments

@syr
Copy link

syr commented Nov 4, 2022

Describe the bug

We had a hard time to find out what is wrong due to not so helpful error message.

Tried to use io.quarkus.logging.Log inside a interface default method (Maybe this is generally a silly idea)

import io.quarkus.runtime.StartupEvent;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;


@ApplicationScoped
public class MyClass implements MyInterface {
    void onStart(@Observes StartupEvent ev) {
        log();
    }
}
import io.quarkus.logging.Log;

public interface MyInterface {
    default void log(){
        Log.info("log same stuff for all implementations");
    }
}

Expected behavior

console log: log same stuff for all implementations

Actual behavior

2022-11-04 16:50:49,262 ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:68)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:122)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
... 6 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.(Unknown Source)
... 17 more
Caused by: java.lang.ClassFormatError: Illegal field modifiers in class org/acme/MyInterface: 0x1A
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:490)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:450)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:490)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:450)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at org.acme.MyClass_Bean.(Unknown Source)
at io.quarkus.arc.setup.Default_ComponentsProvider.addBeans1(Unknown Source)
at io.quarkus.arc.setup.Default_ComponentsProvider.getComponents(Unknown Source)
at io.quarkus.arc.impl.ArcContainerImpl.(ArcContainerImpl.java:127)
at io.quarkus.arc.Arc.initialize(Arc.java:31)
at io.quarkus.arc.runtime.ArcRecorder.initContainer(ArcRecorder.java:43)
at io.quarkus.deployment.steps.ArcProcessor$generateResources1337887788.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.ArcProcessor$generateResources1337887788.deploy(Unknown Source)
... 18 more

2022-11-04 16:50:49,263 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure

How to Reproduce?

See codeblocks in the description, as it is so few code necessary. If it is helpful I can also push a reproducer.

Output of uname -a or ver

No response

Output of java -version

openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.13.3.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)

Additional information

No response

@syr syr added the kind/bug Something isn't working label Nov 4, 2022
@gsmet
Copy link
Member

gsmet commented Nov 4, 2022

/cc @Ladicek

@Ladicek
Copy link
Contributor

Ladicek commented Nov 7, 2022

This should be fixed in #29090. Feel free to checkout that branch and try, but the test I've added there used to fail with the exact same exception and I'm pretty confident the PR fixes your problem too.

@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Nov 7, 2022
@gsmet gsmet modified the milestones: 2.15 - main, 2.14.1.Final Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants