JDK-8243577 : odd set of errors in jshell with sealed classes
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2020-04-24
  • Updated: 2021-09-02
  • Resolved: 2020-06-03
Related Reports
Duplicate :  
Description
it is possible to define a sealed intf, and permitted subclass but can't be used

jshell> sealed interface Foo permits X {
   ...>     public int x();
   ...> }
|  created interface Foo, however, it cannot be referenced until class X is declaredjshell> class X implements Foo { public int x() { return 3; } }
|  created class X, however, it cannot be referenced until class Foo is declaredjshell> new X()
|  Error:
|  cannot find symbol
|    symbol:   class X
|  new X()
|      ^