-
Notifications
You must be signed in to change notification settings - Fork 300
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
#187
Comments
alexfedorenchik
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Oct 5, 2019
…n array. Issue: TNG#187 Signed-off-by: Alexander Fedorenchik <alexander.fedorenchik@gmail.com>
codecholeric
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…Guava AssertJ Issue: TNG#187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…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>
codecholeric
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…n array (or we've already checked javaClass.isArray()) Issue: TNG#187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric
pushed a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…n array. Issue: TNG#187 Signed-off-by: Alexander Fedorenchik <alexander.fedorenchik@gmail.com>
codecholeric
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…Guava AssertJ Issue: TNG#187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…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>
codecholeric
added a commit
to alexfedorenchik/ArchUnit
that referenced
this issue
Nov 3, 2019
…n array (or we've already checked javaClass.isArray()) Issue: TNG#187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric
pushed a commit
that referenced
this issue
Feb 21, 2021
…n array. Issue: #187 Signed-off-by: Alexander Fedorenchik <alexander.fedorenchik@gmail.com>
codecholeric
added a commit
that referenced
this issue
Feb 21, 2021
…Guava AssertJ Issue: #187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric
added a commit
that referenced
this issue
Feb 21, 2021
…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: #187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric
added a commit
that referenced
this issue
Feb 21, 2021
…n array (or we've already checked javaClass.isArray()) Issue: #187 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As a follow up of #114 we should offer a way to get the component type of an array (compare the Java Reflection API ->
arrayClass.getComponentType()
)For example a
JavaClass
representing an arraycom.some.Foo[]
should returncom.some.Foo
as the component type. Likewisecom.some.Foo[][]
should returncom.some.Foo[]
as its component type.On the contrary to the Reflection API and to be consistent with ArchUnit's API, we should call this method
and return
Optional.absent()
if the respectiveJavaClass
is no array type. Additionally we could offerJavaClass getComponentType()
throwing an exception if theJavaClass
is no array type for cases where the nature of theJavaClass
is already known.Note: The
JavaType
withinJavaClass
already offers a methodSo to implement the feature during class creation the respective
JavaType.getName()
must be resolved against the matchingJavaClass
.The text was updated successfully, but these errors were encountered: