From a3ec75b24784c14e666f1c7717649d32ff7fbba2 Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Sat, 6 Jul 2024 14:09:35 +0200 Subject: [PATCH] move tests to Deprecated9Tests for use of enhanced deprecation --- .../compiler/regression/Deprecated9Test.java | 71 +++++++++++++++++++ .../compiler/regression/DeprecatedTest.java | 71 ------------------- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java index 7b1e2df8743..8314fa25589 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java @@ -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; } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java index c4f2d8b78a8..5021c7600de 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java @@ -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; }