Skip to content

Cleanup clone usage#4537

Closed
BradWalker wants to merge 2 commits intoapache:masterfrom
BradWalker:cleanup_clone_usage
Closed

Cleanup clone usage#4537
BradWalker wants to merge 2 commits intoapache:masterfrom
BradWalker:cleanup_clone_usage

Conversation

@BradWalker
Copy link
Member

Remove usage of clone() when a copy constructor will work.

This reduces the use of reflection in the VM. This has the net effect of making
the application more efficient.


^Add meaningful description above

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

This reduces the use of reflection in the VM. This has the net effect of making
the application more efficient.
@BradWalker BradWalker self-assigned this Aug 26, 2022
@BradWalker BradWalker added the Code cleanup Label for cleanup done on the Netbeans IDE label Aug 26, 2022
@BradWalker BradWalker modified the milestones: NB16, NB15 Aug 26, 2022
assertEquals(props, desc.getProps());

String[] correctArgs = args.clone();
String[] correctArgs = new ArrayList<String>.toArray(args);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't compile since the () is missing. But what worse is that this is wrong. It would create an empty AL and copy null into the first element of args to mark the end of the (empty) array.

please use Arrays.copyOf(args, args.length) for example. Same applies to the other occurrences.

@BradWalker
Copy link
Member Author

This is not well thought about it.. It's problematic on several fronts.

Therefore, abandon it and come back later.

@BradWalker BradWalker closed this Aug 27, 2022
@BradWalker BradWalker deleted the cleanup_clone_usage branch August 27, 2022 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code cleanup Label for cleanup done on the Netbeans IDE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants