Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 151581 Details for
Bug 235253
[organize imports] Organize imports removes needed import statement.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Test cases which show the bug is not reproducible.
bug235253_tests.patch (text/plain), 4.03 KB, created by
Kelly Campbell
on 2009-11-06 11:33:39 EST
(
hide
)
Description:
Test cases which show the bug is not reproducible.
Filename:
MIME Type:
Creator:
Kelly Campbell
Created:
2009-11-06 11:33:39 EST
Size:
4.03 KB
patch
obsolete
>diff --git a/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java b/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java >index 1c57400..5548dbf 100644 >--- a/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java >+++ b/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java >@@ -572,6 +572,96 @@ public class ImportRewriteTest extends AbstractJavaModelTests { > assertEqualString(cu.getSource(), buf.toString()); > } > >+ /** >+ * Test that a valid inner class glob import is not removed even if it's in the same package. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=235253" >+ */ >+ public void testAddImports_bug235253_glob() throws Exception { >+ StringBuffer buf= new StringBuffer(); >+ buf.append("package com.pack1;\n"); >+ buf.append("\n"); >+ buf.append("import com.pack1.A;\n"); >+ buf.append("import com.pack1.A.*;\n"); >+ buf.append("import com.pack2.B;\n"); >+ buf.append("\n"); >+ buf.append("public class C {\n"); >+ buf.append("}\n"); >+ >+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("com.pack1", false, null); >+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null); >+ ICompilationUnit aUnit= pack1.createCompilationUnit("A.java", "", false, null); >+ >+ IPackageFragment pack2= this.sourceFolder.createPackageFragment("com.pack2", false, null); >+ ICompilationUnit bUnit= pack2.createCompilationUnit("B.java", "", false, null); >+ bUnit.createType("class B {}", null, false, null); >+ IType aType= aUnit.createType("class A {}", null, false, null); >+ aType.createType("class Inner {}", null, false, null); >+ String[] order= new String[] { "java" }; >+ >+ ImportRewrite imports= newImportsRewrite(cu, order, 99, 99, false); >+ imports.addImport("com.pack1.A"); >+ imports.addImport("com.pack1.A.*"); >+ imports.addImport("com.pack2.B"); >+ >+ apply(imports); >+ >+ buf= new StringBuffer(); >+ buf.append("package com.pack1;\n"); >+ buf.append("\n"); >+ buf.append("import com.pack1.A.*;\n"); >+ buf.append("import com.pack2.B;\n"); >+ buf.append("\n"); >+ buf.append("public class C {\n"); >+ buf.append("}\n"); >+ assertEqualString(cu.getSource(), buf.toString()); >+ } >+ >+ /** >+ * Test that a valid inner class import is not removed even if it's in the same package. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=235253" >+ */ >+ public void testAddImports_bug235253_noglob() throws Exception { >+ StringBuffer buf= new StringBuffer(); >+ buf.append("package com.pack1;\n"); >+ buf.append("\n"); >+ buf.append("import com.pack1.A;\n"); >+ buf.append("import com.pack1.A.Inner;\n"); >+ buf.append("import com.pack2.B;\n"); >+ buf.append("\n"); >+ buf.append("public class C {\n"); >+ buf.append("}\n"); >+ >+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("com.pack1", false, null); >+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null); >+ ICompilationUnit aUnit= pack1.createCompilationUnit("A.java", "", false, null); >+ >+ IPackageFragment pack2= this.sourceFolder.createPackageFragment("com.pack2", false, null); >+ ICompilationUnit bUnit= pack2.createCompilationUnit("B.java", "", false, null); >+ bUnit.createType("class B {}", null, false, null); >+ IType aType= aUnit.createType("class A {}", null, false, null); >+ aType.createType("class Inner {}", null, false, null); >+ String[] order= new String[] { "java" }; >+ >+ ImportRewrite imports= newImportsRewrite(cu, order, 99, 99, false); >+ imports.addImport("com.pack1.A"); >+ imports.addImport("com.pack1.A.Inner"); >+ imports.addImport("com.pack2.B"); >+ >+ apply(imports); >+ >+ buf= new StringBuffer(); >+ buf.append("package com.pack1;\n"); >+ buf.append("\n"); >+ buf.append("import com.pack1.A.Inner;\n"); >+ buf.append("import com.pack2.B;\n"); >+ buf.append("\n"); >+ buf.append("public class C {\n"); >+ buf.append("}\n"); >+ assertEqualString(cu.getSource(), buf.toString()); >+ } >+ > public void testAddStaticImports1() throws Exception { > > IPackageFragment pack1= this.sourceFolder.createPackageFragment("pack1", false, null);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 235253
:
151581
|
152493
|
157791
|
158758
|
158804