commons-bcel
commons-bcel copied to clipboard
added accessors to model and unit tests, javadoc comments
- Added accessors to the module classes. Until now, the fields could only be accessed by reflection and by calling setAccessible(true). The getters return the values from the constant pool as opposed to indexes for more convenient usage.
- Added getter for the local variable type table, similarly to local variable table. They go together, it makes sense to have both instead of one of them.
- Added getAttribute to search attribute by tag. It will avoid iterating through attributes find an attribute or streaming the attributes like this Stream.of(getAttributes()).filter(MyAttribute.class::isInstance).findFirst()
Unable to resolve action actions/[email protected], unable to find version v3.7.0
Codecov Report
Attention: Patch coverage is 94.44444% with 4 lines in your changes missing coverage. Please review.
Project coverage is 65.88%. Comparing base (
f32c53c) to head (fa99fd0). Report is 166 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #183 +/- ##
============================================
+ Coverage 65.10% 65.88% +0.77%
- Complexity 3893 3995 +102
============================================
Files 364 366 +2
Lines 15657 15801 +144
Branches 1956 1969 +13
============================================
+ Hits 10194 10410 +216
+ Misses 4549 4465 -84
- Partials 914 926 +12
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @garydgregory Please help moving forward with this PR Thanks !
This PR has no description, why is it needed?
That's a lot of new APIs for one PR, are ALL of these new APIs actually used? If not, let's split this up since a PR where APIs are actually used from main, and another for the other APIs, otherwise this feels like we would be adding APIs for the sake of adding APIs. TY!
I want to avoid reflection hacks (i.e., setAccessible(true)), example here: https://github.com/nbauma109/jd-core/blob/0bcbf35f700f0cc48e1ef79456c37f9168f527ff/src/main/java/org/jd/core/v1/service/converter/classfiletojavasyntax/processor/ConvertClassFileProcessor.java#L375
I want to avoid recycling this boilerplate pattern for every single attribute:
MyAttribute attr = (MyAttribute) Stream.of(fieldOrMethod.getAttributes()).filter(MyAttribute.class::isInstance).findAny().orElse(null);
I have lots of them in that same class ConvertClassFileProcessor and in LocalVariableMaker.
Other example for local variable type table: https://github.com/nbauma109/jd-core/blob/0bcbf35f700f0cc48e1ef79456c37f9168f527ff/src/main/java/org/jd/core/v1/service/converter/classfiletojavasyntax/util/ByteCodeWriter.java#L525
Also not sure what you mean by "are these new APIs actually used?", as far as I understand, they can't be used until they're published. I happen to create SNAPSHOTs of my forked BCEL for myself to check everything works as I want but that's it.
@nbauma109 Thank you for the reply and please accept my apologies for the delay, I'll come back around to this PR this week.
Hi, any chance to get this in ? What version should I use for the @since tags ?
Hi @nbauma109
I apologize for the delay.
- The next version for new APIs should be
@since 6.10.0 - Please rebase on git master
- Run
mvn(by itself) and make sure the build passes. It may not if there are not enough tests to cover the new code. All new public and protected methods should have matching tests
Hi @garydgregory
Can you enable the workflows ?
Thanks.
Hi @markro49 Would you have any issues on your end with this PR? Looks good to me.
Merged, TY @markro49 !