aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-12-19 20:09:40 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-12-19 20:09:40 +0100
commitae87a26456245f19d97f8852ea21556cd78e97ef (patch)
tree1df316ac294e8d9c784c9d3a006ae872404d1345 /src/core/lombok
parent6b91620d9efab992ee8e909b3e7b9cac0ac6f607 (diff)
downloadlombok-ae87a26456245f19d97f8852ea21556cd78e97ef.tar.gz
lombok-ae87a26456245f19d97f8852ea21556cd78e97ef.tar.bz2
lombok-ae87a26456245f19d97f8852ea21556cd78e97ef.zip
Now the type resolver also finds top-level types in a compilation unit that name-shadow. Added tests for the type resolver.
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/core/TypeResolver.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/lombok/core/TypeResolver.java b/src/core/lombok/core/TypeResolver.java
index 2fa24fd2..e5c3fac8 100644
--- a/src/core/lombok/core/TypeResolver.java
+++ b/src/core/lombok/core/TypeResolver.java
@@ -73,7 +73,7 @@ public class TypeResolver {
// because if you want to know if 'Foo' could refer to 'bar.Foo' when 'baz.Foo' is explicitly imported, the answer is no.
if (nameConflictInImportList(typeRef, potentialMatches)) return Collections.emptyList();
- // Check if any of our potentials is even imported in the first place. If not: no matches.
+ // Check if any of our potentials are even imported in the first place. If not: no matches.
// Note that (ourPackage.*) is added to the imports.
potentialMatches = eliminateImpossibleMatches(potentialMatches, library);
if (potentialMatches.isEmpty()) return Collections.emptyList();
@@ -84,7 +84,7 @@ public class TypeResolver {
LombokNode<?, ?, ?> n = context;
mainLoop:
- while (n != null && n.getKind() != Kind.COMPILATION_UNIT) {
+ while (n != null) {
if (n.getKind() == Kind.TYPE && typeRef.equals(n.getName())) {
// Our own class or one of our outer classes is named 'typeRef' so that's what 'typeRef' is referring to, not one of our type library classes.
return Collections.emptyList();
@@ -106,7 +106,7 @@ public class TypeResolver {
continue mainLoop;
}
- if (n.getKind() == Kind.TYPE) {
+ if (n.getKind() == Kind.TYPE || n.getKind() == Kind.COMPILATION_UNIT) {
for (LombokNode<?, ?, ?> child : n.down()) {
// Inner class that's visible to us has 'typeRef' as name, so that's the one being referred to, not one of our type library classes.
if (child.getKind() == Kind.TYPE && typeRef.equals(child.getName())) return Collections.emptyList();