⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 methodaccess.java

📁 JDK1.4编译器前端
💻 JAVA
📖 第 1 页 / 共 3 页
字号:

package AST;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.FileNotFoundException;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;public class MethodAccess extends Access implements Cloneable {
    public void flushCache() {        super.flushCache();        computeDAbefore_int_Variable_visited = new java.util.HashMap(4);        computeDAbefore_int_Variable_values = null;        isDAafter_Variable_visited = new java.util.HashMap(4);        exceptionCollection_visited = -1;        exceptionCollection_computed = false;        exceptionCollection_value = null;        singleCandidateDecl_visited = -1;        decls_visited = -1;        decls_computed = false;        decls_value = null;        decl_visited = -1;        decl_computed = false;        decl_value = null;        accessible_MethodDecl_visited = new java.util.HashMap(4);        validArgs_visited = -1;        dumpString_visited = -1;        name_visited = -1;        isMethodAccess_visited = -1;        predNameType_visited = -1;        type_visited = -1;        type_computed = false;        type_value = null;        handlesException_TypeDecl_visited = new java.util.HashMap(4);        unknownMethod_visited = -1;        inExplicitConstructorInvocation_visited = -1;    }     @SuppressWarnings({"unchecked", "cast"})  public MethodAccess clone() throws CloneNotSupportedException {        MethodAccess node = (MethodAccess)super.clone();        node.computeDAbefore_int_Variable_visited = new java.util.HashMap(4);        node.computeDAbefore_int_Variable_values = null;        node.isDAafter_Variable_visited = new java.util.HashMap(4);        node.exceptionCollection_visited = -1;        node.exceptionCollection_computed = false;        node.exceptionCollection_value = null;        node.singleCandidateDecl_visited = -1;        node.decls_visited = -1;        node.decls_computed = false;        node.decls_value = null;        node.decl_visited = -1;        node.decl_computed = false;        node.decl_value = null;        node.accessible_MethodDecl_visited = new java.util.HashMap(4);        node.validArgs_visited = -1;        node.dumpString_visited = -1;        node.name_visited = -1;        node.isMethodAccess_visited = -1;        node.predNameType_visited = -1;        node.type_visited = -1;        node.type_computed = false;        node.type_value = null;        node.handlesException_TypeDecl_visited = new java.util.HashMap(4);        node.unknownMethod_visited = -1;        node.inExplicitConstructorInvocation_visited = -1;        node.in$Circle(false);        node.is$Final(false);    return node;    }     @SuppressWarnings({"unchecked", "cast"})  public MethodAccess copy() {      try {          MethodAccess node = (MethodAccess)clone();          if(children != null) node.children = (ASTNode[])children.clone();          return node;      } catch (CloneNotSupportedException e) {      }      System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");      return null;    }     @SuppressWarnings({"unchecked", "cast"})  public MethodAccess fullCopy() {        MethodAccess res = (MethodAccess)copy();        for(int i = 0; i < getNumChildNoTransform(); i++) {          ASTNode node = getChildNoTransform(i);          if(node != null) node = node.fullCopy();          res.setChild(node, i);        }        return res;    }    // Declared in AnonymousClasses.jrag at line 149  protected void collectExceptions(Collection c, ASTNode target) {    super.collectExceptions(c, target);    for(int i = 0; i < decl().getNumException(); i++)      c.add(decl().getException(i).type());  }    // Declared in ExceptionHandling.jrag at line 43    public void exceptionHandling() {    for(Iterator iter = exceptionCollection().iterator(); iter.hasNext(); ) {      TypeDecl exceptionType = (TypeDecl)iter.next();      if(!handlesException(exceptionType))        error("" + decl().hostType().fullName() + "." + this + " invoked in " + hostType().fullName() + " may throw uncaught exception " + exceptionType.fullName());    }  }    // Declared in ExceptionHandling.jrag at line 225  protected boolean reachedException(TypeDecl catchType) {    for(Iterator iter = exceptionCollection().iterator(); iter.hasNext(); ) {      TypeDecl exceptionType = (TypeDecl)iter.next();      if(catchType.mayCatch(exceptionType))        return true;    }    return super.reachedException(catchType);  }    // Declared in LookupMethod.jrag at line 113  private static SimpleSet removeInstanceMethods(SimpleSet c) {    SimpleSet set = SimpleSet.emptySet;    for(Iterator iter = c.iterator(); iter.hasNext(); ) {      MethodDecl m = (MethodDecl)iter.next();      if(m.isStatic())        set = set.add(m);    }    return set;  }    // Declared in LookupMethod.jrag at line 152    public boolean applicable(MethodDecl decl) {    if(getNumArg() != decl.getNumParameter())      return false;    if(!name().equals(decl.name()))      return false;    for(int i = 0; i < getNumArg(); i++) {      if(!getArg(i).type().instanceOf(decl.getParameter(i).type()))        return false;    }    return true;  }    // Declared in NodeConstructors.jrag at line 56  public MethodAccess(String name, List args, int start, int end) {    this(name, args);    setStart(start);    setEnd(end);  }    // Declared in PrettyPrint.jadd at line 473  public void toString(StringBuffer s) {    s.append(name());    s.append("(");    if(getNumArg() > 0) {      getArg(0).toString(s);      for(int i = 1; i < getNumArg(); i++) {        s.append(", ");        getArg(i).toString(s);      }    }    s.append(")");  }    // Declared in TypeCheck.jrag at line 124  // 5.3 Method Invocation Conversion  public void typeCheck() {    for(int i = 0; i < decl().getNumParameter(); i++) {      TypeDecl exprType = getArg(i).type();      TypeDecl parmType = decl().getParameter(i).type();      if(!exprType.methodInvocationConversionTo(parmType) && !exprType.isUnknown() && !parmType.isUnknown()) {        error("The type " + exprType.typeName() + " of expr " +            getArg(i) + " is not compatible with the method parameter " +            decl().getParameter(i));      }    }  }    // Declared in TypeHierarchyCheck.jrag at line 23    public void nameCheck() {    if(isQualified() && qualifier().isPackageAccess() && !qualifier().isUnknown())      error("The method " + decl().signature() +           " can not be qualified by a package name.");    if(isQualified() && decl().isAbstract() && qualifier().isSuperAccess())      error("may not access abstract methods in superclass");    if(decls().isEmpty() && (!isQualified() || !qualifier().isUnknown())) {      StringBuffer s = new StringBuffer();      s.append("no method named " + name());      s.append("(");      for(int i = 0; i < getNumArg(); i++) {        if(i != 0)          s.append(", ");        s.append(getArg(i).type().typeName());      }      s.append(")" + " in " + methodHost() + " matches.");      if(singleCandidateDecl() != null)        s.append(" However, there is a method " + singleCandidateDecl().signature());      error(s.toString());    }    if(decls().size() > 1) {      boolean allAbstract = true;      for(Iterator iter = decls().iterator(); iter.hasNext() && allAbstract; ) {         MethodDecl m = (MethodDecl)iter.next();        if(!m.isAbstract() && !m.hostType().isObject())          allAbstract = false;      }      if(!allAbstract && validArgs()) {        StringBuffer s = new StringBuffer();        s.append("several most specific methods for " + this + "\n");        for(Iterator iter = decls().iterator(); iter.hasNext(); ) {          MethodDecl m = (MethodDecl)iter.next();          s.append("    " + m.signature() + " in " + m.hostType().typeName() + "\n");        }        error(s.toString());      }           }  }    // Declared in java.ast at line 3    // Declared in java.ast line 17
    public MethodAccess() {        super();
        setChild(new List(), 0);

    }    // Declared in java.ast at line 11
    // Declared in java.ast line 17    public MethodAccess(String p0, List<Expr> p1) {        setID(p0);        setChild(p1, 0);    }    // Declared in java.ast at line 17    // Declared in java.ast line 17    public MethodAccess(beaver.Symbol p0, List<Expr> p1) {        setID(p0);        setChild(p1, 0);    }    // Declared in java.ast at line 22  protected int numChildren() {
    return 1;
  }    // Declared in java.ast at line 25

⌨️ 快捷键说明

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