classdecl.java

来自「JDK1.4编译器前端」· Java 代码 · 共 1,302 行 · 第 1/4 页

JAVA
1,302
字号
      }    }    for(Iterator iter = localMethodsIterator(); iter.hasNext(); ) {      MethodDecl m = (MethodDecl)iter.next();      if(m.isAbstract()) {        c.add(m);      }    }    return c;  }    protected int hasAbstract_visited = -1;    // Declared in Modifiers.jrag at line 64 @SuppressWarnings({"unchecked", "cast"})     public boolean hasAbstract() {        if(hasAbstract_computed)            return hasAbstract_value;        if(hasAbstract_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: hasAbstract in class: ");        hasAbstract_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        hasAbstract_value = hasAbstract_compute();        if(isFinal && num == boundariesCrossed)            hasAbstract_computed = true;        hasAbstract_visited = -1;        return hasAbstract_value;    }    private boolean hasAbstract_compute() {  return !unimplementedMethods().isEmpty();  }    protected java.util.Map castingConversionTo_TypeDecl_visited;    // Declared in TypeAnalysis.jrag at line 85 @SuppressWarnings({"unchecked", "cast"})     public boolean castingConversionTo(TypeDecl type) {        Object _parameters = type;if(castingConversionTo_TypeDecl_visited == null) castingConversionTo_TypeDecl_visited = new java.util.HashMap(4);if(castingConversionTo_TypeDecl_values == null) castingConversionTo_TypeDecl_values = new java.util.HashMap(4);        if(castingConversionTo_TypeDecl_values.containsKey(_parameters))            return ((Boolean)castingConversionTo_TypeDecl_values.get(_parameters)).booleanValue();        if(new Integer(boundariesCrossed).equals(castingConversionTo_TypeDecl_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: castingConversionTo in class: ");        castingConversionTo_TypeDecl_visited.put(_parameters, new Integer(boundariesCrossed));        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        boolean castingConversionTo_TypeDecl_value = castingConversionTo_compute(type);        if(isFinal && num == boundariesCrossed)            castingConversionTo_TypeDecl_values.put(_parameters, Boolean.valueOf(castingConversionTo_TypeDecl_value));        castingConversionTo_TypeDecl_visited.remove(_parameters);        return castingConversionTo_TypeDecl_value;    }    private boolean castingConversionTo_compute(TypeDecl type) {    if(type.isArrayDecl()) {      return isObject();    }    else if(type.isClassDecl()) {      return this == type || instanceOf(type) || type.instanceOf(this);    }    else if(type.isInterfaceDecl()) {      return !isFinal() || instanceOf(type);    }    else return super.castingConversionTo(type);  }    protected int isClassDecl_visited = -1;    // Declared in TypeAnalysis.jrag at line 211 @SuppressWarnings({"unchecked", "cast"})     public boolean isClassDecl() {        if(isClassDecl_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: isClassDecl in class: ");        isClassDecl_visited = boundariesCrossed;        boolean isClassDecl_value = isClassDecl_compute();        isClassDecl_visited = -1;        return isClassDecl_value;    }    private boolean isClassDecl_compute() {  return true;  }    protected int isString_visited = -1;    // Declared in TypeAnalysis.jrag at line 226 @SuppressWarnings({"unchecked", "cast"})     public boolean isString() {        if(isString_computed)            return isString_value;        if(isString_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: isString in class: ");        isString_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        isString_value = isString_compute();        if(isFinal && num == boundariesCrossed)            isString_computed = true;        isString_visited = -1;        return isString_value;    }    private boolean isString_compute() {  return fullName().equals("java.lang.String");  }    protected int isObject_visited = -1;    // Declared in TypeAnalysis.jrag at line 229 @SuppressWarnings({"unchecked", "cast"})     public boolean isObject() {        if(isObject_computed)            return isObject_value;        if(isObject_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: isObject in class: ");        isObject_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        isObject_value = isObject_compute();        if(isFinal && num == boundariesCrossed)            isObject_computed = true;        isObject_visited = -1;        return isObject_value;    }    private boolean isObject_compute() {  return name().equals("Object") && packageName().equals("java.lang");  }    protected java.util.Map instanceOf_TypeDecl_visited;    // Declared in TypeAnalysis.jrag at line 410 @SuppressWarnings({"unchecked", "cast"})     public boolean instanceOf(TypeDecl type) {        Object _parameters = type;if(instanceOf_TypeDecl_visited == null) instanceOf_TypeDecl_visited = new java.util.HashMap(4);if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4);        if(instanceOf_TypeDecl_values.containsKey(_parameters))            return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue();        if(new Integer(boundariesCrossed).equals(instanceOf_TypeDecl_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: instanceOf in class: ");        instanceOf_TypeDecl_visited.put(_parameters, new Integer(boundariesCrossed));        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        boolean instanceOf_TypeDecl_value = instanceOf_compute(type);        if(isFinal && num == boundariesCrossed)            instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value));        instanceOf_TypeDecl_visited.remove(_parameters);        return instanceOf_TypeDecl_value;    }    private boolean instanceOf_compute(TypeDecl type) {  return type.isSupertypeOfClassDecl(this);  }    protected java.util.Map isSupertypeOfClassDecl_ClassDecl_visited;    // Declared in TypeAnalysis.jrag at line 425 @SuppressWarnings({"unchecked", "cast"})     public boolean isSupertypeOfClassDecl(ClassDecl type) {        Object _parameters = type;if(isSupertypeOfClassDecl_ClassDecl_visited == null) isSupertypeOfClassDecl_ClassDecl_visited = new java.util.HashMap(4);        if(new Integer(boundariesCrossed).equals(isSupertypeOfClassDecl_ClassDecl_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: isSupertypeOfClassDecl in class: ");        isSupertypeOfClassDecl_ClassDecl_visited.put(_parameters, new Integer(boundariesCrossed));        boolean isSupertypeOfClassDecl_ClassDecl_value = isSupertypeOfClassDecl_compute(type);        isSupertypeOfClassDecl_ClassDecl_visited.remove(_parameters);        return isSupertypeOfClassDecl_ClassDecl_value;    }    private boolean isSupertypeOfClassDecl_compute(ClassDecl type) {    if(super.isSupertypeOfClassDecl(type))      return true;    return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this);  }    protected java.util.Map isSupertypeOfInterfaceDecl_InterfaceDecl_visited;    // Declared in TypeAnalysis.jrag at line 442 @SuppressWarnings({"unchecked", "cast"})     public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) {        Object _parameters = type;if(isSupertypeOfInterfaceDecl_InterfaceDecl_visited == null) isSupertypeOfInterfaceDecl_InterfaceDecl_visited = new java.util.HashMap(4);        if(new Integer(boundariesCrossed).equals(isSupertypeOfInterfaceDecl_InterfaceDecl_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: isSupertypeOfInterfaceDecl in class: ");        isSupertypeOfInterfaceDecl_InterfaceDecl_visited.put(_parameters, new Integer(boundariesCrossed));        boolean isSupertypeOfInterfaceDecl_InterfaceDecl_value = isSupertypeOfInterfaceDecl_compute(type);        isSupertypeOfInterfaceDecl_InterfaceDecl_visited.remove(_parameters);        return isSupertypeOfInterfaceDecl_InterfaceDecl_value;    }    private boolean isSupertypeOfInterfaceDecl_compute(InterfaceDecl type) {  return isObject();  }    protected java.util.Map isSupertypeOfArrayDecl_ArrayDecl_visited;    // Declared in TypeAnalysis.jrag at line 455 @SuppressWarnings({"unchecked", "cast"})     public boolean isSupertypeOfArrayDecl(ArrayDecl type) {        Object _parameters = type;if(isSupertypeOfArrayDecl_ArrayDecl_visited == null) isSupertypeOfArrayDecl_ArrayDecl_visited = new java.util.HashMap(4);        if(new Integer(boundariesCrossed).equals(isSupertypeOfArrayDecl_ArrayDecl_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: isSupertypeOfArrayDecl in class: ");        isSupertypeOfArrayDecl_ArrayDecl_visited.put(_parameters, new Integer(boundariesCrossed));        boolean isSupertypeOfArrayDecl_ArrayDecl_value = isSupertypeOfArrayDecl_compute(type);        isSupertypeOfArrayDecl_ArrayDecl_visited.remove(_parameters);        return isSupertypeOfArrayDecl_ArrayDecl_value;    }    private boolean isSupertypeOfArrayDecl_compute(ArrayDecl type) {    if(super.isSupertypeOfArrayDecl(type))      return true;    return type.hasSuperclass() && type.superclass() != null && type.superclass().instanceOf(this);  }    protected int isInnerClass_visited = -1;    // Declared in TypeAnalysis.jrag at line 537 @SuppressWarnings({"unchecked", "cast"})     public boolean isInnerClass() {        if(isInnerClass_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: isInnerClass in class: ");        isInnerClass_visited = boundariesCrossed;        boolean isInnerClass_value = isInnerClass_compute();        isInnerClass_visited = -1;        return isInnerClass_value;    }    private boolean isInnerClass_compute() {  return isNestedType() && !isStatic() && enclosingType().isClassDecl();  }    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() {    if(hasSuperClassAccess()) {      Access a = getSuperClassAccess().lastAccess();      while(a != null) {        if(a.type().isCircular())          return true;        a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access)a.qualifier() : null;      }    }    for(int i = 0; i < getNumImplements(); i++) {      Access a = getImplements(i).lastAccess();      while(a != null) {        if(a.type().isCircular())          return true;        a = (a.isQualified() && a.qualifier().isTypeAccess()) ? (Access)a.qualifier() : null;      }    }    return false;  }    // Declared in TypeAnalysis.jrag at line 577    public TypeDecl Define_TypeDecl_hostType(ASTNode caller, ASTNode child) {        if(caller == getImplementsListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return hostType();        }        if(caller == getSuperClassAccessOptNoTransform()) {            return hostType();        }        return super.Define_TypeDecl_hostType(caller, child);    }    // Declared in SyntacticClassification.jrag at line 74    public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) {        if(caller == getImplementsListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return NameType.TYPE_NAME;        }        if(caller == getSuperClassAccessOptNoTransform()) {            return NameType.TYPE_NAME;        }        return super.Define_NameType_nameType(caller, child);    }    // Declared in Modifiers.jrag at line 257    public boolean Define_boolean_mayBeFinal(ASTNode caller, ASTNode child) {        if(caller == getModifiersNoTransform()) {            return true;        }        return super.Define_boolean_mayBeFinal(caller, child);    }public ASTNode rewriteTo() {    return super.rewriteTo();}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?