Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
32,700
Collection<MethodSignature> (@NotNull GrTypeDefinition aClass) { return getMapToOverrideImplement(aClass, true, true).keySet(); }
getMethodSignaturesToImplement
32,701
Collection<CandidateInfo> (GrTypeDefinition aClass, boolean toImplement) { return getMapToOverrideImplement(aClass, toImplement, true).values(); }
getMethodsToOverrideImplement
32,702
void (PsiClass aClass, boolean skipImplemented, Map<MethodSignature, PsiMethod> abstracts, Map<MethodSignature, PsiMethod> finals, Map<MethodSignature, PsiMethod> concretes, HierarchicalMethodSignature signature, PsiMethod method) { PsiUtilCore.ensureValid(method); if (GrModifierListUtil.hasCodeModifierProperty(method, PsiModifier.STATIC) || GrModifierListUtil.hasCodeModifierProperty(method, PsiModifier.FINAL) || GrModifierListUtil.hasCodeModifierProperty(method, PsiModifier.PRIVATE)) return; PsiClass hisClass = method.getContainingClass(); if (hisClass == null) return; // filter non-immediate super constructors if (method.isConstructor() && (!aClass.isInheritor(hisClass, false) || aClass instanceof PsiAnonymousClass || aClass.isEnum())) { return; } // filter already implemented if (skipImplemented) { PsiMethod implemented = MethodSignatureUtil.findMethodBySignature(aClass, signature, false); if (implemented != null && !(implemented instanceof GrTraitMethod) && !(implemented instanceof GrLightMethodBuilder)) { return; } } if (method.hasModifierProperty(PsiModifier.FINAL)) { finals.put(signature, method); return; } Map<MethodSignature, PsiMethod> map = method.hasModifierProperty(PsiModifier.ABSTRACT) ? abstracts : concretes; fillMap(signature, method, map); if (isDefaultMethod(method)) { fillMap(signature, method, concretes); } }
processMethod
32,703
void (HierarchicalMethodSignature signature, PsiMethod method, Map<MethodSignature, PsiMethod> map) { final PsiMethod other = map.get(signature); if (other == null || preferLeftForImplement(method, other)) { map.put(signature, method); } }
fillMap
32,704
boolean (PsiMethod left, PsiMethod right) { if (PsiUtil.getAccessLevel(left.getModifierList()) > PsiUtil.getAccessLevel(right.getModifierList())) return true; PsiClass lClass = left.getContainingClass(); PsiClass rClass = right.getContainingClass(); if (lClass != null && !lClass.isInterface()) return true; if (rClass != null && !rClass.isInterface()) return false; // implement annotated method PsiAnnotation[] leftAnnotations = left.getModifierList().getAnnotations(); PsiAnnotation[] rightAnnotations = right.getModifierList().getAnnotations(); return leftAnnotations.length > rightAnnotations.length; }
preferLeftForImplement
32,705
boolean (PsiMethod method) { return method instanceof GrMethod && !method.getModifierList().hasExplicitModifier(PsiModifier.ABSTRACT) && GrTraitUtil.isTrait(method.getContainingClass()); }
isDefaultMethod
32,706
void (PsiClass aClass, Map<MethodSignature, PsiMethod> abstracts, Map<MethodSignature, PsiMethod> finals, Map<MethodSignature, PsiMethod> concretes, Map<MethodSignature, CandidateInfo> result) { for (Map.Entry<MethodSignature, PsiMethod> entry : abstracts.entrySet()) { MethodSignature signature = entry.getKey(); PsiMethod abstractOne = entry.getValue(); PsiMethod concrete = concretes.get(signature); if (concrete == null || PsiUtil.getAccessLevel(concrete.getModifierList()) < PsiUtil.getAccessLevel(abstractOne.getModifierList()) || !abstractOne.getContainingClass().isInterface() && abstractOne.getContainingClass().isInheritor(concrete.getContainingClass(), true) || isDefaultMethod(abstractOne)) { if (finals.get(signature) == null) { PsiSubstitutor subst = OverrideImplementExploreUtil.correctSubstitutor(abstractOne, signature.getSubstitutor()); CandidateInfo info = new CandidateInfo(abstractOne, subst); result.put(signature, info); } } } /*for (final PsiMethod method : new GroovyMethodImplementor().getMethodsToImplement(aClass)) { MethodSignature signature = MethodSignatureUtil.createMethodSignature(method.getName(), method.getParameterList(), method.getTypeParameterList(), PsiSubstitutor.EMPTY, method.isConstructor()); CandidateInfo info = new CandidateInfo(method, PsiSubstitutor.EMPTY); result.put(signature, info); }*/ }
collectMethodsToImplement
32,707
Library[] (final Module module, final Condition<? super Library> condition) { if (module == null) return Library.EMPTY_ARRAY; final ArrayList<Library> libraries = new ArrayList<>(); ApplicationManager.getApplication().runReadAction(() -> populateOrderEntries(module, condition, libraries, false, new HashSet<>())); return libraries.toArray(Library.EMPTY_ARRAY); }
getLibrariesByCondition
32,708
void (@NotNull Module module, Condition<? super Library> condition, ArrayList<? super Library> libraries, boolean exportedOnly, Set<? super Module> visited) { if (!visited.add(module)) { return; } for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) { if (entry instanceof LibraryOrderEntry libEntry) { if (exportedOnly && !libEntry.isExported()) { continue; } Library library = libEntry.getLibrary(); if (condition.value(library)) { libraries.add(library); } } else if (entry instanceof ModuleOrderEntry) { final Module dep = ((ModuleOrderEntry)entry).getModule(); if (dep != null) { populateOrderEntries(dep, condition, libraries, true, visited); } } } }
populateOrderEntries
32,709
Library[] (Condition<? super Library> condition) { LibraryTable table = LibraryTablesRegistrar.getInstance().getLibraryTable(); List<Library> libs = ContainerUtil.findAll(table.getLibraries(), condition); return libs.toArray(Library.EMPTY_ARRAY); }
getGlobalLibraries
32,710
String (Library library) { final VirtualFile[] classRoots = library.getFiles(OrderRootType.CLASSES); final String home = getGroovyLibraryHome(classRoots); return home == null ? "" : home; }
getGroovyLibraryHome
32,711
boolean (@Nullable Module module) { return module != null && getGroovyHomePath(module) != null; }
hasGroovySdk
32,712
VirtualFile (@NotNull Module module, final String classQName) { GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module); for (PsiClass psiClass : JavaPsiFacade.getInstance(module.getProject()).findClasses(classQName, scope)) { VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile(); final VirtualFile local = getLocalFor(virtualFile); if (local != null) { return local; } } return null; }
findJarWithClass
32,713
VirtualFile (VirtualFile virtualFile) { if (virtualFile != null) { VirtualFileSystem fileSystem = virtualFile.getFileSystem(); if (fileSystem instanceof ArchiveFileSystem) { return ((ArchiveFileSystem)fileSystem).getLocalByEntry(virtualFile); } } return null; }
getLocalFor
32,714
String (@NotNull Module module) { if (!DumbService.isDumb(module.getProject())) { final VirtualFile local = findJarWithClass(module, SOME_GROOVY_CLASS); if (local != null) { final VirtualFile parent = local.getParent(); if (parent != null) { if ((LIB.equals(parent.getName()) || EMBEDDABLE.equals(parent.getName())) && parent.getParent() != null) { return parent.getParent().getPath(); } return parent.getPath(); } } } final String home = getGroovyLibraryHome(OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots()); return StringUtil.isEmpty(home) ? null : home; }
getGroovyHomePath
32,715
String (VirtualFile[] classRoots) { for (VirtualFile file : classRoots) { final String name = file.getName(); if (GroovyConfigUtils.GROOVY_JAR_PATTERN.matcher(name).matches()) { String jarPath = file.getPresentableUrl(); File realFile = new File(jarPath); if (realFile.exists()) { File parentFile = realFile.getParentFile(); if (parentFile != null) { if (LIB.equals(parentFile.getName())) { return parentFile.getParent(); } return parentFile.getPath(); } } } } return null; }
getGroovySdkHome
32,716
String (VirtualFile[] classRoots) { for (VirtualFile file : classRoots) { final String name = file.getName(); if (GroovyConfigUtils.matchesGroovyAll(name)) { String jarPath = file.getPresentableUrl(); File realFile = new File(jarPath); if (realFile.exists()) { return realFile.getPath(); } } } return null; }
getEmbeddableGroovyJar
32,717
String (VirtualFile[] classRoots) { final String sdkHome = getGroovySdkHome(classRoots); if (sdkHome != null) { return sdkHome; } final String embeddable = getEmbeddableGroovyJar(classRoots); if (embeddable != null) { final File emb = new File(embeddable); if (emb.exists()) { final File parent = emb.getParentFile(); if (EMBEDDABLE.equals(parent.getName()) || LIB.equals(parent.getName())) { return parent.getParent(); } return parent.getPath(); } } return null; }
getGroovyLibraryHome
32,718
VirtualFile (@NotNull VirtualFile libFile) { VirtualFile local = getLocalFor(libFile); if (local != null) { return local; } return libFile; }
getLocalFile
32,719
void (ModifiableRootModel model, LibraryOrderEntry addedEntry) { final OrderEntry[] order = model.getOrderEntries(); //place library after module sources assert order[order.length - 1] == addedEntry; int insertionPoint = -1; for (int i = 0; i < order.length - 1; i++) { if (order[i] instanceof ModuleSourceOrderEntry) { insertionPoint = i + 1; break; } } if (insertionPoint >= 0) { System.arraycopy(order, insertionPoint, order, insertionPoint + 1, order.length - 1 - insertionPoint); order[insertionPoint] = addedEntry; model.rearrangeOrderEntries(order); } }
placeEntryToCorrectPlace
32,720
File[] (String dirPath, final Pattern pattern) { File distDir = new File(dirPath); File[] files = distDir.listFiles((dir, name) -> pattern.matcher(name).matches()); return files != null ? files : new File[0]; }
getFilesInDirectoryByPattern
32,721
PsiClass () { return null; }
getContainingClass
32,722
PsiType () { return myMethod.getReturnType(); }
getReturnType
32,723
PsiTypeElement () { return myMethod.getReturnTypeElement(); }
getReturnTypeElement
32,724
String () { return "grails dynamic method"; }
toString
32,725
PsiIdentifier () { return myMethod.getNameIdentifier(); }
getNameIdentifier
32,726
List<MethodSignatureBackedByPsiMethod> (boolean checkAccess) { return Collections.emptyList(); }
findSuperMethodSignaturesIncludingStatic
32,727
PsiMethod () { return null; }
findDeepestSuperMethod
32,728
PsiElement () { return myMethod.copy(); }
copy
32,729
GrMember[] () { return GrMember.EMPTY_ARRAY; }
getMembers
32,730
GrModifierList () { return myMethod.getModifierList(); }
getModifierList
32,731
boolean (@NonNls @NotNull String name) { return myMethod.hasModifierProperty(name); }
hasModifierProperty
32,732
GrOpenBlock () { return null; }
getBlock
32,733
void (GrCodeBlock newBlock) { }
setBlock
32,734
GrTypeElement () { return myMethod.getReturnTypeElementGroovy(); }
getReturnTypeElementGroovy
32,735
PsiType () { return myMethod.getInferredReturnType(); }
getInferredReturnType
32,736
GrParameterList () { return myMethod.getParameterList(); }
getParameterList
32,737
PsiReferenceList () { return myMethod.getThrowsList(); }
getThrowsList
32,738
PsiCodeBlock () { return null; }
getBody
32,739
boolean () { return false; }
isConstructor
32,740
boolean () { return myMethod.isVarArgs(); }
isVarArgs
32,741
MethodSignature (@NotNull PsiSubstitutor substitutor) { return myMethod.getSignature(substitutor); }
getSignature
32,742
PsiElement () { return myMethod.getNameIdentifierGroovy(); }
getNameIdentifierGroovy
32,743
void (@NotNull GroovyElementVisitor visitor) { }
accept
32,744
void (@NotNull GroovyElementVisitor visitor) { }
acceptChildren
32,745
GrDocComment () { return null; }
getDocComment
32,746
boolean () { return myMethod.isDeprecated(); }
isDeprecated
32,747
boolean () { return myMethod.hasTypeParameters(); }
hasTypeParameters
32,748
PsiTypeParameterList () { return myMethod.getTypeParameterList(); }
getTypeParameterList
32,749
HierarchicalMethodSignature () { return myMethod.getHierarchicalMethodSignature(); }
getHierarchicalMethodSignature
32,750
boolean (PsiElement another) { return another instanceof GrDynamicMethodImpl && myMethod.isEquivalentTo(((GrDynamicMethodImpl)another).myMethod); }
isEquivalentTo
32,751
GrTypeElement (PsiType newReturnType) { throw new UnsupportedOperationException("Dynamic method can't change it's return type"); }
setReturnType
32,752
GrDocComment () { return null; }
getDocComment
32,753
PsiClass () { return myContainingClass; }
getContainingClass
32,754
boolean () { return false; }
isDeprecated
32,755
PsiElement () { return myNavigationalElement; }
getNavigationElement
32,756
Icon (int flags) { return JetgroovyIcons.Groovy.Property; }
getIcon
32,757
PsiFile () { return myContainingClass != null ? myContainingClass.getContainingFile() : null; }
getContainingFile
32,758
String () { return "Dynamic Property: " + getName(); }
toString
32,759
String () { return myField.getName(); }
getName
32,760
PsiType () { return myField.getType(); }
getType
32,761
GrModifierList () { return myField.getModifierList(); }
getModifierList
32,762
PsiTypeElement () { return myField.getTypeElement(); }
getTypeElement
32,763
boolean (@NonNls @NotNull String name) { return myField.hasModifierProperty(name); }
hasModifierProperty
32,764
PsiExpression () { return myField.getInitializer(); }
getInitializer
32,765
PsiIdentifier () { return myField.getNameIdentifier(); }
getNameIdentifier
32,766
boolean () { return myField.hasInitializer(); }
hasInitializer
32,767
Object () { return null; }
computeConstantValue
32,768
PsiElement () { return myField.getNameIdentifierGroovy(); }
getNameIdentifierGroovy
32,769
void (@NotNull GroovyElementVisitor visitor) { }
accept
32,770
void (@NotNull GroovyElementVisitor visitor) { }
acceptChildren
32,771
PsiType () { return myField.getTypeGroovy(); }
getTypeGroovy
32,772
PsiType () { return myField.getDeclaredType(); }
getDeclaredType
32,773
boolean () { return myField.isProperty(); }
isProperty
32,774
GrExpression () { return myField.getInitializerGroovy(); }
getInitializerGroovy
32,775
GrAccessorMethod () { return myField.getSetter(); }
getSetter
32,776
GrTypeElement () { return myField.getTypeElementGroovy(); }
getTypeElementGroovy
32,777
void (GrExpression initializer) { throw new IncorrectOperationException("cannot set initializer to dynamic property!"); }
setInitializerGroovy
32,778
boolean (PsiElement another) { return another instanceof GrDynamicPropertyImpl && myManager.areElementsEquivalent(myField, ((GrDynamicPropertyImpl)another).myField) && myManager.areElementsEquivalent(myContainingClass, ((GrDynamicPropertyImpl)another).myContainingClass); }
isEquivalentTo
32,779
ClassMemberHolder (@NotNull Project project, @NotNull String source) { ConcurrentHashMap<String, ClassMemberHolder> map = project.getUserData(KEY); if (map == null) { map = new ConcurrentHashMap<>(); map = ((UserDataHolderEx)project).putUserDataIfAbsent(KEY, map); } ClassMemberHolder res = map.get(source); if (res == null) { res = new ClassMemberHolder(project, source); ClassMemberHolder oldValue = map.putIfAbsent(source, res); if (oldValue != null) { res = oldValue; } } assert source.equals(res.myClassSource) : "Store class sources in static constant, do not generate it in each call."; return res; }
getMembers
32,780
boolean (PsiScopeProcessor processor, PsiClass psiClass, GrReferenceExpression ref, String classSource) { return process(processor, GrStaticChecker.isInStaticContext(ref, psiClass), ref, classSource); }
process
32,781
boolean (PsiScopeProcessor processor, boolean isInStaticContext, PsiElement place, String classSource) { ElementClassHint classHint = processor.getHint(ElementClassHint.KEY); String name = ResolveUtil.getNameHint(processor); ClassMemberHolder memberHolder = getMembers(place.getProject(), classSource); if (ResolveUtil.shouldProcessMethods(classHint)) { PsiMethod[] methods = isInStaticContext ? memberHolder.getStaticMethods(name) : memberHolder.getMethods(name); for (PsiMethod method : methods) { if (!processor.execute(method, ResolveState.initial())) return false; } } if (ResolveUtil.shouldProcessProperties(classHint)) { PsiField[] fields = isInStaticContext ? memberHolder.getStaticFields(name) : memberHolder.getFields(name); for (PsiField field : fields) { if (!processor.execute(field, ResolveState.initial())) return false; } } return true; }
process
32,782
boolean (PsiMethod method, String version) { String since = getCommentValue(method, "since"); if (since == null) return true; return version.compareTo(since) >= 0; }
checkVersion
32,783
String (PsiMethod method, @NlsSafe String commentTagName) { Map<String, String> commentMap = method.getUserData(COMMENT_KEY); if (commentMap == null) return null; return commentMap.get(commentTagName); }
getCommentValue
32,784
GrTypeDefinition () { return myClass; }
getParsedClass
32,785
void (GrTypeDefinition psiClass) { Set<String> existingMethods = new HashSet<>(); for (PsiMethod psiMethod : psiClass.getCodeMethods()) { if (!(psiMethod instanceof GrAccessorMethod) && !(psiMethod instanceof GrReflectedMethod) && !existingMethods.add(psiMethod.getText())) { throw new RuntimeException("Duplicated field in dynamic class: " + psiClass.getName() + ":" + psiMethod.getText()); } } }
checkDuplicatedMethods
32,786
PsiMethod[] () { return getMethods(null); }
getMethods
32,787
PsiMethod[] (@Nullable String nameHint) { PsiMethod[] res = myNonStaticMethodMap.get(nameHint); if (res == null) { res = PsiMethod.EMPTY_ARRAY; } return res; }
getDynamicMethods
32,788
PsiMethod[] (@Nullable String nameHint) { PsiMethod[] res = myStaticMethodMap.get(nameHint); if (res == null) { res = PsiMethod.EMPTY_ARRAY; } return res; }
getStaticMethods
32,789
PsiMethod[] (@Nullable String nameHint) { PsiMethod[] res = myMethodMap.get(nameHint); if (res == null) { res = PsiMethod.EMPTY_ARRAY; } return res; }
getMethods
32,790
PsiField[] () { return getFields(null); }
getFields
32,791
PsiField[] (@Nullable String nameHint) { PsiField[] res = myFieldMap.get(nameHint); if (res == null) { res = PsiField.EMPTY_ARRAY; } return res; }
getFields
32,792
PsiField[] (@Nullable String nameHint) { PsiField[] res = myStaticFieldMap.get(nameHint); if (res == null) { res = PsiField.EMPTY_ARRAY; } return res; }
getStaticFields
32,793
boolean (@Nullable PsiElement element) { return element instanceof DynamicElement; }
isDynamicElement
32,794
boolean (@Nullable PsiElement element, @NotNull String classSource) { return element instanceof DynamicElement && classSource.equals(((DynamicElement)element).getSource()); }
isDynamicElement
32,795
String () { return myMethod.getText(); }
getText
32,796
GrParameterList () { return myParameterList; }
getParameterList
32,797
Icon (int flags) { return myMethod.getIcon(flags); }
getIcon
32,798
String () { return mySource; }
getSource
32,799
PsiClass () { return myMethod.getContainingClass(); }
getSourceClass