/** * Add an exception to those thrown by this method. */ public void addException(Class type) { addException(type.getName()); }
/** * Set the checked exceptions thrown by this method. Use null or an * empty array for none. */ public void setExceptions(String[] exceptions) { if (exceptions != null) { for (int i = 0; i < exceptions.length; i++) if (exceptions[i] == null) throw new NullPointerException("exceptions[" + i + "] = null"); } clear(); if (exceptions != null) for (int i = 0; i < exceptions.length; i++) addException(exceptions[i]); }
/** * Return bytecode for the exception types of this * method, or an empty array if none. */ public BCClass[] getExceptionBCs() { String[] names = getExceptionNames(); BCClass[] types = new BCClass[names.length]; for (int i = 0; i < names.length; i++) types[i] = getProject().loadClass(names[i], getClassLoader()); return types; }
void read(Attribute other) { setExceptions(((Exceptions) other).getExceptionNames()); }
/** * Add an exception type to those thrown by this method. */ public void addException(String type) { int index = getPool().findClassEntry(getProject().getNameCache(). getInternalForm(type, false), true); _indexes.add(Numbers.valueOf(index)); }
public void enterExceptions(Exceptions obj) { int[] indexes = obj.getExceptionIndexes(); String[] names = obj.getExceptionNames(); for (int i = 0; i < indexes.length; i++) println("exception=" + indexes[i] + " <" + names[i] + ">"); }
/** * Return the {@link Class} objects for the exception types for this * method, or an empty array if none. */ public Class[] getExceptionTypes() { String[] names = getExceptionNames(); Class[] types = new Class[names.length]; for (int i = 0; i < names.length; i++) types[i] = Strings.toClass(names[i], getClassLoader()); return types; }
/** * Remove an exception thrown by this method. * * @return true if the method had the exception type, false otherwise */ public boolean removeException(Class type) { if (type == null) return false; return removeException(type.getName()); }
/** * Return true if the method declares that it throws the given * exception type. */ public boolean throwsException(String type) { String[] exceptions = getExceptionNames(); for (int i = 0; i < exceptions.length; i++) if (exceptions[i].equals(type)) return true; return false; }
/** * Return the owning method. */ public BCMethod getMethod() { return (BCMethod) getOwner(); }
/** * Add an exception type to those thrown by this method. */ public void addException(String type) { int index = getPool().findClassEntry(getProject().getNameCache(). getInternalForm(type, false), true); _indexes.add(Numbers.valueOf(index)); }
public void enterExceptions(Exceptions obj) { int[] indexes = obj.getExceptionIndexes(); String[] names = obj.getExceptionNames(); for (int i = 0; i < indexes.length; i++) println("exception=" + indexes[i] + " <" + names[i] + ">"); }
/** * Return the {@link Class} objects for the exception types for this * method, or an empty array if none. */ public Class[] getExceptionTypes() { String[] names = getExceptionNames(); Class[] types = new Class[names.length]; for (int i = 0; i < names.length; i++) types[i] = Strings.toClass(names[i], getClassLoader()); return types; }
void read(Attribute other) { setExceptions(((Exceptions) other).getExceptionNames()); }
/** * Remove an exception thrown by this method. * * @return true if the method had the exception type, false otherwise */ public boolean removeException(Class type) { if (type == null) return false; return removeException(type.getName()); }
/** * Return true if the method declares that it throws the given * exception type. */ public boolean throwsException(String type) { String[] exceptions = getExceptionNames(); for (int i = 0; i < exceptions.length; i++) if (exceptions[i].equals(type)) return true; return false; }
/** * Return the owning method. */ public BCMethod getMethod() { return (BCMethod) getOwner(); }
/** * Add an exception to those thrown by this method. */ public void addException(Class type) { addException(type.getName()); }
/** * Set the checked exceptions thrown by this method. Use null or an * empty array for none. */ public void setExceptions(String[] exceptions) { if (exceptions != null) { for (int i = 0; i < exceptions.length; i++) if (exceptions[i] == null) throw new NullPointerException("exceptions[" + i + "] = null"); } clear(); if (exceptions != null) for (int i = 0; i < exceptions.length; i++) addException(exceptions[i]); }
/** * Remove an exception type thrown by this method. * * @return true if the method had the exception type, false otherwise */ public boolean removeException(String type) { String internalForm = getProject().getNameCache().getInternalForm(type, false); ClassEntry entry; for (Iterator itr = _indexes.iterator(); itr.hasNext();) { entry = (ClassEntry) getPool().getEntry(((Integer) itr.next()). intValue()); if (entry.getNameEntry().getValue().equals(internalForm)) { itr.remove(); return true; } } return false; }