com.intellij.psi.PsiTypeParameterList Java Examples

The following examples show how to use com.intellij.psi.PsiTypeParameterList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CamelDocumentationProvider.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
private boolean isPsiMethodCamelLanguage(PsiMethod method) {
    PsiType type = method.getReturnType();
    if (type != null && type instanceof PsiClassReferenceType) {
        PsiClassReferenceType clazz = (PsiClassReferenceType) type;
        PsiClass resolved = clazz.resolve();
        if (resolved != null) {
            boolean language = getCamelIdeaUtils().isCamelExpressionOrLanguage(resolved);
            // try parent using some weird/nasty stub stuff which is how complex IDEA AST
            // is when its parsing the Camel route builder
            if (!language) {
                PsiElement elem = resolved.getParent();
                if (elem instanceof PsiTypeParameterList) {
                    elem = elem.getParent();
                }
                if (elem instanceof PsiClass) {
                    language = getCamelIdeaUtils().isCamelExpressionOrLanguage((PsiClass) elem);
                }
            }
            return language;
        }
    }

    return false;
}
 
Example #2
Source File: InvalidJsonGenericTypesDetector.java    From aircon with MIT License 5 votes vote down vote up
@Override
protected void visitJsonConfigAnnotation(final UAnnotation node, final PsiClass jsonType, final int genericTypesCount) {
	final PsiTypeParameterList typeParameterList = jsonType.getTypeParameterList();
	final int expectedGenericTypesCount = typeParameterList != null ? typeParameterList.getTypeParameters().length : 0;
	if (expectedGenericTypesCount != genericTypesCount) {
		report(node, String.format(Locale.getDefault(), DESC_FORMAT, jsonType.getName(), expectedGenericTypesCount, genericTypesCount));
	}
}
 
Example #3
Source File: LombokLightClassBuilder.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public LombokLightClassBuilder withParameterTypes(@Nullable PsiTypeParameterList parameterList) {
  if (parameterList != null) {
    Stream.of(parameterList.getTypeParameters()).forEach(this::withParameterType);
  }
  return this;
}