Skip to content

Commit

Permalink
move tests to Deprecated9Tests for use of enhanced deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-herrmann committed Jul 6, 2024
1 parent 4c8df29 commit a3ec75b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,77 @@ public class AnnotatedClass {}
};
runner.runConformTest();
}
public void testJEP211_2() {
Runner runner = new Runner();
runner.testFiles = new String[] {
"p1/C1.java",
"""
package p1;
public class C1 {
@Deprecated public class CInner {}
@Deprecated(forRemoval=true) public static int ZERO = 0;
}
""",
"Test.java",
"""
import p1.C1.CInner;
import static p1.C1.ZERO;
public class Test {
CInner c;
int z = ZERO;
}
"""
};
runner.expectedCompilerLog = """
----------
1. WARNING in Test.java (at line 4)
CInner c;
^^^^^^
The type C1.CInner is deprecated
----------
2. WARNING in Test.java (at line 5)
int z = ZERO;
^^^^
The field C1.ZERO has been deprecated and marked for removal
----------
""";
runner.runWarningTest();
}
public void testJEP211_3() {
Runner runner = new Runner();
runner.testFiles = new String[] {
"p1/C1.java",
"""
package p1;
public class C1 {
@Deprecated public static int ZERO = 0;
@Deprecated public static int nothing() { return 0; };
}
""",
"Test.java",
"""
import static p1.C1.*;
public class Test {
int z = ZERO;
int zz = nothing();
}
"""
};
runner.expectedCompilerLog = """
----------
1. WARNING in Test.java (at line 3)
int z = ZERO;
^^^^
The field C1.ZERO is deprecated
----------
2. WARNING in Test.java (at line 4)
int zz = nothing();
^^^^^^^^^
The method nothing() from the type C1 is deprecated
----------
""";
runner.runWarningTest();
}
public static Class<?> testClass() {
return Deprecated9Test.class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,77 +987,6 @@ public class Test {
""";
runner.runWarningTest();
}
public void testJEP211_2() {
Runner runner = new Runner();
runner.testFiles = new String[] {
"p1/C1.java",
"""
package p1;
public class C1 {
@Deprecated public class CInner {}
@Deprecated(forRemoval=true) public static int ZERO = 0;
}
""",
"Test.java",
"""
import p1.C1.CInner;
import static p1.C1.ZERO;
public class Test {
CInner c;
int z = ZERO;
}
"""
};
runner.expectedCompilerLog = """
----------
1. WARNING in Test.java (at line 4)
CInner c;
^^^^^^
The type C1.CInner is deprecated
----------
2. WARNING in Test.java (at line 5)
int z = ZERO;
^^^^
The field C1.ZERO has been deprecated and marked for removal
----------
""";
runner.runWarningTest();
}
public void testJEP211_3() {
Runner runner = new Runner();
runner.testFiles = new String[] {
"p1/C1.java",
"""
package p1;
public class C1 {
@Deprecated public static int ZERO = 0;
@Deprecated public static int nothing() { return 0; };
}
""",
"Test.java",
"""
import static p1.C1.*;
public class Test {
int z = ZERO;
int zz = nothing();
}
"""
};
runner.expectedCompilerLog = """
----------
1. WARNING in Test.java (at line 3)
int z = ZERO;
^^^^
The field C1.ZERO is deprecated
----------
2. WARNING in Test.java (at line 4)
int zz = nothing();
^^^^^^^^^
The method nothing() from the type C1 is deprecated
----------
""";
runner.runWarningTest();
}
public static Class testClass() {
return DeprecatedTest.class;
}
Expand Down

0 comments on commit a3ec75b

Please sign in to comment.