Skip to content

Update MvcUriComponentsBuilder.java #431

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

Closed
wants to merge 1 commit into from

Conversation

floresj
Copy link

@floresj floresj commented Dec 18, 2013

Method with following signature "public static UriComponentsBuilder fromMethodName(Class<?> controllerType,String methodName, Object... argumentValues)" makes use of the getParameterCount() method found in the java.lang.reflect.Method class. This is specific to Java 8 and will cause projects using prior versions of Java to throw an exception (java.lang.NoSuchMethodError: java.lang.reflect.Method.getParameterCount()). My proposed modification is to change it to getParameterTypes().length to get the total number of parameters.

I have signed and agree to the terms of the SpringSource Individual
Contributor License Agreement.

Method with following signature "public static UriComponentsBuilder fromMethodName(Class<?> controllerType,String methodName, Object... argumentValues)" makes use of the getParameterCount() method found in the java.lang.reflect.Method class. This is specific to Java 8 and will cause projects using prior versions of Java to throw an exception (java.lang.NoSuchMethodError: java.lang.reflect.Method.getParameterCount()). My proposed modification is to change it to getParameterTypes().length to get the total number of parameters.
@bclozel
Copy link
Member

bclozel commented Dec 18, 2013

Good catch!
This methods misses a "since 1.8" documentation hint in the javadoc...

@jhoeller
Copy link
Contributor

I'm in the process of revising MvcUriComponentsBuilder in a few respects, so I can deal with the getParameterCount() issue as part of that. It would be good to have a JIRA issue for this specific issue though, just to track the breakage on JDK <1.8 that people will be seeing before 4.0.1...

@bclozel
Copy link
Member

bclozel commented Dec 18, 2013

Just created SPR-11245 and a bugreport to Oracle (#9009017).

@floresj
Copy link
Author

floresj commented Dec 18, 2013

Awesome, thank you. You guys are fast.

@rstoyanchev
Copy link
Contributor

SPR-11245 is now resolved.

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

Successfully merging this pull request may close these issues.

4 participants