[ https://issues.apache.org/jira/browse/LANG-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950374#comment-17950374 ]
Gary D. Gregory commented on LANG-1773: --------------------------------------- I would not want to use reflection but what about rewriting the method to use a stream? > Apache Commons Lang no longer builds on Android > ----------------------------------------------- > > Key: LANG-1773 > URL: https://issues.apache.org/jira/browse/LANG-1773 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* > Reporter: Éamonn McManus > Priority: Major > > Google periodically imports various open source projects into the [Google > Monorepo|https://research.google/pubs/why-google-stores-billions-of-lines-of-code-in-a-single-repository] > > [.|https://research.google/pubs/why-google-stores-billions-of-lines-of-code-in-a-single-repository/].] > When I attempted to do that for Commons Lang, I found that it no longer > builds against the Android API. The reason is that [this > commit|https://github.com/apache/commons-lang/commit/c4007c4a24eafbed53109e4b0376b4fd0ba01b56] > introduced a usage of `java.lang.reflect.AnnotatedType`, but that interface > doesn't exist on Android ([Android > `java.lang.reflect`|https://developer.android.com/reference/java/lang/reflect/package-summary]). > The open-source Commons Lang is probably not built against the Android API, > but the built artifacts get used there, and this code could lead to bizarre > runtime failures. > I was able to patch the code so that it uses reflection to access > `AnnotatedType`, and I could make a PR with that change if that is helpful. > Then if `AnnotatedType` doesn't exist, the private `TypeUtils.isCyclical` > method just returns false. Or perhaps the test for these cyclical types could > work some other way that doesn't involve `AnnotatedType`. > Alternatively, if this is unlikely to be useful to users outside Google, we > can maintain a private patch. -- This message was sent by Atlassian Jira (v8.20.10#820010)