Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties2
-rw-r--r--plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java54
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java2
3 files changed, 40 insertions, 18 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index aac3dc284..303a95b51 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -809,7 +809,7 @@
1201308 = Illegal base import: this package is not provided by the declared base plug-in(s) {0} (OT/Equinox).
1201309 = Illegal base import: this package is not provided by the declared base plug-in {0} but by plug-in {1} (OT/Equinox).
-1201310 = Illegal base import: no aspect binding declared for team {0} (OT/Equinox).
+1201310 = Illegal base import: no aspect binding declared for team {0} or any nested team (OT/Equinox).
1201311 = Decapsulating base class {0} by means of a forced export. Note, that additionally a corresponing declaration is needed in config.ini (OTJLD 2.1.2(c) + OT/Equinox).
1201312 = This messages should never be seen ({0}).
1201313 = The forced-exported type {0} cannot be accessed other than as a role's base class (OT/Equinox).
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
index c34505e75..d5b798414 100644
--- a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
@@ -19,8 +19,11 @@
**********************************************************************/
package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import org.eclipse.jdt.core.Flags;
@@ -150,13 +153,21 @@ public team class BaseImportChecker extends CompilationThreadWatcher
if (location instanceof ImportReference) {
ImportReference imp= (ImportReference)location;
if (imp.isBase()) {
- String teamName= getReferenceTeam();
- if (teamName == null)
+ List<String> teamNames= getReferenceTeams();
+ if (teamNames.isEmpty()) {
baseImportInRegularClass(getPublicType(), imp);
+ return false;
+ }
+
+ Set<String> basePlugins= new HashSet<String>();
+ for (String teamName : teamNames) {
+ Set<String> currentBasePlugins = aspectBindingReader.getBasePlugins(teamName);
+ if (currentBasePlugins != null && !currentBasePlugins.isEmpty())
+ basePlugins.addAll(currentBasePlugins);
+ }
- Set<String> basePlugins= aspectBindingReader.getBasePlugins(teamName);
- if (basePlugins == null || basePlugins.isEmpty()) {
- illegalBaseImportNoAspectBinding(imp, teamName);
+ if (basePlugins.isEmpty()) {
+ illegalBaseImportNoAspectBinding(imp, teamNames.isEmpty() ? null : teamNames.get(0));
return false;
}
String baseString = flattenSet(basePlugins);
@@ -165,14 +176,16 @@ public team class BaseImportChecker extends CompilationThreadWatcher
if (rule.aspectBindingData != null) {
for (Object data : rule.aspectBindingData) {
AdaptedBaseBundle info= (AdaptedBaseBundle) data;
- if (info.isAdaptedBy(teamName)) {
- // OK, no error
- if (info.hasPackageSplit) {
- ReferenceContext contextSave = getReferenceContext();
- baseImportFromSplitPackage(imp, baseString); // just a warning
- setReferenceContext(contextSave);
+ for (String teamName : teamNames) {
+ if (info.isAdaptedBy(teamName)) {
+ // OK, no error
+ if (info.hasPackageSplit) {
+ ReferenceContext contextSave = getReferenceContext();
+ baseImportFromSplitPackage(imp, baseString); // just a warning
+ setReferenceContext(contextSave);
+ }
+ return true;
}
- return true;
}
actualBases.add(info.getSymbolicName());
}
@@ -212,11 +225,20 @@ public team class BaseImportChecker extends CompilationThreadWatcher
}
return DecapsulationState.NONE;
}
- private String getReferenceTeam() {
+ private List<String> getReferenceTeams() {
TypeDeclaration type= getPublicType();
- if (type != null && type.isTeam())
- return new String(type.binding.readableName());
- return null;
+ if (type != null && type.isTeam()) {
+ List<String> names = new ArrayList<String>();
+ addTeamNames(type.binding, names);
+ return names;
+ }
+ return Collections.emptyList();
+ }
+ private void addTeamNames(ReferenceBinding type, List<String> names) {
+ names.add(String.valueOf(type.readableName()));
+ for (ReferenceBinding member : type.memberTypes())
+ if (member != null && member.isTeam())
+ addTeamNames(member, names);
}
private TypeDeclaration getPublicType() {
ReferenceContext context= getReferenceContext();
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
index 56d1b8e87..cf6b32349 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
@@ -180,7 +180,7 @@ public class OTEquinoxBuilderTests extends OTBuilderTests {
fullBuild();
expectingNoProblemsFor(trac18b.getPath());
expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] {
- new Problem("", "Illegal base import: no aspect binding declared for team MissingAspectBindingTeam (OT/Equinox).",
+ new Problem("", "Illegal base import: no aspect binding declared for team MissingAspectBindingTeam or any nested team (OT/Equinox).",
aspectPlugin.getPath().append(new Path("src/MissingAspectBindingTeam.java")),
12, 34,
CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_ERROR)

Back to the top