-
Notifications
You must be signed in to change notification settings - Fork 333
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
Fixing issue 486 @SubParameter Problems #515
base: master
Are you sure you want to change the base?
Conversation
@@ -300,7 +300,10 @@ private Object handleSubParameters(String value, int currentIndex, Class<?> type | |||
objectValue = type.newInstance(); | |||
parameterized.set(object, objectValue); | |||
} | |||
boolean access = sai.field.isAccessible(); | |||
sai.field.setAccessible(true); // before using the field, set accessible to true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide a unit test for this bug. Thanks.
@@ -81,6 +81,32 @@ public void addValue(Parameterized parameterized, Object object, Object value, F | |||
throws IllegalAccessException { | |||
if (parameter != null) { | |||
if (field != null) { | |||
Class<?> fieldClass = field.getType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide a unit test for this bug. Thanks.
try { | ||
value = fieldClass.getConstructor(value.getClass()).newInstance(value); | ||
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException e) { | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not print to stack trace, but instead throw ParameterException. Thanks.
@fsd654qyl Kindly asking for answers to the open questions. Thanks. |
@fsd654qyl Kindly requesting your response! :-) |
fixed #486