-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
25
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
For context, I wanted to have a static reference to a java.lang.foregin.Linker, so as to have static access to canonicalLayouts for construction of StructLayouts and the like, and in order to protect against Linker.nativeLinker() throwing unexpected exceptions, I wanted to write a "class NoLinker implements Linker", which just does the bare minimum to not crash when constructing static values (like to return some non-null value from canonicalLayouts().get(), for example). However, I'm told that java.lang.foreign.Linker is a sealed interface for some reason, and that puts a wrench in my wheel.
The reason I'm filing this as a bug is because I can't see any useful reason for java.lang.foreign.Linker to be sealed, so I'm kind of assuming that it is some sort of oversight, but feel free to correct me, I guess. To be clear, I have other ways around this problem, but I don't see that I should need to use them.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to implement a
public class NoLinker implements java.lang.foreign.Linker {
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Get compilation errors for the missing implementation methods.
ACTUAL -
Actually get a compilation errors that Linker is a sealed interface that I'm not allowed to implement.
For context, I wanted to have a static reference to a java.lang.foregin.Linker, so as to have static access to canonicalLayouts for construction of StructLayouts and the like, and in order to protect against Linker.nativeLinker() throwing unexpected exceptions, I wanted to write a "class NoLinker implements Linker", which just does the bare minimum to not crash when constructing static values (like to return some non-null value from canonicalLayouts().get(), for example). However, I'm told that java.lang.foreign.Linker is a sealed interface for some reason, and that puts a wrench in my wheel.
The reason I'm filing this as a bug is because I can't see any useful reason for java.lang.foreign.Linker to be sealed, so I'm kind of assuming that it is some sort of oversight, but feel free to correct me, I guess. To be clear, I have other ways around this problem, but I don't see that I should need to use them.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to implement a
public class NoLinker implements java.lang.foreign.Linker {
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Get compilation errors for the missing implementation methods.
ACTUAL -
Actually get a compilation errors that Linker is a sealed interface that I'm not allowed to implement.