Bug 507246 - Error reported on default method implementing an interface,
even if set to Ignore



Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/InterfaceDeltaTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/InterfaceDeltaTests.java
index 51bd210..882e040 100644
--- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/InterfaceDeltaTests.java
+++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/InterfaceDeltaTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 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
@@ -10,9 +10,6 @@
  *******************************************************************************/
 package org.eclipse.pde.api.tools.comparator.tests;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
 import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
 import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
 import org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator;
@@ -21,6 +18,9 @@
 import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
 import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 /**
  * Delta tests for interface
  */
@@ -758,6 +758,39 @@
 		assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
 		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
 	}
+
+	/**
+	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=507246
+	 */
+	public void test29() {
+		deployBundles("test29"); //$NON-NLS-1$
+		IApiBaseline before = getBeforeState();
+		IApiBaseline after = getAfterState();
+		IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME);
+		assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$
+		IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME);
+		assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$
+		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after,
+				VisibilityModifiers.ALL_VISIBILITIES, null);
+		assertNotNull("No delta", delta); //$NON-NLS-1$
+		IDelta[] allLeavesDeltas = collectLeaves(delta);
+		assertEquals("Wrong size", 3, allLeavesDeltas.length); //$NON-NLS-1$
+		IDelta child = allLeavesDeltas[0];
+		assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
+		assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$
+		assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
+		assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
+		child = allLeavesDeltas[1];
+		assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
+		assertEquals("Wrong flag", IDelta.DEFAULT_METHOD, child.getFlags()); //$NON-NLS-1$
+		assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
+		assertFalse("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
+		child = allLeavesDeltas[2];
+		assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
+		assertEquals("Wrong flag", IDelta.EXPANDED_SUPERINTERFACES_SET, child.getFlags()); //$NON-NLS-1$
+		assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
+		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
+	}
 	/**
 	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244984
 	 */
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/after/p/I.java b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/after/p/I.java
new file mode 100644
index 0000000..828cefc
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/after/p/I.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package p;
+
+public interface I extends J {
+	default void foo2(String s){
+	}
+}
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/after/p/J.java b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/after/p/J.java
new file mode 100644
index 0000000..3325ff2
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/after/p/J.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package p;
+
+public interface J {
+	void foo2(String s);
+}
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/before/p/I.java b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/before/p/I.java
new file mode 100644
index 0000000..0b6cfed
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/before/p/I.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package p;
+
+public interface I {
+	
+}
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/before/p/J.java b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/before/p/J.java
new file mode 100644
index 0000000..3325ff2
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/before/p/J.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package p;
+
+public interface J {
+	void foo2(String s);
+}
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/after/.api_description b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/after/.api_description
new file mode 100644
index 0000000..be8c55f
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/after/.api_description
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="deltatest">
+<plugin id="deltatest" />
+
+</component>
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/after/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/after/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7921bf0
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/after/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.7.0
+Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.)
+Bundle-ManifestVersion: 2
+Bundle-Name: deltatest Plug-in
+Bundle-SymbolicName: deltatest
+Bundle-Version: 2.0.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Export-Package: p
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/before/.api_description b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/before/.api_description
new file mode 100644
index 0000000..56f5524
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/before/.api_description
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="deltatest">
+<plugin id="deltatest" />
+</component>
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/before/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/before/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fd1bbdf
--- /dev/null
+++ b/apitools/org.eclipse.pde.api.tools.tests/tests-deltas/interface/test29/resources/before/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.7.0
+Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.)
+Bundle-ManifestVersion: 2
+Bundle-Name: deltatest Plug-in
+Bundle-SymbolicName: deltatest
+Bundle-Version: 1.0.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Export-Package: p
\ No newline at end of file
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java
index 9f5fa0a..7257030 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java
@@ -293,7 +293,11 @@
 								IApiMethod method = methods[j];
 								IApiMethod method3 = this.type1.getMethod(method.getName(), method.getSignature());
 								if (method3 == null) {
-									this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.SUPER_INTERFACE_WITH_METHODS, this.currentDescriptorRestrictions, this.initialDescriptorRestrictions, this.type1.getModifiers(), this.type2.getModifiers(), this.type1, this.type1.getName(), new String[] {
+									boolean isDefaultMethod = false;
+									if (this.type2.getMethod(method.getName(), method.getSignature()) != null) {
+										isDefaultMethod = this.type2.getMethod(method.getName(), method.getSignature()).isDefaultMethod();
+									}
+									this.addDelta(getElementType(this.type1), IDelta.ADDED, isDefaultMethod ? IDelta.DEFAULT_METHOD : IDelta.SUPER_INTERFACE_WITH_METHODS, this.currentDescriptorRestrictions, this.initialDescriptorRestrictions, this.type1.getModifiers(), this.type2.getModifiers(), this.type1, this.type1.getName(), new String[] {
 											Util.getDescriptorName(type1),
 											type.getName(),
 											getMethodDisplayName(method, type) });
@@ -356,7 +360,11 @@
 										}
 									}
 									if (!found) {
-										this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.SUPER_INTERFACE_WITH_METHODS, this.currentDescriptorRestrictions, this.initialDescriptorRestrictions, this.type1.getModifiers(), this.type2.getModifiers(), this.type1, this.type1.getName(), new String[] {
+										boolean isDefaultMethod = false;
+										if(this.type2.getMethod(method.getName(), method.getSignature())!=null) {
+											isDefaultMethod = this.type2.getMethod(method.getName(), method.getSignature()).isDefaultMethod();
+										}
+										this.addDelta(getElementType(this.type1), IDelta.ADDED, isDefaultMethod ? IDelta.DEFAULT_METHOD : IDelta.SUPER_INTERFACE_WITH_METHODS, this.currentDescriptorRestrictions, this.initialDescriptorRestrictions, this.type1.getModifiers(), this.type2.getModifiers(), this.type1, this.type1.getName(), new String[] {
 												Util.getDescriptorName(type1),
 												type.getName(),
 												getMethodDisplayName(method, type) });