You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "jjestrada2 (via GitHub)" <gi...@apache.org> on 2025/01/31 17:37:35 UTC
[PR] Update ClassParser.java [commons-bcel]
jjestrada2 opened a new pull request, #406:
URL: https://github.com/apache/commons-bcel/pull/406
### Refactored `ClassParser` to Use instanceof for ZIP/JAR Detection
#### Problem:
The previous implementation used `getClass().getName()` to detect if an `InputStream` was from a ZIP/JAR file. This approach relied on string matching, which was inefficient and prone to break if class names changed.
#### Solution:
- Replaced reflection-based detection with `instanceof` checks for `ZipInputStream` and `JarInputStream`.
- Improved maintainability by eliminating unnecessary string operations.
- Added missing imports for `ZipInputStream` and `JarInputStream`.
#### Testing:
- Ran `mvn clean install` successfully.
- Verified existing tests pass.
- No breaking changes observed.
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
--
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
Re: [PR] Update ClassParser.java [commons-bcel]
Posted by "jjestrada2 (via GitHub)" <gi...@apache.org>.
jjestrada2 commented on PR #406:
URL: https://github.com/apache/commons-bcel/pull/406#issuecomment-2631052665
Thanks I will look into it, sorry for the delay response. I will start
working on it this week
On Mon, Feb 3, 2025 at 8:33 AM Gary Gregory ***@***.***>
wrote:
> If you're looking for something to do here, you could see why
> ConstantPoolModuleAccessTestCase fails on Java 23.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/commons-bcel/pull/406#issuecomment-2631020843>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AQULTMTSV3KTEBTFOLBKZEL2N5V37AVCNFSM6AAAAABWICIVP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZRGAZDAOBUGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
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
Re: [PR] Update ClassParser.java [commons-bcel]
Posted by "garydgregory (via GitHub) via issues" <is...@commons.apache.org>.
garydgregory commented on PR #406:
URL: https://github.com/apache/commons-bcel/pull/406#issuecomment-6533627142
Closing: Old, won't do.
--
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
Re: [PR] Update ClassParser.java [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #406:
URL: https://github.com/apache/commons-bcel/pull/406#issuecomment-2628002101
The breaking change is what would happen if a class happens to be using that package but is not one of the two specific classes the PR now requires.
The behavior is different, from package testing to 2 specific classes.
I think we can leave this alone for now. Any talk of performance is inappropriate without numbers.
--
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
Re: [PR] Update ClassParser.java [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #406:
URL: https://github.com/apache/commons-bcel/pull/406#issuecomment-2631020843
If you're looking for something to do here, you could see why `ConstantPoolModuleAccessTestCase` fails on Java 23.
--
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
Re: [PR] Update ClassParser.java [commons-bcel]
Posted by "garydgregory (via GitHub) via issues" <is...@commons.apache.org>.
garydgregory closed pull request #406: Update ClassParser.java
URL: https://github.com/apache/commons-bcel/pull/406
--
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