Buggy code:
public static IJavaProject create ( IProject project ) { } public static IJavaElement create ( IResource resource ) { } public static IJavaModel create ( IWorkspaceRoot root ) { } public static IClassFile createClassFileFrom ( IFile file ) { } public static ICompilationUnit createCompilationUnitFrom ( IFile file ) { } public static IPackageFragmentRoot createJarPackageFragmentRootFrom ( IFile file ) { } public static IClasspathContainer getClasspathContainer ( IPath containerPath , IJavaProject project ) throws JavaModelException { } public static ClasspathContainerInitializer getClasspathContainerInitializer ( String containerID ) { } public static IPath getClasspathVariable ( final String variableName ) { } public static ClasspathVariableInitializer getClasspathVariableInitializer ( String variable ) { } public static String [ ] getClasspathVariableNames ( ) { } public static Hashtable getDefaultOptions ( ) { } public static String getEncoding ( ) { } public static JavaCore getJavaCore ( ) { } public static String getOption ( String optionName ) { } public static Hashtable getOptions ( ) { } public static Plugin getPlugin ( ) { } public static IClasspathEntry getResolvedClasspathEntry ( IClasspathEntry entry ) { } public static IPath getResolvedVariablePath ( IPath variablePath ) { } public static IWorkingCopy [ ] getSharedWorkingCopies ( IBufferFactory factory ) { } public static String [ ] getUserLibraryNames ( ) { } public static ICompilationUnit [ ] getWorkingCopies ( WorkingCopyOwner owner ) { } protected void initializeDefaultPluginPreferences ( ) { Preferences preferences = getPluginPreferences ( ) ; HashSet optionNames = JavaModelManager . getJavaModelManager ( ) . optionNames ; Map compilerOptionsMap = new CompilerOptions ( ) . getMap ( ) ; for ( Iterator iter = compilerOptionsMap . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( iter . next ( ) ) ) ; String optionName = ( ( String ) ( entry . getKey ( ) ) ) ; preferences . setDefault ( optionName , ( ( String ) ( entry . getValue ( ) ) ) ) ; optionNames . add ( optionName ) ; } preferences . setDefault ( JavaCore . COMPILER_LOCAL_VARIABLE_ATTR , JavaCore . GENERATE ) ; preferences . setDefault ( JavaCore . COMPILER_CODEGEN_UNUSED_LOCAL , JavaCore . PRESERVE ) ; preferences . setDefault ( JavaCore . COMPILER_TASK_TAGS , JavaCore . DEFAULT_TASK_TAGS ) ; preferences . setDefault ( JavaCore . COMPILER_TASK_PRIORITIES , JavaCore . DEFAULT_TASK_PRIORITIES ) ; preferences . setDefault ( JavaCore . COMPILER_TASK_CASE_SENSITIVE , JavaCore . ENABLED ) ; preferences . setDefault ( JavaCore . COMPILER_DOC_COMMENT_SUPPORT , JavaCore . ENABLED ) ; preferences . setDefault ( JavaCore . CORE_JAVA_BUILD_RESOURCE_COPY_FILTER , "" ) ; optionNames . add ( JavaCore . CORE_JAVA_BUILD_RESOURCE_COPY_FILTER ) ; preferences . setDefault ( JavaCore . CORE_JAVA_BUILD_INVALID_CLASSPATH , JavaCore . ABORT ) ; optionNames . add ( JavaCore . CORE_JAVA_BUILD_INVALID_CLASSPATH ) ; preferences . setDefault ( JavaCore . CORE_JAVA_BUILD_DUPLICATE_RESOURCE , JavaCore . WARNING ) ; optionNames . add ( JavaCore . CORE_JAVA_BUILD_DUPLICATE_RESOURCE ) ; preferences . setDefault ( JavaCore . CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER , JavaCore . CLEAN ) ; optionNames . add ( JavaCore . CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER ) ; preferences . setDefault ( JavaCore . CORE_JAVA_BUILD_ORDER , JavaCore . IGNORE ) ; optionNames . add ( JavaCore . CORE_JAVA_BUILD_ORDER ) ; preferences . setDefault ( JavaCore . CORE_INCOMPLETE_CLASSPATH , JavaCore . ERROR ) ; optionNames . add ( JavaCore . CORE_INCOMPLETE_CLASSPATH ) ; preferences . setDefault ( JavaCore . CORE_CIRCULAR_CLASSPATH , JavaCore . ERROR ) ; optionNames . add ( JavaCore . CORE_CIRCULAR_CLASSPATH ) ; preferences . setDefault ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL , JavaCore . IGNORE ) ; optionNames . add ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL ) ; preferences . setDefault ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS , JavaCore . ENABLED ) ; optionNames . add ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS ) ; preferences . setDefault ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS , JavaCore . ENABLED ) ; optionNames . add ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS ) ; optionNames . add ( JavaCore . CORE_ENCODING ) ; <START_BUG> Map codeFormatterOptionsMap = org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants . getDefaultSettings ( ) ; <END_BUG> for ( Iterator iter = codeFormatterOptionsMap . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( iter . next ( ) ) ) ; String optionName = ( ( String ) ( entry . getKey ( ) ) ) ; preferences . setDefault ( optionName , ( ( String ) ( entry . getValue ( ) ) ) ) ; optionNames . add ( optionName ) ; } preferences . setDefault ( JavaCore . FORMATTER_NEWLINE_OPENING_BRACE , JavaCore . DO_NOT_INSERT ) ; optionNames . add ( JavaCore . FORMATTER_NEWLINE_OPENING_BRACE ) ; preferences . setDefault ( JavaCore . FORMATTER_NEWLINE_CONTROL , JavaCore . DO_NOT_INSERT ) ; optionNames . add ( JavaCore . FORMATTER_NEWLINE_CONTROL ) ; preferences . setDefault ( JavaCore . FORMATTER_CLEAR_BLANK_LINES , JavaCore . PRESERVE_ONE ) ; optionNames . add ( JavaCore . FORMATTER_CLEAR_BLANK_LINES ) ; preferences . setDefault ( JavaCore . FORMATTER_NEWLINE_ELSE_IF , JavaCore . DO_NOT_INSERT ) ; optionNames . add ( JavaCore . FORMATTER_NEWLINE_ELSE_IF ) ; preferences . setDefault ( JavaCore . FORMATTER_NEWLINE_EMPTY_BLOCK , JavaCore . INSERT ) ; optionNames . add ( JavaCore . FORMATTER_NEWLINE_EMPTY_BLOCK ) ; preferences . setDefault ( JavaCore . FORMATTER_LINE_SPLIT , "80" ) ; optionNames . add ( JavaCore . FORMATTER_LINE_SPLIT ) ; preferences . setDefault ( JavaCore . FORMATTER_COMPACT_ASSIGNMENT , JavaCore . NORMAL ) ; optionNames . add ( JavaCore . FORMATTER_COMPACT_ASSIGNMENT ) ; preferences . setDefault ( JavaCore . FORMATTER_TAB_CHAR , JavaCore . TAB ) ; optionNames . add ( JavaCore . FORMATTER_TAB_CHAR ) ; preferences . setDefault ( JavaCore . FORMATTER_TAB_SIZE , "4" ) ; optionNames . add ( JavaCore . FORMATTER_TAB_SIZE ) ; preferences . setDefault ( JavaCore . FORMATTER_SPACE_CASTEXPRESSION , JavaCore . INSERT ) ; optionNames . add ( JavaCore . FORMATTER_SPACE_CASTEXPRESSION ) ; preferences . setDefault ( JavaCore . CODEASSIST_VISIBILITY_CHECK , JavaCore . DISABLED ) ; optionNames . add ( JavaCore . CODEASSIST_VISIBILITY_CHECK ) ;

Fix:
Map codeFormatterOptionsMap = DefaultCodeFormatterConstants . getJavaConventionsSettings ( ) ;