|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2013 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2014 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 297-300
Link Here
|
| 297 |
assertEqualString(cu.getSource(), buf.toString()); |
297 |
assertEqualString(cu.getSource(), buf.toString()); |
| 298 |
} |
298 |
} |
| 299 |
|
299 |
|
|
|
300 |
public void testStaticMethodReferenceImports_bug424172() throws Exception { |
| 301 |
IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src"); |
| 302 |
|
| 303 |
IPackageFragment pack0= sourceFolder.createPackageFragment("p", false, null); |
| 304 |
StringBuffer buf= new StringBuffer(); |
| 305 |
buf.append("package p;\n"); |
| 306 |
buf.append("\n"); |
| 307 |
buf.append("import java.util.function.IntPredicate;\n"); |
| 308 |
buf.append("\n"); |
| 309 |
buf.append("class UnusedStaticImport {\n"); |
| 310 |
buf.append(" boolean value = match(Character::isUpperCase, 'A');\n"); |
| 311 |
buf.append("\n"); |
| 312 |
buf.append(" public static boolean match(IntPredicate matcher, int codePoint) {\n"); |
| 313 |
buf.append(" return matcher.test(codePoint);\n"); |
| 314 |
buf.append(" }\n"); |
| 315 |
buf.append("}\n"); |
| 316 |
ICompilationUnit cu= pack0.createCompilationUnit("UnusedStaticImport.java", buf.toString(), false, null); |
| 317 |
|
| 318 |
String[] order= new String[] {}; |
| 319 |
IChooseImportQuery query= createQuery("StaticMethodReferenceImports_bug424172", new String[] {}, new int[] {}); |
| 320 |
|
| 321 |
OrganizeImportsOperation op= createOperation(cu, order, 99, false, true, true, query); |
| 322 |
op.run(null); |
| 323 |
|
| 324 |
buf= new StringBuffer(); |
| 325 |
buf.append("package p;\n"); |
| 326 |
buf.append("\n"); |
| 327 |
buf.append("import java.util.function.IntPredicate;\n"); |
| 328 |
buf.append("\n"); |
| 329 |
buf.append("class UnusedStaticImport {\n"); |
| 330 |
buf.append(" boolean value = match(Character::isUpperCase, 'A');\n"); |
| 331 |
buf.append("\n"); |
| 332 |
buf.append(" public static boolean match(IntPredicate matcher, int codePoint) {\n"); |
| 333 |
buf.append(" return matcher.test(codePoint);\n"); |
| 334 |
buf.append(" }\n"); |
| 335 |
buf.append("}\n"); |
| 336 |
assertEqualString(cu.getSource(), buf.toString()); |
| 337 |
} |
| 338 |
|
| 300 |
} |
339 |
} |