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

[JBLOGGING-184] Make module interfaces accessible in module mode #102

Merged
merged 1 commit into from Mar 19, 2024

Conversation

dmlloyd
Copy link
Member

@dmlloyd dmlloyd commented Mar 5, 2024

Avoids errors in modular environments.

An example error is:

[ERROR] Tests run: 34, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.050 s <<< FAILURE! -- in org.wildfly.common.codec.Base64Test
[ERROR] org.wildfly.common.codec.Base64Test.testInvalidInputDecodePadding1 -- Time elapsed: 0.018 s <<< ERROR!
java.lang.Exception: Unexpected exception, expected<java.lang.IllegalArgumentException> but was<java.lang.ExceptionInInitializerError>
	at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:30)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: java.lang.ExceptionInInitializerError
	at org.wildfly.common@2.0.0-SNAPSHOT/org.wildfly.common.iteration.Base64DecodingByteIterator.hasNext(Base64DecodingByteIterator.java:61)
	at org.wildfly.common@2.0.0-SNAPSHOT/org.wildfly.common.iteration.ByteIterator.drainTo(ByteIterator.java:415)
	at org.wildfly.common@2.0.0-SNAPSHOT/org.wildfly.common.iteration.ByteIterator.drain(ByteIterator.java:427)
	at org.wildfly.common@2.0.0-SNAPSHOT/org.wildfly.common.codec.Base64Test.testInvalidInputDecodePadding1(Base64Test.java:228)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19)
	... 20 more
Caused by: java.lang.IllegalArgumentException: Bundle implementation class org.wildfly.common._private.CommonMessages_$bundle could not be instantiated
	at org.jboss.logging.Messages.doGetBundle(Messages.java:113)
	at org.jboss.logging.Messages.getBundle(Messages.java:59)
	at org.jboss.logging.Messages.getBundle(Messages.java:46)
	at org.wildfly.common@2.0.0-SNAPSHOT/org.wildfly.common._private.CommonMessages.<clinit>(CommonMessages.java:36)
	... 33 more
Caused by: java.lang.IllegalAccessException: class org.jboss.logging.Messages cannot access class org.wildfly.common._private.CommonMessages_$bundle (in module org.wildfly.common) because module org.wildfly.common does not export org.wildfly.common._private to unnamed module @6a6cb05c
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
	at java.base/java.lang.reflect.Field.checkAccess(Field.java:1075)
	at java.base/java.lang.reflect.Field.get(Field.java:416)
	at org.jboss.logging.Messages.doGetBundle(Messages.java:111)
	... 36 more

@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 5, 2024

(Updated to change invokeExact to invoke)

@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 5, 2024

Also, confirming that using these new methods does indeed fix the above class of errors.

@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 16, 2024

Ping @jamezp - any thoughts/objections/insights?

Copy link
Member

@jamezp jamezp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. This makes sense to me. The only thing I wonder is if we want to add a version to the @Deprecated annotations and adding the forRemoval = true.

*/
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be forRemoval = true and add a since version?

@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 18, 2024

Sure, that's reasonable.

@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 18, 2024

How do you prefer it to be formatted? I could do since="3.6", or since="3.6.0.Final", or something else?

@jamezp
Copy link
Member

jamezp commented Mar 18, 2024

How do you prefer it to be formatted? I could do since="3.6", or since="3.6.0.Final", or something else?

It doesn't matter much to me TBH. 3.6 seems fine with me to keep it short, but I'm fine with the long version too.

@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 19, 2024

Done. I went with the shorter "3.6" option.

@jamezp jamezp merged commit 14a5fda into jboss-logging:main Mar 19, 2024
13 checks passed
@dmlloyd dmlloyd deleted the jbl-184 branch March 19, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants