Skip to content

[BUG] Java: Problem.addConstraint accepts the same Constraint twice #2224

Closed

Description

@ramakrishnap-nv

In the Java bindings, Problem.addConstraint accepts the same Constraint object twice. The second call overwrites the constraint's index and the list holds it twice, so the problem has an inconsistent constraint list.

Expected: IllegalArgumentException, and getNumConstraints() stays 1.

Disabled test that reproduces it (in #2219): ModelEdgeCaseTest.addingTheSameConstraintTwiceToOneProblemIsRejected

🤖 Generated with Claude Code

Activity

  1. added this to the 26.12 milestone on Oct 27, 2026
  2. akhil9tiet commented on Oct 27, 2026

    @akhil9tiet
    Contributor

    I'd like to work on this — please assign it to me.

  3. ramakrishnap-nv commented on Oct 27, 2026

    @ramakrishnap-nv
    CollaboratorAuthor

    Thank you @akhil9tiet, please create the PR and ping me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions