ericparshall / reflections

Automatically exported from code.google.com/p/reflections
Do What The F*ck You Want To Public License
0 stars 0 forks source link

getConstructorsAnnotatedWith() throws exception, if the constructor is nonpublic #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a class containing non-public constructor, annotate the constructor 
using SomeAnnotation.
2. Configure Reflections, run 
reflections.getConstructorsAnnotatedWith(SomeAnnotation.class)

What is the expected output? What do you see instead?
I would expect to get a list of annotated constructors, including the 
non-public ones.
Instead, I get the following exception:

org.reflections.ReflectionsException: Can't resolve method named <init>
    at org.reflections.util.Utils.getMemberFromDescriptor(Utils.java:86)
    at org.reflections.util.Utils.getConstructorsFromDescriptors(Utils.java:105)
    at org.reflections.Reflections.getConstructorsAnnotatedWith(Reflections.java:443)

What version of the product are you using? On what operating system?
reflections-0.9.9-RC1
osX 10.8
ava version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)

Please provide any additional information below.
Possible fix:
org.reflections.util.Utils:81         return 
aClass.getConstructor(parameterTypes);
Should be changed to:                return 
aClass.getDeclaredConstructor(parameterTypes);

Original issue reported on code.google.com by mirek.pr...@ngcompliance.com on 27 Aug 2013 at 12:11

GoogleCodeExporter commented 9 years ago

Original comment by ronm...@gmail.com on 21 Dec 2013 at 9:34

GoogleCodeExporter commented 9 years ago
on 1/2015
The official release 0.9.9-RC1 does NOT contain the fix!
Why has it been marked as closed 13 months ago?

Original comment by uvw...@googlemail.com on 19 Jan 2015 at 11:55

GoogleCodeExporter commented 9 years ago
Bbecause nobody bother to update the release info on this site!

The current release is now 0.9.9

Original comment by uvw...@googlemail.com on 19 Jan 2015 at 11:57