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
Regex.unapplySeq not null safe #8787
Milestone
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8787?orig=1 |
@som-snytt said: |
eed3si9n
added a commit
to eed3si9n/scala
that referenced
this issue
Apr 1, 2018
Ref scala/bug#4364 This is a general fix for scala/bug#2241 and scala/bug#8787. scala/bug#4364 raises the question of what should the pattern matcher do when encountering a `null` and an extractor pattern. As it stands, SLS does not say anything about `null` for extractor pattern, which leads: - Pattern matcher will happily pass `null` into your extractor. - I can write a `null`-matching extractor MyNull. - Thus, all extractor authors must check for `null` if they would like to access the passed in argument `x`. There are potentially two things we can do. 1. Be ok with the status quo. Clarify in SLS that all extractor authors must handle `null`. 2. Not be ok with the status quo. Change SLS and implementation such that `null` is treated as no match (empty). I've already sent option 1 as scala#6374. This implements option 2.
eed3si9n
added a commit
to eed3si9n/scala
that referenced
this issue
Apr 1, 2018
Ref scala/bug#4364 This is a general fix for scala/bug#2241 and scala/bug#8787. scala/bug#4364 raises the question of what should the pattern matcher do when encountering a `null` and an extractor pattern. As it stands, SLS does not say anything about `null` for extractor pattern, which leads: - Pattern matcher will happily pass `null` into your extractor. - I can write a `null`-matching extractor MyNull. - Thus, all extractor authors must check for `null` if they would like to access the passed in argument `x`. There are potentially two things we can do. 1. Be ok with the status quo. Clarify in SLS that all extractor authors must handle `null`. 2. Not be ok with the status quo. Change SLS and implementation such that `null` is treated as no match (empty). I've already sent option 1 as scala#6374. This implements option 2.
eed3si9n
added a commit
to eed3si9n/scala
that referenced
this issue
Apr 12, 2018
Ref scala/bug#4364 This is a general fix for scala/bug#2241 and scala/bug#8787. scala/bug#4364 raises the question of what should the pattern matcher do when encountering a `null` and an extractor pattern. As it stands, SLS does not say anything about `null` for extractor pattern, which leads: - Pattern matcher will happily pass `null` into your extractor. - I can write a `null`-matching extractor MyNull. - Thus, all extractor authors must check for `null` if they would like to access the passed in argument `x`. There are potentially two things we can do. 1. Be ok with the status quo. Clarify in SLS that all extractor authors must handle `null`. 2. Not be ok with the status quo. Change SLS and implementation such that `null` is treated as no match (empty). I've already sent option 1 as scala#6374. This implements option 2.
eed3si9n
added a commit
to eed3si9n/scala
that referenced
this issue
May 4, 2018
Ref scala/bug#4364 This is a general fix for scala/bug#2241 and scala/bug#8787. scala/bug#4364 raises the question of what should the pattern matcher do when encountering a `null` and an extractor pattern. As it stands, SLS does not say anything about `null` for extractor pattern, which leads: - Pattern matcher will happily pass `null` into your extractor. - I can write a `null`-matching extractor MyNull. - Thus, all extractor authors must check for `null` if they would like to access the passed in argument `x`. There are potentially two things we can do. 1. Be ok with the status quo. Clarify in SLS that all extractor authors must handle `null`. 2. Not be ok with the status quo. Change SLS and implementation such that `null` is treated as no match (empty). I've already sent option 1 as scala#6374. This implements option 2.
adriaanm
pushed a commit
to eed3si9n/scala
that referenced
this issue
Jun 1, 2018
Until now, the spec did not say anything about `null` for extractor pattern, so that: - The pattern matcher would happily pass `null` into your extractor. - One could write a `null`-matching extractor `MyNull`. - But all extractor authors must consider `null` as a possible argument value. No more! The pattern matcher inserts a non-`null` check before invoking an extractor, so that you don't have to. This is a general fix for scala/bug#2241, scala/bug#8787. See scala/bug#4364.
eed3si9n
added a commit
to eed3si9n/scala
that referenced
this issue
Jun 2, 2018
Until now, the spec did not say anything about `null` for extractor pattern, so that: - The pattern matcher would happily pass `null` into your extractor. - One could write a `null`-matching extractor `MyNull`. - But all extractor authors must consider `null` as a possible argument value. No more! The pattern matcher inserts a non-`null` check before invoking an extractor, so that you don't have to. This is a general fix for scala/bug#2241, scala/bug#8787. See scala/bug#4364.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NullPointerException occurs when Regex.unapplySeq is called with null.
See: https://groups.google.com/forum/#!topic/scala-language/_IAaYPUUL1s
The error message:
The text was updated successfully, but these errors were encountered: