Skip to content

Commit 9024493

Browse files
committed
JDK library enhancement captured in issue eclipse-jdt#3877 and issue eclipse-jdt#3878
1 parent 963c909 commit 9024493

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public GenericTypeTest(String name) {
5858
// Static initializer to specify tests subset using TESTS_* static variables
5959
// All specified tests which does not belong to the class are skipped...
6060
static {
61-
// TESTS_NAMES = new String[] { "test0593" };
61+
// TESTS_NAMES = new String[] { "test1083" };
6262
// TESTS_NUMBERS = new int[] { 470, 627 };
6363
// TESTS_RANGE = new int[] { 1097, -1 };
6464
}
@@ -37578,6 +37578,18 @@ public void test1082() {
3757837578
}
3757937579
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106451 - variation
3758037580
public void test1083() {
37581+
String JDK8344943_msg = isJRE25Plus ?
37582+
"3. ERROR in X.java (at line 15)\n" +
37583+
" java.util.List<Runtime> d = (LinkedList<Runtime>) a; // inconvertible / unchecked ?\n" +
37584+
" ^^^^^^^^^^^^^^^^^^^^^^^\n" +
37585+
"Cannot cast from List<capture#3-of ? extends Serializable> to LinkedList<Runtime>\n" +
37586+
"----------\n"
37587+
:
37588+
"3. WARNING in X.java (at line 15)\n" +
37589+
" java.util.List<Runtime> d = (LinkedList<Runtime>) a; // inconvertible / unchecked ?\n" +
37590+
" ^^^^^^^^^^^^^^^^^^^^^^^\n" +
37591+
"Type safety: Unchecked cast from List<capture#3-of ? extends Serializable> to LinkedList<Runtime>\n" +
37592+
"----------\n";
3758137593
this.runNegativeTest(
3758237594
new String[] {
3758337595
"X.java", // =================
@@ -37613,11 +37625,7 @@ public void test1083() {
3761337625
" ^^^^^^^^^^^^^^^^^^^^^^^\n" +
3761437626
"Type safety: Unchecked cast from List<capture#2-of ? extends Serializable> to LinkedList<Integer>\n" +
3761537627
"----------\n" +
37616-
"3. WARNING in X.java (at line 15)\n" +
37617-
" java.util.List<Runtime> d = (LinkedList<Runtime>) a; // inconvertible / unchecked ?\n" +
37618-
" ^^^^^^^^^^^^^^^^^^^^^^^\n" +
37619-
"Type safety: Unchecked cast from List<capture#3-of ? extends Serializable> to LinkedList<Runtime>\n" +
37620-
"----------\n" +
37628+
JDK8344943_msg +
3762137629
"4. ERROR in X.java (at line 18)\n" +
3762237630
" Zork z;\n" +
3762337631
" ^^^^\n" +

org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
*
99
* SPDX-License-Identifier: EPL-2.0
1010
*
11+
* This is an implementation of an early-draft specification developed under the Java
12+
* Community Process (JCP) and is made available for testing and evaluation purposes
13+
* only. The code is not compatible with any specification of the JCP.
14+
*
1115
* Contributors:
1216
* Stephan Herrmann - initial API and implementation
1317
* Nikolay Metchev (nikolaymetchev@gmail.com) - Contributions for
@@ -76,7 +80,7 @@ abstract class BaseStreamEx<T, S extends BaseStream<T, S>, SPLTR extends Spliter
7680
""";
7781

7882
static {
79-
// TESTS_NAMES = new String[] { "testBug463320" };
83+
// TESTS_NAMES = new String[] { "testBug368709b" };
8084
// TESTS_NUMBERS = new int[] { 50 };
8185
// TESTS_RANGE = new int[] { 11, -1 };
8286
}
@@ -3087,6 +3091,14 @@ public void test063e() {
30873091
// original test case from jgit
30883092
public void testBug368709a() {
30893093
if (this.complianceLevel < ClassFileConstants.JDK1_5) return;
3094+
String JDK8225763_Fix = isJRE25Plus ?
3095+
"2. ERROR in X.java (at line 17)\n" +
3096+
" in = new BufferedInputStream(new InflaterInputStream(in, wc.inflater(), 8192), 8192);\n" +
3097+
" ^^^^^^^^^^^^^\n" +
3098+
potentialOrDefiniteLeak("<unassigned Closeable value>") +
3099+
"----------\n" +
3100+
"3."
3101+
: "2.";
30903102
Map options = getCompilerOptions();
30913103
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
30923104
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
@@ -3142,7 +3154,8 @@ public void testBug368709a() {
31423154
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
31433155
potentialOrDefiniteLeak("<unassigned Closeable value>") +
31443156
"----------\n" +
3145-
"2. ERROR in X.java (at line 18)\n" +
3157+
JDK8225763_Fix +
3158+
" ERROR in X.java (at line 18)\n" +
31463159
" return new ObjectStream.Filter(type, size, in);\n" +
31473160
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
31483161
potentialLeakOrCloseNotShownAtExit("in") +
@@ -3153,6 +3166,13 @@ public void testBug368709a() {
31533166
// minimal test case: constructing an indirect self-wrapper
31543167
public void testBug368709b() {
31553168
if (this.complianceLevel < ClassFileConstants.JDK1_5) return;
3169+
String JDK8225763_Fix = isJRE25Plus ?
3170+
"2. ERROR in X.java (at line 6)\n" +
3171+
" in = new BufferedInputStream(new InflaterInputStream(in, inflater(), 8192), 8192);\n" +
3172+
" ^^^^^^^^^^\n" +
3173+
potentialOrDefiniteLeak("<unassigned Closeable value>") +
3174+
"----------\n"
3175+
: "";
31563176
Map options = getCompilerOptions();
31573177
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
31583178
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
@@ -3176,7 +3196,8 @@ public void testBug368709b() {
31763196
" InputStream in = new FileInputStream(\"somefile\");\n" +
31773197
" ^^\n" +
31783198
potentialLeakOrCloseNotShown("in") +
3179-
"----------\n",
3199+
"----------\n" +
3200+
JDK8225763_Fix,
31803201
options);
31813202
}
31823203

0 commit comments

Comments
 (0)