Skip to content

Enable KeY to distinguish between classes of same name in different packages#3805

Merged
unp1 merged 4 commits intomainfrom
fixNameConfusionIssues
Apr 17, 2026
Merged

Enable KeY to distinguish between classes of same name in different packages#3805
unp1 merged 4 commits intomainfrom
fixNameConfusionIssues

Conversation

@unp1
Copy link
Copy Markdown
Member

@unp1 unp1 commented Apr 17, 2026

Intended Change

At the moment KeY cannot deal with classes of the same name that are declared in different packages as it confuses their type.

The problem originates from two sources:

  • JavaParsers equal and hashcode do not take the fully qualified name of the classes into consideration. Hence two identical classes (the package declaration is part of the compilation unit) are considered equal even if they are declared in different packages.
  • The name given to "Contract_axiom_ ....in" used the shortname of the class not its fully qualified name, and hence could not distinguish between classes of the same name in different packages

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)

Ensuring quality

  • I made sure that introduced/changed code is well documented (javadoc and inline comments).
  • I added new test case(s) for new functionality.
  • I have tested the feature as follows: standard tests of KeY and works now correct with a case study

Additional information and contact(s)

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

unp1 added 4 commits April 17, 2026 07:09
…lly equal) classes as identical even though they occur in different packages

package a;

public class C {
  //@ public static invariant i>=0;
  public static int i;
}

package b;

public class C {
  //@ public static invariant i>=0;
  public static int i;
}

demonstrates the error
…name in taclet names, hence, the name was equal for classes with the same name in different packages
@unp1 unp1 requested a review from wadoon April 17, 2026 05:38
@unp1 unp1 added this to the v3.0.0 milestone Apr 17, 2026
@unp1 unp1 added the 🐞 Bug label Apr 17, 2026
@unp1 unp1 added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit 05966cc Apr 17, 2026
36 checks passed
@unp1 unp1 deleted the fixNameConfusionIssues branch April 17, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants