Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
33,100 | Collection<PsiClassType> () { return implementsTypes; } | getImplementsTypes |
33,101 | void (@NotNull Members other) { methods.addAll(other.getMethods()); fields.addAll(other.getFields()); classes.addAll(other.getClasses()); implementsTypes.addAll(other.getImplementsTypes()); } | addFrom |
33,102 | void (@NotNull TransformationContext context) { GrTypeDefinition clazz = context.getCodeClass(); if (!hasGeneratedImplementations(clazz)) return; final LightMethodBuilder write = new LightMethodBuilder(clazz.getManager(), "writeExternal"); write.addParameter("out", ObjectOutput.class.getName()); write.addException(IOException.class.getName()); write.setOriginInfo("created by @AutoExternalize"); context.addMethod(write); final LightMethodBuilder read = new LightMethodBuilder(clazz.getManager(), "readExternal"); read.addParameter("oin", ObjectInput.class.getName()); read.setOriginInfo("created by @AutoExternalize"); context.addMethod(read); } | applyTransformation |
33,103 | boolean (GrTypeDefinition clazz) { return PsiImplUtil.getAnnotation(clazz, GroovyCommonClassNames.GROOVY_TRANSFORM_AUTO_EXTERNALIZE) != null; } | hasGeneratedImplementations |
33,104 | void (@NotNull TransformationContext context) { GrTypeDefinition psiClass = context.getCodeClass(); if (psiClass.isAnonymous() || psiClass.isInterface() || psiClass.isEnum()) { return; } if (!hasInheritConstructorsAnnotation(psiClass)) return; final PsiClass hierarchyView = context.getHierarchyView(); final PsiClass superClass = hierarchyView.getSuperClass(); if (superClass == null) return; final PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor( superClass, hierarchyView, PsiSubstitutor.EMPTY ); for (PsiMethod constructor : superClass.getConstructors()) { if (constructor.hasModifierProperty(PsiModifier.PRIVATE)) continue; final GrLightMethodBuilder inheritedConstructor = new GrLightMethodBuilder(context.getManager(), context.getClassName()); inheritedConstructor.setConstructor(true); inheritedConstructor.setNavigationElement(psiClass); inheritedConstructor.addModifier(VisibilityUtil.getVisibilityModifier(constructor.getModifierList())); inheritedConstructor.setOriginInfo("created by @InheritConstructors"); for (PsiParameter parameter : constructor.getParameterList().getParameters()) { String name = parameter.getName(); PsiType type = superClassSubstitutor.substitute(parameter.getType()); inheritedConstructor.addParameter(name, type); } context.addMethod(inheritedConstructor); } } | applyTransformation |
33,105 | boolean (PsiClass psiClass) { final PsiModifierList modifierList = psiClass.getModifierList(); return modifierList != null && modifierList.hasAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_INHERIT_CONSTRUCTORS); } | hasInheritConstructorsAnnotation |
33,106 | PsiMethod () { return myPrototype; } | getPrototype |
33,107 | String () { PsiClass aClass = myPrototype.getContainingClass(); if (aClass != null && aClass.getName() != null) { return "delegates to " + aClass.getName(); } return null; } | getOriginInfo |
33,108 | PsiElement () { return getContainingClass(); } | getParent |
33,109 | PsiClass () { //noinspection ConstantConditions return super.getContainingClass(); } | getContainingClass |
33,110 | PsiFile () { return getContainingClass().getContainingFile(); } | getContainingFile |
33,111 | boolean (@Nullable PsiAnnotation annotation, @NotNull String strategy) { if (annotation == null) return false; PsiClass aClass = GrAnnotationUtil.inferClassAttribute(annotation, STRATEGY_ATTRIBUTE); if (aClass == null) return false; return StringUtil.getQualifiedName(BUILDER_PACKAGE, strategy).equals(aClass.getQualifiedName()); } | isApplicable |
33,112 | PsiField[] (@NotNull TransformationContext context, boolean includeSuper) { return filterFields(includeSuper ? context.getAllFields(false) : context.getFields(), context); } | getFields |
33,113 | PsiField[] (@NotNull GrTypeDefinition clazz, boolean includeSuper, @NotNull TransformationContext context) { return filterFields(includeSuper ? asList(GrClassImplUtil.getAllFields(clazz, false)) : asList(clazz.getFields()), context); } | getFields |
33,114 | PsiField[] (Collection<? extends PsiField> collectedFields, @NotNull TransformationContext context) { return collectedFields.stream() .filter(field -> { PsiModifierList modifierList = field.getModifierList(); if (modifierList instanceof GrModifierList) { return !context.hasModifierProperty((GrModifierList)modifierList, PsiModifier.STATIC); } else { return true; } }) .filter(field -> { PsiClass aClass = field.getContainingClass(); if (aClass == null || aClass.getQualifiedName() == null) { return false; } String name = aClass.getQualifiedName(); return !name.equals(GroovyCommonClassNames.GROOVY_OBJECT_SUPPORT) && !name.equals(GroovyCommonClassNames.GROOVY_OBJECT); }) .toArray(PsiField[]::new); } | filterFields |
33,115 | boolean (@NotNull PsiAnnotation annotation) { return PsiUtil.getAnnoAttributeValue(annotation, "includeSuperProperties", false); } | isIncludeSuperProperties |
33,116 | void (@NotNull TransformationContext context) { GrTypeDefinition typeDefinition = context.getCodeClass(); final PsiAnnotation annotation = PsiImplUtil.getAnnotation(typeDefinition, BUILDER_FQN); if (!isApplicable(annotation, SIMPLE_STRATEGY_NAME)) return; if (isIncludeSuperProperties(annotation)) return; for (GrField field : typeDefinition.getCodeFields()) { context.addMethod(createFieldSetter(typeDefinition, field, annotation)); } } | applyTransformation |
33,117 | LightMethodBuilder (@NotNull PsiClass builderClass, @NotNull GrVariable field, @NotNull PsiAnnotation annotation) { final String name = field.getName(); final LightMethodBuilder fieldSetter = new LightMethodBuilder(builderClass.getManager(), getFieldMethodName(annotation, name)); fieldSetter.addModifier(PsiModifier.PUBLIC); fieldSetter.addParameter(name, field.getType(), false); fieldSetter.setMethodReturnType(createType(builderClass)); fieldSetter.setNavigationElement(field); fieldSetter.setOriginInfo(ORIGIN_INFO); return fieldSetter; } | createFieldSetter |
33,118 | String (@NotNull PsiAnnotation annotation, @NotNull String fieldName) { final String prefix = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "prefix"); return prefix == null ? "set" + StringUtil.capitalize(fieldName) : prefix.isEmpty() ? fieldName : prefix + StringUtil.capitalize(fieldName); } | getFieldMethodName |
33,119 | void (@NotNull TransformationContext context) { PsiAnnotation annotation = PsiImplUtil.getAnnotation(context.getCodeClass(), BUILDER_FQN); if (!isApplicable(annotation, EXTERNAL_STRATEGY_NAME)) return; final PsiClass constructedClass = GrAnnotationUtil.inferClassAttribute(annotation, "forClass"); if (constructedClass == null || "groovy.transform.Undefined.CLASS".equals(constructedClass.getQualifiedName())) return; boolean includeSuper = isIncludeSuperProperties(annotation); if (constructedClass instanceof GrTypeDefinition) { PsiField[] fields = getFields((GrTypeDefinition)constructedClass, includeSuper, context); for (PsiField field : fields) { context.addMethod(DefaultBuilderStrategySupport.createFieldSetter(context.getCodeClass(), field, annotation, context)); } } else { Collection<PsiMethod> properties = PropertyUtilBase.getAllProperties(constructedClass, true, false, includeSuper).values(); for (PsiMethod setter : properties) { final PsiMethod builderSetter = createFieldSetter(context, setter, annotation); if (builderSetter != null) context.addMethod(builderSetter); } } context.addMethod(createBuildMethod(annotation, createType(constructedClass))); } | applyTransformation |
33,120 | LightMethodBuilder (@NotNull TransformationContext context, @NotNull PsiMethod setter, @NotNull PsiAnnotation annotation) { PsiClass builderClass = context.getCodeClass(); final String name = PropertyUtilBase.getPropertyNameBySetter(setter); final PsiType type = PropertyUtilBase.getPropertyType(setter); if (type == null) return null; return DefaultBuilderStrategySupport.createFieldSetter(builderClass, name, type, annotation, setter, context); } | createFieldSetter |
33,121 | void (@NotNull TransformationContext context) { new InitializerBuilderStrategyHandler(context).doProcess(); } | applyTransformation |
33,122 | void () { processTypeDefinition(); processConstructors(); } | doProcess |
33,123 | void () { final PsiAnnotation builderAnno = PsiImplUtil.getAnnotation(myContainingClass, BUILDER_FQN); if (!isApplicable(builderAnno, INITIALIZER_STRATEGY_NAME)) return; boolean includeSuper = isIncludeSuperProperties(builderAnno); final PsiClass builderClass = createBuilderClass(builderAnno, getFields(myContext, includeSuper)); myContext.addMethod(createBuilderMethod(builderClass, builderAnno)); myContext.addMethod(createBuilderConstructor(myContainingClass, builderClass, builderAnno)); myContext.addInnerClass(builderClass); } | processTypeDefinition |
33,124 | LightPsiClassBuilder (@NotNull final PsiAnnotation annotation, PsiVariable @NotNull [] setters) { final LightPsiClassBuilder builderClass = new BuilderHelperLightPsiClass( myContainingClass, getBuilderClassName(annotation, myContainingClass) ); for (int i = 0; i < setters.length; i++) { builderClass.getTypeParameterList().addParameter(new InitializerTypeParameter(builderClass, i)); } for (int i = 0; i < setters.length; i++) { builderClass.addMethod(createFieldSetter(builderClass, setters[i], annotation, i)); } return builderClass.addMethod(createBuildMethod(annotation, builderClass)); } | createBuilderClass |
33,125 | LightMethodBuilder (@NotNull LightPsiClassBuilder builderClass, @NotNull PsiVariable field, @NotNull PsiAnnotation annotation, int currentField) { final String name = Objects.requireNonNull(field.getName()); final LightMethodBuilder fieldSetter = new LightMethodBuilder(builderClass.getManager(), getFieldMethodName(annotation, name)); final PsiSubstitutor substitutor = PsiSubstitutor.EMPTY.put( builderClass.getTypeParameters()[currentField], myElementFactory.createTypeByFQClassName(SET_FQN, annotation.getResolveScope()) ); fieldSetter.addModifier(PsiModifier.PUBLIC); fieldSetter.addParameter(name, field.getType()); fieldSetter.setContainingClass(builderClass); fieldSetter.setMethodReturnType(myElementFactory.createType(builderClass, substitutor)); fieldSetter.setNavigationElement(field); fieldSetter.setOriginInfo(ORIGIN_INFO); return fieldSetter; } | createFieldSetter |
33,126 | LightMethodBuilder (@NotNull PsiAnnotation annotation, @NotNull PsiClass builderClass) { LightMethodBuilder buildMethod = new LightMethodBuilder(annotation.getManager(), builderClass.getLanguage(), getBuildMethodName(annotation)); buildMethod.addModifier(PsiModifier.STATIC); buildMethod.setContainingClass(builderClass); buildMethod.setOriginInfo(ORIGIN_INFO); buildMethod.setNavigationElement(annotation); buildMethod.setMethodReturnType(createAllSetUnsetType(builderClass, false)); return buildMethod; } | createBuildMethod |
33,127 | LightMethodBuilder (@NotNull PsiClass builderClass, @NotNull PsiAnnotation annotation) { final LightMethodBuilder builderMethod = new LightMethodBuilder(myContext.getManager(), getBuilderMethodName(annotation)); builderMethod.addModifier(PsiModifier.STATIC); builderMethod.setOriginInfo(ORIGIN_INFO); builderMethod.setNavigationElement(annotation); builderMethod.setMethodReturnType(createAllSetUnsetType(builderClass, false)); return builderMethod; } | createBuilderMethod |
33,128 | LightMethodBuilder (@NotNull PsiClass constructedClass, @NotNull PsiClass builderClass, @NotNull PsiAnnotation annotation) { final LightMethodBuilder constructor = new LightMethodBuilder(constructedClass, constructedClass.getLanguage()).addParameter( "builder", createAllSetUnsetType(builderClass, true) ).setConstructor(true); constructor.setNavigationElement(annotation); constructor.setOriginInfo(ORIGIN_INFO); return constructor; } | createBuilderConstructor |
33,129 | void () { for (GrMethod method : myContainingClass.getCodeMethods()) { final PsiAnnotation annotation = PsiImplUtil.getAnnotation(method, BUILDER_FQN); if (!isApplicable(annotation, INITIALIZER_STRATEGY_NAME)) return; if (method.isConstructor()) { processConstructor(method, annotation); } } } | processConstructors |
33,130 | void (@NotNull GrMethod method, @NotNull PsiAnnotation annotation) { PsiClass builderClass = createBuilderClass(annotation, method.getParameters()); myContext.addMethod(createBuilderMethod(builderClass, annotation)); myContext.addMethod(createBuilderConstructor(myContainingClass, builderClass, annotation)); myContext.addInnerClass(builderClass); } | processConstructor |
33,131 | String (@NotNull PsiAnnotation annotation) { final String builderMethodName = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "builderMethodName"); return StringUtil.isEmpty(builderMethodName) ? "createInitializer" : builderMethodName; } | getBuilderMethodName |
33,132 | String (@NotNull PsiAnnotation annotation) { final String builderMethodName = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "buildMethodName"); return StringUtil.isEmpty(builderMethodName) ? "create" : builderMethodName; } | getBuildMethodName |
33,133 | PsiType (@NotNull PsiClass builderClass, boolean setUnset) { final PsiClassType type = myElementFactory.createTypeByFQClassName( setUnset ? SET_FQN : UNSET_FQN, builderClass.getResolveScope() ); final PsiType[] mappings = PsiType.createArray(builderClass.getTypeParameters().length); Arrays.fill(mappings, type); return myElementFactory.createType(builderClass, mappings); } | createAllSetUnsetType |
33,134 | void (@NotNull TransformationContext context) { new DefaultBuilderStrategyHandler(context).doProcess(); } | applyTransformation |
33,135 | void () { processTypeDefinition(); processMethods(); } | doProcess |
33,136 | void () { final PsiAnnotation builderAnno = PsiImplUtil.getAnnotation(myContainingClass, BUILDER_FQN); if (!isApplicable(builderAnno, DEFAULT_STRATEGY_NAME)) return; boolean includeSuper = isIncludeSuperProperties(builderAnno); final PsiClass builderClass = createBuilderClass(builderAnno, getFields(myContext, includeSuper)); myContext.addMethod(createBuilderMethod(builderClass, builderAnno)); myContext.addInnerClass(builderClass); } | processTypeDefinition |
33,137 | LightPsiClassBuilder (@NotNull final PsiAnnotation annotation, PsiVariable @NotNull [] setters) { return createBuilderClass(annotation, setters, null); } | createBuilderClass |
33,138 | LightPsiClassBuilder (@NotNull final PsiAnnotation annotation, PsiVariable @NotNull [] setters, @Nullable PsiType builtType) { final LightPsiClassBuilder builderClass = new BuilderHelperLightPsiClass( myContainingClass, getBuilderClassName(annotation, myContainingClass) ); for (PsiVariable field : setters) { LightMethodBuilder setter = createFieldSetter(builderClass, field, annotation, myContext); builderClass.addMethod(setter); } final LightMethodBuilder buildMethod = createBuildMethod( annotation, builtType == null ? createType(myContainingClass) : builtType ); return builderClass.addMethod(buildMethod); } | createBuilderClass |
33,139 | LightMethodBuilder (@NotNull PsiClass builderClass, @NotNull PsiAnnotation annotation) { final LightMethodBuilder builderMethod = new LightMethodBuilder(myContext.getManager(), getBuilderMethodName(annotation)); builderMethod.addModifier(PsiModifier.STATIC); builderMethod.setOriginInfo(ORIGIN_INFO); builderMethod.setNavigationElement(annotation); builderMethod.setMethodReturnType(createType(builderClass)); return builderMethod; } | createBuilderMethod |
33,140 | void () { for (GrMethod method : myContext.getCodeClass().getCodeMethods()) { processMethod(method); } } | processMethods |
33,141 | void (@NotNull GrMethod method) { final PsiAnnotation annotation = PsiImplUtil.getAnnotation(method, BUILDER_FQN); if (!isApplicable(annotation, DEFAULT_STRATEGY_NAME)) return; if (method.isConstructor()) { processConstructor(method, annotation); } else if (method.hasModifierProperty(PsiModifier.STATIC)) { processFactoryMethod(method, annotation); } } | processMethod |
33,142 | void (@NotNull GrMethod method, PsiAnnotation annotation) { PsiClass builderClass = createBuilderClass(annotation, method.getParameters()); myContext.addMethod(createBuilderMethod(builderClass, annotation)); myContext.addInnerClass(builderClass); } | processConstructor |
33,143 | void (@NotNull GrMethod method, PsiAnnotation annotation) { PsiClass builderClass = createBuilderClass(annotation, method.getParameters(), method.getReturnType()); myContext.addMethod(createBuilderMethod(builderClass, annotation)); myContext.addInnerClass(builderClass); } | processFactoryMethod |
33,144 | String (@NotNull PsiAnnotation annotation) { final String builderMethodName = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "builderMethodName"); return StringUtil.isEmpty(builderMethodName) ? "builder" : builderMethodName; } | getBuilderMethodName |
33,145 | String (@NotNull PsiAnnotation annotation, @NotNull GrTypeDefinition clazz) { final String builderClassName = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "builderClassName"); return builderClassName == null ? clazz.getName() + "Builder" : builderClassName; } | getBuilderClassName |
33,146 | LightMethodBuilder (@NotNull PsiAnnotation annotation, @NotNull PsiType builtType) { final LightMethodBuilder buildMethod = new LightMethodBuilder(annotation.getManager(), getBuildMethodName(annotation)); buildMethod.setOriginInfo(ORIGIN_INFO); buildMethod.setMethodReturnType(builtType); return buildMethod; } | createBuildMethod |
33,147 | LightMethodBuilder (@NotNull PsiClass builderClass, @NotNull PsiVariable field, @NotNull PsiAnnotation annotation, @NotNull TransformationContext context) { String name = Objects.requireNonNull(field.getName()); return createFieldSetter(builderClass, name, field.getType(), annotation, field, context); } | createFieldSetter |
33,148 | LightMethodBuilder (@NotNull PsiClass builderClass, @NotNull String name, @NotNull PsiType type, @NotNull PsiAnnotation annotation, @NotNull PsiElement navigationElement, @NotNull TransformationContext context) { final LightMethodBuilder fieldSetter = new LightMethodBuilder(builderClass.getManager(), getFieldMethodName(annotation, name)); fieldSetter.addModifier(PsiModifier.PUBLIC); fieldSetter.addParameter(name, type); fieldSetter.setContainingClass(builderClass); fieldSetter.setMethodReturnType(context.eraseClassType(JavaPsiFacade.getElementFactory(builderClass.getProject()).createType(builderClass, PsiSubstitutor.EMPTY))); fieldSetter.setNavigationElement(navigationElement); fieldSetter.setOriginInfo(ORIGIN_INFO); return fieldSetter; } | createFieldSetter |
33,149 | String (@NotNull PsiAnnotation annotation, @NotNull String fieldName) { final String prefix = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "prefix"); return StringUtil.isEmpty(prefix) ? fieldName : String.format("%s%s", prefix, StringUtil.capitalize(fieldName)); } | getFieldMethodName |
33,150 | String (@NotNull PsiAnnotation annotation) { final String buildMethodName = AnnotationUtil.getDeclaredStringAttributeValue(annotation, "buildMethodName"); return StringUtil.isEmpty(buildMethodName) ? "build" : buildMethodName; } | getBuildMethodName |
33,151 | Applicability (@NotNull Collection<Applicability> applicabilities) { return applicabilities.isEmpty() ? applicable : Collections.max(applicabilities); } | totalApplicability |
33,152 | boolean (@NotNull PsiElement target) { return PropertyReferenceBase.isPropertyPsi(target); } | acceptsTarget |
33,153 | boolean (@NotNull final PsiType qualifierType, @NotNull PsiScopeProcessor processor, @NotNull final PsiElement place, @NotNull ResolveState state) { if (isInAnnotation(place)) return true; final PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(qualifierType); if (aClass == null) return true; if (aClass.getLanguage() != GroovyLanguage.INSTANCE) return true; final PsiModifierList modifierList = aClass.getModifierList(); if (modifierList == null) return true; List<PsiClass> mixins = new ArrayList<>(); for (PsiAnnotation annotation : getAllMixins(modifierList)) { final PsiAnnotationMemberValue value = annotation.findAttributeValue("value"); if (value instanceof GrAnnotationArrayInitializer) { final GrAnnotationMemberValue[] initializers = ((GrAnnotationArrayInitializer)value).getInitializers(); for (GrAnnotationMemberValue initializer : initializers) { addMixin(initializer, mixins); } } else if (value instanceof GrExpression) { addMixin((GrExpression)value, mixins); } } final MixinProcessor delegate = new MixinProcessor(processor, qualifierType, place); for (PsiClass mixin : mixins) { if (!mixin.processDeclarations(delegate, state, null, place)) { return false; } } return true; } | processClassMixins |
33,154 | String (PsiMethod element) { PsiClass aClass = element.getContainingClass(); if (aClass != null && aClass.getName() != null) { return "mixed in from " + aClass.getName(); } return "mixed in"; } | getOriginInfoForCategory |
33,155 | String (@NotNull PsiType subjectType) { return "mixed in " + subjectType.getPresentableText(); } | getOriginInfoForMixin |
33,156 | List<PsiAnnotation> (PsiModifierList modifierList) { final ArrayList<PsiAnnotation> result = new ArrayList<>(); for (PsiAnnotation annotation : modifierList.getAnnotations()) { if (GroovyCommonClassNames.GROOVY_LANG_MIXIN.equals(annotation.getQualifiedName())) { result.add(annotation); } } return result; } | getAllMixins |
33,157 | boolean (PsiElement place) { return place.getParent() instanceof GrAnnotation || place.getParent() instanceof GrAnnotationArrayInitializer; } | isInAnnotation |
33,158 | void (GrAnnotationMemberValue value, List<? super PsiClass> mixins) { if (value instanceof GrReferenceExpression) { final PsiElement resolved = ((GrReferenceExpression)value).resolve(); if (resolved instanceof PsiClass) { mixins.add((PsiClass)resolved); } } } | addMixin |
33,159 | String () { return myOriginInfo; } | getOriginInfo |
33,160 | PsiElement () { return myPrototype; } | getPrototype |
33,161 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (element instanceof PsiMethod method && GdkMethodUtil.isCategoryMethod((PsiMethod)element, myType, myPlace, state.get(PsiSubstitutor.KEY))) { String originInfo = getOriginInfoForCategory(method); return super.execute(GrGdkMethodImpl.createGdkMethod(method, false, originInfo), state); } else if (element instanceof PsiMethod) { return super.execute(new MixinedMethod((PsiMethod)element, getOriginInfoForMixin(myType)), state); } else { return super.execute(element, state); } } | execute |
33,162 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (element instanceof PsiLocalVariableImpl) { //todo a better hack return true; // the debugger creates a Java code block context and our expressions to evaluate resolve there } if (myResolveTargetKinds == null || myResolveTargetKinds.contains(getDeclarationKind(element))) { //hack for resolve of java local vars and parameters //don't check field for name because they can be aliased imported if (element instanceof PsiVariable && !(element instanceof PsiField) && myName != null && !myName.equals(((PsiVariable)element).getName())) { return true; } PsiNamedElement namedElement = (PsiNamedElement)element; PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY); if (substitutor == null) substitutor = PsiSubstitutor.EMPTY; if (myTypeArguments.length > 0 && namedElement instanceof PsiClass) { substitutor = substitutor.putAll((PsiClass)namedElement, myTypeArguments); } if (namedElement instanceof PsiClass aClass && !(namedElement instanceof PsiTypeParameter)) { if (myProcessedClasses == null) myProcessedClasses = new HashSet<>(); if (!myProcessedClasses.add(aClass.getQualifiedName())) { return true; } } boolean isAccessible = isAccessible(namedElement); final PsiElement resolveContext = state.get(RESOLVE_CONTEXT); final SpreadState spreadState = state.get(SpreadState.SPREAD_STATE); boolean isStaticsOK = isStaticsOK(namedElement, resolveContext, false); addCandidate(new GroovyResolveResultImpl(namedElement, resolveContext, spreadState, substitutor, isAccessible, isStaticsOK)); return !(isAccessible && isStaticsOK); } return true; } | execute |
33,163 | DeclarationKind (PsiElement element) { if (element instanceof PsiMethod) return DeclarationKind.METHOD; if (element instanceof PsiEnumConstant) return DeclarationKind.ENUM_CONST; if (element instanceof PsiField) return DeclarationKind.FIELD; if (element instanceof GroovyProperty) return DeclarationKind.FIELD; if (element instanceof PsiVariable) return DeclarationKind.VARIABLE; if (element instanceof PsiClass) return DeclarationKind.CLASS; if (element instanceof PsiPackage) return DeclarationKind.PACKAGE; return null; } | getDeclarationKind |
33,164 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { return super.execute(element, state) || element instanceof PsiField; } | execute |
33,165 | boolean (GroovyResolveResult last) { return !(last.getElement() instanceof PsiField) && last.isAccessible() && last.isStaticsOK() && last.getCurrentFileResolveContext() == null; } | isCorrectLocalVarOrParam |
33,166 | boolean () { return true; } | shouldProcessProperties |
33,167 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (myHint != null && element instanceof PsiNamedElement) { final String expectedName = myHint.getName(state); final String elementName = ((PsiNamedElement)element).getName(); if (expectedName != null && !expectedName.equals(elementName)) { return true; } } return super.execute(element, state); } | execute |
33,168 | boolean (@NotNull PsiElement element, @NotNull ResolveState substitutor) { if (element instanceof PsiMethod && ((PsiMethod)element).isConstructor()) { return true; } super.execute(element, substitutor); return true; } | execute |
33,169 | ResolverProcessor (PsiElement place) { return new CompletionProcessor(place, RESOLVE_KINDS_METHOD_PROPERTY, null); } | createPropertyCompletionProcessor |
33,170 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { return myDelegate.execute(element, state); } | execute |
33,171 | void (@NotNull Event event, @Nullable Object associated) { myDelegate.handleEvent(event, associated); } | handleEvent |
33,172 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (!(element instanceof PsiMember)) return true; if (!((PsiMember)element).hasModifierProperty(PsiModifier.STATIC)) return true; return super.execute(element, state); } | execute |
33,173 | boolean (@NotNull DeclarationKind kind) { assert myResolveTargetKinds != null : "don't invoke shouldProcess if resolveTargets are not declared"; return myResolveTargetKinds.contains(kind); } | shouldProcess |
33,174 | String (@NotNull ResolveState state) { assert myName != null : "don't invoke getName if myName is not declared"; return myName; } | getName |
33,175 | boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (myStopExecuting) { return false; } if (element instanceof PsiMethod method) { if (method.isConstructor() != myIsConstructor) return true; final PsiElement resolveContext = state.get(RESOLVE_CONTEXT); final SpreadState spreadState = state.get(SpreadState.SPREAD_STATE); final PsiSubstitutor partialSubstitutor = getSubstitutor(state); final NotNullComputable<PsiSubstitutor> substitutorComputer = () -> mySubstitutorComputer.obtainSubstitutor(partialSubstitutor, method, resolveContext); boolean isAccessible = isAccessible(method); boolean isStaticsOK = isStaticsOK(method, resolveContext, false); boolean isApplicable = PsiUtil.isApplicable(myArgumentTypes, method, partialSubstitutor, myPlace, true); boolean isValidResult = isStaticsOK && isAccessible && isApplicable; GroovyMethodResultImpl candidate = new GroovyMethodResultImpl( method, resolveContext, spreadState, partialSubstitutor, substitutorComputer, isAccessible, isStaticsOK, isValidResult ); if (!myAllVariants && isValidResult) { addCandidate(candidate); } else { addInapplicableCandidate(candidate); } } return true; } | execute |
33,176 | boolean (@NotNull GroovyMethodResult candidate) { if (myInapplicableCandidates == null) { myInapplicableCandidates = new LinkedHashSet<>(); } return myInapplicableCandidates.add(candidate); } | addInapplicableCandidate |
33,177 | PsiSubstitutor (@NotNull final ResolveState state) { PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY); if (substitutor == null) substitutor = PsiSubstitutor.EMPTY; return substitutor; } | getSubstitutor |
33,178 | Set<GroovyMethodResult> (Set<GroovyMethodResult> candidates) { if (myArgumentTypes == null) return candidates; Set<GroovyMethodResult> result = new LinkedHashSet<>(); for (GroovyMethodResult candidate : candidates) { if (candidate.getElement().getParameterList().getParametersCount() == myArgumentTypes.length) { result.add(candidate); } } if (!result.isEmpty()) return result; return candidates; } | filterCorrectParameterCount |
33,179 | GroovyResolveResult[] () { List<GroovyMethodResult> array = getCandidatesInternal(); if (array.size() == 1) return array.toArray(GroovyResolveResult.EMPTY_ARRAY); List<GroovyMethodResult> result = new ArrayList<>(); Iterator<GroovyMethodResult> itr = array.iterator(); result.add(itr.next()); Outer: while (itr.hasNext()) { GroovyMethodResult resolveResult = itr.next(); for (Iterator<GroovyMethodResult> iterator = result.iterator(); iterator.hasNext(); ) { final GroovyMethodResult otherResolveResult = iterator.next(); int res = GrMethodComparator.compareMethods(resolveResult, otherResolveResult, this); if (res > 0) { continue Outer; } else if (res < 0) { iterator.remove(); } } result.add(resolveResult); } return result.toArray(GroovyResolveResult.EMPTY_ARRAY); } | filterCandidates |
33,180 | boolean () { return hasApplicableCandidates() || myInapplicableCandidates != null && !myInapplicableCandidates.isEmpty(); } | hasCandidates |
33,181 | boolean () { return super.hasCandidates(); } | hasApplicableCandidates |
33,182 | void (@NotNull Event event, Object associated) { super.handleEvent(event, associated); if (JavaScopeProcessorEvent.CHANGE_LEVEL == event && hasApplicableCandidates()) { myStopExecuting = true; } } | handleEvent |
33,183 | PsiElement () { return myPlace; } | getPlace |
33,184 | boolean () { return myIsConstructor; } | isConstructor |
33,185 | void (@NotNull T candidate) { PsiElement element = candidate.getElement(); assert element == null || element.isValid() : getElementInfo(element); if (myCandidates == null) myCandidates = new ArrayList<>(); myCandidates.add(candidate); } | addCandidate |
33,186 | String (@NotNull PsiElement element) { String text; if (element instanceof LightElement) { final PsiElement context = element.getContext(); text = context instanceof LightElement ? context.toString() : context != null ? context.getText() : null; } else { text = element.getText(); } return "invalid resolve candidate: " + element.getClass() + ", text: " + text; } | getElementInfo |
33,187 | List<T> () { return myCandidates == null ? Collections.emptyList() : myCandidates; } | getCandidatesInternal |
33,188 | boolean (@NotNull PsiNamedElement namedElement) { if (namedElement instanceof GrField field) { if (PsiUtil.isAccessible(myPlace, field)) { return true; } for (GrAccessorMethod method : field.getGetters()) { if (PsiUtil.isAccessible(myPlace, method)) { return true; } } final GrAccessorMethod setter = field.getSetter(); if (setter != null && PsiUtil.isAccessible(myPlace, setter)) { return true; } return false; } return !(namedElement instanceof PsiMember) || PsiUtil.isAccessible(myPlace, ((PsiMember)namedElement)); } | isAccessible |
33,189 | boolean (@NotNull PsiNamedElement element, @Nullable PsiElement resolveContext, boolean filterStaticAfterInstanceQualifier) { if (resolveContext instanceof GrImportStatement) return true; if (element instanceof PsiModifierListOwner) { return GrStaticChecker.isStaticsOK((PsiModifierListOwner)element, myPlace, resolveContext, filterStaticAfterInstanceQualifier); } return true; } | isStaticsOK |
33,190 | boolean () { return myCandidates != null; } | hasCandidates |
33,191 | String () { return "NameHint: '" + myName + "', " + myResolveTargetKinds + ", Candidates: " + (myCandidates == null ? 0 : myCandidates.size()); } | toString |
33,192 | PsiType () { final PsiElement parent = myPlaceToInferContext.getParent(); if (parent instanceof GrReturnStatement || myExitPoints.getValue().contains(myPlaceToInferContext)) { final GrMethod method = PsiTreeUtil.getParentOfType(parent, GrMethod.class, true, GrClosableBlock.class); if (method != null) { return method.getReturnType(); } } else if (parent instanceof GrAssignmentExpression && myPlaceToInferContext.equals(((GrAssignmentExpression)parent).getRValue())) { PsiElement lValue = PsiUtil.skipParentheses(((GrAssignmentExpression)parent).getLValue(), false); if ((lValue instanceof GrExpression) && !(lValue instanceof GrIndexProperty)) { return ((GrExpression)lValue).getNominalType(); } else { return null; } } else if (parent instanceof GrVariable) { return ((GrVariable)parent).getDeclaredType(); } return null; } | inferContextType |
33,193 | boolean (PsiElement place) { while (place != null) { if (place instanceof GrMethod || place instanceof GrClosableBlock || place instanceof GrClassInitializer) return true; if (place instanceof GrThrowStatement || place instanceof GrTypeDefinitionBody || place instanceof GroovyFile) return false; place = place.getParent(); } return false; } | canBeExitPoint |
33,194 | PsiSubstitutor (@NotNull PsiSubstitutor substitutor, @NotNull PsiMethod method, @Nullable PsiElement resolveContext) { final PsiTypeParameter[] typeParameters = method.getTypeParameters(); if (myTypeArguments != null && myTypeArguments.length == typeParameters.length) { for (int i = 0; i < typeParameters.length; i++) { PsiTypeParameter typeParameter = typeParameters[i]; final PsiType typeArgument = myTypeArguments[i]; substitutor = substitutor.put(typeParameter, typeArgument); } return substitutor; } if (myArgumentTypes != null && method.hasTypeParameters()) { PsiType[] argTypes = myArgumentTypes; if (method instanceof GrGdkMethod) { //type inference should be performed from static method argTypes = ArrayUtil.prepend(myThisType.getValue(), argTypes); method = ((GrGdkMethod)method).getStaticMethod(); LOG.assertTrue(method.isValid()); } return inferMethodTypeParameters(method, substitutor, typeParameters, argTypes); } return substitutor; } | obtainSubstitutor |
33,195 | PsiSubstitutor (@NotNull PsiMethod method, @NotNull PsiSubstitutor partialSubstitutor, PsiTypeParameter @NotNull [] typeParameters, PsiType @NotNull [] argTypes) { if (typeParameters.length == 0 || myArgumentTypes == null) return partialSubstitutor; final GrSignature erasedSignature = GrClosureSignatureUtil.createSignature(method, partialSubstitutor, true); final GrSignature signature = GrClosureSignatureUtil.createSignature(method, partialSubstitutor); final GrClosureParameter[] params = signature.getParameters(); final GrClosureSignatureUtil.ArgInfo<PsiType>[] argInfos = GrClosureSignatureUtil.mapArgTypesToParameters(erasedSignature, argTypes, myPlace, true); if (argInfos == null || params.length > argInfos.length) return partialSubstitutor; Deque<InferenceStep> inferenceQueue = buildInferenceQueue(method, typeParameters, params, argInfos); PsiSubstitutor substitutor = partialSubstitutor; while (!inferenceQueue.isEmpty()) { substitutor = inferenceQueue.pollFirst().doInfer(substitutor); } for (PsiTypeParameter typeParameter : typeParameters) { if (!substitutor.getSubstitutionMap().containsKey(typeParameter)) { substitutor = inferFromContext(typeParameter, PsiUtil.getSmartReturnType(method), substitutor); if (!substitutor.getSubstitutionMap().containsKey(typeParameter)) { substitutor = substitutor.put(typeParameter, null); } } } return partialSubstitutor.putAll(substitutor); } | inferMethodTypeParameters |
33,196 | Deque<InferenceStep> (@NotNull PsiMethod method, PsiTypeParameter @NotNull [] typeParameters, GrClosureParameter[] params, GrClosureSignatureUtil.ArgInfo<PsiType>[] argInfos) { Deque<InferenceStep> inferenceQueue = new ArrayDeque<>(); List<PsiType> parameterTypes = new ArrayList<>(); List<PsiType> argumentTypes = new ArrayList<>(); for (int paramIndex = 0; paramIndex < params.length; paramIndex++) { PsiType paramType = params[paramIndex].getType(); GrClosureSignatureUtil.ArgInfo<PsiType> argInfo = argInfos[paramIndex]; if (argInfo != null) { if (argInfo.isMultiArg) { if (paramType instanceof PsiArrayType) paramType = ((PsiArrayType)paramType).getComponentType(); } for (PsiType type : argInfo.args) { PsiType argType = type; if (InheritanceUtil.isInheritor(argType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) { inferenceQueue.add(handleClosure(paramType, argType, typeParameters)); continue; } if (argType instanceof GrTupleType) { PsiType rawWildcardType = TypesUtil.rawWildcard(argType, method); argType = rawWildcardType != null ? rawWildcardType : argType; } if (argType != null) { argType = com.intellij.psi.util.PsiUtil.captureToplevelWildcards(argType, method); } parameterTypes.add(paramType); argumentTypes.add(argType); } } else { parameterTypes.add(paramType); argumentTypes.add(PsiTypes.nullType()); } } PsiType[] parameterArray = parameterTypes.toArray(PsiType.EMPTY_ARRAY); PsiType[] argumentArray = argumentTypes.toArray(PsiType.EMPTY_ARRAY); inferenceQueue.addFirst(buildStep(parameterArray, argumentArray, typeParameters)); return inferenceQueue; } | buildInferenceQueue |
33,197 | InferenceStep (PsiType targetType, PsiType argType, PsiTypeParameter @NotNull [] typeParameters) { if (targetType instanceof PsiClassType && TypesUtil.isClassType(targetType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) { PsiType[] parameters = ((PsiClassType)targetType).getParameters(); if (parameters.length != 1) return InferenceStep.EMPTY; return buildReturnTypeClosureStep(argType, parameters[0], typeParameters); } if (isSamConversionAllowed(myPlace)) { return handleConversionOfSAMType(targetType, argType, typeParameters); } return InferenceStep.EMPTY; } | handleClosure |
33,198 | InferenceStep (@Nullable PsiType targetType, @NotNull PsiType closure, PsiTypeParameter[] typeParameters) { if (!(closure instanceof PsiClassType)) return InferenceStep.EMPTY; if (!(targetType instanceof PsiClassType)) return InferenceStep.EMPTY; ClassResolveResult resolveResult = ((PsiClassType)targetType).resolveGenerics(); PsiClass samClass = resolveResult.getElement(); if (samClass == null) return InferenceStep.EMPTY; PsiMethod sam = findSingleAbstractMethod(samClass); if (sam == null) return InferenceStep.EMPTY; PsiType samReturnType = resolveResult.getSubstitutor().substitute(sam.getReturnType()); if (samReturnType == null) return InferenceStep.EMPTY; return buildReturnTypeClosureStep(closure, samReturnType, typeParameters); } | handleConversionOfSAMType |
33,199 | InferenceStep (@NotNull PsiType closure, @Nullable PsiType returnType, PsiTypeParameter[] typeParameters) { PsiType[] parameters = ((PsiClassType)closure).getParameters(); if (parameters.length != 1) return InferenceStep.EMPTY; PsiType[] rightTypes = closure instanceof GrClosureType ? ((GrClosureType)closure).inferParameters() : parameters; return buildStep(new PsiType[]{returnType}, rightTypes, typeParameters); } | buildReturnTypeClosureStep |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.