-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Remove unnecessary boxing #541
Conversation
Hi Vladimir,
I agree, that the boxing/unboxing stuff makes reading the code a bit harder, but on the other hand it helps to raise awareness. It makes the process explicitly.
I have sprinkled quite a few of those boxing/unboxing constructs into my patches in the past. My intention was to mark those places. Make it clear that the conversion will happen.
I think this patch should have been discussed before.
Regards
Felix
Am 18. Oktober 2019 23:01:22 MESZ schrieb Vladimir Sitnikov <notifications@github.com>:
…## Motivation and Context
Removal of boxing and unboxing makes the code easier to read in most of
the cases.
The replacements were performed automatically by IDEA.
You can view, comment on, or merge this pull request online at:
#541
-- Commit Summary --
* Remove unnecessary boxing
* Remove unnecessary unboxing
-- File Changes --
M
src/components/src/main/java/org/apache/jmeter/assertions/CompareAssertionBeanInfo.java
(2)
M
src/components/src/main/java/org/apache/jmeter/assertions/DurationAssertion.java
(2)
M
src/components/src/main/java/org/apache/jmeter/assertions/SizeAssertion.java
(2)
M
src/components/src/main/java/org/apache/jmeter/config/RandomVariableConfig.java
(2)
M
src/components/src/main/java/org/apache/jmeter/extractor/RegexExtractor.java
(2)
M
src/components/src/main/java/org/apache/jmeter/extractor/json/jmespath/JMESPathExtractor.java
(2)
M
src/components/src/main/java/org/apache/jmeter/extractor/json/jsonpath/JSONPostProcessor.java
(2)
M
src/components/src/main/java/org/apache/jmeter/modifiers/CounterConfig.java
(10)
M
src/components/src/main/java/org/apache/jmeter/sampler/TestAction.java
(4)
M
src/components/src/main/java/org/apache/jmeter/timers/BeanShellTimer.java
(2)
M
src/components/src/main/java/org/apache/jmeter/timers/ConstantThroughputTimerBeanInfo.java
(4)
M
src/components/src/main/java/org/apache/jmeter/timers/SyncTimerBeanInfo.java
(4)
M
src/components/src/main/java/org/apache/jmeter/timers/poissonarrivals/PreciseThroughputTimerBeanInfo.java
(10)
M
src/components/src/main/java/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
(12)
M
src/components/src/main/java/org/apache/jmeter/visualizers/StatGraphVisualizer.java
(14)
M
src/components/src/main/java/org/apache/jmeter/visualizers/TableVisualizer.java
(2)
M
src/components/src/main/java/org/apache/jmeter/visualizers/backend/BackendListenerContext.java
(2)
M
src/components/src/main/java/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java
(6)
M
src/components/src/main/java/org/apache/jmeter/visualizers/backend/graphite/TextGraphiteMetricsSender.java
(2)
M
src/components/src/test/java/org/apache/jmeter/timers/TimerServiceTest.java
(10)
M src/core/src/main/java/org/apache/jmeter/control/LoopController.java
(8)
M src/core/src/main/java/org/apache/jmeter/gui/SavePropertyDialog.java
(4)
M
src/core/src/main/java/org/apache/jmeter/gui/action/CompileJSR223TestElements.java
(2)
M src/core/src/main/java/org/apache/jmeter/gui/util/JMeterToolBar.java
(22)
M
src/core/src/main/java/org/apache/jmeter/gui/util/PowerTableModel.java
(6)
M
src/core/src/main/java/org/apache/jmeter/report/config/ReportGeneratorConfiguration.java
(16)
M src/core/src/main/java/org/apache/jmeter/report/core/Converters.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/core/CsvSampleReader.java
(2)
M src/core/src/main/java/org/apache/jmeter/report/core/Sample.java (18)
M
src/core/src/main/java/org/apache/jmeter/report/core/SampleMetadata.java
(6)
M
src/core/src/main/java/org/apache/jmeter/report/dashboard/HtmlTemplateExporter.java
(10)
M
src/core/src/main/java/org/apache/jmeter/report/dashboard/ReportGenerator.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/AbstractSampleConsumer.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/AbstractSummaryConsumer.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/AggregateConsumer.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/ApdexSummaryConsumer.java
(6)
M
src/core/src/main/java/org/apache/jmeter/report/processor/ErrorsSummaryConsumer.java
(12)
M
src/core/src/main/java/org/apache/jmeter/report/processor/RequestsSummaryConsumer.java
(6)
M
src/core/src/main/java/org/apache/jmeter/report/processor/StatisticsSummaryConsumer.java
(30)
M
src/core/src/main/java/org/apache/jmeter/report/processor/Top5ErrorsBySamplerConsumer.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/Top5ErrorsSummaryData.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java
(44)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/AbstractOverTimeGraphConsumer.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/AbstractVersusRequestsGraphConsumer.java
(10)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/ConnectTimeValueSelector.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/CountValueSelector.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/ElapsedTimeValueSelector.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/IndexedNameSelector.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/LatencyValueSelector.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/SuccessfulElapsedTimeValueSelector.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/TimeStampKeysSelector.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/ActiveThreadsGraphConsumer.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/BytesThroughputGraphConsumer.java
(7)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/CustomGraphConsumer.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/ResponseTimeDistributionGraphConsumer.java
(4)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/ResponseTimePerSampleGraphConsumer.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/ResponseTimePercentilesGraphConsumer.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/ResponseTimePercentilesOverTimeGraphConsumer.java
(2)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/SyntheticResponseTimeDistributionGraphConsumer.java
(22)
M
src/core/src/main/java/org/apache/jmeter/report/processor/graph/impl/TimeVSThreadGraphConsumer.java
(2)
M src/core/src/main/java/org/apache/jmeter/save/CSVSaveService.java (2)
M
src/core/src/main/java/org/apache/jmeter/save/converters/BooleanPropertyConverter.java
(2)
M
src/core/src/main/java/org/apache/jmeter/testbeans/BeanInfoSupport.java
(4)
M
src/core/src/main/java/org/apache/jmeter/testbeans/gui/BooleanPropertyEditor.java
(2)
M
src/core/src/main/java/org/apache/jmeter/testbeans/gui/EnumEditor.java
(6)
M
src/core/src/main/java/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
(4)
M
src/core/src/main/java/org/apache/jmeter/testelement/property/AbstractProperty.java
(10)
M
src/core/src/main/java/org/apache/jmeter/testelement/property/BooleanProperty.java
(4)
M
src/core/src/main/java/org/apache/jmeter/testelement/property/DoubleProperty.java
(2)
M
src/core/src/main/java/org/apache/jmeter/testelement/property/FloatProperty.java
(2)
M
src/core/src/main/java/org/apache/jmeter/testelement/property/IntegerProperty.java
(2)
M
src/core/src/main/java/org/apache/jmeter/testelement/property/LongProperty.java
(2)
M
src/core/src/main/java/org/apache/jmeter/util/BeanShellInterpreter.java
(2)
M src/core/src/main/java/org/apache/jmeter/util/BeanShellServer.java
(2)
M src/core/src/main/java/org/apache/jmeter/util/Calculator.java (2)
M src/core/src/main/java/org/apache/jmeter/util/SSLManager.java (4)
M src/core/src/main/java/org/apache/jmeter/util/XPathUtil.java (2)
M
src/core/src/main/java/org/apache/jmeter/visualizers/SamplingStatCalculator.java
(10)
M src/core/src/test/java/org/apache/jmeter/junit/JMeterTestCase.java
(2)
M
src/core/src/test/java/org/apache/jmeter/samplers/TestDataStrippingSampleSender.java
(2)
M
src/core/src/test/java/org/apache/jmeter/testelement/property/MapPropertyTest.java
(2)
M
src/examples/src/main/java/org/apache/jmeter/examples/sampler/ExampleSampler.java
(2)
M
src/examples/src/main/java/org/apache/jmeter/examples/testbeans/example3/Example3BeanInfo.java
(8)
M
src/functions/src/main/java/org/apache/jmeter/functions/CharFunction.java
(2)
M
src/functions/src/main/java/org/apache/jmeter/functions/RegexFunction.java
(2)
M
src/jorphan/src/main/java/org/apache/commons/cli/avalon/CLArgsParser.java
(4)
M
src/jorphan/src/main/java/org/apache/jorphan/gui/MinMaxLongRenderer.java
(2)
M src/jorphan/src/main/java/org/apache/jorphan/gui/RateRenderer.java
(2)
M
src/jorphan/src/main/java/org/apache/jorphan/math/StatCalculatorInteger.java
(10)
M
src/jorphan/src/main/java/org/apache/jorphan/math/StatCalculatorLong.java
(10)
M src/jorphan/src/main/java/org/apache/jorphan/reflect/ClassTools.java
(2)
M src/jorphan/src/main/java/org/apache/jorphan/util/Converter.java (16)
M src/jorphan/src/main/java/org/apache/jorphan/util/HeapDumper.java (2)
M src/jorphan/src/main/java/org/apache/jorphan/util/JOrphanUtils.java
(2)
M
src/jorphan/src/test/java/org/apache/jorphan/collections/PackageTest.java
(2)
M
src/jorphan/src/test/java/org/apache/jorphan/gui/MinMaxLongRendererTest.java
(6)
M
src/jorphan/src/test/java/org/apache/jorphan/math/TestStatCalculator.java
(8)
M
src/jorphan/src/test/java/org/apache/jorphan/util/TestJorphanUtils.java
(8)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/AuthManager.java
(2)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/DynamicKerberosSchemeFactory.java
(2)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/DynamicSPNegoSchemeFactory.java
(2)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/HeaderManager.java
(4)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/curl/BasicCurlParser.java
(4)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/CookiePanel.java
(4)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
(2)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/parser/HTMLParser.java
(2)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
(8)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
(26)
M
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
(2)
M
src/protocol/java/src/main/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
(2)
M
src/protocol/java/src/main/java/org/apache/jmeter/protocol/java/sampler/JavaSamplerContext.java
(8)
M
src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java
(2)
M
src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
(2)
M
src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/config/DataSourceElementBeanInfo.java
(14)
M
src/protocol/mail/src/main/java/org/apache/jmeter/protocol/mail/sampler/MailFileFolder.java
(2)
M
src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java
(16)
-- Patch Links --
https://github.com/apache/jmeter/pull/541.patch
https://github.com/apache/jmeter/pull/541.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#541
|
Sample from JMeterToolbar:
"valueof" adds nothing here, and it triggered the refactoring. Note: in certain cases, the change is a performance improvement (when |
// in this case as resetLoopCount will not be called, | ||
// it leads to no further evaluations if we don't evaluate, see BUG 56276 |
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.
Is it worth fixing this indentation (or moving it to a form which doesn't require constant manual formatting?)
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.
It would probably be nice to use consistent spacing around ==
provided Spotless or something like that can auto-format the code.
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.
Sorry, I was referring to the block of //
comments, but now you mention it, the spacing around ==
should at least be consistently wrong or correct ;)
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.
Ah, I see. As discussed earlier, there's no point in maintaining horizontal alignment.
Frankly speaking, I don't like "line comments within expression", and it would probably look better if the comment is placed before if
or if nbLoops ==0
was extracted to a separate method.
I'm not sure it makes sense to manually inspect this change and fix spacing around ==
because it would take time and it add no value.
I would rather spend the time on implementing Async HTTP client rather than dealing with spaces.
Byte.valueOf(Byte.MIN_VALUE), Short.valueOf(Short.MIN_VALUE))); | ||
private static final List<Object> DEFAULT_ARGS = Collections.unmodifiableList(Arrays.asList("", 0, | ||
0L, Boolean.FALSE, 0F, 0D, ' ', | ||
Byte.MIN_VALUE, Short.MIN_VALUE)); |
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.
This could probably be better formatted now the arguments are much shorter e.g.
Collections.unmodifiableList(Arrays.asList(
"", 0, 0L, false, 0F, 0D, ' ', Byte.MIN_VALUE, Short.MIN_VALUE));
row + 2, file, data.length, columnCount, | ||
String.join(", ", data)); |
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.
Join these two short lines?
result.setResult("KoPercent", new ValueResultData(Double.valueOf((double) errorCount | ||
* 100 / count))); | ||
result.setResult("KoPercent", new ValueResultData((double) errorCount | ||
* 100 / count)); |
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.
Join these lines?
valueResult.setValue(Math.min((Double) valueResult.getValue(), | ||
value)); |
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.
Join these lines here and for the change below in this file?
@@ -342,15 +340,15 @@ private void addKeyData(MapResultData result, String group, String series, | |||
ListResultData coordResult = new ListResultData(); | |||
coordResult.addResult(new ValueResultData(value)); | |||
coordResult.addResult(new ValueResultData( | |||
Double.valueOf(percentile))); | |||
percentile)); |
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.
Join lines? :)
Motivation and Context
Removal of boxing and unboxing makes the code easier to read in most of the cases.
The replacements were performed automatically by IDEA.