Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 525713

Summary: [9] Warn when consuming auto modules with unstable names
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, jarthana, manoj.palat, register.eclipse, sasikanth.bharadwaj
Version: 4.7.1   
Target Milestone: 4.8 M7   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/117598
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=ab20dcc315da3b88242cf9c4ff39323b4a718aa0
Whiteboard:
Bug Depends on:    
Bug Blocks: 534473    

Description Stephan Herrmann CLA 2017-10-07 09:15:59 EDT
See e.g. https://stackoverflow.com/questions/46501047/what-does-required-filename-based-automodules-detected-warning-mean

In particular this warning:

[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *

JDT should emit a similar warning, either under the responsibility of the builder (in a wholesale approach), or particularly on affected "requires" clauses.
Comment 1 Stephan Herrmann CLA 2017-10-07 09:17:01 EDT
Would be important sooner (while people start working with auto modules) rather than later (when all are explicit modules).
Comment 2 Eclipse Genie CLA 2018-02-17 17:37:04 EST
New Gerrit change created: https://git.eclipse.org/r/117598
Comment 3 Stephan Herrmann CLA 2018-02-17 17:45:19 EST
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/117598

Implemented the new warning.

A few things to callout in that patch (comments welcome!):

- determine whether auto-name is derived from manifest or file name 
  directly when using AutomaticModuleNaming, I hope I didn't break anything
  (wasn't 100% about the role of parameter 'skipDirectory').

- new message reads
  Name of automatic module ''{0}'' is unstable, it is derived from the module's file name.

- made this warning configurable via
  JavaCore.COMPILER_PB_UNSTABLE_AUTO_MODULE_NAME
  (new API)

- needed a way to suppress / configure from CLI
  => followed the example of javac and introduced warning token "module"

- added @SW support to modules
Comment 5 Stephan Herrmann CLA 2018-02-18 06:43:05 EST
(In reply to Eclipse Genie from comment #4)
> Gerrit change https://git.eclipse.org/r/117598 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=ab20dcc315da3b88242cf9c4ff39323b4a718aa0

Released for 4.8 M6

Still happy to accept comments (e.g., re javadoc, message text etc.).
Comment 6 Jay Arthanareeswaran CLA 2018-03-08 10:33:27 EST
Verified for 4.8 M6 with build I20180308-0630
Comment 7 Dani Megert CLA 2018-05-02 13:15:07 EDT
There is no UI for this. I think this is wrong. Please provide a Gerrit change that adds this to the UI.
Comment 8 Stephan Herrmann CLA 2018-05-03 10:11:35 EDT
(In reply to Dani Megert from comment #7)
> There is no UI for this. I think this is wrong. Please provide a Gerrit
> change that adds this to the UI.

Any suggestions what the label should read?

The token for CLI and @SW is "module", modeled after javac. From them all we know is:

"module — Warns about the module system-related issues." [1]

Similarly, ecj --help has this:
  module             + module related problems.

On the preference page we already have a heading "Modules", so below that heading we probably want to be more specific, right?

The JavaCore constant says:

"Reporting when a module requires an auto module with an unstable name"

So perhaps the UI should say:

  "An automatic module with an unstable name is required:  [E/W/I/I]"

?



[1] https://docs.oracle.com/javase/9/tools/javac.htm
Comment 9 Dani Megert CLA 2018-05-03 10:22:49 EDT
(In reply to Stephan Herrmann from comment #8)
> So perhaps the UI should say:
> 
>   "An automatic module with an unstable name is required:  [E/W/I/I]"
> 
> ?

I'd be fine with that. I'm also fine doing this in 4.9 as long as we have a bug report that covers the UI work.
Comment 10 Stephan Herrmann CLA 2018-05-08 12:06:11 EDT
(In reply to Dani Megert from comment #9)
> (In reply to Stephan Herrmann from comment #8)
> > So perhaps the UI should say:
> > 
> >   "An automatic module with an unstable name is required:  [E/W/I/I]"
> > 
> > ?
> 
> I'd be fine with that. I'm also fine doing this in 4.9 as long as we have a
> bug report that covers the UI work.

Ran out of time, so here is bug 534473.

Reclosing the core part.
Comment 11 Jay Arthanareeswaran CLA 2018-05-10 12:38:05 EDT
Moving back to verified.