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 274971 Details for
Bug 536937
Create JavaSE-x-systempackages.profile for java 11
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.32 KB, created by
Vikas Chandra
on 2018-07-13 09:09:19 EDT
(
hide
)
Description:
temp_code
Filename:
MIME Type:
Creator:
Vikas Chandra
Created:
2018-07-13 09:09:19 EDT
Size:
3.32 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 e1aaffb..1557379 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 >@@ -14,6 +14,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; >@@ -300,6 +301,15 @@ > */ > private void initialize(Properties profile, ExecutionEnvironmentDescription description) throws CoreException { > String value = profile.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); >+ if (value == null) { // Java 10 onwards calculate this on runtime. >+ value = calculateVMPackages(); >+ String[] systemPackages2 = value.split(","); //$NON-NLS-1$ >+ System.out.println("total=" + systemPackages2.length); //$NON-NLS-1$ >+ for (int i = 0; i < systemPackages2.length; i++) { >+ System.out.println(systemPackages2[i]); >+ >+ } >+ } > if (value == null) { > // In Java-10 and beyond, we take systempackages list from > // org.eclipse.pde.api.tools\system_packages\JavaSE-x-systempackages.profile >@@ -651,6 +661,45 @@ > } > } > >+ 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; >+ } >+ } > /** > * Returns all of the visible dependent components from the current state > *
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 536937
: 274971