Package juzu.impl.fs.spi.disk

Examples of juzu.impl.fs.spi.disk.DiskFileSystem


    }
  }

  @Test
  public void testGetResourceFromSourcePath() throws Exception {
    DiskFileSystem input = diskFS("compiler.getresource");
    RAMFileSystem output = new RAMFileSystem();
    Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(input).output(output).build();
    GetResource processor = new GetResource(StandardLocation.SOURCE_PATH, FileKey.newResourceName("compiler.getresource", "A.txt"));
    compiler.addAnnotationProcessor(processor);
    compiler.compile();
View Full Code Here


    assertEquals(1, compiler.failCompile().size());
  }

  @Test
  public void testProcessorErrorOnElement() throws Exception {
    DiskFileSystem fs = diskFS("compiler.annotationexception");
    Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build();
    @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
    @javax.annotation.processing.SupportedAnnotationTypes({"*"})
    class Processor1 extends AbstractProcessor {
      @Override
      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(Deprecated.class);
        if (elements.size() == 1) {
          Element elt = elements.iterator().next();
          processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "the_message", elt);
        }
        return false;
      }
    }
    compiler.addAnnotationProcessor(new Processor1());
    try {
      compiler.compile();
      fail();
    }
    catch (CompilationException e) {
      List<CompilationError> errors = e.getErrors();
      assertEquals(1, errors.size());
      CompilationError error = errors.get(0);
      assertEquals(null, error.getCode());
      assertEquals(Collections.<String>emptyList(), error.getArguments());
      assertEquals(fs.getPath("compiler", "annotationexception", "A.java"), error.getSourceFile());
      assertTrue(error.getMessage().contains("the_message"));
      assertNotNull(error.getSourceFile());
      assertNotNull(error.getLocation());
      String absolutePath = error.getSourceFile().getAbsolutePath();
      char separator = File.separatorChar;
View Full Code Here

  @Test
  public void testProcessorError() throws Exception {
    // Works only with javac
    if (compilerProvider == JavaCompilerProvider.JAVAC) {
      DiskFileSystem fs = diskFS("compiler.annotationexception");
      Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build();
      @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
      @javax.annotation.processing.SupportedAnnotationTypes({"*"})
      class Processor2 extends AbstractProcessor {
        boolean failed = false;
View Full Code Here

          throw new ProcessingException(code, 5, "foobar");
        }
      }
    }

    DiskFileSystem fs = diskFS("compiler.errorcode");
    Compiler compiler = Compiler.
      builder().
      javaCompiler(compilerProvider).
      config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")).
      sourcePath(fs).
View Full Code Here

TOP

Related Classes of juzu.impl.fs.spi.disk.DiskFileSystem

Copyright © 2018 www.massapicom. 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.