Skip to content

Update Jtreg tests - #7941

Merged
smillst merged 89 commits into
typetools:masterfrom
smillst:jtreg-rewrite
Aug 10, 2026
Merged

Update Jtreg tests#7941
smillst merged 89 commits into
typetools:masterfrom
smillst:jtreg-rewrite

Conversation

@smillst

@smillst smillst commented Aug 7, 2026

Copy link
Copy Markdown
Member

These changes were pulled from #7912.

Fixes #2816.

mernst added 30 commits July 25, 2026 13:21
mernst and others added 20 commits August 4, 2026 00:16
…ker-framework into type-inference-8-review-2-16
@smillst smillst mentioned this pull request Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c41e24eb-50ad-4dbb-91cc-4e7170590454

📥 Commits

Reviewing files that changed from the base of the PR and between 6c2584d and 5a6367e.

📒 Files selected for processing (1)
  • checker/jtreg/nullness/defaultsPersist/Fields.java
💤 Files with no reviewable changes (1)
  • checker/jtreg/nullness/defaultsPersist/Fields.java

📝 Walkthrough

Walkthrough

The jtreg nullness persistence tests now target JDK 24 or later and use the java.lang.classfile API. Compilation helpers return ClassModel instances. Defaults persistence tests use local position data and TargetInfo matching. Inherited annotation tests extract annotation names from ClassModel methods. Legacy constant-pool and ClassFile dependencies were removed. The jtreg configuration now references jdk.compiler.

Possibly related PRs

Suggested reviewers: mernst

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@checker/jtreg/nullness/defaultsPersist/Fields.java`:
- Around line 5-9: Resolve the stale `@ignore` in the jtreg header for
Fields.java: verify whether Issue 2816 still reproduces on JDK 24, then remove
`@ignore` if fixed or update its reason to describe the current JDK 24 failure.
Keep the jdk.version.major requirement unchanged.

In `@checker/jtreg/nullness/defaultsPersist/ReferenceInfoUtil.java`:
- Around line 104-119: Remove the unconditional System.out.println debug
statement from findAnnotation, leaving the annotation matching and isAtPosition
logic unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bf493e6a-3737-4a29-9edd-d014caedf277

📥 Commits

Reviewing files that changed from the base of the PR and between 168366a and 6c2584d.

📒 Files selected for processing (14)
  • build.gradle
  • checker/jtreg/nullness/PersistUtil.java
  • checker/jtreg/nullness/defaultsPersist/Classes.java
  • checker/jtreg/nullness/defaultsPersist/Constructors.java
  • checker/jtreg/nullness/defaultsPersist/Driver.java
  • checker/jtreg/nullness/defaultsPersist/Fields.java
  • checker/jtreg/nullness/defaultsPersist/Methods.java
  • checker/jtreg/nullness/defaultsPersist/ReferenceInfoUtil.java
  • checker/jtreg/nullness/inheritDeclAnnoPersist/Driver.java
  • checker/jtreg/nullness/inheritDeclAnnoPersist/Extends.java
  • checker/jtreg/nullness/inheritDeclAnnoPersist/Implements.java
  • checker/jtreg/nullness/inheritDeclAnnoPersist/ReferenceInfoUtil.java
  • checker/jtreg/tainting/ComplementaryBoundProvenance.goal
  • checker/jtreg/tainting/ComplementaryBoundProvenance.java

Comment thread checker/jtreg/nullness/defaultsPersist/Fields.java
Comment on lines 104 to 119
private static TypeAnnotation findAnnotation(
String name, TypeAnnotation.Position expected, List<TypeAnnotation> annotations, ClassFile cf)
throws InvalidIndex, UnexpectedEntry {
String name, Position expected, List<TypeAnnotation> annotations) {
String properName = "L" + name + ";";
for (TypeAnnotation anno : annotations) {
String actualName = cf.constant_pool.getUTF8Value(anno.annotation.type_index);
String actualName = anno.annotation().className().stringValue();

if (properName.equals(actualName)) {
System.out.println("For Anno: " + actualName);
}

if (properName.equals(actualName) && areEquals(expected, anno.position)) {
if (properName.equals(actualName) && isAtPosition(expected, anno)) {
return anno;
}
}
return null;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the leftover debug print.

Lines 110-112 print "For Anno: " + actualName whenever the name matches. The print duplicates the condition on line 114 and adds unconditional output to every test run. Noisy stdout hides the real comparison diagnostics that ComparisonException produces.

♻️ Proposed cleanup
     String properName = "L" + name + ";";
     for (TypeAnnotation anno : annotations) {
       String actualName = anno.annotation().className().stringValue();
-
-      if (properName.equals(actualName)) {
-        System.out.println("For Anno: " + actualName);
-      }
-
       if (properName.equals(actualName) && isAtPosition(expected, anno)) {
         return anno;
       }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static TypeAnnotation findAnnotation(
String name, TypeAnnotation.Position expected, List<TypeAnnotation> annotations, ClassFile cf)
throws InvalidIndex, UnexpectedEntry {
String name, Position expected, List<TypeAnnotation> annotations) {
String properName = "L" + name + ";";
for (TypeAnnotation anno : annotations) {
String actualName = cf.constant_pool.getUTF8Value(anno.annotation.type_index);
String actualName = anno.annotation().className().stringValue();
if (properName.equals(actualName)) {
System.out.println("For Anno: " + actualName);
}
if (properName.equals(actualName) && areEquals(expected, anno.position)) {
if (properName.equals(actualName) && isAtPosition(expected, anno)) {
return anno;
}
}
return null;
}
private static TypeAnnotation findAnnotation(
String name, Position expected, List<TypeAnnotation> annotations) {
String properName = "L" + name + ";";
for (TypeAnnotation anno : annotations) {
String actualName = anno.annotation().className().stringValue();
if (properName.equals(actualName) && isAtPosition(expected, anno)) {
return anno;
}
}
return null;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@checker/jtreg/nullness/defaultsPersist/ReferenceInfoUtil.java` around lines
104 - 119, Remove the unconditional System.out.println debug statement from
findAnnotation, leaving the annotation matching and isAtPosition logic
unchanged.

@smillst smillst self-assigned this Aug 10, 2026
@smillst
smillst merged commit 1dd42c2 into typetools:master Aug 10, 2026
21 checks passed
@smillst
smillst deleted the jtreg-rewrite branch August 10, 2026 17:20
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.

checker/jtreg/nullness/defaultsPersist/Fields.java fails on JDK 11

2 participants