1 Reply Latest reply: Feb 10, 2013 6:15 PM by EJP RSS

    Reading META-INF contents from an annotation processor

    990243
      Hello,

      I'm trying to read the contents of META-INF with my annotation processor, something akin to:
      @Override
      public boolean process(
      Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
      {
      try {
      FileObject resource = processingEnv.getFiler().getResource(
      StandardLocation.SOURCE_PATH, "META-INF.services", "javax.annotation.processing.Processor");
      String filecontents = new Scanner(resource.openInputStream()).useDelimiter("\\A").next();
      processingEnv.getMessager().printMessage(Kind.NOTE, filecontents);
      } catch (IOException ex) {
      processingEnv.getMessager().printMessage(Kind.ERROR, ex.toString());
      }
      return true;
      }

      (But against something that is relevant for my processor.) But when I do that I get:
      error: javax.annotation.processing.FilerException: Illegal name META-INF.services

      Bug, or shouldn't annotation processors be reading the contents of META-INF anyhow?

      Thanks,
      Thor Michael