Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2019-03-01 06:57:36 -0500
committerJay Arthanareeswaran2019-03-02 03:23:21 -0500
commitfe1552846fcd781adf7c2d1952ab882767e9125c (patch)
treea4e0c6f078cf612dbbec860692f577769c7efc36 /org.eclipse.jdt.compiler.apt
parent4e22de6b5c96cb008d4a18fa7ee6a605ce7e9a06 (diff)
downloadeclipse.jdt.core-fe1552846fcd781adf7c2d1952ab882767e9125c.tar.gz
eclipse.jdt.core-fe1552846fcd781adf7c2d1952ab882767e9125c.tar.xz
eclipse.jdt.core-fe1552846fcd781adf7c2d1952ab882767e9125c.zip
Bug 544936 - RoundEnvImpl#getRootElements() does not include include
binary modules Change-Id: I7f845d3ceb6894bcefe6296ae9c9ec5bb9625a4d 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/dispatch/RoundEnvImpl.java12
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java20
2 files changed, 28 insertions, 4 deletions
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java
index 185dfd8f8a..00afab42dd 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundEnvImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - Fix for bug 328575
@@ -34,6 +38,7 @@ import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
@@ -235,6 +240,11 @@ public class RoundEnvImpl implements RoundEnvironment
throw new IllegalArgumentException("Top-level type binding could not be converted to element: " + typeBinding); //$NON-NLS-1$
}
elements.add(element);
+ ModuleBinding binding = typeBinding.module();
+ if (binding != null) {
+ Element m = _factory.newElement(binding);
+ elements.add(m);
+ }
}
}
_rootElements = elements;
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java
index adda859990..e6e473e91c 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2018 IBM Corporation and others.
+ * Copyright (c) 2018, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -7,7 +7,11 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*
@@ -90,8 +94,18 @@ public class ModuleElementImpl extends ElementImpl implements ModuleElement {
for (PackageBinding p : packs) {
if (p == null)
continue;
- if (!p.hasCompilationUnit(true))
+ if (p instanceof SplitPackageBinding) {
+ // select from incarnations the unique package containing CUs, if any:
+ for (PackageBinding incarnation : ((SplitPackageBinding) p).incarnations) {
+ if (incarnation.enclosingModule == module && incarnation.hasCompilationUnit(true)) {
+ unique.add(getModulesPackageBinding(p));
+ }
+ }
continue;
+ } else {
+ if (!p.hasCompilationUnit(true))
+ continue;
+ }
unique.add(getModulesPackageBinding(p));
}
if (module.isUnnamed()) {

Back to the top