示例#1
0
 @Override
 public void merge(FieldDeclaration remote, MergeEngine configuration) {
   super.merge(remote, configuration);
   setType((Type) configuration.apply(getType(), remote.getType(), Type.class));
   List<VariableDeclarator> resultList = new LinkedList<VariableDeclarator>();
   configuration.apply(
       getVariables(), remote.getVariables(), resultList, VariableDeclarator.class);
   setVariables(resultList);
 }
 /*
  * (non-Javadoc)
  *
  * @see org.walkmod.javalang.visitors.VoidVisitorAdapter#visit(org.walkmod.javalang.ast.body.FieldDeclaration,
  * java.lang.Object)
  */
 @Override
 public void visit(FieldDeclaration n, VisitorContext arg) {
   Map<String, Object> m = variablesMap.get(classStack.peek());
   String type = getActualType(n.getType());
   List<VariableDeclarator> lDeclarators;
   // if(n instanceof VariableDeclarationExpr){
   // lDeclarators = ((VariableDeclarationExpr) n).getVars();
   // }
   // else{
   // }
   lDeclarators = n.getVariables();
   for (VariableDeclarator declarator : lDeclarators) {
     m.put(declarator.getId().getName(), type);
   }
   super.visit(n, arg);
 }