📄 methodaccess.java
字号:
} protected int decl_visited = -1; protected boolean decl_computed = false; protected MethodDecl decl_value; // Declared in LookupMethod.jrag at line 97 @SuppressWarnings({"unchecked", "cast"}) public MethodDecl decl() { if(decl_computed) return decl_value; if(decl_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: decl in class: "); decl_visited = boundariesCrossed; int num = boundariesCrossed; boolean isFinal = this.is$Final(); decl_value = decl_compute(); if(isFinal && num == boundariesCrossed) decl_computed = true; decl_visited = -1; return decl_value; } private MethodDecl decl_compute() { SimpleSet decls = decls(); if(decls.size() == 1) return (MethodDecl)decls.iterator().next(); // 8.4.6.4 - only return the first method in case of multply inherited abstract methods 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(decls.size() > 1 && allAbstract) return (MethodDecl)decls.iterator().next(); return unknownMethod(); } protected java.util.Map accessible_MethodDecl_visited; // Declared in LookupMethod.jrag at line 164 @SuppressWarnings({"unchecked", "cast"}) public boolean accessible(MethodDecl m) { Object _parameters = m;if(accessible_MethodDecl_visited == null) accessible_MethodDecl_visited = new java.util.HashMap(4); if(new Integer(boundariesCrossed).equals(accessible_MethodDecl_visited.get(_parameters))) throw new RuntimeException("Circular definition of attr: accessible in class: "); accessible_MethodDecl_visited.put(_parameters, new Integer(boundariesCrossed)); boolean accessible_MethodDecl_value = accessible_compute(m); accessible_MethodDecl_visited.remove(_parameters); return accessible_MethodDecl_value; } private boolean accessible_compute(MethodDecl m) { if(!isQualified()) return true; if(!m.accessibleFrom(hostType())) return false; // the method is not accessible if the type is not accessible if(!qualifier().type().accessibleFrom(hostType())) return false; // 6.6.2.1 - include qualifier type for protected access if(m.isProtected() && !m.hostPackage().equals(hostPackage()) && !m.isStatic() && !qualifier().isSuperAccess()) { TypeDecl C = m.hostType(); TypeDecl S = hostType().subclassWithinBody(C); TypeDecl Q = qualifier().type(); if(S == null || !Q.instanceOf(S)) return false; } return true; } protected int validArgs_visited = -1; // Declared in NameCheck.jrag at line 60 @SuppressWarnings({"unchecked", "cast"}) public boolean validArgs() { if(validArgs_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: validArgs in class: "); validArgs_visited = boundariesCrossed; boolean validArgs_value = validArgs_compute(); validArgs_visited = -1; return validArgs_value; } private boolean validArgs_compute() { for(int i = 0; i < getNumArg(); i++) if(getArg(i).type().isUnknown()) return false; return true; } protected int dumpString_visited = -1; // Declared in PrettyPrint.jadd at line 782 @SuppressWarnings({"unchecked", "cast"}) public String dumpString() { if(dumpString_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: dumpString in class: "); dumpString_visited = boundariesCrossed; String dumpString_value = dumpString_compute(); dumpString_visited = -1; return dumpString_value; } private String dumpString_compute() { return getClass().getName() + " [" + getID() + "]"; } protected int name_visited = -1; // Declared in QualifiedNames.jrag at line 18 @SuppressWarnings({"unchecked", "cast"}) public String name() { if(name_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: name in class: "); name_visited = boundariesCrossed; String name_value = name_compute(); name_visited = -1; return name_value; } private String name_compute() { return getID(); } protected int isMethodAccess_visited = -1; // Declared in ResolveAmbiguousNames.jrag at line 19 @SuppressWarnings({"unchecked", "cast"}) public boolean isMethodAccess() { if(isMethodAccess_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: isMethodAccess in class: "); isMethodAccess_visited = boundariesCrossed; boolean isMethodAccess_value = isMethodAccess_compute(); isMethodAccess_visited = -1; return isMethodAccess_value; } private boolean isMethodAccess_compute() { return true; } protected int predNameType_visited = -1; // Declared in SyntacticClassification.jrag at line 113 @SuppressWarnings({"unchecked", "cast"}) public NameType predNameType() { if(predNameType_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: predNameType in class: "); predNameType_visited = boundariesCrossed; NameType predNameType_value = predNameType_compute(); predNameType_visited = -1; return predNameType_value; } private NameType predNameType_compute() { return NameType.AMBIGUOUS_NAME; } protected int type_visited = -1; // Declared in TypeAnalysis.jrag at line 285 @SuppressWarnings({"unchecked", "cast"}) public TypeDecl type() { if(type_computed) return type_value; if(type_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: type in class: "); type_visited = boundariesCrossed; int num = boundariesCrossed; boolean isFinal = this.is$Final(); type_value = type_compute(); if(isFinal && num == boundariesCrossed) type_computed = true; type_visited = -1; return type_value; } private TypeDecl type_compute() { return decl().type(); } protected java.util.Map handlesException_TypeDecl_visited; // Declared in ExceptionHandling.jrag at line 29 @SuppressWarnings({"unchecked", "cast"}) public boolean handlesException(TypeDecl exceptionType) { Object _parameters = exceptionType;if(handlesException_TypeDecl_visited == null) handlesException_TypeDecl_visited = new java.util.HashMap(4); if(new Integer(boundariesCrossed).equals(handlesException_TypeDecl_visited.get(_parameters))) throw new RuntimeException("Circular definition of attr: handlesException in class: "); handlesException_TypeDecl_visited.put(_parameters, new Integer(boundariesCrossed)); if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); boolean handlesException_TypeDecl_value = getParent().Define_boolean_handlesException(this, null, exceptionType); handlesException_TypeDecl_visited.remove(_parameters); return handlesException_TypeDecl_value; } protected int unknownMethod_visited = -1; // Declared in LookupMethod.jrag at line 15 @SuppressWarnings({"unchecked", "cast"}) public MethodDecl unknownMethod() { if(unknownMethod_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: unknownMethod in class: "); unknownMethod_visited = boundariesCrossed; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); MethodDecl unknownMethod_value = getParent().Define_MethodDecl_unknownMethod(this, null); unknownMethod_visited = -1; return unknownMethod_value; } protected int inExplicitConstructorInvocation_visited = -1; // Declared in TypeHierarchyCheck.jrag at line 123 @SuppressWarnings({"unchecked", "cast"}) public boolean inExplicitConstructorInvocation() { if(inExplicitConstructorInvocation_visited == boundariesCrossed) throw new RuntimeException("Circular definition of attr: inExplicitConstructorInvocation in class: "); inExplicitConstructorInvocation_visited = boundariesCrossed; if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); boolean inExplicitConstructorInvocation_value = getParent().Define_boolean_inExplicitConstructorInvocation(this, null); inExplicitConstructorInvocation_visited = -1; return inExplicitConstructorInvocation_value; } // Declared in LookupVariable.jrag at line 130 public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return unqualifiedScope().lookupVariable(name); } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_SimpleSet_lookupVariable(this, caller, name); } // Declared in LookupMethod.jrag at line 28 public Collection Define_Collection_lookupMethod(ASTNode caller, ASTNode child, String name) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return unqualifiedScope().lookupMethod(name); } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_Collection_lookupMethod(this, caller, name); } // Declared in LookupType.jrag at line 87 public boolean Define_boolean_hasPackage(ASTNode caller, ASTNode child, String packageName) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return unqualifiedScope().hasPackage(packageName); } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_boolean_hasPackage(this, caller, packageName); } // Declared in TypeHierarchyCheck.jrag at line 17 public String Define_String_methodHost(ASTNode caller, ASTNode child) { if(true) { int childIndex = this.getIndexOfChild(caller); return unqualifiedScope().methodHost(); } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_String_methodHost(this, caller); } // Declared in SyntacticClassification.jrag at line 120 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return NameType.EXPRESSION_NAME; } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_NameType_nameType(this, caller); } // Declared in DefiniteAssignment.jrag at line 413 public boolean Define_boolean_isDAbefore(ASTNode caller, ASTNode child, Variable v) { if(caller == getArgListNoTransform()) { int i = caller.getIndexOfChild(child); return computeDAbefore(i, v); } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_boolean_isDAbefore(this, caller, v); } // Declared in LookupType.jrag at line 165 public SimpleSet Define_SimpleSet_lookupType(ASTNode caller, ASTNode child, String name) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return unqualifiedScope().lookupType(name); } if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree"); return getParent().Define_SimpleSet_lookupType(this, caller, name); }public ASTNode rewriteTo() { return super.rewriteTo();}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -