This site is maintained for archival purposes only. Eclipse projects have transitioned to GitHub and Eclipse GitLab. Use the Projects search tool to locate your project and access its latest code and issue tracker.
Bug 522022 - [9][create on paste] paste into package explorer should understand module-info.java
Summary: [9][create on paste] paste into package explorer should understand module-inf...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.7.3   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 529654
Blocks:
  Show dependency tree
 
Reported: 2017-09-07 18:11 EDT by Stephan Herrmann CLA
Modified: 2018-02-08 06:43 EST (History)
5 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 2017-09-07 18:11:30 EDT
Copy the content of some module-info.java from somewhere, paste it into the package explorer.

=> Instead of creating a module-info.java file it creates a Snippet.java class, inside of which the module syntax creates nothing but syntax errors :)
Comment 1 Stephan Herrmann CLA 2017-09-07 18:12:22 EDT
Putting this on our medium-term radar...
Comment 2 Jay Arthanareeswaran CLA 2017-11-16 02:15:03 EST
Ran into this a few times and already missing this, esp. during bug verification.

Can somebody guide me how to tackle this? I can take a stab at it.
Comment 3 Noopur Gupta CLA 2017-11-16 06:08:12 EST
(In reply to Jay Arthanareeswaran from comment #2)
> Ran into this a few times and already missing this, esp. during bug
> verification.
> 
> Can somebody guide me how to tackle this? I can take a stab at it.

See org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction. Fix should probably go in #parseCus method.
Comment 4 Eclipse Genie CLA 2018-01-15 06:27:37 EST
New Gerrit change created: https://git.eclipse.org/r/115378
Comment 6 Eclipse Genie CLA 2018-01-16 02:09:45 EST
New Gerrit change created: https://git.eclipse.org/r/115426
Comment 7 Eclipse Genie CLA 2018-01-16 02:28:00 EST
Gerrit change https://git.eclipse.org/r/115426 was merged to [R4_7_maintenance].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=7794f531e53d5560f2b6e6a528dcfd4135e306b9
Comment 8 Noopur Gupta CLA 2018-01-16 02:28:54 EST
Released the fix to master and R4_7.
Comment 9 Noopur Gupta CLA 2018-01-19 04:55:32 EST
ASTParser resets to defaults after each use so this fix doesn't work when no project is selected in Package Explorer.

Released the fix for that in master and R4_7:

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=182c5aac719cd51403ddd060e55cc7fc949f6e25

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?h=R4_7_maintenance&id=2a528615dacb4f9b7cb7c2ae03fa11bd837b16f8
Comment 10 Manoj N Palat CLA 2018-01-21 09:27:54 EST
(In reply to Stephan Herrmann from comment #0)
> Copy the content of some module-info.java from somewhere, paste it into the
> package explorer.
> 
> => Instead of creating a module-info.java file it creates a Snippet.java
> class, inside of which the module syntax creates nothing but syntax errors :)

follow up bug of 530096 raised for "invalid" module info texts
Comment 11 Noopur Gupta CLA 2018-01-23 09:30:27 EST
Verified as fixed in I20180122-2000 for 4.8 M5.
Comment 12 Noopur Gupta CLA 2018-02-08 06:43:54 EST
Verified for 4.7.3 in M20180207-1700.