Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
28,800
void () { addFile(""" class Bar { def positive(){} def negative(){} def bitwiseNegate(){} }"""); }
testUnaryMethods
28,801
void () { myFixture.addFileToProject("java/util/regex/Pattern.java", """ package java.util.regex; public final class Pattern { public static Pattern compile(String regex) {return new Pattern();} public Matcher matcher(CharSequence input){return new Matcher();} public static boolean matches(String regex, CharSequence input) {return true;} }"""); myFixture.addFileToProject("java/util/regex/Matcher.java", """ package java.util.regex; public final class Matcher { public boolean matches() {return true;} } """); doTest(); }
testRegex
28,802
Pattern (String regex) {return new Pattern();}
compile
28,803
Matcher (CharSequence input) {return new Matcher();}
matcher
28,804
boolean (String regex, CharSequence input) {return true;}
matches
28,805
boolean () {return true;}
matches
28,806
void () { doTest(); }
testAsBoolean
28,807
void () { doTest(); }
testCharInitializer
28,808
void () { doTest(); }
testAnonymousFromMap
28,809
void () { doTest(); }
testClosure
28,810
void () { doTest(); }
testListAsArray
28,811
void () { doTest(); }
testUnresolvedArrayAccess
28,812
void () { doTest(); }
testArrayAccess
28,813
void () { addBigDecimal(); doTest(); }
testCastWithEquality
28,814
void () { doTest(); }
testAsserts
28,815
void () { doTest(); }
testConditional
28,816
void () { doTest(); }
testBinary
28,817
void () { doTest(); }
testSafeCast
28,818
void () { doTest(); }
testNewExpr
28,819
void () { doTest(); }
testMapNameAlreadyused
28,820
void () { doTest(); }
testEmptyMap
28,821
void () { doTest(); }
testEmptyList
28,822
void () { doTest(); }
testErasedArrayInitializer
28,823
void () { doTest(); }
testTupleVariableDeclaration
28,824
void () { doTest(); }
testEmptyVarargs
28,825
void () { doTest(); }
testClassReference
28,826
void () { doTest(); }
testClassMethod
28,827
void () { doTest(); }
testEquals
28,828
void () { doTest(); }
testSelfNavigatingOperator
28,829
void () { doTest(); }
testComparisonToNull
28,830
void () { doTest(); }
testStringConverting
28,831
void () { doTest(); }
testMultilineString
28,832
void () { doTest(); }
testInWitchClassCheck
28,833
void () { doTest(); }
testSwitch
28,834
void () { doTest(); }
testPropSelection
28,835
void () { doTest(); }
testSafeChain
28,836
String () { return TestUtils.getTestDataPath() + "groovy/inspections/secondUnsafeCall"; }
getBasePath
28,837
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test"); myFixture.configureByText("a.groovy", data.get(0)); myFixture.enableInspections(new SecondUnsafeCallInspection()); final IntentionAction action = myFixture.findSingleIntention("Second unsafe call"); myFixture.launchAction(action); myFixture.checkResult(data.get(1)); }
doTest
28,838
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test"); myFixture.configureByText("a.groovy", data.get(0)); myFixture.enableInspections(new SecondUnsafeCallInspection()); final IntentionAction action = myFixture.getAvailableIntention("Second unsafe call"); Assert.assertNull(action); }
doNoTest
28,839
void () { doTest(); }
test4Calls
28,840
void () { doTest(); }
testMethodCall
28,841
void () { doTest(); }
testMethodsCalls
28,842
void () { doTest(); }
testSecondUnsafeCall1
28,843
void () { doTest(); }
testVarInit
28,844
void () { doNoTest(); }
testSafeChain
28,845
TestNodePresentation (String fullName) { return JUnitTestTreeNodeManager.JAVA_NODE_NAMES_MANAGER.getRootNodePresentation(fullName); }
getRootNodePresentation
28,846
String (String fqName, boolean splitBySlash) { return JUnitTestTreeNodeManager.JAVA_NODE_NAMES_MANAGER.getNodeName(fqName, splitBySlash); }
getNodeName
28,847
String (Description description, String className, String methodName) { Collection<? extends Annotation> annotations = description.getAnnotations(); String spockAwareName = methodName; for (Annotation annotation : annotations) { if (annotation instanceof FeatureMetadata) { spockAwareName = ((FeatureMetadata)annotation).name(); } } return JUnitTestTreeNodeManager.JAVA_NODE_NAMES_MANAGER.getTestLocation(description, className, spockAwareName); }
getTestLocation
28,848
boolean (CompileContext context) { return !myForStubs && FILES_MARKED_DIRTY_FOR_NEXT_ROUND.get(context, Boolean.FALSE); }
hasFilesToCompileForNextRound
28,849
void (CompileContext context) { if (myForStubs) { File stubRoot = getStubRoot(context); if (stubRoot.exists() && !FileUtil.deleteWithRenaming(stubRoot)) { context.processMessage(new CompilerMessage( myBuilderName, BuildMessage.Kind.ERROR, GroovyJpsBundle.message("external.build.cannot.clean.path.0", stubRoot.getPath()) )); } } }
buildStarted
28,850
void (CompileContext context, ModuleChunk chunk) { JavaBuilderUtil.cleanupChunkResources(context); JpsGroovycRunner.clearContinuation(context, chunk); STUB_TO_SRC.set(context, null); }
chunkBuildFinished
28,851
File (CompileContext context) { return new File(context.getProjectDescriptor().dataManager.getDataPaths().getDataStorageRoot(), "groovyStubs"); }
getStubRoot
28,852
JpsSdk<JpsDummyElement> (ModuleChunk chunk) { return chunk.getModules().iterator().next().getSdk(JpsJavaSdkType.INSTANCE); }
getJdk
28,853
List<String> (boolean addClassLoaderJar) { List<String> roots = GroovyRtJarPaths.getGroovyRtRoots(ClasspathBootstrap.getResourceFile(GroovyBuilder.class), addClassLoaderJar); if (addClassLoaderJar) { return ContainerUtil.append(roots, ClasspathBootstrap.getResourcePath(Function.class)); // intellij.platform.util.rt } return roots; }
getGroovyRtRoots
28,854
boolean (String path) { //todo file type check return path.endsWith("." + GROOVY_EXTENSION); }
isGroovyFile
28,855
List<String> () { return Collections.singletonList(GROOVY_EXTENSION); }
getCompilableFileExtensions
28,856
String () { return myBuilderName; }
toString
28,857
String () { return myBuilderName; }
getPresentableName
28,858
long () { return 100; }
getExpectedBuildTime
28,859
void (CompileContext context, OutputFileObject out) { final Map<String, String> stubToSrc = STUB_TO_SRC.get(context); if (stubToSrc != null) { for (String groovy : Iterators.filter(Iterators.map(out.getSourceFiles(), file -> stubToSrc.get(FileUtil.toSystemIndependentName(file.getPath()))), Iterators.notNullFilter())) { try { final File groovyFile = new File(groovy); if (!FSOperations.isMarkedDirty(context, CompilationRound.CURRENT, groovyFile)) { FSOperations.markDirty(context, CompilationRound.NEXT, groovyFile); FILES_MARKED_DIRTY_FOR_NEXT_ROUND.set(context, Boolean.TRUE); } } catch (IOException e) { LOG.error(e); } } } }
process
28,860
void (CompilationResult result) { super.outputClassFiles(result); if (result == null || result.hasErrors() && !proceedOnError) { return; } List<String> classFiles = new ArrayList<>(); for (ClassFile file : result.getClassFiles()) { classFiles.add(new String(file.fileName()) + ".class"); } myOutputs.put(new String(result.getFileName()), classFiles); }
outputClassFiles
28,861
String () { return GroovyJpsBundle.message("builder.resource.checker"); }
getPresentableName
28,862
long () { return 50; }
getExpectedBuildTime
28,863
ModuleChunk (final JpsModule module) { return new ModuleChunk(Collections.singleton(new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION))); }
singleModuleChunk
28,864
boolean (File file, GroovyResourceRootDescriptor sourceRoot, String path, JpsJavaCompilerConfiguration configuration) { return GroovyBuilder.isGroovyFile(path) && !configuration.getValidationExcludes().isExcluded(file); }
shouldProcessSourceFile
28,865
boolean (CompileContext context, GroovyCompilerResult result) { return false; }
checkChunkRebuildNeeded
28,866
Collection<String> (CompileContext context, ModuleChunk chunk) { Collection<String> paths = super.generateClasspath(context, chunk); for (File resourceOutput : getVisibleResourceOutputs(context, myTarget.isTests())) { paths.add(resourceOutput.getPath()); } return paths; }
generateClasspath
28,867
List<File> (CompileContext context, boolean tests) { List<File> resourceOutputs = new ArrayList<>(); JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(myTarget.getModule()). includedIn(JpsJavaClasspathKind.compile(tests)). recursively(); for (JpsModule module : enumerator.getModules()) { resourceOutputs.addAll(new CheckResourcesTarget(module, CheckResourcesTarget.PRODUCTION).getOutputRoots(context)); if (tests) { resourceOutputs.addAll(new CheckResourcesTarget(module, CheckResourcesTarget.TESTS).getOutputRoots(context)); } } return resourceOutputs; }
getVisibleResourceOutputs
28,868
GroovyResourceRootDescriptor (CompileContext context, File srcFile) { return context.getProjectDescriptor().getBuildRootIndex().findParentDescriptor(srcFile, CheckResourcesTarget.TARGET_TYPES, context); }
findRoot
28,869
Set<CheckResourcesTarget> (ModuleChunk chunk) { return Collections.singleton(myTarget); }
getTargets
28,870
GroovycContinuation (Future<Void> future, @NotNull Queue<String> mailbox, GroovycOutputParser parser) { return new GroovycContinuation() { @NotNull @Override public GroovyCompilerResult continueCompilation() throws Exception { parser.onContinuation(); mailbox.offer(GroovyRtConstants.JAVAC_COMPLETED); future.get(); return parser.result(); } @Override public void buildAborted() { mailbox.offer(GroovyRtConstants.BUILD_ABORTED); } }; }
createContinuation
28,871
void () { mailbox.offer(GroovyRtConstants.BUILD_ABORTED); }
buildAborted
28,872
String (Collection<String> compilationClassPath) { if (!"true".equals(System.getProperty("groovyc.reuse.compiler.classes", "true"))) { return null; } List<String> groovyJars = ContainerUtil.findAll(compilationClassPath, s -> { String fileName = PathUtilRt.getFileName(s); return (GROOVY_ALL_JAR_PATTERN.matcher(fileName).matches() || GROOVY_JAR_PATTERN.matcher(fileName).matches()) && !GROOVY_ECLIPSE_BATCH_PATTERN.matcher(fileName).matches() && !GROOVY_JPS_PLUGIN_JARS_PATTERN.matcher(fileName).matches() ; }); LOG.debug("Groovy jars: " + groovyJars); String singleJar = ContainerUtil.getOnlyItem(groovyJars); if (singleJar == null) { // avoid complications caused by caching classes from several groovy versions in classpath return null; } String fileName = PathUtilRt.getFileName(singleJar); if (GROOVY_ALL_JAR_PATTERN.matcher(fileName).matches()) { return singleJar; } Matcher matcher = GROOVY_JAR_PATTERN.matcher(fileName); if (matcher.matches()) { String version = matcher.group(2); if (version != null && version.startsWith("2.5")) { return singleJar; } } return null; }
evaluatePathToGroovyJarForParentClassloader
28,873
boolean (String name) { if (name.startsWith("groovyjarjar")) { return true; } if (name.startsWith("org.codehaus.groovy.")) { String tail = name.substring("org.codehaus.groovy.".length()); if (tail.startsWith("ast") || tail.startsWith("classgen") || tail.startsWith("tools.javac") || tail.startsWith("antlr") || tail.startsWith("vmplugin") || tail.startsWith("reflection") || tail.startsWith("control")) { return true; } if (tail.startsWith("runtime") && name.contains("GroovyMethods")) { return true; } } return false; }
isCompilerCoreClass
28,874
List<Path> (Collection<String> paths) { List<Path> result = new ArrayList<>(); for (String s : paths) { result.add(Paths.get(s)); } return result; }
toPaths
28,875
void (int b) { if (overridden != null && Thread.currentThread() != thread) { overridden.write(b); return; } if (hasLineSeparator && !isLineSeparator(b)) { flush(); } else { hasLineSeparator |= isLineSeparator(b); } line.write(b); }
write
28,876
boolean (int b) { return b == '\n' || b == '\r'; }
isLineSeparator
28,877
void () { if (overridden != null && Thread.currentThread() != thread) { overridden.flush(); return; } if (line.size() > 0) { parser.notifyTextAvailable(StringUtil.convertLineSeparators(line.toString(StandardCharsets.UTF_8)), type); line = new ByteArrayOutputStream(); hasLineSeparator = false; } }
flush
28,878
void (CompileContext context, Map<T, String> generationOutputs, MultiMap<T, OutputItem> compiled) { }
stubsGenerated
28,879
boolean (int jdkVersion) { String explicitProperty = System.getProperty(GROOVYC_IN_PROCESS); return explicitProperty != null ? "true".equals(explicitProperty) : jdkVersion == JavaVersion.current().feature || jdkVersion < 5; // our own jars require at least JDK 5 }
shouldRunGroovycInProcess
28,880
void (CompileContext context, ModuleChunk chunk) { GroovycContinuation continuation = takeContinuation(context, chunk); if (continuation != null) { if (Utils.IS_TEST_MODE || LOG.isDebugEnabled()) { LOG.debug("clearing continuation for " + chunk); } continuation.buildAborted(); } }
clearContinuation
28,881
void (CompileContext context, ModuleChunk chunk, @Nullable GroovycContinuation continuation) { clearContinuation(context, chunk); if (continuation != null) { if (Utils.IS_TEST_MODE || LOG.isDebugEnabled()) { LOG.debug("registering continuation for " + chunk); } Map<ModuleChunk, GroovycContinuation> map = CONTINUATIONS.get(context); if (map == null) CONTINUATIONS.set(context, map = new ConcurrentHashMap<>()); map.put(chunk, continuation); } }
setContinuation
28,882
Set<String> (List<File> toCompile) { final Set<String> toCompilePaths = new LinkedHashSet<>(); for (File file : toCompile) { if (LOG.isDebugEnabled()) { LOG.debug("Path to compile: " + file.getPath()); } toCompilePaths.add(FileUtil.toSystemIndependentName(file.getPath())); } return toCompilePaths; }
getPathsToCompile
28,883
boolean (CompileContext context, GroovyCompilerResult result) { if (CHUNK_REBUILD_ORDERED.get(context) != null) { if (!myForStubs) { CHUNK_REBUILD_ORDERED.set(context, null); } return false; } if (JavaBuilderUtil.isForcedRecompilationAllJavaModules(context) || !result.shouldRetry()) { return false; } CHUNK_REBUILD_ORDERED.set(context, Boolean.TRUE); LOG.info("Order chunk rebuild"); return true; }
checkChunkRebuildNeeded
28,884
T (Map<T, String> generationOutputs) { return generationOutputs.keySet().iterator().next(); }
representativeTarget
28,885
boolean (@NotNull T target, @NotNull File file, @NotNull R sourceRoot) { if (shouldProcessSourceFile(file, sourceRoot, file.getPath(), configuration)) { if (forStubs && settings.isExcludedFromStubGeneration(file)) { hasExcludes.set(true); return true; } toCompile.add(file); } return true; }
apply
28,886
JpsGroovySettings (CompileContext context) { return JpsGroovySettings.getSettings(context.getProjectDescriptor().getProject()); }
getGroovyCompilerSettings
28,887
JpsJavaCompilerConfiguration (CompileContext context) { return Objects.requireNonNull(JpsJavaExtensionService.getInstance().getCompilerConfiguration(context.getProjectDescriptor().getProject())); }
getJavaCompilerSettings
28,888
boolean (File file, R sourceRoot, String path, JpsJavaCompilerConfiguration configuration) { return acceptsFileType(path) && !configuration.isResourceFile(file, sourceRoot.getRootFile()); }
shouldProcessSourceFile
28,889
boolean (String path) { return GroovyBuilder.isGroovyFile(path); }
acceptsFileType
28,890
Collection<String> (CompileContext context, ModuleChunk chunk) { //groovy_rt.jar // IMPORTANT! must be the first in classpath final Set<String> cp = new LinkedHashSet<>(GroovyBuilder.getGroovyRtRoots(false)); for (File file : ProjectPaths.getCompilationClasspathFiles(chunk, chunk.containsTests(), false, false)) { cp.add(FileUtil.toCanonicalPath(file.getPath())); } for (GroovyBuilderExtension extension : JpsServiceManager.getInstance().getExtensions(GroovyBuilderExtension.class)) { cp.addAll(extension.getCompilationClassPath(context, chunk)); } return cp; }
generateClasspath
28,891
void (@NotNull String text, @NotNull Key outputType) { parser.notifyTextAvailable(text, outputType); }
notifyTextAvailable
28,892
List<String> (File tempFile, JpsGroovySettings settings, boolean forStubs) { List<String> programParams = List.of(myOptimizeClassLoading ? GroovyRtConstants.OPTIMIZE : "do_not_optimize", forStubs ? "stubs" : "groovyc", tempFile.getPath()); if (settings.invokeDynamic) { programParams = ContainerUtil.append(programParams, "--indy"); } return programParams; }
getProgramParams
28,893
String (ModuleChunk chunk) { JpsSdk<?> sdk = GroovyBuilder.getJdk(chunk); return sdk != null ? JpsJavaSdkType.getJavaExecutable(sdk) : SystemProperties.getJavaHome() + "/bin/java"; }
getJavaExecutable
28,894
CheckResourcesTarget () { return myTarget; }
getTarget
28,895
FileFilter () { return myDescriptor.createFileFilter(); }
createFileFilter
28,896
boolean () { return myDescriptor.isGenerated(); }
isGenerated
28,897
String () { return myDescriptor.toString(); }
toString
28,898
boolean () { return myDescriptor.canUseFileCache(); }
canUseFileCache
28,899
String () { return myDescriptor.getRootId(); }
getRootId