Skip to content

Priority comparator overflow in CompositeExpressionFactory #1795

Description

@mathecruz

What happened:
CompositeExpressionFactory picks the winning ExpressionFactory using a subtraction-based comparator.

.sorted((f1, f2) -> f1.priority(desc) - f2.priority(desc))

What you expected to happen:

This overflows int when a factory uses ExpressionFactory.MIN_PRIORITY/MAX_PRIORITY (which are Integer.MAX_VALUE/Integer.MIN_VALUE), causing the wrong factory to be picked silently, no exception.

How to reproduce it:

Do the previous scenario.

Anything else we need to know?:

Environment:

  • Specification version used:

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. added
    javaPull requests that update java code
    on Oct 22, 2026
  3. added theissue type on Oct 22, 2026
  4. self-assigned this
    on Oct 23, 2026
  5. added 2 commits that reference this issue on Oct 23, 2026
    ca4ce0e
    dc8d7f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

javaPull requests that update java code

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions