Commit 20244dba authored by andrei's avatar andrei

Fixed (again) anonymous inner class resolving

parent 5ad640bd
This diff is collapsed.
......@@ -7,6 +7,10 @@ public class TestJdk14Compatibility extends TestJdtUtils {
doTest("Anon1");
}
public void testGetNamed1_1() throws Exception {
doTest("Anon1_1");
}
public void testGetNamed2() throws Exception {
doTest("Anon2");
}
......@@ -15,10 +19,18 @@ public class TestJdk14Compatibility extends TestJdtUtils {
doTest("Anon3");
}
public void testGetNamed3_3() throws Exception {
doTest("Anon3_3");
}
public void testGetNamed4() throws Exception {
doTest("Anon4");
}
public void testGetNamed5() throws Exception {
doTest("Anon5");
}
protected String getJdkVersion() {
return "1.4";
}
......
......@@ -7,6 +7,10 @@ public class TestJdk15Compatibility extends TestJdtUtils {
doTest("Anon1");
}
public void testGetNamed1_1() throws Exception {
doTest("Anon1_1");
}
public void testGetNamed2() throws Exception {
doTest("Anon2");
}
......@@ -15,10 +19,18 @@ public class TestJdk15Compatibility extends TestJdtUtils {
doTest("Anon3");
}
public void testGetNamed3_3() throws Exception {
doTest("Anon3_3");
}
public void testGetNamed4() throws Exception {
doTest("Anon4");
}
public void testGetNamed5() throws Exception {
doTest("Anon5");
}
protected String getJdkVersion() {
return "1.5";
}
......
......@@ -48,7 +48,7 @@ import org.eclipse.ui.PlatformUI;
public abstract class TestJdtUtils extends TestCase {
private boolean onlyPrintOutError = false;
private final boolean onlyPrintOutError = false;
private static String EXTERNAL_JAR_DIR_PATH;
private IWorkspace workspace;
private IWorkspaceRoot root;
......@@ -470,7 +470,7 @@ public abstract class TestJdtUtils extends TestCase {
* This path ends with a File.separatorChar.
*/
protected String getExternalPath() {
if (EXTERNAL_JAR_DIR_PATH == null)
if (EXTERNAL_JAR_DIR_PATH == null) {
try {
String path = root.getLocation().toFile().getParentFile().getCanonicalPath();
if (path.charAt(path.length()-1) != File.separatorChar) {
......@@ -480,6 +480,7 @@ public abstract class TestJdtUtils extends TestCase {
} catch (IOException e) {
e.printStackTrace();
}
}
return EXTERNAL_JAR_DIR_PATH;
}
......@@ -599,10 +600,10 @@ public abstract class TestJdtUtils extends TestCase {
if(constant != null){
constant = constant.substring(1, constant.length() - 1);
}
String name = JdtUtils.getByteCodePath(type);
String expectedPath = packagePath + constant + ".class";
String name = JdtUtils.getByteCodePath(type);
if(!(expectedPath).equals(name)){
System.out.println("Expected/received: \nok -> " + expectedPath + "\nbad -> " + name + "\n");
System.out.println("Expected/received: \nexpected -> " + expectedPath + "\nreceived -> " + name + "\n");
if(!onlyPrintOutError) {
assertEquals(expectedPath, name);
}
......
......@@ -4,7 +4,7 @@ public class Anon1 {
final static String v15 = "Anon1";
final static String v14 = "Anon1";
Anon1() {
void instanceMethod() {
new Object() {
final static String v15 = "Anon1$3";
final static String v14 = "Anon1$11";
......@@ -15,26 +15,26 @@ public class Anon1 {
};
}
void instanceMethod() {
new Object() {
Anon1() {
new Object() {
final static String v15 = "Anon1$5";
final static String v14 = "Anon1$13";
};
new Object() {
};
new Object() {
final static String v15 = "Anon1$6";
final static String v14 = "Anon1$14";
};
};
}
static void staticMethod() {
new Object() {
new Object() {
final static String v15 = "Anon1$7";
final static String v14 = "Anon1$15";
};
new Object() {
};
new Object() {
final static String v15 = "Anon1$8";
final static String v14 = "Anon1$16";
};
};
}
static {
......@@ -53,6 +53,17 @@ public class Anon1 {
final static String v15 = "Anon1$A2";
final static String v14 = "Anon1$A2";
void instanceMethod() {
new Object() {
final static String v15 = "Anon1$A2$5";
final static String v14 = "Anon1$7";
};
new Object() {
final static String v15 = "Anon1$A2$6";
final static String v14 = "Anon1$8";
};
}
{
new Object() {
final static String v15 = "Anon1$A2$1";
......@@ -64,26 +75,15 @@ public class Anon1 {
};
}
void instanceMethod() {
new Object() {
final static String v15 = "Anon1$A2$5";
final static String v14 = "Anon1$7";
};
new Object() {
final static String v15 = "Anon1$A2$6";
final static String v14 = "Anon1$8";
};
}
static void staticMethod() {
new Object() {
new Object() {
final static String v15 = "Anon1$A2$7";
final static String v14 = "Anon1$9";
};
new Object() {
};
new Object() {
final static String v15 = "Anon1$A2$8";
final static String v14 = "Anon1$10";
};
};
}
static {
......
package inner;
public class Anon1_1 {
final static String v15 = "Anon1_1";
final static String v14 = "Anon1_1";
static {
new Object() {
final static String v15 = "Anon1_1$1";
final static String v14 = "Anon1_1$1";
};
}
Anon1_1() {
new Object() {
final static String v15 = "Anon1_1$4";
final static String v14 = "Anon1_1$12";
};
}
{
new Object() {
final static String v15 = "Anon1_1$2";
final static String v14 = "Anon1_1$2";
};
}
void instanceMethod() {
new Object() {
final static String v15 = "Anon1_1$5";
final static String v14 = "Anon1_1$13";
};
new Object() {
final static String v15 = "Anon1_1$6";
final static String v14 = "Anon1_1$14";
};
}
static void staticMethod() {
new Object() {
final static String v15 = "Anon1_1$7";
final static String v14 = "Anon1_1$15";
};
new Object() {
final static String v15 = "Anon1_1$8";
final static String v14 = "Anon1_1$16";
};
}
static {
new Object() {
final static String v15 = "Anon1_1$3";
final static String v14 = "Anon1_1$3";
};
}
static class A2 {
final static String v15 = "Anon1_1$A2";
final static String v14 = "Anon1_1$A2";
static {
new Object() {
final static String v15 = "Anon1_1$A2$1";
final static String v14 = "Anon1_1$4";
};
}
A2(){
new Object() {
final static String v15 = "Anon1_1$A2$4";
final static String v14 = "Anon1_1$7";
};
}
static {
new Object() {
final static String v15 = "Anon1_1$A2$2";
final static String v14 = "Anon1_1$5";
};
}
{
new Object() {
final static String v15 = "Anon1_1$A2$3";
final static String v14 = "Anon1_1$6";
};
}
void instanceMethod() {
new Object() {
final static String v15 = "Anon1_1$A2$5";
final static String v14 = "Anon1_1$8";
};
new Object() {
final static String v15 = "Anon1_1$A2$6";
final static String v14 = "Anon1_1$9";
};
}
static void staticMethod() {
new Object() {
final static String v15 = "Anon1_1$A2$7";
final static String v14 = "Anon1_1$10";
};
new Object() {
final static String v15 = "Anon1_1$A2$8";
final static String v14 = "Anon1_1$11";
};
}
}
}
......@@ -4,7 +4,7 @@ public class Anon2 {
final static String v15 = "Anon2";
final static String v14 = "Anon2";
Anon2() {
void instanceMethod() {
new Object() {
final static String v15 = "Anon2$3";
final static String v14 = "Anon2$7";
......@@ -15,7 +15,7 @@ public class Anon2 {
};
}
void instanceMethod() {
Anon2() {
new Object() {
final static String v15 = "Anon2$5";
final static String v14 = "Anon2$9";
......@@ -53,25 +53,25 @@ public class Anon2 {
final static String v15 = "Anon2$A2";
final static String v14 = "Anon2$A2";
{
void instanceMethod() {
new Object() {
final static String v15 = "Anon2$A2$1";
final static String v14 = "Anon2$3";
final static String v15 = "Anon2$A2$3";
final static String v14 = "Anon2$5";
};
new Object() {
final static String v15 = "Anon2$A2$2";
final static String v14 = "Anon2$4";
final static String v15 = "Anon2$A2$4";
final static String v14 = "Anon2$6";
};
}
void instanceMethod() {
{
new Object() {
final static String v15 = "Anon2$A2$3";
final static String v14 = "Anon2$5";
final static String v15 = "Anon2$A2$1";
final static String v14 = "Anon2$3";
};
new Object() {
final static String v15 = "Anon2$A2$4";
final static String v14 = "Anon2$6";
final static String v15 = "Anon2$A2$2";
final static String v14 = "Anon2$4";
};
}
}
......
......@@ -4,7 +4,7 @@ public class Anon3 {
final static String v15 = "Anon3";
final static String v14 = "Anon3";
Anon3() {
void instanceMethod() {
new Object() {
final static String v15 = "Anon3$3";
final static String v14 = "Anon3$15";
......@@ -15,7 +15,7 @@ public class Anon3 {
};
}
void instanceMethod() {
Anon3() {
new Object() {
final static String v15 = "Anon3$5";
final static String v14 = "Anon3$17";
......@@ -53,17 +53,6 @@ public class Anon3 {
final static String v15 = "Anon3$A2";
final static String v14 = "Anon3$A2";
{
new Object() {
final static String v15 = "Anon3$A2$1";
final static String v14 = "Anon3$3";
};
new Object() {
final static String v15 = "Anon3$A2$2";
final static String v14 = "Anon3$4";
};
}
void instanceMethod() {
new Object() {
final static String v15 = "Anon3$A2$3";
......@@ -74,22 +63,22 @@ public class Anon3 {
final static String v14 = "Anon3$6";
};
}
}
static class A3 {
final static String v15 = "Anon3$A3";
final static String v14 = "Anon3$A3";
{
new Object() {
final static String v15 = "Anon3$A3$1";
final static String v14 = "Anon3$7";
final static String v15 = "Anon3$A2$1";
final static String v14 = "Anon3$3";
};
new Object() {
final static String v15 = "Anon3$A3$2";
final static String v14 = "Anon3$8";
final static String v15 = "Anon3$A2$2";
final static String v14 = "Anon3$4";
};
}
}
static class A3 {
final static String v15 = "Anon3$A3";
final static String v14 = "Anon3$A3";
void instanceMethod() {
new Object() {
......@@ -102,6 +91,17 @@ public class Anon3 {
};
}
{
new Object() {
final static String v15 = "Anon3$A3$1";
final static String v14 = "Anon3$7";
};
new Object() {
final static String v15 = "Anon3$A3$2";
final static String v14 = "Anon3$8";
};
}
static void staticMethod() {
new Object() {
final static String v15 = "Anon3$A3$7";
......
package inner;
public class Anon3_3 {
final static String v15 = "Anon3_3";
final static String v14 = "Anon3_3";
static {
new Object() {
final static String v15 = "Anon3_3$1";
final static String v14 = "Anon3_3$1";
};
}
Anon3_3() {
new Object() {
final static String v15 = "Anon3_3$4";
final static String v14 = "Anon3_3$16";
};
}
{
new Object() {
final static String v15 = "Anon3_3$2";
final static String v14 = "Anon3_3$2";
};
}
void instanceMethod() {
new Object() {
final static String v15 = "Anon3_3$5";
final static String v14 = "Anon3_3$17";
};
new Object() {
final static String v15 = "Anon3_3$6";
final static String v14 = "Anon3_3$18";
};
}
static void staticMethod() {
new Object() {
final static String v15 = "Anon3_3$7";
final static String v14 = "Anon3_3$19";
};
new Object() {
final static String v15 = "Anon3_3$8";
final static String v14 = "Anon3_3$20";
};
}
static {
new Object() {
final static String v15 = "Anon3_3$3";
final static String v14 = "Anon3_3$3";
};
}
class A2 {
final static String v15 = "Anon3_3$A2";
final static String v14 = "Anon3_3$A2";
void instanceMethod() {
new Object() {
final static String v15 = "Anon3_3$A2$2";
final static String v14 = "Anon3_3$5";
};
new Object() {
final static String v15 = "Anon3_3$A2$3";
final static String v14 = "Anon3_3$6";
};
}
A2(){
new Object() {
final static String v15 = "Anon3_3$A2$4";
final static String v14 = "Anon3_3$7";
};
}
{
new Object() {
final static String v15 = "Anon3_3$A2$1";
final static String v14 = "Anon3_3$4";
};
}
}
static class A3 {
final static String v15 = "Anon3_3$A3";
final static String v14 = "Anon3_3$A3";
static {
new Object() {
final static String v15 = "Anon3_3$A3$1";
final static String v14 = "Anon3_3$8";
};
}
A3(){
new Object() {
final static String v15 = "Anon3_3$A3$4";
final static String v14 = "Anon3_3$11";
};
}
{
new Object() {
final static String v15 = "Anon3_3$A3$2";
final static String v14 = "Anon3_3$9";
};
}
static {
new Object() {
final static String v15 = "Anon3_3$A3$3";
final static String v14 = "Anon3_3$10";
};
}
void instanceMethod() {
new Object() {
final static String v15 = "Anon3_3$A3$5";
final static String v14 = "Anon3_3$12";
};
new Object() {
final static String v15 = "Anon3_3$A3$6";
final static String v14 = "Anon3_3$13";
};
}
static void staticMethod() {
new Object() {
final static String v15 = "Anon3_3$A3$7";
final static String v14 = "Anon3_3$14";
};
new Object() {
final static String v15 = "Anon3_3$A3$8";
final static String v14 = "Anon3_3$15";
};
}
}
}
......@@ -26,17 +26,6 @@ public class Anon4 {
};
class A3 {
{
new Object() {
final static String v15 = "Anon4$1A3$1";
final static String v14 = "Anon4$11";
};
new Object() {
final static String v15 = "Anon4$1A3$2";
final static String v14 = "Anon4$12";
};
}
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=167357
final static String v15 = "Anon4$1A3";
final static String v14 = "Anon4$1$A3";
......@@ -50,17 +39,29 @@ public class Anon4 {
final static String v14 = "Anon4$14";
};
}
{
new Object() {
final static String v15 = "Anon4$1A3$1";
final static String v14 = "Anon4$11";
};
new Object() {
final static String v15 = "Anon4$1A3$2";
final static String v14 = "Anon4$12";
};
}
}
}
static void staticMethod() {
new Object() {
final static String v15 = "Anon4$7";
final static String v14 = "Anon4$11";
final static String v14 = "Anon4$15";
};
new Object() {
final static String v15 = "Anon4$8";
final static String v14 = "Anon4$12";
final static String v14 = "Anon4$16";
};
}
......@@ -80,26 +81,28 @@ public class Anon4 {
final static String v15 = "Anon4$A2";
final static String v14 = "Anon4$A2";
{
void instanceMethod() {
new Object() {
final static String v15 = "Anon4$A2$1";
final static String v14 = "Anon4$3";
final static String v15 = "Anon4$A2$3";
final static String v14 = "Anon4$5";
};
new Object() {
final static String v15 = "Anon4$A2$2";
final static String v14 = "Anon4$4";
final static String v15 = "Anon4$A2$4";
final static String v14 = "Anon4$6";
};
}
void instanceMethod() {
{
new Object() {
final static String v15 = "Anon4$A2$3";
final static String v14 = "Anon4$5";
final static String v15 = "Anon4$A2$1";
final static String v14 = "Anon4$3";
};
new Object() {
final static String v15 = "Anon4$A2$4";
final static String v14 = "Anon4$6";
final static String v15 = "Anon4$A2$2";
final static String v14 = "Anon4$4";
};
}
}
}
......@@ -4,77 +4,125 @@ public class Anon5 {
final static String v15 = "Anon5";
final static String v14 = "Anon5";
void instanceMethod1() {
new Object() {
final static String v15 = "Anon5$5";
final static String v14 = "Anon5$10";
};
new Object() {
final static String v15 = "Anon5$6";
final static String v14 = "Anon5$11";
{
new Object() {
final static String v15 = "Anon5$6$1";
final static String v14 = "Anon5$12";
};
}
};
new Object() {
final static String v15 = "Anon5$7";
final static String v14 = "Anon5$13";
};
}
{
new Object() {
final static String v15 = "Anon5$3";
final static String v15 = "Anon5$1";
final static String v14 = "Anon5$1";
};
}
Anon5(){
new Object() {
final static String v15 = "Anon5$8";
final static String v14 = "Anon5$14";
};
}
static {
new Object() {
final static String v15 = "Anon5$2";
final static String v14 = "Anon5$2";
};
}
{
new Object() {
final static String v15 = "Anon5$3";
final static String v14 = "Anon5$1";
final static String v14 = "Anon5$3";
};
}
void instanceMethod1() {
static {
new Object() {
{
new Object() {
final static String v15 = "Anon5$1A3$1";
final static String v14 = "Anon5$11";
};