Clojure

Regression in reflectively finding default methods

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Completed
  • Affects Version/s: Release 1.10
  • Fix Version/s: Release 1.10
  • Component/s: None
  • Environment:
    Java 9+
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

CLJ-2066 introduced a new reflective walk for matching accessible methods but the logic in that walk assumes it will find a method in the superclass hierarchy. If it does not, then it will produce an infinite loop.

This is an example of a concrete class (sun.nio.fs.UnixPath) which has a method startsWith which is declared as a default method on java.nio.file.Path:

(def p (java.nio.file.Paths/get "src" (into-array String [])))
(.startsWith p "s")

Proposed: Instead, should walk all super classes, then walk all interfaces to find an accessible default method.

Patch: clj-2414-2.patch

  1. clj-2414.patch
    07/Oct/18 10:08 AM
    3 kB
    Alex Miller
  2. clj-2414-2.patch
    07/Oct/18 10:34 AM
    4 kB
    Alex Miller

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: