Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
254,000
void (@NotNull String encoding) { ReflectionUtil.resetField(Charset.class, Charset.class, "defaultCharset"); System.setProperty("file.encoding", encoding); }
patchSystemFileEncoding
254,001
void (@NotNull Runnable r) { PrintStream std = System.err; System.setErr(new PrintStream(OutputStream.nullOutputStream())); try { r.run(); } finally { System.setErr(std); } }
withStdErrSuppressed
254,002
void (@NotNull GeneralCommandLine command) { try { ProcessOutput output = ExecUtil.execAndGetOutput(command.withRedirectErrorStream(true)); assertEquals(output.getStdout(), 0, output.getExitCode()); } catch (ExecutionException e) { throw new RuntimeException(e); } }
assertSuccessful
254,003
List<WebReference> (@NotNull PsiElement element) { List<WebReference> refs = new ArrayList<>(); element.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { for (PsiReference ref : element.getReferences()) { if (ref instanceof WebReference) { refs.add((WebRe...
collectWebReferences
254,004
void (@NotNull PsiElement element) { for (PsiReference ref : element.getReferences()) { if (ref instanceof WebReference) { refs.add((WebReference)ref); } } super.visitElement(element); }
visitElement
254,005
List<UrlReference> (@NotNull PsiElement element) { List<UrlReference> result = new SmartList<>(); element.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { result.addAll(PsiSymbolReferenceService.getService().getReferences(element, UrlReference.class)); s...
collectUrlReferences
254,006
void (@NotNull PsiElement element) { result.addAll(PsiSymbolReferenceService.getService().getReferences(element, UrlReference.class)); super.visitElement(element); }
visitElement
254,007
void (@NotNull Runnable cleanup) { ourProjectCleanups.add(cleanup); }
registerProjectCleanup
254,008
void () { for (Runnable each : ourProjectCleanups) { each.run(); } ourProjectCleanups.clear(); }
cleanupAllProjects
254,009
boolean (int result12, int result23, int result31) { if (result12 == 0 && result23 == 0 && result31 == 0) return true; if (result12 > 0 && result23 > 0 && result31 > 0) return false; if (result12 < 0 && result23 < 0 && result31 < 0) return false; if (result12 == 0 && Integer.signum(result23) * Integer.signum(result31) ...
isTransitive
254,010
void (@NotNull Project project, @NotNull Disposable parentDisposable) { FileTemplateManagerImpl templateManager = (FileTemplateManagerImpl)FileTemplateManager.getInstance(project); templateManager.setDefaultFileIncludeTemplateTextTemporarilyForTest(FileTemplateManager.FILE_HEADER_TEMPLATE_NAME, """ /** * Created by ${U...
setLongMeaninglessFileIncludeTemplateTemporarilyFor
254,011
VirtualFile (@NotNull Project project) { return HeavyTestHelper.getOrCreateProjectBaseDir(project); }
getOrCreateProjectBaseDir
254,012
void () { failure[0] = true; }
processNotStarted
254,013
void (RunContentDescriptor descriptor) { ProcessHandler processHandler = descriptor.getProcessHandler(); LOG.debug("Process started: ", processHandler); if (descriptorProcessor != null) { descriptorProcessor.accept(descriptor); } assertNotNull(processHandler); processHandler.addProcessListener(new ProcessAdapter() { @O...
processStarted
254,014
void (@NotNull ProcessEvent event) { LOG.debug("Process notified: ", processHandler); }
startNotified
254,015
void (@NotNull ProcessEvent event) { LOG.debug("Process terminated: exitCode: ", event.getExitCode(), "; text: ", event.getText(), "; process: ", processHandler); }
processTerminated
254,016
void (@NotNull ProcessEvent event, @NotNull Key outputType) { LOG.debug(outputType + ": " + event.getText()); }
onTextAvailable
254,017
void (@NotNull String errorMessage, @NotNull BooleanSupplier condition, int timeoutInSeconds) { waitWithEventsDispatching(() -> errorMessage, condition, timeoutInSeconds); }
waitWithEventsDispatching
254,018
void (@NotNull Supplier<String> errorMessageSupplier, @NotNull BooleanSupplier condition, int timeoutInSeconds) { waitWithEventsDispatching(errorMessageSupplier, condition, timeoutInSeconds, null); }
waitWithEventsDispatching
254,019
void (@NotNull Supplier<String> errorMessageSupplier, @NotNull BooleanSupplier condition, int timeoutInSeconds, @Nullable Runnable callback) { long start = System.currentTimeMillis(); while (true) { try { if (System.currentTimeMillis() - start > timeoutInSeconds * 1000L) { if (callback != null) { callback.run(); } fail...
waitWithEventsDispatching
254,020
PsiElement (@NotNull String signature, @NotNull String fileRelativePath, @NotNull Project project) { String filePath = project.getBasePath() + File.separator + fileRelativePath; VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); if (virtualFile == null || !virtualFile.exists()) { throw ne...
findElementBySignature
254,021
Project (@NotNull Path path, @NotNull Disposable parent) { Project project = Objects.requireNonNull(ProjectManagerEx.getInstanceEx().openProject(path, new OpenProjectTaskBuilder().build())); Disposer.register(parent, () -> forceCloseProjectWithoutSaving(project)); return project; }
loadAndOpenProject
254,022
boolean () { // StdFileTypes.JSPX is assigned to PLAIN_TEXT in IDEA Community return StdFileTypes.JSPX == FileTypes.PLAIN_TEXT; }
isUnderCommunityClassPath
254,023
void (@NotNull PsiFile file) { for (PsiFile subTree : file.getViewProvider().getAllFiles()) { assertNoPsiErrorElements(subTree); } }
assertNoPsiErrorElementsInAllSubTrees
254,024
void (@NotNull PsiFile file) { List<String> errors = new ArrayList<>(); file.accept(new PsiRecursiveElementVisitor() { @Override public void visitErrorElement(@NotNull PsiErrorElement element) { errors.add(element.getTextOffset() + ": " + element.getErrorDescription()); super.visitErrorElement(element); } }); if (!erro...
assertNoPsiErrorElements
254,025
void (@NotNull PsiErrorElement element) { errors.add(element.getTextOffset() + ": " + element.getErrorDescription()); super.visitErrorElement(element); }
visitErrorElement
254,026
String (@NotNull PsiFile psiFile) { StringBuilder result = new StringBuilder(); for (PsiFile subTree : psiFile.getViewProvider().getAllFiles()) { result.append("Language: ").append(subTree.getLanguage()).append("\n").append(DebugUtil.psiToString(subTree, true, false)); } return result.toString(); }
psiFileToString
254,027
void (@NotNull PsiFile psiFile, @NotNull CharSequence newFileText, @NotNull String answersFilePath, boolean checkInitialTreeForErrors, boolean checkFinalTreeForErrors) { if (checkInitialTreeForErrors) { assertNoPsiErrorElements(psiFile); } var project = psiFile.getProject(); var psiDocumentManager = PsiDocumentManager....
testIncrementalParsing
254,028
void (@Nullable Couple<ASTNode> reparseableRoots, @NotNull StringBuilder result, @NotNull CharSequence newText) { TextRange reparsedRange; if (reparseableRoots == null) { reparsedRange = TextRange.create(0, newText.length()); } else { reparsedRange = TextRange.from(reparseableRoots.first.getStartOffset(), reparseableRo...
serializeReparseableRoots
254,029
Disposable () { return myRootDisposable; }
getRootDisposable
254,030
TestClass (Class<?> testClass) { return new MixinAwareTestClass(testClass); }
createTestClass
254,031
void (Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations, Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotations) { super.scanAnnotatedMembers(methodsForAnnotations, fieldsForAnnotations); scanAnnotatedMethodsInInterfaces(getJavaClass(), methodsForAnnotations); }
scanAnnotatedMembers
254,032
void (Class<?> clazz, Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations) { for (Class<?> superInterface : clazz.getInterfaces()) { for (Method eachMethod : MethodSorter.getDeclaredMethods(superInterface)) { addToAnnotationLists(new FrameworkMethod(eachMethod), methodsForAnnotations); } scanA...
scanAnnotatedMethodsInInterfaces
254,033
void (RunNotifier originalNotifier) { RunNotifier wrapperNotifier = new RunNotifier() { @Override public void addListener(RunListener listener) { originalNotifier.addListener(listener); } @Override public void removeListener(RunListener listener) { originalNotifier.removeListener(listener); } @Override public void fire...
run
254,034
void (RunListener listener) { originalNotifier.addListener(listener); }
addListener
254,035
void (RunListener listener) { originalNotifier.removeListener(listener); }
removeListener
254,036
void (Description description) { originalNotifier.fireTestRunStarted(description); }
fireTestRunStarted
254,037
void (Result result) { originalNotifier.fireTestRunFinished(result); }
fireTestRunFinished
254,038
void (Failure failure) { if (failure.getException() instanceof AssumptionViolatedException) { originalNotifier.fireTestAssumptionFailed(failure); return; } originalNotifier.fireTestFailure(failure); }
fireTestFailure
254,039
void (Failure failure) { originalNotifier.fireTestAssumptionFailed(failure); }
fireTestAssumptionFailed
254,040
void (Description description) { originalNotifier.fireTestIgnored(description); }
fireTestIgnored
254,041
void (Description description) { originalNotifier.fireTestFinished(description); }
fireTestFinished
254,042
void () { originalNotifier.pleaseStop(); super.pleaseStop(); }
pleaseStop
254,043
String () { return printLongestNames(myGcTimes) + "; free " + myMemStart + " -> " + myMemEnd + " MB"; }
getGcStats
254,044
String () { return printLongestNames(myThreadTimes); }
getThreadStats
254,045
long () { long usedBefore = myMemStart.total - myMemStart.free; long usedAfter = myMemEnd.total - myMemEnd.free; return usedAfter - usedBefore; }
getMemDelta
254,046
String (@NotNull String indent) { return indent + "GC: " + getGcStats() + "\n" + indent + "Threads: " + getThreadStats() + "\n" + indent + "Process: " + getProcessCpuStats(); }
getSummary
254,047
String (@NotNull List<? extends Pair<Long, String>> times) { String stats = times.stream() .sorted(Comparator.comparingLong((Pair<Long, String> p) -> p.first).reversed()) .filter(p -> p.first > 10) .limit(10) .map(p -> "\"" + p.second + "\"" + " took " + p.first + "ms") .collect(Collectors.joining(", ")); return stats....
printLongestNames
254,048
int (ThreadInfo object) { return (int)object.getThreadId(); }
hashCode
254,049
boolean (ThreadInfo o1, ThreadInfo o2) { return o1==null||o2==null?o1==o2:o1.getThreadId() == o2.getThreadId(); }
equals
254,050
long () { return ourCompilationMXBean.getTotalCompilationTime(); }
getTotalCompilationMillis
254,051
long (long bytes) { return bytes / 1024 / 1024; }
toMb
254,052
String () { return free + "/" + total; }
toString
254,053
boolean (final Runnable runnable) { myThread = Thread.currentThread(); final Semaphore canStart = new Semaphore(); canStart.down(); final Semaphore finished = new Semaphore(); finished.down(); // ProgressManager invokes indicator.checkCanceled only when there's at least one canceled indicator. So we have to create a mo...
runBombed
254,054
BombedProgressIndicator (Predicate<? super StackTraceElement[]> stackCondition) { return new BombedProgressIndicator(stackCondition); }
explodeOnStack
254,055
BombedProgressIndicator (Predicate<? super StackTraceElement> stackElementCondition) { return explodeOnStack(stack -> Arrays.stream(stack).anyMatch(stackElementCondition)); }
explodeOnStackElement
254,056
GlyphVector (@NotNull Font font, @NotNull FontRenderContext fontRenderContext, char @NotNull [] chars, int start, int end, boolean isRtl) { return new MockGlyphVector(Arrays.copyOfRange(chars, start, end), isRtl); }
layoutGlyphVector
254,057
double (int codePoint) { return myCharWidthFunction == null ? myCharWidth : (float)myCharWidthFunction.applyAsDouble(codePoint); }
getCharWidth
254,058
int (@NotNull FontMetrics fontMetrics, char c) { return (int)getCharWidth(c); }
charWidth
254,059
int (@NotNull FontMetrics fontMetrics, int codePoint) { return (int)getCharWidth(codePoint); }
charWidth
254,060
float (@NotNull FontMetrics fontMetrics, int codePoint) { return (float)getCharWidth(codePoint); }
charWidth2D
254,061
int (@NotNull FontMetrics fontMetrics, @NotNull String str) { if (myCharWidthFunction == null) { return myCharWidth * str.codePointCount(0, str.length()); } float width = 0; int pos = 0; while (pos < str.length()) { width += myCharWidthFunction.applyAsDouble(str.codePointAt(pos)); pos = str.offsetByCodePoints(pos, 1); ...
stringWidth
254,062
int (@NotNull FontMetrics fontMetrics) { return myLineHeight; }
getHeight
254,063
int (@NotNull FontMetrics fontMetrics) { return myDescent; }
getDescent
254,064
int () { return myChars.length; }
getNumGlyphs
254,065
int (int glyphIndex) { return myIsRtl ? myChars.length - 1 - glyphIndex : glyphIndex; }
getGlyphCharIndex
254,066
Point2D (int glyphIndex) { double x = 0; if (myCharWidthFunction == null) { x = glyphIndex * myCharWidth; } else { for (int i = 0; i < glyphIndex; i++) { x += myCharWidthFunction.applyAsDouble(myChars[getGlyphCharIndex(i)]); } } return new Point2D.Double(x, 0); }
getGlyphPosition
254,067
Shape (int glyphIndex) { Point2D position = getGlyphPosition(glyphIndex); return new Rectangle2D.Double(position.getX(), position.getY() - myDescent, myCharWidth, myLineHeight); }
getGlyphLogicalBounds
254,068
int (int glyphIndex) { return myChars[glyphIndex]; }
getGlyphCode
254,069
void () { ourInstance.checkSystemOut(); ourInstance.checkSystemErr(); }
checkSystemStreams
254,070
void () { PrintStream out = System.out; if (out != originalSystemOut) { System.setOut(originalSystemOut); throwStreamRedirected("System.out", originalSystemOut, out); } if (originalSystemOut.checkError()) { throwStreamClosed("System.out"); } }
checkSystemOut
254,071
void () { PrintStream err = System.err; if (err != originalSystemErr) { System.setErr(originalSystemErr); throwStreamRedirected("System.err", originalSystemErr, err); } if (originalSystemErr.checkError()) { throwStreamClosed("System.err"); } }
checkSystemErr
254,072
void (String name, PrintStream original, PrintStream curr) { throwMessage("The global '%s' has changed from '%s' to '%s'.", name, original, curr); }
throwStreamRedirected
254,073
void (String name) { throwMessage("The global '%s' is in error state; maybe it has been closed.", name); }
throwStreamClosed
254,074
void (String fmt, Object... args) { String msg = GlobalState.class.getName() + ": " + String.format(Locale.ROOT, fmt, args); // Warn on all available output channels, hoping that one of them still works. originalSystemOut.println(msg); originalSystemErr.println(msg); throw new IllegalStateException(msg); }
throwMessage
254,075
boolean (String s) { return test(s); }
value
254,076
boolean (String s) { return mySet.contains(s); }
test
254,077
boolean (String s) { return !mySet.contains(s); }
test
254,078
DataContext () { return EMPTY_CONTEXT; }
getParent
254,079
void (@NotNull String dataId, Object data) { myMap.put(dataId, data); }
put
254,080
void () { myFixture.configureByFile(PathUtil.makeFileName(getTestName(false), getFileExtension())); }
configureDefault
254,081
void (String filter) { checkTree(filter, true); }
checkTree
254,082
void () { EdtTestUtilKt.runInEdtAndWait(true, () -> { checkTree(null, true); return null; }); }
checkTree
254,083
void (boolean expandAll) { checkTree(null, expandAll); }
checkTree
254,084
void (@Nullable String filter, boolean expandAll) { configureDefault(); myPopupFixture.update(); if (filter != null) { setSearchFilter(filter); } if (expandAll) { PlatformTestUtil.expandAll(myPopupFixture.getTree()); } checkResult(); }
checkTree
254,085
void (@NotNull String filter) { myPopupFixture.getPopup().setSearchFilterForTests(filter); PlatformTestUtil.waitForPromise(myPopupFixture.getPopup().rebuildAndUpdate()); myPopupFixture.getSpeedSearch().findAndSelectElement(filter); }
setSearchFilter
254,086
void () { String expectedFileName = getTestDataPath() + "/" + PathUtil.makeFileName(getTestName(false), "tree"); PlatformTestUtil.waitWhileBusy(myPopupFixture.getTree()); assertSameLinesWithFile(expectedFileName, PlatformTestUtil.print(myPopupFixture.getTree(), true).trim()); }
checkResult
254,087
record (@NotNull IterationResult iterationResult, boolean passed, @NotNull String logMessage) { }
IterationStatus
254,088
PerformanceTestInfo (@NotNull ThrowableRunnable<?> setup) { assert this.setup == null; this.setup = setup; return this; }
setup
254,089
PerformanceTestInfo () { return usesMultipleCPUCores(8); }
usesAllCPUCores
254,090
PerformanceTestInfo (int maxCores) { assert adjustForCPU : "This test configured to be io-bound, it cannot use all cores"; usedReferenceCpuCores = maxCores; return this; }
usesMultipleCPUCores
254,091
PerformanceTestInfo () { adjustForIO = true; adjustForCPU = false; return this; }
ioBound
254,092
PerformanceTestInfo (int attempts) { this.maxRetries = attempts; return this; }
attempts
254,093
PerformanceTestInfo (int iterations) { assert warmupIterations == Integer.MIN_VALUE : "Already called warmupIterations()"; assert iterations >= 1 : "invalid argument: " + iterations + "; must be >= 1"; warmupIterations = iterations; return this; }
warmupIterations
254,094
PerformanceTestInfo () { useLegacyScaling = true; return this; }
useLegacyScaling
254,095
void () { if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return; Timings.getStatistics(); // warm-up, measure updateJitUsage(); if (maxRetries == 1) { //noinspection CallToSystemGC System.gc(); } int initialMaxRetries = maxRetries; try { runWithSpanSimple(tracer, what, () -> { try { for (int attempt = 1; attempt <= maxRe...
assertTiming
254,096
String (@NotNull CpuUsageData data, int expectedOnMyMachine, int actualInputSize, int actualUsedCpuCores, @NotNull IterationResult iterationResult, int initialMaxRetries) { long duration = data.durationMs; int percentage = (int)(100.0 * (duration - expectedOnMyMachine) / expectedOnMyMachine); String colorCode = iterati...
formatMessage
254,097
JitUsageResult () { long timeNow = System.nanoTime(); long jitNow = CpuUsageData.getTotalCompilationMillis(); long elapsedMillis = TimeUnit.NANOSECONDS.toMillis(timeNow - lastJitStamp); if (lastJitStamp >= 0) { if (elapsedMillis >= 3_000) { if (jitNow - lastJitUsage <= elapsedMillis / 10) { return JitUsageResult.DEFINI...
updateJitUsage
254,098
int (int actualInputSize, int actualUsedCpuCores) { int expectedOnMyMachine = (int)(((long)expectedMs) * actualInputSize / expectedInputSize); if (adjustForCPU) { expectedOnMyMachine *= usedReferenceCpuCores; expectedOnMyMachine = adjust(expectedOnMyMachine, Timings.CPU_TIMING, Timings.REFERENCE_CPU_TIMING, useLegacySc...
getExpectedTimeOnThisMachine
254,099
int (int expectedOnMyMachine, long thisTiming, long referenceTiming, boolean useLegacyScaling) { if (useLegacyScaling) { double speed = 1.0 * thisTiming / referenceTiming; double delta = speed < 1 ? 0.9 + Math.pow(speed - 0.7, 2) : 0.45 + Math.pow(speed - 0.25, 2); expectedOnMyMachine *= delta; return expectedOnMyMachi...
adjust