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

Avoid reflection on java.util.concurrent internals during tests. #6155

Closed
wants to merge 1 commit into from

Conversation

copybara-service[bot]
Copy link
Contributor

Avoid reflection on java.util.concurrent internals during tests.

Under modern JDKs, it will fail.

This lets us remove one of our --add-opens lines. (I haven't looked into the others.)

Example failure:

java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Thread java.util.concurrent.locks.AbstractOwnableSynchronizer.getExclusiveOwnerThread() accessible: module java.base does not "opens java.util.concurrent.locks" to unnamed module @5ba184fc; did you mean --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:348)
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
	at java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
	at java.lang.reflect.Method.setAccessible(Method.java:192)
	at com.google.common.util.concurrent.InterruptibleTaskTest.testInterruptIsSlow(InterruptibleTaskTest.java:160)

Relevant to #5801

RELNOTES=n/a

Under modern JDKs, it will fail.

This lets us remove one of our `--add-opens` lines. (I haven't looked into [the others](#5801 (comment)).)

Example failure:

```
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Thread java.util.concurrent.locks.AbstractOwnableSynchronizer.getExclusiveOwnerThread() accessible: module java.base does not "opens java.util.concurrent.locks" to unnamed module @5ba184fc; did you mean --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:348)
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
	at java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
	at java.lang.reflect.Method.setAccessible(Method.java:192)
	at com.google.common.util.concurrent.InterruptibleTaskTest.testInterruptIsSlow(InterruptibleTaskTest.java:160)
```

Relevant to #5801

RELNOTES=n/a
PiperOrigin-RevId: 469500716
@copybara-service copybara-service bot closed this Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant