← Back to Pull requests

Add a PriorityQueue type adapter to extras #3183

Open
unknown opened this pull request with 179 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 23, 2026 16:17 UTC
Author

Purpose

Add the opt-in PriorityQueue adapter discussed in #2393.

Description

The factory sorts a copy of the queue before serializing it. Both directions delegate to the List<E> adapter, preserving the declared element type, including wildcard bounds, and registered adapters. The original queue is left intact.

This example supports natural-order queues. It rejects custom comparators because they cannot be recovered from the JSON. It is only used when explicitly registered; Gson's default collection handling is unchanged.

Validation: mvn clean verify javadoc:jar -Dmaven.javadoc.offline=true passes on JDK 21.0.13.1 (all eight modules). The issue's example produces [1,2,3,4,5,9] with the factory registered, and the queue is unchanged.

Javadoc was generated in offline mode; external documentation links were not checked.

Checklist

  • New code follows the Google Java Style Guide

  • If necessary, new public API validates arguments

  • New public API has Javadoc

  • - [x] Javadoc uses @since $next-version$
  • If necessary, new unit tests have been added

  • - [x] Assertions in unit tests use Truth
    - [x] No JUnit 3 features are used
    - [x] Bug regression test: not applicable; this adds an opt-in adapter
  • mvn clean verify javadoc:jar -Dmaven.javadoc.offline=true passes without errors (external links not checked)
  • Diff: 179 lines (+134 / -45) across 2 files Reviewer: wozhenbang2004 Review duration: 5492m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 179 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.311
    Real PR Conversation Timeline
    1 comments
    "Review active on #3183"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.5% (MEDIUM) · Higher = larger blast radius
    35.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.9% · Safe to merge
    18.9%
    Repository