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

Synopsis shows indexed Parameters in wrong order when subclassing for reuse #96

Closed
remkop opened this issue Apr 17, 2017 · 0 comments
Closed

Comments

@remkop
Copy link
Owner

remkop commented Apr 17, 2017

class Super {
  @Parameters(index=0) String first;
}
class Sub {
  @Parameters(index=1) String second;
}

Shows: Usage: <main class> <second> <first>

Fix: in Help constructor at the bottom, add the below

            Collections.sort(positionalParametersFields, new PositionalParametersSorter());
        }

        private static class PositionalParametersSorter implements Comparator<Field> {
            @Override
            public int compare(Field o1, Field o2) {
                Arity indexRange1 = Arity.valueOf(o1.getAnnotation(Parameters.class).index());
                Arity indexRange2 = Arity.valueOf(o2.getAnnotation(Parameters.class).index());
                return indexRange1.min - indexRange2.min;
            }
        }
@remkop remkop added this to the 0.4.0 user manual milestone Apr 17, 2017
@remkop remkop closed this as completed in 92a9468 Apr 17, 2017
@remkop remkop modified the milestones: 0.4.0 user manual, 0.9.1 bugfixes Apr 18, 2017
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

1 participant