forked from azachar/org.eclipse.jdt.ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 424745: [1.8][inline] Error after inlining constant with static m…
…ethod reference as initializer
- Loading branch information
1 parent
29abae6
commit b1b64fc
Showing
4 changed files
with
131 additions
and
82 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...efactoring/resources/InlineConstant/canInline18/test1004/in/TestInlineMethodRef_Enum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 5, 28 -> 5, 30 replaceAll = true, removeDeclaration = true | ||
package p; | ||
|
||
class Test { | ||
public static final FI f1 = Test::m; | ||
|
||
static int m(int x) { | ||
return x--; | ||
} | ||
} | ||
|
||
enum E { | ||
E_C1(Test.f1); // [1] | ||
E(FI fi) {} | ||
} | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int x); | ||
} |
18 changes: 18 additions & 0 deletions
18
...factoring/resources/InlineConstant/canInline18/test1004/out/TestInlineMethodRef_Enum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// 5, 28 -> 5, 30 replaceAll = true, removeDeclaration = true | ||
package p; | ||
|
||
class Test { | ||
static int m(int x) { | ||
return x--; | ||
} | ||
} | ||
|
||
enum E { | ||
E_C1(Test::m); // [1] | ||
E(FI fi) {} | ||
} | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int x); | ||
} |
164 changes: 82 additions & 82 deletions
164
...ts.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineConstantTests18.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,82 @@ | ||
/******************************************************************************* | ||
* 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.ui.tests.refactoring; | ||
|
||
import junit.framework.Test; | ||
|
||
public class InlineConstantTests18 extends InlineConstantTests { | ||
private static final Class clazz= InlineConstantTests18.class; | ||
|
||
public InlineConstantTests18(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
protected String successPath() { | ||
return toSucceed ? "/canInline18/" : "/cannotInline18/"; | ||
} | ||
|
||
public static Test suite() { | ||
return new Java18Setup(new NoSuperTestsSuite(clazz)); | ||
} | ||
|
||
public static Test setUpTest(Test someTest) { | ||
return new Java18Setup(someTest); | ||
} | ||
|
||
//--- Test lambda expressions | ||
|
||
public void test0() throws Exception { | ||
helper1("p.TestInlineLambda", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1() throws Exception { | ||
helper1("p.TestInlineLambda_Cast", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test2() throws Exception { | ||
helper1("p.TestInlineLambdaArray", 5, 30, 5, 35, true, true); | ||
} | ||
|
||
public void test3() throws Exception { | ||
helper1("p.TestInlineLambda_Ambiguous", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test4() throws Exception { | ||
helper1("p.TestInlineLambda_Ambiguous", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test5() throws Exception { | ||
helper1("p.TestInlineLambda_Cast", 15, 30, 15, 36, true, true); | ||
} | ||
|
||
//--- Test method references | ||
|
||
public void test1000() throws Exception { | ||
helper1("p.TestInlineMethodRef", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1001() throws Exception { | ||
helper1("p.TestInlineMethodRef_Cast", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1002() throws Exception { | ||
helper1("p.TestInlineMethodRefArray", 5, 30, 5, 35, true, true); | ||
} | ||
|
||
public void test1003() throws Exception { | ||
helper1("p.TestInlineMethodRef_Ambiguous", 5, 28, 5, 30, true, true); | ||
} | ||
} | ||
/******************************************************************************* | ||
* Copyright (c) 2013, 2014 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 | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.jdt.ui.tests.refactoring; | ||
|
||
import junit.framework.Test; | ||
|
||
public class InlineConstantTests18 extends InlineConstantTests { | ||
private static final Class clazz= InlineConstantTests18.class; | ||
|
||
public InlineConstantTests18(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
protected String successPath() { | ||
return toSucceed ? "/canInline18/" : "/cannotInline18/"; | ||
} | ||
|
||
public static Test suite() { | ||
return new Java18Setup(new NoSuperTestsSuite(clazz)); | ||
} | ||
|
||
public static Test setUpTest(Test someTest) { | ||
return new Java18Setup(someTest); | ||
} | ||
|
||
//--- Test lambda expressions | ||
|
||
public void test0() throws Exception { | ||
helper1("p.TestInlineLambda", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1() throws Exception { | ||
helper1("p.TestInlineLambda_Cast", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test2() throws Exception { | ||
helper1("p.TestInlineLambdaArray", 5, 30, 5, 35, true, true); | ||
} | ||
|
||
public void test3() throws Exception { | ||
helper1("p.TestInlineLambda_Ambiguous", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test4() throws Exception { | ||
helper1("p.TestInlineLambda_Ambiguous", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test5() throws Exception { | ||
helper1("p.TestInlineLambda_Cast", 15, 30, 15, 36, true, true); | ||
} | ||
|
||
//--- Test method references | ||
|
||
public void test1000() throws Exception { | ||
helper1("p.TestInlineMethodRef", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1001() throws Exception { | ||
helper1("p.TestInlineMethodRef_Cast", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1002() throws Exception { | ||
helper1("p.TestInlineMethodRefArray", 5, 30, 5, 35, true, true); | ||
} | ||
|
||
public void test1003() throws Exception { | ||
helper1("p.TestInlineMethodRef_Ambiguous", 5, 28, 5, 30, true, true); | ||
} | ||
|
||
public void test1004() throws Exception { | ||
helper1("p.TestInlineMethodRef_Enum", 5, 28, 5, 30, true, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters