Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 282617 Details for
Bug 562131
[15] Create JavaSE-x-systempackages.profile for Java 15
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
temp code
temp_code.patch (text/plain), 3.89 KB, created by
Vikas Chandra
on 2020-04-29 05:56:53 EDT
(
hide
)
Description:
temp code
Filename:
MIME Type:
Creator:
Vikas Chandra
Created:
2020-04-29 05:56:53 EDT
Size:
3.89 KB
patch
obsolete
>diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java >index d40e4dc..49db43a 100644 >--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java >+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ApiBaseline.java >@@ -17,6 +17,7 @@ > import java.io.File; > import java.io.IOException; > import java.io.InputStream; >+import java.lang.reflect.Method; > import java.net.URL; > import java.net.URLConnection; > import java.util.ArrayList; >@@ -79,6 +80,7 @@ > */ > public class ApiBaseline extends ApiElement implements IApiBaseline, IVMInstallChangedListener { > >+ private String fVMPackages = null; > /** > * Empty array of component > */ >@@ -293,6 +295,61 @@ > } > > >+ @SuppressWarnings("unused") >+ private String getVMPackages() { >+ if (fVMPackages == null) { >+ fVMPackages = calculateVMPackages(); >+ } >+ return fVMPackages; >+ >+ } >+ >+ /* >+ * Copied from org.eclipse.osgi.storage.Storage.calculateVMPackages >+ */ >+ >+ private String calculateVMPackages() { >+ try { >+ List<String> packages = new ArrayList<>(); >+ Class<?> moduleLayerClass = Class.forName("java.lang.ModuleLayer"); //$NON-NLS-1$ >+ Method boot = moduleLayerClass.getMethod("boot"); //$NON-NLS-1$ >+ Method modules = moduleLayerClass.getMethod("modules"); //$NON-NLS-1$ >+ Class<?> moduleClass = Class.forName("java.lang.Module"); //$NON-NLS-1$ >+ Method getDescriptor = moduleClass.getMethod("getDescriptor"); //$NON-NLS-1$ >+ Class<?> moduleDescriptorClass = Class.forName("java.lang.module.ModuleDescriptor"); //$NON-NLS-1$ >+ Method exports = moduleDescriptorClass.getMethod("exports"); //$NON-NLS-1$ >+ Class<?> exportsClass = Class.forName("java.lang.module.ModuleDescriptor$Exports"); //$NON-NLS-1$ >+ Method targets = exportsClass.getMethod("targets"); //$NON-NLS-1$ >+ Method source = exportsClass.getMethod("source"); //$NON-NLS-1$ >+ >+ Object bootLayer = boot.invoke(null); >+ Set<?> bootModules = (Set<?>) modules.invoke(bootLayer); >+ for (Object m : bootModules) { >+ Object descriptor = getDescriptor.invoke(m); >+ for (Object export : (Set<?>) exports.invoke(descriptor)) { >+ String pkg = (String) source.invoke(export); >+ if (((Set<?>) targets.invoke(export)).isEmpty() && !pkg.startsWith("java.")) { //$NON-NLS-1$ >+ packages.add(pkg); >+ } >+ } >+ } >+ Collections.sort(packages); >+ StringBuilder result = new StringBuilder(); >+ for (String pkg : packages) { >+ if (result.length() != 0) { >+ result.append(',').append(' '); >+ } >+ result.append(pkg); >+ } >+ return result.toString(); >+ } catch (Exception e) { >+ // equinoxContainer.getLogServices().log(EquinoxContainer.NAME, >+ // FrameworkLogEntry.ERROR, "Error determining system packages.", >+ // e); //$NON-NLS-1$ >+ return null; >+ } >+ } >+ > /** > * Initializes this baseline from the given properties. > * >@@ -303,6 +360,11 @@ > private void initialize(Properties profile, ExecutionEnvironmentDescription description) throws CoreException { > String value = profile.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); > if (value == null) { >+ >+ if (value == null) { >+ // Java 10 onwards calculate this on runtime. >+ // value = getVMPackages(); >+ } > // In Java-10 and beyond, we take systempackages list from > // org.eclipse.pde.api.tools\system_packages\JavaSE-x-systempackages.profile > // They are calculated by launching eclipse in Java x and then using >@@ -317,6 +379,9 @@ > if (value != null) { > systemPackages = value.split(","); //$NON-NLS-1$ > } >+ for (String string : systemPackages) { >+ System.out.println(string + " "); //$NON-NLS-1$ >+ } > if (!(this instanceof WorkspaceBaseline)) { > Dictionary<String, Object> dictionary = new Hashtable<>(); > dictionary.put(Constants.FRAMEWORK_SYSTEMPACKAGES, value);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 562131
: 282617