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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support methods on arrays #4303

Open
piotrp opened this issue May 19, 2023 · 0 comments
Open

Support methods on arrays #4303

piotrp opened this issue May 19, 2023 · 0 comments
Labels

Comments

@piotrp
Copy link
Member

piotrp commented May 19, 2023

馃挜 Proposal

Allow to call methods on arrays, e.g. .contains, like this: new String[]{'a','b'}.contains('a'). Currently it ends with:

EL1004E: Method call: Method contains(java.lang.String) cannot be found on type java.lang.String[]

(in Sping's SpEL as well).

Without this using arrays requires users to use custom helpers like #COLLECTIONS.asJavaList("a,b,c".split(",")).contains("b").

Sounds simple until you realize that arrays are in fact plain objects and don't have any useful methods, so at the minimum:

  • type extraction would need to use some stand-in class, like Scala does with ArrayOps
  • SpEL would need to detect calls on arrays (probably in our custom MethodResolver) and use this stand-in class
  • possibly something more...
@piotrp piotrp changed the title Allow callijng methods on arrays Support methods on arrays May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant