Package javax.tools

Examples of javax.tools.JavaFileObject.toUri()


          kind = BuildMessage.Kind.INFO;
      }
      final String srcPath;
      final JavaFileObject source = diagnostic.getSource();
      if (source != null) {
        srcPath = FileUtil.toSystemIndependentName(new File(source.toUri()).getPath());
      }
      else {
        srcPath = null;
      }
      myContext.processMessage(new CompilerMessage(
View Full Code Here


    }

    @Override
    public JavaFileObject getJavaFileForOutput(Location location, final String className, final JavaFileObject.Kind kind, FileObject fileObject) throws IOException {
        final JavaFileObject result = super.getJavaFileForOutput(location, className, kind, fileObject);
        final String classFileName = PathUtil.toPath(result.toUri());
        final String sourceFileName = PathUtil.toPath(fileObject.toUri());

        return new ForwardingJavaFileObject<JavaFileObject>(result) {
            private OutputStream superOpenOutputStream() throws IOException {
                return super.openOutputStream();
View Full Code Here

                if ( baseMessage == null )
                {
                    continue;
                }
                JavaFileObject source = diagnostic.getSource();
                String longFileName = source == null ? null : source.toUri().getPath();
                String shortFileName = source == null ? null : source.getName();
                String formattedMessage = baseMessage;
                int lineNumber = Math.max( 0, (int) diagnostic.getLineNumber() );
                int columnNumber = Math.max( 0, (int) diagnostic.getColumnNumber() );
                if ( source != null && lineNumber > 0 )
View Full Code Here

                currentFolder.mkdirs();
              }
            } else {
              // create the subfolfers is necessary
              // need a way to retrieve the folders to create
              String path = javaFileForOutput.toUri().getPath();
              int index = path.lastIndexOf('/');
              if (index != -1) {
                File file = new File(path.substring(0, index));
                file.mkdirs();
              }
View Full Code Here

      Element... originatingElements) throws IOException
  {
    //TODO: do we need to check validity of 'name', or can we trust the filemanager to handle that?
    JavaFileObject jfo = _fileManager.getJavaFileForOutput(
        StandardLocation.CLASS_OUTPUT, name.toString(), JavaFileObject.Kind.CLASS, null);
    URI uri = jfo.toUri();
    if (_createdFiles.contains(uri)) {
      throw new FilerException("Class file already created : " + name); //$NON-NLS-1$
    }

    _createdFiles.add(uri);
View Full Code Here

  public JavaFileObject createSourceFile(CharSequence name,
      Element... originatingElements) throws IOException {
    //TODO: do we need to check validity of 'name', or can we trust the filemanager to handle that?
    JavaFileObject jfo = _fileManager.getJavaFileForOutput(
        StandardLocation.SOURCE_OUTPUT, name.toString(), JavaFileObject.Kind.SOURCE, null);
    URI uri = jfo.toUri();
    if (_createdFiles.contains(uri)) {
      throw new FilerException("Source file already created : " + name); //$NON-NLS-1$
    }

    _createdFiles.add(uri);
View Full Code Here

            setSourceOutputDirectory(OutputPath.getAbsoluteDirectory(processingEnv, e));
        }
        JavaFileObject javaFile = fileManager.getJavaFileForOutput(StandardLocation.SOURCE_OUTPUT,
            metaClass, JavaFileObject.Kind.SOURCE,
            null); // do not use sibling hint because of indeterminable behavior across JDK
        logger.info(_loc.get("mmg-process", javaFile.toUri()));
        OutputStream out = javaFile.openOutputStream();
        PrintWriter writer = new PrintWriter(out);
        return writer;
    }
   
View Full Code Here

               
                // JavaFileObject f = unit.getSourceFile();
                JavaFileObject f = (JavaFileObject)unit.getClass().getMethod("getSourceFile", (Class[])null)
                    .invoke(unit, (Object[])null);
               
                URI uri = f.toUri();
                File dir = getParentFile(new File(uri.toURL().getPath()),
                        packageDepth(e.getQualifiedName().toString()));
                return dir;
            } catch (Throwable t) {
                return null;
View Full Code Here

  @Override
  public JavaFileObject createClassFile(CharSequence name,
      Element... originatingElements) throws IOException {
    JavaFileObject jfo = _fileManager.getJavaFileForOutput(
        StandardLocation.CLASS_OUTPUT, name.toString(), JavaFileObject.Kind.CLASS, null);
    URI uri = jfo.toUri();
    if (_createdFiles.contains(uri)) {
      throw new FilerException("Class file already created : " + name); //$NON-NLS-1$
    }

    _createdFiles.add(uri);
View Full Code Here

  @Override
  public JavaFileObject createSourceFile(CharSequence name,
      Element... originatingElements) throws IOException {
    JavaFileObject jfo = _fileManager.getJavaFileForOutput(
        StandardLocation.SOURCE_OUTPUT, name.toString(), JavaFileObject.Kind.SOURCE, null);
    URI uri = jfo.toUri();
    if (_createdFiles.contains(uri)) {
      throw new FilerException("Source file already created : " + name); //$NON-NLS-1$
    }

    _createdFiles.add(uri);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.