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 238849 Details for
Bug 424172
[1.8][organize imports] Unused static import for Character::isUpperCase added
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch + Test
Fixed-bug-424172-1.8-organize-imports-Unused-static-import.patch (text/plain), 4.52 KB, created by
Noopur Gupta
on 2014-01-10 04:10:24 EST
(
hide
)
Description:
Patch + Test
Filename:
MIME Type:
Creator:
Noopur Gupta
Created:
2014-01-10 04:10:24 EST
Size:
4.52 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest18.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest18.java >index db2d798..c374ceb 100644 >--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest18.java >+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest18.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2013 IBM Corporation and others. >+ * Copyright (c) 2000, 2014 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -297,4 +297,43 @@ > assertEqualString(cu.getSource(), buf.toString()); > } > >+ public void testStaticMethodReferenceImports_bug424172() throws Exception { >+ IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src"); >+ >+ IPackageFragment pack0= sourceFolder.createPackageFragment("p", false, null); >+ StringBuffer buf= new StringBuffer(); >+ buf.append("package p;\n"); >+ buf.append("\n"); >+ buf.append("import java.util.function.IntPredicate;\n"); >+ buf.append("\n"); >+ buf.append("class UnusedStaticImport {\n"); >+ buf.append(" boolean value = match(Character::isUpperCase, 'A');\n"); >+ buf.append("\n"); >+ buf.append(" public static boolean match(IntPredicate matcher, int codePoint) {\n"); >+ buf.append(" return matcher.test(codePoint);\n"); >+ buf.append(" }\n"); >+ buf.append("}\n"); >+ ICompilationUnit cu= pack0.createCompilationUnit("UnusedStaticImport.java", buf.toString(), false, null); >+ >+ String[] order= new String[] {}; >+ IChooseImportQuery query= createQuery("StaticMethodReferenceImports_bug424172", new String[] {}, new int[] {}); >+ >+ OrganizeImportsOperation op= createOperation(cu, order, 99, false, true, true, query); >+ op.run(null); >+ >+ buf= new StringBuffer(); >+ buf.append("package p;\n"); >+ buf.append("\n"); >+ buf.append("import java.util.function.IntPredicate;\n"); >+ buf.append("\n"); >+ buf.append("class UnusedStaticImport {\n"); >+ buf.append(" boolean value = match(Character::isUpperCase, 'A');\n"); >+ buf.append("\n"); >+ buf.append(" public static boolean match(IntPredicate matcher, int codePoint) {\n"); >+ buf.append(" return matcher.test(codePoint);\n"); >+ buf.append(" }\n"); >+ buf.append("}\n"); >+ assertEqualString(cu.getSource(), buf.toString()); >+ } >+ > } >diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java >index cc47871..8077379 100644 >--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java >+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java >@@ -24,6 +24,7 @@ > import org.eclipse.jdt.core.dom.ClassInstanceCreation; > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jdt.core.dom.Expression; >+import org.eclipse.jdt.core.dom.ExpressionMethodReference; > import org.eclipse.jdt.core.dom.FieldAccess; > import org.eclipse.jdt.core.dom.IBinding; > import org.eclipse.jdt.core.dom.IMethodBinding; >@@ -46,10 +47,12 @@ > import org.eclipse.jdt.core.dom.SimpleName; > import org.eclipse.jdt.core.dom.SimpleType; > import org.eclipse.jdt.core.dom.SingleMemberAnnotation; >+import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; > import org.eclipse.jdt.core.dom.SuperConstructorInvocation; > import org.eclipse.jdt.core.dom.TagElement; > import org.eclipse.jdt.core.dom.ThisExpression; > import org.eclipse.jdt.core.dom.TypeDeclaration; >+import org.eclipse.jdt.core.dom.TypeMethodReference; > > import org.eclipse.jdt.internal.corext.dom.GenericVisitor; > import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer; >@@ -162,6 +165,10 @@ > } > } > } else if (binding instanceof IMethodBinding) { >+ StructuralPropertyDescriptor locationInParent= simpleName.getLocationInParent(); >+ if (locationInParent == ExpressionMethodReference.NAME_PROPERTY || locationInParent == TypeMethodReference.NAME_PROPERTY) { >+ return; >+ } > IMethodBinding methodBinding= ((IMethodBinding) binding).getMethodDeclaration(); > ITypeBinding declaringClass= methodBinding.getDeclaringClass(); > if (declaringClass != null && !declaringClass.isLocal()) {
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 424172
:
238392
|
238395
| 238849