Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types for Signatures are not sanitized #43

Closed
Clashsoft opened this issue Aug 17, 2020 · 0 comments · Fixed by #59
Closed

Types for Signatures are not sanitized #43

Clashsoft opened this issue Aug 17, 2020 · 0 comments · Fixed by #59
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Clashsoft
Copy link
Member

Clashsoft commented Aug 17, 2020

Summary

Signatures, i.e. the keys used to replace fragments of class files, are not properly sanitized when constructed from attribute or method types.

Example

If an attribute bar has type Map<String, @NonNull Object>, it initially generates fragments with signatures like class/Foo/method/setBar(Map<String, @NonNull Object>). When parsing the generated file in the next run, the method is parsed with the (correct) signature class/Foo/method/setBar(Map<String,Object>) - note the lack of the annotations and the missing space after the comma. The obvious mismatch causes a second method to be generated.

Solution

The solution is to sanitize the user-supplied types like Map<String, @NonNull Object> and transform them for use in signatures, in this case Map<String,Object>. The implementation for the method parser can be mostly reused in this regard.

@Clashsoft Clashsoft added the bug Something isn't working label Aug 17, 2020
@Clashsoft Clashsoft self-assigned this Aug 17, 2020
@Clashsoft Clashsoft added this to the v1.2.2 milestone Aug 25, 2020
Clashsoft added a commit that referenced this issue Aug 25, 2020
When setting the type of an attribute, the signature for that type is
now automatically computed and stored in the typeSignature property.

See #43
Clashsoft added a commit that referenced this issue Aug 25, 2020
When setting the type of an attribute, the signature for that type is
now automatically computed and stored in the typeSignature property.

See #43
Clashsoft added a commit that referenced this issue Aug 25, 2020
The FMethod.getSignature method now utilizes the signature building
mechanics of FragmentMapBuilder.

See #43
@Clashsoft Clashsoft linked a pull request Aug 25, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant