ADDITIONAL SYSTEM INFORMATION :
```
$ java --version
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12)
OpenJDK 64-Bit Server VM (build 17.0.1+12, mixed mode)
$ jshell --version
jshell 17.0.1
```
A DESCRIPTION OF THE PROBLEM :
If there are some circularly-required classes in some specific way, they cannot be defined in jshell.
Related bug: https://bugs.openjdk.java.net/browse/JDK-8137064 but that one is fixed. This one still persist in Java 17.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Type into jshell:
```
class Y{ X x; }
class X extends Y{
@Override
public String toString() {
return "";
}
}
```
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Two classes `X` and `Y` are created.
ACTUAL -
Error messages:
```
| Error:
| cannot find symbol
| symbol: class Y
| class X extends Y{
| ^
| Error:
| method does not override or implement a method from a supertype
| @Override
| ^-------^
```
---------- BEGIN SOURCE ----------
See "steps to reproduce" above.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
It's possible to workaround by defining an empty class `X`, then define the class `X` as the actual one.
```
$ java --version
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12)
OpenJDK 64-Bit Server VM (build 17.0.1+12, mixed mode)
$ jshell --version
jshell 17.0.1
```
A DESCRIPTION OF THE PROBLEM :
If there are some circularly-required classes in some specific way, they cannot be defined in jshell.
Related bug: https://bugs.openjdk.java.net/browse/JDK-8137064 but that one is fixed. This one still persist in Java 17.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Type into jshell:
```
class Y{ X x; }
class X extends Y{
@Override
public String toString() {
return "";
}
}
```
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Two classes `X` and `Y` are created.
ACTUAL -
Error messages:
```
| Error:
| cannot find symbol
| symbol: class Y
| class X extends Y{
| ^
| Error:
| method does not override or implement a method from a supertype
| @Override
| ^-------^
```
---------- BEGIN SOURCE ----------
See "steps to reproduce" above.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
It's possible to workaround by defining an empty class `X`, then define the class `X` as the actual one.
- relates to
-
JDK-8137064 JShell API: circular dependencies cause infinite circular update
-
- Resolved
-