You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "gtoison (via GitHub)" <gi...@apache.org> on 2024/01/02 10:01:27 UTC
[PR] Tests and proposed fix for BCEL-370 [commons-bcel]
gtoison opened a new pull request, #254:
URL: https://github.com/apache/commons-bcel/pull/254
BCEL currently does not support `LDC` with `Constant_Dynamic`, this notably happens with class files modified by Jacoco following https://github.com/jacoco/jacoco/pull/845
This causes issues in SpotBugs when it runs after Jacoco has modified the class fiels: https://github.com/spotbugs/spotbugs/issues/2759
Here's a test case illustrating the problem and a proposed fix. The change in `LDC.getValue()` is most certainly wrong but I'm not sure what to do here, any guidance would be much appreciated.
See: https://issues.apache.org/jira/browse/BCEL-370
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877276951
I would also ask @gtoison and others for a full code base scan to see if there are other switch (or cascading if-else) statements that fall through to an error condition that should be/can be addressed for `constant_dynamic` handling. TY!
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1441898238
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -89,6 +89,8 @@ public Type getType(final ConstantPoolGen cpg) {
return Type.INT;
case org.apache.bcel.Const.CONSTANT_Class:
return Type.CLASS;
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
Review Comment:
Warning->Tangent: I wonder why we case Float but not Double.
https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.10.1.9.ldc
--
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] [BCEL-370] CONSTANT_Dynamic is not handled in LDC [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1880116684
Hello @gtoison
Now that this PR is merged, do you plan on another PR soon? If yes, I'll wait to start the release cycle.
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877205250
Hum, you're right: I misread and thought it was only for long and double constants but it was also modified for dynamic constants.
Currently `LDC2_W.getValue()` returns a `Number` (while `LDC.getValue()` returns an `Object`. Updating it would require modifying the return type of the method, so it could be a breaking change for client code using BCEL.
It also remains an open question as to _what_ should be returned by `getValue()` since the value is computed at runtime.
I'll look into modifying LDC2_W as well, thanks for pointing this out!
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877072612
Hm, what about `LDC2_W`?
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1879075347
> For the unit tests I've noticed that [Mockito](https://github.com/mockito/mockito) doesn't seem to be on the project's (test) classpath. Is there any objection against adding it?
Fine with me.
--
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] [BCEL-370] CONSTANT_Dynamic is not handled in LDC [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1882568767
When using BCEL 4.8.1RC1 in https://github.com/spotbugs/spotbugs/pull/2807 the issue seems fixed indeed.
I still get an error but that's coming from SpotBugs itself, so it is another problem
--
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] [BCEL-370] CONSTANT_Dynamic is not handled in LDC [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1879821029
Thanks for merging!
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1443845828
##########
pom.xml:
##########
@@ -63,6 +63,8 @@
<commons.osgi.private />
<commons.jira.id>BCEL</commons.jira.id>
<commons.jira.pid>12314220</commons.jira.pid>
+ <mockito.version>5.8.0</mockito.version>
Review Comment:
Hello @gtoison
This version of Mockito depends on Java 11 and this project's baseline is Java 8. Please use a Java 8-based version. We can discuss separately raising the platform's Java requirement from Java 8 to 11. If you want to start this discussion, please do so on the developer's mailing list. see https://commons.apache.org/mail-lists.html
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1874039866
## [Codecov](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: `4 lines` in your changes are missing coverage. Please review.
> Comparison is base [(`20cf556`)](https://app.codecov.io/gh/apache/commons-bcel/commit/20cf556aad679dc4fc30a1cc027b138070fe8812?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 64.77% compared to head [(`01210d1`)](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 64.31%.
| [Files](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...g/apache/bcel/verifier/statics/Pass3aVerifier.java](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2JjZWwvdmVyaWZpZXIvc3RhdGljcy9QYXNzM2FWZXJpZmllci5qYXZh) | 0.00% | [1 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [src/main/java/org/apache/bcel/generic/LDC.java](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2JjZWwvZ2VuZXJpYy9MREMuamF2YQ==) | 50.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...el/verifier/structurals/InstConstraintVisitor.java](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2JjZWwvdmVyaWZpZXIvc3RydWN0dXJhbHMvSW5zdENvbnN0cmFpbnRWaXNpdG9yLmphdmE=) | 0.00% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #254 +/- ##
============================================
- Coverage 64.77% 64.31% -0.46%
+ Complexity 3878 3864 -14
============================================
Files 364 364
Lines 15677 15680 +3
Branches 1947 1941 -6
============================================
- Hits 10154 10084 -70
- Misses 4600 4681 +81
+ Partials 923 915 -8
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/commons-bcel/pull/254?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?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
Re: [PR] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1441898238
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -89,6 +89,8 @@ public Type getType(final ConstantPoolGen cpg) {
return Type.INT;
case org.apache.bcel.Const.CONSTANT_Class:
return Type.CLASS;
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
Review Comment:
Warning->Tangent: I wonder why we case Float but not Double.
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877270405
@gtoison
Note that I'm OK and would actually prefer splitting out `LDC2_W` work into a separate PR. I'd also prefer we nail this PR down first, and get it merged. The PR behavior seems better that the current production code, at least it does not blow up 😉
I want to make sure all interested parties are OK with the current PR or if it needs another tweak.
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1875115443
@nbauma109
Any thoughts?
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1443847557
##########
pom.xml:
##########
@@ -63,6 +63,8 @@
<commons.osgi.private />
<commons.jira.id>BCEL</commons.jira.id>
<commons.jira.pid>12314220</commons.jira.pid>
+ <mockito.version>5.8.0</mockito.version>
Review Comment:
I've just pushed a commit to use Mockito 4 (so it should be compatible with java 8) and made the adjustments to the test because final methods/classes can't be mocked with Mockito 4
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877907283
Also note that out test coverage is not great (https://commons.apache.org/proper/commons-bcel/jacoco/index.html), so any help there would be appreciated
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1875230932
The change in `StringRepresentation.visitNestHost()` _seemed_ necessary because I tested with a sample from the Checkstyle project's build.
I've removed that sample from the test and also the change, hopefully it is better with that new commit.
It's probably a good idea to keep the changes limited to `LDC CONSTANT_Dynamic` anyway
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #254:
URL: https://github.com/apache/commons-bcel/pull/254
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1878993361
For the unit tests I've noticed that [Mockito](https://github.com/mockito/mockito) doesn't seem to be on the project's (test) classpath. Is there any objection against adding it?
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1441773107
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -109,6 +111,9 @@ public Object getValue(final ConstantPoolGen cpg) {
final int nameIndex = ((org.apache.bcel.classfile.ConstantClass) c).getNameIndex();
c = cpg.getConstantPool().getConstant(nameIndex);
return Type.getType(Type.internalTypeNameToSignature(((org.apache.bcel.classfile.ConstantUtf8) c).getBytes()));
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
+ // Really not sure what to return here, maybe a BootstrapMethod instance but how do we get it?
+ return c;
Review Comment:
I suppose, maybe later, we can invent a `ConstantDynamic` proxy class where you'd say here `new ConstantDynamic(c)` for a later handling, possibly by BCEL call sites themselves. I don't see how an `LDC`, `ConstantPoolGen` and `Attribute` containing the needed data intersect from 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
Re: [PR] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877760451
Thanks for checking @JuditKnoll
I think I could come up with something sensible for [ConstantPoolX.constantToString()](https://github.com/apache/commons-bcel/blob/master/src/test/java/org/apache/bcel/data/ConstantPoolX.java#L96) but [ConstantPoolGen.addConstant()](https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java#L275) seems outside of the scope of this PR
@garydgregory, shall I add a new line to [src/changes/changes.xml](https://github.com/apache/commons-bcel/blob/fbc58b1d4693048c50849be2027a9b526ab4c462/src/changes/changes.xml)?
Regarding the coverage: the updated/uncovered lines are in the logic for rejecting invalid classes, so the case of a valid class is covered, but an invalid case isn't (e.g `LDC CONSTANT_Module`)
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1875314362
@gtoison
Thank you for your updates. We have green builds.
Note that the coverage report thinks there is something missing: https://github.com/apache/commons-bcel/pull/254#issuecomment-1874039866
Now, let's see if @nbauma109, @JuditKnoll, or anyone else has any thoughts.
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1443845828
##########
pom.xml:
##########
@@ -63,6 +63,8 @@
<commons.osgi.private />
<commons.jira.id>BCEL</commons.jira.id>
<commons.jira.pid>12314220</commons.jira.pid>
+ <mockito.version>5.8.0</mockito.version>
Review Comment:
Hello @gtoison
Version 5.8.0 of Mockito depends on Java 11 and this project's baseline is Java 8. Please use a Java 8-based version. We can discuss separately raising the platform's Java requirement from Java 8 to 11. If you want to start this discussion, please do so on the developer's mailing list. see https://commons.apache.org/mail-lists.html
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1440540961
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -109,6 +111,9 @@ public Object getValue(final ConstantPoolGen cpg) {
final int nameIndex = ((org.apache.bcel.classfile.ConstantClass) c).getNameIndex();
c = cpg.getConstantPool().getConstant(nameIndex);
return Type.getType(Type.internalTypeNameToSignature(((org.apache.bcel.classfile.ConstantUtf8) c).getBytes()));
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
+ // Really not sure what to return here, maybe a BootstrapMethod instance but how do we get it?
+ return c;
Review Comment:
Any guidance or pointer would be very helpful here: my understanding is that the _value_ should be the return of the invocation of a bootstrap method, so it could be anything.
I'm not sure what's the best way for BCEL to convey this information because even the type of this value does not seem to be available 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
Re: [PR] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1441434251
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -109,6 +111,9 @@ public Object getValue(final ConstantPoolGen cpg) {
final int nameIndex = ((org.apache.bcel.classfile.ConstantClass) c).getNameIndex();
c = cpg.getConstantPool().getConstant(nameIndex);
return Type.getType(Type.internalTypeNameToSignature(((org.apache.bcel.classfile.ConstantUtf8) c).getBytes()));
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
+ // Really not sure what to return here, maybe a BootstrapMethod instance but how do we get it?
+ return c;
Review Comment:
Yes, I was wondering if there's already something in BCEL to account for values known at runtime.
For other constant types `LDC.getValue()` returns the actual value (or a `Type` in case it's a class), so returning the constant itself might be a bit misleading 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
Re: [PR] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "JuditKnoll (via GitHub)" <gi...@apache.org>.
JuditKnoll commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877654007
Thank you very much for your PR @gtoison!
I looked at the usages of `Const.CONSTANT_Integer`, and found two functions where `Const.CONSTANT_Dynamic` is not handled, but I think it should be:
- [ConstantPoolX.constantToString()](https://github.com/apache/commons-bcel/blob/master/src/test/java/org/apache/bcel/data/ConstantPoolX.java#L96),
- [ConstantPoolGen.addConstant()](https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java#L275).
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1875267474
Thanks for approving the builds. I've made some changes to fix the checkstyle violations
When running the build on my computer I had many many violations about line endings (expected LF but got CRLF) so I missed these violations
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1879794950
I've added some tests checking that the verifier rejects LDC with an unsupported constant
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1443850745
##########
pom.xml:
##########
@@ -63,6 +63,8 @@
<commons.osgi.private />
<commons.jira.id>BCEL</commons.jira.id>
<commons.jira.pid>12314220</commons.jira.pid>
+ <mockito.version>5.8.0</mockito.version>
Review Comment:
OK, green build.
--
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] [BCEL-370] CONSTANT_Dynamic is not handled in LDC [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1880151108
I don't plan another PR right now, I think you can start the release.
Thanks!
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1874079078
Hello @gtoison
Thank you for your report and PR.
Please see the build failures on Java 11 and up.
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1874995398
Hello @garydgregory,
I have added a test to improve the coverage but I'm not sure what to do with `StringRepresentation.visitNestHost()`. I saw that the verifier failed because it was not implemented, so I've added it.
But there's also this unit test checking that it is NOT implemented: https://github.com/apache/commons-bcel/blame/20cf556aad679dc4fc30a1cc027b138070fe8812/src/test/java/org/apache/bcel/verifier/VerifierTestCase.java#L100
Is it not implemented on purpose, maybe for compatibility with various JDK versions?
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1877883989
In general, I feel it's best not to edit changes.xml as it could create conflicts with other PRs.
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "gtoison (via GitHub)" <gi...@apache.org>.
gtoison commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1441908638
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -89,6 +89,8 @@ public Type getType(final ConstantPoolGen cpg) {
return Type.INT;
case org.apache.bcel.Const.CONSTANT_Class:
return Type.CLASS;
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
Review Comment:
For a Double (or a Long) the instruction would be `LDC2_W` I think, because it is wider
--
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] [BCEL-370] CONSTANT_Dynamic is not handled in LDC [commons-bcel]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#issuecomment-1880161453
FYI: You can track the vote thread here: https://lists.apache.org/thread/29vnv2xdr2hkh7j5bmn0f23vz6pd8dfj
--
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] Tests and proposed fix for BCEL-370 [commons-bcel]
Posted by "nbauma109 (via GitHub)" <gi...@apache.org>.
nbauma109 commented on code in PR #254:
URL: https://github.com/apache/commons-bcel/pull/254#discussion_r1441409944
##########
src/main/java/org/apache/bcel/generic/LDC.java:
##########
@@ -109,6 +111,9 @@ public Object getValue(final ConstantPoolGen cpg) {
final int nameIndex = ((org.apache.bcel.classfile.ConstantClass) c).getNameIndex();
c = cpg.getConstantPool().getConstant(nameIndex);
return Type.getType(Type.internalTypeNameToSignature(((org.apache.bcel.classfile.ConstantUtf8) c).getBytes()));
+ case org.apache.bcel.Const.CONSTANT_Dynamic:
+ // Really not sure what to return here, maybe a BootstrapMethod instance but how do we get it?
+ return c;
Review Comment:
The value of a constant dynamic is only known at runtime, so I guess it can only return an arbitrary value ?
--
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