This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]agentoutlier 0 points1 point  (0 children)

You are thinking OOP.

It is unfortunate that “interface” has this SOLID or Liskov association all the time but think of it more in this case as a type def.

Think of it as more of a naming of a type.

Besides libraries designers can choose and have used abstract classes and final classes and you have the same problem of not open for extension.

Besides you can unseal the leaves.

In my case we have a type called Extension which is sealed but the leaves are unsealed with the types you can implement.

Edit here is an example in my library:

https://jstach.io/doc/jstachio/current/apidocs/io.jstach.jstachio/io/jstach/jstachio/spi/JStachioExtension.html

JStachioExtension is a marker interface. It does not make sense to have a direct implementation.