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

Fixing issue 486 @SubParameter Problems #515

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

fsd654qyl
Copy link
Contributor

@fsd654qyl fsd654qyl commented Apr 25, 2021

fixed #486

  1. @Subparameter has accessibility problem. I solve it by setting the accessibility of field to true and then set to origin in ParameterDescription.java
  2. @Subparameter seems only can parse String, other data types do not work properly. So I add data type convertion in WrappedParameter.java

@mkarg mkarg added the bug Bug label Dec 17, 2023
@@ -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
Copy link
Collaborator

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();
Copy link
Collaborator

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();
Copy link
Collaborator

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.

@mkarg
Copy link
Collaborator

mkarg commented Apr 27, 2024

@fsd654qyl Kindly asking for answers to the open questions. Thanks.

@mkarg
Copy link
Collaborator

mkarg commented Jul 6, 2024

@fsd654qyl Kindly requesting your response! :-)

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

Successfully merging this pull request may close these issues.

@SubParameter Problems
2 participants