mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new inference: incorporation: proceed with capture incorporation if not all type args are wildcards
This commit is contained in:
+17
@@ -126,6 +126,21 @@ public class InferenceIncorporationPhase {
|
||||
LOG.assertTrue(gClass != null);
|
||||
final InferenceVariable[] parameters = capture.first;
|
||||
PsiType[] typeArgs = right.getParameters();
|
||||
PsiSubstitutor restSubst = PsiSubstitutor.EMPTY;
|
||||
if (Registry.is("javac.fresh.variables.for.captured.wildcards.only")) {
|
||||
List<PsiType> args = new ArrayList<PsiType>();
|
||||
PsiTypeParameter[] typeParameters = gClass.getTypeParameters();
|
||||
for (int i = 0; i < typeArgs.length; i++) {
|
||||
PsiType arg = typeArgs[i];
|
||||
if (arg instanceof PsiWildcardType) {
|
||||
args.add(arg);
|
||||
}
|
||||
else {
|
||||
restSubst = restSubst.put(typeParameters[i], arg);
|
||||
}
|
||||
}
|
||||
typeArgs = args.toArray(PsiType.EMPTY_ARRAY);
|
||||
}
|
||||
if (parameters.length != typeArgs.length) continue;
|
||||
for (int i = 0; i < typeArgs.length; i++) {
|
||||
final PsiType aType = typeArgs[i];
|
||||
@@ -155,6 +170,8 @@ public class InferenceIncorporationPhase {
|
||||
}
|
||||
}
|
||||
|
||||
glb = restSubst.substitute(glb);
|
||||
|
||||
if (!((PsiWildcardType)aType).isBounded()) {
|
||||
|
||||
for (PsiType upperBound : upperBounds) {
|
||||
|
||||
Reference in New Issue
Block a user