diff options
author | ssankaran | 2013-12-17 12:43:54 +0000 |
---|---|---|
committer | ssankaran | 2013-12-17 13:54:51 +0000 |
commit | f4fa1b5b78e764cbc99a897dc3a1af35ead150e3 (patch) | |
tree | 24a4e3dfa7d4ebcc043aba0397bb4ea6122fdcdc /org.eclipse.jdt.core.tests.builder | |
parent | 6d26e89371291b0e31c04fda43f7d9e8d5d62845 (diff) | |
download | eclipse.jdt.core-f4fa1b5b78e764cbc99a897dc3a1af35ead150e3.tar.gz eclipse.jdt.core-f4fa1b5b78e764cbc99a897dc3a1af35ead150e3.tar.xz eclipse.jdt.core-f4fa1b5b78e764cbc99a897dc3a1af35ead150e3.zip |
Fixed Bug 423122 - [1.8] Missing incremental build dependency from
lambda expression to functional interface
Diffstat (limited to 'org.eclipse.jdt.core.tests.builder')
2 files changed, 130 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java index f91a9e98ba..cb7bcbf602 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -517,6 +521,7 @@ public class BuilderTests extends TestCase { EfficiencyTests.class, ExecutionTests.class, IncrementalTests.class, + IncrementalTests18.class, MultiProjectTests.class, MultiSourceFolderAndOutputFolderTests.class, OutputFolderTests.class, diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java new file mode 100644 index 0000000000..54b7464909 --- /dev/null +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2013 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import junit.framework.Test; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +public class IncrementalTests18 extends BuilderTests { + + public IncrementalTests18(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(IncrementalTests18.class); + } + + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=423122, [1.8] Missing incremental build dependency from lambda expression to functional interface. + public void test423122() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "p", "I", + "package p; \n"+ + "public interface I { void foo(); } \n" + ); + env.addClass(root, "p", "X", + "package p; \n"+ + "public class X { I i = () -> {}; } \n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p", "I", + "package p; \n"+ + "public interface I { } \n" + ); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : The target type of this expression must be a functional interface [ resource : </Project/src/p/X.java> range : <35,40> category : <40> severity : <2>]" + ); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=423122, [1.8] Missing incremental build dependency from lambda expression to functional interface. + public void test423122a() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "test1", "I", + "package test1;\n" + + "public interface I {\n" + + " int method(int a); // change argument type to Object\n" + + "}\n" + ); + env.addClass(root, "test1", "E", + "package test1;\n" + + "public class E {\n" + + " void take(I i) {\n" + + " }\n" + + "}\n" + ); + env.addClass(root, "test1", "Ref", + "package test1;\n" + + "public class Ref {\n" + + " void foo(E e) {\n" + + " e.take((x) -> x+2); // not recompiled when I#method changed\n" + + " }\n" + + "}\n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "test1", "I", + "package test1;\n" + + "public interface I {\n" + + " int method(Object a); // change argument type to Object\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : The operator + is undefined for the argument type(s) Object, int [ resource : </Project/src/test1/Ref.java> range : <76,79> category : <60> severity : <2>]" + ); + env.addClass(root, "test1", "I", + "package test1;\n" + + "public interface I {\n" + + " int method(int a); // change argument type back to int\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingNoProblems(); + } +} |