[Bug]: CtWildcardReference::equals does not respect isUpper
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
### Describe the bug
when comparing two wildcards using `equals`, they are considered equal even if one has an upper bound and the other's bound is a lower one.
### Source code you are trying to analyze/transform
```Java
irrelevant, see mre below
```
### Source code for your Spoon processing
```Java
var factory = new spoon.Launcher().createFactory();
var x = factory.createWildcardReference().setBoundingType(factory.Type().createReference(Object.class)).setUpper(false);
var y = factory.createWildcardReference().setBoundingType(factory.Type().createReference(Object.class)).setUpper(true);
System.out.println(x);
System.out.println(y);
System.out.println(x.equals(y));
System.out.println(y.equals(x));
```
### Actual output
```Java
? super java.lang.Object
? extends java.lang.Object
true
true
```
### Expected output
```Java
? super java.lang.Object
? extends java.lang.Object
false
false
```
### Spoon Version
11.1.0 (i looked through every changelog since then and found none where wildcards are mentioned)
### JVM Version
21.0.10
### What operating system are you using?
nixos unstable 26.11.20260823.56c02bc (Zokor)
Contributor guide
Research direction
Start at CtWildcardReference.equals and run the supplied Java reproducer with one wildcard using an upper bound and the other a lower bound. Done means the two comparisons return false while the printed wildcard forms remain ? super java.lang.Object and ? extends java.lang.Object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100