From af01bdcff6fc12bfcdb8f182fb92f32be6310404 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Fri, 21 Apr 2017 13:36:42 +0300 Subject: [PATCH] [groovy] do not infer closure type parameters from toString() and getParameterCount() --- .../plugins/groovy/lang/psi/impl/GrClosureType.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClosureType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClosureType.java index f1b82f9e0e7f..09f0292eac99 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClosureType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClosureType.java @@ -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. @@ -67,6 +67,12 @@ public class GrClosureType extends GrLiteralClassType { return "Closure"; } + @Override + public int getParameterCount() { + PsiClass resolved = resolve(); + return resolved != null && resolved.getTypeParameters().length == 1 ? 1 : 0; + } + @Override @NotNull public PsiType[] getParameters() { @@ -188,4 +194,9 @@ public class GrClosureType extends GrLiteralClassType { public GrSignature getSignature() { return mySignature; } + + @Override + public String toString() { + return "PsiType: Closure<*>"; + } } \ No newline at end of file