blob: 855d96eed44cd3e5288f8fab56b40fd193984481 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2010 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 org.eclipse.pde.api.tools.comparator.tests;
import org.eclipse.jdt.core.Flags;
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;
import org.eclipse.pde.api.tools.internal.provisional.comparator.DeltaProcessor;
import org.eclipse.pde.api.tools.internal.provisional.comparator.IDelta;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.util.Util;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Delta tests for field
*/
public class FieldDeltaTests extends DeltaTestSetup {
public static Test suite() {
return new TestSuite(FieldDeltaTests.class);
// TestSuite suite = new TestSuite(FieldDeltaTests.class.getName());
// suite.addTest(new FieldDeltaTests("test75"));
// return suite;
}
public FieldDeltaTests(String name) {
super(name);
}
@Override
public String getTestRoot() {
return "field"; //$NON-NLS-1$
}
/**
* Check change field type (interface)
*/
public void test1() {
deployBundles("test1"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field visibility - default to public
*/
public void test10() {
deployBundles("test10"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field visibility - private to public
*/
public void test11() {
deployBundles("test11"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field modifiers - final to non-final (field non static)
*/
public void test12() {
deployBundles("test12"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL_NON_STATIC, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field modifiers - final to non-final (field non static)
*/
public void test13() {
deployBundles("test13"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field modifiers - final to non-final (field non static)
*/
public void test14() {
deployBundles("test14"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.CLINIT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL_STATIC_CONSTANT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field modifiers - final to non-final (field non static)
*/
public void test15() {
deployBundles("test15"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL_STATIC_NON_CONSTANT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field modifiers - static to non static
*/
public void test16() {
deployBundles("test16"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.STATIC_TO_NON_STATIC, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field modifiers - non static to static
*/
public void test17() {
deployBundles("test17"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_STATIC_TO_STATIC, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field modifiers - transient to non transient
*/
public void test18() {
deployBundles("test18"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TRANSIENT_TO_NON_TRANSIENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field modifiers - non transient to transient
*/
public void test19() {
deployBundles("test19"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_TRANSIENT_TO_TRANSIENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field value (interface)
*/
public void test2() {
deployBundles("test2"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Decrease access
*/
public void test20() {
deployBundles("test20"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Decrease access
*/
public void test21() {
deployBundles("test21"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed static non final to static final
*/
public void test22() {
deployBundles("test22"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field modifiers - final to non-final (field non static)
*/
public void test23() {
deployBundles("test23"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.CLINIT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL_STATIC_CONSTANT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed value of non-visible field (default)
*/
public void test24() {
deployBundles("test24"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field modifiers - final to non-final (field non static)
*/
public void test25() {
deployBundles("test25"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.CLINIT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL_STATIC_CONSTANT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed value of non-visible field (private)
*/
public void test26() {
deployBundles("test26"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Added value of non-visible field (private)
*/
public void test27() {
deployBundles("test27"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed value of non-visible field (protected with extend restrictions)
*/
public void test28() {
deployBundles("test28"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("No extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed List<Integer> to List<String>
*/
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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field type (class)
*/
public void test3() {
deployBundles("test3"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed Map<String, Integer> to Map<String, String>
*/
public void test30() {
deployBundles("test30"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed Map to Map<String, String>
*/
public void test31() {
deployBundles("test31"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENTS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed List<String> to ArrayList<String>
*/
public void test32() {
deployBundles("test32"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed ArrayList<String> to ArrayList
*/
public void test33() {
deployBundles("test33"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed X<String, Integer, Number> to X<Integer, String, Number>
*/
public void test34() {
deployBundles("test34"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=218976
*/
public void test35() {
deployBundles("test35"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("No extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=222905
*/
public void test36() {
deployBundles("test36"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Should be compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=222905
*/
public void test37() {
deployBundles("test37"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=222905
*/
public void test38() {
deployBundles("test38"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertFalse("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.CLINIT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL_STATIC_CONSTANT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Remove compile-time constant
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=224994
*/
public void test39() {
deployBundles("test39"); //$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.CLINIT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[2];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field value (class)
*/
public void test4() {
deployBundles("test4"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Field addition
*/
public void test40() {
deployBundles("test40"); //$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", 6, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.CLINIT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[2];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[3];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[4];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[5];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.API_COMPONENT_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=225164
*/
public void test41() {
deployBundles("test41"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertTrue("Wrong restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertTrue("Wrong modifier", Flags.isProtected(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Added type arguments List<String>
*/
public void test42() {
deployBundles("test42"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENTS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field modifiers - volatile to non volatile
*/
public void test43() {
deployBundles("test43"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VOLATILE_TO_NON_VOLATILE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field modifiers - non volatile to volatile
*/
public void test44() {
deployBundles("test44"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_VOLATILE_TO_VOLATILE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Tag one existing field with @noreference
*/
public void test45() {
deployBundles("test45"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.API_FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Adding a field with @noreference
*/
public void test46() {
deployBundles("test46"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
assertTrue("Not empty", delta.isEmpty()); //$NON-NLS-1$
assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
}
/**
* Adding a field with @noreference
*/
public void test47() {
deployBundles("test47"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Removing @noreference on an existing field
*/
public void test48() {
deployBundles("test48"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Removing field tagged as @noreference
*/
public void test49() {
deployBundles("test49"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
assertTrue("Not NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
}
/**
* Check change field value (class) - no delta
*/
public void test5() {
deployBundles("test5"); //$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$
assertTrue("Not empty", delta.isEmpty()); //$NON-NLS-1$
assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
}
/**
* Removing field tagged as @noreference
*/
public void test50() {
deployBundles("test50"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Tag one existing protected field with @noreference
*/
public void test51() {
deployBundles("test51"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.API_FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Removing @noreference on an existing field
*/
public void test52() {
deployBundles("test52"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Removing @noreference on an existing field
*/
public void test53() {
deployBundles("test53"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check change field type (class) for protected field inside class tagged as @noextend
*/
public void test54() {
deployBundles("test54"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Remove method from internal super class with protected members (extend restriction)
*/
public void test55() {
deployBundles("test55"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
}
/**
* Changed Y<Integer, String> to Y<String>
*/
public void test56() {
deployBundles("test56"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_PARAMETER, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Changed Y<String> to Y<Integer, String>
*/
public void test57() {
deployBundles("test57"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE_PARAMETER, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("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.TYPE_ARGUMENT, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Private field to @noreference public field
*/
public void test58() {
deployBundles("test58"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
}
/**
* Private field to @noreference public field
*/
public void test59() {
deployBundles("test59"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @noreferece restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check decrease field visibility - public to protected
*/
public void test6() {
deployBundles("test6"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=244995
*/
public void test60() {
deployBundles("test60"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test61() {
deployBundles("test61"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test62() {
deployBundles("test62"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_STATIC_TO_STATIC, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test63() {
deployBundles("test63"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.STATIC_TO_NON_STATIC, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test64() {
deployBundles("test64"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test65() {
deployBundles("test65"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test66() {
deployBundles("test66"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test67() {
deployBundles("test67"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test68() {
deployBundles("test68"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244993
*/
public void test69() {
deployBundles("test69"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check decrease field visibility - public to default
*/
public void test7() {
deployBundles("test7"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=244994
*/
public void test70() {
deployBundles("test70"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=230189
*/
public void test71() {
deployBundles("test71"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, 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$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=230189
*/
public void test72() {
deployBundles("test72"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Should not be compatible", !DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertTrue("Is visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=244994
*/
public void test73() {
deployBundles("test73"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=244994
*/
public void test74() {
deployBundles("test74"); //$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", 2, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.CLINIT, child.getFlags()); //$NON-NLS-1$
assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
child = allLeavesDeltas[1];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=244994
*/
public void test75() {
deployBundles("test75"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.VALUE, child.getFlags()); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$
assertTrue("Is visible", !Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=277925
*/
public void test76() {
deployBundles("test76"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DEPRECATION, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_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=277925
*/
public void test77() {
deployBundles("test77"); //$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.API, null);
assertNotNull("No delta", delta); //$NON-NLS-1$
IDelta[] allLeavesDeltas = collectLeaves(delta);
assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DEPRECATION, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check decrease field visibility - public to private
*/
public void test8() {
deployBundles("test8"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
/**
* Check increase field visibility - protected to public
*/
public void test9() {
deployBundles("test9"); //$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", 1, allLeavesDeltas.length); //$NON-NLS-1$
IDelta child = allLeavesDeltas[0];
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$
assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$
assertEquals("Wrong element type", IDelta.FIELD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
}
}