Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
---|---|---|
4,600 |
String (Iterable<? extends File> path, boolean caseSensitiveFS) { return null; // this will cause FileManager to delegate to JVM implementation }
|
inferBinaryName
|
4,601 |
ByteArrayOutputStream () { return new ByteArrayOutputStream() { private boolean isClosed = false; private synchronized boolean markClosed() { return !isClosed && (isClosed = true); } @Override public void close() throws IOException { if (markClosed()) { try { super.close(); } finally { myContent = new BinaryContent(buf, 0, size()); if (myContext != null) { myContext.consumeOutputFile(OutputFileObject.this); } } } } }; }
|
openOutputStream
|
4,602 |
BinaryContent () { return myContent; }
|
getContent
|
4,603 |
void (@NotNull byte[] updatedContent) { myContent = new BinaryContent(updatedContent, 0, updatedContent.length); }
|
updateContent
|
4,604 |
boolean (Object s) { return s != null; }
|
fun
|
4,605 |
boolean (Iterable<?> iterable) { return isEmptyCollection(iterable) || !iterable.iterator().hasNext(); }
|
isEmpty
|
4,606 |
boolean (Iterable<?> iterable) { return iterable == null || iterable instanceof Collection && ((Collection<?>)iterable).isEmpty(); }
|
isEmptyCollection
|
4,607 |
Iterator<T> () { return getDelegate().iterator(); }
|
iterator
|
4,608 |
Iterable<T> () { Iterable<T> delegate = myDelegate; if (delegate == null) { myDelegate = delegate = provider.get(); } return delegate; }
|
getDelegate
|
4,609 |
Iterator<T> () { return flat(first.iterator(), second.iterator()); }
|
iterator
|
4,610 |
boolean () { return first.hasNext() || second.hasNext(); }
|
hasNext
|
4,611 |
T () { return first.hasNext()? first.next() : second.next(); }
|
next
|
4,612 |
Iterator<T> () { return flat(map(parts.iterator(), new Function<Iterable<? extends T>, Iterator<T>>() { @Override public Iterator<T> fun(Iterable<? extends T> itr) { return asIterator(itr); } })); }
|
iterator
|
4,613 |
Iterator<T> (Iterable<? extends T> itr) { return asIterator(itr); }
|
fun
|
4,614 |
boolean () { return findNext() != null; }
|
hasNext
|
4,615 |
T () { Iterator<T> group = findNext(); if (group != null) { return group.next(); } throw new NoSuchElementException(); }
|
next
|
4,616 |
Iterator<T> () { if (currentGroup == null || !currentGroup.hasNext()) { do { currentGroup = groupsIterator.hasNext() ? groupsIterator.next() : null; } while (currentGroup != null && !currentGroup.hasNext()); } return currentGroup; }
|
findNext
|
4,617 |
Iterator<T> () { return asIterator(elem); }
|
iterator
|
4,618 |
boolean () { return available; }
|
hasNext
|
4,619 |
T () { if (available) { available = false; return elem; } throw new NoSuchElementException(); }
|
next
|
4,620 |
Iterator<O> () { return map(from.iterator(), mapper); }
|
iterator
|
4,621 |
boolean () { return it.hasNext(); }
|
hasNext
|
4,622 |
O () { return mapper.fun(it.next()); }
|
next
|
4,623 |
Iterator<T> () { return filter(it.iterator(), predicate); }
|
iterator
|
4,624 |
boolean () { if (!isPending) { findNext(); } return isPending; }
|
hasNext
|
4,625 |
T () { try { if (!isPending) { findNext(); if (!isPending) { throw new NoSuchElementException(); } } return current; } finally { current = null; isPending = false; } }
|
next
|
4,626 |
void () { isPending = false; current = null; while (it.hasNext()) { final T next = it.next(); if (predicate.fun(next)) { isPending = true; current = next; break; } } }
|
findNext
|
4,627 |
Iterator<T> () { return filterWithOrder(from.iterator(), predicates.iterator()); }
|
iterator
|
4,628 |
Iterator<T> (BooleanFunction<? super T> pred) { if (!buffer.isEmpty()) { for (Iterator<T> it = buffer.iterator(); it.hasNext(); ) { final T elem = it.next(); if (pred.fun(elem)) { it.remove(); return asIterator(elem); } } } while(from.hasNext()) { final T elem = from.next(); if (pred.fun(elem)) { return asIterator(elem); } buffer.add(elem); } buffer.clear(); return Collections.emptyIterator(); }
|
fun
|
4,629 |
Iterator<T> () { return unique(it.iterator()); }
|
iterator
|
4,630 |
boolean (T t) { if (processed == null) { processed = new HashSet<>(); } return processed.add(t); }
|
fun
|
4,631 |
Iterator<T> () { return filter(it.iterator(), predicateFactory.get()); }
|
iterator
|
4,632 |
Iterator<T> () { return new Object() { private final Set<T> traversed = new HashSet<>(); private Iterator<T> recurse(final T elem, boolean includeHead) { if (!traversed.add(elem)) { return Collections.emptyIterator(); } if (!includeHead) { return tailOf(elem); } return flat(asIterator(elem), new LazyIterator<T>() { @Override protected Iterator<? extends T> create() { return tailOf(elem); } }); } @NotNull private Iterator<T> tailOf(final T elem) { final Iterable<? extends T> tail = filter(step.fun(elem), new BooleanFunction<T>() { @Override public boolean fun(T e) { return !traversed.contains(e); } }); return flat(tail.iterator(), flat(map(tail.iterator(), new Function<T, Iterator<T>>() { @Override public Iterator<T> fun(T obj) { return recurse(obj, false); } }))); } }.recurse(item, includeHead); }
|
iterator
|
4,633 |
Iterator<T> (final T elem, boolean includeHead) { if (!traversed.add(elem)) { return Collections.emptyIterator(); } if (!includeHead) { return tailOf(elem); } return flat(asIterator(elem), new LazyIterator<T>() { @Override protected Iterator<? extends T> create() { return tailOf(elem); } }); }
|
recurse
|
4,634 |
Iterator<T> (final T elem) { final Iterable<? extends T> tail = filter(step.fun(elem), new BooleanFunction<T>() { @Override public boolean fun(T e) { return !traversed.contains(e); } }); return flat(tail.iterator(), flat(map(tail.iterator(), new Function<T, Iterator<T>>() { @Override public Iterator<T> fun(T obj) { return recurse(obj, false); } }))); }
|
tailOf
|
4,635 |
boolean (T e) { return !traversed.contains(e); }
|
fun
|
4,636 |
Iterator<T> (T obj) { return recurse(obj, false); }
|
fun
|
4,637 |
Iterator<T> () { return new Object() { private final Set<T> visited = new HashSet<>(); private Iterator<T> recurse(final T elem, boolean includeHead) { if (!visited.add(elem)) { return Collections.emptyIterator(); } if (!includeHead) { return flat(map(step.fun(elem).iterator(), new Function<T, Iterator<T>>() { @Override public Iterator<T> fun(T obj) { return recurse(obj, true); } })); } Iterator<? extends T> tail = new LazyIterator<T>() { @Override protected Iterator<? extends T> create() { return step.fun(elem).iterator(); } }; return flat(asIterator(elem), flat(map(tail, new Function<T, Iterator<T>>() { @Override public Iterator<T> fun(T obj) { return recurse(obj, true); } }))); } }.recurse(item, includeHead); }
|
iterator
|
4,638 |
Iterator<T> (final T elem, boolean includeHead) { if (!visited.add(elem)) { return Collections.emptyIterator(); } if (!includeHead) { return flat(map(step.fun(elem).iterator(), new Function<T, Iterator<T>>() { @Override public Iterator<T> fun(T obj) { return recurse(obj, true); } })); } Iterator<? extends T> tail = new LazyIterator<T>() { @Override protected Iterator<? extends T> create() { return step.fun(elem).iterator(); } }; return flat(asIterator(elem), flat(map(tail, new Function<T, Iterator<T>>() { @Override public Iterator<T> fun(T obj) { return recurse(obj, true); } }))); }
|
recurse
|
4,639 |
Iterator<T> (T obj) { return recurse(obj, true); }
|
fun
|
4,640 |
Iterator<T> (T obj) { return recurse(obj, true); }
|
fun
|
4,641 |
void () { throw new UnsupportedOperationException(); }
|
remove
|
4,642 |
boolean () { return getDelegate().hasNext(); }
|
hasNext
|
4,643 |
T () { return getDelegate().next(); }
|
next
|
4,644 |
void () { getDelegate().remove(); }
|
remove
|
4,645 |
String (String path) { return path != null? path.replace('\\', '/') : null; }
|
convertPath
|
4,646 |
DiagnosticOutputConsumer () { return myDiagnosticSink; }
|
getDiagnosticSink
|
4,647 |
boolean (MessageLite message) { try { final JavacRemoteProto.Message msg = (JavacRemoteProto.Message)message; final JavacRemoteProto.Message.Type messageType = msg.getMessageType(); if (messageType == JavacRemoteProto.Message.Type.RESPONSE) { final JavacRemoteProto.Message.Response response = msg.getResponse(); final JavacRemoteProto.Message.Response.Type responseType = response.getResponseType(); if (responseType == JavacRemoteProto.Message.Response.Type.BUILD_MESSAGE) { final JavacRemoteProto.Message.Response.CompileMessage compileMessage = response.getCompileMessage(); final JavacRemoteProto.Message.Response.CompileMessage.Kind messageKind = compileMessage.getKind(); if (messageKind == JavacRemoteProto.Message.Response.CompileMessage.Kind.STD_OUT) { if (compileMessage.hasText()) { myDiagnosticSink.outputLineAvailable(compileMessage.getText()); } } else { final String sourceUri = compileMessage.hasSourceUri()? compileMessage.getSourceUri() : null; final JavaFileObject srcFileObject = sourceUri != null? new DummyJavaFileObject(URI.create(sourceUri)) : null; myDiagnosticSink.report(new DummyDiagnostic(convertKind(messageKind), srcFileObject, compileMessage)); } return false; } if (responseType == JavacRemoteProto.Message.Response.Type.OUTPUT_OBJECT) { final JavacRemoteProto.Message.Response.OutputObject outputObject = response.getOutputObject(); final JavacRemoteProto.Message.Response.OutputObject.Kind kind = outputObject.getKind(); final String outputRoot = outputObject.hasOutputRoot()? outputObject.getOutputRoot() : null; final File outputRootFile = outputRoot != null? new File(myWslSupport.convertPath(outputRoot)) : null; final BinaryContent fileObjectContent; final ByteString content = outputObject.hasContent()? outputObject.getContent() : null; if (content != null) { final byte[] bytes = content.toByteArray(); fileObjectContent = new BinaryContent(bytes, 0, bytes.length); } else { fileObjectContent = null; } final JavaFileManager.Location location = outputObject.hasLocation()? StandardLocation.locationFor(outputObject.getLocation()) : null; Collection<URI> sources = new ArrayList<>(); for (String uri : outputObject.getSourceUriList()) { sources.add(URI.create(uri)); } final OutputFileObject fileObject = new OutputFileObject( null, outputRootFile, outputObject.hasRelativePath()? outputObject.getRelativePath() : null, new File(myWslSupport.convertPath(outputObject.getFilePath())), convertKind(kind), outputObject.hasClassName()? outputObject.getClassName() : null, sources, myEncodingName, fileObjectContent, location, outputObject.getIsGenerated() ); myOutputSink.save(fileObject); return false; } if (responseType == JavacRemoteProto.Message.Response.Type.SRC_FILE_LOADED) { final JavacRemoteProto.Message.Response.OutputObject outputObject = response.getOutputObject(); final File file = new File(myWslSupport.convertPath(outputObject.getFilePath())); myDiagnosticSink.javaFileLoaded(file); return false; } if (responseType == JavacRemoteProto.Message.Response.Type.CUSTOM_OUTPUT_OBJECT) { final JavacRemoteProto.Message.Response.OutputObject outputObject = response.getOutputObject(); final String pluginId = outputObject.getFilePath(); final String name = outputObject.getClassName(); final byte[] content = outputObject.hasContent()? outputObject.getContent().toByteArray() : new byte[0]; myDiagnosticSink.customOutputData(pluginId, name, content); return false; } if (responseType == JavacRemoteProto.Message.Response.Type.BUILD_COMPLETED) { if (response.hasCompletionStatus()) { myTerminatedSuccessfully = response.getCompletionStatus(); } return true; } throw new Exception("Unsupported response type: " + responseType.name()); } if (messageType == JavacRemoteProto.Message.Type.FAILURE) { final JavacRemoteProto.Message.Failure failure = msg.getFailure(); final StringBuilder buf = new StringBuilder(); if (failure.hasDescription()) { buf.append(failure.getDescription()); } if (failure.hasStacktrace()) { if (buf.length() > 0) { buf.append("\n"); } buf.append(failure.getStacktrace()); } //noinspection HardCodedStringLiteral myDiagnosticSink.report(new PlainMessageDiagnostic(Diagnostic.Kind.ERROR, buf.toString())); return true; } throw new Exception("Unsupported message type: " + messageType.name()); } catch (Throwable e) { myDiagnosticSink.report(new PlainMessageDiagnostic(Diagnostic.Kind.ERROR, e.getMessage())); return true; } }
|
handleMessage
|
4,648 |
boolean () { return myTerminatedSuccessfully; }
|
isTerminatedSuccessfully
|
4,649 |
Kind () { return myMessageKind; }
|
getKind
|
4,650 |
JavaFileObject () { return mySrcFileObject; }
|
getSource
|
4,651 |
long () { return myCompileMessage.hasProblemLocationOffset()? myCompileMessage.getProblemLocationOffset() : -1; }
|
getPosition
|
4,652 |
long () { return myCompileMessage.hasProblemBeginOffset()? myCompileMessage.getProblemBeginOffset() : -1; }
|
getStartPosition
|
4,653 |
long () { return myCompileMessage.hasProblemEndOffset()? myCompileMessage.getProblemEndOffset() : -1; }
|
getEndPosition
|
4,654 |
long () { return myCompileMessage.hasLine()? myCompileMessage.getLine() : -1; }
|
getLineNumber
|
4,655 |
long () { return myCompileMessage.hasColumn()? myCompileMessage.getColumn() : -1; }
|
getColumnNumber
|
4,656 |
String () { return null; }
|
getCode
|
4,657 |
String (Locale locale) { //noinspection HardCodedStringLiteral return myCompileMessage.hasText()? myCompileMessage.getText() : null; }
|
getMessage
|
4,658 |
boolean (T data) { return JpsFileObject.findKind(myToNameConverter.fun(data)) == JavaFileObject.Kind.OTHER; }
|
fun
|
4,659 |
boolean (T data) { final String name = myToNameConverter.fun(data); return name.regionMatches(true, name.length() - kind.extension.length(), kind.extension, 0, kind.extension.length()); }
|
fun
|
4,660 |
BooleanFunction<T> (final Set<JavaFileObject.Kind> kinds) { // optimization for a single-element collection final Iterator<JavaFileObject.Kind> it = kinds.iterator(); if (it.hasNext()) { final JavaFileObject.Kind kind = it.next(); if (!it.hasNext()) { return myFilterMap.get(kind); } } // OR-filter, quite rare case return new BooleanFunction<T>() { @Override public boolean fun(T data) { for (JavaFileObject.Kind kind : kinds) { if (myFilterMap.get(kind).fun(data)) { return true; } } return false; } }; }
|
getFor
|
4,661 |
boolean (T data) { for (JavaFileObject.Kind kind : kinds) { if (myFilterMap.get(kind).fun(data)) { return true; } } return false; }
|
fun
|
4,662 |
File () { return myFile.getAbsoluteFile(); }
|
get
|
4,663 |
File () { return myFile; }
|
getFile
|
4,664 |
long () { return myFile.lastModified(); }
|
getLastModified
|
4,665 |
boolean () { return myFile.delete(); }
|
delete
|
4,666 |
String (Iterable<? extends File> path, final boolean caseSensitiveFS) { final String fPath = myFile.getPath(); for (File dir: path) { String dirPath = dir.getPath(); if (dirPath.length() == 0) { dirPath = System.getProperty("user.dir"); } if (!fPath.regionMatches(!caseSensitiveFS, 0, dirPath, 0, dirPath.length())) { continue; } final int pathLength = fPath.length(); final boolean endsWithSeparator = dirPath.endsWith(File.separator); if (!endsWithSeparator) { // need to check if the next char in fPath is file separator final int separatorIdx = dirPath.length(); if (pathLength <= separatorIdx || fPath.charAt(separatorIdx) != File.separatorChar) { continue; } } // fPath starts with dirPath final int startIndex = endsWithSeparator ? dirPath.length() : dirPath.length() + 1; int endIndex = fPath.lastIndexOf('.'); if (endIndex <= startIndex) { endIndex = fPath.length(); } final int length = endIndex - startIndex; final StringBuilder buf = new StringBuilder(length).append(fPath, startIndex, endIndex); for (int idx = 0; idx < length; idx++) { if (buf.charAt(idx) == File.separatorChar) { buf.setCharAt(idx, '.'); } } return buf.toString(); } return null; }
|
inferBinaryName
|
4,667 |
boolean (@NotNull String cn, JavaFileObject.Kind kind) { if (kind == Kind.OTHER && getKind() != kind) { return false; } final String n = cn + kind.extension; String name = myFile.getName(); if (name.equals(n)) { return true; } if (name.equalsIgnoreCase(n)) { // if we are on a case-insensitive file system, // try to compare against the real (exactly as on the disk) file name // try { // todo: use NIO API if available like in the commented code below //return n.equals(myFile.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS).getFileName().toString()); return n.equals(myFile.getCanonicalFile().getName()); } catch (IOException ignored) { } } return false; }
|
isNameCompatible
|
4,668 |
boolean (Object other) { if (this == other) { return true; } if (!(other instanceof InputFileObject)) { return false; } final InputFileObject o = (InputFileObject)other; return getAbsoluteFile().equals(o.getAbsoluteFile()); }
|
equals
|
4,669 |
int () { return getAbsoluteFile().hashCode(); }
|
hashCode
|
4,670 |
File () { return myAbsFile.get(); }
|
getAbsoluteFile
|
4,671 |
boolean (Iterable<? extends String> options, Iterable<? extends File> sources, Iterable<? extends File> classpath, Iterable<? extends File> platformClasspath, ModulePath modulePath, Iterable<? extends File> upgradeModulePath, Iterable<? extends File> sourcePath, final Map<File, Set<File>> outputDirToRoots, final DiagnosticOutputConsumer diagnosticConsumer, final OutputFileConsumer outputSink, CanceledStatus canceledStatus, @NotNull JavaCompilingTool compilingTool) { JavaCompiler compiler; try { compiler = compilingTool.createCompiler(); } catch (CannotCreateJavaCompilerException e) { diagnosticConsumer.report(new PlainMessageDiagnostic(Diagnostic.Kind.ERROR, e.getMessage())); return false; } for (File outputDir : outputDirToRoots.keySet()) { outputDir.mkdirs(); } final boolean usingJavac = compilingTool instanceof JavacCompilerTool; final boolean javacBefore9 = usingJavac && JAVA_RUNTIME_PRE_9; // since java 9 internal API's used by the optimizedFileManager have changed final JpsJavacFileManager fileManager = new JpsJavacFileManager( new ContextImpl(compiler, diagnosticConsumer, outputSink, modulePath, canceledStatus), javacBefore9, JavaSourceTransformer.getTransformers() ); if (javacBefore9 && !Iterators.isEmpty(platformClasspath)) { // for javac6 this will prevent lazy initialization of Paths.bootClassPathRtJar // and thus usage of symbol file for resolution, when this file is not expected to be used fileManager.handleOption("-bootclasspath", Collections.singleton("").iterator()); fileManager.handleOption("-extdirs", Collections.singleton("").iterator()); // this will clear cached stuff fileManager.handleOption("-endorseddirs", Collections.singleton("").iterator()); // this will clear cached stuff } final Iterable<String> _options = prepareOptions(options, compilingTool); try { // to be on the safe side, we'll have to apply all options _before_ calling any of manager's methods // i.e. getJavaFileObjectsFromFiles() // This way the manager will be properly initialized. Namely, the encoding will be set correctly // Note that due to lazy initialization in various components inside javac, handleOption() should be called before setLocation() and others // update: for some options their repetitive initialization would be considered as error: e.g. '--patch-module', // therefore we do the trick only for those options that may influence FileManager's state initialization before passing it to getTask() method for (Iterator<String> iterator = _options.iterator(); iterator.hasNext(); ) { final String option = iterator.next(); if (FILE_MANAGER_EARLY_INIT_OPTIONS.contains(option)) { fileManager.handleOption(option, iterator); } } try { fileManager.setOutputDirectories(outputDirToRoots); } catch (IOException e) { fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage()); return false; } if (!Iterators.isEmpty(platformClasspath)) { try { fileManager.handleOption("-bootclasspath", Collections.singleton("").iterator()); // this will clear cached stuff fileManager.setLocation(StandardLocation.PLATFORM_CLASS_PATH, buildPlatformClasspath(platformClasspath, _options)); } catch (IOException e) { fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage()); return false; } } if (!Iterators.isEmpty(upgradeModulePath)) { try { setLocation(fileManager, "UPGRADE_MODULE_PATH", upgradeModulePath); } catch (IOException e) { fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage()); return false; } } final boolean isAnnotationProcessingEnabled = isAnnotationProcessingEnabled(_options); if (!modulePath.isEmpty()) { try { setLocation(fileManager, "MODULE_PATH", modulePath.getPath()); if (isAnnotationProcessingEnabled && getLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH") == null && fileManager.getLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH) == null) { // default annotation processing discovery path to module path if not explicitly set setLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH", Iterators.filter(modulePath.getPath(), new BooleanFunction<File>() { @Override public boolean fun(File file) { return !outputDirToRoots.containsKey(file); } })); } } catch (IOException e) { fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage()); return false; } } if (!Iterators.isEmpty(classpath)) { // because module path has priority if present, initialize classpath after the module path try { fileManager.setLocation(StandardLocation.CLASS_PATH, classpath); if (!usingJavac && isAnnotationProcessingEnabled && !Iterators.contains(_options, "-processorpath") && !Iterators.contains(_options, "--processor-module-path") && getLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH") == null) { // for non-javac file manager ensure annotation processor path defaults to classpath fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpath); } } catch (IOException e) { fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage()); return false; } } if (javacBefore9 || !Iterators.isEmpty(sourcePath) || modulePath.isEmpty()) { try { // ensure the source path is set; // otherwise, if not set, javac attempts to search both classes and sources in classpath; // so if some classpath jars contain sources, it will attempt to compile them // starting from javac9 it seems that setting empty source path may affect module compilation logic, so starting from javac9 // we avoid forcing empty sourcepath fileManager.setLocation(StandardLocation.SOURCE_PATH, sourcePath); } catch (IOException e) { fileManager.getContext().reportMessage(Diagnostic.Kind.ERROR, e.getMessage()); return false; } } final APIWrappers.ProcessingContext procContext; final DiagnosticOutputConsumer diagnosticListener; if (TRACK_AP_GENERATED_DEPENDENCIES && isAnnotationProcessingEnabled) { procContext = new APIWrappers.ProcessingContext(fileManager); // use real processor class names and not names of processor wrappers diagnosticListener = APIWrappers.newDiagnosticListenerWrapper(procContext, diagnosticConsumer); } else { procContext = null; diagnosticListener = diagnosticConsumer; } final LineOutputWriter out = new LineOutputWriter() { @Override protected void lineAvailable(String line) { if (usingJavac) { diagnosticListener.outputLineAvailable(line); } else { // todo: filter too verbose eclipse output? } } }; // methods added to newer versions of StandardJavaFileManager interfaces have default implementations that // do not delegate to corresponding methods of FileManager's base implementation // this proxy object makes sure the calls, not implemented in our file manager, are dispatched further to the base file manager implementation final StandardJavaFileManager fm = APIWrappers.wrap(StandardJavaFileManager.class, fileManager, fileManager.getClass().getSuperclass(), fileManager.getStdManager()); final JavaCompiler.CompilationTask task = tryInstallClientCodeWrapperCallDispatcher(compiler.getTask( out, fm, diagnosticListener, _options, null, fileManager.setInputSources(sources) ), fm); for (JavaCompilerToolExtension extension : JavaCompilerToolExtension.getExtensions()) { try { extension.beforeCompileTaskExecution(compilingTool, task, _options, diagnosticConsumer); } catch (Throwable e) { fileManager.getContext().reportMessage(Diagnostic.Kind.MANDATORY_WARNING, extension.getClass() + " : " + e.getMessage()); e.printStackTrace(System.err); } } if (TRACK_AP_GENERATED_DEPENDENCIES && isAnnotationProcessingEnabled) { final Iterable<Processor> processors = lookupAnnotationProcessors(procContext, getAnnotationProcessorNames(_options)); if (processors != null) { task.setProcessors(processors); } } return task.call(); } catch(IllegalArgumentException | IllegalStateException e) { diagnosticConsumer.report(new PlainMessageDiagnostic(Diagnostic.Kind.ERROR, e.getMessage())); } catch (CompilationCanceledException e) { diagnosticConsumer.report(new JpsInfoDiagnostic(e.getMessage())); } catch (RuntimeException e) { final Throwable cause = e.getCause(); if (cause != null) { if (cause instanceof CompilationCanceledException) { diagnosticConsumer.report(new JpsInfoDiagnostic(cause.getMessage())); } else { diagnosticConsumer.report(new PlainMessageDiagnostic(Diagnostic.Kind.ERROR, buildCompilerErrorMessage(e))); throw e; } } else { throw e; } } finally { fileManager.close(); if (usingJavac) { cleanupJavacNameTable(); } } return false; }
|
compile
|
4,672 |
boolean (File file) { return !outputDirToRoots.containsKey(file); }
|
fun
|
4,673 |
void (String line) { if (usingJavac) { diagnosticListener.outputLineAvailable(line); } else { // todo: filter too verbose eclipse output? } }
|
lineAvailable
|
4,674 |
Iterable<Processor> (final APIWrappers.ProcessingContext procContext, @Nullable Iterable<String> processorNames) { try { Iterable<Processor> processors = null; if (hasLocation(procContext.getFileManager(), "ANNOTATION_PROCESSOR_MODULE_PATH")) { // this is equivalent to //processors = fileManager.getServiceLoader(StandardLocation.locationFor("ANNOTATION_PROCESSOR_MODULE_PATH"), Processor.class); // if java modules are involved, they should be properly handled by the fileManager //noinspection unchecked processors = (ServiceLoader<Processor>)JavaFileManager.class.getMethod("getServiceLoader", JavaFileManager.Location.class, Class.class).invoke( procContext.getFileManager(), StandardLocation.locationFor("ANNOTATION_PROCESSOR_MODULE_PATH"), Processor.class ); if (processorNames != null) { processors = Iterators.filterWithOrder(processors, Iterators.map(processorNames, new Function<String, BooleanFunction<? super Processor>>() { @Override public BooleanFunction<? super Processor> fun(final String procName) { return new BooleanFunction<Processor>() { @Override public boolean fun(Processor processor) { return procName.equals(processor.getClass().getName()); } }; } })); } } else { final ClassLoader processorClassLoader = procContext.getFileManager().getClassLoader( // If processorpath is not explicitly set, use the classpath. procContext.getFileManager().hasLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH) ? StandardLocation.ANNOTATION_PROCESSOR_PATH : StandardLocation.CLASS_PATH ); if (processorClassLoader != null) { if (processorNames != null) { final List<Processor> loaded = new ArrayList<>(); for (String procName : processorNames) { loaded.add((Processor)processorClassLoader.loadClass(procName).getDeclaredConstructor().newInstance()); } processors = loaded; } else { processors = ServiceLoader.load(Processor.class, processorClassLoader); } } } if (processors != null) { return procContext.wrapProcessors(processors); } } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } return null; }
|
lookupAnnotationProcessors
|
4,675 |
boolean (Processor processor) { return procName.equals(processor.getClass().getName()); }
|
fun
|
4,676 |
Iterable<String> (Iterable<String> options) { for (Iterator<String> it = options.iterator(); it.hasNext(); ) { final String option = it.next(); if ("-processor".equals(option)) { return it.hasNext()? Arrays.asList(it.next().split(",")) : null; } } return null; }
|
getAnnotationProcessorNames
|
4,677 |
String (Throwable e) { return new Object() { @Nls final StringBuilder buf = new StringBuilder(); @Nls String collectAllMessages(Throwable e, Set<Throwable> processed) { if (e != null && processed.add(e)) { final String msg = e.getMessage(); if (msg != null && !msg.trim().isEmpty() && buf.indexOf(msg) < 0) { if (buf.length() > 0) { buf.append("\n"); } buf.append(msg); } return collectAllMessages(e.getCause(), processed); } return buf.toString(); } }.collectAllMessages(e, new HashSet<Throwable>()); }
|
buildCompilerErrorMessage
|
4,678 |
boolean (Field field) { return contextClass.equals(field.getType()); }
|
fun
|
4,679 |
void (final Object obj, final StandardJavaFileManager delegateTo, final Set<Object> visited) { if (obj instanceof JavaFileManager && visited.add(obj)) { forEachField(obj.getClass(), new BooleanFunction<Field>() { @Override public boolean fun(Field field) { try { if (JavaFileManager.class.isAssignableFrom(field.getType())) { final Object value = field.get(obj); if (isClientCodeWrapper(value, delegateTo)) { field.set(obj, APIWrappers.wrap(StandardJavaFileManager.class, value, Object.class, delegateTo)); } else { installCallDispatcherRecursively(value, delegateTo, visited); } } } catch (Throwable ignored) { } return true; } }); } }
|
installCallDispatcherRecursively
|
4,680 |
boolean (Field field) { try { if (JavaFileManager.class.isAssignableFrom(field.getType())) { final Object value = field.get(obj); if (isClientCodeWrapper(value, delegateTo)) { field.set(obj, APIWrappers.wrap(StandardJavaFileManager.class, value, Object.class, delegateTo)); } else { installCallDispatcherRecursively(value, delegateTo, visited); } } } catch (Throwable ignored) { } return true; }
|
fun
|
4,681 |
boolean (final Object obj, final StandardJavaFileManager delegateTo) { return obj instanceof StandardJavaFileManager && findField(obj.getClass(), new BooleanFunction<Field>() { @Override public boolean fun(Field f) { try { return f.get(obj) == delegateTo; } catch (Throwable ignored) { return false; } } }) != null; }
|
isClientCodeWrapper
|
4,682 |
boolean (Field f) { try { return f.get(obj) == delegateTo; } catch (Throwable ignored) { return false; } }
|
fun
|
4,683 |
Field (final Class<?> aClass, final BooleanFunction<? super Field> cond) { final Field[] res = new Field[]{null}; forEachField(aClass, new BooleanFunction<Field>() { @Override public boolean fun(Field field) { if (!cond.fun(field)) { return true; // continue } res[0] = field; return false; // stop } }); return res[0]; }
|
findField
|
4,684 |
boolean (Field field) { if (!cond.fun(field)) { return true; // continue } res[0] = field; return false; // stop }
|
fun
|
4,685 |
void (final Class<?> aClass, final BooleanFunction<? super Field> func) { for (Class<?> from = aClass; from != null && !Object.class.equals(from); from = from.getSuperclass()) { for (Field field : from.getDeclaredFields()) { try { if (!field.isAccessible()) { field.setAccessible(true); } if (!func.fun(field)) { return; } } catch (Throwable ignored) { } } } }
|
forEachField
|
4,686 |
boolean (StandardJavaFileManager fileManager, String locationId) { final JavaFileManager.Location location = StandardLocation.locationFor(locationId); return location != null && fileManager.hasLocation(location); }
|
hasLocation
|
4,687 |
boolean (final Iterable<String> options) { return !Iterators.contains(options, "-proc:none"); }
|
isAnnotationProcessingEnabled
|
4,688 |
Iterable<String> (final Iterable<? extends String> options, @NotNull JavaCompilingTool compilingTool) { final List<String> result = new ArrayList<>(compilingTool.getDefaultCompilerOptions()); boolean skip = false; for (String option : options) { if (FILTERED_OPTIONS.contains(option)) { skip = true; continue; } if (!skip) { if (!FILTERED_SINGLE_OPTIONS.contains(option) && !compilingTool.getDefaultCompilerOptions().contains(option)) { result.add(option); } } skip = false; } compilingTool.preprocessOptions(result); return result; }
|
prepareOptions
|
4,689 |
void (Map<PathOption, String> args, PathOption option, Collection<? super File> container, boolean listDir) { final String path = args.get(option); if (path == null) { return; } final StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator, false); while (tokenizer.hasMoreTokens()) { final File file = new File(tokenizer.nextToken()); if (listDir) { final File[] files = file.listFiles(); if (files != null) { for (File f : files) { final String fName = f.getName(); if (fName.endsWith(".jar") || fName.endsWith(".zip")) { container.add(f); } } } } else { container.add(file); } } }
|
appendFiles
|
4,690 |
boolean (Map<PathOption, String> container, String arg, Iterator<String> rest) { if (myIsSuffix) { if (arg.startsWith(myArgName)) { container.put(this, arg.substring(myArgName.length())); return true; } } else { if (arg.equals(myArgName)) { if (rest.hasNext()) { container.put(this, rest.next()); } return true; } } return false; }
|
parse
|
4,691 |
String (File pathElement) { return myModulePath.getModuleName(pathElement); }
|
getExplodedAutomaticModuleName
|
4,692 |
boolean () { return myCanceledStatus.isCanceled(); }
|
isCanceled
|
4,693 |
StandardJavaFileManager () { return myStdManager; }
|
getStandardFileManager
|
4,694 |
void (final Diagnostic.Kind kind, @Nls String message) { myOutConsumer.report(new PlainMessageDiagnostic(kind, message)); }
|
reportMessage
|
4,695 |
void (@NotNull final OutputFileObject cls) { myOutputFileSink.save(cls); }
|
consumeOutputFile
|
4,696 |
void () { try { final Field freelistField = NameTableCleanupDataHolder.freelistField; final Object emptyList = NameTableCleanupDataHolder.emptyList; // both parameters should be non-null if properly initialized if (freelistField != null && emptyList != null) { // the access to static 'freeList' field is synchronized inside javac, so we must use "synchronized" too synchronized (freelistField.getDeclaringClass()) { freelistField.set(null, emptyList); } } } catch (Throwable ignored) { } }
|
cleanupJavacNameTable
|
4,697 |
void () { if (zipCacheCleanupPossible) { final Method clearMethod = ZipFileIndexCleanupDataHolder.cacheClearMethod; if (clearMethod != null) { final Method getter = ZipFileIndexCleanupDataHolder.cacheInstanceGetter; try { Object instance = getter != null? getter.invoke(null) : null; clearMethod.invoke(instance); } catch (Throwable e) { zipCacheCleanupPossible = false; } } else { zipCacheCleanupPossible = false; } } }
|
clearCompilerZipFileCache
|
4,698 |
void ( com.google.protobuf.ExtensionRegistryLite registry) { }
|
registerAllExtensions
|
4,699 |
void ( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); }
|
registerAllExtensions
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.