Ejemplo n.º 1
0
 static {
   _jspx_imports_packages = new java.util.HashSet<>();
   _jspx_imports_packages.add("javax.servlet");
   _jspx_imports_packages.add("java.util");
   _jspx_imports_packages.add("java.io");
   _jspx_imports_packages.add("javax.servlet.jsp");
   _jspx_imports_packages.add("javax.servlet.http");
   _jspx_imports_classes = null;
 }
Ejemplo n.º 2
0
 @SuppressWarnings({"unchecked", "cast"})
 public boolean subtype(TypeDecl type) {
   Object _parameters = type;
   if (subtype_TypeDecl_visited == null) subtype_TypeDecl_visited = new java.util.HashMap(4);
   if (subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4);
   if (subtype_TypeDecl_computed.contains(_parameters))
     return ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue();
   if (!subtype_TypeDecl_initialized.contains(_parameters)) {
     subtype_TypeDecl_initialized.add(_parameters);
     subtype_TypeDecl_values.put(_parameters, Boolean.valueOf(true));
   }
   if (!IN_CIRCLE) {
     IN_CIRCLE = true;
     int num = boundariesCrossed;
     boolean isFinal = this.is$Final();
     CIRCLE_INDEX = 1;
     boolean new_subtype_TypeDecl_value;
     do {
       subtype_TypeDecl_visited.put(_parameters, new Integer(CIRCLE_INDEX));
       CHANGE = false;
       new_subtype_TypeDecl_value = subtype_compute(type);
       if (new_subtype_TypeDecl_value
           != ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue()) CHANGE = true;
       subtype_TypeDecl_values.put(_parameters, Boolean.valueOf(new_subtype_TypeDecl_value));
       CIRCLE_INDEX++;
     } while (CHANGE);
     if (isFinal && num == boundariesCrossed) {
       subtype_TypeDecl_computed.add(_parameters);
     } else {
       RESET_CYCLE = true;
       subtype_compute(type);
       RESET_CYCLE = false;
       subtype_TypeDecl_computed.remove(_parameters);
       subtype_TypeDecl_initialized.remove(_parameters);
     }
     IN_CIRCLE = false;
     return new_subtype_TypeDecl_value;
   }
   if (!new Integer(CIRCLE_INDEX).equals(subtype_TypeDecl_visited.get(_parameters))) {
     subtype_TypeDecl_visited.put(_parameters, new Integer(CIRCLE_INDEX));
     if (RESET_CYCLE) {
       subtype_TypeDecl_computed.remove(_parameters);
       subtype_TypeDecl_initialized.remove(_parameters);
       return ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue();
     }
     boolean new_subtype_TypeDecl_value = subtype_compute(type);
     if (new_subtype_TypeDecl_value
         != ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue()) CHANGE = true;
     subtype_TypeDecl_values.put(_parameters, Boolean.valueOf(new_subtype_TypeDecl_value));
     return new_subtype_TypeDecl_value;
   }
   return ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue();
 }
Ejemplo n.º 3
0
 protected void write() throws IOException {
   BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
   java.util.Set ids = seminars.keySet();
   java.util.Iterator iterator = ids.iterator();
   while (iterator.hasNext()) {
     String id = (String) iterator.next();
     Vector vector = (Vector) seminars.get(id);
     for (int i = 0; i < vector.size(); i++) {
       Seminar seminar = (Seminar) vector.get(i);
       writer.write(id + "\t" + seminar.getAnnotations().length + "\n");
       for (int j = 0; j < seminar.getAnnotations().length; j++) {
         Annotation annotation = seminar.getAnnotations()[j];
         writer.write(annotation.type + "\t");
         writer.write(annotation.offset + "\t");
         writer.write(annotation.length + "\t");
         writer.write(annotation.text + "\n");
       }
     }
   }
   writer.flush();
   writer.close();
 }
Ejemplo n.º 4
0
 static {
   _jspx_imports_packages = new java.util.HashSet<>();
   _jspx_imports_packages.add("com.oreilly.servlet");
   _jspx_imports_packages.add("javax.servlet");
   _jspx_imports_packages.add("java.util");
   _jspx_imports_packages.add("javax.servlet.http");
   _jspx_imports_packages.add("java.io");
   _jspx_imports_packages.add("org.apache.jasper");
   _jspx_imports_packages.add("javax.servlet.jsp");
   _jspx_imports_classes = new java.util.HashSet<>();
   _jspx_imports_classes.add("com.oreilly.servlet.multipart.DefaultFileRenamePolicy");
 }
