@SuppressWarnings({"unchecked", "cast"})
 public FieldDecl clone() throws CloneNotSupportedException {
   FieldDecl node = (FieldDecl) super.clone();
   node.in$Circle(false);
   node.is$Final(false);
   return node;
 }
Beispiel #2
0
  protected void setupClassBody(ClassBody n) throws SemanticException {
    ClassBodyInfo newCDI = new ClassBodyInfo();
    newCDI.outer = currCBI;
    currCBI = newCDI;

    // set up currClassFinalFieldInitCounts to contain mappings
    // for all the final fields of the class.
    Iterator classMembers = n.members().iterator();
    while (classMembers.hasNext()) {
      ClassMember cm = (ClassMember) classMembers.next();
      if (cm instanceof FieldDecl) {
        FieldDecl fd = (FieldDecl) cm;
        if (fd.flags().isFinal()) {
          MinMaxInitCount initCount;
          if (fd.init() != null) {
            // the field has an initializer
            initCount = new MinMaxInitCount(InitCount.ONE, InitCount.ONE);

            // do dataflow over the initialization expression
            // to pick up any uses of outer local variables.
            if (currCBI.outer != null) dataflow(fd.init());
          } else {
            // the field does not have an initializer
            initCount = new MinMaxInitCount(InitCount.ZERO, InitCount.ZERO);
          }
          newCDI.currClassFinalFieldInitCounts.put(fd.fieldInstance(), initCount);
        }
      }
    }
  }
 @SuppressWarnings({"unchecked", "cast"})
 public FieldDecl fullCopy() {
   FieldDecl res = (FieldDecl) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
 @SuppressWarnings({"unchecked", "cast"})
 public FieldDecl copy() {
   try {
     FieldDecl node = (FieldDecl) clone();
     if (children != null) node.children = (ASTNode[]) children.clone();
     return node;
   } catch (CloneNotSupportedException e) {
   }
   System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");
   return null;
 }