Skip to content

Annotations.getValue fails when an annotation has a value that is also a valid key #699

Description

@sschr15

public static <T> T getValue(AnnotationNode annotation, String key) {
boolean getNextValue = false;
if (annotation == null || annotation.values == null) {
return null;
}
// Keys and value are stored in successive pairs, search for the key and if found return the following entry
for (Object value : annotation.values) {
if (getNextValue) {
return (T) value;
}
if (value.equals(key)) {
getNextValue = true;
}
}
return null;
}

This can very easily be seen with an @At(id = "shift", ...), but it is likely a problem in many areas.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions