Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2017-12-14 01:45:24 -0500
committerJay Arthanareeswaran2017-12-14 02:31:57 -0500
commit8bde56d56aaf790ffdc7af74a4133dd0bec2ee14 (patch)
tree7508fdc001e54860b669596aa20b555751e58c1e /org.eclipse.jdt.compiler.apt
parent75db974235400681df67963930eee90bd9538e37 (diff)
downloadeclipse.jdt.core-8bde56d56aaf790ffdc7af74a4133dd0bec2ee14.tar.gz
eclipse.jdt.core-8bde56d56aaf790ffdc7af74a4133dd0bec2ee14.tar.xz
eclipse.jdt.core-8bde56d56aaf790ffdc7af74a4133dd0bec2ee14.zip
Bug 528747: PackageElement should not contain package as enclosed
element Change-Id: I149b89e33f7fbbe4cc4878a0ffbbcc9d5b331d08 Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.compiler.apt')
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java
index ca276eeecd..83a4d482de 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java
@@ -80,8 +80,11 @@ public class PackageElementImpl extends ElementImpl implements PackageElement {
if (typeName == null) continue;
ReferenceBinding type = environment.getType(typeName);
if (type != null && type.isValidBinding()) {
- set.add(_env.getFactory().newElement(type));
- types.add(type);
+ Element newElement = _env.getFactory().newElement(type);
+ if (newElement.getKind() != ElementKind.PACKAGE) {
+ set.add(newElement);
+ types.add(type);
+ }
}
}
}
@@ -90,7 +93,9 @@ public class PackageElementImpl extends ElementImpl implements PackageElement {
for (ReferenceBinding referenceBinding : knownTypes) {
if (referenceBinding != null && referenceBinding.isValidBinding() && referenceBinding.enclosingType() == null) {
if (!types.contains(referenceBinding)) {
- set.add(_env.getFactory().newElement(referenceBinding));
+ Element newElement = _env.getFactory().newElement(referenceBinding);
+ if (newElement.getKind() != ElementKind.PACKAGE)
+ set.add(newElement);
}
}
}

Back to the top