public void addCompilationUnit(CompilationUnit compilationUnit) {
    String compilationUnitTypeSourceName = compilationUnit.getTypeName();
    compilationUnitsByTypeName.put(compilationUnitTypeSourceName, compilationUnit);
    compilationUnitTypeNames.add(compilationUnitTypeSourceName);

    Collection<CompiledClass> compiledClasses = compilationUnit.getCompiledClasses();
    for (CompiledClass compiledClass : compiledClasses) {
      String sourceName = compiledClass.getSourceName();
      String binaryName = InternalName.toBinaryName(compiledClass.getInternalName());
      nestedSourceNamesByCompilationUnitName.put(compilationUnitTypeSourceName, sourceName);
      nestedBinaryNamesByCompilationUnitName.put(compilationUnitTypeSourceName, binaryName);
      compilationUnitNamesByNestedSourceName.put(sourceName, compilationUnitTypeSourceName);
      compilationUnitNamesByNestedBinaryName.put(binaryName, compilationUnitTypeSourceName);
    }
  }
Exemple #2
0
 static Multimap<String, JRunAsync> computeRunAsyncsByName(
     Collection<JRunAsync> runAsyncs, boolean onlyExplicitNames) {
   Multimap<String, JRunAsync> runAsyncsByName = LinkedListMultimap.create();
   for (JRunAsync runAsync : runAsyncs) {
     String name = runAsync.getName();
     if (name == null || (onlyExplicitNames && !runAsync.hasExplicitClassLiteral())) {
       continue;
     }
     runAsyncsByName.put(name, runAsync);
   }
   return runAsyncsByName;
 }
Exemple #3
0
  private void onNewDirectory(Path directory) throws IOException {
    String relativePath = getRelativePath(directory);
    if (!relativePath.isEmpty() && !getPathPrefixSet().includesDirectory(relativePath)) {
      return;
    }

    if (watchService != null) {
      // Start watching the directory.
      directory.register(watchService, ENTRY_CREATE, ENTRY_DELETE);
    }

    try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
      for (Path child : stream) {
        childPathsByParentPath.put(directory, child);
        onNewPath(child);
      }
    }
  }