Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Green2017-10-11 12:05:12 -0400
committerFred Bricon2017-11-15 14:40:30 -0500
commitbc287cf165dadea3b5411f9cff94e320eb8516ee (patch)
tree737eb0614ac3404f243e5d93b12db6463c4cb08c /org.eclipse.m2e.jdt
parentaa37223eebe2aa8683f358853e532d704453c20a (diff)
downloadm2e-core-bc287cf165dadea3b5411f9cff94e320eb8516ee.tar.gz
m2e-core-bc287cf165dadea3b5411f9cff94e320eb8516ee.tar.xz
m2e-core-bc287cf165dadea3b5411f9cff94e320eb8516ee.zip
525880: preserve access rules when updating Java projects
Change-Id: Ib1b6f43afae3056a41337fbd863b314657e9126e Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=525880 Signed-off-by: David Green <david.green@tasktop.com>
Diffstat (limited to 'org.eclipse.m2e.jdt')
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
index 1acdf1a6..980e1a9e 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
@@ -31,6 +31,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -216,10 +217,15 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
protected void addMavenClasspathContainer(IClasspathDescriptor classpath) {
List<IClasspathEntryDescriptor> descriptors = classpath.getEntryDescriptors();
+ List<IAccessRule> accessRules = new ArrayList<>();
boolean isExported = false;
for(IClasspathEntryDescriptor descriptor : descriptors) {
if(MavenClasspathHelpers.isMaven2ClasspathContainer(descriptor.getPath())) {
isExported = descriptor.isExported();
+ List<IAccessRule> previousAccessRules = descriptor.getAccessRules();
+ if(previousAccessRules != null) {
+ accessRules.addAll(previousAccessRules);
+ }
break;
}
}
@@ -228,6 +234,9 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
// add new entry without removing existing entries first, see bug398121
IClasspathEntryDescriptor entryDescriptor = classpath.addEntry(cpe);
entryDescriptor.setExported(isExported);
+ for(IAccessRule accessRule : accessRules) {
+ entryDescriptor.addAccessRule(accessRule);
+ }
}
protected void addProjectSourceFolders(IClasspathDescriptor classpath, ProjectConfigurationRequest request,

Back to the top