Bug 505934 - Scrapbook imports do not work
Summary: Scrapbook imports do not work
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 10
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-13 20:57 EDT by Simon Lieschke CLA
Modified: 2024-01-02 01:20 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Lieschke CLA 2016-10-13 20:57:10 EDT
Steps to reproduce:
1. Create a scrapbook page with the following trivial code: System.out.println(new ArrayList<String>());
2. Add the java.util package as an import for the scrapbook page (by right clicking and selecting "Set Imports...")
3. Select the line of code in the scrapbook page and execute it

Expected results:
The scrapbook page successfully executes and "[]" is output to the console.

Actual results:
The scrapbook page fails to execute and the text "The import java.util is never used" is inserted at the top of the scrapbook page

If I use the fully qualified classname for ArrayList in the scrapbook page code and remove the java.util package import the code executes as expected.

-- Configuration Details --
Product: Eclipse 4.6.1.20161007-1200 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.jdt 3.12.1.v20160907-1200
Comment 1 Lee Courtney CLA 2024-01-02 01:20:22 EST
This regression is still in Eclipse version 2023-12. :-( To reproduce create a new project with a trivial class, create Scrapbook, then try importing with the "Java Snippet Imports" icon, and attempt to reference the class. Get a missing class error.