📄 anonymousdecl.java
字号:
} // Declared in java.ast at line 20 public void setImplements(Access node, int i) { List<Access> list = getImplementsList(); list.setChild(node, i); } // Declared in java.ast at line 24 public List<Access> getImplementss() { return getImplementsList(); } // Declared in java.ast at line 27 public List<Access> getImplementssNoTransform() { return getImplementsListNoTransform(); } // Declared in java.ast at line 31 public List<Access> getImplementsListNoTransform() { return (List<Access>)getChildNoTransform(3); } // Declared in java.ast at line 35 protected int getImplementsListChildPosition() { return 3; } protected int isCircular_visited; protected boolean isCircular_computed = false; protected boolean isCircular_initialized = false; protected boolean isCircular_value; @SuppressWarnings({"unchecked", "cast"}) public boolean isCircular() { if(isCircular_computed) return isCircular_value; if (!isCircular_initialized) { isCircular_initialized = true; isCircular_value = true; } if (!IN_CIRCLE) { IN_CIRCLE = true; int num = boundariesCrossed; boolean isFinal = this.is$Final(); CIRCLE_INDEX = 1; do { isCircular_visited = CIRCLE_INDEX; CHANGE = false; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); boolean new_isCircular_value = isCircular_compute(); if (new_isCircular_value!=isCircular_value) CHANGE = true; isCircular_value = new_isCircular_value; CIRCLE_INDEX++;if(CIRCLE_INDEX > 100) throw new java.lang.RuntimeException("Iteration limit 100 exceeded"); } while (CHANGE); if(isFinal && num == boundariesCrossed){ isCircular_computed = true; LAST_CYCLE = true; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); isCircular_compute(); LAST_CYCLE = false; } else { RESET_CYCLE = true; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); isCircular_compute(); RESET_CYCLE = false; isCircular_computed = false; isCircular_initialized = false; } IN_CIRCLE = false; return isCircular_value; } if(isCircular_visited != CIRCLE_INDEX) { isCircular_visited = CIRCLE_INDEX; if (LAST_CYCLE) { isCircular_computed = true; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return isCircular_compute(); } if (RESET_CYCLE) { isCircular_computed = false; isCircular_initialized = false; return isCircular_value; } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); boolean new_isCircular_value = isCircular_compute(); if (new_isCircular_value!=isCircular_value) CHANGE = true; isCircular_value = new_isCircular_value; return isCircular_value; } return isCircular_value; } private boolean isCircular_compute() { return false; } protected int getSuperClassAccessOpt_visited = -1; protected boolean getSuperClassAccessOpt_computed = false; protected Opt getSuperClassAccessOpt_value; // Declared in AnonymousClasses.jrag at line 32 @SuppressWarnings({"unchecked", "cast"}) public Opt getSuperClassAccessOpt() { if(getSuperClassAccessOpt_computed) return (Opt)ASTNode.getChild(this, getSuperClassAccessOptChildPosition()); if(getSuperClassAccessOpt_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: getSuperClassAccessOpt in class: "); getSuperClassAccessOpt_visited = boundariesCrossed; int num = boundariesCrossed; boolean isFinal = this.is$Final(); getSuperClassAccessOpt_value = getSuperClassAccessOpt_compute(); setSuperClassAccessOpt(getSuperClassAccessOpt_value); if(isFinal && num == boundariesCrossed) getSuperClassAccessOpt_computed = true; getSuperClassAccessOpt_visited = -1; return (Opt)ASTNode.getChild(this, getSuperClassAccessOptChildPosition()); } private Opt getSuperClassAccessOpt_compute() { if(superType().isInterfaceDecl()) return new Opt(typeObject().createQualifiedAccess()); else return new Opt(superType().createBoundAccess()); } protected int getImplementsList_visited = -1; protected boolean getImplementsList_computed = false; protected List getImplementsList_value; // Declared in AnonymousClasses.jrag at line 38 @SuppressWarnings({"unchecked", "cast"}) public List getImplementsList() { if(getImplementsList_computed) return (List)ASTNode.getChild(this, getImplementsListChildPosition()); if(getImplementsList_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: getImplementsList in class: "); getImplementsList_visited = boundariesCrossed; int num = boundariesCrossed; boolean isFinal = this.is$Final(); getImplementsList_value = getImplementsList_compute(); setImplementsList(getImplementsList_value); if(isFinal && num == boundariesCrossed) getImplementsList_computed = true; getImplementsList_visited = -1; return (List)ASTNode.getChild(this, getImplementsListChildPosition()); } private List getImplementsList_compute() { if(superType().isInterfaceDecl()) return new List().add(superType().createBoundAccess()); else return new List(); } protected int superType_visited = -1; // Declared in AnonymousClasses.jrag at line 14 @SuppressWarnings({"unchecked", "cast"}) public TypeDecl superType() { if(superType_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: superType in class: "); superType_visited = boundariesCrossed; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); TypeDecl superType_value = getParent().Define_TypeDecl_superType(this, null); superType_visited = -1; return superType_value; } protected int constructorDecl_visited = -1; // Declared in AnonymousClasses.jrag at line 18 @SuppressWarnings({"unchecked", "cast"}) public ConstructorDecl constructorDecl() { if(constructorDecl_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: constructorDecl in class: "); constructorDecl_visited = boundariesCrossed; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); ConstructorDecl constructorDecl_value = getParent().Define_ConstructorDecl_constructorDecl(this, null); constructorDecl_visited = -1; return constructorDecl_value; } protected int typeNullPointerException_visited = -1; // Declared in AnonymousClasses.jrag at line 109 @SuppressWarnings({"unchecked", "cast"}) public TypeDecl typeNullPointerException() { if(typeNullPointerException_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: typeNullPointerException in class: "); typeNullPointerException_visited = boundariesCrossed; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); TypeDecl typeNullPointerException_value = getParent().Define_TypeDecl_typeNullPointerException(this, null); typeNullPointerException_visited = -1; return typeNullPointerException_value; }public ASTNode rewriteTo() { // Declared in AnonymousClasses.jrag at line 52 if(noConstructor()) { duringAnonymousClasses++; ASTNode result = rewriteRule0(); duringAnonymousClasses--; return result; } return super.rewriteTo();} // Declared in AnonymousClasses.jrag at line 52 private AnonymousDecl rewriteRule0() { debugRewrite("Rewriting " + getClass().getName() + " using rule in AnonymousClasses.jrag at line 52");{ setModifiers(new Modifiers(new List().add(new Modifier("final")))); ConstructorDecl constructor = new ConstructorDecl(); addBodyDecl(constructor); constructor.setModifiers((Modifiers)constructorDecl().getModifiers().fullCopy()); String name = "Anonymous" + nextAnonymousIndex(); setID(name); constructor.setID(name); List parameterList = new List(); for(int i = 0; i < constructorDecl().getNumParameter(); i++) { parameterList.add( new ParameterDeclaration( constructorDecl().getParameter(i).type().createBoundAccess(), constructorDecl().getParameter(i).name() ) ); } constructor.setParameterList(parameterList); List argList = new List(); for(int i = 0; i < constructor.getNumParameter(); i++) argList.add(new VarAccess(constructor.getParameter(i).name())); constructor.setConstructorInvocation( new ExprStmt( new SuperConstructorAccess("super", argList) ) ); constructor.setBlock(new Block()); HashSet set = new HashSet(); for(int i = 0; i < getNumBodyDecl(); i++) { if(getBodyDecl(i) instanceof InstanceInitializer) { InstanceInitializer init = (InstanceInitializer)getBodyDecl(i); set.addAll(init.exceptions()); } else if(getBodyDecl(i) instanceof FieldDeclaration) { FieldDeclaration f = (FieldDeclaration)getBodyDecl(i); if(f.isInstanceVariable()) { set.addAll(f.exceptions()); } } } List exceptionList = new List(); for(Iterator iter = set.iterator(); iter.hasNext(); ) { TypeDecl exceptionType = (TypeDecl)iter.next(); if(exceptionType.isNull()) exceptionType = typeNullPointerException(); exceptionList.add(exceptionType.createQualifiedAccess()); } constructor.setExceptionList(exceptionList); return this; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -