JDK-8258421 : (jdeprscan) tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java failed with "error: cannot access jdk.internal.ValueBased"
  • Type: Bug
  • Component: tools
  • Affected Version: 17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-15
  • Updated: 2021-07-15
  • Resolved: 2021-07-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 18
17 b31Fixed 18Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The following test failed in the JDK17 CI:

tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java	

Here's a snippet from the log file:

test jdk.jdeprscan.TestRelease.testSuccess(): failure
java.lang.AssertionError: expected [true] but found [false]
	at org.testng.Assert.fail(Assert.java:94)
	at org.testng.Assert.failNotEquals(Assert.java:496)
	at org.testng.Assert.assertTrue(Assert.java:42)
	at org.testng.Assert.assertTrue(Assert.java:52)
	at jdk.jdeprscan.TestRelease.testSuccess(TestRelease.java:56)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:773)
	at org.testng.TestRunner.run(TestRunner.java:623)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
	at org.testng.SuiteRunner.run(SuiteRunner.java:259)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
	at org.testng.TestNG.run(TestNG.java:1018)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

===============================================
tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java
Total tests run: 2, Failures: 1, Skips: 0
===============================================

----------System.err:(56/2683)----------
>>> invoking Main.call with arguments: --list --release 5
Usage: jdeprscan [options] {dir|jar|class} ...

options:
        --class-path PATH
        --for-removal
        --full-version
  -? -h --help
  -l    --list
        --release 7|8|9|10|11|12|13|14|15|16|17
  -v    --verbose
        --version
>>> Main.call returned false
>>> invoking Main.call with arguments: --list --release 7
warning: unknown enum constant javax.jws.soap.SOAPBinding.Use.LITERAL
warning: unknown enum constant javax.annotation.Resource.AuthenticationType.CONTAINER
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 8
warning: unknown enum constant javax.jws.soap.SOAPBinding.Use.LITERAL
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 9
warning: unknown enum constant javax.annotation.Resource.AuthenticationType.CONTAINER
warning: unknown enum constant javax.jws.WebParam.Mode.IN
warning: unknown enum constant javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 10
warning: unknown enum constant javax.jws.WebParam.Mode.IN
warning: unknown enum constant javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED
warning: unknown enum constant javax.annotation.Resource.AuthenticationType.CONTAINER
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 11
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 12
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 13
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 14
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 15
>>> Main.call returned true
>>> invoking Main.call with arguments: --list --release 16
error: cannot access jdk.internal.ValueBased
  class file for jdk.internal.ValueBased not found
>>> Main.call returned false
java.lang.Exception: failures: 1
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:96)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

JavaTest Message: Test threw exception: java.lang.Exception
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 1


test result: Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 1

I'm starting this bug as a P2 since this is a Tier1 failure.
Comments
This has been automatically forward-ported to JDK 18 where it is now causing a different failure.
08-07-2021

Changeset: 7fcd5ca0 Author: Jan Lahoda <jlahoda@openjdk.org> Date: 2021-07-07 09:49:53 +0000 URL: https://git.openjdk.java.net/jdk17/commit/7fcd5ca0258b1dc6c34c98ced177ee4dc7945f26
07-07-2021

Possibly related to JDK-8266036.
10-06-2021

Didn't replicated it locally using a promoted JDK 17 b01 and using a class file in the file system vs a jar file. Issue did not appear on JDK 16 build either. Will try other variants to try to reproduce the issue.
17-12-2020

Something funny is going on with the compiler's symbol table for JDK 16. I have a build where this error occurs, completely independently of jdeprscan: $ javac --release 16 -processorpath /some/path/AnnoProcNoop.jar -processor anno.proc.Noop java.time.ZoneOffset error: cannot access ValueBased class file for jdk.internal.ValueBased not found 1 error The funny thing is that this seems to occur only with java.time.ZoneOffset, which is indeed annotated with jdk.internal.ValueBased. However, this problem does not seem to occur with other classes that are annotated with ValueBased, such as other java.time classes, or primitive boxes such as java.lang.Long. So something appears different about ZoneOffset but I don't know what. [~darcy] Can you take a look at this? The "Noop" annotation processor basically does nothing, but I've appended it below just in case. ========== package anno.proc; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.TypeElement; @SupportedSourceVersion(SourceVersion.RELEASE_17) @SupportedAnnotationTypes("x") public class Noop extends AbstractProcessor { public Noop() { } public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { return true; } } ==========
16-12-2020

Problem-listed by JDK-8258455.
16-12-2020

Looks like this is the first time a deprecated API element is also annotated with a JDK-internal annotation class. Thinking about the best way to fix this.
16-12-2020

[~smarks], can you look at this? The changeset that seemed to trigger the failure was just the usual update to the latest JDK 16 API for the --release information.
15-12-2020