Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
276,400
List<URL> () { List<URL> result = new ArrayList<>(); for (Path file : classPath.getFiles()) { try { result.add(file.toUri().toURL()); } catch (MalformedURLException ignored) { } } return result; }
getUrls
276,401
List<Path> () { return classPath.getFiles(); }
getFiles
276,402
boolean (String name) { Class<?> aClass = findLoadedClass(name); return aClass != null && aClass.getClassLoader() == this; }
hasLoadedClass
276,403
void (String name) { int lastDotIndex = name.lastIndexOf('.'); if (lastDotIndex == -1) { return; } String packageName = name.substring(0, lastDotIndex); // check if the package is already loaded if (isPackageDefined(packageName)) { return; } try { definePackage(packageName, null, null, null, null, null, null, null); } ...
definePackageIfNeeded
276,404
boolean (String packageName) { return getPackage(packageName) != null; }
isPackageDefined
276,405
boolean (@NotNull String name) { return true; }
isByteBufferSupported
276,406
Enumeration<URL> (@NotNull String name) { return classPath.getResources(name); }
findResources
276,407
Object (String className) { return classLoadingLocks == null ? this : classLoadingLocks.getOrCreateLock(className); }
getClassLoadingLock
276,408
CachePool () { return new CachePoolImpl(); }
createCachePool
276,409
String (@NotNull String path) { if (path.isEmpty()) { return path; } if (path.charAt(0) == '.') { if (path.length() == 1) { return ""; } char c = path.charAt(1); if (c == '/') { path = path.substring(2); } } // trying to speed up the common case when there are no "//" or "/." int index = -1; do { index = path.indexOf('...
toCanonicalPath
276,410
boolean (@NotNull CharSequence text, @NotNull CharSequence suffix) { int l1 = text.length(); int l2 = suffix.length(); if (l1 < l2) return false; for (int i = l1 - 1; i >= l1 - l2; i--) { if (text.charAt(i) != suffix.charAt(i + l2 - l1)) return false; } return true; }
endsWith
276,411
int (@NotNull CharSequence s, char c, int start, int end) { start = Math.max(start, 0); for (int i = Math.min(end, s.length()) - 1; i >= start; i--) { if (s.charAt(i) == c) return i; } return -1; }
lastIndexOf
276,412
void (StringBuilder result, int dots, int start) { if (dots == 2) { int pos = -1; if (!endsWith(result, "/../") && !"../".contentEquals(result)) { pos = lastIndexOf(result, '/', start, result.length() - 1); if (pos >= 0) { ++pos; // separator found, trim to next char } else if (start > 0) { pos = start; // the path is ...
processDots
276,413
int (String path, StringBuilder result) { if (!path.isEmpty() && path.charAt(0) == '/') { result.append('/'); return 1; } if (path.length() > 2 && path.charAt(1) == ':' && path.charAt(2) == '/') { result.append(path, 0, 3); return 3; } return 0; }
processRoot
276,414
void (String message, Throwable t) { try { Class<?> logger = loadClass("com.intellij.openapi.diagnostic.Logger"); MethodHandles.Lookup lookup = MethodHandles.lookup(); Object instance = lookup.findStatic(logger, "getInstance", MethodType.methodType(logger, Class.class)).invoke(getClass()); lookup.findVirtual(logger, "e...
logError
276,415
String (@NotNull String url) { int start = url.startsWith("file:") ? "file:".length() : 0; int end = url.indexOf("!/"); if (url.charAt(start) == '/') { // trim leading slashes before drive letter if (url.length() > (start + 2) && url.charAt(start + 2) == ':') { start++; } } return UrlUtilRt.unescapePercentSequences(url...
urlToFilePath
276,416
UrlClassLoader () { return new UrlClassLoader(this, null, isParallelCapable); }
get
276,417
long[] () { return a; }
elements
276,418
long[] (final long[] array, final int length, final int preserve) { final long[] t = new long[length]; System.arraycopy(array, 0, t, 0, preserve); return t; }
forceCapacity
276,419
void (int capacity) { if (capacity <= a.length) { return; } if (a != DEFAULT_EMPTY_ARRAY) { capacity = (int)Math.max( Math.min((long)a.length + (a.length >> 1), MAX_ARRAY_SIZE), capacity); } else if (capacity < DEFAULT_INITIAL_CAPACITY) { capacity = DEFAULT_INITIAL_CAPACITY; } a = forceCapacity(a, capacity, size); asse...
grow
276,420
void (final int index, final long k) { grow(size + 1); if (index != size) { System.arraycopy(a, index, a, index + 1, size - index); } a[index] = k; size++; assert size <= a.length; }
add
276,421
boolean (final long k) { grow(size + 1); a[size++] = k; assert size <= a.length; return true; }
add
276,422
int () { return size; }
size
276,423
boolean (final Object o) { if (o == this) { return true; } if (!(o instanceof StrippedLongArrayList)) { return false; } int s = size(); if (s != ((StrippedLongArrayList)o).size()) { return false; } final long[] a1 = a; final long[] a2 = ((StrippedLongArrayList)o).a; if (a1 == a2) { return true; } while (s-- != 0) { if ...
equals
276,424
void (@NotNull String dir, @NotNull Predicate<? super String> filter, @NotNull BiConsumer<? super String, ? super InputStream> consumer) { }
processResources
276,425
String () { return url.toString(); }
toString
276,426
URL () { URL result = url; if (result == null) { try { result = new URL(baseUrl, entry.getName()); } catch (MalformedURLException e) { throw new RuntimeException(e); } url = result; } return result; }
getURL
276,427
int () { return classPackageHashes.size(); }
classPackageCount
276,428
int () { return resourcePackageHashes.size(); }
resourcePackageCount
276,429
long[] () { return classPackageHashes.keys; }
classPackages
276,430
long[] () { return resourcePackageHashes.keys; }
resourcePackages
276,431
LongPredicate (boolean forClasses) { return new LongPredicate() { boolean addZero = forClasses ? classPackageHashes.hasNull() : resourcePackageHashes.hasNull(); @Override public boolean test(long it) { if (it == 0) { if (!addZero) { return false; } addZero = false; } return true; } }; }
getKeyFilter
276,432
boolean (long it) { if (it == 0) { if (!addZero) { return false; } addZero = false; } return true; }
test
276,433
long (@NotNull String resourcePath, int endIndex) { return endIndex <= 0 ? 0 : Xx3UnencodedString.hashUnencodedStringRange(resourcePath, endIndex); }
getPackageNameHash
276,434
void (long[] hashes, StrippedLongToObjectMap<Loader[]> map, Loader loader, @Nullable LongPredicate hashFilter) { Loader[] singleArray = null; for (long hash : hashes) { if (hashFilter != null && !hashFilter.test(hash)) { continue; } int index = map.index(hash); if (index < 0) { if (singleArray == null) { singleArray = ...
addPackages
276,435
Object (@NotNull String className) { Object lock = map.computeIfAbsent(className, it -> new WeakLockReference(it, new Object(), queue)).get(); if (lock != null) { return lock; } Object newLock = new Object(); WeakLockReference newRef = new WeakLockReference(className, newLock, queue); while (true) { removeExpired(); We...
getOrCreateLock
276,436
void () { while (true) { WeakLockReference ref = (WeakLockReference)queue.poll(); if (ref == null) { break; } map.remove(ref.className, ref); } }
removeExpired
276,437
int () { return containsNull ? size - 1 : size; }
realSize
276,438
boolean () { return containsNull; }
hasNull
276,439
boolean (final long k) { int pos; if (k == 0) { if (containsNull) { return false; } containsNull = true; } else { long curr; final long[] key = this.keys; // The starting point. if (!((curr = key[pos = (int)k & mask]) == 0)) { if (curr == k) { return false; } while (!((curr = key[pos = pos + 1 & mask]) == 0)) { if (cur...
add
276,440
boolean (final long k) { if (k == 0) { return containsNull; } long curr; final long[] key = this.keys; int pos; // The starting point. if ((curr = key[pos = (int)k & mask]) == 0) { return false; } if (k == curr) { return true; } while (true) { if ((curr = key[pos = pos + 1 & mask]) == 0) { return false; } if (k == curr...
contains
276,441
int () { return size; }
size
276,442
boolean () { return size == 0; }
isEmpty
276,443
boolean () { return c != 0; }
hasNext
276,444
long () { if (!hasNext()) { throw new NoSuchElementException(); } c--; if (mustReturnNull) { mustReturnNull = false; return keys[n]; } long[] key = StrippedLongSet.this.keys; for (; ; ) { long v = key[--pos]; if (v != 0) { return v; } } }
nextLong
276,445
SetIterator () { return new SetIterator(); }
iterator
276,446
void (final int newN) { final long[] key = this.keys; final int mask = newN - 1; // Note that this is used by the hashing macro final long[] newKey = new long[newN + 1]; int i = n, pos; for (int j = realSize(); j-- != 0; ) { while (key[--i] == 0) ; if (!(newKey[pos = (int)key[i] & mask] == 0)) { while (!(newKey[pos = p...
rehash
276,447
long[] () { long[] result = new long[size]; SetIterator iterator = iterator(); int i = 0; while (iterator.hasNext()) { result[i++] = iterator.nextLong(); } return result; }
toArray
276,448
CharSequence (@NotNull CharSequence s, int from, int end) { int i = indexOf(s, from, end); if (i == -1) { return s.subSequence(from, end); } StringBuilder decoded = new StringBuilder(); decoded.append(s, from, i); byte[] byteBuffer = null; int byteBufferSize = 0; while (i < end) { char c = s.charAt(i); if (c == '%') { ...
unescapePercentSequences
276,449
int (char c) { if ((c >= '0') && (c <= '9')) { return c - '0'; } if ((c >= 'a') && (c <= 'f')) { return c - 'a' + 10; } if ((c >= 'A') && (c <= 'F')) { return c - 'A' + 10; } return -1; }
decode
276,450
int (@NotNull CharSequence s, int start, int end) { end = Math.min(end, s.length()); for (int i = Math.max(start, 0); i < end; i++) { if (s.charAt(i) == '%') { return i; } } return -1; }
indexOf
276,451
Path () { return path; }
getPath
276,452
URI (@NotNull Path file) { String path = file.toString().replace(File.separatorChar, '/'); if (!path.startsWith("/")) { path = '/' + path; } else if (path.startsWith("//")) { path = "//" + path; } try { return new URI("file", null, path, null); } catch (URISyntaxException e) { throw new IllegalArgumentException(path, e...
fileToUri
276,453
String () { return "JarLoader(path=" + path + ")"; }
toString
276,454
FileLoader (Path file, @Nullable CachePoolImpl cachePool, Predicate<? super Path> cachingCondition, boolean isClassPathIndexEnabled, ClasspathCache cache) { if (cachePool == null) { LoaderData data = buildData(file, isClassPathIndexEnabled); FileLoader loader = new FileLoader(file, data.nameFilter); cache.applyLoaderDa...
createCachingFileLoader
276,455
Path () { return path; }
getPath
276,456
void (Path startDir, ClasspathCache.LoaderDataBuilder context, StrippedLongArrayList nameHashes) { // FileVisitor is not used to avoid getting file attributes for class files // (`.class` extension is a strong indicator that it is a file and not a directory) Deque<Path> dirCandidates = new ArrayDeque<>(); dirCandidates...
buildPackageAndNameCache
276,457
String (@NotNull String path, int startPathLength) { String relativePath = path.substring(startPathLength).replace(File.separatorChar, '/'); return relativePath.startsWith("/") ? relativePath.substring(1) : relativePath; }
getRelativeResourcePath
276,458
LoaderData (@NotNull Path path, boolean isClassPathIndexEnabled) { Path indexFile = isClassPathIndexEnabled ? path.resolve("classpath.index") : null; LoaderData loaderData = indexFile == null ? null : readFromIndex(indexFile); int nsMsFactor = 1_000_000; int currentLoaders = totalLoaders.incrementAndGet(); long current...
buildData
276,459
URL () { URL result = this.url; if (result == null) { try { result = file.toUri().toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } url = result; } return result; }
getURL
276,460
String () { return file.toString(); }
toString
276,461
String () { return "FileLoader(path=" + path + ')'; }
toString
276,462
int () { return classPackageHashes.length; }
classPackageCount
276,463
int () { return resourcePackageHashes.length; }
resourcePackageCount
276,464
Predicate<String> () { return nameFilter; }
getNameFilter
276,465
long[] () { return classPackageHashes; }
classPackages
276,466
long[] () { return resourcePackageHashes; }
resourcePackages
276,467
boolean (String name) { if (name.isEmpty()) { return true; } int lastIndex = name.length() - 1; int end = name.charAt(lastIndex) == '/' ? lastIndex : name.length(); return filter.mightContain(Xx3UnencodedString.hashUnencodedStringRange(name, end)); }
test
276,468
int () { return containsNullKey ? size - 1 : size; }
realSize
276,469
int (long key) { if (key == 0) { return containsNullKey ? tableSize : -(tableSize + 1); } long current; long[] keys = this.keys; int index; // the starting point if ((current = keys[index = (int)key & mask]) == 0) { return -(index + 1); } if (key == current) { return index; } // there's always an unused entry while (tr...
index
276,470
void (int index, long key, V value) { replaceByIndex(-index - 1, key, value); if (size++ >= maxFill) { rehash(Hash.arraySize(size + 1, Hash.FAST_LOAD_FACTOR)); } }
addByIndex
276,471
void (int index, long key, @NotNull V value) { if (index == tableSize) { containsNullKey = true; } keys[index] = key; values[index] = value; }
replaceByIndex
276,472
V (int index) { return values[index]; }
getByIndex
276,473
V (long k) { if (k == 0) { return containsNullKey ? values[tableSize] : null; } long curr; final long[] key = this.keys; int pos; // The starting point. if ((curr = key[pos = (int)k & mask]) == 0) { return null; } if (k == curr) { return values[pos]; } // There's always an unused entry. while (true) { if ((curr = key[p...
apply
276,474
int () { return size; }
size
276,475
boolean () { return size == 0; }
isEmpty
276,476
void (final int newN) { final long[] keys = this.keys; final V[] values = this.values; final int mask = newN - 1; // Note that this is used by the hashing macro final long[] newKey = new long[newN + 1]; final V[] newValue = valueArrayFactory.apply(newN + 1); int i = tableSize; int pos; for (int j = realSize(); j-- != 0...
rehash
276,477
Enumeration<URL> (@NotNull String name) { if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); } if (useCache && allUrlsWereProcessed) { Loader[] loaders = cache.getLoadersByName(name); return loaders == null || loaders.length == 0 ? Collections.emptyEnumeration() : new ResourceEnumeration(name, loade...
getResources
276,478
List<Path> () { List<Path> result = new ArrayList<>(); for (Loader loader : loaders) { result.add(loader.getPath()); } return result; }
getBaseUrls
276,479
void (@NotNull Path file, ResourceFile zipFile, JarLoader loader) { String[] referencedJars = loadManifestClasspath(loader, zipFile); if (referencedJars != null) { long startReferenced = logLoadingInfo ? System.nanoTime() : 0; List<Path> files = new ArrayList<>(referencedJars.length); for (String referencedJar : refere...
addFromManifestClassPathIfNeeded
276,480
boolean () { if (resource != null) { return true; } long start = resourceLoading.startTiming(); try { Loader loader; while (index < loaders.length) { loader = loaders[index++]; resource = loader.getResource(name); if (resource != null) { return true; } } } finally { resourceLoading.record(start, name); } return false; ...
next
276,481
boolean () { return next(); }
hasMoreElements
276,482
URL () { if (!next()) { throw new NoSuchElementException(); } Resource resource = this.resource; this.resource = null; return resource.getURL(); }
nextElement
276,483
boolean () { if (resource != null) { return true; } long start = resourceLoading.startTiming(); try { Loader loader; while ((loader = classPath.getLoader(index++)) != null) { resource = loader.getResource(name); if (resource != null) { return true; } } } finally { resourceLoading.record(start, name); } return false; }
next
276,484
boolean () { return next(); }
hasMoreElements
276,485
URL () { if (!next()) { throw new NoSuchElementException(); } Resource resource = this.resource; this.resource = null; return resource.getURL(); }
nextElement
276,486
boolean (String name) { return classDataConsumer.isByteBufferSupported(name); }
isByteBufferSupported
276,487
long () { if (doingClassDefineTiming.get() != null) { return -1; } else { doingClassDefineTiming.set(Boolean.TRUE); return System.nanoTime(); } }
startTiming
276,488
void (long start) { if (start != -1) { //noinspection ThreadLocalSetWithNull doingClassDefineTiming.set(null); classDefineTotalTime.addAndGet(System.nanoTime() - start); } }
record
276,489
String () { return "Measurer(time=" + TimeUnit.NANOSECONDS.toMillis(timeCounter.get()) + "ms, requests=" + requestCounter + ')'; }
toString
276,490
void (Graphics g) { if (myPaintCallback != null) { myPaintCallback.consume(g); } super.paint(g); }
paint
276,491
void (@Nullable Consumer<? super Graphics> paintCallback) { myPaintCallback = paintCallback; }
setPaintCallback
276,492
int (Pair<ProjectSystemId, File> object) { return object.first.hashCode() + FileUtil.fileHashCode(object.second); }
hashCode
276,493
boolean (Pair<ProjectSystemId, File> o1, Pair<ProjectSystemId, File> o2) { return o1.first.equals(o2.first) && FileUtil.filesEqual(o1.second, o2.second); }
equals
276,494
int (@Nullable File file) { int hash; try { hash = FileUtil.pathHashCode(file == null ? null : file.getCanonicalPath()); } catch (IOException e) { LOG.warn("unable to get canonical file path", e); hash = FileUtil.fileHashCode(file); } return hash; }
fileHashCode
276,495
boolean (@Nullable File file1, @Nullable File file2) { try { return FileUtil.pathsEqual(file1 == null ? null : file1.getCanonicalPath(), file2 == null ? null : file2.getCanonicalPath()); } catch (IOException e) { LOG.warn("unable to get canonical file path", e); } return FileUtil.filesEqual(file1, file2); }
filesEqual
276,496
void (final @NotNull ImportSpecBuilder specBuilder) { refreshProjects(specBuilder.build()); }
refreshProjects
276,497
void (final @NotNull ImportSpec spec) { var manager = ExternalSystemApiUtil.getManager(spec.getExternalSystemId()); if (manager == null) { return; } var settings = manager.getSettingsProvider().fun(spec.getProject()); var projectsSettings = settings.getLinkedProjectsSettings(); if (projectsSettings.isEmpty()) { return;...
refreshProjects
276,498
String (@NotNull Throwable e) { var unwrapped = RemoteUtil.unwrap(e); if (unwrapped instanceof ExternalSystemException esException) { var reason = esException.getOriginalReason(); if (!reason.isEmpty()) { return reason; } } return ExternalSystemApiUtil.stacktraceAsString(e); }
extractDetails
276,499
void (final @NotNull Project project, final @NotNull ProjectSystemId externalSystemId, final @NotNull String externalProjectPath, final boolean isPreviewMode, final @NotNull ProgressExecutionMode progressExecutionMode) { var builder = new ImportSpecBuilder(project, externalSystemId) .use(progressExecutionMode); if (isP...
refreshProject