1. Using preview language feature

1.1. With --enable-preview

1.1.1. Usages suppressed with @SuppressWarnings

1.1.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/1/Test.java:-1:NOTE: /1/Test.java uses preview features of Java SE 16.
/1/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.
1.1.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/15/Test.java:5:MANDATORY_WARNING: pattern matching in instanceof is a preview feature and may be removed in a future release.
Test.class is marked as a preview class file.
1.1.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/29/Test.java:-1:NOTE: /29/Test.java uses preview features of Java SE 16.
/29/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.

1.1.2. Usages not suppressed with @SuppressWarnings

1.1.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/8/Test.java:-1:NOTE: /8/Test.java uses preview features of Java SE 16.
/8/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.
1.1.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/22/Test.java:5:MANDATORY_WARNING: pattern matching in instanceof is a preview feature and may be removed in a future release.
Test.class is marked as a preview class file.
1.1.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/36/Test.java:-1:NOTE: /36/Test.java uses preview features of Java SE 16.
/36/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.

1.2. Without --enable-preview

1.2.1. Usages suppressed with @SuppressWarnings

1.2.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/43/Test.java:5:ERROR: pattern matching in instanceof is a preview feature and is disabled by default.
  (use --enable-preview to enable pattern matching in instanceof)
Does not compile.
1.2.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/57/Test.java:5:ERROR: pattern matching in instanceof is a preview feature and is disabled by default.
  (use --enable-preview to enable pattern matching in instanceof)
Does not compile.
1.2.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/71/Test.java:5:ERROR: pattern matching in instanceof is a preview feature and is disabled by default.
  (use --enable-preview to enable pattern matching in instanceof)
Does not compile.

1.2.2. Usages not suppressed with @SuppressWarnings

1.2.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/50/Test.java:5:ERROR: pattern matching in instanceof is a preview feature and is disabled by default.
  (use --enable-preview to enable pattern matching in instanceof)
Does not compile.
1.2.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/64/Test.java:5:ERROR: pattern matching in instanceof is a preview feature and is disabled by default.
  (use --enable-preview to enable pattern matching in instanceof)
Does not compile.
1.2.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        boolean b = o instanceof String s;
    }
}

/78/Test.java:5:ERROR: pattern matching in instanceof is a preview feature and is disabled by default.
  (use --enable-preview to enable pattern matching in instanceof)
Does not compile.

2. Using an element declared using a preview feature

Element declaration:

package user;
public record R(int i) {}

2.1. With --enable-preview

2.1.1. Usages suppressed with @SuppressWarnings

2.1.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}


Test.class is marked as a preview class file.
2.1.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/17/Test.java:-1:MANDATORY_WARNING: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
Test.class is marked as a preview class file.
2.1.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}


Test.class is marked as a preview class file.

2.1.2. Usages not suppressed with @SuppressWarnings

2.1.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/10/Test.java:-1:NOTE: /10/Test.java uses preview features of Java SE 16.
/10/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.
2.1.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/24/Test.java:-1:MANDATORY_WARNING: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
/24/Test.java:5:MANDATORY_WARNING: record user.R is declared using a preview feature, which may be removed in a future release.
/24/Test.java:5:MANDATORY_WARNING: record user.R is declared using a preview feature, which may be removed in a future release.
Test.class is marked as a preview class file.
2.1.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/38/Test.java:-1:NOTE: /38/Test.java uses preview features of Java SE 16.
/38/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.

2.2. Without --enable-preview

2.2.1. Usages suppressed with @SuppressWarnings

2.2.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/45/Test.java:-1:ERROR: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
  (use --enable-preview to allow loading of class files which contain preview features)
Does not compile.
2.2.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/59/Test.java:-1:ERROR: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
  (use --enable-preview to allow loading of class files which contain preview features)
Does not compile.
2.2.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/73/Test.java:-1:ERROR: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
  (use --enable-preview to allow loading of class files which contain preview features)
Does not compile.

2.2.2. Usages not suppressed with @SuppressWarnings

2.2.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/52/Test.java:-1:ERROR: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
  (use --enable-preview to allow loading of class files which contain preview features)
Does not compile.
2.2.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/66/Test.java:-1:ERROR: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
  (use --enable-preview to allow loading of class files which contain preview features)
Does not compile.
2.2.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        user.R d1; user.R d2;
    }
}

/80/Test.java:-1:ERROR: class file for ./classes/java.base/user/R.class uses preview features of Java SE 16.
  (use --enable-preview to allow loading of class files which contain preview features)
Does not compile.

3. Preview API

API source (part of java.base):

package preview.api;
public class Core {
    @jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.PATTERN_MATCHING_IN_INSTANCEOF
                                 , reflective=false)
    public static void test() { }
    @jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.PATTERN_MATCHING_IN_INSTANCEOF
                                 , reflective=false)
    public static class Clazz {}
}

3.1. With --enable-preview

3.1.1. Usages suppressed with @SuppressWarnings

