Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 12-27
Link Here
|
12 |
|
12 |
|
13 |
import java.io.IOException; |
13 |
import java.io.IOException; |
14 |
|
14 |
|
15 |
import org.eclipse.core.runtime.CoreException; |
15 |
import junit.framework.Test; |
16 |
import org.eclipse.jdt.core.*; |
|
|
17 |
|
16 |
|
18 |
import junit.framework.*; |
17 |
import org.eclipse.core.runtime.CoreException; |
|
|
18 |
import org.eclipse.jdt.core.IClassFile; |
19 |
import org.eclipse.jdt.core.ICompilationUnit; |
20 |
import org.eclipse.jdt.core.IJavaElement; |
21 |
import org.eclipse.jdt.core.IJavaProject; |
22 |
import org.eclipse.jdt.core.ILocalVariable; |
23 |
import org.eclipse.jdt.core.IMethod; |
24 |
import org.eclipse.jdt.core.ISourceRange; |
25 |
import org.eclipse.jdt.core.IType; |
26 |
import org.eclipse.jdt.core.JavaCore; |
27 |
import org.eclipse.jdt.core.JavaModelException; |
28 |
import org.eclipse.jdt.core.WorkingCopyOwner; |
19 |
|
29 |
|
20 |
public class ResolveTests extends AbstractJavaModelTests { |
30 |
public class ResolveTests extends AbstractJavaModelTests { |
21 |
ICompilationUnit wc = null; |
31 |
ICompilationUnit wc = null; |
22 |
|
32 |
|
23 |
static { |
33 |
static { |
24 |
// TESTS_NAMES = new String[] { "testSecondaryTypes" }; |
34 |
TESTS_NAMES = new String[] { "testInterfaceX" }; |
25 |
} |
35 |
} |
26 |
public static Test suite() { |
36 |
public static Test suite() { |
27 |
return buildModelTestSuite(ResolveTests.class); |
37 |
return buildModelTestSuite(ResolveTests.class); |
Lines 2546-2550
Link Here
|
2546 |
elements |
2556 |
elements |
2547 |
); |
2557 |
); |
2548 |
} |
2558 |
} |
|
|
2559 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=235658 |
2560 |
// To verify that "open declaration" works for a protected interface, which is |
2561 |
// an inner type of an extending class's superclass. |
2562 |
public void testInterfaceX() throws JavaModelException { |
2563 |
this.workingCopies = new ICompilationUnit[2]; |
2564 |
this.workingCopies[0] = getWorkingCopy( |
2565 |
"/Resolve/src/test/Bug.java", |
2566 |
"package test;\n"+ |
2567 |
"public class Bug {\n" + |
2568 |
" void foo() {}\n" + |
2569 |
" protected interface Proto {}\n" + |
2570 |
"}\n"); |
2571 |
|
2572 |
this.workingCopies[1] = getWorkingCopy( |
2573 |
"/Resolve/src/Type.java", |
2574 |
"import test.Bug;\n"+ |
2575 |
"import test.Bug.*;\n"+ |
2576 |
"class Type extends Bug implements Proto {\n" + |
2577 |
"}\n"); |
2578 |
|
2579 |
String str = this.workingCopies[1].getSource(); |
2580 |
int start = str.lastIndexOf("Proto"); |
2581 |
int length = "Proto".length(); |
2582 |
IJavaElement[] elements = this.workingCopies[1].codeSelect(start, length, this.wcOwner); |
2583 |
|
2584 |
assertElementsEqual( |
2585 |
"Unexpected elements", |
2586 |
"Proto [in Bug [in [Working copy] Bug.java [in test [in src [in Resolve]]]]]", |
2587 |
elements |
2588 |
); |
2589 |
} |
2549 |
|
2590 |
|
2550 |
} |
2591 |
} |