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

Bug 482026

Summary: Java import templates are broken above class
Product: [Eclipse Project] JDT Reporter: Jakob Jarosch <dev>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: dev
Version: 4.5.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug

Description Jakob Jarosch CLA 2015-11-12 11:04:52 EST
When creating a Java Template with the following contents and executing it above a newly created class (a class without any imports yet) it does create a broken import block.

-- Template ---
${:import(org.junit.experimental.categories.Category)}

@Category(com.sample.MyCategory.class)
---------------


--- Sample Class ---
package com.sample.mypackage;

<<Cursor>>
public class SampleTest {
}
--------------------


Now type the template name and press Ctrl+Space/Enter


--- Expected Class ---
package de.itdesign.meisterplan;

import org.junit.experimental.categories.Category;

@Category(com.sample.MyCategory.class)
public class SampleTest {
}
----------------------


--- Actual Class ----
package de.itdesign.meisterplan;

@Category(com.sample.MyCategory.class)rt org.junit.experimental.categories.Category;
public class SampleTest {
}
---------------------

So the import is now broken and after the actual @Category(...) annotation.
Comment 1 Eclipse Genie CLA 2020-05-04 13:44:39 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.