classdecl.java

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

JAVA
1,302
字号
        lineNumber_visited = boundariesCrossed;        int lineNumber_value = lineNumber_compute();        lineNumber_visited = -1;        return lineNumber_value;    }    private int lineNumber_compute() {  return getLine(IDstart);  }    protected int lookupSuperConstructor_visited = -1;    // Declared in LookupConstructor.jrag at line 22 @SuppressWarnings({"unchecked", "cast"})     public Collection lookupSuperConstructor() {        if(lookupSuperConstructor_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: lookupSuperConstructor in class: ");        lookupSuperConstructor_visited = boundariesCrossed;        Collection lookupSuperConstructor_value = lookupSuperConstructor_compute();        lookupSuperConstructor_visited = -1;        return lookupSuperConstructor_value;    }    private Collection lookupSuperConstructor_compute() {  return hasSuperclass() ? superclass().constructors() : Collections.EMPTY_LIST;  }    protected int noConstructor_visited = -1;    protected boolean noConstructor_computed = false;    protected boolean noConstructor_value;    // Declared in LookupConstructor.jrag at line 177 @SuppressWarnings({"unchecked", "cast"})     public boolean noConstructor() {        if(noConstructor_computed)            return noConstructor_value;        if(noConstructor_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: noConstructor in class: ");        noConstructor_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        noConstructor_value = noConstructor_compute();        if(isFinal && num == boundariesCrossed)            noConstructor_computed = true;        noConstructor_visited = -1;        return noConstructor_value;    }    private boolean noConstructor_compute() {    for(int i = 0; i < getNumBodyDecl(); i++)      if(getBodyDecl(i) instanceof ConstructorDecl)        return false;    return true;  }    protected java.util.Map interfacesMethodsSignature_String_visited;    // Declared in LookupMethod.jrag at line 263 @SuppressWarnings({"unchecked", "cast"})     public SimpleSet interfacesMethodsSignature(String signature) {        Object _parameters = signature;if(interfacesMethodsSignature_String_visited == null) interfacesMethodsSignature_String_visited = new java.util.HashMap(4);        if(new Integer(boundariesCrossed).equals(interfacesMethodsSignature_String_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: interfacesMethodsSignature in class: ");        interfacesMethodsSignature_String_visited.put(_parameters, new Integer(boundariesCrossed));        SimpleSet interfacesMethodsSignature_String_value = interfacesMethodsSignature_compute(signature);        interfacesMethodsSignature_String_visited.remove(_parameters);        return interfacesMethodsSignature_String_value;    }    private SimpleSet interfacesMethodsSignature_compute(String signature) {    SimpleSet set = (SimpleSet)interfacesMethodsSignatureMap().get(signature);    if(set != null) return set;    return SimpleSet.emptySet;  }    protected int interfacesMethodsSignatureMap_visited = -1;    protected boolean interfacesMethodsSignatureMap_computed = false;    protected HashMap interfacesMethodsSignatureMap_value;    // Declared in LookupMethod.jrag at line 269 @SuppressWarnings({"unchecked", "cast"})     public HashMap interfacesMethodsSignatureMap() {        if(interfacesMethodsSignatureMap_computed)            return interfacesMethodsSignatureMap_value;        if(interfacesMethodsSignatureMap_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: interfacesMethodsSignatureMap in class: ");        interfacesMethodsSignatureMap_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        interfacesMethodsSignatureMap_value = interfacesMethodsSignatureMap_compute();        if(isFinal && num == boundariesCrossed)            interfacesMethodsSignatureMap_computed = true;        interfacesMethodsSignatureMap_visited = -1;        return interfacesMethodsSignatureMap_value;    }    private HashMap interfacesMethodsSignatureMap_compute() {    HashMap map = new HashMap();    for(Iterator iter = interfacesIterator(); iter.hasNext(); ) {      TypeDecl typeDecl = (InterfaceDecl)iter.next();      for(Iterator i2 = typeDecl.methodsIterator(); i2.hasNext(); ) {        MethodDecl m = (MethodDecl)i2.next();        putSimpleSetElement(map, m.signature(), m);      }    }    return map;  }    protected int methodsSignatureMap_visited = -1;    // Declared in LookupMethod.jrag at line 305 @SuppressWarnings({"unchecked", "cast"})     public HashMap methodsSignatureMap() {        if(methodsSignatureMap_computed)            return methodsSignatureMap_value;        if(methodsSignatureMap_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: methodsSignatureMap in class: ");        methodsSignatureMap_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        methodsSignatureMap_value = methodsSignatureMap_compute();        if(isFinal && num == boundariesCrossed)            methodsSignatureMap_computed = true;        methodsSignatureMap_visited = -1;        return methodsSignatureMap_value;    }    private HashMap methodsSignatureMap_compute() {    HashMap map = new HashMap(localMethodsSignatureMap());    if(hasSuperclass()) {      for(Iterator iter = superclass().methodsIterator(); iter.hasNext(); ) {        MethodDecl m = (MethodDecl)iter.next();        if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature()))          putSimpleSetElement(map, m.signature(), m);      }    }    for(Iterator outerIter = interfacesIterator(); outerIter.hasNext(); ) {      TypeDecl typeDecl = (TypeDecl)outerIter.next();      for(Iterator iter = typeDecl.methodsIterator(); iter.hasNext(); ) {        MethodDecl m = (MethodDecl)iter.next();        if(!m.isPrivate() && m.accessibleFrom(this) && !localMethodsSignatureMap().containsKey(m.signature()))          if(allMethodsAbstract((SimpleSet)map.get(m.signature())))            putSimpleSetElement(map, m.signature(), m);      }    }    return map;  }    protected java.util.Map ancestorMethods_String_visited;    // Declared in LookupMethod.jrag at line 363 @SuppressWarnings({"unchecked", "cast"})     public SimpleSet ancestorMethods(String signature) {        Object _parameters = signature;if(ancestorMethods_String_visited == null) ancestorMethods_String_visited = new java.util.HashMap(4);if(ancestorMethods_String_values == null) ancestorMethods_String_values = new java.util.HashMap(4);        if(ancestorMethods_String_values.containsKey(_parameters))            return (SimpleSet)ancestorMethods_String_values.get(_parameters);        if(new Integer(boundariesCrossed).equals(ancestorMethods_String_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: ancestorMethods in class: ");        ancestorMethods_String_visited.put(_parameters, new Integer(boundariesCrossed));        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        SimpleSet ancestorMethods_String_value = ancestorMethods_compute(signature);        if(isFinal && num == boundariesCrossed)            ancestorMethods_String_values.put(_parameters, ancestorMethods_String_value);        ancestorMethods_String_visited.remove(_parameters);        return ancestorMethods_String_value;    }    private SimpleSet ancestorMethods_compute(String signature) {    SimpleSet set = SimpleSet.emptySet;    if(hasSuperclass()) {      for(Iterator iter = superclass().localMethodsSignature(signature).iterator(); iter.hasNext(); ) {        MethodDecl m = (MethodDecl)iter.next();        if(!m.isPrivate())          set = set.add(m);      }    }    if(set.size() != 1 || ((MethodDecl)set.iterator().next()).isAbstract()) {       for(Iterator iter = interfacesMethodsSignature(signature).iterator(); iter.hasNext(); ) {        MethodDecl m = (MethodDecl)iter.next();        set = set.add(m);      }    }    if(!hasSuperclass()) return set;    if(set.size() == 1) {      MethodDecl m = (MethodDecl)set.iterator().next();      if(!m.isAbstract()) {        boolean done = true;        for(Iterator iter = superclass().ancestorMethods(signature).iterator(); iter.hasNext(); ) {          MethodDecl n = (MethodDecl)iter.next();          if(n.isPrivate() || !n.accessibleFrom(m.hostType()))            done = false;        }        if(done) return set;      }    }    for(Iterator iter = superclass().ancestorMethods(signature).iterator(); iter.hasNext(); ) {      MethodDecl m = (MethodDecl)iter.next();      set = set.add(m);    }    return set;  }    protected java.util.Map memberTypes_String_visited;    // Declared in LookupType.jrag at line 410 @SuppressWarnings({"unchecked", "cast"})     public SimpleSet memberTypes(String name) {        Object _parameters = name;if(memberTypes_String_visited == null) memberTypes_String_visited = new java.util.HashMap(4);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);        if(new Integer(boundariesCrossed).equals(memberTypes_String_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: memberTypes in class: ");        memberTypes_String_visited.put(_parameters, new Integer(boundariesCrossed));        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);        memberTypes_String_visited.remove(_parameters);        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;  }    protected java.util.Map memberFields_String_visited;    // Declared in LookupVariable.jrag at line 275 @SuppressWarnings({"unchecked", "cast"})     public SimpleSet memberFields(String name) {        Object _parameters = name;if(memberFields_String_visited == null) memberFields_String_visited = new java.util.HashMap(4);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);        if(new Integer(boundariesCrossed).equals(memberFields_String_visited.get(_parameters)))            throw new RuntimeException("Circular definition of attr: memberFields in class: ");        memberFields_String_visited.put(_parameters, new Integer(boundariesCrossed));        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);        memberFields_String_visited.remove(_parameters);        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;  }    protected int unimplementedMethods_visited = -1;    // Declared in Modifiers.jrag at line 17 @SuppressWarnings({"unchecked", "cast"})     public Collection unimplementedMethods() {        if(unimplementedMethods_computed)            return unimplementedMethods_value;        if(unimplementedMethods_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: unimplementedMethods in class: ");        unimplementedMethods_visited = boundariesCrossed;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        unimplementedMethods_value = unimplementedMethods_compute();        if(isFinal && num == boundariesCrossed)            unimplementedMethods_computed = true;        unimplementedMethods_visited = -1;        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);

⌨️ 快捷键说明

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