@Override public javax.tools.FileObject getFileForInput(Location l, String pkgName, String relativeName) { final String[] names = FileObjects.getFolderAndBaseName( FileObjects.resolveRelativePath(pkgName, relativeName), FileObjects.NBFS_SEPARATOR_CHAR); javax.tools.FileObject fo = tx.readFileObject(l, names[0], names[1]); if (fo != null) { return fo; } return super.getFileForInput(l, pkgName, relativeName); }
public static ModifiedFilesTransaction newModifiedFilesTransaction( final boolean srcIndex, final boolean checkForEditorModifications) { final ModifiedFilesTransaction tx = (srcIndex && !checkForEditorModifications) ? new PermanentSourceScan(modifiedFiles) : new TransientSourceScan(); tx.begin(); return tx; }
@Override public javax.tools.FileObject getFileForInput (final Location l, final String pkgName, final String relativeName) { final String rp = FileObjects.resolveRelativePath (pkgName, relativeName); final FileObject[] fileRootPair = findFile(rp); return fileRootPair == null ? null : FileObjects.sourceFileObject(fileRootPair[0], fileRootPair[1]); }
private boolean isModifiedByWorkingCopy() { final FileObject file = handle.resolveFileObject(false); if (file == null) { return false; } return SourceFileManager.getModifiedFiles().isModified(file.toURI()); }
@Override public JavaFileObject getJavaFileForInput(Location l, String className, Kind kind) { if (kind == JavaFileObject.Kind.CLASS) { int dot = className.lastIndexOf('.'); String dir = dot == -1 ? "" : FileObjects.convertPackage2Folder(className.substring(0, dot)); javax.tools.FileObject fo = tx.readFileObject(l, dir, className.substring(dot + 1)); if (fo != null) { return (JavaFileObject)fo; } } return super.getJavaFileForInput(l, className, kind); }
protected void doInvalidate () { final JavacParser parser = this.impl.getParser(); if (parser != null) { parser.resultFinished (true); } }
@Override public void delete(File file) { getDelegate().delete(file); }
@Override Iterable<JavaFileObject> filter(Location location, String packageName, Iterable<JavaFileObject> files) { return getDelegate().filter(location, packageName, files); }
@Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return FileObjects.getCharContent( openInputStream(), encoding, null, (int)this.getSize(), ignoreEncodingErrors); }
@Override public String inferBinaryName(Location location, JavaFileObject file) { if (file instanceof InferableJavaFileObject) { return ((InferableJavaFileObject)file).inferBinaryName(); } return null; }
private static JCDiagnostic getJCDiagnostic(Diagnostic<?> d) { if (d instanceof JCDiagnostic) { return ((JCDiagnostic)d); } else if (d instanceof RichDiagnostic && ((RichDiagnostic) d).getDelegate() instanceof JCDiagnostic) { return (JCDiagnostic)((RichDiagnostic)d).getDelegate(); } return null; }
/** * Releases data held by the cache, and redirects all calls to a regular * File-based FileObject */ void release() { content = null; writer = null; createDelegate(); }
@Override protected String getPathToRoot(final short flags) { return flags == 0 ? pathToRootInCtSym : super.getPathToRoot(flags); } }
/** * Creates read only implementation of {@link FileManagerTransaction}. * The read only implementation supports only read operations the write operations * are throwing {@link UnsupportedOperationException} * @return the read only implementation of {@link FileManagerTransaction}. */ public static FileManagerTransaction read() { return new Read(); }
/** * Ignores all writes, but acts as if they succeeded. */ public static FileManagerTransaction nullWrite() { return new Null(); }
/** * Writes allowed only to {@link LazyTreeLoader}. * @return the new {@link FileManagerTransaction} */ public static FileManagerTransaction treeLoaderOnly() { return new TreeLoaderOnly(); }
/** * Creates write back implementation of {@link FileManagerTransaction}. * The write back implementation isolates modification from underlaying * cache. The changes are made visible by commit. * @param root for which the {@link FileManagerTransaction} should be created. * @return the write back implementation of {@link FileManagerTransaction}. */ public static FileManagerTransaction writeBack(URL root) { return new WriteBackTransaction(root); }
private void writeResources() throws IOException { if (cacheChanged) { assert cachedFile != null; assert cachedValue != null; writeFile(cachedFile, cachedValue); } }
/** * Marks this {@link CompilationInfo} as invalid, may be used to * verify confinement. */ @Override protected void doInvalidate () { final JavacParser parser = this.impl.getParser(); //Parser may be null in case when JS was //created with no sources - java corner case //not covered by parsing API. if (parser != null) { parser.resultFinished (false); } } }