JDK-8279669 : test/jdk/com/sun/jdi/TestScaffold.java uses wrong condition
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-01-10
  • Updated: 2023-10-02
  • Resolved: 2022-01-11
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 11 JDK 17 JDK 19 Other
11.0.15Fixed 17.0.3Fixed 19 b05Fixed openjdk8u342Fixed
Related Reports
Relates :  
Description
Originally reported here:
https://github.com/openjdk/jdk/pull/6652

Condition is obviously wrong, because if name starts with "java." other 2 conditions are always true. Intent, as I understand it, was to redefine class where debug event took place (in case of test classes), unless it took place in class of jdk itself, in which case redefine test's main class (if redefineAtEvents is true of course). Check for class names starting with "jdk." was added with later commit [1], not touching that wrong condition (check for classes belonging to jdk) and putting check to else branch instead (therefore not doing any redefinition in case name starts with "jdk.").

Actually fix is done to be then backported to jdk8u, where com/sun/jdi/RedefineCrossEvent.java test stared failing after recent backport [2], due to missing check for classes starting with "jdk." [3]:
...
Redefining class jdk.internal.misc.TerminatingThreadLocal (no class loader)
FAIL: redefine - unexpected exception: java.io.FileNotFoundException: /home/tester/test.1638289866/jdk/JTwork/classes/com/sun/jdi/jdk/internal/misc/TerminatingThreadLocal.class (No such file or directory)
...

This test actually passes for (latest) jdk. However fixing this condition before doing backport, rather than backporting it in current form seems like right thing to do. I tested this locally and jdi tests are passing with this change for latest jdk (and also for jdk8u).

[1] https://github.com/zzambers/jdk/commit/426873751c710061d0f9bc713a0de47373e51418#diff-778880449f85966d3c6b219b8ceb41fdbbe7acc5e520d2aa27aada3f33bf1eab
[2] https://bugs.openjdk.java.net/browse/JDK-8273772
[3] https://github.com/openjdk/jdk8u/blob/7d3c0bede34930cadd76644e58bf56f2a83c3d01/jdk/test/com/sun/jdi/TestScaffold.java#L535
Comments
Fix Request [8u]: should be fixed on 8u (as on other jdks), it fixes com/sun/jdi/RedefineCrossEvent.java test for 8u (actually initial motivation for this fix), low risk (test only), tests in test/com/sun/jdi passed form me with this patch
14-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk8u-dev/pull/6 Date: 2022-03-14 16:44:49 +0000
14-03-2022

Fix Request 17u: should be also fixed in 17u, applies cleanly for 17u, I ran tests in test/jdk/com/sun/jdi - passed for me
24-02-2022

Fix Request 11u: should be fixed in all jdks, low risk (simple change in test class), I ran tests in test/jdk/com/sun/jdi - passed for me
24-02-2022

8u review: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2022-February/014578.html
24-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk17u-dev/pull/175 Date: 2022-02-23 15:47:13 +0000
23-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk11u-dev/pull/837 Date: 2022-02-23 00:13:55 +0000
23-02-2022

Changeset: 4c52eb39 Author: Zdenek Zambersky <zzambers@redhat.com> Committer: Severin Gehwolf <sgehwolf@openjdk.org> Date: 2022-01-11 13:14:48 +0000 URL: https://git.openjdk.java.net/jdk/commit/4c52eb39431c2479b0d140907bdcc0311d30f871
11-01-2022

Reported on behalf of Zdenek (and assigning to me on his behalf). He has a fix for this.
10-01-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/6652 Date: 2021-12-01 19:19:02 +0000
10-01-2022