Example #1
0
 @Override
 public boolean equals(Object obj) {
   if (obj == this) {
     return true;
   } else if (obj instanceof ControllerParameter) {
     ControllerParameter that = (ControllerParameter) obj;
     return name.equals(that.name) && Tools.safeEquals(value, that.value);
   } else {
     return false;
   }
 }
Example #2
0
    List<CompilationError> compile() throws IOException {
      Compiler.Builder builder = compiler();

      // Force compilation
      builder.force(true);

      //
      List<String> toCompile = new ArrayList<String>();
      List<String> toDelete = new ArrayList<String>();

      //
      for (Map.Entry<String, Change> change : scanner.scan().entrySet()) {
        String path = change.getKey();
        if (path.endsWith(".java")) {
          switch (change.getValue()) {
            case REMOVE:
              toDelete.add(path);
              break;
            case ADD:
              toCompile.add(path);
              break;
            case UPDATE:
              toCompile.add(path);
              toDelete.add(path);
              break;
          }
        }
      }

      //
      for (String s : toDelete) {
        Matcher matcher = javaFilePattern.matcher(s);
        Assert.assertTrue(matcher.matches());
        String path = matcher.group(1) + ".class";
        String[] names = Tools.split(path, '/');
        O clazz = classOutput.getPath(names);
        if (clazz != null) {
          classOutput.removePath(clazz);
        }
      }

      //
      for (ReadFileSystem<?> cp : classPath) {
        builder.addClassPath(cp);
      }

      //
      System.out.println("Compiling " + toCompile);
      compiler = builder.build(processorFactory != null ? processorFactory.get() : null);
      return compiler.compile(toCompile.toArray(new String[toCompile.size()]));
    }