mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
Java: create correct field from parameter with unbounded type parameter (IDEA-365468)
GitOrigin-RevId: 218b864c95d25b6ff47e9360e0eeef47308f0ae8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
135bd98b37
commit
3c99de56be
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
import com.intellij.codeInsight.NullableNotNullManager;
|
||||
@@ -61,7 +61,9 @@ public final class FieldFromParameterUtils {
|
||||
for (PsiTypeParameter usedTypeParameter : usedTypeParameters) {
|
||||
PsiType bound = TypeConversionUtil.typeParameterErasure(usedTypeParameter);
|
||||
PsiManager manager = usedTypeParameter.getManager();
|
||||
subst = subst.put(usedTypeParameter, bound == null ? PsiWildcardType.createUnbounded(manager) : bound.equalsToText(CommonClassNames.JAVA_LANG_OBJECT) ? bound : PsiWildcardType.createExtends(manager, bound));
|
||||
subst = subst.put(usedTypeParameter, bound == null || bound.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)
|
||||
? PsiWildcardType.createUnbounded(manager)
|
||||
: PsiWildcardType.createExtends(manager, bound));
|
||||
}
|
||||
|
||||
PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
class Bar {
|
||||
|
||||
private Class<?> myA;
|
||||
private int myB;
|
||||
|
||||
<T> void get(Class<T> a, int b) {
|
||||
myA = a;
|
||||
myB = b;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import java.util.*;
|
||||
class Test{
|
||||
private List<Object> myP1;
|
||||
private List<?> myP1;
|
||||
|
||||
<T> void f(List<T> p1){
|
||||
myP1 = p1;
|
||||
|
||||
Reference in New Issue
Block a user