Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
---|---|---|
900 | void () { final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE); final JpsLibraryReference reference = library.createReference().asExternal(myModel); assertEquals("l", reference.getLibraryName()); assertSame(library, reference.resolve()); } | testCreateReferenceByLibrary |
901 | void () { JpsLibraryReference reference = JpsElementFactory.getInstance().createLibraryReference("l", myProject.createReference()).asExternal(myModel); assertEquals("l", reference.getLibraryName()); assertNull(reference.resolve()); final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE); assertSame(library, reference.resolve()); } | testCreateReferenceByName |
902 | void () { final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); JavaSourceRootProperties properties = JpsJavaExtensionService.getInstance().createSourceRootProperties("com.xxx"); module.addSourceRoot("file://url", JavaSourceRootType.SOURCE, properties); final JpsModuleSourceRoot root = assertOneElement(module.getSourceRoots()); assertEquals("file://url", root.getUrl()); assertSameElements(ContainerUtil.newArrayList(module.getSourceRoots(JavaSourceRootType.SOURCE)), root); assertEmpty(ContainerUtil.newArrayList(module.getSourceRoots(JavaSourceRootType.TEST_SOURCE))); JpsTypedModuleSourceRoot<JavaSourceRootProperties> typedRoot = root.asTyped(JavaSourceRootType.SOURCE); assertNotNull(typedRoot); assertEquals("com.xxx", typedRoot.getProperties().getPackagePrefix()); } | testAddSourceRoot |
903 | void () { JpsProject project = myProject; JpsModule module = project.addModule("m", JpsJavaModuleType.INSTANCE); Iterable<JpsTypedModule<JpsDummyElement>> modules = project.getModules(JpsJavaModuleType.INSTANCE); assertSameElements(ContainerUtil.newArrayList(modules), module); } | testGetModulesOfType |
904 | void () { JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); module.addExcludePattern("file://url", "*.class"); JpsExcludePattern pattern = assertOneElement(module.getExcludePatterns()); assertEquals("file://url", pattern.getBaseDirUrl()); assertEquals("*.class", pattern.getPattern()); } | testExcludedPatterns |
905 | void () { final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE); final JpsModule dep = myProject.addModule("dep", JpsJavaModuleType.INSTANCE); module.getDependenciesList().addLibraryDependency(library); module.getDependenciesList().addModuleDependency(dep); final List<? extends JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies(); assertEquals(3, dependencies.size()); assertInstanceOf(dependencies.get(0), JpsModuleSourceDependency.class); assertSame(library, assertInstanceOf(dependencies.get(1), JpsLibraryDependency.class).getLibrary()); assertSame(dep, assertInstanceOf(dependencies.get(2), JpsModuleDependency.class).getModule()); } | testAddDependency |
906 | void () { final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); final JpsModuleReference reference = module.createReference().asExternal(myModel); assertEquals("m", reference.getModuleName()); assertSame(module, reference.resolve()); } | testCreateReferenceByModule |
907 | void () { final JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference("m").asExternal(myModel); assertEquals("m", reference.getModuleName()); assertNull(reference.resolve()); final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); assertSame(module, reference.resolve()); } | testCreateReferenceByName |
908 | void () { JpsSdk<JpsDummyElement> sdk = myModel.getGlobal().addSdk("sdk", null, null, JpsJavaSdkType.INSTANCE).getProperties(); final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); module.getSdkReferencesTable().setSdkReference(JpsJavaSdkType.INSTANCE, sdk.createReference()); module.getDependenciesList().addSdkDependency(JpsJavaSdkType.INSTANCE); List<JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies(); assertEquals(2, dependencies.size()); final JpsSdkDependency dependency = assertInstanceOf(dependencies.get(1), JpsSdkDependency.class); assertSame(sdk.getParent(), dependency.resolveSdk()); } | testSdkDependency |
909 | JpsModule () { return addModule("m"); } | addModule |
910 | JpsModule (final String name) { return myProject.addModule(name, JpsJavaModuleType.INSTANCE); } | addModule |
911 | JpsLibrary () { return addLibrary("l"); } | addLibrary |
912 | JpsLibrary (final String name) { return myProject.addLibrary(name, JpsJavaLibraryType.INSTANCE); } | addLibrary |
913 | JpsJavaExtensionService () { return JpsJavaExtensionService.getInstance(); } | getJavaService |
914 | void () { final JpsModule module = addModule(); final JpsJavaModuleExtension extension = getJavaService().getOrCreateModuleExtension(module); extension.setOutputUrl("file://path"); JpsJavaModuleExtension moduleExtension = getJavaService().getModuleExtension(module); assertNotNull(moduleExtension); assertEquals("file://path", moduleExtension.getOutputUrl()); } | testModule |
915 | void () { final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE); final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE); final JpsLibraryDependency dependency = module.getDependenciesList().addLibraryDependency(library); getJavaService().getOrCreateDependencyExtension(dependency).setScope(JpsJavaDependencyScope.TEST); getJavaService().getOrCreateDependencyExtension(dependency).setExported(true); List<JpsDependencyElement> dependencies = assertOneElement(myProject.getModules()).getDependenciesList().getDependencies(); assertEquals(2, dependencies.size()); final JpsDependencyElement dep = dependencies.get(1); final JpsJavaDependencyExtension extension = getJavaService().getDependencyExtension(dep); assertNotNull(extension); assertTrue(extension.isExported()); assertSame(JpsJavaDependencyScope.TEST, extension.getScope()); } | testDependency |
916 | void (String[] args) { new Thread(() -> { //Do nothing }); } | main |
917 | void () { if (DEBUG) { System.out.println("I'm dead"); } else { new java.util.ArrayList(); } } | m |
918 | Foo () { return new Foo(); } | newFoo |
919 | String () { return null; } | m1 |
920 | List<String> () { return null; } | m2 |
921 | List () { return null; } | m3 |
922 | String[] () { return null; } | m4 |
923 | void () { if (false) { xxx(); } } | run |
924 | void () { } | xxx |
925 | void () { } | privateMethod |
926 | void (String[] args) { new Thread(Collections::emptyList); } | main |
927 | void (String[] args) { } | main |
928 | void () { } | utilityMethod |
929 | void (int i) { } | utilityMethod |
930 | void (FooExEx f) { System.out.println(f + " <--- f value"); } | m |
931 | void () { mmmm(); } | run |
932 | void () {} | run |
933 | void () { if (false) { run(); } } | run |
934 | void () { } | run |
935 | void (FooImpl f) { } | m |
936 | void (FooImpl f) { System.out.println(FooImpl.TITLE); System.out.println(f.getSomeText()); } | m |
937 | String () { return "text"; } | getSomeText |
938 | String () { return "text"; } | getSomeText |
939 | void () { final Thread thread = new Thread(() -> runDetectLoop(), "FreezeDetector Thread"); thread.setDaemon(true); thread.start(); } | start |
940 | void () { myStopped = true; } | stop |
941 | long (final long begin, final long end) { long duration = end - begin; synchronized (myPeriods) { for (TimeRange freeze : myPeriods) { final long freezeStart = freeze.begin; if (freezeStart > begin && freezeStart < end) { duration -= (Math.min(end, freeze.end) - freezeStart); } } } return duration; } | getAdjustedDuration |
942 | void () { while (!myStopped) { final long pauseDuration = checkFreeze(); if (pauseDuration > 0L) { try { Thread.sleep(pauseDuration); } catch (InterruptedException ignored) { } } } } | runDetectLoop |
943 | long () { final long current = System.currentTimeMillis(); final long previous = myPeriodBegin; if (previous > 0L && current - previous > EXPECTED_DELTA_MS) { myPeriods.add(new TimeRange(previous, current)); LOG.info("System sleep/hibernate detected from " + new Date(previous) + " till " + new Date(current) + "; " + StringUtil.formatDuration(current - previous)); } myPeriodBegin = current; return SLEEP_INTERVAL_MS - (System.currentTimeMillis() - current); } | checkFreeze |
944 | String () { if (myModules.size() == 1) return myModules.iterator().next().getName(); return StringUtil.join(myModules, GET_NAME, ","); } | getName |
945 | Set<JpsModule> () { return myModules; } | getModules |
946 | boolean () { return myContainsTests; } | containsTests |
947 | Set<ModuleBuildTarget> () { return myTargets; } | getTargets |
948 | String () { return getName(); } | toString |
949 | ModuleBuildTarget () { return myTargets.iterator().next(); } | representativeTarget |
950 | Collection<File> (ModuleChunk chunk, boolean includeTests, boolean excludeMainModuleOutput, boolean exportedOnly) { return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(includeTests), excludeMainModuleOutput, ClasspathPart.WHOLE, exportedOnly); } | getCompilationClasspathFiles |
951 | Collection<File> (ModuleChunk chunk, boolean excludeMainModuleOutput) { return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(chunk.containsTests()), excludeMainModuleOutput, ClasspathPart.BEFORE_PLUS_JDK, true); } | getPlatformCompilationClasspath |
952 | Collection<File> (ModuleChunk chunk, boolean excludeMainModuleOutput) { return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(chunk.containsTests()), excludeMainModuleOutput, ClasspathPart.AFTER_JDK, true); } | getCompilationClasspath |
953 | Collection<File> (ModuleChunk chunk, boolean excludeMainModuleOutput) { return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(chunk.containsTests()), excludeMainModuleOutput, ClasspathPart.AFTER_JDK, false); } | getCompilationModulePath |
954 | Collection<File> (ModuleChunk chunk, JpsJavaClasspathKind kind, boolean excludeMainModuleOutput, ClasspathPart classpathPart, boolean exportedOnly) { final Set<File> files = new LinkedHashSet<>(); for (JpsModule module : chunk.getModules()) { JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(module).includedIn(kind).recursively(); if (exportedOnly) { enumerator = enumerator.exportedOnly(); } if (classpathPart == ClasspathPart.BEFORE_JDK || classpathPart == ClasspathPart.BEFORE_PLUS_JDK) { enumerator = enumerator.satisfying(new BeforeJavaSdkItemFilter(module)); } else if (classpathPart == ClasspathPart.AFTER_JDK) { enumerator = enumerator.satisfying(new AfterJavaSdkItemFilter(module)); } JpsJavaDependenciesRootsEnumerator rootsEnumerator = enumerator.classes(); if (excludeMainModuleOutput) { rootsEnumerator = rootsEnumerator.withoutSelfModuleOutput(); } files.addAll(rootsEnumerator.getRoots()); } if (classpathPart == ClasspathPart.BEFORE_PLUS_JDK) { for (JpsModule module : chunk.getModules()) { JpsSdk<JpsDummyElement> sdk = module.getSdk(JpsJavaSdkType.INSTANCE); if (sdk != null) { files.addAll(sdk.getParent().getFiles(JpsOrderRootType.COMPILED)); } } } return files; } | getClasspathFiles |
955 | void (Set<? super File> classpath, @Nullable String url) { if (url != null) { classpath.add(JpsPathUtil.urlToFile(url)); } } | addFile |
956 | Collection<File> (final ModuleChunk chunk) { final boolean forTests = chunk.containsTests(); final Set<File> sourcePaths = new LinkedHashSet<>(); processModulesRecursively(chunk, JpsJavaClasspathKind.compile(forTests), module -> addFile(sourcePaths, JpsJavaExtensionService.getInstance().getOutputUrl(module, forTests))); return sourcePaths; } | getOutputPathsWithDependents |
957 | void (ModuleChunk chunk, JpsJavaClasspathKind kind, Consumer<? super JpsModule> processor) { JpsJavaExtensionService.getInstance().enumerateDependencies(chunk.getModules()).includedIn(kind).recursively().processModules(processor); } | processModulesRecursively |
958 | boolean (JpsDependencyElement dependency) { boolean isJavaSdk = dependency instanceof JpsSdkDependency && ((JpsSdkDependency)dependency).getSdkType().equals(JpsJavaSdkType.INSTANCE); if (myModule.equals(dependency.getContainingModule()) && isJavaSdk) { mySdkFound = true; } return !mySdkFound && !isJavaSdk; } | value |
959 | boolean (JpsDependencyElement dependency) { if (myModule.equals(dependency.getContainingModule())) { if (dependency instanceof JpsSdkDependency && ((JpsSdkDependency)dependency).getSdkType().equals(JpsJavaSdkType.INSTANCE)) { mySdkFound = true; return false; } } return mySdkFound; } | value |
960 | JpsModule () { return myModule; } | getModule |
961 | boolean () { return false; } | isCompiledBeforeModuleLevelBuilders |
962 | boolean (Object o) { if (this == o) { return true; } if (!(o instanceof ModuleBasedTarget)) { return false; } ModuleBasedTarget target = (ModuleBasedTarget)o; return getTargetType() == target.getTargetType() && getId().equals(target.getId()); } | equals |
963 | int () { return 31 * getId().hashCode() + getTargetType().hashCode(); } | hashCode |
964 | String () { return myTypeId; } | getTypeId |
965 | boolean (Object obj) { return obj instanceof BuildTargetType && ((BuildTargetType<?>)obj).myTypeId.equals(myTypeId); } | equals |
966 | int () { return myTypeId.hashCode(); } | hashCode |
967 | boolean () { return myFileBased; } | isFileBased |
968 | List<R> (@NotNull BuildTarget<R> target, @NotNull BuildDataPaths dataPaths) { return Collections.emptyList(); } | getAdditionalRoots |
969 | void (@NotNull ProjectDescriptor pd, @NotNull PrintWriter out) { } | writeConfiguration |
970 | String () { return getPresentableName(); } | toString |
971 | FileFilter () { return FileFilters.EVERYTHING; } | createFileFilter |
972 | Set<File> () { return Collections.emptySet(); } | getExcludedRoots |
973 | boolean () { return false; } | isGenerated |
974 | boolean () { return false; } | canUseFileCache |
975 | void (String classFileName, Collection<String> sources, ClassReader cr, boolean isGenerated) { JvmClassNodeBuilder builder = JvmClassNodeBuilder.create(classFileName, cr, isGenerated); String nodeName = builder.getReferenceID().getNodeName(); addConstantUsages(builder, nodeName, myConstantRefs.remove(nodeName)); Pair<Collection<String>, Collection<String>> imports = myImportRefs.remove(nodeName); if (imports != null) { addImportUsages(builder, imports.getFirst(), imports.getSecond()); } var node = builder.getResult(); if (!node.isPrivate()) { myNodes.add(new Pair<>(node, Iterators.collect(Iterators.map(sources, s -> new FileSource(Path.of(s))), new SmartList<>()))); } } | associate |
976 | void (String className, Collection<String> classImports, Collection<String> staticImports) { final String key = className.replace('.', '/'); if (!classImports.isEmpty() || !staticImports.isEmpty()) { myImportRefs.put(key, Pair.create(classImports, staticImports)); } else { myImportRefs.remove(key); } } | registerImports |
977 | void (String className, Collection<Callbacks.ConstantRef> cRefs) { final String key = className.replace('.', '/'); if (!cRefs.isEmpty()) { myConstantRefs.put(key, cRefs); } else { myConstantRefs.remove(key); } } | registerConstantReferences |
978 | void (JvmClassNodeBuilder builder, Collection<String> classImports, Collection<String> staticImports) { for (final String anImport : classImports) { if (!anImport.endsWith(IMPORT_WILDCARD_SUFFIX)) { builder.addUsage(new ClassUsage(anImport.replace('.', '/'))); } } for (String anImport : staticImports) { if (anImport.endsWith(IMPORT_WILDCARD_SUFFIX)) { final String iname = anImport.substring(0, anImport.length() - IMPORT_WILDCARD_SUFFIX.length()).replace('.', '/'); builder.addUsage(new ClassUsage(iname)); builder.addUsage(new ImportStaticOnDemandUsage(iname)); } else { final int i = anImport.lastIndexOf('.'); if (i > 0 && i < anImport.length() - 1) { final String iname = anImport.substring(0, i).replace('.', '/'); final String memberName = anImport.substring(i + 1); builder.addUsage(new ClassUsage(iname)); builder.addUsage(new ImportStaticMemberUsage(iname, memberName)); } } } } | addImportUsages |
979 | void (JvmClassNodeBuilder builder, String nodeName, Collection<? extends Callbacks.ConstantRef> cRefs) { if (cRefs != null) { for (Callbacks.ConstantRef ref : cRefs) { final String constantOwner = ref.getOwner().replace('.', '/'); if (!constantOwner.equals(nodeName)) { builder.addUsage(new FieldUsage(constantOwner, ref.getName(), ref.getDescriptor())); } } } } | addConstantUsages |
980 | List<ResourcesTarget> (@NotNull JpsModel model) { List<JpsModule> modules = model.getProject().getModules(); List<ResourcesTarget> targets = new ArrayList<>(modules.size()); for (JpsModule module : modules) { targets.add(new ResourcesTarget(module, this)); } return targets; } | computeAllTargets |
981 | Loader (@NotNull JpsModel model) { return new Loader(model); } | createLoader |
982 | boolean () { return myTests; } | isTests |
983 | ResourcesTargetType (boolean tests) { return tests ? TEST : PRODUCTION; } | getInstance |
984 | void (CompileContext context, File file) { registerFilesToCompile(context, Collections.singleton(file)); } | registerFileToCompile |
985 | void (CompileContext context, Collection<? extends File> files) { getFilesContainer(context, FILES_TO_COMPILE_KEY).addAll(files); } | registerFilesToCompile |
986 | void (CompileContext context, Collection<? extends File> files) { getFilesContainer(context, COMPILED_WITH_ERRORS_KEY).addAll(files); } | registerFilesWithErrors |
987 | void (CompileContext context, File file) { registerSuccessfullyCompiled(context, Collections.singleton(file)); } | registerSuccessfullyCompiled |
988 | void (CompileContext context, Collection<? extends File> files) { getFilesContainer(context, SUCCESSFULLY_COMPILED_FILES_KEY).addAll(files); } | registerSuccessfullyCompiled |
989 | void (@NotNull CompileContext context, @NotNull FileFilter filter) { List<FileFilter> filters = SKIP_MARKING_DIRTY_FILTERS_KEY.get(context); if (filters == null) { SKIP_MARKING_DIRTY_FILTERS_KEY.set(context, filters = new ArrayList<>()); } filters.add(filter); } | registerFilterToSkipMarkingAffectedFileDirty |
990 | void (CompileContext context) { //during next compilation round ModuleLevelBuilders may register filters again so we need to remove old ones to avoid duplicating instances SKIP_MARKING_DIRTY_FILTERS_KEY.set(context, null); } | clearDataOnRoundCompletion |
991 | JavaModuleIndex (CompileContext context) { JpsProject project = context.getProjectDescriptor().getProject(); return JpsJavaExtensionService.getInstance().getJavaModuleIndex(project); } | getJavaModuleIndex |
992 | FileFilter (final List<? extends FileFilter> filters) { if (filters == null || filters.isEmpty()) return null; return pathname -> { for (FileFilter filter : filters) { if (filter.accept(pathname)) { return true; } } return false; }; } | createOrFilter |
993 | void (@NotNull Set<? extends File> files, @Nullable FileFilter filter) { if (filter != null) { for (final Iterator<? extends File> it = files.iterator(); it.hasNext();) { if (filter.accept(it.next())) { it.remove(); } } } } | removeFilesAcceptedByFilter |
994 | boolean (CompileContext context) { return isForcedRecompilationAllJavaModules(context.getScope()); } | isForcedRecompilationAllJavaModules |
995 | boolean (CompileScope scope) { return scope.isBuildForcedForAllTargets(JavaModuleBuildTargetType.PRODUCTION) && scope.isBuildForcedForAllTargets(JavaModuleBuildTargetType.TEST); } | isForcedRecompilationAllJavaModules |
996 | boolean (CompileContext context) { CompileScope scope = context.getScope(); return scope.isBuildIncrementally(JavaModuleBuildTargetType.PRODUCTION) || scope.isBuildIncrementally(JavaModuleBuildTargetType.TEST); } | isCompileJavaIncrementally |
997 | Set<File> (CompileContext context, final Key<Set<File>> dataKey) { Set<File> files = dataKey.get(context); if (files == null) { files = FileCollectionFactory.createCanonicalFileSet(); dataKey.set(context, files); } return files; } | getFilesContainer |
998 | Set<String> (ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder) { if (!dirtyFilesHolder.hasRemovedFiles()) { return Collections.emptySet(); } final Set<String> removed = CollectionFactory.createFilePathSet(); for (ModuleBuildTarget target : chunk.getTargets()) { removed.addAll(dirtyFilesHolder.getRemovedFiles(target)); } return removed; } | getRemovedPaths |
999 | boolean (ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder) { if (dirtyFilesHolder.hasRemovedFiles()) { for (ModuleBuildTarget target : chunk.getTargets()) { if (!dirtyFilesHolder.getRemovedFiles(target).isEmpty()) { return true; } } } return false; } | hasRemovedPaths |