@Test(expected = IndexOutOfBoundsException.class) public void setChildException() throws Exception { new MemberLookupExpr(new VariableIdentifierExpr("v"), "foo") .setChild(1, new VariableIdentifierExpr("w")); }
@Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } MemberLookupExpr(Expr structure, String member); }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } MemberLookupExpr(Expr structure, String member); Expr getStructure(); void setStructure(Expr structure); String getMember(); void setMember(String member); @Override void accept(IAstVisitor visitor); @Override MemberLookupExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren(); }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } MemberLookupExpr(Expr structure, String member); Expr getStructure(); void setStructure(Expr structure); String getMember(); void setMember(String member); @Override void accept(IAstVisitor visitor); @Override MemberLookupExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }