Bug 60257 SearchPattern API: R_CASE_SENSITIVE vs. boolean isCaseSensitive
The SearchPattern API for stringPattern searches to java elements is somewhat odd: There's a public constant R_CASE_SENSITIVE, which is not mentioned in the javadoc of createPattern(String stringPattern, int searchFor, int limitTo, int matchMode, boolean isCaseSensitive) , and there's also an extra boolean parameter isCaseSensitive. I don't see why R_CASE_SENSITIVE is made public if it should not be used by clients. On the other hand, it could also be turned into an official bit-flag and the boolean isCaseSensitive removed. To have both options seems strange to me.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/MainMethodSearchEngine.java
/**
	 * Searches for all main methods in the given scope.
	 * Valid styles are IJavaElementSearchConstants.CONSIDER_BINARIES and
	 * IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS
	 */
	public IType[] searchMainMethods(IRunnableContext context, final IJavaSearchScope scope, final int style) throws InvocationTargetException, InterruptedException  {
		int allFlags=  IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS | IJavaElementSearchConstants.CONSIDER_BINARIES;
		Assert.isTrue((style | allFlags) == allFlags);
		
		final IType[][] res= new IType[1][];
		
		IRunnableWithProgress runnable= new IRunnableWithProgress() {
			public void run(IProgressMonitor pm) throws InvocationTargetException {
				try {
					res[0]= searchMainMethods(pm, scope, style);
				} catch (CoreException e) {
					throw new InvocationTargetException(e);
				}
			}
		};
		context.run(true, true, runnable);
		
		return res[0];
	}
			
}