I have this very strange test case where, when run in Eclipse, everything works fine, but when run as a tycho build, the test fails :
Basically, some piece of code calls JDT's JavaModelManager.createAnnotationProcessorManager(), an annotation processor manager is found in the extension points, instanciated but then, fails to pass the instanceof AbstractAnnotationProcessorManager assertion leading to some unexpected behavior afterwards.
I made up a small test project (attached) showcasing this problem, copying the code from JavaModelManager.createAnnotationProcessorManager() :
package foo.bar;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager;
import org.eclipse.jdt.internal.core.JavaModel;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.util.Util;
import org.junit.Test;
import static org.junit.Assert.*;
@SuppressWarnings("restriction")
public class AnnotationProcessorTest {
	@Test
	public void testJdtAptSupport() throws Exception {
		
		//AbstractAnnotationProcessorManager aapm = JavaModelManager.getJavaModelManager().createAnnotationProcessorManager();
		
		AbstractAnnotationProcessorManager aapm = createAnnotationProcessorManager();
		assertNotNull("Can't find an annotationProcessorManager", aapm);
	}
	
	/*
	 * Code copied from JavaModelManager.createAnnotationProcessorManager()
	 * 
	 * 
	 * Return a new Java 6 annotation processor manager.  The manager will need to
	 * be configured before it can be used.  Returns null if a manager cannot be
	 * created, i.e. if the current VM does not support Java 6 annotation processing.
	 */
	public AbstractAnnotationProcessorManager createAnnotationProcessorManager() {
		IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, "annotationProcessorManager");
		if (extension == null)
			return null;
		IExtension[] extensions = extension.getExtensions();
		IConfigurationElement annotationProcessorManagerFactory = null;
		for(int i = 0; i < extensions.length; i++) {
			if (i > 0) {
				Util.log(null, "An annotation processor manager is already registered: ignoring " + extensions[i].getUniqueIdentifier()); //$NON-NLS-1$
				break;
			}
			IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
			for(int j = 0; j < configElements.length; j++) {
				final IConfigurationElement configElement = configElements[j];
				if ("annotationProcessorManager".equals(configElement.getName())) { //$NON-NLS-1$
					annotationProcessorManagerFactory = configElement;
					break;
				}
			}
		}
		if (annotationProcessorManagerFactory == null) {
			return null;
		}
		final AbstractAnnotationProcessorManager[] apm = new AbstractAnnotationProcessorManager[1];
		apm[0] = null;
		final IConfigurationElement factory = annotationProcessorManagerFactory;
		SafeRunner.run(new ISafeRunnable() {
			public void handleException(Throwable exception) {
				Util.log(exception, "Exception occurred while loading annotation processor manager"); //$NON-NLS-1$
			}
			public void run() throws Exception {
				Object executableExtension = factory.createExecutableExtension("class"); //$NON-NLS-1$
				System.err.println(AbstractAnnotationProcessorManager.class.getClassLoader());
				System.err.println(executableExtension.getClass().getClassLoader());
                                //Classloaders are different in both eclipse and tycho builds, must be something else.
				if (executableExtension instanceof AbstractAnnotationProcessorManager) {
					apm[0] = (AbstractAnnotationProcessorManager) executableExtension;
				} else {
					System.err.println(executableExtension.getClass() + " not an instance of AbstractAnnotationProcessorManager");
				}
			}
		});
		return apm[0];
	}
}