001 /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */ 002 package AST; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.*; 007 import beaver.*; 008 import java.util.ArrayList; 009 import java.util.zip.*; 010 import java.io.*; 011 import java.io.FileNotFoundException; 012 import java.util.Collection; 013 /** 014 * Abstract superclass for catch clauses. 015 * @production CatchClause : {@link ASTNode} ::= <span class="component">{@link Block}</span>; 016 * @ast node 017 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/MultiCatch.ast:4 018 */ 019 public abstract class CatchClause extends ASTNode<ASTNode> implements Cloneable, VariableScope { 020 /** 021 * @apilevel low-level 022 */ 023 public void flushCache() { 024 } 025 /** 026 * @apilevel internal 027 */ 028 public void flushCollectionCache() { 029 } 030 /** 031 * @apilevel internal 032 */ 033 @SuppressWarnings({"unchecked", "cast"}) 034 public CatchClause clone() throws CloneNotSupportedException { 035 CatchClause node = (CatchClause)super.clone(); 036 node.parameterDeclaration_String_values = null; 037 node.label_computed = false; 038 node.typeThrowable_computed = false; 039 node.typeThrowable_value = null; 040 node.lookupVariable_String_values = null; 041 node.reachableCatchClause_TypeDecl_values = null; 042 node.in$Circle(false); 043 node.is$Final(false); 044 return node; 045 } 046 /** 047 * @ast method 048 * @aspect CreateBCode 049 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:15 050 */ 051 public abstract void exceptionTableEntries(CodeGeneration gen, TryStmt tryStmt); 052 /** 053 * @ast method 054 * 055 */ 056 public CatchClause() { 057 super(); 058 059 060 } 061 /** 062 * Initializes the child array to the correct size. 063 * Initializes List and Opt nta children. 064 * @apilevel internal 065 * @ast method 066 * @ast method 067 * 068 */ 069 public void init$Children() { 070 children = new ASTNode[1]; 071 } 072 /** 073 * @ast method 074 * 075 */ 076 public CatchClause(Block p0) { 077 setChild(p0, 0); 078 } 079 /** 080 * @apilevel low-level 081 * @ast method 082 * 083 */ 084 protected int numChildren() { 085 return 1; 086 } 087 /** 088 * @apilevel internal 089 * @ast method 090 * 091 */ 092 public boolean mayHaveRewrite() { 093 return false; 094 } 095 /** 096 * Replaces the Block child. 097 * @param node The new node to replace the Block child. 098 * @apilevel high-level 099 * @ast method 100 * 101 */ 102 public void setBlock(Block node) { 103 setChild(node, 0); 104 } 105 /** 106 * Retrieves the Block child. 107 * @return The current node used as the Block child. 108 * @apilevel high-level 109 * @ast method 110 * 111 */ 112 public Block getBlock() { 113 return (Block)getChild(0); 114 } 115 /** 116 * Retrieves the Block child. 117 * <p><em>This method does not invoke AST transformations.</em></p> 118 * @return The current node used as the Block child. 119 * @apilevel low-level 120 * @ast method 121 * 122 */ 123 public Block getBlockNoTransform() { 124 return (Block)getChildNoTransform(0); 125 } 126 /** 127 * @attribute syn 128 * @aspect ExceptionHandling 129 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/ExceptionHandling.jrag:212 130 */ 131 public boolean handles(TypeDecl exceptionType) { 132 ASTNode$State state = state(); 133 try { return false; } 134 finally { 135 } 136 } 137 protected java.util.Map parameterDeclaration_String_values; 138 /** 139 * @attribute syn 140 * @aspect VariableScope 141 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:111 142 */ 143 @SuppressWarnings({"unchecked", "cast"}) 144 public SimpleSet parameterDeclaration(String name) { 145 Object _parameters = name; 146 if(parameterDeclaration_String_values == null) parameterDeclaration_String_values = new java.util.HashMap(4); 147 if(parameterDeclaration_String_values.containsKey(_parameters)) { 148 return (SimpleSet)parameterDeclaration_String_values.get(_parameters); 149 } 150 ASTNode$State state = state(); 151 int num = state.boundariesCrossed; 152 boolean isFinal = this.is$Final(); 153 SimpleSet parameterDeclaration_String_value = parameterDeclaration_compute(name); 154 if(isFinal && num == state().boundariesCrossed){ parameterDeclaration_String_values.put(_parameters, parameterDeclaration_String_value); } 155 return parameterDeclaration_String_value; 156 } 157 /** 158 * @apilevel internal 159 */ 160 private SimpleSet parameterDeclaration_compute(String name) { return SimpleSet.emptySet; } 161 /** 162 * @apilevel internal 163 */ 164 protected boolean label_computed = false; 165 /** 166 * @apilevel internal 167 */ 168 protected int label_value; 169 /** 170 * @attribute syn 171 * @aspect CreateBCode 172 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1524 173 */ 174 @SuppressWarnings({"unchecked", "cast"}) 175 public int label() { 176 if(label_computed) { 177 return label_value; 178 } 179 ASTNode$State state = state(); 180 int num = state.boundariesCrossed; 181 boolean isFinal = this.is$Final(); 182 label_value = label_compute(); 183 if(isFinal && num == state().boundariesCrossed){ label_computed = true; } 184 return label_value; 185 } 186 /** 187 * @apilevel internal 188 */ 189 private int label_compute() { return hostType().constantPool().newLabel(); } 190 /** 191 * @attribute syn 192 * @aspect PreciseRethrow 193 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:109 194 */ 195 public boolean modifiedInScope(Variable var) { 196 ASTNode$State state = state(); 197 try { return getBlock().modifiedInScope(var); } 198 finally { 199 } 200 } 201 /** 202 * @apilevel internal 203 */ 204 protected boolean typeThrowable_computed = false; 205 /** 206 * @apilevel internal 207 */ 208 protected TypeDecl typeThrowable_value; 209 /** 210 * @attribute inh 211 * @aspect SpecialClasses 212 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupType.jrag:68 213 */ 214 @SuppressWarnings({"unchecked", "cast"}) 215 public TypeDecl typeThrowable() { 216 if(typeThrowable_computed) { 217 return typeThrowable_value; 218 } 219 ASTNode$State state = state(); 220 int num = state.boundariesCrossed; 221 boolean isFinal = this.is$Final(); 222 typeThrowable_value = getParent().Define_TypeDecl_typeThrowable(this, null); 223 if(isFinal && num == state().boundariesCrossed){ typeThrowable_computed = true; } 224 return typeThrowable_value; 225 } 226 protected java.util.Map lookupVariable_String_values; 227 /** 228 * @attribute inh 229 * @aspect VariableScope 230 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:20 231 */ 232 @SuppressWarnings({"unchecked", "cast"}) 233 public SimpleSet lookupVariable(String name) { 234 Object _parameters = name; 235 if(lookupVariable_String_values == null) lookupVariable_String_values = new java.util.HashMap(4); 236 if(lookupVariable_String_values.containsKey(_parameters)) { 237 return (SimpleSet)lookupVariable_String_values.get(_parameters); 238 } 239 ASTNode$State state = state(); 240 int num = state.boundariesCrossed; 241 boolean isFinal = this.is$Final(); 242 SimpleSet lookupVariable_String_value = getParent().Define_SimpleSet_lookupVariable(this, null, name); 243 if(isFinal && num == state().boundariesCrossed){ lookupVariable_String_values.put(_parameters, lookupVariable_String_value); } 244 return lookupVariable_String_value; 245 } 246 protected java.util.Map reachableCatchClause_TypeDecl_values; 247 /** 248 * @return true if an exception of type exceptionType is catchable by the catch clause 249 * @attribute inh 250 * @aspect UnreachableStatements 251 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/UnreachableStatements.jrag:127 252 */ 253 @SuppressWarnings({"unchecked", "cast"}) 254 public boolean reachableCatchClause(TypeDecl exceptionType) { 255 Object _parameters = exceptionType; 256 if(reachableCatchClause_TypeDecl_values == null) reachableCatchClause_TypeDecl_values = new java.util.HashMap(4); 257 if(reachableCatchClause_TypeDecl_values.containsKey(_parameters)) { 258 return ((Boolean)reachableCatchClause_TypeDecl_values.get(_parameters)).booleanValue(); 259 } 260 ASTNode$State state = state(); 261 int num = state.boundariesCrossed; 262 boolean isFinal = this.is$Final(); 263 boolean reachableCatchClause_TypeDecl_value = getParent().Define_boolean_reachableCatchClause(this, null, exceptionType); 264 if(isFinal && num == state().boundariesCrossed){ reachableCatchClause_TypeDecl_values.put(_parameters, Boolean.valueOf(reachableCatchClause_TypeDecl_value)); } 265 return reachableCatchClause_TypeDecl_value; 266 } 267 /** 268 * @attribute inh 269 * @aspect CreateBCode 270 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:13 271 */ 272 @SuppressWarnings({"unchecked", "cast"}) 273 public TypeDecl hostType() { 274 ASTNode$State state = state(); 275 TypeDecl hostType_value = getParent().Define_TypeDecl_hostType(this, null); 276 return hostType_value; 277 } 278 /** 279 * @attribute inh 280 * @aspect PreciseRethrow 281 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:136 282 */ 283 @SuppressWarnings({"unchecked", "cast"}) 284 public Collection<TypeDecl> caughtExceptions() { 285 ASTNode$State state = state(); 286 Collection<TypeDecl> caughtExceptions_value = getParent().Define_Collection_TypeDecl__caughtExceptions(this, null); 287 return caughtExceptions_value; 288 } 289 /** 290 * @attribute inh 291 * @aspect PreciseRethrow 292 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:195 293 */ 294 @SuppressWarnings({"unchecked", "cast"}) 295 public boolean reportUnreachable() { 296 ASTNode$State state = state(); 297 boolean reportUnreachable_value = getParent().Define_boolean_reportUnreachable(this, null); 298 return reportUnreachable_value; 299 } 300 /** 301 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:78 302 * @apilevel internal 303 */ 304 public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name) { 305 if(caller == getBlockNoTransform()){ 306 SimpleSet set = parameterDeclaration(name); 307 if(!set.isEmpty()) return set; 308 return lookupVariable(name); 309 } 310 else { return getParent().Define_SimpleSet_lookupVariable(this, caller, name); 311 } 312 } 313 /** 314 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:134 315 * @apilevel internal 316 */ 317 public CatchClause Define_CatchClause_catchClause(ASTNode caller, ASTNode child) { 318 { 319 int i = this.getIndexOfChild(caller); 320 return this; 321 } 322 } 323 /** 324 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:196 325 * @apilevel internal 326 */ 327 public boolean Define_boolean_reportUnreachable(ASTNode caller, ASTNode child) { 328 if(caller == getBlockNoTransform()) { 329 return false; 330 } 331 else { return getParent().Define_boolean_reportUnreachable(this, caller); 332 } 333 } 334 /** 335 * @apilevel internal 336 */ 337 public ASTNode rewriteTo() { 338 return super.rewriteTo(); 339 } 340 }