Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
4,400
String () { return myId; }
getId
4,401
String () { return myName; }
getName
4,402
String () { return myUrl; }
getUrl
4,403
JpsRemoteRepositoryService () { return JpsServiceManager.getInstance().getService(JpsRemoteRepositoryService.class); }
getInstance
4,404
JpsServiceManager () { return InstanceHolder.INSTANCE; }
getInstance
4,405
SharedThreadPool () { return JpsServiceManager.getInstance().getService(SharedThreadPool.class); }
getInstance
4,406
Collection<T> () { final Collection<T> cached = myCached; if (cached != null) { return cached; } final ServiceLoader<T> loader = ServiceLoader.load(myExtensionClass, myExtensionClass.getClassLoader()); final List<T> extensions = new ArrayList<>(); for (T extension : loader) { extensions.add(extension); } myCached = extensions; return extensions; }
getExtensions
4,407
Collection<JavaSourceTransformer> () { return ourExtSupport.getExtensions(); }
getTransformers
4,408
String () { return null; }
getAlternativeId
4,409
boolean () { return false; }
isCompilerTreeAPISupported
4,410
List<String> () { return Collections.emptyList(); }
getDefaultCompilerOptions
4,411
void (List<String> options) { }
preprocessOptions
4,412
String () { return ID; }
getId
4,413
String () { return ALTERNATIVE_ID; }
getAlternativeId
4,414
boolean () { return true; }
isCompilerTreeAPISupported
4,415
String () { return "javac " + System.getProperty("java.version"); }
getDescription
4,416
String (final String header, Throwable ex) { StringWriter stringWriter = new StringWriter(); stringWriter.write(header); stringWriter.write(":\n"); ex.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.getBuffer().toString(); }
formatErrorMessage
4,417
List<File> () { return Collections.emptyList(); }
getAdditionalClasspath
4,418
List<String> () { return Collections.singletonList("-implicit:class"); }
getDefaultCompilerOptions
4,419
boolean () { return false; }
isCanceled
4,420
void (int c) { processData(new CharSequenceIterator(c)); }
write
4,421
void (char[] cbuf) { processData(new CharSequenceIterator(cbuf)); }
write
4,422
void (String str) { processData(new CharSequenceIterator(str)); }
write
4,423
void (String str, int off, int len) { processData(new CharSequenceIterator(str.subSequence(off, off + len))); }
write
4,424
Writer (CharSequence csq) { processData(new CharSequenceIterator(csq)); return this; }
append
4,425
Writer (CharSequence csq, int start, int end) { processData(new CharSequenceIterator(csq.subSequence(start, end))); return this; }
append
4,426
Writer (char c) { processData(new CharSequenceIterator(c)); return this; }
append
4,427
void (char[] cbuf, int off, int len) { processData(new CharSequenceIterator(cbuf, off, len)); }
write
4,428
void (CharIterator data) { while (myLineParser.parse(data)) { final String line = myLineParser.getResult(); myLineParser.reset(); lineAvailable(line); } }
processData
4,429
boolean (CharIterator it) { while (it.hasData()) { final char ch = it.nextChar(); if (ch == '\r') { myFoundCR = true; } else if (ch == '\n') { myFoundCR = false; return true; } else { if (myFoundCR) { myData.append('\r'); myFoundCR = false; } myData.append(ch); } } return false; }
parse
4,430
boolean () { return myData.length() > 0; }
hasData
4,431
String () { return myData.toString(); }
getResult
4,432
void () { myFoundCR = false; myData.setLength(0); }
reset
4,433
char () { return myChars.charAt(myCursor++); }
nextChar
4,434
boolean () { return myCursor < myChars.length(); }
hasData
4,435
int () { return 1; }
length
4,436
char (int index) { if (index != 0) { throw new IndexOutOfBoundsException("Index out of bounds: " + index); } return myCh; }
charAt
4,437
CharSequence (int start, int end) { throw new RuntimeException("Method subSequence not implemented"); }
subSequence
4,438
String () { return String.valueOf(myCh); }
toString
4,439
byte[] () { return myBuffer; }
getBuffer
4,440
int () { return myOffset; }
getOffset
4,441
int () { return myLength; }
getLength
4,442
byte[] () { return Arrays.copyOfRange(myBuffer, myOffset, myOffset + myLength); }
toByteArray
4,443
JpsJavacFileManager () { return myFileManager; }
getFileManager
4,444
ProcessingEnvironment (ProcessingEnvironment processingEnv) { ProcessingEnvironment wrapped = myWrappers.get(processingEnv); if (wrapped == null) { myWrappers.put(processingEnv, wrapped = wrap(ProcessingEnvironment.class, new ProcessingEnvironmentWrapper(processingEnv, myFileManager))); } return wrapped; }
getWrappedProcessingEnvironment
4,445
String (Processor proc) { return (proc instanceof WrapperDelegateAccessor<?>? ((WrapperDelegateAccessor<?>)proc).getWrapperDelegate() : proc).getClass().getName(); }
getProcessorName
4,446
Iterable<Processor> (Iterable<? extends Processor> processors) { return myAllProcessors = Iterators.map(processors, new Function<Processor, Processor>() { @Override public Processor fun(Processor processor) { return wrap(Processor.class, new ProcessorWrapper(processor, ProcessingContext.this)); } }); }
wrapProcessors
4,447
Processor (Processor processor) { return wrap(Processor.class, new ProcessorWrapper(processor, ProcessingContext.this)); }
fun
4,448
String (String message) { if (message != null) { try { final String realProcName = myLastProcName; if (realProcName != null && !realProcName.isEmpty()) { final String wrappedName = lookupWrappedProcName(realProcName); if (wrappedName != null) { return message.replace(wrappedName, realProcName); } } } catch (Throwable ignored) { //iterating namesMap may cause unexpected AP class loading exceptions } } return message; }
adjustMessage
4,449
String (String procName) { String wrappedName = myProcNamesMap.get(procName); if (wrappedName == null) { for (Processor proc : myAllProcessors) { if (proc instanceof WrapperDelegateAccessor<?>) { myProcNamesMap.put(getProcessorName(proc), proc.getClass().getName()); } } wrappedName = myProcNamesMap.get(procName); } return wrappedName; }
lookupWrappedProcName
4,450
T () { return myDelegate; }
getWrapperDelegate
4,451
void (String line) { getWrapperDelegate().outputLineAvailable(myProcContext.adjustMessage(line)); }
outputLineAvailable
4,452
void (Diagnostic<? extends T> diagnostic) { getWrapperDelegate().report(wrap(Diagnostic.class, new DiagnosticWrapper<>(myProcContext, (Diagnostic<T>)diagnostic))); }
report
4,453
String (Locale locale) { return myProcContext.adjustMessage(getWrapperDelegate().getMessage(locale)); }
getMessage
4,454
void (ProcessingEnvironment processingEnv) { myProcessingEnv = processingEnv; final Ref<ClassLoader> oldCtxLoader = setupContextClassLoader(); try { getWrapperDelegate().init(myProcessingContext.getWrappedProcessingEnvironment(processingEnv)); } catch (IllegalArgumentException e) { sendDiagnosticWarning(processingEnv, e); throw e; } finally { restoreContextClassLoader(oldCtxLoader); } }
init
4,455
boolean (Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { final Ref<ClassLoader> oldCtxLoader = setupContextClassLoader(); try { final Processor delegate = getWrapperDelegate(); myProcessingContext.setLastExecutedProcessorName(delegate); return delegate.process(annotations, roundEnv); } catch (IllegalArgumentException e) { sendDiagnosticWarning(myProcessingEnv, e); throw e; } finally { restoreContextClassLoader(oldCtxLoader); } }
process
4,456
Ref<ClassLoader> () { final Processor delegate = getWrapperDelegate(); if (delegate != null) { final Thread currentThread = Thread.currentThread(); final ClassLoader processorLoader = delegate.getClass().getClassLoader(); final ClassLoader currentCtxLoader = currentThread.getContextClassLoader(); if (processorLoader != currentCtxLoader) { currentThread.setContextClassLoader(processorLoader); return Ref.create(currentCtxLoader); } } return null; }
setupContextClassLoader
4,457
void (@Nullable Ref<ClassLoader> loaderRef) { if (loaderRef != null) { Thread.currentThread().setContextClassLoader(loaderRef.get()); } }
restoreContextClassLoader
4,458
void (ProcessingEnvironment processingEnv, Throwable e) { if (processingEnv != null && !myCodeShown) { processingEnv.getMessager().printMessage( Diagnostic.Kind.MANDATORY_WARNING, "The " + e.getClass() + " may be caused by the wrapped ProcessingEnvironment object.\n" + "Please pass the wrapped ProcessingEnvironment further to super.init().\n"+ "If you need to access the original ProcessingEnvironment object (e.g. for creating com.sun.source.util.Trees.instance(ProcessingEnvironment)), you may use following code in the processor implementation:\n\n" + getUnwrapCodeSuggestion(ProcessingEnvironment.class, "processingEnv") ); processingEnv.getMessager().printMessage( Diagnostic.Kind.MANDATORY_WARNING, "Workaround: to make project compile with the current annotation processor implementation, start JPS with VM option: -D"+JavacMain.TRACK_AP_GENERATED_DEPENDENCIES_PROPERTY + "=false\n" + "When run from IDE, the option can be set in \"Compiler Settings | build process VM options\"" ); myCodeShown = true; } }
sendDiagnosticWarning
4,459
Filer () { Filer impl = myFilerImpl; if (impl == null) { final Filer delegateFiler = getWrapperDelegate().getFiler(); myFilerImpl = impl = wrap(Filer.class, new FilerWrapper(delegateFiler, myFileManager, getWrapperDelegate().getElementUtils())); } return impl; }
getFiler
4,460
void (CharSequence resourceName, final Collection<? extends Element> elements) { if (resourceName != null && resourceName.length() > 0 && !elements.isEmpty()) { myFileManager.addAnnotationProcessingClassMapping(resourceName.toString(), Iterators.filter(Iterators.map(elements, convertToClassName), Iterators.notNullFilter())); } }
addMapping
4,461
T () { return delegateTo; }
getWrapperDelegate
4,462
String (Element element) { Name qName = null; while (element != null) { if (element instanceof TypeElement) { qName = ((TypeElement)element).getQualifiedName(); } else if (element instanceof PackageElement) { qName = ((PackageElement)element).getQualifiedName(); } else if (ourGetQualifiedNameMethod != null && ourGetQualifiedNameMethod.getDeclaringClass().isAssignableFrom(element.getClass())) { try { qName = (Name)ourGetQualifiedNameMethod.invoke(element); } catch (Throwable ignored) { } } if (qName != null) { if (!qName.equals(myEmptyName)) { return qName.toString(); } qName = null; } element = element.getEnclosingElement(); } return null; }
fun
4,463
String (Class<?> ifaceClass, String objVarName) { return ifaceClass.getSimpleName() + " unwrapped" + objVarName + " = " + "jbUnwrap(" + ifaceClass.getSimpleName() + ".class, " + objVarName + ");" + "\n\n\t\twhere\n\n" + "private static <T> T jbUnwrap(Class<? extends T> iface, T wrapper) {\n" + " T unwrapped = null;\n" + " try {\n" + " final Class<?> apiWrappers = wrapper.getClass().getClassLoader().loadClass(\"org.jetbrains.jps.javac.APIWrappers\");\n" + " final Method unwrapMethod = apiWrappers.getDeclaredMethod(\"unwrap\", Class.class, Object.class);\n" + " unwrapped = iface.cast(unwrapMethod.invoke(null, iface, wrapper));\n" + " }\n" + " catch (Throwable ignored) {}\n" + " return unwrapped != null? unwrapped : wrapper;\n" + "}"; }
getUnwrapCodeSuggestion
4,464
URI (final File zipFile, String relPath) { final String p = FileUtilRt.toSystemIndependentName(zipFile.getPath()); final StringBuilder buf = new StringBuilder(p.length() + relPath.length() + 5); if (!p.startsWith("/")) { buf.append("///"); } else if (!p.startsWith("//")) { buf.append("//"); } buf.append(p).append(relPath.startsWith("/") ? "!" : "!/").append(relPath); try { return new URI("jar", null, buf.toString(), null); } catch (URISyntaxException e) { throw new Error("Cannot create URI " + buf, e); } }
createUri
4,465
long () { return myEntry.getTime(); }
getLastModified
4,466
boolean () { throw new UnsupportedOperationException(); }
delete
4,467
String (Iterable<? extends File> path, final boolean caseSensitiveFS) { final String name = myEntry.getName(); int idx = name.lastIndexOf("."); return (idx < 0 ? name : name.substring(0, idx)).replace('/', '.'); }
inferBinaryName
4,468
boolean (@NotNull String cn, Kind kind) { if (kind == Kind.OTHER) { return getKind() == kind; } if (getKind() != kind) { return false; } final String name = myEntry.getName(); return name.length() == (cn.length() + kind.extension.length()) && name.startsWith(cn) && name.endsWith(kind.extension); }
isNameCompatible
4,469
boolean (Object other) { return other instanceof ZipFileObject && super.equals(other); }
equals
4,470
Iterator<File> () { return Collections.emptyIterator(); }
iterator
4,471
String () { return "NULL_ITERABLE"; }
toString
4,472
Iterable<JavaFileObject> (String relPath, Set<JavaFileObject.Kind> kinds, boolean recurse) { return Collections.emptyList(); }
list
4,473
void () { }
close
4,474
String () { return "NULL_ARCHIVE"; }
toString
4,475
Iterable<File> (final File file, final boolean recursively) { final Iterable<File> childrenIterable = Iterators.lazy(new Iterators.Provider<Iterable<File>>() { @Override public Iterable<File> get() { final Iterable<File> children = listChildren(file); return children == null? Collections.<File>emptyList() : children; } }); return !recursively? childrenIterable : Iterators.flat(Iterators.map(childrenIterable, new Function<File, Iterable<File>>() { @Override public Iterable<File> fun(File ff) { return asRecursiveIterable(ff); } })); }
listFiles
4,476
Iterable<File> () { final Iterable<File> children = listChildren(file); return children == null? Collections.<File>emptyList() : children; }
get
4,477
Iterable<File> (File ff) { return asRecursiveIterable(ff); }
fun
4,478
Iterable<File> (final File file) { return Iterators.flat(Iterators.map(Iterators.asIterable(file), new Function<File, Iterable<File>>() { @Override public Iterable<File> fun(File f) { final Iterable<File> children = listChildren(f); if (children == null) { // not a dir return Iterators.asIterable(f); } if (Iterators.isEmptyCollection(children)) { return children; } return Iterators.flat(Iterators.map(children, new Function<File, Iterable<File>>() { @Override public Iterable<File> fun(File ff) { return asRecursiveIterable(ff); } })); } })); }
asRecursiveIterable
4,479
Iterable<File> (File f) { final Iterable<File> children = listChildren(f); if (children == null) { // not a dir return Iterators.asIterable(f); } if (Iterators.isEmptyCollection(children)) { return children; } return Iterators.flat(Iterators.map(children, new Function<File, Iterable<File>>() { @Override public Iterable<File> fun(File ff) { return asRecursiveIterable(ff); } })); }
fun
4,480
Iterable<File> (File ff) { return asRecursiveIterable(ff); }
fun
4,481
boolean (File file) { Boolean cachedIsFile = myIsFile.get(file); if (cachedIsFile == null) { myIsFile.put(file, cachedIsFile = file.isFile()); } return cachedIsFile.booleanValue(); }
isFile
4,482
void (@Nullable File file) { if (file != null) { myDirectoryCache.clear(); final Archive arch = myArchiveCache.remove(file); if (arch != null) { try { arch.close(); } catch (IOException ignored) { } } } else { myDirectoryCache.clear(); myIsFile.clear(); final Map<File, FileOperations.Archive> archCache = myArchiveCache; for (Map.Entry<File, FileOperations.Archive> entry : archCache.entrySet()) { try { entry.getValue().close(); } catch (Throwable ignored) { } } archCache.clear(); } }
clearCaches
4,483
Archive (File file) { final Archive arch = myArchiveCache.get(file); return arch == NULL_ARCHIVE ? null : arch; }
lookupArchive
4,484
Iterable<File> (File file) { Iterable<File> cached = myDirectoryCache.get(file); if (cached == null) { final Iterable<File> parentFiles = lookupCachedParent(file); if (parentFiles == null || (parentFiles != NULL_ITERABLE && !Iterators.isEmptyCollection(parentFiles))) { try { cached = listFiles(file); } catch (IOException e) { throw new RuntimeException(e); } } myDirectoryCache.put(file, cached == null? NULL_ITERABLE : cached); } return cached == NULL_ITERABLE? null : cached; }
listChildren
4,485
Iterable<File> (File file) { if (!myDirectoryCache.isEmpty()) { File parent = file.getParentFile(); for (int i = 0; i < 10 && parent != null; i++) { // at most 10 levels upwards final Iterable<File> cached = myDirectoryCache.get(parent); if (cached != null) { return cached; } parent = parent.getParentFile(); } } return null; }
lookupCachedParent
4,486
String (ZipEntry zipEntry) { return zipEntry.getName(); }
fun
4,487
JavaFileObject (ZipEntry zipEntry) { return new ZipFileObject(root, myZip, zipEntry, encodingName, location); }
fun
4,488
boolean (Map.Entry<String, Collection<ZipEntry>> e) { final String dir = e.getKey(); return dir.startsWith(relPath) && (dir.length() == relPath.length() || dir.charAt(relPath.length()) == '/'); }
fun
4,489
Iterable<ZipEntry> (Map.Entry<String, Collection<ZipEntry>> e) { return e.getValue(); }
fun
4,490
String (String path) { int idx = path.lastIndexOf('/'); if (idx == path.length() - 1) { // the very last char idx = path.lastIndexOf('/', idx - 1); } if (idx < 0) { return ""; } return path.substring(0, idx); }
getParentPath
4,491
boolean () { return getPath().isEmpty(); }
isEmpty
4,492
String (File pathElement) { return null; }
getModuleName
4,493
ModulePath (Collection<? extends File> path) { if (path.isEmpty()) { return EMPTY; } final Collection<File> files = Collections.unmodifiableCollection(path); return new ModulePath() { @Override public Collection<? extends File> getPath() { return files; } @Override public String getModuleName(File pathElement) { return null; } }; }
create
4,494
String (File pathElement) { return null; }
getModuleName
4,495
Builder () { return new Builder() { private final Map<File, String> myMap = new HashMap<>(); private final Collection<File> myPath = new ArrayList<>(); @Override public Builder add(String moduleName, File pathElement) { myPath.add(pathElement); if (moduleName != null) { myMap.put(pathElement, moduleName); } return this; } @Override public ModulePath create() { if (myPath.isEmpty()) { return EMPTY; } final Collection<File> files = Collections.unmodifiableCollection(myPath); return new ModulePath() { @Override public Collection<? extends File> getPath() { return files; } @Override public String getModuleName(File pathElement) { return myMap.get(pathElement); } }; } }; }
newBuilder
4,496
Builder (String moduleName, File pathElement) { myPath.add(pathElement); if (moduleName != null) { myMap.put(pathElement, moduleName); } return this; }
add
4,497
ModulePath () { if (myPath.isEmpty()) { return EMPTY; } final Collection<File> files = Collections.unmodifiableCollection(myPath); return new ModulePath() { @Override public Collection<? extends File> getPath() { return files; } @Override public String getModuleName(File pathElement) { return myMap.get(pathElement); } }; }
create
4,498
String (File pathElement) { return myMap.get(pathElement); }
getModuleName
4,499
String (LogRecord record) { return record.getMessage() + "\n"; }
format