test/langtools/tools/javac/warnings/Serial.java
author darcy
Fri, 02 Feb 2018 10:29:25 -0800
changeset 48723 6cb86bf0b51e
parent 47216 71c04702a3d5
permissions -rw-r--r--
8196623: Update JavaBaseTest.java to be version agnostic Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
27119
b80b6a2e137f 8058410: Group 10b: golden files for tests in tools/javac dir
sogoel
parents: 10202
diff changeset
     2
 * @test /nodynamiccopyright/
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug 4986256
27119
b80b6a2e137f 8058410: Group 10b: golden files for tests in tools/javac dir
sogoel
parents: 10202
diff changeset
     4
 * @compile/ref=Serial.out -XDrawDiagnostics -Xlint:all Serial.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
import java.io.Serializable;
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
// control: this class should generate warnings
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
class Serial implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
{
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
    static class Inner implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
    @SuppressWarnings("serial")
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
    void m() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
        class Inner implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
// tests: the warnings that would otherwise be generated should all be suppressed
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
@SuppressWarnings("serial")
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
class Serial1 implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
{
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
    static class Inner implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
class Serial2
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
{
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
    @SuppressWarnings("serial")
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
    static class Inner implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
    @SuppressWarnings("serial")
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
    void m() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
        class Inner implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
// this class should produce warnings because @SuppressWarnings should not be inherited
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
class Serial3 extends Serial1
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
{
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    static class Inner implements Serializable
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
}