[MDSAL-224] Binding DTOs unvalidated _value constructor Created: 20/Jan/17  Updated: 16/Mar/19

Status: Confirmed
Project: mdsal
Component/s: Binding codegen
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 7604

 Description   

StringValueObjectFactory should not need be necessary to instantiate DTOs which have an already-validated value.

That method needs to require a marker singleton object, whose use needs to carry same warnings as StringValueObjectFactory.

We need to eliminate StringValueObjectFactory in general the use of Field.setAccessible() overrides.



 Comments   
Comment by Robert Varga [ 20/Jan/17 ]

an example API would be:

package mdsal.binding.javav2.spec;
enum UsageProof {
// Proof for methods requiring 'unsafe API' proof
UNSAFE
};

And a typedef DTO would look like:

public class FooLeaf {
// Needs to be protected, for unsafe instantiation of subclasses
protected FooLeaf(String unsafe, Void unused)

{ this.value = unsafe; }

static FooLeaf createUnsafe(UsageProof proof, String unsafe)

{ Verify.verify(proof == UsageProof.UNSAFE); return new FooLeaf(unsafe); }

}

Generated at Wed Feb 07 20:09:08 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.