if (!"<init>".equals(parameterInfo.getDeclaringMethod().getName())) { continue; final ClassInfo classInfo = parameterInfo.getDeclaringMethod().getDeclaringClass(); try { @SuppressWarnings("unchecked") final Parameter<Constructor<?>> parameter = (Parameter<Constructor<?>>) parameterInfo.get(); result.add(parameter); } catch (ClassNotFoundException e) { classesNotLoaded.add(parameterInfo.getDeclaringMethod().getDeclaringClass().getName());
for (Annotation[] annotations : method.getParameterAnnotations()) { for (int i = 0; i < annotations.length; i++) { infos.add(new ParameterInfo(methodInfo, i)); for (Annotation[] annotations : constructor.getParameterAnnotations()) { for (int i = 0; i < annotations.length; i++) { infos.add(new ParameterInfo(methodInfo, i));
@Override public AnnotationVisitor visitParameterAnnotation(final int param, final String desc, final boolean visible) { final AnnotationVisitor toWrap = super.visitParameterAnnotation(param, desc, visible); if (visible) { return toWrap; } ParameterInfo parameterInfo = null; // should be the most recently added parameter, so iterate backward: for (int i = methodInfo.getParameters().size() - 1; i >= 0; i--) { final ParameterInfo atI = methodInfo.getParameters().get(i); if (atI.getName().equals(Integer.toString(param))) { parameterInfo = atI; break; } } return parameterInfo == null ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, parameterInfo); } };
ctorParameterAnnotations.forEach((k, v) -> { try { final Parameter<?> parameter = k.get(); if (parameter.getDeclaringExecutable().equals(ctor.getTarget()) && param.getTarget().intValue() == parameter.getIndex()) { methodParameterAnnotations.forEach((k, v) -> { try { final Parameter<?> parameter = k.get(); if (parameter.getDeclaringExecutable().equals(methd.getTarget()) && param.getTarget().intValue() == parameter.getIndex()) {
for (Annotation[] annotations : method.getParameterAnnotations()) { for (int i = 0; i < annotations.length; i++) { infos.add(new ParameterInfo(methodInfo, i)); for (Annotation[] annotations : constructor.getParameterAnnotations()) { for (int i = 0; i < annotations.length; i++) { infos.add(new ParameterInfo(methodInfo, i));
if ("<init>".equals(parameterInfo.getDeclaringMethod().getName())) { continue; final ClassInfo classInfo = parameterInfo.getDeclaringMethod().getDeclaringClass(); try { @SuppressWarnings("unchecked") final Parameter<Method> parameter = (Parameter<Method>) parameterInfo.get(); result.add(parameter); } catch (ClassNotFoundException e) { classesNotLoaded.add(parameterInfo.getDeclaringMethod().getDeclaringClass().getName());
if (!"<init>".equals(parameterInfo.getDeclaringMethod().getName())) { continue; final ClassInfo classInfo = parameterInfo.getDeclaringMethod().getDeclaringClass(); try { @SuppressWarnings("unchecked") final Parameter<Constructor<?>> parameter = (Parameter<Constructor<?>>) parameterInfo.get(); result.add(parameter); } catch (ClassNotFoundException e) { classesNotLoaded.add(parameterInfo.getDeclaringMethod().getDeclaringClass().getName());
if ("<init>".equals(parameterInfo.getDeclaringMethod().getName())) { continue; final ClassInfo classInfo = parameterInfo.getDeclaringMethod().getDeclaringClass(); try { @SuppressWarnings("unchecked") final Parameter<Method> parameter = (Parameter<Method>) parameterInfo.get(); result.add(parameter); } catch (ClassNotFoundException e) { classesNotLoaded.add(parameterInfo.getDeclaringMethod().getDeclaringClass().getName());
public List<Annotated<Parameter<Constructor<?>>>> findAnnotatedConstructorParameters( final Class<? extends Annotation> annotation) { Finder.this.findAnnotatedConstructorParameters(annotation); return typed(ParameterInfo.class, getAnnotationInfos(annotation.getName())::stream) .filter(isCtor(ParameterInfo::getDeclaringMethod)).map(parameterInfo -> { try { @SuppressWarnings("unchecked") final Parameter<Constructor<?>> parameter = (Parameter<Constructor<?>>) parameterInfo.get(); return new IncludesClassfile<>(parameter, classfileAnnotationsFor(parameterInfo)); } catch (final ClassNotFoundException e) { return null; } }).filter(hasAnnotation(annotation)).collect(Collectors.toList()); }
@Override public Annotation[] getDeclaredAnnotations() { try { return get().getDeclaredAnnotations(); } catch (ClassNotFoundException e) { return super.getDeclaredAnnotations(); } }
public List<Annotated<Parameter<Method>>> findAnnotatedMethodParameters( final Class<? extends Annotation> annotationType) { Finder.this.findAnnotatedMethodParameters(annotationType); return typed(ParameterInfo.class, getAnnotationInfos(annotationType.getName())::stream) .filter(isCtor(ParameterInfo::getDeclaringMethod).negate()).map(parameterInfo -> { try { @SuppressWarnings("unchecked") final Parameter<Method> parameter = (Parameter<Method>) parameterInfo.get(); return new IncludesClassfile<>(parameter, classfileAnnotationsFor(parameterInfo)); } catch (final ClassNotFoundException e) { return null; } }).filter(hasAnnotation(annotationType)).collect(Collectors.toList()); }
@Override public AnnotationVisitor visitMethodParameterAnnotation(int param, String desc, boolean visible) { MethodInfo methodInfo = ((MethodInfo) info); List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param); AnnotationInfo annotationInfo = new AnnotationInfo(desc); annotationInfos.add(annotationInfo); ParameterInfo parameterInfo = new ParameterInfo(methodInfo, param); methodInfo.getParameters().add(parameterInfo); index(annotationInfo, parameterInfo); return new InfoBuildingVisitor(annotationInfo).annotationVisitor(); } }
@Override public boolean test(final Info info) { return super.test(info) && ((ParameterInfo) info).getDeclaringMethod().isConstructor() == isCtor; } }
@Override public Annotation[] getDeclaredAnnotations() { try { return get().getDeclaredAnnotations(); } catch (ClassNotFoundException e) { return super.getDeclaredAnnotations(); } }
@Override public AnnotationVisitor visitMethodParameterAnnotation(int param, String desc, boolean visible) { MethodInfo methodInfo = ((MethodInfo) info); List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param); AnnotationInfo annotationInfo = new AnnotationInfo(desc); annotationInfos.add(annotationInfo); ParameterInfo parameterInfo = new ParameterInfo(methodInfo, param); methodInfo.getParameters().add(parameterInfo); index(annotationInfo, parameterInfo); return new InfoBuildingVisitor(annotationInfo).annotationVisitor(); } }