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

Bug 561305

Summary: Java Comment Templates: Template does not load after restart when using git_config variable
Product: [Eclipse Project] JDT Reporter: Peter Bull <peter.bull>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: maxime.gamboni
Version: 4.15   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:

Description Peter Bull CLA 2020-03-20 18:18:10 EDT
Environment:
- Red Hat Enterprise Linux Server release 7.4 (Maipo)
- Eclipse Platform 4.15.0.I20200305-0155
- Eclipse Java Development Tools 3.18.300.v20200305-0155
- Git integration for Eclipse 5.7.0.202003110725-r

Steps:
1. Create a Java project
2. Go to Window > Preferences > Java > Code Style > Code Templates
3. Ensure "Automatically add comments for new methods, types, modules, packages and files" is checked
4. Select "Comments" > "Files", and click "Edit..."
5. In the Pattern field, insert text: /* myname:  ${name:git_config(user.name)} */
6. Click OK, then Apply and Close
7. Create a few new classes and check the generated comments
8. Restart Eclipse
9. Create a few new classes and check the generated comments
10. Go to Window > Preferences > Java > Code Style > Code Templates
11. Select "Comments" > "Files", and observe the contents of the Pattern field
12. Create a few new classes and observe the generated comments
13. Go to Window > Preferences > Java > Code Style > Code Templates
14. Select "Comments" > "Files", and observe the contents of the Pattern field

Expected results:
- Custom comment template is loaded and applied correctly at steps 7,9,11,12,14

Actual results:
- Default comment template (instead of custom template) is loaded/applied incorrectly at steps 9,11.
- Custom comment template is still loaded and applied correctly at steps 7,12,14.

I started noticing this problem somewhere between releases 4.8 and 4.13.
Comment 1 Maxime Gamboni CLA 2020-07-01 09:17:38 EDT
I have the same issue, but on Windows. Basically, each time I start Eclipse I have to remember to re-import code templates.

I have slightly newer versions:
Eclipse Platform 4.16.0.v20200604-0951
Eclipse Java Development Tools 3.18.400.v20200604-0540
Git integration for Eclipse 5.8.0.202006091008-r
Comment 2 Peter Bull CLA 2022-07-27 19:06:51 EDT
Closing this. Moved to https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/180