Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Parameterized Types in Feature Hierarchy #96

Open
feroult opened this issue Jul 14, 2016 · 1 comment
Open

Allow Parameterized Types in Feature Hierarchy #96

feroult opened this issue Jul 14, 2016 · 1 comment

Comments

@feroult
Copy link
Owner

feroult commented Jul 14, 2016

Right now, we can't create a generic hook for a generic base class like this:

public abstract class BaseAggregator<T extends SomeClass> {
}
public class BaseHook<T extends SomeClass> extends Hook<BaseAggregator<T> {
}

To support this scenario, it is necessary to change the following ReflectionUtils method:

public static Class<?> getFeatureTypeArgumentAt(Class<?> clazz, int index) {
    Type superClassGenericType = getGenericTypeArgumentAt(clazz.getGenericSuperclass(), index);

    if (superClassGenericType instanceof TypeVariable) {
        return (Class<?>) getGenericTypeBound(clazz, ((TypeVariable) superClassGenericType).getName());
    }

    return (Class<?>) superClassGenericType;
}
@luanpotter
Copy link
Collaborator

Probably could replace that method with something like Java Classmate. Shouldn't be hard.

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

No branches or pull requests

2 participants