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

Offer a way to retrieve the component type of a JavaClass that is an array #244

Merged
merged 4 commits into from
Nov 3, 2019

Conversation

alexfedorenchik
Copy link
Contributor

Issue: #187

Signed-off-by: Alexander Fedorenchik alexander.fedorenchik@gmail.com

@ghost
Copy link

ghost commented Oct 5, 2019

DeepCode Report (#d63d92)

DeepCode analyzed this pull request.
There are no new issues.

@alexfedorenchik
Copy link
Contributor Author

alexfedorenchik commented Oct 5, 2019

Not sure that I find the best way to propagate component type from JavaType to JavaClass,
so any feedback will be appreciated.

Also I suppose component type has to be considered in getDirectDependenciesFromSelf(), but may be it worth to do it with a separate PR.

And thanks a lot for the library.

alexfedorenchik and others added 4 commits November 3, 2019 15:36
…n array.

Issue: TNG#187

Signed-off-by: Alexander Fedorenchik <alexander.fedorenchik@gmail.com>
…Guava AssertJ

Issue: TNG#187
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
…esent. Background is, that if those component types are not referenced in another place (e.g. the two-dim component type is not also a field type somewhere, etc.), we will otherwise create a "simple" class stub here on the fly, and that simple stub will not get processed anymore and thus will not get any component type. In other words, the component type chain would then be broken.

Issue: TNG#187
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
…n array (or we've already checked javaClass.isArray())

Issue: TNG#187
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
@codecholeric
Copy link
Collaborator

Hey, thanks a lot for your contribution!! Looks good to me 😄
I've only found one corner case, namely if the component type is not referenced in another place, then for multi-dimensional arrays the component type chain might be broken.
This is, because if the type is referenced no earlier than that point, resolve will create a stub (for sure, because we never have byte code for an array type) and that stub is not going to be processed any further. Thus I've added some commit to ensure the whole chain is present, i.e. just walk up the component type chain and ensure every successive component type is present.

And yes, component types should be added to the dependencies of a class, but also yes, that's outside of this issue. I'll create a new one for that!

So thanks again 😃

@codecholeric codecholeric merged commit c077e0b into TNG:master Nov 3, 2019
codecholeric added a commit that referenced this pull request Feb 21, 2021
Offer a way to retrieve the component type of a `JavaClass` that is an array
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