Ejemplo n.º 5
0
  /**
   * This method implements the interface defined in DefinitionHandler to save definition to
   * database backend.
   *
   * @param d is the Definition that is ready to be stored.
   * @return true, if new version was stored and database modified, false, if the definition was
   *     rejected for any reason.
   */
  public boolean store(Definition d) {
    boolean result = false;
    VDC vdc = (VDC) m_dbschema;

    // NEW: remember all DVs we came across
    if (m_derivations != null && d instanceof Derivation) m_derivations.add(d.shortID());

    try {
      if (m_rejects == null) {
        // rely on saveDefinition to do "the right thing"
        result = vdc.saveDefinition(d, m_overwrite);
      } else {
        // Is the Definition already in the database?
        if (vdc.containsDefinition(d)) {
          if (m_overwrite) {
            // this is time-consuming and ineffective
            Definition old =
                vdc.loadDefinition(d.getNamespace(), d.getName(), d.getVersion(), d.getType());
            old.toXML(m_rejects, "  ");
            result = vdc.saveDefinition(d, true);
          } else {
            // skip, if not forced to overwrite, but save rejects
            d.toXML(m_rejects, "  ");
          }
        } else {
          // not found, insert unconditionally
          result = vdc.saveDefinition(d, true);
        }
      }
    } catch (SQLException sql) {
      // database problems
      for (int i = 0; sql != null; ++i) {
        m_logger.log(
            "database", 0, "SQL error " + i + ": " + sql.getErrorCode() + ": " + sql.getMessage());
        sql = sql.getNextException();
      }
      m_logger.log("database", 0, "ignoring SQL exception(s)");
    } catch (Exception e) {
      m_logger.log("database", 0, "caught " + e + ", ignoring");
      result = false;
    }

    if (result) m_count++;
    else m_rejected++;
    return result;
  }
Ejemplo n.º 6
0
  /**
   * Main method: compile a list of files, return all compiled classes
   *
   * @param filenames The names of all files to be compiled.
   */
  public List<ClassSymbol> compile(
      List<String> filenames,
      Map<String, String> origOptions,
      ClassLoader aptCL,
      AnnotationProcessorFactory providedFactory,
      java.util.Set<Class<? extends AnnotationProcessorFactory>> productiveFactories,
      java.util.Set<java.io.File> aggregateGenFiles)
      throws Throwable {
    // as a JavaCompiler can only be used once, throw an exception if
    // it has been used before.
    assert !hasBeenUsed : "attempt to reuse JavaCompiler";
    hasBeenUsed = true;

    this.aggregateGenFiles = aggregateGenFiles;

    long msec = System.currentTimeMillis();

    ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>();
    try {
      JavacFileManager fm = (JavacFileManager) fileManager;
      // parse all files
      ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>();
      for (List<String> l = filenames; l.nonEmpty(); l = l.tail) {
        if (classesAsDecls) {
          if (!l.head.endsWith(".java")) { // process as class file
            ClassSymbol cs = reader.enterClass(names.fromString(l.head));
            try {
              cs.complete();
            } catch (Symbol.CompletionFailure cf) {
              bark.aptError("CantFindClass", l);
              continue;
            }

            classes.append(cs); // add to list of classes
            continue;
          }
        }
        JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next();
        trees.append(parse(fo));
      }

      // enter symbols for all files
      List<JCCompilationUnit> roots = trees.toList();

      if (errorCount() == 0) {
        boolean prev = bark.setDiagnosticsIgnored(true);
        try {
          enter.main(roots);
        } finally {
          bark.setDiagnosticsIgnored(prev);
        }
      }

      if (errorCount() == 0) {
        apt.main(roots, classes, origOptions, aptCL, providedFactory, productiveFactories);
        genSourceFileNames.addAll(apt.getSourceFileNames());
        genClassFileNames.addAll(apt.getClassFileNames());
      }

    } catch (Abort ex) {
    }

    if (verbose) log.printVerbose("total", Long.toString(System.currentTimeMillis() - msec));

    chk.reportDeferredDiagnostics();

    printCount("error", errorCount());
    printCount("warn", warningCount());

    return classes.toList();
  }