[code-reflection] RFR: 8324556: Not copy result-type when copying an op [v3]

Mourad Abbay mabbay at openjdk.org
Tue Jan 30 18:57:23 UTC 2024


On Tue, 30 Jan 2024 01:35:36 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Review
>>  - Add test
>
> src/java.base/share/classes/java/lang/reflect/code/op/CoreOps.java line 1665:
> 
>> 1663:             @Override
>> 1664:             public TypeDesc resultType() {
>> 1665:                 // resultType is void, but we still call resultType method because it has validations in it
> 
> I think we should avoid specific validations in the call to `resultType()`, since it defers errors until the method is called.
> 
> In general i think we should separate out op specific validation into a separate method that ops can optionally implement (future work). The op constructors can perform some basic structural checks e.g., correct number of operands etc.
> 
> I have found checks on types when constructing ops (and by extension on a call to resultType) to sometimes be problematic, they can be fragile or too opinionated depending on how one consumes the model, and it seems they should reside in explicit validation functionality that can be optionally called.

For now, should I validate during construction ?

-------------

PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1471788562


More information about the babylon-dev mailing list