Merge remote-tracking branch 'origin/master' into BETA_JAVA9
diff --git a/org.eclipse.jdt.junit/forceQualifierUpdate.txt b/org.eclipse.jdt.junit/forceQualifierUpdate.txt
new file mode 100644
index 0000000..c4c6f0d
--- /dev/null
+++ b/org.eclipse.jdt.junit/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update, add the bug here
+Bug 509973 - Comparator errors in I20170105-0320
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests/forceQualifierUpdate.txt b/org.eclipse.jdt.ui.tests/forceQualifierUpdate.txt
new file mode 100644
index 0000000..c4c6f0d
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update, add the bug here
+Bug 509973 - Comparator errors in I20170105-0320
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest.java
index 3765721..b522022 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -3433,6 +3433,47 @@
assertEqualString(cu.getSource(), buf.toString());
}
+ public void testBug508660() throws Exception {
+ IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+
+ IPackageFragment pack1= sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf1= new StringBuffer();
+ buf1.append("package test1;\n");
+ buf1.append("public interface ISomeInterface {\n");
+ buf1.append(" class FirstInnerClass {}\n");
+ buf1.append(" public class SecondInnerClass {}\n");
+ buf1.append("}\n");
+ pack1.createCompilationUnit("ISomeInterface.java", buf1.toString(), false, null);
+
+ IPackageFragment pack2= sourceFolder.createPackageFragment("test2", false, null);
+ StringBuffer buf2= new StringBuffer();
+ buf2.append("package test2;\n");
+ buf2.append("public class Test {\n");
+ buf2.append(" private FirstInnerClass first;\n");
+ buf2.append(" private SecondInnerClass second;\n");
+ buf2.append("}\n");
+ ICompilationUnit cu2= pack2.createCompilationUnit("Test.java", buf2.toString(), false, null);
+
+ String[] order= new String[0];
+ IChooseImportQuery query= createQuery("C", new String[] {}, new int[] {});
+
+ OrganizeImportsOperation op= createOperation(cu2, order, 99, false, true, true, query);
+ op.run(null);
+
+ buf2= new StringBuffer();
+ buf2.append("package test2;\n");
+ buf2.append("\n");
+ buf2.append("import test1.ISomeInterface.FirstInnerClass;\n");
+ buf2.append("import test1.ISomeInterface.SecondInnerClass;\n");
+ buf2.append("\n");
+ buf2.append("public class Test {\n");
+ buf2.append(" private FirstInnerClass first;\n");
+ buf2.append(" private SecondInnerClass second;\n");
+ buf2.append("}\n");
+
+ assertEqualString(cu2.getSource(), buf2.toString());
+ }
+
protected OrganizeImportsOperation createOperation(ICompilationUnit cu, String[] order, int threshold, boolean ignoreLowerCaseNames, boolean save, boolean allowSyntaxErrors, IChooseImportQuery chooseImportQuery) {
setOrganizeImportSettings(order, threshold, threshold, cu.getJavaProject());
return new OrganizeImportsOperation(cu, null, ignoreLowerCaseNames, save, allowSyntaxErrors, chooseImportQuery);
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/OrganizeImportsOperation.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/OrganizeImportsOperation.java
index 2ea1f69..094213d 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/OrganizeImportsOperation.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/OrganizeImportsOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -67,6 +67,7 @@
import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer;
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
+import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.corext.util.TypeNameMatchCollector;
@@ -453,7 +454,13 @@
if (Flags.isPrivate(flags)) {
return false;
}
- if (Flags.isPublic(flags) || Flags.isProtected(flags)) {
+ boolean isPublic;
+ try {
+ isPublic= JdtFlags.isPublic(curr.getType());
+ } catch (JavaModelException e) {
+ isPublic= Flags.isPublic(flags);
+ }
+ if (isPublic || Flags.isProtected(flags)) {
return true;
}
return curr.getPackageName().equals(fCurrPackage.getElementName());
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java
index eba8901..f53778d 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JDTUIHelperClasses.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2016 IBM Corporation and others.
+ * Copyright (c) 2013, 2017 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
@@ -45,6 +45,9 @@
* Back-links in Javadoc from classes in org.eclipse.jdt.core.manipulation to this
* class are not possible, so we use line comments there: // @see JDTUIHelperClasses
* </p>
+ * <p>
+ * New helpers preferably go into the o.e.jdt.core.manipulation bundle.
+ * </p>
*
* Here's a list of the most important helper classes:
*
diff --git a/org.eclipse.jdt.ui/forceQualifierUpdate.txt b/org.eclipse.jdt.ui/forceQualifierUpdate.txt
new file mode 100644
index 0000000..c4c6f0d
--- /dev/null
+++ b/org.eclipse.jdt.ui/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update, add the bug here
+Bug 509973 - Comparator errors in I20170105-0320
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java
index 23c8b15..37dd516 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -200,7 +200,7 @@
parentTypeBinding= Bindings.getBindingOfParentType(node);
}
}
- final IType receiverType= parentTypeBinding != null ? (IType) parentTypeBinding.getJavaElement() : null;
+ final IType receiverType= getType(parentTypeBinding);
if (receiverType == null) {
openQuickHierarchy(editor);
return;
@@ -315,6 +315,21 @@
}
}
+ private static IType getType(ITypeBinding typeBinding) {
+ if (typeBinding == null) {
+ return null;
+ }
+ if (typeBinding.isTypeVariable()) {
+ ITypeBinding[] typeBounds= typeBinding.getTypeBounds();
+ if (typeBounds.length > 0) {
+ typeBinding= typeBounds[0].getTypeDeclaration();
+ } else {
+ return null;
+ }
+ }
+ return (IType) typeBinding.getJavaElement();
+ }
+
/**
* Checks whether or not a method can be overridden.
*
diff --git a/org.eclipse.ltk.core.refactoring/forceQualifierUpdate.txt b/org.eclipse.ltk.core.refactoring/forceQualifierUpdate.txt
new file mode 100644
index 0000000..c4c6f0d
--- /dev/null
+++ b/org.eclipse.ltk.core.refactoring/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update, add the bug here
+Bug 509973 - Comparator errors in I20170105-0320
\ No newline at end of file