/** * Gets whether this operation can possibly throw an exception. This * is just a convenient wrapper for * {@code getExceptions().size() != 0}. * * @return {@code true} iff this operation can possibly throw */ public final boolean canThrow() { return (exceptions.size() != 0); } }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type)); }
/** * Constructs an instance. * * @param exceptions {@code non-null;} list of classes, presumed but not * verified to be subclasses of {@code Throwable} */ public AttExceptions(TypeList exceptions) { super(ATTRIBUTE_NAME); try { if (exceptions.isMutable()) { throw new MutabilityException("exceptions.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("exceptions == null"); } this.exceptions = exceptions; }
/** * Constructs an instance. * * @param list {@code non-null;} the actual list */ public TypeListItem(TypeList list) { super(ALIGNMENT, (list.size() * ELEMENT_SIZE) + HEADER_SIZE); this.list = list; }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type)); }
/** * Constructs an instance. * * @param exceptions {@code non-null;} list of classes, presumed but not * verified to be subclasses of {@code Throwable} */ public AttExceptions(TypeList exceptions) { super(ATTRIBUTE_NAME); try { if (exceptions.isMutable()) { throw new MutabilityException("exceptions.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("exceptions == null"); } this.exceptions = exceptions; }
private void addClassWithHierachy(String classBinaryName) { if (classNames.contains(classBinaryName)) { return; } try { DirectClassFile classFile = path.getClass(classBinaryName + CLASS_EXTENSION); classNames.add(classBinaryName); CstType superClass = classFile.getSuperclass(); if (superClass != null) { addClassWithHierachy(superClass.getClassType().getClassName()); } TypeList interfaceList = classFile.getInterfaces(); int interfaceNumber = interfaceList.size(); for (int i = 0; i < interfaceNumber; i++) { addClassWithHierachy(interfaceList.getType(i).getClassName()); } } catch (FileNotFoundException e) { // Ignore: The referenced type is not in the path it must be part of the libraries. } } }
/** {@inheritDoc} */ @Override public int byteLength() { return 8 + exceptions.size() * 2; }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type)); }
/** * Constructs an instance. * * @param exceptions {@code non-null;} list of classes, presumed but not * verified to be subclasses of {@code Throwable} */ public AttExceptions(TypeList exceptions) { super(ATTRIBUTE_NAME); try { if (exceptions.isMutable()) { throw new MutabilityException("exceptions.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("exceptions == null"); } this.exceptions = exceptions; }
/** * Returns a hashcode of the contents of the given list. This * is a static method so as to work on arbitrary {@link TypeList} * instances. * * @param list {@code non-null;} the list to inspect * @return {@code non-null;} the hash code */ public static int hashContents(TypeList list) { int size = list.size(); int hash = 0; for (int i = 0; i < size; i++) { hash = (hash * 31) + list.getType(i).hashCode(); } return hash; }
/** * Gets whether this operation can possibly throw an exception. This * is just a convenient wrapper for * {@code getExceptions().size() != 0}. * * @return {@code true} iff this operation can possibly throw */ public final boolean canThrow() { return (exceptions.size() != 0); } }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type)); }
/** * Constructs an instance. * * @param exceptions {@code non-null;} list of classes, presumed but not * verified to be subclasses of {@code Throwable} */ public AttExceptions(TypeList exceptions) { super(ATTRIBUTE_NAME); try { if (exceptions.isMutable()) { throw new MutabilityException("exceptions.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("exceptions == null"); } this.exceptions = exceptions; }
/** * Returns a hashcode of the contents of the given list. This * is a static method so as to work on arbitrary {@link TypeList} * instances. * * @param list {@code non-null;} the list to inspect * @return {@code non-null;} the hash code */ public static int hashContents(TypeList list) { int size = list.size(); int hash = 0; for (int i = 0; i < size; i++) { hash = (hash * 31) + list.getType(i).hashCode(); } return hash; }
/** * Gets whether this operation can possibly throw an exception. This * is just a convenient wrapper for * {@code getExceptions().size() != 0}. * * @return {@code true} iff this operation can possibly throw */ public final boolean canThrow() { return (exceptions.size() != 0); } }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type)); }
/** * Constructs an instance. * * @param exceptions {@code non-null;} list of classes, presumed but not * verified to be subclasses of {@code Throwable} */ public AttExceptions(TypeList exceptions) { super(ATTRIBUTE_NAME); try { if (exceptions.isMutable()) { throw new MutabilityException("exceptions.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("exceptions == null"); } this.exceptions = exceptions; }
/** * Returns a hashcode of the contents of the given list. This * is a static method so as to work on arbitrary {@link TypeList} * instances. * * @param list {@code non-null;} the list to inspect * @return {@code non-null;} the hash code */ public static int hashContents(TypeList list) { int size = list.size(); int hash = 0; for (int i = 0; i < size; i++) { hash = (hash * 31) + list.getType(i).hashCode(); } return hash; }