3.1.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}


Test.class is marked as a preview class file.
3.1.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}


Test.class is marked as a preview class file.
3.1.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}


Test.class is marked as a preview class file.

3.1.2. Usages not suppressed with @SuppressWarnings

3.1.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/11/Test.java:-1:NOTE: /11/Test.java uses preview features of Java SE 16.
/11/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.
3.1.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/25/Test.java:5:MANDATORY_WARNING: test() is a preview API and may be removed in a future release.
/25/Test.java:6:MANDATORY_WARNING: preview.api.Core.Clazz is a preview API and may be removed in a future release.
Test.class is marked as a preview class file.
3.1.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/39/Test.java:-1:NOTE: /39/Test.java uses preview features of Java SE 16.
/39/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is marked as a preview class file.

3.2. Without --enable-preview

3.2.1. Usages suppressed with @SuppressWarnings

3.2.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/46/Test.java:5:ERROR: test() is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
/46/Test.java:6:ERROR: preview.api.Core.Clazz is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
Does not compile.
3.2.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/60/Test.java:5:ERROR: test() is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
/60/Test.java:6:ERROR: preview.api.Core.Clazz is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
Does not compile.
3.2.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/74/Test.java:5:ERROR: test() is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
/74/Test.java:6:ERROR: preview.api.Core.Clazz is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
Does not compile.

3.2.2. Usages not suppressed with @SuppressWarnings

3.2.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/53/Test.java:5:ERROR: test() is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
/53/Test.java:6:ERROR: preview.api.Core.Clazz is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
Does not compile.
3.2.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/67/Test.java:5:ERROR: test() is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
/67/Test.java:6:ERROR: preview.api.Core.Clazz is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
Does not compile.
3.2.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Core.test();
preview.api.Core.Clazz c;

    }
}

/81/Test.java:5:ERROR: test() is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
/81/Test.java:6:ERROR: preview.api.Core.Clazz is a preview API and is disabled by default.
  (use --enable-preview to enable preview APIs)
Does not compile.

4. Reflective Preview API

API source (part of java.base):

package preview.api;
public class Reflect {
    @jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.PATTERN_MATCHING_IN_INSTANCEOF
                                 , reflective=true)
    public static void test() { }
    @jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.PATTERN_MATCHING_IN_INSTANCEOF
                                 , reflective=true)
    public static class Clazz {}
}

4.1. With --enable-preview

4.1.1. Usages suppressed with @SuppressWarnings

4.1.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}


Test.class is NOT marked as a preview class file.
4.1.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}


Test.class is NOT marked as a preview class file.
4.1.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}


Test.class is NOT marked as a preview class file.

4.1.2. Usages not suppressed with @SuppressWarnings

4.1.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}

/12/Test.java:-1:NOTE: /12/Test.java uses preview features of Java SE 16.
/12/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is NOT marked as a preview class file.
4.1.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}

/26/Test.java:5:MANDATORY_WARNING: test() is a reflective preview API and may be removed in a future release.
/26/Test.java:6:MANDATORY_WARNING: preview.api.Reflect.Clazz is a reflective preview API and may be removed in a future release.
Test.class is NOT marked as a preview class file.
4.1.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}

/40/Test.java:-1:NOTE: /40/Test.java uses preview features of Java SE 16.
/40/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is NOT marked as a preview class file.

4.2. Without --enable-preview

4.2.1. Usages suppressed with @SuppressWarnings

4.2.1.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}


Test.class is NOT marked as a preview class file.
4.2.1.2. With -Xlint:preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}


Test.class is NOT marked as a preview class file.
4.2.1.3. With -Xlint:-preview
package test;
public class Test {
    @SuppressWarnings("preview")
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}


Test.class is NOT marked as a preview class file.

4.2.2. Usages not suppressed with @SuppressWarnings

4.2.2.1. Neither -Xlint:preview nor -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}

/54/Test.java:5:MANDATORY_WARNING: test() is a reflective preview API and may be removed in a future release.
/54/Test.java:6:MANDATORY_WARNING: preview.api.Reflect.Clazz is a reflective preview API and may be removed in a future release.
Test.class is NOT marked as a preview class file.
4.2.2.2. With -Xlint:preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}

/68/Test.java:5:MANDATORY_WARNING: test() is a reflective preview API and may be removed in a future release.
/68/Test.java:6:MANDATORY_WARNING: preview.api.Reflect.Clazz is a reflective preview API and may be removed in a future release.
Test.class is NOT marked as a preview class file.
4.2.2.3. With -Xlint:-preview
package test;
public class Test {
    
    public void test(Object o) {
        preview.api.Reflect.test();
preview.api.Reflect.Clazz c;

    }
}

/82/Test.java:-1:NOTE: /82/Test.java uses preview features of Java SE 16.
/82/Test.java:-1:NOTE: Recompile with -Xlint:preview for details.
Test.class is NOT marked as a preview class file.