This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 531642 - Avoid using the incomplete JavaSE-9.profile
Summary: Avoid using the incomplete JavaSE-9.profile
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: BETA J18.3   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 528073 (view as bug list)
Depends on:
Blocks: 531263 531901
  Show dependency tree
 
Reported: 2018-02-25 08:02 EST by Stephan Herrmann CLA
Modified: 2018-06-25 02:33 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2018-02-25 08:02:38 EST
If I understand bug 527353 correctly, then o.e.osgi is moving away from static profiles to dynamically computing that information from the JVM.

OTOH, I still see org.eclipse.jdt.internal.launching.environments.ExecutionEnvironment.getProfileProperties() retrieving JavaSE-9.profile, which btw declares that it is not finalized (maybe never will?).

In bug 527353 comment 8 I'm seeking advice whether/how JDT could leverage the dyncamically computed information.

Symptom of the current situation: packages, e.g., in javafx.* are not covered by any positive access rule and hence excluded from features like code completion, see 
https://stackoverflow.com/questions/48969679/how-to-enable-auto-import-in-eclipse-for-javafx-classes/48973377
Comment 1 Stephan Herrmann CLA 2018-02-25 08:07:13 EST
One quick idea: since JDT/Core implements the same algorithm from JEP 261 as o.e.osgi does, do we at all need to read the list of system packages from any profile, or could we just say the default accessibility is entirely managed by jigsaw, not by profiles (still overridable by explicit access rules, if for whatever reasons users might need this)?
Comment 2 Sarika Sinha CLA 2018-02-25 23:04:08 EST
I am fine with it. So this should be targeted to beta 18_3 I assume?
Comment 3 Jay Arthanareeswaran CLA 2018-02-26 04:17:37 EST
(In reply to Stephan Herrmann from comment #1)
> One quick idea: since JDT/Core implements the same algorithm from JEP 261 as
> o.e.osgi does, do we at all need to read the list of system packages from
> any profile, or could we just say the default accessibility is entirely
> managed by jigsaw, not by profiles (still overridable by explicit access
> rules, if for whatever reasons users might need this)?

If these can be overridden that'll make everyone happy.
Comment 4 Sarika Sinha CLA 2018-03-07 14:21:01 EST
So how do we go about it? any suggestion?
Comment 5 Noopur Gupta CLA 2018-03-08 06:19:44 EST
Just to add the reference so that it is not lost - see bug 531263 comment #1: org.eclipse.jdt.launching.environments.IExecutionEnvironment.getComplianceOptions() return null for EE 10.
Comment 6 Stephan Herrmann CLA 2018-03-08 08:29:40 EST
I'm currently looking into this.

A quick question: what would be a proper way for detecting that an org.eclipse.jdt.launching.environments.IExecutionEnvironment has compliance 9 or greater?
- does a helper exist (e.g., based on env.getId() ("JavaSE-9"))?
- should we still read the profile to get the compliance level, but then simply ignore the list of system packages?
Comment 7 Eclipse Genie CLA 2018-03-08 08:49:08 EST
New Gerrit change created: https://git.eclipse.org/r/119000
Comment 8 Stephan Herrmann CLA 2018-03-08 08:52:44 EST
(In reply to Eclipse Genie from comment #7)
> New Gerrit change created: https://git.eclipse.org/r/119000

Draft.

Is this too naive?

Note, that here I'm still using the profile to retrieve the compliance level.

I can confirm that
- this makes javafx classes available in content assist by default.
- it is still possible to restrict access via explicit access rules.
Comment 9 Sarika Sinha CLA 2018-03-08 23:47:21 EST
(In reply to Stephan Herrmann from comment #8)
> (In reply to Eclipse Genie from comment #7)
> > New Gerrit change created: https://git.eclipse.org/r/119000
> 
> Draft.
> 
> Is this too naive?
> 
> Note, that here I'm still using the profile to retrieve the compliance level.
> 
> I can confirm that
> - this makes javafx classes available in content assist by default.
> - it is still possible to restrict access via explicit access rules.

Yes, otherwise looks fine but as we are not going to have the profile any more, we need to decide on how to handle that. How do we create the profile at run time like Osgi.
Comment 10 Stephan Herrmann CLA 2018-03-09 12:27:53 EST
What information previously obtained from the profile is needed? 
- the compliance (can we simply compute "9" from "JavaSE-9"?)
- the list of packages is *not* needed as per my patch
- what else?
Comment 11 Sarika Sinha CLA 2018-03-12 02:15:34 EDT
(In reply to Stephan Herrmann from comment #10)
> What information previously obtained from the profile is needed? 
> - the compliance (can we simply compute "9" from "JavaSE-9"?)
> - the list of packages is *not* needed as per my patch
> - what else?

COMPILER_COMPLIANCE, COMPILER_SOURCE, COMPILER_CODEGEN_TARGET_PLATFORM and COMPILER_RELEASE 
All bascially pointing 9 or 10 or so on.

So If we don't find a profile file from OSGI, can we just read the release file and find the version and set it ?
Comment 12 Sarika Sinha CLA 2018-03-13 07:18:43 EDT
My proposal -
IExecutionEnvironment and the schema executionEnvironments will need a new attribute for compliance (As the release file will not be available if the corresponding Java version is not available with the user).

This can be used instead of OSGI Profile to populate the initial properties.

This will also be required for proper ordering of Execution Environments in the preference page.

Does it sound ok?
Comment 13 Stephan Herrmann CLA 2018-03-13 11:40:09 EDT
(In reply to Sarika Sinha from comment #12)
> My proposal -
> IExecutionEnvironment and the schema executionEnvironments will need a new
> attribute for compliance (As the release file will not be available if the
> corresponding Java version is not available with the user).

And o.e.j.launching/plugin.xml will continue to provide these extensions, so for known environments, we will always have the compliance available without the aid of OSGi, right?

This would fit nicely into the existing gerrit, replacing the use of environment.getComplianceOptions()

The only thing I'm not sure of is: do we want to support future Java releases, or only those known at the time when o.e.j.launching is released?

If the pattern JavaSE-<version> is fixed long term (which honestly I don't know), then a simple string matching would achieve the same and be more open.

Another question: is adding a field in an extension point a breaking / incompatible change?
 
Other than those, your proposal sounds good to me.
Comment 14 Sarika Sinha CLA 2018-03-13 11:51:53 EDT
(In reply to Stephan Herrmann from comment #13)
> 
> The only thing I'm not sure of is: do we want to support future Java
> releases, or only those known at the time when o.e.j.launching is released?
> 
> If the pattern JavaSE-<version> is fixed long term (which honestly I don't
> know), then a simple string matching would achieve the same and be more open.
> 
> Another question: is adding a field in an extension point a breaking /
> incompatible change?
>  
> Other than those, your proposal sounds good to me.

I am planning to make it optional, so I guess it should not be a breaking change(Will check the rules again), but yes it will definitely be an API change and will have to seek PMC approval.

I don't plan to put for future releases right now.
Comment 15 Stephan Herrmann CLA 2018-03-13 11:59:52 EDT
(In reply to Sarika Sinha from comment #14)
> (In reply to Stephan Herrmann from comment #13)
> > 
> > The only thing I'm not sure of is: do we want to support future Java
> > releases, or only those known at the time when o.e.j.launching is released?
> > 
> > If the pattern JavaSE-<version> is fixed long term (which honestly I don't
> > know), then a simple string matching would achieve the same and be more open.
> > 
> > Another question: is adding a field in an extension point a breaking /
> > incompatible change?
> >  
> > Other than those, your proposal sounds good to me.
> 
> I am planning to make it optional, so I guess it should not be a breaking
> change(Will check the rules again), but yes it will definitely be an API
> change and will have to seek PMC approval.
> 
> I don't plan to put for future releases right now.

fine by me
Comment 16 Dani Megert CLA 2018-03-13 12:30:02 EDT
Adding an optional attribute to an extension point doesn't need PMC approval.


> I don't plan to put for future releases right now.

But definitely something to invest. The less manual/static work we have to do for a new release the better. Please open a bug report for that and cc us.
Comment 17 Dani Megert CLA 2018-03-13 12:39:06 EDT
This should go into 3a and 4.8.
Comment 18 Sarika Sinha CLA 2018-03-14 01:31:02 EDT
There are two more properties used from the profile :
org.eclipse.jdt.core.compiler.problem.assertIdentifier
org.eclipse.jdt.core.compiler.problem.enumIdentifier

They are error since 1.5

It was warning for -
J2SE-1.4.profile
OSGi_Minimum-1.2.profile  
CDC-1.1_Foundation-1.1.profile 

It was ignore in the initial ones -
CDC-1.0_Foundation-1.0.profile
OSGi_Minimum-1.0.profile
OSGi_Minimum-1.1.profile
J2SE-1.2.profile
J2SE-1.3.profile

Need to find out how is that arrived at so that launching can also populate it.
Comment 19 Sarika Sinha CLA 2018-03-14 01:51:53 EDT
(In reply to Dani Megert from comment #16)
> Adding an optional attribute to an extension point doesn't need PMC approval.
> 
> 
> > I don't plan to put for future releases right now.
> 
> But definitely something to invest. The less manual/static work we have to
> do for a new release the better. Please open a bug report for that and cc us.

We will need to add attribute in org.eclipse.jdt.launching.environments.IExecutionEnvironment which will I guess need pmc approval.

We already have Bug 531843 for Adding support for running unreleased JDKs with a warning.
Comment 20 Sarika Sinha CLA 2018-03-14 02:11:33 EDT
(In reply to Sarika Sinha from comment #19)

> 
> We will need to add attribute in
> org.eclipse.jdt.launching.environments.IExecutionEnvironment which will I
> guess need pmc approval.
> 
I am working to avoid it so that getComplianceOptions can handle it internally.
Comment 21 Dani Megert CLA 2018-03-14 05:52:45 EDT
(In reply to Sarika Sinha from comment #20)
> (In reply to Sarika Sinha from comment #19)
> 
> > 
> > We will need to add attribute in
> > org.eclipse.jdt.launching.environments.IExecutionEnvironment which will I
> > guess need pmc approval.
> > 
> I am working to avoid it so that getComplianceOptions can handle it
> internally.

If the correct thing is to add the APIs, then we should do so and ask the PMC.

The interface does not allow to be extended or implemented, so, adding stuff there is safe.
Comment 22 Eclipse Genie CLA 2018-03-15 02:49:59 EDT
New Gerrit change created: https://git.eclipse.org/r/119469
Comment 23 Eclipse Genie CLA 2018-03-16 04:47:32 EDT
Gerrit change https://git.eclipse.org/r/119469 was merged to [BETA_JAVA_18_3].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=93425086022ed4c127717fe75c609f5bf5d3e230
Comment 25 Eclipse Genie CLA 2018-03-16 08:02:04 EDT
New Gerrit change created: https://git.eclipse.org/r/119565
Comment 26 Eclipse Genie CLA 2018-03-21 01:09:13 EDT
Gerrit change https://git.eclipse.org/r/119565 was merged to [BETA_JAVA_18_3].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=89c62baa1ebcb971cf65b98c0db25ed10296ae6d
Comment 27 Sarika Sinha CLA 2018-03-21 04:57:48 EDT
Thanks Stephan!!
Comment 28 Sarika Sinha CLA 2018-03-21 04:58:18 EDT
*** Bug 528073 has been marked as a duplicate of this bug. ***
Comment 29 Sarika Sinha CLA 2018-03-22 10:16:50 EDT
Verified using
Eclipse SDK

Version: Photon (4.8)
Build id: I20180322-0645
Comment 30 Sarika Sinha CLA 2018-05-10 02:26:50 EDT
(In reply to Stephan Herrmann from comment #8)
> (In reply to Eclipse Genie from comment #7)
> > New Gerrit change created: https://git.eclipse.org/r/119000
> 
> Draft.
> 
> Is this too naive?
> 
> Note, that here I'm still using the profile to retrieve the compliance level.
> 
> I can confirm that
> - this makes javafx classes available in content assist by default.
> - it is still possible to restrict access via explicit access rules.

While adding the N&N entry, I got a doubt, shouldn't we use the release level instead of compliance level ?
Comment 31 Stephan Herrmann CLA 2018-05-10 05:58:35 EDT
(In reply to Sarika Sinha from comment #30)
> (In reply to Stephan Herrmann from comment #8)
> > (In reply to Eclipse Genie from comment #7)
> > > New Gerrit change created: https://git.eclipse.org/r/119000
> > 
> > Draft.
> > 
> > Is this too naive?
> > 
> > Note, that here I'm still using the profile to retrieve the compliance level.
> > 
> > I can confirm that
> > - this makes javafx classes available in content assist by default.
> > - it is still possible to restrict access via explicit access rules.
> 
> While adding the N&N entry, I got a doubt, shouldn't we use the release
> level instead of compliance level ?

I haven't followed the details of --release, but doesn't setting release imply use of the same level as compliance? OTOH, is a release level always available?
Comment 32 Sarika Sinha CLA 2018-05-11 06:24:58 EDT
(In reply to Stephan Herrmann from comment #31)
> > 
> > While adding the N&N entry, I got a doubt, shouldn't we use the release
> > level instead of compliance level ?
> 
> I haven't followed the details of --release, but doesn't setting release
> imply use of the same level as compliance? OTOH, is a release level always
> available?

Will check out the details!!
Comment 33 Sarika Sinha CLA 2018-06-18 02:38:28 EDT
I think then, we can remove these entries from /org.eclipse.jdt.launching/plugin.xml -


<environment
            description="%environment.description.13"
            id="JavaSE-9"
            ruleParticipant="org.eclipse.jdt.internal.launching.environments.DefaultAccessRuleParticipant">
      </environment> 
      <environment
            description="%environment.description.14"
            id="JavaSE-10"
            compliance="10"
            ruleParticipant="org.eclipse.jdt.internal.launching.environments.DefaultAccessRuleParticipant">
      </environment>

Then the check for COMPILER_COMPLIANCE is not required.

@Stephan, what do you think?
Comment 34 Sarika Sinha CLA 2018-06-25 02:33:13 EDT
(In reply to Sarika Sinha from comment #33)
> I think then, we can remove these entries from
> /org.eclipse.jdt.launching/plugin.xml -


Removing via Bug 536224.