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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java (-6 / +10 lines)
Lines 42-47 Link Here
42
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
42
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
43
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
43
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
44
import org.eclipse.jdt.internal.core.*;
44
import org.eclipse.jdt.internal.core.*;
45
import org.eclipse.jdt.internal.core.util.Util;
45
46
46
public class SourceTypeConverter {
47
public class SourceTypeConverter {
47
	
48
	
Lines 128-134 Link Here
128
		int end = topLevelTypeInfo.getNameSourceEnd();
129
		int end = topLevelTypeInfo.getNameSourceEnd();
129
130
130
		/* convert package and imports */
131
		/* convert package and imports */
131
		char[] packageName = cuHandle.getParent().getElementName().toCharArray();
132
		String[] packageName = ((PackageFragment) cuHandle.getParent()).names;
132
		if (packageName.length > 0)
133
		if (packageName.length > 0)
133
			// if its null then it is defined in the default package
134
			// if its null then it is defined in the default package
134
			this.unit.currentPackage =
135
			this.unit.currentPackage =
Lines 139-146 Link Here
139
		for (int i = 0; i < importCount; i++) {
140
		for (int i = 0; i < importCount; i++) {
140
			ImportDeclaration importDeclaration = (ImportDeclaration) importDeclarations[i];
141
			ImportDeclaration importDeclaration = (ImportDeclaration) importDeclarations[i];
141
			ISourceImport sourceImport = (ISourceImport) importDeclaration.getElementInfo();
142
			ISourceImport sourceImport = (ISourceImport) importDeclaration.getElementInfo();
143
			String nameWithoutStar = importDeclaration.getNameWithoutStar();
142
			this.unit.imports[i] = createImportReference(
144
			this.unit.imports[i] = createImportReference(
143
				importDeclaration.getNameWithoutStar().toCharArray(), 
145
				Util.splitOn('.', nameWithoutStar, 0, nameWithoutStar.length()), 
144
				sourceImport.getDeclarationSourceStart(),
146
				sourceImport.getDeclarationSourceStart(),
145
				sourceImport.getDeclarationSourceEnd(),
147
				sourceImport.getDeclarationSourceEnd(),
146
				importDeclaration.isOnDemand(),
148
				importDeclaration.isOnDemand(),
Lines 627-642 Link Here
627
	 * Build an import reference from an import name, e.g. java.lang.*
629
	 * Build an import reference from an import name, e.g. java.lang.*
628
	 */
630
	 */
629
	private ImportReference createImportReference(
631
	private ImportReference createImportReference(
630
		char[] importName,
632
		String[] importName,
631
		int start,
633
		int start,
632
		int end, 
634
		int end, 
633
		boolean onDemand,
635
		boolean onDemand,
634
		int modifiers) {
636
		int modifiers) {
635
	
637
	
636
		char[][] qImportName = CharOperation.splitOn('.', importName);
638
		int length = importName.length;
637
		long[] positions = new long[qImportName.length];
639
		long[] positions = new long[length];
638
		long position = ((long) start << 32) + end;
640
		long position = ((long) start << 32) + end;
639
		for (int i = 0; i < qImportName.length; i++) {
641
		char[][] qImportName = new char[length][];
642
		for (int i = 0; i < length; i++) {
643
			qImportName[i] = importName[i].toCharArray();
640
			positions[i] = position; // dummy positions
644
			positions[i] = position; // dummy positions
641
		}
645
		}
642
		return new ImportReference(
646
		return new ImportReference(

Return to bug 179684