mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
StreamApiUtil#getStreamELementType: use PsiUtil.substituteTypeParameter to correctly extract type parameter
This commit is contained in:
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.siyeh.ig.psiutils;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
/**
|
||||
@@ -38,9 +39,7 @@ public class StreamApiUtil {
|
||||
if(!com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, false, CommonClassNames.JAVA_UTIL_STREAM_STREAM)) {
|
||||
return null;
|
||||
}
|
||||
PsiType[] parameters = ((PsiClassType)type).getParameters();
|
||||
if(parameters.length != 1) return null;
|
||||
PsiType streamType = parameters[0];
|
||||
PsiType streamType = PsiUtil.substituteTypeParameter(type, CommonClassNames.JAVA_UTIL_STREAM_STREAM, 0, false);
|
||||
if(streamType instanceof PsiCapturedWildcardType) {
|
||||
streamType = ((PsiCapturedWildcardType)streamType).getUpperBound();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user