Skip to content

inconsistent ClassUtils.getAnnotatedFields() implementation? #252

@tpietzsch

Description

@tpietzsch

The javadoc of ClassUtils.getAnnotatedFields(...) says it returns A new list containing all fields with the requested annotation. However, it sometimes returns a new list, and sometimes the cached list.

	public static <A extends Annotation> List<Field> getAnnotatedFields(
		final Class<?> c, final Class<A> annotationClass)
	{
		List<Field> fields = fieldCache.getList(c, annotationClass);

		if (fields == null) {
			fields = new ArrayList<>();
			getAnnotatedFields(c, annotationClass, fields);
		}

		return fields;
	}

Is this an oversight or intended behaviour?

(same for getAnnotatedMethods(...))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions