diff options
author | Terry Parker | 2012-03-05 16:14:43 +0000 |
---|---|---|
committer | Satyam Kandula | 2012-03-05 16:14:43 +0000 |
commit | d39d6a569bf3e8ad17dd21e40b44a475d8afacee (patch) | |
tree | 46ed31d7ec0959b3ccc49f05c1b169a920fefa90 | |
parent | 4de8875392f1614ce3d9b4e720843df3cd1fa2b7 (diff) | |
download | eclipse.jdt.core-d39d6a569bf3e8ad17dd21e40b44a475d8afacee.tar.gz eclipse.jdt.core-d39d6a569bf3e8ad17dd21e40b44a475d8afacee.tar.xz eclipse.jdt.core-d39d6a569bf3e8ad17dd21e40b44a475d8afacee.zip |
Fix for 372418: Another problem with inner classes referenced from jars
or class folders: "The type ... cannot be resolved"
-rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java index 65c3c79e95..0dc9550519 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Terry Parker <tparker@google.com> + * - Contribution for https://bugs.eclipse.org/bugs/show_bug.cgi?id=372418 + * - Another problem with inner classes referenced from jars or class folders: "The type ... cannot be resolved" *******************************************************************************/ package org.eclipse.jdt.internal.core.builder; @@ -271,7 +274,13 @@ private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeNam // if an additional source file is waiting to be compiled, answer it BUT not if this is a secondary type search // if we answer X.java & it no longer defines Y then the binary type looking for Y will think the class path is wrong // let the recompile loop fix up dependents when the secondary type Y has been deleted from X.java - SourceFile unit = (SourceFile) this.additionalUnits.get(qualifiedTypeName); // doesn't have file extension + // Only enclosing type names are present in the additional units table, so strip off inner class specifications + // when doing the lookup (https://bugs.eclipse.org/372418) + String enclosingTypeName = qualifiedTypeName; + int index = enclosingTypeName.indexOf('$'); + if (index > 0) + enclosingTypeName = enclosingTypeName.substring(0, index); + SourceFile unit = (SourceFile) this.additionalUnits.get(enclosingTypeName); // doesn't have file extension if (unit != null) return new NameEnvironmentAnswer(unit, null /*no access restriction*/); } |