Consider a class or interface, marked as preview. And let this class or interface have a a method, not itself marked as preview. This method is "effectively-preview". And a class inside the JDK, which extends the class or implements the interface, but is itself not a preview (i.e. it is participating in preview, not being preview itself). In particular:
```
package jdk.test;
@PreviewFeature
public interface PreviewInterface {
public default void test() {}
}
```
````
package jdk.test;
public final class NotPreview implements PreviewInterface {}
```
javac will produce no error or warning in the following two cases, involving the effectively-preview "test" method:
- when invoking the method on `NotPreview`:
```
NotPreview np = ...;
np.test();
```
- when extending `NotPreview` and overriding the method:
```
public class C extends NotPreview {
public void test() {}
}
```
javac should produce preview errors/warnings for these cases.
```
package jdk.test;
@PreviewFeature
public interface PreviewInterface {
public default void test() {}
}
```
````
package jdk.test;
public final class NotPreview implements PreviewInterface {}
```
javac will produce no error or warning in the following two cases, involving the effectively-preview "test" method:
- when invoking the method on `NotPreview`:
```
NotPreview np = ...;
np.test();
```
- when extending `NotPreview` and overriding the method:
```
public class C extends NotPreview {
public void test() {}
}
```
javac should produce preview errors/warnings for these cases.
- csr for
-
JDK-8343695 Report preview error for inherited effectively-preview methods
-
- Closed
-
- links to
-
Commit(master) openjdk/jdk/56d315da
-
Review(master) openjdk/jdk/21953