Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
253,200
LoggedErrorProcessor () { return ourInstance; }
getInstance
253,201
Throwable (@NotNull Runnable runnable) { AtomicReference<Throwable> error = new AtomicReference<>(); executeWith(new LoggedErrorProcessor() { @Override public @NotNull Set<Action> processError(@NotNull String category, @NotNull String message, String @NotNull [] details, @Nullable Throwable t) { Assert.assertNotNull("U...
executeAndReturnLoggedError
253,202
Set<Action> (@NotNull String category, @NotNull String message, String @NotNull [] details, @Nullable Throwable t) { Assert.assertNotNull("Unexpected error without Throwable: " + message, t); if (!error.compareAndSet(null, t)) { Assert.fail("Multiple errors were reported: " + error.get().getMessage() + " and " + t.getM...
processError
253,203
boolean (@NotNull String category, @NotNull String message, @Nullable Throwable t) { return true; }
processWarn
253,204
Set<Action> (@NotNull String category, @NotNull String message, String @NotNull [] details, @Nullable Throwable t) { return Action.ALL; }
processError
253,205
void (@NotNull java.util.logging.Logger julLogger) { if (julLogger.isLoggable(Level.FINE) && ContainerUtil.findInstance(julLogger.getHandlers(), LogToStdoutJulHandler.class) == null) { julLogger.addHandler(new LogToStdoutJulHandler()); } }
configureLogToStdoutIfDebug
253,206
boolean () { try { String customConfigPath = System.getProperty(PathManager.PROPERTY_LOG_CONFIG_FILE); Path logProperties = customConfigPath != null ? Path.of(customConfigPath) : Path.of(PathManager.getHomePath(), "test-log.properties"); if (Files.exists(logProperties)) { if (customConfigPath != null) System.out.printl...
reconfigure
253,207
Path () { String property = System.getProperty(PROPERTY_LOG_PATH); return property != null ? Path.of(property) : Path.of(PathManager.getSystemPath(), LOG_DIR); }
getTestLogDir
253,208
void (@NotNull String testStartMarker) { dumpLogTo(testStartMarker, System.out); }
dumpLogToStdout
253,209
void (@NotNull String testStartMarker, PrintStream out) { Path logFile = getTestLogDir().resolve(LOG_FILE_NAME); if (Files.exists(logFile)) { try { String logText; long length = Files.size(logFile); if (length > LOG_SEEK_WINDOW) { try (RandomAccessFile file = new RandomAccessFile(logFile.toFile(), "r")) { file.seek(len...
dumpLogTo
253,210
void (@NotNull Disposable parentDisposable, Class<?> @NotNull ... classes) { enableDebugLogging(parentDisposable, Stream.of(classes).map(klass -> '#' + klass.getName())); }
enableDebugLogging
253,211
void (@NotNull Disposable parentDisposable, String @NotNull ... categories) { enableDebugLogging(parentDisposable, Stream.of(categories)); }
enableDebugLogging
253,212
void (@NotNull Disposable parentDisposable, @NotNull Stream<String> categories) { categories.map(Logger::getInstance).filter(logger -> !logger.isDebugEnabled()).forEach(logger -> { logger.setLevel(LogLevel.DEBUG); Disposer.register(parentDisposable, () -> logger.setLevel(LogLevel.INFO)); }); }
enableDebugLogging
253,213
void (@NotNull Disposable parentDisposable, Class<?> @NotNull ... classes) { for (Class<?> klass : classes) { Logger logger = Logger.getInstance('#' + klass.getName()); if (!logger.isTraceEnabled()) { logger.setLevel(LogLevel.TRACE); Disposer.register(parentDisposable, () -> logger.setLevel(LogLevel.INFO)); } } }
enableTraceLogging
253,214
void (@NotNull LogLevel level, @NotNull String category, @Nullable String message, @Nullable Throwable t) { String source = category.substring(Math.max(category.length() - 30, 0)); String format = String.format("%1$tH:%1$tM:%1$tS,%1$tL %2$-6s %3$30s - ", System.currentTimeMillis(), level.getLevelName(), source); synchr...
buffer
253,215
void (@NotNull StringBuilder sb, @Nullable String expected, @Nullable String actual) { if (expected == null && actual == null) return; sb.append("Comparison Failure").append(System.lineSeparator()); if (actual == null) { sb.append("Actual [null]"); } else { sb.append("Actual [[").append(actual).append("]]"); } sb.appen...
logComparisonFailure
253,216
void () { TestLoggerFactory factory = getTestLoggerFactory(); if (factory != null) { factory.clearLogBuffer(); // clear buffer from tests which failed to report their termination properly factory.myTestStartedMillis = System.currentTimeMillis(); } }
onTestStarted
253,217
void (boolean success) { onTestFinished(success, "unnamed_test"); }
onTestFinished
253,218
void (boolean success, @NotNull Description description) { onTestFinished(success, description.getDisplayName()); }
onTestFinished
253,219
void (boolean success, @NotNull String testName) { TestLoggerFactory factory = getTestLoggerFactory(); if (factory != null) { factory.myTestStartedMillis = 0; factory.dumpLogBuffer(success, testName); } }
onTestFinished
253,220
void (@NotNull Throwable t) { TestLoggerFactory factory = getTestLoggerFactory(); if (factory != null) { String comparisonFailures = dumpComparisonFailures(t); String message = comparisonFailures != null ? "test failed: " + comparisonFailures : "Test failed"; factory.buffer(LogLevel.ERROR, "#TestFramework", message, t)...
logTestFailure
253,221
void () { synchronized (myBuffer) { myBuffer.setLength(0); } }
clearLogBuffer
253,222
void (boolean success, @NotNull String testName) { String buffer; synchronized (myBuffer) { buffer = success || myBuffer.isEmpty() ? null : myBuffer.toString(); myBuffer.setLength(0); } if (buffer != null) { if (mySplitTestLogs) { Path logDir = getTestLogDir().resolve(SPLIT_LOGS_SUBDIR); Path logFile = FileUtil.findSeq...
dumpLogBuffer
253,223
TestRule () { return new TestWatcher() { @Override protected void succeeded(Description description) { onTestFinished(true, description); } @Override protected void failed(Throwable e, Description description) { logTestFailure(e); onTestFinished(false, description); } @Override protected void skipped(AssumptionViolated...
createTestWatcher
253,224
void (Description description) { onTestFinished(true, description); }
succeeded
253,225
void (Throwable e, Description description) { logTestFailure(e); onTestFinished(false, description); }
failed
253,226
void (AssumptionViolatedException e, Description description) { onTestFinished(true, description); }
skipped
253,227
void (@NotNull Description d) { onTestStarted(); }
starting
253,228
void (String message, @Nullable Throwable t, String @NotNull ... details) { Set<LoggedErrorProcessor.Action> actions = LoggedErrorProcessor.getInstance().processError(myLogger.getName(), requireNonNullElse(message, ""), details, t); if (actions.contains(LoggedErrorProcessor.Action.LOG)) { if (t instanceof TestLoggerAss...
error
253,229
void (String message, @Nullable Throwable t) { if (LoggedErrorProcessor.getInstance().processWarn(myLogger.getName(), requireNonNullElse(message, ""), t)) { message += DefaultLogger.attachmentsToString(t); t = ensureNotControlFlow(t); if (myFactory.mySplitTestLogs) { myFactory.buffer(LogLevel.WARNING, myLogger.getName(...
warn
253,230
void (String message, @Nullable Throwable t) { super.info(message, t); myFactory.buffer(LogLevel.INFO, myLogger.getName(), message, t); }
info
253,231
void (String message, @Nullable Throwable t) { if (isDebugEnabled()) { super.debug(message, t); myFactory.buffer(LogLevel.DEBUG, myLogger.getName(), message, t); } }
debug
253,232
void (String message) { if (isTraceEnabled()) { super.trace(message); myFactory.buffer(LogLevel.TRACE, myLogger.getName(), message, null); } }
trace
253,233
void (@Nullable Throwable t) { if (isTraceEnabled()) { super.trace(t); myFactory.buffer(LogLevel.TRACE, myLogger.getName(), null, t); } }
trace
253,234
boolean () { return !Accessor.isInStressTest() || super.isDebugEnabled(); }
isDebugEnabled
253,235
MethodHandle () { try { Class<?> clazz = Class.forName("com.intellij.openapi.application.ex.ApplicationManagerEx"); MethodHandle handle = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()).findStatic(clazz, "isInStressTest", MethodType.methodType(boolean.class)); Object result = handle.invokeWithArguments(); ...
getMethodHandle
253,236
boolean () { try { return (boolean)isInStressTest.invokeWithArguments(); } catch (Throwable ignored) { return false; } }
isInStressTest
253,237
long () { TestLoggerFactory factory = getTestLoggerFactory(); return factory == null ? 0L : factory.myTestStartedMillis; }
getStartedMillis
253,238
ConditionEvaluationResult (ExtensionContext context) { if (MAX_FAILURE_TEST_COUNT >= 0 && ourFailedTestsCount.get() > MAX_FAILURE_TEST_COUNT) { if (myDisabledReason == null) { String msg = "Too many errors (" + ourFailedTestsCount.get() + ", MAX_FAILURE_TEST_COUNT = " + MAX_FAILURE_TEST_COUNT + "). Executed: " + ourExe...
evaluateExecutionCondition
253,239
void (ExtensionContext context, Throwable cause) { ourFailedTestsCount.incrementAndGet(); ourExecutedTestsCount.incrementAndGet(); }
testFailed
253,240
void (ExtensionContext context) { ourExecutedTestsCount.incrementAndGet(); }
testSuccessful
253,241
void (ExtensionContext context, Throwable cause) { ourExecutedTestsCount.incrementAndGet(); }
testAborted
253,242
void (ExtensionContext context) { failIfDisabled(context); }
beforeEach
253,243
void (ExtensionContext context) { failIfDisabled(context); }
beforeAll
253,244
void (ExtensionContext context) { ConditionEvaluationResult evaluated = evaluateExecutionCondition(context); if (evaluated.isDisabled()) { //noinspection OptionalGetWithoutIsPresent String reason = evaluated.getReason().get(); throw new AssumptionViolatedException(reason); } }
failIfDisabled
253,245
ConditionEvaluationResult (ExtensionContext context) { if (!SKIP_SLOW_TESTS) return ENABLED; return AnnotationSupport.findAnnotation(context.getTestClass(), SkipSlowTestLocally.class).isPresent() ? DISABLED : ENABLED; }
evaluateExecutionCondition
253,246
ConditionEvaluationResult (ExtensionContext context) { if (IS_LOCAL_RUN) { return ENABLED_LOCALLY; } boolean hasAnnotation = AnnotationSupport.findAnnotation(context.getTestClass(), HardwareAgentRequired.class).isPresent(); return hasAnnotation == RUN_WITH_HARDWARE_REQUIREMENT ? MET_HARDWARE_REQUIREMENT : UNMET_HARDWAR...
evaluateExecutionCondition
253,247
void (ExtensionContext context) { explodeBomb(context); }
beforeEach
253,248
void (ExtensionContext context) { explodeBomb(context); }
beforeAll
253,249
ConditionEvaluationResult (ExtensionContext context) { return AnnotationSupport.findAnnotation(context.getElement(), Bombed.class) .map(bombed -> TestFrameworkUtil.bombExplodes(bombed) ? ConditionEvaluationResult.enabled("Bomb exploded") : ConditionEvaluationResult.disabled("Bomb not yet exploded")) .orElse(ConditionEv...
evaluateExecutionCondition
253,250
void (ExtensionContext context) { AnnotationSupport.findAnnotation(context.getElement(), Bombed.class) .ifPresent(bombed -> { if (TestFrameworkUtil.bombExplodes(bombed)) { String description = bombed.description().isEmpty() ? "" : " (" + bombed.description() + ")"; Assertions.fail("Bomb created by " + bombed.user() + d...
explodeBomb
253,251
ConditionEvaluationResult (ExtensionContext context) { if (NOT_DISCOVERY_RUN) { return NOT_DISCOVERY_RUN_ALWAYS_ENABLED; } return AnnotationSupport.findAnnotation(context.getTestClass(), ExcludeFromTestDiscovery.class) .map(a -> EXCLUDED_FROM_TEST_DISCOVERY) .orElse(INCLUDED_IN_TEST_DISCOVERY); }
evaluateExecutionCondition
253,252
String () { return myExpectedPath; }
getFilePath
253,253
String () { return myActualPath; }
getActualFilePath
253,254
String () { return isActualDefined() ? getActual().getStringRepresentation() : null; }
getActualStringPresentation
253,255
String () { return isExpectedDefined() ? getExpected().getStringRepresentation() : null; }
getExpectedStringPresentation
253,256
String (@NotNull Project project) { String creationTrace = project instanceof ProjectEx ? ((ProjectEx)project).getCreationTrace() : null; return project + " " + (creationTrace == null ? " " : creationTrace); }
getCreationPlace
253,257
void () { checkLeak(allRoots(), ProjectImpl.class, project -> !project.isDefault()); }
checkNonDefaultProjectLeak
253,258
String (@NotNull Object leaked, @Nullable Object backLink, boolean detailedErrorDescription) { int hashCode = System.identityHashCode(leaked); String result = "Found a leaked instance of "+leaked.getClass() +"\nInstance: "+leaked +"\nHashcode: "+hashCode; if (detailedErrorDescription) { result += "\n"+getLeakedObjectEr...
getLeakedObjectDetails
253,259
String (@Nullable String knownHeapDumpPath) { String result = """ Error description: This error means that the object is expected to be collected by the garbage collector by this time, but it was not. Please make sure you dispose your resources properly. See https://plugins.jetbrains.com/docs/intellij/disposers.html"""...
getLeakedObjectErrorDescription
253,260
boolean () { if ("false".equals(System.getProperty("java.awt.headless"))) { return false; } else { setHeadlessProperty(true); return true; } }
getAndSetHeadlessProperty
253,261
void (boolean isHeadless) { System.setProperty("java.awt.headless", Boolean.toString(isHeadless)); }
setHeadlessProperty
253,262
void () { if (EventQueue.isDispatchThread()) { //noinspection ResultOfMethodCallIgnored IdeEventQueue.getInstance(); // replaces system event queue } else { replaceIdeEventQueueSafely(); } }
setupEventQueue
253,263
void () { if (Toolkit.getDefaultToolkit().getSystemEventQueue() instanceof IdeEventQueue) { return; } if (SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("must not be called on EDT"); } AWTAutoShutdown.getInstance().notifyThreadBusy(Thread.currentThread()); // in JDK 1.6, `EventQueue#push` cau...
replaceIdeEventQueueSafely
253,264
void () { ProjectJdkTable table = ProjectJdkTable.getInstance(); if (table == null) { return; } Sdk[] jdks = table.getAllJdks(); if (jdks.length == 0) { return; } Set<Sdk> old = Set.of(oldSdks); Collection<Sdk> leaked = ContainerUtil.subtract(Set.of(jdks), old); try { if (!leaked.isEmpty()) { String message = "Leaked S...
checkForJdkTableLeaks
253,265
void () { if (ourPlatformPrefixInitialized) { return; } if (System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY) != null) { ourPlatformPrefixInitialized = true; return; } for (String candidate : PREFIX_CANDIDATES) { String markerPath = candidate == null ? "idea/ApplicationInfo.xml" : "META-INF/" + candidate + "Plugin....
autodetectPlatformPrefix
253,266
void (@NotNull String prefix) { System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, prefix); ourPlatformPrefixInitialized = true; }
setPlatformPrefix
253,267
void () { PerformanceWatcher.dumpThreadsToConsole("Thread dump:"); }
printThreadDump
253,268
void (@NotNull Disposable parentDisposable, @NotNull String @NotNull ... threadNamePrefixes) { ContainerUtil.addAll(wellKnownOffenders, threadNamePrefixes); Disposer.register(parentDisposable, () -> ContainerUtil.removeAll(wellKnownOffenders, threadNamePrefixes)); }
longRunningThreadCreated
253,269
void () { NettyUtil.awaitQuiescenceOfGlobalEventExecutor(100, TimeUnit.SECONDS); ShutDownTracker.getInstance().waitFor(100, TimeUnit.SECONDS); }
awaitQuiescence
253,270
boolean (@NotNull Thread thread, StackTraceElement @NotNull [] stackTrace) { if (!thread.isAlive()) return true; if (isWellKnownOffender(thread.getName())) return true; if (stackTrace.length == 0) { return true; // ignore threads with empty stack traces for now. Seems they are zombies unwilling to die. } return isIdleA...
shouldIgnore
253,271
boolean (@NotNull String threadName) { for (String t : wellKnownOffenders) { if (threadName.contains(t)) { return true; } } return false; }
isWellKnownOffender
253,272
boolean (StackTraceElement @NotNull [] stackTrace) { return ContainerUtil.exists(stackTrace, element -> element.getMethodName().equals("getTask") && element.getClassName().equals("java.util.concurrent.ThreadPoolExecutor")); }
isIdleApplicationPoolThread
253,273
boolean (StackTraceElement @NotNull [] stackTrace) { return ContainerUtil.exists(stackTrace, element -> element.getMethodName().equals("select") && element.getClassName().equals("io.ktor.network.selector.ActorSelectorManager")); }
isKotlinCIOSelector
253,274
boolean (@NotNull Thread thread, StackTraceElement @NotNull [] stackTrace) { if (!ForkJoinWorkerThread.class.isAssignableFrom(thread.getClass())) { return false; } boolean insideAwaitWork = ContainerUtil.exists( stackTrace, element -> element.getMethodName().equals("awaitWork") && element.getClassName().equals("java.ut...
isIdleCommonPoolThread
253,275
boolean (StackTraceElement @NotNull [] stackTrace) { if (stackTrace.length < 5) { return false; } return stackTrace[0].getClassName().equals("sun.misc.Unsafe") && stackTrace[0].getMethodName().equals("unpark") && stackTrace[2].getClassName().equals("java.util.concurrent.FutureTask") && stackTrace[2].getMethodName().equ...
isFutureTaskAboutToFinish
253,276
boolean (@NotNull Thread thread, @NotNull StackTraceElement @NotNull [] stackTrace) { if (stackTrace.length != 4) { return false; } return "kotlinx.coroutines.DefaultExecutor".equals(thread.getName()) && (stackTrace[0].getClassName().equals("sun.misc.Unsafe") || stackTrace[0].getClassName().equals("jdk.internal.misc.Un...
isIdleDefaultCoroutineExecutorThread
253,277
boolean (@NotNull Thread thread, StackTraceElement @NotNull [] stackTrace) { if (!"kotlinx.coroutines.scheduling.CoroutineScheduler$Worker".equals(thread.getClass().getName())) { return false; } //noinspection UnnecessaryLocalVariable boolean insideCpuWorkerIdle = ContainerUtil.exists( stackTrace, element -> element.ge...
isCoroutineSchedulerPoolThread
253,278
boolean (StackTraceElement @NotNull [] stackTrace) { // java.lang.AssertionError: Thread leaked: Thread[Redirect stderr,5,main] (alive) RUNNABLE //--- its stacktrace: // ... // at app//com.intellij.ide.starter.process.exec.ProcessExecutor$redirectProcessOutput$1.invoke(ProcessExecutor.kt:40) // at app//kotlin.concurren...
isStarterTestFramework
253,279
boolean (StackTraceElement @NotNull [] stackTrace) { // Thread leaked: Thread[JMX client heartbeat 3,5,main] (alive) TIMED_WAITING // --- its stacktrace: // at java.base@17.0.9/java.lang.Thread.sleep(Native Method) // at java.management@17.0.9/com.sun.jmx.remote.internal.ClientCommunicatorAdmin$Checker.run(ClientCommun...
isJMXRemoteCall
253,280
CharSequence ( @NotNull Map<String, Thread> after, @NotNull Map<Thread, StackTraceElement[]> stackTraces ) { StringBuilder f = new StringBuilder(); after.forEach((name, thread) -> { f.append("\"").append(name).append("\" (").append(thread.isAlive() ? "alive" : "dead").append(") ").append(thread.getState()); f.append("\...
dumpThreadsToString
253,281
String (StackTraceElement @NotNull [] stackTrace) { return stackTrace.length < 5 ? "stackTrace.length: " + stackTrace.length : "(diagnostic: " + "0: " + stackTrace[0].getClassName() + " : " + stackTrace[0].getClassName().equals("sun.misc.Unsafe") + " . " + stackTrace[0].getMethodName() + " : " + stackTrace[0].getMethod...
internalDiagnostic
253,282
List<Path> (String classpathFilePath) { try { Path file = Paths.get(classpathFilePath); Set<Path> roots = new LinkedHashSet<>(); try (BufferedReader reader = Files.newBufferedReader(file)) { while (reader.ready()) { roots.add(Paths.get(reader.readLine())); } } return new ArrayList<>(roots); } catch (IOException e) { th...
loadFilesPaths
253,283
List<Path> () { String classPathFilePath = System.getProperty("classpath.file"); return classPathFilePath != null ? loadFilesPaths(classPathFilePath) : null; }
getRoots
253,284
List<Path> () { try { String classPathFilePath = System.getProperty("exclude.tests.roots.file"); return classPathFilePath != null ? loadFilesPaths(classPathFilePath) : null; } catch (Exception e) { return Collections.emptyList(); } }
getExcludeRoots
253,285
void () { List<Path> files = getRoots(); if (files == null) { return; } try { URL[] urls = files.stream().map(path -> { try { return path.toUri().toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } }).toArray(URL[]::new); URLClassLoader auxLoader = new URLClassLoader(urls, Thread.currentThread...
install
253,286
JUnit4TestAdapterCache () { return new JUnit4TestAdapterCache() { @Override public RunNotifier getNotifier(final TestResult result, final JUnit4TestAdapter adapter) { RunNotifier notifier = new RunNotifier(); notifier.addListener(new RunListener() { @Override public void testFailure(Failure failure) { result.addError(a...
createJUnit4TestAdapterCache
253,287
RunNotifier (final TestResult result, final JUnit4TestAdapter adapter) { RunNotifier notifier = new RunNotifier(); notifier.addListener(new RunListener() { @Override public void testFailure(Failure failure) { result.addError(asTest(failure.getDescription()), failure.getException()); } @Override public void testFinished...
getNotifier
253,288
void (Failure failure) { result.addError(asTest(failure.getDescription()), failure.getException()); }
testFailure
253,289
void (Description description) { result.endTest(asTest(description)); }
testFinished
253,290
void (Description description) { result.startTest(asTest(description)); }
testStarted
253,291
void (Description description) { result.addError(asTest(description), IgnoreException.INSTANCE); }
testIgnored
253,292
void (Failure failure) { testFailure(failure); }
testAssumptionFailure
253,293
boolean () { return myCurrentTestStart != 0; }
smthExecuted
253,294
void (TestIdentifier testIdentifier, ReportEntry entry) { StringBuilder builder = new StringBuilder(); builder.append("timestamp = ").append(entry.getTimestamp()); entry.getKeyValuePairs().forEach((key, value) -> builder.append(", ").append(key).append(" = ").append(value)); builder.append("\n"); myPrintStream.println(...
reportingEntryPublished
253,295
void (TestPlan testPlan) { myTestPlan = testPlan; }
testPlanExecutionStarted
253,296
void (TestIdentifier testIdentifier, String reason) { executionStarted(testIdentifier); executionFinished(testIdentifier, TestExecutionResult.Status.ABORTED, null, reason); }
executionSkipped
253,297
void (TestIdentifier testIdentifier) { if (testIdentifier.isTest()) { testStarted(testIdentifier); myCurrentTestStart = System.nanoTime(); } else if (hasNonTrivialParent(testIdentifier)) { myFinishCount = 0; myPrintStream.println("##teamcity[testSuiteStarted" + idAndName(testIdentifier) + "]"); } }
executionStarted
253,298
void (TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { final Throwable throwable = testExecutionResult.getThrowable().orElse(null); if (throwable != null && IgnoreException.isIgnoringThrowable(throwable)) { String message = throwable.getMessage(); executionFinished(testIdentifier, TestExecution...
executionFinished
253,299
void (TestIdentifier testIdentifier, TestExecutionResult.Status status, Throwable throwableOptional, String reason) { if (testIdentifier.isTest()) { final long duration = getDuration(); if (status == TestExecutionResult.Status.FAILED) { testFailure(testIdentifier, ServiceMessageTypes.TEST_FAILED, throwableOptional, dur...
executionFinished