View | Details | Raw Unified | Return to bug 215858 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java (-2 / +16 lines)
Lines 24-29 Link Here
24
import org.eclipse.jdt.core.Flags;
24
import org.eclipse.jdt.core.Flags;
25
import org.eclipse.jdt.core.IClassFile;
25
import org.eclipse.jdt.core.IClassFile;
26
import org.eclipse.jdt.core.ICompilationUnit;
26
import org.eclipse.jdt.core.ICompilationUnit;
27
import org.eclipse.jdt.core.IField;
27
import org.eclipse.jdt.core.IInitializer;
28
import org.eclipse.jdt.core.IInitializer;
28
import org.eclipse.jdt.core.IJavaElement;
29
import org.eclipse.jdt.core.IJavaElement;
29
import org.eclipse.jdt.core.IJavaProject;
30
import org.eclipse.jdt.core.IJavaProject;
Lines 9217-9224 Link Here
9217
		assertNotNull("No fields", fields);
9218
		assertNotNull("No fields", fields);
9218
		assertTrue("Empty", fields.length != 0);
9219
		assertTrue("Empty", fields.length != 0);
9219
	}
9220
	}
9220
	
9221
	
9222
	/**
9221
	/**
9223
	 * http://dev.eclipse.org/bugs/show_bug.cgi?id=196354
9222
	 * http://dev.eclipse.org/bugs/show_bug.cgi?id=196354
9224
	 */
9223
	 */
Lines 9233-9236 Link Here
9233
		assertNotNull("No binding", packageBinding);
9232
		assertNotNull("No binding", packageBinding);
9234
		assertEquals("Wrong name", "Sample", packageBinding.getName());
9233
		assertEquals("Wrong name", "Sample", packageBinding.getName());
9235
	}
9234
	}
9235
	/**
9236
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=215858
9237
	 */
9238
	public void test0679() throws JavaModelException {
9239
		ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0679", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
9240
		IType[] types = sourceUnit.getTypes();
9241
		assertNotNull(types);
9242
		assertEquals("wrong size", 1, types.length);
9243
		IType type = types[0];
9244
		IField field = type.getField("i");
9245
		assertNotNull("No field", field);
9246
		ISourceRange sourceRange = field.getNameRange();
9247
		ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
9248
		assertNotNull(result);
9249
	}
9236
}
9250
}
(-)workspace/Converter/src/test0679/X.java (+6 lines)
Added Link Here
1
package test0679;
2
3
public class X {
4
	protected int i;
5
	protected void foo(String string) {}
6
}
(-)dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java (-1 / +1 lines)
Lines 425-431 Link Here
425
			} else if (enclosingTypeDeclaration != null) {
425
			} else if (enclosingTypeDeclaration != null) {
426
				if (node instanceof org.eclipse.jdt.internal.compiler.ast.Initializer) {
426
				if (node instanceof org.eclipse.jdt.internal.compiler.ast.Initializer) {
427
					((org.eclipse.jdt.internal.compiler.ast.Initializer) node).parseStatements(parser, enclosingTypeDeclaration, compilationUnitDeclaration);
427
					((org.eclipse.jdt.internal.compiler.ast.Initializer) node).parseStatements(parser, enclosingTypeDeclaration, compilationUnitDeclaration);
428
				} else {
428
				} else if (node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
429
					((org.eclipse.jdt.internal.compiler.ast.TypeDeclaration)node).parseMethod(parser, compilationUnitDeclaration);
429
					((org.eclipse.jdt.internal.compiler.ast.TypeDeclaration)node).parseMethod(parser, compilationUnitDeclaration);
430
				}
430
				}
431
			}
431
			}

Return to bug 215858