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

Deduplicate tags to unique jni::Tag<...> types #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kkaefer
Copy link
Member

@kkaefer kkaefer commented Apr 27, 2017

Convert Tag types to jni::Tag<char...> types before instantiating the Object/Class/Method/Constructor/StaticMethod/Field/StaticField types. This removes a source of error where two Tag types returning the same string yielded incompatible Object/... types. Instead of templating these by Tag, we generate a jni::Tag<char...> type like jni::Type<'j', 'a', 'v', 'a', '/', 'l', 'a', 'n', 'g', '/', 'O', 'b', 'j', 'e', 'c', 't'>, which means that two distinct Tags produce the identical type if the returned string is identical.

The primary change is the rename from Object to TypedObject, with a type alias from Object => TypedObject. Then, I changed TypeObject to only have a specialization when the TagType is a jni::Tag, and the type alias automatically converts the tag to a Type type. Same applies to the other entities.

This means that it should be largely backwards-compatible.

Convert Tag types to jni::Tag<char...> types before instantiating the
Object/Class/Method/Constructor/StaticMethod/Field/StaticField types. This removes a source of error
where two Tag types returning the same string yielded incompatible Object/... types. Instead of
templating these by Tag, we generate a jni::Tag<char...> type like
jni::Type<'j', 'a', 'v', 'a', '/', 'l', 'a', 'n', 'g', '/', 'O', 'b', 'j', 'e', 'c', 't'>, which
means that two distinct Tags produce the identical type if the returned string is identical.
@kkaefer kkaefer requested a review from jfirebaugh April 27, 2017 14:25
@jfirebaugh
Copy link
Contributor

Trying to gauge the benefits of this versus the added complexity. What are the consequence of mistakenly having two types returning the same string? Just that code you expected to work doesn't compile? Did this come up in mapbox-gl-native somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants