Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'ui/org.eclipse.pde.core/src')
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/core/plugin/IPluginBase.java12
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java1
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEAuxiliaryState.java8
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEClasspathContainer.java39
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEState.java4
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java2
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/WorkspacePluginModelManager.java3
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/BundlePlugin.java5
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java6
9 files changed, 67 insertions, 13 deletions
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/plugin/IPluginBase.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/plugin/IPluginBase.java
index 5f37e0269b..170f140b30 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/plugin/IPluginBase.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/plugin/IPluginBase.java
@@ -179,4 +179,16 @@ public interface IPluginBase extends IExtensions, IIdentifiable {
*/
void setSchemaVersion(String schemaVersion) throws CoreException;
+ /**
+ * Returns whether this plugin exports its external annotations (.eea files)
+ * to be considered by clients performing annotation based null analysis.
+ * This is read from the manifest header
+ * {@code Eclipse-ExportExternalAnnotations}.
+ *
+ * @since 3.15
+ */
+ default boolean exportsExternalAnnotations() {
+ return false;
+ }
+
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java
index e28d771add..d61f5e38b9 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java
@@ -285,6 +285,7 @@ public interface ICoreConstants {
String ECLIPSE_SOURCE_REFERENCES = "Eclipse-SourceReferences"; //$NON-NLS-1$
String SERVICE_COMPONENT = "Service-Component"; //$NON-NLS-1$
String AUTOMATIC_MODULE_NAME = "Automatic-Module-Name"; //$NON-NLS-1$
+ String ECLIPSE_EXPORT_EXTERNAL_ANNOTATIONS = "Eclipse-ExportExternalAnnotations"; //$NON-NLS-1$
// Equinox-specific system properties
String OSGI_SYSTEM_BUNDLE = "osgi.system.bundle"; //$NON-NLS-1$
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEAuxiliaryState.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEAuxiliaryState.java
index d668d565bf..41996da2e4 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEAuxiliaryState.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEAuxiliaryState.java
@@ -95,6 +95,7 @@ public class PDEAuxiliaryState {
String project;
String localization;
String bundleSourceEntry;
+ boolean exportsExternalAnnotations;
}
/**
@@ -188,6 +189,11 @@ public class PDEAuxiliaryState {
return info == null ? null : info.bundleSourceEntry;
}
+ public boolean exportsExternalAnnotations(long bundleID) {
+ PluginInfo info = fPluginInfos.get(Long.toString(bundleID));
+ return info == null ? false : info.exportsExternalAnnotations;
+ }
+
/**
* Builds an xml document storing the auxiliary plugin info.
* @param dir directory location to create the file
@@ -375,6 +381,8 @@ public class PDEAuxiliaryState {
info.localization = manifest.get(Constants.BUNDLE_LOCALIZATION);
info.hasBundleStructure = hasBundleStructure;
info.bundleSourceEntry = manifest.get(ICoreConstants.ECLIPSE_SOURCE_BUNDLE);
+ info.exportsExternalAnnotations = "true" //$NON-NLS-1$
+ .equals(manifest.get(ICoreConstants.ECLIPSE_EXPORT_EXTERNAL_ANNOTATIONS));
fPluginInfos.put(Long.toString(desc.getBundleId()), info);
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEClasspathContainer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEClasspathContainer.java
index a631457afe..1274af0e79 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEClasspathContainer.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEClasspathContainer.java
@@ -16,6 +16,7 @@ package org.eclipse.pde.internal.core;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -24,6 +25,7 @@ import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.pde.core.plugin.IPluginLibrary;
import org.eclipse.pde.core.plugin.IPluginModelBase;
@@ -54,21 +56,28 @@ public class PDEClasspathContainer {
private static final IAccessRule EXCLUDE_ALL_RULE = JavaCore.newAccessRule(new Path("**/*"), IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER); //$NON-NLS-1$
- protected void addProjectEntry(IProject project, Rule[] rules, ArrayList<IClasspathEntry> entries) throws CoreException {
+ protected void addProjectEntry(IProject project, Rule[] rules, boolean exportsExternalAnnotations,
+ ArrayList<IClasspathEntry> entries) throws CoreException {
if (project.hasNature(JavaCore.NATURE_ID)) {
- IClasspathEntry entry = null;
- if (rules != null) {
- IAccessRule[] accessRules = getAccessRules(rules);
- entry = JavaCore.newProjectEntry(project.getFullPath(), accessRules, true, new IClasspathAttribute[0], false);
- } else {
- entry = JavaCore.newProjectEntry(project.getFullPath());
- }
+ IAccessRule[] accessRules = rules != null ? getAccessRules(rules) : null;
+ IClasspathAttribute[] extraAttribs = getClasspathAttributesForProject(project, exportsExternalAnnotations);
+ IClasspathEntry entry = JavaCore.newProjectEntry(project.getFullPath(), accessRules, true, extraAttribs, false);
if (!entries.contains(entry)) {
entries.add(entry);
}
}
}
+ private IClasspathAttribute[] getClasspathAttributesForProject(IProject project, boolean exportsExternalAnnotations)
+ throws JavaModelException {
+ if (exportsExternalAnnotations) {
+ String annotationPath = JavaCore.create(project).getOutputLocation().toString();
+ return new IClasspathAttribute[] {
+ JavaCore.newClasspathAttribute(IClasspathAttribute.EXTERNAL_ANNOTATION_PATH, annotationPath) };
+ }
+ return new IClasspathAttribute[0];
+ }
+
public static IClasspathEntry[] getExternalEntries(IPluginModelBase model) {
ArrayList<IClasspathEntry> entries = new ArrayList<>();
addExternalPlugin(model, new Rule[0], entries);
@@ -153,12 +162,20 @@ public class PDEClasspathContainer {
}
private static IClasspathAttribute[] getClasspathAttributes(IPluginModelBase model) {
+ List<IClasspathAttribute> attributes = new ArrayList<>();
JavadocLocationManager manager = PDECore.getDefault().getJavadocLocationManager();
String location = manager.getJavadocLocation(model);
- if (location == null) {
- return new IClasspathAttribute[0];
+ if (location != null) {
+ attributes
+ .add(JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, location));
+ }
+ if (model.getPluginBase().exportsExternalAnnotations()) {
+ String installLocation = model.getInstallLocation();
+ attributes.add(
+ JavaCore.newClasspathAttribute(IClasspathAttribute.EXTERNAL_ANNOTATION_PATH,
+ installLocation));
}
- return new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, location)};
+ return attributes.toArray(IClasspathAttribute[]::new);
}
private static synchronized IAccessRule getDiscouragedRule(IPath path) {
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEState.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEState.java
index 1a0cf66cd1..c7ccc40dc9 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEState.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEState.java
@@ -306,4 +306,8 @@ public class PDEState extends MinimalState {
return fAuxiliaryState.getBundleSourceEntry(bundleID);
}
+ public boolean exportsExternalAnnotations(long bundleID) {
+ return fAuxiliaryState.exportsExternalAnnotations(bundleID);
+ }
+
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java
index 310abc4798..3999a40576 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java
@@ -347,7 +347,7 @@ public class RequiredPluginsClasspathContainer extends PDEClasspathContainer imp
}
if (resource != null) {
- addProjectEntry(resource.getProject(), rules, entries);
+ addProjectEntry(resource.getProject(), rules, model.getPluginBase().exportsExternalAnnotations(), entries);
} else {
addExternalPlugin(model, rules, entries);
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/WorkspacePluginModelManager.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/WorkspacePluginModelManager.java
index a726211f24..30dd5e9c75 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/WorkspacePluginModelManager.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/WorkspacePluginModelManager.java
@@ -84,7 +84,8 @@ public class WorkspacePluginModelManager extends WorkspaceModelManager<IPluginMo
Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, //
IPDEBuildConstants.ECLIPSE_PLATFORM_FILTER, //
ICoreConstants.ECLIPSE_SYSTEM_BUNDLE, //
- ICoreConstants.ECLIPSE_SOURCE_BUNDLE)));
+ ICoreConstants.ECLIPSE_SOURCE_BUNDLE, //
+ ICoreConstants.ECLIPSE_EXPORT_EXTERNAL_ANNOTATIONS)));
private final ArrayList<IExtensionDeltaListener> fExtensionListeners = new ArrayList<>();
private ArrayList<ModelChange> fChangedExtensions = null;
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/BundlePlugin.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/BundlePlugin.java
index 1b253ce5ab..7965327eb3 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/BundlePlugin.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/BundlePlugin.java
@@ -52,4 +52,9 @@ public class BundlePlugin extends BundlePluginBase implements IBundlePlugin {
return "true".equals(getValue(ICoreConstants.EXTENSIBLE_API, false)); //$NON-NLS-1$
}
+ @Override
+ public boolean exportsExternalAnnotations() {
+ return "true".equals(getValue(ICoreConstants.ECLIPSE_EXPORT_EXTERNAL_ANNOTATIONS, false)); //$NON-NLS-1$
+ }
+
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java
index faf0a78266..046b9636b5 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java
@@ -51,6 +51,7 @@ public abstract class PluginBase extends AbstractExtensions implements IPluginBa
private String fVersion;
private boolean fHasBundleStructure;
private String fBundleSourceEntry;
+ private boolean fExportsExternalAnnotations;
public PluginBase(boolean readOnly) {
super(readOnly);
@@ -123,6 +124,7 @@ public abstract class PluginBase extends AbstractExtensions implements IPluginBa
fProviderName = state.getProviderName(bundleDesc.getBundleId());
fHasBundleStructure = state.hasBundleStructure(bundleDesc.getBundleId());
fBundleSourceEntry = state.getBundleSourceEntry(bundleDesc.getBundleId());
+ fExportsExternalAnnotations = state.exportsExternalAnnotations(bundleDesc.getBundleId());
loadRuntime(bundleDesc, state);
loadImports(bundleDesc);
}
@@ -443,4 +445,8 @@ public abstract class PluginBase extends AbstractExtensions implements IPluginBa
return fBundleSourceEntry;
}
+ public boolean exportsExternalAnnotations() {
+ return fExportsExternalAnnotations;
+ }
+
}

Back to the top