You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "mawiesne (via GitHub)" <gi...@apache.org> on 2023/06/16 16:41:03 UTC

[GitHub] [commons-compress] mawiesne opened a new pull request, #394: Remove redundant (null) initializations

mawiesne opened a new pull request, #394:
URL: https://github.com/apache/commons-compress/pull/394

   Change
   -
   - removes redundant (null) initializations
   - removes redundant int initializations
   - removes redundant close() methods from try-with-resources handled code blocks
   - clears some unused imports


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] mawiesne commented on pull request #394: Remove redundant (null) initializations

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on PR #394:
URL: https://github.com/apache/commons-compress/pull/394#issuecomment-1595198033

   @garydgregory Adjusted accordingly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] mawiesne commented on a diff in pull request #394: Remove redundant (null) initializations

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #394:
URL: https://github.com/apache/commons-compress/pull/394#discussion_r1232641864


##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ClassRefForm.java:
##########
@@ -62,7 +62,7 @@ protected void setNestedEntries(final ByteCode byteCode, final OperandManager op
         // the spec except for multianewarray, which has
         // its own form.)
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   All fixed with latest push.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] mawiesne commented on pull request #394: Remove redundant (null) initializations

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on PR #394:
URL: https://github.com/apache/commons-compress/pull/394#issuecomment-1594964351

   FYI: @garydgregory @kinow 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] garydgregory merged pull request #394: Remove redundant (null) initializations

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #394:
URL: https://github.com/apache/commons-compress/pull/394


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] codecov-commenter commented on pull request #394: Remove redundant (null) initializations

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #394:
URL: https://github.com/apache/commons-compress/pull/394#issuecomment-1595153274

   ## [Codecov](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#394](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (4d72666) into [master](https://app.codecov.io/gh/apache/commons-compress/commit/f884b868934c35e5d8182986a092170e9ddcfbf0?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (f884b86) will **decrease** coverage by `0.01%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master     #394      +/-   ##
   ============================================
   - Coverage     80.45%   80.44%   -0.01%     
     Complexity     6723     6723              
   ============================================
     Files           343      343              
     Lines         25310    25291      -19     
     Branches       4107     4107              
   ============================================
   - Hits          20363    20346      -17     
   + Misses         3366     3364       -2     
     Partials       1581     1581              
   ```
   
   
   | [Impacted Files](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [.../compress/archivers/arj/ArjArchiveInputStream.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL2Fyai9BcmpBcmNoaXZlSW5wdXRTdHJlYW0uamF2YQ==) | `73.05% <ø> (-0.17%)` | :arrow_down: |
   | [.../commons/compress/archivers/examples/Expander.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL2V4YW1wbGVzL0V4cGFuZGVyLmphdmE=) | `86.66% <ø> (-0.13%)` | :arrow_down: |
   | [...compress/archivers/tar/TarArchiveOutputStream.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3Rhci9UYXJBcmNoaXZlT3V0cHV0U3RyZWFtLmphdmE=) | `88.61% <ø> (ø)` | |
   | [...ommons/compress/archivers/zip/ZipArchiveEntry.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9aaXBBcmNoaXZlRW50cnkuamF2YQ==) | `82.29% <ø> (-0.05%)` | :arrow_down: |
   | [...compress/archivers/zip/ZipArchiveOutputStream.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9aaXBBcmNoaXZlT3V0cHV0U3RyZWFtLmphdmE=) | `74.19% <ø> (-0.05%)` | :arrow_down: |
   | [...ss/compressors/gzip/GzipCompressorInputStream.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvY29tcHJlc3NvcnMvZ3ppcC9HemlwQ29tcHJlc3NvcklucHV0U3RyZWFtLmphdmE=) | `68.57% <ø> (-0.30%)` | :arrow_down: |
   | [...compressors/lz4/BlockLZ4CompressorInputStream.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvY29tcHJlc3NvcnMvbHo0L0Jsb2NrTFo0Q29tcHJlc3NvcklucHV0U3RyZWFtLmphdmE=) | `74.13% <ø> (-0.44%)` | :arrow_down: |
   | [...mpressors/snappy/SnappyCompressorOutputStream.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvY29tcHJlc3NvcnMvc25hcHB5L1NuYXBweUNvbXByZXNzb3JPdXRwdXRTdHJlYW0uamF2YQ==) | `85.05% <ø> (-0.17%)` | :arrow_down: |
   | [...ns/compress/harmony/pack200/MetadataBandGroup.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvaGFybW9ueS9wYWNrMjAwL01ldGFkYXRhQmFuZEdyb3VwLmphdmE=) | `70.64% <ø> (-0.14%)` | :arrow_down: |
   | [...mons/compress/harmony/pack200/PopulationCodec.java](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvaGFybW9ueS9wYWNrMjAwL1BvcHVsYXRpb25Db2RlYy5qYXZh) | `81.15% <ø> (+1.15%)` | :arrow_up: |
   | ... and [9 more](https://app.codecov.io/gh/apache/commons-compress/pull/394?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] garydgregory commented on a diff in pull request #394: Remove redundant (null) initializations

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #394:
URL: https://github.com/apache/commons-compress/pull/394#discussion_r1232628379


##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/InitMethodReferenceForm.java:
##########
@@ -49,7 +49,7 @@ protected int getPoolID() {
     protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset)
         throws Pack200Exception {
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   @mawiesne  How about here?



##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/NewInitMethodRefForm.java:
##########
@@ -41,7 +41,7 @@ protected String context(final OperandManager operandManager) {
     protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset)
         throws Pack200Exception {
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   @mawiesne  How about here?



##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ReferenceForm.java:
##########
@@ -60,7 +60,7 @@ public void setByteCodeOperands(final ByteCode byteCode, final OperandManager op
     protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset)
         throws Pack200Exception {
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   @mawiesne  How about here?



##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/StringRefForm.java:
##########
@@ -52,8 +51,8 @@ protected int getPoolID() {
     protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset)
         throws Pack200Exception {
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
-        nested = new ClassFileEntry[] {((CPString) globalPool.getValue(getPoolID(), offset))};
+        ClassFileEntry[] nested;

Review Comment:
   @mawiesne  How about here?



##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ClassSpecificReferenceForm.java:
##########
@@ -45,7 +45,7 @@ public ClassSpecificReferenceForm(final int opcode, final String name, final int
     protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset)
         throws Pack200Exception {
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   @mawiesne  How about here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] mawiesne commented on a diff in pull request #394: Remove redundant (null) initializations

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #394:
URL: https://github.com/apache/commons-compress/pull/394#discussion_r1232640998


##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/StringRefForm.java:
##########
@@ -52,8 +51,8 @@ protected int getPoolID() {
     protected void setNestedEntries(final ByteCode byteCode, final OperandManager operandManager, final int offset)
         throws Pack200Exception {
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
-        nested = new ClassFileEntry[] {((CPString) globalPool.getValue(getPoolID(), offset))};
+        ClassFileEntry[] nested;

Review Comment:
   Fixed all of them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] garydgregory commented on a diff in pull request #394: Remove redundant (null) initializations

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #394:
URL: https://github.com/apache/commons-compress/pull/394#discussion_r1232578100


##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ClassRefForm.java:
##########
@@ -62,7 +62,7 @@ protected void setNestedEntries(final ByteCode byteCode, final OperandManager op
         // the spec except for multianewarray, which has
         // its own form.)
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   @mawiesne 
   Why is this a standalone declaration and not assigned? IOW, why not perform the assignment from the line below here? Same for the other files changed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-compress] mawiesne commented on a diff in pull request #394: Remove redundant (null) initializations

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #394:
URL: https://github.com/apache/commons-compress/pull/394#discussion_r1232608392


##########
src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ClassRefForm.java:
##########
@@ -62,7 +62,7 @@ protected void setNestedEntries(final ByteCode byteCode, final OperandManager op
         // the spec except for multianewarray, which has
         // its own form.)
         final SegmentConstantPool globalPool = operandManager.globalConstantPool();
-        ClassFileEntry[] nested = null;
+        ClassFileEntry[] nested;

Review Comment:
   > @mawiesne 
   > 
   > Why is this a standalone declaration and not assigned? IOW, why not perform the assignment from the line below here? Same for the other files changed.
   
   Will check/optimize that.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org