classdecl.java

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

JAVA
1,239
字号
      MethodDecl m = (MethodDecl)iter.next();      set = set.add(m);    }    return set;  }    // Declared in LookupType.jrag at line 410 @SuppressWarnings({"unchecked", "cast"})     public SimpleSet memberTypes(String name) {        Object _parameters = name;if(memberTypes_String_values == null) memberTypes_String_values = new java.util.HashMap(4);        if(memberTypes_String_values.containsKey(_parameters))            return (SimpleSet)memberTypes_String_values.get(_parameters);        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        SimpleSet memberTypes_String_value = memberTypes_compute(name);        if(isFinal && num == boundariesCrossed)            memberTypes_String_values.put(_parameters, memberTypes_String_value);        return memberTypes_String_value;    }    private SimpleSet memberTypes_compute(String name) {    SimpleSet set = localTypeDecls(name);    if(!set.isEmpty()) return set;    for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {      TypeDecl type = (TypeDecl)outerIter.next();      for(Iterator iter = type.memberTypes(name).iterator(); iter.hasNext(); ) {        TypeDecl decl = (TypeDecl)iter.next();        if(!decl.isPrivate() && decl.accessibleFrom(this))          set = set.add(decl);      }    }    if(hasSuperclass()) {      for(Iterator iter = superclass().memberTypes(name).iterator(); iter.hasNext(); ) {        TypeDecl decl = (TypeDecl)iter.next();        if(!decl.isPrivate() && decl.accessibleFrom(this)) {          set = set.add(decl);        }      }    }    return set;  }    // Declared in LookupVariable.jrag at line 275 @SuppressWarnings({"unchecked", "cast"})     public SimpleSet memberFields(String name) {        Object _parameters = name;if(memberFields_String_values == null) memberFields_String_values = new java.util.HashMap(4);        if(memberFields_String_values.containsKey(_parameters))            return (SimpleSet)memberFields_String_values.get(_parameters);        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        SimpleSet memberFields_String_value = memberFields_compute(name);        if(isFinal && num == boundariesCrossed)            memberFields_String_values.put(_parameters, memberFields_String_value);        return memberFields_String_value;    }    private SimpleSet memberFields_compute(String name) {    SimpleSet fields = localFields(name);    if(!fields.isEmpty())      return fields; // this causes hiding of fields in superclass and interfaces    if(hasSuperclass()) {      for(Iterator iter = superclass().memberFields(name).iterator(); iter.hasNext(); ) {        FieldDeclaration decl = (FieldDeclaration)iter.next();        if(!decl.isPrivate() && decl.accessibleFrom(this))          fields = fields.add(decl);      }    }    for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {      TypeDecl type = (TypeDecl)outerIter.next();      for(Iterator iter = type.memberFields(name).iterator(); iter.hasNext(); ) {        FieldDeclaration decl = (FieldDeclaration)iter.next();        if(!decl.isPrivate() && decl.accessibleFrom(this))          fields = fields.add(decl);      }    }    return fields;  }    // Declared in Modifiers.jrag at line 17 @SuppressWarnings({"unchecked", "cast"})     public Collection unimplementedMethods() {        if(unimplementedMethods_computed)            return unimplementedMethods_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        unimplementedMethods_value = unimplementedMethods_compute();        if(isFinal && num == boundariesCrossed)            unimplementedMethods_computed = true;        return unimplementedMethods_value;    }    private Collection unimplementedMethods_compute() {    Collection c = new ArrayList();    for(Iterator iter = interfacesMethodsIterator(); iter.hasNext(); ) {      MethodDecl m = (MethodDecl)iter.next();      boolean implemented = false;      SimpleSet set = (SimpleSet)localMethodsSignature(m.signature());      if(set.size() == 1) {        MethodDecl n = (MethodDecl)set.iterator().next();        if(!n.isAbstract())          implemented = true;      }      if(!implemented) {        set = (SimpleSet)ancestorMethods(m.signature());        for(Iterator i2 = set.iterator(); i2.hasNext(); ) {          MethodDecl n = (MethodDecl)i2.next();          if(!n.isAbstract())            implemented = true;        }      }      if(!implemented) {        c.add(m);      }    }    if(hasSuperclass()) {      for(Iterator iter = superclass().unimplementedMethods().iterator(); iter.hasNext(); ) {        MethodDecl m = (MethodDecl)iter.next();        SimpleSet set = (SimpleSet)localMethodsSignature(m.signature());        if(set.size() == 1) {          MethodDecl n = (MethodDecl)set.iterator().next();          if(n.isAbstract() || !n.overrides(m))            c.add(m);        }        else          c.add(m);      }    }    for(Iterator iter = localMethodsIterator(); iter.hasNext(); ) {      MethodDecl m = (MethodDecl)iter.next();      if(m.isAbstract()) {        c.add(m);      }    }    return c;  }    // Declared in Modifiers.jrag at line 64 @SuppressWarnings({"unchecked", "cast"})     public boolean hasAbstract() {        if(hasAbstract_computed)            return hasAbstract_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        hasAbstract_value = hasAbstract_compute();        if(isFinal && num == boundariesCrossed)            hasAbstract_computed = true;        return hasAbstract_value;    }    private boolean hasAbstract_compute() {  return !unimplementedMethods().isEmpty();  }    // Declared in TypeAnalysis.jrag at line 85 @SuppressWarnings({"unchecked", "cast"})     public boolean castingConversionTo(TypeDecl type) {        Object _parameters = type;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();        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));        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);  }    // Declared in TypeAnalysis.jrag at line 211 @SuppressWarnings({"unchecked", "cast"})     public boolean isClassDecl() {        boolean isClassDecl_value = isClassDecl_compute();        return isClassDecl_value;    }    private boolean isClassDecl_compute() {  return true;  }    // Declared in TypeAnalysis.jrag at line 226 @SuppressWarnings({"unchecked", "cast"})     public boolean isString() {        if(isString_computed)            return isString_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        isString_value = isString_compute();        if(isFinal && num == boundariesCrossed)            isString_computed = true;        return isString_value;    }    private boolean isString_compute() {  return fullName().equals("java.lang.String");  }    // Declared in TypeAnalysis.jrag at line 229 @SuppressWarnings({"unchecked", "cast"})     public boolean isObject() {        if(isObject_computed)            return isObject_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        isObject_value = isObject_compute();        if(isFinal && num == boundariesCrossed)            isObject_computed = true;        return isObject_value;    }    private boolean isObject_compute() {  return name().equals("Object") && packageName().equals("java.lang");  }    // Declared in TypeAnalysis.jrag at line 410 @SuppressWarnings({"unchecked", "cast"})     public boolean instanceOf(TypeDecl type) {        Object _parameters = type;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();        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));        return instanceOf_TypeDecl_value;    }    private boolean instanceOf_compute(TypeDecl type) {  return type.isSupertypeOfClassDecl(this);  }    // Declared in TypeAnalysis.jrag at line 425 @SuppressWarnings({"unchecked", "cast"})     public boolean isSupertypeOfClassDecl(ClassDecl type) {        boolean isSupertypeOfClassDecl_ClassDecl_value = isSupertypeOfClassDecl_compute(type);        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);  }    // Declared in TypeAnalysis.jrag at line 442 @SuppressWarnings({"unchecked", "cast"})     public boolean isSupertypeOfInterfaceDecl(InterfaceDecl type) {        boolean isSupertypeOfInterfaceDecl_InterfaceDecl_value = isSupertypeOfInterfaceDecl_compute(type);        return isSupertypeOfInterfaceDecl_InterfaceDecl_value;    }    private boolean isSupertypeOfInterfaceDecl_compute(InterfaceDecl type) {  return isObject();  }    // Declared in TypeAnalysis.jrag at line 455 @SuppressWarnings({"unchecked", "cast"})     public boolean isSupertypeOfArrayDecl(ArrayDecl type) {        boolean isSupertypeOfArrayDecl_ArrayDecl_value = isSupertypeOfArrayDecl_compute(type);        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);  }    // Declared in TypeAnalysis.jrag at line 537 @SuppressWarnings({"unchecked", "cast"})     public boolean isInnerClass() {        boolean isInnerClass_value = isInnerClass_compute();        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;                boolean new_isCircular_value = isCircular_compute();                if (new_isCircular_value!=isCircular_value)                    CHANGE = true;                isCircular_value = new_isCircular_value;                 CIRCLE_INDEX++;            } while (CHANGE);            if(isFinal && num == boundariesCrossed){            isCircular_computed = true;            }            else {            RESET_CYCLE = true;            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 (RESET_CYCLE) {                isCircular_computed = false;                isCircular_initialized = false;                return isCircular_value;            }            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 ConstantPoolNames.jrag at line 15 @SuppressWarnings({"unchecked", "cast"})     public String typeDescriptor() {        if(typeDescriptor_computed)            return typeDescriptor_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        typeDescriptor_value = typeDescriptor_compute();        if(isFinal && num == boundariesCrossed)            typeDescriptor_computed = true;        return typeDescriptor_value;    }    private String typeDescriptor_compute() {  return "L" + constantPoolName() + ";";  }    // Declared in CreateBCode.jrag at line 802 @SuppressWarnings({"unchecked", "cast"})     public String arrayTypeDescriptor() {        String arrayTypeDescriptor_value = arrayTypeDescriptor_compute();        return arrayTypeDescriptor_value;    }    private String arrayTypeDescriptor_compute() {  return constantPoolName();  }    // Declared in InnerClasses.jrag at line 402 @SuppressWarnings({"unchecked", "cast"})     public TypeDecl superEnclosing() {        TypeDecl superEnclosing_value = superEnclosing_compute();        return superEnclosing_value;    }    private TypeDecl superEnclosing_compute() {  return superclass().enclosing();  }    // 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 + -
显示快捷键?