Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalyan Prasad Tatavarthi2021-06-02 10:22:09 +0000
committerManoj Palat2021-06-03 04:32:26 +0000
commit0fc92c07cc21c7828eda0293e01fda98392e50b8 (patch)
tree1828185aa750b662a44ddfac3494d10cff569d81 /org.eclipse.jdt.core.tests.compiler
parent1e8e2bf6047c39a404ae4aca52149cf3c29cc425 (diff)
downloadeclipse.jdt.core-0fc92c07cc21c7828eda0293e01fda98392e50b8.tar.gz
eclipse.jdt.core-0fc92c07cc21c7828eda0293e01fda98392e50b8.tar.xz
eclipse.jdt.core-0fc92c07cc21c7828eda0293e01fda98392e50b8.zip
Bug 572873 - Cannot make a static reference to the non-static type TS4_20_0_RC2I20210603-0040
when static generic method returns lambda Change-Id: I094f0c70ff589a634ec24afbc710143c21251dad Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com> Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/181266 Reviewed-by: Manoj Palat <manpalat@in.ibm.com> Tested-by: Manoj Palat <manpalat@in.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java58
1 files changed, 56 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java
index a336738f3a..1e1b83443b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2019 IBM Corporation and others.
+ * Copyright (c) 2015, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -24,7 +24,7 @@ import junit.framework.Test;
public class LambdaRegressionTest extends AbstractRegressionTest {
static {
-// TESTS_NAMES = new String[] { "test001"};
+// TESTS_NAMES = new String[] { "test572873a", "test572873b"};
// TESTS_NUMBERS = new int[] { 50 };
// TESTS_RANGE = new int[] { 11, -1 };
}
@@ -1163,6 +1163,60 @@ public void testBug543778() {
runner.customOptions.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); // bug happens due to type annotation handling
runner.runConformTest();
}
+public void test572873a() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.Iterator;\n" +
+ "\n" +
+ "public class X {\n" +
+ " static <T> Iterable<T> iterable() {\n" +
+ " return () -> new Iterator<T>() {\n" +
+ " @Override\n" +
+ " public boolean hasNext() {\n" +
+ " return false;\n" +
+ " }\n" +
+ "\n" +
+ " @Override\n" +
+ " public T next() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"test T\");\n" +
+ " }\n" +
+ "}",
+ },
+ "test T"
+ );
+}
+public void test572873b() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.function.Consumer;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static <T> void build(T element) {\n" +
+ " new Thread(() -> {\n" +
+ " new Consumer<T>() {\n" +
+ "\n" +
+ " @Override\n" +
+ " public void accept(T t) {" +
+ "\n" +
+ " }\n" +
+ " };\n" +
+ " });\n" +
+ " }" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"test T\");\n" +
+ " }\n" +
+ "}",
+ },
+ "test T"
+ );
+}
public static Class testClass() {
return LambdaRegressionTest.class;
}

Back to the top