/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
/** * Obtains exceptions that this method/constructor may throw. * * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; ExceptionsAttribute ea = methodInfo.getExceptionsAttribute(); if (ea == null) exceptions = null; else exceptions = ea.getExceptions(); return declaringClass.getClassPool().get(exceptions); }
private List<String> extractExceptions(Optional<? extends CtBehavior> methodOptional) { if (methodOptional.isPresent()) { ExceptionsAttribute exceptionsAttribute = null; try { exceptionsAttribute = methodOptional.get().getMethodInfo().getExceptionsAttribute(); } catch (NullPointerException ex) { return Collections.emptyList(); } String[] exceptions; if (exceptionsAttribute != null && exceptionsAttribute.getExceptions() != null) { exceptions = exceptionsAttribute.getExceptions(); } else { exceptions = new String[0]; } List<String> list = new ArrayList<>(exceptions.length); Collections.addAll(list, exceptions); return list; } else { return Collections.emptyList(); } }
private List<String> extractExceptions(Optional<? extends CtBehavior> methodOptional) { if (methodOptional.isPresent()) { ExceptionsAttribute exceptionsAttribute = null; try { exceptionsAttribute = methodOptional.get().getMethodInfo().getExceptionsAttribute(); } catch (NullPointerException ex) { return Collections.emptyList(); } String[] exceptions; if (exceptionsAttribute != null && exceptionsAttribute.getExceptions() != null) { exceptions = exceptionsAttribute.getExceptions(); } else { exceptions = new String[0]; } List<String> list = new ArrayList<>(exceptions.length); Collections.addAll(list, exceptions); return list; } else { return Collections.emptyList(); } }
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
String[] exceptions = ea.getExceptions(); if (exceptions != null) { int n = exceptions.length;
private void parseMethodReferences(CtClass classFile) throws ClassParseException { for (CtBehavior behavior : classFile.getDeclaredMethods()) { AccessModifier methodAccess = translateAccess(behavior.getModifiers()); List<String> paramsAndReturn = ClassNameTranslator.signatureToClassNames(behavior.getSignature()); for (Iterator<String> i = paramsAndReturn.iterator(); i.hasNext();) { String refTo = i.next(); ClassInfo safeClassInfo = getSafeClassInfo(refTo); ReferenceType referenceType; if (i.hasNext()) { referenceType = ReferenceType.METHOD_PARAM; } else { referenceType = ReferenceType.METHOD_RETURNS; } addReference(new Reference(this, safeClassInfo, referenceType, behavior.getName(), methodAccess)); } if (behavior.getMethodInfo().getExceptionsAttribute() != null) { String[] exceptionNames = behavior.getMethodInfo().getExceptionsAttribute().getExceptions(); for (String exceptionName : exceptionNames) { addReference(new Reference(this, getSafeClassInfo(exceptionName, behavior.getSignature()), ReferenceType.METHOD_THROWS, behavior.getName(), methodAccess)); } } } }