use of org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightParameter in project android by JetBrains.
the class AndroidDslContributor method findAndProcessContributingMethod.
@Nullable
private static PsiMethod findAndProcessContributingMethod(String symbol, PsiScopeProcessor processor, ResolveState state, PsiElement place, PsiClass contributorClass) {
PsiMethod method = getContributingMethod(place, contributorClass, symbol);
if (method == null) {
return null;
}
ParametrizedTypeExtractor typeExtractor = getTypeExtractor(method);
if (typeExtractor != null && !typeExtractor.hasNamedDomainObjectContainer() && typeExtractor.isClosure()) {
// method takes a closure argument
String clz = typeExtractor.getClosureType();
if (clz == null) {
clz = CommonClassNames.JAVA_LANG_OBJECT;
}
if (ourDslForClassMap.containsKey(clz)) {
clz = ourDslForClassMap.get(clz);
}
resolveToMethodWithClosure(place, method, clz, processor, state);
} else {
GrLightMethodBuilder builder = new GrLightMethodBuilder(place.getManager(), method.getName());
PsiElementFactory factory = JavaPsiFacade.getElementFactory(place.getManager().getProject());
PsiType type = new PsiArrayType(factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_OBJECT, place.getResolveScope()));
builder.addParameter(new GrLightParameter("param", type, builder));
PsiClassType retType = factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_OBJECT, place.getResolveScope());
builder.setReturnType(retType);
processor.execute(builder, state);
builder.setNavigationElement(method);
}
return method;
}
Aggregations