mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
NPE: check raw substitution during inline
This commit is contained in:
@@ -289,6 +289,9 @@ public class InlineUtil {
|
||||
PsiElement resolved = resolveResult.getElement();
|
||||
if (resolved instanceof PsiTypeParameter) {
|
||||
PsiType newType = resolveResult.getSubstitutor().putAll(substitutor).substitute((PsiTypeParameter)resolved);
|
||||
if (newType == null) {
|
||||
newType = PsiType.getJavaLangObject(resolved.getManager(), resolved.getResolveScope());
|
||||
}
|
||||
try {
|
||||
typeElement.replace(factory.createTypeElement(newType));
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
public class NotRaw<T> {
|
||||
T g<caret>et(T t){
|
||||
T tt = t;
|
||||
if ( t == null) {
|
||||
return null;
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Raw extends NotRaw {
|
||||
void foo() {
|
||||
Object o = get(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class NotRaw<T> {
|
||||
|
||||
}
|
||||
|
||||
class Raw extends NotRaw {
|
||||
void foo() {
|
||||
Object result;
|
||||
Object tt = null;
|
||||
if ( null == null) {
|
||||
result = null;
|
||||
} else
|
||||
result = null;
|
||||
Object o = result;
|
||||
}
|
||||
}
|
||||
@@ -153,6 +153,10 @@ public class InlineMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testRawSubstitution() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk15("java 1.5");
|
||||
|
||||
Reference in New Issue
Block a user