/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * Return the names of the exception types for this method, or an empty * array if none. The names will be in a form suitable for a * {@link Class#forName} call. */ public String[] getExceptionNames() { String[] names = new String[_indexes.size()]; Iterator itr = _indexes.iterator(); int index; ClassEntry entry; for (int i = 0; i < names.length; i++) { index = ((Number) itr.next()).intValue(); entry = (ClassEntry) getPool().getEntry(index); names[i] = getProject().getNameCache().getExternalForm(entry. getNameEntry().getValue(), false); } return names; }
/** * Return the names of the exception types for this method, or an empty * array if none. The names will be in a form suitable for a * {@link Class#forName} call. */ public String[] getExceptionNames() { String[] names = new String[_indexes.size()]; Iterator itr = _indexes.iterator(); int index; ClassEntry entry; for (int i = 0; i < names.length; i++) { index = ((Number) itr.next()).intValue(); entry = (ClassEntry) getPool().getEntry(index); names[i] = getProject().getNameCache().getExternalForm(entry. getNameEntry().getValue(), false); } return names; }
/** * 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)); }
/** * 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)); }