Bug 143684 - Creating of static imports is unavailable..
Summary: Creating of static imports is unavailable..
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All Windows 2000
: P3 major with 1 vote (vote)
Target Milestone: 3.2.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 127333
  Show dependency tree
 
Reported: 2006-05-25 06:45 EDT by Pawel Walkiewicz CLA
Modified: 2006-09-12 02:22 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix (4.00 KB, patch)
2006-05-25 13:23 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression tests (13.59 KB, patch)
2006-05-25 13:23 EDT, Olivier Thomann CLA
no flags Details | Diff
Improved fix and regression tests (18.67 KB, patch)
2006-06-20 07:24 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Walkiewicz CLA 2006-05-25 06:45:48 EDT
I'am trying to create a class in runtime using packageFragment.createCompilationUnit

and the when I am trying to create static import with :
compilationUnit.createImport(importName, null, Flags.AccStatic, null);
all I get is normal import instead of static one..

when I dig into the code I can see that class
org.eclipse.jdt.internal.core.CompilationUnit has a method 

public IImportDeclaration createImport(String importName, IJavaElement sibling, int flags, IProgressMonitor monitor) throws JavaModelException {
	// TODO (jerome) - consult flags to create static imports
	CreateImportOperation op = new CreateImportOperation(importName, this);
	if (sibling != null) {
		op.createBefore(sibling);
	}
	op.runOperation(monitor);
	return getImport(importName);
}

which as You can see doesn't use the flags parameter..
Comment 1 Olivier Thomann CLA 2006-05-25 13:23:07 EDT
Created attachment 42606 [details]
Proposed fix

This patch is also fixing the fact that the check for duplicate imports doesn't work as expected.
Comment 2 Olivier Thomann CLA 2006-05-25 13:23:26 EDT
Created attachment 42607 [details]
Regression tests
Comment 3 Olivier Thomann CLA 2006-05-25 13:24:04 EDT
Jérôme, please review the patch.
Setting as 3.2.1 as the API needs to be fixed.
Comment 4 Jerome Lanneluc CLA 2006-06-20 07:24:36 EDT
Created attachment 44909 [details]
Improved fix and regression tests
Comment 5 Jerome Lanneluc CLA 2006-06-20 07:37:01 EDT
Fix and tests released for 3.3M1 in HEAD and released for 3.2.1 in TARGET_321 branch.
Comment 6 Frederic Fusier CLA 2006-08-07 06:36:54 EDT
Verified for 3.3 M1 using build I20060807-0010.
Comment 7 Maxime Daniel CLA 2006-09-12 02:22:27 EDT
Verified for 3.2.1 using build M20060908-1655.