Merge branch 'master' into issue-5151
This commit is contained in:
@ -17,6 +17,8 @@ This is a {{ site.pmd.release_type }} release.
|
||||
### 🐛 Fixed Issues
|
||||
* apex-performance
|
||||
* [#5139](https://github.com/pmd/pmd/issues/5139): \[apex] OperationWithHighCostInLoop not firing in triggers
|
||||
* java
|
||||
* [#5167](https://github.com/pmd/pmd/pull/5167): \[java] java.lang.IllegalArgumentException: \<\?\> cannot be a wildcard bound
|
||||
* java-bestpractices
|
||||
* [#3602](https://github.com/pmd/pmd/issues/3602): \[java] GuardLogStatement: False positive when compile-time constant is created from external constants
|
||||
* [#5145](https://github.com/pmd/pmd/issues/5145): \[java] False positive UnusedPrivateMethod
|
||||
|
@ -1170,6 +1170,13 @@ public final class TypeOps {
|
||||
} else if (!upwards) {
|
||||
// If Ai is a type that mentions a restricted type variable, then Ai' is undefined.
|
||||
return NO_DOWN_PROJECTION;
|
||||
} else if (u instanceof JWildcardType) {
|
||||
// The rest of this function, below, treats u as the bound of a wildcard,
|
||||
// but if u is already a wildcard (and therefore ai was a wildcard), we
|
||||
// are already done.
|
||||
newTargs.add(u);
|
||||
change = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
change = true;
|
||||
|
@ -95,7 +95,44 @@ class TypeOpsTest : FunSpec({
|
||||
|
||||
|
||||
}
|
||||
test("#5167 problem in projection") {
|
||||
val (acu, spy) = javaParser.parseWithTypeInferenceSpy(
|
||||
"""
|
||||
import java.lang.annotation.Annotation;
|
||||
interface Bar<T> {
|
||||
Baz<T> getBaz();
|
||||
}
|
||||
|
||||
interface Predicate<T> {
|
||||
boolean check(T t);
|
||||
}
|
||||
interface Stream<T>{
|
||||
T findSome();
|
||||
}
|
||||
interface Baz<T>{
|
||||
Stream<Bar<? super T>> filterMethods(Predicate<? super T> p);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
|
||||
private static Bar<?> foo(
|
||||
Bar<?> type, Class<? extends Annotation> annotation, boolean required) {
|
||||
var method = type.getBaz().filterMethods(m -> true).findSome();
|
||||
return method;
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
val (barT) = acu.declaredTypeSignatures()
|
||||
val methodId = acu.varId("method")
|
||||
|
||||
spy.shouldBeOk {
|
||||
methodId shouldHaveType barT[`?`]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user