text
stringlengths
30
1.67M
<s> package org . eclipse . jdt . core ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Plugin ; import org . eclipse . core . runtime . QualifiedName ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IMarkerDelta ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceChangeListener ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . IWorkspaceRunnable ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . search . IJavaSearchConstants ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . core . search . SearchEngine ; import org . eclipse . jdt . core . search . SearchPattern ; import org . eclipse . jdt . core . search . TypeNameRequestor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . core . builder . State ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import org . osgi . framework . BundleContext ; public final class JavaCore extends Plugin { private static final IResource [ ] NO_GENERATED_RESOURCES = new IResource [ <NUM_LIT:0> ] ; private static Plugin JAVA_CORE_PLUGIN = null ; public static final String PLUGIN_ID = "<STR_LIT>" ; public static final String BUILDER_ID = PLUGIN_ID + "<STR_LIT>" ; public static final String MODEL_ID = PLUGIN_ID + "<STR_LIT>" ; public static final String NATURE_ID = PLUGIN_ID + "<STR_LIT>" ; protected static final String ATT_HANDLE_ID = "<STR_LIT>" ; public static final String USER_LIBRARY_CONTAINER_ID = "<STR_LIT>" ; public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_CODEGEN_INLINE_JSR_BYTECODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_DOC_COMMENT_SUPPORT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD = "<STR_LIT>" ; public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_TYPE_ARGUMENTS_FOR_METHOD_INVOCATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_ENUM_IDENTIFIER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INDIRECT_STATIC_ACCESS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_LOCAL_VARIABLE_HIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FIELD_HIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_TYPE_PARAMETER_HIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FALLTHROUGH_CASE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_EMPTY_STATEMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_BOOLEAN_METHOD_THROWING_EXCEPTION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNNECESSARY_TYPE_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNNECESSARY_ELSE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_EXEMPT_EXCEPTION_AND_THROWABLE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNQUALIFIED_FIELD_ACCESS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNSAFE_TYPE_OPERATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNCHECKED_TYPE_OPERATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_RAW_TYPE_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FINAL_PARAMETER_BOUND = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_SERIAL_VERSION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_AUTOBOXING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_ANNOTATION_SUPER_INTERFACE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_OVERRIDE_ANNOTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_DEPRECATED_ANNOTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_HASHCODE_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEAD_CODE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DEAD_CODE_IN_TRIVIAL_IF_STATEMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCOMPLETE_ENUM_SWITCH = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_ENUM_CASE_DESPITE_DEFAULT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SWITCH_MISSING_DEFAULT_CASE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCONSISTENT_NULL_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_LABEL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_COMMENTS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FATAL_OPTIONAL_ERROR = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_PARAMETER_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_STATIC_ON_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_POTENTIALLY_MISSING_STATIC_ON_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNCLOSED_CLOSEABLE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_POTENTIALLY_UNCLOSED_CLOSEABLE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_EXPLICITLY_CLOSED_AUTOCLOSEABLE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_ANNOTATION_NULL_ANALYSIS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_NULLABLE_ANNOTATION_NAME = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_NONNULL_ANNOTATION_NAME = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_NONNULL_BY_DEFAULT_ANNOTATION_NAME = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NULL_SPECIFICATION_VIOLATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NULL_ANNOTATION_INFERENCE_CONFLICT = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NULL_UNCHECKED_CONVERSION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_REDUNDANT_NULL_ANNOTATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_SOURCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_COMPLIANCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_TASK_TAGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_TASK_CASE_SENSITIVE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_FORBIDDEN_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_DISCOURAGED_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SUPPRESS_WARNINGS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNHANDLED_WARNING_TOKEN = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_WARNING_TOKEN = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_NULL_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_POTENTIAL_NULL_REFERENCE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_REDUNDANT_NULL_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_OVERRIDING_METHOD_WITHOUT_SUPER_INVOCATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_COMPARING_IDENTICAL = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_UNUSED_OBJECT_ALLOCATION = PLUGIN_ID + "<STR_LIT>" ; public static final String COMPILER_PB_REDUNDANT_TYPE_ARGUMENTS = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_INCOMPATIBLE_JDK_LEVEL = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_ENCODING = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + "<STR_LIT>" ; public static final String CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE = PLUGIN_ID + "<STR_LIT>" ; public static final String TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_DEPRECATION_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_CAMEL_CASE_MATCH = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FINAL_FIELD_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_FORBIDDEN_REFERENCE_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_DISCOURAGED_REFERENCE_CHECK = PLUGIN_ID + "<STR_LIT>" ; public static final String CODEASSIST_SUGGEST_STATIC_IMPORTS = PLUGIN_ID + "<STR_LIT>" ; public static final String DEFAULT_TASK_TAG = "<STR_LIT>" ; public static final String DEFAULT_TASK_PRIORITY = "<STR_LIT>" ; public static final String DEFAULT_TASK_TAGS = "<STR_LIT>" ; public static final String DEFAULT_TASK_PRIORITIES = "<STR_LIT>" ; public static final String GENERATE = "<STR_LIT>" ; public static final String DO_NOT_GENERATE = "<STR_LIT>" ; public static final String PRESERVE = "<STR_LIT>" ; public static final String OPTIMIZE_OUT = "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITY_HIGH = "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITY_LOW = "<STR_LIT>" ; public static final String COMPILER_TASK_PRIORITY_NORMAL = "<STR_LIT>" ; public static final String VERSION_1_1 = "<STR_LIT>" ; public static final String VERSION_1_2 = "<STR_LIT>" ; public static final String VERSION_1_3 = "<STR_LIT>" ; public static final String VERSION_1_4 = "<STR_LIT>" ; public static final String VERSION_1_5 = "<STR_LIT>" ; public static final String VERSION_1_6 = "<STR_LIT>" ; public static final String VERSION_1_7 = "<STR_LIT>" ; public static final String VERSION_CLDC_1_1 = "<STR_LIT>" ; public static final String ABORT = "<STR_LIT>" ; public static final String ERROR = "<STR_LIT:error>" ; public static final String WARNING = "<STR_LIT>" ; public static final String IGNORE = "<STR_LIT>" ; public static final String COMPUTE = "<STR_LIT>" ; public static final String INSERT = "<STR_LIT>" ; public static final String DO_NOT_INSERT = "<STR_LIT>" ; public static final String PRESERVE_ONE = "<STR_LIT>" ; public static final String CLEAR_ALL = "<STR_LIT>" ; public static final String NORMAL = "<STR_LIT>" ; public static final String COMPACT = "<STR_LIT>" ; public static final String TAB = "<STR_LIT>" ; public static final String SPACE = "<STR_LIT>" ; public static final String ENABLED = "<STR_LIT>" ; public static final String DISABLED = "<STR_LIT>" ; public static final String CLEAN = "<STR_LIT>" ; public static final String PUBLIC = "<STR_LIT>" ; public static final String PROTECTED = "<STR_LIT>" ; public static final String DEFAULT = "<STR_LIT:default>" ; public static final String PRIVATE = "<STR_LIT>" ; public static final String NEVER = "<STR_LIT>" ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_NO_TAG = CompilerOptions . NO_TAG ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_RETURN_TAG = CompilerOptions . RETURN_TAG ; public static final String COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_STANDARD_TAGS = CompilerOptions . ALL_STANDARD_TAGS ; public static final String JAVA_SOURCE_CONTENT_TYPE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public JavaCore ( ) { super ( ) ; JAVA_CORE_PLUGIN = this ; } public static void addElementChangedListener ( IElementChangedListener listener ) { addElementChangedListener ( listener , ElementChangedEvent . POST_CHANGE | ElementChangedEvent . POST_RECONCILE ) ; } public static void addElementChangedListener ( IElementChangedListener listener , int eventMask ) { JavaModelManager . getDeltaState ( ) . addElementChangedListener ( listener , eventMask ) ; } public static void addJavaElementMarkerAttributes ( Map attributes , IJavaElement element ) { if ( element instanceof IMember ) element = ( ( IMember ) element ) . getClassFile ( ) ; if ( attributes != null && element != null ) attributes . put ( ATT_HANDLE_ID , element . getHandleIdentifier ( ) ) ; } private static void addNonJavaResources ( Object [ ] nonJavaResources , IContainer container , int rootPathSegmentCounts , ArrayList collector ) { for ( int i = <NUM_LIT:0> , max = nonJavaResources . length ; i < max ; i ++ ) { Object nonJavaResource = nonJavaResources [ i ] ; if ( nonJavaResource instanceof IFile ) { IFile file = ( IFile ) nonJavaResource ; IPath path = file . getFullPath ( ) . removeFirstSegments ( rootPathSegmentCounts ) ; IResource member = container . findMember ( path ) ; if ( member != null && member . exists ( ) ) { collector . add ( member ) ; } } else if ( nonJavaResource instanceof IFolder ) { IFolder folder = ( IFolder ) nonJavaResource ; IResource [ ] members = null ; try { members = folder . members ( ) ; } catch ( CoreException e ) { } if ( members != null ) { addNonJavaResources ( members , container , rootPathSegmentCounts , collector ) ; } } } } public static void addPreProcessingResourceChangedListener ( IResourceChangeListener listener ) { addPreProcessingResourceChangedListener ( listener , IResourceChangeEvent . POST_CHANGE ) ; } public static void addPreProcessingResourceChangedListener ( IResourceChangeListener listener , int eventMask ) { JavaModelManager . getDeltaState ( ) . addPreResourceChangedListener ( listener , eventMask ) ; } public void configureJavaElementMarker ( IMarker marker , IJavaElement element ) throws CoreException { if ( element instanceof IMember ) element = ( ( IMember ) element ) . getClassFile ( ) ; if ( marker != null && element != null ) marker . setAttribute ( ATT_HANDLE_ID , element . getHandleIdentifier ( ) ) ; } public static IJavaElement create ( String handleIdentifier ) { return create ( handleIdentifier , DefaultWorkingCopyOwner . PRIMARY ) ; } public static IJavaElement create ( String handleIdentifier , WorkingCopyOwner owner ) { if ( handleIdentifier == null ) { return null ; } if ( owner == null ) owner = DefaultWorkingCopyOwner . PRIMARY ; MementoTokenizer memento = new MementoTokenizer ( handleIdentifier ) ; JavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; return model . getHandleFromMemento ( memento , owner ) ; } public static IJavaElement create ( IFile file ) { return JavaModelManager . create ( file , null ) ; } public static IJavaElement create ( IFolder folder ) { return JavaModelManager . create ( folder , null ) ; } public static IJavaProject create ( IProject project ) { if ( project == null ) { return null ; } JavaModel javaModel = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; return javaModel . getJavaProject ( project ) ; } public static IJavaElement create ( IResource resource ) { return JavaModelManager . create ( resource , null ) ; } public static IJavaElement create ( IResource resource , IJavaProject project ) { return JavaModelManager . create ( resource , project ) ; } public static IJavaModel create ( IWorkspaceRoot root ) { if ( root == null ) { return null ; } return JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; } public static IClassFile createClassFileFrom ( IFile file ) { return JavaModelManager . createClassFileFrom ( file , null ) ; } public static ICompilationUnit createCompilationUnitFrom ( IFile file ) { return JavaModelManager . createCompilationUnitFrom ( file , null ) ; } public static IPackageFragmentRoot createJarPackageFragmentRootFrom ( IFile file ) { return JavaModelManager . createJarPackageFragmentRootFrom ( file , null ) ; } public static IClasspathContainer getClasspathContainer ( IPath containerPath , IJavaProject project ) throws JavaModelException { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IClasspathContainer container = manager . getClasspathContainer ( containerPath , project ) ; if ( container == JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) { return manager . getPreviousSessionContainer ( containerPath , project ) ; } return container ; } public static ClasspathContainerInitializer getClasspathContainerInitializer ( String containerID ) { Hashtable containerInitializersCache = JavaModelManager . getJavaModelManager ( ) . containerInitializersCache ; ClasspathContainerInitializer initializer = ( ClasspathContainerInitializer ) containerInitializersCache . get ( containerID ) ; if ( initializer == null ) { initializer = computeClasspathContainerInitializer ( containerID ) ; if ( initializer == null ) return null ; containerInitializersCache . put ( containerID , initializer ) ; } return initializer ; } private static ClasspathContainerInitializer computeClasspathContainerInitializer ( String containerID ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPCONTAINER_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { IConfigurationElement configurationElement = configElements [ j ] ; String initializerID = configurationElement . getAttribute ( "<STR_LIT:id>" ) ; if ( initializerID != null && initializerID . equals ( containerID ) ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_found_container_initializer ( containerID , configurationElement ) ; try { Object execExt = configurationElement . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( execExt instanceof ClasspathContainerInitializer ) { return ( ClasspathContainerInitializer ) execExt ; } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_failed_to_instanciate_container_initializer ( containerID , configurationElement ) ; e . printStackTrace ( ) ; } } } } } } return null ; } private static void verbose_failed_to_instanciate_container_initializer ( String containerID , IConfigurationElement configurationElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + containerID + '<STR_LIT:\n>' + "<STR_LIT>" + configurationElement . getAttribute ( "<STR_LIT:class>" ) , System . err ) ; } private static void verbose_found_container_initializer ( String containerID , IConfigurationElement configurationElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + containerID + '<STR_LIT:\n>' + "<STR_LIT>" + configurationElement . getAttribute ( "<STR_LIT:class>" ) ) ; } public static IPath getClasspathVariable ( final String variableName ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IPath variablePath = manager . variableGet ( variableName ) ; if ( variablePath == JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) { return manager . getPreviousSessionVariable ( variableName ) ; } if ( variablePath != null ) { if ( variablePath == JavaModelManager . CP_ENTRY_IGNORE_PATH ) return null ; return variablePath ; } final ClasspathVariableInitializer initializer = JavaCore . getClasspathVariableInitializer ( variableName ) ; if ( initializer != null ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE ) verbose_triggering_variable_initialization ( variableName , initializer ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_triggering_variable_initialization_invocation_trace ( ) ; manager . variablePut ( variableName , JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) ; boolean ok = false ; try { initializer . initialize ( variableName ) ; variablePath = manager . variableGet ( variableName ) ; if ( variablePath == JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) return null ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_variable_value_after_initialization ( variableName , variablePath ) ; manager . variablesWithInitializer . add ( variableName ) ; ok = true ; } catch ( RuntimeException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } catch ( Error e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } finally { if ( ! ok ) JavaModelManager . getJavaModelManager ( ) . variablePut ( variableName , null ) ; } } else { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) verbose_no_variable_initializer_found ( variableName ) ; } return variablePath ; } private static void verbose_no_variable_initializer_found ( String variableName ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName ) ; } private static void verbose_variable_value_after_initialization ( String variableName , IPath variablePath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName + '<STR_LIT:\n>' + "<STR_LIT>" + variablePath ) ; } private static void verbose_triggering_variable_initialization ( String variableName , ClasspathVariableInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private static void verbose_triggering_variable_initialization_invocation_trace ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public static String getClasspathVariableDeprecationMessage ( String variableName ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; String message = ( String ) manager . deprecatedVariables . get ( variableName ) ; if ( message != null ) { return message ; } IPath variablePath = manager . variableGet ( variableName ) ; if ( variablePath != null && variablePath != JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) { return null ; } Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPVARIABLE_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { IConfigurationElement configElement = configElements [ j ] ; String varAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( variableName . equals ( varAttribute ) ) { String deprecatedAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( deprecatedAttribute != null ) { return deprecatedAttribute ; } } } } } return null ; } public static ClasspathVariableInitializer getClasspathVariableInitializer ( String variable ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPVARIABLE_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { IConfigurationElement configElement = configElements [ j ] ; try { String varAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( variable . equals ( varAttribute ) ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_found_variable_initializer ( variable , configElement ) ; Object execExt = configElement . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( execExt instanceof ClasspathVariableInitializer ) { ClasspathVariableInitializer initializer = ( ClasspathVariableInitializer ) execExt ; String deprecatedAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( deprecatedAttribute != null ) { JavaModelManager . getJavaModelManager ( ) . deprecatedVariables . put ( variable , deprecatedAttribute ) ; } String readOnlyAttribute = configElement . getAttribute ( "<STR_LIT>" ) ; if ( JavaModelManager . TRUE . equals ( readOnlyAttribute ) ) { JavaModelManager . getJavaModelManager ( ) . readOnlyVariables . add ( variable ) ; } return initializer ; } } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_failed_to_instanciate_variable_initializer ( variable , configElement ) ; e . printStackTrace ( ) ; } } } } } return null ; } private static void verbose_failed_to_instanciate_variable_initializer ( String variable , IConfigurationElement configElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variable + '<STR_LIT:\n>' + "<STR_LIT>" + configElement . getAttribute ( "<STR_LIT:class>" ) , System . err ) ; } private static void verbose_found_variable_initializer ( String variable , IConfigurationElement configElement ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variable + '<STR_LIT:\n>' + "<STR_LIT>" + configElement . getAttribute ( "<STR_LIT:class>" ) ) ; } public static String [ ] getClasspathVariableNames ( ) { return JavaModelManager . getJavaModelManager ( ) . variableNames ( ) ; } public static Hashtable getDefaultOptions ( ) { return JavaModelManager . getJavaModelManager ( ) . getDefaultOptions ( ) ; } public static String getEncoding ( ) { try { return ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getDefaultCharset ( ) ; } catch ( IllegalStateException ise ) { return System . getProperty ( "<STR_LIT>" ) ; } catch ( CoreException ce ) { } return ResourcesPlugin . getEncoding ( ) ; } public static IResource [ ] getGeneratedResources ( IRegion region , boolean includesNonJavaResources ) { if ( region == null ) throw new IllegalArgumentException ( "<STR_LIT>" ) ; IJavaElement [ ] elements = region . getElements ( ) ; HashMap projectsStates = new HashMap ( ) ; ArrayList collector = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> , max = elements . length ; i < max ; i ++ ) { IJavaElement element = elements [ i ] ; IJavaProject javaProject = element . getJavaProject ( ) ; IProject project = javaProject . getProject ( ) ; State state = null ; State currentState = ( State ) projectsStates . get ( project ) ; if ( currentState != null ) { state = currentState ; } else { state = ( State ) JavaModelManager . getJavaModelManager ( ) . getLastBuiltState ( project , null ) ; if ( state != null ) { projectsStates . put ( project , state ) ; } } if ( state == null ) continue ; if ( element . getElementType ( ) == IJavaElement . JAVA_PROJECT ) { IPackageFragmentRoot [ ] roots = null ; try { roots = javaProject . getPackageFragmentRoots ( ) ; } catch ( JavaModelException e ) { } if ( roots == null ) continue ; IRegion region2 = JavaCore . newRegion ( ) ; for ( int j = <NUM_LIT:0> ; j < roots . length ; j ++ ) { region2 . add ( roots [ j ] ) ; } IResource [ ] res = getGeneratedResources ( region2 , includesNonJavaResources ) ; for ( int j = <NUM_LIT:0> , max2 = res . length ; j < max2 ; j ++ ) { collector . add ( res [ j ] ) ; } continue ; } IPath outputLocation = null ; try { outputLocation = javaProject . getOutputLocation ( ) ; } catch ( JavaModelException e ) { } IJavaElement root = element ; while ( root != null && root . getElementType ( ) != IJavaElement . PACKAGE_FRAGMENT_ROOT ) { root = root . getParent ( ) ; } if ( root == null ) continue ; IPackageFragmentRoot packageFragmentRoot = ( IPackageFragmentRoot ) root ; int rootPathSegmentCounts = packageFragmentRoot . getPath ( ) . segmentCount ( ) ; try { IClasspathEntry entry = packageFragmentRoot . getRawClasspathEntry ( ) ; IPath entryOutputLocation = entry . getOutputLocation ( ) ; if ( entryOutputLocation != null ) { outputLocation = entryOutputLocation ; } } catch ( JavaModelException e ) { e . printStackTrace ( ) ; } if ( outputLocation == null ) continue ; IContainer container = ( IContainer ) project . getWorkspace ( ) . getRoot ( ) . findMember ( outputLocation ) ; switch ( element . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : ICompilationUnit unit = ( ICompilationUnit ) element ; getGeneratedResource ( unit , container , state , rootPathSegmentCounts , collector ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : IPackageFragment fragment = ( IPackageFragment ) element ; ICompilationUnit [ ] compilationUnits = null ; try { compilationUnits = fragment . getCompilationUnits ( ) ; } catch ( JavaModelException e ) { } if ( compilationUnits == null ) continue ; for ( int j = <NUM_LIT:0> , max2 = compilationUnits . length ; j < max2 ; j ++ ) { getGeneratedResource ( compilationUnits [ j ] , container , state , rootPathSegmentCounts , collector ) ; } if ( includesNonJavaResources ) { Object [ ] nonJavaResources = null ; try { nonJavaResources = fragment . getNonJavaResources ( ) ; } catch ( JavaModelException e ) { } if ( nonJavaResources != null ) { addNonJavaResources ( nonJavaResources , container , rootPathSegmentCounts , collector ) ; } } break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : IPackageFragmentRoot fragmentRoot = ( IPackageFragmentRoot ) element ; if ( fragmentRoot . isArchive ( ) ) continue ; IJavaElement [ ] children = null ; try { children = fragmentRoot . getChildren ( ) ; } catch ( JavaModelException e ) { } if ( children == null ) continue ; for ( int j = <NUM_LIT:0> , max2 = children . length ; j < max2 ; j ++ ) { fragment = ( IPackageFragment ) children [ j ] ; ICompilationUnit [ ] units = null ; try { units = fragment . getCompilationUnits ( ) ; } catch ( JavaModelException e ) { } if ( units == null ) continue ; for ( int n = <NUM_LIT:0> , max3 = units . length ; n < max3 ; n ++ ) { getGeneratedResource ( units [ n ] , container , state , rootPathSegmentCounts , collector ) ; } if ( includesNonJavaResources ) { Object [ ] nonJavaResources = null ; try { nonJavaResources = fragment . getNonJavaResources ( ) ; } catch ( JavaModelException e ) { } if ( nonJavaResources != null ) { addNonJavaResources ( nonJavaResources , container , rootPathSegmentCounts , collector ) ; } } } break ; } } int size = collector . size ( ) ; if ( size != <NUM_LIT:0> ) { IResource [ ] result = new IResource [ size ] ; collector . toArray ( result ) ; return result ; } return NO_GENERATED_RESOURCES ; } private static void getGeneratedResource ( ICompilationUnit unit , IContainer container , State state , int rootPathSegmentCounts , ArrayList collector ) { IResource resource = unit . getResource ( ) ; char [ ] [ ] typeNames = state . getDefinedTypeNamesFor ( resource . getProjectRelativePath ( ) . toString ( ) ) ; if ( typeNames != null ) { IPath path = unit . getPath ( ) . removeFirstSegments ( rootPathSegmentCounts ) . removeLastSegments ( <NUM_LIT:1> ) ; for ( int j = <NUM_LIT:0> , max2 = typeNames . length ; j < max2 ; j ++ ) { IPath localPath = path . append ( new String ( typeNames [ j ] ) + "<STR_LIT:.class>" ) ; IResource member = container . findMember ( localPath ) ; if ( member != null && member . exists ( ) ) { collector . add ( member ) ; } } } else { IPath path = unit . getPath ( ) . removeFirstSegments ( rootPathSegmentCounts ) . removeLastSegments ( <NUM_LIT:1> ) ; path = path . append ( Util . getNameWithoutJavaLikeExtension ( unit . getElementName ( ) ) + "<STR_LIT:.class>" ) ; IResource member = container . findMember ( path ) ; if ( member != null && member . exists ( ) ) { collector . add ( member ) ; } } } public static JavaCore getJavaCore ( ) { return ( JavaCore ) getPlugin ( ) ; } public static String [ ] getJavaLikeExtensions ( ) { return CharOperation . toStrings ( Util . getJavaLikeExtensions ( ) ) ; } public static String getOption ( String optionName ) { return JavaModelManager . getJavaModelManager ( ) . getOption ( optionName ) ; } public static String getOptionForConfigurableSeverity ( int problemID ) { return CompilerOptions . optionKeyFromIrritant ( ProblemReporter . getIrritant ( problemID ) ) ; } public static Hashtable getOptions ( ) { return JavaModelManager . getJavaModelManager ( ) . getOptions ( ) ; } public static Plugin getPlugin ( ) { return JAVA_CORE_PLUGIN ; } public static IClasspathEntry getResolvedClasspathEntry ( IClasspathEntry entry ) { return JavaModelManager . getJavaModelManager ( ) . resolveVariableEntry ( entry , false ) ; } public static IPath getResolvedVariablePath ( IPath variablePath ) { return JavaModelManager . getJavaModelManager ( ) . getResolvedVariablePath ( variablePath , false ) ; } public static IWorkingCopy [ ] getSharedWorkingCopies ( IBufferFactory factory ) { if ( factory == null ) factory = BufferManager . getDefaultBufferManager ( ) . getDefaultBufferFactory ( ) ; return getWorkingCopies ( BufferFactoryWrapper . create ( factory ) ) ; } public static String [ ] getUserLibraryNames ( ) { return JavaModelManager . getUserLibraryManager ( ) . getUserLibraryNames ( ) ; } public static ICompilationUnit [ ] getWorkingCopies ( WorkingCopyOwner owner ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( owner == null ) owner = DefaultWorkingCopyOwner . PRIMARY ; ICompilationUnit [ ] result = manager . getWorkingCopies ( owner , false ) ; if ( result == null ) return JavaModelManager . NO_WORKING_COPY ; return result ; } public static void initializeAfterLoad ( IProgressMonitor monitor ) throws CoreException { try { if ( monitor != null ) { monitor . beginTask ( Messages . javamodel_initialization , <NUM_LIT:100> ) ; monitor . subTask ( Messages . javamodel_configuring_classpath_containers ) ; } JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; SubProgressMonitor subMonitor = null ; try { if ( monitor != null ) { subMonitor = new SubProgressMonitor ( monitor , <NUM_LIT> ) ; subMonitor . beginTask ( "<STR_LIT>" , <NUM_LIT:100> ) ; subMonitor . worked ( <NUM_LIT:5> ) ; manager . batchContainerInitializationsProgress . initializeAfterLoadMonitor . set ( subMonitor ) ; } if ( manager . forceBatchInitializations ( true ) ) { manager . getClasspathContainer ( Path . EMPTY , null ) ; } else { while ( manager . batchContainerInitializations == JavaModelManager . BATCH_INITIALIZATION_IN_PROGRESS ) { if ( subMonitor != null ) { subMonitor . subTask ( manager . batchContainerInitializationsProgress . subTaskName ) ; subMonitor . worked ( manager . batchContainerInitializationsProgress . getWorked ( ) ) ; } synchronized ( manager ) { try { manager . wait ( <NUM_LIT:100> ) ; } catch ( InterruptedException e ) { } } } } } finally { if ( subMonitor != null ) subMonitor . done ( ) ; manager . batchContainerInitializationsProgress . initializeAfterLoadMonitor . set ( null ) ; } if ( monitor != null ) monitor . subTask ( Messages . javamodel_resetting_source_attachment_properties ) ; final IJavaProject [ ] projects = manager . getJavaModel ( ) . getJavaProjects ( ) ; HashSet visitedPaths = new HashSet ( ) ; ExternalFoldersManager externalFoldersManager = JavaModelManager . getExternalManager ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { JavaProject javaProject = ( JavaProject ) projects [ i ] ; IClasspathEntry [ ] classpath ; try { classpath = javaProject . getResolvedClasspath ( ) ; } catch ( JavaModelException e ) { continue ; } if ( classpath != null ) { for ( int j = <NUM_LIT:0> , length2 = classpath . length ; j < length2 ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; if ( entry . getSourceAttachmentPath ( ) != null ) { IPath entryPath = entry . getPath ( ) ; if ( visitedPaths . add ( entryPath ) ) { Util . setSourceAttachmentProperty ( entryPath , null ) ; } } if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath entryPath = entry . getPath ( ) ; if ( ExternalFoldersManager . isExternalFolderPath ( entryPath ) && externalFoldersManager . getFolder ( entryPath ) == null ) { externalFoldersManager . addFolder ( entryPath , true ) ; } } } } } try { externalFoldersManager . createPendingFolders ( monitor ) ; } catch ( JavaModelException jme ) { Util . log ( jme , "<STR_LIT>" ) ; } if ( monitor != null ) monitor . subTask ( Messages . javamodel_initializing_delta_state ) ; manager . deltaState . rootsAreStale = true ; manager . deltaState . initializeRoots ( true ) ; if ( monitor != null ) monitor . subTask ( Messages . javamodel_configuring_searchengine ) ; SearchEngine engine = new SearchEngine ( ) ; IJavaSearchScope scope = SearchEngine . createWorkspaceScope ( ) ; try { engine . searchAllTypeNames ( null , SearchPattern . R_EXACT_MATCH , "<STR_LIT>" . toCharArray ( ) , SearchPattern . R_PATTERN_MATCH | SearchPattern . R_CASE_SENSITIVE , IJavaSearchConstants . CLASS , scope , new TypeNameRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) { } } , IJavaSearchConstants . CANCEL_IF_NOT_READY_TO_SEARCH , monitor == null ? null : new SubProgressMonitor ( monitor , <NUM_LIT> ) ) ; } catch ( JavaModelException e ) { } catch ( OperationCanceledException e ) { if ( monitor != null && monitor . isCanceled ( ) ) throw e ; } if ( monitor != null ) monitor . subTask ( Messages . javamodel_getting_build_state_number ) ; QualifiedName qName = new QualifiedName ( JavaCore . PLUGIN_ID , "<STR_LIT>" ) ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; String versionNumber = null ; try { versionNumber = root . getPersistentProperty ( qName ) ; } catch ( CoreException e ) { } final JavaModel model = manager . getJavaModel ( ) ; String newVersionNumber = Byte . toString ( State . VERSION ) ; if ( ! newVersionNumber . equals ( versionNumber ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; IWorkspaceRunnable runnable = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor progressMonitor2 ) throws CoreException { for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject project = projects [ i ] ; try { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getElementName ( ) ) ; new ClasspathValidation ( ( JavaProject ) project ) . validate ( ) ; project . getProject ( ) . touch ( progressMonitor2 ) ; } catch ( CoreException e ) { } } } } ; if ( monitor != null ) monitor . subTask ( Messages . javamodel_building_after_upgrade ) ; try { ResourcesPlugin . getWorkspace ( ) . run ( runnable , monitor ) ; } catch ( CoreException e ) { } try { root . setPersistentProperty ( qName , newVersionNumber ) ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } } try { if ( monitor != null ) monitor . subTask ( Messages . javamodel_refreshing_external_jars ) ; model . refreshExternalArchives ( null , monitor == null ? null : new SubProgressMonitor ( monitor , <NUM_LIT:1> ) ) ; } catch ( JavaModelException e ) { } } finally { if ( monitor != null ) monitor . done ( ) ; } } public static boolean isClasspathVariableReadOnly ( String variableName ) { return JavaModelManager . getJavaModelManager ( ) . readOnlyVariables . contains ( variableName ) ; } public static boolean isJavaLikeFileName ( String fileName ) { return Util . isJavaLikeFileName ( fileName ) ; } public static boolean isReferencedBy ( IJavaElement element , IMarker marker ) throws CoreException { if ( element instanceof IMember ) { IMember member = ( IMember ) element ; if ( member . isBinary ( ) ) { element = member . getClassFile ( ) ; } else { element = member . getCompilationUnit ( ) ; } } if ( element == null ) return false ; if ( marker == null ) return false ; String markerHandleId = ( String ) marker . getAttribute ( ATT_HANDLE_ID ) ; if ( markerHandleId == null ) return false ; IJavaElement markerElement = JavaCore . create ( markerHandleId ) ; while ( true ) { if ( element . equals ( markerElement ) ) return true ; if ( markerElement instanceof IClassFile ) { IType enclosingType = ( ( IClassFile ) markerElement ) . getType ( ) . getDeclaringType ( ) ; if ( enclosingType != null ) { markerElement = enclosingType . getClassFile ( ) ; continue ; } } break ; } return false ; } public static boolean isReferencedBy ( IJavaElement element , IMarkerDelta markerDelta ) throws CoreException { if ( element instanceof IMember ) { IMember member = ( IMember ) element ; if ( member . isBinary ( ) ) { element = member . getClassFile ( ) ; } else { element = member . getCompilationUnit ( ) ; } } if ( element == null ) return false ; if ( markerDelta == null ) return false ; String markerDeltarHandleId = ( String ) markerDelta . getAttribute ( ATT_HANDLE_ID ) ; if ( markerDeltarHandleId == null ) return false ; IJavaElement markerElement = JavaCore . create ( markerDeltarHandleId ) ; while ( true ) { if ( element . equals ( markerElement ) ) return true ; if ( markerElement instanceof IClassFile ) { IType enclosingType = ( ( IClassFile ) markerElement ) . getType ( ) . getDeclaringType ( ) ; if ( enclosingType != null ) { markerElement = enclosingType . getClassFile ( ) ; continue ; } } break ; } return false ; } public static IAccessRule newAccessRule ( IPath filePattern , int kind ) { return new ClasspathAccessRule ( filePattern , kind ) ; } public static IClasspathAttribute newClasspathAttribute ( String name , String value ) { return new ClasspathAttribute ( name , value ) ; } public static IClasspathEntry newContainerEntry ( IPath containerPath ) { return newContainerEntry ( containerPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , false ) ; } public static IClasspathEntry newContainerEntry ( IPath containerPath , boolean isExported ) { return newContainerEntry ( containerPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newContainerEntry ( IPath containerPath , IAccessRule [ ] accessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( containerPath == null ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; } else if ( containerPath . segmentCount ( ) < <NUM_LIT:1> ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + containerPath . makeRelative ( ) . toString ( ) + "<STR_LIT>" ) ; } if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_CONTAINER , containerPath , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , null , null , null , isExported , accessRules , true , extraAttributes ) ; } public static ITypeHierarchy newTypeHierarchy ( IRegion region , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { if ( region == null ) { throw new IllegalArgumentException ( Messages . hierarchy_nullRegion ) ; } ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( region , workingCopies , null , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public static IClasspathEntry newLibraryEntry ( IPath path , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath ) { return newLibraryEntry ( path , sourceAttachmentPath , sourceAttachmentRootPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , false ) ; } public static IClasspathEntry newLibraryEntry ( IPath path , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath , boolean isExported ) { return newLibraryEntry ( path , sourceAttachmentPath , sourceAttachmentRootPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newLibraryEntry ( IPath path , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath , IAccessRule [ ] accessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( path == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } boolean hasDotDot = ClasspathEntry . hasDotDot ( path ) ; if ( ! hasDotDot && ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + path ) ; if ( sourceAttachmentPath != null ) { if ( sourceAttachmentPath . isEmpty ( ) ) { sourceAttachmentPath = null ; } else if ( ! sourceAttachmentPath . isAbsolute ( ) ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + sourceAttachmentPath + "<STR_LIT>" ) ; } } return new ClasspathEntry ( IPackageFragmentRoot . K_BINARY , IClasspathEntry . CPE_LIBRARY , hasDotDot ? path : JavaProject . canonicalizedPath ( path ) , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , sourceAttachmentPath , sourceAttachmentRootPath , null , isExported , accessRules , false , extraAttributes ) ; } public static IClasspathEntry newProjectEntry ( IPath path ) { return newProjectEntry ( path , false ) ; } public static IClasspathEntry newProjectEntry ( IPath path , boolean isExported ) { if ( ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; return newProjectEntry ( path , ClasspathEntry . NO_ACCESS_RULES , true , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newProjectEntry ( IPath path , IAccessRule [ ] accessRules , boolean combineAccessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_PROJECT , path , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , null , null , null , isExported , accessRules , combineAccessRules , extraAttributes ) ; } public static IRegion newRegion ( ) { return new Region ( ) ; } public static IClasspathEntry newSourceEntry ( IPath path ) { return newSourceEntry ( path , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , null ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] exclusionPatterns ) { return newSourceEntry ( path , ClasspathEntry . INCLUDE_ALL , exclusionPatterns , null ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] exclusionPatterns , IPath specificOutputLocation ) { return newSourceEntry ( path , ClasspathEntry . INCLUDE_ALL , exclusionPatterns , specificOutputLocation ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] inclusionPatterns , IPath [ ] exclusionPatterns , IPath specificOutputLocation ) { return newSourceEntry ( path , inclusionPatterns , exclusionPatterns , specificOutputLocation , ClasspathEntry . NO_EXTRA_ATTRIBUTES ) ; } public static IClasspathEntry newSourceEntry ( IPath path , IPath [ ] inclusionPatterns , IPath [ ] exclusionPatterns , IPath specificOutputLocation , IClasspathAttribute [ ] extraAttributes ) { if ( path == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( ! path . isAbsolute ( ) ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( exclusionPatterns == null ) { exclusionPatterns = ClasspathEntry . EXCLUDE_NONE ; } if ( inclusionPatterns == null ) { inclusionPatterns = ClasspathEntry . INCLUDE_ALL ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_SOURCE , path , inclusionPatterns , exclusionPatterns , null , null , specificOutputLocation , false , null , false , extraAttributes ) ; } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath sourceAttachmentRootPath ) { return newVariableEntry ( variablePath , variableSourceAttachmentPath , sourceAttachmentRootPath , false ) ; } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath variableSourceAttachmentRootPath , boolean isExported ) { return newVariableEntry ( variablePath , variableSourceAttachmentPath , variableSourceAttachmentRootPath , ClasspathEntry . NO_ACCESS_RULES , ClasspathEntry . NO_EXTRA_ATTRIBUTES , isExported ) ; } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath variableSourceAttachmentRootPath , IAccessRule [ ] accessRules , IClasspathAttribute [ ] extraAttributes , boolean isExported ) { if ( variablePath == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( variablePath . segmentCount ( ) < <NUM_LIT:1> ) { throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" + variablePath . makeRelative ( ) . toString ( ) + "<STR_LIT>" ) ; } if ( accessRules == null ) { accessRules = ClasspathEntry . NO_ACCESS_RULES ; } if ( extraAttributes == null ) { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } return new ClasspathEntry ( IPackageFragmentRoot . K_SOURCE , IClasspathEntry . CPE_VARIABLE , variablePath , ClasspathEntry . INCLUDE_ALL , ClasspathEntry . EXCLUDE_NONE , variableSourceAttachmentPath , variableSourceAttachmentRootPath , null , isExported , accessRules , false , extraAttributes ) ; } public static IClasspathEntry [ ] getReferencedClasspathEntries ( IClasspathEntry libraryEntry , IJavaProject project ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; return manager . getReferencedClasspathEntries ( libraryEntry , project ) ; } public static void removeClasspathVariable ( String variableName ) { removeClasspathVariable ( variableName , null ) ; } public static void removeClasspathVariable ( String variableName , IProgressMonitor monitor ) { try { SetVariablesOperation operation = new SetVariablesOperation ( new String [ ] { variableName } , new IPath [ ] { null } , true ) ; operation . runOperation ( monitor ) ; } catch ( JavaModelException e ) { Util . log ( e , "<STR_LIT>" + variableName ) ; } } public static void removeElementChangedListener ( IElementChangedListener listener ) { JavaModelManager . getDeltaState ( ) . removeElementChangedListener ( listener ) ; } public static String removeJavaLikeExtension ( String fileName ) { return Util . getNameWithoutJavaLikeExtension ( fileName ) ; } public static void removePreProcessingResourceChangedListener ( IResourceChangeListener listener ) { JavaModelManager . getDeltaState ( ) . removePreResourceChangedListener ( listener ) ; } public static void run ( IWorkspaceRunnable action , IProgressMonitor monitor ) throws CoreException { run ( action , ResourcesPlugin . getWorkspace ( ) . getRoot ( ) , monitor ) ; } public static void run ( IWorkspaceRunnable action , ISchedulingRule rule , IProgressMonitor monitor ) throws CoreException { IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace . isTreeLocked ( ) ) { new BatchOperation ( action ) . run ( monitor ) ; } else { workspace . run ( new BatchOperation ( action ) , rule , IWorkspace . AVOID_UPDATE , monitor ) ; } } public static void setClasspathContainer ( IPath containerPath , IJavaProject [ ] affectedProjects , IClasspathContainer [ ] respectiveContainers , IProgressMonitor monitor ) throws JavaModelException { if ( affectedProjects . length != respectiveContainers . length ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; if ( affectedProjects . length == <NUM_LIT:1> ) { IClasspathContainer container = respectiveContainers [ <NUM_LIT:0> ] ; if ( container != null ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IJavaProject project = affectedProjects [ <NUM_LIT:0> ] ; IClasspathContainer existingCointainer = manager . containerGet ( project , containerPath ) ; if ( existingCointainer == JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) { manager . containerBeingInitializedPut ( project , containerPath , container ) ; return ; } } } SetContainerOperation operation = new SetContainerOperation ( containerPath , affectedProjects , respectiveContainers ) ; operation . runOperation ( monitor ) ; } public static void setClasspathVariable ( String variableName , IPath path ) throws JavaModelException { setClasspathVariable ( variableName , path , null ) ; } public static void setClasspathVariable ( String variableName , IPath path , IProgressMonitor monitor ) throws JavaModelException { if ( path == null ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; setClasspathVariables ( new String [ ] { variableName } , new IPath [ ] { path } , monitor ) ; } public static void setClasspathVariables ( String [ ] variableNames , IPath [ ] paths , IProgressMonitor monitor ) throws JavaModelException { if ( variableNames . length != paths . length ) throw new ClasspathEntry . AssertionFailedException ( "<STR_LIT>" ) ; SetVariablesOperation operation = new SetVariablesOperation ( variableNames , paths , true ) ; operation . runOperation ( monitor ) ; } public static void setComplianceOptions ( String compliance , Map options ) { switch ( ( int ) ( CompilerOptions . versionToJdkLevel ( compliance ) > > > <NUM_LIT:16> ) ) { case ClassFileConstants . MAJOR_VERSION_1_3 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_3 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_3 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_1 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . IGNORE ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . IGNORE ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_4 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_4 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_3 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_2 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . WARNING ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . WARNING ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_5 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_5 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_5 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_5 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_CODEGEN_INLINE_JSR_BYTECODE , JavaCore . ENABLED ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_6 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_6 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_6 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_6 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_CODEGEN_INLINE_JSR_BYTECODE , JavaCore . ENABLED ) ; break ; case ClassFileConstants . MAJOR_VERSION_1_7 : options . put ( JavaCore . COMPILER_COMPLIANCE , JavaCore . VERSION_1_7 ) ; options . put ( JavaCore . COMPILER_SOURCE , JavaCore . VERSION_1_7 ) ; options . put ( JavaCore . COMPILER_CODEGEN_TARGET_PLATFORM , JavaCore . VERSION_1_7 ) ; options . put ( JavaCore . COMPILER_PB_ASSERT_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_ENUM_IDENTIFIER , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_CODEGEN_INLINE_JSR_BYTECODE , JavaCore . ENABLED ) ; } } public static void setOptions ( Hashtable newOptions ) { JavaModelManager . getJavaModelManager ( ) . setOptions ( newOptions ) ; } public void stop ( BundleContext context ) throws Exception { try { JavaModelManager . getJavaModelManager ( ) . shutdown ( ) ; } finally { super . stop ( context ) ; } } public void start ( BundleContext context ) throws Exception { super . start ( context ) ; JavaModelManager . getJavaModelManager ( ) . startup ( ) ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ITypeRoot extends IJavaElement , IParent , IOpenable , ISourceReference , ICodeAssist { IType findPrimaryType ( ) ; IJavaElement getElementAt ( int position ) throws JavaModelException ; ICompilationUnit getWorkingCopy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . util . Util ; public final class Signature { public static final int ARRAY_TYPE_SIGNATURE = <NUM_LIT:4> ; public static final int BASE_TYPE_SIGNATURE = <NUM_LIT:2> ; private static final char [ ] BOOLEAN = "<STR_LIT:boolean>" . toCharArray ( ) ; private static final char [ ] BYTE = "<STR_LIT>" . toCharArray ( ) ; public static final char C_ARRAY = org . eclipse . jdt . internal . compiler . util . Util . C_ARRAY ; public static final char C_BOOLEAN = org . eclipse . jdt . internal . compiler . util . Util . C_BOOLEAN ; public static final char C_BYTE = org . eclipse . jdt . internal . compiler . util . Util . C_BYTE ; public static final char C_CAPTURE = org . eclipse . jdt . internal . compiler . util . Util . C_CAPTURE ; public static final char C_CHAR = org . eclipse . jdt . internal . compiler . util . Util . C_CHAR ; public static final char C_COLON = org . eclipse . jdt . internal . compiler . util . Util . C_COLON ; public static final char C_DOLLAR = org . eclipse . jdt . internal . compiler . util . Util . C_DOLLAR ; public static final char C_DOT = org . eclipse . jdt . internal . compiler . util . Util . C_DOT ; public static final char C_DOUBLE = org . eclipse . jdt . internal . compiler . util . Util . C_DOUBLE ; public static final char C_EXCEPTION_START = org . eclipse . jdt . internal . compiler . util . Util . C_EXCEPTION_START ; public static final char C_EXTENDS = org . eclipse . jdt . internal . compiler . util . Util . C_EXTENDS ; public static final char C_FLOAT = org . eclipse . jdt . internal . compiler . util . Util . C_FLOAT ; public static final char C_GENERIC_END = org . eclipse . jdt . internal . compiler . util . Util . C_GENERIC_END ; public static final char C_GENERIC_START = org . eclipse . jdt . internal . compiler . util . Util . C_GENERIC_START ; public static final char C_INT = org . eclipse . jdt . internal . compiler . util . Util . C_INT ; public static final char C_INTERSECTION = '<CHAR_LIT>' ; public static final char C_LONG = org . eclipse . jdt . internal . compiler . util . Util . C_LONG ; public static final char C_NAME_END = org . eclipse . jdt . internal . compiler . util . Util . C_NAME_END ; public static final char C_PARAM_END = org . eclipse . jdt . internal . compiler . util . Util . C_PARAM_END ; public static final char C_PARAM_START = org . eclipse . jdt . internal . compiler . util . Util . C_PARAM_START ; public static final char C_RESOLVED = org . eclipse . jdt . internal . compiler . util . Util . C_RESOLVED ; public static final char C_SEMICOLON = org . eclipse . jdt . internal . compiler . util . Util . C_SEMICOLON ; public static final char C_SHORT = org . eclipse . jdt . internal . compiler . util . Util . C_SHORT ; public static final char C_STAR = org . eclipse . jdt . internal . compiler . util . Util . C_STAR ; public static final char C_SUPER = org . eclipse . jdt . internal . compiler . util . Util . C_SUPER ; public static final char C_TYPE_VARIABLE = org . eclipse . jdt . internal . compiler . util . Util . C_TYPE_VARIABLE ; public static final char C_UNRESOLVED = org . eclipse . jdt . internal . compiler . util . Util . C_UNRESOLVED ; public static final char C_VOID = org . eclipse . jdt . internal . compiler . util . Util . C_VOID ; private static final char [ ] CAPTURE = "<STR_LIT>" . toCharArray ( ) ; public static final int CAPTURE_TYPE_SIGNATURE = <NUM_LIT:6> ; private static final char [ ] CHAR = "<STR_LIT>" . toCharArray ( ) ; public static final int CLASS_TYPE_SIGNATURE = <NUM_LIT:1> ; private static final char [ ] DOUBLE = "<STR_LIT:double>" . toCharArray ( ) ; private static final char [ ] EXTENDS = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] FLOAT = "<STR_LIT:float>" . toCharArray ( ) ; private static final char [ ] INT = "<STR_LIT:int>" . toCharArray ( ) ; public static final int INTERSECTION_TYPE_SIGNATURE = <NUM_LIT:7> ; private static final char [ ] LONG = "<STR_LIT:long>" . toCharArray ( ) ; private static final char [ ] SHORT = "<STR_LIT>" . toCharArray ( ) ; public static final String SIG_BOOLEAN = "<STR_LIT:Z>" ; public static final String SIG_BYTE = "<STR_LIT:B>" ; public static final String SIG_CHAR = "<STR_LIT:C>" ; public static final String SIG_DOUBLE = "<STR_LIT:D>" ; public static final String SIG_FLOAT = "<STR_LIT:F>" ; public static final String SIG_INT = "<STR_LIT:I>" ; public static final String SIG_LONG = "<STR_LIT>" ; public static final String SIG_SHORT = "<STR_LIT:S>" ; public static final String SIG_VOID = "<STR_LIT>" ; private static final char [ ] SUPER = "<STR_LIT>" . toCharArray ( ) ; public static final int TYPE_VARIABLE_SIGNATURE = <NUM_LIT:3> ; private static final char [ ] VOID = "<STR_LIT>" . toCharArray ( ) ; public static final int WILDCARD_TYPE_SIGNATURE = <NUM_LIT:5> ; private static void appendArgumentSimpleNames ( char [ ] name , int start , int end , StringBuffer buffer ) { buffer . append ( '<CHAR_LIT>' ) ; int depth = <NUM_LIT:0> ; int argumentStart = - <NUM_LIT:1> ; int argumentCount = <NUM_LIT:0> ; for ( int i = start ; i <= end ; i ++ ) { switch ( name [ i ] ) { case '<CHAR_LIT>' : depth ++ ; if ( depth == <NUM_LIT:1> ) { argumentStart = i + <NUM_LIT:1> ; } break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:1> ) { if ( argumentCount > <NUM_LIT:0> ) buffer . append ( '<CHAR_LIT:U+002C>' ) ; appendSimpleName ( name , argumentStart , i - <NUM_LIT:1> , buffer ) ; argumentCount ++ ; } depth -- ; break ; case '<CHAR_LIT:U+002C>' : if ( depth == <NUM_LIT:1> ) { if ( argumentCount > <NUM_LIT:0> ) buffer . append ( '<CHAR_LIT:U+002C>' ) ; appendSimpleName ( name , argumentStart , i - <NUM_LIT:1> , buffer ) ; argumentCount ++ ; argumentStart = i + <NUM_LIT:1> ; } break ; } } buffer . append ( '<CHAR_LIT:>>' ) ; } private static int appendArrayTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { return appendArrayTypeSignature ( string , start , fullyQualifyTypeNames , buffer , false ) ; } private static int appendArrayTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer , boolean isVarArgs ) { int length = string . length ; if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_ARRAY ) { throw new IllegalArgumentException ( ) ; } int index = start ; c = string [ ++ index ] ; while ( c == C_ARRAY ) { if ( index >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ index ] ; } int e = appendTypeSignature ( string , index , fullyQualifyTypeNames , buffer ) ; for ( int i = <NUM_LIT:1> , dims = index - start ; i < dims ; i ++ ) { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } if ( isVarArgs ) { buffer . append ( '<CHAR_LIT:.>' ) . append ( '<CHAR_LIT:.>' ) . append ( '<CHAR_LIT:.>' ) ; } else { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } return e ; } private static int appendCaptureTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_CAPTURE ) { throw new IllegalArgumentException ( ) ; } buffer . append ( CAPTURE ) . append ( '<CHAR_LIT:U+0020>' ) ; return appendTypeArgumentSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; } private static int appendClassTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_RESOLVED && c != C_UNRESOLVED ) { throw new IllegalArgumentException ( ) ; } boolean resolved = ( c == C_RESOLVED ) ; boolean removePackageQualifiers = ! fullyQualifyTypeNames ; if ( ! resolved ) { removePackageQualifiers = false ; } int p = start + <NUM_LIT:1> ; int checkpoint = buffer . length ( ) ; int innerTypeStart = - <NUM_LIT:1> ; boolean inAnonymousType = false ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; switch ( c ) { case C_SEMICOLON : return p ; case C_GENERIC_START : int e = appendTypeArgumentSignatures ( string , p , fullyQualifyTypeNames , buffer ) ; removePackageQualifiers = false ; p = e ; break ; case C_DOT : if ( removePackageQualifiers ) { buffer . setLength ( checkpoint ) ; } else { buffer . append ( '<CHAR_LIT:.>' ) ; } break ; case '<CHAR_LIT:/>' : if ( removePackageQualifiers ) { buffer . setLength ( checkpoint ) ; } else { buffer . append ( '<CHAR_LIT:/>' ) ; } break ; case C_DOLLAR : innerTypeStart = buffer . length ( ) ; inAnonymousType = false ; if ( resolved ) { removePackageQualifiers = false ; buffer . append ( '<CHAR_LIT:.>' ) ; } break ; default : if ( innerTypeStart != - <NUM_LIT:1> && ! inAnonymousType && Character . isDigit ( c ) ) { inAnonymousType = true ; buffer . setLength ( innerTypeStart ) ; buffer . insert ( checkpoint , "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; } if ( ! inAnonymousType ) buffer . append ( c ) ; innerTypeStart = - <NUM_LIT:1> ; } p ++ ; } } private static int appendIntersectionTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_INTERSECTION ) { throw new IllegalArgumentException ( ) ; } start = appendClassTypeSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; if ( start < string . length - <NUM_LIT:1> ) { start ++ ; if ( string [ start ] != C_COLON ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } while ( string [ start ] == C_COLON ) { buffer . append ( "<STR_LIT>" ) ; start = appendClassTypeSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; if ( start == string . length - <NUM_LIT:1> ) { return start ; } else if ( start > string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } start ++ ; } } return start ; } private static void appendSimpleName ( char [ ] name , int start , int end , StringBuffer buffer ) { int lastDot = - <NUM_LIT:1> , lastGenericStart = - <NUM_LIT:1> , lastGenericEnd = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; if ( name [ start ] == '<CHAR_LIT>' ) { buffer . append ( "<STR_LIT:?>" ) ; int index = consumeWhitespace ( name , start + <NUM_LIT:1> , end + <NUM_LIT:1> ) ; switch ( name [ index ] ) { case '<CHAR_LIT:e>' : int checkPos = checkName ( EXTENDS , name , index , end ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+0020>' ) . append ( EXTENDS ) . append ( '<CHAR_LIT:U+0020>' ) ; index = consumeWhitespace ( name , checkPos , end + <NUM_LIT:1> ) ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( SUPER , name , index , end + <NUM_LIT:1> ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+0020>' ) . append ( SUPER ) . append ( '<CHAR_LIT:U+0020>' ) ; index = consumeWhitespace ( name , checkPos , end + <NUM_LIT:1> ) ; } break ; } start = index ; } lastDotLookup : for ( int i = end ; i >= start ; i -- ) { switch ( name [ i ] ) { case '<CHAR_LIT:.>' : if ( depth == <NUM_LIT:0> ) { lastDot = i ; char c = name [ start ] ; if ( c == C_EXTENDS || c == C_SUPER ) { buffer . append ( c ) ; } break lastDotLookup ; } break ; case '<CHAR_LIT>' : depth -- ; if ( depth == <NUM_LIT:0> ) lastGenericStart = i ; break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:0> ) lastGenericEnd = i ; depth ++ ; break ; } } int nameStart = lastDot < <NUM_LIT:0> ? start : lastDot + <NUM_LIT:1> ; int nameEnd = lastGenericStart < <NUM_LIT:0> ? end + <NUM_LIT:1> : lastGenericStart ; buffer . append ( name , nameStart , nameEnd - nameStart ) ; if ( lastGenericStart >= <NUM_LIT:0> ) { appendArgumentSimpleNames ( name , lastGenericStart , lastGenericEnd , buffer ) ; buffer . append ( name , lastGenericEnd + <NUM_LIT:1> , end - lastGenericEnd ) ; } } private static int appendTypeArgumentSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case C_STAR : buffer . append ( '<CHAR_LIT>' ) ; return start ; case C_EXTENDS : buffer . append ( "<STR_LIT>" ) ; return appendTypeSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; case C_SUPER : buffer . append ( "<STR_LIT>" ) ; return appendTypeSignature ( string , start + <NUM_LIT:1> , fullyQualifyTypeNames , buffer ) ; default : return appendTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; } } private static int appendTypeArgumentSignatures ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != C_GENERIC_START ) { throw new IllegalArgumentException ( ) ; } buffer . append ( '<CHAR_LIT>' ) ; int p = start + <NUM_LIT:1> ; int count = <NUM_LIT:0> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; if ( c == C_GENERIC_END ) { buffer . append ( '<CHAR_LIT:>>' ) ; return p ; } if ( count != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } int e = appendTypeArgumentSignature ( string , p , fullyQualifyTypeNames , buffer ) ; count ++ ; p = e + <NUM_LIT:1> ; } } private static int appendTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer ) { return appendTypeSignature ( string , start , fullyQualifyTypeNames , buffer , false ) ; } private static int appendTypeSignature ( char [ ] string , int start , boolean fullyQualifyTypeNames , StringBuffer buffer , boolean isVarArgs ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( isVarArgs ) { switch ( c ) { case C_ARRAY : return appendArrayTypeSignature ( string , start , fullyQualifyTypeNames , buffer , true ) ; case C_RESOLVED : case C_UNRESOLVED : case C_TYPE_VARIABLE : case C_BOOLEAN : case C_BYTE : case C_CHAR : case C_DOUBLE : case C_FLOAT : case C_INT : case C_LONG : case C_SHORT : case C_VOID : case C_STAR : case C_EXTENDS : case C_SUPER : case C_CAPTURE : case C_INTERSECTION : default : throw new IllegalArgumentException ( ) ; } } else { switch ( c ) { case C_ARRAY : return appendArrayTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_RESOLVED : case C_UNRESOLVED : return appendClassTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_TYPE_VARIABLE : int e = Util . scanTypeVariableSignature ( string , start ) ; buffer . append ( string , start + <NUM_LIT:1> , e - start - <NUM_LIT:1> ) ; return e ; case C_BOOLEAN : buffer . append ( BOOLEAN ) ; return start ; case C_BYTE : buffer . append ( BYTE ) ; return start ; case C_CHAR : buffer . append ( CHAR ) ; return start ; case C_DOUBLE : buffer . append ( DOUBLE ) ; return start ; case C_FLOAT : buffer . append ( FLOAT ) ; return start ; case C_INT : buffer . append ( INT ) ; return start ; case C_LONG : buffer . append ( LONG ) ; return start ; case C_SHORT : buffer . append ( SHORT ) ; return start ; case C_VOID : buffer . append ( VOID ) ; return start ; case C_CAPTURE : return appendCaptureTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_INTERSECTION : return appendIntersectionTypeSignature ( string , start , fullyQualifyTypeNames , buffer ) ; case C_STAR : case C_EXTENDS : case C_SUPER : return appendTypeArgumentSignature ( string , start , fullyQualifyTypeNames , buffer ) ; default : throw new IllegalArgumentException ( ) ; } } } private static int checkArrayDimension ( char [ ] typeName , int pos , int length ) { int genericBalance = <NUM_LIT:0> ; while ( pos < length ) { switch ( typeName [ pos ] ) { case '<CHAR_LIT>' : genericBalance ++ ; break ; case '<CHAR_LIT:U+002C>' : if ( genericBalance == <NUM_LIT:0> ) return - <NUM_LIT:1> ; break ; case '<CHAR_LIT:>>' : if ( genericBalance == <NUM_LIT:0> ) return - <NUM_LIT:1> ; genericBalance -- ; break ; case '<CHAR_LIT:[>' : if ( genericBalance == <NUM_LIT:0> ) { return pos ; } } pos ++ ; } return - <NUM_LIT:1> ; } private static int checkName ( char [ ] name , char [ ] typeName , int pos , int length ) { if ( CharOperation . fragmentEquals ( name , typeName , pos , true ) ) { pos += name . length ; if ( pos == length ) return pos ; char currentChar = typeName [ pos ] ; switch ( currentChar ) { case '<CHAR_LIT:U+0020>' : case '<CHAR_LIT:.>' : case '<CHAR_LIT>' : case '<CHAR_LIT:>>' : case '<CHAR_LIT:[>' : case '<CHAR_LIT:U+002C>' : return pos ; default : if ( ScannerHelper . isWhitespace ( currentChar ) ) return pos ; } } return - <NUM_LIT:1> ; } private static int checkNextChar ( char [ ] typeName , char expectedChar , int pos , int length , boolean isOptional ) { pos = consumeWhitespace ( typeName , pos , length ) ; if ( pos < length && typeName [ pos ] == expectedChar ) return pos + <NUM_LIT:1> ; if ( ! isOptional ) throw new IllegalArgumentException ( new String ( typeName ) ) ; return - <NUM_LIT:1> ; } private static int consumeWhitespace ( char [ ] typeName , int pos , int length ) { while ( pos < length ) { char currentChar = typeName [ pos ] ; if ( currentChar != '<CHAR_LIT:U+0020>' && ! ScannerHelper . isWhitespace ( currentChar ) ) { break ; } pos ++ ; } return pos ; } public static char [ ] createArraySignature ( char [ ] typeSignature , int arrayCount ) { if ( arrayCount == <NUM_LIT:0> ) return typeSignature ; int sigLength = typeSignature . length ; char [ ] result = new char [ arrayCount + sigLength ] ; for ( int i = <NUM_LIT:0> ; i < arrayCount ; i ++ ) { result [ i ] = C_ARRAY ; } System . arraycopy ( typeSignature , <NUM_LIT:0> , result , arrayCount , sigLength ) ; return result ; } public static String createArraySignature ( String typeSignature , int arrayCount ) { return new String ( createArraySignature ( typeSignature . toCharArray ( ) , arrayCount ) ) ; } public static char [ ] createCharArrayTypeSignature ( char [ ] typeName , boolean isResolved ) { if ( typeName == null ) throw new IllegalArgumentException ( "<STR_LIT:null>" ) ; int length = typeName . length ; if ( length == <NUM_LIT:0> ) throw new IllegalArgumentException ( new String ( typeName ) ) ; StringBuffer buffer = new StringBuffer ( <NUM_LIT:5> ) ; int pos = encodeTypeSignature ( typeName , <NUM_LIT:0> , isResolved , length , buffer ) ; pos = consumeWhitespace ( typeName , pos , length ) ; if ( pos < length ) throw new IllegalArgumentException ( new String ( typeName ) ) ; char [ ] result = new char [ length = buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , length , result , <NUM_LIT:0> ) ; return result ; } public static String createIntersectionTypeSignature ( char [ ] [ ] typeSignatures ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( Signature . C_INTERSECTION ) ; for ( int i = <NUM_LIT:0> , max = typeSignatures . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( Signature . C_COLON ) ; } buffer . append ( typeSignatures [ i ] ) ; } return String . valueOf ( buffer ) ; } public static String createIntersectionTypeSignature ( String [ ] typeSignatures ) { int typeSignaturesLenth = typeSignatures . length ; char [ ] [ ] signatures = new char [ typeSignaturesLenth ] [ ] ; for ( int i = <NUM_LIT:0> ; i < typeSignaturesLenth ; i ++ ) { signatures [ i ] = typeSignatures [ i ] . toCharArray ( ) ; } return createIntersectionTypeSignature ( signatures ) ; } public static char [ ] createMethodSignature ( char [ ] [ ] parameterTypes , char [ ] returnType ) { int parameterTypesLength = parameterTypes . length ; int parameterLength = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < parameterTypesLength ; i ++ ) { parameterLength += parameterTypes [ i ] . length ; } int returnTypeLength = returnType . length ; char [ ] result = new char [ <NUM_LIT:1> + parameterLength + <NUM_LIT:1> + returnTypeLength ] ; result [ <NUM_LIT:0> ] = C_PARAM_START ; int index = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < parameterTypesLength ; i ++ ) { char [ ] parameterType = parameterTypes [ i ] ; int length = parameterType . length ; System . arraycopy ( parameterType , <NUM_LIT:0> , result , index , length ) ; index += length ; } result [ index ] = C_PARAM_END ; System . arraycopy ( returnType , <NUM_LIT:0> , result , index + <NUM_LIT:1> , returnTypeLength ) ; return result ; } public static String createMethodSignature ( String [ ] parameterTypes , String returnType ) { int parameterTypesLenth = parameterTypes . length ; char [ ] [ ] parameters = new char [ parameterTypesLenth ] [ ] ; for ( int i = <NUM_LIT:0> ; i < parameterTypesLenth ; i ++ ) { parameters [ i ] = parameterTypes [ i ] . toCharArray ( ) ; } return new String ( createMethodSignature ( parameters , returnType . toCharArray ( ) ) ) ; } public static char [ ] createTypeParameterSignature ( char [ ] typeParameterName , char [ ] [ ] boundSignatures ) { int length = boundSignatures . length ; if ( length == <NUM_LIT:0> ) { return CharOperation . append ( typeParameterName , C_COLON ) ; } int boundsSize = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { boundsSize += boundSignatures [ i ] . length + <NUM_LIT:1> ; } int nameLength = typeParameterName . length ; char [ ] result = new char [ nameLength + boundsSize ] ; System . arraycopy ( typeParameterName , <NUM_LIT:0> , result , <NUM_LIT:0> , nameLength ) ; int index = nameLength ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ index ++ ] = C_COLON ; int boundLength = boundSignatures [ i ] . length ; System . arraycopy ( boundSignatures [ i ] , <NUM_LIT:0> , result , index , boundLength ) ; index += boundLength ; } return result ; } public static String createTypeParameterSignature ( String typeParameterName , String [ ] boundSignatures ) { int length = boundSignatures . length ; char [ ] [ ] boundSignatureChars = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { boundSignatureChars [ i ] = boundSignatures [ i ] . toCharArray ( ) ; } return new String ( createTypeParameterSignature ( typeParameterName . toCharArray ( ) , boundSignatureChars ) ) ; } public static String createTypeSignature ( char [ ] typeName , boolean isResolved ) { return new String ( createCharArrayTypeSignature ( typeName , isResolved ) ) ; } public static String createTypeSignature ( String typeName , boolean isResolved ) { return createTypeSignature ( typeName == null ? null : typeName . toCharArray ( ) , isResolved ) ; } private static int encodeArrayDimension ( char [ ] typeName , int pos , int length , StringBuffer buffer ) { int checkPos ; while ( pos < length && ( checkPos = checkNextChar ( typeName , '<CHAR_LIT:[>' , pos , length , true ) ) > <NUM_LIT:0> ) { pos = checkNextChar ( typeName , '<CHAR_LIT:]>' , checkPos , length , false ) ; buffer . append ( C_ARRAY ) ; } return pos ; } private static int encodeQualifiedName ( char [ ] typeName , int pos , int length , StringBuffer buffer ) { int count = <NUM_LIT:0> ; char lastAppendedChar = <NUM_LIT:0> ; nameLoop : while ( pos < length ) { char currentChar = typeName [ pos ] ; switch ( currentChar ) { case '<CHAR_LIT>' : case '<CHAR_LIT:>>' : case '<CHAR_LIT:[>' : case '<CHAR_LIT:U+002C>' : break nameLoop ; case '<CHAR_LIT:.>' : buffer . append ( C_DOT ) ; lastAppendedChar = C_DOT ; count ++ ; break ; default : if ( currentChar == '<CHAR_LIT:U+0020>' || ScannerHelper . isWhitespace ( currentChar ) ) { if ( lastAppendedChar == C_DOT ) { pos = consumeWhitespace ( typeName , pos , length ) - <NUM_LIT:1> ; break ; } int checkPos = checkNextChar ( typeName , '<CHAR_LIT:.>' , pos , length , true ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_DOT ) ; lastAppendedChar = C_DOT ; count ++ ; pos = checkPos ; break ; } break nameLoop ; } buffer . append ( currentChar ) ; lastAppendedChar = currentChar ; count ++ ; break ; } pos ++ ; } if ( count == <NUM_LIT:0> ) throw new IllegalArgumentException ( new String ( typeName ) ) ; return pos ; } private static int encodeTypeSignature ( char [ ] typeName , int start , boolean isResolved , int length , StringBuffer buffer ) { int pos = start ; pos = consumeWhitespace ( typeName , pos , length ) ; if ( pos >= length ) throw new IllegalArgumentException ( new String ( typeName ) ) ; int checkPos ; char currentChar = typeName [ pos ] ; switch ( currentChar ) { case '<CHAR_LIT:b>' : checkPos = checkName ( BOOLEAN , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_BOOLEAN ) ; return pos ; } checkPos = checkName ( BYTE , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_BYTE ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( DOUBLE , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_DOUBLE ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( FLOAT , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_FLOAT ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( INT , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_INT ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( LONG , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_LONG ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( SHORT , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_SHORT ) ; return pos ; } break ; case '<CHAR_LIT>' : checkPos = checkName ( VOID , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_VOID ) ; return pos ; } break ; case '<CHAR_LIT:c>' : checkPos = checkName ( CHAR , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; buffer . append ( C_CHAR ) ; return pos ; } else { checkPos = checkName ( CAPTURE , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { pos = consumeWhitespace ( typeName , checkPos , length ) ; if ( typeName [ pos ] != '<CHAR_LIT>' ) { break ; } } else { break ; } } buffer . append ( C_CAPTURE ) ; case '<CHAR_LIT>' : pos = consumeWhitespace ( typeName , pos + <NUM_LIT:1> , length ) ; checkPos = checkName ( EXTENDS , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_EXTENDS ) ; pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; return pos ; } checkPos = checkName ( SUPER , typeName , pos , length ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_SUPER ) ; pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; return pos ; } buffer . append ( C_STAR ) ; return pos ; } checkPos = checkArrayDimension ( typeName , pos , length ) ; int end ; if ( checkPos > <NUM_LIT:0> ) { end = encodeArrayDimension ( typeName , checkPos , length , buffer ) ; } else { end = - <NUM_LIT:1> ; } buffer . append ( isResolved ? C_RESOLVED : C_UNRESOLVED ) ; while ( true ) { pos = encodeQualifiedName ( typeName , pos , length , buffer ) ; checkPos = checkNextChar ( typeName , '<CHAR_LIT>' , pos , length , true ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_GENERIC_START ) ; if ( ( pos = checkNextChar ( typeName , '<CHAR_LIT:>>' , checkPos , length , true ) ) > <NUM_LIT:0> ) { buffer . append ( C_GENERIC_END ) ; } else { pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; while ( ( checkPos = checkNextChar ( typeName , '<CHAR_LIT:U+002C>' , pos , length , true ) ) > <NUM_LIT:0> ) { pos = encodeTypeSignature ( typeName , checkPos , isResolved , length , buffer ) ; } pos = checkNextChar ( typeName , '<CHAR_LIT:>>' , pos , length , false ) ; buffer . append ( C_GENERIC_END ) ; } } checkPos = checkNextChar ( typeName , '<CHAR_LIT:.>' , pos , length , true ) ; if ( checkPos > <NUM_LIT:0> ) { buffer . append ( C_DOT ) ; pos = checkPos ; } else { break ; } } buffer . append ( C_NAME_END ) ; if ( end > <NUM_LIT:0> ) pos = end ; return pos ; } public static int getArrayCount ( char [ ] typeSignature ) throws IllegalArgumentException { try { int count = <NUM_LIT:0> ; while ( typeSignature [ count ] == C_ARRAY ) { ++ count ; } return count ; } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } } public static int getArrayCount ( String typeSignature ) throws IllegalArgumentException { return getArrayCount ( typeSignature . toCharArray ( ) ) ; } public static char [ ] getElementType ( char [ ] typeSignature ) throws IllegalArgumentException { int count = getArrayCount ( typeSignature ) ; if ( count == <NUM_LIT:0> ) return typeSignature ; int length = typeSignature . length ; char [ ] result = new char [ length - count ] ; System . arraycopy ( typeSignature , count , result , <NUM_LIT:0> , length - count ) ; return result ; } public static String getElementType ( String typeSignature ) throws IllegalArgumentException { char [ ] signature = typeSignature . toCharArray ( ) ; char [ ] elementType = getElementType ( signature ) ; return signature == elementType ? typeSignature : new String ( elementType ) ; } public static char [ ] [ ] getIntersectionTypeBounds ( char [ ] intersectionTypeSignature ) throws IllegalArgumentException { if ( getTypeSignatureKind ( intersectionTypeSignature ) != INTERSECTION_TYPE_SIGNATURE ) { return CharOperation . NO_CHAR_CHAR ; } ArrayList args = new ArrayList ( ) ; int i = <NUM_LIT:1> ; int length = intersectionTypeSignature . length ; for ( ; ; ) { int e = Util . scanClassTypeSignature ( intersectionTypeSignature , i ) ; if ( e < <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } args . add ( CharOperation . subarray ( intersectionTypeSignature , i , e + <NUM_LIT:1> ) ) ; if ( e == length - <NUM_LIT:1> ) { int size = args . size ( ) ; char [ ] [ ] result = new char [ size ] [ ] ; args . toArray ( result ) ; return result ; } else if ( intersectionTypeSignature [ e + <NUM_LIT:1> ] != C_COLON ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } i = e + <NUM_LIT:2> ; } } public static String [ ] getIntersectionTypeBounds ( String intersectionTypeSignature ) throws IllegalArgumentException { char [ ] [ ] args = getIntersectionTypeBounds ( intersectionTypeSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( args ) ; } public static int getParameterCount ( char [ ] methodSignature ) throws IllegalArgumentException { try { int count = <NUM_LIT:0> ; int i = CharOperation . indexOf ( C_PARAM_START , methodSignature ) ; if ( i < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } else { i ++ ; } for ( ; ; ) { if ( methodSignature [ i ] == C_PARAM_END ) { return count ; } int e = Util . scanTypeSignature ( methodSignature , i ) ; if ( e < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } else { i = e + <NUM_LIT:1> ; } count ++ ; } } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } } public static int getParameterCount ( String methodSignature ) throws IllegalArgumentException { return getParameterCount ( methodSignature . toCharArray ( ) ) ; } public static char [ ] [ ] getParameterTypes ( char [ ] methodSignature ) throws IllegalArgumentException { try { int count = getParameterCount ( methodSignature ) ; char [ ] [ ] result = new char [ count ] [ ] ; if ( count == <NUM_LIT:0> ) { return result ; } int i = CharOperation . indexOf ( C_PARAM_START , methodSignature ) ; if ( i < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } else { i ++ ; } int t = <NUM_LIT:0> ; for ( ; ; ) { if ( methodSignature [ i ] == C_PARAM_END ) { return result ; } int e = Util . scanTypeSignature ( methodSignature , i ) ; if ( e < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } result [ t ] = CharOperation . subarray ( methodSignature , i , e + <NUM_LIT:1> ) ; t ++ ; i = e + <NUM_LIT:1> ; } } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } } public static String [ ] getParameterTypes ( String methodSignature ) throws IllegalArgumentException { char [ ] [ ] parameterTypes = getParameterTypes ( methodSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( parameterTypes ) ; } public static char [ ] getQualifier ( char [ ] name ) { int firstGenericStart = CharOperation . indexOf ( C_GENERIC_START , name ) ; int lastDot = CharOperation . lastIndexOf ( C_DOT , name , <NUM_LIT:0> , firstGenericStart == - <NUM_LIT:1> ? name . length - <NUM_LIT:1> : firstGenericStart ) ; if ( lastDot == - <NUM_LIT:1> ) { return CharOperation . NO_CHAR ; } return CharOperation . subarray ( name , <NUM_LIT:0> , lastDot ) ; } public static String getQualifier ( String name ) { char [ ] qualifier = getQualifier ( name . toCharArray ( ) ) ; if ( qualifier . length == <NUM_LIT:0> ) return org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ; return new String ( qualifier ) ; } public static char [ ] getReturnType ( char [ ] methodSignature ) throws IllegalArgumentException { int paren = CharOperation . lastIndexOf ( C_PARAM_END , methodSignature ) ; if ( paren == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } int last = Util . scanTypeSignature ( methodSignature , paren + <NUM_LIT:1> ) ; return CharOperation . subarray ( methodSignature , paren + <NUM_LIT:1> , last + <NUM_LIT:1> ) ; } public static String getReturnType ( String methodSignature ) throws IllegalArgumentException { return new String ( getReturnType ( methodSignature . toCharArray ( ) ) ) ; } public static char [ ] getSignatureQualifier ( char [ ] typeSignature ) { if ( typeSignature == null ) return CharOperation . NO_CHAR ; char [ ] qualifiedType = Signature . toCharArray ( typeSignature ) ; int dotCount = <NUM_LIT:0> ; indexFound : for ( int i = <NUM_LIT:0> ; i < typeSignature . length ; i ++ ) { switch ( typeSignature [ i ] ) { case C_DOT : dotCount ++ ; break ; case C_GENERIC_START : break indexFound ; case C_DOLLAR : break indexFound ; } } if ( dotCount > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < qualifiedType . length ; i ++ ) { if ( qualifiedType [ i ] == '<CHAR_LIT:.>' ) { dotCount -- ; } if ( dotCount <= <NUM_LIT:0> ) { return CharOperation . subarray ( qualifiedType , <NUM_LIT:0> , i ) ; } } } return CharOperation . NO_CHAR ; } public static String getSignatureQualifier ( String typeSignature ) { return new String ( getSignatureQualifier ( typeSignature == null ? null : typeSignature . toCharArray ( ) ) ) ; } public static char [ ] getSignatureSimpleName ( char [ ] typeSignature ) { if ( typeSignature == null ) return CharOperation . NO_CHAR ; char [ ] qualifiedType = Signature . toCharArray ( typeSignature ) ; int dotCount = <NUM_LIT:0> ; indexFound : for ( int i = <NUM_LIT:0> ; i < typeSignature . length ; i ++ ) { switch ( typeSignature [ i ] ) { case C_DOT : dotCount ++ ; break ; case C_GENERIC_START : break indexFound ; case C_DOLLAR : break indexFound ; } } if ( dotCount > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < qualifiedType . length ; i ++ ) { if ( qualifiedType [ i ] == '<CHAR_LIT:.>' ) { dotCount -- ; } if ( dotCount <= <NUM_LIT:0> ) { return CharOperation . subarray ( qualifiedType , i + <NUM_LIT:1> , qualifiedType . length ) ; } } } return qualifiedType ; } public static String getSignatureSimpleName ( String typeSignature ) { return new String ( getSignatureSimpleName ( typeSignature == null ? null : typeSignature . toCharArray ( ) ) ) ; } public static char [ ] getSimpleName ( char [ ] name ) { int lastDot = - <NUM_LIT:1> , lastGenericStart = - <NUM_LIT:1> , lastGenericEnd = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; int length = name . length ; lastDotLookup : for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { switch ( name [ i ] ) { case '<CHAR_LIT:.>' : if ( depth == <NUM_LIT:0> ) { lastDot = i ; break lastDotLookup ; } break ; case '<CHAR_LIT>' : depth -- ; if ( depth == <NUM_LIT:0> ) lastGenericStart = i ; break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:0> ) lastGenericEnd = i ; depth ++ ; break ; } } if ( lastGenericStart < <NUM_LIT:0> ) { if ( lastDot < <NUM_LIT:0> ) { return name ; } return CharOperation . subarray ( name , lastDot + <NUM_LIT:1> , length ) ; } StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; int nameStart = lastDot < <NUM_LIT:0> ? <NUM_LIT:0> : lastDot + <NUM_LIT:1> ; buffer . append ( name , nameStart , lastGenericStart - nameStart ) ; appendArgumentSimpleNames ( name , lastGenericStart , lastGenericEnd , buffer ) ; buffer . append ( name , lastGenericEnd + <NUM_LIT:1> , length - lastGenericEnd - <NUM_LIT:1> ) ; char [ ] result = new char [ length = buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , length , result , <NUM_LIT:0> ) ; return result ; } public static String getSimpleName ( String name ) { int lastDot = - <NUM_LIT:1> , lastGenericStart = - <NUM_LIT:1> , lastGenericEnd = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; int length = name . length ( ) ; lastDotLookup : for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { switch ( name . charAt ( i ) ) { case '<CHAR_LIT:.>' : if ( depth == <NUM_LIT:0> ) { lastDot = i ; break lastDotLookup ; } break ; case '<CHAR_LIT>' : depth -- ; if ( depth == <NUM_LIT:0> ) lastGenericStart = i ; break ; case '<CHAR_LIT:>>' : if ( depth == <NUM_LIT:0> ) lastGenericEnd = i ; depth ++ ; break ; } } if ( lastGenericStart < <NUM_LIT:0> ) { if ( lastDot < <NUM_LIT:0> ) { return name ; } return name . substring ( lastDot + <NUM_LIT:1> , length ) ; } StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; char [ ] nameChars = name . toCharArray ( ) ; int nameStart = lastDot < <NUM_LIT:0> ? <NUM_LIT:0> : lastDot + <NUM_LIT:1> ; buffer . append ( nameChars , nameStart , lastGenericStart - nameStart ) ; appendArgumentSimpleNames ( nameChars , lastGenericStart , lastGenericEnd , buffer ) ; buffer . append ( nameChars , lastGenericEnd + <NUM_LIT:1> , length - lastGenericEnd - <NUM_LIT:1> ) ; return buffer . toString ( ) ; } public static char [ ] [ ] getSimpleNames ( char [ ] name ) { int length = name == null ? <NUM_LIT:0> : name . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; int wordCount = <NUM_LIT:1> ; countingWords : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) switch ( name [ i ] ) { case C_DOT : wordCount ++ ; break ; case C_GENERIC_START : break countingWords ; } char [ ] [ ] split = new char [ wordCount ] [ ] ; int last = <NUM_LIT:0> , currentWord = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( name [ i ] == C_GENERIC_START ) break ; if ( name [ i ] == C_DOT ) { split [ currentWord ] = new char [ i - last ] ; System . arraycopy ( name , last , split [ currentWord ++ ] , <NUM_LIT:0> , i - last ) ; last = i + <NUM_LIT:1> ; } } split [ currentWord ] = new char [ length - last ] ; System . arraycopy ( name , last , split [ currentWord ] , <NUM_LIT:0> , length - last ) ; return split ; } public static String [ ] getSimpleNames ( String name ) { return CharOperation . toStrings ( getSimpleNames ( name . toCharArray ( ) ) ) ; } public static char [ ] [ ] getThrownExceptionTypes ( char [ ] methodSignature ) throws IllegalArgumentException { int exceptionStart = CharOperation . indexOf ( C_EXCEPTION_START , methodSignature ) ; if ( exceptionStart == - <NUM_LIT:1> ) { int paren = CharOperation . lastIndexOf ( C_PARAM_END , methodSignature ) ; if ( paren == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } exceptionStart = Util . scanTypeSignature ( methodSignature , paren + <NUM_LIT:1> ) + <NUM_LIT:1> ; int length = methodSignature . length ; if ( exceptionStart == length ) return CharOperation . NO_CHAR_CHAR ; throw new IllegalArgumentException ( ) ; } int length = methodSignature . length ; int i = exceptionStart ; ArrayList exceptionList = new ArrayList ( <NUM_LIT:1> ) ; while ( i < length ) { if ( methodSignature [ i ] == C_EXCEPTION_START ) { exceptionStart ++ ; i ++ ; } else { throw new IllegalArgumentException ( ) ; } i = Util . scanTypeSignature ( methodSignature , i ) + <NUM_LIT:1> ; exceptionList . add ( CharOperation . subarray ( methodSignature , exceptionStart , i ) ) ; exceptionStart = i ; } char [ ] [ ] result ; exceptionList . toArray ( result = new char [ exceptionList . size ( ) ] [ ] ) ; return result ; } public static String [ ] getThrownExceptionTypes ( String methodSignature ) throws IllegalArgumentException { char [ ] [ ] parameterTypes = getThrownExceptionTypes ( methodSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( parameterTypes ) ; } public static char [ ] [ ] getTypeArguments ( char [ ] parameterizedTypeSignature ) throws IllegalArgumentException { int length = parameterizedTypeSignature . length ; if ( length < <NUM_LIT:2> || parameterizedTypeSignature [ length - <NUM_LIT:2> ] != C_GENERIC_END ) return CharOperation . NO_CHAR_CHAR ; int count = <NUM_LIT:1> ; int start = length - <NUM_LIT:2> ; while ( start >= <NUM_LIT:0> && count > <NUM_LIT:0> ) { switch ( parameterizedTypeSignature [ -- start ] ) { case C_GENERIC_START : count -- ; break ; case C_GENERIC_END : count ++ ; break ; } } if ( start < <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; ArrayList args = new ArrayList ( ) ; int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= parameterizedTypeSignature . length ) { throw new IllegalArgumentException ( ) ; } char c = parameterizedTypeSignature [ p ] ; if ( c == C_GENERIC_END ) { int size = args . size ( ) ; char [ ] [ ] result = new char [ size ] [ ] ; args . toArray ( result ) ; return result ; } int e = Util . scanTypeArgumentSignature ( parameterizedTypeSignature , p ) ; args . add ( CharOperation . subarray ( parameterizedTypeSignature , p , e + <NUM_LIT:1> ) ) ; p = e + <NUM_LIT:1> ; } } public static String [ ] getTypeArguments ( String parameterizedTypeSignature ) throws IllegalArgumentException { char [ ] [ ] args = getTypeArguments ( parameterizedTypeSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( args ) ; } public static char [ ] getTypeErasure ( char [ ] parameterizedTypeSignature ) throws IllegalArgumentException { int end = CharOperation . indexOf ( C_GENERIC_START , parameterizedTypeSignature ) ; if ( end == - <NUM_LIT:1> ) return parameterizedTypeSignature ; int length = parameterizedTypeSignature . length ; char [ ] result = new char [ length ] ; int pos = <NUM_LIT:0> ; int start = <NUM_LIT:0> ; int deep = <NUM_LIT:0> ; for ( int idx = end ; idx < length ; idx ++ ) { switch ( parameterizedTypeSignature [ idx ] ) { case C_GENERIC_START : if ( deep == <NUM_LIT:0> ) { int size = idx - start ; System . arraycopy ( parameterizedTypeSignature , start , result , pos , size ) ; end = idx ; pos += size ; } deep ++ ; break ; case C_GENERIC_END : deep -- ; if ( deep < <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; if ( deep == <NUM_LIT:0> ) start = idx + <NUM_LIT:1> ; break ; } } if ( deep > <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; int size = pos + length - start ; char [ ] resized = new char [ size ] ; System . arraycopy ( result , <NUM_LIT:0> , resized , <NUM_LIT:0> , pos ) ; System . arraycopy ( parameterizedTypeSignature , start , resized , pos , length - start ) ; return resized ; } public static String getTypeErasure ( String parameterizedTypeSignature ) throws IllegalArgumentException { char [ ] signature = parameterizedTypeSignature . toCharArray ( ) ; char [ ] erasure = getTypeErasure ( signature ) ; return signature == erasure ? parameterizedTypeSignature : new String ( erasure ) ; } public static char [ ] [ ] getTypeParameterBounds ( char [ ] formalTypeParameterSignature ) throws IllegalArgumentException { int p1 = CharOperation . indexOf ( C_COLON , formalTypeParameterSignature ) ; if ( p1 < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } if ( p1 == formalTypeParameterSignature . length - <NUM_LIT:1> ) { return CharOperation . NO_CHAR_CHAR ; } int p2 = CharOperation . indexOf ( C_COLON , formalTypeParameterSignature , p1 + <NUM_LIT:1> ) ; char [ ] classBound ; if ( p2 < <NUM_LIT:0> ) { classBound = CharOperation . subarray ( formalTypeParameterSignature , p1 + <NUM_LIT:1> , formalTypeParameterSignature . length ) ; return new char [ ] [ ] { classBound } ; } if ( p2 == p1 + <NUM_LIT:1> ) { classBound = null ; } else { classBound = CharOperation . subarray ( formalTypeParameterSignature , p1 + <NUM_LIT:1> , p2 ) ; } char [ ] [ ] interfaceBounds = CharOperation . splitOn ( C_COLON , formalTypeParameterSignature , p2 + <NUM_LIT:1> , formalTypeParameterSignature . length ) ; if ( classBound == null ) { return interfaceBounds ; } int resultLength = interfaceBounds . length + <NUM_LIT:1> ; char [ ] [ ] result = new char [ resultLength ] [ ] ; result [ <NUM_LIT:0> ] = classBound ; System . arraycopy ( interfaceBounds , <NUM_LIT:0> , result , <NUM_LIT:1> , interfaceBounds . length ) ; return result ; } public static String [ ] getTypeParameterBounds ( String formalTypeParameterSignature ) throws IllegalArgumentException { char [ ] [ ] bounds = getTypeParameterBounds ( formalTypeParameterSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( bounds ) ; } public static char [ ] [ ] getTypeParameters ( char [ ] methodOrTypeSignature ) throws IllegalArgumentException { try { int length = methodOrTypeSignature . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; if ( methodOrTypeSignature [ <NUM_LIT:0> ] != C_GENERIC_START ) return CharOperation . NO_CHAR_CHAR ; ArrayList paramList = new ArrayList ( <NUM_LIT:1> ) ; int paramStart = <NUM_LIT:1> , i = <NUM_LIT:1> ; while ( i < length ) { if ( methodOrTypeSignature [ i ] == C_GENERIC_END ) { int size = paramList . size ( ) ; if ( size == <NUM_LIT:0> ) throw new IllegalArgumentException ( ) ; char [ ] [ ] result ; paramList . toArray ( result = new char [ size ] [ ] ) ; return result ; } i = CharOperation . indexOf ( C_COLON , methodOrTypeSignature , i ) ; if ( i < <NUM_LIT:0> || i >= length ) throw new IllegalArgumentException ( ) ; while ( methodOrTypeSignature [ i ] == '<CHAR_LIT::>' ) { i ++ ; switch ( methodOrTypeSignature [ i ] ) { case '<CHAR_LIT::>' : break ; case C_GENERIC_END : break ; case C_RESOLVED : try { i = Util . scanClassTypeSignature ( methodOrTypeSignature , i ) ; i ++ ; } catch ( IllegalArgumentException e ) { } break ; case C_ARRAY : try { i = Util . scanArrayTypeSignature ( methodOrTypeSignature , i ) ; i ++ ; } catch ( IllegalArgumentException e ) { } break ; case C_TYPE_VARIABLE : try { i = Util . scanTypeVariableSignature ( methodOrTypeSignature , i ) ; i ++ ; } catch ( IllegalArgumentException e ) { } break ; } } paramList . add ( CharOperation . subarray ( methodOrTypeSignature , paramStart , i ) ) ; paramStart = i ; } } catch ( ArrayIndexOutOfBoundsException e ) { } throw new IllegalArgumentException ( ) ; } public static String [ ] getTypeParameters ( String methodOrTypeSignature ) throws IllegalArgumentException { char [ ] [ ] params = getTypeParameters ( methodOrTypeSignature . toCharArray ( ) ) ; return CharOperation . toStrings ( params ) ; } public static int getTypeSignatureKind ( char [ ] typeSignature ) { if ( typeSignature . length < <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = typeSignature [ <NUM_LIT:0> ] ; if ( c == C_GENERIC_START ) { int count = <NUM_LIT:1> ; for ( int i = <NUM_LIT:1> , length = typeSignature . length ; i < length ; i ++ ) { switch ( typeSignature [ i ] ) { case C_GENERIC_START : count ++ ; break ; case C_GENERIC_END : count -- ; break ; } if ( count == <NUM_LIT:0> ) { if ( i + <NUM_LIT:1> < length ) c = typeSignature [ i + <NUM_LIT:1> ] ; break ; } } } switch ( c ) { case C_ARRAY : return ARRAY_TYPE_SIGNATURE ; case C_RESOLVED : case C_UNRESOLVED : return CLASS_TYPE_SIGNATURE ; case C_TYPE_VARIABLE : return TYPE_VARIABLE_SIGNATURE ; case C_BOOLEAN : case C_BYTE : case C_CHAR : case C_DOUBLE : case C_FLOAT : case C_INT : case C_LONG : case C_SHORT : case C_VOID : return BASE_TYPE_SIGNATURE ; case C_STAR : case C_SUPER : case C_EXTENDS : return WILDCARD_TYPE_SIGNATURE ; case C_CAPTURE : return CAPTURE_TYPE_SIGNATURE ; case C_INTERSECTION : return INTERSECTION_TYPE_SIGNATURE ; default : throw new IllegalArgumentException ( ) ; } } public static int getTypeSignatureKind ( String typeSignature ) { return getTypeSignatureKind ( typeSignature . toCharArray ( ) ) ; } public static char [ ] getTypeVariable ( char [ ] formalTypeParameterSignature ) throws IllegalArgumentException { int p = CharOperation . indexOf ( C_COLON , formalTypeParameterSignature ) ; if ( p < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } return CharOperation . subarray ( formalTypeParameterSignature , <NUM_LIT:0> , p ) ; } public static String getTypeVariable ( String formalTypeParameterSignature ) throws IllegalArgumentException { return new String ( getTypeVariable ( formalTypeParameterSignature . toCharArray ( ) ) ) ; } public static char [ ] removeCapture ( char [ ] methodOrTypeSignature ) { return CharOperation . remove ( methodOrTypeSignature , C_CAPTURE ) ; } public static String removeCapture ( String methodOrTypeSignature ) { char [ ] array = methodOrTypeSignature . toCharArray ( ) ; char [ ] result = removeCapture ( array ) ; if ( array == result ) return methodOrTypeSignature ; return new String ( result ) ; } public static char [ ] toCharArray ( char [ ] signature ) throws IllegalArgumentException { int sigLength = signature . length ; if ( sigLength == <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } if ( signature [ <NUM_LIT:0> ] == C_PARAM_START || signature [ <NUM_LIT:0> ] == C_GENERIC_START ) { return toCharArray ( signature , CharOperation . NO_CHAR , null , true , true ) ; } StringBuffer buffer = new StringBuffer ( signature . length + <NUM_LIT:10> ) ; appendTypeSignature ( signature , <NUM_LIT:0> , true , buffer ) ; char [ ] result = new char [ buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , buffer . length ( ) , result , <NUM_LIT:0> ) ; return result ; } public static char [ ] toCharArray ( char [ ] methodSignature , char [ ] methodName , char [ ] [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType ) { return toCharArray ( methodSignature , methodName , parameterNames , fullyQualifyTypeNames , includeReturnType , false ) ; } public static char [ ] toCharArray ( char [ ] methodSignature , char [ ] methodName , char [ ] [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType , boolean isVargArgs ) { int firstParen = CharOperation . indexOf ( C_PARAM_START , methodSignature ) ; if ( firstParen == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } StringBuffer buffer = new StringBuffer ( methodSignature . length + <NUM_LIT:10> ) ; if ( includeReturnType ) { char [ ] rts = getReturnType ( methodSignature ) ; appendTypeSignature ( rts , <NUM_LIT:0> , fullyQualifyTypeNames , buffer ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } if ( methodName != null ) { buffer . append ( methodName ) ; } buffer . append ( '<CHAR_LIT:(>' ) ; char [ ] [ ] pts = getParameterTypes ( methodSignature ) ; int max = pts . length ; int index = max - <NUM_LIT:1> ; loop : for ( int i = index ; i >= <NUM_LIT:0> ; i -- ) { if ( pts [ i ] [ <NUM_LIT:0> ] == Signature . C_ARRAY ) { break loop ; } index -- ; } for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { if ( i == index ) { appendTypeSignature ( pts [ i ] , <NUM_LIT:0> , fullyQualifyTypeNames , buffer , isVargArgs ) ; } else { appendTypeSignature ( pts [ i ] , <NUM_LIT:0> , fullyQualifyTypeNames , buffer ) ; } if ( parameterNames != null ) { buffer . append ( '<CHAR_LIT:U+0020>' ) ; buffer . append ( parameterNames [ i ] ) ; } if ( i != pts . length - <NUM_LIT:1> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; char [ ] result = new char [ buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , buffer . length ( ) , result , <NUM_LIT:0> ) ; return result ; } public static char [ ] toQualifiedName ( char [ ] [ ] segments ) { int length = segments . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR ; if ( length == <NUM_LIT:1> ) return segments [ <NUM_LIT:0> ] ; int resultLength = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { resultLength += segments [ i ] . length + <NUM_LIT:1> ; } resultLength -- ; char [ ] result = new char [ resultLength ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] segment = segments [ i ] ; int segmentLength = segment . length ; System . arraycopy ( segment , <NUM_LIT:0> , result , index , segmentLength ) ; index += segmentLength ; if ( i != length - <NUM_LIT:1> ) { result [ index ++ ] = C_DOT ; } } return result ; } public static String toQualifiedName ( String [ ] segments ) { int length = segments . length ; char [ ] [ ] charArrays = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { charArrays [ i ] = segments [ i ] . toCharArray ( ) ; } return new String ( toQualifiedName ( charArrays ) ) ; } public static String toString ( String signature ) throws IllegalArgumentException { return new String ( toCharArray ( signature . toCharArray ( ) ) ) ; } public static String toString ( String methodSignature , String methodName , String [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType ) { return toString ( methodSignature , methodName , parameterNames , fullyQualifyTypeNames , includeReturnType , false ) ; } public static String toString ( String methodSignature , String methodName , String [ ] parameterNames , boolean fullyQualifyTypeNames , boolean includeReturnType , boolean isVarArgs ) { char [ ] [ ] params ; if ( parameterNames == null ) { params = null ; } else { int paramLength = parameterNames . length ; params = new char [ paramLength ] [ ] ; for ( int i = <NUM_LIT:0> ; i < paramLength ; i ++ ) { params [ i ] = parameterNames [ i ] . toCharArray ( ) ; } } return new String ( toCharArray ( methodSignature . toCharArray ( ) , methodName == null ? null : methodName . toCharArray ( ) , params , fullyQualifyTypeNames , includeReturnType , isVarArgs ) ) ; } private Signature ( ) { } } </s>
<s> package org . eclipse . jdt . core ; public interface IField extends IMember , IAnnotatable { public Object getConstant ( ) throws JavaModelException ; String getElementName ( ) ; String getKey ( ) ; String getTypeSignature ( ) throws JavaModelException ; boolean isEnumConstant ( ) throws JavaModelException ; boolean isResolved ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . core . util . KeyKind ; import org . eclipse . jdt . internal . core . util . KeyToSignature ; public final class BindingKey { private String key ; public BindingKey ( String key ) { this . key = key ; } public static String createArrayTypeBindingKey ( String typeKey , int arrayDimension ) { StringBuffer buffer = new StringBuffer ( ) ; while ( arrayDimension -- > <NUM_LIT:0> ) buffer . append ( '<CHAR_LIT:[>' ) ; buffer . append ( typeKey ) ; return buffer . toString ( ) ; } public static String createParameterizedTypeBindingKey ( String genericTypeKey , String [ ] argumentTypeKeys ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( Signature . getTypeErasure ( genericTypeKey ) ) ; buffer . insert ( buffer . length ( ) - <NUM_LIT:1> , '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = argumentTypeKeys . length ; i < length ; i ++ ) { String argumentTypeKey = argumentTypeKeys [ i ] ; buffer . insert ( buffer . length ( ) - <NUM_LIT:1> , argumentTypeKey ) ; } buffer . insert ( buffer . length ( ) - <NUM_LIT:1> , '<CHAR_LIT:>>' ) ; return buffer . toString ( ) ; } public static String createTypeBindingKey ( String typeName ) { return Signature . createTypeSignature ( typeName . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) , true ) ; } public static String createTypeVariableBindingKey ( String typeVariableName , String declaringKey ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( declaringKey ) ; buffer . append ( '<CHAR_LIT::>' ) ; buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( typeVariableName ) ; buffer . append ( '<CHAR_LIT:;>' ) ; return buffer . toString ( ) ; } public static String createWilcardTypeBindingKey ( String typeKey , char kind ) { switch ( kind ) { case Signature . C_STAR : return "<STR_LIT:*>" ; case Signature . C_SUPER : return '<CHAR_LIT:->' + typeKey ; case Signature . C_EXTENDS : return '<CHAR_LIT>' + typeKey ; } return null ; } public static String createWildcardTypeBindingKey ( String genericTypeKey , char boundKind , String boundTypeKey , int rank ) { String wildCardKey ; switch ( boundKind ) { case Signature . C_STAR : wildCardKey = new String ( TypeConstants . WILDCARD_STAR ) ; break ; case Signature . C_SUPER : wildCardKey = new String ( TypeConstants . WILDCARD_MINUS ) + boundTypeKey ; break ; case Signature . C_EXTENDS : wildCardKey = new String ( TypeConstants . WILDCARD_PLUS ) + boundTypeKey ; break ; default : return null ; } return genericTypeKey + '<CHAR_LIT>' + rank + '<CHAR_LIT:}>' + wildCardKey ; } public BindingKey getDeclaringType ( ) { int end = this . key . lastIndexOf ( Signature . C_DOT ) ; if ( end == - <NUM_LIT:1> ) { end = this . key . lastIndexOf ( Signature . C_DOLLAR ) ; if ( end == - <NUM_LIT:1> ) return null ; } KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; if ( ( kind . flags & KeyKind . F_LOCAL_VAR ) != <NUM_LIT:0> ) { return null ; } String typeKey = this . key . substring ( <NUM_LIT:0> , end ) ; if ( typeKey . charAt ( typeKey . length ( ) - <NUM_LIT:1> ) != Signature . C_SEMICOLON ) { typeKey += Signature . C_SEMICOLON ; } return new BindingKey ( typeKey ) ; } public String [ ] getThrownExceptions ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . THROWN_EXCEPTIONS ) ; keyToSignature . parse ( ) ; return keyToSignature . getThrownExceptions ( ) ; } public String [ ] getTypeArguments ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . TYPE_ARGUMENTS ) ; keyToSignature . parse ( ) ; return keyToSignature . getTypeArguments ( ) ; } public boolean isRawType ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_RAW_TYPE ) != <NUM_LIT:0> ; } public boolean isParameterizedType ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_PARAMETERIZED_TYPE ) != <NUM_LIT:0> ; } public boolean isParameterizedMethod ( ) { KeyKind kind = new KeyKind ( this . key ) ; kind . parse ( ) ; return ( kind . flags & KeyKind . F_PARAMETERIZED_METHOD ) != <NUM_LIT:0> ; } public String toSignature ( ) { KeyToSignature keyToSignature = new KeyToSignature ( this . key , KeyToSignature . SIGNATURE ) ; keyToSignature . parse ( ) ; return keyToSignature . signature . toString ( ) ; } public String toString ( ) { return this . key ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IWorkingCopy { void commit ( boolean force , IProgressMonitor monitor ) throws JavaModelException ; void destroy ( ) ; IJavaElement findSharedWorkingCopy ( IBufferFactory bufferFactory ) ; IJavaElement getOriginal ( IJavaElement workingCopyElement ) ; IJavaElement getOriginalElement ( ) ; IJavaElement [ ] findElements ( IJavaElement element ) ; IType findPrimaryType ( ) ; IJavaElement getSharedWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory , IProblemRequestor problemRequestor ) throws JavaModelException ; IJavaElement getWorkingCopy ( ) throws JavaModelException ; IJavaElement getWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory , IProblemRequestor problemRequestor ) throws JavaModelException ; boolean isBasedOn ( IResource resource ) ; boolean isWorkingCopy ( ) ; IMarker [ ] reconcile ( ) throws JavaModelException ; void reconcile ( boolean forceProblemDetection , IProgressMonitor monitor ) throws JavaModelException ; void restore ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core . compiler ; public interface ITerminalSymbols { int TokenNameWHITESPACE = <NUM_LIT:1000> ; int TokenNameCOMMENT_LINE = <NUM_LIT> ; int TokenNameCOMMENT_BLOCK = <NUM_LIT> ; int TokenNameCOMMENT_JAVADOC = <NUM_LIT> ; int TokenNameIdentifier = <NUM_LIT:5> ; int TokenNameabstract = <NUM_LIT> ; int TokenNameassert = <NUM_LIT> ; int TokenNameboolean = <NUM_LIT> ; int TokenNamebreak = <NUM_LIT> ; int TokenNamebyte = <NUM_LIT> ; int TokenNamecase = <NUM_LIT> ; int TokenNamecatch = <NUM_LIT> ; int TokenNamechar = <NUM_LIT:20> ; int TokenNameclass = <NUM_LIT> ; int TokenNamecontinue = <NUM_LIT> ; int TokenNamedefault = <NUM_LIT> ; int TokenNamedo = <NUM_LIT> ; int TokenNamedouble = <NUM_LIT> ; int TokenNameelse = <NUM_LIT> ; int TokenNameextends = <NUM_LIT> ; int TokenNamefalse = <NUM_LIT> ; int TokenNamefinal = <NUM_LIT> ; int TokenNamefinally = <NUM_LIT> ; int TokenNamefloat = <NUM_LIT> ; int TokenNamefor = <NUM_LIT> ; int TokenNameif = <NUM_LIT> ; int TokenNameimplements = <NUM_LIT> ; int TokenNameimport = <NUM_LIT> ; int TokenNameinstanceof = <NUM_LIT> ; int TokenNameint = <NUM_LIT> ; int TokenNameinterface = <NUM_LIT> ; int TokenNamelong = <NUM_LIT:24> ; int TokenNamenative = <NUM_LIT:100> ; int TokenNamenew = <NUM_LIT:32> ; int TokenNamenull = <NUM_LIT> ; int TokenNamepackage = <NUM_LIT> ; int TokenNameprivate = <NUM_LIT> ; int TokenNameprotected = <NUM_LIT> ; int TokenNamepublic = <NUM_LIT> ; int TokenNamereturn = <NUM_LIT> ; int TokenNameshort = <NUM_LIT> ; int TokenNamestatic = <NUM_LIT> ; int TokenNamestrictfp = <NUM_LIT> ; int TokenNamesuper = <NUM_LIT> ; int TokenNameswitch = <NUM_LIT> ; int TokenNamesynchronized = <NUM_LIT> ; int TokenNamethis = <NUM_LIT> ; int TokenNamethrow = <NUM_LIT> ; int TokenNamethrows = <NUM_LIT> ; int TokenNametransient = <NUM_LIT> ; int TokenNametrue = <NUM_LIT> ; int TokenNametry = <NUM_LIT> ; int TokenNamevoid = <NUM_LIT> ; int TokenNamevolatile = <NUM_LIT> ; int TokenNamewhile = <NUM_LIT> ; int TokenNameIntegerLiteral = <NUM_LIT> ; int TokenNameLongLiteral = <NUM_LIT> ; int TokenNameFloatingPointLiteral = <NUM_LIT> ; int TokenNameDoubleLiteral = <NUM_LIT> ; int TokenNameCharacterLiteral = <NUM_LIT> ; int TokenNameStringLiteral = <NUM_LIT> ; int TokenNamePLUS_PLUS = <NUM_LIT:1> ; int TokenNameMINUS_MINUS = <NUM_LIT:2> ; int TokenNameEQUAL_EQUAL = <NUM_LIT> ; int TokenNameLESS_EQUAL = <NUM_LIT> ; int TokenNameGREATER_EQUAL = <NUM_LIT> ; int TokenNameNOT_EQUAL = <NUM_LIT> ; int TokenNameLEFT_SHIFT = <NUM_LIT> ; int TokenNameRIGHT_SHIFT = <NUM_LIT:11> ; int TokenNameUNSIGNED_RIGHT_SHIFT = <NUM_LIT:12> ; int TokenNamePLUS_EQUAL = <NUM_LIT> ; int TokenNameMINUS_EQUAL = <NUM_LIT> ; int TokenNameMULTIPLY_EQUAL = <NUM_LIT> ; int TokenNameDIVIDE_EQUAL = <NUM_LIT> ; int TokenNameAND_EQUAL = <NUM_LIT> ; int TokenNameOR_EQUAL = <NUM_LIT> ; int TokenNameXOR_EQUAL = <NUM_LIT> ; int TokenNameREMAINDER_EQUAL = <NUM_LIT> ; int TokenNameLEFT_SHIFT_EQUAL = <NUM_LIT> ; int TokenNameRIGHT_SHIFT_EQUAL = <NUM_LIT> ; int TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = <NUM_LIT> ; int TokenNameOR_OR = <NUM_LIT> ; int TokenNameAND_AND = <NUM_LIT> ; int TokenNamePLUS = <NUM_LIT:3> ; int TokenNameMINUS = <NUM_LIT:4> ; int TokenNameNOT = <NUM_LIT> ; int TokenNameREMAINDER = <NUM_LIT:9> ; int TokenNameXOR = <NUM_LIT> ; int TokenNameAND = <NUM_LIT> ; int TokenNameMULTIPLY = <NUM_LIT:8> ; int TokenNameOR = <NUM_LIT> ; int TokenNameTWIDDLE = <NUM_LIT> ; int TokenNameDIVIDE = <NUM_LIT:10> ; int TokenNameGREATER = <NUM_LIT> ; int TokenNameLESS = <NUM_LIT> ; int TokenNameLPAREN = <NUM_LIT:7> ; int TokenNameRPAREN = <NUM_LIT> ; int TokenNameLBRACE = <NUM_LIT> ; int TokenNameRBRACE = <NUM_LIT> ; int TokenNameLBRACKET = <NUM_LIT:15> ; int TokenNameRBRACKET = <NUM_LIT> ; int TokenNameSEMICOLON = <NUM_LIT> ; int TokenNameQUESTION = <NUM_LIT> ; int TokenNameCOLON = <NUM_LIT> ; int TokenNameCOMMA = <NUM_LIT> ; int TokenNameDOT = <NUM_LIT:6> ; int TokenNameEQUAL = <NUM_LIT> ; int TokenNameEOF = <NUM_LIT> ; int TokenNameERROR = <NUM_LIT> ; int TokenNameenum = <NUM_LIT> ; int TokenNameAT = <NUM_LIT> ; int TokenNameELLIPSIS = <NUM_LIT> ; int TokenNameconst = <NUM_LIT> ; int TokenNamegoto = <NUM_LIT> ; } </s>
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . core . IJavaProject ; public abstract class CompilationParticipant { public final static int READY_FOR_BUILD = <NUM_LIT:1> ; public final static int NEEDS_FULL_BUILD = <NUM_LIT:2> ; public int aboutToBuild ( IJavaProject project ) { return READY_FOR_BUILD ; } public void buildFinished ( IJavaProject project ) { } public void buildStarting ( BuildContext [ ] files , boolean isBatch ) { } public void cleanStarting ( IJavaProject project ) { } public boolean isActive ( IJavaProject project ) { return false ; } public boolean isAnnotationProcessor ( ) { return false ; } public void processAnnotations ( BuildContext [ ] files ) { } public void reconcile ( ReconcileContext context ) { } } </s>
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . core . compiler . InvalidInputException ; public interface IScanner { char [ ] getCurrentTokenSource ( ) ; char [ ] getRawTokenSource ( ) ; int getCurrentTokenStartPosition ( ) ; int getCurrentTokenEndPosition ( ) ; int getLineStart ( int lineNumber ) ; int getLineEnd ( int lineNumber ) ; int [ ] getLineEnds ( ) ; int getLineNumber ( int charPosition ) ; int getNextToken ( ) throws InvalidInputException ; char [ ] getSource ( ) ; void resetTo ( int startPosition , int endPosition ) ; void setSource ( char [ ] source ) ; } </s>
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . core . resources . IFile ; public class BuildContext { public char [ ] getContents ( ) { return null ; } public IFile getFile ( ) { return null ; } public boolean hasAnnotations ( ) { return false ; } public void recordAddedGeneratedFiles ( IFile [ ] addedGeneratedFiles ) { } public void recordDeletedGeneratedFiles ( IFile [ ] deletedGeneratedFiles ) { } public void recordDependencies ( String [ ] typeNameDependencies ) { } public void recordNewProblems ( CategorizedProblem [ ] newProblems ) { } } </s>
<s> package org . eclipse . jdt . core . compiler ; import java . util . HashMap ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . IJavaModelMarker ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTParser ; import org . eclipse . jdt . internal . core . CompilationUnit ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jdt . internal . core . ReconcileWorkingCopyOperation ; public class ReconcileContext { private ReconcileWorkingCopyOperation operation ; private CompilationUnit workingCopy ; public ReconcileContext ( ReconcileWorkingCopyOperation operation , CompilationUnit workingCopy ) { this . operation = operation ; this . workingCopy = workingCopy ; } public org . eclipse . jdt . core . dom . CompilationUnit getAST3 ( ) throws JavaModelException { if ( this . operation . astLevel != AST . JLS3 || ! this . operation . resolveBindings ) { ASTParser parser = ASTParser . newParser ( AST . JLS3 ) ; parser . setCompilerOptions ( this . workingCopy . getJavaProject ( ) . getOptions ( true ) ) ; if ( JavaProject . hasJavaNature ( this . workingCopy . getJavaProject ( ) . getProject ( ) ) ) parser . setResolveBindings ( true ) ; parser . setStatementsRecovery ( ( this . operation . reconcileFlags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ) ; parser . setBindingsRecovery ( ( this . operation . reconcileFlags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> ) ; parser . setSource ( this . workingCopy ) ; parser . setIgnoreMethodBodies ( ( this . operation . reconcileFlags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) ; return ( org . eclipse . jdt . core . dom . CompilationUnit ) parser . createAST ( this . operation . progressMonitor ) ; } return this . operation . makeConsistent ( this . workingCopy ) ; } public org . eclipse . jdt . core . dom . CompilationUnit getAST4 ( ) throws JavaModelException { if ( this . operation . astLevel != AST . JLS4 || ! this . operation . resolveBindings ) { ASTParser parser = ASTParser . newParser ( AST . JLS4 ) ; parser . setCompilerOptions ( this . workingCopy . getJavaProject ( ) . getOptions ( true ) ) ; if ( JavaProject . hasJavaNature ( this . workingCopy . getJavaProject ( ) . getProject ( ) ) ) parser . setResolveBindings ( true ) ; parser . setStatementsRecovery ( ( this . operation . reconcileFlags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ) ; parser . setBindingsRecovery ( ( this . operation . reconcileFlags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> ) ; parser . setSource ( this . workingCopy ) ; parser . setIgnoreMethodBodies ( ( this . operation . reconcileFlags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) ; return ( org . eclipse . jdt . core . dom . CompilationUnit ) parser . createAST ( this . operation . progressMonitor ) ; } return this . operation . makeConsistent ( this . workingCopy ) ; } public int getASTLevel ( ) { return this . operation . astLevel ; } public boolean isResolvingBindings ( ) { return this . operation . resolveBindings ; } public int getReconcileFlags ( ) { return this . operation . reconcileFlags ; } public IJavaElementDelta getDelta ( ) { return this . operation . deltaBuilder . delta ; } public CategorizedProblem [ ] getProblems ( String markerType ) { if ( this . operation . problems == null ) return null ; return ( CategorizedProblem [ ] ) this . operation . problems . get ( markerType ) ; } public ICompilationUnit getWorkingCopy ( ) { return this . workingCopy ; } public void resetAST ( ) { this . operation . ast = null ; putProblems ( IJavaModelMarker . JAVA_MODEL_PROBLEM_MARKER , null ) ; putProblems ( IJavaModelMarker . TASK_MARKER , null ) ; } public void putProblems ( String markerType , CategorizedProblem [ ] problems ) { if ( this . operation . problems == null ) this . operation . problems = new HashMap ( ) ; this . operation . problems . put ( markerType , problems ) ; } } </s>
<s> package org . eclipse . jdt . core ; public interface IInitializer extends IMember { } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; public interface IJavaElement extends IAdaptable { int JAVA_MODEL = <NUM_LIT:1> ; int JAVA_PROJECT = <NUM_LIT:2> ; int PACKAGE_FRAGMENT_ROOT = <NUM_LIT:3> ; int PACKAGE_FRAGMENT = <NUM_LIT:4> ; int COMPILATION_UNIT = <NUM_LIT:5> ; int CLASS_FILE = <NUM_LIT:6> ; int TYPE = <NUM_LIT:7> ; int FIELD = <NUM_LIT:8> ; int METHOD = <NUM_LIT:9> ; int INITIALIZER = <NUM_LIT:10> ; int PACKAGE_DECLARATION = <NUM_LIT:11> ; int IMPORT_CONTAINER = <NUM_LIT:12> ; int IMPORT_DECLARATION = <NUM_LIT> ; int LOCAL_VARIABLE = <NUM_LIT> ; int TYPE_PARAMETER = <NUM_LIT:15> ; int ANNOTATION = <NUM_LIT:16> ; boolean exists ( ) ; IJavaElement getAncestor ( int ancestorType ) ; String getAttachedJavadoc ( IProgressMonitor monitor ) throws JavaModelException ; IResource getCorrespondingResource ( ) throws JavaModelException ; String getElementName ( ) ; int getElementType ( ) ; String getHandleIdentifier ( ) ; IJavaModel getJavaModel ( ) ; IJavaProject getJavaProject ( ) ; IOpenable getOpenable ( ) ; IJavaElement getParent ( ) ; IPath getPath ( ) ; IJavaElement getPrimaryElement ( ) ; IResource getResource ( ) ; ISchedulingRule getSchedulingRule ( ) ; IResource getUnderlyingResource ( ) throws JavaModelException ; boolean isReadOnly ( ) ; boolean isStructureKnown ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public final class CompletionFlags { public static final int Default = <NUM_LIT> ; public static final int StaticImport = <NUM_LIT> ; private CompletionFlags ( ) { } public static boolean isStaticImport ( int flags ) { return ( flags & StaticImport ) != <NUM_LIT:0> ; } } </s>
<s> package org . eclipse . jdt . core . eval ; public interface IGlobalVariable { public String getInitializer ( ) ; public String getName ( ) ; public String getTypeName ( ) ; } </s>
<s> package org . eclipse . jdt . core . eval ; import org . eclipse . core . resources . IMarker ; import org . eclipse . jdt . internal . eval . EvaluationConstants ; public interface ICodeSnippetRequestor { public static final String LOCAL_VAR_PREFIX = new String ( EvaluationConstants . LOCAL_VAR_PREFIX ) ; public static final String DELEGATE_THIS = new String ( EvaluationConstants . DELEGATE_THIS ) ; public static final String RUN_METHOD = EvaluationConstants . RUN_METHOD ; public static final String RESULT_VALUE_FIELD = EvaluationConstants . RESULT_VALUE_FIELD ; public static final String RESULT_TYPE_FIELD = EvaluationConstants . RESULT_TYPE_FIELD ; public static final int VARIABLE = <NUM_LIT:1> ; public static final int CODE_SNIPPET = <NUM_LIT:2> ; public static final int IMPORT = <NUM_LIT:3> ; public static final int PACKAGE = <NUM_LIT:4> ; public static final int INTERNAL = <NUM_LIT:5> ; public boolean acceptClassFiles ( byte [ ] [ ] classFileBytes , String [ ] [ ] classFileCompoundNames , String codeSnippetClassName ) ; public void acceptProblem ( IMarker problemMarker , String fragmentSource , int fragmentKind ) ; } </s>
<s> package org . eclipse . jdt . core . eval ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; public interface IEvaluationContext { public IGlobalVariable [ ] allVariables ( ) ; public void codeComplete ( String codeSnippet , int position , ICompletionRequestor requestor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; public IJavaElement [ ] codeSelect ( String codeSnippet , int offset , int length ) throws JavaModelException ; public IJavaElement [ ] codeSelect ( String codeSnippet , int offset , int length , WorkingCopyOwner owner ) throws JavaModelException ; public void deleteVariable ( IGlobalVariable variable ) ; public void evaluateCodeSnippet ( String codeSnippet , String [ ] localVariableTypeNames , String [ ] localVariableNames , int [ ] localVariableModifiers , IType declaringType , boolean isStatic , boolean isConstructorCall , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException ; public void evaluateCodeSnippet ( String codeSnippet , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException ; public void evaluateVariable ( IGlobalVariable variable , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException ; public String [ ] getImports ( ) ; public String getPackageName ( ) ; public IJavaProject getProject ( ) ; public IGlobalVariable newVariable ( String typeName , String name , String initializer ) ; public void setImports ( String [ ] imports ) ; public void setPackageName ( String packageName ) ; public void validateImports ( ICodeSnippetRequestor requestor ) throws JavaModelException ; public void codeComplete ( String codeSnippet , int position , org . eclipse . jdt . core . ICodeCompletionRequestor requestor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IMarker ; public interface IJavaModelMarker { String JAVA_MODEL_PROBLEM_MARKER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String TRANSIENT_PROBLEM = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String TASK_MARKER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String ARGUMENTS = "<STR_LIT>" ; String ID = "<STR_LIT:id>" ; String CATEGORY_ID = "<STR_LIT>" ; String FLAGS = "<STR_LIT>" ; String CYCLE_DETECTED = "<STR_LIT>" ; String BUILDPATH_PROBLEM_MARKER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; String CLASSPATH_FILE_FORMAT = "<STR_LIT>" ; String OUTPUT_OVERLAPPING_SOURCE = "<STR_LIT>" ; } </s>
<s> package org . eclipse . jdt . core ; public interface ITypeParameter extends IJavaElement , ISourceReference { String [ ] getBounds ( ) throws JavaModelException ; String [ ] getBoundsSignatures ( ) throws JavaModelException ; IMember getDeclaringMember ( ) ; ITypeRoot getTypeRoot ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import java . io . PrintStream ; import java . io . PrintWriter ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jdt . internal . core . JavaModelStatus ; public class JavaModelException extends CoreException { private static final long serialVersionUID = - <NUM_LIT> ; CoreException nestedCoreException ; public JavaModelException ( Throwable e , int code ) { this ( new JavaModelStatus ( code , e ) ) ; } public JavaModelException ( CoreException exception ) { super ( exception . getStatus ( ) ) ; this . nestedCoreException = exception ; } public JavaModelException ( IJavaModelStatus status ) { super ( status ) ; } public Throwable getException ( ) { if ( this . nestedCoreException == null ) { return getStatus ( ) . getException ( ) ; } else { return this . nestedCoreException ; } } public IJavaModelStatus getJavaModelStatus ( ) { IStatus status = getStatus ( ) ; if ( status instanceof IJavaModelStatus ) { return ( IJavaModelStatus ) status ; } else { return new JavaModelStatus ( this . nestedCoreException ) ; } } public boolean isDoesNotExist ( ) { IJavaModelStatus javaModelStatus = getJavaModelStatus ( ) ; return javaModelStatus != null && javaModelStatus . isDoesNotExist ( ) ; } public void printStackTrace ( PrintStream output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "<STR_LIT>" ) ; throwable . printStackTrace ( output ) ; } } } public void printStackTrace ( PrintWriter output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "<STR_LIT>" ) ; throwable . printStackTrace ( output ) ; } } } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; if ( getException ( ) != null ) { if ( getException ( ) instanceof CoreException ) { CoreException c = ( CoreException ) getException ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( c . getStatus ( ) . getCode ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( c . getStatus ( ) . getMessage ( ) ) ; } else { buffer . append ( getException ( ) . toString ( ) ) ; } } else { buffer . append ( getStatus ( ) . toString ( ) ) ; } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ICodeAssist { void codeComplete ( int offset , ICodeCompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException ; void codeComplete ( int offset , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException ; void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException ; IJavaElement [ ] codeSelect ( int offset , int length , WorkingCopyOwner owner ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface IParent { IJavaElement [ ] getChildren ( ) throws JavaModelException ; boolean hasChildren ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . core . compiler . IProblem ; public interface IProblemRequestor { void acceptProblem ( IProblem problem ) ; void beginReporting ( ) ; void endReporting ( ) ; boolean isActive ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IBufferFactory { IBuffer createBuffer ( IOpenable owner ) ; } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . ClassFile ; public interface IRequestor { boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) ; void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) ; } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IErrorHandlingPolicy ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; public class CodeSnippetCompiler extends Compiler { EvaluationContext evaluationContext ; int codeSnippetStart ; int codeSnippetEnd ; public CodeSnippetCompiler ( INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions compilerOptions , ICompilerRequestor requestor , IProblemFactory problemFactory , EvaluationContext evaluationContext , int codeSnippetStart , int codeSnippetEnd ) { super ( environment , policy , compilerOptions , requestor , problemFactory ) ; this . codeSnippetStart = codeSnippetStart ; this . codeSnippetEnd = codeSnippetEnd ; this . evaluationContext = evaluationContext ; this . parser = new CodeSnippetParser ( this . problemReporter , evaluationContext , this . options . parseLiteralExpressionsAsConstants , codeSnippetStart , codeSnippetEnd ) ; this . parseThreshold = <NUM_LIT:1> ; } public void initializeParser ( ) { this . parser = new CodeSnippetParser ( this . problemReporter , this . evaluationContext , this . options . parseLiteralExpressionsAsConstants , this . codeSnippetStart , this . codeSnippetEnd ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryField ; import org . eclipse . jdt . internal . compiler . env . IBinaryMethod ; import org . eclipse . jdt . internal . compiler . env . IBinaryNestedType ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . core . util . Util ; public class CodeSnippetSkeleton implements IBinaryType , EvaluationConstants { public static class BinaryMethodSkeleton implements IBinaryMethod { char [ ] [ ] exceptionTypeNames ; char [ ] methodDescriptor ; char [ ] selector ; boolean isConstructor ; public BinaryMethodSkeleton ( char [ ] selector , char [ ] methodDescriptor , char [ ] [ ] exceptionTypeNames , boolean isConstructor ) { this . selector = selector ; this . methodDescriptor = methodDescriptor ; this . exceptionTypeNames = exceptionTypeNames ; this . isConstructor = isConstructor ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return null ; } public char [ ] [ ] getArgumentNames ( ) { return null ; } public Object getDefaultValue ( ) { return null ; } public char [ ] [ ] getExceptionTypeNames ( ) { return this . exceptionTypeNames ; } public char [ ] getGenericSignature ( ) { return null ; } public char [ ] getMethodDescriptor ( ) { return this . methodDescriptor ; } public int getModifiers ( ) { return ClassFileConstants . AccPublic ; } public IBinaryAnnotation [ ] getParameterAnnotations ( int index ) { return null ; } public int getAnnotatedParametersCount ( ) { return <NUM_LIT:0> ; } public char [ ] getSelector ( ) { return this . selector ; } public long getTagBits ( ) { return <NUM_LIT:0> ; } public boolean isClinit ( ) { return false ; } public boolean isConstructor ( ) { return this . isConstructor ; } } IBinaryMethod [ ] methods = new IBinaryMethod [ ] { new BinaryMethodSkeleton ( "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] [ ] { } , true ) , new BinaryMethodSkeleton ( "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) } , false ) , new BinaryMethodSkeleton ( "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] [ ] { } , false ) } ; public CodeSnippetSkeleton ( ) { super ( ) ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return null ; } public char [ ] getEnclosingMethod ( ) { return null ; } public char [ ] getEnclosingTypeName ( ) { return null ; } public IBinaryField [ ] getFields ( ) { return null ; } public char [ ] getFileName ( ) { return CharOperation . concat ( CODE_SNIPPET_NAME , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getGenericSignature ( ) { return null ; } public char [ ] [ ] getInterfaceNames ( ) { return null ; } public String getJavadocContents ( ) { return null ; } public String getJavadocContents ( IProgressMonitor monitor , String defaultEncoding ) throws JavaModelException { return null ; } public IBinaryNestedType [ ] getMemberTypes ( ) { return null ; } public IBinaryMethod [ ] getMethods ( ) { return this . methods ; } public int getModifiers ( ) { return ClassFileConstants . AccPublic ; } public char [ ] [ ] [ ] getMissingTypeNames ( ) { return null ; } public char [ ] getName ( ) { return CODE_SNIPPET_NAME ; } public char [ ] getSourceName ( ) { return ROOT_CLASS_NAME ; } public char [ ] getSuperclassName ( ) { return null ; } public long getTagBits ( ) { return <NUM_LIT:0> ; } public String getURLContents ( String docUrlValue , String defaultEncoding ) { return null ; } public boolean isAnonymous ( ) { return false ; } public boolean isBinaryType ( ) { return true ; } public boolean isLocal ( ) { return false ; } public boolean isMember ( ) { return false ; } public char [ ] sourceFileName ( ) { return null ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . SuperReference ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class CodeSnippetSuperReference extends SuperReference implements EvaluationConstants , InvocationSite { public CodeSnippetSuperReference ( int pos , int sourceEnd ) { super ( pos , sourceEnd ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public TypeBinding resolveType ( BlockScope scope ) { scope . problemReporter ( ) . cannotUseSuperInCodeSnippet ( this . sourceStart , this . sourceEnd ) ; return null ; } public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return false ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int index ) { } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . core . util . Util ; public abstract class Evaluator { EvaluationContext context ; INameEnvironment environment ; Map options ; IRequestor requestor ; IProblemFactory problemFactory ; Evaluator ( EvaluationContext context , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) { this . context = context ; this . environment = environment ; this . options = options ; this . requestor = requestor ; this . problemFactory = problemFactory ; } protected abstract void addEvaluationResultForCompilationProblem ( Map resultsByIDs , CategorizedProblem problem , char [ ] cuSource ) ; protected EvaluationResult [ ] evaluationResultsForCompilationProblems ( CompilationResult result , char [ ] cuSource ) { CategorizedProblem [ ] problems = result . getAllProblems ( ) ; HashMap resultsByIDs = new HashMap ( <NUM_LIT:5> ) ; for ( int i = <NUM_LIT:0> ; i < problems . length ; i ++ ) { addEvaluationResultForCompilationProblem ( resultsByIDs , problems [ i ] , cuSource ) ; } int size = resultsByIDs . size ( ) ; EvaluationResult [ ] evalResults = new EvaluationResult [ size ] ; Iterator results = resultsByIDs . values ( ) . iterator ( ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { evalResults [ i ] = ( EvaluationResult ) results . next ( ) ; } return evalResults ; } ClassFile [ ] getClasses ( ) { final char [ ] source = getSource ( ) ; final ArrayList classDefinitions = new ArrayList ( ) ; class CompilerRequestor implements ICompilerRequestor { boolean hasErrors = false ; public void acceptResult ( CompilationResult result ) { if ( result . hasProblems ( ) ) { EvaluationResult [ ] evalResults = evaluationResultsForCompilationProblems ( result , source ) ; for ( int i = <NUM_LIT:0> ; i < evalResults . length ; i ++ ) { EvaluationResult evalResult = evalResults [ i ] ; CategorizedProblem [ ] problems = evalResult . getProblems ( ) ; for ( int j = <NUM_LIT:0> ; j < problems . length ; j ++ ) { Evaluator . this . requestor . acceptProblem ( problems [ j ] , evalResult . getEvaluationID ( ) , evalResult . getEvaluationType ( ) ) ; } } } if ( result . hasErrors ( ) ) { this . hasErrors = true ; } else { ClassFile [ ] classFiles = result . getClassFiles ( ) ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; classDefinitions . add ( classFile ) ; } } } } CompilerRequestor compilerRequestor = new CompilerRequestor ( ) ; Compiler compiler = getCompiler ( compilerRequestor ) ; compiler . compile ( new ICompilationUnit [ ] { new ICompilationUnit ( ) { public char [ ] getFileName ( ) { return CharOperation . concat ( Evaluator . this . getClassName ( ) , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getContents ( ) { return source ; } public char [ ] getMainTypeName ( ) { return Evaluator . this . getClassName ( ) ; } public char [ ] [ ] getPackageName ( ) { return null ; } public boolean ignoreOptionalProblems ( ) { return false ; } } } ) ; if ( compilerRequestor . hasErrors ) { return null ; } else { ClassFile [ ] result = new ClassFile [ classDefinitions . size ( ) ] ; classDefinitions . toArray ( result ) ; return result ; } } protected abstract char [ ] getClassName ( ) ; Compiler getCompiler ( ICompilerRequestor compilerRequestor ) { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; compilerOptions . performMethodsFullRecovery = true ; compilerOptions . performStatementsRecovery = true ; return new Compiler ( this . environment , DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) , compilerOptions , compilerRequestor , this . problemFactory ) ; } protected abstract char [ ] getSource ( ) ; } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . Map ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; public class CodeSnippetEvaluator extends Evaluator implements EvaluationConstants { static final boolean DEVELOPMENT_MODE = false ; char [ ] codeSnippet ; CodeSnippetToCuMapper mapper ; CodeSnippetEvaluator ( char [ ] codeSnippet , EvaluationContext context , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) { super ( context , environment , options , requestor , problemFactory ) ; this . codeSnippet = codeSnippet ; } protected void addEvaluationResultForCompilationProblem ( Map resultsByIDs , CategorizedProblem problem , char [ ] cuSource ) { CodeSnippetToCuMapper sourceMapper = getMapper ( ) ; int pbLineNumber = problem . getSourceLineNumber ( ) ; int evaluationType = sourceMapper . getEvaluationType ( pbLineNumber ) ; char [ ] evaluationID = null ; switch ( evaluationType ) { case EvaluationResult . T_PACKAGE : evaluationID = this . context . packageName ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; break ; case EvaluationResult . T_IMPORT : evaluationID = sourceMapper . getImport ( pbLineNumber ) ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; break ; case EvaluationResult . T_CODE_SNIPPET : evaluationID = this . codeSnippet ; problem . setSourceLineNumber ( pbLineNumber - this . mapper . lineNumberOffset ) ; problem . setSourceStart ( problem . getSourceStart ( ) - this . mapper . startPosOffset ) ; problem . setSourceEnd ( problem . getSourceEnd ( ) - this . mapper . startPosOffset ) ; break ; case EvaluationResult . T_INTERNAL : evaluationID = cuSource ; break ; } EvaluationResult result = ( EvaluationResult ) resultsByIDs . get ( evaluationID ) ; if ( result == null ) { resultsByIDs . put ( evaluationID , new EvaluationResult ( evaluationID , evaluationType , new CategorizedProblem [ ] { problem } ) ) ; } else { result . addProblem ( problem ) ; } } protected char [ ] getClassName ( ) { return CharOperation . concat ( CODE_SNIPPET_CLASS_NAME_PREFIX , Integer . toString ( EvaluationContext . CODE_SNIPPET_COUNTER + <NUM_LIT:1> ) . toCharArray ( ) ) ; } Compiler getCompiler ( ICompilerRequestor compilerRequestor ) { Compiler compiler = null ; if ( ! DEVELOPMENT_MODE ) { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; compilerOptions . performMethodsFullRecovery = true ; compilerOptions . performStatementsRecovery = true ; compiler = new CodeSnippetCompiler ( this . environment , DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) , compilerOptions , compilerRequestor , this . problemFactory , this . context , getMapper ( ) . startPosOffset , getMapper ( ) . startPosOffset + this . codeSnippet . length - <NUM_LIT:1> ) ; ( ( CodeSnippetParser ) compiler . parser ) . lineSeparatorLength = this . context . lineSeparator . length ( ) ; IBinaryType binary = this . context . getRootCodeSnippetBinary ( ) ; if ( binary != null ) { compiler . lookupEnvironment . cacheBinaryType ( binary , null ) ; } VariablesInfo installedVars = this . context . installedVars ; if ( installedVars != null ) { ClassFile [ ] globalClassFiles = installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < globalClassFiles . length ; i ++ ) { ClassFileReader binaryType = null ; try { binaryType = new ClassFileReader ( globalClassFiles [ i ] . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; } compiler . lookupEnvironment . cacheBinaryType ( binaryType , null ) ; } } } else { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; compilerOptions . performMethodsFullRecovery = true ; compilerOptions . performStatementsRecovery = true ; compiler = new Compiler ( getWrapperEnvironment ( ) , DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) , compilerOptions , compilerRequestor , this . problemFactory ) ; } return compiler ; } private CodeSnippetToCuMapper getMapper ( ) { if ( this . mapper == null ) { char [ ] varClassName = null ; VariablesInfo installedVars = this . context . installedVars ; if ( installedVars != null ) { char [ ] superPackageName = installedVars . packageName ; if ( superPackageName != null && superPackageName . length != <NUM_LIT:0> ) { varClassName = CharOperation . concat ( superPackageName , installedVars . className , '<CHAR_LIT:.>' ) ; } else { varClassName = installedVars . className ; } } this . mapper = new CodeSnippetToCuMapper ( this . codeSnippet , this . context . packageName , this . context . imports , getClassName ( ) , varClassName , this . context . localVariableNames , this . context . localVariableTypeNames , this . context . localVariableModifiers , this . context . declaringTypeName , this . context . lineSeparator , CompilerOptions . versionToJdkLevel ( this . options . get ( JavaCore . COMPILER_COMPLIANCE ) ) ) ; } return this . mapper ; } protected char [ ] getSource ( ) { return getMapper ( ) . cuSource ; } private INameEnvironment getWrapperEnvironment ( ) { return new CodeSnippetEnvironment ( this . environment , this . context ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . Map ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; public class VariablesEvaluator extends Evaluator implements EvaluationConstants { VariablesEvaluator ( EvaluationContext context , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) { super ( context , environment , options , requestor , problemFactory ) ; } protected void addEvaluationResultForCompilationProblem ( Map resultsByIDs , CategorizedProblem problem , char [ ] cuSource ) { char [ ] evaluationID = cuSource ; int evaluationType = EvaluationResult . T_INTERNAL ; int pbLine = problem . getSourceLineNumber ( ) ; int currentLine = <NUM_LIT:1> ; char [ ] packageName = getPackageName ( ) ; if ( packageName . length > <NUM_LIT:0> ) { if ( pbLine == <NUM_LIT:1> ) { evaluationID = packageName ; evaluationType = EvaluationResult . T_PACKAGE ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; } currentLine ++ ; } char [ ] [ ] imports = this . context . imports ; if ( ( currentLine <= pbLine ) && ( pbLine < ( currentLine + imports . length ) ) ) { evaluationID = imports [ pbLine - currentLine ] ; evaluationType = EvaluationResult . T_IMPORT ; problem . setSourceLineNumber ( <NUM_LIT:1> ) ; problem . setSourceStart ( <NUM_LIT:0> ) ; problem . setSourceEnd ( evaluationID . length - <NUM_LIT:1> ) ; } currentLine += imports . length + <NUM_LIT:1> ; int varCount = this . context . variableCount ; if ( ( currentLine <= pbLine ) && ( pbLine < currentLine + varCount ) ) { GlobalVariable var = this . context . variables [ pbLine - currentLine ] ; evaluationID = var . getName ( ) ; evaluationType = EvaluationResult . T_VARIABLE ; int pbStart = problem . getSourceStart ( ) - var . declarationStart ; int pbEnd = problem . getSourceEnd ( ) - var . declarationStart ; int typeLength = var . getTypeName ( ) . length ; if ( ( <NUM_LIT:0> <= pbStart ) && ( pbEnd < typeLength ) ) { problem . setSourceLineNumber ( - <NUM_LIT:1> ) ; } else { pbStart -= typeLength + <NUM_LIT:1> ; pbEnd -= typeLength + <NUM_LIT:1> ; problem . setSourceLineNumber ( <NUM_LIT:0> ) ; } problem . setSourceStart ( pbStart ) ; problem . setSourceEnd ( pbEnd ) ; } currentLine = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < varCount ; i ++ ) { GlobalVariable var = this . context . variables [ i ] ; char [ ] initializer = var . getInitializer ( ) ; int initializerLength = initializer == null ? <NUM_LIT:0> : initializer . length ; if ( ( var . initializerStart <= problem . getSourceStart ( ) ) && ( problem . getSourceEnd ( ) < var . initializerStart + var . name . length ) ) { return ; } else if ( ( var . initExpressionStart <= problem . getSourceStart ( ) ) && ( problem . getSourceEnd ( ) < var . initExpressionStart + initializerLength ) ) { evaluationID = var . name ; evaluationType = EvaluationResult . T_VARIABLE ; problem . setSourceLineNumber ( pbLine - var . initializerLineStart + <NUM_LIT:1> ) ; problem . setSourceStart ( problem . getSourceStart ( ) - var . initExpressionStart ) ; problem . setSourceEnd ( problem . getSourceEnd ( ) - var . initExpressionStart ) ; break ; } } EvaluationResult result = ( EvaluationResult ) resultsByIDs . get ( evaluationID ) ; if ( result == null ) { resultsByIDs . put ( evaluationID , new EvaluationResult ( evaluationID , evaluationType , new CategorizedProblem [ ] { problem } ) ) ; } else { result . addProblem ( problem ) ; } } protected char [ ] getClassName ( ) { return CharOperation . concat ( EvaluationConstants . GLOBAL_VARS_CLASS_NAME_PREFIX , Integer . toString ( EvaluationContext . VAR_CLASS_COUNTER + <NUM_LIT:1> ) . toCharArray ( ) ) ; } Compiler getCompiler ( ICompilerRequestor compilerRequestor ) { Compiler compiler = super . getCompiler ( compilerRequestor ) ; IBinaryType binaryType = this . context . getRootCodeSnippetBinary ( ) ; if ( binaryType != null ) { compiler . lookupEnvironment . cacheBinaryType ( binaryType , null ) ; } VariablesInfo installedVars = this . context . installedVars ; if ( installedVars != null ) { ClassFile [ ] classFiles = installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; IBinaryType binary = null ; try { binary = new ClassFileReader ( classFile . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; } compiler . lookupEnvironment . cacheBinaryType ( binary , null ) ; } } return compiler ; } protected char [ ] getPackageName ( ) { return this . context . packageName ; } protected char [ ] getSource ( ) { StringBuffer buffer = new StringBuffer ( ) ; int lineNumberOffset = <NUM_LIT:1> ; char [ ] packageName = getPackageName ( ) ; if ( packageName . length != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( packageName ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } char [ ] [ ] imports = this . context . imports ; for ( int i = <NUM_LIT:0> ; i < imports . length ; i ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( imports [ i ] ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( getClassName ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( PACKAGE_NAME ) ; buffer . append ( "<STR_LIT:.>" ) ; buffer . append ( ROOT_CLASS_NAME ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; GlobalVariable [ ] vars = this . context . variables ; VariablesInfo installedVars = this . context . installedVars ; for ( int i = <NUM_LIT:0> ; i < this . context . variableCount ; i ++ ) { GlobalVariable var = vars [ i ] ; buffer . append ( "<STR_LIT>" ) ; var . declarationStart = buffer . length ( ) ; buffer . append ( var . typeName ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; char [ ] varName = var . name ; buffer . append ( varName ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; for ( int i = <NUM_LIT:0> ; i < this . context . variableCount ; i ++ ) { GlobalVariable var = vars [ i ] ; char [ ] varName = var . name ; GlobalVariable installedVar = installedVars == null ? null : installedVars . varNamed ( varName ) ; if ( installedVar == null || ! CharOperation . equals ( installedVar . typeName , var . typeName ) ) { char [ ] initializer = var . initializer ; if ( initializer != null ) { buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; var . initializerLineStart = lineNumberOffset ; buffer . append ( "<STR_LIT>" ) ; var . initializerStart = buffer . length ( ) ; buffer . append ( varName ) ; buffer . append ( "<STR_LIT>" ) ; var . initExpressionStart = buffer . length ( ) ; buffer . append ( initializer ) ; lineNumberOffset += numberOfCRs ( initializer ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; lineNumberOffset += <NUM_LIT:4> ; } } else { buffer . append ( "<STR_LIT>" ) ; buffer . append ( varName ) ; buffer . append ( "<STR_LIT>" ) ; char [ ] installedPackageName = installedVars . packageName ; if ( installedPackageName != null && installedPackageName . length != <NUM_LIT:0> ) { buffer . append ( installedPackageName ) ; buffer . append ( "<STR_LIT:.>" ) ; } buffer . append ( installedVars . className ) ; buffer . append ( "<STR_LIT:.>" ) ; buffer . append ( varName ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( this . context . lineSeparator ) ; lineNumberOffset ++ ; } } buffer . append ( "<STR_LIT>" ) . append ( this . context . lineSeparator ) ; buffer . append ( '<CHAR_LIT:}>' ) . append ( this . context . lineSeparator ) ; int length = buffer . length ( ) ; char [ ] result = new char [ length ] ; buffer . getChars ( <NUM_LIT:0> , length , result , <NUM_LIT:0> ) ; return result ; } private int numberOfCRs ( char [ ] source ) { int numberOfCRs = <NUM_LIT:0> ; boolean lastWasCR = false ; for ( int i = <NUM_LIT:0> ; i < source . length ; i ++ ) { char currentChar = source [ i ] ; switch ( currentChar ) { case '<STR_LIT>' : lastWasCR = true ; numberOfCRs ++ ; break ; case '<STR_LIT:\n>' : if ( ! lastWasCR ) numberOfCRs ++ ; lastWasCR = false ; break ; default : lastWasCR = false ; } } return numberOfCRs ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . BinaryExpression ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortMethod ; public class CodeSnippetSingleNameReference extends SingleNameReference implements EvaluationConstants , ProblemReasons { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetSingleNameReference ( char [ ] source , long pos , EvaluationContext evaluationContext ) { super ( source , pos ) ; this . evaluationContext = evaluationContext ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo , boolean valueRequired ) { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding fieldBinding ; if ( ( fieldBinding = ( FieldBinding ) this . binding ) . isBlankFinal ( ) && currentScope . needBlankFinalFieldInitializationCheck ( fieldBinding ) ) { FlowInfo fieldInits = flowContext . getInitsForFinalBlankInitializationCheck ( fieldBinding . declaringClass . original ( ) , flowInfo ) ; if ( ! fieldInits . isDefinitelyAssigned ( fieldBinding ) ) { currentScope . problemReporter ( ) . uninitializedBlankFinalField ( fieldBinding , this ) ; } } break ; case Binding . LOCAL : LocalVariableBinding localBinding ; if ( ! flowInfo . isDefinitelyAssigned ( localBinding = ( LocalVariableBinding ) this . binding ) ) { currentScope . problemReporter ( ) . uninitializedLocalVariable ( localBinding , this ) ; } if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ) { localBinding . useFlag = LocalVariableBinding . USED ; } else if ( localBinding . useFlag == LocalVariableBinding . UNUSED ) { localBinding . useFlag = LocalVariableBinding . FAKE_USED ; } } return flowInfo ; } public TypeBinding checkFieldAccess ( BlockScope scope ) { if ( this . delegateThis == null ) { return super . checkFieldAccess ( scope ) ; } FieldBinding fieldBinding = ( FieldBinding ) this . binding ; this . bits &= ~ RestrictiveFlagMASK ; this . bits |= Binding . FIELD ; if ( ! fieldBinding . isStatic ( ) ) { if ( this . evaluationContext . isStatic ) { scope . problemReporter ( ) . staticFieldAccessToNonStaticVariable ( this , fieldBinding ) ; this . constant = Constant . NotAConstant ; return null ; } } this . constant = fieldBinding . constant ( ) ; if ( isFieldUseDeprecated ( fieldBinding , scope , this . bits ) ) { scope . problemReporter ( ) . deprecatedField ( fieldBinding , this ) ; } return fieldBinding . type ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { if ( assignment . expression . isCompactableOperation ( ) ) { BinaryExpression operation = ( BinaryExpression ) assignment . expression ; int operator = ( operation . bits & OperatorMASK ) > > OperatorSHIFT ; SingleNameReference variableReference ; if ( ( operation . left instanceof SingleNameReference ) && ( ( variableReference = ( SingleNameReference ) operation . left ) . binding == this . binding ) ) { variableReference . generateCompoundAssignment ( currentScope , codeStream , this . syntheticAccessors == null ? null : this . syntheticAccessors [ WRITE ] , operation . right , operator , operation . implicitConversion , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } return ; } if ( ( operation . right instanceof SingleNameReference ) && ( ( operator == PLUS ) || ( operator == MULTIPLY ) ) && ( ( variableReference = ( SingleNameReference ) operation . right ) . binding == this . binding ) && ( operation . left . constant != Constant . NotAConstant ) && ( ( ( operation . left . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) != T_JavaLangString ) && ( ( ( operation . right . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) != T_JavaLangString ) ) { variableReference . generateCompoundAssignment ( currentScope , codeStream , this . syntheticAccessors == null ? null : this . syntheticAccessors [ WRITE ] , operation . left , operator , operation . implicitConversion , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } return ; } } switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { if ( ! codegenField . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } } assignment . expression . generateCode ( currentScope , codeStream , true ) ; fieldStore ( currentScope , codeStream , codegenField , null , this . actualReceiverType , this . delegateThis == null , valueRequired ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } else { codeStream . generateEmulationForField ( codegenField ) ; if ( ! codegenField . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } else { codeStream . aconst_null ( ) ; } assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { if ( ( codegenField . type == TypeBinding . LONG ) || ( codegenField . type == TypeBinding . DOUBLE ) ) { codeStream . dup2_x2 ( ) ; } else { codeStream . dup_x2 ( ) ; } } codeStream . generateEmulatedWriteAccessForField ( codegenField ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } return ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; if ( localBinding . resolvedPosition != - <NUM_LIT:1> ) { assignment . expression . generateCode ( currentScope , codeStream , true ) ; } else { if ( assignment . expression . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( assignment . expression . constant , assignment . implicitConversion ) ; } } else { assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } else { if ( ( localBinding . type == TypeBinding . LONG ) || ( localBinding . type == TypeBinding . DOUBLE ) ) { codeStream . pop2 ( ) ; } else { codeStream . pop ( ) ; } } } return ; } codeStream . store ( localBinding , valueRequired ) ; if ( ( this . bits & FirstAssignmentToLocal ) != <NUM_LIT:0> ) { localBinding . recordInitializationStartPC ( codeStream . position ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } } else { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : if ( ! valueRequired ) break ; FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; Constant fieldConstant = codegenField . constant ( ) ; if ( fieldConstant == Constant . NotAConstant ) { if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { TypeBinding someReceiverType = this . delegateThis != null ? this . delegateThis . type : this . actualReceiverType ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenField , someReceiverType , true ) ; if ( codegenField . isStatic ( ) ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenField , constantPoolDeclaringClass ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenField , constantPoolDeclaringClass ) ; } } else { if ( ! codegenField . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } else { codeStream . aconst_null ( ) ; } codeStream . generateEmulatedReadAccessForField ( codegenField ) ; } if ( this . genericCast != null ) codeStream . checkcast ( this . genericCast ) ; codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } break ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; if ( localBinding . resolvedPosition == - <NUM_LIT:1> ) { if ( valueRequired ) { localBinding . useFlag = LocalVariableBinding . USED ; throw new AbortMethod ( CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE , null ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } if ( ! valueRequired ) break ; if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { VariableBinding [ ] path = currentScope . getEmulationPath ( localBinding ) ; codeStream . generateOuterAccess ( path , this , localBinding , currentScope ) ; } else { codeStream . load ( localBinding ) ; } codeStream . generateImplicitConversion ( this . implicitConversion ) ; break ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , MethodBinding writeAccessor , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . isStatic ( ) ) { if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { TypeBinding someReceiverType = this . delegateThis != null ? this . delegateThis . type : this . actualReceiverType ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenField , someReceiverType , true ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenField , constantPoolDeclaringClass ) ; } else { codeStream . generateEmulationForField ( codegenField ) ; codeStream . aconst_null ( ) ; codeStream . aconst_null ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenField ) ; } } else { if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } codeStream . dup ( ) ; TypeBinding someReceiverType = this . delegateThis != null ? this . delegateThis . type : this . actualReceiverType ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenField , someReceiverType , true ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenField , constantPoolDeclaringClass ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } codeStream . generateEmulationForField ( codegenField ) ; generateReceiver ( codeStream ) ; codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenField ) ; } } break ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; Constant assignConstant ; switch ( localBinding . type . id ) { case T_JavaLangString : codeStream . generateStringConcatenationAppend ( currentScope , this , expression ) ; if ( valueRequired ) { codeStream . dup ( ) ; } codeStream . store ( localBinding , false ) ; return ; case T_int : assignConstant = expression . constant ; if ( localBinding . resolvedPosition == - <NUM_LIT:1> ) { if ( valueRequired ) { localBinding . useFlag = LocalVariableBinding . USED ; throw new AbortMethod ( CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE , null ) ; } else if ( assignConstant == Constant . NotAConstant ) { expression . generateCode ( currentScope , codeStream , false ) ; } return ; } if ( ( assignConstant != Constant . NotAConstant ) && ( assignConstant . typeID ( ) != TypeIds . T_float ) && ( assignConstant . typeID ( ) != TypeIds . T_double ) ) { switch ( operator ) { case PLUS : int increment = assignConstant . intValue ( ) ; if ( increment != ( short ) increment ) break ; codeStream . iinc ( localBinding . resolvedPosition , increment ) ; if ( valueRequired ) { codeStream . load ( localBinding ) ; } return ; case MINUS : increment = - assignConstant . intValue ( ) ; if ( increment != ( short ) increment ) break ; codeStream . iinc ( localBinding . resolvedPosition , increment ) ; if ( valueRequired ) { codeStream . load ( localBinding ) ; } return ; } } default : if ( localBinding . resolvedPosition == - <NUM_LIT:1> ) { assignConstant = expression . constant ; if ( valueRequired ) { localBinding . useFlag = LocalVariableBinding . USED ; throw new AbortMethod ( CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE , null ) ; } else if ( assignConstant == Constant . NotAConstant ) { expression . generateCode ( currentScope , codeStream , false ) ; } return ; } codeStream . load ( localBinding ) ; } } int operationTypeID ; switch ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_JavaLangString : case T_JavaLangObject : case T_undefined : codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; break ; default : codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { fieldStore ( currentScope , codeStream , codegenField , writeAccessor , this . actualReceiverType , this . delegateThis == null , valueRequired ) ; } else { if ( valueRequired ) { switch ( codegenField . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( codegenField ) ; } return ; case Binding . LOCAL : LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; if ( valueRequired ) { switch ( localBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } codeStream . store ( localBinding , false ) ; } } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : FieldBinding codegenField = ( ( FieldBinding ) this . binding ) . original ( ) ; if ( codegenField . canBeSeenBy ( getReceiverType ( currentScope ) , this , currentScope ) ) { super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; } else { if ( codegenField . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } codeStream . generateEmulatedReadAccessForField ( codegenField ) ; if ( valueRequired ) { switch ( codegenField . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } codeStream . generateEmulationForField ( codegenField ) ; switch ( codegenField . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; if ( codegenField . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReceiver ( codeStream ) ; } codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; break ; default : codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; if ( codegenField . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReceiver ( codeStream ) ; } codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; break ; } codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , codegenField . type . id ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; codeStream . generateEmulatedWriteAccessForField ( codegenField ) ; } return ; case Binding . LOCAL : super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; } } public void generateReceiver ( CodeStream codeStream ) { codeStream . aload_0 ( ) ; if ( this . delegateThis != null ) { codeStream . fieldAccess ( Opcodes . OPC_getfield , this . delegateThis , null ) ; } } public TypeBinding getReceiverType ( BlockScope currentScope ) { Scope scope = currentScope . parent ; while ( true ) { switch ( scope . kind ) { case Scope . CLASS_SCOPE : return ( ( ClassScope ) scope ) . referenceContext . binding ; default : scope = scope . parent ; } } } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo , boolean isReadAccess ) { if ( this . delegateThis == null ) { super . manageSyntheticAccessIfNecessary ( currentScope , flowInfo , isReadAccess ) ; return ; } if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return ; if ( this . constant != Constant . NotAConstant ) return ; if ( this . binding instanceof ParameterizedFieldBinding ) { ParameterizedFieldBinding parameterizedField = ( ParameterizedFieldBinding ) this . binding ; FieldBinding codegenField = parameterizedField . originalField ; if ( ( codegenField . type . tagBits & TagBits . HasTypeVariable ) != <NUM_LIT:0> ) { this . genericCast = codegenField . type . genericCast ( currentScope . boxing ( parameterizedField . type ) ) ; } } } public TypeBinding reportError ( BlockScope scope ) { this . constant = Constant . NotAConstant ; if ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotFound ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis != null ) { this . actualReceiverType = this . delegateThis . type ; this . binding = scope . getField ( this . delegateThis . type , this . token , this ) ; if ( ! this . binding . isValidBinding ( ) ) { return super . reportError ( scope ) ; } return checkFieldAccess ( scope ) ; } } } if ( this . binding instanceof ProblemBinding && ( ( ProblemBinding ) this . binding ) . problemId ( ) == NotFound ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis != null ) { this . actualReceiverType = this . delegateThis . type ; FieldBinding fieldBinding = scope . getField ( this . delegateThis . type , this . token , this ) ; if ( ! fieldBinding . isValidBinding ( ) ) { if ( ( ( ProblemFieldBinding ) fieldBinding ) . problemId ( ) == NotVisible ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . binding = localScope . getFieldForCodeSnippet ( this . delegateThis . type , this . token , this ) ; return checkFieldAccess ( scope ) ; } else { return super . reportError ( scope ) ; } } this . binding = fieldBinding ; return checkFieldAccess ( scope ) ; } } } return super . reportError ( scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrameCodeStream ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CodeSnippetClassFile extends ClassFile { public CodeSnippetClassFile ( org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding aType , org . eclipse . jdt . internal . compiler . ClassFile enclosingClassFile , boolean creatingProblemType ) { this . referenceBinding = aType ; initByteArrays ( ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:24> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:16> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:8> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:0> ) ; long targetVersion = this . targetJDK = this . referenceBinding . scope . compilerOptions ( ) . targetJDK ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:8> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:0> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:24> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:16> ) ; this . constantPoolOffset = this . headerOffset ; this . headerOffset += <NUM_LIT:2> ; this . constantPool = new ConstantPool ( this ) ; int accessFlags = aType . getAccessFlags ( ) ; if ( ! aType . isInterface ( ) ) { accessFlags |= ClassFileConstants . AccSuper ; } if ( aType . isNestedType ( ) ) { if ( aType . isStatic ( ) ) { accessFlags &= ~ ClassFileConstants . AccStatic ; } if ( aType . isPrivate ( ) ) { accessFlags &= ~ ( ClassFileConstants . AccPrivate | ClassFileConstants . AccPublic ) ; } if ( aType . isProtected ( ) ) { accessFlags &= ~ ClassFileConstants . AccProtected ; accessFlags |= ClassFileConstants . AccPublic ; } } accessFlags &= ~ ClassFileConstants . AccStrictfp ; this . enclosingClassFile = enclosingClassFile ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( accessFlags > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) accessFlags ; int classNameIndex = this . constantPool . literalIndexForType ( aType ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( classNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) classNameIndex ; int superclassNameIndex ; if ( aType . isInterface ( ) ) { superclassNameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangObjectConstantPoolName ) ; } else { superclassNameIndex = ( aType . superclass == null ? <NUM_LIT:0> : this . constantPool . literalIndexForType ( aType . superclass ) ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( superclassNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) superclassNameIndex ; ReferenceBinding [ ] superInterfacesBinding = aType . superInterfaces ( ) ; int interfacesCount = superInterfacesBinding . length ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( interfacesCount > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) interfacesCount ; for ( int i = <NUM_LIT:0> ; i < interfacesCount ; i ++ ) { int interfaceIndex = this . constantPool . literalIndexForType ( superInterfacesBinding [ i ] ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( interfaceIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) interfaceIndex ; } this . produceAttributes = this . referenceBinding . scope . compilerOptions ( ) . produceDebugAttributes ; this . creatingProblemType = creatingProblemType ; if ( this . targetJDK >= ClassFileConstants . JDK1_6 ) { this . codeStream = new StackMapFrameCodeStream ( this ) ; this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP_TABLE ; } else if ( this . targetJDK == ClassFileConstants . CLDC_1_1 ) { this . targetJDK = ClassFileConstants . JDK1_1 ; this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP ; this . codeStream = new StackMapFrameCodeStream ( this ) ; } else { this . codeStream = new CodeStream ( this ) ; } this . codeStream . maxFieldCount = aType . scope . outerMostClassScope ( ) . referenceType ( ) . maxFieldCount ; } public static void createProblemType ( TypeDeclaration typeDeclaration , CompilationResult unitResult ) { SourceTypeBinding typeBinding = typeDeclaration . binding ; ClassFile classFile = new CodeSnippetClassFile ( typeBinding , null , true ) ; if ( typeBinding . hasMemberTypes ( ) ) { ReferenceBinding [ ] members = typeBinding . memberTypes ; for ( int i = <NUM_LIT:0> , l = members . length ; i < l ; i ++ ) classFile . recordInnerClasses ( members [ i ] ) ; } if ( typeBinding . isNestedType ( ) ) { classFile . recordInnerClasses ( typeBinding ) ; } TypeVariableBinding [ ] typeVariables = typeBinding . typeVariables ( ) ; for ( int i = <NUM_LIT:0> , max = typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariables [ i ] ; if ( ( typeVariableBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , typeVariableBinding ) ; } } FieldBinding [ ] fields = typeBinding . fields ( ) ; if ( ( fields != null ) && ( fields != Binding . NO_FIELDS ) ) { classFile . addFieldInfos ( ) ; } else { classFile . contents [ classFile . contentsOffset ++ ] = <NUM_LIT:0> ; classFile . contents [ classFile . contentsOffset ++ ] = <NUM_LIT:0> ; } classFile . setForMethodInfos ( ) ; int problemsLength ; CategorizedProblem [ ] problems = unitResult . getErrors ( ) ; if ( problems == null ) { problems = new CategorizedProblem [ <NUM_LIT:0> ] ; } CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; AbstractMethodDeclaration [ ] methodDecls = typeDeclaration . methods ; if ( methodDecls != null ) { if ( typeBinding . isInterface ( ) ) { classFile . addProblemClinit ( problemsCopy ) ; for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { AbstractMethodDeclaration methodDecl = methodDecls [ i ] ; MethodBinding method = methodDecl . binding ; if ( method == null || method . isConstructor ( ) ) continue ; method . modifiers = ClassFileConstants . AccPublic | ClassFileConstants . AccAbstract ; classFile . addAbstractMethod ( methodDecl , method ) ; } } else { for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { AbstractMethodDeclaration methodDecl = methodDecls [ i ] ; MethodBinding method = methodDecl . binding ; if ( method == null ) continue ; if ( method . isConstructor ( ) ) { classFile . addProblemConstructor ( methodDecl , method , problemsCopy ) ; } else if ( method . isAbstract ( ) ) { classFile . addAbstractMethod ( methodDecl , method ) ; } else { classFile . addProblemMethod ( methodDecl , method , problemsCopy ) ; } } } classFile . addDefaultAbstractMethods ( ) ; } if ( typeDeclaration . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = typeDeclaration . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = typeDeclaration . memberTypes [ i ] ; if ( memberType . binding != null ) { ClassFile . createProblemType ( memberType , unitResult ) ; } } } classFile . addAttributes ( ) ; unitResult . record ( typeBinding . constantPoolName ( ) , classFile ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . CompletionContext ; import org . eclipse . jdt . core . CompletionProposal ; import org . eclipse . jdt . core . CompletionRequestor ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . codeassist . ISelectionRequestor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; class CodeSnippetToCuMapper implements EvaluationConstants { public char [ ] cuSource ; public int lineNumberOffset = <NUM_LIT:0> ; public int startPosOffset = <NUM_LIT:0> ; char [ ] codeSnippet ; char [ ] snippetPackageName ; char [ ] [ ] snippetImports ; char [ ] snippetClassName ; char [ ] snippetVarClassName ; char [ ] snippetDeclaringTypeName ; char [ ] [ ] localVarNames ; char [ ] [ ] localVarTypeNames ; long complianceVersion ; public CodeSnippetToCuMapper ( char [ ] codeSnippet , char [ ] packageName , char [ ] [ ] imports , char [ ] className , char [ ] varClassName , char [ ] [ ] localVarNames , char [ ] [ ] localVarTypeNames , int [ ] localVarModifiers , char [ ] declaringTypeName , String lineSeparator , long complianceVersion ) { this . codeSnippet = codeSnippet ; this . snippetPackageName = packageName ; this . snippetImports = imports ; this . snippetClassName = className ; this . snippetVarClassName = varClassName ; this . localVarNames = localVarNames ; this . localVarTypeNames = localVarTypeNames ; this . snippetDeclaringTypeName = declaringTypeName ; this . complianceVersion = complianceVersion ; buildCUSource ( lineSeparator ) ; } private void buildCUSource ( String lineSeparator ) { StringBuffer buffer = new StringBuffer ( ) ; if ( this . snippetPackageName != null && this . snippetPackageName . length != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . snippetPackageName ) ; buffer . append ( "<STR_LIT:;>" ) . append ( lineSeparator ) ; this . lineNumberOffset ++ ; } char [ ] [ ] imports = this . snippetImports ; for ( int i = <NUM_LIT:0> ; i < imports . length ; i ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( imports [ i ] ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( lineSeparator ) ; this . lineNumberOffset ++ ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . snippetClassName ) ; if ( this . snippetVarClassName != null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . snippetVarClassName ) ; } else { buffer . append ( "<STR_LIT>" ) ; buffer . append ( PACKAGE_NAME ) ; buffer . append ( "<STR_LIT:.>" ) ; buffer . append ( ROOT_CLASS_NAME ) ; } buffer . append ( "<STR_LIT>" ) . append ( lineSeparator ) ; this . lineNumberOffset ++ ; if ( this . snippetDeclaringTypeName != null ) { buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; buffer . append ( this . snippetDeclaringTypeName ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; buffer . append ( DELEGATE_THIS ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( lineSeparator ) ; this . lineNumberOffset ++ ; } if ( this . localVarNames != null ) { for ( int i = <NUM_LIT:0> , max = this . localVarNames . length ; i < max ; i ++ ) { buffer . append ( "<STR_LIT:U+0020U+0020U+0020U+0020>" ) ; buffer . append ( this . localVarTypeNames [ i ] ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; buffer . append ( LOCAL_VAR_PREFIX ) ; buffer . append ( this . localVarNames [ i ] ) ; buffer . append ( '<CHAR_LIT:;>' ) . append ( lineSeparator ) ; this . lineNumberOffset ++ ; } } if ( this . complianceVersion >= ClassFileConstants . JDK1_5 ) { buffer . append ( "<STR_LIT>" ) ; } buffer . append ( "<STR_LIT>" ) . append ( lineSeparator ) ; this . lineNumberOffset ++ ; this . startPosOffset = buffer . length ( ) ; buffer . append ( this . codeSnippet ) ; buffer . append ( lineSeparator ) . append ( '<CHAR_LIT:}>' ) . append ( lineSeparator ) ; buffer . append ( '<CHAR_LIT:}>' ) . append ( lineSeparator ) ; int length = buffer . length ( ) ; this . cuSource = new char [ length ] ; buffer . getChars ( <NUM_LIT:0> , length , this . cuSource , <NUM_LIT:0> ) ; } public CompletionRequestor getCompletionRequestor ( final CompletionRequestor originalRequestor ) { return new CompletionRequestor ( ) { public void accept ( CompletionProposal proposal ) { switch ( proposal . getKind ( ) ) { case CompletionProposal . TYPE_REF : int flags = proposal . getFlags ( ) ; if ( ( flags & Flags . AccEnum ) == <NUM_LIT:0> && ( flags & Flags . AccInterface ) == <NUM_LIT:0> ) { char [ ] packageName = proposal . getDeclarationSignature ( ) ; char [ ] className = Signature . getSignatureSimpleName ( proposal . getSignature ( ) ) ; if ( CharOperation . equals ( packageName , CodeSnippetToCuMapper . this . snippetPackageName ) && ( CharOperation . equals ( className , CodeSnippetToCuMapper . this . snippetClassName ) || CharOperation . equals ( className , CodeSnippetToCuMapper . this . snippetVarClassName ) ) ) return ; if ( CharOperation . equals ( packageName , PACKAGE_NAME ) && CharOperation . equals ( className , ROOT_CLASS_NAME ) ) return ; } break ; case CompletionProposal . METHOD_REF : case CompletionProposal . METHOD_DECLARATION : case CompletionProposal . METHOD_REF_WITH_CASTED_RECEIVER : char [ ] declaringTypePackageName = Signature . getSignatureQualifier ( proposal . getDeclarationSignature ( ) ) ; char [ ] declaringTypeName = Signature . getSignatureSimpleName ( proposal . getDeclarationSignature ( ) ) ; if ( CharOperation . equals ( declaringTypePackageName , CodeSnippetToCuMapper . this . snippetPackageName ) && CharOperation . equals ( declaringTypeName , CodeSnippetToCuMapper . this . snippetClassName ) ) return ; if ( CharOperation . equals ( declaringTypePackageName , PACKAGE_NAME ) && CharOperation . equals ( declaringTypeName , ROOT_CLASS_NAME ) ) return ; break ; } originalRequestor . accept ( proposal ) ; } public void completionFailure ( IProblem problem ) { problem . setSourceStart ( problem . getSourceStart ( ) - CodeSnippetToCuMapper . this . startPosOffset ) ; problem . setSourceEnd ( problem . getSourceEnd ( ) - CodeSnippetToCuMapper . this . startPosOffset ) ; problem . setSourceLineNumber ( problem . getSourceLineNumber ( ) - CodeSnippetToCuMapper . this . lineNumberOffset ) ; originalRequestor . completionFailure ( problem ) ; } public void acceptContext ( CompletionContext context ) { originalRequestor . acceptContext ( context ) ; } public void beginReporting ( ) { originalRequestor . beginReporting ( ) ; } public void endReporting ( ) { originalRequestor . endReporting ( ) ; } public boolean isIgnored ( int completionProposalKind ) { return originalRequestor . isIgnored ( completionProposalKind ) ; } public void setIgnored ( int completionProposalKind , boolean ignore ) { originalRequestor . setIgnored ( completionProposalKind , ignore ) ; } public boolean isAllowingRequiredProposals ( int mainKind , int requiredKind ) { return originalRequestor . isAllowingRequiredProposals ( mainKind , requiredKind ) ; } public void setAllowsRequiredProposals ( int mainKind , int requiredKind , boolean allow ) { originalRequestor . setAllowsRequiredProposals ( mainKind , requiredKind , allow ) ; } } ; } public char [ ] getCUSource ( String lineSeparator ) { if ( this . cuSource == null ) { buildCUSource ( lineSeparator ) ; } return this . cuSource ; } public int getEvaluationType ( int lineNumber ) { int currentLine = <NUM_LIT:1> ; if ( this . snippetPackageName != null && this . snippetPackageName . length != <NUM_LIT:0> ) { if ( lineNumber == <NUM_LIT:1> ) { return EvaluationResult . T_PACKAGE ; } currentLine ++ ; } char [ ] [ ] imports = this . snippetImports ; if ( ( currentLine <= lineNumber ) && ( lineNumber < ( currentLine + imports . length ) ) ) { return EvaluationResult . T_IMPORT ; } currentLine += imports . length + <NUM_LIT:1> ; currentLine += ( this . snippetDeclaringTypeName == null ? <NUM_LIT:0> : <NUM_LIT:1> ) + ( this . localVarNames == null ? <NUM_LIT:0> : this . localVarNames . length ) ; if ( currentLine > lineNumber ) { return EvaluationResult . T_INTERNAL ; } currentLine ++ ; if ( currentLine >= this . lineNumberOffset ) { return EvaluationResult . T_CODE_SNIPPET ; } return EvaluationResult . T_INTERNAL ; } public char [ ] getImport ( int lineNumber ) { int importStartLine = this . lineNumberOffset - <NUM_LIT:1> - this . snippetImports . length ; return this . snippetImports [ lineNumber - importStartLine ] ; } public ISelectionRequestor getSelectionRequestor ( final ISelectionRequestor originalRequestor ) { return new ISelectionRequestor ( ) { public void acceptType ( char [ ] packageName , char [ ] typeName , int modifiers , boolean isDeclaration , char [ ] uniqueKey , int start , int end ) { originalRequestor . acceptType ( packageName , typeName , modifiers , isDeclaration , uniqueKey , start , end ) ; } public void acceptError ( CategorizedProblem error ) { error . setSourceLineNumber ( error . getSourceLineNumber ( ) - CodeSnippetToCuMapper . this . lineNumberOffset ) ; error . setSourceStart ( error . getSourceStart ( ) - CodeSnippetToCuMapper . this . startPosOffset ) ; error . setSourceEnd ( error . getSourceEnd ( ) - CodeSnippetToCuMapper . this . startPosOffset ) ; originalRequestor . acceptError ( error ) ; } public void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , boolean isDeclaration , char [ ] uniqueKey , int start , int end ) { originalRequestor . acceptField ( declaringTypePackageName , declaringTypeName , name , isDeclaration , uniqueKey , start , end ) ; } public void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , String enclosingDeclaringTypeSignature , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , String [ ] parameterSignatures , char [ ] [ ] typeParameterNames , char [ ] [ ] [ ] typeParameterBoundNames , boolean isConstructor , boolean isDeclaration , char [ ] uniqueKey , int start , int end ) { originalRequestor . acceptMethod ( declaringTypePackageName , declaringTypeName , enclosingDeclaringTypeSignature , selector , parameterPackageNames , parameterTypeNames , parameterSignatures , typeParameterNames , typeParameterBoundNames , isConstructor , isDeclaration , uniqueKey , start , end ) ; } public void acceptPackage ( char [ ] packageName ) { originalRequestor . acceptPackage ( packageName ) ; } public void acceptTypeParameter ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] typeParameterName , boolean isDeclaration , int start , int end ) { originalRequestor . acceptTypeParameter ( declaringTypePackageName , declaringTypeName , typeParameterName , isDeclaration , start , end ) ; } public void acceptMethodTypeParameter ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , int selectorStart , int selectorEnd , char [ ] typeParameterName , boolean isDeclaration , int start , int end ) { originalRequestor . acceptMethodTypeParameter ( declaringTypePackageName , declaringTypeName , selector , selectorStart , selectorEnd , typeParameterName , isDeclaration , start , end ) ; } } ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; public interface EvaluationConstants { public static final char [ ] CODE_SNIPPET_CLASS_NAME_PREFIX = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] GLOBAL_VARS_CLASS_NAME_PREFIX = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] PACKAGE_NAME = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] CODE_SNIPPET_NAME = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] ROOT_CLASS_NAME = "<STR_LIT>" . toCharArray ( ) ; public static final String ROOT_FULL_CLASS_NAME = new String ( PACKAGE_NAME ) + "<STR_LIT:.>" + new String ( ROOT_CLASS_NAME ) ; public static final char [ ] SETRESULT_SELECTOR = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] SETRESULT_ARGUMENTS = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] [ ] ROOT_COMPOUND_NAME = CharOperation . arrayConcat ( CharOperation . splitOn ( '<CHAR_LIT:.>' , PACKAGE_NAME ) , ROOT_CLASS_NAME ) ; public static final String RUN_METHOD = "<STR_LIT>" ; public static final String RESULT_VALUE_FIELD = "<STR_LIT>" ; public static final String RESULT_TYPE_FIELD = "<STR_LIT>" ; public static final char [ ] LOCAL_VAR_PREFIX = "<STR_LIT>" . toCharArray ( ) ; public static final char [ ] DELEGATE_THIS = "<STR_LIT>" . toCharArray ( ) ; } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . ReturnStatement ; import org . eclipse . jdt . internal . compiler . ast . TryStatement ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class CodeSnippetReturnStatement extends ReturnStatement implements InvocationSite , EvaluationConstants { MethodBinding setResultMethod ; public CodeSnippetReturnStatement ( Expression expr , int s , int e ) { super ( expr , s , e ) ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { FlowInfo info = super . analyseCode ( currentScope , flowContext , flowInfo ) ; this . expression . bits &= ~ IsReturnedValue ; return info ; } public void generateReturnBytecode ( CodeStream codeStream ) { codeStream . return_ ( ) ; } public void generateStoreSaveValueIfNecessary ( CodeStream codeStream ) { codeStream . aload_0 ( ) ; if ( this . expression == null || this . expression . resolvedType == TypeBinding . VOID ) { codeStream . aconst_null ( ) ; codeStream . generateClassLiteralAccessForType ( TypeBinding . VOID , null ) ; } else { int valueTypeID = this . expression . resolvedType . id ; if ( valueTypeID == T_long || valueTypeID == T_double ) { codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; } else { codeStream . swap ( ) ; } if ( this . expression . resolvedType . isBaseType ( ) && this . expression . resolvedType != TypeBinding . NULL ) { codeStream . generateBoxingConversion ( this . expression . resolvedType . id ) ; } codeStream . generateClassLiteralAccessForType ( this . expression . resolvedType , null ) ; } codeStream . invoke ( Opcodes . OPC_invokevirtual , this . setResultMethod , null ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return false ; } public boolean needValue ( ) { return true ; } public void prepareSaveValueLocation ( TryStatement targetTryStatement ) { } public void resolve ( BlockScope scope ) { if ( this . expression != null ) { if ( this . expression . resolveType ( scope ) != null ) { TypeBinding javaLangClass = scope . getJavaLangClass ( ) ; if ( ! javaLangClass . isValidBinding ( ) ) { scope . problemReporter ( ) . codeSnippetMissingClass ( "<STR_LIT>" , this . sourceStart , this . sourceEnd ) ; return ; } TypeBinding javaLangObject = scope . getJavaLangObject ( ) ; if ( ! javaLangObject . isValidBinding ( ) ) { scope . problemReporter ( ) . codeSnippetMissingClass ( "<STR_LIT>" , this . sourceStart , this . sourceEnd ) ; return ; } TypeBinding [ ] argumentTypes = new TypeBinding [ ] { javaLangObject , javaLangClass } ; this . setResultMethod = scope . getImplicitMethod ( SETRESULT_SELECTOR , argumentTypes , this ) ; if ( ! this . setResultMethod . isValidBinding ( ) ) { scope . problemReporter ( ) . codeSnippetMissingMethod ( ROOT_FULL_CLASS_NAME , new String ( SETRESULT_SELECTOR ) , new String ( SETRESULT_ARGUMENTS ) , this . sourceStart , this . sourceEnd ) ; return ; } if ( this . expression . constant != Constant . NotAConstant ) { this . expression . implicitConversion = this . expression . constant . typeID ( ) << <NUM_LIT:4> ; } } } } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int depth ) { } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ClassFile ; public class VariablesInfo { GlobalVariable [ ] variables ; int variableCount ; char [ ] packageName ; char [ ] className ; ClassFile [ ] classFiles ; public VariablesInfo ( char [ ] packageName , char [ ] className , ClassFile [ ] classFiles , GlobalVariable [ ] variables , int variableCount ) { this . packageName = packageName ; this . className = className ; this . classFiles = classFiles ; this . variables = variables ; this . variableCount = variableCount ; } int indexOf ( GlobalVariable var ) { for ( int i = <NUM_LIT:0> ; i < this . variableCount ; i ++ ) { if ( var . equals ( this . variables [ i ] ) ) { return i ; } } return - <NUM_LIT:1> ; } GlobalVariable varNamed ( char [ ] name ) { GlobalVariable [ ] vars = this . variables ; for ( int i = <NUM_LIT:0> ; i < this . variableCount ; i ++ ) { GlobalVariable var = vars [ i ] ; if ( CharOperation . equals ( name , var . name ) ) { return var ; } } return null ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; public class CodeSnippetEnvironment implements INameEnvironment , EvaluationConstants { INameEnvironment env ; EvaluationContext context ; public CodeSnippetEnvironment ( INameEnvironment env , EvaluationContext context ) { this . env = env ; this . context = context ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) { NameEnvironmentAnswer result = this . env . findType ( compoundTypeName ) ; if ( result != null ) { return result ; } if ( CharOperation . equals ( compoundTypeName , ROOT_COMPOUND_NAME ) ) { IBinaryType binary = this . context . getRootCodeSnippetBinary ( ) ; if ( binary == null ) { return null ; } else { return new NameEnvironmentAnswer ( binary , null ) ; } } VariablesInfo installedVars = this . context . installedVars ; ClassFile [ ] classFiles = installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; if ( CharOperation . equals ( compoundTypeName , classFile . getCompoundName ( ) ) ) { ClassFileReader binary = null ; try { binary = new ClassFileReader ( classFile . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; return null ; } return new NameEnvironmentAnswer ( binary , null ) ; } } return null ; } public NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) { NameEnvironmentAnswer result = this . env . findType ( typeName , packageName ) ; if ( result != null ) { return result ; } return findType ( CharOperation . arrayConcat ( packageName , typeName ) ) ; } public boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] packageName ) { return this . env . isPackage ( parentPackageName , packageName ) ; } public void cleanup ( ) { this . env . cleanup ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . AllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; public class CodeSnippetAllocationExpression extends AllocationExpression implements ProblemReasons , EvaluationConstants { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetAllocationExpression ( EvaluationContext evaluationContext ) { this . evaluationContext = evaluationContext ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding allocatedType = codegenBinding . declaringClass ; if ( codegenBinding . canBeSeenBy ( allocatedType , this , currentScope ) ) { codeStream . new_ ( allocatedType ) ; if ( valueRequired ) { codeStream . dup ( ) ; } codeStream . recordPositionsFrom ( pc , this . type . sourceStart ) ; if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticEnclosingInstanceValues ( currentScope , allocatedType , enclosingInstance ( ) , this ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { this . arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; } } if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticOuterArgumentValues ( currentScope , allocatedType , this ) ; } codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , null ) ; } else { codeStream . generateEmulationForConstructor ( currentScope , codegenBinding ) ; if ( this . arguments != null ) { int argsLength = this . arguments . length ; codeStream . generateInlinedValue ( argsLength ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; codeStream . dup ( ) ; for ( int i = <NUM_LIT:0> ; i < argsLength ; i ++ ) { codeStream . generateInlinedValue ( i ) ; this . arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; TypeBinding parameterBinding = codegenBinding . parameters [ i ] ; if ( parameterBinding . isBaseType ( ) && parameterBinding != TypeBinding . NULL ) { codeStream . generateBoxingConversion ( codegenBinding . parameters [ i ] . id ) ; } codeStream . aastore ( ) ; if ( i < argsLength - <NUM_LIT:1> ) { codeStream . dup ( ) ; } } } else { codeStream . generateInlinedValue ( <NUM_LIT:0> ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; } codeStream . invokeJavaLangReflectConstructorNewInstance ( ) ; codeStream . checkcast ( allocatedType ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; this . resolvedType = this . type . resolveType ( scope , true ) ; checkParameterizedAllocation : { if ( this . type instanceof ParameterizedQualifiedTypeReference ) { ReferenceBinding currentType = ( ReferenceBinding ) this . resolvedType ; if ( currentType == null ) return currentType ; do { if ( ( currentType . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ) break checkParameterizedAllocation ; if ( currentType . isRawType ( ) ) break checkParameterizedAllocation ; } while ( ( currentType = currentType . enclosingType ( ) ) != null ) ; ParameterizedQualifiedTypeReference qRef = ( ParameterizedQualifiedTypeReference ) this . type ; for ( int i = qRef . typeArguments . length - <NUM_LIT:2> ; i >= <NUM_LIT:0> ; i -- ) { if ( qRef . typeArguments [ i ] != null ) { scope . problemReporter ( ) . illegalQualifiedParameterizedTypeAllocation ( this . type , this . resolvedType ) ; break ; } } } } final boolean isDiamond = this . type != null && ( this . type . bits & ASTNode . IsDiamond ) != <NUM_LIT:0> ; if ( this . typeArguments != null ) { int length = this . typeArguments . length ; boolean argHasError = scope . compilerOptions ( ) . sourceLevel < ClassFileConstants . JDK1_5 ; this . genericTypeArguments = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeReference typeReference = this . typeArguments [ i ] ; if ( ( this . genericTypeArguments [ i ] = typeReference . resolveType ( scope , true ) ) == null ) { argHasError = true ; } if ( argHasError && typeReference instanceof Wildcard ) { scope . problemReporter ( ) . illegalUsageOfWildcard ( typeReference ) ; } } if ( isDiamond ) { scope . problemReporter ( ) . diamondNotWithExplicitTypeArguments ( this . typeArguments ) ; return null ; } if ( argHasError ) { if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { this . arguments [ i ] . resolveType ( scope ) ; } } return null ; } } boolean argsContainCast = false ; TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; if ( this . arguments != null ) { boolean argHasError = false ; int length = this . arguments . length ; argumentTypes = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression argument = this . arguments [ i ] ; if ( argument instanceof CastExpression ) { argument . bits |= DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = argument . resolveType ( scope ) ) == null ) { argHasError = true ; } } if ( argHasError ) { return this . resolvedType ; } } if ( this . resolvedType == null ) { return null ; } if ( ! this . resolvedType . canBeInstantiated ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , this . resolvedType ) ; return this . resolvedType ; } if ( isDiamond ) { TypeBinding [ ] inferredTypes = inferElidedTypes ( ( ( ParameterizedTypeBinding ) this . resolvedType ) . genericType ( ) , null , argumentTypes , scope ) ; if ( inferredTypes == null ) { scope . problemReporter ( ) . cannotInferElidedTypes ( this ) ; return this . resolvedType = null ; } this . resolvedType = this . type . resolvedType = scope . environment ( ) . createParameterizedType ( ( ( ParameterizedTypeBinding ) this . resolvedType ) . genericType ( ) , inferredTypes , ( ( ParameterizedTypeBinding ) this . resolvedType ) . enclosingType ( ) ) ; } ReferenceBinding allocatedType = ( ReferenceBinding ) this . resolvedType ; if ( ! ( this . binding = scope . getConstructor ( allocatedType , argumentTypes , this ) ) . isValidBinding ( ) ) { if ( this . binding instanceof ProblemMethodBinding && ( ( ProblemMethodBinding ) this . binding ) . problemId ( ) == NotVisible ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; MethodBinding privateBinding = localScope . getConstructor ( ( ReferenceBinding ) this . delegateThis . type , argumentTypes , this ) ; if ( ! privateBinding . isValidBinding ( ) ) { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } else { this . binding = privateBinding ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocatedType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType ; } } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) { scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> ; i < this . arguments . length ; i ++ ) { TypeBinding parameterType = this . binding . parameters [ i ] ; TypeBinding argumentType = argumentTypes [ i ] ; this . arguments [ i ] . computeConversion ( scope , parameterType , argumentType ) ; if ( argumentType . needsUncheckedConversion ( parameterType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( this . arguments [ i ] , argumentType , parameterType ) ; } } if ( argsContainCast ) { CastExpression . checkNeedForArgumentCasts ( scope , null , allocatedType , this . binding , this . arguments , argumentTypes , this ) ; } } if ( allocatedType . isRawType ( ) && this . binding . hasSubstitutedParameters ( ) ) { scope . problemReporter ( ) . unsafeRawInvocation ( this , this . binding ) ; } if ( this . typeArguments != null && this . binding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( this . binding , this . genericTypeArguments , this . typeArguments ) ; } return allocatedType ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; public class CodeSnippetParser extends Parser implements EvaluationConstants { int codeSnippetStart , codeSnippetEnd ; EvaluationContext evaluationContext ; boolean hasRecoveredOnExpression ; int lastStatement = - <NUM_LIT:1> ; int lineSeparatorLength ; int problemCountBeforeRecovery = <NUM_LIT:0> ; public CodeSnippetParser ( ProblemReporter problemReporter , EvaluationContext evaluationContext , boolean optimizeStringLiterals , int codeSnippetStart , int codeSnippetEnd ) { super ( problemReporter , optimizeStringLiterals ) ; this . codeSnippetStart = codeSnippetStart ; this . codeSnippetEnd = codeSnippetEnd ; this . evaluationContext = evaluationContext ; this . reportOnlyOneSyntaxError = true ; this . javadocParser . checkDocComment = false ; } protected void classInstanceCreation ( boolean alwaysQualified ) { AllocationExpression alloc ; int length ; if ( ( ( length = this . astLengthStack [ this . astLengthPtr -- ] ) == <NUM_LIT:1> ) && ( this . astStack [ this . astPtr ] == null ) ) { this . astPtr -- ; if ( alwaysQualified ) { alloc = new QualifiedAllocationExpression ( ) ; } else { alloc = new CodeSnippetAllocationExpression ( this . evaluationContext ) ; } alloc . sourceEnd = this . endPosition ; if ( ( length = this . expressionLengthStack [ this . expressionLengthPtr -- ] ) != <NUM_LIT:0> ) { this . expressionPtr -= length ; System . arraycopy ( this . expressionStack , this . expressionPtr + <NUM_LIT:1> , alloc . arguments = new Expression [ length ] , <NUM_LIT:0> , length ) ; } alloc . type = getTypeReference ( <NUM_LIT:0> ) ; checkForDiamond ( alloc . type ) ; alloc . sourceStart = this . intStack [ this . intPtr -- ] ; pushOnExpressionStack ( alloc ) ; } else { dispatchDeclarationInto ( length ) ; TypeDeclaration anonymousTypeDeclaration = ( TypeDeclaration ) this . astStack [ this . astPtr ] ; anonymousTypeDeclaration . declarationSourceEnd = this . endStatementPosition ; if ( anonymousTypeDeclaration . allocation != null ) { anonymousTypeDeclaration . allocation . sourceEnd = this . endStatementPosition ; } this . astPtr -- ; this . astLengthPtr -- ; } } protected void consumeClassInstanceCreationExpressionWithTypeArguments ( ) { AllocationExpression alloc ; int length ; if ( ( ( length = this . astLengthStack [ this . astLengthPtr -- ] ) == <NUM_LIT:1> ) && ( this . astStack [ this . astPtr ] == null ) ) { this . astPtr -- ; alloc = new CodeSnippetAllocationExpression ( this . evaluationContext ) ; alloc . sourceEnd = this . endPosition ; if ( ( length = this . expressionLengthStack [ this . expressionLengthPtr -- ] ) != <NUM_LIT:0> ) { this . expressionPtr -= length ; System . arraycopy ( this . expressionStack , this . expressionPtr + <NUM_LIT:1> , alloc . arguments = new Expression [ length ] , <NUM_LIT:0> , length ) ; } alloc . type = getTypeReference ( <NUM_LIT:0> ) ; length = this . genericsLengthStack [ this . genericsLengthPtr -- ] ; this . genericsPtr -= length ; System . arraycopy ( this . genericsStack , this . genericsPtr + <NUM_LIT:1> , alloc . typeArguments = new TypeReference [ length ] , <NUM_LIT:0> , length ) ; this . intPtr -- ; alloc . sourceStart = this . intStack [ this . intPtr -- ] ; pushOnExpressionStack ( alloc ) ; } else { dispatchDeclarationInto ( length ) ; TypeDeclaration anonymousTypeDeclaration = ( TypeDeclaration ) this . astStack [ this . astPtr ] ; anonymousTypeDeclaration . declarationSourceEnd = this . endStatementPosition ; anonymousTypeDeclaration . bodyEnd = this . endStatementPosition ; if ( length == <NUM_LIT:0> && ! containsComment ( anonymousTypeDeclaration . bodyStart , anonymousTypeDeclaration . bodyEnd ) ) { anonymousTypeDeclaration . bits |= ASTNode . UndocumentedEmptyBlock ; } this . astPtr -- ; this . astLengthPtr -- ; QualifiedAllocationExpression allocationExpression = anonymousTypeDeclaration . allocation ; if ( allocationExpression != null ) { allocationExpression . sourceEnd = this . endStatementPosition ; length = this . genericsLengthStack [ this . genericsLengthPtr -- ] ; this . genericsPtr -= length ; System . arraycopy ( this . genericsStack , this . genericsPtr + <NUM_LIT:1> , allocationExpression . typeArguments = new TypeReference [ length ] , <NUM_LIT:0> , length ) ; allocationExpression . sourceStart = this . intStack [ this . intPtr -- ] ; } } } protected void consumeClassDeclaration ( ) { super . consumeClassDeclaration ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeClassHeaderName1 ( ) { TypeDeclaration typeDecl ; if ( this . nestedMethod [ this . nestedType ] == <NUM_LIT:0> ) { if ( this . nestedType != <NUM_LIT:0> ) { typeDecl = new TypeDeclaration ( this . compilationUnit . compilationResult ) ; typeDecl . bits |= ASTNode . IsMemberType ; } else { typeDecl = new CodeSnippetTypeDeclaration ( this . compilationUnit . compilationResult ) ; } } else { typeDecl = new TypeDeclaration ( this . compilationUnit . compilationResult ) ; typeDecl . bits |= ASTNode . IsLocalType ; markEnclosingMemberWithLocalType ( ) ; blockReal ( ) ; } long pos = this . identifierPositionStack [ this . identifierPtr ] ; typeDecl . sourceEnd = ( int ) pos ; typeDecl . sourceStart = ( int ) ( pos > > > <NUM_LIT:32> ) ; typeDecl . name = this . identifierStack [ this . identifierPtr -- ] ; this . identifierLengthPtr -- ; typeDecl . declarationSourceStart = this . intStack [ this . intPtr -- ] ; this . intPtr -- ; typeDecl . modifiersSourceStart = this . intStack [ this . intPtr -- ] ; typeDecl . modifiers = this . intStack [ this . intPtr -- ] ; if ( typeDecl . modifiersSourceStart >= <NUM_LIT:0> ) { typeDecl . declarationSourceStart = typeDecl . modifiersSourceStart ; } typeDecl . bodyStart = typeDecl . sourceEnd + <NUM_LIT:1> ; pushOnAstStack ( typeDecl ) ; this . listLength = <NUM_LIT:0> ; if ( this . currentElement != null ) { this . lastCheckPoint = typeDecl . bodyStart ; this . currentElement = this . currentElement . add ( typeDecl , <NUM_LIT:0> ) ; this . lastIgnoredToken = - <NUM_LIT:1> ; } typeDecl . javadoc = this . javadoc ; this . javadoc = null ; } protected void consumeEmptyStatement ( ) { super . consumeEmptyStatement ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeEnhancedForStatement ( ) { super . consumeEnhancedForStatement ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeExpressionStatement ( ) { super . consumeExpressionStatement ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeFieldAccess ( boolean isSuperAccess ) { FieldReference fr = new CodeSnippetFieldReference ( this . identifierStack [ this . identifierPtr ] , this . identifierPositionStack [ this . identifierPtr -- ] , this . evaluationContext ) ; this . identifierLengthPtr -- ; if ( isSuperAccess ) { fr . sourceStart = this . intStack [ this . intPtr -- ] ; problemReporter ( ) . codeSnippetMissingClass ( null , <NUM_LIT:0> , <NUM_LIT:0> ) ; fr . receiver = new CodeSnippetSuperReference ( fr . sourceStart , this . endPosition ) ; pushOnExpressionStack ( fr ) ; } else { if ( ( fr . receiver = this . expressionStack [ this . expressionPtr ] ) . isThis ( ) ) { fr . sourceStart = fr . receiver . sourceStart ; } this . expressionStack [ this . expressionPtr ] = fr ; } } protected void consumeInternalCompilationUnit ( ) { } protected void consumeInternalCompilationUnitWithTypes ( ) { int length ; if ( ( length = this . astLengthStack [ this . astLengthPtr -- ] ) != <NUM_LIT:0> ) { this . compilationUnit . types = new TypeDeclaration [ length ] ; this . astPtr -= length ; System . arraycopy ( this . astStack , this . astPtr + <NUM_LIT:1> , this . compilationUnit . types , <NUM_LIT:0> , length ) ; } } protected void consumeLocalVariableDeclarationStatement ( ) { super . consumeLocalVariableDeclarationStatement ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeMethodDeclaration ( boolean isNotAbstract ) { super . consumeMethodDeclaration ( isNotAbstract ) ; MethodDeclaration methodDecl = ( MethodDeclaration ) this . astStack [ this . astPtr ] ; if ( isTopLevelType ( ) ) { int last = methodDecl . statements == null ? - <NUM_LIT:1> : methodDecl . statements . length - <NUM_LIT:1> ; if ( last >= <NUM_LIT:0> && methodDecl . statements [ last ] instanceof Expression ) { Expression lastExpression = ( Expression ) methodDecl . statements [ last ] ; methodDecl . statements [ last ] = new CodeSnippetReturnStatement ( lastExpression , lastExpression . sourceStart , lastExpression . sourceEnd ) ; } } int start = methodDecl . bodyStart - <NUM_LIT:1> , end = start ; long position = ( ( long ) start << <NUM_LIT:32> ) + end ; long [ ] positions = new long [ ] { position } ; if ( this . evaluationContext . localVariableNames != null ) { int varCount = this . evaluationContext . localVariableNames . length ; Statement [ ] newStatements = new Statement [ varCount + <NUM_LIT:1> ] ; for ( int i = <NUM_LIT:0> ; i < varCount ; i ++ ) { char [ ] trimmedTypeName = this . evaluationContext . localVariableTypeNames [ i ] ; int nameEnd = CharOperation . indexOf ( '<CHAR_LIT:[>' , trimmedTypeName ) ; if ( nameEnd >= <NUM_LIT:0> ) { trimmedTypeName = CharOperation . subarray ( trimmedTypeName , <NUM_LIT:0> , nameEnd ) ; } nameEnd = CharOperation . indexOf ( '<CHAR_LIT:U+0020>' , trimmedTypeName ) ; if ( nameEnd >= <NUM_LIT:0> ) { trimmedTypeName = CharOperation . subarray ( trimmedTypeName , <NUM_LIT:0> , nameEnd ) ; } TypeReference typeReference ; if ( CharOperation . indexOf ( '<CHAR_LIT:.>' , trimmedTypeName ) == - <NUM_LIT:1> ) { typeReference = new SingleTypeReference ( trimmedTypeName , position ) ; } else { typeReference = new QualifiedTypeReference ( CharOperation . splitOn ( '<CHAR_LIT:.>' , trimmedTypeName ) , positions ) ; } int dimCount = CharOperation . occurencesOf ( '<CHAR_LIT:[>' , this . evaluationContext . localVariableTypeNames [ i ] ) ; if ( dimCount > <NUM_LIT:0> ) { typeReference = copyDims ( typeReference , dimCount ) ; } NameReference init = new SingleNameReference ( CharOperation . concat ( LOCAL_VAR_PREFIX , this . evaluationContext . localVariableNames [ i ] ) , position ) ; LocalDeclaration declaration = new LocalDeclaration ( this . evaluationContext . localVariableNames [ i ] , start , end ) ; declaration . initialization = init ; declaration . type = typeReference ; declaration . modifiers = this . evaluationContext . localVariableModifiers [ i ] ; newStatements [ i ] = declaration ; } TryStatement tryStatement = new TryStatement ( ) ; Block tryBlock = new Block ( methodDecl . explicitDeclarations ) ; tryBlock . sourceStart = start ; tryBlock . sourceEnd = end ; tryBlock . statements = methodDecl . statements ; tryStatement . tryBlock = tryBlock ; Block finallyBlock = new Block ( <NUM_LIT:0> ) ; finallyBlock . sourceStart = start ; finallyBlock . sourceEnd = end ; finallyBlock . statements = new Statement [ varCount ] ; for ( int i = <NUM_LIT:0> ; i < varCount ; i ++ ) { SingleNameReference nameRef = new SingleNameReference ( this . evaluationContext . localVariableNames [ i ] , position ) ; finallyBlock . statements [ i ] = new Assignment ( new SingleNameReference ( CharOperation . concat ( LOCAL_VAR_PREFIX , this . evaluationContext . localVariableNames [ i ] ) , position ) , nameRef , nameRef . sourceEnd ) ; } tryStatement . finallyBlock = finallyBlock ; newStatements [ varCount ] = tryStatement ; methodDecl . statements = newStatements ; } } protected void consumeMethodInvocationName ( ) { if ( this . scanner . startPosition >= this . codeSnippetStart && this . scanner . startPosition <= this . codeSnippetEnd + <NUM_LIT:1> + this . lineSeparatorLength && isTopLevelType ( ) ) { MessageSend m = newMessageSend ( ) ; m . sourceEnd = this . rParenPos ; m . sourceStart = ( int ) ( ( m . nameSourcePosition = this . identifierPositionStack [ this . identifierPtr ] ) > > > <NUM_LIT:32> ) ; m . selector = this . identifierStack [ this . identifierPtr -- ] ; if ( this . identifierLengthStack [ this . identifierLengthPtr ] == <NUM_LIT:1> ) { m . receiver = new CodeSnippetThisReference ( <NUM_LIT:0> , <NUM_LIT:0> , this . evaluationContext , true ) ; this . identifierLengthPtr -- ; } else { this . identifierLengthStack [ this . identifierLengthPtr ] -- ; m . receiver = getUnspecifiedReference ( ) ; m . sourceStart = m . receiver . sourceStart ; } pushOnExpressionStack ( m ) ; } else { super . consumeMethodInvocationName ( ) ; } } protected void consumeMethodInvocationNameWithTypeArguments ( ) { if ( this . scanner . startPosition >= this . codeSnippetStart && this . scanner . startPosition <= this . codeSnippetEnd + <NUM_LIT:1> + this . lineSeparatorLength && isTopLevelType ( ) ) { MessageSend m = newMessageSendWithTypeArguments ( ) ; m . sourceEnd = this . rParenPos ; m . sourceStart = ( int ) ( ( m . nameSourcePosition = this . identifierPositionStack [ this . identifierPtr ] ) > > > <NUM_LIT:32> ) ; m . selector = this . identifierStack [ this . identifierPtr -- ] ; this . identifierLengthPtr -- ; int length = this . genericsLengthStack [ this . genericsLengthPtr -- ] ; this . genericsPtr -= length ; System . arraycopy ( this . genericsStack , this . genericsPtr + <NUM_LIT:1> , m . typeArguments = new TypeReference [ length ] , <NUM_LIT:0> , length ) ; this . intPtr -- ; m . receiver = getUnspecifiedReference ( ) ; m . sourceStart = m . receiver . sourceStart ; pushOnExpressionStack ( m ) ; } else { super . consumeMethodInvocationNameWithTypeArguments ( ) ; } } protected void consumeMethodInvocationSuper ( ) { MessageSend m = newMessageSend ( ) ; m . sourceStart = this . intStack [ this . intPtr -- ] ; m . sourceEnd = this . rParenPos ; m . nameSourcePosition = this . identifierPositionStack [ this . identifierPtr ] ; m . selector = this . identifierStack [ this . identifierPtr -- ] ; this . identifierLengthPtr -- ; m . receiver = new CodeSnippetSuperReference ( m . sourceStart , this . endPosition ) ; pushOnExpressionStack ( m ) ; } protected void consumeMethodInvocationSuperWithTypeArguments ( ) { MessageSend m = newMessageSendWithTypeArguments ( ) ; this . intPtr -- ; m . sourceEnd = this . rParenPos ; m . nameSourcePosition = this . identifierPositionStack [ this . identifierPtr ] ; m . selector = this . identifierStack [ this . identifierPtr -- ] ; this . identifierLengthPtr -- ; int length = this . genericsLengthStack [ this . genericsLengthPtr -- ] ; this . genericsPtr -= length ; System . arraycopy ( this . genericsStack , this . genericsPtr + <NUM_LIT:1> , m . typeArguments = new TypeReference [ length ] , <NUM_LIT:0> , length ) ; m . sourceStart = this . intStack [ this . intPtr -- ] ; m . receiver = new CodeSnippetSuperReference ( m . sourceStart , this . endPosition ) ; pushOnExpressionStack ( m ) ; } protected void consumePrimaryNoNewArrayThis ( ) { if ( this . scanner . startPosition >= this . codeSnippetStart && this . scanner . startPosition <= this . codeSnippetEnd + <NUM_LIT:1> + this . lineSeparatorLength && isTopLevelType ( ) ) { pushOnExpressionStack ( new CodeSnippetThisReference ( this . intStack [ this . intPtr -- ] , this . endPosition , this . evaluationContext , false ) ) ; } else { super . consumePrimaryNoNewArrayThis ( ) ; } } protected void consumeStatementBreak ( ) { super . consumeStatementBreak ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementBreakWithLabel ( ) { super . consumeStatementBreakWithLabel ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementCatch ( ) { super . consumeStatementCatch ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementContinue ( ) { super . consumeStatementContinue ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementContinueWithLabel ( ) { super . consumeStatementContinueWithLabel ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementDo ( ) { super . consumeStatementDo ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementFor ( ) { super . consumeStatementFor ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementIfNoElse ( ) { super . consumeStatementIfNoElse ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementIfWithElse ( ) { super . consumeStatementIfWithElse ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementLabel ( ) { super . consumeStatementLabel ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementReturn ( ) { if ( ( this . hasRecoveredOnExpression || ( this . scanner . startPosition >= this . codeSnippetStart && this . scanner . startPosition <= this . codeSnippetEnd + <NUM_LIT:1> + this . lineSeparatorLength ) ) && this . expressionLengthStack [ this . expressionLengthPtr ] != <NUM_LIT:0> && isTopLevelType ( ) ) { this . expressionLengthPtr -- ; Expression expression = this . expressionStack [ this . expressionPtr -- ] ; pushOnAstStack ( new CodeSnippetReturnStatement ( expression , expression . sourceStart , expression . sourceEnd ) ) ; } else { super . consumeStatementReturn ( ) ; } recordLastStatementIfNeeded ( ) ; } protected void consumeStatementSwitch ( ) { super . consumeStatementSwitch ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementSynchronized ( ) { super . consumeStatementSynchronized ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementThrow ( ) { super . consumeStatementThrow ( ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementTry ( boolean arg_0 , boolean arg_1 ) { super . consumeStatementTry ( arg_0 , arg_1 ) ; recordLastStatementIfNeeded ( ) ; } protected void consumeStatementWhile ( ) { super . consumeStatementWhile ( ) ; recordLastStatementIfNeeded ( ) ; } protected CompilationUnitDeclaration endParse ( int act ) { if ( this . hasRecoveredOnExpression ) { CompilationResult unitResult = this . compilationUnit . compilationResult ; if ( act != ERROR_ACTION ) { for ( int i = <NUM_LIT:0> ; i < unitResult . problemCount ; i ++ ) { unitResult . problems [ i ] = null ; } unitResult . problemCount = <NUM_LIT:0> ; if ( this . referenceContext instanceof AbstractMethodDeclaration ) { ( ( AbstractMethodDeclaration ) this . referenceContext ) . ignoreFurtherInvestigation = false ; } if ( this . referenceContext instanceof CompilationUnitDeclaration ) { ( ( CompilationUnitDeclaration ) this . referenceContext ) . ignoreFurtherInvestigation = false ; } consumeStatementReturn ( ) ; int fieldsCount = ( this . evaluationContext . localVariableNames == null ? <NUM_LIT:0> : this . evaluationContext . localVariableNames . length ) + ( this . evaluationContext . declaringTypeName == null ? <NUM_LIT:0> : <NUM_LIT:1> ) ; if ( this . astPtr > ( this . diet ? <NUM_LIT:0> : <NUM_LIT:2> + fieldsCount ) ) { consumeBlockStatements ( ) ; } consumeMethodBody ( ) ; if ( ! this . diet ) { consumeMethodDeclaration ( true ) ; if ( fieldsCount > <NUM_LIT:0> ) { consumeClassBodyDeclarations ( ) ; } consumeClassBodyDeclarationsopt ( ) ; consumeClassDeclaration ( ) ; consumeInternalCompilationUnitWithTypes ( ) ; consumeCompilationUnit ( ) ; } this . lastAct = ACCEPT_ACTION ; } else { int maxRegularPos = <NUM_LIT:0> , problemCount = unitResult . problemCount ; for ( int i = <NUM_LIT:0> ; i < this . problemCountBeforeRecovery ; i ++ ) { if ( unitResult . problems [ i ] . getID ( ) == IProblem . UnmatchedBracket ) continue ; int start = unitResult . problems [ i ] . getSourceStart ( ) ; if ( start > maxRegularPos && start <= this . codeSnippetEnd ) { maxRegularPos = start ; } } int maxRecoveryPos = <NUM_LIT:0> ; for ( int i = this . problemCountBeforeRecovery ; i < problemCount ; i ++ ) { if ( unitResult . problems [ i ] . getID ( ) == IProblem . UnmatchedBracket ) continue ; int start = unitResult . problems [ i ] . getSourceStart ( ) ; if ( start > maxRecoveryPos && start <= this . codeSnippetEnd ) { maxRecoveryPos = start ; } } if ( maxRecoveryPos > maxRegularPos ) { System . arraycopy ( unitResult . problems , this . problemCountBeforeRecovery , unitResult . problems , <NUM_LIT:0> , problemCount - this . problemCountBeforeRecovery ) ; unitResult . problemCount -= this . problemCountBeforeRecovery ; } else { unitResult . problemCount -= ( problemCount - this . problemCountBeforeRecovery ) ; } for ( int i = unitResult . problemCount ; i < problemCount ; i ++ ) { unitResult . problems [ i ] = null ; } } } return super . endParse ( act ) ; } protected NameReference getUnspecifiedReference ( ) { if ( this . scanner . startPosition >= this . codeSnippetStart && this . scanner . startPosition <= this . codeSnippetEnd + <NUM_LIT:1> + this . lineSeparatorLength ) { int length ; NameReference ref ; if ( ( length = this . identifierLengthStack [ this . identifierLengthPtr -- ] ) == <NUM_LIT:1> ) { ref = new CodeSnippetSingleNameReference ( this . identifierStack [ this . identifierPtr ] , this . identifierPositionStack [ this . identifierPtr -- ] , this . evaluationContext ) ; } else { char [ ] [ ] tokens = new char [ length ] [ ] ; this . identifierPtr -= length ; System . arraycopy ( this . identifierStack , this . identifierPtr + <NUM_LIT:1> , tokens , <NUM_LIT:0> , length ) ; long [ ] positions = new long [ length ] ; System . arraycopy ( this . identifierPositionStack , this . identifierPtr + <NUM_LIT:1> , positions , <NUM_LIT:0> , length ) ; ref = new CodeSnippetQualifiedNameReference ( tokens , positions , ( int ) ( this . identifierPositionStack [ this . identifierPtr + <NUM_LIT:1> ] > > <NUM_LIT:32> ) , ( int ) this . identifierPositionStack [ this . identifierPtr + length ] , this . evaluationContext ) ; } return ref ; } else { return super . getUnspecifiedReference ( ) ; } } protected NameReference getUnspecifiedReferenceOptimized ( ) { if ( this . scanner . startPosition >= this . codeSnippetStart && this . scanner . startPosition <= this . codeSnippetEnd + <NUM_LIT:1> + this . lineSeparatorLength ) { int length ; NameReference ref ; if ( ( length = this . identifierLengthStack [ this . identifierLengthPtr -- ] ) == <NUM_LIT:1> ) { ref = new CodeSnippetSingleNameReference ( this . identifierStack [ this . identifierPtr ] , this . identifierPositionStack [ this . identifierPtr -- ] , this . evaluationContext ) ; ref . bits &= ~ ASTNode . RestrictiveFlagMASK ; ref . bits |= Binding . LOCAL | Binding . FIELD ; return ref ; } char [ ] [ ] tokens = new char [ length ] [ ] ; this . identifierPtr -= length ; System . arraycopy ( this . identifierStack , this . identifierPtr + <NUM_LIT:1> , tokens , <NUM_LIT:0> , length ) ; long [ ] positions = new long [ length ] ; System . arraycopy ( this . identifierPositionStack , this . identifierPtr + <NUM_LIT:1> , positions , <NUM_LIT:0> , length ) ; ref = new CodeSnippetQualifiedNameReference ( tokens , positions , ( int ) ( this . identifierPositionStack [ this . identifierPtr + <NUM_LIT:1> ] > > <NUM_LIT:32> ) , ( int ) this . identifierPositionStack [ this . identifierPtr + length ] , this . evaluationContext ) ; ref . bits &= ~ ASTNode . RestrictiveFlagMASK ; ref . bits |= Binding . LOCAL | Binding . FIELD ; return ref ; } else { return super . getUnspecifiedReferenceOptimized ( ) ; } } protected void ignoreExpressionAssignment ( ) { super . ignoreExpressionAssignment ( ) ; recordLastStatementIfNeeded ( ) ; } private boolean isTopLevelType ( ) { return this . nestedType == ( this . diet ? <NUM_LIT:0> : <NUM_LIT:1> ) ; } protected MessageSend newMessageSend ( ) { CodeSnippetMessageSend m = new CodeSnippetMessageSend ( this . evaluationContext ) ; int length ; if ( ( length = this . expressionLengthStack [ this . expressionLengthPtr -- ] ) != <NUM_LIT:0> ) { this . expressionPtr -= length ; System . arraycopy ( this . expressionStack , this . expressionPtr + <NUM_LIT:1> , m . arguments = new Expression [ length ] , <NUM_LIT:0> , length ) ; } return m ; } protected MessageSend newMessageSendWithTypeArguments ( ) { CodeSnippetMessageSend m = new CodeSnippetMessageSend ( this . evaluationContext ) ; int length ; if ( ( length = this . expressionLengthStack [ this . expressionLengthPtr -- ] ) != <NUM_LIT:0> ) { this . expressionPtr -= length ; System . arraycopy ( this . expressionStack , this . expressionPtr + <NUM_LIT:1> , m . arguments = new Expression [ length ] , <NUM_LIT:0> , length ) ; } return m ; } private void recordLastStatementIfNeeded ( ) { if ( ( isTopLevelType ( ) ) && ( this . scanner . startPosition <= this . codeSnippetEnd + this . lineSeparatorLength ) ) { this . lastStatement = this . scanner . startPosition ; } } protected void reportSyntaxErrors ( boolean isDietParse , int oldFirstToken ) { if ( ! isDietParse ) { this . scanner . initialPosition = this . lastStatement ; this . scanner . eofPosition = this . codeSnippetEnd + <NUM_LIT:1> ; oldFirstToken = TokenNameTWIDDLE ; } super . reportSyntaxErrors ( isDietParse , oldFirstToken ) ; } protected boolean resumeOnSyntaxError ( ) { if ( this . diet || this . hasRecoveredOnExpression ) { return false ; } this . problemCountBeforeRecovery = this . compilationUnit . compilationResult . problemCount ; if ( this . lastStatement < <NUM_LIT:0> ) { this . lastStatement = this . codeSnippetStart ; } this . scanner . initialPosition = this . lastStatement ; this . scanner . startPosition = this . lastStatement ; this . scanner . currentPosition = this . lastStatement ; this . scanner . eofPosition = this . codeSnippetEnd < Integer . MAX_VALUE ? this . codeSnippetEnd + <NUM_LIT:1> : this . codeSnippetEnd ; this . scanner . commentPtr = - <NUM_LIT:1> ; this . expressionPtr = - <NUM_LIT:1> ; this . identifierPtr = - <NUM_LIT:1> ; this . identifierLengthPtr = - <NUM_LIT:1> ; goForExpression ( ) ; this . hasRecoveredOnExpression = true ; this . hasReportedError = false ; this . hasError = false ; return true ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortType ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CodeSnippetTypeDeclaration extends TypeDeclaration { public CodeSnippetTypeDeclaration ( CompilationResult compilationResult ) { super ( compilationResult ) ; } public void generateCode ( ClassFile enclosingClassFile ) { if ( ( this . bits & ASTNode . HasBeenGenerated ) != <NUM_LIT:0> ) return ; this . bits |= ASTNode . HasBeenGenerated ; if ( this . ignoreFurtherInvestigation ) { if ( this . binding == null ) return ; CodeSnippetClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; return ; } try { ClassFile classFile = new CodeSnippetClassFile ( this . binding , enclosingClassFile , false ) ; classFile . addFieldInfos ( ) ; if ( this . binding . isMemberType ( ) ) { classFile . recordInnerClasses ( this . binding ) ; } else if ( this . binding . isLocalType ( ) ) { enclosingClassFile . recordInnerClasses ( this . binding ) ; classFile . recordInnerClasses ( this . binding ) ; } TypeVariableBinding [ ] typeVariables = this . binding . typeVariables ( ) ; for ( int i = <NUM_LIT:0> , max = typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariables [ i ] ; if ( ( typeVariableBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , typeVariableBinding ) ; } } if ( this . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = this . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = this . memberTypes [ i ] ; classFile . recordInnerClasses ( memberType . binding ) ; memberType . generateCode ( this . scope , classFile ) ; } } classFile . setForMethodInfos ( ) ; if ( this . methods != null ) { for ( int i = <NUM_LIT:0> , max = this . methods . length ; i < max ; i ++ ) { this . methods [ i ] . generateCode ( this . scope , classFile ) ; } } classFile . addSpecialMethods ( ) ; if ( this . ignoreFurtherInvestigation ) { throw new AbortType ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } classFile . addAttributes ( ) ; this . scope . referenceCompilationUnit ( ) . compilationResult . record ( this . binding . constantPoolName ( ) , classFile ) ; } catch ( AbortType e ) { if ( this . binding == null ) return ; CodeSnippetClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; } } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; public class EvaluationResult { static final CategorizedProblem [ ] NO_PROBLEMS = new CategorizedProblem [ <NUM_LIT:0> ] ; char [ ] evaluationID ; int evaluationType ; CategorizedProblem [ ] problems ; char [ ] displayString ; char [ ] typeName ; public static final int T_VARIABLE = <NUM_LIT:1> ; public static final int T_CODE_SNIPPET = <NUM_LIT:2> ; public static final int T_IMPORT = <NUM_LIT:3> ; public static final int T_PACKAGE = <NUM_LIT:4> ; public static final int T_INTERNAL = <NUM_LIT:5> ; public EvaluationResult ( char [ ] evaluationID , int evaluationType , char [ ] displayString , char [ ] typeName ) { this . evaluationID = evaluationID ; this . evaluationType = evaluationType ; this . displayString = displayString ; this . typeName = typeName ; this . problems = NO_PROBLEMS ; } public EvaluationResult ( char [ ] evaluationID , int evaluationType , CategorizedProblem [ ] problems ) { this . evaluationID = evaluationID ; this . evaluationType = evaluationType ; this . problems = problems ; } void addProblem ( CategorizedProblem problem ) { CategorizedProblem [ ] existingProblems = this . problems ; int existingLength = existingProblems . length ; this . problems = new CategorizedProblem [ existingLength + <NUM_LIT:1> ] ; System . arraycopy ( existingProblems , <NUM_LIT:0> , this . problems , <NUM_LIT:0> , existingLength ) ; this . problems [ existingLength ] = problem ; } public char [ ] getEvaluationID ( ) { return this . evaluationID ; } public int getEvaluationType ( ) { return this . evaluationType ; } public CategorizedProblem [ ] getProblems ( ) { return this . problems ; } public Object getValue ( ) { return null ; } public char [ ] getValueDisplayString ( ) { return this . displayString ; } public char [ ] getValueTypeName ( ) { return this . typeName ; } public boolean hasErrors ( ) { if ( this . problems == null ) { return false ; } else { for ( int i = <NUM_LIT:0> ; i < this . problems . length ; i ++ ) { if ( this . problems [ i ] . isError ( ) ) { return true ; } } return false ; } } public boolean hasProblems ( ) { return ( this . problems != null ) && ( this . problems . length != <NUM_LIT:0> ) ; } public boolean hasValue ( ) { return this . displayString != null ; } public boolean hasWarnings ( ) { if ( this . problems == null ) { return false ; } else { for ( int i = <NUM_LIT:0> ; i < this . problems . length ; i ++ ) { if ( this . problems [ i ] . isWarning ( ) ) { return true ; } } return false ; } } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; switch ( this . evaluationType ) { case T_CODE_SNIPPET : buffer . append ( "<STR_LIT>" ) ; break ; case T_IMPORT : buffer . append ( "<STR_LIT>" ) ; break ; case T_INTERNAL : buffer . append ( "<STR_LIT>" ) ; break ; case T_PACKAGE : buffer . append ( "<STR_LIT>" ) ; break ; case T_VARIABLE : buffer . append ( "<STR_LIT>" ) ; break ; } buffer . append ( "<STR_LIT::U+0020>" ) ; buffer . append ( this . evaluationID == null ? "<STR_LIT>" . toCharArray ( ) : this . evaluationID ) ; buffer . append ( "<STR_LIT:n>" ) ; if ( hasProblems ( ) ) { buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < this . problems . length ; i ++ ) { buffer . append ( this . problems [ i ] . toString ( ) ) ; } } else { if ( hasValue ( ) ) { buffer . append ( "<STR_LIT:(>" ) ; buffer . append ( this . typeName ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . displayString ) ; } else { buffer . append ( "<STR_LIT>" ) ; } } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . ThisReference ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class CodeSnippetThisReference extends ThisReference implements EvaluationConstants , InvocationSite { EvaluationContext evaluationContext ; FieldBinding delegateThis ; boolean isImplicit ; public CodeSnippetThisReference ( int s , int sourceEnd , EvaluationContext evaluationContext , boolean isImplicit ) { super ( s , sourceEnd ) ; this . evaluationContext = evaluationContext ; this . isImplicit = isImplicit ; } public boolean checkAccess ( MethodScope methodScope ) { if ( this . evaluationContext . isConstructorCall ) { methodScope . problemReporter ( ) . fieldsOrThisBeforeConstructorInvocation ( this ) ; return false ; } if ( this . evaluationContext . declaringTypeName == null || this . evaluationContext . isStatic ) { methodScope . problemReporter ( ) . errorThisSuperInStatic ( this ) ; return false ; } return true ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . aload_0 ( ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , this . delegateThis , null ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding [ ] genericTypeArguments ( ) { return null ; } public boolean isSuperAccess ( ) { return false ; } public boolean isTypeAccess ( ) { return false ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { char [ ] declaringType = this . evaluationContext . declaringTypeName ; output . append ( '<CHAR_LIT:(>' ) ; if ( declaringType == null ) output . append ( "<STR_LIT>" ) ; else output . append ( declaringType ) ; return output . append ( "<STR_LIT>" ) ; } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; TypeBinding snippetType = null ; MethodScope methodScope = scope . methodScope ( ) ; if ( ! this . isImplicit && ! checkAccess ( methodScope ) ) { return null ; } snippetType = scope . enclosingSourceType ( ) ; this . delegateThis = scope . getField ( snippetType , DELEGATE_THIS , this ) ; if ( this . delegateThis == null || ! this . delegateThis . isValidBinding ( ) ) { methodScope . problemReporter ( ) . errorThisSuperInStatic ( this ) ; return null ; } return this . resolvedType = this . delegateThis . type ; } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int index ) { } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . InvocationSite ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . PackageBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; public class CodeSnippetScope extends BlockScope { protected CodeSnippetScope ( int kind , Scope parent ) { super ( kind , parent ) ; } public CodeSnippetScope ( BlockScope parent ) { super ( parent ) ; } public CodeSnippetScope ( BlockScope parent , int variableCount ) { super ( parent , variableCount ) ; } public final boolean canBeSeenByForCodeSnippet ( FieldBinding fieldBinding , TypeBinding receiverType , InvocationSite invocationSite , Scope scope ) { if ( fieldBinding . isPublic ( ) ) return true ; ReferenceBinding invocationType = ( ReferenceBinding ) receiverType ; if ( invocationType == fieldBinding . declaringClass ) return true ; if ( fieldBinding . isProtected ( ) ) { if ( invocationType == fieldBinding . declaringClass ) return true ; if ( invocationType . fPackage == fieldBinding . declaringClass . fPackage ) return true ; if ( fieldBinding . declaringClass . isSuperclassOf ( invocationType ) ) { if ( invocationSite . isSuperAccess ( ) ) return true ; if ( receiverType instanceof ArrayBinding ) return false ; if ( invocationType . isSuperclassOf ( ( ReferenceBinding ) receiverType ) ) return true ; if ( fieldBinding . isStatic ( ) ) return true ; } return false ; } if ( fieldBinding . isPrivate ( ) ) { if ( receiverType != fieldBinding . declaringClass ) return false ; if ( invocationType != fieldBinding . declaringClass ) { ReferenceBinding outerInvocationType = invocationType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = fieldBinding . declaringClass ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } if ( outerInvocationType != outerDeclaringClass ) return false ; } return true ; } if ( invocationType . fPackage != fieldBinding . declaringClass . fPackage ) return false ; if ( receiverType instanceof ArrayBinding ) return false ; ReferenceBinding type = ( ReferenceBinding ) receiverType ; PackageBinding declaringPackage = fieldBinding . declaringClass . fPackage ; TypeBinding originalDeclaringClass = fieldBinding . declaringClass . original ( ) ; do { if ( type . isCapture ( ) ) { if ( originalDeclaringClass == type . erasure ( ) . original ( ) ) return true ; } else { if ( originalDeclaringClass == type . original ( ) ) return true ; } if ( declaringPackage != type . fPackage ) return false ; } while ( ( type = type . superclass ( ) ) != null ) ; return false ; } public final boolean canBeSeenByForCodeSnippet ( MethodBinding methodBinding , TypeBinding receiverType , InvocationSite invocationSite , Scope scope ) { if ( methodBinding . isPublic ( ) ) return true ; ReferenceBinding invocationType = ( ReferenceBinding ) receiverType ; if ( invocationType == methodBinding . declaringClass ) return true ; if ( methodBinding . isProtected ( ) ) { if ( invocationType == methodBinding . declaringClass ) return true ; if ( invocationType . fPackage == methodBinding . declaringClass . fPackage ) return true ; if ( methodBinding . declaringClass . isSuperclassOf ( invocationType ) ) { if ( invocationSite . isSuperAccess ( ) ) return true ; if ( receiverType instanceof ArrayBinding ) return false ; if ( invocationType . isSuperclassOf ( ( ReferenceBinding ) receiverType ) ) return true ; if ( methodBinding . isStatic ( ) ) return true ; } return false ; } if ( methodBinding . isPrivate ( ) ) { if ( receiverType != methodBinding . declaringClass ) return false ; if ( invocationType != methodBinding . declaringClass ) { ReferenceBinding outerInvocationType = invocationType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = methodBinding . declaringClass ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } if ( outerInvocationType != outerDeclaringClass ) return false ; } return true ; } if ( invocationType . fPackage != methodBinding . declaringClass . fPackage ) return false ; if ( receiverType instanceof ArrayBinding ) return false ; ReferenceBinding type = ( ReferenceBinding ) receiverType ; PackageBinding declaringPackage = methodBinding . declaringClass . fPackage ; TypeBinding originalDeclaringClass = methodBinding . declaringClass . original ( ) ; do { if ( type . isCapture ( ) ) { if ( originalDeclaringClass == type . erasure ( ) . original ( ) ) return true ; } else { if ( originalDeclaringClass == type . original ( ) ) return true ; } if ( declaringPackage != type . fPackage ) return false ; } while ( ( type = type . superclass ( ) ) != null ) ; return false ; } public final boolean canBeSeenByForCodeSnippet ( ReferenceBinding referenceBinding , ReferenceBinding receiverType ) { if ( referenceBinding . isPublic ( ) ) return true ; if ( receiverType == referenceBinding ) return true ; if ( referenceBinding . isProtected ( ) ) { return receiverType . fPackage == referenceBinding . fPackage || referenceBinding . isSuperclassOf ( receiverType ) || referenceBinding . enclosingType ( ) . isSuperclassOf ( receiverType ) ; } if ( referenceBinding . isPrivate ( ) ) { ReferenceBinding outerInvocationType = receiverType ; ReferenceBinding temp = outerInvocationType . enclosingType ( ) ; while ( temp != null ) { outerInvocationType = temp ; temp = temp . enclosingType ( ) ; } ReferenceBinding outerDeclaringClass = referenceBinding ; temp = outerDeclaringClass . enclosingType ( ) ; while ( temp != null ) { outerDeclaringClass = temp ; temp = temp . enclosingType ( ) ; } return outerInvocationType == outerDeclaringClass ; } return receiverType . fPackage == referenceBinding . fPackage ; } public MethodBinding findExactMethod ( ReferenceBinding receiverType , char [ ] selector , TypeBinding [ ] argumentTypes , InvocationSite invocationSite ) { MethodBinding exactMethod = receiverType . getExactMethod ( selector , argumentTypes , null ) ; if ( exactMethod != null ) { if ( receiverType . isInterface ( ) || canBeSeenByForCodeSnippet ( exactMethod , receiverType , invocationSite , this ) ) return exactMethod ; } return null ; } public FieldBinding findFieldForCodeSnippet ( TypeBinding receiverType , char [ ] fieldName , InvocationSite invocationSite ) { if ( receiverType . isBaseType ( ) ) return null ; if ( receiverType . isArrayType ( ) ) { TypeBinding leafType = receiverType . leafComponentType ( ) ; if ( leafType instanceof ReferenceBinding ) if ( ! ( ( ReferenceBinding ) leafType ) . canBeSeenBy ( this ) ) { return new ProblemFieldBinding ( ( ReferenceBinding ) leafType , fieldName , ProblemReasons . ReceiverTypeNotVisible ) ; } if ( CharOperation . equals ( fieldName , TypeConstants . LENGTH ) ) return ArrayBinding . ArrayLength ; return null ; } ReferenceBinding currentType = ( ReferenceBinding ) receiverType ; if ( ! currentType . canBeSeenBy ( this ) ) return new ProblemFieldBinding ( currentType , fieldName , ProblemReasons . ReceiverTypeNotVisible ) ; FieldBinding field = currentType . getField ( fieldName , true ) ; if ( field != null ) { if ( canBeSeenByForCodeSnippet ( field , currentType , invocationSite , this ) ) return field ; else return new ProblemFieldBinding ( field , field . declaringClass , fieldName , ProblemReasons . NotVisible ) ; } ReferenceBinding [ ] [ ] interfacesToVisit = null ; int lastPosition = - <NUM_LIT:1> ; FieldBinding visibleField = null ; boolean keepLooking = true ; boolean notVisible = false ; while ( keepLooking ) { ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) interfacesToVisit = new ReferenceBinding [ <NUM_LIT:5> ] [ ] ; if ( ++ lastPosition == interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ lastPosition * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , lastPosition ) ; interfacesToVisit [ lastPosition ] = itsInterfaces ; } if ( ( currentType = currentType . superclass ( ) ) == null ) break ; if ( ( field = currentType . getField ( fieldName , true ) ) != null ) { keepLooking = false ; if ( canBeSeenByForCodeSnippet ( field , receiverType , invocationSite , this ) ) { if ( visibleField == null ) visibleField = field ; else return new ProblemFieldBinding ( visibleField , visibleField . declaringClass , fieldName , ProblemReasons . Ambiguous ) ; } else { notVisible = true ; } } } if ( interfacesToVisit != null ) { ProblemFieldBinding ambiguous = null ; org . eclipse . jdt . internal . compiler . util . SimpleSet interfacesSeen = new org . eclipse . jdt . internal . compiler . util . SimpleSet ( lastPosition * <NUM_LIT:2> ) ; done : for ( int i = <NUM_LIT:0> ; i <= lastPosition ; i ++ ) { ReferenceBinding [ ] interfaces = interfacesToVisit [ i ] ; for ( int j = <NUM_LIT:0> , length = interfaces . length ; j < length ; j ++ ) { ReferenceBinding anInterface = interfaces [ j ] ; if ( interfacesSeen . addIfNotIncluded ( anInterface ) == anInterface ) { if ( ( field = anInterface . getField ( fieldName , true ) ) != null ) { if ( visibleField == null ) { visibleField = field ; } else { ambiguous = new ProblemFieldBinding ( visibleField , visibleField . declaringClass , fieldName , ProblemReasons . Ambiguous ) ; break done ; } } else { ReferenceBinding [ ] itsInterfaces = anInterface . superInterfaces ( ) ; if ( itsInterfaces != Binding . NO_SUPERINTERFACES ) { if ( ++ lastPosition == interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , <NUM_LIT:0> , interfacesToVisit = new ReferenceBinding [ lastPosition * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , lastPosition ) ; interfacesToVisit [ lastPosition ] = itsInterfaces ; } } } } } if ( ambiguous != null ) return ambiguous ; } if ( visibleField != null ) return visibleField ; if ( notVisible ) return new ProblemFieldBinding ( currentType , fieldName , ProblemReasons . NotVisible ) ; return null ; } public MethodBinding findMethod ( ReferenceBinding receiverType , char [ ] selector , TypeBinding [ ] argumentTypes , InvocationSite invocationSite ) { MethodBinding methodBinding = super . findMethod ( receiverType , selector , argumentTypes , invocationSite ) ; if ( methodBinding != null && methodBinding . isValidBinding ( ) ) if ( ! canBeSeenByForCodeSnippet ( methodBinding , receiverType , invocationSite , this ) ) return new ProblemMethodBinding ( methodBinding , selector , argumentTypes , ProblemReasons . NotVisible ) ; return methodBinding ; } public MethodBinding findMethodForArray ( ArrayBinding receiverType , char [ ] selector , TypeBinding [ ] argumentTypes , InvocationSite invocationSite ) { ReferenceBinding object = getJavaLangObject ( ) ; MethodBinding methodBinding = object . getExactMethod ( selector , argumentTypes , null ) ; if ( methodBinding != null ) { if ( argumentTypes == Binding . NO_PARAMETERS && CharOperation . equals ( selector , TypeConstants . CLONE ) ) return new MethodBinding ( ( methodBinding . modifiers & ~ ClassFileConstants . AccProtected ) | ClassFileConstants . AccPublic , TypeConstants . CLONE , methodBinding . returnType , argumentTypes , null , object ) ; if ( canBeSeenByForCodeSnippet ( methodBinding , receiverType , invocationSite , this ) ) return methodBinding ; } methodBinding = findMethod ( object , selector , argumentTypes , invocationSite ) ; if ( methodBinding == null ) return new ProblemMethodBinding ( selector , argumentTypes , ProblemReasons . NotFound ) ; if ( methodBinding . isValidBinding ( ) ) { MethodBinding compatibleMethod = computeCompatibleMethod ( methodBinding , argumentTypes , invocationSite ) ; if ( compatibleMethod == null ) return new ProblemMethodBinding ( methodBinding , selector , argumentTypes , ProblemReasons . NotFound ) ; methodBinding = compatibleMethod ; if ( ! canBeSeenByForCodeSnippet ( methodBinding , receiverType , invocationSite , this ) ) return new ProblemMethodBinding ( methodBinding , selector , methodBinding . parameters , ProblemReasons . NotVisible ) ; } return methodBinding ; } public Binding getBinding ( char [ ] [ ] compoundName , int mask , InvocationSite invocationSite , ReferenceBinding receiverType ) { Binding binding = getBinding ( compoundName [ <NUM_LIT:0> ] , mask | Binding . TYPE | Binding . PACKAGE , invocationSite , true ) ; invocationSite . setFieldIndex ( <NUM_LIT:1> ) ; if ( ! binding . isValidBinding ( ) || binding instanceof VariableBinding ) return binding ; int length = compoundName . length ; int currentIndex = <NUM_LIT:1> ; foundType : if ( binding instanceof PackageBinding ) { PackageBinding packageBinding = ( PackageBinding ) binding ; while ( currentIndex < length ) { binding = packageBinding . getTypeOrPackage ( compoundName [ currentIndex ++ ] ) ; invocationSite . setFieldIndex ( currentIndex ) ; if ( binding == null ) { if ( currentIndex == length ) return new ProblemReferenceBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , null , ProblemReasons . NotFound ) ; else return new ProblemBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , ProblemReasons . NotFound ) ; } if ( binding instanceof ReferenceBinding ) { if ( ! binding . isValidBinding ( ) ) return new ProblemReferenceBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , ( ReferenceBinding ) ( ( ReferenceBinding ) binding ) . closestMatch ( ) , binding . problemId ( ) ) ; if ( ! this . canBeSeenByForCodeSnippet ( ( ReferenceBinding ) binding , receiverType ) ) return new ProblemReferenceBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , ( ReferenceBinding ) binding , ProblemReasons . NotVisible ) ; break foundType ; } packageBinding = ( PackageBinding ) binding ; } return new ProblemReferenceBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , null , ProblemReasons . NotFound ) ; } while ( currentIndex < length ) { ReferenceBinding typeBinding = ( ReferenceBinding ) binding ; char [ ] nextName = compoundName [ currentIndex ++ ] ; invocationSite . setFieldIndex ( currentIndex ) ; if ( ( binding = findFieldForCodeSnippet ( typeBinding , nextName , invocationSite ) ) != null ) { if ( ! binding . isValidBinding ( ) ) { return new ProblemFieldBinding ( ( FieldBinding ) binding , ( ( FieldBinding ) binding ) . declaringClass , CharOperation . concatWith ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , '<CHAR_LIT:.>' ) , binding . problemId ( ) ) ; } break ; } if ( ( binding = findMemberType ( nextName , typeBinding ) ) == null ) return new ProblemBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , typeBinding , ProblemReasons . NotFound ) ; if ( ! binding . isValidBinding ( ) ) return new ProblemReferenceBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , ( ReferenceBinding ) ( ( ReferenceBinding ) binding ) . closestMatch ( ) , binding . problemId ( ) ) ; } if ( ( mask & Binding . FIELD ) != <NUM_LIT:0> && ( binding instanceof FieldBinding ) ) { FieldBinding field = ( FieldBinding ) binding ; if ( ! field . isStatic ( ) ) { return new ProblemFieldBinding ( field , field . declaringClass , CharOperation . concatWith ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , '<CHAR_LIT:.>' ) , ProblemReasons . NonStaticReferenceInStaticContext ) ; } return binding ; } if ( ( mask & Binding . TYPE ) != <NUM_LIT:0> && ( binding instanceof ReferenceBinding ) ) { return binding ; } return new ProblemBinding ( CharOperation . subarray ( compoundName , <NUM_LIT:0> , currentIndex ) , ProblemReasons . NotFound ) ; } public MethodBinding getConstructor ( ReferenceBinding receiverType , TypeBinding [ ] argumentTypes , InvocationSite invocationSite ) { MethodBinding methodBinding = receiverType . getExactConstructor ( argumentTypes ) ; if ( methodBinding != null ) { if ( canBeSeenByForCodeSnippet ( methodBinding , receiverType , invocationSite , this ) ) { return methodBinding ; } } MethodBinding [ ] methods = receiverType . getMethods ( TypeConstants . INIT ) ; if ( methods == Binding . NO_METHODS ) { return new ProblemMethodBinding ( TypeConstants . INIT , argumentTypes , ProblemReasons . NotFound ) ; } MethodBinding [ ] compatible = new MethodBinding [ methods . length ] ; int compatibleIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = methods . length ; i < length ; i ++ ) { MethodBinding compatibleMethod = computeCompatibleMethod ( methods [ i ] , argumentTypes , invocationSite ) ; if ( compatibleMethod != null ) compatible [ compatibleIndex ++ ] = compatibleMethod ; } if ( compatibleIndex == <NUM_LIT:0> ) return new ProblemMethodBinding ( TypeConstants . INIT , argumentTypes , ProblemReasons . NotFound ) ; MethodBinding [ ] visible = new MethodBinding [ compatibleIndex ] ; int visibleIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < compatibleIndex ; i ++ ) { MethodBinding method = compatible [ i ] ; if ( canBeSeenByForCodeSnippet ( method , receiverType , invocationSite , this ) ) { visible [ visibleIndex ++ ] = method ; } } if ( visibleIndex == <NUM_LIT:1> ) { return visible [ <NUM_LIT:0> ] ; } if ( visibleIndex == <NUM_LIT:0> ) { return new ProblemMethodBinding ( compatible [ <NUM_LIT:0> ] , TypeConstants . INIT , compatible [ <NUM_LIT:0> ] . parameters , ProblemReasons . NotVisible ) ; } return mostSpecificClassMethodBinding ( visible , visibleIndex , invocationSite ) ; } public FieldBinding getFieldForCodeSnippet ( TypeBinding receiverType , char [ ] fieldName , InvocationSite invocationSite ) { FieldBinding field = findFieldForCodeSnippet ( receiverType , fieldName , invocationSite ) ; if ( field == null ) return new ProblemFieldBinding ( receiverType instanceof ReferenceBinding ? ( ReferenceBinding ) receiverType : null , fieldName , ProblemReasons . NotFound ) ; else return field ; } public MethodBinding getImplicitMethod ( ReferenceBinding receiverType , char [ ] selector , TypeBinding [ ] argumentTypes , InvocationSite invocationSite ) { MethodBinding methodBinding = findExactMethod ( receiverType , selector , argumentTypes , invocationSite ) ; if ( methodBinding == null ) methodBinding = findMethod ( receiverType , selector , argumentTypes , invocationSite ) ; if ( methodBinding != null ) { if ( methodBinding . isValidBinding ( ) ) if ( ! canBeSeenByForCodeSnippet ( methodBinding , receiverType , invocationSite , this ) ) return new ProblemMethodBinding ( methodBinding , selector , argumentTypes , ProblemReasons . NotVisible ) ; return methodBinding ; } return new ProblemMethodBinding ( selector , argumentTypes , ProblemReasons . NotFound ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . ProblemBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; public class CodeSnippetQualifiedNameReference extends QualifiedNameReference implements EvaluationConstants , ProblemReasons { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetQualifiedNameReference ( char [ ] [ ] sources , long [ ] positions , int sourceStart , int sourceEnd , EvaluationContext evaluationContext ) { super ( sources , positions , sourceStart , sourceEnd ) ; this . evaluationContext = evaluationContext ; } public TypeBinding checkFieldAccess ( BlockScope scope ) { FieldBinding fieldBinding = ( FieldBinding ) this . binding ; MethodScope methodScope = scope . methodScope ( ) ; TypeBinding declaringClass = fieldBinding . original ( ) . declaringClass ; if ( ( this . indexOfFirstFieldBinding == <NUM_LIT:1> || declaringClass . isEnum ( ) ) && methodScope . enclosingSourceType ( ) == declaringClass && methodScope . lastVisibleFieldID >= <NUM_LIT:0> && fieldBinding . id >= methodScope . lastVisibleFieldID && ( ! fieldBinding . isStatic ( ) || methodScope . isStatic ) ) { scope . problemReporter ( ) . forwardReference ( this , this . indexOfFirstFieldBinding - <NUM_LIT:1> , fieldBinding ) ; } this . bits &= ~ ASTNode . RestrictiveFlagMASK ; this . bits |= Binding . FIELD ; return getOtherFieldBindings ( scope ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( ( this . bits & Binding . VARIABLE ) == <NUM_LIT:0> ) { codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; return ; } FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generateCode ( currentScope , codeStream , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; if ( lastFieldBinding != null ) { boolean isStatic = lastFieldBinding . isStatic ( ) ; Constant fieldConstant = lastFieldBinding . constant ( ) ; if ( fieldConstant != Constant . NotAConstant ) { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } if ( valueRequired ) { codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } } else { boolean isFirst = lastFieldBinding == this . binding && ( this . indexOfFirstFieldBinding == <NUM_LIT:1> || lastFieldBinding . declaringClass == currentScope . enclosingReceiverType ( ) ) && this . otherBindings == null ; TypeBinding requiredGenericCast = getGenericCast ( this . otherBindings == null ? <NUM_LIT:0> : this . otherBindings . length ) ; if ( valueRequired || ( ! isFirst && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ) || ( ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) || requiredGenericCast != null ) { int lastFieldPc = codeStream . position ; if ( lastFieldBinding . declaringClass == null ) { codeStream . arraylength ( ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { codeStream . pop ( ) ; } } else { codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; if ( requiredGenericCast != null ) codeStream . checkcast ( requiredGenericCast ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( isUnboxing ) codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( isUnboxing ? postConversionType ( currentScope ) . id : lastFieldBinding . type . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } } int fieldPosition = ( int ) ( this . sourcePositions [ this . sourcePositions . length - <NUM_LIT:1> ] > > > <NUM_LIT:32> ) ; codeStream . recordPositionsFrom ( lastFieldPc , fieldPosition ) ; } else { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generateAssignment ( currentScope , codeStream , assignment , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; codeStream . generateEmulationForField ( lastFieldBinding ) ; codeStream . swap ( ) ; assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { switch ( lastFieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( lastFieldBinding ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generateCompoundAssignment ( currentScope , codeStream , expression , operator , assignmentImplicitConversion , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . generateEmulationForField ( lastFieldBinding ) ; codeStream . swap ( ) ; codeStream . aconst_null ( ) ; codeStream . swap ( ) ; codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } else { codeStream . generateEmulationForField ( lastFieldBinding ) ; codeStream . swap ( ) ; codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } int operationTypeID ; if ( ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_JavaLangString ) { codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; } else { codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } if ( valueRequired ) { switch ( lastFieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( lastFieldBinding ) ; } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { FieldBinding lastFieldBinding = this . otherBindings == null ? ( FieldBinding ) this . binding : this . otherBindings [ this . otherBindings . length - <NUM_LIT:1> ] ; if ( lastFieldBinding . canBeSeenBy ( getFinalReceiverType ( ) , this , currentScope ) ) { super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; return ; } lastFieldBinding = generateReadSequence ( currentScope , codeStream ) ; codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; if ( valueRequired ) { switch ( lastFieldBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2 ( ) ; break ; default : codeStream . dup ( ) ; break ; } } codeStream . generateEmulationForField ( lastFieldBinding ) ; if ( ( lastFieldBinding . type == TypeBinding . LONG ) || ( lastFieldBinding . type == TypeBinding . DOUBLE ) ) { codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReadSequence ( currentScope , codeStream ) ; } codeStream . dup_x2 ( ) ; codeStream . pop ( ) ; } else { codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } else { generateReadSequence ( currentScope , codeStream ) ; } codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; } codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , lastFieldBinding . type . id ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; codeStream . generateEmulatedWriteAccessForField ( lastFieldBinding ) ; } public FieldBinding generateReadSequence ( BlockScope currentScope , CodeStream codeStream ) { int otherBindingsCount = this . otherBindings == null ? <NUM_LIT:0> : this . otherBindings . length ; boolean needValue = otherBindingsCount == <NUM_LIT:0> || ! this . otherBindings [ <NUM_LIT:0> ] . isStatic ( ) ; FieldBinding lastFieldBinding ; TypeBinding lastGenericCast ; TypeBinding lastReceiverType ; boolean complyTo14 = currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_4 ; switch ( this . bits & RestrictiveFlagMASK ) { case Binding . FIELD : lastFieldBinding = ( ( FieldBinding ) this . binding ) . original ( ) ; lastGenericCast = this . genericCast ; lastReceiverType = this . actualReceiverType ; if ( lastFieldBinding . constant ( ) != Constant . NotAConstant ) { break ; } if ( needValue ) { if ( lastFieldBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { if ( ! lastFieldBinding . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] emulationPath = currentScope . getEmulationPath ( targetType , true , false ) ; codeStream . generateOuterAccess ( emulationPath , this , targetType , currentScope ) ; } else { generateReceiver ( codeStream ) ; } } } else { if ( ! lastFieldBinding . isStatic ( ) ) { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { generateReceiver ( codeStream ) ; } } else { codeStream . aconst_null ( ) ; } } } break ; case Binding . LOCAL : lastFieldBinding = null ; lastGenericCast = null ; LocalVariableBinding localBinding = ( LocalVariableBinding ) this . binding ; lastReceiverType = localBinding . type ; if ( ! needValue ) break ; Constant localConstant = localBinding . constant ( ) ; if ( localConstant != Constant . NotAConstant ) { codeStream . generateConstant ( localConstant , <NUM_LIT:0> ) ; } else { if ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) { VariableBinding [ ] path = currentScope . getEmulationPath ( localBinding ) ; codeStream . generateOuterAccess ( path , this , localBinding , currentScope ) ; } else { codeStream . load ( localBinding ) ; } } break ; default : return null ; } int positionsLength = this . sourcePositions . length ; FieldBinding initialFieldBinding = lastFieldBinding ; if ( this . otherBindings != null ) { for ( int i = <NUM_LIT:0> ; i < otherBindingsCount ; i ++ ) { int pc = codeStream . position ; FieldBinding nextField = this . otherBindings [ i ] . original ( ) ; TypeBinding nextGenericCast = this . otherGenericCasts == null ? null : this . otherGenericCasts [ i ] ; if ( lastFieldBinding != null ) { needValue = ! nextField . isStatic ( ) ; Constant fieldConstant = lastFieldBinding . constant ( ) ; if ( fieldConstant != Constant . NotAConstant ) { if ( i > <NUM_LIT:0> && ! lastFieldBinding . isStatic ( ) ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } if ( needValue ) { codeStream . generateConstant ( fieldConstant , <NUM_LIT:0> ) ; } } else { if ( needValue || ( i > <NUM_LIT:0> && complyTo14 ) || lastGenericCast != null ) { if ( lastFieldBinding . canBeSeenBy ( lastReceiverType , this , currentScope ) ) { MethodBinding accessor = this . syntheticReadAccessors == null ? null : this . syntheticReadAccessors [ i ] ; if ( accessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , lastFieldBinding , lastReceiverType , i == <NUM_LIT:0> && this . indexOfFirstFieldBinding == <NUM_LIT:1> ) ; if ( lastFieldBinding . isStatic ( ) ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , lastFieldBinding , constantPoolDeclaringClass ) ; } else { codeStream . fieldAccess ( Opcodes . OPC_getfield , lastFieldBinding , constantPoolDeclaringClass ) ; } } else { codeStream . invoke ( Opcodes . OPC_invokestatic , accessor , null ) ; } } else { codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } if ( lastGenericCast != null ) { codeStream . checkcast ( lastGenericCast ) ; lastReceiverType = lastGenericCast ; } else { lastReceiverType = lastFieldBinding . type ; } if ( ! needValue ) codeStream . pop ( ) ; } else { if ( lastFieldBinding == initialFieldBinding ) { if ( lastFieldBinding . isStatic ( ) ) { if ( initialFieldBinding . declaringClass != this . actualReceiverType . erasure ( ) ) { if ( lastFieldBinding . canBeSeenBy ( lastReceiverType , this , currentScope ) ) { MethodBinding accessor = this . syntheticReadAccessors == null ? null : this . syntheticReadAccessors [ i ] ; if ( accessor == null ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , lastFieldBinding , lastReceiverType , i == <NUM_LIT:0> && this . indexOfFirstFieldBinding == <NUM_LIT:1> ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , lastFieldBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokestatic , accessor , null ) ; } } else { codeStream . generateEmulatedReadAccessForField ( lastFieldBinding ) ; } codeStream . pop ( ) ; } } } else if ( ! lastFieldBinding . isStatic ( ) ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } lastReceiverType = lastFieldBinding . type ; } if ( ( positionsLength - otherBindingsCount + i - <NUM_LIT:1> ) >= <NUM_LIT:0> ) { int fieldPosition = ( int ) ( this . sourcePositions [ positionsLength - otherBindingsCount + i - <NUM_LIT:1> ] > > > <NUM_LIT:32> ) ; codeStream . recordPositionsFrom ( pc , fieldPosition ) ; } } } lastFieldBinding = nextField ; lastGenericCast = nextGenericCast ; if ( lastFieldBinding != null && ! lastFieldBinding . canBeSeenBy ( lastReceiverType , this , currentScope ) ) { if ( lastFieldBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } } } } return lastFieldBinding ; } public void generateReceiver ( CodeStream codeStream ) { codeStream . aload_0 ( ) ; if ( this . delegateThis != null ) { codeStream . fieldAccess ( Opcodes . OPC_getfield , this . delegateThis , null ) ; } } public TypeBinding getOtherFieldBindings ( BlockScope scope ) { int length = this . tokens . length ; if ( ( this . bits & Binding . FIELD ) != <NUM_LIT:0> ) { if ( ! ( ( FieldBinding ) this . binding ) . isStatic ( ) ) { if ( this . indexOfFirstFieldBinding == <NUM_LIT:1> ) { if ( scope . methodScope ( ) . isStatic ) { scope . problemReporter ( ) . staticFieldAccessToNonStaticVariable ( this , ( FieldBinding ) this . binding ) ; return null ; } } else { scope . problemReporter ( ) . staticFieldAccessToNonStaticVariable ( this , ( FieldBinding ) this . binding ) ; return null ; } } if ( isFieldUseDeprecated ( ( FieldBinding ) this . binding , scope , this . indexOfFirstFieldBinding == length ? this . bits : <NUM_LIT:0> ) ) { scope . problemReporter ( ) . deprecatedField ( ( FieldBinding ) this . binding , this ) ; } } TypeBinding type = ( ( VariableBinding ) this . binding ) . type ; int index = this . indexOfFirstFieldBinding ; if ( index == length ) { this . constant = ( ( FieldBinding ) this . binding ) . constant ( ) ; return type ; } int otherBindingsLength = length - index ; this . otherBindings = new FieldBinding [ otherBindingsLength ] ; this . constant = ( ( VariableBinding ) this . binding ) . constant ( ) ; while ( index < length ) { char [ ] token = this . tokens [ index ] ; if ( type == null ) return null ; FieldBinding field = scope . getField ( type , token , this ) ; int place = index - this . indexOfFirstFieldBinding ; this . otherBindings [ place ] = field ; if ( ! field . isValidBinding ( ) ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; if ( this . delegateThis == null ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { return super . reportError ( scope ) ; } this . actualReceiverType = this . delegateThis . type ; } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , field , index , type ) ; return null ; } } field = localScope . getFieldForCodeSnippet ( this . delegateThis . type , token , this ) ; this . otherBindings [ place ] = field ; } if ( field . isValidBinding ( ) ) { if ( isFieldUseDeprecated ( field , scope , index + <NUM_LIT:1> == length ? this . bits : <NUM_LIT:0> ) ) { scope . problemReporter ( ) . deprecatedField ( field , this ) ; } if ( this . constant != Constant . NotAConstant ) { this . constant = field . constant ( ) ; } type = field . type ; index ++ ; } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , field , index , type ) ; return null ; } } return ( this . otherBindings [ otherBindingsLength - <NUM_LIT:1> ] ) . type ; } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FieldBinding fieldBinding , int index , FlowInfo flowInfo ) { } public TypeBinding reportError ( BlockScope scope ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { return super . reportError ( scope ) ; } this . actualReceiverType = this . delegateThis . type ; } else { return super . reportError ( scope ) ; } if ( ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotFound ) || ( this . binding instanceof ProblemBinding && ( ( ProblemBinding ) this . binding ) . problemId ( ) == NotFound ) ) { FieldBinding fieldBinding = scope . getField ( this . delegateThis . type , this . tokens [ <NUM_LIT:0> ] , this ) ; if ( ! fieldBinding . isValidBinding ( ) ) { if ( ( ( ProblemFieldBinding ) fieldBinding ) . problemId ( ) == NotVisible ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . binding = localScope . getFieldForCodeSnippet ( this . delegateThis . type , this . tokens [ <NUM_LIT:0> ] , this ) ; if ( this . binding . isValidBinding ( ) ) { return checkFieldAccess ( scope ) ; } else { return super . reportError ( scope ) ; } } else { return super . reportError ( scope ) ; } } this . binding = fieldBinding ; return checkFieldAccess ( scope ) ; } TypeBinding result ; if ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotVisible ) { CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; if ( ( this . binding = localScope . getBinding ( this . tokens , this . bits & RestrictiveFlagMASK , this , ( ReferenceBinding ) this . delegateThis . type ) ) . isValidBinding ( ) ) { this . bits &= ~ RestrictiveFlagMASK ; this . bits |= Binding . FIELD ; result = getOtherFieldBindings ( scope ) ; } else { return super . reportError ( scope ) ; } if ( result != null && result . isValidBinding ( ) ) { return result ; } } return super . reportError ( scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . FieldReference ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class CodeSnippetFieldReference extends FieldReference implements ProblemReasons , EvaluationConstants { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetFieldReference ( char [ ] source , long pos , EvaluationContext evaluationContext ) { super ( source , pos ) ; this . evaluationContext = evaluationContext ; } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { FieldBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { this . receiver . generateCode ( currentScope , codeStream , ! codegenBinding . isStatic ( ) ) ; assignment . expression . generateCode ( currentScope , codeStream , true ) ; fieldStore ( currentScope , codeStream , codegenBinding , null , this . actualReceiverType , this . receiver . isImplicitThis ( ) , valueRequired ) ; } else { codeStream . generateEmulationForField ( codegenBinding ) ; this . receiver . generateCode ( currentScope , codeStream , ! codegenBinding . isStatic ( ) ) ; if ( codegenBinding . isStatic ( ) ) { codeStream . aconst_null ( ) ; } assignment . expression . generateCode ( currentScope , codeStream , true ) ; if ( valueRequired ) { switch ( codegenBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup_x2 ( ) ; break ; } } codeStream . generateEmulatedWriteAccessForField ( codegenBinding ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( assignment . implicitConversion ) ; } } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( this . constant != Constant . NotAConstant ) { if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } } else { FieldBinding codegenBinding = this . binding . original ( ) ; boolean isStatic = codegenBinding . isStatic ( ) ; this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( valueRequired ) { Constant fieldConstant = codegenBinding . constant ( ) ; if ( fieldConstant == Constant . NotAConstant ) { if ( codegenBinding . declaringClass == null ) { codeStream . arraylength ( ) ; } else { if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; if ( isStatic ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenBinding , constantPoolDeclaringClass ) ; } } else { if ( isStatic ) { codeStream . aconst_null ( ) ; } codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; } } codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } codeStream . generateConstant ( fieldConstant , this . implicitConversion ) ; } } else { if ( ! isStatic ) { codeStream . invokeObjectGetClass ( ) ; codeStream . pop ( ) ; } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { boolean isStatic ; FieldBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; if ( isStatic ) { codeStream . fieldAccess ( Opcodes . OPC_getstatic , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . dup ( ) ; codeStream . fieldAccess ( Opcodes . OPC_getfield , codegenBinding , constantPoolDeclaringClass ) ; } int operationTypeID ; switch ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) { case T_JavaLangString : case T_JavaLangObject : case T_undefined : codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; break ; default : codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } fieldStore ( currentScope , codeStream , codegenBinding , null , this . actualReceiverType , this . receiver . isImplicitThis ( ) , valueRequired ) ; } else { this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; if ( isStatic ) { codeStream . generateEmulationForField ( codegenBinding ) ; codeStream . aconst_null ( ) ; codeStream . aconst_null ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; } else { codeStream . generateEmulationForField ( this . binding ) ; this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; } int operationTypeID ; if ( ( operationTypeID = ( this . implicitConversion & IMPLICIT_CONVERSION_MASK ) > > <NUM_LIT:4> ) == T_JavaLangString ) { codeStream . generateStringConcatenationAppend ( currentScope , null , expression ) ; } else { codeStream . generateImplicitConversion ( this . implicitConversion ) ; if ( expression == IntLiteral . One ) { codeStream . generateConstant ( expression . constant , this . implicitConversion ) ; } else { expression . generateCode ( currentScope , codeStream , true ) ; } codeStream . sendOperator ( operator , operationTypeID ) ; codeStream . generateImplicitConversion ( assignmentImplicitConversion ) ; } if ( valueRequired ) { if ( ( codegenBinding . type == TypeBinding . LONG ) || ( codegenBinding . type == TypeBinding . DOUBLE ) ) { codeStream . dup2_x2 ( ) ; } else { codeStream . dup_x2 ( ) ; } } codeStream . generateEmulatedWriteAccessForField ( codegenBinding ) ; } } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { boolean isStatic ; FieldBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { super . generatePostIncrement ( currentScope , codeStream , postIncrement , valueRequired ) ; } else { this . receiver . generateCode ( currentScope , codeStream , ! ( isStatic = codegenBinding . isStatic ( ) ) ) ; if ( isStatic ) { codeStream . aconst_null ( ) ; } codeStream . dup ( ) ; codeStream . generateEmulatedReadAccessForField ( codegenBinding ) ; int typeID ; switch ( typeID = codegenBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : if ( valueRequired ) { codeStream . dup2_x1 ( ) ; } codeStream . dup2_x1 ( ) ; codeStream . pop2 ( ) ; break ; default : if ( valueRequired ) { codeStream . dup_x1 ( ) ; } codeStream . dup_x1 ( ) ; codeStream . pop ( ) ; break ; } codeStream . generateEmulationForField ( codegenBinding ) ; codeStream . swap ( ) ; switch ( typeID ) { case TypeIds . T_long : case TypeIds . T_double : codeStream . dup2_x2 ( ) ; break ; default : codeStream . dup2_x1 ( ) ; break ; } codeStream . pop2 ( ) ; codeStream . generateConstant ( postIncrement . expression . constant , this . implicitConversion ) ; codeStream . sendOperator ( postIncrement . operator , codegenBinding . type . id ) ; codeStream . generateImplicitConversion ( postIncrement . preAssignImplicitConversion ) ; codeStream . generateEmulatedWriteAccessForField ( codegenBinding ) ; } } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo , boolean isReadAccess ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) return ; } public TypeBinding resolveType ( BlockScope scope ) { this . actualReceiverType = this . receiver . resolveType ( scope ) ; if ( this . actualReceiverType == null ) { this . constant = Constant . NotAConstant ; return null ; } this . binding = scope . getField ( this . actualReceiverType , this . token , this ) ; FieldBinding firstAttempt = this . binding ; boolean isNotVisible = false ; if ( ! this . binding . isValidBinding ( ) ) { if ( this . binding instanceof ProblemFieldBinding && ( ( ProblemFieldBinding ) this . binding ) . problemId ( ) == NotVisible ) { isNotVisible = true ; if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; return null ; } this . actualReceiverType = this . delegateThis . type ; } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; return null ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . binding = localScope . getFieldForCodeSnippet ( this . delegateThis . type , this . token , this ) ; } } if ( ! this . binding . isValidBinding ( ) ) { this . constant = Constant . NotAConstant ; if ( isNotVisible ) { this . binding = firstAttempt ; } scope . problemReporter ( ) . invalidField ( this , this . actualReceiverType ) ; return null ; } if ( isFieldUseDeprecated ( this . binding , scope , this . bits ) ) { scope . problemReporter ( ) . deprecatedField ( this . binding , this ) ; } this . constant = this . receiver . isImplicitThis ( ) ? this . binding . constant ( ) : Constant . NotAConstant ; if ( ! this . receiver . isThis ( ) ) { this . constant = Constant . NotAConstant ; } return this . resolvedType = this . binding . type ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . NameReference ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; public class CodeSnippetMessageSend extends MessageSend { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetMessageSend ( EvaluationContext evaluationContext ) { this . evaluationContext = evaluationContext ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding . canBeSeenBy ( this . actualReceiverType , this , currentScope ) ) { boolean isStatic = codegenBinding . isStatic ( ) ; if ( ! isStatic && ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) ) { ReferenceBinding targetType = currentScope . enclosingSourceType ( ) . enclosingTypeAt ( ( this . bits & DepthMASK ) > > DepthSHIFT ) ; Object [ ] path = currentScope . getEmulationPath ( targetType , true , false ) ; if ( path == null ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { codeStream . generateOuterAccess ( path , this , targetType , currentScope ) ; } } else { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ( this . bits & NeedReceiverGenericCast ) != <NUM_LIT:0> ) { codeStream . checkcast ( this . actualReceiverType ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } generateArguments ( this . binding , this . arguments , currentScope , codeStream ) ; TypeBinding constantPoolDeclaringClass = CodeStream . getConstantPoolDeclaringClass ( currentScope , codegenBinding , this . actualReceiverType , this . receiver . isImplicitThis ( ) ) ; if ( isStatic ) { codeStream . invoke ( Opcodes . OPC_invokestatic , codegenBinding , constantPoolDeclaringClass ) ; } else if ( ( this . receiver . isSuper ( ) ) || codegenBinding . isPrivate ( ) ) { codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , constantPoolDeclaringClass ) ; } else { if ( constantPoolDeclaringClass . isInterface ( ) ) { codeStream . invoke ( Opcodes . OPC_invokeinterface , codegenBinding , constantPoolDeclaringClass ) ; } else { codeStream . invoke ( Opcodes . OPC_invokevirtual , codegenBinding , constantPoolDeclaringClass ) ; } } } else { codeStream . generateEmulationForMethod ( currentScope , codegenBinding ) ; boolean isStatic = codegenBinding . isStatic ( ) ; if ( ! isStatic && ( ( this . bits & DepthMASK ) != <NUM_LIT:0> ) ) { currentScope . problemReporter ( ) . needImplementation ( this ) ; } else { this . receiver . generateCode ( currentScope , codeStream , ! isStatic ) ; if ( ( this . bits & NeedReceiverGenericCast ) != <NUM_LIT:0> ) { codeStream . checkcast ( this . actualReceiverType ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } if ( isStatic ) { codeStream . aconst_null ( ) ; } if ( this . arguments != null ) { int argsLength = this . arguments . length ; codeStream . generateInlinedValue ( argsLength ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; codeStream . dup ( ) ; for ( int i = <NUM_LIT:0> ; i < argsLength ; i ++ ) { codeStream . generateInlinedValue ( i ) ; this . arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; TypeBinding parameterBinding = codegenBinding . parameters [ i ] ; if ( parameterBinding . isBaseType ( ) && parameterBinding != TypeBinding . NULL ) { codeStream . generateBoxingConversion ( codegenBinding . parameters [ i ] . id ) ; } codeStream . aastore ( ) ; if ( i < argsLength - <NUM_LIT:1> ) { codeStream . dup ( ) ; } } } else { codeStream . generateInlinedValue ( <NUM_LIT:0> ) ; codeStream . newArray ( currentScope . createArrayType ( currentScope . getType ( TypeConstants . JAVA_LANG_OBJECT , <NUM_LIT:3> ) , <NUM_LIT:1> ) ) ; } codeStream . invokeJavaLangReflectMethodInvoke ( ) ; if ( codegenBinding . returnType . isBaseType ( ) ) { int typeID = codegenBinding . returnType . id ; if ( typeID == T_void ) { codeStream . pop ( ) ; } codeStream . checkcast ( typeID ) ; codeStream . getBaseTypeValue ( typeID ) ; } else { codeStream . checkcast ( codegenBinding . returnType ) ; } } if ( this . valueCast != null ) codeStream . checkcast ( this . valueCast ) ; if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else { boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( isUnboxing ) codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( isUnboxing ? postConversionType ( currentScope ) . id : codegenBinding . returnType . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; case T_void : break ; default : codeStream . pop ( ) ; } } codeStream . recordPositionsFrom ( pc , ( int ) ( this . nameSourcePosition > > > <NUM_LIT:32> ) ) ; } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { MethodBinding codegenBinding = this . binding . original ( ) ; if ( codegenBinding != this . binding ) { if ( codegenBinding . returnType . isTypeVariable ( ) ) { TypeVariableBinding variableReturnType = ( TypeVariableBinding ) codegenBinding . returnType ; if ( variableReturnType . firstBound != this . binding . returnType ) { this . valueCast = this . binding . returnType ; } } } } } public TypeBinding resolveType ( BlockScope scope ) { this . constant = Constant . NotAConstant ; boolean receiverCast = false , argsContainCast = false ; if ( this . receiver instanceof CastExpression ) { this . receiver . bits |= DisableUnnecessaryCastCheck ; receiverCast = true ; } this . actualReceiverType = this . receiver . resolveType ( scope ) ; if ( receiverCast && this . actualReceiverType != null ) { if ( ( ( CastExpression ) this . receiver ) . expression . resolvedType == this . actualReceiverType ) { scope . problemReporter ( ) . unnecessaryCast ( ( CastExpression ) this . receiver ) ; } } if ( this . typeArguments != null ) { int length = this . typeArguments . length ; boolean argHasError = false ; this . genericTypeArguments = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ( this . genericTypeArguments [ i ] = this . typeArguments [ i ] . resolveType ( scope , true ) ) == null ) { argHasError = true ; } } if ( argHasError ) { return null ; } } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; if ( this . arguments != null ) { boolean argHasError = false ; int length = this . arguments . length ; argumentTypes = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression argument = this . arguments [ i ] ; if ( argument instanceof CastExpression ) { argument . bits |= DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = this . arguments [ i ] . resolveType ( scope ) ) == null ) argHasError = true ; } if ( argHasError ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding = scope . findMethod ( ( ReferenceBinding ) this . actualReceiverType , this . selector , new TypeBinding [ ] { } , this ) ; } return null ; } } if ( this . actualReceiverType == null ) { return null ; } if ( this . actualReceiverType . isBaseType ( ) ) { scope . problemReporter ( ) . errorNoMethodFor ( this , this . actualReceiverType , argumentTypes ) ; return null ; } this . binding = this . receiver . isImplicitThis ( ) ? scope . getImplicitMethod ( this . selector , argumentTypes , this ) : scope . getMethod ( this . actualReceiverType , this . selector , argumentTypes , this ) ; if ( ! this . binding . isValidBinding ( ) ) { if ( this . binding instanceof ProblemMethodBinding && ( ( ProblemMethodBinding ) this . binding ) . problemId ( ) == ProblemReasons . NotVisible ) { if ( this . evaluationContext . declaringTypeName != null ) { this . delegateThis = scope . getField ( scope . enclosingSourceType ( ) , EvaluationConstants . DELEGATE_THIS , this ) ; if ( this . delegateThis == null ) { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } } else { this . constant = Constant . NotAConstant ; scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; MethodBinding privateBinding = this . receiver instanceof CodeSnippetThisReference && ( ( CodeSnippetThisReference ) this . receiver ) . isImplicit ? localScope . getImplicitMethod ( ( ReferenceBinding ) this . delegateThis . type , this . selector , argumentTypes , this ) : localScope . getMethod ( this . delegateThis . type , this . selector , argumentTypes , this ) ; if ( ! privateBinding . isValidBinding ( ) ) { if ( this . binding . declaringClass == null ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding . declaringClass = ( ReferenceBinding ) this . actualReceiverType ; } else { scope . problemReporter ( ) . errorNoMethodFor ( this , this . actualReceiverType , argumentTypes ) ; return null ; } } scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } else { this . binding = privateBinding ; } } else { if ( this . binding . declaringClass == null ) { if ( this . actualReceiverType instanceof ReferenceBinding ) { this . binding . declaringClass = ( ReferenceBinding ) this . actualReceiverType ; } else { scope . problemReporter ( ) . errorNoMethodFor ( this , this . actualReceiverType , argumentTypes ) ; return null ; } } scope . problemReporter ( ) . invalidMethod ( this , this . binding ) ; return null ; } } if ( ! this . binding . isStatic ( ) ) { if ( this . receiver instanceof NameReference && ( ( ( NameReference ) this . receiver ) . bits & Binding . TYPE ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . mustUseAStaticMethod ( this , this . binding ) ; } else { TypeBinding oldReceiverType = this . actualReceiverType ; this . actualReceiverType = this . actualReceiverType . getErasureCompatibleType ( this . binding . declaringClass ) ; this . receiver . computeConversion ( scope , this . actualReceiverType , this . actualReceiverType ) ; if ( this . actualReceiverType != oldReceiverType && this . receiver . postConversionType ( scope ) != this . actualReceiverType ) { this . bits |= NeedReceiverGenericCast ; } } } if ( checkInvocationArguments ( scope , this . receiver , this . actualReceiverType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } if ( this . binding . isAbstract ( ) ) { if ( this . receiver . isSuper ( ) ) { scope . problemReporter ( ) . cannotDireclyInvokeAbstractMethod ( this , this . binding ) ; } } if ( isMethodUseDeprecated ( this . binding , scope , true ) ) scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; if ( this . actualReceiverType . isArrayType ( ) && this . binding . parameters == Binding . NO_PARAMETERS && scope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_5 && CharOperation . equals ( this . binding . selector , CLONE ) ) { this . resolvedType = this . actualReceiverType ; } else { TypeBinding returnType = this . binding . returnType ; if ( returnType != null ) { if ( ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) { returnType = scope . environment ( ) . convertToRawType ( returnType . erasure ( ) , true ) ; } returnType = returnType . capture ( scope , this . sourceEnd ) ; } this . resolvedType = returnType ; } return this . resolvedType ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; public class GlobalVariable { char [ ] typeName ; char [ ] name ; char [ ] initializer ; int declarationStart = - <NUM_LIT:1> , initializerStart = - <NUM_LIT:1> , initExpressionStart ; int initializerLineStart = - <NUM_LIT:1> ; public GlobalVariable ( char [ ] typeName , char [ ] name , char [ ] initializer ) { this . typeName = typeName ; this . name = name ; this . initializer = initializer ; } public char [ ] getInitializer ( ) { return this . initializer ; } public char [ ] getName ( ) { return this . name ; } public char [ ] getTypeName ( ) { return this . typeName ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( this . typeName ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; buffer . append ( this . name ) ; if ( this . initializer != null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . initializer ) ; } buffer . append ( "<STR_LIT:;>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; public class InstallException extends Exception { private static final long serialVersionUID = - <NUM_LIT> ; public InstallException ( ) { super ( ) ; } public InstallException ( String s ) { super ( s ) ; } } </s>
<s> package org . eclipse . jdt . internal . eval ; import java . util . Locale ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . CompletionRequestor ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . codeassist . CompletionEngine ; import org . eclipse . jdt . internal . codeassist . ISelectionRequestor ; import org . eclipse . jdt . internal . codeassist . SelectionEngine ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . SearchableEnvironment ; import org . eclipse . jdt . internal . core . util . Util ; public class EvaluationContext implements EvaluationConstants , SuffixConstants { static int VAR_CLASS_COUNTER = <NUM_LIT:0> ; static int CODE_SNIPPET_COUNTER = <NUM_LIT:0> ; GlobalVariable [ ] variables ; int variableCount ; char [ ] [ ] imports ; char [ ] packageName ; boolean varsChanged ; VariablesInfo installedVars ; IBinaryType codeSnippetBinary ; String lineSeparator ; char [ ] declaringTypeName ; int [ ] localVariableModifiers ; char [ ] [ ] localVariableTypeNames ; char [ ] [ ] localVariableNames ; boolean isStatic ; boolean isConstructorCall ; public EvaluationContext ( ) { this . variables = new GlobalVariable [ <NUM_LIT:5> ] ; this . variableCount = <NUM_LIT:0> ; this . imports = CharOperation . NO_CHAR_CHAR ; this . packageName = CharOperation . NO_CHAR ; this . varsChanged = true ; this . isStatic = true ; this . isConstructorCall = false ; this . lineSeparator = org . eclipse . jdt . internal . compiler . util . Util . LINE_SEPARATOR ; } public GlobalVariable [ ] allVariables ( ) { GlobalVariable [ ] result = new GlobalVariable [ this . variableCount ] ; System . arraycopy ( this . variables , <NUM_LIT:0> , result , <NUM_LIT:0> , this . variableCount ) ; return result ; } public void complete ( char [ ] codeSnippet , int completionPosition , SearchableEnvironment environment , CompletionRequestor requestor , Map options , final IJavaProject project , WorkingCopyOwner owner , IProgressMonitor monitor ) { try { IRequestor variableRequestor = new IRequestor ( ) { public boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) { return true ; } public void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) { } } ; evaluateVariables ( environment , options , variableRequestor , new DefaultProblemFactory ( Locale . getDefault ( ) ) ) ; } catch ( InstallException e ) { } final char [ ] className = "<STR_LIT>" . toCharArray ( ) ; final long complianceVersion = CompilerOptions . versionToJdkLevel ( options . get ( JavaCore . COMPILER_COMPLIANCE ) ) ; final CodeSnippetToCuMapper mapper = new CodeSnippetToCuMapper ( codeSnippet , this . packageName , this . imports , className , this . installedVars == null ? null : this . installedVars . className , this . localVariableNames , this . localVariableTypeNames , this . localVariableModifiers , this . declaringTypeName , this . lineSeparator , complianceVersion ) ; ICompilationUnit sourceUnit = new ICompilationUnit ( ) { public char [ ] getFileName ( ) { return CharOperation . concat ( className , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getContents ( ) { return mapper . getCUSource ( EvaluationContext . this . lineSeparator ) ; } public char [ ] getMainTypeName ( ) { return className ; } public char [ ] [ ] getPackageName ( ) { return null ; } public boolean ignoreOptionalProblems ( ) { return false ; } } ; CompletionEngine engine = new CompletionEngine ( environment , mapper . getCompletionRequestor ( requestor ) , options , project , owner , monitor ) ; if ( this . installedVars != null ) { IBinaryType binaryType = getRootCodeSnippetBinary ( ) ; if ( binaryType != null ) { engine . lookupEnvironment . cacheBinaryType ( binaryType , null ) ; } ClassFile [ ] classFiles = this . installedVars . classFiles ; for ( int i = <NUM_LIT:0> ; i < classFiles . length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; IBinaryType binary = null ; try { binary = new ClassFileReader ( classFile . getBytes ( ) , null ) ; } catch ( ClassFormatException e ) { e . printStackTrace ( ) ; } engine . lookupEnvironment . cacheBinaryType ( binary , null ) ; } } engine . complete ( sourceUnit , mapper . startPosOffset + completionPosition , mapper . startPosOffset , null ) ; } public void deleteVariable ( GlobalVariable variable ) { GlobalVariable [ ] vars = this . variables ; int index = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < this . variableCount ; i ++ ) { if ( vars [ i ] . equals ( variable ) ) { index = i ; break ; } } if ( index == - <NUM_LIT:1> ) { return ; } int elementCount = this . variableCount -- ; int j = elementCount - index - <NUM_LIT:1> ; if ( j > <NUM_LIT:0> ) { System . arraycopy ( vars , index + <NUM_LIT:1> , vars , index , j ) ; } vars [ elementCount - <NUM_LIT:1> ] = null ; this . varsChanged = true ; } private void deployCodeSnippetClassIfNeeded ( IRequestor requestor ) throws InstallException { if ( this . codeSnippetBinary == null ) { if ( ! requestor . acceptClassFiles ( new ClassFile [ ] { new ClassFile ( ) { public byte [ ] getBytes ( ) { return getCodeSnippetBytes ( ) ; } public char [ ] [ ] getCompoundName ( ) { return EvaluationConstants . ROOT_COMPOUND_NAME ; } } } , null ) ) throw new InstallException ( ) ; } } public void evaluate ( char [ ] codeSnippet , char [ ] [ ] contextLocalVariableTypeNames , char [ ] [ ] contextLocalVariableNames , int [ ] contextLocalVariableModifiers , char [ ] contextDeclaringTypeName , boolean contextIsStatic , boolean contextIsConstructorCall , INameEnvironment environment , Map options , final IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { this . localVariableTypeNames = contextLocalVariableTypeNames ; this . localVariableNames = contextLocalVariableNames ; this . localVariableModifiers = contextLocalVariableModifiers ; this . declaringTypeName = contextDeclaringTypeName ; this . isStatic = contextIsStatic ; this . isConstructorCall = contextIsConstructorCall ; deployCodeSnippetClassIfNeeded ( requestor ) ; try { class ForwardingRequestor implements IRequestor { boolean hasErrors = false ; public boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) { return requestor . acceptClassFiles ( classFiles , codeSnippetClassName ) ; } public void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) { requestor . acceptProblem ( problem , fragmentSource , fragmentKind ) ; if ( problem . isError ( ) ) { this . hasErrors = true ; } } } ForwardingRequestor forwardingRequestor = new ForwardingRequestor ( ) ; if ( this . varsChanged ) { evaluateVariables ( environment , options , forwardingRequestor , problemFactory ) ; } if ( ! forwardingRequestor . hasErrors ) { Evaluator evaluator = new CodeSnippetEvaluator ( codeSnippet , this , environment , options , requestor , problemFactory ) ; ClassFile [ ] classes = evaluator . getClasses ( ) ; if ( classes != null && classes . length > <NUM_LIT:0> ) { char [ ] simpleClassName = evaluator . getClassName ( ) ; char [ ] pkgName = getPackageName ( ) ; char [ ] qualifiedClassName = pkgName . length == <NUM_LIT:0> ? simpleClassName : CharOperation . concat ( pkgName , simpleClassName , '<CHAR_LIT:.>' ) ; CODE_SNIPPET_COUNTER ++ ; if ( ! requestor . acceptClassFiles ( classes , qualifiedClassName ) ) throw new InstallException ( ) ; } } } finally { this . localVariableTypeNames = null ; this . localVariableNames = null ; this . localVariableModifiers = null ; this . declaringTypeName = null ; this . isStatic = true ; this . isConstructorCall = false ; } } public void evaluate ( char [ ] codeSnippet , INameEnvironment environment , Map options , final IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { this . evaluate ( codeSnippet , null , null , null , null , true , false , environment , options , requestor , problemFactory ) ; } public void evaluateImports ( INameEnvironment environment , IRequestor requestor , IProblemFactory problemFactory ) { for ( int i = <NUM_LIT:0> ; i < this . imports . length ; i ++ ) { CategorizedProblem [ ] problems = new CategorizedProblem [ ] { null } ; char [ ] importDeclaration = this . imports [ i ] ; char [ ] [ ] splitDeclaration = CharOperation . splitOn ( '<CHAR_LIT:.>' , importDeclaration ) ; int splitLength = splitDeclaration . length ; if ( splitLength > <NUM_LIT:0> ) { char [ ] pkgName = splitDeclaration [ splitLength - <NUM_LIT:1> ] ; if ( pkgName . length == <NUM_LIT:1> && pkgName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { char [ ] [ ] parentName ; switch ( splitLength ) { case <NUM_LIT:1> : parentName = null ; break ; case <NUM_LIT:2> : parentName = null ; pkgName = splitDeclaration [ splitLength - <NUM_LIT:2> ] ; break ; default : parentName = CharOperation . subarray ( splitDeclaration , <NUM_LIT:0> , splitLength - <NUM_LIT:2> ) ; pkgName = splitDeclaration [ splitLength - <NUM_LIT:2> ] ; } if ( ! environment . isPackage ( parentName , pkgName ) ) { String [ ] arguments = new String [ ] { new String ( importDeclaration ) } ; problems [ <NUM_LIT:0> ] = problemFactory . createProblem ( importDeclaration , IProblem . ImportNotFound , arguments , arguments , ProblemSeverities . Warning , <NUM_LIT:0> , importDeclaration . length - <NUM_LIT:1> , i , <NUM_LIT:0> ) ; } } else { if ( environment . findType ( splitDeclaration ) == null ) { String [ ] arguments = new String [ ] { new String ( importDeclaration ) } ; problems [ <NUM_LIT:0> ] = problemFactory . createProblem ( importDeclaration , IProblem . ImportNotFound , arguments , arguments , ProblemSeverities . Warning , <NUM_LIT:0> , importDeclaration . length - <NUM_LIT:1> , i , <NUM_LIT:0> ) ; } } } else { String [ ] arguments = new String [ ] { new String ( importDeclaration ) } ; problems [ <NUM_LIT:0> ] = problemFactory . createProblem ( importDeclaration , IProblem . ImportNotFound , arguments , arguments , ProblemSeverities . Warning , <NUM_LIT:0> , importDeclaration . length - <NUM_LIT:1> , i , <NUM_LIT:0> ) ; } if ( problems [ <NUM_LIT:0> ] != null ) { requestor . acceptProblem ( problems [ <NUM_LIT:0> ] , importDeclaration , EvaluationResult . T_IMPORT ) ; } } } public void evaluateVariable ( GlobalVariable variable , INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { this . evaluate ( variable . getName ( ) , environment , options , requestor , problemFactory ) ; } public void evaluateVariables ( INameEnvironment environment , Map options , IRequestor requestor , IProblemFactory problemFactory ) throws InstallException { deployCodeSnippetClassIfNeeded ( requestor ) ; VariablesEvaluator evaluator = new VariablesEvaluator ( this , environment , options , requestor , problemFactory ) ; ClassFile [ ] classes = evaluator . getClasses ( ) ; if ( classes != null ) { if ( classes . length > <NUM_LIT:0> ) { Util . sort ( classes , new Util . Comparer ( ) { public int compare ( Object a , Object b ) { if ( a == b ) return <NUM_LIT:0> ; ClassFile enclosing = ( ( ClassFile ) a ) . enclosingClassFile ; while ( enclosing != null ) { if ( enclosing == b ) return <NUM_LIT:1> ; enclosing = enclosing . enclosingClassFile ; } return - <NUM_LIT:1> ; } } ) ; if ( ! requestor . acceptClassFiles ( classes , null ) ) { throw new InstallException ( ) ; } int count = this . variableCount ; GlobalVariable [ ] variablesCopy = new GlobalVariable [ count ] ; System . arraycopy ( this . variables , <NUM_LIT:0> , variablesCopy , <NUM_LIT:0> , count ) ; this . installedVars = new VariablesInfo ( evaluator . getPackageName ( ) , evaluator . getClassName ( ) , classes , variablesCopy , count ) ; VAR_CLASS_COUNTER ++ ; } this . varsChanged = false ; } } byte [ ] getCodeSnippetBytes ( ) { return new byte [ ] { - <NUM_LIT> , - <NUM_LIT:2> , - <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:7> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT:0> , <NUM_LIT:12> , <NUM_LIT:10> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:20> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:7> , <NUM_LIT:0> , <NUM_LIT:8> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:8> , <NUM_LIT:0> , <NUM_LIT:9> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT:0> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:15> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:20> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:24> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:16> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:24> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:24> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:30> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:30> , <NUM_LIT:0> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:6> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:31> , <NUM_LIT:0> , <NUM_LIT:32> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:11> , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:24> , <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT> } ; } public static String getCodeSnippetSource ( ) { return "<STR_LIT>" + "<STR_LIT:n>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ; } public char [ ] [ ] getImports ( ) { return this . imports ; } public char [ ] getPackageName ( ) { return this . packageName ; } IBinaryType getRootCodeSnippetBinary ( ) { if ( this . codeSnippetBinary == null ) { this . codeSnippetBinary = new CodeSnippetSkeleton ( ) ; } return this . codeSnippetBinary ; } public char [ ] getVarClassName ( ) { if ( this . installedVars == null ) return CharOperation . NO_CHAR ; return CharOperation . concat ( this . installedVars . packageName , this . installedVars . className , '<CHAR_LIT:.>' ) ; } public GlobalVariable newVariable ( char [ ] typeName , char [ ] name , char [ ] initializer ) { GlobalVariable var = new GlobalVariable ( typeName , name , initializer ) ; if ( this . variableCount >= this . variables . length ) System . arraycopy ( this . variables , <NUM_LIT:0> , this . variables = new GlobalVariable [ this . variableCount * <NUM_LIT:2> ] , <NUM_LIT:0> , this . variableCount ) ; this . variables [ this . variableCount ++ ] = var ; this . varsChanged = true ; return var ; } public void select ( char [ ] codeSnippet , int selectionSourceStart , int selectionSourceEnd , SearchableEnvironment environment , ISelectionRequestor requestor , Map options , WorkingCopyOwner owner ) { final char [ ] className = "<STR_LIT>" . toCharArray ( ) ; final long complianceVersion = CompilerOptions . versionToJdkLevel ( options . get ( JavaCore . COMPILER_COMPLIANCE ) ) ; final CodeSnippetToCuMapper mapper = new CodeSnippetToCuMapper ( codeSnippet , this . packageName , this . imports , className , this . installedVars == null ? null : this . installedVars . className , this . localVariableNames , this . localVariableTypeNames , this . localVariableModifiers , this . declaringTypeName , this . lineSeparator , complianceVersion ) ; ICompilationUnit sourceUnit = new ICompilationUnit ( ) { public char [ ] getFileName ( ) { return CharOperation . concat ( className , Util . defaultJavaExtension ( ) . toCharArray ( ) ) ; } public char [ ] getContents ( ) { return mapper . getCUSource ( EvaluationContext . this . lineSeparator ) ; } public char [ ] getMainTypeName ( ) { return className ; } public char [ ] [ ] getPackageName ( ) { return null ; } public boolean ignoreOptionalProblems ( ) { return false ; } } ; SelectionEngine engine = new SelectionEngine ( environment , mapper . getSelectionRequestor ( requestor ) , options , owner ) ; engine . select ( sourceUnit , mapper . startPosOffset + selectionSourceStart , mapper . startPosOffset + selectionSourceEnd ) ; } public void setImports ( char [ ] [ ] imports ) { this . imports = imports ; this . varsChanged = true ; } public void setLineSeparator ( String lineSeparator ) { this . lineSeparator = lineSeparator ; } public void setPackageName ( char [ ] packageName ) { this . packageName = packageName ; this . varsChanged = true ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import org . eclipse . jdt . internal . compiler . parser . JavadocTagConstants ; public abstract class FormatJavadocNode implements JavadocTagConstants { final static int DEFAULT_ARRAY_SIZE = <NUM_LIT:10> ; final static int INCREMENT_ARRAY_SIZE = <NUM_LIT:10> ; protected int sourceStart , sourceEnd ; protected int lineStart ; protected int linesBefore = <NUM_LIT:0> ; public FormatJavadocNode ( int start , int end , int line ) { this . sourceStart = start ; this . sourceEnd = end ; this . lineStart = line ; } abstract void clean ( ) ; FormatJavadocNode getLastNode ( ) { return null ; } public int getLength ( ) { return this . sourceEnd - this . sourceStart + <NUM_LIT:1> ; } public boolean isText ( ) { return false ; } public boolean isImmutable ( ) { return false ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; toString ( buffer ) ; return buffer . toString ( ) ; } protected void toString ( StringBuffer buffer ) { buffer . append ( "<STR_LIT::U+0020>" ) ; buffer . append ( this . sourceStart ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . sourceEnd ) ; } public String toStringDebug ( char [ ] source ) { StringBuffer buffer = new StringBuffer ( ) ; toStringDebug ( buffer , source ) ; return buffer . toString ( ) ; } public void toStringDebug ( StringBuffer buffer , char [ ] source ) { buffer . append ( source , this . sourceStart , this . sourceEnd - this . sourceStart + <NUM_LIT:1> ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } void setHeaderLine ( int javadocLineStart ) { } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . formatter . comment . IJavaDocTagConstants ; public class FormatJavadocBlock extends FormatJavadocNode implements IJavaDocTagConstants { final static int INLINED = <NUM_LIT> ; final static int FIRST = <NUM_LIT> ; final static int ON_HEADER_LINE = <NUM_LIT> ; final static int TEXT_ON_TAG_LINE = <NUM_LIT> ; final static int ONE_LINE_TAG = <NUM_LIT> ; final static int PARAM_TAG = <NUM_LIT> ; final static int IN_PARAM_TAG = <NUM_LIT> ; final static int IN_DESCRIPTION = <NUM_LIT> ; final static int IMMUTABLE = <NUM_LIT> ; final static int MAX_TAG_HIERARCHY = <NUM_LIT:10> ; private int tagValue = NO_TAG_VALUE ; int tagEnd ; FormatJavadocReference reference ; FormatJavadocNode [ ] nodes ; int nodesPtr = - <NUM_LIT:1> ; int flags = <NUM_LIT:0> ; public FormatJavadocBlock ( int start , int end , int line , int value ) { super ( start , end , line ) ; this . tagValue = value ; this . tagEnd = end ; switch ( value ) { case TAG_PARAM_VALUE : case TAG_SERIAL_FIELD_VALUE : case TAG_THROWS_VALUE : case TAG_EXCEPTION_VALUE : this . flags |= PARAM_TAG ; break ; case TAG_CODE_VALUE : case TAG_LITERAL_VALUE : this . flags |= IMMUTABLE ; break ; } } private void addNode ( FormatJavadocNode node ) { if ( ++ this . nodesPtr == <NUM_LIT:0> ) { this . nodes = new FormatJavadocNode [ DEFAULT_ARRAY_SIZE ] ; } else if ( this . nodesPtr >= this . nodes . length ) { System . arraycopy ( this . nodes , <NUM_LIT:0> , this . nodes = new FormatJavadocNode [ this . nodes . length + INCREMENT_ARRAY_SIZE ] , <NUM_LIT:0> , this . nodesPtr ) ; } this . nodes [ this . nodesPtr ] = node ; this . sourceEnd = node . sourceEnd ; } void addBlock ( FormatJavadocBlock block , int htmlLevel ) { if ( this . nodes != null ) { FormatJavadocText [ ] textHierarchy = getTextHierarchy ( block , htmlLevel ) ; if ( textHierarchy != null ) { FormatJavadocText lastText = textHierarchy [ htmlLevel ] ; if ( lastText != null ) { lastText . appendNode ( block ) ; for ( int i = htmlLevel - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { textHierarchy [ i ] . sourceEnd = block . sourceEnd ; } this . sourceEnd = block . sourceEnd ; if ( isParamTag ( ) ) { block . flags |= IN_PARAM_TAG ; } else if ( isDescription ( ) ) { block . flags |= IN_DESCRIPTION ; } block . flags |= INLINED ; return ; } } } addNode ( block ) ; if ( isParamTag ( ) ) { block . flags |= IN_PARAM_TAG ; } else if ( isDescription ( ) ) { block . flags |= IN_DESCRIPTION ; } block . flags |= INLINED ; } void addText ( FormatJavadocText text ) { if ( this . nodes != null ) { FormatJavadocText [ ] textHierarchy = getTextHierarchy ( text , text . depth ) ; if ( textHierarchy != null ) { FormatJavadocText lastText = textHierarchy [ text . depth ] ; if ( lastText != null ) { lastText . appendText ( text ) ; for ( int i = text . depth - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { textHierarchy [ i ] . sourceEnd = text . sourceEnd ; } this . sourceEnd = text . sourceEnd ; return ; } if ( text . depth > <NUM_LIT:0> ) { FormatJavadocText parentText = textHierarchy [ text . depth - <NUM_LIT:1> ] ; if ( parentText != null ) { parentText . appendText ( text ) ; for ( int i = text . depth - <NUM_LIT:2> ; i >= <NUM_LIT:0> ; i -- ) { textHierarchy [ i ] . sourceEnd = text . sourceEnd ; } this . sourceEnd = text . sourceEnd ; return ; } } } } if ( text . isHtmlTag ( ) ) { switch ( text . getHtmlTagID ( ) ) { case JAVADOC_CODE_TAGS_ID : text . linesBefore = this . nodesPtr == - <NUM_LIT:1> ? <NUM_LIT:0> : <NUM_LIT:2> ; break ; case JAVADOC_SEPARATOR_TAGS_ID : text . linesBefore = <NUM_LIT:1> ; break ; } } addNode ( text ) ; if ( isImmutable ( ) ) { text . immutable = true ; } } void clean ( ) { int length = this . nodes == null ? <NUM_LIT:0> : this . nodes . length ; if ( this . nodesPtr != ( length - <NUM_LIT:1> ) ) { System . arraycopy ( this . nodes , <NUM_LIT:0> , this . nodes = new FormatJavadocNode [ this . nodesPtr + <NUM_LIT:1> ] , <NUM_LIT:0> , this . nodesPtr + <NUM_LIT:1> ) ; } for ( int i = <NUM_LIT:0> ; i <= this . nodesPtr ; i ++ ) { this . nodes [ i ] . clean ( ) ; } } FormatJavadocNode getLastNode ( ) { if ( this . nodes != null ) { return this . nodes [ this . nodesPtr ] ; } return null ; } FormatJavadocText [ ] getTextHierarchy ( FormatJavadocNode node , int htmlDepth ) { if ( this . nodes == null ) return null ; FormatJavadocText [ ] textHierarchy = null ; int ptr = <NUM_LIT:0> ; FormatJavadocText text = node . isText ( ) ? ( FormatJavadocText ) node : null ; FormatJavadocNode lastNode = this . nodes [ this . nodesPtr ] ; while ( lastNode . isText ( ) ) { FormatJavadocText lastText = ( FormatJavadocText ) lastNode ; int lastTagCategory = lastText . getHtmlTagID ( ) ; boolean lastSingleTag = lastTagCategory <= JAVADOC_SINGLE_TAGS_ID ; boolean lastTextCanHaveChildren = lastText . isHtmlTag ( ) && ! lastText . isClosingHtmlTag ( ) && ! lastSingleTag ; if ( lastText . depth == htmlDepth || lastText . htmlNodesPtr == - <NUM_LIT:1> ) { if ( lastText . isHtmlTag ( ) ) { boolean setLinesBefore = lastText . separatorsPtr == - <NUM_LIT:1> || ( ptr == <NUM_LIT:0> && lastText . isClosingHtmlTag ( ) ) ; if ( ! setLinesBefore && ptr > <NUM_LIT:0> && lastText . isClosingHtmlTag ( ) ) { FormatJavadocText parentText = textHierarchy [ ptr - <NUM_LIT:1> ] ; int textStart = ( int ) parentText . separators [ parentText . separatorsPtr ] ; if ( textStart < lastText . sourceStart ) { setLinesBefore = true ; } } if ( setLinesBefore ) { switch ( lastText . getHtmlTagID ( ) ) { case JAVADOC_CODE_TAGS_ID : if ( node . linesBefore < <NUM_LIT:2> ) { node . linesBefore = <NUM_LIT:2> ; } break ; case JAVADOC_SEPARATOR_TAGS_ID : case JAVADOC_SINGLE_BREAK_TAG_ID : if ( node . linesBefore < <NUM_LIT:1> ) { node . linesBefore = <NUM_LIT:1> ; } } } if ( text != null && text . isHtmlTag ( ) && ! text . isClosingHtmlTag ( ) && text . getHtmlTagIndex ( ) == lastText . getHtmlTagIndex ( ) && ! lastText . isClosingHtmlTag ( ) ) { lastText . closeTag ( ) ; return textHierarchy ; } } if ( lastTextCanHaveChildren || ( htmlDepth == <NUM_LIT:0> && ! lastText . isHtmlTag ( ) && text != null && ! text . isHtmlTag ( ) ) ) { if ( textHierarchy == null ) textHierarchy = new FormatJavadocText [ htmlDepth + <NUM_LIT:1> ] ; textHierarchy [ ptr ] = lastText ; return textHierarchy ; } return textHierarchy ; } if ( textHierarchy == null ) textHierarchy = new FormatJavadocText [ htmlDepth + <NUM_LIT:1> ] ; textHierarchy [ ptr ++ ] = lastText ; lastNode = lastText . htmlNodes [ lastText . htmlNodesPtr ] ; } return textHierarchy ; } public boolean hasTextOnTagLine ( ) { return ( this . flags & TEXT_ON_TAG_LINE ) != <NUM_LIT:0> ; } public boolean isDescription ( ) { return this . tagValue == NO_TAG_VALUE ; } public boolean isFirst ( ) { return ( this . flags & FIRST ) != <NUM_LIT:0> ; } public boolean isHeaderLine ( ) { return ( this . flags & ON_HEADER_LINE ) != <NUM_LIT:0> ; } public boolean isImmutable ( ) { return ( this . flags & IMMUTABLE ) == IMMUTABLE ; } public boolean isInDescription ( ) { return this . tagValue == NO_TAG_VALUE || ( this . flags & IN_DESCRIPTION ) == IN_DESCRIPTION ; } public boolean isInlined ( ) { return ( this . flags & INLINED ) != <NUM_LIT:0> ; } public boolean isInParamTag ( ) { return ( this . flags & ( PARAM_TAG | IN_PARAM_TAG ) ) != <NUM_LIT:0> ; } public boolean isOneLineTag ( ) { return ( this . flags & ONE_LINE_TAG ) != <NUM_LIT:0> ; } public boolean isParamTag ( ) { return ( this . flags & PARAM_TAG ) == PARAM_TAG ; } void setHeaderLine ( int javadocLineStart ) { if ( javadocLineStart == this . lineStart ) { this . flags |= ON_HEADER_LINE ; } for ( int i = <NUM_LIT:0> ; i < this . nodesPtr ; i ++ ) { this . nodes [ i ] . setHeaderLine ( javadocLineStart ) ; } } protected void toString ( StringBuffer buffer ) { boolean inlined = ( this . flags & INLINED ) != <NUM_LIT:0> ; if ( inlined ) buffer . append ( "<STR_LIT>" ) ; buffer . append ( '<CHAR_LIT>' ) ; if ( this . tagValue == TAG_OTHERS_VALUE ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( TAG_NAMES [ this . tagValue ] ) ; } super . toString ( buffer ) ; if ( this . reference == null ) { buffer . append ( '<STR_LIT:\n>' ) ; } else { buffer . append ( "<STR_LIT:U+0020(>" ) ; this . reference . toString ( buffer ) ; buffer . append ( "<STR_LIT>" ) ; } StringBuffer flagsBuffer = new StringBuffer ( ) ; if ( isDescription ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT:description>" ) ; } if ( isFirst ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isHeaderLine ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isImmutable ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isInDescription ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isInlined ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isInParamTag ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isOneLineTag ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( isParamTag ( ) ) { if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) flagsBuffer . append ( '<CHAR_LIT:U+002C>' ) ; flagsBuffer . append ( "<STR_LIT>" ) ; } if ( flagsBuffer . length ( ) > <NUM_LIT:0> ) { if ( inlined ) buffer . append ( '<STR_LIT:\t>' ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( flagsBuffer ) ; buffer . append ( '<STR_LIT:\n>' ) ; } if ( this . nodesPtr > - <NUM_LIT:1> ) { for ( int i = <NUM_LIT:0> ; i <= this . nodesPtr ; i ++ ) { if ( inlined ) buffer . append ( '<STR_LIT:\t>' ) ; this . nodes [ i ] . toString ( buffer ) ; } } } public String toStringDebug ( char [ ] source ) { StringBuffer buffer = new StringBuffer ( ) ; toStringDebug ( buffer , source ) ; return buffer . toString ( ) ; } public void toStringDebug ( StringBuffer buffer , char [ ] source ) { if ( this . tagValue > <NUM_LIT:0> ) { buffer . append ( source , this . sourceStart , this . tagEnd - this . sourceStart + <NUM_LIT:1> ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } if ( this . reference != null ) { this . reference . toStringDebug ( buffer , source ) ; } for ( int i = <NUM_LIT:0> ; i <= this . nodesPtr ; i ++ ) { this . nodes [ i ] . toStringDebug ( buffer , source ) ; } } void update ( Scanner scanner ) { int blockEnd = scanner . getLineNumber ( this . sourceEnd ) ; if ( blockEnd == this . lineStart ) { this . flags |= FormatJavadocBlock . ONE_LINE_TAG ; } for ( int i = <NUM_LIT:0> ; i <= this . nodesPtr ; i ++ ) { if ( ! this . nodes [ i ] . isText ( ) ) { ( ( FormatJavadocBlock ) this . nodes [ i ] ) . update ( scanner ) ; } } } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import org . eclipse . jdt . internal . formatter . comment . IJavaDocTagConstants ; public class FormatJavadocText extends FormatJavadocNode implements IJavaDocTagConstants { long [ ] separators ; int separatorsPtr = - <NUM_LIT:1> ; private int htmlTagIndex = - <NUM_LIT:1> ; boolean immutable = false ; FormatJavadocNode [ ] htmlNodes ; int [ ] htmlIndexes ; int htmlNodesPtr = - <NUM_LIT:1> ; int depth = <NUM_LIT:0> ; public FormatJavadocText ( int start , int end , int line , int htmlIndex , int htmlDepth ) { super ( start , end , line ) ; this . htmlTagIndex = htmlIndex ; this . depth = htmlDepth ; } void appendText ( FormatJavadocText text ) { text . immutable = this . immutable ; if ( this . depth == text . depth ) { addSeparator ( text ) ; this . sourceEnd = text . sourceEnd ; if ( text . isClosingHtmlTag ( ) ) { this . htmlTagIndex = text . htmlTagIndex ; } } else { appendNode ( text ) ; } if ( text . isHtmlTag ( ) ) { switch ( text . htmlTagIndex & JAVADOC_TAGS_ID_MASK ) { case JAVADOC_CODE_TAGS_ID : text . linesBefore = this . htmlNodesPtr == - <NUM_LIT:1> ? <NUM_LIT:0> : <NUM_LIT:2> ; break ; case JAVADOC_SEPARATOR_TAGS_ID : text . linesBefore = <NUM_LIT:1> ; break ; case JAVADOC_SINGLE_BREAK_TAG_ID : if ( ! text . isClosingHtmlTag ( ) ) text . linesBefore = <NUM_LIT:1> ; break ; case JAVADOC_BREAK_TAGS_ID : if ( ! text . isClosingHtmlTag ( ) ) text . linesBefore = <NUM_LIT:1> ; } } } void appendNode ( FormatJavadocNode node ) { if ( ++ this . htmlNodesPtr == <NUM_LIT:0> ) { this . htmlNodes = new FormatJavadocNode [ DEFAULT_ARRAY_SIZE ] ; } else { if ( this . htmlNodesPtr == this . htmlNodes . length ) { int size = this . htmlNodesPtr + DEFAULT_ARRAY_SIZE ; System . arraycopy ( this . htmlNodes , <NUM_LIT:0> , ( this . htmlNodes = new FormatJavadocNode [ size ] ) , <NUM_LIT:0> , this . htmlNodesPtr ) ; } } addSeparator ( node ) ; this . htmlNodes [ this . htmlNodesPtr ] = node ; this . sourceEnd = node . sourceEnd ; } private void addSeparator ( FormatJavadocNode node ) { if ( ++ this . separatorsPtr == <NUM_LIT:0> ) { this . separators = new long [ DEFAULT_ARRAY_SIZE ] ; this . htmlIndexes = new int [ DEFAULT_ARRAY_SIZE ] ; } else { if ( this . separatorsPtr == this . separators . length ) { int size = this . separatorsPtr + DEFAULT_ARRAY_SIZE ; System . arraycopy ( this . separators , <NUM_LIT:0> , ( this . separators = new long [ size ] ) , <NUM_LIT:0> , this . separatorsPtr ) ; System . arraycopy ( this . htmlIndexes , <NUM_LIT:0> , ( this . htmlIndexes = new int [ size ] ) , <NUM_LIT:0> , this . separatorsPtr ) ; } } this . separators [ this . separatorsPtr ] = ( ( ( long ) this . sourceEnd ) << <NUM_LIT:32> ) + node . sourceStart ; this . htmlIndexes [ this . separatorsPtr ] = node . isText ( ) ? ( ( FormatJavadocText ) node ) . htmlTagIndex : - <NUM_LIT:1> ; } void clean ( ) { int length = this . separators == null ? <NUM_LIT:0> : this . separators . length ; if ( this . separatorsPtr != ( length - <NUM_LIT:1> ) ) { System . arraycopy ( this . separators , <NUM_LIT:0> , this . separators = new long [ this . separatorsPtr + <NUM_LIT:1> ] , <NUM_LIT:0> , this . separatorsPtr + <NUM_LIT:1> ) ; System . arraycopy ( this . htmlIndexes , <NUM_LIT:0> , this . htmlIndexes = new int [ this . separatorsPtr + <NUM_LIT:1> ] , <NUM_LIT:0> , this . separatorsPtr + <NUM_LIT:1> ) ; } length = this . htmlNodes == null ? <NUM_LIT:0> : this . htmlNodes . length ; if ( this . htmlNodesPtr != ( length - <NUM_LIT:1> ) ) { System . arraycopy ( this . htmlNodes , <NUM_LIT:0> , this . htmlNodes = new FormatJavadocNode [ this . htmlNodesPtr + <NUM_LIT:1> ] , <NUM_LIT:0> , this . htmlNodesPtr + <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> ; i <= this . htmlNodesPtr ; i ++ ) { this . htmlNodes [ i ] . clean ( ) ; } } } void closeTag ( ) { this . htmlTagIndex |= JAVADOC_CLOSED_TAG ; } int getHtmlTagIndex ( ) { return this . htmlTagIndex & JAVADOC_TAGS_INDEX_MASK ; } int getHtmlTagID ( ) { return this . htmlTagIndex & JAVADOC_TAGS_ID_MASK ; } FormatJavadocNode getLastNode ( ) { if ( this . htmlNodes != null ) { return this . htmlNodes [ this . htmlNodesPtr ] ; } return null ; } public boolean isClosingHtmlTag ( ) { return this . htmlTagIndex != - <NUM_LIT:1> && ( this . htmlTagIndex & JAVADOC_CLOSED_TAG ) != <NUM_LIT:0> ; } public boolean isHtmlTag ( ) { return this . htmlTagIndex != - <NUM_LIT:1> ; } public boolean isImmutableHtmlTag ( ) { return this . htmlTagIndex != - <NUM_LIT:1> && ( this . htmlTagIndex & JAVADOC_TAGS_ID_MASK ) == JAVADOC_IMMUTABLE_TAGS_ID ; } public boolean isImmutable ( ) { return this . immutable || ( this . htmlTagIndex != - <NUM_LIT:1> && ( this . htmlTagIndex & JAVADOC_TAGS_ID_MASK ) == JAVADOC_IMMUTABLE_TAGS_ID ) ; } public boolean isTextAfterHtmlSeparatorTag ( int separatorIndex ) { int ptr = separatorIndex ; if ( ptr > this . separatorsPtr ) return false ; int tagIndex = this . htmlIndexes [ ptr ] & JAVADOC_TAGS_ID_MASK ; return tagIndex != - <NUM_LIT:1> && tagIndex == JAVADOC_SEPARATOR_TAGS_ID ; } public boolean isText ( ) { return true ; } void setHeaderLine ( int javadocLineStart ) { for ( int i = <NUM_LIT:0> ; i < this . htmlNodesPtr ; i ++ ) { FormatJavadocNode node = this . htmlNodes [ i ] ; if ( ! node . isText ( ) ) { ( ( FormatJavadocBlock ) node ) . setHeaderLine ( javadocLineStart ) ; } } } protected void toString ( StringBuffer buffer ) { StringBuffer indentation = new StringBuffer ( ) ; for ( int t = <NUM_LIT:0> ; t <= this . depth ; t ++ ) indentation . append ( '<STR_LIT:\t>' ) ; buffer . append ( indentation ) ; if ( isImmutable ( ) ) { buffer . append ( "<STR_LIT>" ) ; } buffer . append ( "<STR_LIT:text>" ) ; super . toString ( buffer ) ; buffer . append ( "<STR_LIT:U+0020(>" ) ; buffer . append ( this . separatorsPtr + <NUM_LIT:1> ) . append ( "<STR_LIT>" ) ; buffer . append ( this . htmlNodesPtr + <NUM_LIT:1> ) . append ( "<STR_LIT>" ) ; buffer . append ( this . depth ) . append ( "<STR_LIT>" ) ; buffer . append ( this . linesBefore ) . append ( "<STR_LIT>" ) ; String tagID = "<STR_LIT>" ; switch ( getHtmlTagID ( ) ) { case JAVADOC_TAGS_ID_MASK : tagID = "<STR_LIT>" ; break ; case JAVADOC_SINGLE_BREAK_TAG_ID : tagID = "<STR_LIT>" ; break ; case JAVADOC_CODE_TAGS_ID : tagID = "<STR_LIT:code>" ; break ; case JAVADOC_BREAK_TAGS_ID : tagID = "<STR_LIT>" ; break ; case JAVADOC_IMMUTABLE_TAGS_ID : tagID = "<STR_LIT>" ; break ; case JAVADOC_SEPARATOR_TAGS_ID : tagID = "<STR_LIT>" ; break ; } buffer . append ( tagID ) . append ( "<STR_LIT>" ) ; buffer . append ( '<STR_LIT:\n>' ) ; } public void toStringDebug ( StringBuffer buffer , char [ ] source ) { if ( buffer . length ( ) > <NUM_LIT:0> ) { for ( int l = <NUM_LIT:0> ; l < this . linesBefore ; l ++ ) { buffer . append ( '<STR_LIT:\n>' ) ; for ( int t = <NUM_LIT:0> ; t < this . depth ; t ++ ) buffer . append ( '<STR_LIT:\t>' ) ; } } if ( this . separatorsPtr == - <NUM_LIT:1> ) { super . toStringDebug ( buffer , source ) ; return ; } int ptr = <NUM_LIT:0> ; int nextStart = this . sourceStart ; int idx = <NUM_LIT:0> ; while ( idx <= this . separatorsPtr || ( this . htmlNodesPtr != - <NUM_LIT:1> && ptr <= this . htmlNodesPtr ) ) { if ( idx > this . separatorsPtr ) { FormatJavadocNode node = this . htmlNodes [ ptr ++ ] ; node . toStringDebug ( buffer , source ) ; return ; } int end = ( int ) ( this . separators [ idx ] > > > <NUM_LIT:32> ) ; if ( this . htmlNodesPtr >= <NUM_LIT:0> && ptr <= this . htmlNodesPtr && end > this . htmlNodes [ ptr ] . sourceStart ) { FormatJavadocNode node = this . htmlNodes [ ptr ++ ] ; node . toStringDebug ( buffer , source ) ; } else { if ( idx > <NUM_LIT:1> && source [ nextStart ] != '<CHAR_LIT>' ) { buffer . append ( '<STR_LIT:\n>' ) ; for ( int t = <NUM_LIT:0> ; t < this . depth ; t ++ ) buffer . append ( '<STR_LIT:\t>' ) ; } buffer . append ( source , nextStart , end - nextStart + <NUM_LIT:1> ) ; } nextStart = ( int ) this . separators [ idx ++ ] ; } if ( source [ nextStart ] == '<CHAR_LIT>' ) { switch ( getHtmlTagID ( ) ) { case JAVADOC_CODE_TAGS_ID : buffer . append ( '<STR_LIT:\n>' ) ; for ( int t = <NUM_LIT:0> ; t < this . depth ; t ++ ) buffer . append ( '<STR_LIT:\t>' ) ; break ; } } buffer . append ( source , nextStart , this . sourceEnd - nextStart + <NUM_LIT:1> ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; public interface ICodeFormatterConstants { public static final int ANNOTATION_UNSPECIFIED = <NUM_LIT:0> ; public static final int ANNOTATION_ON_TYPE = <NUM_LIT:1> ; public static final int ANNOTATION_ON_FIELD = <NUM_LIT:2> ; public static final int ANNOTATION_ON_METHOD = <NUM_LIT:3> ; public static final int ANNOTATION_ON_PACKAGE = <NUM_LIT:4> ; public static final int ANNOTATION_ON_PARAMETER = <NUM_LIT:5> ; public static final int ANNOTATION_ON_LOCAL_VARIABLE = <NUM_LIT:6> ; } </s>
<s> package org . eclipse . jdt . internal . formatter ; import org . eclipse . jdt . internal . compiler . ast . Javadoc ; public class FormatJavadoc extends Javadoc { FormatJavadocBlock [ ] blocks ; int textStart , textEnd ; int lineStart , lineEnd ; public FormatJavadoc ( int sourceStart , int sourceEnd , int length ) { super ( sourceStart , sourceEnd ) ; if ( length > <NUM_LIT:0> ) { this . blocks = new FormatJavadocBlock [ length ] ; } } public FormatJavadocBlock getFirstBlock ( ) { if ( this . blocks != null ) { return this . blocks [ <NUM_LIT:0> ] ; } return null ; } public boolean isMultiLine ( ) { return this . lineStart < this . lineEnd ; } public String toDebugString ( char [ ] source ) { if ( this . blocks == null ) { return "<STR_LIT>" ; } StringBuffer buffer = new StringBuffer ( ) ; int length = this . blocks . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . blocks [ i ] . toStringDebug ( buffer , source ) ; buffer . append ( '<STR_LIT:\n>' ) ; } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . align ; public class AlignmentException extends RuntimeException { public static final int LINE_TOO_LONG = <NUM_LIT:1> ; public static final int ALIGN_TOO_SMALL = <NUM_LIT:2> ; private static final long serialVersionUID = - <NUM_LIT> ; int reason ; int value ; public int relativeDepth ; public AlignmentException ( int reason , int relativeDepth ) { this ( reason , <NUM_LIT:0> , relativeDepth ) ; } public AlignmentException ( int reason , int value , int relativeDepth ) { this . reason = reason ; this . value = value ; this . relativeDepth = relativeDepth ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; switch ( this . reason ) { case LINE_TOO_LONG : buffer . append ( "<STR_LIT>" ) ; break ; case ALIGN_TOO_SMALL : buffer . append ( "<STR_LIT>" ) ; break ; } buffer . append ( "<STR_LIT>" ) . append ( this . relativeDepth ) . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . align ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jdt . internal . formatter . Location ; import org . eclipse . jdt . internal . formatter . Scribe ; public class Alignment { public int kind ; public static final int ALLOCATION = <NUM_LIT:1> ; public static final int ANNOTATION_MEMBERS_VALUE_PAIRS = <NUM_LIT:2> ; public static final int ARRAY_INITIALIZER = <NUM_LIT:3> ; public static final int ASSIGNMENT = <NUM_LIT:4> ; public static final int BINARY_EXPRESSION = <NUM_LIT:5> ; public static final int CASCADING_MESSAGE_SEND = <NUM_LIT:6> ; public static final int COMPACT_IF = <NUM_LIT:7> ; public static final int COMPOUND_ASSIGNMENT = <NUM_LIT:8> ; public static final int CONDITIONAL_EXPRESSION = <NUM_LIT:9> ; public static final int ENUM_CONSTANTS = <NUM_LIT:10> ; public static final int ENUM_CONSTANTS_ARGUMENTS = <NUM_LIT:11> ; public static final int EXPLICIT_CONSTRUCTOR_CALL = <NUM_LIT:12> ; public static final int FIELD_DECLARATION_ASSIGNMENT = <NUM_LIT> ; public static final int LOCAL_DECLARATION_ASSIGNMENT = <NUM_LIT> ; public static final int MESSAGE_ARGUMENTS = <NUM_LIT:15> ; public static final int MESSAGE_SEND = <NUM_LIT:16> ; public static final int METHOD_ARGUMENTS = <NUM_LIT> ; public static final int METHOD_DECLARATION = <NUM_LIT> ; public static final int MULTIPLE_FIELD = <NUM_LIT> ; public static final int SUPER_CLASS = <NUM_LIT:20> ; public static final int SUPER_INTERFACES = <NUM_LIT> ; public static final int THROWS = <NUM_LIT> ; public static final int TYPE_MEMBERS = <NUM_LIT> ; public static final int STRING_CONCATENATION = <NUM_LIT:24> ; public static final int TRY_RESOURCES = <NUM_LIT> ; public static final int MULTI_CATCH = <NUM_LIT> ; public String name ; public static final String [ ] NAMES = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , } ; public Alignment enclosing ; public Location location ; public int fragmentIndex ; public int fragmentCount ; public int [ ] fragmentIndentations ; public boolean needRedoColumnAlignment ; public int chunkStartIndex ; public int chunkKind ; public int originalIndentationLevel ; public int breakIndentationLevel ; public int shiftBreakIndentationLevel ; public int [ ] fragmentBreaks ; public boolean wasSplit ; public boolean blockAlign = false ; public boolean tooLong = false ; public Scribe scribe ; private boolean reset = false ; public static final int M_FORCE = <NUM_LIT:1> ; public static final int M_INDENT_ON_COLUMN = <NUM_LIT:2> ; public static final int M_INDENT_BY_ONE = <NUM_LIT:4> ; public static final int M_COMPACT_SPLIT = <NUM_LIT:16> ; public static final int M_COMPACT_FIRST_BREAK_SPLIT = <NUM_LIT:32> ; public static final int M_ONE_PER_LINE_SPLIT = <NUM_LIT:32> + <NUM_LIT:16> ; public static final int M_NEXT_SHIFTED_SPLIT = <NUM_LIT> ; public static final int M_NEXT_PER_LINE_SPLIT = <NUM_LIT> + <NUM_LIT:16> ; public static final int M_MULTICOLUMN = <NUM_LIT> ; public static final int M_NO_ALIGNMENT = <NUM_LIT:0> ; public int mode ; public static final int SPLIT_MASK = M_ONE_PER_LINE_SPLIT | M_NEXT_SHIFTED_SPLIT | M_COMPACT_SPLIT | M_COMPACT_FIRST_BREAK_SPLIT | M_NEXT_PER_LINE_SPLIT ; public static final int R_OUTERMOST = <NUM_LIT:1> ; public static final int R_INNERMOST = <NUM_LIT:2> ; public int tieBreakRule ; public int startingColumn = - <NUM_LIT:1> ; public static final int NONE = <NUM_LIT:0> ; public static final int BREAK = <NUM_LIT:1> ; public static final int CHUNK_FIELD = <NUM_LIT:1> ; public static final int CHUNK_METHOD = <NUM_LIT:2> ; public static final int CHUNK_TYPE = <NUM_LIT:3> ; public static final int CHUNK_ENUM = <NUM_LIT:4> ; public Alignment ( int kind , int mode , int tieBreakRule , Scribe scribe , int fragmentCount , int sourceRestart , int continuationIndent ) { Assert . isTrue ( kind >= ALLOCATION && kind <= MULTI_CATCH ) ; this . kind = kind ; this . name = NAMES [ kind ] ; this . location = new Location ( scribe , sourceRestart ) ; this . mode = mode ; this . tieBreakRule = tieBreakRule ; this . fragmentCount = fragmentCount ; this . scribe = scribe ; this . originalIndentationLevel = this . scribe . indentationLevel ; this . wasSplit = false ; final int indentSize = this . scribe . indentationSize ; int currentColumn = this . location . outputColumn ; if ( currentColumn == <NUM_LIT:1> ) { currentColumn = this . location . outputIndentationLevel + <NUM_LIT:1> ; } if ( ( mode & M_INDENT_ON_COLUMN ) != <NUM_LIT:0> ) { this . breakIndentationLevel = this . scribe . getNextIndentationLevel ( currentColumn ) ; if ( this . breakIndentationLevel == this . location . outputIndentationLevel ) { this . breakIndentationLevel += ( continuationIndent * indentSize ) ; } } else if ( ( mode & M_INDENT_BY_ONE ) != <NUM_LIT:0> ) { this . breakIndentationLevel = this . location . outputIndentationLevel + indentSize ; } else { this . breakIndentationLevel = this . location . outputIndentationLevel + continuationIndent * indentSize ; } this . shiftBreakIndentationLevel = this . breakIndentationLevel + indentSize ; this . fragmentIndentations = new int [ this . fragmentCount ] ; this . fragmentBreaks = new int [ this . fragmentCount ] ; if ( ( this . mode & M_FORCE ) != <NUM_LIT:0> ) { couldBreak ( ) ; } } public boolean checkChunkStart ( int chunk , int startIndex , int sourceRestart ) { if ( this . chunkKind != chunk ) { this . chunkKind = chunk ; if ( startIndex != this . chunkStartIndex ) { this . chunkStartIndex = startIndex ; this . location . update ( this . scribe , sourceRestart ) ; reset ( ) ; } return true ; } return false ; } public void checkColumn ( ) { if ( ( this . mode & M_MULTICOLUMN ) != <NUM_LIT:0> && this . fragmentCount > <NUM_LIT:0> ) { int currentIndentation = this . scribe . getNextIndentationLevel ( this . scribe . column + ( this . scribe . needSpace ? <NUM_LIT:1> : <NUM_LIT:0> ) ) ; int fragmentIndentation = this . fragmentIndentations [ this . fragmentIndex ] ; if ( currentIndentation > fragmentIndentation ) { this . fragmentIndentations [ this . fragmentIndex ] = currentIndentation ; if ( fragmentIndentation != <NUM_LIT:0> ) { for ( int i = this . fragmentIndex + <NUM_LIT:1> ; i < this . fragmentCount ; i ++ ) { this . fragmentIndentations [ i ] = <NUM_LIT:0> ; } this . needRedoColumnAlignment = true ; } } if ( this . needRedoColumnAlignment && this . fragmentIndex == this . fragmentCount - <NUM_LIT:1> ) { this . needRedoColumnAlignment = false ; int relativeDepth = <NUM_LIT:0> ; Alignment targetAlignment = this . scribe . memberAlignment ; while ( targetAlignment != null ) { if ( targetAlignment == this ) { throw new AlignmentException ( AlignmentException . ALIGN_TOO_SMALL , relativeDepth ) ; } targetAlignment = targetAlignment . enclosing ; relativeDepth ++ ; } } } } public int depth ( ) { int depth = <NUM_LIT:0> ; Alignment current = this . enclosing ; while ( current != null ) { depth ++ ; current = current . enclosing ; } return depth ; } public boolean canAlign ( ) { if ( this . tooLong ) { return true ; } boolean canAlign = true ; Alignment enclosingAlignment = this . enclosing ; while ( enclosingAlignment != null ) { switch ( enclosingAlignment . kind ) { case Alignment . ALLOCATION : case Alignment . MESSAGE_ARGUMENTS : if ( enclosingAlignment . isWrapped ( ) && ( enclosingAlignment . fragmentIndex > <NUM_LIT:0> || enclosingAlignment . fragmentCount < <NUM_LIT:2> ) ) { return ! this . blockAlign ; } if ( enclosingAlignment . tooLong ) { return true ; } canAlign = false ; break ; case Alignment . MESSAGE_SEND : switch ( this . kind ) { case Alignment . ALLOCATION : case Alignment . MESSAGE_ARGUMENTS : case Alignment . MESSAGE_SEND : Alignment superEnclosingAlignment = enclosingAlignment . enclosing ; while ( superEnclosingAlignment != null ) { switch ( superEnclosingAlignment . kind ) { case Alignment . ALLOCATION : case Alignment . MESSAGE_ARGUMENTS : case Alignment . MESSAGE_SEND : if ( this . scribe . nlsTagCounter == <NUM_LIT:0> ) { enclosingAlignment . blockAlign = true ; } return ! this . blockAlign ; } superEnclosingAlignment = superEnclosingAlignment . enclosing ; } break ; } return ! this . blockAlign ; } enclosingAlignment = enclosingAlignment . enclosing ; } return canAlign && ! this . blockAlign ; } public boolean couldBreak ( ) { if ( this . fragmentCount == <NUM_LIT:0> ) return false ; int i ; switch ( this . mode & SPLIT_MASK ) { case M_COMPACT_FIRST_BREAK_SPLIT : if ( this . fragmentBreaks [ <NUM_LIT:0> ] == NONE ) { this . fragmentBreaks [ <NUM_LIT:0> ] = BREAK ; this . fragmentIndentations [ <NUM_LIT:0> ] = this . breakIndentationLevel ; return this . wasSplit = true ; } i = this . fragmentIndex ; do { if ( this . fragmentBreaks [ i ] == NONE ) { this . fragmentBreaks [ i ] = BREAK ; this . fragmentIndentations [ i ] = this . breakIndentationLevel ; return this . wasSplit = true ; } } while ( -- i >= <NUM_LIT:0> ) ; break ; case M_COMPACT_SPLIT : i = this . fragmentIndex ; do { if ( this . fragmentBreaks [ i ] == NONE ) { this . fragmentBreaks [ i ] = BREAK ; this . fragmentIndentations [ i ] = this . breakIndentationLevel ; return this . wasSplit = true ; } } while ( -- i >= <NUM_LIT:0> ) ; break ; case M_NEXT_SHIFTED_SPLIT : if ( this . fragmentBreaks [ <NUM_LIT:0> ] == NONE ) { this . fragmentBreaks [ <NUM_LIT:0> ] = BREAK ; this . fragmentIndentations [ <NUM_LIT:0> ] = this . breakIndentationLevel ; for ( i = <NUM_LIT:1> ; i < this . fragmentCount ; i ++ ) { this . fragmentBreaks [ i ] = BREAK ; this . fragmentIndentations [ i ] = this . shiftBreakIndentationLevel ; } return this . wasSplit = true ; } break ; case M_ONE_PER_LINE_SPLIT : if ( this . fragmentBreaks [ <NUM_LIT:0> ] == NONE ) { for ( i = <NUM_LIT:0> ; i < this . fragmentCount ; i ++ ) { this . fragmentBreaks [ i ] = BREAK ; this . fragmentIndentations [ i ] = this . breakIndentationLevel ; } return this . wasSplit = true ; } break ; case M_NEXT_PER_LINE_SPLIT : if ( this . fragmentBreaks [ <NUM_LIT:0> ] == NONE ) { if ( this . fragmentCount > <NUM_LIT:1> && this . fragmentBreaks [ <NUM_LIT:1> ] == NONE ) { if ( ( this . mode & M_INDENT_ON_COLUMN ) != <NUM_LIT:0> ) { this . fragmentIndentations [ <NUM_LIT:0> ] = this . breakIndentationLevel ; } for ( i = <NUM_LIT:1> ; i < this . fragmentCount ; i ++ ) { this . fragmentBreaks [ i ] = BREAK ; this . fragmentIndentations [ i ] = this . breakIndentationLevel ; } return this . wasSplit = true ; } } break ; } return false ; } public boolean isWrapped ( ) { if ( this . fragmentCount == <NUM_LIT:0> ) return false ; return this . fragmentBreaks [ this . fragmentIndex ] == BREAK ; } public int wrappedIndex ( ) { for ( int i = <NUM_LIT:0> , max = this . fragmentCount ; i < max ; i ++ ) { if ( this . fragmentBreaks [ i ] == BREAK ) { return i ; } } return - <NUM_LIT:1> ; } public void performFragmentEffect ( ) { if ( this . fragmentCount == <NUM_LIT:0> ) return ; if ( ( this . mode & M_MULTICOLUMN ) == <NUM_LIT:0> ) { switch ( this . mode & SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_COMPACT_FIRST_BREAK_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : case Alignment . M_NEXT_SHIFTED_SPLIT : case Alignment . M_ONE_PER_LINE_SPLIT : break ; default : return ; } } int fragmentIndentation = this . fragmentIndentations [ this . fragmentIndex ] ; if ( this . startingColumn < <NUM_LIT:0> || ( fragmentIndentation + <NUM_LIT:1> ) < this . startingColumn ) { if ( this . fragmentBreaks [ this . fragmentIndex ] == BREAK ) { this . scribe . printNewLine ( ) ; } if ( fragmentIndentation > <NUM_LIT:0> ) { this . scribe . indentationLevel = fragmentIndentation ; } } } public void reset ( ) { this . wasSplit = false ; if ( this . fragmentCount > <NUM_LIT:0> ) { this . fragmentIndentations = new int [ this . fragmentCount ] ; this . fragmentBreaks = new int [ this . fragmentCount ] ; } if ( ( this . mode & M_FORCE ) != <NUM_LIT:0> ) { couldBreak ( ) ; } this . reset = true ; } public void toFragmentsString ( StringBuffer buffer ) { } public String toString ( ) { StringBuffer buffer = new StringBuffer ( <NUM_LIT:10> ) ; return toString ( buffer , - <NUM_LIT:1> ) ; } public String toString ( StringBuffer buffer , int level ) { StringBuffer indentation = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < level ; i ++ ) { indentation . append ( '<STR_LIT:\t>' ) ; } buffer . append ( indentation ) ; buffer . append ( "<STR_LIT>" ) . append ( this . kind ) . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) . append ( this . name ) . append ( "<STR_LIT>" ) ; buffer . append ( indentation ) ; buffer . append ( "<STR_LIT>" ) . append ( depth ( ) ) . append ( "<STR_LIT>" ) . append ( this . breakIndentationLevel ) . append ( "<STR_LIT>" ) . append ( this . shiftBreakIndentationLevel ) . append ( "<STR_LIT>" ) ; buffer . append ( indentation ) ; buffer . append ( "<STR_LIT>" ) . append ( this . location . toString ( ) ) . append ( "<STR_LIT>" ) ; buffer . append ( indentation ) . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < this . fragmentCount ; i ++ ) { buffer . append ( indentation ) . append ( "<STR_LIT:U+0020-U+0020>" ) . append ( i ) . append ( "<STR_LIT::U+0020>" ) . append ( "<STR_LIT>" ) . append ( this . fragmentBreaks [ i ] > <NUM_LIT:0> ? "<STR_LIT>" : "<STR_LIT>" ) . append ( "<STR_LIT:>>" ) . append ( "<STR_LIT>" ) . append ( this . fragmentIndentations [ i ] ) . append ( "<STR_LIT>" ) ; } buffer . append ( indentation ) . append ( "<STR_LIT>" ) ; if ( this . enclosing != null && level >= <NUM_LIT:0> ) { buffer . append ( indentation ) . append ( "<STR_LIT>" ) ; this . enclosing . toString ( buffer , level + <NUM_LIT:1> ) ; buffer . append ( indentation ) . append ( "<STR_LIT>" ) ; } return buffer . toString ( ) ; } public void update ( ) { for ( int i = <NUM_LIT:1> ; i < this . fragmentCount ; i ++ ) { if ( this . fragmentBreaks [ i ] == BREAK ) { this . fragmentIndentations [ i ] = this . breakIndentationLevel ; } } } public boolean wasReset ( ) { return this . reset ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . formatter . align . Alignment ; public class DefaultCodeFormatterOptions { public static final int TAB = <NUM_LIT:1> ; public static final int SPACE = <NUM_LIT:2> ; public static final int MIXED = <NUM_LIT:4> ; public static DefaultCodeFormatterOptions getDefaultSettings ( ) { DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions ( ) ; options . setDefaultSettings ( ) ; return options ; } public static DefaultCodeFormatterOptions getEclipseDefaultSettings ( ) { DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions ( ) ; options . setEclipseDefaultSettings ( ) ; return options ; } public static DefaultCodeFormatterOptions getJavaConventionsSettings ( ) { DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions ( ) ; options . setJavaConventionsSettings ( ) ; return options ; } public int alignment_for_arguments_in_allocation_expression ; public int alignment_for_arguments_in_annotation ; public int alignment_for_arguments_in_enum_constant ; public int alignment_for_arguments_in_explicit_constructor_call ; public int alignment_for_arguments_in_method_invocation ; public int alignment_for_arguments_in_qualified_allocation_expression ; public int alignment_for_assignment ; public int alignment_for_binary_expression ; public int alignment_for_compact_if ; public int alignment_for_conditional_expression ; public int alignment_for_enum_constants ; public int alignment_for_expressions_in_array_initializer ; public int alignment_for_method_declaration ; public int alignment_for_multiple_fields ; public int alignment_for_parameters_in_constructor_declaration ; public int alignment_for_parameters_in_method_declaration ; public int alignment_for_selector_in_method_invocation ; public int alignment_for_superclass_in_type_declaration ; public int alignment_for_superinterfaces_in_enum_declaration ; public int alignment_for_superinterfaces_in_type_declaration ; public int alignment_for_throws_clause_in_constructor_declaration ; public int alignment_for_throws_clause_in_method_declaration ; public int alignment_for_resources_in_try ; public int alignment_for_union_type_in_multicatch ; public boolean align_type_members_on_columns ; public String brace_position_for_annotation_type_declaration ; public String brace_position_for_anonymous_type_declaration ; public String brace_position_for_array_initializer ; public String brace_position_for_block ; public String brace_position_for_block_in_case ; public String brace_position_for_constructor_declaration ; public String brace_position_for_enum_constant ; public String brace_position_for_enum_declaration ; public String brace_position_for_method_declaration ; public String brace_position_for_type_declaration ; public String brace_position_for_switch ; public int continuation_indentation ; public int continuation_indentation_for_array_initializer ; public int blank_lines_after_imports ; public int blank_lines_after_package ; public int blank_lines_before_field ; public int blank_lines_before_first_class_body_declaration ; public int blank_lines_before_imports ; public int blank_lines_before_member_type ; public int blank_lines_before_method ; public int blank_lines_before_new_chunk ; public int blank_lines_before_package ; public int blank_lines_between_import_groups ; public int blank_lines_between_type_declarations ; public int blank_lines_at_beginning_of_method_body ; public boolean comment_clear_blank_lines_in_javadoc_comment ; public boolean comment_clear_blank_lines_in_block_comment ; public boolean comment_new_lines_at_block_boundaries ; public boolean comment_new_lines_at_javadoc_boundaries ; public boolean comment_format_javadoc_comment ; public boolean comment_format_line_comment ; public boolean comment_format_line_comment_starting_on_first_column ; public boolean comment_format_block_comment ; public boolean comment_format_header ; public boolean comment_format_html ; public boolean comment_format_source ; public boolean comment_indent_parameter_description ; public boolean comment_indent_root_tags ; public boolean comment_insert_empty_line_before_root_tags ; public boolean comment_insert_new_line_for_parameter ; public boolean comment_preserve_white_space_between_code_and_line_comments ; public int comment_line_length ; public boolean use_tags ; public char [ ] disabling_tag ; public char [ ] enabling_tag ; private final static char [ ] DEFAULT_DISABLING_TAG = "<STR_LIT>" . toCharArray ( ) ; private final static char [ ] DEFAULT_ENABLING_TAG = "<STR_LIT>" . toCharArray ( ) ; public boolean indent_statements_compare_to_block ; public boolean indent_statements_compare_to_body ; public boolean indent_body_declarations_compare_to_annotation_declaration_header ; public boolean indent_body_declarations_compare_to_enum_constant_header ; public boolean indent_body_declarations_compare_to_enum_declaration_header ; public boolean indent_body_declarations_compare_to_type_header ; public boolean indent_breaks_compare_to_cases ; public boolean indent_empty_lines ; public boolean indent_switchstatements_compare_to_cases ; public boolean indent_switchstatements_compare_to_switch ; public int indentation_size ; public boolean insert_new_line_after_annotation_on_type ; public boolean insert_new_line_after_annotation_on_field ; public boolean insert_new_line_after_annotation_on_method ; public boolean insert_new_line_after_annotation_on_package ; public boolean insert_new_line_after_annotation_on_parameter ; public boolean insert_new_line_after_annotation_on_local_variable ; public boolean insert_new_line_after_label ; public boolean insert_new_line_after_opening_brace_in_array_initializer ; public boolean insert_new_line_at_end_of_file_if_missing ; public boolean insert_new_line_before_catch_in_try_statement ; public boolean insert_new_line_before_closing_brace_in_array_initializer ; public boolean insert_new_line_before_else_in_if_statement ; public boolean insert_new_line_before_finally_in_try_statement ; public boolean insert_new_line_before_while_in_do_statement ; public boolean insert_new_line_in_empty_anonymous_type_declaration ; public boolean insert_new_line_in_empty_block ; public boolean insert_new_line_in_empty_annotation_declaration ; public boolean insert_new_line_in_empty_enum_constant ; public boolean insert_new_line_in_empty_enum_declaration ; public boolean insert_new_line_in_empty_method_body ; public boolean insert_new_line_in_empty_type_declaration ; public boolean insert_space_after_and_in_type_parameter ; public boolean insert_space_after_assignment_operator ; public boolean insert_space_after_at_in_annotation ; public boolean insert_space_after_at_in_annotation_type_declaration ; public boolean insert_space_after_binary_operator ; public boolean insert_space_after_closing_angle_bracket_in_type_arguments ; public boolean insert_space_after_closing_angle_bracket_in_type_parameters ; public boolean insert_space_after_closing_paren_in_cast ; public boolean insert_space_after_closing_brace_in_block ; public boolean insert_space_after_colon_in_assert ; public boolean insert_space_after_colon_in_case ; public boolean insert_space_after_colon_in_conditional ; public boolean insert_space_after_colon_in_for ; public boolean insert_space_after_colon_in_labeled_statement ; public boolean insert_space_after_comma_in_allocation_expression ; public boolean insert_space_after_comma_in_annotation ; public boolean insert_space_after_comma_in_array_initializer ; public boolean insert_space_after_comma_in_constructor_declaration_parameters ; public boolean insert_space_after_comma_in_constructor_declaration_throws ; public boolean insert_space_after_comma_in_enum_constant_arguments ; public boolean insert_space_after_comma_in_enum_declarations ; public boolean insert_space_after_comma_in_explicit_constructor_call_arguments ; public boolean insert_space_after_comma_in_for_increments ; public boolean insert_space_after_comma_in_for_inits ; public boolean insert_space_after_comma_in_method_invocation_arguments ; public boolean insert_space_after_comma_in_method_declaration_parameters ; public boolean insert_space_after_comma_in_method_declaration_throws ; public boolean insert_space_after_comma_in_multiple_field_declarations ; public boolean insert_space_after_comma_in_multiple_local_declarations ; public boolean insert_space_after_comma_in_parameterized_type_reference ; public boolean insert_space_after_comma_in_superinterfaces ; public boolean insert_space_after_comma_in_type_arguments ; public boolean insert_space_after_comma_in_type_parameters ; public boolean insert_space_after_ellipsis ; public boolean insert_space_after_opening_angle_bracket_in_parameterized_type_reference ; public boolean insert_space_after_opening_angle_bracket_in_type_arguments ; public boolean insert_space_after_opening_angle_bracket_in_type_parameters ; public boolean insert_space_after_opening_bracket_in_array_allocation_expression ; public boolean insert_space_after_opening_bracket_in_array_reference ; public boolean insert_space_after_opening_brace_in_array_initializer ; public boolean insert_space_after_opening_paren_in_annotation ; public boolean insert_space_after_opening_paren_in_cast ; public boolean insert_space_after_opening_paren_in_catch ; public boolean insert_space_after_opening_paren_in_constructor_declaration ; public boolean insert_space_after_opening_paren_in_enum_constant ; public boolean insert_space_after_opening_paren_in_for ; public boolean insert_space_after_opening_paren_in_if ; public boolean insert_space_after_opening_paren_in_method_declaration ; public boolean insert_space_after_opening_paren_in_method_invocation ; public boolean insert_space_after_opening_paren_in_parenthesized_expression ; public boolean insert_space_after_opening_paren_in_switch ; public boolean insert_space_after_opening_paren_in_synchronized ; public boolean insert_space_after_opening_paren_in_try ; public boolean insert_space_after_opening_paren_in_while ; public boolean insert_space_after_postfix_operator ; public boolean insert_space_after_prefix_operator ; public boolean insert_space_after_question_in_conditional ; public boolean insert_space_after_question_in_wilcard ; public boolean insert_space_after_semicolon_in_for ; public boolean insert_space_after_semicolon_in_try_resources ; public boolean insert_space_after_unary_operator ; public boolean insert_space_before_and_in_type_parameter ; public boolean insert_space_before_at_in_annotation_type_declaration ; public boolean insert_space_before_assignment_operator ; public boolean insert_space_before_binary_operator ; public boolean insert_space_before_closing_angle_bracket_in_parameterized_type_reference ; public boolean insert_space_before_closing_angle_bracket_in_type_arguments ; public boolean insert_space_before_closing_angle_bracket_in_type_parameters ; public boolean insert_space_before_closing_brace_in_array_initializer ; public boolean insert_space_before_closing_bracket_in_array_allocation_expression ; public boolean insert_space_before_closing_bracket_in_array_reference ; public boolean insert_space_before_closing_paren_in_annotation ; public boolean insert_space_before_closing_paren_in_cast ; public boolean insert_space_before_closing_paren_in_catch ; public boolean insert_space_before_closing_paren_in_constructor_declaration ; public boolean insert_space_before_closing_paren_in_enum_constant ; public boolean insert_space_before_closing_paren_in_for ; public boolean insert_space_before_closing_paren_in_if ; public boolean insert_space_before_closing_paren_in_method_declaration ; public boolean insert_space_before_closing_paren_in_method_invocation ; public boolean insert_space_before_closing_paren_in_parenthesized_expression ; public boolean insert_space_before_closing_paren_in_switch ; public boolean insert_space_before_closing_paren_in_synchronized ; public boolean insert_space_before_closing_paren_in_try ; public boolean insert_space_before_closing_paren_in_while ; public boolean insert_space_before_colon_in_assert ; public boolean insert_space_before_colon_in_case ; public boolean insert_space_before_colon_in_conditional ; public boolean insert_space_before_colon_in_default ; public boolean insert_space_before_colon_in_for ; public boolean insert_space_before_colon_in_labeled_statement ; public boolean insert_space_before_comma_in_allocation_expression ; public boolean insert_space_before_comma_in_annotation ; public boolean insert_space_before_comma_in_array_initializer ; public boolean insert_space_before_comma_in_constructor_declaration_parameters ; public boolean insert_space_before_comma_in_constructor_declaration_throws ; public boolean insert_space_before_comma_in_enum_constant_arguments ; public boolean insert_space_before_comma_in_enum_declarations ; public boolean insert_space_before_comma_in_explicit_constructor_call_arguments ; public boolean insert_space_before_comma_in_for_increments ; public boolean insert_space_before_comma_in_for_inits ; public boolean insert_space_before_comma_in_method_invocation_arguments ; public boolean insert_space_before_comma_in_method_declaration_parameters ; public boolean insert_space_before_comma_in_method_declaration_throws ; public boolean insert_space_before_comma_in_multiple_field_declarations ; public boolean insert_space_before_comma_in_multiple_local_declarations ; public boolean insert_space_before_comma_in_parameterized_type_reference ; public boolean insert_space_before_comma_in_superinterfaces ; public boolean insert_space_before_comma_in_type_arguments ; public boolean insert_space_before_comma_in_type_parameters ; public boolean insert_space_before_ellipsis ; public boolean insert_space_before_parenthesized_expression_in_return ; public boolean insert_space_before_parenthesized_expression_in_throw ; public boolean insert_space_before_question_in_wilcard ; public boolean insert_space_before_opening_angle_bracket_in_parameterized_type_reference ; public boolean insert_space_before_opening_angle_bracket_in_type_arguments ; public boolean insert_space_before_opening_angle_bracket_in_type_parameters ; public boolean insert_space_before_opening_brace_in_annotation_type_declaration ; public boolean insert_space_before_opening_brace_in_anonymous_type_declaration ; public boolean insert_space_before_opening_brace_in_array_initializer ; public boolean insert_space_before_opening_brace_in_block ; public boolean insert_space_before_opening_brace_in_constructor_declaration ; public boolean insert_space_before_opening_brace_in_enum_constant ; public boolean insert_space_before_opening_brace_in_enum_declaration ; public boolean insert_space_before_opening_brace_in_method_declaration ; public boolean insert_space_before_opening_brace_in_type_declaration ; public boolean insert_space_before_opening_bracket_in_array_allocation_expression ; public boolean insert_space_before_opening_bracket_in_array_reference ; public boolean insert_space_before_opening_bracket_in_array_type_reference ; public boolean insert_space_before_opening_paren_in_annotation ; public boolean insert_space_before_opening_paren_in_annotation_type_member_declaration ; public boolean insert_space_before_opening_paren_in_catch ; public boolean insert_space_before_opening_paren_in_constructor_declaration ; public boolean insert_space_before_opening_paren_in_enum_constant ; public boolean insert_space_before_opening_paren_in_for ; public boolean insert_space_before_opening_paren_in_if ; public boolean insert_space_before_opening_paren_in_method_invocation ; public boolean insert_space_before_opening_paren_in_method_declaration ; public boolean insert_space_before_opening_paren_in_switch ; public boolean insert_space_before_opening_paren_in_try ; public boolean insert_space_before_opening_brace_in_switch ; public boolean insert_space_before_opening_paren_in_synchronized ; public boolean insert_space_before_opening_paren_in_parenthesized_expression ; public boolean insert_space_before_opening_paren_in_while ; public boolean insert_space_before_postfix_operator ; public boolean insert_space_before_prefix_operator ; public boolean insert_space_before_question_in_conditional ; public boolean insert_space_before_semicolon ; public boolean insert_space_before_semicolon_in_for ; public boolean insert_space_before_semicolon_in_try_resources ; public boolean insert_space_before_unary_operator ; public boolean insert_space_between_brackets_in_array_type_reference ; public boolean insert_space_between_empty_braces_in_array_initializer ; public boolean insert_space_between_empty_brackets_in_array_allocation_expression ; public boolean insert_space_between_empty_parens_in_annotation_type_member_declaration ; public boolean insert_space_between_empty_parens_in_constructor_declaration ; public boolean insert_space_between_empty_parens_in_enum_constant ; public boolean insert_space_between_empty_parens_in_method_declaration ; public boolean insert_space_between_empty_parens_in_method_invocation ; public boolean compact_else_if ; public boolean keep_guardian_clause_on_one_line ; public boolean keep_else_statement_on_same_line ; public boolean keep_empty_array_initializer_on_one_line ; public boolean keep_simple_if_on_one_line ; public boolean keep_then_statement_on_same_line ; public boolean never_indent_block_comments_on_first_column ; public boolean never_indent_line_comments_on_first_column ; public int number_of_empty_lines_to_preserve ; public boolean join_wrapped_lines ; public boolean join_lines_in_comments ; public boolean put_empty_statement_on_new_line ; public int tab_size ; public final char filling_space = '<CHAR_LIT:U+0020>' ; public int page_width ; public int tab_char ; public boolean use_tabs_only_for_leading_indentations ; public boolean wrap_before_binary_operator ; public boolean wrap_before_or_operator_multicatch ; public boolean wrap_outer_expressions_when_nested ; public int initial_indentation_level ; public String line_separator ; private DefaultCodeFormatterOptions ( ) { } public DefaultCodeFormatterOptions ( Map settings ) { setDefaultSettings ( ) ; if ( settings == null ) return ; set ( settings ) ; } private String getAlignment ( int alignment ) { return Integer . toString ( alignment ) ; } public Map getMap ( ) { Map options = new HashMap ( ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION , getAlignment ( this . alignment_for_arguments_in_allocation_expression ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION , getAlignment ( this . alignment_for_arguments_in_annotation ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT , getAlignment ( this . alignment_for_arguments_in_enum_constant ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL , getAlignment ( this . alignment_for_arguments_in_explicit_constructor_call ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION , getAlignment ( this . alignment_for_arguments_in_method_invocation ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION , getAlignment ( this . alignment_for_arguments_in_qualified_allocation_expression ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ASSIGNMENT , getAlignment ( this . alignment_for_assignment ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION , getAlignment ( this . alignment_for_binary_expression ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_COMPACT_IF , getAlignment ( this . alignment_for_compact_if ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION , getAlignment ( this . alignment_for_conditional_expression ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS , getAlignment ( this . alignment_for_enum_constants ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER , getAlignment ( this . alignment_for_expressions_in_array_initializer ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_METHOD_DECLARATION , getAlignment ( this . alignment_for_method_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS , getAlignment ( this . alignment_for_multiple_fields ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION , getAlignment ( this . alignment_for_parameters_in_constructor_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION , getAlignment ( this . alignment_for_parameters_in_method_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY , getAlignment ( this . alignment_for_resources_in_try ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION , getAlignment ( this . alignment_for_selector_in_method_invocation ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION , getAlignment ( this . alignment_for_superclass_in_type_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION , getAlignment ( this . alignment_for_superinterfaces_in_enum_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION , getAlignment ( this . alignment_for_superinterfaces_in_type_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION , getAlignment ( this . alignment_for_throws_clause_in_constructor_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION , getAlignment ( this . alignment_for_throws_clause_in_method_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_UNION_TYPE_IN_MULTICATCH , getAlignment ( this . alignment_for_union_type_in_multicatch ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS , this . align_type_members_on_columns ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION , this . brace_position_for_annotation_type_declaration ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION , this . brace_position_for_anonymous_type_declaration ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER , this . brace_position_for_array_initializer ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_BLOCK , this . brace_position_for_block ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE , this . brace_position_for_block_in_case ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION , this . brace_position_for_constructor_declaration ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT , this . brace_position_for_enum_constant ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION , this . brace_position_for_enum_declaration ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION , this . brace_position_for_method_declaration ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION , this . brace_position_for_type_declaration ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_SWITCH , this . brace_position_for_switch ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT , this . comment_clear_blank_lines_in_block_comment ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT , this . comment_clear_blank_lines_in_javadoc_comment ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES , this . comment_new_lines_at_block_boundaries ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES , this . comment_new_lines_at_javadoc_boundaries ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT , this . comment_format_block_comment ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_HEADER , this . comment_format_header ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_HTML , this . comment_format_html ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT , this . comment_format_javadoc_comment ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_LINE_COMMENT , this . comment_format_line_comment ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN , this . comment_format_line_comment_starting_on_first_column ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_SOURCE , this . comment_format_source ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION , this . comment_indent_parameter_description ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INDENT_ROOT_TAGS , this . comment_indent_root_tags ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS , this . comment_insert_empty_line_before_root_tags ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER , this . comment_insert_new_line_for_parameter ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_PRESERVE_WHITE_SPACE_BETWEEN_CODE_AND_LINE_COMMENT , this . comment_preserve_white_space_between_code_and_line_comments ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_LINE_LENGTH , Integer . toString ( this . comment_line_length ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_CONTINUATION_INDENTATION , Integer . toString ( this . continuation_indentation ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER , Integer . toString ( this . continuation_indentation_for_array_initializer ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_AFTER_IMPORTS , Integer . toString ( this . blank_lines_after_imports ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_AFTER_PACKAGE , Integer . toString ( this . blank_lines_after_package ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_FIELD , Integer . toString ( this . blank_lines_before_field ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION , Integer . toString ( this . blank_lines_before_first_class_body_declaration ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_IMPORTS , Integer . toString ( this . blank_lines_before_imports ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE , Integer . toString ( this . blank_lines_before_member_type ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_METHOD , Integer . toString ( this . blank_lines_before_method ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK , Integer . toString ( this . blank_lines_before_new_chunk ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_PACKAGE , Integer . toString ( this . blank_lines_before_package ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS , Integer . toString ( this . blank_lines_between_import_groups ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS , Integer . toString ( this . blank_lines_between_type_declarations ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY , Integer . toString ( this . blank_lines_at_beginning_of_method_body ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK , this . indent_statements_compare_to_block ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY , this . indent_statements_compare_to_body ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER , this . indent_body_declarations_compare_to_annotation_declaration_header ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER , this . indent_body_declarations_compare_to_enum_constant_header ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER , this . indent_body_declarations_compare_to_enum_declaration_header ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER , this . indent_body_declarations_compare_to_type_header ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES , this . indent_breaks_compare_to_cases ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_EMPTY_LINES , this . indent_empty_lines ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES , this . indent_switchstatements_compare_to_cases ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH , this . indent_switchstatements_compare_to_switch ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INDENTATION_SIZE , Integer . toString ( this . indentation_size ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE , this . insert_new_line_after_annotation_on_type ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD , this . insert_new_line_after_annotation_on_field ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD , this . insert_new_line_after_annotation_on_method ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE , this . insert_new_line_after_annotation_on_package ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER , this . insert_new_line_after_annotation_on_parameter ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE , this . insert_new_line_after_annotation_on_local_variable ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER , this . insert_new_line_after_opening_brace_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING , this . insert_new_line_at_end_of_file_if_missing ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT , this . insert_new_line_before_catch_in_try_statement ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER , this . insert_new_line_before_closing_brace_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT , this . insert_new_line_before_else_in_if_statement ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT , this . insert_new_line_before_finally_in_try_statement ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT , this . insert_new_line_before_while_in_do_statement ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION , this . insert_new_line_in_empty_anonymous_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK , this . insert_new_line_in_empty_block ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION , this . insert_new_line_in_empty_annotation_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT , this . insert_new_line_in_empty_enum_constant ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION , this . insert_new_line_in_empty_enum_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY , this . insert_new_line_in_empty_method_body ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION , this . insert_new_line_in_empty_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_LABEL , this . insert_new_line_after_label ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER , this . insert_space_after_and_in_type_parameter ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR , this . insert_space_after_assignment_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION , this . insert_space_after_at_in_annotation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION_TYPE_DECLARATION , this . insert_space_after_at_in_annotation_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR , this . insert_space_after_binary_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS , this . insert_space_after_closing_angle_bracket_in_type_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS , this . insert_space_after_closing_angle_bracket_in_type_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST , this . insert_space_after_closing_paren_in_cast ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK , this . insert_space_after_closing_brace_in_block ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT , this . insert_space_after_colon_in_assert ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE , this . insert_space_after_colon_in_case ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL , this . insert_space_after_colon_in_conditional ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR , this . insert_space_after_colon_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT , this . insert_space_after_colon_in_labeled_statement ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION , this . insert_space_after_comma_in_allocation_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION , this . insert_space_after_comma_in_annotation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER , this . insert_space_after_comma_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS , this . insert_space_after_comma_in_constructor_declaration_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS , this . insert_space_after_comma_in_constructor_declaration_throws ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS , this . insert_space_after_comma_in_enum_constant_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS , this . insert_space_after_comma_in_enum_declarations ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS , this . insert_space_after_comma_in_explicit_constructor_call_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS , this . insert_space_after_comma_in_for_increments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS , this . insert_space_after_comma_in_for_inits ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS , this . insert_space_after_comma_in_method_invocation_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS , this . insert_space_after_comma_in_method_declaration_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS , this . insert_space_after_comma_in_method_declaration_throws ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS , this . insert_space_after_comma_in_multiple_field_declarations ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS , this . insert_space_after_comma_in_multiple_local_declarations ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE , this . insert_space_after_comma_in_parameterized_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES , this . insert_space_after_comma_in_superinterfaces ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS , this . insert_space_after_comma_in_type_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS , this . insert_space_after_comma_in_type_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION , this . insert_space_after_opening_bracket_in_array_allocation_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS , this . insert_space_after_ellipsis ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE , this . insert_space_after_opening_angle_bracket_in_parameterized_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS , this . insert_space_after_opening_angle_bracket_in_type_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS , this . insert_space_after_opening_angle_bracket_in_type_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE , this . insert_space_after_opening_bracket_in_array_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER , this . insert_space_after_opening_brace_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION , this . insert_space_after_opening_paren_in_annotation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST , this . insert_space_after_opening_paren_in_cast ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH , this . insert_space_after_opening_paren_in_catch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION , this . insert_space_after_opening_paren_in_constructor_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT , this . insert_space_after_opening_paren_in_enum_constant ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR , this . insert_space_after_opening_paren_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF , this . insert_space_after_opening_paren_in_if ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION , this . insert_space_after_opening_paren_in_method_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION , this . insert_space_after_opening_paren_in_method_invocation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION , this . insert_space_after_opening_paren_in_parenthesized_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH , this . insert_space_after_opening_paren_in_switch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED , this . insert_space_after_opening_paren_in_synchronized ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_TRY , this . insert_space_after_opening_paren_in_try ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE , this . insert_space_after_opening_paren_in_while ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR , this . insert_space_after_postfix_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR , this . insert_space_after_prefix_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL , this . insert_space_after_question_in_conditional ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_WILDCARD , this . insert_space_after_question_in_wilcard ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR , this . insert_space_after_semicolon_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_TRY_RESOURCES , this . insert_space_after_semicolon_in_try_resources ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR , this . insert_space_after_unary_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER , this . insert_space_before_and_in_type_parameter ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION , this . insert_space_before_at_in_annotation_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR , this . insert_space_before_assignment_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR , this . insert_space_before_binary_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE , this . insert_space_before_closing_angle_bracket_in_parameterized_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS , this . insert_space_before_closing_angle_bracket_in_type_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS , this . insert_space_before_closing_angle_bracket_in_type_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER , this . insert_space_before_closing_brace_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION , this . insert_space_before_closing_bracket_in_array_allocation_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE , this . insert_space_before_closing_bracket_in_array_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION , this . insert_space_before_closing_paren_in_annotation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST , this . insert_space_before_closing_paren_in_cast ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH , this . insert_space_before_closing_paren_in_catch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION , this . insert_space_before_closing_paren_in_constructor_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT , this . insert_space_before_closing_paren_in_enum_constant ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR , this . insert_space_before_closing_paren_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF , this . insert_space_before_closing_paren_in_if ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION , this . insert_space_before_closing_paren_in_method_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION , this . insert_space_before_closing_paren_in_method_invocation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION , this . insert_space_before_closing_paren_in_parenthesized_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH , this . insert_space_before_closing_paren_in_switch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED , this . insert_space_before_closing_paren_in_synchronized ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_TRY , this . insert_space_before_closing_paren_in_try ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE , this . insert_space_before_closing_paren_in_while ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT , this . insert_space_before_colon_in_assert ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE , this . insert_space_before_colon_in_case ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL , this . insert_space_before_colon_in_conditional ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT , this . insert_space_before_colon_in_default ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR , this . insert_space_before_colon_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT , this . insert_space_before_colon_in_labeled_statement ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION , this . insert_space_before_comma_in_allocation_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION , this . insert_space_before_comma_in_annotation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER , this . insert_space_before_comma_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS , this . insert_space_before_comma_in_constructor_declaration_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS , this . insert_space_before_comma_in_constructor_declaration_throws ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS , this . insert_space_before_comma_in_enum_constant_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS , this . insert_space_before_comma_in_enum_declarations ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS , this . insert_space_before_comma_in_explicit_constructor_call_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS , this . insert_space_before_comma_in_for_increments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS , this . insert_space_before_comma_in_for_inits ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS , this . insert_space_before_comma_in_method_invocation_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS , this . insert_space_before_comma_in_method_declaration_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS , this . insert_space_before_comma_in_method_declaration_throws ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS , this . insert_space_before_comma_in_multiple_field_declarations ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS , this . insert_space_before_comma_in_multiple_local_declarations ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES , this . insert_space_before_comma_in_superinterfaces ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS , this . insert_space_before_comma_in_type_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS , this . insert_space_before_comma_in_type_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE , this . insert_space_before_comma_in_parameterized_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS , this . insert_space_before_ellipsis ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE , this . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS , this . insert_space_before_opening_angle_bracket_in_type_arguments ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS , this . insert_space_before_opening_angle_bracket_in_type_parameters ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION , this . insert_space_before_opening_brace_in_annotation_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION , this . insert_space_before_opening_brace_in_anonymous_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER , this . insert_space_before_opening_brace_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK , this . insert_space_before_opening_brace_in_block ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION , this . insert_space_before_opening_brace_in_constructor_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT , this . insert_space_before_opening_brace_in_enum_constant ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION , this . insert_space_before_opening_brace_in_enum_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION , this . insert_space_before_opening_brace_in_method_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION , this . insert_space_before_opening_brace_in_type_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION , this . insert_space_before_opening_bracket_in_array_allocation_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE , this . insert_space_before_opening_bracket_in_array_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE , this . insert_space_before_opening_bracket_in_array_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION , this . insert_space_before_opening_paren_in_annotation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION , this . insert_space_before_opening_paren_in_annotation_type_member_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH , this . insert_space_before_opening_paren_in_catch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION , this . insert_space_before_opening_paren_in_constructor_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT , this . insert_space_before_opening_paren_in_enum_constant ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR , this . insert_space_before_opening_paren_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF , this . insert_space_before_opening_paren_in_if ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION , this . insert_space_before_opening_paren_in_method_invocation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION , this . insert_space_before_opening_paren_in_method_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH , this . insert_space_before_opening_paren_in_switch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH , this . insert_space_before_opening_brace_in_switch ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED , this . insert_space_before_opening_paren_in_synchronized ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_TRY , this . insert_space_before_opening_paren_in_try ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION , this . insert_space_before_opening_paren_in_parenthesized_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE , this . insert_space_before_opening_paren_in_while ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN , this . insert_space_before_parenthesized_expression_in_return ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW , this . insert_space_before_parenthesized_expression_in_throw ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR , this . insert_space_before_postfix_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR , this . insert_space_before_prefix_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL , this . insert_space_before_question_in_conditional ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD , this . insert_space_before_question_in_wilcard ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON , this . insert_space_before_semicolon ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR , this . insert_space_before_semicolon_in_for ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_TRY_RESOURCES , this . insert_space_before_semicolon_in_try_resources ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR , this . insert_space_before_unary_operator ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE , this . insert_space_between_brackets_in_array_type_reference ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER , this . insert_space_between_empty_braces_in_array_initializer ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION , this . insert_space_between_empty_brackets_in_array_allocation_expression ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION , this . insert_space_between_empty_parens_in_annotation_type_member_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION , this . insert_space_between_empty_parens_in_constructor_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT , this . insert_space_between_empty_parens_in_enum_constant ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION , this . insert_space_between_empty_parens_in_method_declaration ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION , this . insert_space_between_empty_parens_in_method_invocation ? JavaCore . INSERT : JavaCore . DO_NOT_INSERT ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_COMPACT_ELSE_IF , this . compact_else_if ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE , this . keep_guardian_clause_on_one_line ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE , this . keep_else_statement_on_same_line ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE , this . keep_empty_array_initializer_on_one_line ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE , this . keep_simple_if_on_one_line ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE , this . keep_then_statement_on_same_line ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN , this . never_indent_block_comments_on_first_column ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN , this . never_indent_line_comments_on_first_column ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE , Integer . toString ( this . number_of_empty_lines_to_preserve ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_JOIN_WRAPPED_LINES , this . join_wrapped_lines ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_JOIN_LINES_IN_COMMENTS , this . join_lines_in_comments ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE , this . put_empty_statement_on_new_line ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_LINE_SPLIT , Integer . toString ( this . page_width ) ) ; switch ( this . tab_char ) { case SPACE : options . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR , JavaCore . SPACE ) ; break ; case TAB : options . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR , JavaCore . TAB ) ; break ; case MIXED : options . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR , DefaultCodeFormatterConstants . MIXED ) ; break ; } options . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_SIZE , Integer . toString ( this . tab_size ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS , this . use_tabs_only_for_leading_indentations ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_WRAP_BEFORE_BINARY_OPERATOR , this . wrap_before_binary_operator ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_WRAP_BEFORE_OR_OPERATOR_MULTICATCH , this . wrap_before_or_operator_multicatch ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_DISABLING_TAG , this . disabling_tag == null ? Util . EMPTY_STRING : new String ( this . disabling_tag ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_ENABLING_TAG , this . enabling_tag == null ? Util . EMPTY_STRING : new String ( this . enabling_tag ) ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_USE_ON_OFF_TAGS , this . use_tags ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; options . put ( DefaultCodeFormatterConstants . FORMATTER_WRAP_OUTER_EXPRESSIONS_WHEN_NESTED , this . wrap_outer_expressions_when_nested ? DefaultCodeFormatterConstants . TRUE : DefaultCodeFormatterConstants . FALSE ) ; return options ; } public void set ( Map settings ) { final Object alignmentForArgumentsInAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION ) ; if ( alignmentForArgumentsInAllocationExpressionOption != null ) { try { this . alignment_for_arguments_in_allocation_expression = Integer . parseInt ( ( String ) alignmentForArgumentsInAllocationExpressionOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_arguments_in_allocation_expression = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_arguments_in_allocation_expression = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForArgumentsInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION ) ; if ( alignmentForArgumentsInAnnotationOption != null ) { try { this . alignment_for_arguments_in_annotation = Integer . parseInt ( ( String ) alignmentForArgumentsInAnnotationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_arguments_in_annotation = Alignment . M_NO_ALIGNMENT ; } catch ( ClassCastException e ) { this . alignment_for_arguments_in_annotation = Alignment . M_NO_ALIGNMENT ; } } final Object alignmentForArgumentsInEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT ) ; if ( alignmentForArgumentsInEnumConstantOption != null ) { try { this . alignment_for_arguments_in_enum_constant = Integer . parseInt ( ( String ) alignmentForArgumentsInEnumConstantOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_arguments_in_enum_constant = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_arguments_in_enum_constant = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForArgumentsInExplicitConstructorCallOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL ) ; if ( alignmentForArgumentsInExplicitConstructorCallOption != null ) { try { this . alignment_for_arguments_in_explicit_constructor_call = Integer . parseInt ( ( String ) alignmentForArgumentsInExplicitConstructorCallOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_arguments_in_explicit_constructor_call = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_arguments_in_explicit_constructor_call = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForArgumentsInMethodInvocationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION ) ; if ( alignmentForArgumentsInMethodInvocationOption != null ) { try { this . alignment_for_arguments_in_method_invocation = Integer . parseInt ( ( String ) alignmentForArgumentsInMethodInvocationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_arguments_in_method_invocation = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_arguments_in_method_invocation = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForArgumentsInQualifiedAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION ) ; if ( alignmentForArgumentsInQualifiedAllocationExpressionOption != null ) { try { this . alignment_for_arguments_in_qualified_allocation_expression = Integer . parseInt ( ( String ) alignmentForArgumentsInQualifiedAllocationExpressionOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_arguments_in_qualified_allocation_expression = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_arguments_in_qualified_allocation_expression = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForAssignmentOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ASSIGNMENT ) ; if ( alignmentForAssignmentOption != null ) { try { this . alignment_for_assignment = Integer . parseInt ( ( String ) alignmentForAssignmentOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_assignment = Alignment . M_ONE_PER_LINE_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_assignment = Alignment . M_ONE_PER_LINE_SPLIT ; } } final Object alignmentForBinaryExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION ) ; if ( alignmentForBinaryExpressionOption != null ) { try { this . alignment_for_binary_expression = Integer . parseInt ( ( String ) alignmentForBinaryExpressionOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_binary_expression = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_binary_expression = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForCompactIfOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_COMPACT_IF ) ; if ( alignmentForCompactIfOption != null ) { try { this . alignment_for_compact_if = Integer . parseInt ( ( String ) alignmentForCompactIfOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_compact_if = Alignment . M_ONE_PER_LINE_SPLIT | Alignment . M_INDENT_BY_ONE ; } catch ( ClassCastException e ) { this . alignment_for_compact_if = Alignment . M_ONE_PER_LINE_SPLIT | Alignment . M_INDENT_BY_ONE ; } } final Object alignmentForConditionalExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION ) ; if ( alignmentForConditionalExpressionOption != null ) { try { this . alignment_for_conditional_expression = Integer . parseInt ( ( String ) alignmentForConditionalExpressionOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_conditional_expression = Alignment . M_ONE_PER_LINE_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_conditional_expression = Alignment . M_ONE_PER_LINE_SPLIT ; } } final Object alignmentForEnumConstantsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS ) ; if ( alignmentForEnumConstantsOption != null ) { try { this . alignment_for_enum_constants = Integer . parseInt ( ( String ) alignmentForEnumConstantsOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_enum_constants = Alignment . NONE ; } catch ( ClassCastException e ) { this . alignment_for_enum_constants = Alignment . NONE ; } } final Object alignmentForExpressionsInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER ) ; if ( alignmentForExpressionsInArrayInitializerOption != null ) { try { this . alignment_for_expressions_in_array_initializer = Integer . parseInt ( ( String ) alignmentForExpressionsInArrayInitializerOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_expressions_in_array_initializer = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_expressions_in_array_initializer = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_METHOD_DECLARATION ) ; if ( alignmentForMethodDeclarationOption != null ) { try { this . alignment_for_method_declaration = Integer . parseInt ( ( String ) alignmentForMethodDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_method_declaration = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_method_declaration = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForMultipleFieldsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS ) ; if ( alignmentForMultipleFieldsOption != null ) { try { this . alignment_for_multiple_fields = Integer . parseInt ( ( String ) alignmentForMultipleFieldsOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_multiple_fields = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_multiple_fields = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForParametersInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION ) ; if ( alignmentForParametersInConstructorDeclarationOption != null ) { try { this . alignment_for_parameters_in_constructor_declaration = Integer . parseInt ( ( String ) alignmentForParametersInConstructorDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_parameters_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_parameters_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForParametersInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION ) ; if ( alignmentForParametersInMethodDeclarationOption != null ) { try { this . alignment_for_parameters_in_method_declaration = Integer . parseInt ( ( String ) alignmentForParametersInMethodDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_parameters_in_method_declaration = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_parameters_in_method_declaration = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForResourcesInTry = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY ) ; if ( alignmentForResourcesInTry != null ) { try { this . alignment_for_resources_in_try = Integer . parseInt ( ( String ) alignmentForResourcesInTry ) ; } catch ( NumberFormatException e ) { this . alignment_for_resources_in_try = Alignment . M_NEXT_PER_LINE_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_resources_in_try = Alignment . M_NEXT_PER_LINE_SPLIT ; } } final Object alignmentForSelectorInMethodInvocationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION ) ; if ( alignmentForSelectorInMethodInvocationOption != null ) { try { this . alignment_for_selector_in_method_invocation = Integer . parseInt ( ( String ) alignmentForSelectorInMethodInvocationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_selector_in_method_invocation = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_selector_in_method_invocation = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForSuperclassInTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION ) ; if ( alignmentForSuperclassInTypeDeclarationOption != null ) { try { this . alignment_for_superclass_in_type_declaration = Integer . parseInt ( ( String ) alignmentForSuperclassInTypeDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_superclass_in_type_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_superclass_in_type_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; } } final Object alignmentForSuperinterfacesInEnumDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION ) ; if ( alignmentForSuperinterfacesInEnumDeclarationOption != null ) { try { this . alignment_for_superinterfaces_in_enum_declaration = Integer . parseInt ( ( String ) alignmentForSuperinterfacesInEnumDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_superinterfaces_in_enum_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_superinterfaces_in_enum_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; } } final Object alignmentForSuperinterfacesInTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION ) ; if ( alignmentForSuperinterfacesInTypeDeclarationOption != null ) { try { this . alignment_for_superinterfaces_in_type_declaration = Integer . parseInt ( ( String ) alignmentForSuperinterfacesInTypeDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_superinterfaces_in_type_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_superinterfaces_in_type_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; } } final Object alignmentForThrowsClauseInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION ) ; if ( alignmentForThrowsClauseInConstructorDeclarationOption != null ) { try { this . alignment_for_throws_clause_in_constructor_declaration = Integer . parseInt ( ( String ) alignmentForThrowsClauseInConstructorDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_throws_clause_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_throws_clause_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForThrowsClauseInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION ) ; if ( alignmentForThrowsClauseInMethodDeclarationOption != null ) { try { this . alignment_for_throws_clause_in_method_declaration = Integer . parseInt ( ( String ) alignmentForThrowsClauseInMethodDeclarationOption ) ; } catch ( NumberFormatException e ) { this . alignment_for_throws_clause_in_method_declaration = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_throws_clause_in_method_declaration = Alignment . M_COMPACT_SPLIT ; } } final Object alignmentForUnionTypeInMulticatch = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_UNION_TYPE_IN_MULTICATCH ) ; if ( alignmentForUnionTypeInMulticatch != null ) { try { this . alignment_for_union_type_in_multicatch = Integer . parseInt ( ( String ) alignmentForUnionTypeInMulticatch ) ; } catch ( NumberFormatException e ) { this . alignment_for_union_type_in_multicatch = Alignment . M_COMPACT_SPLIT ; } catch ( ClassCastException e ) { this . alignment_for_union_type_in_multicatch = Alignment . M_COMPACT_SPLIT ; } } final Object alignTypeMembersOnColumnsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS ) ; if ( alignTypeMembersOnColumnsOption != null ) { this . align_type_members_on_columns = DefaultCodeFormatterConstants . TRUE . equals ( alignTypeMembersOnColumnsOption ) ; } final Object bracePositionForAnnotationTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION ) ; if ( bracePositionForAnnotationTypeDeclarationOption != null ) { try { this . brace_position_for_annotation_type_declaration = ( String ) bracePositionForAnnotationTypeDeclarationOption ; } catch ( ClassCastException e ) { this . brace_position_for_annotation_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForAnonymousTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION ) ; if ( bracePositionForAnonymousTypeDeclarationOption != null ) { try { this . brace_position_for_anonymous_type_declaration = ( String ) bracePositionForAnonymousTypeDeclarationOption ; } catch ( ClassCastException e ) { this . brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER ) ; if ( bracePositionForArrayInitializerOption != null ) { try { this . brace_position_for_array_initializer = ( String ) bracePositionForArrayInitializerOption ; } catch ( ClassCastException e ) { this . brace_position_for_array_initializer = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForBlockOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_BLOCK ) ; if ( bracePositionForBlockOption != null ) { try { this . brace_position_for_block = ( String ) bracePositionForBlockOption ; } catch ( ClassCastException e ) { this . brace_position_for_block = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForBlockInCaseOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE ) ; if ( bracePositionForBlockInCaseOption != null ) { try { this . brace_position_for_block_in_case = ( String ) bracePositionForBlockInCaseOption ; } catch ( ClassCastException e ) { this . brace_position_for_block_in_case = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION ) ; if ( bracePositionForConstructorDeclarationOption != null ) { try { this . brace_position_for_constructor_declaration = ( String ) bracePositionForConstructorDeclarationOption ; } catch ( ClassCastException e ) { this . brace_position_for_constructor_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT ) ; if ( bracePositionForEnumConstantOption != null ) { try { this . brace_position_for_enum_constant = ( String ) bracePositionForEnumConstantOption ; } catch ( ClassCastException e ) { this . brace_position_for_enum_constant = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForEnumDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION ) ; if ( bracePositionForEnumDeclarationOption != null ) { try { this . brace_position_for_enum_declaration = ( String ) bracePositionForEnumDeclarationOption ; } catch ( ClassCastException e ) { this . brace_position_for_enum_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION ) ; if ( bracePositionForMethodDeclarationOption != null ) { try { this . brace_position_for_method_declaration = ( String ) bracePositionForMethodDeclarationOption ; } catch ( ClassCastException e ) { this . brace_position_for_method_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForSwitchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_SWITCH ) ; if ( bracePositionForSwitchOption != null ) { try { this . brace_position_for_switch = ( String ) bracePositionForSwitchOption ; } catch ( ClassCastException e ) { this . brace_position_for_switch = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object bracePositionForTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION ) ; if ( bracePositionForTypeDeclarationOption != null ) { try { this . brace_position_for_type_declaration = ( String ) bracePositionForTypeDeclarationOption ; } catch ( ClassCastException e ) { this . brace_position_for_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; } } final Object continuationIndentationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_CONTINUATION_INDENTATION ) ; if ( continuationIndentationOption != null ) { try { this . continuation_indentation = Integer . parseInt ( ( String ) continuationIndentationOption ) ; } catch ( NumberFormatException e ) { this . continuation_indentation = <NUM_LIT:2> ; } catch ( ClassCastException e ) { this . continuation_indentation = <NUM_LIT:2> ; } } final Object continuationIndentationForArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER ) ; if ( continuationIndentationForArrayInitializerOption != null ) { try { this . continuation_indentation_for_array_initializer = Integer . parseInt ( ( String ) continuationIndentationForArrayInitializerOption ) ; } catch ( NumberFormatException e ) { this . continuation_indentation_for_array_initializer = <NUM_LIT:2> ; } catch ( ClassCastException e ) { this . continuation_indentation_for_array_initializer = <NUM_LIT:2> ; } } final Object blankLinesAfterImportsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_AFTER_IMPORTS ) ; if ( blankLinesAfterImportsOption != null ) { try { this . blank_lines_after_imports = Integer . parseInt ( ( String ) blankLinesAfterImportsOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_after_imports = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_after_imports = <NUM_LIT:0> ; } } final Object blankLinesAfterPackageOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_AFTER_PACKAGE ) ; if ( blankLinesAfterPackageOption != null ) { try { this . blank_lines_after_package = Integer . parseInt ( ( String ) blankLinesAfterPackageOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_after_package = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_after_package = <NUM_LIT:0> ; } } final Object blankLinesBeforeFieldOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_FIELD ) ; if ( blankLinesBeforeFieldOption != null ) { try { this . blank_lines_before_field = Integer . parseInt ( ( String ) blankLinesBeforeFieldOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_field = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_field = <NUM_LIT:0> ; } } final Object blankLinesBeforeFirstClassBodyDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION ) ; if ( blankLinesBeforeFirstClassBodyDeclarationOption != null ) { try { this . blank_lines_before_first_class_body_declaration = Integer . parseInt ( ( String ) blankLinesBeforeFirstClassBodyDeclarationOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_first_class_body_declaration = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_first_class_body_declaration = <NUM_LIT:0> ; } } final Object blankLinesBeforeImportsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_IMPORTS ) ; if ( blankLinesBeforeImportsOption != null ) { try { this . blank_lines_before_imports = Integer . parseInt ( ( String ) blankLinesBeforeImportsOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_imports = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_imports = <NUM_LIT:0> ; } } final Object blankLinesBeforeMemberTypeOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE ) ; if ( blankLinesBeforeMemberTypeOption != null ) { try { this . blank_lines_before_member_type = Integer . parseInt ( ( String ) blankLinesBeforeMemberTypeOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_member_type = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_member_type = <NUM_LIT:0> ; } } final Object blankLinesBeforeMethodOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_METHOD ) ; if ( blankLinesBeforeMethodOption != null ) { try { this . blank_lines_before_method = Integer . parseInt ( ( String ) blankLinesBeforeMethodOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_method = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_method = <NUM_LIT:0> ; } } final Object blankLinesBeforeNewChunkOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK ) ; if ( blankLinesBeforeNewChunkOption != null ) { try { this . blank_lines_before_new_chunk = Integer . parseInt ( ( String ) blankLinesBeforeNewChunkOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_new_chunk = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_new_chunk = <NUM_LIT:0> ; } } final Object blankLinesBeforePackageOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BEFORE_PACKAGE ) ; if ( blankLinesBeforePackageOption != null ) { try { this . blank_lines_before_package = Integer . parseInt ( ( String ) blankLinesBeforePackageOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_before_package = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_before_package = <NUM_LIT:0> ; } } final Object blankLinesBetweenImportGroupsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS ) ; if ( blankLinesBetweenImportGroupsOption != null ) { try { this . blank_lines_between_import_groups = Integer . parseInt ( ( String ) blankLinesBetweenImportGroupsOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_between_import_groups = <NUM_LIT:1> ; } catch ( ClassCastException e ) { this . blank_lines_between_import_groups = <NUM_LIT:1> ; } } final Object blankLinesBetweenTypeDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS ) ; if ( blankLinesBetweenTypeDeclarationsOption != null ) { try { this . blank_lines_between_type_declarations = Integer . parseInt ( ( String ) blankLinesBetweenTypeDeclarationsOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_between_type_declarations = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_between_type_declarations = <NUM_LIT:0> ; } } final Object blankLinesAtBeginningOfMethodBodyOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY ) ; if ( blankLinesAtBeginningOfMethodBodyOption != null ) { try { this . blank_lines_at_beginning_of_method_body = Integer . parseInt ( ( String ) blankLinesAtBeginningOfMethodBodyOption ) ; } catch ( NumberFormatException e ) { this . blank_lines_at_beginning_of_method_body = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . blank_lines_at_beginning_of_method_body = <NUM_LIT:0> ; } } setDeprecatedOptions ( settings ) ; final Object commentFormatJavadocCommentOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT ) ; if ( commentFormatJavadocCommentOption != null ) { this . comment_format_javadoc_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentFormatJavadocCommentOption ) ; } final Object commentFormatBlockCommentOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT ) ; if ( commentFormatBlockCommentOption != null ) { this . comment_format_block_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentFormatBlockCommentOption ) ; } final Object commentFormatLineCommentOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_LINE_COMMENT ) ; if ( commentFormatLineCommentOption != null ) { this . comment_format_line_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentFormatLineCommentOption ) ; } final Object formatLineCommentStartingOnFirstColumnOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN ) ; if ( formatLineCommentStartingOnFirstColumnOption != null ) { this . comment_format_line_comment_starting_on_first_column = DefaultCodeFormatterConstants . TRUE . equals ( formatLineCommentStartingOnFirstColumnOption ) ; } final Object commentFormatHeaderOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_HEADER ) ; if ( commentFormatHeaderOption != null ) { this . comment_format_header = DefaultCodeFormatterConstants . TRUE . equals ( commentFormatHeaderOption ) ; } final Object commentFormatHtmlOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_HTML ) ; if ( commentFormatHtmlOption != null ) { this . comment_format_html = DefaultCodeFormatterConstants . TRUE . equals ( commentFormatHtmlOption ) ; } final Object commentFormatSourceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_SOURCE ) ; if ( commentFormatSourceOption != null ) { this . comment_format_source = DefaultCodeFormatterConstants . TRUE . equals ( commentFormatSourceOption ) ; } final Object commentIndentParameterDescriptionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION ) ; if ( commentIndentParameterDescriptionOption != null ) { this . comment_indent_parameter_description = DefaultCodeFormatterConstants . TRUE . equals ( commentIndentParameterDescriptionOption ) ; } final Object commentIndentRootTagsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INDENT_ROOT_TAGS ) ; if ( commentIndentRootTagsOption != null ) { this . comment_indent_root_tags = DefaultCodeFormatterConstants . TRUE . equals ( commentIndentRootTagsOption ) ; } final Object commentInsertEmptyLineBeforeRootTagsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS ) ; if ( commentInsertEmptyLineBeforeRootTagsOption != null ) { this . comment_insert_empty_line_before_root_tags = JavaCore . INSERT . equals ( commentInsertEmptyLineBeforeRootTagsOption ) ; } final Object commentInsertNewLineForParameterOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER ) ; if ( commentInsertNewLineForParameterOption != null ) { this . comment_insert_new_line_for_parameter = JavaCore . INSERT . equals ( commentInsertNewLineForParameterOption ) ; } final Object commentPreserveWhiteSpaceBetweenCodeAndLineCommentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_PRESERVE_WHITE_SPACE_BETWEEN_CODE_AND_LINE_COMMENT ) ; if ( commentPreserveWhiteSpaceBetweenCodeAndLineCommentsOption != null ) { this . comment_preserve_white_space_between_code_and_line_comments = DefaultCodeFormatterConstants . TRUE . equals ( commentPreserveWhiteSpaceBetweenCodeAndLineCommentsOption ) ; } final Object commentLineLengthOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_LINE_LENGTH ) ; if ( commentLineLengthOption != null ) { try { this . comment_line_length = Integer . parseInt ( ( String ) commentLineLengthOption ) ; } catch ( NumberFormatException e ) { this . comment_line_length = <NUM_LIT> ; } catch ( ClassCastException e ) { this . comment_line_length = <NUM_LIT> ; } } final Object commentNewLinesAtBlockBoundariesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES ) ; if ( commentNewLinesAtBlockBoundariesOption != null ) { this . comment_new_lines_at_block_boundaries = DefaultCodeFormatterConstants . TRUE . equals ( commentNewLinesAtBlockBoundariesOption ) ; } final Object commentNewLinesAtJavadocBoundariesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES ) ; if ( commentNewLinesAtJavadocBoundariesOption != null ) { this . comment_new_lines_at_javadoc_boundaries = DefaultCodeFormatterConstants . TRUE . equals ( commentNewLinesAtJavadocBoundariesOption ) ; } final Object indentStatementsCompareToBlockOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK ) ; if ( indentStatementsCompareToBlockOption != null ) { this . indent_statements_compare_to_block = DefaultCodeFormatterConstants . TRUE . equals ( indentStatementsCompareToBlockOption ) ; } final Object indentStatementsCompareToBodyOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY ) ; if ( indentStatementsCompareToBodyOption != null ) { this . indent_statements_compare_to_body = DefaultCodeFormatterConstants . TRUE . equals ( indentStatementsCompareToBodyOption ) ; } final Object indentBodyDeclarationsCompareToAnnotationDeclarationHeaderOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER ) ; if ( indentBodyDeclarationsCompareToAnnotationDeclarationHeaderOption != null ) { this . indent_body_declarations_compare_to_annotation_declaration_header = DefaultCodeFormatterConstants . TRUE . equals ( indentBodyDeclarationsCompareToAnnotationDeclarationHeaderOption ) ; } final Object indentBodyDeclarationsCompareToEnumConstantHeaderOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER ) ; if ( indentBodyDeclarationsCompareToEnumConstantHeaderOption != null ) { this . indent_body_declarations_compare_to_enum_constant_header = DefaultCodeFormatterConstants . TRUE . equals ( indentBodyDeclarationsCompareToEnumConstantHeaderOption ) ; } final Object indentBodyDeclarationsCompareToEnumDeclarationHeaderOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER ) ; if ( indentBodyDeclarationsCompareToEnumDeclarationHeaderOption != null ) { this . indent_body_declarations_compare_to_enum_declaration_header = DefaultCodeFormatterConstants . TRUE . equals ( indentBodyDeclarationsCompareToEnumDeclarationHeaderOption ) ; } final Object indentBodyDeclarationsCompareToTypeHeaderOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER ) ; if ( indentBodyDeclarationsCompareToTypeHeaderOption != null ) { this . indent_body_declarations_compare_to_type_header = DefaultCodeFormatterConstants . TRUE . equals ( indentBodyDeclarationsCompareToTypeHeaderOption ) ; } final Object indentBreaksCompareToCasesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES ) ; if ( indentBreaksCompareToCasesOption != null ) { this . indent_breaks_compare_to_cases = DefaultCodeFormatterConstants . TRUE . equals ( indentBreaksCompareToCasesOption ) ; } final Object indentEmptyLinesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_EMPTY_LINES ) ; if ( indentEmptyLinesOption != null ) { this . indent_empty_lines = DefaultCodeFormatterConstants . TRUE . equals ( indentEmptyLinesOption ) ; } final Object indentSwitchstatementsCompareToCasesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES ) ; if ( indentSwitchstatementsCompareToCasesOption != null ) { this . indent_switchstatements_compare_to_cases = DefaultCodeFormatterConstants . TRUE . equals ( indentSwitchstatementsCompareToCasesOption ) ; } final Object indentSwitchstatementsCompareToSwitchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH ) ; if ( indentSwitchstatementsCompareToSwitchOption != null ) { this . indent_switchstatements_compare_to_switch = DefaultCodeFormatterConstants . TRUE . equals ( indentSwitchstatementsCompareToSwitchOption ) ; } final Object indentationSizeOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INDENTATION_SIZE ) ; if ( indentationSizeOption != null ) { try { this . indentation_size = Integer . parseInt ( ( String ) indentationSizeOption ) ; } catch ( NumberFormatException e ) { this . indentation_size = <NUM_LIT:4> ; } catch ( ClassCastException e ) { this . indentation_size = <NUM_LIT:4> ; } } final Object insertNewLineAfterOpeningBraceInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER ) ; if ( insertNewLineAfterOpeningBraceInArrayInitializerOption != null ) { this . insert_new_line_after_opening_brace_in_array_initializer = JavaCore . INSERT . equals ( insertNewLineAfterOpeningBraceInArrayInitializerOption ) ; } final Object insertNewLineAtEndOfFileIfMissingOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING ) ; if ( insertNewLineAtEndOfFileIfMissingOption != null ) { this . insert_new_line_at_end_of_file_if_missing = JavaCore . INSERT . equals ( insertNewLineAtEndOfFileIfMissingOption ) ; } final Object insertNewLineBeforeCatchInTryStatementOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT ) ; if ( insertNewLineBeforeCatchInTryStatementOption != null ) { this . insert_new_line_before_catch_in_try_statement = JavaCore . INSERT . equals ( insertNewLineBeforeCatchInTryStatementOption ) ; } final Object insertNewLineBeforeClosingBraceInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER ) ; if ( insertNewLineBeforeClosingBraceInArrayInitializerOption != null ) { this . insert_new_line_before_closing_brace_in_array_initializer = JavaCore . INSERT . equals ( insertNewLineBeforeClosingBraceInArrayInitializerOption ) ; } final Object insertNewLineBeforeElseInIfStatementOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT ) ; if ( insertNewLineBeforeElseInIfStatementOption != null ) { this . insert_new_line_before_else_in_if_statement = JavaCore . INSERT . equals ( insertNewLineBeforeElseInIfStatementOption ) ; } final Object insertNewLineBeforeFinallyInTryStatementOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT ) ; if ( insertNewLineBeforeFinallyInTryStatementOption != null ) { this . insert_new_line_before_finally_in_try_statement = JavaCore . INSERT . equals ( insertNewLineBeforeFinallyInTryStatementOption ) ; } final Object insertNewLineBeforeWhileInDoStatementOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT ) ; if ( insertNewLineBeforeWhileInDoStatementOption != null ) { this . insert_new_line_before_while_in_do_statement = JavaCore . INSERT . equals ( insertNewLineBeforeWhileInDoStatementOption ) ; } final Object insertNewLineInEmptyAnonymousTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION ) ; if ( insertNewLineInEmptyAnonymousTypeDeclarationOption != null ) { this . insert_new_line_in_empty_anonymous_type_declaration = JavaCore . INSERT . equals ( insertNewLineInEmptyAnonymousTypeDeclarationOption ) ; } final Object insertNewLineInEmptyBlockOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK ) ; if ( insertNewLineInEmptyBlockOption != null ) { this . insert_new_line_in_empty_block = JavaCore . INSERT . equals ( insertNewLineInEmptyBlockOption ) ; } final Object insertNewLineInEmptyAnnotationDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION ) ; if ( insertNewLineInEmptyAnnotationDeclarationOption != null ) { this . insert_new_line_in_empty_annotation_declaration = JavaCore . INSERT . equals ( insertNewLineInEmptyAnnotationDeclarationOption ) ; } final Object insertNewLineInEmptyEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT ) ; if ( insertNewLineInEmptyEnumConstantOption != null ) { this . insert_new_line_in_empty_enum_constant = JavaCore . INSERT . equals ( insertNewLineInEmptyEnumConstantOption ) ; } final Object insertNewLineInEmptyEnumDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION ) ; if ( insertNewLineInEmptyEnumDeclarationOption != null ) { this . insert_new_line_in_empty_enum_declaration = JavaCore . INSERT . equals ( insertNewLineInEmptyEnumDeclarationOption ) ; } final Object insertNewLineInEmptyMethodBodyOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY ) ; if ( insertNewLineInEmptyMethodBodyOption != null ) { this . insert_new_line_in_empty_method_body = JavaCore . INSERT . equals ( insertNewLineInEmptyMethodBodyOption ) ; } final Object insertNewLineInEmptyTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION ) ; if ( insertNewLineInEmptyTypeDeclarationOption != null ) { this . insert_new_line_in_empty_type_declaration = JavaCore . INSERT . equals ( insertNewLineInEmptyTypeDeclarationOption ) ; } final Object insertNewLineAfterLabelOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_LABEL ) ; if ( insertNewLineAfterLabelOption != null ) { this . insert_new_line_after_label = JavaCore . INSERT . equals ( insertNewLineAfterLabelOption ) ; } final Object insertSpaceAfterAndInWildcardOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER ) ; if ( insertSpaceAfterAndInWildcardOption != null ) { this . insert_space_after_and_in_type_parameter = JavaCore . INSERT . equals ( insertSpaceAfterAndInWildcardOption ) ; } final Object insertSpaceAfterAssignmentOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR ) ; if ( insertSpaceAfterAssignmentOperatorOption != null ) { this . insert_space_after_assignment_operator = JavaCore . INSERT . equals ( insertSpaceAfterAssignmentOperatorOption ) ; } final Object insertSpaceAfterAtInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION ) ; if ( insertSpaceAfterAtInAnnotationOption != null ) { this . insert_space_after_at_in_annotation = JavaCore . INSERT . equals ( insertSpaceAfterAtInAnnotationOption ) ; } final Object insertSpaceAfterAtInAnnotationTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION_TYPE_DECLARATION ) ; if ( insertSpaceAfterAtInAnnotationTypeDeclarationOption != null ) { this . insert_space_after_at_in_annotation_type_declaration = JavaCore . INSERT . equals ( insertSpaceAfterAtInAnnotationTypeDeclarationOption ) ; } final Object insertSpaceAfterBinaryOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR ) ; if ( insertSpaceAfterBinaryOperatorOption != null ) { this . insert_space_after_binary_operator = JavaCore . INSERT . equals ( insertSpaceAfterBinaryOperatorOption ) ; } final Object insertSpaceAfterClosingAngleBracketInTypeArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS ) ; if ( insertSpaceAfterClosingAngleBracketInTypeArgumentsOption != null ) { this . insert_space_after_closing_angle_bracket_in_type_arguments = JavaCore . INSERT . equals ( insertSpaceAfterClosingAngleBracketInTypeArgumentsOption ) ; } final Object insertSpaceAfterClosingAngleBracketInTypeParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS ) ; if ( insertSpaceAfterClosingAngleBracketInTypeParametersOption != null ) { this . insert_space_after_closing_angle_bracket_in_type_parameters = JavaCore . INSERT . equals ( insertSpaceAfterClosingAngleBracketInTypeParametersOption ) ; } final Object insertSpaceAfterClosingParenInCastOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST ) ; if ( insertSpaceAfterClosingParenInCastOption != null ) { this . insert_space_after_closing_paren_in_cast = JavaCore . INSERT . equals ( insertSpaceAfterClosingParenInCastOption ) ; } final Object insertSpaceAfterClosingBraceInBlockOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK ) ; if ( insertSpaceAfterClosingBraceInBlockOption != null ) { this . insert_space_after_closing_brace_in_block = JavaCore . INSERT . equals ( insertSpaceAfterClosingBraceInBlockOption ) ; } final Object insertSpaceAfterColonInAssertOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT ) ; if ( insertSpaceAfterColonInAssertOption != null ) { this . insert_space_after_colon_in_assert = JavaCore . INSERT . equals ( insertSpaceAfterColonInAssertOption ) ; } final Object insertSpaceAfterColonInCaseOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE ) ; if ( insertSpaceAfterColonInCaseOption != null ) { this . insert_space_after_colon_in_case = JavaCore . INSERT . equals ( insertSpaceAfterColonInCaseOption ) ; } final Object insertSpaceAfterColonInConditionalOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL ) ; if ( insertSpaceAfterColonInConditionalOption != null ) { this . insert_space_after_colon_in_conditional = JavaCore . INSERT . equals ( insertSpaceAfterColonInConditionalOption ) ; } final Object insertSpaceAfterColonInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR ) ; if ( insertSpaceAfterColonInForOption != null ) { this . insert_space_after_colon_in_for = JavaCore . INSERT . equals ( insertSpaceAfterColonInForOption ) ; } final Object insertSpaceAfterColonInLabeledStatementOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT ) ; if ( insertSpaceAfterColonInLabeledStatementOption != null ) { this . insert_space_after_colon_in_labeled_statement = JavaCore . INSERT . equals ( insertSpaceAfterColonInLabeledStatementOption ) ; } final Object insertSpaceAfterCommaInAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION ) ; if ( insertSpaceAfterCommaInAllocationExpressionOption != null ) { this . insert_space_after_comma_in_allocation_expression = JavaCore . INSERT . equals ( insertSpaceAfterCommaInAllocationExpressionOption ) ; } final Object insertSpaceAfterCommaInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION ) ; if ( insertSpaceAfterCommaInAnnotationOption != null ) { this . insert_space_after_comma_in_annotation = JavaCore . INSERT . equals ( insertSpaceAfterCommaInAnnotationOption ) ; } final Object insertSpaceAfterCommaInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER ) ; if ( insertSpaceAfterCommaInArrayInitializerOption != null ) { this . insert_space_after_comma_in_array_initializer = JavaCore . INSERT . equals ( insertSpaceAfterCommaInArrayInitializerOption ) ; } final Object insertSpaceAfterCommaInConstructorDeclarationParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS ) ; if ( insertSpaceAfterCommaInConstructorDeclarationParametersOption != null ) { this . insert_space_after_comma_in_constructor_declaration_parameters = JavaCore . INSERT . equals ( insertSpaceAfterCommaInConstructorDeclarationParametersOption ) ; } final Object insertSpaceAfterCommaInConstructorDeclarationThrowsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS ) ; if ( insertSpaceAfterCommaInConstructorDeclarationThrowsOption != null ) { this . insert_space_after_comma_in_constructor_declaration_throws = JavaCore . INSERT . equals ( insertSpaceAfterCommaInConstructorDeclarationThrowsOption ) ; } final Object insertSpaceAfterCommaInEnumConstantArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS ) ; if ( insertSpaceAfterCommaInEnumConstantArgumentsOption != null ) { this . insert_space_after_comma_in_enum_constant_arguments = JavaCore . INSERT . equals ( insertSpaceAfterCommaInEnumConstantArgumentsOption ) ; } final Object insertSpaceAfterCommaInEnumDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS ) ; if ( insertSpaceAfterCommaInEnumDeclarationsOption != null ) { this . insert_space_after_comma_in_enum_declarations = JavaCore . INSERT . equals ( insertSpaceAfterCommaInEnumDeclarationsOption ) ; } final Object insertSpaceAfterCommaInExplicitConstructorCallArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS ) ; if ( insertSpaceAfterCommaInExplicitConstructorCallArgumentsOption != null ) { this . insert_space_after_comma_in_explicit_constructor_call_arguments = JavaCore . INSERT . equals ( insertSpaceAfterCommaInExplicitConstructorCallArgumentsOption ) ; } final Object insertSpaceAfterCommaInForIncrementsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS ) ; if ( insertSpaceAfterCommaInForIncrementsOption != null ) { this . insert_space_after_comma_in_for_increments = JavaCore . INSERT . equals ( insertSpaceAfterCommaInForIncrementsOption ) ; } final Object insertSpaceAfterCommaInForInitsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS ) ; if ( insertSpaceAfterCommaInForInitsOption != null ) { this . insert_space_after_comma_in_for_inits = JavaCore . INSERT . equals ( insertSpaceAfterCommaInForInitsOption ) ; } final Object insertSpaceAfterCommaInMethodInvocationArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS ) ; if ( insertSpaceAfterCommaInMethodInvocationArgumentsOption != null ) { this . insert_space_after_comma_in_method_invocation_arguments = JavaCore . INSERT . equals ( insertSpaceAfterCommaInMethodInvocationArgumentsOption ) ; } final Object insertSpaceAfterCommaInMethodDeclarationParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS ) ; if ( insertSpaceAfterCommaInMethodDeclarationParametersOption != null ) { this . insert_space_after_comma_in_method_declaration_parameters = JavaCore . INSERT . equals ( insertSpaceAfterCommaInMethodDeclarationParametersOption ) ; } final Object insertSpaceAfterCommaInMethodDeclarationThrowsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS ) ; if ( insertSpaceAfterCommaInMethodDeclarationThrowsOption != null ) { this . insert_space_after_comma_in_method_declaration_throws = JavaCore . INSERT . equals ( insertSpaceAfterCommaInMethodDeclarationThrowsOption ) ; } final Object insertSpaceAfterCommaInMultipleFieldDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS ) ; if ( insertSpaceAfterCommaInMultipleFieldDeclarationsOption != null ) { this . insert_space_after_comma_in_multiple_field_declarations = JavaCore . INSERT . equals ( insertSpaceAfterCommaInMultipleFieldDeclarationsOption ) ; } final Object insertSpaceAfterCommaInMultipleLocalDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS ) ; if ( insertSpaceAfterCommaInMultipleLocalDeclarationsOption != null ) { this . insert_space_after_comma_in_multiple_local_declarations = JavaCore . INSERT . equals ( insertSpaceAfterCommaInMultipleLocalDeclarationsOption ) ; } final Object insertSpaceAfterCommaInParameterizedTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE ) ; if ( insertSpaceAfterCommaInParameterizedTypeReferenceOption != null ) { this . insert_space_after_comma_in_parameterized_type_reference = JavaCore . INSERT . equals ( insertSpaceAfterCommaInParameterizedTypeReferenceOption ) ; } final Object insertSpaceAfterCommaInSuperinterfacesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES ) ; if ( insertSpaceAfterCommaInSuperinterfacesOption != null ) { this . insert_space_after_comma_in_superinterfaces = JavaCore . INSERT . equals ( insertSpaceAfterCommaInSuperinterfacesOption ) ; } final Object insertSpaceAfterCommaInTypeArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS ) ; if ( insertSpaceAfterCommaInTypeArgumentsOption != null ) { this . insert_space_after_comma_in_type_arguments = JavaCore . INSERT . equals ( insertSpaceAfterCommaInTypeArgumentsOption ) ; } final Object insertSpaceAfterCommaInTypeParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS ) ; if ( insertSpaceAfterCommaInTypeParametersOption != null ) { this . insert_space_after_comma_in_type_parameters = JavaCore . INSERT . equals ( insertSpaceAfterCommaInTypeParametersOption ) ; } final Object insertSpaceAfterEllipsisOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS ) ; if ( insertSpaceAfterEllipsisOption != null ) { this . insert_space_after_ellipsis = JavaCore . INSERT . equals ( insertSpaceAfterEllipsisOption ) ; } final Object insertSpaceAfterOpeningAngleBracketInParameterizedTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE ) ; if ( insertSpaceAfterOpeningAngleBracketInParameterizedTypeReferenceOption != null ) { this . insert_space_after_opening_angle_bracket_in_parameterized_type_reference = JavaCore . INSERT . equals ( insertSpaceAfterOpeningAngleBracketInParameterizedTypeReferenceOption ) ; } final Object insertSpaceAfterOpeningAngleBracketInTypeArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS ) ; if ( insertSpaceAfterOpeningAngleBracketInTypeArgumentsOption != null ) { this . insert_space_after_opening_angle_bracket_in_type_arguments = JavaCore . INSERT . equals ( insertSpaceAfterOpeningAngleBracketInTypeArgumentsOption ) ; } final Object insertSpaceAfterOpeningAngleBracketInTypeParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS ) ; if ( insertSpaceAfterOpeningAngleBracketInTypeParametersOption != null ) { this . insert_space_after_opening_angle_bracket_in_type_parameters = JavaCore . INSERT . equals ( insertSpaceAfterOpeningAngleBracketInTypeParametersOption ) ; } final Object insertSpaceAfterOpeningBracketInArrayAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION ) ; if ( insertSpaceAfterOpeningBracketInArrayAllocationExpressionOption != null ) { this . insert_space_after_opening_bracket_in_array_allocation_expression = JavaCore . INSERT . equals ( insertSpaceAfterOpeningBracketInArrayAllocationExpressionOption ) ; } final Object insertSpaceAfterOpeningBracketInArrayReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE ) ; if ( insertSpaceAfterOpeningBracketInArrayReferenceOption != null ) { this . insert_space_after_opening_bracket_in_array_reference = JavaCore . INSERT . equals ( insertSpaceAfterOpeningBracketInArrayReferenceOption ) ; } final Object insertSpaceAfterOpeningBraceInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER ) ; if ( insertSpaceAfterOpeningBraceInArrayInitializerOption != null ) { this . insert_space_after_opening_brace_in_array_initializer = JavaCore . INSERT . equals ( insertSpaceAfterOpeningBraceInArrayInitializerOption ) ; } final Object insertSpaceAfterOpeningParenInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION ) ; if ( insertSpaceAfterOpeningParenInAnnotationOption != null ) { this . insert_space_after_opening_paren_in_annotation = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInAnnotationOption ) ; } final Object insertSpaceAfterOpeningParenInCastOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST ) ; if ( insertSpaceAfterOpeningParenInCastOption != null ) { this . insert_space_after_opening_paren_in_cast = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInCastOption ) ; } final Object insertSpaceAfterOpeningParenInCatchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH ) ; if ( insertSpaceAfterOpeningParenInCatchOption != null ) { this . insert_space_after_opening_paren_in_catch = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInCatchOption ) ; } final Object insertSpaceAfterOpeningParenInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION ) ; if ( insertSpaceAfterOpeningParenInConstructorDeclarationOption != null ) { this . insert_space_after_opening_paren_in_constructor_declaration = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInConstructorDeclarationOption ) ; } final Object insertSpaceAfterOpeningParenInEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT ) ; if ( insertSpaceAfterOpeningParenInEnumConstantOption != null ) { this . insert_space_after_opening_paren_in_enum_constant = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInEnumConstantOption ) ; } final Object insertSpaceAfterOpeningParenInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR ) ; if ( insertSpaceAfterOpeningParenInForOption != null ) { this . insert_space_after_opening_paren_in_for = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInForOption ) ; } final Object insertSpaceAfterOpeningParenInIfOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF ) ; if ( insertSpaceAfterOpeningParenInIfOption != null ) { this . insert_space_after_opening_paren_in_if = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInIfOption ) ; } final Object insertSpaceAfterOpeningParenInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION ) ; if ( insertSpaceAfterOpeningParenInMethodDeclarationOption != null ) { this . insert_space_after_opening_paren_in_method_declaration = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInMethodDeclarationOption ) ; } final Object insertSpaceAfterOpeningParenInMethodInvocationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION ) ; if ( insertSpaceAfterOpeningParenInMethodInvocationOption != null ) { this . insert_space_after_opening_paren_in_method_invocation = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInMethodInvocationOption ) ; } final Object insertSpaceAfterOpeningParenInParenthesizedExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION ) ; if ( insertSpaceAfterOpeningParenInParenthesizedExpressionOption != null ) { this . insert_space_after_opening_paren_in_parenthesized_expression = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInParenthesizedExpressionOption ) ; } final Object insertSpaceAfterOpeningParenInSwitchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH ) ; if ( insertSpaceAfterOpeningParenInSwitchOption != null ) { this . insert_space_after_opening_paren_in_switch = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInSwitchOption ) ; } final Object insertSpaceAfterOpeningParenInSynchronizedOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED ) ; if ( insertSpaceAfterOpeningParenInSynchronizedOption != null ) { this . insert_space_after_opening_paren_in_synchronized = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInSynchronizedOption ) ; } final Object insertSpaceAfterOpeningParenInTryOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_TRY ) ; if ( insertSpaceAfterOpeningParenInTryOption != null ) { this . insert_space_after_opening_paren_in_try = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInTryOption ) ; } final Object insertSpaceAfterOpeningParenInWhileOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE ) ; if ( insertSpaceAfterOpeningParenInWhileOption != null ) { this . insert_space_after_opening_paren_in_while = JavaCore . INSERT . equals ( insertSpaceAfterOpeningParenInWhileOption ) ; } final Object insertSpaceAfterPostfixOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR ) ; if ( insertSpaceAfterPostfixOperatorOption != null ) { this . insert_space_after_postfix_operator = JavaCore . INSERT . equals ( insertSpaceAfterPostfixOperatorOption ) ; } final Object insertSpaceAfterPrefixOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR ) ; if ( insertSpaceAfterPrefixOperatorOption != null ) { this . insert_space_after_prefix_operator = JavaCore . INSERT . equals ( insertSpaceAfterPrefixOperatorOption ) ; } final Object insertSpaceAfterQuestionInConditionalOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL ) ; if ( insertSpaceAfterQuestionInConditionalOption != null ) { this . insert_space_after_question_in_conditional = JavaCore . INSERT . equals ( insertSpaceAfterQuestionInConditionalOption ) ; } final Object insertSpaceAfterQuestionInWildcardOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_WILDCARD ) ; if ( insertSpaceAfterQuestionInWildcardOption != null ) { this . insert_space_after_question_in_wilcard = JavaCore . INSERT . equals ( insertSpaceAfterQuestionInWildcardOption ) ; } final Object insertSpaceAfterSemicolonInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR ) ; if ( insertSpaceAfterSemicolonInForOption != null ) { this . insert_space_after_semicolon_in_for = JavaCore . INSERT . equals ( insertSpaceAfterSemicolonInForOption ) ; } final Object insertSpaceAfterSemicolonInTryOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_TRY_RESOURCES ) ; if ( insertSpaceAfterSemicolonInTryOption != null ) { this . insert_space_after_semicolon_in_try_resources = JavaCore . INSERT . equals ( insertSpaceAfterSemicolonInTryOption ) ; } final Object insertSpaceAfterUnaryOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR ) ; if ( insertSpaceAfterUnaryOperatorOption != null ) { this . insert_space_after_unary_operator = JavaCore . INSERT . equals ( insertSpaceAfterUnaryOperatorOption ) ; } final Object insertSpaceBeforeAndInWildcardOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER ) ; if ( insertSpaceBeforeAndInWildcardOption != null ) { this . insert_space_before_and_in_type_parameter = JavaCore . INSERT . equals ( insertSpaceBeforeAndInWildcardOption ) ; } final Object insertSpaceBeforeAtInAnnotationTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION ) ; if ( insertSpaceBeforeAtInAnnotationTypeDeclarationOption != null ) { this . insert_space_before_at_in_annotation_type_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeAtInAnnotationTypeDeclarationOption ) ; } final Object insertSpaceBeforeAssignmentOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR ) ; if ( insertSpaceBeforeAssignmentOperatorOption != null ) { this . insert_space_before_assignment_operator = JavaCore . INSERT . equals ( insertSpaceBeforeAssignmentOperatorOption ) ; } final Object insertSpaceBeforeBinaryOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR ) ; if ( insertSpaceBeforeBinaryOperatorOption != null ) { this . insert_space_before_binary_operator = JavaCore . INSERT . equals ( insertSpaceBeforeBinaryOperatorOption ) ; } final Object insertSpaceBeforeClosingAngleBracketInParameterizedTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE ) ; if ( insertSpaceBeforeClosingAngleBracketInParameterizedTypeReferenceOption != null ) { this . insert_space_before_closing_angle_bracket_in_parameterized_type_reference = JavaCore . INSERT . equals ( insertSpaceBeforeClosingAngleBracketInParameterizedTypeReferenceOption ) ; } final Object insertSpaceBeforeClosingAngleBracketInTypeArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS ) ; if ( insertSpaceBeforeClosingAngleBracketInTypeArgumentsOption != null ) { this . insert_space_before_closing_angle_bracket_in_type_arguments = JavaCore . INSERT . equals ( insertSpaceBeforeClosingAngleBracketInTypeArgumentsOption ) ; } final Object insertSpaceBeforeClosingAngleBracketInTypeParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS ) ; if ( insertSpaceBeforeClosingAngleBracketInTypeParametersOption != null ) { this . insert_space_before_closing_angle_bracket_in_type_parameters = JavaCore . INSERT . equals ( insertSpaceBeforeClosingAngleBracketInTypeParametersOption ) ; } final Object insertSpaceBeforeClosingBraceInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER ) ; if ( insertSpaceBeforeClosingBraceInArrayInitializerOption != null ) { this . insert_space_before_closing_brace_in_array_initializer = JavaCore . INSERT . equals ( insertSpaceBeforeClosingBraceInArrayInitializerOption ) ; } final Object insertSpaceBeforeClosingBracketInArrayAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION ) ; if ( insertSpaceBeforeClosingBracketInArrayAllocationExpressionOption != null ) { this . insert_space_before_closing_bracket_in_array_allocation_expression = JavaCore . INSERT . equals ( insertSpaceBeforeClosingBracketInArrayAllocationExpressionOption ) ; } final Object insertSpaceBeforeClosingBracketInArrayReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE ) ; if ( insertSpaceBeforeClosingBracketInArrayReferenceOption != null ) { this . insert_space_before_closing_bracket_in_array_reference = JavaCore . INSERT . equals ( insertSpaceBeforeClosingBracketInArrayReferenceOption ) ; } final Object insertSpaceBeforeClosingParenInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION ) ; if ( insertSpaceBeforeClosingParenInAnnotationOption != null ) { this . insert_space_before_closing_paren_in_annotation = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInAnnotationOption ) ; } final Object insertSpaceBeforeClosingParenInCastOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST ) ; if ( insertSpaceBeforeClosingParenInCastOption != null ) { this . insert_space_before_closing_paren_in_cast = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInCastOption ) ; } final Object insertSpaceBeforeClosingParenInCatchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH ) ; if ( insertSpaceBeforeClosingParenInCatchOption != null ) { this . insert_space_before_closing_paren_in_catch = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInCatchOption ) ; } final Object insertSpaceBeforeClosingParenInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION ) ; if ( insertSpaceBeforeClosingParenInConstructorDeclarationOption != null ) { this . insert_space_before_closing_paren_in_constructor_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInConstructorDeclarationOption ) ; } final Object insertSpaceBeforeClosingParenInEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT ) ; if ( insertSpaceBeforeClosingParenInEnumConstantOption != null ) { this . insert_space_before_closing_paren_in_enum_constant = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInEnumConstantOption ) ; } final Object insertSpaceBeforeClosingParenInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR ) ; if ( insertSpaceBeforeClosingParenInForOption != null ) { this . insert_space_before_closing_paren_in_for = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInForOption ) ; } final Object insertSpaceBeforeClosingParenInIfOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF ) ; if ( insertSpaceBeforeClosingParenInIfOption != null ) { this . insert_space_before_closing_paren_in_if = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInIfOption ) ; } final Object insertSpaceBeforeClosingParenInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION ) ; if ( insertSpaceBeforeClosingParenInMethodDeclarationOption != null ) { this . insert_space_before_closing_paren_in_method_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInMethodDeclarationOption ) ; } final Object insertSpaceBeforeClosingParenInMethodInvocationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION ) ; if ( insertSpaceBeforeClosingParenInMethodInvocationOption != null ) { this . insert_space_before_closing_paren_in_method_invocation = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInMethodInvocationOption ) ; } final Object insertSpaceBeforeClosingParenInParenthesizedExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION ) ; if ( insertSpaceBeforeClosingParenInParenthesizedExpressionOption != null ) { this . insert_space_before_closing_paren_in_parenthesized_expression = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInParenthesizedExpressionOption ) ; } final Object insertSpaceBeforeClosingParenInSwitchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH ) ; if ( insertSpaceBeforeClosingParenInSwitchOption != null ) { this . insert_space_before_closing_paren_in_switch = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInSwitchOption ) ; } final Object insertSpaceBeforeClosingParenInSynchronizedOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED ) ; if ( insertSpaceBeforeClosingParenInSynchronizedOption != null ) { this . insert_space_before_closing_paren_in_synchronized = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInSynchronizedOption ) ; } final Object insertSpaceBeforeClosingParenInTryOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_TRY ) ; if ( insertSpaceBeforeClosingParenInTryOption != null ) { this . insert_space_before_closing_paren_in_try = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInTryOption ) ; } final Object insertSpaceBeforeClosingParenInWhileOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE ) ; if ( insertSpaceBeforeClosingParenInWhileOption != null ) { this . insert_space_before_closing_paren_in_while = JavaCore . INSERT . equals ( insertSpaceBeforeClosingParenInWhileOption ) ; } final Object insertSpaceBeforeColonInAssertOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT ) ; if ( insertSpaceBeforeColonInAssertOption != null ) { this . insert_space_before_colon_in_assert = JavaCore . INSERT . equals ( insertSpaceBeforeColonInAssertOption ) ; } final Object insertSpaceBeforeColonInCaseOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE ) ; if ( insertSpaceBeforeColonInCaseOption != null ) { this . insert_space_before_colon_in_case = JavaCore . INSERT . equals ( insertSpaceBeforeColonInCaseOption ) ; } final Object insertSpaceBeforeColonInConditionalOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL ) ; if ( insertSpaceBeforeColonInConditionalOption != null ) { this . insert_space_before_colon_in_conditional = JavaCore . INSERT . equals ( insertSpaceBeforeColonInConditionalOption ) ; } final Object insertSpaceBeforeColonInDefaultOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT ) ; if ( insertSpaceBeforeColonInDefaultOption != null ) { this . insert_space_before_colon_in_default = JavaCore . INSERT . equals ( insertSpaceBeforeColonInDefaultOption ) ; } final Object insertSpaceBeforeColonInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR ) ; if ( insertSpaceBeforeColonInForOption != null ) { this . insert_space_before_colon_in_for = JavaCore . INSERT . equals ( insertSpaceBeforeColonInForOption ) ; } final Object insertSpaceBeforeColonInLabeledStatementOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT ) ; if ( insertSpaceBeforeColonInLabeledStatementOption != null ) { this . insert_space_before_colon_in_labeled_statement = JavaCore . INSERT . equals ( insertSpaceBeforeColonInLabeledStatementOption ) ; } final Object insertSpaceBeforeCommaInAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION ) ; if ( insertSpaceBeforeCommaInAllocationExpressionOption != null ) { this . insert_space_before_comma_in_allocation_expression = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInAllocationExpressionOption ) ; } final Object insertSpaceBeforeCommaInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION ) ; if ( insertSpaceBeforeCommaInAnnotationOption != null ) { this . insert_space_before_comma_in_annotation = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInAnnotationOption ) ; } final Object insertSpaceBeforeCommaInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER ) ; if ( insertSpaceBeforeCommaInArrayInitializerOption != null ) { this . insert_space_before_comma_in_array_initializer = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInArrayInitializerOption ) ; } final Object insertSpaceBeforeCommaInConstructorDeclarationParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS ) ; if ( insertSpaceBeforeCommaInConstructorDeclarationParametersOption != null ) { this . insert_space_before_comma_in_constructor_declaration_parameters = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInConstructorDeclarationParametersOption ) ; } final Object insertSpaceBeforeCommaInConstructorDeclarationThrowsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS ) ; if ( insertSpaceBeforeCommaInConstructorDeclarationThrowsOption != null ) { this . insert_space_before_comma_in_constructor_declaration_throws = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInConstructorDeclarationThrowsOption ) ; } final Object insertSpaceBeforeCommaInEnumConstantArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS ) ; if ( insertSpaceBeforeCommaInEnumConstantArgumentsOption != null ) { this . insert_space_before_comma_in_enum_constant_arguments = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInEnumConstantArgumentsOption ) ; } final Object insertSpaceBeforeCommaInEnumDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS ) ; if ( insertSpaceBeforeCommaInEnumDeclarationsOption != null ) { this . insert_space_before_comma_in_enum_declarations = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInEnumDeclarationsOption ) ; } final Object insertSpaceBeforeCommaInExplicitConstructorCallArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS ) ; if ( insertSpaceBeforeCommaInExplicitConstructorCallArgumentsOption != null ) { this . insert_space_before_comma_in_explicit_constructor_call_arguments = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInExplicitConstructorCallArgumentsOption ) ; } final Object insertSpaceBeforeCommaInForIncrementsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS ) ; if ( insertSpaceBeforeCommaInForIncrementsOption != null ) { this . insert_space_before_comma_in_for_increments = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInForIncrementsOption ) ; } final Object insertSpaceBeforeCommaInForInitsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS ) ; if ( insertSpaceBeforeCommaInForInitsOption != null ) { this . insert_space_before_comma_in_for_inits = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInForInitsOption ) ; } final Object insertSpaceBeforeCommaInMethodInvocationArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS ) ; if ( insertSpaceBeforeCommaInMethodInvocationArgumentsOption != null ) { this . insert_space_before_comma_in_method_invocation_arguments = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInMethodInvocationArgumentsOption ) ; } final Object insertSpaceBeforeCommaInMethodDeclarationParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS ) ; if ( insertSpaceBeforeCommaInMethodDeclarationParametersOption != null ) { this . insert_space_before_comma_in_method_declaration_parameters = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInMethodDeclarationParametersOption ) ; } final Object insertSpaceBeforeCommaInMethodDeclarationThrowsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS ) ; if ( insertSpaceBeforeCommaInMethodDeclarationThrowsOption != null ) { this . insert_space_before_comma_in_method_declaration_throws = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInMethodDeclarationThrowsOption ) ; } final Object insertSpaceBeforeCommaInMultipleFieldDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS ) ; if ( insertSpaceBeforeCommaInMultipleFieldDeclarationsOption != null ) { this . insert_space_before_comma_in_multiple_field_declarations = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInMultipleFieldDeclarationsOption ) ; } final Object insertSpaceBeforeCommaInMultipleLocalDeclarationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS ) ; if ( insertSpaceBeforeCommaInMultipleLocalDeclarationsOption != null ) { this . insert_space_before_comma_in_multiple_local_declarations = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInMultipleLocalDeclarationsOption ) ; } final Object insertSpaceBeforeCommaInParameterizedTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE ) ; if ( insertSpaceBeforeCommaInParameterizedTypeReferenceOption != null ) { this . insert_space_before_comma_in_parameterized_type_reference = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInParameterizedTypeReferenceOption ) ; } final Object insertSpaceBeforeCommaInSuperinterfacesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES ) ; if ( insertSpaceBeforeCommaInSuperinterfacesOption != null ) { this . insert_space_before_comma_in_superinterfaces = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInSuperinterfacesOption ) ; } final Object insertSpaceBeforeCommaInTypeArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS ) ; if ( insertSpaceBeforeCommaInTypeArgumentsOption != null ) { this . insert_space_before_comma_in_type_arguments = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInTypeArgumentsOption ) ; } final Object insertSpaceBeforeCommaInTypeParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS ) ; if ( insertSpaceBeforeCommaInTypeParametersOption != null ) { this . insert_space_before_comma_in_type_parameters = JavaCore . INSERT . equals ( insertSpaceBeforeCommaInTypeParametersOption ) ; } final Object insertSpaceBeforeEllipsisOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS ) ; if ( insertSpaceBeforeEllipsisOption != null ) { this . insert_space_before_ellipsis = JavaCore . INSERT . equals ( insertSpaceBeforeEllipsisOption ) ; } final Object insertSpaceBeforeOpeningAngleBrackerInParameterizedTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE ) ; if ( insertSpaceBeforeOpeningAngleBrackerInParameterizedTypeReferenceOption != null ) { this . insert_space_before_opening_angle_bracket_in_parameterized_type_reference = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningAngleBrackerInParameterizedTypeReferenceOption ) ; } final Object insertSpaceBeforeOpeningAngleBrackerInTypeArgumentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS ) ; if ( insertSpaceBeforeOpeningAngleBrackerInTypeArgumentsOption != null ) { this . insert_space_before_opening_angle_bracket_in_type_arguments = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningAngleBrackerInTypeArgumentsOption ) ; } final Object insertSpaceBeforeOpeningAngleBrackerInTypeParametersOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS ) ; if ( insertSpaceBeforeOpeningAngleBrackerInTypeParametersOption != null ) { this . insert_space_before_opening_angle_bracket_in_type_parameters = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningAngleBrackerInTypeParametersOption ) ; } final Object insertSpaceBeforeOpeningBraceInAnnotationTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION ) ; if ( insertSpaceBeforeOpeningBraceInAnnotationTypeDeclarationOption != null ) { this . insert_space_before_opening_brace_in_annotation_type_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInAnnotationTypeDeclarationOption ) ; } final Object insertSpaceBeforeOpeningBraceInAnonymousTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION ) ; if ( insertSpaceBeforeOpeningBraceInAnonymousTypeDeclarationOption != null ) { this . insert_space_before_opening_brace_in_anonymous_type_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInAnonymousTypeDeclarationOption ) ; } final Object insertSpaceBeforeOpeningBraceInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER ) ; if ( insertSpaceBeforeOpeningBraceInArrayInitializerOption != null ) { this . insert_space_before_opening_brace_in_array_initializer = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInArrayInitializerOption ) ; } final Object insertSpaceBeforeOpeningBraceInBlockOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK ) ; if ( insertSpaceBeforeOpeningBraceInBlockOption != null ) { this . insert_space_before_opening_brace_in_block = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInBlockOption ) ; } final Object insertSpaceBeforeOpeningBraceInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION ) ; if ( insertSpaceBeforeOpeningBraceInConstructorDeclarationOption != null ) { this . insert_space_before_opening_brace_in_constructor_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInConstructorDeclarationOption ) ; } final Object insertSpaceBeforeOpeningBraceInEnumDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION ) ; if ( insertSpaceBeforeOpeningBraceInEnumDeclarationOption != null ) { this . insert_space_before_opening_brace_in_enum_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInEnumDeclarationOption ) ; } final Object insertSpaceBeforeOpeningBraceInEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT ) ; if ( insertSpaceBeforeOpeningBraceInEnumConstantOption != null ) { this . insert_space_before_opening_brace_in_enum_constant = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInEnumConstantOption ) ; } final Object insertSpaceBeforeOpeningBraceInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION ) ; if ( insertSpaceBeforeOpeningBraceInMethodDeclarationOption != null ) { this . insert_space_before_opening_brace_in_method_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInMethodDeclarationOption ) ; } final Object insertSpaceBeforeOpeningBraceInTypeDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION ) ; if ( insertSpaceBeforeOpeningBraceInTypeDeclarationOption != null ) { this . insert_space_before_opening_brace_in_type_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInTypeDeclarationOption ) ; } final Object insertSpaceBeforeOpeningBracketInArrayAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION ) ; if ( insertSpaceBeforeOpeningBracketInArrayAllocationExpressionOption != null ) { this . insert_space_before_opening_bracket_in_array_allocation_expression = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBracketInArrayAllocationExpressionOption ) ; } final Object insertSpaceBeforeOpeningBracketInArrayReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE ) ; if ( insertSpaceBeforeOpeningBracketInArrayReferenceOption != null ) { this . insert_space_before_opening_bracket_in_array_reference = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBracketInArrayReferenceOption ) ; } final Object insertSpaceBeforeOpeningBracketInArrayTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE ) ; if ( insertSpaceBeforeOpeningBracketInArrayTypeReferenceOption != null ) { this . insert_space_before_opening_bracket_in_array_type_reference = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBracketInArrayTypeReferenceOption ) ; } final Object insertSpaceBeforeOpeningParenInAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION ) ; if ( insertSpaceBeforeOpeningParenInAnnotationOption != null ) { this . insert_space_before_opening_paren_in_annotation = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInAnnotationOption ) ; } final Object insertSpaceBeforeOpeningParenInAnnotationTypeMemberDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION ) ; if ( insertSpaceBeforeOpeningParenInAnnotationTypeMemberDeclarationOption != null ) { this . insert_space_before_opening_paren_in_annotation_type_member_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInAnnotationTypeMemberDeclarationOption ) ; } final Object insertSpaceBeforeOpeningParenInCatchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH ) ; if ( insertSpaceBeforeOpeningParenInCatchOption != null ) { this . insert_space_before_opening_paren_in_catch = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInCatchOption ) ; } final Object insertSpaceBeforeOpeningParenInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION ) ; if ( insertSpaceBeforeOpeningParenInConstructorDeclarationOption != null ) { this . insert_space_before_opening_paren_in_constructor_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInConstructorDeclarationOption ) ; } final Object insertSpaceBeforeOpeningParenInEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT ) ; if ( insertSpaceBeforeOpeningParenInEnumConstantOption != null ) { this . insert_space_before_opening_paren_in_enum_constant = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInEnumConstantOption ) ; } final Object insertSpaceBeforeOpeningParenInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR ) ; if ( insertSpaceBeforeOpeningParenInForOption != null ) { this . insert_space_before_opening_paren_in_for = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInForOption ) ; } final Object insertSpaceBeforeOpeningParenInIfOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF ) ; if ( insertSpaceBeforeOpeningParenInIfOption != null ) { this . insert_space_before_opening_paren_in_if = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInIfOption ) ; } final Object insertSpaceBeforeOpeningParenInMethodInvocationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION ) ; if ( insertSpaceBeforeOpeningParenInMethodInvocationOption != null ) { this . insert_space_before_opening_paren_in_method_invocation = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInMethodInvocationOption ) ; } final Object insertSpaceBeforeOpeningParenInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION ) ; if ( insertSpaceBeforeOpeningParenInMethodDeclarationOption != null ) { this . insert_space_before_opening_paren_in_method_declaration = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInMethodDeclarationOption ) ; } final Object insertSpaceBeforeOpeningParenInSwitchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH ) ; if ( insertSpaceBeforeOpeningParenInSwitchOption != null ) { this . insert_space_before_opening_paren_in_switch = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInSwitchOption ) ; } final Object insertSpaceBeforeOpeningBraceInSwitchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH ) ; if ( insertSpaceBeforeOpeningBraceInSwitchOption != null ) { this . insert_space_before_opening_brace_in_switch = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningBraceInSwitchOption ) ; } final Object insertSpaceBeforeOpeningParenInSynchronizedOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED ) ; if ( insertSpaceBeforeOpeningParenInSynchronizedOption != null ) { this . insert_space_before_opening_paren_in_synchronized = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInSynchronizedOption ) ; } final Object insertSpaceBeforeOpeningParenInTryOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_TRY ) ; if ( insertSpaceBeforeOpeningParenInTryOption != null ) { this . insert_space_before_opening_paren_in_try = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInTryOption ) ; } final Object insertSpaceBeforeOpeningParenInParenthesizedExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION ) ; if ( insertSpaceBeforeOpeningParenInParenthesizedExpressionOption != null ) { this . insert_space_before_opening_paren_in_parenthesized_expression = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInParenthesizedExpressionOption ) ; } final Object insertSpaceBeforeOpeningParenInWhileOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE ) ; if ( insertSpaceBeforeOpeningParenInWhileOption != null ) { this . insert_space_before_opening_paren_in_while = JavaCore . INSERT . equals ( insertSpaceBeforeOpeningParenInWhileOption ) ; } final Object insertSpaceBeforeParenthesizedExpressionInReturnOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN ) ; if ( insertSpaceBeforeParenthesizedExpressionInReturnOption != null ) { this . insert_space_before_parenthesized_expression_in_return = JavaCore . INSERT . equals ( insertSpaceBeforeParenthesizedExpressionInReturnOption ) ; } final Object insertSpaceBeforeParenthesizedExpressionInThrowOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW ) ; if ( insertSpaceBeforeParenthesizedExpressionInThrowOption != null ) { this . insert_space_before_parenthesized_expression_in_throw = JavaCore . INSERT . equals ( insertSpaceBeforeParenthesizedExpressionInThrowOption ) ; } final Object insertSpaceBeforePostfixOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR ) ; if ( insertSpaceBeforePostfixOperatorOption != null ) { this . insert_space_before_postfix_operator = JavaCore . INSERT . equals ( insertSpaceBeforePostfixOperatorOption ) ; } final Object insertSpaceBeforePrefixOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR ) ; if ( insertSpaceBeforePrefixOperatorOption != null ) { this . insert_space_before_prefix_operator = JavaCore . INSERT . equals ( insertSpaceBeforePrefixOperatorOption ) ; } final Object insertSpaceBeforeQuestionInConditionalOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL ) ; if ( insertSpaceBeforeQuestionInConditionalOption != null ) { this . insert_space_before_question_in_conditional = JavaCore . INSERT . equals ( insertSpaceBeforeQuestionInConditionalOption ) ; } final Object insertSpaceBeforeQuestionInWildcardOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD ) ; if ( insertSpaceBeforeQuestionInWildcardOption != null ) { this . insert_space_before_question_in_wilcard = JavaCore . INSERT . equals ( insertSpaceBeforeQuestionInWildcardOption ) ; } final Object insertSpaceBeforeSemicolonOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON ) ; if ( insertSpaceBeforeSemicolonOption != null ) { this . insert_space_before_semicolon = JavaCore . INSERT . equals ( insertSpaceBeforeSemicolonOption ) ; } final Object insertSpaceBeforeSemicolonInForOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR ) ; if ( insertSpaceBeforeSemicolonInForOption != null ) { this . insert_space_before_semicolon_in_for = JavaCore . INSERT . equals ( insertSpaceBeforeSemicolonInForOption ) ; } final Object insertSpaceBeforeSemicolonInTryOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_TRY_RESOURCES ) ; if ( insertSpaceBeforeSemicolonInTryOption != null ) { this . insert_space_before_semicolon_in_try_resources = JavaCore . INSERT . equals ( insertSpaceBeforeSemicolonInTryOption ) ; } final Object insertSpaceBeforeUnaryOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR ) ; if ( insertSpaceBeforeUnaryOperatorOption != null ) { this . insert_space_before_unary_operator = JavaCore . INSERT . equals ( insertSpaceBeforeUnaryOperatorOption ) ; } final Object insertSpaceBetweenBracketsInArrayTypeReferenceOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE ) ; if ( insertSpaceBetweenBracketsInArrayTypeReferenceOption != null ) { this . insert_space_between_brackets_in_array_type_reference = JavaCore . INSERT . equals ( insertSpaceBetweenBracketsInArrayTypeReferenceOption ) ; } final Object insertSpaceBetweenEmptyBracesInArrayInitializerOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER ) ; if ( insertSpaceBetweenEmptyBracesInArrayInitializerOption != null ) { this . insert_space_between_empty_braces_in_array_initializer = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyBracesInArrayInitializerOption ) ; } final Object insertSpaceBetweenEmptyBracketsInArrayAllocationExpressionOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION ) ; if ( insertSpaceBetweenEmptyBracketsInArrayAllocationExpressionOption != null ) { this . insert_space_between_empty_brackets_in_array_allocation_expression = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyBracketsInArrayAllocationExpressionOption ) ; } final Object insertSpaceBetweenEmptyParensInConstructorDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION ) ; if ( insertSpaceBetweenEmptyParensInConstructorDeclarationOption != null ) { this . insert_space_between_empty_parens_in_constructor_declaration = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyParensInConstructorDeclarationOption ) ; } final Object insertSpaceBetweenEmptyParensInAnnotationTypeMemberDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION ) ; if ( insertSpaceBetweenEmptyParensInAnnotationTypeMemberDeclarationOption != null ) { this . insert_space_between_empty_parens_in_annotation_type_member_declaration = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyParensInAnnotationTypeMemberDeclarationOption ) ; } final Object insertSpaceBetweenEmptyParensInEnumConstantOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT ) ; if ( insertSpaceBetweenEmptyParensInEnumConstantOption != null ) { this . insert_space_between_empty_parens_in_enum_constant = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyParensInEnumConstantOption ) ; } final Object insertSpaceBetweenEmptyParensInMethodDeclarationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION ) ; if ( insertSpaceBetweenEmptyParensInMethodDeclarationOption != null ) { this . insert_space_between_empty_parens_in_method_declaration = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyParensInMethodDeclarationOption ) ; } final Object insertSpaceBetweenEmptyParensInMethodInvocationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION ) ; if ( insertSpaceBetweenEmptyParensInMethodInvocationOption != null ) { this . insert_space_between_empty_parens_in_method_invocation = JavaCore . INSERT . equals ( insertSpaceBetweenEmptyParensInMethodInvocationOption ) ; } final Object compactElseIfOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMPACT_ELSE_IF ) ; if ( compactElseIfOption != null ) { this . compact_else_if = DefaultCodeFormatterConstants . TRUE . equals ( compactElseIfOption ) ; } final Object keepGuardianClauseOnOneLineOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE ) ; if ( keepGuardianClauseOnOneLineOption != null ) { this . keep_guardian_clause_on_one_line = DefaultCodeFormatterConstants . TRUE . equals ( keepGuardianClauseOnOneLineOption ) ; } final Object keepElseStatementOnSameLineOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE ) ; if ( keepElseStatementOnSameLineOption != null ) { this . keep_else_statement_on_same_line = DefaultCodeFormatterConstants . TRUE . equals ( keepElseStatementOnSameLineOption ) ; } final Object keepEmptyArrayInitializerOnOneLineOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE ) ; if ( keepEmptyArrayInitializerOnOneLineOption != null ) { this . keep_empty_array_initializer_on_one_line = DefaultCodeFormatterConstants . TRUE . equals ( keepEmptyArrayInitializerOnOneLineOption ) ; } final Object keepSimpleIfOnOneLineOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE ) ; if ( keepSimpleIfOnOneLineOption != null ) { this . keep_simple_if_on_one_line = DefaultCodeFormatterConstants . TRUE . equals ( keepSimpleIfOnOneLineOption ) ; } final Object keepThenStatementOnSameLineOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE ) ; if ( keepThenStatementOnSameLineOption != null ) { this . keep_then_statement_on_same_line = DefaultCodeFormatterConstants . TRUE . equals ( keepThenStatementOnSameLineOption ) ; } final Object neverIndentBlockCommentOnFirstColumnOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN ) ; if ( neverIndentBlockCommentOnFirstColumnOption != null ) { this . never_indent_block_comments_on_first_column = DefaultCodeFormatterConstants . TRUE . equals ( neverIndentBlockCommentOnFirstColumnOption ) ; } final Object neverIndentLineCommentOnFirstColumnOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN ) ; if ( neverIndentLineCommentOnFirstColumnOption != null ) { this . never_indent_line_comments_on_first_column = DefaultCodeFormatterConstants . TRUE . equals ( neverIndentLineCommentOnFirstColumnOption ) ; } final Object numberOfEmptyLinesToPreserveOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE ) ; if ( numberOfEmptyLinesToPreserveOption != null ) { try { this . number_of_empty_lines_to_preserve = Integer . parseInt ( ( String ) numberOfEmptyLinesToPreserveOption ) ; } catch ( NumberFormatException e ) { this . number_of_empty_lines_to_preserve = <NUM_LIT:0> ; } catch ( ClassCastException e ) { this . number_of_empty_lines_to_preserve = <NUM_LIT:0> ; } } final Object joinLinesInCommentsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_JOIN_LINES_IN_COMMENTS ) ; if ( joinLinesInCommentsOption != null ) { this . join_lines_in_comments = DefaultCodeFormatterConstants . TRUE . equals ( joinLinesInCommentsOption ) ; } final Object joinWrappedLinesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_JOIN_WRAPPED_LINES ) ; if ( joinWrappedLinesOption != null ) { this . join_wrapped_lines = DefaultCodeFormatterConstants . TRUE . equals ( joinWrappedLinesOption ) ; } final Object putEmptyStatementOnNewLineOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE ) ; if ( putEmptyStatementOnNewLineOption != null ) { this . put_empty_statement_on_new_line = DefaultCodeFormatterConstants . TRUE . equals ( putEmptyStatementOnNewLineOption ) ; } final Object tabSizeOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_TAB_SIZE ) ; if ( tabSizeOption != null ) { try { this . tab_size = Integer . parseInt ( ( String ) tabSizeOption ) ; } catch ( NumberFormatException e ) { this . tab_size = <NUM_LIT:4> ; } catch ( ClassCastException e ) { this . tab_size = <NUM_LIT:4> ; } } final Object useTabsOnlyForLeadingIndentationsOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS ) ; if ( useTabsOnlyForLeadingIndentationsOption != null ) { this . use_tabs_only_for_leading_indentations = DefaultCodeFormatterConstants . TRUE . equals ( useTabsOnlyForLeadingIndentationsOption ) ; } final Object pageWidthOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_LINE_SPLIT ) ; if ( pageWidthOption != null ) { try { this . page_width = Integer . parseInt ( ( String ) pageWidthOption ) ; } catch ( NumberFormatException e ) { this . page_width = <NUM_LIT> ; } catch ( ClassCastException e ) { this . page_width = <NUM_LIT> ; } } final Object useTabOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR ) ; if ( useTabOption != null ) { if ( JavaCore . TAB . equals ( useTabOption ) ) { this . tab_char = TAB ; } else if ( JavaCore . SPACE . equals ( useTabOption ) ) { this . tab_char = SPACE ; } else { this . tab_char = MIXED ; } } final Object wrapBeforeBinaryOperatorOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_WRAP_BEFORE_BINARY_OPERATOR ) ; if ( wrapBeforeBinaryOperatorOption != null ) { this . wrap_before_binary_operator = DefaultCodeFormatterConstants . TRUE . equals ( wrapBeforeBinaryOperatorOption ) ; } final Object wrapBeforeOrOperatorMulticatchOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_WRAP_BEFORE_OR_OPERATOR_MULTICATCH ) ; if ( wrapBeforeOrOperatorMulticatchOption != null ) { this . wrap_before_or_operator_multicatch = DefaultCodeFormatterConstants . TRUE . equals ( wrapBeforeOrOperatorMulticatchOption ) ; } final Object useTags = settings . get ( DefaultCodeFormatterConstants . FORMATTER_USE_ON_OFF_TAGS ) ; if ( useTags != null ) { this . use_tags = DefaultCodeFormatterConstants . TRUE . equals ( useTags ) ; } final Object disableTagOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_DISABLING_TAG ) ; if ( disableTagOption != null ) { if ( disableTagOption instanceof String ) { String stringValue = ( String ) disableTagOption ; int idx = stringValue . indexOf ( '<STR_LIT:\n>' ) ; if ( idx == <NUM_LIT:0> ) { this . disabling_tag = null ; } else { String tag = idx < <NUM_LIT:0> ? stringValue . trim ( ) : stringValue . substring ( <NUM_LIT:0> , idx ) . trim ( ) ; if ( tag . length ( ) == <NUM_LIT:0> ) { this . disabling_tag = null ; } else { this . disabling_tag = tag . toCharArray ( ) ; } } } } final Object enableTagOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_ENABLING_TAG ) ; if ( enableTagOption != null ) { if ( enableTagOption instanceof String ) { String stringValue = ( String ) enableTagOption ; int idx = stringValue . indexOf ( '<STR_LIT:\n>' ) ; if ( idx == <NUM_LIT:0> ) { this . enabling_tag = null ; } else { String tag = idx < <NUM_LIT:0> ? stringValue . trim ( ) : stringValue . substring ( <NUM_LIT:0> , idx ) . trim ( ) ; if ( tag . length ( ) == <NUM_LIT:0> ) { this . enabling_tag = null ; } else { this . enabling_tag = tag . toCharArray ( ) ; } } } } final Object wrapWrapOuterExpressionsWhenNestedOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_WRAP_OUTER_EXPRESSIONS_WHEN_NESTED ) ; if ( wrapWrapOuterExpressionsWhenNestedOption != null ) { this . wrap_outer_expressions_when_nested = DefaultCodeFormatterConstants . TRUE . equals ( wrapWrapOuterExpressionsWhenNestedOption ) ; } } private void setDeprecatedOptions ( Map settings ) { final Object commentClearBlankLinesOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_CLEAR_BLANK_LINES ) ; if ( commentClearBlankLinesOption != null ) { this . comment_clear_blank_lines_in_javadoc_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentClearBlankLinesOption ) ; this . comment_clear_blank_lines_in_block_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentClearBlankLinesOption ) ; } else { final Object commentClearBlankLinesInJavadocCommentOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT ) ; if ( commentClearBlankLinesInJavadocCommentOption != null ) { this . comment_clear_blank_lines_in_javadoc_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentClearBlankLinesInJavadocCommentOption ) ; } final Object commentClearBlankLinesInBlockCommentOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT ) ; if ( commentClearBlankLinesInBlockCommentOption != null ) { this . comment_clear_blank_lines_in_block_comment = DefaultCodeFormatterConstants . TRUE . equals ( commentClearBlankLinesInBlockCommentOption ) ; } } final Object insertNewLineAfterAnnotationOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION ) ; final Object insertNewLineAfterAnnotationOnMemberOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER ) ; final Object insertNewLineAfterAnnotationOnTypeOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE ) ; final Object insertNewLineAfterAnnotationOnFieldOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD ) ; final Object insertNewLineAfterAnnotationOnMethodOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD ) ; final Object insertNewLineAfterAnnotationOnPackageOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE ) ; final Object insertNewLineAfterAnnotationOnParameterOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER ) ; final Object insertNewLineAfterAnnotationOnLocalVariableOption = settings . get ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE ) ; if ( insertNewLineAfterAnnotationOnTypeOption == null && insertNewLineAfterAnnotationOnFieldOption == null && insertNewLineAfterAnnotationOnMethodOption == null && insertNewLineAfterAnnotationOnPackageOption == null ) { if ( insertNewLineAfterAnnotationOnMemberOption != null ) { boolean insert = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnMemberOption ) ; this . insert_new_line_after_annotation_on_type = insert ; this . insert_new_line_after_annotation_on_field = insert ; this . insert_new_line_after_annotation_on_method = insert ; this . insert_new_line_after_annotation_on_package = insert ; if ( insertNewLineAfterAnnotationOnParameterOption != null ) { this . insert_new_line_after_annotation_on_parameter = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnParameterOption ) ; } if ( insertNewLineAfterAnnotationOnLocalVariableOption != null ) { this . insert_new_line_after_annotation_on_local_variable = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnLocalVariableOption ) ; } } else if ( insertNewLineAfterAnnotationOnParameterOption == null && insertNewLineAfterAnnotationOnLocalVariableOption == null ) { if ( insertNewLineAfterAnnotationOption != null ) { boolean insert = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOption ) ; this . insert_new_line_after_annotation_on_type = insert ; this . insert_new_line_after_annotation_on_field = insert ; this . insert_new_line_after_annotation_on_method = insert ; this . insert_new_line_after_annotation_on_package = insert ; this . insert_new_line_after_annotation_on_parameter = insert ; this . insert_new_line_after_annotation_on_local_variable = insert ; } } } else { if ( insertNewLineAfterAnnotationOnTypeOption != null ) { this . insert_new_line_after_annotation_on_type = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnTypeOption ) ; } if ( insertNewLineAfterAnnotationOnFieldOption != null ) { this . insert_new_line_after_annotation_on_field = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnFieldOption ) ; } if ( insertNewLineAfterAnnotationOnMethodOption != null ) { this . insert_new_line_after_annotation_on_method = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnMethodOption ) ; } if ( insertNewLineAfterAnnotationOnPackageOption != null ) { this . insert_new_line_after_annotation_on_package = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnPackageOption ) ; } if ( insertNewLineAfterAnnotationOnParameterOption != null ) { this . insert_new_line_after_annotation_on_parameter = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnParameterOption ) ; } if ( insertNewLineAfterAnnotationOnLocalVariableOption != null ) { this . insert_new_line_after_annotation_on_local_variable = JavaCore . INSERT . equals ( insertNewLineAfterAnnotationOnLocalVariableOption ) ; } } } public void setDefaultSettings ( ) { this . alignment_for_arguments_in_allocation_expression = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_annotation = Alignment . M_NO_ALIGNMENT ; this . alignment_for_arguments_in_enum_constant = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_explicit_constructor_call = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_method_invocation = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_qualified_allocation_expression = Alignment . M_COMPACT_SPLIT ; this . alignment_for_assignment = Alignment . M_NO_ALIGNMENT ; this . alignment_for_binary_expression = Alignment . M_COMPACT_SPLIT ; this . alignment_for_compact_if = Alignment . M_ONE_PER_LINE_SPLIT | Alignment . M_INDENT_BY_ONE ; this . alignment_for_conditional_expression = Alignment . M_ONE_PER_LINE_SPLIT ; this . alignment_for_enum_constants = Alignment . NONE ; this . alignment_for_expressions_in_array_initializer = Alignment . M_COMPACT_SPLIT ; this . alignment_for_method_declaration = Alignment . M_NO_ALIGNMENT ; this . alignment_for_multiple_fields = Alignment . M_COMPACT_SPLIT ; this . alignment_for_parameters_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_parameters_in_method_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_resources_in_try = Alignment . M_NEXT_PER_LINE_SPLIT ; this . alignment_for_selector_in_method_invocation = Alignment . M_COMPACT_SPLIT ; this . alignment_for_superclass_in_type_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; this . alignment_for_superinterfaces_in_enum_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; this . alignment_for_superinterfaces_in_type_declaration = Alignment . M_NEXT_SHIFTED_SPLIT ; this . alignment_for_throws_clause_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_throws_clause_in_method_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_union_type_in_multicatch = Alignment . M_COMPACT_SPLIT ; this . align_type_members_on_columns = false ; this . brace_position_for_annotation_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_array_initializer = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_block = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_block_in_case = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_constructor_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_enum_constant = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_enum_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_method_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_switch = DefaultCodeFormatterConstants . END_OF_LINE ; this . comment_clear_blank_lines_in_block_comment = false ; this . comment_clear_blank_lines_in_javadoc_comment = false ; this . comment_format_block_comment = true ; this . comment_format_javadoc_comment = true ; this . comment_format_line_comment = true ; this . comment_format_line_comment_starting_on_first_column = true ; this . comment_format_header = false ; this . comment_format_html = true ; this . comment_format_source = true ; this . comment_indent_parameter_description = true ; this . comment_indent_root_tags = true ; this . comment_insert_empty_line_before_root_tags = true ; this . comment_insert_new_line_for_parameter = true ; this . comment_new_lines_at_block_boundaries = true ; this . comment_new_lines_at_javadoc_boundaries = true ; this . comment_line_length = <NUM_LIT> ; this . comment_preserve_white_space_between_code_and_line_comments = false ; this . continuation_indentation = <NUM_LIT:2> ; this . continuation_indentation_for_array_initializer = <NUM_LIT:2> ; this . blank_lines_after_imports = <NUM_LIT:0> ; this . blank_lines_after_package = <NUM_LIT:0> ; this . blank_lines_before_field = <NUM_LIT:0> ; this . blank_lines_before_first_class_body_declaration = <NUM_LIT:0> ; this . blank_lines_before_imports = <NUM_LIT:0> ; this . blank_lines_before_member_type = <NUM_LIT:0> ; this . blank_lines_before_method = <NUM_LIT:0> ; this . blank_lines_before_new_chunk = <NUM_LIT:0> ; this . blank_lines_before_package = <NUM_LIT:0> ; this . blank_lines_between_import_groups = <NUM_LIT:1> ; this . blank_lines_between_type_declarations = <NUM_LIT:0> ; this . blank_lines_at_beginning_of_method_body = <NUM_LIT:0> ; this . indent_statements_compare_to_block = true ; this . indent_statements_compare_to_body = true ; this . indent_body_declarations_compare_to_annotation_declaration_header = true ; this . indent_body_declarations_compare_to_enum_constant_header = true ; this . indent_body_declarations_compare_to_enum_declaration_header = true ; this . indent_body_declarations_compare_to_type_header = true ; this . indent_breaks_compare_to_cases = true ; this . indent_empty_lines = false ; this . indent_switchstatements_compare_to_cases = true ; this . indent_switchstatements_compare_to_switch = true ; this . indentation_size = <NUM_LIT:4> ; this . insert_new_line_after_annotation_on_type = true ; this . insert_new_line_after_annotation_on_field = true ; this . insert_new_line_after_annotation_on_method = true ; this . insert_new_line_after_annotation_on_package = true ; this . insert_new_line_after_annotation_on_parameter = false ; this . insert_new_line_after_annotation_on_local_variable = true ; this . insert_new_line_after_opening_brace_in_array_initializer = false ; this . insert_new_line_at_end_of_file_if_missing = false ; this . insert_new_line_before_catch_in_try_statement = false ; this . insert_new_line_before_closing_brace_in_array_initializer = false ; this . insert_new_line_before_else_in_if_statement = false ; this . insert_new_line_before_finally_in_try_statement = false ; this . insert_new_line_before_while_in_do_statement = false ; this . insert_new_line_in_empty_anonymous_type_declaration = true ; this . insert_new_line_in_empty_block = true ; this . insert_new_line_in_empty_annotation_declaration = true ; this . insert_new_line_in_empty_enum_constant = true ; this . insert_new_line_in_empty_enum_declaration = true ; this . insert_new_line_in_empty_method_body = true ; this . insert_new_line_in_empty_type_declaration = true ; this . insert_space_after_and_in_type_parameter = true ; this . insert_space_after_assignment_operator = true ; this . insert_space_after_at_in_annotation = false ; this . insert_space_after_at_in_annotation_type_declaration = false ; this . insert_space_after_binary_operator = true ; this . insert_space_after_closing_angle_bracket_in_type_arguments = true ; this . insert_space_after_closing_angle_bracket_in_type_parameters = true ; this . insert_space_after_closing_paren_in_cast = true ; this . insert_space_after_closing_brace_in_block = true ; this . insert_space_after_colon_in_assert = true ; this . insert_space_after_colon_in_case = true ; this . insert_space_after_colon_in_conditional = true ; this . insert_space_after_colon_in_for = true ; this . insert_space_after_colon_in_labeled_statement = true ; this . insert_space_after_comma_in_allocation_expression = true ; this . insert_space_after_comma_in_annotation = true ; this . insert_space_after_comma_in_array_initializer = true ; this . insert_space_after_comma_in_constructor_declaration_parameters = true ; this . insert_space_after_comma_in_constructor_declaration_throws = true ; this . insert_space_after_comma_in_enum_constant_arguments = true ; this . insert_space_after_comma_in_enum_declarations = true ; this . insert_space_after_comma_in_explicit_constructor_call_arguments = true ; this . insert_space_after_comma_in_for_increments = true ; this . insert_space_after_comma_in_for_inits = true ; this . insert_space_after_comma_in_method_invocation_arguments = true ; this . insert_space_after_comma_in_method_declaration_parameters = true ; this . insert_space_after_comma_in_method_declaration_throws = true ; this . insert_space_after_comma_in_multiple_field_declarations = true ; this . insert_space_after_comma_in_multiple_local_declarations = true ; this . insert_space_after_comma_in_parameterized_type_reference = true ; this . insert_space_after_comma_in_superinterfaces = true ; this . insert_space_after_comma_in_type_arguments = true ; this . insert_space_after_comma_in_type_parameters = true ; this . insert_space_after_ellipsis = true ; this . insert_space_after_opening_angle_bracket_in_parameterized_type_reference = false ; this . insert_space_after_opening_angle_bracket_in_type_arguments = false ; this . insert_space_after_opening_angle_bracket_in_type_parameters = false ; this . insert_space_after_opening_bracket_in_array_allocation_expression = false ; this . insert_space_after_opening_bracket_in_array_reference = false ; this . insert_space_after_opening_brace_in_array_initializer = false ; this . insert_space_after_opening_paren_in_annotation = false ; this . insert_space_after_opening_paren_in_cast = false ; this . insert_space_after_opening_paren_in_catch = false ; this . insert_space_after_opening_paren_in_constructor_declaration = false ; this . insert_space_after_opening_paren_in_enum_constant = false ; this . insert_space_after_opening_paren_in_for = false ; this . insert_space_after_opening_paren_in_if = false ; this . insert_space_after_opening_paren_in_method_declaration = false ; this . insert_space_after_opening_paren_in_method_invocation = false ; this . insert_space_after_opening_paren_in_parenthesized_expression = false ; this . insert_space_after_opening_paren_in_switch = false ; this . insert_space_after_opening_paren_in_synchronized = false ; this . insert_space_after_opening_paren_in_try = false ; this . insert_space_after_opening_paren_in_while = false ; this . insert_space_after_postfix_operator = false ; this . insert_space_after_prefix_operator = false ; this . insert_space_after_question_in_conditional = true ; this . insert_space_after_question_in_wilcard = false ; this . insert_space_after_semicolon_in_for = true ; this . insert_space_after_semicolon_in_try_resources = true ; this . insert_space_after_unary_operator = false ; this . insert_space_before_and_in_type_parameter = true ; this . insert_space_before_at_in_annotation_type_declaration = true ; this . insert_space_before_assignment_operator = true ; this . insert_space_before_binary_operator = true ; this . insert_space_before_closing_angle_bracket_in_parameterized_type_reference = false ; this . insert_space_before_closing_angle_bracket_in_type_arguments = false ; this . insert_space_before_closing_angle_bracket_in_type_parameters = false ; this . insert_space_before_closing_brace_in_array_initializer = false ; this . insert_space_before_closing_bracket_in_array_allocation_expression = false ; this . insert_space_before_closing_bracket_in_array_reference = false ; this . insert_space_before_closing_paren_in_annotation = false ; this . insert_space_before_closing_paren_in_cast = false ; this . insert_space_before_closing_paren_in_catch = false ; this . insert_space_before_closing_paren_in_constructor_declaration = false ; this . insert_space_before_closing_paren_in_enum_constant = false ; this . insert_space_before_closing_paren_in_for = false ; this . insert_space_before_closing_paren_in_if = false ; this . insert_space_before_closing_paren_in_method_declaration = false ; this . insert_space_before_closing_paren_in_method_invocation = false ; this . insert_space_before_closing_paren_in_parenthesized_expression = false ; this . insert_space_before_closing_paren_in_switch = false ; this . insert_space_before_closing_paren_in_synchronized = false ; this . insert_space_before_closing_paren_in_try = false ; this . insert_space_before_closing_paren_in_while = false ; this . insert_space_before_colon_in_assert = true ; this . insert_space_before_colon_in_case = true ; this . insert_space_before_colon_in_conditional = true ; this . insert_space_before_colon_in_default = true ; this . insert_space_before_colon_in_for = true ; this . insert_space_before_colon_in_labeled_statement = true ; this . insert_space_before_comma_in_allocation_expression = false ; this . insert_space_before_comma_in_array_initializer = false ; this . insert_space_before_comma_in_constructor_declaration_parameters = false ; this . insert_space_before_comma_in_constructor_declaration_throws = false ; this . insert_space_before_comma_in_enum_constant_arguments = false ; this . insert_space_before_comma_in_enum_declarations = false ; this . insert_space_before_comma_in_explicit_constructor_call_arguments = false ; this . insert_space_before_comma_in_for_increments = false ; this . insert_space_before_comma_in_for_inits = false ; this . insert_space_before_comma_in_method_invocation_arguments = false ; this . insert_space_before_comma_in_method_declaration_parameters = false ; this . insert_space_before_comma_in_method_declaration_throws = false ; this . insert_space_before_comma_in_multiple_field_declarations = false ; this . insert_space_before_comma_in_multiple_local_declarations = false ; this . insert_space_before_comma_in_parameterized_type_reference = false ; this . insert_space_before_comma_in_superinterfaces = false ; this . insert_space_before_comma_in_type_arguments = false ; this . insert_space_before_comma_in_type_parameters = false ; this . insert_space_before_ellipsis = false ; this . insert_space_before_parenthesized_expression_in_return = true ; this . insert_space_before_parenthesized_expression_in_throw = true ; this . insert_space_before_opening_angle_bracket_in_parameterized_type_reference = false ; this . insert_space_before_opening_angle_bracket_in_type_arguments = false ; this . insert_space_before_opening_angle_bracket_in_type_parameters = false ; this . insert_space_before_opening_brace_in_annotation_type_declaration = true ; this . insert_space_before_opening_brace_in_anonymous_type_declaration = true ; this . insert_space_before_opening_brace_in_array_initializer = false ; this . insert_space_before_opening_brace_in_block = true ; this . insert_space_before_opening_brace_in_constructor_declaration = true ; this . insert_space_before_opening_brace_in_enum_constant = true ; this . insert_space_before_opening_brace_in_enum_declaration = true ; this . insert_space_before_opening_brace_in_method_declaration = true ; this . insert_space_before_opening_brace_in_switch = true ; this . insert_space_before_opening_brace_in_type_declaration = true ; this . insert_space_before_opening_bracket_in_array_allocation_expression = false ; this . insert_space_before_opening_bracket_in_array_reference = false ; this . insert_space_before_opening_bracket_in_array_type_reference = false ; this . insert_space_before_opening_paren_in_annotation = false ; this . insert_space_before_opening_paren_in_annotation_type_member_declaration = false ; this . insert_space_before_opening_paren_in_catch = true ; this . insert_space_before_opening_paren_in_constructor_declaration = false ; this . insert_space_before_opening_paren_in_enum_constant = false ; this . insert_space_before_opening_paren_in_for = true ; this . insert_space_before_opening_paren_in_if = true ; this . insert_space_before_opening_paren_in_method_invocation = false ; this . insert_space_before_opening_paren_in_method_declaration = false ; this . insert_space_before_opening_paren_in_switch = true ; this . insert_space_before_opening_paren_in_synchronized = true ; this . insert_space_before_opening_paren_in_try = true ; this . insert_space_before_opening_paren_in_parenthesized_expression = false ; this . insert_space_before_opening_paren_in_while = true ; this . insert_space_before_postfix_operator = false ; this . insert_space_before_prefix_operator = false ; this . insert_space_before_question_in_conditional = true ; this . insert_space_before_question_in_wilcard = false ; this . insert_space_before_semicolon = false ; this . insert_space_before_semicolon_in_for = false ; this . insert_space_before_semicolon_in_try_resources = false ; this . insert_space_before_unary_operator = false ; this . insert_space_between_brackets_in_array_type_reference = false ; this . insert_space_between_empty_braces_in_array_initializer = false ; this . insert_space_between_empty_brackets_in_array_allocation_expression = false ; this . insert_space_between_empty_parens_in_annotation_type_member_declaration = false ; this . insert_space_between_empty_parens_in_constructor_declaration = false ; this . insert_space_between_empty_parens_in_enum_constant = false ; this . insert_space_between_empty_parens_in_method_declaration = false ; this . insert_space_between_empty_parens_in_method_invocation = false ; this . compact_else_if = true ; this . keep_guardian_clause_on_one_line = false ; this . keep_else_statement_on_same_line = false ; this . keep_empty_array_initializer_on_one_line = false ; this . keep_simple_if_on_one_line = false ; this . keep_then_statement_on_same_line = false ; this . never_indent_block_comments_on_first_column = false ; this . never_indent_line_comments_on_first_column = false ; this . number_of_empty_lines_to_preserve = <NUM_LIT:1> ; this . join_lines_in_comments = true ; this . join_wrapped_lines = true ; this . put_empty_statement_on_new_line = false ; this . tab_size = <NUM_LIT:4> ; this . page_width = <NUM_LIT> ; this . tab_char = TAB ; this . use_tabs_only_for_leading_indentations = false ; this . wrap_before_binary_operator = true ; this . wrap_before_or_operator_multicatch = true ; this . use_tags = false ; this . disabling_tag = DEFAULT_DISABLING_TAG ; this . enabling_tag = DEFAULT_ENABLING_TAG ; this . wrap_outer_expressions_when_nested = true ; } public void setEclipseDefaultSettings ( ) { setJavaConventionsSettings ( ) ; this . tab_char = TAB ; this . tab_size = <NUM_LIT:4> ; } public void setJavaConventionsSettings ( ) { this . alignment_for_arguments_in_allocation_expression = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_annotation = Alignment . M_NO_ALIGNMENT ; this . alignment_for_arguments_in_enum_constant = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_explicit_constructor_call = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_method_invocation = Alignment . M_COMPACT_SPLIT ; this . alignment_for_arguments_in_qualified_allocation_expression = Alignment . M_COMPACT_SPLIT ; this . alignment_for_assignment = Alignment . M_NO_ALIGNMENT ; this . alignment_for_binary_expression = Alignment . M_COMPACT_SPLIT ; this . alignment_for_compact_if = Alignment . M_COMPACT_SPLIT ; this . alignment_for_conditional_expression = Alignment . M_NEXT_PER_LINE_SPLIT ; this . alignment_for_enum_constants = Alignment . NONE ; this . alignment_for_expressions_in_array_initializer = Alignment . M_COMPACT_SPLIT ; this . alignment_for_method_declaration = Alignment . M_NO_ALIGNMENT ; this . alignment_for_multiple_fields = Alignment . M_COMPACT_SPLIT ; this . alignment_for_parameters_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_parameters_in_method_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_resources_in_try = Alignment . M_NEXT_PER_LINE_SPLIT ; this . alignment_for_selector_in_method_invocation = Alignment . M_COMPACT_SPLIT ; this . alignment_for_superclass_in_type_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_superinterfaces_in_enum_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_superinterfaces_in_type_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_throws_clause_in_constructor_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_throws_clause_in_method_declaration = Alignment . M_COMPACT_SPLIT ; this . alignment_for_union_type_in_multicatch = Alignment . M_COMPACT_SPLIT ; this . align_type_members_on_columns = false ; this . brace_position_for_annotation_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_array_initializer = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_block = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_block_in_case = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_constructor_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_enum_constant = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_enum_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_method_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_type_declaration = DefaultCodeFormatterConstants . END_OF_LINE ; this . brace_position_for_switch = DefaultCodeFormatterConstants . END_OF_LINE ; this . comment_clear_blank_lines_in_block_comment = false ; this . comment_clear_blank_lines_in_javadoc_comment = false ; this . comment_format_block_comment = true ; this . comment_format_javadoc_comment = true ; this . comment_format_line_comment = true ; this . comment_format_line_comment_starting_on_first_column = true ; this . comment_format_header = false ; this . comment_format_html = true ; this . comment_format_source = true ; this . comment_indent_parameter_description = true ; this . comment_indent_root_tags = true ; this . comment_insert_empty_line_before_root_tags = true ; this . comment_insert_new_line_for_parameter = true ; this . comment_new_lines_at_block_boundaries = true ; this . comment_new_lines_at_javadoc_boundaries = true ; this . comment_line_length = <NUM_LIT> ; this . comment_preserve_white_space_between_code_and_line_comments = false ; this . continuation_indentation = <NUM_LIT:2> ; this . continuation_indentation_for_array_initializer = <NUM_LIT:2> ; this . blank_lines_after_imports = <NUM_LIT:1> ; this . blank_lines_after_package = <NUM_LIT:1> ; this . blank_lines_before_field = <NUM_LIT:0> ; this . blank_lines_before_first_class_body_declaration = <NUM_LIT:0> ; this . blank_lines_before_imports = <NUM_LIT:1> ; this . blank_lines_before_member_type = <NUM_LIT:1> ; this . blank_lines_before_method = <NUM_LIT:1> ; this . blank_lines_before_new_chunk = <NUM_LIT:1> ; this . blank_lines_before_package = <NUM_LIT:0> ; this . blank_lines_between_import_groups = <NUM_LIT:1> ; this . blank_lines_between_type_declarations = <NUM_LIT:1> ; this . blank_lines_at_beginning_of_method_body = <NUM_LIT:0> ; this . indent_statements_compare_to_block = true ; this . indent_statements_compare_to_body = true ; this . indent_body_declarations_compare_to_annotation_declaration_header = true ; this . indent_body_declarations_compare_to_enum_constant_header = true ; this . indent_body_declarations_compare_to_enum_declaration_header = true ; this . indent_body_declarations_compare_to_type_header = true ; this . indent_breaks_compare_to_cases = true ; this . indent_empty_lines = false ; this . indent_switchstatements_compare_to_cases = true ; this . indent_switchstatements_compare_to_switch = false ; this . indentation_size = <NUM_LIT:4> ; this . insert_new_line_after_annotation_on_type = true ; this . insert_new_line_after_annotation_on_field = true ; this . insert_new_line_after_annotation_on_method = true ; this . insert_new_line_after_annotation_on_package = true ; this . insert_new_line_after_annotation_on_parameter = false ; this . insert_new_line_after_annotation_on_local_variable = true ; this . insert_new_line_after_opening_brace_in_array_initializer = false ; this . insert_new_line_at_end_of_file_if_missing = false ; this . insert_new_line_before_catch_in_try_statement = false ; this . insert_new_line_before_closing_brace_in_array_initializer = false ; this . insert_new_line_before_else_in_if_statement = false ; this . insert_new_line_before_finally_in_try_statement = false ; this . insert_new_line_before_while_in_do_statement = false ; this . insert_new_line_in_empty_anonymous_type_declaration = true ; this . insert_new_line_in_empty_block = true ; this . insert_new_line_in_empty_annotation_declaration = true ; this . insert_new_line_in_empty_enum_constant = true ; this . insert_new_line_in_empty_enum_declaration = true ; this . insert_new_line_in_empty_method_body = true ; this . insert_new_line_in_empty_type_declaration = true ; this . insert_space_after_and_in_type_parameter = true ; this . insert_space_after_assignment_operator = true ; this . insert_space_after_at_in_annotation = false ; this . insert_space_after_at_in_annotation_type_declaration = false ; this . insert_space_after_binary_operator = true ; this . insert_space_after_closing_angle_bracket_in_type_arguments = true ; this . insert_space_after_closing_angle_bracket_in_type_parameters = true ; this . insert_space_after_closing_paren_in_cast = true ; this . insert_space_after_closing_brace_in_block = true ; this . insert_space_after_colon_in_assert = true ; this . insert_space_after_colon_in_case = true ; this . insert_space_after_colon_in_conditional = true ; this . insert_space_after_colon_in_for = true ; this . insert_space_after_colon_in_labeled_statement = true ; this . insert_space_after_comma_in_allocation_expression = true ; this . insert_space_after_comma_in_annotation = true ; this . insert_space_after_comma_in_array_initializer = true ; this . insert_space_after_comma_in_constructor_declaration_parameters = true ; this . insert_space_after_comma_in_constructor_declaration_throws = true ; this . insert_space_after_comma_in_enum_constant_arguments = true ; this . insert_space_after_comma_in_enum_declarations = true ; this . insert_space_after_comma_in_explicit_constructor_call_arguments = true ; this . insert_space_after_comma_in_for_increments = true ; this . insert_space_after_comma_in_for_inits = true ; this . insert_space_after_comma_in_method_invocation_arguments = true ; this . insert_space_after_comma_in_method_declaration_parameters = true ; this . insert_space_after_comma_in_method_declaration_throws = true ; this . insert_space_after_comma_in_multiple_field_declarations = true ; this . insert_space_after_comma_in_multiple_local_declarations = true ; this . insert_space_after_comma_in_parameterized_type_reference = true ; this . insert_space_after_comma_in_superinterfaces = true ; this . insert_space_after_comma_in_type_arguments = true ; this . insert_space_after_comma_in_type_parameters = true ; this . insert_space_after_ellipsis = true ; this . insert_space_after_opening_angle_bracket_in_parameterized_type_reference = false ; this . insert_space_after_opening_angle_bracket_in_type_arguments = false ; this . insert_space_after_opening_angle_bracket_in_type_parameters = false ; this . insert_space_after_opening_bracket_in_array_allocation_expression = false ; this . insert_space_after_opening_bracket_in_array_reference = false ; this . insert_space_after_opening_brace_in_array_initializer = true ; this . insert_space_after_opening_paren_in_annotation = false ; this . insert_space_after_opening_paren_in_cast = false ; this . insert_space_after_opening_paren_in_catch = false ; this . insert_space_after_opening_paren_in_constructor_declaration = false ; this . insert_space_after_opening_paren_in_enum_constant = false ; this . insert_space_after_opening_paren_in_for = false ; this . insert_space_after_opening_paren_in_if = false ; this . insert_space_after_opening_paren_in_method_declaration = false ; this . insert_space_after_opening_paren_in_method_invocation = false ; this . insert_space_after_opening_paren_in_parenthesized_expression = false ; this . insert_space_after_opening_paren_in_switch = false ; this . insert_space_after_opening_paren_in_synchronized = false ; this . insert_space_after_opening_paren_in_try = false ; this . insert_space_after_opening_paren_in_while = false ; this . insert_space_after_postfix_operator = false ; this . insert_space_after_prefix_operator = false ; this . insert_space_after_question_in_conditional = true ; this . insert_space_after_question_in_wilcard = false ; this . insert_space_after_semicolon_in_for = true ; this . insert_space_after_semicolon_in_try_resources = true ; this . insert_space_after_unary_operator = false ; this . insert_space_before_and_in_type_parameter = true ; this . insert_space_before_at_in_annotation_type_declaration = true ; this . insert_space_before_assignment_operator = true ; this . insert_space_before_binary_operator = true ; this . insert_space_before_closing_angle_bracket_in_parameterized_type_reference = false ; this . insert_space_before_closing_angle_bracket_in_type_arguments = false ; this . insert_space_before_closing_angle_bracket_in_type_parameters = false ; this . insert_space_before_closing_brace_in_array_initializer = true ; this . insert_space_before_closing_bracket_in_array_allocation_expression = false ; this . insert_space_before_closing_bracket_in_array_reference = false ; this . insert_space_before_closing_paren_in_annotation = false ; this . insert_space_before_closing_paren_in_cast = false ; this . insert_space_before_closing_paren_in_catch = false ; this . insert_space_before_closing_paren_in_constructor_declaration = false ; this . insert_space_before_closing_paren_in_enum_constant = false ; this . insert_space_before_closing_paren_in_for = false ; this . insert_space_before_closing_paren_in_if = false ; this . insert_space_before_closing_paren_in_method_declaration = false ; this . insert_space_before_closing_paren_in_method_invocation = false ; this . insert_space_before_closing_paren_in_parenthesized_expression = false ; this . insert_space_before_closing_paren_in_switch = false ; this . insert_space_before_closing_paren_in_synchronized = false ; this . insert_space_before_closing_paren_in_try = false ; this . insert_space_before_closing_paren_in_while = false ; this . insert_space_before_colon_in_assert = true ; this . insert_space_before_colon_in_case = false ; this . insert_space_before_colon_in_conditional = true ; this . insert_space_before_colon_in_default = false ; this . insert_space_before_colon_in_for = true ; this . insert_space_before_colon_in_labeled_statement = false ; this . insert_space_before_comma_in_allocation_expression = false ; this . insert_space_before_comma_in_array_initializer = false ; this . insert_space_before_comma_in_constructor_declaration_parameters = false ; this . insert_space_before_comma_in_constructor_declaration_throws = false ; this . insert_space_before_comma_in_enum_constant_arguments = false ; this . insert_space_before_comma_in_enum_declarations = false ; this . insert_space_before_comma_in_explicit_constructor_call_arguments = false ; this . insert_space_before_comma_in_for_increments = false ; this . insert_space_before_comma_in_for_inits = false ; this . insert_space_before_comma_in_method_invocation_arguments = false ; this . insert_space_before_comma_in_method_declaration_parameters = false ; this . insert_space_before_comma_in_method_declaration_throws = false ; this . insert_space_before_comma_in_multiple_field_declarations = false ; this . insert_space_before_comma_in_multiple_local_declarations = false ; this . insert_space_before_comma_in_parameterized_type_reference = false ; this . insert_space_before_comma_in_superinterfaces = false ; this . insert_space_before_comma_in_type_arguments = false ; this . insert_space_before_comma_in_type_parameters = false ; this . insert_space_before_ellipsis = false ; this . insert_space_before_parenthesized_expression_in_return = true ; this . insert_space_before_parenthesized_expression_in_throw = true ; this . insert_space_before_opening_angle_bracket_in_parameterized_type_reference = false ; this . insert_space_before_opening_angle_bracket_in_type_arguments = false ; this . insert_space_before_opening_angle_bracket_in_type_parameters = false ; this . insert_space_before_opening_brace_in_annotation_type_declaration = true ; this . insert_space_before_opening_brace_in_anonymous_type_declaration = true ; this . insert_space_before_opening_brace_in_array_initializer = true ; this . insert_space_before_opening_brace_in_block = true ; this . insert_space_before_opening_brace_in_constructor_declaration = true ; this . insert_space_before_opening_brace_in_enum_constant = true ; this . insert_space_before_opening_brace_in_enum_declaration = true ; this . insert_space_before_opening_brace_in_method_declaration = true ; this . insert_space_before_opening_brace_in_switch = true ; this . insert_space_before_opening_brace_in_type_declaration = true ; this . insert_space_before_opening_bracket_in_array_allocation_expression = false ; this . insert_space_before_opening_bracket_in_array_reference = false ; this . insert_space_before_opening_bracket_in_array_type_reference = false ; this . insert_space_before_opening_paren_in_annotation = false ; this . insert_space_before_opening_paren_in_annotation_type_member_declaration = false ; this . insert_space_before_opening_paren_in_catch = true ; this . insert_space_before_opening_paren_in_constructor_declaration = false ; this . insert_space_before_opening_paren_in_enum_constant = false ; this . insert_space_before_opening_paren_in_for = true ; this . insert_space_before_opening_paren_in_if = true ; this . insert_space_before_opening_paren_in_method_invocation = false ; this . insert_space_before_opening_paren_in_method_declaration = false ; this . insert_space_before_opening_paren_in_switch = true ; this . insert_space_before_opening_paren_in_synchronized = true ; this . insert_space_before_opening_paren_in_try = true ; this . insert_space_before_opening_paren_in_parenthesized_expression = false ; this . insert_space_before_opening_paren_in_while = true ; this . insert_space_before_postfix_operator = false ; this . insert_space_before_prefix_operator = false ; this . insert_space_before_question_in_conditional = true ; this . insert_space_before_question_in_wilcard = false ; this . insert_space_before_semicolon = false ; this . insert_space_before_semicolon_in_for = false ; this . insert_space_before_semicolon_in_try_resources = false ; this . insert_space_before_unary_operator = false ; this . insert_space_between_brackets_in_array_type_reference = false ; this . insert_space_between_empty_braces_in_array_initializer = false ; this . insert_space_between_empty_brackets_in_array_allocation_expression = false ; this . insert_space_between_empty_parens_in_annotation_type_member_declaration = false ; this . insert_space_between_empty_parens_in_constructor_declaration = false ; this . insert_space_between_empty_parens_in_enum_constant = false ; this . insert_space_between_empty_parens_in_method_declaration = false ; this . insert_space_between_empty_parens_in_method_invocation = false ; this . compact_else_if = true ; this . keep_guardian_clause_on_one_line = false ; this . keep_else_statement_on_same_line = false ; this . keep_empty_array_initializer_on_one_line = false ; this . keep_simple_if_on_one_line = false ; this . keep_then_statement_on_same_line = false ; this . never_indent_block_comments_on_first_column = false ; this . never_indent_line_comments_on_first_column = false ; this . number_of_empty_lines_to_preserve = <NUM_LIT:1> ; this . join_lines_in_comments = true ; this . join_wrapped_lines = true ; this . put_empty_statement_on_new_line = true ; this . tab_size = <NUM_LIT:8> ; this . page_width = <NUM_LIT> ; this . tab_char = MIXED ; this . use_tabs_only_for_leading_indentations = false ; this . wrap_before_binary_operator = true ; this . wrap_before_or_operator_multicatch = true ; this . use_tags = false ; this . disabling_tag = DEFAULT_DISABLING_TAG ; this . enabling_tag = DEFAULT_ENABLING_TAG ; this . wrap_outer_expressions_when_nested = true ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; public class AbortFormatting extends RuntimeException { Throwable nestedException ; private static final long serialVersionUID = - <NUM_LIT> ; public AbortFormatting ( String message ) { super ( message ) ; } public AbortFormatting ( Throwable nestedException ) { super ( nestedException . getMessage ( ) ) ; this . nestedException = nestedException ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . comment ; import java . util . Map ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . BadPositionCategoryException ; import org . eclipse . jface . text . DefaultPositionUpdater ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . Position ; import org . eclipse . jdt . core . ToolFactory ; import org . eclipse . jdt . internal . core . util . Util ; public class CommentFormatterUtil { public static String evaluateFormatterEdit ( String string , TextEdit edit , Position [ ] positions ) { try { Document doc = createDocument ( string , positions ) ; edit . apply ( doc , <NUM_LIT:0> ) ; if ( positions != null ) { for ( int i = <NUM_LIT:0> ; i < positions . length ; i ++ ) { Assert . isTrue ( ! positions [ i ] . isDeleted , "<STR_LIT>" ) ; } } return doc . get ( ) ; } catch ( BadLocationException e ) { log ( e ) ; Assert . isTrue ( false , "<STR_LIT>" + e . getMessage ( ) ) ; } return null ; } public static TextEdit format2 ( int kind , String string , int indentationLevel , String lineSeparator , Map options ) { int length = string . length ( ) ; if ( <NUM_LIT:0> < <NUM_LIT:0> || length < <NUM_LIT:0> || <NUM_LIT:0> + length > string . length ( ) ) { throw new IllegalArgumentException ( "<STR_LIT>" + <NUM_LIT:0> + "<STR_LIT>" + length + "<STR_LIT>" + string . length ( ) ) ; } return ToolFactory . createCodeFormatter ( options ) . format ( kind , string , <NUM_LIT:0> , length , indentationLevel , lineSeparator ) ; } private static Document createDocument ( String content , Position [ ] positions ) throws IllegalArgumentException { Document doc = new Document ( content ) ; try { if ( positions != null ) { final String POS_CATEGORY = "<STR_LIT>" ; doc . addPositionCategory ( POS_CATEGORY ) ; doc . addPositionUpdater ( new DefaultPositionUpdater ( POS_CATEGORY ) { protected boolean notDeleted ( ) { if ( this . fOffset < this . fPosition . offset && ( this . fPosition . offset + this . fPosition . length < this . fOffset + this . fLength ) ) { this . fPosition . offset = this . fOffset + this . fLength ; return false ; } return true ; } } ) ; for ( int i = <NUM_LIT:0> ; i < positions . length ; i ++ ) { try { doc . addPosition ( POS_CATEGORY , positions [ i ] ) ; } catch ( BadLocationException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + positions [ i ] . offset + "<STR_LIT>" + positions [ i ] . length + "<STR_LIT>" + content . length ( ) ) ; } } } } catch ( BadPositionCategoryException cannotHappen ) { } return doc ; } public static void log ( Throwable t ) { Util . log ( t , "<STR_LIT>" ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . comment ; public interface IJavaDocTagConstants { public static final char [ ] [ ] JAVADOC_SINGLE_BREAK_TAG = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) } ; public static final char [ ] [ ] JAVADOC_CODE_TAGS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) } ; public static final char [ ] [ ] JAVADOC_BREAK_TAGS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT:q>" . toCharArray ( ) } ; public static final char [ ] [ ] JAVADOC_IMMUTABLE_TAGS = new char [ ] [ ] { "<STR_LIT:code>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT:q>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) } ; public static final char [ ] [ ] JAVADOC_NEWLINE_TAGS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT:q>" . toCharArray ( ) } ; public static final char [ ] [ ] JAVADOC_PARAM_TAGS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) } ; public static final char [ ] [ ] JAVADOC_SEPARATOR_TAGS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT:p>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , } ; public static final char JAVADOC_TAG_PREFIX = '<CHAR_LIT>' ; public static final char LINK_TAG_POSTFIX = '<CHAR_LIT:}>' ; public static final String LINK_TAG_PREFIX_STRING = "<STR_LIT>" ; public static final char [ ] LINK_TAG_PREFIX = LINK_TAG_PREFIX_STRING . toCharArray ( ) ; public static final char [ ] [ ] COMMENT_ROOT_TAGS = new char [ ] [ ] { "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) } ; public static final char COMMENT_TAG_PREFIX = '<CHAR_LIT>' ; public static final String BLOCK_HEADER = "<STR_LIT>" ; public static final int BLOCK_HEADER_LENGTH = BLOCK_HEADER . length ( ) ; public static final String JAVADOC_HEADER = "<STR_LIT>" ; public static final int JAVADOC_HEADER_LENGTH = JAVADOC_HEADER . length ( ) ; public static final String BLOCK_LINE_PREFIX = "<STR_LIT>" ; public static final int BLOCK_LINE_PREFIX_LENGTH = BLOCK_LINE_PREFIX . length ( ) ; public static final String BLOCK_FOOTER = "<STR_LIT>" ; public static final int BLOCK_FOOTER_LENGTH = BLOCK_FOOTER . length ( ) ; public static final String LINE_COMMENT_PREFIX = "<STR_LIT>" ; public static final int LINE_COMMENT_PREFIX_LENGTH = LINE_COMMENT_PREFIX . length ( ) ; public static final String JAVADOC_STAR = "<STR_LIT:*>" ; static final int JAVADOC_TAGS_INDEX_MASK = <NUM_LIT> ; static final int JAVADOC_TAGS_ID_MASK = <NUM_LIT> ; static final int JAVADOC_SINGLE_BREAK_TAG_ID = <NUM_LIT> ; static final int JAVADOC_CODE_TAGS_ID = <NUM_LIT> ; static final int JAVADOC_BREAK_TAGS_ID = <NUM_LIT> ; static final int JAVADOC_IMMUTABLE_TAGS_ID = <NUM_LIT> ; static final int JAVADOC_SEPARATOR_TAGS_ID = <NUM_LIT> ; static final int JAVADOC_SINGLE_TAGS_ID = JAVADOC_SINGLE_BREAK_TAG_ID ; static final int JAVADOC_CLOSED_TAG = <NUM_LIT> ; } </s>
<s> package org . eclipse . jdt . internal . formatter . comment ; import java . io . IOException ; import java . io . Reader ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; public class HTMLEntity2JavaReader extends SubstitutionTextReader { private static final Map fgEntityLookup ; static { fgEntityLookup = new HashMap ( <NUM_LIT:7> ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT:<>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT:>>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT:U+0020>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT:&>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT:\">" ) ; } public HTMLEntity2JavaReader ( Reader reader ) { super ( reader ) ; setSkipWhitespace ( false ) ; } protected String computeSubstitution ( int c ) throws IOException { if ( c == '<CHAR_LIT>' ) return processEntity ( ) ; return null ; } protected String entity2Text ( String symbol ) { if ( symbol . length ( ) > <NUM_LIT:1> && symbol . charAt ( <NUM_LIT:0> ) == '<CHAR_LIT>' ) { int ch ; try { if ( symbol . charAt ( <NUM_LIT:1> ) == '<CHAR_LIT>' ) { ch = Integer . parseInt ( symbol . substring ( <NUM_LIT:2> ) , <NUM_LIT:16> ) ; } else { ch = Integer . parseInt ( symbol . substring ( <NUM_LIT:1> ) , <NUM_LIT:10> ) ; } return String . valueOf ( ( char ) ch ) ; } catch ( NumberFormatException e ) { } } else { String str = ( String ) fgEntityLookup . get ( symbol ) ; if ( str != null ) { return str ; } } return "<STR_LIT:&>" + symbol ; } private String processEntity ( ) throws IOException { StringBuffer buf = new StringBuffer ( ) ; int ch = nextChar ( ) ; while ( ScannerHelper . isLetterOrDigit ( ( char ) ch ) || ch == '<CHAR_LIT>' ) { buf . append ( ( char ) ch ) ; ch = nextChar ( ) ; } if ( ch == '<CHAR_LIT:;>' ) return entity2Text ( buf . toString ( ) ) ; buf . insert ( <NUM_LIT:0> , '<CHAR_LIT>' ) ; if ( ch != - <NUM_LIT:1> ) buf . append ( ( char ) ch ) ; return buf . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . comment ; import java . io . IOException ; import java . io . Reader ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; public abstract class SubstitutionTextReader extends Reader { private Reader fReader ; private boolean fWasWhiteSpace ; private int fCharAfterWhiteSpace ; private boolean fSkipWhiteSpace = true ; private boolean fReadFromBuffer ; private StringBuffer fBuffer ; private int fIndex ; protected SubstitutionTextReader ( Reader reader ) { this . fReader = reader ; this . fBuffer = new StringBuffer ( ) ; this . fIndex = <NUM_LIT:0> ; this . fReadFromBuffer = false ; this . fCharAfterWhiteSpace = - <NUM_LIT:1> ; this . fWasWhiteSpace = true ; } public String getString ( ) throws IOException { StringBuffer buf = new StringBuffer ( ) ; int ch ; while ( ( ch = read ( ) ) != - <NUM_LIT:1> ) { buf . append ( ( char ) ch ) ; } return buf . toString ( ) ; } protected abstract String computeSubstitution ( int c ) throws IOException ; protected Reader getReader ( ) { return this . fReader ; } protected int nextChar ( ) throws IOException { this . fReadFromBuffer = ( this . fBuffer . length ( ) > <NUM_LIT:0> ) ; if ( this . fReadFromBuffer ) { char ch = this . fBuffer . charAt ( this . fIndex ++ ) ; if ( this . fIndex >= this . fBuffer . length ( ) ) { this . fBuffer . setLength ( <NUM_LIT:0> ) ; this . fIndex = <NUM_LIT:0> ; } return ch ; } else { int ch = this . fCharAfterWhiteSpace ; if ( ch == - <NUM_LIT:1> ) { ch = this . fReader . read ( ) ; } if ( this . fSkipWhiteSpace && ScannerHelper . isWhitespace ( ( char ) ch ) ) { do { ch = this . fReader . read ( ) ; } while ( ScannerHelper . isWhitespace ( ( char ) ch ) ) ; if ( ch != - <NUM_LIT:1> ) { this . fCharAfterWhiteSpace = ch ; return '<CHAR_LIT:U+0020>' ; } } else { this . fCharAfterWhiteSpace = - <NUM_LIT:1> ; } return ch ; } } public int read ( ) throws IOException { int c ; do { c = nextChar ( ) ; while ( ! this . fReadFromBuffer && c != - <NUM_LIT:1> ) { String s = computeSubstitution ( c ) ; if ( s == null ) break ; if ( s . length ( ) > <NUM_LIT:0> ) this . fBuffer . insert ( <NUM_LIT:0> , s ) ; c = nextChar ( ) ; } } while ( this . fSkipWhiteSpace && this . fWasWhiteSpace && ( c == '<CHAR_LIT:U+0020>' ) ) ; this . fWasWhiteSpace = ( c == '<CHAR_LIT:U+0020>' || c == '<STR_LIT>' || c == '<STR_LIT:\n>' ) ; return c ; } public int read ( char cbuf [ ] , int off , int len ) throws IOException { int end = off + len ; for ( int i = off ; i < end ; i ++ ) { int ch = read ( ) ; if ( ch == - <NUM_LIT:1> ) { if ( i == off ) { return - <NUM_LIT:1> ; } else { return i - off ; } } cbuf [ i ] = ( char ) ch ; } return len ; } public boolean ready ( ) throws IOException { return this . fReader . ready ( ) ; } public void close ( ) throws IOException { this . fReader . close ( ) ; } public void reset ( ) throws IOException { this . fReader . reset ( ) ; this . fWasWhiteSpace = true ; this . fCharAfterWhiteSpace = - <NUM_LIT:1> ; this . fBuffer . setLength ( <NUM_LIT:0> ) ; this . fIndex = <NUM_LIT:0> ; } protected final void setSkipWhitespace ( boolean state ) { this . fSkipWhiteSpace = state ; } protected final boolean isSkippingWhitespace ( ) { return this . fSkipWhiteSpace ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . comment ; import java . io . IOException ; import java . io . Reader ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . internal . compiler . parser . * ; public class Java2HTMLEntityReader extends SubstitutionTextReader { private static final int BEGIN_LINE = <NUM_LIT> ; private static final Map fgEntityLookup ; private int bits = BEGIN_LINE ; static { fgEntityLookup = new HashMap ( <NUM_LIT:7> ) ; fgEntityLookup . put ( "<STR_LIT:<>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT:>>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT:&>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT>" , "<STR_LIT>" ) ; fgEntityLookup . put ( "<STR_LIT:\">" , "<STR_LIT>" ) ; } public Java2HTMLEntityReader ( Reader reader ) { super ( reader ) ; setSkipWhitespace ( false ) ; } protected String computeSubstitution ( int c ) throws IOException { StringBuffer buf = new StringBuffer ( ) ; while ( c == '<CHAR_LIT>' ) { this . bits &= ~ BEGIN_LINE ; c = nextChar ( ) ; buf . append ( '<CHAR_LIT>' ) ; } if ( c == - <NUM_LIT:1> ) return buf . toString ( ) ; if ( c == '<CHAR_LIT:/>' && buf . length ( ) > <NUM_LIT:0> ) { buf . setLength ( buf . length ( ) - <NUM_LIT:1> ) ; buf . append ( "<STR_LIT>" ) ; } else if ( c == '<CHAR_LIT>' && ( this . bits & BEGIN_LINE ) != <NUM_LIT:0> ) { buf . append ( "<STR_LIT>" ) ; } else { String entity = ( String ) fgEntityLookup . get ( String . valueOf ( ( char ) c ) ) ; if ( entity != null ) buf . append ( entity ) ; else buf . append ( ( char ) c ) ; } if ( c == '<STR_LIT:\n>' || c == '<STR_LIT>' ) { this . bits |= BEGIN_LINE ; } else if ( ! ScannerHelper . isWhitespace ( ( char ) c ) ) { this . bits &= ~ BEGIN_LINE ; } return buf . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . util . ArrayList ; import java . util . Map ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . core . formatter . CodeFormatter ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . AND_AND_Expression ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . AbstractVariableDeclaration ; import org . eclipse . jdt . internal . compiler . ast . AllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Argument ; import org . eclipse . jdt . internal . compiler . ast . ArrayAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ; import org . eclipse . jdt . internal . compiler . ast . ArrayQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ArrayReference ; import org . eclipse . jdt . internal . compiler . ast . ArrayTypeReference ; import org . eclipse . jdt . internal . compiler . ast . AssertStatement ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . BinaryExpression ; import org . eclipse . jdt . internal . compiler . ast . Block ; import org . eclipse . jdt . internal . compiler . ast . BreakStatement ; import org . eclipse . jdt . internal . compiler . ast . CaseStatement ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . CharLiteral ; import org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ; import org . eclipse . jdt . internal . compiler . ast . Clinit ; import org . eclipse . jdt . internal . compiler . ast . CombinedBinaryExpression ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . ConditionalExpression ; import org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ; import org . eclipse . jdt . internal . compiler . ast . ContinueStatement ; import org . eclipse . jdt . internal . compiler . ast . UnionTypeReference ; import org . eclipse . jdt . internal . compiler . ast . DoStatement ; import org . eclipse . jdt . internal . compiler . ast . DoubleLiteral ; import org . eclipse . jdt . internal . compiler . ast . EmptyStatement ; import org . eclipse . jdt . internal . compiler . ast . EqualExpression ; import org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . FalseLiteral ; import org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ; import org . eclipse . jdt . internal . compiler . ast . FieldReference ; import org . eclipse . jdt . internal . compiler . ast . FloatLiteral ; import org . eclipse . jdt . internal . compiler . ast . ForStatement ; import org . eclipse . jdt . internal . compiler . ast . ForeachStatement ; import org . eclipse . jdt . internal . compiler . ast . IfStatement ; import org . eclipse . jdt . internal . compiler . ast . ImportReference ; import org . eclipse . jdt . internal . compiler . ast . Initializer ; import org . eclipse . jdt . internal . compiler . ast . InstanceOfExpression ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . ast . LabeledStatement ; import org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ; import org . eclipse . jdt . internal . compiler . ast . LongLiteral ; import org . eclipse . jdt . internal . compiler . ast . MarkerAnnotation ; import org . eclipse . jdt . internal . compiler . ast . MemberValuePair ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . NormalAnnotation ; import org . eclipse . jdt . internal . compiler . ast . NullLiteral ; import org . eclipse . jdt . internal . compiler . ast . OR_OR_Expression ; import org . eclipse . jdt . internal . compiler . ast . OperatorIds ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedSingleTypeReference ; import org . eclipse . jdt . internal . compiler . ast . PostfixExpression ; import org . eclipse . jdt . internal . compiler . ast . PrefixExpression ; import org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedThisReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ReturnStatement ; import org . eclipse . jdt . internal . compiler . ast . SingleMemberAnnotation ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleTypeReference ; import org . eclipse . jdt . internal . compiler . ast . Statement ; import org . eclipse . jdt . internal . compiler . ast . StringLiteral ; import org . eclipse . jdt . internal . compiler . ast . StringLiteralConcatenation ; import org . eclipse . jdt . internal . compiler . ast . SuperReference ; import org . eclipse . jdt . internal . compiler . ast . SwitchStatement ; import org . eclipse . jdt . internal . compiler . ast . SynchronizedStatement ; import org . eclipse . jdt . internal . compiler . ast . ThisReference ; import org . eclipse . jdt . internal . compiler . ast . ThrowStatement ; import org . eclipse . jdt . internal . compiler . ast . TrueLiteral ; import org . eclipse . jdt . internal . compiler . ast . TryStatement ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeParameter ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . ast . UnaryExpression ; import org . eclipse . jdt . internal . compiler . ast . WhileStatement ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . core . util . CodeSnippetParsingUtil ; import org . eclipse . jdt . internal . formatter . align . Alignment ; import org . eclipse . jdt . internal . formatter . align . AlignmentException ; import org . eclipse . jface . text . IRegion ; import org . eclipse . text . edits . TextEdit ; public class CodeFormatterVisitor extends ASTVisitor { public static class MultiFieldDeclaration extends FieldDeclaration { FieldDeclaration [ ] declarations ; MultiFieldDeclaration ( FieldDeclaration [ ] declarations ) { this . declarations = declarations ; this . modifiers = declarations [ <NUM_LIT:0> ] . modifiers ; } } public final static boolean DEBUG = false ; private static final int NO_MODIFIERS = <NUM_LIT:0> ; private static final int [ ] SINGLETYPEREFERENCE_EXPECTEDTOKENS = new int [ ] { TerminalTokens . TokenNameIdentifier , TerminalTokens . TokenNameboolean , TerminalTokens . TokenNamebyte , TerminalTokens . TokenNamechar , TerminalTokens . TokenNamedouble , TerminalTokens . TokenNamefloat , TerminalTokens . TokenNameint , TerminalTokens . TokenNamelong , TerminalTokens . TokenNameshort , TerminalTokens . TokenNamevoid } ; private static final int [ ] CLOSING_GENERICS_EXPECTEDTOKENS = new int [ ] { TerminalTokens . TokenNameRIGHT_SHIFT , TerminalTokens . TokenNameGREATER , TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT , } ; public int lastLocalDeclarationSourceStart ; int lastBinaryExpressionAlignmentBreakIndentation ; private Scanner localScanner ; public DefaultCodeFormatterOptions preferences ; public Scribe scribe ; final static long EXPRESSIONS_POS_ENTER_EQUALITY = <NUM_LIT:1> ; final static long EXPRESSIONS_POS_ENTER_TWO = <NUM_LIT:2> ; final static long EXPRESSIONS_POS_BETWEEN_TWO = <NUM_LIT:3> ; final static long EXPRESSIONS_POS_MASK = EXPRESSIONS_POS_BETWEEN_TWO ; long expressionsPos ; int expressionsDepth = - <NUM_LIT:1> ; int arrayInitializersDepth = - <NUM_LIT:1> ; public CodeFormatterVisitor ( DefaultCodeFormatterOptions preferences , Map settings , IRegion [ ] regions , CodeSnippetParsingUtil codeSnippetParsingUtil , boolean includeComments ) { long sourceLevel = settings == null ? ClassFileConstants . JDK1_3 : CompilerOptions . versionToJdkLevel ( settings . get ( JavaCore . COMPILER_SOURCE ) ) ; this . localScanner = new Scanner ( true , false , false , sourceLevel , null , null , true ) ; this . preferences = preferences ; this . scribe = new Scribe ( this , sourceLevel , regions , codeSnippetParsingUtil , includeComments ) ; } public void acceptProblem ( IProblem problem ) { super . acceptProblem ( problem ) ; } private BinaryExpressionFragmentBuilder buildFragments ( BinaryExpression binaryExpression , BlockScope scope ) { BinaryExpressionFragmentBuilder builder = new BinaryExpressionFragmentBuilder ( ) ; if ( binaryExpression instanceof CombinedBinaryExpression ) { binaryExpression . traverse ( builder , scope ) ; return builder ; } switch ( ( binaryExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT ) { case OperatorIds . MULTIPLY : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameMULTIPLY ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . PLUS : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNamePLUS ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . DIVIDE : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameDIVIDE ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . REMAINDER : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameREMAINDER ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . XOR : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameXOR ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . MINUS : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameMINUS ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . OR : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameOR ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . AND : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameAND ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . AND_AND : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameAND_AND ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; case OperatorIds . OR_OR : binaryExpression . left . traverse ( builder , scope ) ; builder . operatorsList . add ( new Integer ( TerminalTokens . TokenNameOR_OR ) ) ; binaryExpression . right . traverse ( builder , scope ) ; break ; } return builder ; } private CascadingMethodInvocationFragmentBuilder buildFragments ( MessageSend messageSend , BlockScope scope ) { CascadingMethodInvocationFragmentBuilder builder = new CascadingMethodInvocationFragmentBuilder ( ) ; messageSend . traverse ( builder , scope ) ; return builder ; } private boolean commentStartsBlock ( int start , int end ) { this . localScanner . resetTo ( start , end ) ; try { if ( this . localScanner . getNextToken ( ) == TerminalTokens . TokenNameLBRACE ) { switch ( this . localScanner . getNextToken ( ) ) { case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : return true ; } } } catch ( InvalidInputException e ) { } return false ; } private ASTNode [ ] computeMergedMemberDeclarations ( ASTNode [ ] nodes ) { ArrayList mergedNodes = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> , max = nodes . length ; i < max ; i ++ ) { ASTNode currentNode = nodes [ i ] ; if ( currentNode instanceof FieldDeclaration ) { FieldDeclaration currentField = ( FieldDeclaration ) currentNode ; if ( mergedNodes . size ( ) == <NUM_LIT:0> ) { mergedNodes . add ( currentNode ) ; } else { ASTNode previousMergedNode = ( ASTNode ) mergedNodes . get ( mergedNodes . size ( ) - <NUM_LIT:1> ) ; if ( previousMergedNode instanceof MultiFieldDeclaration ) { MultiFieldDeclaration multiFieldDeclaration = ( MultiFieldDeclaration ) previousMergedNode ; int length = multiFieldDeclaration . declarations . length ; System . arraycopy ( multiFieldDeclaration . declarations , <NUM_LIT:0> , multiFieldDeclaration . declarations = new FieldDeclaration [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; multiFieldDeclaration . declarations [ length ] = currentField ; } else if ( previousMergedNode instanceof FieldDeclaration ) { final FieldDeclaration previousFieldDeclaration = ( FieldDeclaration ) previousMergedNode ; if ( currentField . declarationSourceStart == previousFieldDeclaration . declarationSourceStart ) { final MultiFieldDeclaration multiFieldDeclaration = new MultiFieldDeclaration ( new FieldDeclaration [ ] { previousFieldDeclaration , currentField } ) ; multiFieldDeclaration . annotations = previousFieldDeclaration . annotations ; mergedNodes . set ( mergedNodes . size ( ) - <NUM_LIT:1> , multiFieldDeclaration ) ; } else { mergedNodes . add ( currentNode ) ; } } else { mergedNodes . add ( currentNode ) ; } } } else { mergedNodes . add ( currentNode ) ; } } if ( mergedNodes . size ( ) != nodes . length ) { ASTNode [ ] result = new ASTNode [ mergedNodes . size ( ) ] ; mergedNodes . toArray ( result ) ; return result ; } else { return nodes ; } } private ASTNode [ ] computeMergedMemberDeclarations ( TypeDeclaration typeDeclaration ) { int fieldIndex = <NUM_LIT:0> , fieldCount = ( typeDeclaration . fields == null ) ? <NUM_LIT:0> : typeDeclaration . fields . length ; FieldDeclaration field = fieldCount == <NUM_LIT:0> ? null : typeDeclaration . fields [ fieldIndex ] ; int fieldStart = field == null ? Integer . MAX_VALUE : field . declarationSourceStart ; int methodIndex = <NUM_LIT:0> , methodCount = ( typeDeclaration . methods == null ) ? <NUM_LIT:0> : typeDeclaration . methods . length ; AbstractMethodDeclaration method = methodCount == <NUM_LIT:0> ? null : typeDeclaration . methods [ methodIndex ] ; int methodStart = method == null ? Integer . MAX_VALUE : method . declarationSourceStart ; int typeIndex = <NUM_LIT:0> , typeCount = ( typeDeclaration . memberTypes == null ) ? <NUM_LIT:0> : typeDeclaration . memberTypes . length ; TypeDeclaration type = typeCount == <NUM_LIT:0> ? null : typeDeclaration . memberTypes [ typeIndex ] ; int typeStart = type == null ? Integer . MAX_VALUE : type . declarationSourceStart ; final int memberLength = fieldCount + methodCount + typeCount ; ASTNode [ ] members = new ASTNode [ memberLength ] ; if ( memberLength != <NUM_LIT:0> ) { int index = <NUM_LIT:0> ; int previousFieldStart = - <NUM_LIT:1> ; do { if ( fieldStart < methodStart && fieldStart < typeStart ) { if ( field . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { previousFieldStart = fieldStart ; if ( ++ fieldIndex < fieldCount ) { fieldStart = ( field = typeDeclaration . fields [ fieldIndex ] ) . declarationSourceStart ; } else { fieldStart = Integer . MAX_VALUE ; } continue ; } if ( fieldStart == previousFieldStart ) { ASTNode previousMember = members [ index - <NUM_LIT:1> ] ; if ( previousMember instanceof MultiFieldDeclaration ) { MultiFieldDeclaration multiField = ( MultiFieldDeclaration ) previousMember ; int length = multiField . declarations . length ; System . arraycopy ( multiField . declarations , <NUM_LIT:0> , multiField . declarations = new FieldDeclaration [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; multiField . declarations [ length ] = field ; } else { FieldDeclaration fieldDeclaration = ( FieldDeclaration ) previousMember ; final MultiFieldDeclaration multiFieldDeclaration = new MultiFieldDeclaration ( new FieldDeclaration [ ] { fieldDeclaration , field } ) ; multiFieldDeclaration . annotations = fieldDeclaration . annotations ; members [ index - <NUM_LIT:1> ] = multiFieldDeclaration ; } } else { members [ index ++ ] = field ; } previousFieldStart = fieldStart ; if ( ++ fieldIndex < fieldCount ) { fieldStart = ( field = typeDeclaration . fields [ fieldIndex ] ) . declarationSourceStart ; } else { fieldStart = Integer . MAX_VALUE ; } } else if ( methodStart < fieldStart && methodStart < typeStart ) { if ( ! method . isDefaultConstructor ( ) && ! method . isClinit ( ) ) { members [ index ++ ] = method ; } if ( ++ methodIndex < methodCount ) { methodStart = ( method = typeDeclaration . methods [ methodIndex ] ) . declarationSourceStart ; } else { methodStart = Integer . MAX_VALUE ; } } else { members [ index ++ ] = type ; if ( ++ typeIndex < typeCount ) { typeStart = ( type = typeDeclaration . memberTypes [ typeIndex ] ) . declarationSourceStart ; } else { typeStart = Integer . MAX_VALUE ; } } } while ( ( fieldIndex < fieldCount ) || ( typeIndex < typeCount ) || ( methodIndex < methodCount ) ) ; if ( members . length != index ) { System . arraycopy ( members , <NUM_LIT:0> , members = new ASTNode [ index ] , <NUM_LIT:0> , index ) ; } } return members ; } private boolean dumpBinaryExpression ( BinaryExpression binaryExpression , int operator , BlockScope scope ) { final int numberOfParens = ( binaryExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( binaryExpression , numberOfParens ) ; } BinaryExpressionFragmentBuilder builder = buildFragments ( binaryExpression , scope ) ; final int fragmentsSize = builder . size ( ) ; if ( this . expressionsDepth < <NUM_LIT:0> ) { this . expressionsDepth = <NUM_LIT:0> ; } else { this . expressionsDepth ++ ; this . expressionsPos <<= <NUM_LIT:2> ; } try { this . lastBinaryExpressionAlignmentBreakIndentation = <NUM_LIT:0> ; if ( ( builder . realFragmentsSize ( ) > <NUM_LIT:1> || fragmentsSize > <NUM_LIT:4> ) && numberOfParens == <NUM_LIT:0> ) { int scribeLine = this . scribe . line ; this . scribe . printComment ( ) ; Alignment binaryExpressionAlignment = this . scribe . createAlignment ( Alignment . BINARY_EXPRESSION , this . preferences . alignment_for_binary_expression , Alignment . R_OUTERMOST , fragmentsSize , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( binaryExpressionAlignment ) ; boolean ok = false ; ASTNode [ ] fragments = builder . fragments ( ) ; int [ ] operators = builder . operators ( ) ; do { try { final int max = fragmentsSize - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { ASTNode fragment = fragments [ i ] ; fragment . traverse ( this , scope ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( this . scribe . lastNumberOfNewLines == <NUM_LIT:1> ) { this . scribe . indentationLevel = binaryExpressionAlignment . breakIndentationLevel ; } if ( this . preferences . wrap_before_binary_operator ) { this . scribe . alignFragment ( binaryExpressionAlignment , i ) ; this . scribe . printNextToken ( operators [ i ] , this . preferences . insert_space_before_binary_operator ) ; } else { this . scribe . printNextToken ( operators [ i ] , this . preferences . insert_space_before_binary_operator ) ; this . scribe . alignFragment ( binaryExpressionAlignment , i ) ; } if ( operators [ i ] == TerminalTokens . TokenNameMINUS && isNextToken ( TerminalTokens . TokenNameMINUS ) ) { this . scribe . space ( ) ; } if ( this . preferences . insert_space_after_binary_operator ) { this . scribe . space ( ) ; } } fragments [ max ] . traverse ( this , scope ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( binaryExpressionAlignment , true ) ; if ( this . scribe . line == scribeLine ) { this . lastBinaryExpressionAlignmentBreakIndentation = <NUM_LIT:0> ; } else { this . lastBinaryExpressionAlignmentBreakIndentation = binaryExpressionAlignment . breakIndentationLevel ; } } else { this . expressionsPos |= EXPRESSIONS_POS_ENTER_TWO ; binaryExpression . left . traverse ( this , scope ) ; this . expressionsPos &= ~ EXPRESSIONS_POS_MASK ; this . expressionsPos |= EXPRESSIONS_POS_BETWEEN_TWO ; this . scribe . printNextToken ( operator , this . preferences . insert_space_before_binary_operator , Scribe . PRESERVE_EMPTY_LINES_IN_BINARY_EXPRESSION ) ; if ( operator == TerminalTokens . TokenNameMINUS && isNextToken ( TerminalTokens . TokenNameMINUS ) ) { this . scribe . space ( ) ; } if ( this . preferences . insert_space_after_binary_operator ) { this . scribe . space ( ) ; } binaryExpression . right . traverse ( this , scope ) ; } } finally { this . expressionsDepth -- ; this . expressionsPos >>= <NUM_LIT:2> ; if ( this . expressionsDepth < <NUM_LIT:0> ) { this . lastBinaryExpressionAlignmentBreakIndentation = <NUM_LIT:0> ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( binaryExpression , numberOfParens ) ; } return false ; } private boolean dumpEqualityExpression ( BinaryExpression binaryExpression , int operator , BlockScope scope ) { final int numberOfParens = ( binaryExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( binaryExpression , numberOfParens ) ; } if ( this . expressionsDepth < <NUM_LIT:0> ) { this . expressionsDepth = <NUM_LIT:0> ; } else { this . expressionsDepth ++ ; this . expressionsPos <<= <NUM_LIT:2> ; } try { this . expressionsPos |= EXPRESSIONS_POS_ENTER_EQUALITY ; binaryExpression . left . traverse ( this , scope ) ; this . scribe . printNextToken ( operator , this . preferences . insert_space_before_binary_operator , Scribe . PRESERVE_EMPTY_LINES_IN_EQUALITY_EXPRESSION ) ; if ( this . preferences . insert_space_after_binary_operator ) { this . scribe . space ( ) ; } binaryExpression . right . traverse ( this , scope ) ; } finally { this . expressionsDepth -- ; this . expressionsPos >>= <NUM_LIT:2> ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( binaryExpression , numberOfParens ) ; } return false ; } private final TextEdit failedToFormat ( ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + this . scribe . scanner ) ; System . out . println ( this . scribe ) ; } return null ; } private void format ( AbstractMethodDeclaration methodDeclaration , ClassScope scope , boolean isChunkStart , boolean isFirstClassBodyDeclaration ) { if ( isFirstClassBodyDeclaration ) { int newLinesBeforeFirstClassBodyDeclaration = this . preferences . blank_lines_before_first_class_body_declaration ; if ( newLinesBeforeFirstClassBodyDeclaration > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeFirstClassBodyDeclaration ) ; } } else { final int newLineBeforeChunk = isChunkStart ? this . preferences . blank_lines_before_new_chunk : <NUM_LIT:0> ; if ( newLineBeforeChunk > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLineBeforeChunk ) ; } } final int newLinesBeforeMethod = this . preferences . blank_lines_before_method ; if ( newLinesBeforeMethod > <NUM_LIT:0> && ! isFirstClassBodyDeclaration ) { this . scribe . printEmptyLines ( newLinesBeforeMethod ) ; } else if ( this . scribe . line != <NUM_LIT:0> || this . scribe . column != <NUM_LIT:1> ) { this . scribe . printNewLine ( ) ; } methodDeclaration . traverse ( this , scope ) ; } private void format ( FieldDeclaration fieldDeclaration , ASTVisitor visitor , MethodScope scope , boolean isChunkStart , boolean isFirstClassBodyDeclaration ) { if ( isFirstClassBodyDeclaration ) { int newLinesBeforeFirstClassBodyDeclaration = this . preferences . blank_lines_before_first_class_body_declaration ; if ( newLinesBeforeFirstClassBodyDeclaration > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeFirstClassBodyDeclaration ) ; } } else { int newLineBeforeChunk = isChunkStart ? this . preferences . blank_lines_before_new_chunk : <NUM_LIT:0> ; if ( newLineBeforeChunk > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLineBeforeChunk ) ; } final int newLinesBeforeField = this . preferences . blank_lines_before_field ; if ( newLinesBeforeField > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeField ) ; } } Alignment memberAlignment = this . scribe . getMemberAlignment ( ) ; this . scribe . printComment ( ) ; this . scribe . printModifiers ( fieldDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_FIELD ) ; this . scribe . space ( ) ; fieldDeclaration . type . traverse ( this , scope ) ; this . scribe . alignFragment ( memberAlignment , <NUM_LIT:0> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; int extraDimensions = getDimensions ( ) ; if ( extraDimensions != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < extraDimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } final Expression initialization = fieldDeclaration . initialization ; if ( initialization != null ) { this . scribe . alignFragment ( memberAlignment , <NUM_LIT:1> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameEQUAL , this . preferences . insert_space_before_assignment_operator ) ; if ( this . preferences . insert_space_after_assignment_operator ) { this . scribe . space ( ) ; } Alignment assignmentAlignment = this . scribe . createAlignment ( Alignment . FIELD_DECLARATION_ASSIGNMENT , this . preferences . alignment_for_assignment , Alignment . R_INNERMOST , <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( assignmentAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( assignmentAlignment , <NUM_LIT:0> ) ; initialization . traverse ( this , scope ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( assignmentAlignment , true ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; if ( memberAlignment != null ) { this . scribe . alignFragment ( memberAlignment , <NUM_LIT:2> ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } else { this . scribe . space ( ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } private void format ( ImportReference importRef , boolean isLast ) { this . scribe . printNextToken ( TerminalTokens . TokenNameimport ) ; if ( ! isLast ) this . scribe . blank_lines_between_import_groups = this . preferences . blank_lines_between_import_groups ; this . scribe . space ( ) ; if ( importRef . isStatic ( ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNamestatic ) ; this . scribe . space ( ) ; } if ( ( importRef . bits & ASTNode . OnDemand ) != <NUM_LIT:0> ) { this . scribe . printQualifiedReference ( importRef . sourceEnd , false ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameMULTIPLY ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; } else { this . scribe . printQualifiedReference ( importRef . sourceEnd , false ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; } if ( isLast ) { this . scribe . blank_lines_between_import_groups = - <NUM_LIT:1> ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . IMPORT_TRAILING_COMMENT ) ; } else { this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . NO_TRAILING_COMMENT ) ; this . scribe . blank_lines_between_import_groups = - <NUM_LIT:1> ; } this . scribe . printNewLine ( ) ; } private void format ( MultiFieldDeclaration multiFieldDeclaration , ASTVisitor visitor , MethodScope scope , boolean isChunkStart , boolean isFirstClassBodyDeclaration ) { if ( isFirstClassBodyDeclaration ) { int newLinesBeforeFirstClassBodyDeclaration = this . preferences . blank_lines_before_first_class_body_declaration ; if ( newLinesBeforeFirstClassBodyDeclaration > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeFirstClassBodyDeclaration ) ; } } else { int newLineBeforeChunk = isChunkStart ? this . preferences . blank_lines_before_new_chunk : <NUM_LIT:0> ; if ( newLineBeforeChunk > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLineBeforeChunk ) ; } final int newLinesBeforeField = this . preferences . blank_lines_before_field ; if ( newLinesBeforeField > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeField ) ; } } Alignment fieldAlignment = this . scribe . getMemberAlignment ( ) ; this . scribe . printComment ( ) ; this . scribe . printModifiers ( multiFieldDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_FIELD ) ; this . scribe . space ( ) ; multiFieldDeclaration . declarations [ <NUM_LIT:0> ] . type . traverse ( this , scope ) ; final int multipleFieldDeclarationsLength = multiFieldDeclaration . declarations . length ; Alignment multiFieldDeclarationsAlignment = this . scribe . createAlignment ( Alignment . MULTIPLE_FIELD , this . preferences . alignment_for_multiple_fields , multipleFieldDeclarationsLength - <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( multiFieldDeclarationsAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> , length = multipleFieldDeclarationsLength ; i < length ; i ++ ) { FieldDeclaration fieldDeclaration = multiFieldDeclaration . declarations [ i ] ; if ( i == <NUM_LIT:0> ) { this . scribe . alignFragment ( fieldAlignment , <NUM_LIT:0> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , false ) ; } int extraDimensions = getDimensions ( ) ; if ( extraDimensions != <NUM_LIT:0> ) { for ( int index = <NUM_LIT:0> ; index < extraDimensions ; index ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } final Expression initialization = fieldDeclaration . initialization ; if ( initialization != null ) { if ( i == <NUM_LIT:0> ) { this . scribe . alignFragment ( fieldAlignment , <NUM_LIT:1> ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameEQUAL , this . preferences . insert_space_before_assignment_operator ) ; if ( this . preferences . insert_space_after_assignment_operator ) { this . scribe . space ( ) ; } initialization . traverse ( this , scope ) ; } if ( i != length - <NUM_LIT:1> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_multiple_field_declarations ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . alignFragment ( multiFieldDeclarationsAlignment , i ) ; if ( this . preferences . insert_space_after_comma_in_multiple_field_declarations ) { this . scribe . space ( ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . alignFragment ( fieldAlignment , <NUM_LIT:2> ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( multiFieldDeclarationsAlignment , true ) ; } public TextEdit format ( String string , ASTNode [ ] nodes ) { this . scribe . reset ( ) ; long startTime = <NUM_LIT:0> ; if ( DEBUG ) { startTime = System . currentTimeMillis ( ) ; } final char [ ] compilationUnitSource = string . toCharArray ( ) ; this . localScanner . setSource ( compilationUnitSource ) ; this . scribe . resetScanner ( compilationUnitSource ) ; if ( nodes == null ) { return null ; } this . lastLocalDeclarationSourceStart = - <NUM_LIT:1> ; try { formatClassBodyDeclarations ( nodes ) ; } catch ( AbortFormatting e ) { return failedToFormat ( ) ; } if ( DEBUG ) { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - startTime ) ) ; } return this . scribe . getRootEdit ( ) ; } public TextEdit format ( String string , CompilationUnitDeclaration compilationUnitDeclaration ) { this . scribe . reset ( ) ; if ( compilationUnitDeclaration == null || compilationUnitDeclaration . ignoreFurtherInvestigation ) { return failedToFormat ( ) ; } long startTime = <NUM_LIT:0> ; if ( DEBUG ) { startTime = System . currentTimeMillis ( ) ; } final char [ ] compilationUnitSource = string . toCharArray ( ) ; this . localScanner . setSource ( compilationUnitSource ) ; this . scribe . resetScanner ( compilationUnitSource ) ; this . lastLocalDeclarationSourceStart = - <NUM_LIT:1> ; try { compilationUnitDeclaration . traverse ( this , compilationUnitDeclaration . scope ) ; } catch ( AbortFormatting e ) { return failedToFormat ( ) ; } if ( DEBUG ) { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - startTime ) ) ; } return this . scribe . getRootEdit ( ) ; } public TextEdit format ( String string , ConstructorDeclaration constructorDeclaration ) { this . scribe . reset ( ) ; long startTime = <NUM_LIT:0> ; if ( DEBUG ) { startTime = System . currentTimeMillis ( ) ; } final char [ ] compilationUnitSource = string . toCharArray ( ) ; this . localScanner . setSource ( compilationUnitSource ) ; this . scribe . resetScanner ( compilationUnitSource ) ; if ( constructorDeclaration == null ) { return null ; } this . lastLocalDeclarationSourceStart = - <NUM_LIT:1> ; try { ExplicitConstructorCall explicitConstructorCall = constructorDeclaration . constructorCall ; if ( explicitConstructorCall != null && ! explicitConstructorCall . isImplicitSuper ( ) ) { explicitConstructorCall . traverse ( this , null ) ; } Statement [ ] statements = constructorDeclaration . statements ; if ( statements != null ) { formatStatements ( null , statements , false ) ; } if ( hasComments ( ) ) { this . scribe . printNewLine ( ) ; } this . scribe . printComment ( ) ; } catch ( AbortFormatting e ) { return failedToFormat ( ) ; } if ( DEBUG ) { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - startTime ) ) ; } return this . scribe . getRootEdit ( ) ; } public TextEdit format ( String string , Expression expression ) { this . scribe . reset ( ) ; long startTime = <NUM_LIT:0> ; if ( DEBUG ) { startTime = System . currentTimeMillis ( ) ; } final char [ ] compilationUnitSource = string . toCharArray ( ) ; this . localScanner . setSource ( compilationUnitSource ) ; this . scribe . resetScanner ( compilationUnitSource ) ; if ( expression == null ) { return null ; } this . lastLocalDeclarationSourceStart = - <NUM_LIT:1> ; try { expression . traverse ( this , ( BlockScope ) null ) ; this . scribe . printComment ( ) ; } catch ( AbortFormatting e ) { return failedToFormat ( ) ; } if ( DEBUG ) { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - startTime ) ) ; } return this . scribe . getRootEdit ( ) ; } public void formatComment ( int kind , String source , int start , int end , int indentationLevel ) { if ( source == null ) return ; this . scribe . printComment ( kind , source , start , end , indentationLevel ) ; } private void format ( TypeDeclaration typeDeclaration ) { this . scribe . printComment ( ) ; int line = this . scribe . line ; this . scribe . printModifiers ( typeDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_TYPE ) ; if ( this . scribe . line > line ) { line = this . scribe . line ; } switch ( TypeDeclaration . kind ( typeDeclaration . modifiers ) ) { case TypeDeclaration . CLASS_DECL : this . scribe . printNextToken ( TerminalTokens . TokenNameclass , true ) ; break ; case TypeDeclaration . INTERFACE_DECL : this . scribe . printNextToken ( TerminalTokens . TokenNameinterface , true ) ; break ; case TypeDeclaration . ENUM_DECL : this . scribe . printNextToken ( TerminalTokens . TokenNameenum , true ) ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : this . scribe . printNextToken ( TerminalTokens . TokenNameAT , this . preferences . insert_space_before_at_in_annotation_type_declaration ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameinterface , this . preferences . insert_space_after_at_in_annotation_type_declaration ) ; break ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; TypeParameter [ ] typeParameters = typeDeclaration . typeParameters ; if ( typeParameters != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_parameters ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_parameters ) { this . scribe . space ( ) ; } int length = typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeParameters [ i ] . traverse ( this , typeDeclaration . scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_parameters ) ; if ( this . preferences . insert_space_after_comma_in_type_parameters ) { this . scribe . space ( ) ; } } typeParameters [ length - <NUM_LIT:1> ] . traverse ( this , typeDeclaration . scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_parameters ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_parameters ) { this . scribe . space ( ) ; } } final TypeReference superclass = typeDeclaration . superclass ; if ( superclass != null ) { Alignment superclassAlignment = this . scribe . createAlignment ( Alignment . SUPER_CLASS , this . preferences . alignment_for_superclass_in_type_declaration , <NUM_LIT:2> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( superclassAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( superclassAlignment , <NUM_LIT:0> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameextends , true ) ; this . scribe . alignFragment ( superclassAlignment , <NUM_LIT:1> ) ; this . scribe . space ( ) ; superclass . traverse ( this , typeDeclaration . scope ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( superclassAlignment , true ) ; } final TypeReference [ ] superInterfaces = typeDeclaration . superInterfaces ; if ( superInterfaces != null ) { int alignment_for_superinterfaces ; int kind = TypeDeclaration . kind ( typeDeclaration . modifiers ) ; switch ( kind ) { case TypeDeclaration . ENUM_DECL : alignment_for_superinterfaces = this . preferences . alignment_for_superinterfaces_in_enum_declaration ; break ; default : alignment_for_superinterfaces = this . preferences . alignment_for_superinterfaces_in_type_declaration ; break ; } int superInterfaceLength = superInterfaces . length ; Alignment interfaceAlignment = this . scribe . createAlignment ( Alignment . SUPER_INTERFACES , alignment_for_superinterfaces , superInterfaceLength + <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( interfaceAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( interfaceAlignment , <NUM_LIT:0> ) ; if ( kind == TypeDeclaration . INTERFACE_DECL ) { this . scribe . printNextToken ( TerminalTokens . TokenNameextends , true ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameimplements , true ) ; } for ( int i = <NUM_LIT:0> ; i < superInterfaceLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_superinterfaces ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . alignFragment ( interfaceAlignment , i + <NUM_LIT:1> ) ; if ( this . preferences . insert_space_after_comma_in_superinterfaces ) { this . scribe . space ( ) ; } superInterfaces [ i ] . traverse ( this , typeDeclaration . scope ) ; } else { this . scribe . alignFragment ( interfaceAlignment , i + <NUM_LIT:1> ) ; this . scribe . space ( ) ; superInterfaces [ i ] . traverse ( this , typeDeclaration . scope ) ; } } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( interfaceAlignment , true ) ; } String class_declaration_brace ; boolean space_before_opening_brace ; int kind = TypeDeclaration . kind ( typeDeclaration . modifiers ) ; switch ( kind ) { case TypeDeclaration . ENUM_DECL : class_declaration_brace = this . preferences . brace_position_for_enum_declaration ; space_before_opening_brace = this . preferences . insert_space_before_opening_brace_in_enum_declaration ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : class_declaration_brace = this . preferences . brace_position_for_annotation_type_declaration ; space_before_opening_brace = this . preferences . insert_space_before_opening_brace_in_annotation_type_declaration ; break ; default : class_declaration_brace = this . preferences . brace_position_for_type_declaration ; space_before_opening_brace = this . preferences . insert_space_before_opening_brace_in_type_declaration ; break ; } formatLeftCurlyBrace ( line , class_declaration_brace ) ; formatTypeOpeningBrace ( class_declaration_brace , space_before_opening_brace , typeDeclaration ) ; boolean indent_body_declarations_compare_to_header ; switch ( kind ) { case TypeDeclaration . ENUM_DECL : indent_body_declarations_compare_to_header = this . preferences . indent_body_declarations_compare_to_enum_declaration_header ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : indent_body_declarations_compare_to_header = this . preferences . indent_body_declarations_compare_to_annotation_declaration_header ; break ; default : indent_body_declarations_compare_to_header = this . preferences . indent_body_declarations_compare_to_type_header ; break ; } if ( indent_body_declarations_compare_to_header ) { this . scribe . indent ( ) ; } if ( kind == TypeDeclaration . ENUM_DECL ) { FieldDeclaration [ ] fieldDeclarations = typeDeclaration . fields ; boolean hasConstants = false ; int length = fieldDeclarations != null ? fieldDeclarations . length : <NUM_LIT:0> ; int enumConstantsLength = <NUM_LIT:0> ; if ( fieldDeclarations != null ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FieldDeclaration fieldDeclaration = fieldDeclarations [ i ] ; if ( fieldDeclaration . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { enumConstantsLength ++ ; } else { break ; } } hasConstants = enumConstantsLength != <NUM_LIT:0> ; if ( enumConstantsLength > <NUM_LIT:1> ) { Alignment enumConstantsAlignment = this . scribe . createAlignment ( Alignment . ENUM_CONSTANTS , this . preferences . alignment_for_enum_constants , enumConstantsLength , this . scribe . scanner . currentPosition , <NUM_LIT:0> , false ) ; this . scribe . enterAlignment ( enumConstantsAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> ; i < enumConstantsLength ; i ++ ) { this . scribe . alignFragment ( enumConstantsAlignment , i ) ; FieldDeclaration fieldDeclaration = fieldDeclarations [ i ] ; fieldDeclaration . traverse ( this , typeDeclaration . initializerScope ) ; if ( isNextToken ( TerminalTokens . TokenNameCOMMA ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_enum_declarations ) ; if ( this . preferences . insert_space_after_comma_in_enum_declarations ) { this . scribe . space ( ) ; } this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( fieldDeclaration . initialization instanceof QualifiedAllocationExpression ) { this . scribe . printNewLine ( ) ; } } } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( enumConstantsAlignment , true ) ; } else if ( hasConstants ) { FieldDeclaration fieldDeclaration = fieldDeclarations [ <NUM_LIT:0> ] ; fieldDeclaration . traverse ( this , typeDeclaration . initializerScope ) ; if ( isNextToken ( TerminalTokens . TokenNameCOMMA ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_enum_declarations ) ; if ( this . preferences . insert_space_after_comma_in_enum_declarations ) { this . scribe . space ( ) ; } this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( fieldDeclaration . initialization instanceof QualifiedAllocationExpression ) { this . scribe . printNewLine ( ) ; } } } } if ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( hasConstants || ( ( enumConstantsLength - length ) != <NUM_LIT:0> ) || typeDeclaration . methods != null || typeDeclaration . memberTypes != null ) { this . scribe . printNewLine ( ) ; } } else if ( hasConstants ) { this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . printNewLine ( ) ; } } formatTypeMembers ( typeDeclaration ) ; if ( indent_body_declarations_compare_to_header ) { this . scribe . unIndent ( ) ; } switch ( kind ) { case TypeDeclaration . ENUM_DECL : if ( this . preferences . insert_new_line_in_empty_enum_declaration ) { this . scribe . printNewLine ( ) ; } break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : if ( this . preferences . insert_new_line_in_empty_annotation_declaration ) { this . scribe . printNewLine ( ) ; } break ; default : if ( this . preferences . insert_new_line_in_empty_type_declaration ) { this . scribe . printNewLine ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( class_declaration_brace . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } if ( hasComments ( ) ) { this . scribe . printNewLine ( ) ; } } private void format ( TypeDeclaration memberTypeDeclaration , ClassScope scope , boolean isChunkStart , boolean isFirstClassBodyDeclaration ) { if ( isFirstClassBodyDeclaration ) { int newLinesBeforeFirstClassBodyDeclaration = this . preferences . blank_lines_before_first_class_body_declaration ; if ( newLinesBeforeFirstClassBodyDeclaration > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeFirstClassBodyDeclaration ) ; } } else { int newLineBeforeChunk = isChunkStart ? this . preferences . blank_lines_before_new_chunk : <NUM_LIT:0> ; if ( newLineBeforeChunk > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLineBeforeChunk ) ; } final int newLinesBeforeMember = this . preferences . blank_lines_before_member_type ; if ( newLinesBeforeMember > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeMember ) ; } } memberTypeDeclaration . traverse ( this , scope ) ; } private void formatAnonymousTypeDeclaration ( TypeDeclaration typeDeclaration ) { String anonymous_type_declaration_brace_position = this . preferences . brace_position_for_anonymous_type_declaration ; formatTypeOpeningBrace ( anonymous_type_declaration_brace_position , this . preferences . insert_space_before_opening_brace_in_anonymous_type_declaration , typeDeclaration ) ; this . scribe . indent ( ) ; formatTypeMembers ( typeDeclaration ) ; this . scribe . unIndent ( ) ; if ( this . preferences . insert_new_line_in_empty_anonymous_type_declaration ) { this . scribe . printNewLine ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; if ( anonymous_type_declaration_brace_position . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } } private void formatBlock ( Block block , BlockScope scope , String block_brace_position , boolean insertSpaceBeforeOpeningBrace ) { formatOpeningBrace ( block_brace_position , insertSpaceBeforeOpeningBrace ) ; final Statement [ ] statements = block . statements ; if ( statements != null ) { this . scribe . printNewLine ( ) ; if ( this . preferences . indent_statements_compare_to_block ) { this . scribe . indent ( ) ; } formatStatements ( scope , statements , true ) ; this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_AT_END_OF_BLOCK ) ; if ( this . preferences . indent_statements_compare_to_block ) { this . scribe . unIndent ( ) ; } } else if ( this . preferences . insert_new_line_in_empty_block ) { this . scribe . printNewLine ( ) ; if ( this . preferences . indent_statements_compare_to_block ) { this . scribe . indent ( ) ; } this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_AT_END_OF_BLOCK ) ; if ( this . preferences . indent_statements_compare_to_block ) { this . scribe . unIndent ( ) ; } } else { if ( this . preferences . indent_statements_compare_to_block ) { this . scribe . indent ( ) ; } this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_AT_END_OF_BLOCK ) ; if ( this . preferences . indent_statements_compare_to_block ) { this . scribe . unIndent ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED . equals ( block_brace_position ) ) { this . scribe . unIndent ( ) ; } } private void formatCascadingMessageSends ( CascadingMethodInvocationFragmentBuilder builder , BlockScope scope ) { int size = builder . size ( ) ; MessageSend [ ] fragments = builder . fragments ( ) ; Expression fragment = fragments [ <NUM_LIT:0> ] . receiver ; int startingPositionInCascade = <NUM_LIT:1> ; if ( ! fragment . isImplicitThis ( ) ) { fragment . traverse ( this , scope ) ; } else { MessageSend currentMessageSend = fragments [ <NUM_LIT:1> ] ; final int numberOfParens = ( currentMessageSend . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( currentMessageSend , numberOfParens ) ; } ASTNode [ ] arguments = currentMessageSend . arguments ; TypeReference [ ] typeArguments = currentMessageSend . typeArguments ; if ( typeArguments != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_arguments ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_arguments ) ; if ( this . preferences . insert_space_after_comma_in_type_arguments ) { this . scribe . space ( ) ; } } typeArguments [ length - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_arguments ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_method_invocation ) ; if ( arguments != null ) { if ( this . preferences . insert_space_after_opening_paren_in_method_invocation ) { this . scribe . space ( ) ; } int argumentLength = arguments . length ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . MESSAGE_ARGUMENTS , this . preferences . alignment_for_arguments_in_method_invocation , Alignment . R_OUTERMOST , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean okForArguments = false ; do { try { for ( int j = <NUM_LIT:0> ; j < argumentLength ; j ++ ) { if ( j > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_method_invocation_arguments ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( argumentsAlignment , j ) ; if ( j > <NUM_LIT:0> && this . preferences . insert_space_after_comma_in_method_invocation_arguments ) { this . scribe . space ( ) ; } arguments [ j ] . traverse ( this , scope ) ; } okForArguments = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! okForArguments ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_method_invocation ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_method_invocation ) ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( currentMessageSend , numberOfParens ) ; } startingPositionInCascade = <NUM_LIT:2> ; } int tieBreakRule = this . preferences . wrap_outer_expressions_when_nested && size - startingPositionInCascade > <NUM_LIT:2> ? Alignment . R_OUTERMOST : Alignment . R_INNERMOST ; Alignment cascadingMessageSendAlignment = this . scribe . createAlignment ( Alignment . CASCADING_MESSAGE_SEND , this . preferences . alignment_for_selector_in_method_invocation , tieBreakRule , size , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( cascadingMessageSendAlignment ) ; boolean ok = false ; boolean setStartingColumn = true ; switch ( this . preferences . alignment_for_arguments_in_method_invocation & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_FIRST_BREAK_SPLIT : case Alignment . M_NEXT_SHIFTED_SPLIT : case Alignment . M_ONE_PER_LINE_SPLIT : setStartingColumn = false ; break ; } do { if ( setStartingColumn ) { cascadingMessageSendAlignment . startingColumn = this . scribe . column ; } try { this . scribe . alignFragment ( cascadingMessageSendAlignment , <NUM_LIT:0> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; for ( int i = startingPositionInCascade ; i < size ; i ++ ) { MessageSend currentMessageSend = fragments [ i ] ; final int numberOfParens = ( currentMessageSend . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( currentMessageSend , numberOfParens ) ; } TypeReference [ ] typeArguments = currentMessageSend . typeArguments ; if ( typeArguments != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_arguments ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } int length = typeArguments . length ; for ( int j = <NUM_LIT:0> ; j < length - <NUM_LIT:1> ; j ++ ) { typeArguments [ j ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_arguments ) ; if ( this . preferences . insert_space_after_comma_in_type_arguments ) { this . scribe . space ( ) ; } } typeArguments [ length - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_arguments ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } } ASTNode [ ] arguments = currentMessageSend . arguments ; this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_method_invocation ) ; if ( arguments != null ) { if ( this . preferences . insert_space_after_opening_paren_in_method_invocation ) { this . scribe . space ( ) ; } int argumentLength = arguments . length ; int alignmentMode = this . preferences . alignment_for_arguments_in_method_invocation ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . MESSAGE_ARGUMENTS , alignmentMode , Alignment . R_OUTERMOST , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean okForArguments = false ; do { switch ( alignmentMode & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : argumentsAlignment . startingColumn = this . scribe . column ; break ; } try { for ( int j = <NUM_LIT:0> ; j < argumentLength ; j ++ ) { if ( j > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_method_invocation_arguments ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( argumentsAlignment , j ) ; if ( j == <NUM_LIT:0> ) { int fragmentIndentation = argumentsAlignment . fragmentIndentations [ j ] ; if ( ( argumentsAlignment . mode & Alignment . M_INDENT_ON_COLUMN ) != <NUM_LIT:0> && fragmentIndentation > <NUM_LIT:0> ) { this . scribe . indentationLevel = fragmentIndentation ; } } else if ( this . preferences . insert_space_after_comma_in_method_invocation_arguments ) { this . scribe . space ( ) ; } arguments [ j ] . traverse ( this , scope ) ; argumentsAlignment . startingColumn = - <NUM_LIT:1> ; } okForArguments = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! okForArguments ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_method_invocation ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_method_invocation ) ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( currentMessageSend , numberOfParens ) ; } cascadingMessageSendAlignment . startingColumn = - <NUM_LIT:1> ; if ( i < size - <NUM_LIT:1> ) { this . scribe . alignFragment ( cascadingMessageSendAlignment , i ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; } } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( cascadingMessageSendAlignment , true ) ; } private void formatClassBodyDeclarations ( ASTNode [ ] nodes ) { final int FIELD = <NUM_LIT:1> , METHOD = <NUM_LIT:2> , TYPE = <NUM_LIT:3> ; this . scribe . lastNumberOfNewLines = <NUM_LIT:1> ; ASTNode [ ] mergedNodes = computeMergedMemberDeclarations ( nodes ) ; Alignment memberAlignment = this . scribe . createMemberAlignment ( Alignment . TYPE_MEMBERS , this . preferences . align_type_members_on_columns ? Alignment . M_MULTICOLUMN : Alignment . M_NO_ALIGNMENT , <NUM_LIT:4> , this . scribe . scanner . currentPosition ) ; this . scribe . enterMemberAlignment ( memberAlignment ) ; boolean isChunkStart = false ; boolean ok = false ; int startIndex = <NUM_LIT:0> ; do { try { for ( int i = startIndex , max = mergedNodes . length ; i < max ; i ++ ) { ASTNode member = mergedNodes [ i ] ; if ( member instanceof FieldDeclaration ) { isChunkStart = memberAlignment . checkChunkStart ( FIELD , i , this . scribe . scanner . currentPosition ) ; if ( member instanceof MultiFieldDeclaration ) { MultiFieldDeclaration multiField = ( MultiFieldDeclaration ) member ; format ( multiField , this , null , isChunkStart , i == <NUM_LIT:0> ) ; } else if ( member instanceof Initializer ) { int newLineBeforeChunk = isChunkStart ? this . preferences . blank_lines_before_new_chunk : <NUM_LIT:0> ; if ( newLineBeforeChunk > <NUM_LIT:0> && i != <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLineBeforeChunk ) ; } else if ( i == <NUM_LIT:0> ) { int newLinesBeforeFirstClassBodyDeclaration = this . preferences . blank_lines_before_first_class_body_declaration ; if ( newLinesBeforeFirstClassBodyDeclaration > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeFirstClassBodyDeclaration ) ; } } Initializer initializer = ( Initializer ) member ; initializer . traverse ( this , null ) ; } else { FieldDeclaration field = ( FieldDeclaration ) member ; format ( field , this , null , isChunkStart , i == <NUM_LIT:0> ) ; } } else if ( member instanceof AbstractMethodDeclaration ) { isChunkStart = memberAlignment . checkChunkStart ( METHOD , i , this . scribe . scanner . currentPosition ) ; format ( ( AbstractMethodDeclaration ) member , null , isChunkStart , i == <NUM_LIT:0> ) ; } else { isChunkStart = memberAlignment . checkChunkStart ( TYPE , i , this . scribe . scanner . currentPosition ) ; format ( ( TypeDeclaration ) member , null , isChunkStart , i == <NUM_LIT:0> ) ; } while ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } if ( i != max - <NUM_LIT:1> ) { this . scribe . printNewLine ( ) ; } } ok = true ; } catch ( AlignmentException e ) { startIndex = memberAlignment . chunkStartIndex ; this . scribe . redoMemberAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitMemberAlignment ( memberAlignment ) ; if ( hasComments ( ) ) { this . scribe . printNewLine ( ) ; } this . scribe . printComment ( ) ; } private void formatEmptyTypeDeclaration ( boolean isFirst ) { boolean hasSemiColon = isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ; while ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printComment ( ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } if ( hasSemiColon && isFirst ) { this . scribe . printNewLine ( ) ; } } private void formatGuardClauseBlock ( Block block , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACE , this . preferences . insert_space_before_opening_brace_in_block ) ; this . scribe . space ( ) ; final Statement [ ] statements = block . statements ; statements [ <NUM_LIT:0> ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE , true ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } private void formatLeftCurlyBrace ( final int line , final String bracePosition ) { this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_IN_FORMAT_LEFT_CURLY_BRACE ) ; if ( DefaultCodeFormatterConstants . NEXT_LINE_ON_WRAP . equals ( bracePosition ) && ( this . scribe . line > line || this . scribe . column >= this . preferences . page_width ) ) { this . scribe . printNewLine ( ) ; } } private void formatLocalDeclaration ( LocalDeclaration localDeclaration , BlockScope scope , boolean insertSpaceBeforeComma , boolean insertSpaceAfterComma ) { if ( ! isMultipleLocalDeclaration ( localDeclaration ) ) { if ( localDeclaration . modifiers != NO_MODIFIERS || localDeclaration . annotations != null ) { this . scribe . printComment ( ) ; this . scribe . printModifiers ( localDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_LOCAL_VARIABLE ) ; this . scribe . space ( ) ; } if ( localDeclaration . type != null ) { localDeclaration . type . traverse ( this , scope ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , false ) ; } int extraDimensions = getDimensions ( ) ; if ( extraDimensions != <NUM_LIT:0> ) { for ( int index = <NUM_LIT:0> ; index < extraDimensions ; index ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } final Expression initialization = localDeclaration . initialization ; if ( initialization != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameEQUAL , this . preferences . insert_space_before_assignment_operator ) ; if ( this . preferences . insert_space_after_assignment_operator ) { this . scribe . space ( ) ; } Alignment assignmentAlignment = this . scribe . createAlignment ( Alignment . LOCAL_DECLARATION_ASSIGNMENT , this . preferences . alignment_for_assignment , Alignment . R_OUTERMOST , <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( assignmentAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( assignmentAlignment , <NUM_LIT:0> ) ; initialization . traverse ( this , scope ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( assignmentAlignment , true ) ; } if ( isPartOfMultipleLocalDeclaration ( ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , insertSpaceBeforeComma ) ; if ( insertSpaceAfterComma ) { this . scribe . space ( ) ; } this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } private void formatMessageSend ( MessageSend messageSend , BlockScope scope , Alignment messageAlignment ) { if ( messageAlignment != null ) { if ( ! this . preferences . wrap_outer_expressions_when_nested || messageAlignment . canAlign ( ) ) { this . scribe . alignFragment ( messageAlignment , <NUM_LIT:0> ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; } TypeReference [ ] typeArguments = messageSend . typeArguments ; if ( typeArguments != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_arguments ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_arguments ) ; if ( this . preferences . insert_space_after_comma_in_type_arguments ) { this . scribe . space ( ) ; } } typeArguments [ length - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_arguments ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_method_invocation ) ; final Expression [ ] arguments = messageSend . arguments ; if ( arguments != null ) { if ( this . preferences . insert_space_after_opening_paren_in_method_invocation ) { this . scribe . space ( ) ; } int argumentsLength = arguments . length ; if ( argumentsLength > <NUM_LIT:1> ) { int alignmentMode = this . preferences . alignment_for_arguments_in_method_invocation ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . MESSAGE_ARGUMENTS , alignmentMode , argumentsLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { switch ( alignmentMode & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : argumentsAlignment . startingColumn = this . scribe . column ; break ; } try { for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_method_invocation_arguments ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( this . scribe . lastNumberOfNewLines == <NUM_LIT:1> ) { this . scribe . indentationLevel = argumentsAlignment . breakIndentationLevel ; } } this . scribe . alignFragment ( argumentsAlignment , i ) ; if ( i > <NUM_LIT:0> && this . preferences . insert_space_after_comma_in_method_invocation_arguments ) { this . scribe . space ( ) ; } int fragmentIndentation = <NUM_LIT:0> ; if ( i == <NUM_LIT:0> ) { int wrappedIndex = argumentsAlignment . wrappedIndex ( ) ; if ( wrappedIndex >= <NUM_LIT:0> ) { fragmentIndentation = argumentsAlignment . fragmentIndentations [ wrappedIndex ] ; if ( ( argumentsAlignment . mode & Alignment . M_INDENT_ON_COLUMN ) != <NUM_LIT:0> && fragmentIndentation > <NUM_LIT:0> ) { this . scribe . indentationLevel = fragmentIndentation ; } } } arguments [ i ] . traverse ( this , scope ) ; argumentsAlignment . startingColumn = - <NUM_LIT:1> ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; } else { arguments [ <NUM_LIT:0> ] . traverse ( this , scope ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_method_invocation ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_method_invocation ) ; } } private void formatTryResources ( TryStatement tryStatement , boolean spaceBeforeOpenParen , boolean spaceBeforeClosingParen , boolean spaceBeforeFirstResource , boolean spaceBeforeSemicolon , boolean spaceAfterSemicolon , int tryResourcesAligment ) { LocalDeclaration [ ] resources = tryStatement . resources ; int length = resources != null ? resources . length : <NUM_LIT:0> ; if ( length > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , spaceBeforeOpenParen ) ; if ( spaceBeforeFirstResource ) { this . scribe . space ( ) ; } Alignment resourcesAlignment = this . scribe . createAlignment ( Alignment . TRY_RESOURCES , tryResourcesAligment , Alignment . R_OUTERMOST , length , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( resourcesAlignment ) ; boolean ok = false ; do { switch ( tryResourcesAligment & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : resourcesAlignment . startingColumn = this . scribe . column ; break ; } try { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , spaceBeforeSemicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( this . scribe . lastNumberOfNewLines == <NUM_LIT:1> ) { this . scribe . indentationLevel = resourcesAlignment . breakIndentationLevel ; } } this . scribe . alignFragment ( resourcesAlignment , i ) ; if ( i == <NUM_LIT:0> ) { int fragmentIndentation = resourcesAlignment . fragmentIndentations [ <NUM_LIT:0> ] ; if ( ( resourcesAlignment . mode & Alignment . M_INDENT_ON_COLUMN ) != <NUM_LIT:0> && fragmentIndentation > <NUM_LIT:0> ) { this . scribe . indentationLevel = fragmentIndentation ; } } else if ( spaceAfterSemicolon ) { this . scribe . space ( ) ; } resources [ i ] . traverse ( this , null ) ; resourcesAlignment . startingColumn = - <NUM_LIT:1> ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( resourcesAlignment , true ) ; if ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , spaceBeforeSemicolon ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , spaceBeforeClosingParen ) ; } } private void formatMethodArguments ( AbstractMethodDeclaration methodDeclaration , boolean spaceBeforeOpenParen , boolean spaceBetweenEmptyParameters , boolean spaceBeforeClosingParen , boolean spaceBeforeFirstParameter , boolean spaceBeforeComma , boolean spaceAfterComma , int methodDeclarationParametersAlignment ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , spaceBeforeOpenParen ) ; final Argument [ ] arguments = methodDeclaration . arguments ; if ( arguments != null ) { if ( spaceBeforeFirstParameter ) { this . scribe . space ( ) ; } int argumentLength = arguments . length ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . METHOD_ARGUMENTS , methodDeclarationParametersAlignment , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { switch ( methodDeclarationParametersAlignment & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : argumentsAlignment . startingColumn = this . scribe . column ; break ; } try { for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , spaceBeforeComma ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( this . scribe . lastNumberOfNewLines == <NUM_LIT:1> ) { this . scribe . indentationLevel = argumentsAlignment . breakIndentationLevel ; } } this . scribe . alignFragment ( argumentsAlignment , i ) ; if ( i == <NUM_LIT:0> ) { int fragmentIndentation = argumentsAlignment . fragmentIndentations [ <NUM_LIT:0> ] ; if ( ( argumentsAlignment . mode & Alignment . M_INDENT_ON_COLUMN ) != <NUM_LIT:0> && fragmentIndentation > <NUM_LIT:0> ) { this . scribe . indentationLevel = fragmentIndentation ; } } else if ( spaceAfterComma ) { this . scribe . space ( ) ; } arguments [ i ] . traverse ( this , methodDeclaration . scope ) ; argumentsAlignment . startingColumn = - <NUM_LIT:1> ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , spaceBeforeClosingParen ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , spaceBetweenEmptyParameters ) ; } } private void formatEnumConstantArguments ( FieldDeclaration enumConstant , boolean spaceBeforeOpenParen , boolean spaceBetweenEmptyParameters , boolean spaceBeforeClosingParen , boolean spaceBeforeFirstParameter , boolean spaceBeforeComma , boolean spaceAfterComma , int methodDeclarationParametersAlignment ) { if ( ! isNextToken ( TerminalTokens . TokenNameLPAREN ) ) { return ; } this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , spaceBeforeOpenParen ) ; final Expression [ ] arguments = ( ( AllocationExpression ) enumConstant . initialization ) . arguments ; if ( arguments != null ) { int argumentLength = arguments . length ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . ENUM_CONSTANTS_ARGUMENTS , methodDeclarationParametersAlignment , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { try { if ( spaceBeforeFirstParameter ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , spaceBeforeComma ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( argumentsAlignment , i ) ; if ( i > <NUM_LIT:0> && spaceAfterComma ) { this . scribe . space ( ) ; } arguments [ i ] . traverse ( this , ( BlockScope ) null ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , spaceBeforeClosingParen ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , spaceBetweenEmptyParameters ) ; } } private void formatNecessaryEmptyStatement ( ) { if ( this . preferences . put_empty_statement_on_new_line ) { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . unIndent ( ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } private void formatOpeningBrace ( String bracePosition , boolean insertSpaceBeforeBrace ) { if ( DefaultCodeFormatterConstants . NEXT_LINE . equals ( bracePosition ) ) { this . scribe . printNewLine ( ) ; } else if ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED . equals ( bracePosition ) ) { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACE , insertSpaceBeforeBrace , Scribe . PRESERVE_EMPTY_LINES_IN_FORMAT_OPENING_BRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . UNMODIFIABLE_TRAILING_COMMENT ) ; } private void formatStatements ( BlockScope scope , final Statement [ ] statements , boolean insertNewLineAfterLastStatement ) { int statementsLength = statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) { final Statement statement = statements [ i ] ; if ( i > <NUM_LIT:0> && ( statements [ i - <NUM_LIT:1> ] instanceof EmptyStatement ) && ! ( statement instanceof EmptyStatement ) ) { this . scribe . printNewLine ( ) ; } statement . traverse ( this , scope ) ; if ( statement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( i != statementsLength - <NUM_LIT:1> ) { if ( ! ( statement instanceof EmptyStatement ) && ! ( statements [ i + <NUM_LIT:1> ] instanceof EmptyStatement ) ) { this . scribe . printNewLine ( ) ; } } else if ( i == statementsLength - <NUM_LIT:1> && insertNewLineAfterLastStatement ) { this . scribe . printNewLine ( ) ; } } else if ( statement instanceof LocalDeclaration ) { LocalDeclaration currentLocal = ( LocalDeclaration ) statement ; if ( i < ( statementsLength - <NUM_LIT:1> ) ) { if ( statements [ i + <NUM_LIT:1> ] instanceof LocalDeclaration ) { LocalDeclaration nextLocal = ( LocalDeclaration ) statements [ i + <NUM_LIT:1> ] ; if ( currentLocal . declarationSourceStart != nextLocal . declarationSourceStart ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( i != statementsLength - <NUM_LIT:1> ) { if ( ! ( statement instanceof EmptyStatement ) && ! ( statements [ i + <NUM_LIT:1> ] instanceof EmptyStatement ) ) { this . scribe . printNewLine ( ) ; } } else if ( i == statementsLength - <NUM_LIT:1> && insertNewLineAfterLastStatement ) { this . scribe . printNewLine ( ) ; } } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( i != statementsLength - <NUM_LIT:1> ) { if ( ! ( statement instanceof EmptyStatement ) && ! ( statements [ i + <NUM_LIT:1> ] instanceof EmptyStatement ) ) { this . scribe . printNewLine ( ) ; } } else if ( i == statementsLength - <NUM_LIT:1> && insertNewLineAfterLastStatement ) { this . scribe . printNewLine ( ) ; } } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( i != statementsLength - <NUM_LIT:1> ) { if ( ! ( statement instanceof EmptyStatement ) && ! ( statements [ i + <NUM_LIT:1> ] instanceof EmptyStatement ) ) { this . scribe . printNewLine ( ) ; } } else if ( i == statementsLength - <NUM_LIT:1> && insertNewLineAfterLastStatement ) { this . scribe . printNewLine ( ) ; } } } else if ( i != statementsLength - <NUM_LIT:1> ) { if ( ! ( statement instanceof EmptyStatement ) && ! ( statements [ i + <NUM_LIT:1> ] instanceof EmptyStatement ) ) { this . scribe . printNewLine ( ) ; } } else if ( i == statementsLength - <NUM_LIT:1> && insertNewLineAfterLastStatement ) { this . scribe . printNewLine ( ) ; } } } private void formatThrowsClause ( AbstractMethodDeclaration methodDeclaration , boolean spaceBeforeComma , boolean spaceAfterComma , int alignmentForThrowsClause ) { final TypeReference [ ] thrownExceptions = methodDeclaration . thrownExceptions ; if ( thrownExceptions != null ) { int thrownExceptionsLength = thrownExceptions . length ; Alignment throwsAlignment = this . scribe . createAlignment ( Alignment . THROWS , alignmentForThrowsClause , thrownExceptionsLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( throwsAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( throwsAlignment , <NUM_LIT:0> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNamethrows , true ) ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , spaceBeforeComma ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . alignFragment ( throwsAlignment , i ) ; if ( spaceAfterComma ) { this . scribe . space ( ) ; } } else { this . scribe . space ( ) ; } thrownExceptions [ i ] . traverse ( this , methodDeclaration . scope ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( throwsAlignment , true ) ; } } private void formatTypeMembers ( TypeDeclaration typeDeclaration ) { Alignment memberAlignment = this . scribe . createMemberAlignment ( Alignment . TYPE_MEMBERS , this . preferences . align_type_members_on_columns ? Alignment . M_MULTICOLUMN : Alignment . M_NO_ALIGNMENT , <NUM_LIT:3> , this . scribe . scanner . currentPosition ) ; this . scribe . enterMemberAlignment ( memberAlignment ) ; ASTNode [ ] members = computeMergedMemberDeclarations ( typeDeclaration ) ; boolean isChunkStart = false ; boolean ok = false ; int membersLength = members . length ; if ( membersLength > <NUM_LIT:0> ) { int startIndex = <NUM_LIT:0> ; do { try { for ( int i = startIndex , max = members . length ; i < max ; i ++ ) { while ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . printNewLine ( ) ; ASTNode member = members [ i ] ; if ( member instanceof FieldDeclaration ) { isChunkStart = memberAlignment . checkChunkStart ( Alignment . CHUNK_FIELD , i , this . scribe . scanner . currentPosition ) ; if ( member instanceof MultiFieldDeclaration ) { MultiFieldDeclaration multiField = ( MultiFieldDeclaration ) member ; if ( multiField . isStatic ( ) ) { format ( multiField , this , typeDeclaration . staticInitializerScope , isChunkStart , i == <NUM_LIT:0> ) ; } else { format ( multiField , this , typeDeclaration . initializerScope , isChunkStart , i == <NUM_LIT:0> ) ; } } else if ( member instanceof Initializer ) { int newLineBeforeChunk = isChunkStart ? this . preferences . blank_lines_before_new_chunk : <NUM_LIT:0> ; if ( newLineBeforeChunk > <NUM_LIT:0> && i != <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLineBeforeChunk ) ; } else if ( i == <NUM_LIT:0> ) { int newLinesBeforeFirstClassBodyDeclaration = this . preferences . blank_lines_before_first_class_body_declaration ; if ( newLinesBeforeFirstClassBodyDeclaration > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( newLinesBeforeFirstClassBodyDeclaration ) ; } } Initializer initializer = ( Initializer ) member ; if ( initializer . isStatic ( ) ) { initializer . traverse ( this , typeDeclaration . staticInitializerScope ) ; } else { initializer . traverse ( this , typeDeclaration . initializerScope ) ; } } else { FieldDeclaration field = ( FieldDeclaration ) member ; if ( field . isStatic ( ) ) { format ( field , this , typeDeclaration . staticInitializerScope , isChunkStart , i == <NUM_LIT:0> ) ; } else { format ( field , this , typeDeclaration . initializerScope , isChunkStart , i == <NUM_LIT:0> ) ; } } } else if ( member instanceof AbstractMethodDeclaration ) { isChunkStart = memberAlignment . checkChunkStart ( Alignment . CHUNK_METHOD , i , this . scribe . scanner . currentPosition ) ; format ( ( AbstractMethodDeclaration ) member , typeDeclaration . scope , isChunkStart , i == <NUM_LIT:0> ) ; } else if ( member instanceof TypeDeclaration ) { isChunkStart = memberAlignment . checkChunkStart ( Alignment . CHUNK_TYPE , i , this . scribe . scanner . currentPosition ) ; format ( ( TypeDeclaration ) member , typeDeclaration . scope , isChunkStart , i == <NUM_LIT:0> ) ; } while ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . printNewLine ( ) ; if ( this . scribe . memberAlignment != null ) { this . scribe . indentationLevel = this . scribe . memberAlignment . originalIndentationLevel ; } } ok = true ; } catch ( AlignmentException e ) { startIndex = memberAlignment . chunkStartIndex ; this . scribe . redoMemberAlignment ( e ) ; } } while ( ! ok ) ; } else if ( isNextToken ( TerminalTokens . TokenNameSEMICOLON ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . printComment ( Scribe . DO_NOT_PRESERVE_EMPTY_LINES ) ; this . scribe . exitMemberAlignment ( memberAlignment ) ; } private void formatTypeOpeningBraceForEnumConstant ( String bracePosition , boolean insertSpaceBeforeBrace , TypeDeclaration typeDeclaration ) { int fieldCount = ( typeDeclaration . fields == null ) ? <NUM_LIT:0> : typeDeclaration . fields . length ; int methodCount = ( typeDeclaration . methods == null ) ? <NUM_LIT:0> : typeDeclaration . methods . length ; int typeCount = ( typeDeclaration . memberTypes == null ) ? <NUM_LIT:0> : typeDeclaration . memberTypes . length ; if ( methodCount <= <NUM_LIT:2> ) { for ( int i = <NUM_LIT:0> , max = methodCount ; i < max ; i ++ ) { final AbstractMethodDeclaration abstractMethodDeclaration = typeDeclaration . methods [ i ] ; if ( abstractMethodDeclaration . isDefaultConstructor ( ) ) { methodCount -- ; } else if ( abstractMethodDeclaration . isClinit ( ) ) { methodCount -- ; } } } final int memberLength = fieldCount + methodCount + typeCount ; boolean insertNewLine = memberLength > <NUM_LIT:0> ; if ( ! insertNewLine ) { if ( ( typeDeclaration . bits & ASTNode . IsAnonymousType ) != <NUM_LIT:0> ) { insertNewLine = this . preferences . insert_new_line_in_empty_enum_constant ; } } formatOpeningBrace ( bracePosition , insertSpaceBeforeBrace ) ; if ( insertNewLine ) { this . scribe . printNewLine ( ) ; } } private void formatTypeOpeningBrace ( String bracePosition , boolean insertSpaceBeforeBrace , TypeDeclaration typeDeclaration ) { int fieldCount = ( typeDeclaration . fields == null ) ? <NUM_LIT:0> : typeDeclaration . fields . length ; int methodCount = ( typeDeclaration . methods == null ) ? <NUM_LIT:0> : typeDeclaration . methods . length ; int typeCount = ( typeDeclaration . memberTypes == null ) ? <NUM_LIT:0> : typeDeclaration . memberTypes . length ; if ( methodCount <= <NUM_LIT:2> ) { for ( int i = <NUM_LIT:0> , max = methodCount ; i < max ; i ++ ) { final AbstractMethodDeclaration abstractMethodDeclaration = typeDeclaration . methods [ i ] ; if ( abstractMethodDeclaration . isDefaultConstructor ( ) ) { methodCount -- ; } else if ( abstractMethodDeclaration . isClinit ( ) ) { methodCount -- ; } } } final int memberLength = fieldCount + methodCount + typeCount ; boolean insertNewLine = memberLength > <NUM_LIT:0> ; if ( ! insertNewLine ) { if ( TypeDeclaration . kind ( typeDeclaration . modifiers ) == TypeDeclaration . ENUM_DECL ) { insertNewLine = this . preferences . insert_new_line_in_empty_enum_declaration ; } else if ( ( typeDeclaration . bits & ASTNode . IsAnonymousType ) != <NUM_LIT:0> ) { insertNewLine = this . preferences . insert_new_line_in_empty_anonymous_type_declaration ; } else if ( TypeDeclaration . kind ( typeDeclaration . modifiers ) == TypeDeclaration . ANNOTATION_TYPE_DECL ) { insertNewLine = this . preferences . insert_new_line_in_empty_annotation_declaration ; } else { insertNewLine = this . preferences . insert_new_line_in_empty_type_declaration ; } } formatOpeningBrace ( bracePosition , insertSpaceBeforeBrace ) ; if ( insertNewLine ) { this . scribe . printNewLine ( ) ; } } private int getDimensions ( ) { this . localScanner . resetTo ( this . scribe . scanner . currentPosition , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; int dimensions = <NUM_LIT:0> ; int balance = <NUM_LIT:0> ; try { int token ; loop : while ( ( token = this . localScanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameRBRACKET : dimensions ++ ; balance -- ; break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : break ; case TerminalTokens . TokenNameLBRACKET : balance ++ ; break ; default : break loop ; } } } catch ( InvalidInputException e ) { } if ( balance == <NUM_LIT:0> ) { return dimensions ; } return <NUM_LIT:0> ; } private boolean hasComments ( ) { this . localScanner . resetTo ( this . scribe . scanner . startPosition , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; try { switch ( this . localScanner . getNextToken ( ) ) { case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : return true ; } } catch ( InvalidInputException e ) { } return false ; } private boolean isNextToken ( int tokenName ) { this . localScanner . resetTo ( this . scribe . scanner . currentPosition , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; try { int token = this . localScanner . getNextToken ( ) ; loop : while ( true ) { switch ( token ) { case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : token = this . localScanner . getNextToken ( ) ; continue loop ; default : break loop ; } } return token == tokenName ; } catch ( InvalidInputException e ) { } return false ; } private boolean isClosingGenericToken ( ) { this . localScanner . resetTo ( this . scribe . scanner . currentPosition , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; try { int token = this . localScanner . getNextToken ( ) ; loop : while ( true ) { switch ( token ) { case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : token = this . localScanner . getNextToken ( ) ; continue loop ; default : break loop ; } } switch ( token ) { case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : return true ; } } catch ( InvalidInputException e ) { } return false ; } private boolean isGuardClause ( Block block ) { return ! commentStartsBlock ( block . sourceStart , block . sourceEnd ) && block . statements != null && block . statements . length == <NUM_LIT:1> && ( block . statements [ <NUM_LIT:0> ] instanceof ReturnStatement || block . statements [ <NUM_LIT:0> ] instanceof ThrowStatement ) ; } private boolean isMultipleLocalDeclaration ( LocalDeclaration localDeclaration ) { if ( localDeclaration . declarationSourceStart == this . lastLocalDeclarationSourceStart ) return true ; this . lastLocalDeclarationSourceStart = localDeclaration . declarationSourceStart ; return false ; } private boolean isPartOfMultipleLocalDeclaration ( ) { this . localScanner . resetTo ( this . scribe . scanner . currentPosition , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; try { int token ; while ( ( token = this . localScanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameCOMMA : return true ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : break ; default : return false ; } } } catch ( InvalidInputException e ) { } return false ; } private void manageClosingParenthesizedExpression ( Expression expression , int numberOfParens ) { for ( int i = <NUM_LIT:0> ; i < numberOfParens ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_parenthesized_expression ) ; } } private void manageOpeningParenthesizedExpression ( Expression expression , int numberOfParens ) { for ( int i = <NUM_LIT:0> ; i < numberOfParens ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_parenthesized_expression ) ; if ( this . preferences . insert_space_after_opening_paren_in_parenthesized_expression ) { this . scribe . space ( ) ; } } } private void printComment ( ) { this . localScanner . resetTo ( this . scribe . scanner . startPosition , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; try { int token = this . localScanner . getNextToken ( ) ; switch ( token ) { case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_LINE : this . scribe . printComment ( token , Scribe . NO_TRAILING_COMMENT ) ; break ; } } catch ( InvalidInputException e ) { } } public boolean visit ( AllocationExpression allocationExpression , BlockScope scope ) { final int numberOfParens = ( allocationExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( allocationExpression , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamenew ) ; TypeReference [ ] typeArguments = allocationExpression . typeArguments ; if ( typeArguments != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_arguments ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_arguments ) ; if ( this . preferences . insert_space_after_comma_in_type_arguments ) { this . scribe . space ( ) ; } } typeArguments [ length - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_arguments ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } } else { this . scribe . space ( ) ; } allocationExpression . type . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_method_invocation ) ; final Expression [ ] arguments = allocationExpression . arguments ; if ( arguments != null ) { if ( this . preferences . insert_space_after_opening_paren_in_method_invocation ) { this . scribe . space ( ) ; } int argumentLength = arguments . length ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . ALLOCATION , this . preferences . alignment_for_arguments_in_allocation_expression , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_allocation_expression ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( argumentsAlignment , i ) ; if ( i > <NUM_LIT:0> && this . preferences . insert_space_after_comma_in_allocation_expression ) { this . scribe . space ( ) ; } arguments [ i ] . traverse ( this , scope ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_method_invocation ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_method_invocation ) ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( allocationExpression , numberOfParens ) ; } return false ; } public boolean visit ( AND_AND_Expression and_and_Expression , BlockScope scope ) { return dumpBinaryExpression ( and_and_Expression , TerminalTokens . TokenNameAND_AND , scope ) ; } public boolean visit ( AnnotationMethodDeclaration annotationTypeMemberDeclaration , ClassScope scope ) { this . scribe . printComment ( ) ; this . scribe . printModifiers ( annotationTypeMemberDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_METHOD ) ; this . scribe . space ( ) ; final TypeReference returnType = annotationTypeMemberDeclaration . returnType ; final MethodScope annotationTypeMemberDeclarationScope = annotationTypeMemberDeclaration . scope ; if ( returnType != null ) { returnType . traverse ( this , annotationTypeMemberDeclarationScope ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_annotation_type_member_declaration ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_annotation_type_member_declaration ) ; int extraDimensions = annotationTypeMemberDeclaration . extendedDimensions ; if ( extraDimensions != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < extraDimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } Expression defaultValue = annotationTypeMemberDeclaration . defaultValue ; if ( defaultValue != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNamedefault , true ) ; this . scribe . space ( ) ; defaultValue . traverse ( this , ( BlockScope ) null ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( Argument argument , BlockScope scope ) { if ( argument . modifiers != NO_MODIFIERS || argument . annotations != null ) { this . scribe . printComment ( ) ; this . scribe . printModifiers ( argument . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_PARAMETER ) ; this . scribe . space ( ) ; } if ( argument . type != null ) { if ( argument . type instanceof UnionTypeReference ) { formatMultiCatchArguments ( argument , this . preferences . insert_space_before_binary_operator , this . preferences . insert_space_after_binary_operator , this . preferences . alignment_for_union_type_in_multicatch , scope ) ; } else { argument . type . traverse ( this , scope ) ; } } if ( argument . isVarArgs ( ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameELLIPSIS , this . preferences . insert_space_before_ellipsis ) ; if ( this . preferences . insert_space_after_ellipsis ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , false ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; } int extraDimensions = getDimensions ( ) ; if ( extraDimensions != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < extraDimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } return false ; } public boolean visit ( ArrayAllocationExpression arrayAllocationExpression , BlockScope scope ) { final int numberOfParens = ( arrayAllocationExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayAllocationExpression , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamenew ) ; this . scribe . space ( ) ; arrayAllocationExpression . type . traverse ( this , scope ) ; final Expression [ ] dimensions = arrayAllocationExpression . dimensions ; int dimensionsLength = dimensions . length ; for ( int i = <NUM_LIT:0> ; i < dimensionsLength ; i ++ ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_allocation_expression ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET , false ) ; if ( dimensions [ i ] != null ) { if ( this . preferences . insert_space_after_opening_bracket_in_array_allocation_expression ) { this . scribe . space ( ) ; } dimensions [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET , this . preferences . insert_space_before_closing_bracket_in_array_allocation_expression ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET , this . preferences . insert_space_between_empty_brackets_in_array_allocation_expression ) ; } } final ArrayInitializer initializer = arrayAllocationExpression . initializer ; if ( initializer != null ) { initializer . traverse ( this , scope ) ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayAllocationExpression , numberOfParens ) ; } return false ; } public boolean visit ( ArrayInitializer arrayInitializer , BlockScope scope ) { final int numberOfParens = ( arrayInitializer . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayInitializer , numberOfParens ) ; } if ( this . arrayInitializersDepth < <NUM_LIT:0> ) { this . arrayInitializersDepth = <NUM_LIT:0> ; } else { this . arrayInitializersDepth ++ ; } int arrayInitializerIndentationLevel = this . scribe . indentationLevel ; try { final Expression [ ] expressions = arrayInitializer . expressions ; if ( expressions != null ) { String array_initializer_brace_position = this . preferences . brace_position_for_array_initializer ; formatOpeningBrace ( array_initializer_brace_position , this . preferences . insert_space_before_opening_brace_in_array_initializer ) ; int expressionsLength = expressions . length ; final boolean insert_new_line_after_opening_brace = this . preferences . insert_new_line_after_opening_brace_in_array_initializer ; boolean ok = false ; Alignment arrayInitializerAlignment = null ; if ( expressionsLength > <NUM_LIT:1> ) { if ( insert_new_line_after_opening_brace ) { this . scribe . printNewLine ( ) ; } arrayInitializerAlignment = this . scribe . createAlignment ( Alignment . ARRAY_INITIALIZER , this . preferences . alignment_for_expressions_in_array_initializer , Alignment . R_OUTERMOST , expressionsLength , this . scribe . scanner . currentPosition , this . preferences . continuation_indentation_for_array_initializer , true ) ; if ( insert_new_line_after_opening_brace ) { arrayInitializerAlignment . fragmentIndentations [ <NUM_LIT:0> ] = arrayInitializerAlignment . breakIndentationLevel ; } this . scribe . enterAlignment ( arrayInitializerAlignment ) ; do { try { this . scribe . alignFragment ( arrayInitializerAlignment , <NUM_LIT:0> ) ; if ( this . preferences . insert_space_after_opening_brace_in_array_initializer ) { this . scribe . space ( ) ; } expressions [ <NUM_LIT:0> ] . traverse ( this , scope ) ; for ( int i = <NUM_LIT:1> ; i < expressionsLength ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_array_initializer ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . alignFragment ( arrayInitializerAlignment , i ) ; if ( this . preferences . insert_space_after_comma_in_array_initializer ) { this . scribe . space ( ) ; } expressions [ i ] . traverse ( this , scope ) ; if ( i == expressionsLength - <NUM_LIT:1> ) { if ( isNextToken ( TerminalTokens . TokenNameCOMMA ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_array_initializer ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( arrayInitializerAlignment , true ) ; } else { if ( this . scribe . currentAlignment == null || this . scribe . currentAlignment . kind != Alignment . MESSAGE_ARGUMENTS ) { arrayInitializerAlignment = this . scribe . createAlignment ( Alignment . ARRAY_INITIALIZER , this . preferences . alignment_for_expressions_in_array_initializer , Alignment . R_OUTERMOST , <NUM_LIT:0> , this . scribe . scanner . currentPosition , this . preferences . continuation_indentation_for_array_initializer , true ) ; this . scribe . enterAlignment ( arrayInitializerAlignment ) ; } do { try { if ( insert_new_line_after_opening_brace ) { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; } if ( this . preferences . insert_space_after_opening_brace_in_array_initializer ) { this . scribe . space ( ) ; } else { this . scribe . needSpace = false ; } expressions [ <NUM_LIT:0> ] . traverse ( this , scope ) ; if ( isNextToken ( TerminalTokens . TokenNameCOMMA ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_array_initializer ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } if ( insert_new_line_after_opening_brace ) { this . scribe . unIndent ( ) ; } ok = true ; } catch ( AlignmentException e ) { if ( arrayInitializerAlignment == null ) throw e ; this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; if ( arrayInitializerAlignment != null ) { this . scribe . exitAlignment ( arrayInitializerAlignment , true ) ; } } if ( this . preferences . insert_new_line_before_closing_brace_in_array_initializer ) { this . scribe . printNewLine ( ) ; } else if ( this . preferences . insert_space_before_closing_brace_in_array_initializer ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE , false , Scribe . PRESERVE_EMPTY_LINES_IN_CLOSING_ARRAY_INITIALIZER + ( arrayInitializerIndentationLevel << <NUM_LIT:16> ) ) ; if ( array_initializer_brace_position . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } } else { boolean keepEmptyArrayInitializerOnTheSameLine = this . preferences . keep_empty_array_initializer_on_one_line ; String array_initializer_brace_position = this . preferences . brace_position_for_array_initializer ; if ( keepEmptyArrayInitializerOnTheSameLine ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACE , this . preferences . insert_space_before_opening_brace_in_array_initializer ) ; if ( isNextToken ( TerminalTokens . TokenNameCOMMA ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_array_initializer ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE , this . preferences . insert_space_between_empty_braces_in_array_initializer ) ; } else { formatOpeningBrace ( array_initializer_brace_position , this . preferences . insert_space_before_opening_brace_in_array_initializer ) ; if ( isNextToken ( TerminalTokens . TokenNameCOMMA ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_array_initializer ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE , this . preferences . insert_space_between_empty_braces_in_array_initializer ) ; if ( array_initializer_brace_position . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } } } } finally { this . arrayInitializersDepth -- ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayInitializer , numberOfParens ) ; } return false ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , BlockScope scope ) { final int numberOfParens = ( arrayQualifiedTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayQualifiedTypeReference , numberOfParens ) ; } this . scribe . printArrayQualifiedReference ( arrayQualifiedTypeReference . tokens . length , arrayQualifiedTypeReference . sourceEnd ) ; int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayQualifiedTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , ClassScope scope ) { final int numberOfParens = ( arrayQualifiedTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayQualifiedTypeReference , numberOfParens ) ; } this . scribe . printArrayQualifiedReference ( arrayQualifiedTypeReference . tokens . length , arrayQualifiedTypeReference . sourceEnd ) ; int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayQualifiedTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ArrayReference arrayReference , BlockScope scope ) { final int numberOfParens = ( arrayReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayReference , numberOfParens ) ; } arrayReference . receiver . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET , this . preferences . insert_space_before_opening_bracket_in_array_reference ) ; if ( this . preferences . insert_space_after_opening_bracket_in_array_reference ) { this . scribe . space ( ) ; } arrayReference . position . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET , this . preferences . insert_space_before_closing_bracket_in_array_reference ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayReference , numberOfParens ) ; } return false ; } public boolean visit ( ArrayTypeReference arrayTypeReference , BlockScope scope ) { final int numberOfParens = ( arrayTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayTypeReference , numberOfParens ) ; } this . scribe . printNextToken ( SINGLETYPEREFERENCE_EXPECTEDTOKENS ) ; int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; if ( this . preferences . insert_space_between_brackets_in_array_type_reference ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ArrayTypeReference arrayTypeReference , ClassScope scope ) { final int numberOfParens = ( arrayTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( arrayTypeReference , numberOfParens ) ; } this . scribe . printNextToken ( SINGLETYPEREFERENCE_EXPECTEDTOKENS ) ; int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; if ( this . preferences . insert_space_between_brackets_in_array_type_reference ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( arrayTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( AssertStatement assertStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameassert ) ; this . scribe . space ( ) ; assertStatement . assertExpression . traverse ( this , scope ) ; if ( assertStatement . exceptionArgument != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOLON , this . preferences . insert_space_before_colon_in_assert ) ; if ( this . preferences . insert_space_after_colon_in_assert ) { this . scribe . space ( ) ; } assertStatement . exceptionArgument . traverse ( this , scope ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( Assignment assignment , BlockScope scope ) { final int numberOfParens = ( assignment . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( assignment , numberOfParens ) ; } assignment . lhs . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameEQUAL , this . preferences . insert_space_before_assignment_operator ) ; if ( this . preferences . insert_space_after_assignment_operator ) { this . scribe . space ( ) ; } Alignment assignmentAlignment = this . scribe . createAlignment ( Alignment . ASSIGNMENT , this . preferences . alignment_for_assignment , Alignment . R_OUTERMOST , <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( assignmentAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( assignmentAlignment , <NUM_LIT:0> ) ; assignment . expression . traverse ( this , scope ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( assignmentAlignment , true ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( assignment , numberOfParens ) ; } return false ; } public boolean visit ( BinaryExpression binaryExpression , BlockScope scope ) { switch ( ( binaryExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT ) { case OperatorIds . AND : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameAND , scope ) ; case OperatorIds . DIVIDE : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameDIVIDE , scope ) ; case OperatorIds . GREATER : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameGREATER , scope ) ; case OperatorIds . GREATER_EQUAL : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameGREATER_EQUAL , scope ) ; case OperatorIds . LEFT_SHIFT : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameLEFT_SHIFT , scope ) ; case OperatorIds . LESS : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameLESS , scope ) ; case OperatorIds . LESS_EQUAL : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameLESS_EQUAL , scope ) ; case OperatorIds . MINUS : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameMINUS , scope ) ; case OperatorIds . MULTIPLY : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameMULTIPLY , scope ) ; case OperatorIds . OR : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameOR , scope ) ; case OperatorIds . PLUS : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNamePLUS , scope ) ; case OperatorIds . REMAINDER : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameREMAINDER , scope ) ; case OperatorIds . RIGHT_SHIFT : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameRIGHT_SHIFT , scope ) ; case OperatorIds . UNSIGNED_RIGHT_SHIFT : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT , scope ) ; case OperatorIds . XOR : return dumpBinaryExpression ( binaryExpression , TerminalTokens . TokenNameXOR , scope ) ; default : throw new IllegalStateException ( ) ; } } public boolean visit ( Block block , BlockScope scope ) { formatBlock ( block , scope , this . preferences . brace_position_for_block , this . preferences . insert_space_before_opening_brace_in_block ) ; return false ; } public boolean visit ( BreakStatement breakStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamebreak ) ; if ( breakStatement . label != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( CaseStatement caseStatement , BlockScope scope ) { if ( caseStatement . constantExpression == null ) { this . scribe . printNextToken ( TerminalTokens . TokenNamedefault ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOLON , this . preferences . insert_space_before_colon_in_default ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNamecase ) ; this . scribe . space ( ) ; caseStatement . constantExpression . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOLON , this . preferences . insert_space_before_colon_in_case ) ; } return false ; } public boolean visit ( CastExpression castExpression , BlockScope scope ) { final int numberOfParens = ( castExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( castExpression , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN ) ; if ( this . preferences . insert_space_after_opening_paren_in_cast ) { this . scribe . space ( ) ; } castExpression . type . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_cast ) ; if ( this . preferences . insert_space_after_closing_paren_in_cast ) { this . scribe . space ( ) ; } castExpression . expression . traverse ( this , scope ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( castExpression , numberOfParens ) ; } return false ; } public boolean visit ( CharLiteral charLiteral , BlockScope scope ) { final int numberOfParens = ( charLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( charLiteral , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameCharacterLiteral ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( charLiteral , numberOfParens ) ; } return false ; } public boolean visit ( ClassLiteralAccess classLiteral , BlockScope scope ) { final int numberOfParens = ( classLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( classLiteral , numberOfParens ) ; } classLiteral . type . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameclass ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( classLiteral , numberOfParens ) ; } return false ; } public boolean visit ( Clinit clinit , ClassScope scope ) { return false ; } public boolean visit ( CompilationUnitDeclaration compilationUnitDeclaration , CompilationUnitScope scope ) { this . scribe . lastNumberOfNewLines = <NUM_LIT:1> ; final TypeDeclaration [ ] types = compilationUnitDeclaration . types ; int headerEndPosition = types == null ? compilationUnitDeclaration . sourceEnd : types [ <NUM_LIT:0> ] . declarationSourceStart ; this . scribe . setHeaderComment ( headerEndPosition ) ; ImportReference currentPackage = compilationUnitDeclaration . currentPackage ; final boolean hasPackage = currentPackage != null ; if ( hasPackage ) { printComment ( ) ; int blankLinesBeforePackage = this . preferences . blank_lines_before_package ; if ( blankLinesBeforePackage > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( blankLinesBeforePackage ) ; } this . scribe . printModifiers ( currentPackage . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_PACKAGE ) ; this . scribe . space ( ) ; this . scribe . printNextToken ( TerminalTokens . TokenNamepackage ) ; this . scribe . space ( ) ; this . scribe . printQualifiedReference ( compilationUnitDeclaration . currentPackage . sourceEnd , false ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; int blankLinesAfterPackage = this . preferences . blank_lines_after_package ; if ( blankLinesAfterPackage > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( blankLinesAfterPackage ) ; } else { this . scribe . printNewLine ( ) ; } } else { this . scribe . printComment ( ) ; } final ImportReference [ ] imports = compilationUnitDeclaration . imports ; if ( imports != null ) { if ( hasPackage ) { int blankLinesBeforeImports = this . preferences . blank_lines_before_imports ; if ( blankLinesBeforeImports > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( blankLinesBeforeImports ) ; } } int importLength = imports . length ; if ( importLength != <NUM_LIT:1> ) { format ( imports [ <NUM_LIT:0> ] , false ) ; for ( int i = <NUM_LIT:1> ; i < importLength - <NUM_LIT:1> ; i ++ ) { format ( imports [ i ] , false ) ; } format ( imports [ importLength - <NUM_LIT:1> ] , true ) ; } else { format ( imports [ <NUM_LIT:0> ] , true ) ; } int blankLinesAfterImports = this . preferences . blank_lines_after_imports ; if ( blankLinesAfterImports > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( blankLinesAfterImports ) ; } } formatEmptyTypeDeclaration ( true ) ; int blankLineBetweenTypeDeclarations = this . preferences . blank_lines_between_type_declarations ; if ( types != null ) { int typesLength = types . length ; for ( int i = <NUM_LIT:0> ; i < typesLength - <NUM_LIT:1> ; i ++ ) { types [ i ] . traverse ( this , scope ) ; formatEmptyTypeDeclaration ( false ) ; if ( blankLineBetweenTypeDeclarations != <NUM_LIT:0> ) { this . scribe . printEmptyLines ( blankLineBetweenTypeDeclarations ) ; } else { this . scribe . printNewLine ( ) ; } } types [ typesLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; } this . scribe . printEndOfCompilationUnit ( ) ; return false ; } public boolean visit ( CompoundAssignment compoundAssignment , BlockScope scope ) { final int numberOfParens = ( compoundAssignment . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( compoundAssignment , numberOfParens ) ; } compoundAssignment . lhs . traverse ( this , scope ) ; int operator ; switch ( compoundAssignment . operator ) { case OperatorIds . PLUS : operator = TerminalTokens . TokenNamePLUS_EQUAL ; break ; case OperatorIds . MINUS : operator = TerminalTokens . TokenNameMINUS_EQUAL ; break ; case OperatorIds . MULTIPLY : operator = TerminalTokens . TokenNameMULTIPLY_EQUAL ; break ; case OperatorIds . DIVIDE : operator = TerminalTokens . TokenNameDIVIDE_EQUAL ; break ; case OperatorIds . AND : operator = TerminalTokens . TokenNameAND_EQUAL ; break ; case OperatorIds . OR : operator = TerminalTokens . TokenNameOR_EQUAL ; break ; case OperatorIds . XOR : operator = TerminalTokens . TokenNameXOR_EQUAL ; break ; case OperatorIds . REMAINDER : operator = TerminalTokens . TokenNameREMAINDER_EQUAL ; break ; case OperatorIds . LEFT_SHIFT : operator = TerminalTokens . TokenNameLEFT_SHIFT_EQUAL ; break ; case OperatorIds . RIGHT_SHIFT : operator = TerminalTokens . TokenNameRIGHT_SHIFT_EQUAL ; break ; default : operator = TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL ; } this . scribe . printNextToken ( operator , this . preferences . insert_space_before_assignment_operator ) ; if ( this . preferences . insert_space_after_assignment_operator ) { this . scribe . space ( ) ; } Alignment assignmentAlignment = this . scribe . createAlignment ( Alignment . COMPOUND_ASSIGNMENT , this . preferences . alignment_for_assignment , Alignment . R_OUTERMOST , <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( assignmentAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( assignmentAlignment , <NUM_LIT:0> ) ; compoundAssignment . expression . traverse ( this , scope ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( assignmentAlignment , true ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( compoundAssignment , numberOfParens ) ; } return false ; } public boolean visit ( ConditionalExpression conditionalExpression , BlockScope scope ) { final int numberOfParens = ( conditionalExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( conditionalExpression , numberOfParens ) ; } conditionalExpression . condition . traverse ( this , scope ) ; Alignment conditionalExpressionAlignment = this . scribe . createAlignment ( Alignment . CONDITIONAL_EXPRESSION , this . preferences . alignment_for_conditional_expression , <NUM_LIT:2> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( conditionalExpressionAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( conditionalExpressionAlignment , <NUM_LIT:0> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameQUESTION , this . preferences . insert_space_before_question_in_conditional ) ; if ( this . preferences . insert_space_after_question_in_conditional ) { this . scribe . space ( ) ; } conditionalExpression . valueIfTrue . traverse ( this , scope ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . alignFragment ( conditionalExpressionAlignment , <NUM_LIT:1> ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOLON , this . preferences . insert_space_before_colon_in_conditional ) ; if ( this . preferences . insert_space_after_colon_in_conditional ) { this . scribe . space ( ) ; } conditionalExpression . valueIfFalse . traverse ( this , scope ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( conditionalExpressionAlignment , true ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( conditionalExpression , numberOfParens ) ; } return false ; } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { if ( constructorDeclaration . ignoreFurtherInvestigation ) { this . scribe . printComment ( ) ; if ( this . scribe . indentationLevel != <NUM_LIT:0> ) { this . scribe . printIndentationIfNecessary ( ) ; } this . scribe . scanner . resetTo ( constructorDeclaration . declarationSourceEnd + <NUM_LIT:1> , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; switch ( this . scribe . scanner . source [ this . scribe . scanner . currentPosition ] ) { case '<STR_LIT:\n>' : this . scribe . scanner . currentPosition ++ ; this . scribe . lastNumberOfNewLines = <NUM_LIT:1> ; break ; case '<STR_LIT>' : this . scribe . scanner . currentPosition ++ ; if ( this . scribe . scanner . source [ this . scribe . scanner . currentPosition ] == '<STR_LIT:\n>' ) { this . scribe . scanner . currentPosition ++ ; } this . scribe . lastNumberOfNewLines = <NUM_LIT:1> ; } return false ; } this . scribe . printComment ( ) ; int line = this . scribe . line ; this . scribe . printModifiers ( constructorDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_METHOD ) ; if ( this . scribe . line > line ) { line = this . scribe . line ; } this . scribe . space ( ) ; TypeParameter [ ] typeParameters = constructorDeclaration . typeParameters ; if ( typeParameters != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_parameters ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_parameters ) { this . scribe . space ( ) ; } int length = typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeParameters [ i ] . traverse ( this , constructorDeclaration . scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_parameters ) ; if ( this . preferences . insert_space_after_comma_in_type_parameters ) { this . scribe . space ( ) ; } } typeParameters [ length - <NUM_LIT:1> ] . traverse ( this , constructorDeclaration . scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_parameters ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_parameters ) { this . scribe . space ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; formatMethodArguments ( constructorDeclaration , this . preferences . insert_space_before_opening_paren_in_constructor_declaration , this . preferences . insert_space_between_empty_parens_in_constructor_declaration , this . preferences . insert_space_before_closing_paren_in_constructor_declaration , this . preferences . insert_space_after_opening_paren_in_constructor_declaration , this . preferences . insert_space_before_comma_in_constructor_declaration_parameters , this . preferences . insert_space_after_comma_in_constructor_declaration_parameters , this . preferences . alignment_for_parameters_in_constructor_declaration ) ; formatThrowsClause ( constructorDeclaration , this . preferences . insert_space_before_comma_in_constructor_declaration_throws , this . preferences . insert_space_after_comma_in_constructor_declaration_throws , this . preferences . alignment_for_throws_clause_in_constructor_declaration ) ; if ( ! constructorDeclaration . isNative ( ) && ! constructorDeclaration . isAbstract ( ) ) { String constructor_declaration_brace = this . preferences . brace_position_for_constructor_declaration ; formatLeftCurlyBrace ( line , constructor_declaration_brace ) ; formatOpeningBrace ( constructor_declaration_brace , this . preferences . insert_space_before_opening_brace_in_constructor_declaration ) ; final int numberOfBlankLinesAtBeginningOfMethodBody = this . preferences . blank_lines_at_beginning_of_method_body ; if ( numberOfBlankLinesAtBeginningOfMethodBody > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( numberOfBlankLinesAtBeginningOfMethodBody ) ; } if ( constructorDeclaration . constructorCall != null && ! constructorDeclaration . constructorCall . isImplicitSuper ( ) ) { this . scribe . printNewLine ( ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . indent ( ) ; } constructorDeclaration . constructorCall . traverse ( this , constructorDeclaration . scope ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . unIndent ( ) ; } } final Statement [ ] statements = constructorDeclaration . statements ; if ( statements != null ) { this . scribe . printNewLine ( ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . indent ( ) ; } formatStatements ( constructorDeclaration . scope , statements , true ) ; this . scribe . printComment ( ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . unIndent ( ) ; } } else { if ( this . preferences . insert_new_line_in_empty_method_body ) { this . scribe . printNewLine ( ) ; } if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . indent ( ) ; } this . scribe . printComment ( ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . unIndent ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( constructor_declaration_brace . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } return false ; } public boolean visit ( ContinueStatement continueStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamecontinue ) ; if ( continueStatement . label != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( DoStatement doStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamedo ) ; final int line = this . scribe . line ; final Statement action = doStatement . action ; if ( action != null ) { if ( action instanceof Block ) { formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; action . traverse ( this , scope ) ; } else if ( action instanceof EmptyStatement ) { formatNecessaryEmptyStatement ( ) ; } else { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; action . traverse ( this , scope ) ; if ( action instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . printNewLine ( ) ; this . scribe . unIndent ( ) ; } } else { formatNecessaryEmptyStatement ( ) ; } if ( this . preferences . insert_new_line_before_while_in_do_statement ) { this . scribe . printNewLine ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamewhile , this . preferences . insert_space_after_closing_brace_in_block ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_while ) ; if ( this . preferences . insert_space_after_opening_paren_in_while ) { this . scribe . space ( ) ; } doStatement . condition . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_while ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( DoubleLiteral doubleLiteral , BlockScope scope ) { final int numberOfParens = ( doubleLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( doubleLiteral , numberOfParens ) ; } if ( isNextToken ( TerminalTokens . TokenNameMINUS ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameMINUS ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameDoubleLiteral ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( doubleLiteral , numberOfParens ) ; } return false ; } public boolean visit ( EmptyStatement statement , BlockScope scope ) { if ( this . preferences . put_empty_statement_on_new_line ) { this . scribe . printNewLine ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( FieldDeclaration enumConstant , MethodScope scope ) { this . scribe . printComment ( ) ; final int line = this . scribe . line ; this . scribe . printModifiers ( enumConstant . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_FIELD ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , false ) ; formatEnumConstantArguments ( enumConstant , this . preferences . insert_space_before_opening_paren_in_enum_constant , this . preferences . insert_space_between_empty_parens_in_enum_constant , this . preferences . insert_space_before_closing_paren_in_enum_constant , this . preferences . insert_space_after_opening_paren_in_enum_constant , this . preferences . insert_space_before_comma_in_enum_constant_arguments , this . preferences . insert_space_after_comma_in_enum_constant_arguments , this . preferences . alignment_for_arguments_in_enum_constant ) ; Expression initialization = enumConstant . initialization ; if ( initialization instanceof QualifiedAllocationExpression ) { TypeDeclaration typeDeclaration = ( ( QualifiedAllocationExpression ) initialization ) . anonymousType ; int fieldsCount = typeDeclaration . fields == null ? <NUM_LIT:0> : typeDeclaration . fields . length ; int methodsCount = typeDeclaration . methods == null ? <NUM_LIT:0> : typeDeclaration . methods . length ; int membersCount = typeDeclaration . memberTypes == null ? <NUM_LIT:0> : typeDeclaration . memberTypes . length ; String enum_constant_brace = this . preferences . brace_position_for_enum_constant ; formatLeftCurlyBrace ( line , enum_constant_brace ) ; formatTypeOpeningBraceForEnumConstant ( enum_constant_brace , this . preferences . insert_space_before_opening_brace_in_enum_constant , typeDeclaration ) ; if ( this . preferences . indent_body_declarations_compare_to_enum_constant_header ) { this . scribe . indent ( ) ; } if ( fieldsCount != <NUM_LIT:0> || methodsCount != <NUM_LIT:0> || membersCount != <NUM_LIT:0> ) { formatTypeMembers ( typeDeclaration ) ; } if ( this . preferences . indent_body_declarations_compare_to_enum_constant_header ) { this . scribe . unIndent ( ) ; } if ( this . preferences . insert_new_line_in_empty_enum_constant ) { this . scribe . printNewLine ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( enum_constant_brace . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } if ( hasComments ( ) ) { this . scribe . printNewLine ( ) ; } } return false ; } public boolean visit ( EqualExpression equalExpression , BlockScope scope ) { if ( ( equalExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT == OperatorIds . EQUAL_EQUAL ) { return dumpEqualityExpression ( equalExpression , TerminalTokens . TokenNameEQUAL_EQUAL , scope ) ; } else { return dumpEqualityExpression ( equalExpression , TerminalTokens . TokenNameNOT_EQUAL , scope ) ; } } public boolean visit ( ExplicitConstructorCall explicitConstructor , BlockScope scope ) { if ( explicitConstructor . isImplicitSuper ( ) ) { return false ; } final Expression qualification = explicitConstructor . qualification ; if ( qualification != null ) { qualification . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; } TypeReference [ ] typeArguments = explicitConstructor . typeArguments ; if ( typeArguments != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_arguments ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_arguments ) ; if ( this . preferences . insert_space_after_comma_in_type_arguments ) { this . scribe . space ( ) ; } } typeArguments [ length - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_arguments ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } } if ( explicitConstructor . isSuperAccess ( ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNamesuper ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNamethis ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_method_invocation ) ; final Expression [ ] arguments = explicitConstructor . arguments ; if ( arguments != null ) { if ( this . preferences . insert_space_after_opening_paren_in_method_invocation ) { this . scribe . space ( ) ; } int argumentLength = arguments . length ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . EXPLICIT_CONSTRUCTOR_CALL , this . preferences . alignment_for_arguments_in_explicit_constructor_call , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_explicit_constructor_call_arguments ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( argumentsAlignment , i ) ; if ( i > <NUM_LIT:0> && this . preferences . insert_space_after_comma_in_explicit_constructor_call_arguments ) { this . scribe . space ( ) ; } arguments [ i ] . traverse ( this , scope ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_method_invocation ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_method_invocation ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( FalseLiteral falseLiteral , BlockScope scope ) { final int numberOfParens = ( falseLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( falseLiteral , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamefalse ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( falseLiteral , numberOfParens ) ; } return false ; } public boolean visit ( FieldReference fieldReference , BlockScope scope ) { final int numberOfParens = ( fieldReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( fieldReference , numberOfParens ) ; } fieldReference . receiver . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( fieldReference , numberOfParens ) ; } return false ; } public boolean visit ( FloatLiteral floatLiteral , BlockScope scope ) { final int numberOfParens = ( floatLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( floatLiteral , numberOfParens ) ; } if ( isNextToken ( TerminalTokens . TokenNameMINUS ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameMINUS ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameFloatingPointLiteral ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( floatLiteral , numberOfParens ) ; } return false ; } public boolean visit ( ForeachStatement forStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamefor ) ; final int line = this . scribe . line ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_for ) ; if ( this . preferences . insert_space_after_opening_paren_in_for ) { this . scribe . space ( ) ; } formatLocalDeclaration ( forStatement . elementVariable , scope , false , false ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOLON , this . preferences . insert_space_before_colon_in_for ) ; if ( this . preferences . insert_space_after_colon_in_for ) { this . scribe . space ( ) ; } forStatement . collection . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_for ) ; final Statement action = forStatement . action ; if ( action != null ) { if ( action instanceof Block ) { formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; action . traverse ( this , scope ) ; } else if ( action instanceof EmptyStatement ) { formatNecessaryEmptyStatement ( ) ; } else { this . scribe . indent ( ) ; this . scribe . printNewLine ( ) ; action . traverse ( this , scope ) ; this . scribe . unIndent ( ) ; } if ( action instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } else { formatNecessaryEmptyStatement ( ) ; } return false ; } public boolean visit ( ForStatement forStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamefor ) ; final int line = this . scribe . line ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_for ) ; if ( this . preferences . insert_space_after_opening_paren_in_for ) { this . scribe . space ( ) ; } final Statement [ ] initializations = forStatement . initializations ; if ( initializations != null ) { int length = initializations . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( initializations [ i ] instanceof LocalDeclaration ) { formatLocalDeclaration ( ( LocalDeclaration ) initializations [ i ] , scope , this . preferences . insert_space_before_comma_in_for_inits , this . preferences . insert_space_after_comma_in_for_inits ) ; } else { initializations [ i ] . traverse ( this , scope ) ; if ( i >= <NUM_LIT:0> && ( i < length - <NUM_LIT:1> ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_for_inits ) ; if ( this . preferences . insert_space_after_comma_in_for_inits ) { this . scribe . space ( ) ; } this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } } } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon_in_for ) ; final Expression condition = forStatement . condition ; if ( condition != null ) { if ( this . preferences . insert_space_after_semicolon_in_for ) { this . scribe . space ( ) ; } condition . traverse ( this , scope ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon_in_for ) ; final Statement [ ] increments = forStatement . increments ; if ( increments != null ) { if ( this . preferences . insert_space_after_semicolon_in_for ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> , length = increments . length ; i < length ; i ++ ) { increments [ i ] . traverse ( this , scope ) ; if ( i != length - <NUM_LIT:1> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_for_increments ) ; if ( this . preferences . insert_space_after_comma_in_for_increments ) { this . scribe . space ( ) ; } this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } } this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_for ) ; final Statement action = forStatement . action ; if ( action != null ) { if ( action instanceof Block ) { formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; action . traverse ( this , scope ) ; } else if ( action instanceof EmptyStatement ) { formatNecessaryEmptyStatement ( ) ; } else { this . scribe . indent ( ) ; this . scribe . printNewLine ( ) ; action . traverse ( this , scope ) ; this . scribe . unIndent ( ) ; } if ( action instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } else { formatNecessaryEmptyStatement ( ) ; } return false ; } public boolean visit ( IfStatement ifStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameif ) ; final int line = this . scribe . line ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_if ) ; if ( this . preferences . insert_space_after_opening_paren_in_if ) { this . scribe . space ( ) ; } ifStatement . condition . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_if ) ; final Statement thenStatement = ifStatement . thenStatement ; final Statement elseStatement = ifStatement . elseStatement ; boolean thenStatementIsBlock = false ; if ( thenStatement != null ) { if ( thenStatement instanceof Block ) { thenStatementIsBlock = true ; if ( isGuardClause ( ( Block ) thenStatement ) && elseStatement == null && this . preferences . keep_guardian_clause_on_one_line ) { formatGuardClauseBlock ( ( Block ) thenStatement , scope ) ; } else { formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; thenStatement . traverse ( this , scope ) ; if ( elseStatement != null && ( this . preferences . insert_new_line_before_else_in_if_statement ) ) { this . scribe . printNewLine ( ) ; } } } else if ( elseStatement == null && this . preferences . keep_simple_if_on_one_line ) { Alignment compactIfAlignment = this . scribe . createAlignment ( Alignment . COMPACT_IF , this . preferences . alignment_for_compact_if , Alignment . R_OUTERMOST , <NUM_LIT:1> , this . scribe . scanner . currentPosition , <NUM_LIT:1> , false ) ; this . scribe . enterAlignment ( compactIfAlignment ) ; boolean ok = false ; do { try { this . scribe . alignFragment ( compactIfAlignment , <NUM_LIT:0> ) ; this . scribe . space ( ) ; thenStatement . traverse ( this , scope ) ; if ( thenStatement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( compactIfAlignment , true ) ; } else if ( this . preferences . keep_then_statement_on_same_line ) { this . scribe . space ( ) ; thenStatement . traverse ( this , scope ) ; if ( thenStatement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } if ( elseStatement != null ) { this . scribe . printNewLine ( ) ; } } else { this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; thenStatement . traverse ( this , scope ) ; if ( thenStatement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } if ( elseStatement != null ) { this . scribe . printNewLine ( ) ; } this . scribe . unIndent ( ) ; } } if ( elseStatement != null ) { if ( thenStatementIsBlock ) { this . scribe . printNextToken ( TerminalTokens . TokenNameelse , this . preferences . insert_space_after_closing_brace_in_block , Scribe . PRESERVE_EMPTY_LINES_BEFORE_ELSE ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameelse , true , Scribe . PRESERVE_EMPTY_LINES_BEFORE_ELSE ) ; } if ( elseStatement instanceof Block ) { elseStatement . traverse ( this , scope ) ; } else if ( elseStatement instanceof IfStatement ) { if ( ! this . preferences . compact_else_if ) { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; } this . scribe . space ( ) ; elseStatement . traverse ( this , scope ) ; if ( ! this . preferences . compact_else_if ) { this . scribe . unIndent ( ) ; } } else if ( this . preferences . keep_else_statement_on_same_line ) { this . scribe . space ( ) ; elseStatement . traverse ( this , scope ) ; if ( elseStatement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } } else { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; elseStatement . traverse ( this , scope ) ; if ( elseStatement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . unIndent ( ) ; } } return false ; } public boolean visit ( Initializer initializer , MethodScope scope ) { if ( initializer . isStatic ( ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNamestatic ) ; } initializer . block . traverse ( this , scope ) ; return false ; } public boolean visit ( InstanceOfExpression instanceOfExpression , BlockScope scope ) { final int numberOfParens = ( instanceOfExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( instanceOfExpression , numberOfParens ) ; } instanceOfExpression . expression . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameinstanceof , true ) ; this . scribe . space ( ) ; instanceOfExpression . type . traverse ( this , scope ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( instanceOfExpression , numberOfParens ) ; } return false ; } public boolean visit ( IntLiteral intLiteral , BlockScope scope ) { final int numberOfParens = ( intLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( intLiteral , numberOfParens ) ; } if ( isNextToken ( TerminalTokens . TokenNameMINUS ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameMINUS ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIntegerLiteral ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( intLiteral , numberOfParens ) ; } return false ; } public boolean visit ( LabeledStatement labeledStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOLON , this . preferences . insert_space_before_colon_in_labeled_statement ) ; if ( this . preferences . insert_space_after_colon_in_labeled_statement ) { this . scribe . space ( ) ; } if ( this . preferences . insert_new_line_after_label ) { this . scribe . printNewLine ( ) ; } final Statement statement = labeledStatement . statement ; statement . traverse ( this , scope ) ; if ( statement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } return false ; } public boolean visit ( LocalDeclaration localDeclaration , BlockScope scope ) { formatLocalDeclaration ( localDeclaration , scope , this . preferences . insert_space_before_comma_in_multiple_local_declarations , this . preferences . insert_space_after_comma_in_multiple_local_declarations ) ; return false ; } public boolean visit ( LongLiteral longLiteral , BlockScope scope ) { final int numberOfParens = ( longLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( longLiteral , numberOfParens ) ; } if ( isNextToken ( TerminalTokens . TokenNameMINUS ) ) { this . scribe . printNextToken ( TerminalTokens . TokenNameMINUS ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameLongLiteral ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( longLiteral , numberOfParens ) ; } return false ; } public boolean visit ( MarkerAnnotation annotation , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameAT ) ; if ( this . preferences . insert_space_after_at_in_annotation ) { this . scribe . space ( ) ; } this . scribe . printQualifiedReference ( annotation . sourceEnd , false ) ; return false ; } public boolean visit ( MarkerAnnotation annotation , ClassScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameAT ) ; if ( this . preferences . insert_space_after_at_in_annotation ) { this . scribe . space ( ) ; } this . scribe . printQualifiedReference ( annotation . sourceEnd , false ) ; return false ; } public boolean visit ( MemberValuePair pair , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameEQUAL , this . preferences . insert_space_before_assignment_operator ) ; if ( this . preferences . insert_space_after_assignment_operator ) { this . scribe . space ( ) ; } pair . value . traverse ( this , scope ) ; return false ; } public boolean visit ( MessageSend messageSend , BlockScope scope ) { final int numberOfParens = ( messageSend . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( messageSend , numberOfParens ) ; } CascadingMethodInvocationFragmentBuilder builder = buildFragments ( messageSend , scope ) ; if ( builder . size ( ) >= <NUM_LIT:3> && numberOfParens == <NUM_LIT:0> ) { formatCascadingMessageSends ( builder , scope ) ; } else { Alignment messageAlignment = null ; if ( ! messageSend . receiver . isImplicitThis ( ) ) { messageSend . receiver . traverse ( this , scope ) ; int alignmentMode = this . preferences . alignment_for_selector_in_method_invocation ; messageAlignment = this . scribe . createAlignment ( Alignment . MESSAGE_SEND , alignmentMode , <NUM_LIT:1> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( messageAlignment ) ; boolean ok = false ; do { switch ( alignmentMode & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : messageAlignment . startingColumn = this . scribe . column ; break ; } try { formatMessageSend ( messageSend , scope , messageAlignment ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( messageAlignment , true ) ; } else { formatMessageSend ( messageSend , scope , null ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( messageSend , numberOfParens ) ; } return false ; } public boolean visit ( MethodDeclaration methodDeclaration , ClassScope scope ) { if ( methodDeclaration . ignoreFurtherInvestigation ) { this . scribe . printComment ( ) ; if ( this . scribe . indentationLevel != <NUM_LIT:0> ) { this . scribe . printIndentationIfNecessary ( ) ; } this . scribe . scanner . resetTo ( methodDeclaration . declarationSourceEnd + <NUM_LIT:1> , this . scribe . scannerEndPosition - <NUM_LIT:1> ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( ! this . scribe . scanner . atEnd ( ) ) { switch ( this . scribe . scanner . source [ this . scribe . scanner . currentPosition ] ) { case '<STR_LIT:\n>' : this . scribe . scanner . currentPosition ++ ; this . scribe . lastNumberOfNewLines = <NUM_LIT:1> ; break ; case '<STR_LIT>' : this . scribe . scanner . currentPosition ++ ; if ( this . scribe . scanner . source [ this . scribe . scanner . currentPosition ] == '<STR_LIT:\n>' ) { this . scribe . scanner . currentPosition ++ ; } this . scribe . lastNumberOfNewLines = <NUM_LIT:1> ; } } return false ; } this . scribe . printComment ( ) ; int line = this . scribe . line ; Alignment methodDeclAlignment = this . scribe . createAlignment ( Alignment . METHOD_DECLARATION , this . preferences . alignment_for_method_declaration , Alignment . R_INNERMOST , <NUM_LIT:3> , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( methodDeclAlignment ) ; boolean ok = false ; final MethodScope methodDeclarationScope = methodDeclaration . scope ; do { try { this . scribe . printModifiers ( methodDeclaration . annotations , this , ICodeFormatterConstants . ANNOTATION_ON_METHOD ) ; int fragmentIndex = <NUM_LIT:0> ; this . scribe . alignFragment ( methodDeclAlignment , fragmentIndex ) ; if ( this . scribe . line > line ) { line = this . scribe . line ; } this . scribe . space ( ) ; TypeParameter [ ] typeParameters = methodDeclaration . typeParameters ; if ( typeParameters != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_parameters ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_parameters ) { this . scribe . space ( ) ; } int length = typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeParameters [ i ] . traverse ( this , methodDeclaration . scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_parameters ) ; if ( this . preferences . insert_space_after_comma_in_type_parameters ) { this . scribe . space ( ) ; } } typeParameters [ length - <NUM_LIT:1> ] . traverse ( this , methodDeclaration . scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_parameters ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_parameters ) { this . scribe . space ( ) ; } this . scribe . alignFragment ( methodDeclAlignment , ++ fragmentIndex ) ; } final TypeReference returnType = methodDeclaration . returnType ; if ( returnType != null ) { returnType . traverse ( this , methodDeclarationScope ) ; } this . scribe . alignFragment ( methodDeclAlignment , ++ fragmentIndex ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier , true ) ; formatMethodArguments ( methodDeclaration , this . preferences . insert_space_before_opening_paren_in_method_declaration , this . preferences . insert_space_between_empty_parens_in_method_declaration , this . preferences . insert_space_before_closing_paren_in_method_declaration , this . preferences . insert_space_after_opening_paren_in_method_declaration , this . preferences . insert_space_before_comma_in_method_declaration_parameters , this . preferences . insert_space_after_comma_in_method_declaration_parameters , this . preferences . alignment_for_parameters_in_method_declaration ) ; int extraDimensions = getDimensions ( ) ; if ( extraDimensions != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < extraDimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } formatThrowsClause ( methodDeclaration , this . preferences . insert_space_before_comma_in_method_declaration_throws , this . preferences . insert_space_after_comma_in_method_declaration_throws , this . preferences . alignment_for_throws_clause_in_method_declaration ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( methodDeclAlignment , true ) ; if ( ! methodDeclaration . isNative ( ) && ! methodDeclaration . isAbstract ( ) && ( ( methodDeclaration . modifiers & ExtraCompilerModifiers . AccSemicolonBody ) == <NUM_LIT:0> ) ) { String method_declaration_brace = this . preferences . brace_position_for_method_declaration ; formatLeftCurlyBrace ( line , method_declaration_brace ) ; formatOpeningBrace ( method_declaration_brace , this . preferences . insert_space_before_opening_brace_in_method_declaration ) ; final int numberOfBlankLinesAtBeginningOfMethodBody = this . preferences . blank_lines_at_beginning_of_method_body ; if ( numberOfBlankLinesAtBeginningOfMethodBody > <NUM_LIT:0> ) { this . scribe . printEmptyLines ( numberOfBlankLinesAtBeginningOfMethodBody ) ; } final Statement [ ] statements = methodDeclaration . statements ; if ( statements != null ) { this . scribe . printNewLine ( ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . indent ( ) ; } formatStatements ( methodDeclarationScope , statements , true ) ; this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_AT_END_OF_METHOD_DECLARATION ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . unIndent ( ) ; } } else { if ( this . preferences . insert_new_line_in_empty_method_body ) { this . scribe . printNewLine ( ) ; } if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . indent ( ) ; } this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_AT_END_OF_METHOD_DECLARATION ) ; if ( this . preferences . indent_statements_compare_to_body ) { this . scribe . unIndent ( ) ; } } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( method_declaration_brace . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . COMPLEX_TRAILING_COMMENT ) ; } return false ; } public boolean visit ( NormalAnnotation annotation , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameAT ) ; if ( this . preferences . insert_space_after_at_in_annotation ) { this . scribe . space ( ) ; } this . scribe . printQualifiedReference ( annotation . sourceEnd , false ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_annotation ) ; if ( this . preferences . insert_space_after_opening_paren_in_annotation ) { this . scribe . space ( ) ; } MemberValuePair [ ] memberValuePairs = annotation . memberValuePairs ; if ( memberValuePairs != null ) { int length = memberValuePairs . length ; Alignment annotationAlignment = this . scribe . createAlignment ( Alignment . ANNOTATION_MEMBERS_VALUE_PAIRS , this . preferences . alignment_for_arguments_in_annotation , length , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( annotationAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_annotation ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( annotationAlignment , i ) ; if ( i > <NUM_LIT:0> && this . preferences . insert_space_after_comma_in_annotation ) { this . scribe . space ( ) ; } memberValuePairs [ i ] . traverse ( this , scope ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( annotationAlignment , true ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_annotation ) ; return false ; } public boolean visit ( NullLiteral nullLiteral , BlockScope scope ) { final int numberOfParens = ( nullLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( nullLiteral , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamenull ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( nullLiteral , numberOfParens ) ; } return false ; } public boolean visit ( OR_OR_Expression or_or_Expression , BlockScope scope ) { return dumpBinaryExpression ( or_or_Expression , TerminalTokens . TokenNameOR_OR , scope ) ; } public boolean visit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , BlockScope scope ) { final int numberOfParens = ( parameterizedQualifiedTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( parameterizedQualifiedTypeReference , numberOfParens ) ; } TypeReference [ ] [ ] typeArguments = parameterizedQualifiedTypeReference . typeArguments ; int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; TypeReference [ ] typeArgument = typeArguments [ i ] ; if ( typeArgument != null ) { int typeArgumentLength = typeArgument . length ; if ( typeArgumentLength > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_parameterized_type_reference ) { this . scribe . space ( ) ; } for ( int j = <NUM_LIT:0> ; j < typeArgumentLength - <NUM_LIT:1> ; j ++ ) { typeArgument [ j ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_comma_in_parameterized_type_reference ) { this . scribe . space ( ) ; } } typeArgument [ typeArgumentLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_parameterized_type_reference ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS ) ; } } if ( i < length - <NUM_LIT:1> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; } } int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> && dimensions <= parameterizedQualifiedTypeReference . dimensions ( ) ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; if ( this . preferences . insert_space_between_brackets_in_array_type_reference ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( parameterizedQualifiedTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , ClassScope scope ) { final int numberOfParens = ( parameterizedQualifiedTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( parameterizedQualifiedTypeReference , numberOfParens ) ; } TypeReference [ ] [ ] typeArguments = parameterizedQualifiedTypeReference . typeArguments ; int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; TypeReference [ ] typeArgument = typeArguments [ i ] ; if ( typeArgument != null ) { int typeArgumentLength = typeArgument . length ; if ( typeArgumentLength > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_parameterized_type_reference ) { this . scribe . space ( ) ; } for ( int j = <NUM_LIT:0> ; j < typeArgumentLength - <NUM_LIT:1> ; j ++ ) { typeArgument [ j ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_comma_in_parameterized_type_reference ) { this . scribe . space ( ) ; } } typeArgument [ typeArgumentLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_parameterized_type_reference ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS ) ; } } if ( i < length - <NUM_LIT:1> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; } } int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> && dimensions <= parameterizedQualifiedTypeReference . dimensions ( ) ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; if ( this . preferences . insert_space_between_brackets_in_array_type_reference ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( parameterizedQualifiedTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , BlockScope scope ) { final int numberOfParens = ( parameterizedSingleTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( parameterizedSingleTypeReference , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; TypeReference [ ] typeArguments = parameterizedSingleTypeReference . typeArguments ; int typeArgumentsLength = typeArguments . length ; if ( typeArgumentsLength > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_parameterized_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_comma_in_parameterized_type_reference ) { this . scribe . space ( ) ; } } typeArguments [ typeArgumentsLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_parameterized_type_reference ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS ) ; } int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> && dimensions <= parameterizedSingleTypeReference . dimensions ( ) ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; if ( this . preferences . insert_space_between_brackets_in_array_type_reference ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( parameterizedSingleTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , ClassScope scope ) { final int numberOfParens = ( parameterizedSingleTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( parameterizedSingleTypeReference , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; TypeReference [ ] typeArguments = parameterizedSingleTypeReference . typeArguments ; int typeArgumentsLength = typeArguments . length ; if ( typeArgumentsLength > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_parameterized_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_parameterized_type_reference ) ; if ( this . preferences . insert_space_after_comma_in_parameterized_type_reference ) { this . scribe . space ( ) ; } } typeArguments [ typeArgumentsLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_parameterized_type_reference ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_parameterized_type_reference ) ; this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS ) ; } int dimensions = getDimensions ( ) ; if ( dimensions != <NUM_LIT:0> && dimensions <= parameterizedSingleTypeReference . dimensions ( ) ) { if ( this . preferences . insert_space_before_opening_bracket_in_array_type_reference ) { this . scribe . space ( ) ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLBRACKET ) ; if ( this . preferences . insert_space_between_brackets_in_array_type_reference ) { this . scribe . space ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACKET ) ; } } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( parameterizedSingleTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( PostfixExpression postfixExpression , BlockScope scope ) { final int numberOfParens = ( postfixExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( postfixExpression , numberOfParens ) ; } postfixExpression . lhs . traverse ( this , scope ) ; int operator = postfixExpression . operator == OperatorIds . PLUS ? TerminalTokens . TokenNamePLUS_PLUS : TerminalTokens . TokenNameMINUS_MINUS ; this . scribe . printNextToken ( operator , this . preferences . insert_space_before_postfix_operator ) ; if ( this . preferences . insert_space_after_postfix_operator ) { this . scribe . space ( ) ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( postfixExpression , numberOfParens ) ; } return false ; } public boolean visit ( PrefixExpression prefixExpression , BlockScope scope ) { final int numberOfParens = ( prefixExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( prefixExpression , numberOfParens ) ; } int operator = prefixExpression . operator == OperatorIds . PLUS ? TerminalTokens . TokenNamePLUS_PLUS : TerminalTokens . TokenNameMINUS_MINUS ; this . scribe . printNextToken ( operator , this . preferences . insert_space_before_prefix_operator ) ; if ( this . preferences . insert_space_after_prefix_operator ) { this . scribe . space ( ) ; } prefixExpression . lhs . traverse ( this , scope ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( prefixExpression , numberOfParens ) ; } return false ; } public boolean visit ( QualifiedAllocationExpression qualifiedAllocationExpression , BlockScope scope ) { final int numberOfParens = ( qualifiedAllocationExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( qualifiedAllocationExpression , numberOfParens ) ; } final Expression enclosingInstance = qualifiedAllocationExpression . enclosingInstance ; if ( enclosingInstance != null ) { enclosingInstance . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamenew ) ; TypeReference [ ] typeArguments = qualifiedAllocationExpression . typeArguments ; if ( typeArguments != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameLESS , this . preferences . insert_space_before_opening_angle_bracket_in_type_arguments ) ; if ( this . preferences . insert_space_after_opening_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } int length = typeArguments . length ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { typeArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_type_arguments ) ; if ( this . preferences . insert_space_after_comma_in_type_arguments ) { this . scribe . space ( ) ; } } typeArguments [ length - <NUM_LIT:1> ] . traverse ( this , scope ) ; if ( isClosingGenericToken ( ) ) { this . scribe . printNextToken ( CLOSING_GENERICS_EXPECTEDTOKENS , this . preferences . insert_space_before_closing_angle_bracket_in_type_arguments ) ; } if ( this . preferences . insert_space_after_closing_angle_bracket_in_type_arguments ) { this . scribe . space ( ) ; } } else { this . scribe . space ( ) ; } final int line = this . scribe . line ; qualifiedAllocationExpression . type . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_method_invocation ) ; final Expression [ ] arguments = qualifiedAllocationExpression . arguments ; if ( arguments != null ) { if ( this . preferences . insert_space_after_opening_paren_in_method_invocation ) { this . scribe . space ( ) ; } int argumentLength = arguments . length ; Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . ALLOCATION , this . preferences . alignment_for_arguments_in_qualified_allocation_expression , argumentLength , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameCOMMA , this . preferences . insert_space_before_comma_in_allocation_expression ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . alignFragment ( argumentsAlignment , i ) ; if ( i > <NUM_LIT:0> && this . preferences . insert_space_after_comma_in_allocation_expression ) { this . scribe . space ( ) ; } arguments [ i ] . traverse ( this , scope ) ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_method_invocation ) ; } else { this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_between_empty_parens_in_method_invocation ) ; } final TypeDeclaration anonymousType = qualifiedAllocationExpression . anonymousType ; if ( anonymousType != null ) { formatLeftCurlyBrace ( line , this . preferences . brace_position_for_anonymous_type_declaration ) ; formatAnonymousTypeDeclaration ( anonymousType ) ; } if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( qualifiedAllocationExpression , numberOfParens ) ; } return false ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , BlockScope scope ) { final int numberOfParens = ( qualifiedNameReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( qualifiedNameReference , numberOfParens ) ; } this . scribe . printQualifiedReference ( qualifiedNameReference . sourceEnd , numberOfParens >= <NUM_LIT:0> ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( qualifiedNameReference , numberOfParens ) ; } return false ; } public boolean visit ( QualifiedSuperReference qualifiedSuperReference , BlockScope scope ) { final int numberOfParens = ( qualifiedSuperReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( qualifiedSuperReference , numberOfParens ) ; } qualifiedSuperReference . qualification . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; this . scribe . printNextToken ( TerminalTokens . TokenNamesuper ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( qualifiedSuperReference , numberOfParens ) ; } return false ; } public boolean visit ( QualifiedThisReference qualifiedThisReference , BlockScope scope ) { final int numberOfParens = ( qualifiedThisReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( qualifiedThisReference , numberOfParens ) ; } qualifiedThisReference . qualification . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameDOT ) ; this . scribe . printNextToken ( TerminalTokens . TokenNamethis ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( qualifiedThisReference , numberOfParens ) ; } return false ; } public boolean visit ( QualifiedTypeReference qualifiedTypeReference , BlockScope scope ) { final int numberOfParens = ( qualifiedTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( qualifiedTypeReference , numberOfParens ) ; } this . scribe . printQualifiedReference ( qualifiedTypeReference . sourceEnd , numberOfParens >= <NUM_LIT:0> ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( qualifiedTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( QualifiedTypeReference qualifiedTypeReference , ClassScope scope ) { final int numberOfParens = ( qualifiedTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( qualifiedTypeReference , numberOfParens ) ; } this . scribe . printQualifiedReference ( qualifiedTypeReference . sourceEnd , numberOfParens >= <NUM_LIT:0> ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( qualifiedTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( ReturnStatement returnStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamereturn ) ; final Expression expression = returnStatement . expression ; if ( expression != null ) { final int numberOfParens = ( expression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( ( numberOfParens != <NUM_LIT:0> && this . preferences . insert_space_before_parenthesized_expression_in_return ) || numberOfParens == <NUM_LIT:0> ) { this . scribe . space ( ) ; } expression . traverse ( this , scope ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( SingleMemberAnnotation annotation , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameAT ) ; if ( this . preferences . insert_space_after_at_in_annotation ) { this . scribe . space ( ) ; } this . scribe . printQualifiedReference ( annotation . sourceEnd , false ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_annotation ) ; if ( this . preferences . insert_space_after_opening_paren_in_annotation ) { this . scribe . space ( ) ; } annotation . memberValue . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_annotation ) ; return false ; } public boolean visit ( SingleNameReference singleNameReference , BlockScope scope ) { final int numberOfParens = ( singleNameReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( singleNameReference , numberOfParens ) ; } this . scribe . printNextToken ( SINGLETYPEREFERENCE_EXPECTEDTOKENS ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( singleNameReference , numberOfParens ) ; } return false ; } public boolean visit ( SingleTypeReference singleTypeReference , BlockScope scope ) { final int numberOfParens = ( singleTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( singleTypeReference , numberOfParens ) ; } this . scribe . printNextToken ( SINGLETYPEREFERENCE_EXPECTEDTOKENS ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( singleTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( SingleTypeReference singleTypeReference , ClassScope scope ) { final int numberOfParens = ( singleTypeReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( singleTypeReference , numberOfParens ) ; } this . scribe . printNextToken ( SINGLETYPEREFERENCE_EXPECTEDTOKENS ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( singleTypeReference , numberOfParens ) ; } return false ; } public boolean visit ( StringLiteral stringLiteral , BlockScope scope ) { final int numberOfParens = ( stringLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( stringLiteral , numberOfParens ) ; } this . scribe . checkNLSTag ( stringLiteral . sourceStart ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameStringLiteral ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( stringLiteral , numberOfParens ) ; } return false ; } public boolean visit ( StringLiteralConcatenation stringLiteral , BlockScope scope ) { final int numberOfParens = ( stringLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( stringLiteral , numberOfParens ) ; } this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_IN_STRING_LITERAL_CONCATENATION ) ; ASTNode [ ] fragments = stringLiteral . literals ; int fragmentsSize = stringLiteral . counter ; Alignment binaryExpressionAlignment = this . scribe . createAlignment ( Alignment . STRING_CONCATENATION , this . preferences . alignment_for_binary_expression , Alignment . R_OUTERMOST , fragmentsSize , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( binaryExpressionAlignment ) ; boolean ok = false ; do { try { for ( int i = <NUM_LIT:0> ; i < fragmentsSize - <NUM_LIT:1> ; i ++ ) { ASTNode fragment = fragments [ i ] ; fragment . traverse ( this , scope ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( this . scribe . lastNumberOfNewLines == <NUM_LIT:1> ) { this . scribe . indentationLevel = binaryExpressionAlignment . breakIndentationLevel ; } this . scribe . alignFragment ( binaryExpressionAlignment , i ) ; this . scribe . printNextToken ( TerminalTokens . TokenNamePLUS , this . preferences . insert_space_before_binary_operator ) ; if ( this . preferences . insert_space_after_binary_operator ) { this . scribe . space ( ) ; } } fragments [ fragmentsSize - <NUM_LIT:1> ] . traverse ( this , scope ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( binaryExpressionAlignment , true ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( stringLiteral , numberOfParens ) ; } return false ; } public boolean visit ( SuperReference superReference , BlockScope scope ) { final int numberOfParens = ( superReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( superReference , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamesuper ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( superReference , numberOfParens ) ; } return false ; } public boolean visit ( SwitchStatement switchStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameswitch ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_switch ) ; if ( this . preferences . insert_space_after_opening_paren_in_switch ) { this . scribe . space ( ) ; } switchStatement . expression . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_switch ) ; String switch_brace = this . preferences . brace_position_for_switch ; formatOpeningBrace ( switch_brace , this . preferences . insert_space_before_opening_brace_in_switch ) ; this . scribe . printNewLine ( ) ; final Statement [ ] statements = switchStatement . statements ; int switchIndentationLevel = this . scribe . indentationLevel ; int caseIndentation = <NUM_LIT:0> ; int statementIndentation = <NUM_LIT:0> ; int breakIndentation = <NUM_LIT:0> ; if ( this . preferences . indent_switchstatements_compare_to_switch ) { caseIndentation ++ ; statementIndentation ++ ; breakIndentation ++ ; } if ( this . preferences . indent_switchstatements_compare_to_cases ) { statementIndentation ++ ; } if ( this . preferences . indent_breaks_compare_to_cases ) { breakIndentation ++ ; } boolean wasACase = false ; boolean wasABreak = false ; if ( statements != null ) { int statementsLength = statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) { final Statement statement = statements [ i ] ; if ( statement instanceof CaseStatement ) { if ( wasABreak ) { this . scribe . setIndentation ( switchIndentationLevel , caseIndentation ) ; this . scribe . printComment ( ) ; } else { if ( wasACase ) { this . scribe . printComment ( Scribe . PRESERVE_EMPTY_LINES_IN_SWITCH_CASE ) ; } else { this . scribe . printComment ( ) ; } this . scribe . setIndentation ( switchIndentationLevel , caseIndentation ) ; } if ( wasACase ) { this . scribe . printNewLine ( ) ; } statement . traverse ( this , scope ) ; this . scribe . setIndentation ( switchIndentationLevel , statementIndentation ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . COMPLEX_TRAILING_COMMENT ) ; wasACase = true ; wasABreak = false ; } else if ( statement instanceof BreakStatement ) { this . scribe . setIndentation ( switchIndentationLevel , breakIndentation ) ; if ( wasACase ) { this . scribe . printNewLine ( ) ; } this . scribe . printComment ( ) ; statement . traverse ( this , scope ) ; wasACase = false ; wasABreak = true ; } else if ( statement instanceof Block ) { this . scribe . setIndentation ( switchIndentationLevel , wasACase ? caseIndentation : statementIndentation ) ; this . scribe . printComment ( ) ; String bracePosition = wasACase ? this . preferences . brace_position_for_block_in_case : this . preferences . brace_position_for_block ; formatBlock ( ( Block ) statement , scope , bracePosition , this . preferences . insert_space_before_opening_brace_in_block ) ; wasACase = false ; wasABreak = false ; } else { this . scribe . setIndentation ( switchIndentationLevel , statementIndentation ) ; this . scribe . printNewLine ( ) ; this . scribe . printComment ( ) ; statement . traverse ( this , scope ) ; wasACase = false ; wasABreak = false ; } if ( statement instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . printNewLine ( ) ; } else if ( statement instanceof LocalDeclaration ) { LocalDeclaration currentLocal = ( LocalDeclaration ) statement ; if ( i < ( statementsLength - <NUM_LIT:1> ) ) { if ( statements [ i + <NUM_LIT:1> ] instanceof LocalDeclaration ) { LocalDeclaration nextLocal = ( LocalDeclaration ) statements [ i + <NUM_LIT:1> ] ; if ( currentLocal . declarationSourceStart != nextLocal . declarationSourceStart ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . printNewLine ( ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . printNewLine ( ) ; } } else { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; this . scribe . printNewLine ( ) ; } } else if ( ! wasACase ) { this . scribe . printNewLine ( ) ; } } } this . scribe . printNewLine ( ) ; if ( wasABreak ) { this . scribe . setIndentation ( switchIndentationLevel , <NUM_LIT:0> ) ; this . scribe . printComment ( ) ; } else { this . scribe . printComment ( ) ; this . scribe . setIndentation ( switchIndentationLevel , <NUM_LIT:0> ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameRBRACE ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( switch_brace . equals ( DefaultCodeFormatterConstants . NEXT_LINE_SHIFTED ) ) { this . scribe . unIndent ( ) ; } return false ; } public boolean visit ( SynchronizedStatement synchronizedStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamesynchronized ) ; final int line = this . scribe . line ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_synchronized ) ; if ( this . preferences . insert_space_after_opening_paren_in_synchronized ) { this . scribe . space ( ) ; } synchronizedStatement . expression . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_synchronized ) ; formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; synchronizedStatement . block . traverse ( this , scope ) ; return false ; } public boolean visit ( ThisReference thisReference , BlockScope scope ) { if ( ! thisReference . isImplicitThis ( ) ) { final int numberOfParens = ( thisReference . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( thisReference , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamethis ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( thisReference , numberOfParens ) ; } } return false ; } public boolean visit ( ThrowStatement throwStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamethrow ) ; Expression expression = throwStatement . exception ; final int numberOfParens = ( expression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( ( numberOfParens > <NUM_LIT:0> && this . preferences . insert_space_before_parenthesized_expression_in_throw ) || numberOfParens == <NUM_LIT:0> ) { this . scribe . space ( ) ; } expression . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; return false ; } public boolean visit ( TrueLiteral trueLiteral , BlockScope scope ) { final int numberOfParens = ( trueLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( trueLiteral , numberOfParens ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNametrue ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( trueLiteral , numberOfParens ) ; } return false ; } public boolean visit ( TryStatement tryStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNametry ) ; formatTryResources ( tryStatement , this . preferences . insert_space_before_opening_paren_in_try , this . preferences . insert_space_before_closing_paren_in_try , this . preferences . insert_space_after_opening_paren_in_try , this . preferences . insert_space_before_semicolon_in_try_resources , this . preferences . insert_space_after_semicolon_in_try_resources , this . preferences . alignment_for_resources_in_try ) ; tryStatement . tryBlock . traverse ( this , scope ) ; if ( tryStatement . catchArguments != null ) { for ( int i = <NUM_LIT:0> , max = tryStatement . catchBlocks . length ; i < max ; i ++ ) { if ( this . preferences . insert_new_line_before_catch_in_try_statement ) { this . scribe . printNewLine ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamecatch , this . preferences . insert_space_after_closing_brace_in_block ) ; final int line = this . scribe . line ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_catch ) ; if ( this . preferences . insert_space_after_opening_paren_in_catch ) { this . scribe . space ( ) ; } tryStatement . catchArguments [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_catch ) ; formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; tryStatement . catchBlocks [ i ] . traverse ( this , scope ) ; } } if ( tryStatement . finallyBlock != null ) { if ( this . preferences . insert_new_line_before_finally_in_try_statement ) { this . scribe . printNewLine ( ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNamefinally , this . preferences . insert_space_after_closing_brace_in_block ) ; tryStatement . finallyBlock . traverse ( this , scope ) ; } return false ; } private void formatMultiCatchArguments ( Argument argument , boolean spaceBeforePipe , boolean spaceAfterPipe , int multiCatchAlignment , BlockScope scope ) { UnionTypeReference unionType = ( UnionTypeReference ) argument . type ; int length = unionType . typeReferences != null ? unionType . typeReferences . length : <NUM_LIT:0> ; if ( length > <NUM_LIT:0> ) { Alignment argumentsAlignment = this . scribe . createAlignment ( Alignment . MULTI_CATCH , multiCatchAlignment , length , this . scribe . scanner . currentPosition ) ; this . scribe . enterAlignment ( argumentsAlignment ) ; boolean ok = false ; do { switch ( multiCatchAlignment & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : argumentsAlignment . startingColumn = this . scribe . column ; break ; } try { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) { if ( this . preferences . wrap_before_or_operator_multicatch ) { this . scribe . alignFragment ( argumentsAlignment , i ) ; } this . scribe . printNextToken ( TerminalTokens . TokenNameOR , spaceBeforePipe ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; if ( this . scribe . lastNumberOfNewLines == <NUM_LIT:1> ) { this . scribe . indentationLevel = argumentsAlignment . breakIndentationLevel ; } if ( ! this . preferences . wrap_before_or_operator_multicatch ) { this . scribe . alignFragment ( argumentsAlignment , i ) ; } } if ( i == <NUM_LIT:0> ) { this . scribe . alignFragment ( argumentsAlignment , i ) ; int fragmentIndentation = argumentsAlignment . fragmentIndentations [ <NUM_LIT:0> ] ; if ( ( argumentsAlignment . mode & Alignment . M_INDENT_ON_COLUMN ) != <NUM_LIT:0> && fragmentIndentation > <NUM_LIT:0> ) { this . scribe . indentationLevel = fragmentIndentation ; } } else if ( spaceAfterPipe ) { this . scribe . space ( ) ; } unionType . typeReferences [ i ] . traverse ( this , scope ) ; argumentsAlignment . startingColumn = - <NUM_LIT:1> ; } ok = true ; } catch ( AlignmentException e ) { this . scribe . redoAlignment ( e ) ; } } while ( ! ok ) ; this . scribe . exitAlignment ( argumentsAlignment , true ) ; } } public boolean visit ( TypeDeclaration localTypeDeclaration , BlockScope scope ) { format ( localTypeDeclaration ) ; return false ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { format ( memberTypeDeclaration ) ; return false ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { format ( typeDeclaration ) ; return false ; } public boolean visit ( TypeParameter typeParameter , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; if ( typeParameter . type != null ) { this . scribe . space ( ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameextends , true ) ; this . scribe . space ( ) ; typeParameter . type . traverse ( this , scope ) ; } final TypeReference [ ] bounds = typeParameter . bounds ; if ( bounds != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameAND , this . preferences . insert_space_before_and_in_type_parameter ) ; if ( this . preferences . insert_space_after_and_in_type_parameter ) { this . scribe . space ( ) ; } int boundsLength = bounds . length ; for ( int i = <NUM_LIT:0> ; i < boundsLength - <NUM_LIT:1> ; i ++ ) { bounds [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameAND , this . preferences . insert_space_before_and_in_type_parameter ) ; if ( this . preferences . insert_space_after_and_in_type_parameter ) { this . scribe . space ( ) ; } } bounds [ boundsLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; } return false ; } public boolean visit ( TypeParameter typeParameter , ClassScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameIdentifier ) ; if ( typeParameter . type != null ) { this . scribe . space ( ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameextends , true ) ; this . scribe . space ( ) ; typeParameter . type . traverse ( this , scope ) ; } final TypeReference [ ] bounds = typeParameter . bounds ; if ( bounds != null ) { this . scribe . printNextToken ( TerminalTokens . TokenNameAND , this . preferences . insert_space_before_and_in_type_parameter ) ; if ( this . preferences . insert_space_after_and_in_type_parameter ) { this . scribe . space ( ) ; } int boundsLength = bounds . length ; for ( int i = <NUM_LIT:0> ; i < boundsLength - <NUM_LIT:1> ; i ++ ) { bounds [ i ] . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameAND , this . preferences . insert_space_before_and_in_type_parameter ) ; if ( this . preferences . insert_space_after_and_in_type_parameter ) { this . scribe . space ( ) ; } } bounds [ boundsLength - <NUM_LIT:1> ] . traverse ( this , scope ) ; } return false ; } public boolean visit ( UnaryExpression unaryExpression , BlockScope scope ) { final int numberOfParens = ( unaryExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { manageOpeningParenthesizedExpression ( unaryExpression , numberOfParens ) ; } int operator ; int operatorValue = ( unaryExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT ; switch ( operatorValue ) { case OperatorIds . PLUS : operator = TerminalTokens . TokenNamePLUS ; break ; case OperatorIds . MINUS : operator = TerminalTokens . TokenNameMINUS ; break ; case OperatorIds . TWIDDLE : operator = TerminalTokens . TokenNameTWIDDLE ; break ; default : operator = TerminalTokens . TokenNameNOT ; } this . scribe . printNextToken ( operator , this . preferences . insert_space_before_unary_operator ) ; if ( this . preferences . insert_space_after_unary_operator ) { this . scribe . space ( ) ; } Expression expression = unaryExpression . expression ; if ( expression instanceof PrefixExpression ) { PrefixExpression prefixExpression = ( PrefixExpression ) expression ; final int numberOfParensForExpression = ( prefixExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParensForExpression == <NUM_LIT:0> ) { switch ( operatorValue ) { case OperatorIds . PLUS : if ( prefixExpression . operator == OperatorIds . PLUS ) { this . scribe . space ( ) ; } break ; case OperatorIds . MINUS : if ( prefixExpression . operator == OperatorIds . MINUS ) { this . scribe . space ( ) ; } break ; } } } else if ( expression instanceof UnaryExpression ) { UnaryExpression unaryExpression2 = ( UnaryExpression ) expression ; final int numberOfParensForExpression = ( unaryExpression2 . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParensForExpression == <NUM_LIT:0> ) { int operatorValue2 = ( unaryExpression2 . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT ; switch ( operatorValue ) { case OperatorIds . PLUS : if ( operatorValue2 == OperatorIds . PLUS ) { this . scribe . space ( ) ; } break ; case OperatorIds . MINUS : if ( operatorValue2 == OperatorIds . MINUS ) { this . scribe . space ( ) ; } break ; } } } expression . traverse ( this , scope ) ; if ( numberOfParens > <NUM_LIT:0> ) { manageClosingParenthesizedExpression ( unaryExpression , numberOfParens ) ; } return false ; } public boolean visit ( UnionTypeReference unionTypeReference , BlockScope scope ) { TypeReference [ ] typeReferences = unionTypeReference . typeReferences ; for ( int i = <NUM_LIT:0> , max = typeReferences . length ; i < max ; i ++ ) { if ( i != <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameOR , true ) ; this . scribe . space ( ) ; } typeReferences [ i ] . traverse ( this , scope ) ; } return false ; } public boolean visit ( UnionTypeReference unionTypeReference , ClassScope scope ) { TypeReference [ ] typeReferences = unionTypeReference . typeReferences ; for ( int i = <NUM_LIT:0> , max = typeReferences . length ; i < max ; i ++ ) { if ( i != <NUM_LIT:0> ) { this . scribe . printNextToken ( TerminalTokens . TokenNameOR , true ) ; this . scribe . space ( ) ; } typeReferences [ i ] . traverse ( this , scope ) ; } return false ; } public boolean visit ( WhileStatement whileStatement , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNamewhile ) ; final int line = this . scribe . line ; this . scribe . printNextToken ( TerminalTokens . TokenNameLPAREN , this . preferences . insert_space_before_opening_paren_in_while ) ; if ( this . preferences . insert_space_after_opening_paren_in_while ) { this . scribe . space ( ) ; } whileStatement . condition . traverse ( this , scope ) ; this . scribe . printNextToken ( TerminalTokens . TokenNameRPAREN , this . preferences . insert_space_before_closing_paren_in_while ) ; final Statement action = whileStatement . action ; if ( action != null ) { if ( action instanceof Block ) { formatLeftCurlyBrace ( line , this . preferences . brace_position_for_block ) ; action . traverse ( this , scope ) ; } else if ( action instanceof EmptyStatement ) { formatNecessaryEmptyStatement ( ) ; } else { this . scribe . printNewLine ( ) ; this . scribe . indent ( ) ; action . traverse ( this , scope ) ; if ( action instanceof Expression ) { this . scribe . printNextToken ( TerminalTokens . TokenNameSEMICOLON , this . preferences . insert_space_before_semicolon ) ; this . scribe . printComment ( CodeFormatter . K_UNKNOWN , Scribe . BASIC_TRAILING_COMMENT ) ; } this . scribe . unIndent ( ) ; } } else { formatNecessaryEmptyStatement ( ) ; } return false ; } public boolean visit ( Wildcard wildcard , BlockScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameQUESTION , this . preferences . insert_space_before_question_in_wilcard ) ; switch ( wildcard . kind ) { case Wildcard . SUPER : this . scribe . printNextToken ( TerminalTokens . TokenNamesuper , true ) ; this . scribe . space ( ) ; wildcard . bound . traverse ( this , scope ) ; break ; case Wildcard . EXTENDS : this . scribe . printNextToken ( TerminalTokens . TokenNameextends , true ) ; this . scribe . space ( ) ; wildcard . bound . traverse ( this , scope ) ; break ; case Wildcard . UNBOUND : if ( this . preferences . insert_space_after_question_in_wilcard ) { this . scribe . space ( ) ; } } return false ; } public boolean visit ( Wildcard wildcard , ClassScope scope ) { this . scribe . printNextToken ( TerminalTokens . TokenNameQUESTION , this . preferences . insert_space_before_question_in_wilcard ) ; switch ( wildcard . kind ) { case Wildcard . SUPER : this . scribe . printNextToken ( TerminalTokens . TokenNamesuper , true ) ; this . scribe . space ( ) ; wildcard . bound . traverse ( this , scope ) ; break ; case Wildcard . EXTENDS : this . scribe . printNextToken ( TerminalTokens . TokenNameextends , true ) ; this . scribe . space ( ) ; wildcard . bound . traverse ( this , scope ) ; break ; case Wildcard . UNBOUND : if ( this . preferences . insert_space_after_question_in_wilcard ) { this . scribe . space ( ) ; } } return false ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; public class Location { public int inputOffset ; public int inputColumn ; public int outputLine ; public int outputColumn ; public int outputIndentationLevel ; public boolean needSpace ; public boolean pendingSpace ; public int nlsTagCounter ; public int lastLocalDeclarationSourceStart ; public int numberOfIndentations ; public int lastNumberOfNewLines ; int editsIndex ; OptimizedReplaceEdit textEdit ; public Location ( Scribe scribe , int sourceRestart ) { update ( scribe , sourceRestart ) ; } public void update ( Scribe scribe , int sourceRestart ) { this . outputColumn = scribe . column ; this . outputLine = scribe . line ; this . inputOffset = sourceRestart ; this . inputColumn = scribe . getCurrentIndentation ( sourceRestart ) + <NUM_LIT:1> ; this . outputIndentationLevel = scribe . indentationLevel ; this . lastNumberOfNewLines = scribe . lastNumberOfNewLines ; this . needSpace = scribe . needSpace ; this . pendingSpace = scribe . pendingSpace ; this . editsIndex = scribe . editsIndex ; this . nlsTagCounter = scribe . nlsTagCounter ; this . numberOfIndentations = scribe . numberOfIndentations ; this . textEdit = scribe . getLastEdit ( ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" + this . outputColumn ) ; buffer . append ( "<STR_LIT>" + this . outputLine ) ; buffer . append ( "<STR_LIT>" + this . outputIndentationLevel ) ; buffer . append ( "<STR_LIT>" + this . inputOffset ) ; buffer . append ( "<STR_LIT>" + this . inputColumn ) ; buffer . append ( '<CHAR_LIT:)>' ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . ITerminalSymbols ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . core . formatter . CodeFormatter ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . util . CodeSnippetParsingUtil ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . Region ; import org . eclipse . text . edits . TextEdit ; public class DefaultCodeFormatter extends CodeFormatter { public static boolean DEBUG = false ; private static final int K_MASK = K_UNKNOWN | K_EXPRESSION | K_STATEMENTS | K_CLASS_BODY_DECLARATIONS | K_COMPILATION_UNIT | K_SINGLE_LINE_COMMENT | K_MULTI_LINE_COMMENT | K_JAVA_DOC ; private static Scanner PROBING_SCANNER ; private CodeSnippetParsingUtil codeSnippetParsingUtil ; private Map defaultCompilerOptions ; private CodeFormatterVisitor newCodeFormatter ; private Map options ; private DefaultCodeFormatterOptions preferences ; public DefaultCodeFormatter ( ) { this ( new DefaultCodeFormatterOptions ( DefaultCodeFormatterConstants . getJavaConventionsSettings ( ) ) , null ) ; } public DefaultCodeFormatter ( DefaultCodeFormatterOptions preferences ) { this ( preferences , null ) ; } public DefaultCodeFormatter ( DefaultCodeFormatterOptions defaultCodeFormatterOptions , Map options ) { if ( options != null ) { this . options = options ; this . preferences = new DefaultCodeFormatterOptions ( options ) ; } else { this . options = JavaCore . getOptions ( ) ; this . preferences = new DefaultCodeFormatterOptions ( DefaultCodeFormatterConstants . getJavaConventionsSettings ( ) ) ; } this . defaultCompilerOptions = getDefaultCompilerOptions ( ) ; if ( defaultCodeFormatterOptions != null ) { this . preferences . set ( defaultCodeFormatterOptions . getMap ( ) ) ; } } public DefaultCodeFormatter ( Map options ) { this ( null , options ) ; } public String createIndentationString ( final int indentationLevel ) { if ( indentationLevel < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } int tabs = <NUM_LIT:0> ; int spaces = <NUM_LIT:0> ; switch ( this . preferences . tab_char ) { case DefaultCodeFormatterOptions . SPACE : spaces = indentationLevel * this . preferences . tab_size ; break ; case DefaultCodeFormatterOptions . TAB : tabs = indentationLevel ; break ; case DefaultCodeFormatterOptions . MIXED : int tabSize = this . preferences . tab_size ; if ( tabSize != <NUM_LIT:0> ) { int spaceEquivalents = indentationLevel * this . preferences . indentation_size ; tabs = spaceEquivalents / tabSize ; spaces = spaceEquivalents % tabSize ; } break ; default : return Util . EMPTY_STRING ; } if ( tabs == <NUM_LIT:0> && spaces == <NUM_LIT:0> ) { return Util . EMPTY_STRING ; } StringBuffer buffer = new StringBuffer ( tabs + spaces ) ; for ( int i = <NUM_LIT:0> ; i < tabs ; i ++ ) { buffer . append ( '<STR_LIT:\t>' ) ; } for ( int i = <NUM_LIT:0> ; i < spaces ; i ++ ) { buffer . append ( '<CHAR_LIT:U+0020>' ) ; } return buffer . toString ( ) ; } public TextEdit format ( int kind , String source , int offset , int length , int indentationLevel , String lineSeparator ) { if ( offset < <NUM_LIT:0> || length < <NUM_LIT:0> || length > source . length ( ) ) { throw new IllegalArgumentException ( ) ; } switch ( kind & K_MASK ) { case K_JAVA_DOC : return formatComment ( kind & K_MASK , source , indentationLevel , lineSeparator , new IRegion [ ] { new Region ( offset , length ) } ) ; case K_MULTI_LINE_COMMENT : case K_SINGLE_LINE_COMMENT : return formatComment ( kind & K_MASK , source , indentationLevel , lineSeparator , new IRegion [ ] { new Region ( offset , length ) } ) ; } return format ( kind , source , new IRegion [ ] { new Region ( offset , length ) } , indentationLevel , lineSeparator ) ; } public TextEdit format ( int kind , String source , IRegion [ ] regions , int indentationLevel , String lineSeparator ) { if ( ! regionsSatisfiesPreconditions ( regions , source . length ( ) ) ) { throw new IllegalArgumentException ( ) ; } this . codeSnippetParsingUtil = new CodeSnippetParsingUtil ( ) ; boolean includeComments = ( kind & F_INCLUDE_COMMENTS ) != <NUM_LIT:0> ; switch ( kind & K_MASK ) { case K_CLASS_BODY_DECLARATIONS : return formatClassBodyDeclarations ( source , indentationLevel , lineSeparator , regions , includeComments ) ; case K_COMPILATION_UNIT : return formatCompilationUnit ( source , indentationLevel , lineSeparator , regions , includeComments ) ; case K_EXPRESSION : return formatExpression ( source , indentationLevel , lineSeparator , regions , includeComments ) ; case K_STATEMENTS : return formatStatements ( source , indentationLevel , lineSeparator , regions , includeComments ) ; case K_UNKNOWN : return probeFormatting ( source , indentationLevel , lineSeparator , regions , includeComments ) ; case K_JAVA_DOC : case K_MULTI_LINE_COMMENT : case K_SINGLE_LINE_COMMENT : throw new IllegalArgumentException ( ) ; } return null ; } private TextEdit formatClassBodyDeclarations ( String source , int indentationLevel , String lineSeparator , IRegion [ ] regions , boolean includeComments ) { ASTNode [ ] bodyDeclarations = this . codeSnippetParsingUtil . parseClassBodyDeclarations ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true ) ; if ( bodyDeclarations == null ) { return null ; } return internalFormatClassBodyDeclarations ( source , indentationLevel , lineSeparator , bodyDeclarations , regions , includeComments ) ; } private TextEdit formatComment ( int kind , String source , int indentationLevel , String lineSeparator , IRegion [ ] regions ) { Object oldOption = oldCommentFormatOption ( ) ; boolean isFormattingComments = false ; if ( oldOption == null ) { switch ( kind & K_MASK ) { case K_SINGLE_LINE_COMMENT : isFormattingComments = DefaultCodeFormatterConstants . TRUE . equals ( this . options . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_LINE_COMMENT ) ) ; break ; case K_MULTI_LINE_COMMENT : isFormattingComments = DefaultCodeFormatterConstants . TRUE . equals ( this . options . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT ) ) ; break ; case K_JAVA_DOC : isFormattingComments = DefaultCodeFormatterConstants . TRUE . equals ( this . options . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT ) ) ; } } else { isFormattingComments = DefaultCodeFormatterConstants . TRUE . equals ( oldOption ) ; } if ( isFormattingComments ) { if ( lineSeparator != null ) { this . preferences . line_separator = lineSeparator ; } else { this . preferences . line_separator = Util . LINE_SEPARATOR ; } this . preferences . initial_indentation_level = indentationLevel ; if ( this . codeSnippetParsingUtil == null ) this . codeSnippetParsingUtil = new CodeSnippetParsingUtil ( ) ; this . codeSnippetParsingUtil . parseCompilationUnit ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true ) ; this . newCodeFormatter = new CodeFormatterVisitor ( this . preferences , this . options , regions , this . codeSnippetParsingUtil , true ) ; IRegion coveredRegion = getCoveredRegion ( regions ) ; int start = coveredRegion . getOffset ( ) ; int end = start + coveredRegion . getLength ( ) ; this . newCodeFormatter . formatComment ( kind , source , start , end , indentationLevel ) ; return this . newCodeFormatter . scribe . getRootEdit ( ) ; } return null ; } private TextEdit formatCompilationUnit ( String source , int indentationLevel , String lineSeparator , IRegion [ ] regions , boolean includeComments ) { CompilationUnitDeclaration compilationUnitDeclaration = this . codeSnippetParsingUtil . parseCompilationUnit ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true ) ; if ( lineSeparator != null ) { this . preferences . line_separator = lineSeparator ; } else { this . preferences . line_separator = Util . LINE_SEPARATOR ; } this . preferences . initial_indentation_level = indentationLevel ; this . newCodeFormatter = new CodeFormatterVisitor ( this . preferences , this . options , regions , this . codeSnippetParsingUtil , includeComments ) ; return this . newCodeFormatter . format ( source , compilationUnitDeclaration ) ; } private TextEdit formatExpression ( String source , int indentationLevel , String lineSeparator , IRegion [ ] regions , boolean includeComments ) { Expression expression = this . codeSnippetParsingUtil . parseExpression ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true ) ; if ( expression == null ) { return null ; } return internalFormatExpression ( source , indentationLevel , lineSeparator , expression , regions , includeComments ) ; } private TextEdit formatStatements ( String source , int indentationLevel , String lineSeparator , IRegion [ ] regions , boolean includeComments ) { ConstructorDeclaration constructorDeclaration = this . codeSnippetParsingUtil . parseStatements ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true , false ) ; if ( constructorDeclaration . statements == null ) { return null ; } return internalFormatStatements ( source , indentationLevel , lineSeparator , constructorDeclaration , regions , includeComments ) ; } private IRegion getCoveredRegion ( IRegion [ ] regions ) { int length = regions . length ; if ( length == <NUM_LIT:1> ) { return regions [ <NUM_LIT:0> ] ; } int offset = regions [ <NUM_LIT:0> ] . getOffset ( ) ; IRegion lastRegion = regions [ length - <NUM_LIT:1> ] ; return new Region ( offset , lastRegion . getOffset ( ) + lastRegion . getLength ( ) - offset ) ; } public String getDebugOutput ( ) { return this . newCodeFormatter . scribe . toString ( ) ; } private Map getDefaultCompilerOptions ( ) { if ( this . defaultCompilerOptions == null ) { Map optionsMap = new HashMap ( <NUM_LIT:30> ) ; optionsMap . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . DO_NOT_GENERATE ) ; optionsMap . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . DO_NOT_GENERATE ) ; optionsMap . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . DO_NOT_GENERATE ) ; optionsMap . put ( CompilerOptions . OPTION_PreserveUnusedLocal , CompilerOptions . PRESERVE ) ; optionsMap . put ( CompilerOptions . OPTION_DocCommentSupport , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMethodWithConstructorName , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportOverridingPackageDefaultMethod , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportOverridingMethodWithoutSuperInvocation , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportHiddenCatchBlock , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedLocal , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedObjectAllocation , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedParameter , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedImport , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportSyntheticAccessEmulation , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportNoEffectAssignment , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportNonExternalizedStringLiteral , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportNoImplicitStringConversion , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportNonStaticAccessToStatic , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportIndirectStaticAccess , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportIncompatibleNonInheritedInterfaceMethod , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedPrivateMember , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportLocalVariableHiding , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportFieldHiding , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportPossibleAccidentalBooleanAssignment , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportEmptyStatement , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportAssertIdentifier , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportEnumIdentifier , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUndocumentedEmptyBlock , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnnecessaryTypeCheck , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportInvalidJavadoc , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportInvalidJavadocTagsVisibility , CompilerOptions . PUBLIC ) ; optionsMap . put ( CompilerOptions . OPTION_ReportInvalidJavadocTags , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocTagDescription , CompilerOptions . RETURN_TAG ) ; optionsMap . put ( CompilerOptions . OPTION_ReportInvalidJavadocTagsDeprecatedRef , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportInvalidJavadocTagsNotVisibleRef , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocTags , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocTagsVisibility , CompilerOptions . PUBLIC ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocTagsOverriding , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocComments , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocCommentsVisibility , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMissingJavadocCommentsOverriding , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportFinallyBlockNotCompletingNormally , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedDeclaredThrownException , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnqualifiedFieldAccess , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_4 ) ; optionsMap . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_2 ) ; optionsMap . put ( CompilerOptions . OPTION_TaskTags , Util . EMPTY_STRING ) ; optionsMap . put ( CompilerOptions . OPTION_TaskPriorities , Util . EMPTY_STRING ) ; optionsMap . put ( CompilerOptions . OPTION_TaskCaseSensitive , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedParameterWhenImplementingAbstract , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnusedParameterWhenOverridingConcrete , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportSpecialParameterHidingField , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportUnavoidableGenericTypeProblems , CompilerOptions . ENABLED ) ; optionsMap . put ( CompilerOptions . OPTION_MaxProblemPerUnit , String . valueOf ( <NUM_LIT:100> ) ) ; optionsMap . put ( CompilerOptions . OPTION_InlineJsr , CompilerOptions . DISABLED ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMethodCanBeStatic , CompilerOptions . IGNORE ) ; optionsMap . put ( CompilerOptions . OPTION_ReportMethodCanBePotentiallyStatic , CompilerOptions . IGNORE ) ; this . defaultCompilerOptions = optionsMap ; } Object sourceOption = this . options . get ( CompilerOptions . OPTION_Source ) ; if ( sourceOption != null ) { this . defaultCompilerOptions . put ( CompilerOptions . OPTION_Source , sourceOption ) ; } else { this . defaultCompilerOptions . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_3 ) ; } return this . defaultCompilerOptions ; } private TextEdit internalFormatClassBodyDeclarations ( String source , int indentationLevel , String lineSeparator , ASTNode [ ] bodyDeclarations , IRegion [ ] regions , boolean includeComments ) { if ( lineSeparator != null ) { this . preferences . line_separator = lineSeparator ; } else { this . preferences . line_separator = Util . LINE_SEPARATOR ; } this . preferences . initial_indentation_level = indentationLevel ; this . newCodeFormatter = new CodeFormatterVisitor ( this . preferences , this . options , regions , this . codeSnippetParsingUtil , includeComments ) ; return this . newCodeFormatter . format ( source , bodyDeclarations ) ; } private TextEdit internalFormatExpression ( String source , int indentationLevel , String lineSeparator , Expression expression , IRegion [ ] regions , boolean includeComments ) { if ( lineSeparator != null ) { this . preferences . line_separator = lineSeparator ; } else { this . preferences . line_separator = Util . LINE_SEPARATOR ; } this . preferences . initial_indentation_level = indentationLevel ; this . newCodeFormatter = new CodeFormatterVisitor ( this . preferences , this . options , regions , this . codeSnippetParsingUtil , includeComments ) ; TextEdit textEdit = this . newCodeFormatter . format ( source , expression ) ; return textEdit ; } private TextEdit internalFormatStatements ( String source , int indentationLevel , String lineSeparator , ConstructorDeclaration constructorDeclaration , IRegion [ ] regions , boolean includeComments ) { if ( lineSeparator != null ) { this . preferences . line_separator = lineSeparator ; } else { this . preferences . line_separator = Util . LINE_SEPARATOR ; } this . preferences . initial_indentation_level = indentationLevel ; this . newCodeFormatter = new CodeFormatterVisitor ( this . preferences , this . options , regions , this . codeSnippetParsingUtil , includeComments ) ; return this . newCodeFormatter . format ( source , constructorDeclaration ) ; } private Object oldCommentFormatOption ( ) { return this . options . get ( DefaultCodeFormatterConstants . FORMATTER_COMMENT_FORMAT ) ; } private TextEdit probeFormatting ( String source , int indentationLevel , String lineSeparator , IRegion [ ] regions , boolean includeComments ) { if ( PROBING_SCANNER == null ) { PROBING_SCANNER = new Scanner ( true , false , false , ClassFileConstants . JDK1_6 , ClassFileConstants . JDK1_6 , null , null , true ) ; } PROBING_SCANNER . setSource ( source . toCharArray ( ) ) ; IRegion coveredRegion = getCoveredRegion ( regions ) ; int offset = coveredRegion . getOffset ( ) ; int length = coveredRegion . getLength ( ) ; PROBING_SCANNER . resetTo ( offset , offset + length - <NUM_LIT:1> ) ; try { int kind = - <NUM_LIT:1> ; switch ( PROBING_SCANNER . getNextToken ( ) ) { case ITerminalSymbols . TokenNameCOMMENT_BLOCK : if ( PROBING_SCANNER . getNextToken ( ) == TerminalTokens . TokenNameEOF ) { kind = K_MULTI_LINE_COMMENT ; } break ; case ITerminalSymbols . TokenNameCOMMENT_LINE : if ( PROBING_SCANNER . getNextToken ( ) == TerminalTokens . TokenNameEOF ) { kind = K_SINGLE_LINE_COMMENT ; } break ; case ITerminalSymbols . TokenNameCOMMENT_JAVADOC : if ( PROBING_SCANNER . getNextToken ( ) == TerminalTokens . TokenNameEOF ) { kind = K_JAVA_DOC ; } break ; } if ( kind != - <NUM_LIT:1> ) { return formatComment ( kind , source , indentationLevel , lineSeparator , regions ) ; } } catch ( InvalidInputException e ) { } PROBING_SCANNER . setSource ( ( char [ ] ) null ) ; Expression expression = this . codeSnippetParsingUtil . parseExpression ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true ) ; if ( expression != null ) { return internalFormatExpression ( source , indentationLevel , lineSeparator , expression , regions , includeComments ) ; } ASTNode [ ] bodyDeclarations = this . codeSnippetParsingUtil . parseClassBodyDeclarations ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true ) ; if ( bodyDeclarations != null ) { return internalFormatClassBodyDeclarations ( source , indentationLevel , lineSeparator , bodyDeclarations , regions , includeComments ) ; } ConstructorDeclaration constructorDeclaration = this . codeSnippetParsingUtil . parseStatements ( source . toCharArray ( ) , getDefaultCompilerOptions ( ) , true , false ) ; if ( constructorDeclaration . statements != null ) { return internalFormatStatements ( source , indentationLevel , lineSeparator , constructorDeclaration , regions , includeComments ) ; } return formatCompilationUnit ( source , indentationLevel , lineSeparator , regions , includeComments ) ; } private boolean regionsSatisfiesPreconditions ( IRegion [ ] regions , int maxLength ) { int regionsLength = regions == null ? <NUM_LIT:0> : regions . length ; if ( regionsLength == <NUM_LIT:0> ) { return false ; } IRegion first = regions [ <NUM_LIT:0> ] ; if ( first . getOffset ( ) < <NUM_LIT:0> || first . getLength ( ) < <NUM_LIT:0> || first . getOffset ( ) + first . getLength ( ) > maxLength ) { return false ; } int lastOffset = first . getOffset ( ) + first . getLength ( ) - <NUM_LIT:1> ; for ( int i = <NUM_LIT:1> ; i < regionsLength ; i ++ ) { IRegion current = regions [ i ] ; if ( lastOffset > current . getOffset ( ) ) { return false ; } if ( current . getOffset ( ) < <NUM_LIT:0> || current . getLength ( ) < <NUM_LIT:0> || current . getOffset ( ) + current . getLength ( ) > maxLength ) { return false ; } lastOffset = current . getOffset ( ) + current . getLength ( ) - <NUM_LIT:1> ; } return true ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; public class OptimizedReplaceEdit { int offset ; int length ; String replacement ; public OptimizedReplaceEdit ( int offset , int length , String replacement ) { this . offset = offset ; this . length = length ; this . replacement = replacement ; } public String toString ( ) { return ( this . offset < <NUM_LIT:0> ? "<STR_LIT:(>" : "<STR_LIT>" ) + this . offset + "<STR_LIT>" + this . length + "<STR_LIT>" + this . replacement + "<STR_LIT:<>" ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . util . ArrayList ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . AND_AND_Expression ; import org . eclipse . jdt . internal . compiler . ast . AllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . ArrayAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ; import org . eclipse . jdt . internal . compiler . ast . ArrayQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ArrayReference ; import org . eclipse . jdt . internal . compiler . ast . ArrayTypeReference ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . BinaryExpression ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . CharLiteral ; import org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ; import org . eclipse . jdt . internal . compiler . ast . CombinedBinaryExpression ; import org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ; import org . eclipse . jdt . internal . compiler . ast . ConditionalExpression ; import org . eclipse . jdt . internal . compiler . ast . DoubleLiteral ; import org . eclipse . jdt . internal . compiler . ast . EqualExpression ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . ExtendedStringLiteral ; import org . eclipse . jdt . internal . compiler . ast . FalseLiteral ; import org . eclipse . jdt . internal . compiler . ast . FieldReference ; import org . eclipse . jdt . internal . compiler . ast . FloatLiteral ; import org . eclipse . jdt . internal . compiler . ast . InstanceOfExpression ; import org . eclipse . jdt . internal . compiler . ast . IntLiteral ; import org . eclipse . jdt . internal . compiler . ast . LongLiteral ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . StringLiteralConcatenation ; import org . eclipse . jdt . internal . compiler . ast . NullLiteral ; import org . eclipse . jdt . internal . compiler . ast . OR_OR_Expression ; import org . eclipse . jdt . internal . compiler . ast . OperatorIds ; import org . eclipse . jdt . internal . compiler . ast . PostfixExpression ; import org . eclipse . jdt . internal . compiler . ast . PrefixExpression ; import org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedThisReference ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . StringLiteral ; import org . eclipse . jdt . internal . compiler . ast . SuperReference ; import org . eclipse . jdt . internal . compiler . ast . ThisReference ; import org . eclipse . jdt . internal . compiler . ast . TrueLiteral ; import org . eclipse . jdt . internal . compiler . ast . UnaryExpression ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; class BinaryExpressionFragmentBuilder extends ASTVisitor { ArrayList fragmentsList ; ArrayList operatorsList ; private int realFragmentsSize ; BinaryExpressionFragmentBuilder ( ) { this . fragmentsList = new ArrayList ( ) ; this . operatorsList = new ArrayList ( ) ; this . realFragmentsSize = <NUM_LIT:0> ; } private final void addRealFragment ( ASTNode node ) { this . fragmentsList . add ( node ) ; this . realFragmentsSize ++ ; } private final void addSmallFragment ( ASTNode node ) { this . fragmentsList . add ( node ) ; } private boolean buildFragments ( Expression expression ) { if ( ( ( expression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ) != <NUM_LIT:0> ) { addRealFragment ( expression ) ; return false ; } return true ; } public ASTNode [ ] fragments ( ) { ASTNode [ ] fragments = new ASTNode [ this . fragmentsList . size ( ) ] ; this . fragmentsList . toArray ( fragments ) ; return fragments ; } public int [ ] operators ( ) { int length = this . operatorsList . size ( ) ; int [ ] tab = new int [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { tab [ i ] = ( ( Integer ) this . operatorsList . get ( i ) ) . intValue ( ) ; } return tab ; } public int realFragmentsSize ( ) { return this . realFragmentsSize ; } public boolean visit ( AllocationExpression allocationExpression , BlockScope scope ) { addRealFragment ( allocationExpression ) ; return false ; } public boolean visit ( AND_AND_Expression and_and_Expression , BlockScope scope ) { if ( ( ( and_and_Expression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ) != <NUM_LIT:0> ) { addRealFragment ( and_and_Expression ) ; } else { and_and_Expression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameAND_AND ) ) ; and_and_Expression . right . traverse ( this , scope ) ; } return false ; } public boolean visit ( ArrayAllocationExpression arrayAllocationExpression , BlockScope scope ) { addRealFragment ( arrayAllocationExpression ) ; return false ; } public boolean visit ( ArrayInitializer arrayInitializer , BlockScope scope ) { addRealFragment ( arrayInitializer ) ; return false ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , BlockScope scope ) { addRealFragment ( arrayQualifiedTypeReference ) ; return false ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , ClassScope scope ) { addRealFragment ( arrayQualifiedTypeReference ) ; return false ; } public boolean visit ( ArrayReference arrayReference , BlockScope scope ) { addRealFragment ( arrayReference ) ; return false ; } public boolean visit ( ArrayTypeReference arrayTypeReference , BlockScope scope ) { addRealFragment ( arrayTypeReference ) ; return false ; } public boolean visit ( ArrayTypeReference arrayTypeReference , ClassScope scope ) { addRealFragment ( arrayTypeReference ) ; return false ; } public boolean visit ( Assignment assignment , BlockScope scope ) { addRealFragment ( assignment ) ; return false ; } public boolean visit ( BinaryExpression binaryExpression , BlockScope scope ) { if ( binaryExpression instanceof CombinedBinaryExpression ) { CombinedBinaryExpression expression = ( CombinedBinaryExpression ) binaryExpression ; if ( expression . referencesTable != null ) { return this . visit ( expression , scope ) ; } } final int numberOfParens = ( binaryExpression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ; if ( numberOfParens > <NUM_LIT:0> ) { addRealFragment ( binaryExpression ) ; } else { switch ( ( binaryExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT ) { case OperatorIds . PLUS : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNamePLUS ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . MINUS : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameMINUS ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . MULTIPLY : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameMULTIPLY ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . REMAINDER : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameREMAINDER ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . XOR : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameXOR ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . DIVIDE : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameDIVIDE ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . OR : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameOR ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; case OperatorIds . AND : if ( buildFragments ( binaryExpression ) ) { binaryExpression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameAND ) ) ; binaryExpression . right . traverse ( this , scope ) ; } return false ; default : addRealFragment ( binaryExpression ) ; } } return false ; } public boolean visit ( CombinedBinaryExpression combinedBinaryExpression , BlockScope scope ) { if ( combinedBinaryExpression . referencesTable == null ) { addRealFragment ( combinedBinaryExpression . left ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNamePLUS ) ) ; addRealFragment ( combinedBinaryExpression . right ) ; return false ; } BinaryExpression cursor = combinedBinaryExpression . referencesTable [ <NUM_LIT:0> ] ; if ( cursor . left instanceof CombinedBinaryExpression ) { this . visit ( ( CombinedBinaryExpression ) cursor . left , scope ) ; } else { addRealFragment ( cursor . left ) ; } for ( int i = <NUM_LIT:0> , end = combinedBinaryExpression . arity ; i < end ; i ++ ) { this . operatorsList . add ( new Integer ( TerminalTokens . TokenNamePLUS ) ) ; addRealFragment ( combinedBinaryExpression . referencesTable [ i ] . right ) ; } this . operatorsList . add ( new Integer ( TerminalTokens . TokenNamePLUS ) ) ; addRealFragment ( combinedBinaryExpression . right ) ; return false ; } public boolean visit ( CastExpression castExpression , BlockScope scope ) { addRealFragment ( castExpression ) ; return false ; } public boolean visit ( CharLiteral charLiteral , BlockScope scope ) { addSmallFragment ( charLiteral ) ; return false ; } public boolean visit ( ClassLiteralAccess classLiteralAccess , BlockScope scope ) { addRealFragment ( classLiteralAccess ) ; return false ; } public boolean visit ( CompoundAssignment compoundAssignment , BlockScope scope ) { addRealFragment ( compoundAssignment ) ; return false ; } public boolean visit ( ConditionalExpression conditionalExpression , BlockScope scope ) { addRealFragment ( conditionalExpression ) ; return false ; } public boolean visit ( DoubleLiteral doubleLiteral , BlockScope scope ) { addSmallFragment ( doubleLiteral ) ; return false ; } public boolean visit ( EqualExpression equalExpression , BlockScope scope ) { addRealFragment ( equalExpression ) ; return false ; } public boolean visit ( ExtendedStringLiteral extendedStringLiteral , BlockScope scope ) { addRealFragment ( extendedStringLiteral ) ; return false ; } public boolean visit ( FalseLiteral falseLiteral , BlockScope scope ) { addSmallFragment ( falseLiteral ) ; return false ; } public boolean visit ( FieldReference fieldReference , BlockScope scope ) { addRealFragment ( fieldReference ) ; return false ; } public boolean visit ( FloatLiteral floatLiteral , BlockScope scope ) { addSmallFragment ( floatLiteral ) ; return false ; } public boolean visit ( InstanceOfExpression instanceOfExpression , BlockScope scope ) { addRealFragment ( instanceOfExpression ) ; return false ; } public boolean visit ( IntLiteral intLiteral , BlockScope scope ) { addSmallFragment ( intLiteral ) ; return false ; } public boolean visit ( LongLiteral longLiteral , BlockScope scope ) { addSmallFragment ( longLiteral ) ; return false ; } public boolean visit ( MessageSend messageSend , BlockScope scope ) { addRealFragment ( messageSend ) ; return false ; } public boolean visit ( StringLiteralConcatenation stringLiteral , BlockScope scope ) { if ( ( ( stringLiteral . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ) != <NUM_LIT:0> ) { addRealFragment ( stringLiteral ) ; } else { for ( int i = <NUM_LIT:0> , max = stringLiteral . counter ; i < max ; i ++ ) { addRealFragment ( stringLiteral . literals [ i ] ) ; if ( i < max - <NUM_LIT:1> ) { this . operatorsList . add ( new Integer ( TerminalTokens . TokenNamePLUS ) ) ; } } } return false ; } public boolean visit ( NullLiteral nullLiteral , BlockScope scope ) { addRealFragment ( nullLiteral ) ; return false ; } public boolean visit ( OR_OR_Expression or_or_Expression , BlockScope scope ) { if ( ( ( or_or_Expression . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT ) != <NUM_LIT:0> ) { addRealFragment ( or_or_Expression ) ; } else { or_or_Expression . left . traverse ( this , scope ) ; this . operatorsList . add ( new Integer ( TerminalTokens . TokenNameOR_OR ) ) ; or_or_Expression . right . traverse ( this , scope ) ; } return false ; } public boolean visit ( PostfixExpression postfixExpression , BlockScope scope ) { addRealFragment ( postfixExpression ) ; return false ; } public boolean visit ( PrefixExpression prefixExpression , BlockScope scope ) { addRealFragment ( prefixExpression ) ; return false ; } public boolean visit ( QualifiedAllocationExpression qualifiedAllocationExpression , BlockScope scope ) { addRealFragment ( qualifiedAllocationExpression ) ; return false ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , BlockScope scope ) { addRealFragment ( qualifiedNameReference ) ; return false ; } public boolean visit ( QualifiedSuperReference qualifiedSuperReference , BlockScope scope ) { addRealFragment ( qualifiedSuperReference ) ; return false ; } public boolean visit ( QualifiedThisReference qualifiedThisReference , BlockScope scope ) { addRealFragment ( qualifiedThisReference ) ; return false ; } public boolean visit ( SingleNameReference singleNameReference , BlockScope scope ) { addRealFragment ( singleNameReference ) ; return false ; } public boolean visit ( StringLiteral stringLiteral , BlockScope scope ) { addRealFragment ( stringLiteral ) ; return false ; } public boolean visit ( SuperReference superReference , BlockScope scope ) { addRealFragment ( superReference ) ; return false ; } public boolean visit ( ThisReference thisReference , BlockScope scope ) { addRealFragment ( thisReference ) ; return false ; } public boolean visit ( TrueLiteral trueLiteral , BlockScope scope ) { addSmallFragment ( trueLiteral ) ; return false ; } public boolean visit ( UnaryExpression unaryExpression , BlockScope scope ) { addRealFragment ( unaryExpression ) ; return false ; } public int size ( ) { return this . fragmentsList . size ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . util . List ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . parser . JavadocParser ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . formatter . comment . IJavaDocTagConstants ; public class FormatterCommentParser extends JavadocParser implements IJavaDocTagConstants { char [ ] [ ] htmlTags ; int htmlTagsPtr = - <NUM_LIT:1> ; int inlineHtmlTagsPtr = - <NUM_LIT:1> ; private boolean invalidTagName ; public boolean parseHtmlTags ; public FormatterCommentParser ( long sourceLevel ) { super ( null ) ; this . kind = FORMATTER_COMMENT_PARSER | TEXT_PARSE ; this . reportProblems = false ; this . checkDocComment = true ; this . sourceLevel = sourceLevel ; } public boolean parse ( int start , int end ) { this . javadocStart = start ; this . javadocEnd = end ; this . firstTagPosition = this . javadocStart ; this . htmlTagsPtr = - <NUM_LIT:1> ; boolean valid = commentParse ( ) ; return valid && this . docComment != null ; } protected Object createArgumentReference ( char [ ] name , int dim , boolean isVarargs , Object ref , long [ ] dimPositions , long argNamePos ) throws InvalidInputException { FormatJavadocReference typeRef = ( FormatJavadocReference ) ref ; if ( dim > <NUM_LIT:0> ) { typeRef . sourceEnd = ( int ) dimPositions [ dim - <NUM_LIT:1> ] ; } if ( argNamePos >= <NUM_LIT:0> ) typeRef . sourceEnd = ( int ) argNamePos ; return ref ; } protected boolean createFakeReference ( int start ) { this . scanner . currentPosition = this . index ; int lineStart = this . scanner . getLineNumber ( start ) ; FormatJavadocReference reference = new FormatJavadocReference ( start , this . index - <NUM_LIT:1> , lineStart ) ; return pushSeeRef ( reference ) ; } protected Object createFieldReference ( Object receiver ) throws InvalidInputException { int start = receiver == null ? this . memberStart : ( ( FormatJavadocReference ) receiver ) . sourceStart ; int lineStart = this . scanner . getLineNumber ( start ) ; return new FormatJavadocReference ( start , ( int ) this . identifierPositionStack [ <NUM_LIT:0> ] , lineStart ) ; } protected Object createMethodReference ( Object receiver , List arguments ) throws InvalidInputException { int start = receiver == null ? this . memberStart : ( ( FormatJavadocReference ) receiver ) . sourceStart ; int lineStart = this . scanner . getLineNumber ( start ) ; return new FormatJavadocReference ( start , this . scanner . getCurrentTokenEndPosition ( ) , lineStart ) ; } protected void createTag ( ) { int lineStart = this . scanner . getLineNumber ( this . tagSourceStart ) ; if ( this . inlineTagStarted ) { FormatJavadocBlock block = new FormatJavadocBlock ( this . inlineTagStart , this . tagSourceEnd , lineStart , this . tagValue ) ; FormatJavadocBlock previousBlock = null ; if ( this . astPtr == - <NUM_LIT:1> ) { previousBlock = new FormatJavadocBlock ( this . inlineTagStart , this . tagSourceEnd , lineStart , NO_TAG_VALUE ) ; pushOnAstStack ( previousBlock , true ) ; } else { previousBlock = ( FormatJavadocBlock ) this . astStack [ this . astPtr ] ; } previousBlock . addBlock ( block , this . htmlTagsPtr == - <NUM_LIT:1> ? <NUM_LIT:0> : this . htmlTagsPtr ) ; } else { FormatJavadocBlock block = new FormatJavadocBlock ( this . tagSourceStart , this . tagSourceEnd , lineStart , this . tagValue ) ; pushOnAstStack ( block , true ) ; } } protected Object createTypeReference ( int primitiveToken ) { int size = this . identifierLengthStack [ this . identifierLengthPtr ] ; if ( size == <NUM_LIT:0> ) return null ; int start = ( int ) ( this . identifierPositionStack [ this . identifierPtr ] > > > <NUM_LIT:32> ) ; int lineStart = this . scanner . getLineNumber ( start ) ; if ( size == <NUM_LIT:1> ) { return new FormatJavadocReference ( this . identifierPositionStack [ this . identifierPtr ] , lineStart ) ; } long [ ] positions = new long [ size ] ; System . arraycopy ( this . identifierPositionStack , this . identifierPtr - size + <NUM_LIT:1> , positions , <NUM_LIT:0> , size ) ; return new FormatJavadocReference ( ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) , ( int ) positions [ positions . length - <NUM_LIT:1> ] , lineStart ) ; } private int getHtmlTagIndex ( char [ ] htmlTag ) { int length = htmlTag == null ? <NUM_LIT:0> : htmlTag . length ; int tagId = <NUM_LIT:0> ; if ( length > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> , max = JAVADOC_SINGLE_BREAK_TAG . length ; i < max ; i ++ ) { char [ ] tag = JAVADOC_SINGLE_BREAK_TAG [ i ] ; if ( length == tag . length && CharOperation . equals ( htmlTag , tag , false ) ) { return ( tagId | JAVADOC_SINGLE_BREAK_TAG_ID ) + i ; } } for ( int i = <NUM_LIT:0> , max = JAVADOC_CODE_TAGS . length ; i < max ; i ++ ) { char [ ] tag = JAVADOC_CODE_TAGS [ i ] ; if ( length == tag . length && CharOperation . equals ( htmlTag , tag , false ) ) { return ( tagId | JAVADOC_CODE_TAGS_ID ) + i ; } } for ( int i = <NUM_LIT:0> , max = JAVADOC_BREAK_TAGS . length ; i < max ; i ++ ) { char [ ] tag = JAVADOC_BREAK_TAGS [ i ] ; if ( length == tag . length && CharOperation . equals ( htmlTag , tag , false ) ) { return ( tagId | JAVADOC_BREAK_TAGS_ID ) + i ; } } for ( int i = <NUM_LIT:0> , max = JAVADOC_IMMUTABLE_TAGS . length ; i < max ; i ++ ) { char [ ] tag = JAVADOC_IMMUTABLE_TAGS [ i ] ; if ( length == tag . length && CharOperation . equals ( htmlTag , tag , false ) ) { return ( tagId | JAVADOC_IMMUTABLE_TAGS_ID ) + i ; } } for ( int i = <NUM_LIT:0> , max = JAVADOC_SEPARATOR_TAGS . length ; i < max ; i ++ ) { char [ ] tag = JAVADOC_SEPARATOR_TAGS [ i ] ; if ( length == tag . length && CharOperation . equals ( htmlTag , tag , false ) ) { return ( tagId | JAVADOC_SEPARATOR_TAGS_ID ) + i ; } } } return JAVADOC_TAGS_ID_MASK ; } protected boolean parseHtmlTag ( int previousPosition , int endTextPosition ) throws InvalidInputException { if ( ! this . parseHtmlTags ) return false ; boolean closing = false ; boolean valid = false ; boolean incremented = false ; int start = this . scanner . currentPosition ; int currentPosition = start ; int htmlPtr = this . htmlTagsPtr ; char firstChar = peekChar ( ) ; boolean hasWhitespaces = firstChar == '<CHAR_LIT:U+0020>' || ScannerHelper . isWhitespace ( firstChar ) ; try { int token = readTokenAndConsume ( ) ; char [ ] htmlTag ; int htmlIndex ; switch ( token ) { case TerminalTokens . TokenNameIdentifier : htmlTag = this . scanner . getCurrentIdentifierSource ( ) ; htmlIndex = getHtmlTagIndex ( htmlTag ) ; if ( htmlIndex == JAVADOC_TAGS_ID_MASK ) return false ; if ( htmlPtr >= <NUM_LIT:0> ) { int lastHtmlTagIndex = getHtmlTagIndex ( this . htmlTags [ htmlPtr ] ) ; if ( ( lastHtmlTagIndex & JAVADOC_TAGS_ID_MASK ) == JAVADOC_IMMUTABLE_TAGS_ID ) { if ( ( htmlIndex & JAVADOC_TAGS_ID_MASK ) == JAVADOC_CODE_TAGS_ID ) { FormatJavadocBlock previousBlock = ( FormatJavadocBlock ) this . astStack [ this . astPtr ] ; FormatJavadocNode parentNode = previousBlock ; FormatJavadocNode lastNode = parentNode ; while ( lastNode . getLastNode ( ) != null ) { parentNode = lastNode ; lastNode = lastNode . getLastNode ( ) ; } if ( lastNode . isText ( ) ) { FormatJavadocText text = ( FormatJavadocText ) lastNode ; if ( text . separatorsPtr == - <NUM_LIT:1> ) { break ; } } } return false ; } } if ( ( htmlIndex & JAVADOC_TAGS_ID_MASK ) > JAVADOC_SINGLE_TAGS_ID ) { if ( this . htmlTagsPtr == - <NUM_LIT:1> || ! CharOperation . equals ( this . htmlTags [ this . htmlTagsPtr ] , htmlTag , false ) ) { if ( ++ this . htmlTagsPtr == <NUM_LIT:0> ) { this . htmlTags = new char [ AST_STACK_INCREMENT ] [ ] ; } else { if ( this . htmlTagsPtr == this . htmlTags . length ) { System . arraycopy ( this . htmlTags , <NUM_LIT:0> , ( this . htmlTags = new char [ this . htmlTags . length + AST_STACK_INCREMENT ] [ ] ) , <NUM_LIT:0> , this . htmlTagsPtr ) ; } } this . htmlTags [ this . htmlTagsPtr ] = htmlTag ; incremented = true ; } } currentPosition = this . scanner . currentPosition ; if ( readToken ( ) == TerminalTokens . TokenNameDIVIDE ) { consumeToken ( ) ; } break ; case TerminalTokens . TokenNameDIVIDE : if ( this . htmlTagsPtr == - <NUM_LIT:1> ) return false ; htmlTag = this . htmlTags [ this . htmlTagsPtr ] ; if ( ( token = readTokenAndConsume ( ) ) != TerminalTokens . TokenNameIdentifier ) { return false ; } char [ ] identifier = this . scanner . getCurrentIdentifierSource ( ) ; htmlIndex = getHtmlTagIndex ( identifier ) ; if ( htmlIndex == JAVADOC_TAGS_ID_MASK ) return false ; int ptr = this . htmlTagsPtr ; while ( ! CharOperation . equals ( htmlTag , identifier , false ) ) { if ( this . htmlTagsPtr <= <NUM_LIT:0> ) { this . htmlTagsPtr = ptr ; return false ; } this . htmlTagsPtr -- ; htmlTag = this . htmlTags [ this . htmlTagsPtr ] ; } htmlIndex |= JAVADOC_CLOSED_TAG ; closing = true ; currentPosition = this . scanner . currentPosition ; break ; default : return false ; } switch ( readTokenAndConsume ( ) ) { case TerminalTokens . TokenNameLESS : case TerminalTokens . TokenNameLESS_EQUAL : return false ; case TerminalTokens . TokenNameGREATER : break ; case TerminalTokens . TokenNameGREATER_EQUAL : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameRIGHT_SHIFT_EQUAL : break ; default : this . index = currentPosition ; loop : while ( true ) { switch ( readChar ( ) ) { case '<CHAR_LIT>' : if ( hasWhitespaces ) { return false ; } this . index = currentPosition ; this . scanner . startPosition = currentPosition ; this . scanner . currentPosition = currentPosition ; this . scanner . currentCharacter = '<CHAR_LIT>' ; break loop ; case '<CHAR_LIT:>>' : this . scanner . startPosition = this . index ; this . scanner . currentPosition = this . index ; this . scanner . currentCharacter = peekChar ( ) ; break loop ; default : break ; } if ( this . index >= this . javadocTextEnd ) { this . index = currentPosition ; this . scanner . startPosition = currentPosition ; this . scanner . currentPosition = currentPosition ; break ; } } } if ( this . lineStarted && this . textStart != - <NUM_LIT:1> && this . textStart < endTextPosition ) { pushText ( this . textStart , endTextPosition , - <NUM_LIT:1> , htmlPtr ) ; } pushText ( previousPosition , this . index , htmlIndex , this . htmlTagsPtr ) ; this . textStart = - <NUM_LIT:1> ; valid = true ; } finally { if ( valid ) { if ( closing ) { this . htmlTagsPtr -- ; } } else if ( ! this . abort ) { if ( incremented ) { this . htmlTagsPtr -- ; if ( this . htmlTagsPtr == - <NUM_LIT:1> ) this . htmlTags = null ; } this . scanner . resetTo ( start , this . scanner . eofPosition - <NUM_LIT:1> ) ; this . index = start ; } } return valid ; } protected boolean parseIdentifierTag ( boolean report ) { if ( super . parseIdentifierTag ( report ) ) { createTag ( ) ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; this . scanner . resetTo ( this . index , this . javadocEnd ) ; return true ; } this . tagValue = TAG_OTHERS_VALUE ; return false ; } protected boolean parseParam ( ) throws InvalidInputException { boolean valid = super . parseParam ( ) ; if ( ! valid ) { this . scanner . resetTo ( this . tagSourceEnd + <NUM_LIT:1> , this . javadocEnd ) ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; char ch = peekChar ( ) ; if ( ch == '<CHAR_LIT:U+0020>' || ScannerHelper . isWhitespace ( ch ) ) { int token = this . scanner . getNextToken ( ) ; if ( token == TerminalTokens . TokenNameIdentifier ) { ch = peekChar ( ) ; if ( ch == '<CHAR_LIT:U+0020>' || ScannerHelper . isWhitespace ( ch ) ) { pushIdentifier ( true , false ) ; pushParamName ( false ) ; this . index = this . scanner . currentPosition ; valid = true ; } } this . scanner . resetTo ( this . tagSourceEnd + <NUM_LIT:1> , this . javadocEnd ) ; } this . tagValue = TAG_OTHERS_VALUE ; } return valid ; } protected boolean parseReference ( ) throws InvalidInputException { boolean valid = super . parseReference ( ) ; if ( ! valid ) { this . scanner . resetTo ( this . tagSourceEnd + <NUM_LIT:1> , this . javadocEnd ) ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; this . tagValue = TAG_OTHERS_VALUE ; } return valid ; } protected boolean parseReturn ( ) { createTag ( ) ; return true ; } protected boolean parseTag ( int previousPosition ) throws InvalidInputException { if ( this . htmlTagsPtr >= <NUM_LIT:0> ) { int ptr = this . htmlTagsPtr ; while ( ptr >= <NUM_LIT:0> ) { if ( getHtmlTagIndex ( this . htmlTags [ ptr -- ] ) == JAVADOC_CODE_TAGS_ID ) { if ( this . textStart == - <NUM_LIT:1> ) this . textStart = this . inlineTagStarted ? this . inlineTagStart : previousPosition ; this . inlineTagStarted = false ; return true ; } } } int ptr = this . astPtr ; this . tagSourceStart = previousPosition ; this . scanner . startPosition = this . index ; this . scanner . currentCharacter = readChar ( ) ; switch ( this . scanner . currentCharacter ) { case '<CHAR_LIT:U+0020>' : case '<CHAR_LIT>' : case '<CHAR_LIT:}>' : this . tagSourceEnd = previousPosition ; if ( this . textStart == - <NUM_LIT:1> ) this . textStart = previousPosition ; return true ; default : if ( ScannerHelper . isWhitespace ( this . scanner . currentCharacter ) ) { this . tagSourceEnd = previousPosition ; if ( this . textStart == - <NUM_LIT:1> ) this . textStart = previousPosition ; return true ; } break ; } int currentPosition = this . index ; char currentChar = this . scanner . currentCharacter ; while ( currentChar != '<CHAR_LIT:U+0020>' && currentChar != '<CHAR_LIT>' && currentChar != '<CHAR_LIT:}>' && ! ScannerHelper . isWhitespace ( currentChar ) ) { currentPosition = this . index ; currentChar = readChar ( ) ; } this . tagSourceEnd = currentPosition - <NUM_LIT:1> ; this . scanner . currentCharacter = currentChar ; this . scanner . currentPosition = currentPosition ; char [ ] tagName = this . scanner . getCurrentIdentifierSource ( ) ; int length = tagName . length ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; this . tagValue = TAG_OTHERS_VALUE ; boolean valid = false ; switch ( tagName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:a>' : if ( length == TAG_AUTHOR_LENGTH && CharOperation . equals ( TAG_AUTHOR , tagName ) ) { this . tagValue = TAG_AUTHOR_VALUE ; } break ; case '<CHAR_LIT:c>' : if ( length == TAG_CATEGORY_LENGTH && CharOperation . equals ( TAG_CATEGORY , tagName ) ) { this . tagValue = TAG_CATEGORY_VALUE ; valid = parseIdentifierTag ( false ) ; } else if ( length == TAG_CODE_LENGTH && this . inlineTagStarted && CharOperation . equals ( TAG_CODE , tagName ) ) { this . tagValue = TAG_CODE_VALUE ; } break ; case '<CHAR_LIT>' : if ( length == TAG_DEPRECATED_LENGTH && CharOperation . equals ( TAG_DEPRECATED , tagName ) ) { this . deprecated = true ; valid = true ; this . tagValue = TAG_DEPRECATED_VALUE ; } else if ( length == TAG_DOC_ROOT_LENGTH && CharOperation . equals ( TAG_DOC_ROOT , tagName ) ) { valid = true ; this . tagValue = TAG_DOC_ROOT_VALUE ; } break ; case '<CHAR_LIT:e>' : if ( length == TAG_EXCEPTION_LENGTH && CharOperation . equals ( TAG_EXCEPTION , tagName ) ) { this . tagValue = TAG_EXCEPTION_VALUE ; valid = parseThrows ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_INHERITDOC_LENGTH && CharOperation . equals ( TAG_INHERITDOC , tagName ) ) { if ( this . reportProblems ) { recordInheritedPosition ( ( ( ( long ) this . tagSourceStart ) << <NUM_LIT:32> ) + this . tagSourceEnd ) ; } valid = true ; this . tagValue = TAG_INHERITDOC_VALUE ; } break ; case '<CHAR_LIT>' : if ( length == TAG_LINK_LENGTH && CharOperation . equals ( TAG_LINK , tagName ) ) { this . tagValue = TAG_LINK_VALUE ; if ( this . inlineTagStarted || ( this . kind & COMPLETION_PARSER ) != <NUM_LIT:0> ) { valid = parseReference ( ) ; } else { valid = false ; if ( this . reportProblems ) { this . sourceParser . problemReporter ( ) . javadocUnexpectedTag ( this . tagSourceStart , this . tagSourceEnd ) ; } } } else if ( length == TAG_LINKPLAIN_LENGTH && CharOperation . equals ( TAG_LINKPLAIN , tagName ) ) { this . tagValue = TAG_LINKPLAIN_VALUE ; if ( this . inlineTagStarted ) { valid = parseReference ( ) ; } else { valid = false ; if ( this . reportProblems ) { this . sourceParser . problemReporter ( ) . javadocUnexpectedTag ( this . tagSourceStart , this . tagSourceEnd ) ; } } } else if ( length == TAG_LITERAL_LENGTH && this . inlineTagStarted && CharOperation . equals ( TAG_LITERAL , tagName ) ) { this . tagValue = TAG_LITERAL_VALUE ; } break ; case '<CHAR_LIT>' : if ( length == TAG_PARAM_LENGTH && CharOperation . equals ( TAG_PARAM , tagName ) ) { this . tagValue = TAG_PARAM_VALUE ; valid = parseParam ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_SEE_LENGTH && CharOperation . equals ( TAG_SEE , tagName ) ) { if ( this . inlineTagStarted ) { valid = false ; if ( this . reportProblems ) { this . sourceParser . problemReporter ( ) . javadocUnexpectedTag ( this . tagSourceStart , this . tagSourceEnd ) ; } } else { this . tagValue = TAG_SEE_VALUE ; valid = parseReference ( ) ; } } else if ( length == TAG_SERIAL_LENGTH && CharOperation . equals ( TAG_SERIAL , tagName ) ) { this . tagValue = TAG_SERIAL_VALUE ; } else if ( length == TAG_SERIAL_DATA_LENGTH && CharOperation . equals ( TAG_SERIAL_DATA , tagName ) ) { this . tagValue = TAG_SERIAL_DATA_VALUE ; } else if ( length == TAG_SERIAL_FIELD_LENGTH && CharOperation . equals ( TAG_SERIAL_FIELD , tagName ) ) { this . tagValue = TAG_SERIAL_FIELD_VALUE ; } else if ( length == TAG_SINCE_LENGTH && CharOperation . equals ( TAG_SINCE , tagName ) ) { this . tagValue = TAG_SINCE_VALUE ; } break ; case '<CHAR_LIT>' : if ( length == TAG_VALUE_LENGTH && CharOperation . equals ( TAG_VALUE , tagName ) ) { this . tagValue = TAG_VALUE_VALUE ; if ( this . sourceLevel >= ClassFileConstants . JDK1_5 ) { if ( this . inlineTagStarted ) { valid = parseReference ( ) ; } else { valid = false ; if ( this . reportProblems ) this . sourceParser . problemReporter ( ) . javadocUnexpectedTag ( this . tagSourceStart , this . tagSourceEnd ) ; } } } else if ( length == TAG_VERSION_LENGTH && CharOperation . equals ( TAG_VERSION , tagName ) ) { this . tagValue = TAG_VERSION_VALUE ; } else { createTag ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_RETURN_LENGTH && CharOperation . equals ( TAG_RETURN , tagName ) ) { this . tagValue = TAG_RETURN_VALUE ; valid = parseReturn ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_THROWS_LENGTH && CharOperation . equals ( TAG_THROWS , tagName ) ) { this . tagValue = TAG_THROWS_VALUE ; valid = parseThrows ( ) ; } break ; default : createTag ( ) ; break ; } consumeToken ( ) ; this . textStart = - <NUM_LIT:1> ; if ( valid ) { switch ( this . tagValue ) { case TAG_INHERITDOC_VALUE : case TAG_DEPRECATED_VALUE : createTag ( ) ; break ; } } else if ( this . invalidTagName ) { this . textStart = previousPosition ; } else if ( this . astPtr == ptr ) { createTag ( ) ; } return true ; } protected boolean parseThrows ( ) { boolean valid = super . parseThrows ( ) ; if ( ! valid ) { this . scanner . resetTo ( this . tagSourceEnd + <NUM_LIT:1> , this . javadocEnd ) ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; this . tagValue = TAG_OTHERS_VALUE ; } return valid ; } protected boolean pushParamName ( boolean isTypeParam ) { int lineTagStart = this . scanner . getLineNumber ( this . tagSourceStart ) ; FormatJavadocBlock block = new FormatJavadocBlock ( this . tagSourceStart , this . tagSourceEnd , lineTagStart , TAG_PARAM_VALUE ) ; int start = ( int ) ( this . identifierPositionStack [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; int lineStart = this . scanner . getLineNumber ( start ) ; FormatJavadocReference reference ; reference = new FormatJavadocReference ( start , ( int ) this . identifierPositionStack [ isTypeParam ? <NUM_LIT:2> : <NUM_LIT:0> ] , lineStart ) ; block . reference = reference ; block . sourceEnd = reference . sourceEnd ; pushOnAstStack ( block , true ) ; return true ; } protected boolean pushSeeRef ( Object statement ) { FormatJavadocReference reference = ( FormatJavadocReference ) statement ; int lineTagStart = this . scanner . getLineNumber ( this . tagSourceStart ) ; FormatJavadocBlock block = new FormatJavadocBlock ( this . tagSourceStart , this . tagSourceEnd , lineTagStart , this . tagValue ) ; block . reference = reference ; block . sourceEnd = reference . sourceEnd ; if ( this . inlineTagStarted ) { block . sourceStart = this . inlineTagStart ; FormatJavadocBlock previousBlock = null ; if ( this . astPtr == - <NUM_LIT:1> ) { int lineStart = this . scanner . getLineNumber ( this . inlineTagStart ) ; previousBlock = new FormatJavadocBlock ( this . inlineTagStart , this . tagSourceEnd , lineStart , NO_TAG_VALUE ) ; previousBlock . sourceEnd = reference . sourceEnd ; pushOnAstStack ( previousBlock , true ) ; } else { previousBlock = ( FormatJavadocBlock ) this . astStack [ this . astPtr ] ; } previousBlock . addBlock ( block , this . htmlTagsPtr == - <NUM_LIT:1> ? <NUM_LIT:0> : this . htmlTagsPtr ) ; block . flags |= FormatJavadocBlock . INLINED ; } else { pushOnAstStack ( block , true ) ; } return true ; } protected void pushText ( int start , int end ) { pushText ( start , end , - <NUM_LIT:1> , this . htmlTagsPtr == - <NUM_LIT:1> ? <NUM_LIT:0> : this . htmlTagsPtr ) ; } private void pushText ( int start , int end , int htmlIndex , int htmlDepth ) { FormatJavadocBlock previousBlock = null ; int previousStart = start ; int lineStart = this . scanner . getLineNumber ( start ) ; if ( this . astPtr == - <NUM_LIT:1> ) { previousBlock = new FormatJavadocBlock ( start , start , lineStart , NO_TAG_VALUE ) ; pushOnAstStack ( previousBlock , true ) ; } else { previousBlock = ( FormatJavadocBlock ) this . astStack [ this . astPtr ] ; previousStart = previousBlock . sourceStart ; } if ( this . inlineTagStarted ) { if ( previousBlock . nodes == null ) { } else { FormatJavadocNode lastNode = previousBlock . nodes [ previousBlock . nodesPtr ] ; while ( lastNode != null && lastNode . isText ( ) ) { lastNode = lastNode . getLastNode ( ) ; } if ( lastNode != null ) { previousBlock = ( FormatJavadocBlock ) lastNode ; previousStart = previousBlock . sourceStart ; } } } FormatJavadocText text = new FormatJavadocText ( start , end - <NUM_LIT:1> , lineStart , htmlIndex , htmlDepth == - <NUM_LIT:1> ? <NUM_LIT:0> : htmlDepth ) ; previousBlock . addText ( text ) ; previousBlock . sourceStart = previousStart ; if ( lineStart == previousBlock . lineStart ) { previousBlock . flags |= FormatJavadocBlock . TEXT_ON_TAG_LINE ; } this . textStart = - <NUM_LIT:1> ; } protected boolean pushThrowName ( Object typeRef ) { int lineStart = this . scanner . getLineNumber ( this . tagSourceStart ) ; FormatJavadocBlock block = new FormatJavadocBlock ( this . tagSourceStart , this . tagSourceEnd , lineStart , this . tagValue ) ; block . reference = ( FormatJavadocReference ) typeRef ; block . sourceEnd = block . reference . sourceEnd ; pushOnAstStack ( block , true ) ; return true ; } protected void refreshInlineTagPosition ( int previousPosition ) { if ( this . astPtr != - <NUM_LIT:1> ) { FormatJavadocNode previousBlock = ( FormatJavadocNode ) this . astStack [ this . astPtr ] ; if ( this . inlineTagStarted ) { FormatJavadocNode lastNode = previousBlock ; while ( lastNode != null ) { lastNode . sourceEnd = previousPosition ; lastNode = lastNode . getLastNode ( ) ; } } } } protected void setInlineTagStarted ( boolean started ) { super . setInlineTagStarted ( started ) ; if ( started ) { this . inlineHtmlTagsPtr = this . htmlTagsPtr ; } else { if ( this . htmlTagsPtr > this . inlineHtmlTagsPtr ) { this . htmlTagsPtr = this . inlineHtmlTagsPtr ; } } } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( super . toString ( ) ) ; return buffer . toString ( ) ; } public String toDebugString ( ) { if ( this . docComment == null ) { return "<STR_LIT>" ; } return ( ( FormatJavadoc ) this . docComment ) . toDebugString ( this . source ) ; } protected void updateDocComment ( ) { int length = this . astPtr + <NUM_LIT:1> ; FormatJavadoc formatJavadoc = new FormatJavadoc ( this . javadocStart , this . javadocEnd , length ) ; if ( length > <NUM_LIT:0> ) { formatJavadoc . blocks = new FormatJavadocBlock [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FormatJavadocBlock block = ( FormatJavadocBlock ) this . astStack [ i ] ; block . clean ( ) ; block . update ( this . scanner ) ; formatJavadoc . blocks [ i ] = block ; if ( i == <NUM_LIT:0> ) { block . flags |= FormatJavadocBlock . FIRST ; } } } formatJavadoc . textStart = this . javadocTextStart ; formatJavadoc . textEnd = this . javadocTextEnd ; formatJavadoc . lineStart = this . scanner . getLineNumber ( this . javadocTextStart ) ; formatJavadoc . lineEnd = this . scanner . getLineNumber ( this . javadocTextEnd ) ; FormatJavadocBlock firstBlock = formatJavadoc . getFirstBlock ( ) ; if ( firstBlock != null ) { firstBlock . setHeaderLine ( formatJavadoc . lineStart ) ; } this . docComment = formatJavadoc ; if ( DefaultCodeFormatter . DEBUG ) { System . out . println ( toDebugString ( ) ) ; } } protected boolean verifyEndLine ( int textPosition ) { return true ; } protected boolean verifySpaceOrEndComment ( ) { return true ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . io . IOException ; import java . io . StringReader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Map ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . core . formatter . CodeFormatter ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . Annotation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . util . CodeSnippetParsingUtil ; import org . eclipse . jdt . internal . core . util . RecordedParsingInformation ; import org . eclipse . jdt . internal . formatter . align . Alignment ; import org . eclipse . jdt . internal . formatter . align . AlignmentException ; import org . eclipse . jdt . internal . formatter . comment . CommentFormatterUtil ; import org . eclipse . jdt . internal . formatter . comment . HTMLEntity2JavaReader ; import org . eclipse . jdt . internal . formatter . comment . IJavaDocTagConstants ; import org . eclipse . jdt . internal . formatter . comment . Java2HTMLEntityReader ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . DefaultLineTracker ; import org . eclipse . jface . text . ILineTracker ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . Region ; import org . eclipse . text . edits . MalformedTreeException ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; public class Scribe implements IJavaDocTagConstants { private static final int INITIAL_SIZE = <NUM_LIT:100> ; private boolean checkLineWrapping ; public int column ; private int [ ] [ ] commentPositions ; public Alignment currentAlignment ; public int currentToken ; private OptimizedReplaceEdit [ ] edits ; public int editsIndex ; public CodeFormatterVisitor formatter ; public int indentationLevel ; public int lastNumberOfNewLines ; private boolean preserveLineBreakIndentation = false ; public int line ; private int [ ] lineEnds ; private int maxLines ; public Alignment memberAlignment ; public boolean needSpace = false ; final private String lineSeparator ; final private String lineSeparatorAndSpace ; final private char firstLS ; final private int lsLength ; public int nlsTagCounter ; public int pageWidth ; public boolean pendingSpace = false ; public Scanner scanner ; public int scannerEndPosition ; public int tabLength ; public int indentationSize ; private final IRegion [ ] regions ; private IRegion [ ] adaptedRegions ; public int tabChar ; public int numberOfIndentations ; private boolean useTabsOnlyForLeadingIndents ; private final boolean indentEmptyLines ; int blank_lines_between_import_groups = - <NUM_LIT:1> ; public static final int DO_NOT_PRESERVE_EMPTY_LINES = - <NUM_LIT:1> ; public static final int PRESERVE_EMPTY_LINES_KEEP_LAST_NEW_LINES_INDENTATION = <NUM_LIT:1> ; public static final int PRESERVE_EMPTY_LINES_IN_FORMAT_LEFT_CURLY_BRACE = <NUM_LIT:2> ; public static final int PRESERVE_EMPTY_LINES_IN_STRING_LITERAL_CONCATENATION = <NUM_LIT:3> ; public static final int PRESERVE_EMPTY_LINES_IN_CLOSING_ARRAY_INITIALIZER = <NUM_LIT:4> ; public static final int PRESERVE_EMPTY_LINES_IN_FORMAT_OPENING_BRACE = <NUM_LIT:5> ; public static final int PRESERVE_EMPTY_LINES_IN_BINARY_EXPRESSION = <NUM_LIT:6> ; public static final int PRESERVE_EMPTY_LINES_IN_EQUALITY_EXPRESSION = <NUM_LIT:7> ; public static final int PRESERVE_EMPTY_LINES_BEFORE_ELSE = <NUM_LIT:8> ; public static final int PRESERVE_EMPTY_LINES_IN_SWITCH_CASE = <NUM_LIT:9> ; public static final int PRESERVE_EMPTY_LINES_AT_END_OF_METHOD_DECLARATION = <NUM_LIT:10> ; public static final int PRESERVE_EMPTY_LINES_AT_END_OF_BLOCK = <NUM_LIT:11> ; final static int PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION = - <NUM_LIT:1> ; final static int PRESERVE_EMPTY_LINES_USE_CURRENT_INDENTATION = <NUM_LIT:0> ; final static int PRESERVE_EMPTY_LINES_USE_TEMPORARY_INDENTATION = <NUM_LIT:1> ; boolean editsEnabled ; boolean useTags ; int tagsKind ; private static final int INCLUDE_BLOCK_COMMENTS = CodeFormatter . F_INCLUDE_COMMENTS | CodeFormatter . K_MULTI_LINE_COMMENT ; private static final int INCLUDE_JAVA_DOC = CodeFormatter . F_INCLUDE_COMMENTS | CodeFormatter . K_JAVA_DOC ; private static final int INCLUDE_LINE_COMMENTS = CodeFormatter . F_INCLUDE_COMMENTS | CodeFormatter . K_SINGLE_LINE_COMMENT ; private static final int SKIP_FIRST_WHITESPACE_TOKEN = - <NUM_LIT:2> ; private static final int INVALID_TOKEN = <NUM_LIT> ; static final int NO_TRAILING_COMMENT = <NUM_LIT> ; static final int BASIC_TRAILING_COMMENT = <NUM_LIT> ; static final int COMPLEX_TRAILING_COMMENT = <NUM_LIT> ; static final int IMPORT_TRAILING_COMMENT = COMPLEX_TRAILING_COMMENT | <NUM_LIT> ; static final int UNMODIFIABLE_TRAILING_COMMENT = <NUM_LIT> ; private int formatComments = <NUM_LIT:0> ; private int headerEndPosition = - <NUM_LIT:1> ; String commentIndentation ; static class LineComment { boolean contiguous = false ; int currentIndentation , indentation ; int lines ; char [ ] leadingSpaces ; } final LineComment lastLineComment = new LineComment ( ) ; private FormatterCommentParser formatterCommentParser ; OptimizedReplaceEdit previousDisabledEdit ; private char [ ] disablingTag , enablingTag ; private String [ ] newEmptyLines = new String [ <NUM_LIT:10> ] ; private static String [ ] COMMENT_INDENTATIONS = new String [ <NUM_LIT:20> ] ; private final StringBuffer tempBuffer = new StringBuffer ( ) ; private final StringBuffer blockCommentBuffer = new StringBuffer ( ) ; private final StringBuffer blockCommentTokensBuffer = new StringBuffer ( ) ; private final StringBuffer codeSnippetBuffer = new StringBuffer ( ) ; private final StringBuffer javadocBlockRefBuffer = new StringBuffer ( ) ; private final StringBuffer javadocGapLinesBuffer = new StringBuffer ( ) ; private StringBuffer [ ] javadocHtmlTagBuffers = new StringBuffer [ <NUM_LIT:5> ] ; private final StringBuffer javadocTextBuffer = new StringBuffer ( ) ; private final StringBuffer javadocTokensBuffer = new StringBuffer ( ) ; Scribe ( CodeFormatterVisitor formatter , long sourceLevel , IRegion [ ] regions , CodeSnippetParsingUtil codeSnippetParsingUtil , boolean includeComments ) { initializeScanner ( sourceLevel , formatter . preferences ) ; this . formatter = formatter ; this . pageWidth = formatter . preferences . page_width ; this . tabLength = formatter . preferences . tab_size ; this . indentationLevel = <NUM_LIT:0> ; this . numberOfIndentations = <NUM_LIT:0> ; this . useTabsOnlyForLeadingIndents = formatter . preferences . use_tabs_only_for_leading_indentations ; this . indentEmptyLines = formatter . preferences . indent_empty_lines ; this . tabChar = formatter . preferences . tab_char ; if ( this . tabChar == DefaultCodeFormatterOptions . MIXED ) { this . indentationSize = formatter . preferences . indentation_size ; } else { this . indentationSize = this . tabLength ; } this . lineSeparator = formatter . preferences . line_separator ; this . lineSeparatorAndSpace = this . lineSeparator + '<CHAR_LIT:U+0020>' ; this . firstLS = this . lineSeparator . charAt ( <NUM_LIT:0> ) ; this . lsLength = this . lineSeparator . length ( ) ; this . indentationLevel = formatter . preferences . initial_indentation_level * this . indentationSize ; this . regions = regions ; if ( codeSnippetParsingUtil != null ) { final RecordedParsingInformation information = codeSnippetParsingUtil . recordedParsingInformation ; if ( information != null ) { this . lineEnds = information . lineEnds ; this . commentPositions = information . commentPositions ; } } if ( formatter . preferences . comment_format_line_comment ) this . formatComments |= CodeFormatter . K_SINGLE_LINE_COMMENT ; if ( formatter . preferences . comment_format_block_comment ) this . formatComments |= CodeFormatter . K_MULTI_LINE_COMMENT ; if ( formatter . preferences . comment_format_javadoc_comment ) this . formatComments |= CodeFormatter . K_JAVA_DOC ; if ( includeComments ) this . formatComments |= CodeFormatter . F_INCLUDE_COMMENTS ; reset ( ) ; } private void adaptRegions ( ) { int max = this . regions . length ; if ( max == <NUM_LIT:1> ) { if ( this . regions [ <NUM_LIT:0> ] . getOffset ( ) == <NUM_LIT:0> && this . regions [ <NUM_LIT:0> ] . getLength ( ) == this . scannerEndPosition ) { this . adaptedRegions = this . regions ; return ; } } this . adaptedRegions = new IRegion [ max ] ; int commentIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { IRegion aRegion = this . regions [ i ] ; int offset = aRegion . getOffset ( ) ; int length = aRegion . getLength ( ) ; int index = getCommentIndex ( commentIndex , offset ) ; int adaptedOffset = offset ; int adaptedLength = length ; if ( index >= <NUM_LIT:0> ) { adaptedOffset = this . commentPositions [ index ] [ <NUM_LIT:0> ] ; if ( adaptedOffset >= <NUM_LIT:0> ) { adaptedLength = length + offset - adaptedOffset ; commentIndex = index ; } } index = getCommentIndex ( commentIndex , offset + length - <NUM_LIT:1> ) ; if ( index >= <NUM_LIT:0> && this . commentPositions [ index ] [ <NUM_LIT:0> ] >= <NUM_LIT:0> ) { int commentEnd = this . commentPositions [ index ] [ <NUM_LIT:1> ] ; if ( commentEnd < <NUM_LIT:0> ) commentEnd = - commentEnd ; adaptedLength = commentEnd - adaptedOffset ; commentIndex = index ; } if ( adaptedLength != length ) { this . adaptedRegions [ i ] = new Region ( adaptedOffset , adaptedLength ) ; } else { this . adaptedRegions [ i ] = aRegion ; } } } private void adaptEdits ( ) { int max = this . regions . length ; if ( max == <NUM_LIT:1> ) { if ( this . regions [ <NUM_LIT:0> ] . getOffset ( ) == <NUM_LIT:0> && this . regions [ <NUM_LIT:0> ] . getLength ( ) == this . scannerEndPosition ) { return ; } } OptimizedReplaceEdit [ ] sortedEdits = new OptimizedReplaceEdit [ this . editsIndex ] ; System . arraycopy ( this . edits , <NUM_LIT:0> , sortedEdits , <NUM_LIT:0> , this . editsIndex ) ; Arrays . sort ( sortedEdits , new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { OptimizedReplaceEdit edit1 = ( OptimizedReplaceEdit ) o1 ; OptimizedReplaceEdit edit2 = ( OptimizedReplaceEdit ) o2 ; return edit1 . offset - edit2 . offset ; } } ) ; int currentEdit = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { IRegion region = this . adaptedRegions [ i ] ; int offset = region . getOffset ( ) ; int length = region . getLength ( ) ; int index = adaptEdit ( sortedEdits , currentEdit , offset , offset + length ) ; if ( index != - <NUM_LIT:1> ) { currentEdit = index ; } } if ( currentEdit != - <NUM_LIT:1> ) { int length = sortedEdits . length ; for ( int e = currentEdit ; e < length ; e ++ ) { sortedEdits [ e ] . offset = - <NUM_LIT:1> ; } } } private int adaptEdit ( OptimizedReplaceEdit [ ] sortedEdits , int start , int regionStart , int regionEnd ) { int initialStart = start == - <NUM_LIT:1> ? <NUM_LIT:0> : start ; int bottom = initialStart , top = sortedEdits . length - <NUM_LIT:1> ; int topEnd = top ; int i = <NUM_LIT:0> ; OptimizedReplaceEdit edit = null ; int overlapIndex = - <NUM_LIT:1> ; while ( bottom <= top ) { i = bottom + ( top - bottom ) / <NUM_LIT:2> ; edit = sortedEdits [ i ] ; int editStart = edit . offset ; int editEnd = editStart + edit . length ; if ( editStart > regionStart ) { top = i - <NUM_LIT:1> ; if ( editStart > regionEnd ) { topEnd = top ; } } else { if ( editEnd < regionStart ) { bottom = i + <NUM_LIT:1> ; } else { int linesOutside = <NUM_LIT:0> ; StringBuffer spacesOutside = new StringBuffer ( ) ; this . scanner . resetTo ( editStart , editEnd - <NUM_LIT:1> ) ; while ( this . scanner . currentPosition < regionStart && ! this . scanner . atEnd ( ) ) { char ch = ( char ) this . scanner . getNextChar ( ) ; switch ( ch ) { case '<STR_LIT:\n>' : linesOutside ++ ; spacesOutside . setLength ( <NUM_LIT:0> ) ; break ; case '<STR_LIT>' : break ; default : spacesOutside . append ( ch ) ; break ; } } edit . offset = regionStart ; int editLength = edit . length ; edit . length -= edit . offset - editStart ; int length = edit . replacement . length ( ) ; if ( length > <NUM_LIT:0> ) { int linesReplaced = <NUM_LIT:0> ; for ( int idx = <NUM_LIT:0> ; idx < length ; idx ++ ) { if ( edit . replacement . charAt ( idx ) == '<STR_LIT:\n>' ) linesReplaced ++ ; } if ( editLength > <NUM_LIT:0> && edit . length == <NUM_LIT:0> && editEnd == regionStart && linesReplaced == <NUM_LIT:0> && linesOutside == <NUM_LIT:0> ) { edit . offset = - <NUM_LIT:1> ; } else { if ( linesReplaced > <NUM_LIT:0> ) { int linesCount = linesOutside >= linesReplaced ? linesReplaced : linesOutside ; if ( linesCount > <NUM_LIT:0> ) { int idx = <NUM_LIT:0> ; loop : while ( idx < length ) { char ch = edit . replacement . charAt ( idx ) ; switch ( ch ) { case '<STR_LIT:\n>' : linesCount -- ; if ( linesCount == <NUM_LIT:0> ) { idx ++ ; break loop ; } break ; case '<STR_LIT>' : case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\t>' : break ; default : break loop ; } idx ++ ; } int spacesOutsideLength = spacesOutside . length ( ) ; int replacementStart = idx ; for ( int o = <NUM_LIT:0> , r = <NUM_LIT:0> ; o < spacesOutsideLength && r < ( length - idx ) ; o ++ ) { char rch = edit . replacement . charAt ( idx + r ) ; char och = spacesOutside . charAt ( o ) ; if ( rch == och ) { replacementStart ++ ; r ++ ; } else if ( rch == '<STR_LIT:\t>' && ( this . tabLength > <NUM_LIT:0> && och == '<CHAR_LIT:U+0020>' ) ) { if ( ( o + <NUM_LIT:1> ) % this . tabLength == <NUM_LIT:0> ) { replacementStart ++ ; r ++ ; } } else { break ; } } if ( replacementStart > length || ( replacementStart == length && spacesOutsideLength > <NUM_LIT:0> ) ) { edit . offset = - <NUM_LIT:1> ; } else if ( spacesOutsideLength == <NUM_LIT:0> && replacementStart == length ) { edit . replacement = "<STR_LIT>" ; } else { edit . replacement = edit . replacement . substring ( replacementStart ) ; } } } } } overlapIndex = i ; break ; } } } int validIndex = ( overlapIndex != - <NUM_LIT:1> ) ? overlapIndex : bottom ; if ( overlapIndex != - <NUM_LIT:1> ) bottom = overlapIndex ; while ( bottom <= topEnd ) { i = bottom + ( topEnd - bottom ) / <NUM_LIT:2> ; edit = sortedEdits [ i ] ; int editStart = edit . offset ; int editEnd = editStart + edit . length ; if ( regionEnd < editStart ) { topEnd = i - <NUM_LIT:1> ; } else if ( regionEnd == editStart ) { topEnd = i - <NUM_LIT:1> ; if ( edit . length == <NUM_LIT:0> ) { int nrLength = <NUM_LIT:0> ; int rLength = edit . replacement . length ( ) ; if ( nrLength < rLength ) { int ch = edit . replacement . charAt ( nrLength ) ; loop : while ( nrLength < rLength ) { switch ( ch ) { case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\t>' : nrLength ++ ; break ; default : break loop ; } } } if ( nrLength > <NUM_LIT:0> ) { topEnd ++ ; if ( nrLength < rLength ) { edit . replacement = edit . replacement . substring ( <NUM_LIT:0> , nrLength ) ; } } } break ; } else if ( editEnd <= regionEnd ) { bottom = i + <NUM_LIT:1> ; } else { int linesOutside = <NUM_LIT:0> ; this . scanner . resetTo ( editStart , editEnd - <NUM_LIT:1> ) ; while ( ! this . scanner . atEnd ( ) ) { boolean after = this . scanner . currentPosition >= regionEnd ; char ch = ( char ) this . scanner . getNextChar ( ) ; if ( ch == '<STR_LIT:\n>' ) { if ( after ) linesOutside ++ ; } } int length = edit . replacement . length ( ) ; if ( length > <NUM_LIT:0> ) { int linesReplaced = <NUM_LIT:0> ; for ( int idx = <NUM_LIT:0> ; idx < length ; idx ++ ) { if ( edit . replacement . charAt ( idx ) == '<STR_LIT:\n>' ) linesReplaced ++ ; } if ( linesReplaced == <NUM_LIT:0> ) { edit . replacement = "<STR_LIT>" ; } else { int linesCount = linesReplaced > linesOutside ? linesReplaced - linesOutside : <NUM_LIT:0> ; if ( linesCount == <NUM_LIT:0> ) { edit . replacement = "<STR_LIT>" ; } else { edit . replacement = getNewLineString ( linesCount ) ; } } } edit . length = regionEnd - editStart ; topEnd = i ; break ; } } for ( int e = initialStart ; e < validIndex ; e ++ ) { sortedEdits [ e ] . offset = - <NUM_LIT:1> ; } return topEnd + <NUM_LIT:1> ; } private final void addDeleteEdit ( int start , int end ) { if ( this . edits . length == this . editsIndex ) { resize ( ) ; } addOptimizedReplaceEdit ( start , end - start + <NUM_LIT:1> , Util . EMPTY_STRING ) ; } public final void addInsertEdit ( int insertPosition , String insertedString ) { if ( this . edits . length == this . editsIndex ) { resize ( ) ; } addOptimizedReplaceEdit ( insertPosition , <NUM_LIT:0> , insertedString ) ; } private final void addOptimizedReplaceEdit ( int offset , int length , String replacement ) { if ( ! this . editsEnabled ) { if ( this . previousDisabledEdit != null && this . previousDisabledEdit . offset == offset ) { replacement = this . previousDisabledEdit . replacement ; } this . previousDisabledEdit = null ; if ( replacement . indexOf ( this . lineSeparator ) >= <NUM_LIT:0> ) { if ( length == <NUM_LIT:0> || printNewLinesCharacters ( offset , length ) ) { this . previousDisabledEdit = new OptimizedReplaceEdit ( offset , length , replacement ) ; } } return ; } if ( this . editsIndex > <NUM_LIT:0> ) { final OptimizedReplaceEdit previous = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; final int previousOffset = previous . offset ; final int previousLength = previous . length ; final int endOffsetOfPreviousEdit = previousOffset + previousLength ; final int replacementLength = replacement . length ( ) ; final String previousReplacement = previous . replacement ; final int previousReplacementLength = previousReplacement . length ( ) ; if ( previousOffset == offset && previousLength == length && ( replacementLength == <NUM_LIT:0> || previousReplacementLength == <NUM_LIT:0> ) ) { if ( this . currentAlignment != null ) { final Location location = this . currentAlignment . location ; if ( location . editsIndex == this . editsIndex ) { location . editsIndex -- ; location . textEdit = previous ; } } this . editsIndex -- ; return ; } if ( endOffsetOfPreviousEdit == offset ) { if ( length != <NUM_LIT:0> ) { if ( replacementLength != <NUM_LIT:0> ) { this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( previousOffset , previousLength + length , previousReplacement + replacement ) ; } else if ( previousLength + length == previousReplacementLength ) { boolean canBeRemoved = true ; loop : for ( int i = previousOffset ; i < previousOffset + previousReplacementLength ; i ++ ) { if ( this . scanner . source [ i ] != previousReplacement . charAt ( i - previousOffset ) ) { this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( previousOffset , previousReplacementLength , previousReplacement ) ; canBeRemoved = false ; break loop ; } } if ( canBeRemoved ) { if ( this . currentAlignment != null ) { final Location location = this . currentAlignment . location ; if ( location . editsIndex == this . editsIndex ) { location . editsIndex -- ; location . textEdit = previous ; } } this . editsIndex -- ; } } else { this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( previousOffset , previousLength + length , previousReplacement ) ; } } else { if ( replacementLength != <NUM_LIT:0> ) { this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( previousOffset , previousLength , previousReplacement + replacement ) ; } } } else if ( ( offset + length == previousOffset ) && ( previousLength + length == replacementLength + previousReplacementLength ) ) { boolean canBeRemoved = true ; String totalReplacement = replacement + previousReplacement ; loop : for ( int i = <NUM_LIT:0> ; i < previousLength + length ; i ++ ) { if ( this . scanner . source [ i + offset ] != totalReplacement . charAt ( i ) ) { this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( offset , previousLength + length , totalReplacement ) ; canBeRemoved = false ; break loop ; } } if ( canBeRemoved ) { if ( this . currentAlignment != null ) { final Location location = this . currentAlignment . location ; if ( location . editsIndex == this . editsIndex ) { location . editsIndex -- ; location . textEdit = previous ; } } this . editsIndex -- ; } } else { this . edits [ this . editsIndex ++ ] = new OptimizedReplaceEdit ( offset , length , replacement ) ; } } else { this . edits [ this . editsIndex ++ ] = new OptimizedReplaceEdit ( offset , length , replacement ) ; } } public final void addReplaceEdit ( int start , int end , String replacement ) { if ( this . edits . length == this . editsIndex ) { resize ( ) ; } addOptimizedReplaceEdit ( start , end - start + <NUM_LIT:1> , replacement ) ; } public void alignFragment ( Alignment alignment , int fragmentIndex ) { alignment . fragmentIndex = fragmentIndex ; alignment . checkColumn ( ) ; alignment . performFragmentEffect ( ) ; } public void checkNLSTag ( int sourceStart ) { if ( hasNLSTag ( sourceStart ) ) { this . nlsTagCounter ++ ; } } private int consumeInvalidToken ( int end ) { this . scanner . resetTo ( this . scanner . startPosition , end ) ; if ( this . scanner . currentCharacter == '<STR_LIT:\\>' ) { this . scanner . currentPosition = this . scanner . startPosition + <NUM_LIT:1> ; } int previousPosition = this . scanner . currentPosition ; char ch = ( char ) this . scanner . getNextChar ( ) ; if ( this . scanner . atEnd ( ) ) { return INVALID_TOKEN ; } while ( ! this . scanner . atEnd ( ) && ch != '<CHAR_LIT>' && ! ScannerHelper . isWhitespace ( ch ) ) { previousPosition = this . scanner . currentPosition ; ch = ( char ) this . scanner . getNextChar ( ) ; } this . scanner . currentPosition = previousPosition ; return INVALID_TOKEN ; } public Alignment createAlignment ( int kind , int mode , int count , int sourceRestart ) { return createAlignment ( kind , mode , Alignment . R_INNERMOST , count , sourceRestart ) ; } public Alignment createAlignment ( int kind , int mode , int tieBreakRule , int count , int sourceRestart ) { return createAlignment ( kind , mode , tieBreakRule , count , sourceRestart , this . formatter . preferences . continuation_indentation , false ) ; } public Alignment createAlignment ( int kind , int mode , int count , int sourceRestart , int continuationIndent , boolean adjust ) { return createAlignment ( kind , mode , Alignment . R_INNERMOST , count , sourceRestart , continuationIndent , adjust ) ; } public Alignment createAlignment ( int kind , int mode , int tieBreakRule , int count , int sourceRestart , int continuationIndent , boolean adjust ) { Alignment alignment = new Alignment ( kind , mode , tieBreakRule , this , count , sourceRestart , continuationIndent ) ; if ( ( this . currentAlignment == null && this . formatter . expressionsDepth >= <NUM_LIT:0> ) || ( this . currentAlignment != null && this . currentAlignment . kind == Alignment . BINARY_EXPRESSION && ( this . formatter . expressionsPos & CodeFormatterVisitor . EXPRESSIONS_POS_MASK ) == CodeFormatterVisitor . EXPRESSIONS_POS_BETWEEN_TWO ) ) { switch ( kind ) { case Alignment . CONDITIONAL_EXPRESSION : case Alignment . MESSAGE_ARGUMENTS : case Alignment . MESSAGE_SEND : if ( this . formatter . lastBinaryExpressionAlignmentBreakIndentation == alignment . breakIndentationLevel ) { alignment . breakIndentationLevel += this . indentationSize ; alignment . shiftBreakIndentationLevel += this . indentationSize ; this . formatter . lastBinaryExpressionAlignmentBreakIndentation = <NUM_LIT:0> ; } break ; } } if ( adjust && this . memberAlignment != null ) { Alignment current = this . memberAlignment ; while ( current . enclosing != null ) { current = current . enclosing ; } if ( ( current . mode & Alignment . M_MULTICOLUMN ) != <NUM_LIT:0> ) { final int indentSize = this . indentationSize ; switch ( current . chunkKind ) { case Alignment . CHUNK_METHOD : case Alignment . CHUNK_TYPE : if ( ( mode & Alignment . M_INDENT_BY_ONE ) != <NUM_LIT:0> ) { alignment . breakIndentationLevel = this . indentationLevel + indentSize ; } else { alignment . breakIndentationLevel = this . indentationLevel + continuationIndent * indentSize ; } alignment . update ( ) ; break ; case Alignment . CHUNK_FIELD : if ( ( mode & Alignment . M_INDENT_BY_ONE ) != <NUM_LIT:0> ) { alignment . breakIndentationLevel = current . originalIndentationLevel + indentSize ; } else { alignment . breakIndentationLevel = current . originalIndentationLevel + continuationIndent * indentSize ; } alignment . update ( ) ; break ; } } else { switch ( current . mode & Alignment . SPLIT_MASK ) { case Alignment . M_COMPACT_SPLIT : case Alignment . M_COMPACT_FIRST_BREAK_SPLIT : case Alignment . M_NEXT_PER_LINE_SPLIT : case Alignment . M_NEXT_SHIFTED_SPLIT : case Alignment . M_ONE_PER_LINE_SPLIT : final int indentSize = this . indentationSize ; switch ( current . chunkKind ) { case Alignment . CHUNK_METHOD : case Alignment . CHUNK_TYPE : if ( ( mode & Alignment . M_INDENT_BY_ONE ) != <NUM_LIT:0> ) { alignment . breakIndentationLevel = this . indentationLevel + indentSize ; } else { alignment . breakIndentationLevel = this . indentationLevel + continuationIndent * indentSize ; } alignment . update ( ) ; break ; case Alignment . CHUNK_FIELD : if ( ( mode & Alignment . M_INDENT_BY_ONE ) != <NUM_LIT:0> ) { alignment . breakIndentationLevel = current . originalIndentationLevel + indentSize ; } else { alignment . breakIndentationLevel = current . originalIndentationLevel + continuationIndent * indentSize ; } alignment . update ( ) ; break ; } break ; } } } return alignment ; } public Alignment createMemberAlignment ( int kind , int mode , int count , int sourceRestart ) { Alignment mAlignment = createAlignment ( kind , mode , Alignment . R_INNERMOST , count , sourceRestart ) ; mAlignment . breakIndentationLevel = this . indentationLevel ; return mAlignment ; } public void enterAlignment ( Alignment alignment ) { alignment . enclosing = this . currentAlignment ; alignment . location . lastLocalDeclarationSourceStart = this . formatter . lastLocalDeclarationSourceStart ; this . currentAlignment = alignment ; } public void enterMemberAlignment ( Alignment alignment ) { alignment . enclosing = this . memberAlignment ; alignment . location . lastLocalDeclarationSourceStart = this . formatter . lastLocalDeclarationSourceStart ; this . memberAlignment = alignment ; } public void exitAlignment ( Alignment alignment , boolean discardAlignment ) { Alignment current = this . currentAlignment ; while ( current != null ) { if ( current == alignment ) break ; current = current . enclosing ; } if ( current == null ) { throw new AbortFormatting ( "<STR_LIT>" + alignment ) ; } this . indentationLevel = alignment . location . outputIndentationLevel ; this . numberOfIndentations = alignment . location . numberOfIndentations ; this . formatter . lastLocalDeclarationSourceStart = alignment . location . lastLocalDeclarationSourceStart ; if ( discardAlignment ) { this . currentAlignment = alignment . enclosing ; if ( this . currentAlignment == null ) { this . formatter . lastBinaryExpressionAlignmentBreakIndentation = <NUM_LIT:0> ; } } } public void exitMemberAlignment ( Alignment alignment ) { Alignment current = this . memberAlignment ; while ( current != null ) { if ( current == alignment ) break ; current = current . enclosing ; } if ( current == null ) { throw new AbortFormatting ( "<STR_LIT>" + alignment ) ; } this . indentationLevel = current . location . outputIndentationLevel ; this . numberOfIndentations = current . location . numberOfIndentations ; this . formatter . lastLocalDeclarationSourceStart = alignment . location . lastLocalDeclarationSourceStart ; this . memberAlignment = current . enclosing ; } public int getColumnIndentationLevel ( ) { return this . column - <NUM_LIT:1> ; } public final int getCommentIndex ( int position ) { if ( this . commentPositions == null ) return - <NUM_LIT:1> ; int length = this . commentPositions . length ; if ( length == <NUM_LIT:0> ) { return - <NUM_LIT:1> ; } int g = <NUM_LIT:0> , d = length - <NUM_LIT:1> ; int m = <NUM_LIT:0> ; while ( g <= d ) { m = g + ( d - g ) / <NUM_LIT:2> ; int bound = this . commentPositions [ m ] [ <NUM_LIT:1> ] ; if ( bound < <NUM_LIT:0> ) { bound = - bound ; } if ( bound < position ) { g = m + <NUM_LIT:1> ; } else if ( bound > position ) { d = m - <NUM_LIT:1> ; } else { return m ; } } return - ( g + <NUM_LIT:1> ) ; } private int getCommentIndex ( int start , int position ) { int commentsLength = this . commentPositions == null ? <NUM_LIT:0> : this . commentPositions . length ; if ( commentsLength == <NUM_LIT:0> ) return - <NUM_LIT:1> ; if ( position == <NUM_LIT:0> ) { if ( commentsLength > <NUM_LIT:0> && this . commentPositions [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] == <NUM_LIT:0> ) { return <NUM_LIT:0> ; } return - <NUM_LIT:1> ; } int bottom = start , top = commentsLength - <NUM_LIT:1> ; int i = <NUM_LIT:0> ; int [ ] comment = null ; while ( bottom <= top ) { i = bottom + ( top - bottom ) / <NUM_LIT:2> ; comment = this . commentPositions [ i ] ; int commentStart = comment [ <NUM_LIT:0> ] ; if ( commentStart < <NUM_LIT:0> ) commentStart = - commentStart ; if ( position < commentStart ) { top = i - <NUM_LIT:1> ; } else { int commentEnd = comment [ <NUM_LIT:1> ] ; if ( commentEnd < <NUM_LIT:0> ) commentEnd = - commentEnd ; if ( position >= commentEnd ) { bottom = i + <NUM_LIT:1> ; } else { return i ; } } } return - <NUM_LIT:1> ; } private int getCurrentCommentIndentation ( int start ) { int linePtr = - Arrays . binarySearch ( this . lineEnds , start ) ; int indentation = <NUM_LIT:0> ; int beginningOfLine = getLineEnd ( linePtr - <NUM_LIT:1> ) + <NUM_LIT:1> ; if ( beginningOfLine == - <NUM_LIT:1> ) { beginningOfLine = <NUM_LIT:0> ; } int currentStartPosition = start ; char [ ] source = this . scanner . source ; while ( beginningOfLine > currentStartPosition ) { if ( linePtr > <NUM_LIT:0> ) { beginningOfLine = getLineEnd ( -- linePtr ) + <NUM_LIT:1> ; } else { beginningOfLine = <NUM_LIT:0> ; break ; } } for ( int i = beginningOfLine ; i < currentStartPosition ; i ++ ) { char currentCharacter = source [ i ] ; switch ( currentCharacter ) { case '<STR_LIT:\t>' : if ( this . tabLength != <NUM_LIT:0> ) { int reminder = indentation % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { indentation += this . tabLength ; } else { indentation = ( ( indentation / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } } break ; case '<STR_LIT>' : case '<STR_LIT:\n>' : indentation = <NUM_LIT:0> ; break ; default : indentation ++ ; break ; } } return indentation ; } int getCurrentIndentation ( char [ ] whitespaces , int offset ) { if ( whitespaces == null ) return offset ; int length = whitespaces . length ; if ( this . tabLength == <NUM_LIT:0> ) return length ; int indentation = offset ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char ch = whitespaces [ i ] ; switch ( ch ) { case '<STR_LIT:\t>' : int reminder = indentation % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { indentation += this . tabLength ; } else { indentation = ( ( indentation / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } break ; case '<STR_LIT>' : case '<STR_LIT:\n>' : indentation = <NUM_LIT:0> ; break ; default : indentation ++ ; break ; } } return indentation ; } int getCurrentIndentation ( int start ) { int linePtr = Arrays . binarySearch ( this . lineEnds , start ) ; if ( linePtr < <NUM_LIT:0> ) { linePtr = - linePtr - <NUM_LIT:1> ; } int indentation = <NUM_LIT:0> ; int beginningOfLine = getLineEnd ( linePtr ) + <NUM_LIT:1> ; if ( beginningOfLine == - <NUM_LIT:1> ) { beginningOfLine = <NUM_LIT:0> ; } char [ ] source = this . scanner . source ; for ( int i = beginningOfLine ; i < start ; i ++ ) { char currentCharacter = source [ i ] ; switch ( currentCharacter ) { case '<STR_LIT:\t>' : if ( this . tabLength != <NUM_LIT:0> ) { int reminder = indentation % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { indentation += this . tabLength ; } else { indentation = ( ( indentation / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } } break ; case '<STR_LIT>' : case '<STR_LIT:\n>' : indentation = <NUM_LIT:0> ; break ; case '<CHAR_LIT:U+0020>' : indentation ++ ; break ; default : return indentation ; } } return indentation ; } public String getEmptyLines ( int linesNumber ) { if ( this . nlsTagCounter > <NUM_LIT:0> ) { return Util . EMPTY_STRING ; } String emptyLines ; if ( this . lastNumberOfNewLines == <NUM_LIT:0> ) { linesNumber ++ ; if ( this . indentEmptyLines ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; for ( int i = <NUM_LIT:0> ; i < linesNumber ; i ++ ) { printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; } emptyLines = this . tempBuffer . toString ( ) ; } else { emptyLines = getNewLineString ( linesNumber ) ; } this . lastNumberOfNewLines += linesNumber ; this . line += linesNumber ; this . column = <NUM_LIT:1> ; this . needSpace = false ; this . pendingSpace = false ; } else if ( this . lastNumberOfNewLines == <NUM_LIT:1> ) { if ( this . indentEmptyLines ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; for ( int i = <NUM_LIT:0> ; i < linesNumber ; i ++ ) { printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; } emptyLines = this . tempBuffer . toString ( ) ; } else { emptyLines = getNewLineString ( linesNumber ) ; } this . lastNumberOfNewLines += linesNumber ; this . line += linesNumber ; this . column = <NUM_LIT:1> ; this . needSpace = false ; this . pendingSpace = false ; } else { if ( ( this . lastNumberOfNewLines - <NUM_LIT:1> ) >= linesNumber ) { return Util . EMPTY_STRING ; } final int realNewLineNumber = linesNumber - this . lastNumberOfNewLines + <NUM_LIT:1> ; if ( this . indentEmptyLines ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; for ( int i = <NUM_LIT:0> ; i < realNewLineNumber ; i ++ ) { printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; } emptyLines = this . tempBuffer . toString ( ) ; } else { emptyLines = getNewLineString ( realNewLineNumber ) ; } this . lastNumberOfNewLines += realNewLineNumber ; this . line += realNewLineNumber ; this . column = <NUM_LIT:1> ; this . needSpace = false ; this . pendingSpace = false ; } return emptyLines ; } public OptimizedReplaceEdit getLastEdit ( ) { if ( this . editsIndex > <NUM_LIT:0> ) { return this . edits [ this . editsIndex - <NUM_LIT:1> ] ; } return null ; } public final int getLineEnd ( int lineNumber ) { if ( this . lineEnds == null ) return - <NUM_LIT:1> ; if ( lineNumber >= this . lineEnds . length + <NUM_LIT:1> ) return this . scannerEndPosition ; if ( lineNumber <= <NUM_LIT:0> ) return - <NUM_LIT:1> ; return this . lineEnds [ lineNumber - <NUM_LIT:1> ] ; } Alignment getMemberAlignment ( ) { return this . memberAlignment ; } public String getNewLine ( ) { if ( this . nlsTagCounter > <NUM_LIT:0> ) { return Util . EMPTY_STRING ; } if ( this . lastNumberOfNewLines >= <NUM_LIT:1> ) { this . column = <NUM_LIT:1> ; return Util . EMPTY_STRING ; } this . line ++ ; this . lastNumberOfNewLines = <NUM_LIT:1> ; this . column = <NUM_LIT:1> ; this . needSpace = false ; this . pendingSpace = false ; return this . lineSeparator ; } private String getNewLineString ( int linesCount ) { int length = this . newEmptyLines . length ; if ( linesCount > length ) { System . arraycopy ( this . newEmptyLines , <NUM_LIT:0> , this . newEmptyLines = new String [ linesCount + <NUM_LIT:10> ] , <NUM_LIT:0> , length ) ; } String newLineString = this . newEmptyLines [ linesCount - <NUM_LIT:1> ] ; if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; for ( int j = <NUM_LIT:0> ; j < linesCount ; j ++ ) { this . tempBuffer . append ( this . lineSeparator ) ; } newLineString = this . tempBuffer . toString ( ) ; this . newEmptyLines [ linesCount - <NUM_LIT:1> ] = newLineString ; } return newLineString ; } public int getNextIndentationLevel ( int someColumn ) { int indent = someColumn - <NUM_LIT:1> ; if ( indent == <NUM_LIT:0> ) return this . indentationLevel ; if ( this . tabChar == DefaultCodeFormatterOptions . TAB ) { if ( this . useTabsOnlyForLeadingIndents ) { return indent ; } if ( this . indentationSize == <NUM_LIT:0> ) { return indent ; } int rem = indent % this . indentationSize ; int addition = rem == <NUM_LIT:0> ? <NUM_LIT:0> : this . indentationSize - rem ; return indent + addition ; } return indent ; } private String getPreserveEmptyLines ( int count , int emptyLinesRules ) { if ( count == <NUM_LIT:0> ) { int currentIndentationLevel = this . indentationLevel ; int useAlignmentBreakIndentation = useAlignmentBreakIndentation ( emptyLinesRules ) ; switch ( useAlignmentBreakIndentation ) { case PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION : return Util . EMPTY_STRING ; default : StringBuffer buffer = new StringBuffer ( getNewLine ( ) ) ; printIndentationIfNecessary ( buffer ) ; if ( useAlignmentBreakIndentation == PRESERVE_EMPTY_LINES_USE_TEMPORARY_INDENTATION ) { this . indentationLevel = currentIndentationLevel ; } return buffer . toString ( ) ; } } if ( this . blank_lines_between_import_groups >= <NUM_LIT:0> ) { useAlignmentBreakIndentation ( emptyLinesRules ) ; return getEmptyLines ( this . blank_lines_between_import_groups ) ; } if ( this . formatter . preferences . number_of_empty_lines_to_preserve != <NUM_LIT:0> ) { useAlignmentBreakIndentation ( emptyLinesRules ) ; int linesToPreserve = Math . min ( count , this . formatter . preferences . number_of_empty_lines_to_preserve ) ; return getEmptyLines ( linesToPreserve ) ; } return getNewLine ( ) ; } private int useAlignmentBreakIndentation ( int emptyLinesRules ) { boolean specificEmptyLinesRule = emptyLinesRules != PRESERVE_EMPTY_LINES_KEEP_LAST_NEW_LINES_INDENTATION ; if ( ( this . currentAlignment != null || specificEmptyLinesRule ) && ! this . formatter . preferences . join_wrapped_lines ) { if ( this . lastNumberOfNewLines == <NUM_LIT:0> || specificEmptyLinesRule || this . formatter . arrayInitializersDepth >= <NUM_LIT:0> ) { boolean useAlignmentBreakIndentation ; boolean useAlignmentShiftBreakIndentation = false ; boolean useLastBinaryExpressionAlignmentBreakIndentation = false ; switch ( emptyLinesRules ) { case DO_NOT_PRESERVE_EMPTY_LINES : case PRESERVE_EMPTY_LINES_IN_SWITCH_CASE : case PRESERVE_EMPTY_LINES_AT_END_OF_METHOD_DECLARATION : case PRESERVE_EMPTY_LINES_AT_END_OF_BLOCK : return PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION ; case PRESERVE_EMPTY_LINES_IN_BINARY_EXPRESSION : useAlignmentBreakIndentation = true ; if ( ( this . formatter . expressionsPos & CodeFormatterVisitor . EXPRESSIONS_POS_MASK ) == CodeFormatterVisitor . EXPRESSIONS_POS_BETWEEN_TWO ) { useLastBinaryExpressionAlignmentBreakIndentation = true ; } break ; case PRESERVE_EMPTY_LINES_IN_EQUALITY_EXPRESSION : useAlignmentShiftBreakIndentation = this . currentAlignment == null || this . currentAlignment . kind == Alignment . BINARY_EXPRESSION ; useAlignmentBreakIndentation = ! useAlignmentShiftBreakIndentation ; break ; case PRESERVE_EMPTY_LINES_IN_FORMAT_OPENING_BRACE : useAlignmentBreakIndentation = this . formatter . arrayInitializersDepth <= <NUM_LIT:1> && this . currentAlignment != null && this . currentAlignment . kind == Alignment . ARRAY_INITIALIZER ; break ; case PRESERVE_EMPTY_LINES_IN_FORMAT_LEFT_CURLY_BRACE : useAlignmentBreakIndentation = false ; break ; default : if ( ( emptyLinesRules & <NUM_LIT> ) == PRESERVE_EMPTY_LINES_IN_CLOSING_ARRAY_INITIALIZER && this . scanner . currentCharacter == '<CHAR_LIT:}>' ) { this . indentationLevel = emptyLinesRules > > <NUM_LIT:16> ; this . preserveLineBreakIndentation = true ; return PRESERVE_EMPTY_LINES_USE_CURRENT_INDENTATION ; } useAlignmentBreakIndentation = true ; break ; } Alignment alignment = this . currentAlignment ; if ( alignment == null ) { if ( useLastBinaryExpressionAlignmentBreakIndentation ) { if ( this . indentationLevel < this . formatter . lastBinaryExpressionAlignmentBreakIndentation ) { this . indentationLevel = this . formatter . lastBinaryExpressionAlignmentBreakIndentation ; } } if ( useAlignmentShiftBreakIndentation && this . memberAlignment != null ) { if ( this . indentationLevel < this . memberAlignment . shiftBreakIndentationLevel ) { this . indentationLevel = this . memberAlignment . shiftBreakIndentationLevel ; } } } else { if ( this . memberAlignment != null && this . memberAlignment . location . inputOffset > alignment . location . inputOffset ) { alignment = this . memberAlignment ; } if ( useLastBinaryExpressionAlignmentBreakIndentation ) { if ( this . indentationLevel < this . formatter . lastBinaryExpressionAlignmentBreakIndentation ) { this . indentationLevel = this . formatter . lastBinaryExpressionAlignmentBreakIndentation ; } } if ( useAlignmentBreakIndentation ) { if ( this . indentationLevel < alignment . breakIndentationLevel ) { this . indentationLevel = alignment . breakIndentationLevel ; } } else if ( useAlignmentShiftBreakIndentation ) { if ( this . indentationLevel < alignment . shiftBreakIndentationLevel ) { this . indentationLevel = alignment . shiftBreakIndentationLevel ; } } } this . preserveLineBreakIndentation = true ; if ( useLastBinaryExpressionAlignmentBreakIndentation || useAlignmentShiftBreakIndentation ) { return PRESERVE_EMPTY_LINES_USE_TEMPORARY_INDENTATION ; } return PRESERVE_EMPTY_LINES_USE_CURRENT_INDENTATION ; } } return PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION ; } public TextEdit getRootEdit ( ) { adaptRegions ( ) ; adaptEdits ( ) ; MultiTextEdit edit = null ; int regionsLength = this . adaptedRegions . length ; int textRegionStart ; int textRegionEnd ; if ( regionsLength == <NUM_LIT:1> ) { IRegion lastRegion = this . adaptedRegions [ <NUM_LIT:0> ] ; textRegionStart = lastRegion . getOffset ( ) ; textRegionEnd = textRegionStart + lastRegion . getLength ( ) ; } else { textRegionStart = this . adaptedRegions [ <NUM_LIT:0> ] . getOffset ( ) ; IRegion lastRegion = this . adaptedRegions [ regionsLength - <NUM_LIT:1> ] ; textRegionEnd = lastRegion . getOffset ( ) + lastRegion . getLength ( ) ; } int length = textRegionEnd - textRegionStart + <NUM_LIT:1> ; if ( textRegionStart <= <NUM_LIT:0> ) { if ( length <= <NUM_LIT:0> ) { edit = new MultiTextEdit ( <NUM_LIT:0> , <NUM_LIT:0> ) ; } else { edit = new MultiTextEdit ( <NUM_LIT:0> , textRegionEnd ) ; } } else { edit = new MultiTextEdit ( textRegionStart , length - <NUM_LIT:1> ) ; } for ( int i = <NUM_LIT:0> , max = this . editsIndex ; i < max ; i ++ ) { OptimizedReplaceEdit currentEdit = this . edits [ i ] ; if ( currentEdit . offset >= <NUM_LIT:0> && currentEdit . offset <= this . scannerEndPosition ) { if ( currentEdit . length == <NUM_LIT:0> || ( currentEdit . offset != this . scannerEndPosition && isMeaningfulEdit ( currentEdit ) ) ) { try { edit . addChild ( new ReplaceEdit ( currentEdit . offset , currentEdit . length , currentEdit . replacement ) ) ; } catch ( MalformedTreeException ex ) { CommentFormatterUtil . log ( ex ) ; throw ex ; } } } } this . edits = null ; return edit ; } public void handleLineTooLong ( ) { if ( this . formatter . preferences . wrap_outer_expressions_when_nested ) { handleLineTooLongSmartly ( ) ; return ; } int relativeDepth = <NUM_LIT:0> , outerMostDepth = - <NUM_LIT:1> ; Alignment targetAlignment = this . currentAlignment ; while ( targetAlignment != null ) { if ( targetAlignment . tieBreakRule == Alignment . R_OUTERMOST && targetAlignment . couldBreak ( ) ) { outerMostDepth = relativeDepth ; } targetAlignment = targetAlignment . enclosing ; relativeDepth ++ ; } if ( outerMostDepth >= <NUM_LIT:0> ) { throw new AlignmentException ( AlignmentException . LINE_TOO_LONG , outerMostDepth ) ; } relativeDepth = <NUM_LIT:0> ; targetAlignment = this . currentAlignment ; while ( targetAlignment != null ) { if ( targetAlignment . couldBreak ( ) ) { throw new AlignmentException ( AlignmentException . LINE_TOO_LONG , relativeDepth ) ; } targetAlignment = targetAlignment . enclosing ; relativeDepth ++ ; } } private void handleLineTooLongSmartly ( ) { int relativeDepth = <NUM_LIT:0> , outerMostDepth = - <NUM_LIT:1> ; Alignment targetAlignment = this . currentAlignment ; int previousKind = - <NUM_LIT:1> ; int insideMessage = <NUM_LIT:0> ; boolean insideStringConcat = false ; while ( targetAlignment != null ) { boolean couldBreak = targetAlignment . tieBreakRule == Alignment . R_OUTERMOST || ( ! insideStringConcat && insideMessage > <NUM_LIT:0> && targetAlignment . kind == Alignment . MESSAGE_ARGUMENTS && ( ! targetAlignment . wasReset ( ) || previousKind != Alignment . MESSAGE_SEND ) ) ; if ( couldBreak && targetAlignment . couldBreak ( ) ) { outerMostDepth = relativeDepth ; } switch ( targetAlignment . kind ) { case Alignment . MESSAGE_ARGUMENTS : case Alignment . MESSAGE_SEND : insideMessage ++ ; break ; case Alignment . STRING_CONCATENATION : insideStringConcat = true ; break ; } previousKind = targetAlignment . kind ; targetAlignment = targetAlignment . enclosing ; relativeDepth ++ ; } if ( outerMostDepth >= <NUM_LIT:0> ) { throw new AlignmentException ( AlignmentException . LINE_TOO_LONG , outerMostDepth ) ; } relativeDepth = <NUM_LIT:0> ; targetAlignment = this . currentAlignment ; AlignmentException alignmentException = null ; int msgArgsDepth = - <NUM_LIT:1> ; while ( targetAlignment != null ) { if ( targetAlignment . kind == Alignment . MESSAGE_ARGUMENTS ) { msgArgsDepth = relativeDepth ; } if ( alignmentException == null ) { if ( targetAlignment . couldBreak ( ) ) { alignmentException = new AlignmentException ( AlignmentException . LINE_TOO_LONG , relativeDepth ) ; if ( insideStringConcat ) throw alignmentException ; } } else if ( targetAlignment . wasSplit ) { if ( ! targetAlignment . wasReset ( ) ) { targetAlignment . reset ( ) ; if ( msgArgsDepth > alignmentException . relativeDepth ) { alignmentException . relativeDepth = msgArgsDepth ; } throw alignmentException ; } } targetAlignment = targetAlignment . enclosing ; relativeDepth ++ ; } if ( alignmentException != null ) { throw alignmentException ; } if ( this . currentAlignment != null ) { this . currentAlignment . blockAlign = false ; this . currentAlignment . tooLong = true ; } } private boolean hasNLSTag ( int sourceStart ) { if ( this . lineEnds == null ) return false ; int index = Arrays . binarySearch ( this . lineEnds , sourceStart ) ; int currentLineEnd = getLineEnd ( - index ) ; if ( currentLineEnd != - <NUM_LIT:1> ) { int commentIndex = getCommentIndex ( currentLineEnd ) ; if ( commentIndex < <NUM_LIT:0> ) { commentIndex = - commentIndex - <NUM_LIT:2> ; } if ( commentIndex >= <NUM_LIT:0> && commentIndex < this . commentPositions . length ) { int start = this . commentPositions [ commentIndex ] [ <NUM_LIT:0> ] ; if ( start < <NUM_LIT:0> ) { start = - start ; int lineIndexForComment = Arrays . binarySearch ( this . lineEnds , start ) ; if ( lineIndexForComment == index ) { return CharOperation . indexOf ( Scanner . TAG_PREFIX , this . scanner . source , true , start , currentLineEnd ) != - <NUM_LIT:1> ; } } } } return false ; } private boolean includesBlockComments ( ) { return ( ( this . formatComments & INCLUDE_BLOCK_COMMENTS ) == INCLUDE_BLOCK_COMMENTS && this . headerEndPosition < this . scanner . currentPosition ) || ( this . formatter . preferences . comment_format_header && this . headerEndPosition >= this . scanner . currentPosition ) ; } private boolean includesJavadocComments ( ) { return ( ( this . formatComments & INCLUDE_JAVA_DOC ) == INCLUDE_JAVA_DOC && this . headerEndPosition < this . scanner . currentPosition ) || ( this . formatter . preferences . comment_format_header && this . headerEndPosition >= this . scanner . currentPosition ) ; } private boolean includesLineComments ( ) { return ( ( this . formatComments & INCLUDE_LINE_COMMENTS ) == INCLUDE_LINE_COMMENTS && this . headerEndPosition < this . scanner . currentPosition ) || ( this . formatter . preferences . comment_format_header && this . headerEndPosition >= this . scanner . currentPosition ) ; } boolean includesComments ( ) { return ( this . formatComments & CodeFormatter . F_INCLUDE_COMMENTS ) != <NUM_LIT:0> ; } public void indent ( ) { this . indentationLevel += this . indentationSize ; this . numberOfIndentations ++ ; } void setIndentation ( int level , int n ) { this . indentationLevel = level + n * this . indentationSize ; this . numberOfIndentations = this . indentationLevel / this . indentationSize ; } private void initializeScanner ( long sourceLevel , DefaultCodeFormatterOptions preferences ) { this . useTags = preferences . use_tags ; this . tagsKind = <NUM_LIT:0> ; char [ ] [ ] taskTags = null ; if ( this . useTags ) { this . disablingTag = preferences . disabling_tag ; this . enablingTag = preferences . enabling_tag ; if ( this . disablingTag == null ) { if ( this . enablingTag != null ) { taskTags = new char [ ] [ ] { this . enablingTag } ; } } else if ( this . enablingTag == null ) { taskTags = new char [ ] [ ] { this . disablingTag } ; } else { taskTags = new char [ ] [ ] { this . disablingTag , this . enablingTag } ; } } if ( taskTags != null ) { loop : for ( int i = <NUM_LIT:0> , length = taskTags . length ; i < length ; i ++ ) { if ( taskTags [ i ] . length > <NUM_LIT:2> && taskTags [ i ] [ <NUM_LIT:0> ] == '<CHAR_LIT:/>' ) { switch ( taskTags [ i ] [ <NUM_LIT:1> ] ) { case '<CHAR_LIT:/>' : this . tagsKind = TerminalTokens . TokenNameCOMMENT_LINE ; break loop ; case '<CHAR_LIT>' : if ( taskTags [ i ] [ <NUM_LIT:2> ] != '<CHAR_LIT>' ) { this . tagsKind = TerminalTokens . TokenNameCOMMENT_BLOCK ; break loop ; } break ; } } } } this . scanner = new Scanner ( true , true , false , sourceLevel , taskTags , null , true ) ; this . editsEnabled = true ; } private void initFormatterCommentParser ( ) { if ( this . formatterCommentParser == null ) { this . formatterCommentParser = new FormatterCommentParser ( this . scanner . sourceLevel ) ; } this . formatterCommentParser . scanner . setSource ( this . scanner . source ) ; this . formatterCommentParser . source = this . scanner . source ; this . formatterCommentParser . scanner . lineEnds = this . lineEnds ; this . formatterCommentParser . scanner . linePtr = this . maxLines ; this . formatterCommentParser . parseHtmlTags = this . formatter . preferences . comment_format_html ; } private boolean isOnFirstColumn ( int start ) { if ( this . lineEnds == null ) return start == <NUM_LIT:0> ; int index = Arrays . binarySearch ( this . lineEnds , start ) ; int previousLineEnd = getLineEnd ( - index - <NUM_LIT:1> ) ; return previousLineEnd != - <NUM_LIT:1> && previousLineEnd == start - <NUM_LIT:1> ; } private boolean isMeaningfulEdit ( OptimizedReplaceEdit edit ) { final int editLength = edit . length ; final int editReplacementLength = edit . replacement . length ( ) ; final int editOffset = edit . offset ; if ( editReplacementLength != <NUM_LIT:0> && editLength == editReplacementLength ) { for ( int i = editOffset , max = editOffset + editLength ; i < max ; i ++ ) { if ( this . scanner . source [ i ] != edit . replacement . charAt ( i - editOffset ) ) { return true ; } } return false ; } return true ; } private void preserveEmptyLines ( int count , int insertPosition ) { if ( count > <NUM_LIT:0> ) { if ( this . blank_lines_between_import_groups >= <NUM_LIT:0> ) { printEmptyLines ( this . blank_lines_between_import_groups , insertPosition ) ; } else if ( this . formatter . preferences . number_of_empty_lines_to_preserve != <NUM_LIT:0> ) { int linesToPreserve = Math . min ( count , this . formatter . preferences . number_of_empty_lines_to_preserve ) ; printEmptyLines ( linesToPreserve , insertPosition ) ; } else { printNewLine ( insertPosition ) ; } } } private void print ( int length , boolean considerSpaceIfAny ) { if ( this . checkLineWrapping && length + this . column > this . pageWidth ) { handleLineTooLong ( ) ; } this . lastNumberOfNewLines = <NUM_LIT:0> ; if ( this . indentationLevel != <NUM_LIT:0> ) { printIndentationIfNecessary ( ) ; } if ( considerSpaceIfAny ) { space ( ) ; } if ( this . pendingSpace ) { addInsertEdit ( this . scanner . getCurrentTokenStartPosition ( ) , "<STR_LIT:U+0020>" ) ; } this . pendingSpace = false ; this . column += length ; this . needSpace = true ; } private void printBlockComment ( boolean isJavadoc ) { int currentTokenStartPosition = this . scanner . getCurrentTokenStartPosition ( ) ; int currentTokenEndPosition = this . scanner . getCurrentTokenEndPosition ( ) + <NUM_LIT:1> ; boolean includesBlockComments = ! isJavadoc && includesBlockComments ( ) ; this . scanner . resetTo ( currentTokenStartPosition , currentTokenEndPosition - <NUM_LIT:1> ) ; int currentCharacter ; boolean isNewLine = false ; int start = currentTokenStartPosition ; int nextCharacterStart = currentTokenStartPosition ; int previousStart = currentTokenStartPosition ; boolean onFirstColumn = isOnFirstColumn ( start ) ; boolean indentComment = false ; if ( this . indentationLevel != <NUM_LIT:0> ) { if ( isJavadoc || ! this . formatter . preferences . never_indent_block_comments_on_first_column || ! onFirstColumn ) { indentComment = true ; printIndentationIfNecessary ( ) ; } } if ( this . pendingSpace ) { addInsertEdit ( currentTokenStartPosition , "<STR_LIT:U+0020>" ) ; } this . needSpace = false ; this . pendingSpace = false ; int commentColumn = this . column ; if ( includesBlockComments ) { if ( printBlockComment ( currentTokenStartPosition , currentTokenEndPosition ) ) { return ; } } int currentIndentationLevel = this . indentationLevel ; if ( ( commentColumn - <NUM_LIT:1> ) > this . indentationLevel ) { this . indentationLevel = commentColumn - <NUM_LIT:1> ; } int currentCommentIndentation = onFirstColumn ? <NUM_LIT:0> : getCurrentCommentIndentation ( start ) ; boolean formatComment = ( isJavadoc && ( this . formatComments & CodeFormatter . K_JAVA_DOC ) != <NUM_LIT:0> ) || ( ! isJavadoc && ( this . formatComments & CodeFormatter . K_MULTI_LINE_COMMENT ) != <NUM_LIT:0> ) ; try { while ( nextCharacterStart <= currentTokenEndPosition && ( currentCharacter = this . scanner . getNextChar ( ) ) != - <NUM_LIT:1> ) { nextCharacterStart = this . scanner . currentPosition ; switch ( currentCharacter ) { case '<STR_LIT>' : start = previousStart ; isNewLine = true ; if ( this . scanner . getNextChar ( '<STR_LIT:\n>' ) ) { currentCharacter = '<STR_LIT:\n>' ; nextCharacterStart = this . scanner . currentPosition ; } break ; case '<STR_LIT:\n>' : start = previousStart ; isNewLine = true ; nextCharacterStart = this . scanner . currentPosition ; break ; default : if ( isNewLine ) { this . column = <NUM_LIT:1> ; this . line ++ ; isNewLine = false ; boolean addSpace = false ; if ( onFirstColumn ) { if ( formatComment ) { if ( ScannerHelper . isWhitespace ( ( char ) currentCharacter ) ) { int previousStartPosition = this . scanner . currentPosition ; while ( currentCharacter != - <NUM_LIT:1> && currentCharacter != '<STR_LIT>' && currentCharacter != '<STR_LIT:\n>' && ScannerHelper . isWhitespace ( ( char ) currentCharacter ) ) { previousStart = nextCharacterStart ; previousStartPosition = this . scanner . currentPosition ; currentCharacter = this . scanner . getNextChar ( ) ; nextCharacterStart = this . scanner . currentPosition ; } if ( currentCharacter == '<STR_LIT>' || currentCharacter == '<STR_LIT:\n>' ) { nextCharacterStart = previousStartPosition ; } } if ( currentCharacter != '<STR_LIT>' && currentCharacter != '<STR_LIT:\n>' ) { addSpace = true ; } } } else { if ( ScannerHelper . isWhitespace ( ( char ) currentCharacter ) ) { int previousStartPosition = this . scanner . currentPosition ; int currentIndentation = <NUM_LIT:0> ; loop : while ( currentCharacter != - <NUM_LIT:1> && currentCharacter != '<STR_LIT>' && currentCharacter != '<STR_LIT:\n>' && ScannerHelper . isWhitespace ( ( char ) currentCharacter ) ) { if ( currentIndentation >= currentCommentIndentation ) { break loop ; } previousStart = nextCharacterStart ; previousStartPosition = this . scanner . currentPosition ; switch ( currentCharacter ) { case '<STR_LIT:\t>' : if ( this . tabLength != <NUM_LIT:0> ) { int reminder = currentIndentation % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { currentIndentation += this . tabLength ; } else { currentIndentation = ( ( currentIndentation / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } } break ; default : currentIndentation ++ ; } currentCharacter = this . scanner . getNextChar ( ) ; nextCharacterStart = this . scanner . currentPosition ; } if ( currentCharacter == '<STR_LIT>' || currentCharacter == '<STR_LIT:\n>' ) { nextCharacterStart = previousStartPosition ; } } if ( formatComment ) { int previousStartTemp = previousStart ; int nextCharacterStartTemp = nextCharacterStart ; while ( currentCharacter != - <NUM_LIT:1> && currentCharacter != '<STR_LIT>' && currentCharacter != '<STR_LIT:\n>' && ScannerHelper . isWhitespace ( ( char ) currentCharacter ) ) { previousStart = nextCharacterStart ; currentCharacter = this . scanner . getNextChar ( ) ; nextCharacterStart = this . scanner . currentPosition ; } if ( currentCharacter == '<CHAR_LIT>' ) { addSpace = true ; } else { previousStart = previousStartTemp ; nextCharacterStart = nextCharacterStartTemp ; } this . scanner . currentPosition = nextCharacterStart ; } } String replacement ; if ( indentComment ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( this . lineSeparator ) ; if ( this . indentationLevel > <NUM_LIT:0> ) { printIndentationIfNecessary ( this . tempBuffer ) ; } if ( addSpace ) { this . tempBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } replacement = this . tempBuffer . toString ( ) ; } else { replacement = addSpace ? this . lineSeparatorAndSpace : this . lineSeparator ; } addReplaceEdit ( start , previousStart - <NUM_LIT:1> , replacement ) ; } else { this . column += ( nextCharacterStart - previousStart ) ; } } previousStart = nextCharacterStart ; this . scanner . currentPosition = nextCharacterStart ; } } finally { this . indentationLevel = currentIndentationLevel ; } this . lastNumberOfNewLines = <NUM_LIT:0> ; this . needSpace = false ; this . scanner . resetTo ( currentTokenEndPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; } private boolean printBlockComment ( int currentTokenStartPosition , int currentTokenEndPosition ) { int maxColumn = this . formatter . preferences . comment_line_length + <NUM_LIT:1> ; int indentLevel = this . indentationLevel ; int indentations = this . numberOfIndentations ; switch ( this . tabChar ) { case DefaultCodeFormatterOptions . TAB : switch ( this . tabLength ) { case <NUM_LIT:0> : this . indentationLevel = <NUM_LIT:0> ; this . column = <NUM_LIT:1> ; this . numberOfIndentations = <NUM_LIT:0> ; break ; case <NUM_LIT:1> : this . indentationLevel = this . column - <NUM_LIT:1> ; this . numberOfIndentations = this . indentationLevel ; break ; default : this . indentationLevel = ( this . column / this . tabLength ) * this . tabLength ; this . column = this . indentationLevel + <NUM_LIT:1> ; this . numberOfIndentations = this . indentationLevel / this . tabLength ; } break ; case DefaultCodeFormatterOptions . MIXED : if ( this . tabLength == <NUM_LIT:0> ) { this . indentationLevel = <NUM_LIT:0> ; this . column = <NUM_LIT:1> ; this . numberOfIndentations = <NUM_LIT:0> ; } else { this . indentationLevel = this . column - <NUM_LIT:1> ; this . numberOfIndentations = this . indentationLevel / this . tabLength ; } break ; case DefaultCodeFormatterOptions . SPACE : if ( this . indentationSize == <NUM_LIT:0> ) { this . indentationLevel = <NUM_LIT:0> ; this . column = <NUM_LIT:1> ; this . numberOfIndentations = <NUM_LIT:0> ; } else { this . indentationLevel = this . column - <NUM_LIT:1> ; } break ; } this . blockCommentBuffer . setLength ( <NUM_LIT:0> ) ; this . scanner . getNextChar ( ) ; this . scanner . getNextChar ( ) ; this . column += <NUM_LIT:2> ; this . scanner . skipComments = true ; this . blockCommentTokensBuffer . setLength ( <NUM_LIT:0> ) ; int editStart = this . scanner . currentPosition ; int editEnd = - <NUM_LIT:1> ; int previousToken = - <NUM_LIT:1> ; boolean newLine = false ; boolean multiLines = false ; boolean hasMultiLines = false ; boolean hasTokens = false ; boolean bufferHasTokens = false ; boolean bufferHasNewLine = false ; boolean lineHasTokens = false ; int hasTextOnFirstLine = <NUM_LIT:0> ; boolean firstWord = true ; boolean clearBlankLines = this . formatter . preferences . comment_clear_blank_lines_in_block_comment ; boolean joinLines = this . formatter . preferences . join_lines_in_comments ; boolean newLinesAtBoundaries = this . formatter . preferences . comment_new_lines_at_block_boundaries ; int scannerLine = Util . getLineNumber ( this . scanner . currentPosition , this . lineEnds , <NUM_LIT:0> , this . maxLines ) ; int firstLine = scannerLine ; int lineNumber = scannerLine ; int lastTextLine = - <NUM_LIT:1> ; while ( ! this . scanner . atEnd ( ) ) { int token ; try { token = this . scanner . getNextToken ( ) ; } catch ( InvalidInputException iie ) { token = consumeInvalidToken ( currentTokenEndPosition - <NUM_LIT:1> ) ; newLine = false ; } boolean insertSpace = ( previousToken == TerminalTokens . TokenNameWHITESPACE ) && ( ! firstWord || ! hasTokens ) ; boolean isTokenStar = false ; switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : if ( this . blockCommentTokensBuffer . length ( ) > <NUM_LIT:0> ) { if ( hasTextOnFirstLine == <NUM_LIT:1> && multiLines ) { printBlockCommentHeaderLine ( this . blockCommentBuffer ) ; hasTextOnFirstLine = - <NUM_LIT:1> ; } this . blockCommentBuffer . append ( this . blockCommentTokensBuffer ) ; this . column += this . blockCommentTokensBuffer . length ( ) ; this . blockCommentTokensBuffer . setLength ( <NUM_LIT:0> ) ; bufferHasTokens = true ; bufferHasNewLine = false ; } if ( previousToken == - <NUM_LIT:1> ) { previousToken = SKIP_FIRST_WHITESPACE_TOKEN ; } else { previousToken = token ; } lineNumber = Util . getLineNumber ( this . scanner . currentPosition , this . lineEnds , scannerLine > <NUM_LIT:1> ? scannerLine - <NUM_LIT:2> : <NUM_LIT:0> , this . maxLines ) ; if ( lineNumber > scannerLine ) { hasMultiLines = true ; newLine = true ; } scannerLine = lineNumber ; continue ; case TerminalTokens . TokenNameMULTIPLY : isTokenStar = true ; lineNumber = Util . getLineNumber ( this . scanner . currentPosition , this . lineEnds , scannerLine > <NUM_LIT:1> ? scannerLine - <NUM_LIT:2> : <NUM_LIT:0> , this . maxLines ) ; if ( lineNumber == firstLine && previousToken == SKIP_FIRST_WHITESPACE_TOKEN ) { this . blockCommentBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } previousToken = token ; if ( this . scanner . currentCharacter == '<CHAR_LIT:/>' ) { editEnd = this . scanner . startPosition - <NUM_LIT:1> ; if ( this . blockCommentTokensBuffer . length ( ) > <NUM_LIT:0> ) { this . blockCommentBuffer . append ( this . blockCommentTokensBuffer ) ; this . column += this . blockCommentTokensBuffer . length ( ) ; } if ( newLinesAtBoundaries ) { if ( multiLines || hasMultiLines ) { this . blockCommentBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . blockCommentBuffer ) ; } } this . blockCommentBuffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column += BLOCK_FOOTER_LENGTH + <NUM_LIT:1> ; this . scanner . getNextChar ( ) ; continue ; } if ( newLine ) { scannerLine = lineNumber ; newLine = false ; continue ; } break ; case TerminalTokens . TokenNameMULTIPLY_EQUAL : if ( newLine ) { this . scanner . resetTo ( this . scanner . startPosition , currentTokenEndPosition - <NUM_LIT:1> ) ; this . scanner . getNextChar ( ) ; previousToken = TerminalTokens . TokenNameMULTIPLY ; scannerLine = Util . getLineNumber ( this . scanner . currentPosition , this . lineEnds , scannerLine > <NUM_LIT:1> ? scannerLine - <NUM_LIT:2> : <NUM_LIT:0> , this . maxLines ) ; continue ; } break ; case TerminalTokens . TokenNameMINUS : case TerminalTokens . TokenNameMINUS_MINUS : if ( previousToken == - <NUM_LIT:1> ) { this . indentationLevel = indentLevel ; this . numberOfIndentations = indentations ; this . lastNumberOfNewLines = <NUM_LIT:0> ; this . needSpace = false ; this . scanner . skipComments = false ; this . scanner . resetTo ( currentTokenStartPosition , currentTokenEndPosition - <NUM_LIT:1> ) ; return false ; } break ; default : break ; } int linesGap ; int max ; lineNumber = Util . getLineNumber ( this . scanner . currentPosition , this . lineEnds , scannerLine > <NUM_LIT:1> ? scannerLine - <NUM_LIT:2> : <NUM_LIT:0> , this . maxLines ) ; if ( lastTextLine == - <NUM_LIT:1> ) { linesGap = newLinesAtBoundaries ? lineNumber - firstLine : <NUM_LIT:0> ; max = <NUM_LIT:0> ; } else { linesGap = lineNumber - lastTextLine ; if ( token == TerminalTokens . TokenNameAT && linesGap == <NUM_LIT:1> ) { linesGap = <NUM_LIT:2> ; } max = joinLines && lineHasTokens ? <NUM_LIT:1> : <NUM_LIT:0> ; } if ( linesGap > max ) { if ( clearBlankLines ) { if ( token == TerminalTokens . TokenNameAT ) { linesGap = <NUM_LIT:1> ; } else { linesGap = ( max == <NUM_LIT:0> || ! joinLines ) ? <NUM_LIT:1> : <NUM_LIT:0> ; } } for ( int i = <NUM_LIT:0> ; i < linesGap ; i ++ ) { if ( this . blockCommentTokensBuffer . length ( ) > <NUM_LIT:0> ) { if ( hasTextOnFirstLine == <NUM_LIT:1> ) { printBlockCommentHeaderLine ( this . blockCommentBuffer ) ; hasTextOnFirstLine = - <NUM_LIT:1> ; } this . blockCommentBuffer . append ( this . blockCommentTokensBuffer ) ; this . blockCommentTokensBuffer . setLength ( <NUM_LIT:0> ) ; bufferHasTokens = true ; } this . blockCommentBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . blockCommentBuffer ) ; this . blockCommentBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; firstWord = true ; multiLines = true ; bufferHasNewLine = true ; } insertSpace = insertSpace && linesGap == <NUM_LIT:0> ; } if ( newLine ) lineHasTokens = false ; int tokenStart = this . scanner . getCurrentTokenStartPosition ( ) ; int tokenLength = ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - tokenStart ; hasTokens = true ; if ( ! isTokenStar ) lineHasTokens = true ; if ( hasTextOnFirstLine == <NUM_LIT:0> && ! isTokenStar ) { if ( firstLine == lineNumber ) { hasTextOnFirstLine = <NUM_LIT:1> ; this . column ++ ; } else { hasTextOnFirstLine = - <NUM_LIT:1> ; } } int lastColumn = this . column + this . blockCommentTokensBuffer . length ( ) + tokenLength ; if ( insertSpace ) lastColumn ++ ; if ( lineHasTokens && ! firstWord && lastColumn > maxColumn ) { String tokensString = this . blockCommentTokensBuffer . toString ( ) . trim ( ) ; int tokensStringLength = tokensString . length ( ) ; if ( hasTextOnFirstLine == <NUM_LIT:1> ) { printBlockCommentHeaderLine ( this . blockCommentBuffer ) ; } if ( ( this . indentationLevel + tokensStringLength + tokenLength ) > maxColumn ) { this . blockCommentBuffer . append ( this . blockCommentTokensBuffer ) ; this . column += this . blockCommentTokensBuffer . length ( ) ; this . blockCommentTokensBuffer . setLength ( <NUM_LIT:0> ) ; bufferHasNewLine = false ; bufferHasTokens = true ; } if ( bufferHasTokens && ! bufferHasNewLine ) { this . blockCommentBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . blockCommentBuffer ) ; this . blockCommentBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; } if ( this . blockCommentTokensBuffer . length ( ) > <NUM_LIT:0> ) { this . blockCommentBuffer . append ( tokensString ) ; this . column += tokensStringLength ; this . blockCommentTokensBuffer . setLength ( <NUM_LIT:0> ) ; } this . blockCommentBuffer . append ( this . scanner . source , tokenStart , tokenLength ) ; bufferHasTokens = true ; bufferHasNewLine = false ; this . column += tokenLength ; multiLines = true ; hasTextOnFirstLine = - <NUM_LIT:1> ; } else { if ( insertSpace ) { this . blockCommentTokensBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } this . blockCommentTokensBuffer . append ( this . scanner . source , tokenStart , tokenLength ) ; } previousToken = token ; newLine = false ; firstWord = false ; scannerLine = lineNumber ; lastTextLine = lineNumber ; } if ( this . nlsTagCounter == <NUM_LIT:0> || ! multiLines ) { if ( hasTokens || multiLines ) { StringBuffer replacement ; if ( hasTextOnFirstLine == <NUM_LIT:1> ) { this . blockCommentTokensBuffer . setLength ( <NUM_LIT:0> ) ; replacement = this . blockCommentTokensBuffer ; if ( ( hasMultiLines || multiLines ) ) { int col = this . column ; replacement . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( replacement ) ; replacement . append ( BLOCK_LINE_PREFIX ) ; this . column = col ; } else if ( this . blockCommentBuffer . length ( ) == <NUM_LIT:0> || this . blockCommentBuffer . charAt ( <NUM_LIT:0> ) != '<CHAR_LIT:U+0020>' ) { replacement . append ( '<CHAR_LIT:U+0020>' ) ; } replacement . append ( this . blockCommentBuffer ) ; } else { replacement = this . blockCommentBuffer ; } addReplaceEdit ( editStart , editEnd , replacement . toString ( ) ) ; } } this . indentationLevel = indentLevel ; this . numberOfIndentations = indentations ; this . lastNumberOfNewLines = <NUM_LIT:0> ; this . needSpace = false ; this . scanner . resetTo ( currentTokenEndPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; this . scanner . skipComments = false ; return true ; } private void printBlockCommentHeaderLine ( StringBuffer buffer ) { if ( ! this . formatter . preferences . comment_new_lines_at_block_boundaries ) { buffer . insert ( <NUM_LIT:0> , '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } else if ( buffer . length ( ) == <NUM_LIT:0> ) { buffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( buffer ) ; buffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; } else { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; buffer . insert ( <NUM_LIT:0> , this . tempBuffer . toString ( ) ) ; } } public void printEndOfCompilationUnit ( ) { try { int currentTokenStartPosition = this . scanner . currentPosition ; boolean hasComment = false ; boolean hasLineComment = false ; boolean hasWhitespace = false ; int count = <NUM_LIT:0> ; while ( true ) { this . currentToken = this . scanner . getNextToken ( ) ; switch ( this . currentToken ) { case TerminalTokens . TokenNameWHITESPACE : char [ ] whiteSpaces = this . scanner . getCurrentTokenSource ( ) ; count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = whiteSpaces . length ; i < max ; i ++ ) { switch ( whiteSpaces [ i ] ) { case '<STR_LIT>' : if ( ( i + <NUM_LIT:1> ) < max ) { if ( whiteSpaces [ i + <NUM_LIT:1> ] == '<STR_LIT:\n>' ) { i ++ ; } } count ++ ; break ; case '<STR_LIT:\n>' : count ++ ; } } if ( count == <NUM_LIT:0> ) { hasWhitespace = true ; addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; } else if ( hasLineComment ) { preserveEmptyLines ( count , this . scanner . getCurrentTokenStartPosition ( ) ) ; addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; } else if ( hasComment ) { if ( count == <NUM_LIT:1> ) { this . printNewLine ( this . scanner . getCurrentTokenStartPosition ( ) ) ; } else { preserveEmptyLines ( count - <NUM_LIT:1> , this . scanner . getCurrentTokenStartPosition ( ) ) ; } addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; } else { addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; } currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_LINE : if ( count >= <NUM_LIT:1> ) { if ( count > <NUM_LIT:1> ) { preserveEmptyLines ( count - <NUM_LIT:1> , this . scanner . getCurrentTokenStartPosition ( ) ) ; } else if ( count == <NUM_LIT:1> ) { printNewLine ( this . scanner . getCurrentTokenStartPosition ( ) ) ; } } else if ( hasWhitespace ) { space ( ) ; } hasWhitespace = false ; printLineComment ( ) ; currentTokenStartPosition = this . scanner . currentPosition ; hasLineComment = true ; count = <NUM_LIT:0> ; break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : if ( count >= <NUM_LIT:1> ) { if ( count > <NUM_LIT:1> ) { preserveEmptyLines ( count - <NUM_LIT:1> , this . scanner . getCurrentTokenStartPosition ( ) ) ; } else if ( count == <NUM_LIT:1> ) { printNewLine ( this . scanner . getCurrentTokenStartPosition ( ) ) ; } } else if ( hasWhitespace ) { space ( ) ; } hasWhitespace = false ; printBlockComment ( false ) ; currentTokenStartPosition = this . scanner . currentPosition ; hasLineComment = false ; hasComment = true ; count = <NUM_LIT:0> ; break ; case TerminalTokens . TokenNameCOMMENT_JAVADOC : if ( count >= <NUM_LIT:1> ) { if ( count > <NUM_LIT:1> ) { preserveEmptyLines ( count - <NUM_LIT:1> , this . scanner . startPosition ) ; } else if ( count == <NUM_LIT:1> ) { printNewLine ( this . scanner . startPosition ) ; } } else if ( hasWhitespace ) { space ( ) ; } hasWhitespace = false ; if ( includesJavadocComments ( ) ) { printJavadocComment ( this . scanner . startPosition , this . scanner . currentPosition ) ; } else { printBlockComment ( true ) ; } printNewLine ( ) ; currentTokenStartPosition = this . scanner . currentPosition ; hasLineComment = false ; hasComment = true ; count = <NUM_LIT:0> ; break ; case TerminalTokens . TokenNameSEMICOLON : print ( this . scanner . currentPosition - this . scanner . startPosition , this . formatter . preferences . insert_space_before_semicolon ) ; break ; case TerminalTokens . TokenNameEOF : if ( count >= <NUM_LIT:1> || this . formatter . preferences . insert_new_line_at_end_of_file_if_missing ) { this . printNewLine ( this . scannerEndPosition ) ; } return ; default : this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } } } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } private void printCodeSnippet ( int startPosition , int endPosition , int linesGap ) { String snippet = new String ( this . scanner . source , startPosition , endPosition - startPosition + <NUM_LIT:1> ) ; int firstLine = Util . getLineNumber ( startPosition , this . lineEnds , <NUM_LIT:0> , this . maxLines ) - <NUM_LIT:1> ; int lastLine = Util . getLineNumber ( endPosition , this . lineEnds , firstLine > <NUM_LIT:1> ? firstLine - <NUM_LIT:2> : <NUM_LIT:0> , this . maxLines ) - <NUM_LIT:1> ; this . codeSnippetBuffer . setLength ( <NUM_LIT:0> ) ; if ( firstLine == lastLine && linesGap == <NUM_LIT:0> ) { this . codeSnippetBuffer . append ( snippet ) ; } else { boolean hasCharsAfterStar = false ; if ( linesGap == <NUM_LIT:0> ) { this . codeSnippetBuffer . append ( this . scanner . source , startPosition , this . lineEnds [ firstLine ] + <NUM_LIT:1> - startPosition ) ; firstLine ++ ; } int initialLength = this . codeSnippetBuffer . length ( ) ; for ( int currentLine = firstLine ; currentLine <= lastLine ; currentLine ++ ) { this . scanner . resetTo ( this . lineEnds [ currentLine - <NUM_LIT:1> ] + <NUM_LIT:1> , this . lineEnds [ currentLine ] ) ; int lineStart = this . scanner . currentPosition ; boolean hasStar = false ; loop : while ( ! this . scanner . atEnd ( ) ) { char ch = ( char ) this . scanner . getNextChar ( ) ; switch ( ch ) { case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\t>' : case '<CHAR_LIT>' : break ; case '<STR_LIT>' : case '<STR_LIT:\n>' : break loop ; case '<CHAR_LIT>' : hasStar = true ; break loop ; default : if ( ScannerHelper . isWhitespace ( ch ) ) { break ; } break loop ; } } if ( hasStar ) { lineStart = this . scanner . currentPosition ; if ( ! hasCharsAfterStar && ! this . scanner . atEnd ( ) ) { char ch = ( char ) this . scanner . getNextChar ( ) ; boolean atEnd = this . scanner . atEnd ( ) ; switch ( ch ) { case '<CHAR_LIT:U+0020>' : case '<STR_LIT:\t>' : case '<CHAR_LIT>' : break ; case '<STR_LIT>' : case '<STR_LIT:\n>' : atEnd = true ; break ; default : if ( ! ScannerHelper . isWhitespace ( ch ) ) { if ( hasStar ) { hasCharsAfterStar = true ; currentLine = firstLine - <NUM_LIT:1> ; this . codeSnippetBuffer . setLength ( initialLength ) ; continue ; } } break ; } if ( ! hasCharsAfterStar && ! atEnd ) { lineStart = this . scanner . currentPosition ; } } } int end = currentLine == lastLine ? endPosition : this . lineEnds [ currentLine ] ; this . codeSnippetBuffer . append ( this . scanner . source , lineStart , end + <NUM_LIT:1> - lineStart ) ; } } HTMLEntity2JavaReader reader = new HTMLEntity2JavaReader ( new StringReader ( this . codeSnippetBuffer . toString ( ) ) ) ; char [ ] buf = new char [ this . codeSnippetBuffer . length ( ) ] ; String convertedSnippet ; try { int read = reader . read ( buf ) ; convertedSnippet = new String ( buf , <NUM_LIT:0> , read ) ; } catch ( IOException e ) { CommentFormatterUtil . log ( e ) ; return ; } String formattedSnippet = convertedSnippet ; Map options = this . formatter . preferences . getMap ( ) ; if ( this . scanner . sourceLevel > ClassFileConstants . JDK1_3 ) { options . put ( JavaCore . COMPILER_SOURCE , CompilerOptions . versionFromJdkLevel ( this . scanner . sourceLevel ) ) ; } TextEdit edit = CommentFormatterUtil . format2 ( CodeFormatter . K_UNKNOWN | CodeFormatter . F_INCLUDE_COMMENTS , convertedSnippet , <NUM_LIT:0> , this . lineSeparator , options ) ; if ( edit == null ) { formattedSnippet = this . codeSnippetBuffer . toString ( ) ; } else { formattedSnippet = CommentFormatterUtil . evaluateFormatterEdit ( convertedSnippet , edit , null ) ; Java2HTMLEntityReader javaReader = new Java2HTMLEntityReader ( new StringReader ( formattedSnippet ) ) ; buf = new char [ <NUM_LIT> ] ; this . codeSnippetBuffer . setLength ( <NUM_LIT:0> ) ; int l ; try { do { l = javaReader . read ( buf ) ; if ( l != - <NUM_LIT:1> ) this . codeSnippetBuffer . append ( buf , <NUM_LIT:0> , l ) ; } while ( l > <NUM_LIT:0> ) ; formattedSnippet = this . codeSnippetBuffer . toString ( ) ; } catch ( IOException e ) { CommentFormatterUtil . log ( e ) ; return ; } } this . codeSnippetBuffer . setLength ( <NUM_LIT:0> ) ; ILineTracker tracker = new DefaultLineTracker ( ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . codeSnippetBuffer ) ; this . codeSnippetBuffer . append ( BLOCK_LINE_PREFIX ) ; String linePrefix = this . codeSnippetBuffer . toString ( ) ; this . codeSnippetBuffer . setLength ( <NUM_LIT:0> ) ; String replacement = formattedSnippet ; tracker . set ( formattedSnippet ) ; int numberOfLines = tracker . getNumberOfLines ( ) ; if ( numberOfLines > <NUM_LIT:1> ) { int lastLineOffset = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < numberOfLines - <NUM_LIT:1> ; i ++ ) { if ( i > <NUM_LIT:0> ) this . codeSnippetBuffer . append ( linePrefix ) ; try { lastLineOffset = tracker . getLineOffset ( i + <NUM_LIT:1> ) ; this . codeSnippetBuffer . append ( formattedSnippet . substring ( tracker . getLineOffset ( i ) , lastLineOffset ) ) ; } catch ( BadLocationException e ) { CommentFormatterUtil . log ( e ) ; return ; } } this . codeSnippetBuffer . append ( linePrefix ) ; this . codeSnippetBuffer . append ( formattedSnippet . substring ( lastLineOffset ) ) ; replacement = this . codeSnippetBuffer . toString ( ) ; } addReplaceEdit ( startPosition , endPosition , replacement ) ; } void printComment ( ) { printComment ( CodeFormatter . K_UNKNOWN , NO_TRAILING_COMMENT , PRESERVE_EMPTY_LINES_KEEP_LAST_NEW_LINES_INDENTATION ) ; } void printComment ( int emptyLinesRules ) { printComment ( CodeFormatter . K_UNKNOWN , NO_TRAILING_COMMENT , emptyLinesRules ) ; } void printComment ( int kind , int trailing ) { printComment ( kind , trailing , PRESERVE_EMPTY_LINES_KEEP_LAST_NEW_LINES_INDENTATION ) ; } void printComment ( int kind , int trailing , int emptyLinesRules ) { final boolean rejectLineComment = kind == CodeFormatter . K_MULTI_LINE_COMMENT || kind == CodeFormatter . K_JAVA_DOC ; final boolean rejectBlockComment = kind == CodeFormatter . K_SINGLE_LINE_COMMENT || kind == CodeFormatter . K_JAVA_DOC ; final boolean rejectJavadocComment = kind == CodeFormatter . K_SINGLE_LINE_COMMENT || kind == CodeFormatter . K_MULTI_LINE_COMMENT ; try { int currentTokenStartPosition = this . scanner . currentPosition ; boolean hasComment = false ; boolean hasLineComment = false ; boolean hasWhitespaces = false ; int lines = <NUM_LIT:0> ; while ( ( this . currentToken = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { int foundTaskCount = this . scanner . foundTaskCount ; int tokenStartPosition = this . scanner . getCurrentTokenStartPosition ( ) ; switch ( this . currentToken ) { case TerminalTokens . TokenNameWHITESPACE : char [ ] whiteSpaces = this . scanner . getCurrentTokenSource ( ) ; int whitespacesEndPosition = this . scanner . getCurrentTokenEndPosition ( ) ; lines = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = whiteSpaces . length ; i < max ; i ++ ) { switch ( whiteSpaces [ i ] ) { case '<STR_LIT>' : if ( ( i + <NUM_LIT:1> ) < max ) { if ( whiteSpaces [ i + <NUM_LIT:1> ] == '<STR_LIT:\n>' ) { i ++ ; } } lines ++ ; break ; case '<STR_LIT:\n>' : lines ++ ; } } boolean realTrailing = trailing > NO_TRAILING_COMMENT ; if ( realTrailing && this . scanner . currentCharacter == '<CHAR_LIT:/>' && ( lines == <NUM_LIT:0> || ( lines == <NUM_LIT:1> && ! hasLineComment && trailing == IMPORT_TRAILING_COMMENT ) ) ) { boolean canChangeTrailing = ( trailing & COMPLEX_TRAILING_COMMENT ) != <NUM_LIT:0> ; if ( trailing == BASIC_TRAILING_COMMENT && hasLineComment ) { int currentCommentIndentation = getCurrentIndentation ( whiteSpaces , <NUM_LIT:0> ) ; int relativeIndentation = currentCommentIndentation - this . lastLineComment . currentIndentation ; if ( this . tabLength == <NUM_LIT:0> ) { canChangeTrailing = relativeIndentation == <NUM_LIT:0> ; } else { canChangeTrailing = relativeIndentation > - this . tabLength ; } } if ( canChangeTrailing ) { int currentPosition = this . scanner . currentPosition ; if ( this . scanner . getNextToken ( ) == TerminalTokens . TokenNameCOMMENT_LINE ) { realTrailing = ! hasLineComment ; switch ( this . scanner . getNextToken ( ) ) { case TerminalTokens . TokenNameCOMMENT_LINE : realTrailing = false ; break ; case TerminalTokens . TokenNameWHITESPACE : if ( this . scanner . getNextToken ( ) == TerminalTokens . TokenNameCOMMENT_LINE ) { realTrailing = false ; } break ; } } this . scanner . resetTo ( currentPosition , this . scanner . eofPosition - <NUM_LIT:1> ) ; } } if ( lines > <NUM_LIT:1> || ( lines == <NUM_LIT:1> && hasLineComment ) ) { this . lastLineComment . contiguous = false ; } this . lastLineComment . leadingSpaces = whiteSpaces ; this . lastLineComment . lines = lines ; if ( realTrailing ) { if ( hasLineComment ) { if ( lines >= <NUM_LIT:1> ) { currentTokenStartPosition = tokenStartPosition ; preserveEmptyLines ( lines , currentTokenStartPosition ) ; addDeleteEdit ( currentTokenStartPosition , whitespacesEndPosition ) ; this . scanner . resetTo ( this . scanner . currentPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } if ( lines >= <NUM_LIT:1> ) { if ( hasComment ) { this . printNewLine ( tokenStartPosition ) ; } this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } hasWhitespaces = true ; currentTokenStartPosition = this . scanner . currentPosition ; addDeleteEdit ( tokenStartPosition , whitespacesEndPosition ) ; } else { if ( lines == <NUM_LIT:0> ) { hasWhitespaces = true ; if ( hasLineComment && emptyLinesRules != PRESERVE_EMPTY_LINES_KEEP_LAST_NEW_LINES_INDENTATION ) { addReplaceEdit ( tokenStartPosition , whitespacesEndPosition , getPreserveEmptyLines ( <NUM_LIT:0> , emptyLinesRules ) ) ; } else { addDeleteEdit ( tokenStartPosition , whitespacesEndPosition ) ; } } else if ( hasLineComment ) { useAlignmentBreakIndentation ( emptyLinesRules ) ; currentTokenStartPosition = tokenStartPosition ; preserveEmptyLines ( lines , currentTokenStartPosition ) ; addDeleteEdit ( currentTokenStartPosition , whitespacesEndPosition ) ; } else if ( hasComment ) { useAlignmentBreakIndentation ( emptyLinesRules ) ; if ( lines == <NUM_LIT:1> ) { this . printNewLine ( tokenStartPosition ) ; } else { preserveEmptyLines ( lines - <NUM_LIT:1> , tokenStartPosition ) ; } addDeleteEdit ( tokenStartPosition , whitespacesEndPosition ) ; } else if ( lines != <NUM_LIT:0> && ( ! this . formatter . preferences . join_wrapped_lines || this . formatter . preferences . number_of_empty_lines_to_preserve != <NUM_LIT:0> || this . blank_lines_between_import_groups > <NUM_LIT:0> ) ) { addReplaceEdit ( tokenStartPosition , whitespacesEndPosition , getPreserveEmptyLines ( lines - <NUM_LIT:1> , emptyLinesRules ) ) ; } else { useAlignmentBreakIndentation ( emptyLinesRules ) ; addDeleteEdit ( tokenStartPosition , whitespacesEndPosition ) ; } } currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_LINE : if ( this . useTags && this . editsEnabled ) { boolean turnOff = false ; if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; turnOff = true ; } else if ( this . tagsKind == this . currentToken && CharOperation . fragmentEquals ( this . disablingTag , this . scanner . source , tokenStartPosition , true ) ) { this . editsEnabled = false ; turnOff = true ; } if ( turnOff ) { if ( ! this . editsEnabled && this . editsIndex > <NUM_LIT:1> ) { OptimizedReplaceEdit currentEdit = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; if ( this . scanner . startPosition == currentEdit . offset + currentEdit . length ) { printNewLinesBeforeDisablingComment ( ) ; } } } } if ( rejectLineComment ) break ; if ( lines >= <NUM_LIT:1> ) { if ( lines > <NUM_LIT:1> ) { preserveEmptyLines ( lines - <NUM_LIT:1> , this . scanner . getCurrentTokenStartPosition ( ) ) ; } else if ( lines == <NUM_LIT:1> ) { printNewLine ( this . scanner . getCurrentTokenStartPosition ( ) ) ; } } else if ( hasWhitespaces ) { space ( ) ; } hasWhitespaces = false ; printLineComment ( ) ; currentTokenStartPosition = this . scanner . currentPosition ; hasLineComment = true ; lines = <NUM_LIT:0> ; if ( this . useTags && ! this . editsEnabled ) { if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; } else if ( this . tagsKind == this . currentToken ) { this . editsEnabled = CharOperation . fragmentEquals ( this . enablingTag , this . scanner . source , tokenStartPosition , true ) ; } } break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : if ( this . useTags && this . editsEnabled ) { boolean turnOff = false ; if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; turnOff = true ; } else if ( this . tagsKind == this . currentToken && CharOperation . fragmentEquals ( this . disablingTag , this . scanner . source , tokenStartPosition , true ) ) { this . editsEnabled = false ; turnOff = true ; } if ( turnOff ) { if ( ! this . editsEnabled && this . editsIndex > <NUM_LIT:1> ) { OptimizedReplaceEdit currentEdit = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; if ( this . scanner . startPosition == currentEdit . offset + currentEdit . length ) { printNewLinesBeforeDisablingComment ( ) ; } } } } if ( trailing > NO_TRAILING_COMMENT && lines >= <NUM_LIT:1> ) { this . scanner . resetTo ( this . scanner . getCurrentTokenStartPosition ( ) , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } this . lastLineComment . contiguous = false ; if ( rejectBlockComment ) break ; if ( lines >= <NUM_LIT:1> ) { if ( lines > <NUM_LIT:1> ) { preserveEmptyLines ( lines - <NUM_LIT:1> , this . scanner . getCurrentTokenStartPosition ( ) ) ; } else if ( lines == <NUM_LIT:1> ) { printNewLine ( this . scanner . getCurrentTokenStartPosition ( ) ) ; } } else if ( hasWhitespaces ) { space ( ) ; } hasWhitespaces = false ; printBlockComment ( false ) ; currentTokenStartPosition = this . scanner . currentPosition ; hasLineComment = false ; hasComment = true ; lines = <NUM_LIT:0> ; if ( this . useTags && ! this . editsEnabled ) { if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; } else if ( this . tagsKind == this . currentToken ) { this . editsEnabled = CharOperation . fragmentEquals ( this . enablingTag , this . scanner . source , tokenStartPosition , true ) ; } } break ; case TerminalTokens . TokenNameCOMMENT_JAVADOC : if ( this . useTags && this . editsEnabled && foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; if ( ! this . editsEnabled && this . editsIndex > <NUM_LIT:1> ) { OptimizedReplaceEdit currentEdit = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; if ( this . scanner . startPosition == currentEdit . offset + currentEdit . length ) { printNewLinesBeforeDisablingComment ( ) ; } } } if ( trailing > NO_TRAILING_COMMENT ) { this . scanner . resetTo ( this . scanner . getCurrentTokenStartPosition ( ) , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } this . lastLineComment . contiguous = false ; if ( rejectJavadocComment ) break ; if ( lines >= <NUM_LIT:1> ) { if ( lines > <NUM_LIT:1> ) { preserveEmptyLines ( lines - <NUM_LIT:1> , this . scanner . getCurrentTokenStartPosition ( ) ) ; } else if ( lines == <NUM_LIT:1> ) { printNewLine ( this . scanner . getCurrentTokenStartPosition ( ) ) ; } } else if ( hasWhitespaces ) { space ( ) ; } hasWhitespaces = false ; if ( includesJavadocComments ( ) ) { printJavadocComment ( this . scanner . startPosition , this . scanner . currentPosition ) ; } else { printBlockComment ( true ) ; } if ( this . useTags && ! this . editsEnabled && foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; } printNewLine ( ) ; currentTokenStartPosition = this . scanner . currentPosition ; hasLineComment = false ; hasComment = true ; lines = <NUM_LIT:0> ; break ; default : this . lastLineComment . contiguous = false ; this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } } } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } void printComment ( int kind , String source , int start , int end , int level ) { resetScanner ( source . toCharArray ( ) ) ; this . scanner . resetTo ( start , end ) ; this . numberOfIndentations = level ; this . indentationLevel = level * this . indentationSize ; this . column = this . indentationLevel + <NUM_LIT:1> ; switch ( kind ) { case CodeFormatter . K_SINGLE_LINE_COMMENT : printComment ( kind , NO_TRAILING_COMMENT ) ; break ; case CodeFormatter . K_MULTI_LINE_COMMENT : printComment ( kind , NO_TRAILING_COMMENT ) ; break ; case CodeFormatter . K_JAVA_DOC : printJavadocComment ( start , end ) ; break ; } } private void printLineComment ( ) { int currentTokenStartPosition = this . scanner . getCurrentTokenStartPosition ( ) ; int currentTokenEndPosition = this . scanner . getCurrentTokenEndPosition ( ) + <NUM_LIT:1> ; boolean includesLineComments = includesLineComments ( ) ; boolean isNlsTag = false ; if ( CharOperation . indexOf ( Scanner . TAG_PREFIX , this . scanner . source , true , currentTokenStartPosition , currentTokenEndPosition ) != - <NUM_LIT:1> ) { this . nlsTagCounter = <NUM_LIT:0> ; isNlsTag = true ; } this . scanner . resetTo ( currentTokenStartPosition , currentTokenEndPosition - <NUM_LIT:1> ) ; int currentCharacter ; int start = currentTokenStartPosition ; int nextCharacterStart = currentTokenStartPosition ; int commentIndentationLevel ; boolean onFirstColumn = isOnFirstColumn ( start ) ; if ( this . indentationLevel == <NUM_LIT:0> ) { commentIndentationLevel = this . column - <NUM_LIT:1> ; } else { if ( onFirstColumn && ( ( includesLineComments && ! this . formatter . preferences . comment_format_line_comment_starting_on_first_column ) || this . formatter . preferences . never_indent_line_comments_on_first_column ) ) { commentIndentationLevel = this . column - <NUM_LIT:1> ; } else { if ( this . lastLineComment . contiguous ) { int currentCommentIndentation = getCurrentIndentation ( this . lastLineComment . leadingSpaces , <NUM_LIT:0> ) ; int relativeIndentation = currentCommentIndentation - this . lastLineComment . currentIndentation ; boolean similarCommentsIndentation = false ; if ( this . tabLength == <NUM_LIT:0> ) { similarCommentsIndentation = relativeIndentation == <NUM_LIT:0> ; } else if ( relativeIndentation > - this . tabLength ) { similarCommentsIndentation = relativeIndentation == <NUM_LIT:0> || currentCommentIndentation != <NUM_LIT:0> && this . lastLineComment . currentIndentation != <NUM_LIT:0> ; } if ( similarCommentsIndentation && this . lastLineComment . indentation != this . indentationLevel ) { int currentIndentationLevel = this . indentationLevel ; this . indentationLevel = this . lastLineComment . indentation ; printIndentationIfNecessary ( ) ; this . indentationLevel = currentIndentationLevel ; commentIndentationLevel = this . lastLineComment . indentation ; } else { printIndentationIfNecessary ( ) ; commentIndentationLevel = this . column - <NUM_LIT:1> ; } } else { if ( this . currentAlignment != null && this . currentAlignment . kind == Alignment . ARRAY_INITIALIZER && this . currentAlignment . fragmentCount > <NUM_LIT:0> && this . indentationLevel < this . currentAlignment . breakIndentationLevel && this . lastLineComment . lines > <NUM_LIT:0> ) { int currentIndentationLevel = this . indentationLevel ; this . indentationLevel = this . currentAlignment . breakIndentationLevel ; printIndentationIfNecessary ( ) ; this . indentationLevel = currentIndentationLevel ; commentIndentationLevel = this . currentAlignment . breakIndentationLevel ; } else { printIndentationIfNecessary ( ) ; commentIndentationLevel = this . column - <NUM_LIT:1> ; } } } } this . lastLineComment . contiguous = true ; this . lastLineComment . currentIndentation = getCurrentCommentIndentation ( currentTokenStartPosition ) ; this . lastLineComment . indentation = commentIndentationLevel ; if ( this . pendingSpace ) { if ( this . formatter . preferences . comment_preserve_white_space_between_code_and_line_comments ) { addInsertEdit ( currentTokenStartPosition , new String ( this . lastLineComment . leadingSpaces ) ) ; } else { addInsertEdit ( currentTokenStartPosition , "<STR_LIT:U+0020>" ) ; } } this . needSpace = false ; this . pendingSpace = false ; int previousStart = currentTokenStartPosition ; if ( ! isNlsTag && includesLineComments && ( ! onFirstColumn || this . formatter . preferences . comment_format_line_comment_starting_on_first_column ) ) { printLineComment ( currentTokenStartPosition , currentTokenEndPosition - <NUM_LIT:1> ) ; } else { loop : while ( nextCharacterStart <= currentTokenEndPosition && ( currentCharacter = this . scanner . getNextChar ( ) ) != - <NUM_LIT:1> ) { nextCharacterStart = this . scanner . currentPosition ; switch ( currentCharacter ) { case '<STR_LIT>' : start = previousStart ; break loop ; case '<STR_LIT:\n>' : start = previousStart ; break loop ; } previousStart = nextCharacterStart ; } if ( start != currentTokenStartPosition ) { addReplaceEdit ( start , currentTokenEndPosition - <NUM_LIT:1> , this . lineSeparator ) ; this . line ++ ; this . column = <NUM_LIT:1> ; this . lastNumberOfNewLines = <NUM_LIT:1> ; } } this . needSpace = false ; this . pendingSpace = false ; if ( this . currentAlignment != null ) { if ( this . memberAlignment != null ) { if ( this . currentAlignment . location . inputOffset > this . memberAlignment . location . inputOffset ) { if ( this . currentAlignment . couldBreak ( ) && this . currentAlignment . wasSplit ) { this . currentAlignment . performFragmentEffect ( ) ; } } else { this . indentationLevel = Math . max ( this . indentationLevel , this . memberAlignment . breakIndentationLevel ) ; } } else if ( this . currentAlignment . couldBreak ( ) && this . currentAlignment . wasSplit ) { this . currentAlignment . performFragmentEffect ( ) ; } if ( this . currentAlignment . kind == Alignment . BINARY_EXPRESSION && this . currentAlignment . enclosing != null && this . currentAlignment . enclosing . kind == Alignment . BINARY_EXPRESSION && this . indentationLevel < this . currentAlignment . breakIndentationLevel ) { this . indentationLevel = this . currentAlignment . breakIndentationLevel ; } } this . scanner . resetTo ( currentTokenEndPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; } private void printLineComment ( int commentStart , int commentEnd ) { int firstColumn = this . column ; int indentLevel = this . indentationLevel ; int indentations = this . numberOfIndentations ; this . indentationLevel = getNextIndentationLevel ( firstColumn ) ; if ( this . indentationSize != <NUM_LIT:0> ) { this . numberOfIndentations = this . indentationLevel / this . indentationSize ; } else { this . numberOfIndentations = <NUM_LIT:0> ; } this . scanner . resetTo ( commentStart , commentEnd ) ; this . scanner . getNextChar ( ) ; this . scanner . getNextChar ( ) ; this . column += <NUM_LIT:2> ; int maxColumn = this . formatter . preferences . comment_line_length + <NUM_LIT:1> ; int previousToken = - <NUM_LIT:1> ; int lastTokenEndPosition = commentStart ; int spaceStartPosition = - <NUM_LIT:1> ; int spaceEndPosition = - <NUM_LIT:1> ; this . scanner . skipComments = true ; String newLineString = null ; this . commentIndentation = null ; while ( ! this . scanner . atEnd ( ) ) { int token ; try { token = this . scanner . getNextToken ( ) ; } catch ( InvalidInputException iie ) { token = consumeInvalidToken ( commentEnd ) ; } switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : if ( previousToken == - <NUM_LIT:1> ) { previousToken = SKIP_FIRST_WHITESPACE_TOKEN ; } else { previousToken = token ; } spaceStartPosition = this . scanner . getCurrentTokenStartPosition ( ) ; spaceEndPosition = this . scanner . getCurrentTokenEndPosition ( ) ; continue ; case TerminalTokens . TokenNameEOF : continue ; case TerminalTokens . TokenNameIdentifier : if ( previousToken == - <NUM_LIT:1> || previousToken == SKIP_FIRST_WHITESPACE_TOKEN ) { char [ ] identifier = this . scanner . getCurrentTokenSource ( ) ; int startPosition = this . scanner . getCurrentTokenStartPosition ( ) ; int restartPosition = this . scanner . currentPosition ; if ( CharOperation . equals ( identifier , Parser . FALL_THROUGH_TAG , <NUM_LIT:0> , <NUM_LIT:5> ) && this . scanner . currentCharacter == '<CHAR_LIT:->' ) { try { this . scanner . getNextToken ( ) ; token = this . scanner . getNextToken ( ) ; if ( token == TerminalTokens . TokenNameIdentifier ) { identifier = this . scanner . getCurrentTokenSource ( ) ; if ( CharOperation . endsWith ( Parser . FALL_THROUGH_TAG , identifier ) ) { if ( previousToken == SKIP_FIRST_WHITESPACE_TOKEN ) { addReplaceEdit ( spaceStartPosition , startPosition - <NUM_LIT:1> , "<STR_LIT:U+0020>" ) ; } this . scanner . startPosition = startPosition ; previousToken = token ; break ; } } } catch ( InvalidInputException iie ) { } } this . scanner . startPosition = startPosition ; this . scanner . currentPosition = restartPosition ; } break ; } int tokenStart = this . scanner . getCurrentTokenStartPosition ( ) ; int tokenLength = ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - tokenStart ; if ( previousToken == - <NUM_LIT:1> ) { addInsertEdit ( this . scanner . startPosition , "<STR_LIT:U+0020>" ) ; this . column ++ ; } else if ( previousToken == SKIP_FIRST_WHITESPACE_TOKEN ) { addReplaceEdit ( spaceStartPosition , this . scanner . startPosition - <NUM_LIT:1> , "<STR_LIT:U+0020>" ) ; this . column ++ ; spaceStartPosition = - <NUM_LIT:1> ; } else { boolean insertSpace = previousToken == TerminalTokens . TokenNameWHITESPACE ; if ( insertSpace ) { tokenLength ++ ; } if ( spaceStartPosition > <NUM_LIT:0> && ( this . column + tokenLength ) > maxColumn ) { this . lastNumberOfNewLines ++ ; this . line ++ ; if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; if ( ! this . formatter . preferences . never_indent_line_comments_on_first_column ) { printIndentationIfNecessary ( this . tempBuffer ) ; } this . tempBuffer . append ( LINE_COMMENT_PREFIX ) ; this . column += LINE_COMMENT_PREFIX_LENGTH ; newLineString = this . tempBuffer . toString ( ) ; firstColumn = this . column ; } else { this . column = firstColumn ; } if ( lastTokenEndPosition > spaceEndPosition ) { this . column += lastTokenEndPosition - ( spaceEndPosition + <NUM_LIT:1> ) ; } if ( this . edits [ this . editsIndex - <NUM_LIT:1> ] . offset == spaceStartPosition ) { this . editsIndex -- ; } addReplaceEdit ( spaceStartPosition , spaceEndPosition , newLineString ) ; spaceStartPosition = - <NUM_LIT:1> ; if ( insertSpace ) { tokenLength -- ; } } else if ( insertSpace ) { addReplaceEdit ( spaceStartPosition , this . scanner . startPosition - <NUM_LIT:1> , "<STR_LIT:U+0020>" ) ; } } this . column += tokenLength ; previousToken = token ; lastTokenEndPosition = this . scanner . currentPosition ; } this . scanner . skipComments = false ; this . indentationLevel = indentLevel ; this . numberOfIndentations = indentations ; this . lastNumberOfNewLines = <NUM_LIT:0> ; this . scanner . resetTo ( lastTokenEndPosition , commentEnd ) ; while ( ! this . scanner . atEnd ( ) ) { spaceEndPosition = this . scanner . currentPosition ; this . scanner . getNextChar ( ) ; if ( this . scanner . currentCharacter == '<STR_LIT:\n>' || this . scanner . currentCharacter == '<STR_LIT>' ) { this . column = <NUM_LIT:1> ; this . line ++ ; this . lastNumberOfNewLines ++ ; break ; } } int startReplace = previousToken == SKIP_FIRST_WHITESPACE_TOKEN ? spaceStartPosition : lastTokenEndPosition ; if ( this . column == <NUM_LIT:1> && commentEnd >= startReplace ) { addReplaceEdit ( startReplace , commentEnd , this . formatter . preferences . line_separator ) ; } } public void printEmptyLines ( int linesNumber ) { this . printEmptyLines ( linesNumber , this . scanner . getCurrentTokenEndPosition ( ) + <NUM_LIT:1> ) ; } private void printEmptyLines ( int linesNumber , int insertPosition ) { final String buffer = getEmptyLines ( linesNumber ) ; if ( Util . EMPTY_STRING == buffer ) return ; addInsertEdit ( insertPosition , buffer ) ; } void printIndentationIfNecessary ( ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; printIndentationIfNecessary ( this . tempBuffer ) ; if ( this . tempBuffer . length ( ) > <NUM_LIT:0> ) { addInsertEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . tempBuffer . toString ( ) ) ; this . pendingSpace = false ; } } private void printIndentationIfNecessary ( StringBuffer buffer ) { switch ( this . tabChar ) { case DefaultCodeFormatterOptions . TAB : boolean useTabsForLeadingIndents = this . useTabsOnlyForLeadingIndents ; int numberOfLeadingIndents = this . numberOfIndentations ; int indentationsAsTab = <NUM_LIT:0> ; if ( useTabsForLeadingIndents ) { while ( this . column <= this . indentationLevel ) { if ( this . tabLength > <NUM_LIT:0> && indentationsAsTab < numberOfLeadingIndents ) { if ( buffer != null ) buffer . append ( '<STR_LIT:\t>' ) ; indentationsAsTab ++ ; int complement = this . tabLength - ( ( this . column - <NUM_LIT:1> ) % this . tabLength ) ; this . column += complement ; } else { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } this . needSpace = false ; } } else if ( this . tabLength > <NUM_LIT:0> ) { while ( this . column <= this . indentationLevel ) { if ( buffer != null ) buffer . append ( '<STR_LIT:\t>' ) ; int complement = this . tabLength - ( ( this . column - <NUM_LIT:1> ) % this . tabLength ) ; this . column += complement ; this . needSpace = false ; } } break ; case DefaultCodeFormatterOptions . SPACE : while ( this . column <= this . indentationLevel ) { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; this . needSpace = false ; } break ; case DefaultCodeFormatterOptions . MIXED : useTabsForLeadingIndents = this . useTabsOnlyForLeadingIndents ; numberOfLeadingIndents = this . numberOfIndentations ; indentationsAsTab = <NUM_LIT:0> ; if ( useTabsForLeadingIndents ) { final int columnForLeadingIndents = numberOfLeadingIndents * this . indentationSize ; while ( this . column <= this . indentationLevel ) { if ( this . column <= columnForLeadingIndents ) { if ( this . tabLength > <NUM_LIT:0> && ( this . column - <NUM_LIT:1> + this . tabLength ) <= this . indentationLevel ) { if ( buffer != null ) buffer . append ( '<STR_LIT:\t>' ) ; this . column += this . tabLength ; } else if ( ( this . column - <NUM_LIT:1> + this . indentationSize ) <= this . indentationLevel ) { for ( int i = <NUM_LIT:0> , max = this . indentationSize ; i < max ; i ++ ) { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } } else { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } } else { for ( int i = this . column , max = this . indentationLevel ; i <= max ; i ++ ) { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } } this . needSpace = false ; } } else { while ( this . column <= this . indentationLevel ) { if ( this . tabLength > <NUM_LIT:0> && ( this . column - <NUM_LIT:1> + this . tabLength ) <= this . indentationLevel ) { if ( buffer != null ) buffer . append ( '<STR_LIT:\t>' ) ; this . column += this . tabLength ; } else if ( this . indentationSize > <NUM_LIT:0> && ( this . column - <NUM_LIT:1> + this . indentationSize ) <= this . indentationLevel ) { for ( int i = <NUM_LIT:0> , max = this . indentationSize ; i < max ; i ++ ) { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } } else { if ( buffer != null ) buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } this . needSpace = false ; } } break ; } } private void printJavadocBlock ( FormatJavadocBlock block ) { if ( block == null ) return ; int previousEnd = block . tagEnd ; int maxNodes = block . nodesPtr ; boolean headerLine = block . isHeaderLine ( ) && this . lastNumberOfNewLines == <NUM_LIT:0> ; int maxColumn = this . formatter . preferences . comment_line_length + <NUM_LIT:1> ; if ( headerLine ) { maxColumn ++ ; } if ( ! block . isInlined ( ) ) { this . lastNumberOfNewLines = <NUM_LIT:0> ; } if ( block . isDescription ( ) ) { if ( ! block . isInlined ( ) ) { this . commentIndentation = null ; } } else { int tagLength = previousEnd - block . sourceStart + <NUM_LIT:1> ; this . column += tagLength ; if ( ! block . isInlined ( ) ) { boolean indentRootTags = this . formatter . preferences . comment_indent_root_tags && ! block . isInDescription ( ) ; int commentIndentationLevel = <NUM_LIT:0> ; if ( indentRootTags ) { commentIndentationLevel = tagLength + <NUM_LIT:1> ; boolean indentParamTag = this . formatter . preferences . comment_indent_parameter_description && block . isInParamTag ( ) ; if ( indentParamTag ) { commentIndentationLevel += this . indentationSize ; } } setCommentIndentation ( commentIndentationLevel ) ; } FormatJavadocReference reference = block . reference ; if ( reference != null ) { printJavadocBlockReference ( block , reference ) ; previousEnd = reference . sourceEnd ; } if ( maxNodes < <NUM_LIT:0> ) { if ( block . isInlined ( ) ) { this . column ++ ; } return ; } } int previousLine = Util . getLineNumber ( previousEnd , this . lineEnds , <NUM_LIT:0> , this . maxLines ) ; boolean clearBlankLines = this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment ; boolean joinLines = this . formatter . preferences . join_lines_in_comments ; for ( int i = <NUM_LIT:0> ; i <= maxNodes ; i ++ ) { FormatJavadocNode node = block . nodes [ i ] ; int nodeStart = node . sourceStart ; int newLines ; if ( i == <NUM_LIT:0> ) { newLines = this . formatter . preferences . comment_insert_new_line_for_parameter && block . isParamTag ( ) ? <NUM_LIT:1> : <NUM_LIT:0> ; if ( nodeStart > ( previousEnd + <NUM_LIT:1> ) ) { if ( ! clearBlankLines || ! joinLines ) { int startLine = Util . getLineNumber ( nodeStart , this . lineEnds , previousLine - <NUM_LIT:1> , this . maxLines ) ; int gapLine = previousLine ; if ( joinLines ) gapLine ++ ; if ( startLine > gapLine ) { newLines = startLine - previousLine ; } if ( clearBlankLines ) { if ( newLines > <NUM_LIT:0> ) newLines = <NUM_LIT:1> ; } } if ( newLines == <NUM_LIT:0> && ( ! node . isImmutable ( ) || block . reference != null ) ) { newLines = printJavadocBlockNodesNewLines ( block , node , previousEnd ) ; } if ( block . isImmutable ( ) ) { printJavadocGapLinesForImmutableBlock ( block ) ; } else { printJavadocGapLines ( previousEnd + <NUM_LIT:1> , nodeStart - <NUM_LIT:1> , newLines , clearBlankLines , false , null ) ; } } else { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; if ( newLines > <NUM_LIT:0> ) { for ( int j = <NUM_LIT:0> ; j < newLines ; j ++ ) { printJavadocNewLine ( this . tempBuffer ) ; } addInsertEdit ( nodeStart , this . tempBuffer . toString ( ) ) ; } } } else { newLines = this . column > maxColumn ? <NUM_LIT:1> : <NUM_LIT:0> ; if ( ! clearBlankLines && node . lineStart > ( previousLine + <NUM_LIT:1> ) ) newLines = node . lineStart - previousLine ; if ( newLines < node . linesBefore ) newLines = node . linesBefore ; if ( newLines == <NUM_LIT:0> ) { newLines = printJavadocBlockNodesNewLines ( block , node , previousEnd ) ; } if ( newLines > <NUM_LIT:0> || nodeStart > ( previousEnd + <NUM_LIT:1> ) ) { printJavadocGapLines ( previousEnd + <NUM_LIT:1> , nodeStart - <NUM_LIT:1> , newLines , clearBlankLines , false , null ) ; } } if ( headerLine && newLines > <NUM_LIT:0> ) { headerLine = false ; maxColumn -- ; } if ( node . isText ( ) ) { FormatJavadocText text = ( FormatJavadocText ) node ; if ( text . isImmutable ( ) ) { if ( text . isImmutableHtmlTag ( ) && newLines > <NUM_LIT:0> && this . commentIndentation != null ) { addInsertEdit ( node . sourceStart , this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } printJavadocImmutableText ( text , block , newLines > <NUM_LIT:0> ) ; this . column += getTextLength ( block , text ) ; } else if ( text . isHtmlTag ( ) ) { printJavadocHtmlTag ( text , block , newLines > <NUM_LIT:0> ) ; } else { printJavadocText ( text , block , newLines > <NUM_LIT:0> ) ; } } else { if ( newLines > <NUM_LIT:0> && this . commentIndentation != null ) { addInsertEdit ( node . sourceStart , this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } printJavadocBlock ( ( FormatJavadocBlock ) node ) ; } previousEnd = node . sourceEnd ; previousLine = Util . getLineNumber ( previousEnd , this . lineEnds , node . lineStart > <NUM_LIT:1> ? node . lineStart - <NUM_LIT:2> : <NUM_LIT:0> , this . maxLines ) ; } this . lastNumberOfNewLines = <NUM_LIT:0> ; } private int printJavadocBlockNodesNewLines ( FormatJavadocBlock block , FormatJavadocNode node , int previousEnd ) { int maxColumn = this . formatter . preferences . comment_line_length + <NUM_LIT:1> ; int nodeStart = node . sourceStart ; try { this . scanner . resetTo ( nodeStart , node . sourceEnd ) ; int length = <NUM_LIT:0> ; boolean newLine = false ; boolean headerLine = block . isHeaderLine ( ) && this . lastNumberOfNewLines == <NUM_LIT:0> ; int firstColumn = <NUM_LIT:1> + this . indentationLevel + BLOCK_LINE_PREFIX_LENGTH ; if ( this . commentIndentation != null ) firstColumn += this . commentIndentation . length ( ) ; if ( headerLine ) maxColumn ++ ; FormatJavadocText text = null ; boolean isImmutableNode = node . isImmutable ( ) ; boolean nodeIsText = node . isText ( ) ; if ( nodeIsText ) { text = ( FormatJavadocText ) node ; } else { FormatJavadocBlock inlinedBlock = ( FormatJavadocBlock ) node ; if ( isImmutableNode ) { text = ( FormatJavadocText ) inlinedBlock . getLastNode ( ) ; if ( text != null ) { length += inlinedBlock . tagEnd - inlinedBlock . sourceStart + <NUM_LIT:1> ; if ( nodeStart > ( previousEnd + <NUM_LIT:1> ) ) { length ++ ; } this . scanner . resetTo ( text . sourceStart , node . sourceEnd ) ; } } } if ( text != null ) { if ( isImmutableNode ) { if ( nodeStart > ( previousEnd + <NUM_LIT:1> ) ) { length ++ ; } int lastColumn = this . column + length ; while ( ! this . scanner . atEnd ( ) ) { try { int token = this . scanner . getNextToken ( ) ; switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : if ( CharOperation . indexOf ( '<STR_LIT:\n>' , this . scanner . source , this . scanner . startPosition , this . scanner . currentPosition ) >= <NUM_LIT:0> ) { return <NUM_LIT:0> ; } lastColumn = getCurrentIndentation ( this . scanner . getCurrentTokenSource ( ) , lastColumn ) ; break ; case TerminalTokens . TokenNameMULTIPLY : if ( newLine ) { newLine = false ; continue ; } lastColumn ++ ; break ; default : lastColumn += ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; break ; } } catch ( InvalidInputException iie ) { lastColumn += ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; } if ( lastColumn > maxColumn ) { return <NUM_LIT:1> ; } } return <NUM_LIT:0> ; } if ( text . isHtmlTag ( ) ) { if ( text . getHtmlTagID ( ) == JAVADOC_SINGLE_BREAK_TAG_ID ) { return <NUM_LIT:0> ; } this . scanner . getNextToken ( ) ; if ( this . scanner . getNextToken ( ) == TerminalTokens . TokenNameDIVIDE ) { length ++ ; this . scanner . getNextToken ( ) ; } length += ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; this . scanner . getNextToken ( ) ; length ++ ; } else { while ( true ) { int token = this . scanner . getNextToken ( ) ; if ( token == TerminalTokens . TokenNameWHITESPACE || token == TerminalTokens . TokenNameEOF ) break ; int tokenLength = ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; length += tokenLength ; if ( ( this . column + length ) >= maxColumn ) { break ; } } } } else { FormatJavadocBlock inlinedBlock = ( FormatJavadocBlock ) node ; length += inlinedBlock . tagEnd - inlinedBlock . sourceStart + <NUM_LIT:1> ; if ( inlinedBlock . reference != null ) { length ++ ; this . scanner . resetTo ( inlinedBlock . reference . sourceStart , inlinedBlock . reference . sourceEnd ) ; int previousToken = - <NUM_LIT:1> ; loop : while ( ! this . scanner . atEnd ( ) ) { int token = this . scanner . getNextToken ( ) ; int tokenLength = ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : if ( previousToken == TerminalTokens . TokenNameCOMMA ) { length ++ ; } break ; case TerminalTokens . TokenNameMULTIPLY : break ; default : length += tokenLength ; if ( ( this . column + length ) > maxColumn ) { break loop ; } break ; } previousToken = token ; } } length ++ ; } if ( nodeStart > ( previousEnd + <NUM_LIT:1> ) ) { length ++ ; } if ( ( firstColumn + length ) >= maxColumn && node == block . nodes [ <NUM_LIT:0> ] ) { return <NUM_LIT:0> ; } if ( ( this . column + length ) > maxColumn ) { return <NUM_LIT:1> ; } } catch ( InvalidInputException iie ) { int tokenLength = <NUM_LIT:1> ; if ( nodeStart > ( previousEnd + <NUM_LIT:1> ) ) { tokenLength ++ ; } if ( ( this . column + tokenLength ) > maxColumn ) { return <NUM_LIT:1> ; } } return <NUM_LIT:0> ; } private void printJavadocBlockReference ( FormatJavadocBlock block , FormatJavadocReference reference ) { int maxColumn = this . formatter . preferences . comment_line_length + <NUM_LIT:1> ; boolean headerLine = block . isHeaderLine ( ) ; boolean inlined = block . isInlined ( ) ; if ( headerLine ) maxColumn ++ ; this . scanner . resetTo ( block . tagEnd + <NUM_LIT:1> , reference . sourceEnd ) ; this . javadocBlockRefBuffer . setLength ( <NUM_LIT:0> ) ; boolean needFormat = false ; int previousToken = - <NUM_LIT:1> ; int spacePosition = - <NUM_LIT:1> ; String newLineString = null ; int firstColumn = - <NUM_LIT:1> ; while ( ! this . scanner . atEnd ( ) ) { int token ; try { token = this . scanner . getNextToken ( ) ; int tokenLength = ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : if ( previousToken != - <NUM_LIT:1> || tokenLength > <NUM_LIT:1> || this . scanner . currentCharacter != '<CHAR_LIT:U+0020>' ) needFormat = true ; switch ( previousToken ) { case TerminalTokens . TokenNameMULTIPLY : case TerminalTokens . TokenNameLPAREN : break ; default : spacePosition = this . javadocBlockRefBuffer . length ( ) ; case - <NUM_LIT:1> : this . javadocBlockRefBuffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; break ; } break ; case TerminalTokens . TokenNameMULTIPLY : break ; default : if ( ! inlined && spacePosition > <NUM_LIT:0> && ( this . column + tokenLength ) > maxColumn ) { this . lastNumberOfNewLines ++ ; this . line ++ ; if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; if ( this . commentIndentation != null ) { this . tempBuffer . append ( this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } newLineString = this . tempBuffer . substring ( <NUM_LIT:0> , this . tempBuffer . length ( ) - <NUM_LIT:1> ) ; firstColumn = this . column ; } else { this . column = firstColumn ; } this . column = firstColumn + this . javadocBlockRefBuffer . length ( ) - spacePosition - <NUM_LIT:1> ; this . javadocBlockRefBuffer . insert ( spacePosition , newLineString ) ; if ( headerLine ) { headerLine = false ; maxColumn -- ; } spacePosition = - <NUM_LIT:1> ; } this . javadocBlockRefBuffer . append ( this . scanner . source , this . scanner . startPosition , tokenLength ) ; this . column += tokenLength ; break ; } previousToken = token ; } catch ( InvalidInputException iie ) { } } if ( needFormat ) { addReplaceEdit ( block . tagEnd + <NUM_LIT:1> , reference . sourceEnd , this . javadocBlockRefBuffer . toString ( ) ) ; } } private int getTextLength ( FormatJavadocBlock block , FormatJavadocText text ) { if ( text . isImmutable ( ) ) { this . scanner . resetTo ( text . sourceStart , text . sourceEnd ) ; int textLength = <NUM_LIT:0> ; while ( ! this . scanner . atEnd ( ) ) { try { int token = this . scanner . getNextToken ( ) ; if ( token == TerminalTokens . TokenNameWHITESPACE ) { if ( CharOperation . indexOf ( '<STR_LIT:\n>' , this . scanner . source , this . scanner . startPosition , this . scanner . currentPosition ) >= <NUM_LIT:0> ) { textLength = <NUM_LIT:0> ; this . scanner . getNextChar ( ) ; if ( this . scanner . currentCharacter == '<CHAR_LIT>' ) { this . scanner . getNextChar ( ) ; if ( this . scanner . currentCharacter != '<CHAR_LIT:U+0020>' ) { textLength ++ ; } } else { textLength ++ ; } continue ; } } textLength += ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; } catch ( InvalidInputException e ) { textLength += ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - this . scanner . startPosition ; } } return textLength ; } if ( block . isOneLineTag ( ) ) { return text . sourceEnd - text . sourceStart + <NUM_LIT:1> ; } int startLine = Util . getLineNumber ( text . sourceStart , this . lineEnds , <NUM_LIT:0> , this . maxLines ) ; int endLine = startLine ; int previousEnd = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i <= text . separatorsPtr ; i ++ ) { int end = ( int ) ( text . separators [ i ] > > > <NUM_LIT:32> ) ; endLine = Util . getLineNumber ( end , this . lineEnds , endLine - <NUM_LIT:1> , this . maxLines ) ; if ( endLine > startLine ) { return previousEnd - text . sourceStart + <NUM_LIT:1> ; } previousEnd = end ; } return text . sourceEnd - text . sourceStart + <NUM_LIT:1> ; } void printJavadocComment ( int start , int end ) { int lastIndentationLevel = this . indentationLevel ; try { this . scanner . resetTo ( start , end - <NUM_LIT:1> ) ; if ( ! this . formatterCommentParser . parse ( start , end - <NUM_LIT:1> ) ) { return ; } FormatJavadoc javadoc = ( FormatJavadoc ) this . formatterCommentParser . docComment ; if ( this . indentationLevel != <NUM_LIT:0> ) { printIndentationIfNecessary ( ) ; } if ( this . pendingSpace ) { addInsertEdit ( start , "<STR_LIT:U+0020>" ) ; } if ( javadoc . blocks == null ) { return ; } this . needSpace = false ; this . pendingSpace = false ; int length = javadoc . blocks . length ; FormatJavadocBlock previousBlock = javadoc . blocks [ <NUM_LIT:0> ] ; this . lastNumberOfNewLines = <NUM_LIT:0> ; int currentLine = this . line ; int firstBlockStart = previousBlock . sourceStart ; printIndentationIfNecessary ( null ) ; this . column += JAVADOC_HEADER_LENGTH ; int index = <NUM_LIT:1> ; if ( length > <NUM_LIT:1> ) { if ( previousBlock . isDescription ( ) ) { printJavadocBlock ( previousBlock ) ; FormatJavadocBlock block = javadoc . blocks [ index ++ ] ; int newLines = this . formatter . preferences . comment_insert_empty_line_before_root_tags ? <NUM_LIT:2> : <NUM_LIT:1> ; printJavadocGapLines ( previousBlock . sourceEnd + <NUM_LIT:1> , block . sourceStart - <NUM_LIT:1> , newLines , this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment , false , null ) ; previousBlock = block ; } while ( index < length ) { printJavadocBlock ( previousBlock ) ; FormatJavadocBlock block = javadoc . blocks [ index ++ ] ; printJavadocGapLines ( previousBlock . sourceEnd + <NUM_LIT:1> , block . sourceStart - <NUM_LIT:1> , <NUM_LIT:1> , this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment , false , null ) ; previousBlock = block ; } } printJavadocBlock ( previousBlock ) ; int newLines = ( this . formatter . preferences . comment_new_lines_at_javadoc_boundaries && ( this . line > currentLine || javadoc . isMultiLine ( ) ) ) ? <NUM_LIT:1> : <NUM_LIT:0> ; printJavadocGapLines ( javadoc . textStart , firstBlockStart - <NUM_LIT:1> , newLines , this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment , false , null ) ; printJavadocGapLines ( previousBlock . sourceEnd + <NUM_LIT:1> , javadoc . textEnd , newLines , this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment , true , null ) ; } finally { this . scanner . resetTo ( end , this . scannerEndPosition - <NUM_LIT:1> ) ; this . needSpace = false ; this . indentationLevel = lastIndentationLevel ; this . lastNumberOfNewLines = <NUM_LIT:0> ; } } private void printJavadocGapLines ( int textStartPosition , int textEndPosition , int newLines , boolean clearBlankLines , boolean footer , StringBuffer output ) { try { if ( newLines == <NUM_LIT:0> ) { if ( output == null ) { addReplaceEdit ( textStartPosition , textEndPosition , "<STR_LIT:U+0020>" ) ; } else { output . append ( '<CHAR_LIT:U+0020>' ) ; } this . column ++ ; return ; } if ( textStartPosition > textEndPosition ) { if ( newLines > <NUM_LIT:0> ) { this . javadocGapLinesBuffer . setLength ( <NUM_LIT:0> ) ; for ( int i = <NUM_LIT:0> ; i < newLines ; i ++ ) { this . javadocGapLinesBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . javadocGapLinesBuffer ) ; if ( footer ) { this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } else { this . javadocGapLinesBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; } } if ( output == null ) { addInsertEdit ( textStartPosition , this . javadocGapLinesBuffer . toString ( ) ) ; } else { output . append ( this . javadocGapLinesBuffer ) ; } } return ; } this . scanner . resetTo ( textStartPosition , textEndPosition ) ; this . scanner . recordLineSeparator = true ; this . scanner . linePtr = Util . getLineNumber ( textStartPosition , this . lineEnds , <NUM_LIT:0> , this . maxLines ) - <NUM_LIT:2> ; int linePtr = this . scanner . linePtr ; int lineCount = <NUM_LIT:0> ; int start = textStartPosition ; boolean endsOnMultiply = false ; while ( ! this . scanner . atEnd ( ) ) { switch ( this . scanner . getNextToken ( ) ) { case TerminalTokens . TokenNameMULTIPLY : int linesGap = this . scanner . linePtr - linePtr ; if ( linesGap > <NUM_LIT:0> ) { this . javadocGapLinesBuffer . setLength ( <NUM_LIT:0> ) ; if ( lineCount > <NUM_LIT:0> ) { this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } for ( int i = <NUM_LIT:0> ; i < linesGap ; i ++ ) { if ( clearBlankLines && lineCount >= newLines ) { if ( textEndPosition >= start ) { if ( output == null ) { addReplaceEdit ( start , textEndPosition , this . javadocGapLinesBuffer . toString ( ) ) ; } else { output . append ( this . javadocGapLinesBuffer ) ; } } return ; } this . javadocGapLinesBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . javadocGapLinesBuffer ) ; if ( i == ( linesGap - <NUM_LIT:1> ) ) { this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } else { this . javadocGapLinesBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; } lineCount ++ ; } int currentTokenStartPosition = this . scanner . getCurrentTokenStartPosition ( ) ; int tokenLength = this . scanner . currentPosition - currentTokenStartPosition ; if ( output == null ) { addReplaceEdit ( start , currentTokenStartPosition - <NUM_LIT:1> , this . javadocGapLinesBuffer . toString ( ) ) ; } else { output . append ( this . javadocGapLinesBuffer ) ; output . append ( this . scanner . source , currentTokenStartPosition , tokenLength ) ; } this . column += tokenLength ; if ( footer && clearBlankLines && lineCount == newLines ) { if ( textEndPosition >= currentTokenStartPosition ) { if ( output == null ) { addDeleteEdit ( currentTokenStartPosition , textEndPosition ) ; } } return ; } } start = this . scanner . currentPosition ; linePtr = this . scanner . linePtr ; endsOnMultiply = true ; break ; default : endsOnMultiply = false ; break ; } } if ( lineCount < newLines ) { this . javadocGapLinesBuffer . setLength ( <NUM_LIT:0> ) ; if ( lineCount > <NUM_LIT:0> ) { this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } for ( int i = lineCount ; i < newLines - <NUM_LIT:1> ; i ++ ) { printJavadocNewLine ( this . javadocGapLinesBuffer ) ; } this . javadocGapLinesBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . javadocGapLinesBuffer ) ; if ( footer ) { this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; this . column ++ ; } else { this . javadocGapLinesBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; } if ( output == null ) { if ( textEndPosition >= start ) { addReplaceEdit ( start , textEndPosition , this . javadocGapLinesBuffer . toString ( ) ) ; } else { addInsertEdit ( textEndPosition + <NUM_LIT:1> , this . javadocGapLinesBuffer . toString ( ) ) ; } } else { output . append ( this . javadocGapLinesBuffer ) ; } } else { if ( textEndPosition >= start ) { this . javadocGapLinesBuffer . setLength ( <NUM_LIT:0> ) ; if ( this . scanner . linePtr > linePtr ) { if ( lineCount > <NUM_LIT:0> ) { this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } this . javadocGapLinesBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . javadocGapLinesBuffer ) ; } this . javadocGapLinesBuffer . append ( '<CHAR_LIT:U+0020>' ) ; if ( output == null ) { addReplaceEdit ( start , textEndPosition , this . javadocGapLinesBuffer . toString ( ) ) ; } else { output . append ( this . javadocGapLinesBuffer ) ; } this . needSpace = false ; } else if ( endsOnMultiply ) { if ( output == null ) { addInsertEdit ( textEndPosition + <NUM_LIT:1> , "<STR_LIT:U+0020>" ) ; } else { output . append ( '<CHAR_LIT:U+0020>' ) ; } this . needSpace = false ; } this . column ++ ; } } catch ( InvalidInputException iie ) { } finally { this . scanner . recordLineSeparator = false ; this . needSpace = false ; this . scanner . resetTo ( textEndPosition + <NUM_LIT:1> , this . scannerEndPosition - <NUM_LIT:1> ) ; this . lastNumberOfNewLines += newLines ; this . line += newLines ; } } private void printJavadocImmutableText ( FormatJavadocText text , FormatJavadocBlock block , boolean textOnNewLine ) { try { int textLineStart = text . lineStart ; this . scanner . tokenizeWhiteSpace = false ; String newLineString = null ; for ( int idx = <NUM_LIT:0> , max = text . separatorsPtr ; idx <= max ; idx ++ ) { int start = ( int ) text . separators [ idx ] ; int lineStart = Util . getLineNumber ( start , this . lineEnds , textLineStart - <NUM_LIT:1> , this . maxLines ) ; while ( textLineStart < lineStart ) { int end = this . lineEnds [ textLineStart - <NUM_LIT:1> ] ; this . scanner . resetTo ( end , start ) ; int token = this . scanner . getNextToken ( ) ; switch ( token ) { case TerminalTokens . TokenNameMULTIPLY : case TerminalTokens . TokenNameMULTIPLY_EQUAL : break ; default : return ; } if ( this . scanner . currentCharacter == '<CHAR_LIT:U+0020>' ) { this . scanner . getNextChar ( ) ; } if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; newLineString = this . tempBuffer . toString ( ) ; } addReplaceEdit ( end + <NUM_LIT:1> , this . scanner . getCurrentTokenEndPosition ( ) , newLineString ) ; textLineStart = Util . getLineNumber ( this . scanner . currentPosition - <NUM_LIT:1> , this . lineEnds , textLineStart , this . maxLines ) ; } } } catch ( InvalidInputException iie ) { } finally { this . needSpace = false ; this . scanner . tokenizeWhiteSpace = true ; this . scanner . resetTo ( text . sourceEnd + <NUM_LIT:1> , this . scannerEndPosition - <NUM_LIT:1> ) ; } } private void printJavadocGapLinesForImmutableBlock ( FormatJavadocBlock block ) { int firstLineEnd = - <NUM_LIT:1> ; int newLineStart = - <NUM_LIT:1> ; int secondLineStart = - <NUM_LIT:1> ; int starPosition = - <NUM_LIT:1> ; int offset = <NUM_LIT:0> ; int start = block . tagEnd + <NUM_LIT:1> ; int end = block . nodes [ <NUM_LIT:0> ] . sourceStart - <NUM_LIT:1> ; this . scanner . resetTo ( start , end ) ; int lineStart = block . lineStart ; int lineEnd = Util . getLineNumber ( block . nodes [ <NUM_LIT:0> ] . sourceEnd , this . lineEnds , lineStart - <NUM_LIT:1> , this . maxLines ) ; boolean multiLinesBlock = lineEnd > ( lineStart + <NUM_LIT:1> ) ; int previousPosition = this . scanner . currentPosition ; String newLineString = null ; int indentationColumn = <NUM_LIT:0> ; int leadingSpaces = - <NUM_LIT:1> ; while ( ! this . scanner . atEnd ( ) ) { char ch = ( char ) this . scanner . getNextChar ( ) ; switch ( ch ) { case '<STR_LIT:\t>' : if ( secondLineStart > <NUM_LIT:0> || firstLineEnd < <NUM_LIT:0> ) { int reminder = this . tabLength == <NUM_LIT:0> ? <NUM_LIT:0> : offset % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { offset += this . tabLength ; } else { offset = ( ( offset / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } } else if ( leadingSpaces >= <NUM_LIT:0> ) { int reminder = this . tabLength == <NUM_LIT:0> ? <NUM_LIT:0> : offset % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { leadingSpaces += this . tabLength ; } else { leadingSpaces = ( ( offset / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } } break ; case '<STR_LIT>' : case '<STR_LIT:\n>' : if ( firstLineEnd < <NUM_LIT:0> ) { firstLineEnd = previousPosition ; } if ( leadingSpaces > <NUM_LIT:0> && multiLinesBlock ) { if ( newLineString == null ) { this . column = <NUM_LIT:1> ; this . tempBuffer . setLength ( <NUM_LIT:0> ) ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; newLineString = this . tempBuffer . toString ( ) ; indentationColumn = this . column ; } else { this . column = indentationColumn ; } addReplaceEdit ( newLineStart , newLineStart + indentationColumn - <NUM_LIT:2> , newLineString ) ; } newLineStart = this . scanner . currentPosition ; leadingSpaces = <NUM_LIT:0> ; starPosition = - <NUM_LIT:1> ; if ( multiLinesBlock ) { offset = <NUM_LIT:0> ; secondLineStart = - <NUM_LIT:1> ; } break ; case '<CHAR_LIT>' : if ( starPosition < <NUM_LIT:0> && firstLineEnd > <NUM_LIT:0> ) { secondLineStart = this . scanner . currentPosition ; starPosition = this . scanner . currentPosition ; leadingSpaces = - <NUM_LIT:1> ; } break ; default : if ( secondLineStart > <NUM_LIT:0> ) { if ( secondLineStart == starPosition ) { secondLineStart = this . scanner . currentPosition ; } else { if ( offset == <NUM_LIT:0> && multiLinesBlock ) { if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; indentationColumn = this . column ; newLineString = this . tempBuffer . toString ( ) ; } else { this . column = indentationColumn ; } addReplaceEdit ( newLineStart , secondLineStart - <NUM_LIT:1> , newLineString ) ; } offset ++ ; } } else if ( firstLineEnd < <NUM_LIT:0> ) { offset ++ ; } else if ( leadingSpaces >= <NUM_LIT:0> ) { leadingSpaces ++ ; } break ; } previousPosition = this . scanner . currentPosition ; } if ( multiLinesBlock ) { this . column += offset ; } else { this . column ++ ; } if ( ! multiLinesBlock ) { if ( firstLineEnd > <NUM_LIT:0> ) { addReplaceEdit ( firstLineEnd , end , "<STR_LIT:U+0020>" ) ; } } else if ( secondLineStart > <NUM_LIT:0> ) { if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; newLineString = this . tempBuffer . toString ( ) ; indentationColumn = this . column ; } else { this . column = indentationColumn ; } addReplaceEdit ( newLineStart , secondLineStart - <NUM_LIT:1> , newLineString ) ; } else if ( leadingSpaces > <NUM_LIT:0> ) { if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; newLineString = this . tempBuffer . toString ( ) ; indentationColumn = this . column ; } else { this . column = indentationColumn ; } addReplaceEdit ( newLineStart , newLineStart + indentationColumn - <NUM_LIT:2> , newLineString ) ; } this . needSpace = false ; this . scanner . resetTo ( end + <NUM_LIT:1> , this . scannerEndPosition - <NUM_LIT:1> ) ; } private int printJavadocHtmlTag ( FormatJavadocText text , FormatJavadocBlock block , boolean textOnNewLine ) { boolean clearBlankLines = this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment ; int textStart = text . sourceStart ; int nextStart = textStart ; int startLine = Util . getLineNumber ( textStart , this . lineEnds , <NUM_LIT:0> , this . maxLines ) ; int htmlTagID = text . getHtmlTagID ( ) ; if ( text . depth >= this . javadocHtmlTagBuffers . length ) { int length = this . javadocHtmlTagBuffers . length ; System . arraycopy ( this . javadocHtmlTagBuffers , <NUM_LIT:0> , this . javadocHtmlTagBuffers = new StringBuffer [ text . depth + <NUM_LIT:6> ] , <NUM_LIT:0> , length ) ; } StringBuffer buffer = this . javadocHtmlTagBuffers [ text . depth ] ; if ( buffer == null ) { buffer = new StringBuffer ( ) ; this . javadocHtmlTagBuffers [ text . depth ] = buffer ; } else { buffer . setLength ( <NUM_LIT:0> ) ; } int max = text . separatorsPtr ; int linesAfter = <NUM_LIT:0> ; int previousEnd = - <NUM_LIT:1> ; boolean isHtmlBreakTag = htmlTagID == JAVADOC_SINGLE_BREAK_TAG_ID ; boolean isHtmlSeparatorTag = htmlTagID == JAVADOC_SEPARATOR_TAGS_ID ; if ( isHtmlBreakTag ) { return <NUM_LIT:1> ; } boolean isCode = htmlTagID == JAVADOC_CODE_TAGS_ID ; for ( int idx = <NUM_LIT:0> , ptr = <NUM_LIT:0> ; idx <= max || ( text . htmlNodesPtr != - <NUM_LIT:1> && ptr <= text . htmlNodesPtr ) ; idx ++ ) { int end = ( idx > max ) ? text . sourceEnd : ( int ) ( text . separators [ idx ] > > > <NUM_LIT:32> ) ; int nodeKind = <NUM_LIT:0> ; if ( text . htmlNodesPtr >= <NUM_LIT:0> && ptr <= text . htmlNodesPtr && end > text . htmlNodes [ ptr ] . sourceStart ) { FormatJavadocNode node = text . htmlNodes [ ptr ] ; FormatJavadocText htmlTag = node . isText ( ) ? ( FormatJavadocText ) node : null ; int newLines = htmlTag == null ? <NUM_LIT:0> : htmlTag . linesBefore ; if ( linesAfter > newLines ) { newLines = linesAfter ; if ( newLines > <NUM_LIT:1> && clearBlankLines ) { if ( idx < <NUM_LIT:2> || ( text . htmlIndexes [ idx - <NUM_LIT:2> ] & JAVADOC_TAGS_ID_MASK ) != JAVADOC_CODE_TAGS_ID ) { newLines = <NUM_LIT:1> ; } } } if ( textStart < previousEnd ) { addReplaceEdit ( textStart , previousEnd , buffer . toString ( ) ) ; } boolean immutable = node . isImmutable ( ) ; if ( newLines == <NUM_LIT:0> ) { newLines = printJavadocBlockNodesNewLines ( block , node , previousEnd ) ; } int nodeStart = node . sourceStart ; if ( newLines > <NUM_LIT:0> || ( idx > <NUM_LIT:1> && nodeStart > ( previousEnd + <NUM_LIT:1> ) ) ) { printJavadocGapLines ( previousEnd + <NUM_LIT:1> , nodeStart - <NUM_LIT:1> , newLines , clearBlankLines , false , null ) ; } if ( newLines > <NUM_LIT:0> ) textOnNewLine = true ; buffer . setLength ( <NUM_LIT:0> ) ; if ( node . isText ( ) ) { if ( immutable ) { if ( textOnNewLine && this . commentIndentation != null ) { addInsertEdit ( node . sourceStart , this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } printJavadocImmutableText ( htmlTag , block , textOnNewLine ) ; this . column += getTextLength ( block , htmlTag ) ; linesAfter = <NUM_LIT:0> ; } else { linesAfter = printJavadocHtmlTag ( htmlTag , block , textOnNewLine ) ; } nodeKind = <NUM_LIT:1> ; } else { if ( textOnNewLine && this . commentIndentation != null ) { addInsertEdit ( node . sourceStart , this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } printJavadocBlock ( ( FormatJavadocBlock ) node ) ; linesAfter = <NUM_LIT:0> ; nodeKind = <NUM_LIT:2> ; } textStart = node . sourceEnd + <NUM_LIT:1> ; ptr ++ ; if ( idx > max ) { return linesAfter ; } } else { if ( idx > <NUM_LIT:0> && linesAfter > <NUM_LIT:0> ) { printJavadocGapLines ( previousEnd + <NUM_LIT:1> , nextStart - <NUM_LIT:1> , linesAfter , clearBlankLines , false , buffer ) ; textOnNewLine = true ; } boolean needIndentation = textOnNewLine ; if ( idx > <NUM_LIT:0> ) { if ( ! needIndentation && text . isTextAfterHtmlSeparatorTag ( idx - <NUM_LIT:1> ) ) { needIndentation = true ; } } this . needSpace = idx > <NUM_LIT:1> && ( previousEnd + <NUM_LIT:1> ) < nextStart ; printJavadocTextLine ( buffer , nextStart , end , block , idx == <NUM_LIT:0> , needIndentation , idx == <NUM_LIT:0> || text . htmlIndexes [ idx - <NUM_LIT:1> ] != - <NUM_LIT:1> ) ; linesAfter = <NUM_LIT:0> ; if ( idx == <NUM_LIT:0> ) { if ( isHtmlSeparatorTag ) { linesAfter = <NUM_LIT:1> ; } } else if ( text . htmlIndexes [ idx - <NUM_LIT:1> ] == JAVADOC_SINGLE_BREAK_TAG_ID ) { linesAfter = <NUM_LIT:1> ; } } nextStart = ( int ) text . separators [ idx ] ; int endLine = Util . getLineNumber ( end , this . lineEnds , startLine - <NUM_LIT:1> , this . maxLines ) ; startLine = Util . getLineNumber ( nextStart , this . lineEnds , endLine - <NUM_LIT:1> , this . maxLines ) ; int linesGap = startLine - endLine ; if ( linesGap > <NUM_LIT:0> ) { if ( clearBlankLines ) { } else { if ( idx == <NUM_LIT:0> || linesGap > <NUM_LIT:1> || ( idx < max && nodeKind == <NUM_LIT:1> && ( text . htmlIndexes [ idx - <NUM_LIT:1> ] & JAVADOC_TAGS_ID_MASK ) != JAVADOC_IMMUTABLE_TAGS_ID ) ) { if ( linesAfter < linesGap ) { linesAfter = linesGap ; } } } } textOnNewLine = linesAfter > <NUM_LIT:0> ; if ( isCode ) { int codeEnd = ( int ) ( text . separators [ max ] > > > <NUM_LIT:32> ) ; if ( codeEnd > end ) { if ( this . formatter . preferences . comment_format_source ) { if ( textStart < end ) addReplaceEdit ( textStart , end , buffer . toString ( ) ) ; if ( linesGap > <NUM_LIT:0> ) { int lineStart = this . scanner . getLineStart ( startLine ) ; if ( nextStart > lineStart ) { this . scanner . resetTo ( lineStart , nextStart - <NUM_LIT:1> ) ; try { int token = this . scanner . getNextToken ( ) ; if ( token == TerminalTokens . TokenNameWHITESPACE ) { token = this . scanner . getNextToken ( ) ; } if ( token == TerminalTokens . TokenNameMULTIPLY ) { nextStart = this . scanner . currentPosition ; } } catch ( InvalidInputException iie ) { } } } int newLines = linesGap ; if ( newLines == <NUM_LIT:0> ) newLines = <NUM_LIT:1> ; this . needSpace = false ; printJavadocGapLines ( end + <NUM_LIT:1> , nextStart - <NUM_LIT:1> , newLines , false , false , null ) ; printCodeSnippet ( nextStart , codeEnd , linesGap ) ; nextStart = ( int ) text . separators [ max ] ; printJavadocGapLines ( codeEnd + <NUM_LIT:1> , nextStart - <NUM_LIT:1> , <NUM_LIT:1> , false , false , null ) ; return <NUM_LIT:2> ; } } else { nextStart = ( int ) text . separators [ max ] ; if ( ( nextStart - <NUM_LIT:1> ) > ( end + <NUM_LIT:1> ) ) { int line1 = Util . getLineNumber ( end + <NUM_LIT:1> , this . lineEnds , startLine - <NUM_LIT:1> , this . maxLines ) ; int line2 = Util . getLineNumber ( nextStart - <NUM_LIT:1> , this . lineEnds , line1 - <NUM_LIT:1> , this . maxLines ) ; int gapLines = line2 - line1 - <NUM_LIT:1> ; printJavadocGapLines ( end + <NUM_LIT:1> , nextStart - <NUM_LIT:1> , gapLines , false , false , null ) ; if ( gapLines > <NUM_LIT:0> ) textOnNewLine = true ; } } return <NUM_LIT:1> ; } previousEnd = end ; } boolean closingTag = isHtmlBreakTag || ( text . htmlIndexes != null && ( text . htmlIndexes [ max ] & JAVADOC_TAGS_ID_MASK ) == htmlTagID ) ; boolean isValidHtmlSeparatorTag = max > <NUM_LIT:0> && isHtmlSeparatorTag && closingTag ; if ( previousEnd != - <NUM_LIT:1> ) { if ( isValidHtmlSeparatorTag ) { if ( linesAfter == <NUM_LIT:0> ) linesAfter = <NUM_LIT:1> ; } if ( linesAfter > <NUM_LIT:0> ) { printJavadocGapLines ( previousEnd + <NUM_LIT:1> , nextStart - <NUM_LIT:1> , linesAfter , clearBlankLines , false , buffer ) ; textOnNewLine = linesAfter > <NUM_LIT:0> ; } } boolean needIndentation = textOnNewLine ; if ( ! needIndentation && ! isHtmlBreakTag && text . htmlIndexes != null && text . isTextAfterHtmlSeparatorTag ( max ) ) { needIndentation = true ; } this . needSpace = ! closingTag && max > <NUM_LIT:0> && ( previousEnd + <NUM_LIT:1> ) < nextStart ; printJavadocTextLine ( buffer , nextStart , text . sourceEnd , block , max <= <NUM_LIT:0> , needIndentation , closingTag ) ; if ( textStart < text . sourceEnd ) { addReplaceEdit ( textStart , text . sourceEnd , buffer . toString ( ) ) ; } this . needSpace = false ; this . scanner . resetTo ( text . sourceEnd + <NUM_LIT:1> , this . scannerEndPosition - <NUM_LIT:1> ) ; return isValidHtmlSeparatorTag ? <NUM_LIT:1> : <NUM_LIT:0> ; } private void printJavadocNewLine ( StringBuffer buffer ) { buffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( buffer ) ; buffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; this . line ++ ; this . lastNumberOfNewLines ++ ; } private void printJavadocText ( FormatJavadocText text , FormatJavadocBlock block , boolean textOnNewLine ) { boolean clearBlankLines = this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment ; boolean joinLines = this . formatter . preferences . join_lines_in_comments ; this . javadocTextBuffer . setLength ( <NUM_LIT:0> ) ; int textStart = text . sourceStart ; int nextStart = textStart ; int startLine = Util . getLineNumber ( textStart , this . lineEnds , <NUM_LIT:0> , this . maxLines ) ; for ( int idx = <NUM_LIT:0> , max = text . separatorsPtr ; idx <= max ; idx ++ ) { int end = ( int ) ( text . separators [ idx ] > > > <NUM_LIT:32> ) ; boolean needIndentation = textOnNewLine ; if ( idx > <NUM_LIT:0> ) { if ( ! needIndentation && text . isTextAfterHtmlSeparatorTag ( idx - <NUM_LIT:1> ) ) { needIndentation = true ; } } this . needSpace = idx > <NUM_LIT:0> ; printJavadocTextLine ( this . javadocTextBuffer , nextStart , end , block , idx == <NUM_LIT:0> || ( ! joinLines && textOnNewLine ) , needIndentation , false ) ; textOnNewLine = false ; nextStart = ( int ) text . separators [ idx ] ; if ( ! clearBlankLines || ! joinLines ) { int endLine = Util . getLineNumber ( end , this . lineEnds , startLine - <NUM_LIT:1> , this . maxLines ) ; startLine = Util . getLineNumber ( nextStart , this . lineEnds , endLine - <NUM_LIT:1> , this . maxLines ) ; int gapLine = endLine ; if ( joinLines ) gapLine ++ ; if ( startLine > gapLine ) { addReplaceEdit ( textStart , end , this . javadocTextBuffer . toString ( ) ) ; textStart = nextStart ; this . javadocTextBuffer . setLength ( <NUM_LIT:0> ) ; int newLines = startLine - endLine ; if ( clearBlankLines ) newLines = <NUM_LIT:1> ; printJavadocGapLines ( end + <NUM_LIT:1> , nextStart - <NUM_LIT:1> , newLines , this . formatter . preferences . comment_clear_blank_lines_in_javadoc_comment , false , null ) ; textOnNewLine = true ; } else if ( startLine > endLine ) { textOnNewLine = ! joinLines ; } } } boolean needIndentation = textOnNewLine ; this . needSpace = text . separatorsPtr >= <NUM_LIT:0> ; printJavadocTextLine ( this . javadocTextBuffer , nextStart , text . sourceEnd , block , text . separatorsPtr == - <NUM_LIT:1> , needIndentation , false ) ; addReplaceEdit ( textStart , text . sourceEnd , this . javadocTextBuffer . toString ( ) ) ; this . needSpace = false ; this . scanner . resetTo ( text . sourceEnd + <NUM_LIT:1> , this . scannerEndPosition - <NUM_LIT:1> ) ; } private void printJavadocTextLine ( StringBuffer buffer , int textStart , int textEnd , FormatJavadocBlock block , boolean firstText , boolean needIndentation , boolean isHtmlTag ) { boolean headerLine = block . isHeaderLine ( ) && this . lastNumberOfNewLines == <NUM_LIT:0> ; this . javadocTokensBuffer . setLength ( <NUM_LIT:0> ) ; int firstColumn = <NUM_LIT:1> + this . indentationLevel + BLOCK_LINE_PREFIX_LENGTH ; int maxColumn = this . formatter . preferences . comment_line_length + <NUM_LIT:1> ; if ( headerLine ) { firstColumn ++ ; maxColumn ++ ; } if ( needIndentation && this . commentIndentation != null ) { buffer . append ( this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; firstColumn += this . commentIndentation . length ( ) ; } if ( this . column < firstColumn ) { this . column = firstColumn ; } String newLineString = null ; try { this . scanner . resetTo ( textStart , textEnd ) ; this . scanner . skipComments = true ; int previousToken = - <NUM_LIT:1> ; boolean textOnNewLine = needIndentation ; while ( ! this . scanner . atEnd ( ) ) { int token ; try { token = this . scanner . getNextToken ( ) ; } catch ( InvalidInputException iie ) { token = consumeInvalidToken ( textEnd ) ; } int tokensBufferLength = this . javadocTokensBuffer . length ( ) ; int tokenStart = this . scanner . getCurrentTokenStartPosition ( ) ; int tokenLength = ( this . scanner . atEnd ( ) ? this . scanner . eofPosition : this . scanner . currentPosition ) - tokenStart ; boolean insertSpace = ( previousToken == TerminalTokens . TokenNameWHITESPACE || this . needSpace ) && ! textOnNewLine ; String tokensBufferString = this . javadocTokensBuffer . toString ( ) . trim ( ) ; switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : if ( tokensBufferLength > <NUM_LIT:0> ) { boolean shouldSplit = ( this . column + tokensBufferLength ) > maxColumn && ! isHtmlTag && ( insertSpace || tokensBufferLength > <NUM_LIT:1> ) && tokensBufferString . charAt ( <NUM_LIT:0> ) != '<CHAR_LIT>' ; if ( shouldSplit ) { this . lastNumberOfNewLines ++ ; this . line ++ ; if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; if ( this . commentIndentation != null ) { this . tempBuffer . append ( this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } firstColumn = this . column ; newLineString = this . tempBuffer . toString ( ) ; } else { this . column = firstColumn ; } buffer . append ( newLineString ) ; buffer . append ( tokensBufferString ) ; this . column += tokensBufferString . length ( ) ; if ( headerLine ) { firstColumn -- ; maxColumn -- ; headerLine = false ; } } else { buffer . append ( this . javadocTokensBuffer ) ; this . column += tokensBufferLength ; } this . javadocTokensBuffer . setLength ( <NUM_LIT:0> ) ; } textOnNewLine = false ; previousToken = token ; continue ; case TerminalTokens . TokenNameCharacterLiteral : if ( this . scanner . currentPosition > this . scanner . eofPosition ) { this . scanner . resetTo ( this . scanner . startPosition , textEnd ) ; this . scanner . getNextChar ( ) ; token = <NUM_LIT:1> ; } break ; } int lastColumn = this . column + tokensBufferLength + tokenLength ; if ( insertSpace ) lastColumn ++ ; boolean shouldSplit = lastColumn > maxColumn && ( ! isHtmlTag || previousToken == - <NUM_LIT:1> ) && token != TerminalTokens . TokenNameAT && ( tokensBufferLength == <NUM_LIT:0> || this . javadocTokensBuffer . charAt ( tokensBufferLength - <NUM_LIT:1> ) != '<CHAR_LIT>' ) ; if ( shouldSplit ) { if ( ( tokensBufferLength > <NUM_LIT:0> || tokenLength < maxColumn ) && ! isHtmlTag && tokensBufferLength > <NUM_LIT:0> && ( firstColumn + tokensBufferLength + tokenLength ) >= maxColumn ) { buffer . append ( this . javadocTokensBuffer ) ; this . column += tokensBufferLength ; this . javadocTokensBuffer . setLength ( <NUM_LIT:0> ) ; tokensBufferLength = <NUM_LIT:0> ; textOnNewLine = false ; } if ( ( tokensBufferLength > <NUM_LIT:0> || this . column > firstColumn ) && ( ! textOnNewLine || ! firstText ) ) { this . lastNumberOfNewLines ++ ; this . line ++ ; if ( newLineString == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( this . lineSeparator ) ; this . column = <NUM_LIT:1> ; printIndentationIfNecessary ( this . tempBuffer ) ; this . tempBuffer . append ( BLOCK_LINE_PREFIX ) ; this . column += BLOCK_LINE_PREFIX_LENGTH ; if ( this . commentIndentation != null ) { this . tempBuffer . append ( this . commentIndentation ) ; this . column += this . commentIndentation . length ( ) ; } firstColumn = this . column ; newLineString = this . tempBuffer . toString ( ) ; } else { this . column = firstColumn ; } buffer . append ( newLineString ) ; } if ( tokensBufferLength > <NUM_LIT:0> ) { String tokensString = tokensBufferString ; buffer . append ( tokensString ) ; this . column += tokensString . length ( ) ; this . javadocTokensBuffer . setLength ( <NUM_LIT:0> ) ; tokensBufferLength = <NUM_LIT:0> ; } buffer . append ( this . scanner . source , tokenStart , tokenLength ) ; this . column += tokenLength ; textOnNewLine = false ; if ( headerLine ) { firstColumn -- ; maxColumn -- ; headerLine = false ; } } else { if ( insertSpace ) { this . javadocTokensBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } this . javadocTokensBuffer . append ( this . scanner . source , tokenStart , tokenLength ) ; } previousToken = token ; this . needSpace = false ; if ( headerLine && lastColumn == maxColumn && this . scanner . atEnd ( ) ) { this . lastNumberOfNewLines ++ ; this . line ++ ; } } } finally { this . scanner . skipComments = false ; if ( this . javadocTokensBuffer . length ( ) > <NUM_LIT:0> ) { buffer . append ( this . javadocTokensBuffer ) ; this . column += this . javadocTokensBuffer . length ( ) ; } } } public void printModifiers ( Annotation [ ] annotations , ASTVisitor visitor ) { printModifiers ( annotations , visitor , ICodeFormatterConstants . ANNOTATION_UNSPECIFIED ) ; } public void printModifiers ( Annotation [ ] annotations , ASTVisitor visitor , int annotationSourceKind ) { try { int annotationsLength = annotations != null ? annotations . length : <NUM_LIT:0> ; int annotationsIndex = <NUM_LIT:0> ; boolean isFirstModifier = true ; int currentTokenStartPosition = this . scanner . currentPosition ; boolean hasComment = false ; boolean hasModifiers = false ; while ( ( this . currentToken = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { int foundTaskCount = this . scanner . foundTaskCount ; int tokenStartPosition = this . scanner . getCurrentTokenStartPosition ( ) ; int tokenEndPosition = this . scanner . getCurrentTokenEndPosition ( ) ; switch ( this . currentToken ) { case TerminalTokens . TokenNamepublic : case TerminalTokens . TokenNameprotected : case TerminalTokens . TokenNameprivate : case TerminalTokens . TokenNamestatic : case TerminalTokens . TokenNameabstract : case TerminalTokens . TokenNamefinal : case TerminalTokens . TokenNamenative : case TerminalTokens . TokenNamesynchronized : case TerminalTokens . TokenNametransient : case TerminalTokens . TokenNamevolatile : case TerminalTokens . TokenNamestrictfp : hasModifiers = true ; print ( this . scanner . currentPosition - this . scanner . startPosition , ! isFirstModifier ) ; isFirstModifier = false ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameAT : hasModifiers = true ; if ( ! isFirstModifier ) { space ( ) ; } this . scanner . resetTo ( this . scanner . getCurrentTokenStartPosition ( ) , this . scannerEndPosition - <NUM_LIT:1> ) ; if ( annotationsIndex < annotationsLength ) { boolean insertSpaceBeforeBrace = this . formatter . preferences . insert_space_before_opening_brace_in_array_initializer ; this . formatter . preferences . insert_space_before_opening_brace_in_array_initializer = false ; try { annotations [ annotationsIndex ++ ] . traverse ( visitor , ( BlockScope ) null ) ; } finally { this . formatter . preferences . insert_space_before_opening_brace_in_array_initializer = insertSpaceBeforeBrace ; } boolean shouldAddNewLine = false ; switch ( annotationSourceKind ) { case ICodeFormatterConstants . ANNOTATION_ON_TYPE : if ( this . formatter . preferences . insert_new_line_after_annotation_on_type ) { shouldAddNewLine = true ; } break ; case ICodeFormatterConstants . ANNOTATION_ON_FIELD : if ( this . formatter . preferences . insert_new_line_after_annotation_on_field ) { shouldAddNewLine = true ; } break ; case ICodeFormatterConstants . ANNOTATION_ON_METHOD : if ( this . formatter . preferences . insert_new_line_after_annotation_on_method ) { shouldAddNewLine = true ; } break ; case ICodeFormatterConstants . ANNOTATION_ON_PACKAGE : if ( this . formatter . preferences . insert_new_line_after_annotation_on_package ) { shouldAddNewLine = true ; } break ; case ICodeFormatterConstants . ANNOTATION_ON_PARAMETER : if ( this . formatter . preferences . insert_new_line_after_annotation_on_parameter ) { shouldAddNewLine = true ; } break ; case ICodeFormatterConstants . ANNOTATION_ON_LOCAL_VARIABLE : if ( this . formatter . preferences . insert_new_line_after_annotation_on_local_variable ) { shouldAddNewLine = true ; } break ; default : } if ( shouldAddNewLine ) { this . printNewLine ( ) ; } } else { return ; } isFirstModifier = false ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : if ( this . useTags && this . editsEnabled ) { boolean turnOff = false ; if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; turnOff = true ; } else if ( this . tagsKind == this . currentToken && CharOperation . equals ( this . disablingTag , this . scanner . source , tokenStartPosition , tokenEndPosition + <NUM_LIT:1> ) ) { this . editsEnabled = false ; turnOff = true ; } if ( turnOff ) { if ( ! this . editsEnabled && this . editsIndex > <NUM_LIT:1> ) { OptimizedReplaceEdit currentEdit = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; if ( this . scanner . startPosition == currentEdit . offset + currentEdit . length ) { printNewLinesBeforeDisablingComment ( ) ; } } } } printBlockComment ( this . currentToken == TerminalTokens . TokenNameCOMMENT_JAVADOC ) ; if ( this . useTags && ! this . editsEnabled ) { if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; } else if ( this . tagsKind == this . currentToken ) { this . editsEnabled = CharOperation . equals ( this . enablingTag , this . scanner . source , tokenStartPosition , tokenEndPosition + <NUM_LIT:1> ) ; } } currentTokenStartPosition = this . scanner . currentPosition ; hasComment = true ; break ; case TerminalTokens . TokenNameCOMMENT_LINE : tokenEndPosition = - this . scanner . commentStops [ this . scanner . commentPtr ] ; if ( this . useTags && this . editsEnabled ) { boolean turnOff = false ; if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; turnOff = true ; } else if ( this . tagsKind == this . currentToken && CharOperation . equals ( this . disablingTag , this . scanner . source , tokenStartPosition , tokenEndPosition ) ) { this . editsEnabled = false ; turnOff = true ; } if ( turnOff ) { if ( ! this . editsEnabled && this . editsIndex > <NUM_LIT:1> ) { OptimizedReplaceEdit currentEdit = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; if ( this . scanner . startPosition == currentEdit . offset + currentEdit . length ) { printNewLinesBeforeDisablingComment ( ) ; } } } } printLineComment ( ) ; if ( this . useTags && ! this . editsEnabled ) { if ( foundTaskCount > <NUM_LIT:0> ) { setEditsEnabled ( foundTaskCount ) ; } else if ( this . tagsKind == this . currentToken ) { this . editsEnabled = CharOperation . equals ( this . enablingTag , this . scanner . source , tokenStartPosition , tokenEndPosition ) ; } } currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameWHITESPACE : addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; int count = <NUM_LIT:0> ; char [ ] whiteSpaces = this . scanner . getCurrentTokenSource ( ) ; for ( int i = <NUM_LIT:0> , max = whiteSpaces . length ; i < max ; i ++ ) { switch ( whiteSpaces [ i ] ) { case '<STR_LIT>' : if ( ( i + <NUM_LIT:1> ) < max ) { if ( whiteSpaces [ i + <NUM_LIT:1> ] == '<STR_LIT:\n>' ) { i ++ ; } } count ++ ; break ; case '<STR_LIT:\n>' : count ++ ; } } if ( count >= <NUM_LIT:1> && hasComment ) { printNewLine ( ) ; } currentTokenStartPosition = this . scanner . currentPosition ; hasComment = false ; break ; default : if ( hasModifiers ) { space ( ) ; } this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } } } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } public void printNewLine ( ) { this . printNewLine ( this . scanner . getCurrentTokenEndPosition ( ) + <NUM_LIT:1> ) ; } public void printNewLine ( int insertPosition ) { if ( this . nlsTagCounter > <NUM_LIT:0> ) { return ; } if ( this . lastNumberOfNewLines >= <NUM_LIT:1> ) { if ( ! this . preserveLineBreakIndentation ) { this . column = <NUM_LIT:1> ; } this . preserveLineBreakIndentation = false ; return ; } addInsertEdit ( insertPosition , this . lineSeparator ) ; this . line ++ ; this . lastNumberOfNewLines = <NUM_LIT:1> ; this . column = <NUM_LIT:1> ; this . needSpace = false ; this . pendingSpace = false ; this . preserveLineBreakIndentation = false ; this . lastLineComment . contiguous = false ; } private void printNewLinesBeforeDisablingComment ( ) { int linePtr = Arrays . binarySearch ( this . lineEnds , this . scanner . startPosition ) ; if ( linePtr < <NUM_LIT:0> ) { linePtr = - linePtr - <NUM_LIT:1> ; } int indentation = <NUM_LIT:0> ; int beginningOfLine = getLineEnd ( linePtr ) + <NUM_LIT:1> ; if ( beginningOfLine == - <NUM_LIT:1> ) { beginningOfLine = <NUM_LIT:0> ; } OptimizedReplaceEdit currentEdit = this . edits [ this . editsIndex - <NUM_LIT:1> ] ; int offset = currentEdit . offset ; if ( offset >= beginningOfLine ) return ; int scannerStartPosition = this . scanner . startPosition ; int scannerEofPosition = this . scanner . eofPosition ; int scannerCurrentPosition = this . scanner . currentPosition ; char scannerCurrentChar = this . scanner . currentCharacter ; int length = currentEdit . length ; this . scanner . resetTo ( beginningOfLine , offset + length - <NUM_LIT:1> ) ; try { while ( ! this . scanner . atEnd ( ) ) { char ch = ( char ) this . scanner . getNextChar ( ) ; switch ( ch ) { case '<STR_LIT:\t>' : if ( this . tabLength != <NUM_LIT:0> ) { int reminder = indentation % this . tabLength ; if ( reminder == <NUM_LIT:0> ) { indentation += this . tabLength ; } else { indentation = ( ( indentation / this . tabLength ) + <NUM_LIT:1> ) * this . tabLength ; } } break ; case '<CHAR_LIT:U+0020>' : indentation ++ ; break ; default : return ; } } String indentationString ; int currentIndentation = getCurrentIndentation ( this . scanner . currentPosition ) ; if ( currentIndentation > <NUM_LIT:0> && this . indentationLevel > <NUM_LIT:0> ) { int col = this . column ; this . tempBuffer . setLength ( <NUM_LIT:0> ) ; printIndentationIfNecessary ( this . tempBuffer ) ; indentationString = this . tempBuffer . toString ( ) ; this . column = col ; } else { indentationString = Util . EMPTY_STRING ; } String replacement = currentEdit . replacement ; if ( replacement . length ( ) == <NUM_LIT:0> ) { this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( beginningOfLine , offset + length - beginningOfLine , indentationString ) ; } else { int idx = replacement . lastIndexOf ( this . lineSeparator ) ; if ( idx >= <NUM_LIT:0> ) { int start = idx + this . lsLength ; this . tempBuffer . setLength ( <NUM_LIT:0> ) ; this . tempBuffer . append ( replacement . substring ( <NUM_LIT:0> , start ) ) ; if ( indentationString != Util . EMPTY_STRING ) { this . tempBuffer . append ( indentationString ) ; } this . edits [ this . editsIndex - <NUM_LIT:1> ] = new OptimizedReplaceEdit ( offset , length , this . tempBuffer . toString ( ) ) ; } } } finally { this . scanner . startPosition = scannerStartPosition ; this . scanner . eofPosition = scannerEofPosition ; this . scanner . currentPosition = scannerCurrentPosition ; this . scanner . currentCharacter = scannerCurrentChar ; } } private boolean printNewLinesCharacters ( int offset , int length ) { boolean foundNewLine = false ; int scannerStartPosition = this . scanner . startPosition ; int scannerEofPosition = this . scanner . eofPosition ; int scannerCurrentPosition = this . scanner . currentPosition ; char scannerCurrentChar = this . scanner . currentCharacter ; this . scanner . resetTo ( offset , offset + length - <NUM_LIT:1> ) ; try { while ( ! this . scanner . atEnd ( ) ) { int start = this . scanner . currentPosition ; char ch = ( char ) this . scanner . getNextChar ( ) ; boolean needReplace = ch != this . firstLS ; switch ( ch ) { case '<STR_LIT>' : if ( this . scanner . atEnd ( ) ) break ; ch = ( char ) this . scanner . getNextChar ( ) ; if ( ch != '<STR_LIT:\n>' ) break ; needReplace = needReplace || this . lsLength != <NUM_LIT:2> ; case '<STR_LIT:\n>' : if ( needReplace ) { if ( this . editsIndex == <NUM_LIT:0> || this . edits [ this . editsIndex - <NUM_LIT:1> ] . offset != start ) { this . edits [ this . editsIndex ++ ] = new OptimizedReplaceEdit ( start , this . scanner . currentPosition - start , this . lineSeparator ) ; } } foundNewLine = true ; break ; } } } finally { this . scanner . startPosition = scannerStartPosition ; this . scanner . eofPosition = scannerEofPosition ; this . scanner . currentPosition = scannerCurrentPosition ; this . scanner . currentCharacter = scannerCurrentChar ; } return foundNewLine ; } public void printNextToken ( int expectedTokenType ) { printNextToken ( expectedTokenType , false ) ; } public void printNextToken ( int expectedTokenType , boolean considerSpaceIfAny ) { printNextToken ( expectedTokenType , considerSpaceIfAny , PRESERVE_EMPTY_LINES_KEEP_LAST_NEW_LINES_INDENTATION ) ; } public void printNextToken ( int expectedTokenType , boolean considerSpaceIfAny , int emptyLineRules ) { printComment ( CodeFormatter . K_UNKNOWN , NO_TRAILING_COMMENT , emptyLineRules ) ; try { this . currentToken = this . scanner . getNextToken ( ) ; if ( expectedTokenType != this . currentToken ) { throw new AbortFormatting ( "<STR_LIT>" + expectedTokenType + "<STR_LIT>" + this . currentToken ) ; } print ( this . scanner . currentPosition - this . scanner . startPosition , considerSpaceIfAny ) ; } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } public void printNextToken ( int [ ] expectedTokenTypes ) { printNextToken ( expectedTokenTypes , false ) ; } public void printNextToken ( int [ ] expectedTokenTypes , boolean considerSpaceIfAny ) { printComment ( CodeFormatter . K_UNKNOWN , NO_TRAILING_COMMENT ) ; try { this . currentToken = this . scanner . getNextToken ( ) ; if ( Arrays . binarySearch ( expectedTokenTypes , this . currentToken ) < <NUM_LIT:0> ) { StringBuffer expectations = new StringBuffer ( <NUM_LIT:5> ) ; for ( int i = <NUM_LIT:0> ; i < expectedTokenTypes . length ; i ++ ) { if ( i > <NUM_LIT:0> ) { expectations . append ( '<CHAR_LIT:U+002C>' ) ; } expectations . append ( expectedTokenTypes [ i ] ) ; } throw new AbortFormatting ( "<STR_LIT>" + expectations . toString ( ) + "<STR_LIT>" + this . currentToken ) ; } print ( this . scanner . currentPosition - this . scanner . startPosition , considerSpaceIfAny ) ; } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } public void printArrayQualifiedReference ( int numberOfTokens , int sourceEnd ) { int currentTokenStartPosition = this . scanner . currentPosition ; int numberOfIdentifiers = <NUM_LIT:0> ; try { do { printComment ( CodeFormatter . K_UNKNOWN , NO_TRAILING_COMMENT ) ; switch ( this . currentToken = this . scanner . getNextToken ( ) ) { case TerminalTokens . TokenNameEOF : return ; case TerminalTokens . TokenNameWHITESPACE : addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : printBlockComment ( false ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_LINE : printLineComment ( ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameIdentifier : print ( this . scanner . currentPosition - this . scanner . startPosition , false ) ; currentTokenStartPosition = this . scanner . currentPosition ; if ( ++ numberOfIdentifiers == numberOfTokens ) { this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } break ; case TerminalTokens . TokenNameDOT : print ( this . scanner . currentPosition - this . scanner . startPosition , false ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameRPAREN : currentTokenStartPosition = this . scanner . startPosition ; default : this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } } while ( this . scanner . currentPosition <= sourceEnd ) ; } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } public void printQualifiedReference ( int sourceEnd , boolean expectParenthesis ) { int currentTokenStartPosition = this . scanner . currentPosition ; try { do { printComment ( CodeFormatter . K_UNKNOWN , NO_TRAILING_COMMENT ) ; switch ( this . currentToken = this . scanner . getNextToken ( ) ) { case TerminalTokens . TokenNameEOF : return ; case TerminalTokens . TokenNameWHITESPACE : addDeleteEdit ( this . scanner . getCurrentTokenStartPosition ( ) , this . scanner . getCurrentTokenEndPosition ( ) ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : printBlockComment ( false ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameCOMMENT_LINE : printLineComment ( ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameIdentifier : case TerminalTokens . TokenNameDOT : print ( this . scanner . currentPosition - this . scanner . startPosition , false ) ; currentTokenStartPosition = this . scanner . currentPosition ; break ; case TerminalTokens . TokenNameRPAREN : if ( expectParenthesis ) { currentTokenStartPosition = this . scanner . startPosition ; } default : this . scanner . resetTo ( currentTokenStartPosition , this . scannerEndPosition - <NUM_LIT:1> ) ; return ; } } while ( this . scanner . currentPosition <= sourceEnd ) ; } catch ( InvalidInputException e ) { throw new AbortFormatting ( e ) ; } } private void printRule ( StringBuffer stringBuffer ) { for ( int i = <NUM_LIT:0> ; i < this . pageWidth ; i ++ ) { if ( ( i % this . tabLength ) == <NUM_LIT:0> ) { stringBuffer . append ( '<CHAR_LIT>' ) ; } else { stringBuffer . append ( '<CHAR_LIT:->' ) ; } } stringBuffer . append ( this . lineSeparator ) ; for ( int i = <NUM_LIT:0> ; i < ( this . pageWidth / this . tabLength ) ; i ++ ) { stringBuffer . append ( i ) ; stringBuffer . append ( '<STR_LIT:\t>' ) ; } } void redoAlignment ( AlignmentException e ) { if ( e . relativeDepth > <NUM_LIT:0> ) { e . relativeDepth -- ; this . currentAlignment = this . currentAlignment . enclosing ; throw e ; } resetAt ( this . currentAlignment . location ) ; this . scanner . resetTo ( this . currentAlignment . location . inputOffset , this . scanner . eofPosition - <NUM_LIT:1> ) ; this . currentAlignment . chunkKind = <NUM_LIT:0> ; } void redoMemberAlignment ( AlignmentException e ) { resetAt ( this . memberAlignment . location ) ; this . scanner . resetTo ( this . memberAlignment . location . inputOffset , this . scanner . eofPosition - <NUM_LIT:1> ) ; this . memberAlignment . chunkKind = <NUM_LIT:0> ; } public void reset ( ) { this . checkLineWrapping = true ; this . line = <NUM_LIT:0> ; this . column = <NUM_LIT:1> ; this . editsIndex = <NUM_LIT:0> ; this . nlsTagCounter = <NUM_LIT:0> ; } private void resetAt ( Location location ) { this . line = location . outputLine ; this . column = location . outputColumn ; this . indentationLevel = location . outputIndentationLevel ; this . numberOfIndentations = location . numberOfIndentations ; this . lastNumberOfNewLines = location . lastNumberOfNewLines ; this . needSpace = location . needSpace ; this . pendingSpace = location . pendingSpace ; this . editsIndex = location . editsIndex ; this . nlsTagCounter = location . nlsTagCounter ; if ( this . editsIndex > <NUM_LIT:0> ) { this . edits [ this . editsIndex - <NUM_LIT:1> ] = location . textEdit ; } this . formatter . lastLocalDeclarationSourceStart = location . lastLocalDeclarationSourceStart ; } public void resetScanner ( char [ ] compilationUnitSource ) { this . scanner . setSource ( compilationUnitSource ) ; this . scannerEndPosition = compilationUnitSource . length ; this . scanner . resetTo ( <NUM_LIT:0> , this . scannerEndPosition - <NUM_LIT:1> ) ; this . edits = new OptimizedReplaceEdit [ INITIAL_SIZE ] ; this . maxLines = this . lineEnds == null ? - <NUM_LIT:1> : this . lineEnds . length - <NUM_LIT:1> ; this . scanner . lineEnds = this . lineEnds ; this . scanner . linePtr = this . maxLines ; initFormatterCommentParser ( ) ; } private void resize ( ) { System . arraycopy ( this . edits , <NUM_LIT:0> , ( this . edits = new OptimizedReplaceEdit [ this . editsIndex * <NUM_LIT:2> ] ) , <NUM_LIT:0> , this . editsIndex ) ; } private void setCommentIndentation ( int commentIndentationLevel ) { if ( commentIndentationLevel == <NUM_LIT:0> ) { this . commentIndentation = null ; } else { int length = COMMENT_INDENTATIONS . length ; if ( commentIndentationLevel > length ) { System . arraycopy ( COMMENT_INDENTATIONS , <NUM_LIT:0> , COMMENT_INDENTATIONS = new String [ commentIndentationLevel + <NUM_LIT:10> ] , <NUM_LIT:0> , length ) ; } this . commentIndentation = COMMENT_INDENTATIONS [ commentIndentationLevel - <NUM_LIT:1> ] ; if ( this . commentIndentation == null ) { this . tempBuffer . setLength ( <NUM_LIT:0> ) ; for ( int i = <NUM_LIT:0> ; i < commentIndentationLevel ; i ++ ) { this . tempBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } this . commentIndentation = this . tempBuffer . toString ( ) ; COMMENT_INDENTATIONS [ commentIndentationLevel - <NUM_LIT:1> ] = this . commentIndentation ; } } } private void setEditsEnabled ( int count ) { for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { if ( this . disablingTag != null && CharOperation . equals ( this . scanner . foundTaskTags [ i ] , this . disablingTag ) ) { this . editsEnabled = false ; } if ( this . enablingTag != null && CharOperation . equals ( this . scanner . foundTaskTags [ i ] , this . enablingTag ) ) { this . editsEnabled = true ; } } } void setIncludeComments ( boolean on ) { if ( on ) { this . formatComments |= CodeFormatter . F_INCLUDE_COMMENTS ; } else { this . formatComments &= ~ CodeFormatter . F_INCLUDE_COMMENTS ; } } void setHeaderComment ( int position ) { this . headerEndPosition = position ; } public void space ( ) { if ( ! this . needSpace ) return ; this . lastNumberOfNewLines = <NUM_LIT:0> ; this . pendingSpace = true ; this . column ++ ; this . needSpace = false ; } public String toString ( ) { StringBuffer stringBuffer = new StringBuffer ( ) ; stringBuffer . append ( "<STR_LIT>" + this . pageWidth + "<STR_LIT>" ) ; switch ( this . tabChar ) { case DefaultCodeFormatterOptions . TAB : stringBuffer . append ( "<STR_LIT>" ) ; break ; case DefaultCodeFormatterOptions . SPACE : stringBuffer . append ( "<STR_LIT>" ) ; break ; default : stringBuffer . append ( "<STR_LIT>" ) ; } stringBuffer . append ( "<STR_LIT>" + this . tabLength + "<STR_LIT:)>" ) . append ( this . lineSeparator ) . append ( "<STR_LIT>" + this . line + "<STR_LIT>" + this . column + "<STR_LIT>" + this . indentationLevel + "<STR_LIT:)>" ) . append ( this . lineSeparator ) . append ( "<STR_LIT>" + this . needSpace + "<STR_LIT>" + this . lastNumberOfNewLines + "<STR_LIT>" + this . checkLineWrapping + "<STR_LIT:)>" ) . append ( this . lineSeparator ) . append ( "<STR_LIT>" ) . append ( this . lineSeparator ) ; if ( this . tabLength > <NUM_LIT:0> ) { printRule ( stringBuffer ) ; } return stringBuffer . toString ( ) ; } public void unIndent ( ) { this . indentationLevel -= this . indentationSize ; this . numberOfIndentations -- ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; import java . util . ArrayList ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; class CascadingMethodInvocationFragmentBuilder extends ASTVisitor { ArrayList fragmentsList ; CascadingMethodInvocationFragmentBuilder ( ) { this . fragmentsList = new ArrayList ( ) ; } public MessageSend [ ] fragments ( ) { MessageSend [ ] fragments = new MessageSend [ this . fragmentsList . size ( ) ] ; this . fragmentsList . toArray ( fragments ) ; return fragments ; } public int size ( ) { return this . fragmentsList . size ( ) ; } public boolean visit ( MessageSend messageSend , BlockScope scope ) { if ( ( messageSend . receiver . bits & ASTNode . ParenthesizedMASK ) > > ASTNode . ParenthesizedSHIFT == <NUM_LIT:0> ) { if ( messageSend . receiver instanceof MessageSend ) { this . fragmentsList . add ( <NUM_LIT:0> , messageSend ) ; messageSend . receiver . traverse ( this , scope ) ; return false ; } this . fragmentsList . add ( <NUM_LIT:0> , messageSend ) ; this . fragmentsList . add ( <NUM_LIT:1> , messageSend ) ; } else { this . fragmentsList . add ( <NUM_LIT:0> , messageSend ) ; this . fragmentsList . add ( <NUM_LIT:1> , messageSend ) ; } return false ; } } </s>
<s> package org . eclipse . jdt . internal . formatter . old ; import java . util . Map ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . formatter . DefaultCodeFormatter ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; public class CodeFormatter implements TerminalTokens , org . eclipse . jdt . core . ICodeFormatter { private Map options ; public CodeFormatter ( Map options ) { if ( options == null ) { this . options = JavaCore . getOptions ( ) ; } else { this . options = options ; } } public String format ( String string , int indentLevel , int [ ] positions , String lineSeparator ) { Map newOptions = DefaultCodeFormatterConstants . getEclipse21Settings ( ) ; Object formatterNewLineOpeningBrace = this . options . get ( JavaCore . FORMATTER_NEWLINE_OPENING_BRACE ) ; if ( formatterNewLineOpeningBrace != null ) { if ( JavaCore . INSERT . equals ( formatterNewLineOpeningBrace ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION , DefaultCodeFormatterConstants . NEXT_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_BLOCK , DefaultCodeFormatterConstants . NEXT_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION , DefaultCodeFormatterConstants . NEXT_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION , DefaultCodeFormatterConstants . NEXT_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_SWITCH , DefaultCodeFormatterConstants . NEXT_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION , DefaultCodeFormatterConstants . NEXT_LINE ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION , DefaultCodeFormatterConstants . END_OF_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_BLOCK , DefaultCodeFormatterConstants . END_OF_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION , DefaultCodeFormatterConstants . END_OF_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION , DefaultCodeFormatterConstants . END_OF_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_SWITCH , DefaultCodeFormatterConstants . END_OF_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION , DefaultCodeFormatterConstants . END_OF_LINE ) ; } } Object formatterNewLineControl = this . options . get ( JavaCore . FORMATTER_NEWLINE_CONTROL ) ; if ( formatterNewLineControl != null ) { if ( JavaCore . INSERT . equals ( formatterNewLineControl ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT , JavaCore . INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT , JavaCore . INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT , JavaCore . INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT , JavaCore . INSERT ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT , JavaCore . DO_NOT_INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT , JavaCore . DO_NOT_INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT , JavaCore . DO_NOT_INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT , JavaCore . DO_NOT_INSERT ) ; } } Object formatterClearBlankLines = this . options . get ( JavaCore . FORMATTER_CLEAR_BLANK_LINES ) ; if ( formatterClearBlankLines != null ) { if ( JavaCore . PRESERVE_ONE . equals ( formatterClearBlankLines ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE , "<STR_LIT:1>" ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE , "<STR_LIT:0>" ) ; } } Object formatterNewLineElseIf = this . options . get ( JavaCore . FORMATTER_NEWLINE_ELSE_IF ) ; if ( formatterNewLineElseIf != null ) { if ( JavaCore . INSERT . equals ( formatterNewLineElseIf ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_COMPACT_ELSE_IF , DefaultCodeFormatterConstants . FALSE ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_COMPACT_ELSE_IF , DefaultCodeFormatterConstants . TRUE ) ; } } Object formatterNewLineEmptyBlock = this . options . get ( JavaCore . FORMATTER_NEWLINE_EMPTY_BLOCK ) ; if ( formatterNewLineEmptyBlock != null ) { if ( JavaCore . INSERT . equals ( formatterNewLineEmptyBlock ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK , JavaCore . INSERT ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK , JavaCore . DO_NOT_INSERT ) ; } } Object formatterCompactAssignment = this . options . get ( JavaCore . FORMATTER_COMPACT_ASSIGNMENT ) ; if ( formatterCompactAssignment != null ) { if ( JavaCore . COMPACT . equals ( formatterCompactAssignment ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR , JavaCore . DO_NOT_INSERT ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR , JavaCore . INSERT ) ; } } if ( this . options . get ( JavaCore . FORMATTER_SPACE_CASTEXPRESSION ) != null ) { if ( JavaCore . INSERT . equals ( this . options . get ( JavaCore . FORMATTER_SPACE_CASTEXPRESSION ) ) ) { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST , JavaCore . INSERT ) ; } else { newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST , JavaCore . DO_NOT_INSERT ) ; } } newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR , this . options . get ( JavaCore . FORMATTER_TAB_CHAR ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_SIZE , this . options . get ( JavaCore . FORMATTER_TAB_SIZE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_LINE_SPLIT , this . options . get ( JavaCore . FORMATTER_LINE_SPLIT ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER , DefaultCodeFormatterConstants . END_OF_LINE ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_CONTINUATION_INDENTATION , "<STR_LIT:1>" ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION , DefaultCodeFormatterConstants . createAlignmentValue ( false , DefaultCodeFormatterConstants . WRAP_ONE_PER_LINE , DefaultCodeFormatterConstants . INDENT_BY_ONE ) ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER , JavaCore . INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER , JavaCore . INSERT ) ; newOptions . put ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER , JavaCore . INSERT ) ; DefaultCodeFormatter defaultCodeFormatter = new DefaultCodeFormatter ( newOptions ) ; TextEdit textEdit = defaultCodeFormatter . format ( org . eclipse . jdt . core . formatter . CodeFormatter . K_UNKNOWN , string , <NUM_LIT:0> , string . length ( ) , indentLevel , lineSeparator ) ; if ( positions != null && textEdit != null ) { TextEdit [ ] edits = textEdit . getChildren ( ) ; int textEditSize = edits . length ; int editsIndex = <NUM_LIT:0> ; int delta = <NUM_LIT:0> ; int originalSourceLength = string . length ( ) - <NUM_LIT:1> ; if ( textEditSize != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> , max = positions . length ; i < max ; i ++ ) { int currentPosition = positions [ i ] ; if ( currentPosition > originalSourceLength ) { currentPosition = originalSourceLength ; } ReplaceEdit currentEdit = ( ReplaceEdit ) edits [ editsIndex ] ; while ( currentEdit . getOffset ( ) <= currentPosition ) { delta += currentEdit . getText ( ) . length ( ) - currentEdit . getLength ( ) ; editsIndex ++ ; if ( editsIndex < textEditSize ) { currentEdit = ( ReplaceEdit ) edits [ editsIndex ] ; } else { break ; } } positions [ i ] = currentPosition + delta ; } } } return org . eclipse . jdt . internal . core . util . Util . editedString ( string , textEdit ) ; } } </s>
<s> package org . eclipse . jdt . internal . formatter ; public class FormatJavadocReference extends FormatJavadocNode { public FormatJavadocReference ( int start , int end , int line ) { super ( start , end , line ) ; } public FormatJavadocReference ( long position , int line ) { super ( ( int ) ( position > > > <NUM_LIT:32> ) , ( int ) position , line ) ; } void clean ( ) { } protected void toString ( StringBuffer buffer ) { buffer . append ( "<STR_LIT>" ) ; super . toString ( buffer ) ; } } </s>
<s> package org . eclipse . jdt . core . formatter ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jface . text . IRegion ; import org . eclipse . text . edits . TextEdit ; public abstract class CodeFormatter { public static final int K_UNKNOWN = <NUM_LIT:0x00> ; public static final int K_EXPRESSION = <NUM_LIT> ; public static final int K_STATEMENTS = <NUM_LIT> ; public static final int K_CLASS_BODY_DECLARATIONS = <NUM_LIT> ; public static final int K_COMPILATION_UNIT = <NUM_LIT> ; public static final int K_SINGLE_LINE_COMMENT = <NUM_LIT> ; public static final int K_MULTI_LINE_COMMENT = <NUM_LIT> ; public static final int K_JAVA_DOC = <NUM_LIT> ; public static final int F_INCLUDE_COMMENTS = <NUM_LIT> ; public abstract TextEdit format ( int kind , String source , int offset , int length , int indentationLevel , String lineSeparator ) ; public abstract TextEdit format ( int kind , String source , IRegion [ ] regions , int indentationLevel , String lineSeparator ) ; public String createIndentationString ( int indentationLevel ) { return Util . EMPTY_STRING ; } } </s>
<s> package org . eclipse . jdt . core . formatter ; import java . util . Map ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . ToolFactory ; import org . eclipse . jdt . internal . formatter . DefaultCodeFormatterOptions ; import org . eclipse . jdt . internal . formatter . align . Alignment ; public class DefaultCodeFormatterConstants { public static final String END_OF_LINE = "<STR_LIT>" ; public static final String FALSE = "<STR_LIT:false>" ; public static final String FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ASSIGNMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ALIGNMENT_FOR_UNION_TYPE_IN_MULTICATCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_AFTER_IMPORTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_AFTER_PACKAGE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_FIELD = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_IMPORTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_METHOD = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BEFORE_PACKAGE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_SWITCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String FORMATTER_COMMENT_CLEAR_BLANK_LINES = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT_LINE_COMMENT = "<STR_LIT>" ; public static final String FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String FORMATTER_COMMENT_PRESERVE_WHITE_SPACE_BETWEEN_CODE_AND_LINE_COMMENT = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT_HEADER = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT_HTML = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_FORMAT_SOURCE = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_INDENT_ROOT_TAGS = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_LINE_LENGTH = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES = "<STR_LIT>" ; public final static String FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES = "<STR_LIT>" ; public static final String FORMATTER_COMPACT_ELSE_IF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_CONTINUATION_INDENTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_USE_ON_OFF_TAGS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_DISABLING_TAG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_ENABLING_TAG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_EMPTY_LINES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INDENTATION_SIZE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_LABEL = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_TRY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_WILDCARD = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_TRY_RESOURCES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_TRY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_TRY = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_TRY_RESOURCES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_LINE_SPLIT = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_JOIN_WRAPPED_LINES = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_JOIN_LINES_IN_COMMENTS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_TAB_CHAR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_TAB_SIZE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_WRAP_BEFORE_BINARY_OPERATOR = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_WRAP_BEFORE_OR_OPERATOR_MULTICATCH = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String FORMATTER_WRAP_OUTER_EXPRESSIONS_WHEN_NESTED = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final int INDENT_BY_ONE = <NUM_LIT:2> ; public static final int INDENT_DEFAULT = <NUM_LIT:0> ; public static final int INDENT_ON_COLUMN = <NUM_LIT:1> ; public static final String MIXED = "<STR_LIT>" ; public static final String NEXT_LINE = "<STR_LIT>" ; public static final String NEXT_LINE_ON_WRAP = "<STR_LIT>" ; public static final String NEXT_LINE_SHIFTED = "<STR_LIT>" ; public static final String TRUE = "<STR_LIT:true>" ; public static final int WRAP_COMPACT = <NUM_LIT:1> ; public static final int WRAP_COMPACT_FIRST_BREAK = <NUM_LIT:2> ; public static final int WRAP_NEXT_PER_LINE = <NUM_LIT:5> ; public static final int WRAP_NEXT_SHIFTED = <NUM_LIT:4> ; public static final int WRAP_NO_SPLIT = <NUM_LIT:0> ; public static final int WRAP_ONE_PER_LINE = <NUM_LIT:3> ; private static final IllegalArgumentException WRONG_ARGUMENT = new IllegalArgumentException ( ) ; public static String createAlignmentValue ( boolean forceSplit , int wrapStyle , int indentStyle ) { int alignmentValue = <NUM_LIT:0> ; switch ( wrapStyle ) { case WRAP_COMPACT : alignmentValue |= Alignment . M_COMPACT_SPLIT ; break ; case WRAP_COMPACT_FIRST_BREAK : alignmentValue |= Alignment . M_COMPACT_FIRST_BREAK_SPLIT ; break ; case WRAP_NEXT_PER_LINE : alignmentValue |= Alignment . M_NEXT_PER_LINE_SPLIT ; break ; case WRAP_NEXT_SHIFTED : alignmentValue |= Alignment . M_NEXT_SHIFTED_SPLIT ; break ; case WRAP_ONE_PER_LINE : alignmentValue |= Alignment . M_ONE_PER_LINE_SPLIT ; break ; } if ( forceSplit ) { alignmentValue |= Alignment . M_FORCE ; } switch ( indentStyle ) { case INDENT_BY_ONE : alignmentValue |= Alignment . M_INDENT_BY_ONE ; break ; case INDENT_ON_COLUMN : alignmentValue |= Alignment . M_INDENT_ON_COLUMN ; } return String . valueOf ( alignmentValue ) ; } public static Map getEclipse21Settings ( ) { return DefaultCodeFormatterOptions . getDefaultSettings ( ) . getMap ( ) ; } public static Map getEclipseDefaultSettings ( ) { return DefaultCodeFormatterOptions . getEclipseDefaultSettings ( ) . getMap ( ) ; } public static boolean getForceWrapping ( String value ) { if ( value == null ) { throw WRONG_ARGUMENT ; } try { int existingValue = Integer . parseInt ( value ) ; return ( existingValue & Alignment . M_FORCE ) != <NUM_LIT:0> ; } catch ( NumberFormatException e ) { throw WRONG_ARGUMENT ; } } public static int getIndentStyle ( String value ) { if ( value == null ) { throw WRONG_ARGUMENT ; } try { int existingValue = Integer . parseInt ( value ) ; if ( ( existingValue & Alignment . M_INDENT_BY_ONE ) != <NUM_LIT:0> ) { return INDENT_BY_ONE ; } else if ( ( existingValue & Alignment . M_INDENT_ON_COLUMN ) != <NUM_LIT:0> ) { return INDENT_ON_COLUMN ; } else { return INDENT_DEFAULT ; } } catch ( NumberFormatException e ) { throw WRONG_ARGUMENT ; } } public static Map getJavaConventionsSettings ( ) { return DefaultCodeFormatterOptions . getJavaConventionsSettings ( ) . getMap ( ) ; } public static int getWrappingStyle ( String value ) { if ( value == null ) { throw WRONG_ARGUMENT ; } try { int existingValue = Integer . parseInt ( value ) & Alignment . SPLIT_MASK ; switch ( existingValue ) { case Alignment . M_COMPACT_SPLIT : return WRAP_COMPACT ; case Alignment . M_COMPACT_FIRST_BREAK_SPLIT : return WRAP_COMPACT_FIRST_BREAK ; case Alignment . M_NEXT_PER_LINE_SPLIT : return WRAP_NEXT_PER_LINE ; case Alignment . M_NEXT_SHIFTED_SPLIT : return WRAP_NEXT_SHIFTED ; case Alignment . M_ONE_PER_LINE_SPLIT : return WRAP_ONE_PER_LINE ; default : return WRAP_NO_SPLIT ; } } catch ( NumberFormatException e ) { throw WRONG_ARGUMENT ; } } public static String setForceWrapping ( String value , boolean force ) { if ( value == null ) { throw WRONG_ARGUMENT ; } try { int existingValue = Integer . parseInt ( value ) ; existingValue &= ~ Alignment . M_FORCE ; if ( force ) { existingValue |= Alignment . M_FORCE ; } return String . valueOf ( existingValue ) ; } catch ( NumberFormatException e ) { throw WRONG_ARGUMENT ; } } public static String setIndentStyle ( String value , int indentStyle ) { if ( value == null ) { throw WRONG_ARGUMENT ; } switch ( indentStyle ) { case INDENT_BY_ONE : case INDENT_DEFAULT : case INDENT_ON_COLUMN : break ; default : throw WRONG_ARGUMENT ; } try { int existingValue = Integer . parseInt ( value ) ; existingValue &= ~ ( Alignment . M_INDENT_BY_ONE | Alignment . M_INDENT_ON_COLUMN ) ; switch ( indentStyle ) { case INDENT_BY_ONE : existingValue |= Alignment . M_INDENT_BY_ONE ; break ; case INDENT_ON_COLUMN : existingValue |= Alignment . M_INDENT_ON_COLUMN ; } return String . valueOf ( existingValue ) ; } catch ( NumberFormatException e ) { throw WRONG_ARGUMENT ; } } public static String setWrappingStyle ( String value , int wrappingStyle ) { if ( value == null ) { throw WRONG_ARGUMENT ; } switch ( wrappingStyle ) { case WRAP_COMPACT : case WRAP_COMPACT_FIRST_BREAK : case WRAP_NEXT_PER_LINE : case WRAP_NEXT_SHIFTED : case WRAP_NO_SPLIT : case WRAP_ONE_PER_LINE : break ; default : throw WRONG_ARGUMENT ; } try { int existingValue = Integer . parseInt ( value ) ; existingValue &= ~ ( Alignment . SPLIT_MASK ) ; switch ( wrappingStyle ) { case WRAP_COMPACT : existingValue |= Alignment . M_COMPACT_SPLIT ; break ; case WRAP_COMPACT_FIRST_BREAK : existingValue |= Alignment . M_COMPACT_FIRST_BREAK_SPLIT ; break ; case WRAP_NEXT_PER_LINE : existingValue |= Alignment . M_NEXT_PER_LINE_SPLIT ; break ; case WRAP_NEXT_SHIFTED : existingValue |= Alignment . M_NEXT_SHIFTED_SPLIT ; break ; case WRAP_ONE_PER_LINE : existingValue |= Alignment . M_ONE_PER_LINE_SPLIT ; break ; } return String . valueOf ( existingValue ) ; } catch ( NumberFormatException e ) { throw WRONG_ARGUMENT ; } } } </s>
<s> package org . eclipse . jdt . core . formatter ; import java . io . BufferedInputStream ; import java . io . BufferedWriter ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Map ; import java . util . Properties ; import org . eclipse . equinox . app . IApplication ; import org . eclipse . equinox . app . IApplicationContext ; import org . eclipse . jdt . core . ToolFactory ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . osgi . util . NLS ; import org . eclipse . text . edits . TextEdit ; public class CodeFormatterApplication implements IApplication { private final static class Messages extends NLS { private static final String BUNDLE_NAME = "<STR_LIT>" ; public static String CommandLineConfigFile ; public static String CommandLineDone ; public static String CommandLineErrorConfig ; public static String CommandLineErrorFileTryFullPath ; public static String CommandLineErrorFile ; public static String CommandLineErrorFileDir ; public static String CommandLineErrorQuietVerbose ; public static String CommandLineErrorNoConfigFile ; public static String CommandLineFormatting ; public static String CommandLineStart ; public static String CommandLineUsage ; public static String ConfigFileNotFoundErrorTryFullPath ; public static String ConfigFileReadingError ; public static String FormatProblem ; public static String CaughtException ; public static String ExceptionSkip ; static { NLS . initializeMessages ( BUNDLE_NAME , Messages . class ) ; } public static String bind ( String message ) { return bind ( message , null ) ; } public static String bind ( String message , Object binding ) { return bind ( message , new Object [ ] { binding } ) ; } public static String bind ( String message , Object binding1 , Object binding2 ) { return bind ( message , new Object [ ] { binding1 , binding2 } ) ; } public static String bind ( String message , Object [ ] bindings ) { return MessageFormat . format ( message , bindings ) ; } } private static final String ARG_CONFIG = "<STR_LIT>" ; private static final String ARG_HELP = "<STR_LIT>" ; private static final String ARG_QUIET = "<STR_LIT>" ; private static final String ARG_VERBOSE = "<STR_LIT>" ; private String configName ; private Map options = null ; private static final String PDE_LAUNCH = "<STR_LIT>" ; private boolean quiet = false ; private boolean verbose = false ; private void displayHelp ( ) { System . out . println ( Messages . bind ( Messages . CommandLineUsage ) ) ; } private void displayHelp ( String message ) { System . err . println ( message ) ; System . out . println ( ) ; displayHelp ( ) ; } private void formatDirTree ( File dir , CodeFormatter codeFormatter ) { File [ ] files = dir . listFiles ( ) ; if ( files == null ) return ; for ( int i = <NUM_LIT:0> ; i < files . length ; i ++ ) { File file = files [ i ] ; if ( file . isDirectory ( ) ) { formatDirTree ( file , codeFormatter ) ; } else if ( Util . isJavaLikeFileName ( file . getPath ( ) ) ) { formatFile ( file , codeFormatter ) ; } } } private void formatFile ( File file , CodeFormatter codeFormatter ) { IDocument doc = new Document ( ) ; try { if ( this . verbose ) { System . out . println ( Messages . bind ( Messages . CommandLineFormatting , file . getAbsolutePath ( ) ) ) ; } String contents = new String ( org . eclipse . jdt . internal . compiler . util . Util . getFileCharContent ( file , null ) ) ; doc . set ( contents ) ; TextEdit edit = codeFormatter . format ( CodeFormatter . K_COMPILATION_UNIT | CodeFormatter . F_INCLUDE_COMMENTS , contents , <NUM_LIT:0> , contents . length ( ) , <NUM_LIT:0> , null ) ; if ( edit != null ) { edit . apply ( doc ) ; } else { System . err . println ( Messages . bind ( Messages . FormatProblem , file . getAbsolutePath ( ) ) ) ; return ; } final BufferedWriter out = new BufferedWriter ( new FileWriter ( file ) ) ; try { out . write ( doc . get ( ) ) ; out . flush ( ) ; } finally { try { out . close ( ) ; } catch ( IOException e ) { } } } catch ( IOException e ) { String errorMessage = Messages . bind ( Messages . CaughtException , "<STR_LIT>" , e . getLocalizedMessage ( ) ) ; Util . log ( e , errorMessage ) ; System . err . println ( Messages . bind ( Messages . ExceptionSkip , errorMessage ) ) ; } catch ( BadLocationException e ) { String errorMessage = Messages . bind ( Messages . CaughtException , "<STR_LIT>" , e . getLocalizedMessage ( ) ) ; Util . log ( e , errorMessage ) ; System . err . println ( Messages . bind ( Messages . ExceptionSkip , errorMessage ) ) ; } } private File [ ] processCommandLine ( String [ ] argsArray ) { ArrayList args = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> , max = argsArray . length ; i < max ; i ++ ) { args . add ( argsArray [ i ] ) ; } int index = <NUM_LIT:0> ; final int argCount = argsArray . length ; final int DEFAULT_MODE = <NUM_LIT:0> ; final int CONFIG_MODE = <NUM_LIT:1> ; int mode = DEFAULT_MODE ; final int INITIAL_SIZE = <NUM_LIT:1> ; int fileCounter = <NUM_LIT:0> ; File [ ] filesToFormat = new File [ INITIAL_SIZE ] ; loop : while ( index < argCount ) { String currentArg = argsArray [ index ++ ] ; switch ( mode ) { case DEFAULT_MODE : if ( PDE_LAUNCH . equals ( currentArg ) ) { continue loop ; } if ( ARG_HELP . equals ( currentArg ) ) { displayHelp ( ) ; return null ; } if ( ARG_VERBOSE . equals ( currentArg ) ) { this . verbose = true ; continue loop ; } if ( ARG_QUIET . equals ( currentArg ) ) { this . quiet = true ; continue loop ; } if ( ARG_CONFIG . equals ( currentArg ) ) { mode = CONFIG_MODE ; continue loop ; } File file = new File ( currentArg ) ; if ( file . exists ( ) ) { if ( filesToFormat . length == fileCounter ) { System . arraycopy ( filesToFormat , <NUM_LIT:0> , ( filesToFormat = new File [ fileCounter * <NUM_LIT:2> ] ) , <NUM_LIT:0> , fileCounter ) ; } filesToFormat [ fileCounter ++ ] = file ; } else { String canonicalPath ; try { canonicalPath = file . getCanonicalPath ( ) ; } catch ( IOException e2 ) { canonicalPath = file . getAbsolutePath ( ) ; } String errorMsg = file . isAbsolute ( ) ? Messages . bind ( Messages . CommandLineErrorFile , canonicalPath ) : Messages . bind ( Messages . CommandLineErrorFileTryFullPath , canonicalPath ) ; displayHelp ( errorMsg ) ; return null ; } break ; case CONFIG_MODE : this . configName = currentArg ; this . options = readConfig ( currentArg ) ; if ( this . options == null ) { displayHelp ( Messages . bind ( Messages . CommandLineErrorConfig , currentArg ) ) ; return null ; } mode = DEFAULT_MODE ; continue loop ; } } if ( mode == CONFIG_MODE || this . options == null ) { displayHelp ( Messages . bind ( Messages . CommandLineErrorNoConfigFile ) ) ; return null ; } if ( this . quiet && this . verbose ) { displayHelp ( Messages . bind ( Messages . CommandLineErrorQuietVerbose , new String [ ] { ARG_QUIET , ARG_VERBOSE } ) ) ; return null ; } if ( fileCounter == <NUM_LIT:0> ) { displayHelp ( Messages . bind ( Messages . CommandLineErrorFileDir ) ) ; return null ; } if ( filesToFormat . length != fileCounter ) { System . arraycopy ( filesToFormat , <NUM_LIT:0> , ( filesToFormat = new File [ fileCounter ] ) , <NUM_LIT:0> , fileCounter ) ; } return filesToFormat ; } private Properties readConfig ( String filename ) { BufferedInputStream stream = null ; File configFile = new File ( filename ) ; try { stream = new BufferedInputStream ( new FileInputStream ( configFile ) ) ; final Properties formatterOptions = new Properties ( ) ; formatterOptions . load ( stream ) ; return formatterOptions ; } catch ( IOException e ) { String canonicalPath = null ; try { canonicalPath = configFile . getCanonicalPath ( ) ; } catch ( IOException e2 ) { canonicalPath = configFile . getAbsolutePath ( ) ; } String errorMessage ; if ( ! configFile . exists ( ) && ! configFile . isAbsolute ( ) ) { errorMessage = Messages . bind ( Messages . ConfigFileNotFoundErrorTryFullPath , new Object [ ] { canonicalPath , System . getProperty ( "<STR_LIT>" ) } ) ; } else { errorMessage = Messages . bind ( Messages . ConfigFileReadingError , canonicalPath ) ; } Util . log ( e , errorMessage ) ; System . err . println ( errorMessage ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { } } } return null ; } public Object start ( IApplicationContext context ) throws Exception { File [ ] filesToFormat = processCommandLine ( ( String [ ] ) context . getArguments ( ) . get ( IApplicationContext . APPLICATION_ARGS ) ) ; if ( filesToFormat == null ) { return IApplication . EXIT_OK ; } if ( ! this . quiet ) { if ( this . configName != null ) { System . out . println ( Messages . bind ( Messages . CommandLineConfigFile , this . configName ) ) ; } System . out . println ( Messages . bind ( Messages . CommandLineStart ) ) ; } final CodeFormatter codeFormatter = ToolFactory . createCodeFormatter ( this . options ) ; for ( int i = <NUM_LIT:0> , max = filesToFormat . length ; i < max ; i ++ ) { final File file = filesToFormat [ i ] ; if ( file . isDirectory ( ) ) { formatDirTree ( file , codeFormatter ) ; } else if ( Util . isJavaLikeFileName ( file . getPath ( ) ) ) { formatFile ( file , codeFormatter ) ; } } if ( ! this . quiet ) { System . out . println ( Messages . bind ( Messages . CommandLineDone ) ) ; } return IApplication . EXIT_OK ; } public void stop ( ) { } } </s>
<s> package org . eclipse . jdt . core . formatter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Map ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . DefaultLineTracker ; import org . eclipse . jface . text . ILineTracker ; import org . eclipse . jface . text . IRegion ; import org . eclipse . text . edits . ReplaceEdit ; public final class IndentManipulation { private IndentManipulation ( ) { } public static boolean isIndentChar ( char ch ) { return ScannerHelper . isWhitespace ( ch ) && ! isLineDelimiterChar ( ch ) ; } public static boolean isLineDelimiterChar ( char ch ) { return ch == '<STR_LIT:\n>' || ch == '<STR_LIT>' ; } public static int measureIndentUnits ( CharSequence line , int tabWidth , int indentWidth ) { if ( indentWidth < <NUM_LIT:0> || tabWidth < <NUM_LIT:0> || line == null ) { throw new IllegalArgumentException ( ) ; } if ( indentWidth == <NUM_LIT:0> ) return <NUM_LIT:0> ; int visualLength = measureIndentInSpaces ( line , tabWidth ) ; return visualLength / indentWidth ; } public static int measureIndentInSpaces ( CharSequence line , int tabWidth ) { if ( tabWidth < <NUM_LIT:0> || line == null ) { throw new IllegalArgumentException ( ) ; } int length = <NUM_LIT:0> ; int max = line . length ( ) ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { char ch = line . charAt ( i ) ; if ( ch == '<STR_LIT:\t>' ) { length = calculateSpaceEquivalents ( tabWidth , length ) ; } else if ( isIndentChar ( ch ) ) { length ++ ; } else { return length ; } } return length ; } public static String extractIndentString ( String line , int tabWidth , int indentWidth ) { if ( tabWidth < <NUM_LIT:0> || indentWidth < <NUM_LIT:0> || line == null ) { throw new IllegalArgumentException ( ) ; } int size = line . length ( ) ; int end = <NUM_LIT:0> ; int spaceEquivs = <NUM_LIT:0> ; int characters = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { char c = line . charAt ( i ) ; if ( c == '<STR_LIT:\t>' ) { spaceEquivs = calculateSpaceEquivalents ( tabWidth , spaceEquivs ) ; characters ++ ; } else if ( isIndentChar ( c ) ) { spaceEquivs ++ ; characters ++ ; } else { break ; } if ( spaceEquivs >= indentWidth ) { end += characters ; characters = <NUM_LIT:0> ; if ( indentWidth == <NUM_LIT:0> ) { spaceEquivs = <NUM_LIT:0> ; } else { spaceEquivs = spaceEquivs % indentWidth ; } } } if ( end == <NUM_LIT:0> ) { return Util . EMPTY_STRING ; } else if ( end == size ) { return line ; } else { return line . substring ( <NUM_LIT:0> , end ) ; } } public static String trimIndent ( String line , int indentUnitsToRemove , int tabWidth , int indentWidth ) { if ( tabWidth < <NUM_LIT:0> || indentWidth < <NUM_LIT:0> || line == null ) { throw new IllegalArgumentException ( ) ; } if ( indentUnitsToRemove <= <NUM_LIT:0> || indentWidth == <NUM_LIT:0> ) { return line ; } final int spaceEquivalentsToRemove = indentUnitsToRemove * indentWidth ; int start = <NUM_LIT:0> ; int spaceEquivalents = <NUM_LIT:0> ; int size = line . length ( ) ; String prefix = null ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { char c = line . charAt ( i ) ; if ( c == '<STR_LIT:\t>' ) { spaceEquivalents = calculateSpaceEquivalents ( tabWidth , spaceEquivalents ) ; } else if ( isIndentChar ( c ) ) { spaceEquivalents ++ ; } else { start = i ; break ; } if ( spaceEquivalents == spaceEquivalentsToRemove ) { start = i + <NUM_LIT:1> ; break ; } if ( spaceEquivalents > spaceEquivalentsToRemove ) { start = i + <NUM_LIT:1> ; char [ ] missing = new char [ spaceEquivalents - spaceEquivalentsToRemove ] ; Arrays . fill ( missing , '<CHAR_LIT:U+0020>' ) ; prefix = new String ( missing ) ; break ; } } String trimmed ; if ( start == size ) trimmed = Util . EMPTY_STRING ; else trimmed = line . substring ( start ) ; if ( prefix == null ) return trimmed ; return prefix + trimmed ; } public static String changeIndent ( String code , int indentUnitsToRemove , int tabWidth , int indentWidth , String newIndentString , String lineDelim ) { if ( tabWidth < <NUM_LIT:0> || indentWidth < <NUM_LIT:0> || code == null || indentUnitsToRemove < <NUM_LIT:0> || newIndentString == null || lineDelim == null ) { throw new IllegalArgumentException ( ) ; } try { ILineTracker tracker = new DefaultLineTracker ( ) ; tracker . set ( code ) ; int nLines = tracker . getNumberOfLines ( ) ; if ( nLines == <NUM_LIT:1> ) { return code ; } StringBuffer buf = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < nLines ; i ++ ) { IRegion region = tracker . getLineInformation ( i ) ; int start = region . getOffset ( ) ; int end = start + region . getLength ( ) ; String line = code . substring ( start , end ) ; if ( i == <NUM_LIT:0> ) { buf . append ( line ) ; } else { buf . append ( lineDelim ) ; buf . append ( newIndentString ) ; if ( indentWidth != <NUM_LIT:0> ) { buf . append ( trimIndent ( line , indentUnitsToRemove , tabWidth , indentWidth ) ) ; } else { buf . append ( line ) ; } } } return buf . toString ( ) ; } catch ( BadLocationException e ) { return code ; } } public static ReplaceEdit [ ] getChangeIndentEdits ( String source , int indentUnitsToRemove , int tabWidth , int indentWidth , String newIndentString ) { if ( tabWidth < <NUM_LIT:0> || indentWidth < <NUM_LIT:0> || source == null || indentUnitsToRemove < <NUM_LIT:0> || newIndentString == null ) { throw new IllegalArgumentException ( ) ; } ArrayList result = new ArrayList ( ) ; try { ILineTracker tracker = new DefaultLineTracker ( ) ; tracker . set ( source ) ; int nLines = tracker . getNumberOfLines ( ) ; if ( nLines == <NUM_LIT:1> ) return ( ReplaceEdit [ ] ) result . toArray ( new ReplaceEdit [ result . size ( ) ] ) ; for ( int i = <NUM_LIT:1> ; i < nLines ; i ++ ) { IRegion region = tracker . getLineInformation ( i ) ; int offset = region . getOffset ( ) ; String line = source . substring ( offset , offset + region . getLength ( ) ) ; int length = indexOfIndent ( line , indentUnitsToRemove , tabWidth , indentWidth ) ; if ( length >= <NUM_LIT:0> ) { result . add ( new ReplaceEdit ( offset , length , newIndentString ) ) ; } else { length = measureIndentUnits ( line , tabWidth , indentWidth ) ; result . add ( new ReplaceEdit ( offset , length , "<STR_LIT>" ) ) ; } } } catch ( BadLocationException cannotHappen ) { } return ( ReplaceEdit [ ] ) result . toArray ( new ReplaceEdit [ result . size ( ) ] ) ; } private static int indexOfIndent ( CharSequence line , int numberOfIndentUnits , int tabWidth , int indentWidth ) { int spaceEquivalents = numberOfIndentUnits * indentWidth ; int size = line . length ( ) ; int result = - <NUM_LIT:1> ; int blanks = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < size && blanks < spaceEquivalents ; i ++ ) { char c = line . charAt ( i ) ; if ( c == '<STR_LIT:\t>' ) { blanks = calculateSpaceEquivalents ( tabWidth , blanks ) ; } else if ( isIndentChar ( c ) ) { blanks ++ ; } else { break ; } result = i ; } if ( blanks < spaceEquivalents ) return - <NUM_LIT:1> ; return result + <NUM_LIT:1> ; } private static int calculateSpaceEquivalents ( int tabWidth , int spaceEquivalents ) { if ( tabWidth == <NUM_LIT:0> ) { return spaceEquivalents ; } int remainder = spaceEquivalents % tabWidth ; spaceEquivalents += tabWidth - remainder ; return spaceEquivalents ; } public static int getTabWidth ( Map options ) { if ( options == null ) { throw new IllegalArgumentException ( ) ; } return getIntValue ( options , DefaultCodeFormatterConstants . FORMATTER_TAB_SIZE , <NUM_LIT:4> ) ; } public static int getIndentWidth ( Map options ) { if ( options == null ) { throw new IllegalArgumentException ( ) ; } int tabWidth = getTabWidth ( options ) ; boolean isMixedMode = DefaultCodeFormatterConstants . MIXED . equals ( options . get ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR ) ) ; if ( isMixedMode ) { return getIntValue ( options , DefaultCodeFormatterConstants . FORMATTER_INDENTATION_SIZE , tabWidth ) ; } return tabWidth ; } private static int getIntValue ( Map options , String key , int def ) { try { return Integer . parseInt ( ( String ) options . get ( key ) ) ; } catch ( NumberFormatException e ) { return def ; } } } </s>
<s> package org . eclipse . jdt . core . compiler . batch ; import java . io . PrintWriter ; import org . eclipse . jdt . core . compiler . CompilationProgress ; import org . eclipse . jdt . internal . compiler . batch . Main ; public final class BatchCompiler { public static boolean compile ( String commandLine , PrintWriter outWriter , PrintWriter errWriter , CompilationProgress progress ) { return compile ( Main . tokenize ( commandLine ) , outWriter , errWriter , progress ) ; } public static boolean compile ( String [ ] commandLineArguments , PrintWriter outWriter , PrintWriter errWriter , CompilationProgress progress ) { return Main . compile ( commandLineArguments , outWriter , errWriter , progress ) ; } private BatchCompiler ( ) { } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; public abstract class ClasspathLocation implements FileSystem . Classpath , SuffixConstants { public static final int SOURCE = <NUM_LIT:1> ; public static final int BINARY = <NUM_LIT:2> ; String path ; char [ ] normalizedPath ; public AccessRuleSet accessRuleSet ; public String destinationPath ; protected ClasspathLocation ( AccessRuleSet accessRuleSet , String destinationPath ) { this . accessRuleSet = accessRuleSet ; this . destinationPath = destinationPath ; } protected AccessRestriction fetchAccessRestriction ( String qualifiedBinaryFileName ) { if ( this . accessRuleSet == null ) return null ; char [ ] qualifiedTypeName = qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedBinaryFileName . length ( ) - SUFFIX_CLASS . length ) . toCharArray ( ) ; if ( File . separatorChar == '<STR_LIT:\\>' ) { CharOperation . replace ( qualifiedTypeName , File . separatorChar , '<CHAR_LIT:/>' ) ; } return this . accessRuleSet . getViolatedRestriction ( qualifiedTypeName ) ; } public int getMode ( ) { return SOURCE | BINARY ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + this . getMode ( ) ; result = prime * result + ( ( this . path == null ) ? <NUM_LIT:0> : this . path . hashCode ( ) ) ; return result ; } public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; ClasspathLocation other = ( ClasspathLocation ) obj ; String localPath = this . getPath ( ) ; String otherPath = other . getPath ( ) ; if ( localPath == null ) { if ( otherPath != null ) return false ; } else if ( ! localPath . equals ( otherPath ) ) return false ; if ( this . getMode ( ) != other . getMode ( ) ) return false ; return true ; } public String getPath ( ) { return this . path ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import java . io . IOException ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; public class FileSystem implements INameEnvironment , SuffixConstants { public interface Classpath { char [ ] [ ] [ ] findTypeNames ( String qualifiedPackageName ) ; NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName ) ; NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName , boolean asBinaryOnly ) ; boolean isPackage ( String qualifiedPackageName ) ; List fetchLinkedJars ( ClasspathSectionProblemReporter problemReporter ) ; void reset ( ) ; char [ ] normalizedPath ( ) ; String getPath ( ) ; void initialize ( ) throws IOException ; } public interface ClasspathSectionProblemReporter { void invalidClasspathSection ( String jarFilePath ) ; void multipleClasspathSections ( String jarFilePath ) ; } public static class ClasspathNormalizer { public static ArrayList normalize ( ArrayList classpaths ) { ArrayList normalizedClasspath = new ArrayList ( ) ; HashSet cache = new HashSet ( ) ; for ( Iterator iterator = classpaths . iterator ( ) ; iterator . hasNext ( ) ; ) { FileSystem . Classpath classpath = ( FileSystem . Classpath ) iterator . next ( ) ; if ( ! cache . contains ( classpath ) ) { normalizedClasspath . add ( classpath ) ; cache . add ( classpath ) ; } } return normalizedClasspath ; } } protected Classpath [ ] classpaths ; Set knownFileNames ; public FileSystem ( String [ ] classpathNames , String [ ] initialFileNames , String encoding ) { final int classpathSize = classpathNames . length ; this . classpaths = new Classpath [ classpathSize ] ; int counter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < classpathSize ; i ++ ) { Classpath classpath = getClasspath ( classpathNames [ i ] , encoding , null ) ; try { classpath . initialize ( ) ; this . classpaths [ counter ++ ] = classpath ; } catch ( IOException e ) { } } if ( counter != classpathSize ) { System . arraycopy ( this . classpaths , <NUM_LIT:0> , ( this . classpaths = new Classpath [ counter ] ) , <NUM_LIT:0> , counter ) ; } initializeKnownFileNames ( initialFileNames ) ; } protected FileSystem ( Classpath [ ] paths , String [ ] initialFileNames ) { final int length = paths . length ; int counter = <NUM_LIT:0> ; this . classpaths = new FileSystem . Classpath [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { final Classpath classpath = paths [ i ] ; try { classpath . initialize ( ) ; this . classpaths [ counter ++ ] = classpath ; } catch ( IOException exception ) { } } if ( counter != length ) { System . arraycopy ( this . classpaths , <NUM_LIT:0> , ( this . classpaths = new FileSystem . Classpath [ counter ] ) , <NUM_LIT:0> , counter ) ; } initializeKnownFileNames ( initialFileNames ) ; } public static Classpath getClasspath ( String classpathName , String encoding , AccessRuleSet accessRuleSet ) { return getClasspath ( classpathName , encoding , false , accessRuleSet , null ) ; } public static Classpath getClasspath ( String classpathName , String encoding , boolean isSourceOnly , AccessRuleSet accessRuleSet , String destinationPath ) { Classpath result = null ; File file = new File ( convertPathSeparators ( classpathName ) ) ; if ( file . isDirectory ( ) ) { if ( file . exists ( ) ) { result = new ClasspathDirectory ( file , encoding , isSourceOnly ? ClasspathLocation . SOURCE : ClasspathLocation . SOURCE | ClasspathLocation . BINARY , accessRuleSet , destinationPath == null || destinationPath == Main . NONE ? destinationPath : convertPathSeparators ( destinationPath ) ) ; } } else { if ( Util . isPotentialZipArchive ( classpathName ) ) { if ( isSourceOnly ) { result = new ClasspathSourceJar ( file , true , accessRuleSet , encoding , destinationPath == null || destinationPath == Main . NONE ? destinationPath : convertPathSeparators ( destinationPath ) ) ; } else if ( destinationPath == null ) { result = new ClasspathJar ( file , true , accessRuleSet , null ) ; } } } return result ; } private void initializeKnownFileNames ( String [ ] initialFileNames ) { if ( initialFileNames == null ) { this . knownFileNames = new HashSet ( <NUM_LIT:0> ) ; return ; } this . knownFileNames = new HashSet ( initialFileNames . length * <NUM_LIT:2> ) ; for ( int i = initialFileNames . length ; -- i >= <NUM_LIT:0> ; ) { File compilationUnitFile = new File ( initialFileNames [ i ] ) ; char [ ] fileName = null ; try { fileName = compilationUnitFile . getCanonicalPath ( ) . toCharArray ( ) ; } catch ( IOException e ) { continue ; } char [ ] matchingPathName = null ; final int lastIndexOf = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , fileName ) ; if ( lastIndexOf != - <NUM_LIT:1> ) { fileName = CharOperation . subarray ( fileName , <NUM_LIT:0> , lastIndexOf ) ; } CharOperation . replace ( fileName , '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) ; boolean globalPathMatches = false ; for ( int j = <NUM_LIT:0> , max = this . classpaths . length ; j < max ; j ++ ) { char [ ] matchCandidate = this . classpaths [ j ] . normalizedPath ( ) ; boolean currentPathMatch = false ; if ( this . classpaths [ j ] instanceof ClasspathDirectory && CharOperation . prefixEquals ( matchCandidate , fileName ) ) { currentPathMatch = true ; if ( matchingPathName == null ) { matchingPathName = matchCandidate ; } else { if ( currentPathMatch ) { if ( matchCandidate . length > matchingPathName . length ) { matchingPathName = matchCandidate ; } } else { if ( ! globalPathMatches && matchCandidate . length < matchingPathName . length ) { matchingPathName = matchCandidate ; } } } if ( currentPathMatch ) { globalPathMatches = true ; } } } if ( matchingPathName == null ) { this . knownFileNames . add ( new String ( fileName ) ) ; } else { this . knownFileNames . add ( new String ( CharOperation . subarray ( fileName , matchingPathName . length , fileName . length ) ) ) ; } matchingPathName = null ; } } public void cleanup ( ) { for ( int i = <NUM_LIT:0> , max = this . classpaths . length ; i < max ; i ++ ) this . classpaths [ i ] . reset ( ) ; } private static String convertPathSeparators ( String path ) { return File . separatorChar == '<CHAR_LIT:/>' ? path . replace ( '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) : path . replace ( '<CHAR_LIT:/>' , '<STR_LIT:\\>' ) ; } private NameEnvironmentAnswer findClass ( String qualifiedTypeName , char [ ] typeName , boolean asBinaryOnly ) { if ( this . knownFileNames . contains ( qualifiedTypeName ) ) return null ; String qualifiedBinaryFileName = qualifiedTypeName + SUFFIX_STRING_class ; String qualifiedPackageName = qualifiedTypeName . length ( ) == typeName . length ? Util . EMPTY_STRING : qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedTypeName . length ( ) - typeName . length - <NUM_LIT:1> ) ; String qp2 = File . separatorChar == '<CHAR_LIT:/>' ? qualifiedPackageName : qualifiedPackageName . replace ( '<CHAR_LIT:/>' , File . separatorChar ) ; NameEnvironmentAnswer suggestedAnswer = null ; if ( qualifiedPackageName == qp2 ) { for ( int i = <NUM_LIT:0> , length = this . classpaths . length ; i < length ; i ++ ) { NameEnvironmentAnswer answer = this . classpaths [ i ] . findClass ( typeName , qualifiedPackageName , qualifiedBinaryFileName , asBinaryOnly ) ; if ( answer != null ) { if ( ! answer . ignoreIfBetter ( ) ) { if ( answer . isBetter ( suggestedAnswer ) ) return answer ; } else if ( answer . isBetter ( suggestedAnswer ) ) suggestedAnswer = answer ; } } } else { String qb2 = qualifiedBinaryFileName . replace ( '<CHAR_LIT:/>' , File . separatorChar ) ; for ( int i = <NUM_LIT:0> , length = this . classpaths . length ; i < length ; i ++ ) { Classpath p = this . classpaths [ i ] ; NameEnvironmentAnswer answer = ( p instanceof ClasspathJar ) ? p . findClass ( typeName , qualifiedPackageName , qualifiedBinaryFileName , asBinaryOnly ) : p . findClass ( typeName , qp2 , qb2 , asBinaryOnly ) ; if ( answer != null ) { if ( ! answer . ignoreIfBetter ( ) ) { if ( answer . isBetter ( suggestedAnswer ) ) return answer ; } else if ( answer . isBetter ( suggestedAnswer ) ) suggestedAnswer = answer ; } } } if ( suggestedAnswer != null ) return suggestedAnswer ; return null ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundName ) { if ( compoundName != null ) return findClass ( new String ( CharOperation . concatWith ( compoundName , '<CHAR_LIT:/>' ) ) , compoundName [ compoundName . length - <NUM_LIT:1> ] , false ) ; return null ; } public char [ ] [ ] [ ] findTypeNames ( char [ ] [ ] packageName ) { char [ ] [ ] [ ] result = null ; if ( packageName != null ) { String qualifiedPackageName = new String ( CharOperation . concatWith ( packageName , '<CHAR_LIT:/>' ) ) ; String qualifiedPackageName2 = File . separatorChar == '<CHAR_LIT:/>' ? qualifiedPackageName : qualifiedPackageName . replace ( '<CHAR_LIT:/>' , File . separatorChar ) ; if ( qualifiedPackageName == qualifiedPackageName2 ) { for ( int i = <NUM_LIT:0> , length = this . classpaths . length ; i < length ; i ++ ) { char [ ] [ ] [ ] answers = this . classpaths [ i ] . findTypeNames ( qualifiedPackageName ) ; if ( answers != null ) { if ( result == null ) { result = answers ; } else { int resultLength = result . length ; int answersLength = answers . length ; System . arraycopy ( result , <NUM_LIT:0> , ( result = new char [ answersLength + resultLength ] [ ] [ ] ) , <NUM_LIT:0> , resultLength ) ; System . arraycopy ( answers , <NUM_LIT:0> , result , resultLength , answersLength ) ; } } } } else { for ( int i = <NUM_LIT:0> , length = this . classpaths . length ; i < length ; i ++ ) { Classpath p = this . classpaths [ i ] ; char [ ] [ ] [ ] answers = ( p instanceof ClasspathJar ) ? p . findTypeNames ( qualifiedPackageName ) : p . findTypeNames ( qualifiedPackageName2 ) ; if ( answers != null ) { if ( result == null ) { result = answers ; } else { int resultLength = result . length ; int answersLength = answers . length ; System . arraycopy ( result , <NUM_LIT:0> , ( result = new char [ answersLength + resultLength ] [ ] [ ] ) , <NUM_LIT:0> , resultLength ) ; System . arraycopy ( answers , <NUM_LIT:0> , result , resultLength , answersLength ) ; } } } } } return result ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundName , boolean asBinaryOnly ) { if ( compoundName != null ) return findClass ( new String ( CharOperation . concatWith ( compoundName , '<CHAR_LIT:/>' ) ) , compoundName [ compoundName . length - <NUM_LIT:1> ] , asBinaryOnly ) ; return null ; } public NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) { if ( typeName != null ) return findClass ( new String ( CharOperation . concatWith ( packageName , typeName , '<CHAR_LIT:/>' ) ) , typeName , false ) ; return null ; } public boolean isPackage ( char [ ] [ ] compoundName , char [ ] packageName ) { String qualifiedPackageName = new String ( CharOperation . concatWith ( compoundName , packageName , '<CHAR_LIT:/>' ) ) ; String qp2 = File . separatorChar == '<CHAR_LIT:/>' ? qualifiedPackageName : qualifiedPackageName . replace ( '<CHAR_LIT:/>' , File . separatorChar ) ; if ( qualifiedPackageName == qp2 ) { for ( int i = <NUM_LIT:0> , length = this . classpaths . length ; i < length ; i ++ ) if ( this . classpaths [ i ] . isPackage ( qualifiedPackageName ) ) return true ; } else { for ( int i = <NUM_LIT:0> , length = this . classpaths . length ; i < length ; i ++ ) { Classpath p = this . classpaths [ i ] ; if ( ( p instanceof ClasspathJar ) ? p . isPackage ( qualifiedPackageName ) : p . isPackage ( qp2 ) ) return true ; } } return false ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import java . util . ArrayList ; public class FileFinder { public static String [ ] find ( File f , String pattern ) { ArrayList files = new ArrayList ( ) ; find0 ( f , pattern , files ) ; String [ ] result = new String [ files . size ( ) ] ; files . toArray ( result ) ; return result ; } private static void find0 ( File f , String pattern , ArrayList collector ) { if ( f . isDirectory ( ) ) { String [ ] files = f . list ( ) ; if ( files == null ) return ; for ( int i = <NUM_LIT:0> , max = files . length ; i < max ; i ++ ) { File current = new File ( f , files [ i ] ) ; if ( current . isDirectory ( ) ) { find0 ( current , pattern , collector ) ; } else { if ( current . getName ( ) . toUpperCase ( ) . endsWith ( pattern ) ) { collector . add ( current . getAbsolutePath ( ) ) ; } } } } } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . Enumeration ; import java . util . Hashtable ; import java . util . Iterator ; import java . util . List ; import java . util . zip . ZipEntry ; import java . util . zip . ZipFile ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . util . ManifestAnalyzer ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ClasspathJar extends ClasspathLocation { protected File file ; protected ZipFile zipFile ; protected boolean closeZipFileAtEnd ; protected Hashtable packageCache ; public ClasspathJar ( File file , boolean closeZipFileAtEnd , AccessRuleSet accessRuleSet , String destinationPath ) { super ( accessRuleSet , destinationPath ) ; this . file = file ; this . closeZipFileAtEnd = closeZipFileAtEnd ; } public List fetchLinkedJars ( FileSystem . ClasspathSectionProblemReporter problemReporter ) { InputStream inputStream = null ; try { initialize ( ) ; ArrayList result = new ArrayList ( ) ; ZipEntry manifest = this . zipFile . getEntry ( "<STR_LIT>" ) ; if ( manifest != null ) { inputStream = this . zipFile . getInputStream ( manifest ) ; ManifestAnalyzer analyzer = new ManifestAnalyzer ( ) ; boolean success = analyzer . analyzeManifestContents ( inputStream ) ; List calledFileNames = analyzer . getCalledFileNames ( ) ; if ( problemReporter != null ) { if ( ! success || analyzer . getClasspathSectionsCount ( ) == <NUM_LIT:1> && calledFileNames == null ) { problemReporter . invalidClasspathSection ( getPath ( ) ) ; } else if ( analyzer . getClasspathSectionsCount ( ) > <NUM_LIT:1> ) { problemReporter . multipleClasspathSections ( getPath ( ) ) ; } } if ( calledFileNames != null ) { Iterator calledFilesIterator = calledFileNames . iterator ( ) ; String directoryPath = getPath ( ) ; int lastSeparator = directoryPath . lastIndexOf ( File . separatorChar ) ; directoryPath = directoryPath . substring ( <NUM_LIT:0> , lastSeparator + <NUM_LIT:1> ) ; while ( calledFilesIterator . hasNext ( ) ) { result . add ( new ClasspathJar ( new File ( directoryPath + ( String ) calledFilesIterator . next ( ) ) , this . closeZipFileAtEnd , this . accessRuleSet , this . destinationPath ) ) ; } } } return result ; } catch ( IOException e ) { return null ; } finally { if ( inputStream != null ) { try { inputStream . close ( ) ; } catch ( IOException e ) { } } } } public NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName ) { return findClass ( typeName , qualifiedPackageName , qualifiedBinaryFileName , false ) ; } public NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName , boolean asBinaryOnly ) { if ( ! isPackage ( qualifiedPackageName ) ) return null ; try { ClassFileReader reader = ClassFileReader . read ( this . zipFile , qualifiedBinaryFileName ) ; if ( reader != null ) return new NameEnvironmentAnswer ( reader , fetchAccessRestriction ( qualifiedBinaryFileName ) ) ; } catch ( ClassFormatException e ) { } catch ( IOException e ) { } return null ; } public char [ ] [ ] [ ] findTypeNames ( String qualifiedPackageName ) { if ( ! isPackage ( qualifiedPackageName ) ) return null ; ArrayList answers = new ArrayList ( ) ; nextEntry : for ( Enumeration e = this . zipFile . entries ( ) ; e . hasMoreElements ( ) ; ) { String fileName = ( ( ZipEntry ) e . nextElement ( ) ) . getName ( ) ; int last = fileName . lastIndexOf ( '<CHAR_LIT:/>' ) ; while ( last > <NUM_LIT:0> ) { String packageName = fileName . substring ( <NUM_LIT:0> , last ) ; if ( ! qualifiedPackageName . equals ( packageName ) ) continue nextEntry ; int indexOfDot = fileName . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( indexOfDot != - <NUM_LIT:1> ) { String typeName = fileName . substring ( last + <NUM_LIT:1> , indexOfDot ) ; char [ ] packageArray = packageName . toCharArray ( ) ; answers . add ( CharOperation . arrayConcat ( CharOperation . splitOn ( '<CHAR_LIT:/>' , packageArray ) , typeName . toCharArray ( ) ) ) ; } } } int size = answers . size ( ) ; if ( size != <NUM_LIT:0> ) { char [ ] [ ] [ ] result = new char [ size ] [ ] [ ] ; answers . toArray ( result ) ; return null ; } return null ; } public void initialize ( ) throws IOException { if ( this . zipFile == null ) { this . zipFile = new ZipFile ( this . file ) ; } } public boolean isPackage ( String qualifiedPackageName ) { if ( this . packageCache != null ) return this . packageCache . containsKey ( qualifiedPackageName ) ; this . packageCache = new Hashtable ( <NUM_LIT> ) ; this . packageCache . put ( Util . EMPTY_STRING , Util . EMPTY_STRING ) ; nextEntry : for ( Enumeration e = this . zipFile . entries ( ) ; e . hasMoreElements ( ) ; ) { String fileName = ( ( ZipEntry ) e . nextElement ( ) ) . getName ( ) ; int last = fileName . lastIndexOf ( '<CHAR_LIT:/>' ) ; while ( last > <NUM_LIT:0> ) { String packageName = fileName . substring ( <NUM_LIT:0> , last ) ; if ( this . packageCache . containsKey ( packageName ) ) continue nextEntry ; this . packageCache . put ( packageName , packageName ) ; last = packageName . lastIndexOf ( '<CHAR_LIT:/>' ) ; } } return this . packageCache . containsKey ( qualifiedPackageName ) ; } public void reset ( ) { if ( this . zipFile != null && this . closeZipFileAtEnd ) { try { this . zipFile . close ( ) ; } catch ( IOException e ) { } this . zipFile = null ; } this . packageCache = null ; } public String toString ( ) { return "<STR_LIT>" + this . file . getPath ( ) ; } public char [ ] normalizedPath ( ) { if ( this . normalizedPath == null ) { String path2 = this . getPath ( ) ; char [ ] rawName = path2 . toCharArray ( ) ; if ( File . separatorChar == '<STR_LIT:\\>' ) { CharOperation . replace ( rawName , '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) ; } this . normalizedPath = CharOperation . subarray ( rawName , <NUM_LIT:0> , CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , rawName ) ) ; } return this . normalizedPath ; } public String getPath ( ) { if ( this . path == null ) { try { this . path = this . file . getCanonicalPath ( ) ; } catch ( IOException e ) { this . path = this . file . getAbsolutePath ( ) ; } } return this . path ; } public int getMode ( ) { return BINARY ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import java . io . FilenameFilter ; import java . io . IOException ; import java . util . Hashtable ; import java . util . List ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ClasspathDirectory extends ClasspathLocation { private Hashtable directoryCache ; private String [ ] missingPackageHolder = new String [ <NUM_LIT:1> ] ; private int mode ; private String encoding ; ClasspathDirectory ( File directory , String encoding , int mode , AccessRuleSet accessRuleSet , String destinationPath ) { super ( accessRuleSet , destinationPath ) ; this . mode = mode ; try { this . path = directory . getCanonicalPath ( ) ; } catch ( IOException e ) { this . path = directory . getAbsolutePath ( ) ; } if ( ! this . path . endsWith ( File . separator ) ) this . path += File . separator ; this . directoryCache = new Hashtable ( <NUM_LIT:11> ) ; this . encoding = encoding ; } String [ ] directoryList ( String qualifiedPackageName ) { String [ ] dirList = ( String [ ] ) this . directoryCache . get ( qualifiedPackageName ) ; if ( dirList == this . missingPackageHolder ) return null ; if ( dirList != null ) return dirList ; File dir = new File ( this . path + qualifiedPackageName ) ; notFound : if ( dir . isDirectory ( ) ) { int index = qualifiedPackageName . length ( ) ; int last = qualifiedPackageName . lastIndexOf ( File . separatorChar ) ; while ( -- index > last && ! ScannerHelper . isUpperCase ( qualifiedPackageName . charAt ( index ) ) ) { } if ( index > last ) { if ( last == - <NUM_LIT:1> ) { if ( ! doesFileExist ( qualifiedPackageName , Util . EMPTY_STRING ) ) break notFound ; } else { String packageName = qualifiedPackageName . substring ( last + <NUM_LIT:1> ) ; String parentPackage = qualifiedPackageName . substring ( <NUM_LIT:0> , last ) ; if ( ! doesFileExist ( packageName , parentPackage ) ) break notFound ; } } if ( ( dirList = dir . list ( ) ) == null ) dirList = CharOperation . NO_STRINGS ; this . directoryCache . put ( qualifiedPackageName , dirList ) ; return dirList ; } this . directoryCache . put ( qualifiedPackageName , this . missingPackageHolder ) ; return null ; } boolean doesFileExist ( String fileName , String qualifiedPackageName ) { String [ ] dirList = directoryList ( qualifiedPackageName ) ; if ( dirList == null ) return false ; for ( int i = dirList . length ; -- i >= <NUM_LIT:0> ; ) if ( fileName . equals ( dirList [ i ] ) ) return true ; return false ; } public List fetchLinkedJars ( FileSystem . ClasspathSectionProblemReporter problemReporter ) { return null ; } public NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName ) { return findClass ( typeName , qualifiedPackageName , qualifiedBinaryFileName , false ) ; } public NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName , boolean asBinaryOnly ) { if ( ! isPackage ( qualifiedPackageName ) ) return null ; String fileName = new String ( typeName ) ; boolean binaryExists = ( ( this . mode & BINARY ) != <NUM_LIT:0> ) && doesFileExist ( fileName + SUFFIX_STRING_class , qualifiedPackageName ) ; boolean sourceExists = ( ( this . mode & SOURCE ) != <NUM_LIT:0> ) && doesFileExist ( fileName + SUFFIX_STRING_java , qualifiedPackageName ) ; if ( sourceExists && ! asBinaryOnly ) { String fullSourcePath = this . path + qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedBinaryFileName . length ( ) - <NUM_LIT:6> ) + SUFFIX_STRING_java ; if ( ! binaryExists ) return new NameEnvironmentAnswer ( new CompilationUnit ( null , fullSourcePath , this . encoding , this . destinationPath ) , fetchAccessRestriction ( qualifiedBinaryFileName ) ) ; String fullBinaryPath = this . path + qualifiedBinaryFileName ; long binaryModified = new File ( fullBinaryPath ) . lastModified ( ) ; long sourceModified = new File ( fullSourcePath ) . lastModified ( ) ; if ( sourceModified > binaryModified ) return new NameEnvironmentAnswer ( new CompilationUnit ( null , fullSourcePath , this . encoding , this . destinationPath ) , fetchAccessRestriction ( qualifiedBinaryFileName ) ) ; } if ( binaryExists ) { try { ClassFileReader reader = ClassFileReader . read ( this . path + qualifiedBinaryFileName ) ; String typeSearched = qualifiedPackageName . length ( ) > <NUM_LIT:0> ? qualifiedPackageName . replace ( File . separatorChar , '<CHAR_LIT:/>' ) + "<STR_LIT:/>" + fileName : fileName ; if ( ! CharOperation . equals ( reader . getName ( ) , typeSearched . toCharArray ( ) ) ) { reader = null ; } if ( reader != null ) return new NameEnvironmentAnswer ( reader , fetchAccessRestriction ( qualifiedBinaryFileName ) ) ; } catch ( IOException e ) { } catch ( ClassFormatException e ) { } } return null ; } public char [ ] [ ] [ ] findTypeNames ( String qualifiedPackageName ) { if ( ! isPackage ( qualifiedPackageName ) ) { return null ; } File dir = new File ( this . path + qualifiedPackageName ) ; if ( ! dir . exists ( ) || ! dir . isDirectory ( ) ) { return null ; } String [ ] listFiles = dir . list ( new FilenameFilter ( ) { public boolean accept ( File directory , String name ) { String fileName = name . toLowerCase ( ) ; return fileName . endsWith ( "<STR_LIT:.class>" ) || fileName . endsWith ( "<STR_LIT>" ) ; } } ) ; int length ; if ( listFiles == null || ( length = listFiles . length ) == <NUM_LIT:0> ) { return null ; } char [ ] [ ] [ ] result = new char [ length ] [ ] [ ] ; char [ ] [ ] packageName = CharOperation . splitOn ( File . separatorChar , qualifiedPackageName . toCharArray ( ) ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String fileName = listFiles [ i ] ; int indexOfLastDot = fileName . indexOf ( '<CHAR_LIT:.>' ) ; result [ i ] = CharOperation . arrayConcat ( packageName , fileName . substring ( <NUM_LIT:0> , indexOfLastDot ) . toCharArray ( ) ) ; } return result ; } public void initialize ( ) throws IOException { } public boolean isPackage ( String qualifiedPackageName ) { return directoryList ( qualifiedPackageName ) != null ; } public void reset ( ) { this . directoryCache = new Hashtable ( <NUM_LIT:11> ) ; } public String toString ( ) { return "<STR_LIT>" + this . path ; } public char [ ] normalizedPath ( ) { if ( this . normalizedPath == null ) { this . normalizedPath = this . path . toCharArray ( ) ; if ( File . separatorChar == '<STR_LIT:\\>' ) { CharOperation . replace ( this . normalizedPath , '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) ; } } return this . normalizedPath ; } public String getPath ( ) { return this . path ; } public int getMode ( ) { return this . mode ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . BufferedInputStream ; import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . FilenameFilter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . LineNumberReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . StringReader ; import java . io . StringWriter ; import java . io . UnsupportedEncodingException ; import java . lang . reflect . Field ; import java . text . DateFormat ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Date ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Locale ; import java . util . Map ; import java . util . MissingResourceException ; import java . util . Properties ; import java . util . ResourceBundle ; import java . util . Set ; import java . util . StringTokenizer ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . CompilationProgress ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . compiler . batch . BatchCompiler ; import org . eclipse . jdt . internal . compiler . AbstractAnnotationProcessorManager ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IErrorHandlingPolicy ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . batch . FileSystem . Classpath ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . env . AccessRule ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . CompilerStats ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . util . GenericXMLWriter ; import org . eclipse . jdt . internal . compiler . util . HashtableOfInt ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObject ; import org . eclipse . jdt . internal . compiler . util . Messages ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; public class Main implements ProblemSeverities , SuffixConstants { public static class Logger { private PrintWriter err ; private PrintWriter log ; private Main main ; private PrintWriter out ; private HashMap parameters ; int tagBits ; private static final String CLASS = "<STR_LIT:class>" ; private static final String CLASS_FILE = "<STR_LIT>" ; private static final String CLASSPATH = "<STR_LIT>" ; private static final String CLASSPATH_FILE = "<STR_LIT>" ; private static final String CLASSPATH_FOLDER = "<STR_LIT>" ; private static final String CLASSPATH_ID = "<STR_LIT:id>" ; private static final String CLASSPATH_JAR = "<STR_LIT>" ; private static final String CLASSPATHS = "<STR_LIT>" ; private static final String COMMAND_LINE_ARGUMENT = "<STR_LIT>" ; private static final String COMMAND_LINE_ARGUMENTS = "<STR_LIT>" ; private static final String COMPILER = "<STR_LIT>" ; private static final String COMPILER_COPYRIGHT = "<STR_LIT>" ; private static final String COMPILER_NAME = "<STR_LIT:name>" ; private static final String COMPILER_VERSION = "<STR_LIT:version>" ; public static final int EMACS = <NUM_LIT:2> ; private static final String ERROR = "<STR_LIT>" ; private static final String ERROR_TAG = "<STR_LIT:error>" ; private static final String WARNING_TAG = "<STR_LIT>" ; private static final String EXCEPTION = "<STR_LIT>" ; private static final String EXTRA_PROBLEM_TAG = "<STR_LIT>" ; private static final String EXTRA_PROBLEMS = "<STR_LIT>" ; private static final HashtableOfInt FIELD_TABLE = new HashtableOfInt ( ) ; private static final String KEY = "<STR_LIT:key>" ; private static final String MESSAGE = "<STR_LIT:message>" ; private static final String NUMBER_OF_CLASSFILES = "<STR_LIT>" ; private static final String NUMBER_OF_ERRORS = "<STR_LIT>" ; private static final String NUMBER_OF_LINES = "<STR_LIT>" ; private static final String NUMBER_OF_PROBLEMS = "<STR_LIT>" ; private static final String NUMBER_OF_TASKS = "<STR_LIT>" ; private static final String NUMBER_OF_WARNINGS = "<STR_LIT>" ; private static final String OPTION = "<STR_LIT>" ; private static final String OPTIONS = "<STR_LIT>" ; private static final String OUTPUT = "<STR_LIT>" ; private static final String PACKAGE = "<STR_LIT>" ; private static final String PATH = "<STR_LIT:path>" ; private static final String PROBLEM_ARGUMENT = "<STR_LIT>" ; private static final String PROBLEM_ARGUMENT_VALUE = "<STR_LIT:value>" ; private static final String PROBLEM_ARGUMENTS = "<STR_LIT>" ; private static final String PROBLEM_CATEGORY_ID = "<STR_LIT>" ; private static final String ID = "<STR_LIT:id>" ; private static final String PROBLEM_ID = "<STR_LIT>" ; private static final String PROBLEM_LINE = "<STR_LIT>" ; private static final String PROBLEM_OPTION_KEY = "<STR_LIT>" ; private static final String PROBLEM_MESSAGE = "<STR_LIT:message>" ; private static final String PROBLEM_SEVERITY = "<STR_LIT>" ; private static final String PROBLEM_SOURCE_END = "<STR_LIT>" ; private static final String PROBLEM_SOURCE_START = "<STR_LIT>" ; private static final String PROBLEM_SUMMARY = "<STR_LIT>" ; private static final String PROBLEM_TAG = "<STR_LIT>" ; private static final String PROBLEMS = "<STR_LIT>" ; private static final String SOURCE = "<STR_LIT:source>" ; private static final String SOURCE_CONTEXT = "<STR_LIT>" ; private static final String SOURCE_END = "<STR_LIT>" ; private static final String SOURCE_START = "<STR_LIT>" ; private static final String SOURCES = "<STR_LIT>" ; private static final String STATS = "<STR_LIT>" ; private static final String TASK = "<STR_LIT>" ; private static final String TASKS = "<STR_LIT>" ; private static final String TIME = "<STR_LIT>" ; private static final String VALUE = "<STR_LIT:value>" ; private static final String WARNING = "<STR_LIT>" ; public static final int XML = <NUM_LIT:1> ; private static final String XML_DTD_DECLARATION = "<STR_LIT>" ; static { try { Class c = IProblem . class ; Field [ ] fields = c . getFields ( ) ; for ( int i = <NUM_LIT:0> , max = fields . length ; i < max ; i ++ ) { Field field = fields [ i ] ; if ( field . getType ( ) . equals ( Integer . TYPE ) ) { Integer value = ( Integer ) field . get ( null ) ; int key2 = value . intValue ( ) & IProblem . IgnoreCategoriesMask ; if ( key2 == <NUM_LIT:0> ) { key2 = Integer . MAX_VALUE ; } Logger . FIELD_TABLE . put ( key2 , field . getName ( ) ) ; } } } catch ( SecurityException e ) { e . printStackTrace ( ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } } public Logger ( Main main , PrintWriter out , PrintWriter err ) { this . out = out ; this . err = err ; this . parameters = new HashMap ( ) ; this . main = main ; } public String buildFileName ( String outputPath , String relativeFileName ) { char fileSeparatorChar = File . separatorChar ; String fileSeparator = File . separator ; outputPath = outputPath . replace ( '<CHAR_LIT:/>' , fileSeparatorChar ) ; StringBuffer outDir = new StringBuffer ( outputPath ) ; if ( ! outputPath . endsWith ( fileSeparator ) ) { outDir . append ( fileSeparator ) ; } StringTokenizer tokenizer = new StringTokenizer ( relativeFileName , fileSeparator ) ; String token = tokenizer . nextToken ( ) ; while ( tokenizer . hasMoreTokens ( ) ) { outDir . append ( token ) . append ( fileSeparator ) ; token = tokenizer . nextToken ( ) ; } return outDir . append ( token ) . toString ( ) ; } public void close ( ) { if ( this . log != null ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { endTag ( Logger . COMPILER ) ; flush ( ) ; } this . log . close ( ) ; } } public void compiling ( ) { printlnOut ( this . main . bind ( "<STR_LIT>" ) ) ; } private void endLoggingExtraProblems ( ) { endTag ( Logger . EXTRA_PROBLEMS ) ; } private void endLoggingProblems ( ) { endTag ( Logger . PROBLEMS ) ; } public void endLoggingSource ( ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { endTag ( Logger . SOURCE ) ; } } public void endLoggingSources ( ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { endTag ( Logger . SOURCES ) ; } } public void endLoggingTasks ( ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { endTag ( Logger . TASKS ) ; } } private void endTag ( String name ) { if ( this . log != null ) { ( ( GenericXMLWriter ) this . log ) . endTag ( name , true , true ) ; } } private String errorReportSource ( CategorizedProblem problem , char [ ] unitSource , int bits ) { int startPosition = problem . getSourceStart ( ) ; int endPosition = problem . getSourceEnd ( ) ; if ( unitSource == null ) { if ( problem . getOriginatingFileName ( ) != null ) { try { unitSource = Util . getFileCharContent ( new File ( new String ( problem . getOriginatingFileName ( ) ) ) , null ) ; } catch ( IOException e ) { } } } int length ; if ( ( startPosition > endPosition ) || ( ( startPosition < <NUM_LIT:0> ) && ( endPosition < <NUM_LIT:0> ) ) || ( unitSource == null ) || ( length = unitSource . length ) == <NUM_LIT:0> ) return Messages . problem_noSourceInformation ; StringBuffer errorBuffer = new StringBuffer ( ) ; if ( ( bits & Main . Logger . EMACS ) == <NUM_LIT:0> ) { errorBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( Messages . bind ( Messages . problem_atLine , String . valueOf ( problem . getSourceLineNumber ( ) ) ) ) ; errorBuffer . append ( Util . LINE_SEPARATOR ) ; } errorBuffer . append ( '<STR_LIT:\t>' ) ; char c ; final char SPACE = '<CHAR_LIT:U+0020>' ; final char MARK = '<CHAR_LIT>' ; final char TAB = '<STR_LIT:\t>' ; int begin ; int end ; for ( begin = startPosition >= length ? length - <NUM_LIT:1> : startPosition ; begin > <NUM_LIT:0> ; begin -- ) { if ( ( c = unitSource [ begin - <NUM_LIT:1> ] ) == '<STR_LIT:\n>' || c == '<STR_LIT>' ) break ; } for ( end = endPosition >= length ? length - <NUM_LIT:1> : endPosition ; end + <NUM_LIT:1> < length ; end ++ ) { if ( ( c = unitSource [ end + <NUM_LIT:1> ] ) == '<STR_LIT>' || c == '<STR_LIT:\n>' ) break ; } while ( ( c = unitSource [ begin ] ) == '<CHAR_LIT:U+0020>' || c == '<STR_LIT:\t>' ) begin ++ ; errorBuffer . append ( unitSource , begin , end - begin + <NUM_LIT:1> ) ; errorBuffer . append ( Util . LINE_SEPARATOR ) . append ( "<STR_LIT:t>" ) ; for ( int i = begin ; i < startPosition ; i ++ ) { errorBuffer . append ( ( unitSource [ i ] == TAB ) ? TAB : SPACE ) ; } for ( int i = startPosition ; i <= ( endPosition >= length ? length - <NUM_LIT:1> : endPosition ) ; i ++ ) { errorBuffer . append ( MARK ) ; } return errorBuffer . toString ( ) ; } private void extractContext ( CategorizedProblem problem , char [ ] unitSource ) { int startPosition = problem . getSourceStart ( ) ; int endPosition = problem . getSourceEnd ( ) ; if ( unitSource == null ) { if ( problem . getOriginatingFileName ( ) != null ) { try { unitSource = Util . getFileCharContent ( new File ( new String ( problem . getOriginatingFileName ( ) ) ) , null ) ; } catch ( IOException e ) { } } } int length ; if ( ( startPosition > endPosition ) || ( ( startPosition < <NUM_LIT:0> ) && ( endPosition < <NUM_LIT:0> ) ) || ( unitSource == null ) || ( ( length = unitSource . length ) <= <NUM_LIT:0> ) || ( endPosition > length ) ) { this . parameters . put ( Logger . VALUE , Messages . problem_noSourceInformation ) ; this . parameters . put ( Logger . SOURCE_START , "<STR_LIT:-1>" ) ; this . parameters . put ( Logger . SOURCE_END , "<STR_LIT:-1>" ) ; printTag ( Logger . SOURCE_CONTEXT , this . parameters , true , true ) ; return ; } char c ; int begin , end ; for ( begin = startPosition >= length ? length - <NUM_LIT:1> : startPosition ; begin > <NUM_LIT:0> ; begin -- ) { if ( ( c = unitSource [ begin - <NUM_LIT:1> ] ) == '<STR_LIT:\n>' || c == '<STR_LIT>' ) break ; } for ( end = endPosition >= length ? length - <NUM_LIT:1> : endPosition ; end + <NUM_LIT:1> < length ; end ++ ) { if ( ( c = unitSource [ end + <NUM_LIT:1> ] ) == '<STR_LIT>' || c == '<STR_LIT:\n>' ) break ; } while ( ( c = unitSource [ begin ] ) == '<CHAR_LIT:U+0020>' || c == '<STR_LIT:\t>' ) begin ++ ; while ( ( c = unitSource [ end ] ) == '<CHAR_LIT:U+0020>' || c == '<STR_LIT:\t>' ) end -- ; StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( unitSource , begin , end - begin + <NUM_LIT:1> ) ; this . parameters . put ( Logger . VALUE , String . valueOf ( buffer ) ) ; this . parameters . put ( Logger . SOURCE_START , Integer . toString ( startPosition - begin ) ) ; this . parameters . put ( Logger . SOURCE_END , Integer . toString ( endPosition - begin ) ) ; printTag ( Logger . SOURCE_CONTEXT , this . parameters , true , true ) ; } public void flush ( ) { this . out . flush ( ) ; this . err . flush ( ) ; if ( this . log != null ) { this . log . flush ( ) ; } } private String getFieldName ( int id ) { int key2 = id & IProblem . IgnoreCategoriesMask ; if ( key2 == <NUM_LIT:0> ) { key2 = Integer . MAX_VALUE ; } return ( String ) Logger . FIELD_TABLE . get ( key2 ) ; } private String getProblemOptionKey ( int problemID ) { int irritant = ProblemReporter . getIrritant ( problemID ) ; return CompilerOptions . optionKeyFromIrritant ( irritant ) ; } public void logAverage ( ) { Arrays . sort ( this . main . compilerStats ) ; long lineCount = this . main . compilerStats [ <NUM_LIT:0> ] . lineCount ; final int length = this . main . maxRepetition ; long sum = <NUM_LIT:0> ; long parseSum = <NUM_LIT:0> , resolveSum = <NUM_LIT:0> , analyzeSum = <NUM_LIT:0> , generateSum = <NUM_LIT:0> ; for ( int i = <NUM_LIT:1> , max = length - <NUM_LIT:1> ; i < max ; i ++ ) { CompilerStats stats = this . main . compilerStats [ i ] ; sum += stats . elapsedTime ( ) ; parseSum += stats . parseTime ; resolveSum += stats . resolveTime ; analyzeSum += stats . analyzeTime ; generateSum += stats . generateTime ; } long time = sum / ( length - <NUM_LIT:2> ) ; long parseTime = parseSum / ( length - <NUM_LIT:2> ) ; long resolveTime = resolveSum / ( length - <NUM_LIT:2> ) ; long analyzeTime = analyzeSum / ( length - <NUM_LIT:2> ) ; long generateTime = generateSum / ( length - <NUM_LIT:2> ) ; printlnOut ( this . main . bind ( "<STR_LIT>" , new String [ ] { String . valueOf ( lineCount ) , String . valueOf ( time ) , String . valueOf ( ( ( int ) ( lineCount * <NUM_LIT> / time ) ) / <NUM_LIT> ) , } ) ) ; if ( ( this . main . timing & Main . TIMING_DETAILED ) != <NUM_LIT:0> ) { printlnOut ( this . main . bind ( "<STR_LIT>" , new String [ ] { String . valueOf ( parseTime ) , String . valueOf ( ( ( int ) ( parseTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , String . valueOf ( resolveTime ) , String . valueOf ( ( ( int ) ( resolveTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , String . valueOf ( analyzeTime ) , String . valueOf ( ( ( int ) ( analyzeTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , String . valueOf ( generateTime ) , String . valueOf ( ( ( int ) ( generateTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , } ) ) ; } } public void logClassFile ( boolean generatePackagesStructure , String outputPath , String relativeFileName ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { String fileName = null ; if ( generatePackagesStructure ) { fileName = buildFileName ( outputPath , relativeFileName ) ; } else { char fileSeparatorChar = File . separatorChar ; String fileSeparator = File . separator ; outputPath = outputPath . replace ( '<CHAR_LIT:/>' , fileSeparatorChar ) ; int indexOfPackageSeparator = relativeFileName . lastIndexOf ( fileSeparatorChar ) ; if ( indexOfPackageSeparator == - <NUM_LIT:1> ) { if ( outputPath . endsWith ( fileSeparator ) ) { fileName = outputPath + relativeFileName ; } else { fileName = outputPath + fileSeparator + relativeFileName ; } } else { int length = relativeFileName . length ( ) ; if ( outputPath . endsWith ( fileSeparator ) ) { fileName = outputPath + relativeFileName . substring ( indexOfPackageSeparator + <NUM_LIT:1> , length ) ; } else { fileName = outputPath + fileSeparator + relativeFileName . substring ( indexOfPackageSeparator + <NUM_LIT:1> , length ) ; } } } File f = new File ( fileName ) ; try { this . parameters . put ( Logger . PATH , f . getCanonicalPath ( ) ) ; printTag ( Logger . CLASS_FILE , this . parameters , true , true ) ; } catch ( IOException e ) { logNoClassFileCreated ( outputPath , relativeFileName , e ) ; } } } public void logClasspath ( FileSystem . Classpath [ ] classpaths ) { if ( classpaths == null ) return ; if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { final int length = classpaths . length ; if ( length != <NUM_LIT:0> ) { printTag ( Logger . CLASSPATHS , null , true , false ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String classpath = classpaths [ i ] . getPath ( ) ; this . parameters . put ( Logger . PATH , classpath ) ; File f = new File ( classpath ) ; String id = null ; if ( f . isFile ( ) ) { if ( Util . isPotentialZipArchive ( classpath ) ) { id = Logger . CLASSPATH_JAR ; } else { id = Logger . CLASSPATH_FILE ; } } else if ( f . isDirectory ( ) ) { id = Logger . CLASSPATH_FOLDER ; } if ( id != null ) { this . parameters . put ( Logger . CLASSPATH_ID , id ) ; printTag ( Logger . CLASSPATH , this . parameters , true , true ) ; } } endTag ( Logger . CLASSPATHS ) ; } } } public void logCommandLineArguments ( String [ ] commandLineArguments ) { if ( commandLineArguments == null ) return ; if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { final int length = commandLineArguments . length ; if ( length != <NUM_LIT:0> ) { printTag ( Logger . COMMAND_LINE_ARGUMENTS , null , true , false ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . parameters . put ( Logger . VALUE , commandLineArguments [ i ] ) ; printTag ( Logger . COMMAND_LINE_ARGUMENT , this . parameters , true , true ) ; } endTag ( Logger . COMMAND_LINE_ARGUMENTS ) ; } } } public void logException ( Exception e ) { StringWriter writer = new StringWriter ( ) ; PrintWriter printWriter = new PrintWriter ( writer ) ; e . printStackTrace ( printWriter ) ; printWriter . flush ( ) ; printWriter . close ( ) ; final String stackTrace = writer . toString ( ) ; if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { LineNumberReader reader = new LineNumberReader ( new StringReader ( stackTrace ) ) ; String line ; int i = <NUM_LIT:0> ; StringBuffer buffer = new StringBuffer ( ) ; String message = e . getMessage ( ) ; if ( message != null ) { buffer . append ( message ) . append ( Util . LINE_SEPARATOR ) ; } try { while ( ( line = reader . readLine ( ) ) != null && i < <NUM_LIT:4> ) { buffer . append ( line ) . append ( Util . LINE_SEPARATOR ) ; i ++ ; } reader . close ( ) ; } catch ( IOException e1 ) { } message = buffer . toString ( ) ; this . parameters . put ( Logger . MESSAGE , message ) ; this . parameters . put ( Logger . CLASS , e . getClass ( ) ) ; printTag ( Logger . EXCEPTION , this . parameters , true , true ) ; } String message = e . getMessage ( ) ; if ( message == null ) { this . printlnErr ( stackTrace ) ; } else { this . printlnErr ( message ) ; } } private void logExtraProblem ( CategorizedProblem problem , int localErrorCount , int globalErrorCount ) { char [ ] originatingFileName = problem . getOriginatingFileName ( ) ; if ( originatingFileName == null ) { if ( problem . isError ( ) ) { printErr ( this . main . bind ( "<STR_LIT>" , Integer . toString ( globalErrorCount ) ) ) ; } else { printErr ( this . main . bind ( "<STR_LIT>" , Integer . toString ( globalErrorCount ) ) ) ; } printErr ( "<STR_LIT:U+0020>" ) ; this . printlnErr ( problem . getMessage ( ) ) ; } else { String fileName = new String ( originatingFileName ) ; if ( ( this . tagBits & Logger . EMACS ) != <NUM_LIT:0> ) { String result = fileName + "<STR_LIT::>" + problem . getSourceLineNumber ( ) + "<STR_LIT::U+0020>" + ( problem . isError ( ) ? this . main . bind ( "<STR_LIT>" ) : this . main . bind ( "<STR_LIT>" ) ) + "<STR_LIT::U+0020>" + problem . getMessage ( ) ; this . printlnErr ( result ) ; final String errorReportSource = errorReportSource ( problem , null , this . tagBits ) ; this . printlnErr ( errorReportSource ) ; } else { if ( localErrorCount == <NUM_LIT:0> ) { this . printlnErr ( "<STR_LIT>" ) ; } printErr ( problem . isError ( ) ? this . main . bind ( "<STR_LIT>" , Integer . toString ( globalErrorCount ) , new String ( fileName ) ) : this . main . bind ( "<STR_LIT>" , Integer . toString ( globalErrorCount ) , new String ( fileName ) ) ) ; final String errorReportSource = errorReportSource ( problem , null , <NUM_LIT:0> ) ; this . printlnErr ( errorReportSource ) ; this . printlnErr ( problem . getMessage ( ) ) ; this . printlnErr ( "<STR_LIT>" ) ; } } } public void loggingExtraProblems ( Main currentMain ) { ArrayList problems = currentMain . extraProblems ; final int count = problems . size ( ) ; int localProblemCount = <NUM_LIT:0> ; if ( count != <NUM_LIT:0> ) { int errors = <NUM_LIT:0> ; int warnings = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { CategorizedProblem problem = ( CategorizedProblem ) problems . get ( i ) ; if ( problem != null ) { currentMain . globalProblemsCount ++ ; logExtraProblem ( problem , localProblemCount , currentMain . globalProblemsCount ) ; localProblemCount ++ ; if ( problem . isError ( ) ) { errors ++ ; currentMain . globalErrorsCount ++ ; } else if ( problem . isWarning ( ) ) { currentMain . globalWarningsCount ++ ; warnings ++ ; } } } if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { if ( ( errors + warnings ) != <NUM_LIT:0> ) { startLoggingExtraProblems ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { CategorizedProblem problem = ( CategorizedProblem ) problems . get ( i ) ; if ( problem != null ) { if ( problem . getID ( ) != IProblem . Task ) { logXmlExtraProblem ( problem , localProblemCount , currentMain . globalProblemsCount ) ; } } } endLoggingExtraProblems ( ) ; } } } } public void logIncorrectVMVersionForAnnotationProcessing ( ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . MESSAGE , this . main . bind ( "<STR_LIT>" ) ) ; printTag ( Logger . ERROR_TAG , this . parameters , true , true ) ; } this . printlnErr ( this . main . bind ( "<STR_LIT>" ) ) ; } public void logNoClassFileCreated ( String outputDir , String relativeFileName , IOException e ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . MESSAGE , this . main . bind ( "<STR_LIT>" , new String [ ] { outputDir , relativeFileName , e . getMessage ( ) } ) ) ; printTag ( Logger . ERROR_TAG , this . parameters , true , true ) ; } this . printlnErr ( this . main . bind ( "<STR_LIT>" , new String [ ] { outputDir , relativeFileName , e . getMessage ( ) } ) ) ; } public void logNumberOfClassFilesGenerated ( int exportedClassFilesCounter ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . VALUE , new Integer ( exportedClassFilesCounter ) ) ; printTag ( Logger . NUMBER_OF_CLASSFILES , this . parameters , true , true ) ; } if ( exportedClassFilesCounter == <NUM_LIT:1> ) { printlnOut ( this . main . bind ( "<STR_LIT>" ) ) ; } else { printlnOut ( this . main . bind ( "<STR_LIT>" , String . valueOf ( exportedClassFilesCounter ) ) ) ; } } public void logOptions ( Map options ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { printTag ( Logger . OPTIONS , null , true , false ) ; final Set entriesSet = options . entrySet ( ) ; Object [ ] entries = entriesSet . toArray ( ) ; Arrays . sort ( entries , new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { Map . Entry entry1 = ( Map . Entry ) o1 ; Map . Entry entry2 = ( Map . Entry ) o2 ; return ( ( String ) entry1 . getKey ( ) ) . compareTo ( ( String ) entry2 . getKey ( ) ) ; } } ) ; for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { Map . Entry entry = ( Map . Entry ) entries [ i ] ; String key = ( String ) entry . getKey ( ) ; this . parameters . put ( Logger . KEY , key ) ; this . parameters . put ( Logger . VALUE , entry . getValue ( ) ) ; printTag ( Logger . OPTION , this . parameters , true , true ) ; } endTag ( Logger . OPTIONS ) ; } } public void logPendingError ( String error ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . MESSAGE , error ) ; printTag ( Logger . ERROR_TAG , this . parameters , true , true ) ; } this . printlnErr ( error ) ; } public void logWarning ( String message ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . MESSAGE , message ) ; printTag ( Logger . WARNING_TAG , this . parameters , true , true ) ; } this . printlnOut ( message ) ; } private void logProblem ( CategorizedProblem problem , int localErrorCount , int globalErrorCount , char [ ] unitSource ) { if ( ( this . tagBits & Logger . EMACS ) != <NUM_LIT:0> ) { String result = ( new String ( problem . getOriginatingFileName ( ) ) + "<STR_LIT::>" + problem . getSourceLineNumber ( ) + "<STR_LIT::U+0020>" + ( problem . isError ( ) ? this . main . bind ( "<STR_LIT>" ) : this . main . bind ( "<STR_LIT>" ) ) + "<STR_LIT::U+0020>" + problem . getMessage ( ) ) ; this . printlnErr ( result ) ; final String errorReportSource = errorReportSource ( problem , unitSource , this . tagBits ) ; if ( errorReportSource . length ( ) != <NUM_LIT:0> ) this . printlnErr ( errorReportSource ) ; } else { if ( localErrorCount == <NUM_LIT:0> ) { this . printlnErr ( "<STR_LIT>" ) ; } printErr ( problem . isError ( ) ? this . main . bind ( "<STR_LIT>" , Integer . toString ( globalErrorCount ) , new String ( problem . getOriginatingFileName ( ) ) ) : this . main . bind ( "<STR_LIT>" , Integer . toString ( globalErrorCount ) , new String ( problem . getOriginatingFileName ( ) ) ) ) ; try { final String errorReportSource = errorReportSource ( problem , unitSource , <NUM_LIT:0> ) ; this . printlnErr ( errorReportSource ) ; this . printlnErr ( problem . getMessage ( ) ) ; } catch ( Exception e ) { this . printlnErr ( this . main . bind ( "<STR_LIT>" , problem . toString ( ) ) ) ; } this . printlnErr ( "<STR_LIT>" ) ; } } public int logProblems ( CategorizedProblem [ ] problems , char [ ] unitSource , Main currentMain ) { final int count = problems . length ; int localErrorCount = <NUM_LIT:0> ; int localProblemCount = <NUM_LIT:0> ; if ( count != <NUM_LIT:0> ) { int errors = <NUM_LIT:0> ; int warnings = <NUM_LIT:0> ; int tasks = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { CategorizedProblem problem = problems [ i ] ; if ( problem != null ) { currentMain . globalProblemsCount ++ ; logProblem ( problem , localProblemCount , currentMain . globalProblemsCount , unitSource ) ; localProblemCount ++ ; if ( problem . isError ( ) ) { localErrorCount ++ ; errors ++ ; currentMain . globalErrorsCount ++ ; } else if ( problem . getID ( ) == IProblem . Task ) { currentMain . globalTasksCount ++ ; tasks ++ ; } else { currentMain . globalWarningsCount ++ ; warnings ++ ; } } } if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { if ( ( errors + warnings ) != <NUM_LIT:0> ) { startLoggingProblems ( errors , warnings ) ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { CategorizedProblem problem = problems [ i ] ; if ( problem != null ) { if ( problem . getID ( ) != IProblem . Task ) { logXmlProblem ( problem , unitSource ) ; } } } endLoggingProblems ( ) ; } if ( tasks != <NUM_LIT:0> ) { startLoggingTasks ( tasks ) ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { CategorizedProblem problem = problems [ i ] ; if ( problem != null ) { if ( problem . getID ( ) == IProblem . Task ) { logXmlTask ( problem , unitSource ) ; } } } endLoggingTasks ( ) ; } } } return localErrorCount ; } public void logProblemsSummary ( int globalProblemsCount , int globalErrorsCount , int globalWarningsCount , int globalTasksCount ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . NUMBER_OF_PROBLEMS , new Integer ( globalProblemsCount ) ) ; this . parameters . put ( Logger . NUMBER_OF_ERRORS , new Integer ( globalErrorsCount ) ) ; this . parameters . put ( Logger . NUMBER_OF_WARNINGS , new Integer ( globalWarningsCount ) ) ; this . parameters . put ( Logger . NUMBER_OF_TASKS , new Integer ( globalTasksCount ) ) ; printTag ( Logger . PROBLEM_SUMMARY , this . parameters , true , true ) ; } if ( globalProblemsCount == <NUM_LIT:1> ) { String message = null ; if ( globalErrorsCount == <NUM_LIT:1> ) { message = this . main . bind ( "<STR_LIT>" ) ; } else { message = this . main . bind ( "<STR_LIT>" ) ; } printErr ( this . main . bind ( "<STR_LIT>" , message ) ) ; } else { String errorMessage = null ; String warningMessage = null ; if ( globalErrorsCount > <NUM_LIT:0> ) { if ( globalErrorsCount == <NUM_LIT:1> ) { errorMessage = this . main . bind ( "<STR_LIT>" ) ; } else { errorMessage = this . main . bind ( "<STR_LIT>" , String . valueOf ( globalErrorsCount ) ) ; } } int warningsNumber = globalWarningsCount + globalTasksCount ; if ( warningsNumber > <NUM_LIT:0> ) { if ( warningsNumber == <NUM_LIT:1> ) { warningMessage = this . main . bind ( "<STR_LIT>" ) ; } else { warningMessage = this . main . bind ( "<STR_LIT>" , String . valueOf ( warningsNumber ) ) ; } } if ( errorMessage == null || warningMessage == null ) { if ( errorMessage == null ) { printErr ( this . main . bind ( "<STR_LIT>" , String . valueOf ( globalProblemsCount ) , warningMessage ) ) ; } else { printErr ( this . main . bind ( "<STR_LIT>" , String . valueOf ( globalProblemsCount ) , errorMessage ) ) ; } } else { printErr ( this . main . bind ( "<STR_LIT>" , new String [ ] { String . valueOf ( globalProblemsCount ) , errorMessage , warningMessage } ) ) ; } } if ( ( this . tagBits & Logger . EMACS ) != <NUM_LIT:0> ) { this . printlnErr ( ) ; } } public void logProgress ( ) { printOut ( '<CHAR_LIT:.>' ) ; } public void logRepetition ( int i , int repetitions ) { printlnOut ( this . main . bind ( "<STR_LIT>" , String . valueOf ( i + <NUM_LIT:1> ) , String . valueOf ( repetitions ) ) ) ; } public void logTiming ( CompilerStats compilerStats ) { long time = compilerStats . elapsedTime ( ) ; long lineCount = compilerStats . lineCount ; if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . VALUE , new Long ( time ) ) ; printTag ( Logger . TIME , this . parameters , true , true ) ; this . parameters . put ( Logger . VALUE , new Long ( lineCount ) ) ; printTag ( Logger . NUMBER_OF_LINES , this . parameters , true , true ) ; } if ( lineCount != <NUM_LIT:0> ) { printlnOut ( this . main . bind ( "<STR_LIT>" , new String [ ] { String . valueOf ( lineCount ) , String . valueOf ( time ) , String . valueOf ( ( ( int ) ( lineCount * <NUM_LIT> / time ) ) / <NUM_LIT> ) , } ) ) ; } else { printlnOut ( this . main . bind ( "<STR_LIT>" , new String [ ] { String . valueOf ( time ) , } ) ) ; } if ( ( this . main . timing & Main . TIMING_DETAILED ) != <NUM_LIT:0> ) { printlnOut ( this . main . bind ( "<STR_LIT>" , new String [ ] { String . valueOf ( compilerStats . parseTime ) , String . valueOf ( ( ( int ) ( compilerStats . parseTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , String . valueOf ( compilerStats . resolveTime ) , String . valueOf ( ( ( int ) ( compilerStats . resolveTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , String . valueOf ( compilerStats . analyzeTime ) , String . valueOf ( ( ( int ) ( compilerStats . analyzeTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , String . valueOf ( compilerStats . generateTime ) , String . valueOf ( ( ( int ) ( compilerStats . generateTime * <NUM_LIT> / time ) ) / <NUM_LIT> ) , } ) ) ; } } public void logUsage ( String usage ) { printlnOut ( usage ) ; } public void logVersion ( final boolean printToOut ) { if ( this . log != null && ( this . tagBits & Logger . XML ) == <NUM_LIT:0> ) { final String version = this . main . bind ( "<STR_LIT>" , new String [ ] { this . main . bind ( "<STR_LIT>" ) , this . main . bind ( "<STR_LIT>" ) , this . main . bind ( "<STR_LIT>" ) } ) ; this . log . println ( "<STR_LIT>" + version ) ; if ( printToOut ) { this . out . println ( version ) ; this . out . flush ( ) ; } } else if ( printToOut ) { final String version = this . main . bind ( "<STR_LIT>" , new String [ ] { this . main . bind ( "<STR_LIT>" ) , this . main . bind ( "<STR_LIT>" ) , this . main . bind ( "<STR_LIT>" ) } ) ; this . out . println ( version ) ; this . out . flush ( ) ; } } public void logWrongJDK ( ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . MESSAGE , this . main . bind ( "<STR_LIT>" ) ) ; printTag ( Logger . ERROR , this . parameters , true , true ) ; } this . printlnErr ( this . main . bind ( "<STR_LIT>" ) ) ; } private void logXmlExtraProblem ( CategorizedProblem problem , int globalErrorCount , int localErrorCount ) { final int sourceStart = problem . getSourceStart ( ) ; final int sourceEnd = problem . getSourceEnd ( ) ; boolean isError = problem . isError ( ) ; this . parameters . put ( Logger . PROBLEM_SEVERITY , isError ? Logger . ERROR : Logger . WARNING ) ; this . parameters . put ( Logger . PROBLEM_LINE , new Integer ( problem . getSourceLineNumber ( ) ) ) ; this . parameters . put ( Logger . PROBLEM_SOURCE_START , new Integer ( sourceStart ) ) ; this . parameters . put ( Logger . PROBLEM_SOURCE_END , new Integer ( sourceEnd ) ) ; printTag ( Logger . EXTRA_PROBLEM_TAG , this . parameters , true , false ) ; this . parameters . put ( Logger . VALUE , problem . getMessage ( ) ) ; printTag ( Logger . PROBLEM_MESSAGE , this . parameters , true , true ) ; extractContext ( problem , null ) ; endTag ( Logger . EXTRA_PROBLEM_TAG ) ; } private void logXmlProblem ( CategorizedProblem problem , char [ ] unitSource ) { final int sourceStart = problem . getSourceStart ( ) ; final int sourceEnd = problem . getSourceEnd ( ) ; final int id = problem . getID ( ) ; this . parameters . put ( Logger . ID , getFieldName ( id ) ) ; this . parameters . put ( Logger . PROBLEM_ID , new Integer ( id ) ) ; boolean isError = problem . isError ( ) ; int severity = isError ? ProblemSeverities . Error : ProblemSeverities . Warning ; this . parameters . put ( Logger . PROBLEM_SEVERITY , isError ? Logger . ERROR : Logger . WARNING ) ; this . parameters . put ( Logger . PROBLEM_LINE , new Integer ( problem . getSourceLineNumber ( ) ) ) ; this . parameters . put ( Logger . PROBLEM_SOURCE_START , new Integer ( sourceStart ) ) ; this . parameters . put ( Logger . PROBLEM_SOURCE_END , new Integer ( sourceEnd ) ) ; String problemOptionKey = getProblemOptionKey ( id ) ; if ( problemOptionKey != null ) { this . parameters . put ( Logger . PROBLEM_OPTION_KEY , problemOptionKey ) ; } int categoryID = ProblemReporter . getProblemCategory ( severity , id ) ; this . parameters . put ( Logger . PROBLEM_CATEGORY_ID , new Integer ( categoryID ) ) ; printTag ( Logger . PROBLEM_TAG , this . parameters , true , false ) ; this . parameters . put ( Logger . VALUE , problem . getMessage ( ) ) ; printTag ( Logger . PROBLEM_MESSAGE , this . parameters , true , true ) ; extractContext ( problem , unitSource ) ; String [ ] arguments = problem . getArguments ( ) ; final int length = arguments . length ; if ( length != <NUM_LIT:0> ) { printTag ( Logger . PROBLEM_ARGUMENTS , null , true , false ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . parameters . put ( Logger . PROBLEM_ARGUMENT_VALUE , arguments [ i ] ) ; printTag ( Logger . PROBLEM_ARGUMENT , this . parameters , true , true ) ; } endTag ( Logger . PROBLEM_ARGUMENTS ) ; } endTag ( Logger . PROBLEM_TAG ) ; } private void logXmlTask ( CategorizedProblem problem , char [ ] unitSource ) { this . parameters . put ( Logger . PROBLEM_LINE , new Integer ( problem . getSourceLineNumber ( ) ) ) ; this . parameters . put ( Logger . PROBLEM_SOURCE_START , new Integer ( problem . getSourceStart ( ) ) ) ; this . parameters . put ( Logger . PROBLEM_SOURCE_END , new Integer ( problem . getSourceEnd ( ) ) ) ; String problemOptionKey = getProblemOptionKey ( problem . getID ( ) ) ; if ( problemOptionKey != null ) { this . parameters . put ( Logger . PROBLEM_OPTION_KEY , problemOptionKey ) ; } printTag ( Logger . TASK , this . parameters , true , false ) ; this . parameters . put ( Logger . VALUE , problem . getMessage ( ) ) ; printTag ( Logger . PROBLEM_MESSAGE , this . parameters , true , true ) ; extractContext ( problem , unitSource ) ; endTag ( Logger . TASK ) ; } private void printErr ( String s ) { this . err . print ( s ) ; if ( ( this . tagBits & Logger . XML ) == <NUM_LIT:0> && this . log != null ) { this . log . print ( s ) ; } } private void printlnErr ( ) { this . err . println ( ) ; if ( ( this . tagBits & Logger . XML ) == <NUM_LIT:0> && this . log != null ) { this . log . println ( ) ; } } private void printlnErr ( String s ) { this . err . println ( s ) ; if ( ( this . tagBits & Logger . XML ) == <NUM_LIT:0> && this . log != null ) { this . log . println ( s ) ; } } private void printlnOut ( String s ) { this . out . println ( s ) ; if ( ( this . tagBits & Logger . XML ) == <NUM_LIT:0> && this . log != null ) { this . log . println ( s ) ; } } public void printNewLine ( ) { this . out . println ( ) ; } private void printOut ( char c ) { this . out . print ( c ) ; } public void printStats ( ) { final boolean isTimed = ( this . main . timing & TIMING_ENABLED ) != <NUM_LIT:0> ; if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { printTag ( Logger . STATS , null , true , false ) ; } if ( isTimed ) { CompilerStats compilerStats = this . main . batchCompiler . stats ; compilerStats . startTime = this . main . startTime ; compilerStats . endTime = System . currentTimeMillis ( ) ; logTiming ( compilerStats ) ; } if ( this . main . globalProblemsCount > <NUM_LIT:0> ) { logProblemsSummary ( this . main . globalProblemsCount , this . main . globalErrorsCount , this . main . globalWarningsCount , this . main . globalTasksCount ) ; } if ( this . main . exportedClassFilesCounter != <NUM_LIT:0> && ( this . main . showProgress || isTimed || this . main . verbose ) ) { logNumberOfClassFilesGenerated ( this . main . exportedClassFilesCounter ) ; } if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { endTag ( Logger . STATS ) ; } } private void printTag ( String name , HashMap params , boolean insertNewLine , boolean closeTag ) { if ( this . log != null ) { ( ( GenericXMLWriter ) this . log ) . printTag ( name , this . parameters , true , insertNewLine , closeTag ) ; } this . parameters . clear ( ) ; } public void setEmacs ( ) { this . tagBits |= Logger . EMACS ; } public void setLog ( String logFileName ) { final Date date = new Date ( ) ; final DateFormat dateFormat = DateFormat . getDateTimeInstance ( DateFormat . SHORT , DateFormat . LONG , Locale . getDefault ( ) ) ; try { int index = logFileName . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( index != - <NUM_LIT:1> ) { if ( logFileName . substring ( index ) . toLowerCase ( ) . equals ( "<STR_LIT>" ) ) { this . log = new GenericXMLWriter ( new OutputStreamWriter ( new FileOutputStream ( logFileName , false ) , Util . UTF_8 ) , Util . LINE_SEPARATOR , true ) ; this . tagBits |= Logger . XML ; this . log . println ( "<STR_LIT>" + dateFormat . format ( date ) + "<STR_LIT>" ) ; this . log . println ( Logger . XML_DTD_DECLARATION ) ; this . parameters . put ( Logger . COMPILER_NAME , this . main . bind ( "<STR_LIT>" ) ) ; this . parameters . put ( Logger . COMPILER_VERSION , this . main . bind ( "<STR_LIT>" ) ) ; this . parameters . put ( Logger . COMPILER_COPYRIGHT , this . main . bind ( "<STR_LIT>" ) ) ; printTag ( Logger . COMPILER , this . parameters , true , false ) ; } else { this . log = new PrintWriter ( new FileOutputStream ( logFileName , false ) ) ; this . log . println ( "<STR_LIT>" + dateFormat . format ( date ) ) ; } } else { this . log = new PrintWriter ( new FileOutputStream ( logFileName , false ) ) ; this . log . println ( "<STR_LIT>" + dateFormat . format ( date ) ) ; } } catch ( FileNotFoundException e ) { throw new IllegalArgumentException ( this . main . bind ( "<STR_LIT>" , logFileName ) ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalArgumentException ( this . main . bind ( "<STR_LIT>" , logFileName ) ) ; } } private void startLoggingExtraProblems ( int count ) { this . parameters . put ( Logger . NUMBER_OF_PROBLEMS , new Integer ( count ) ) ; printTag ( Logger . EXTRA_PROBLEMS , this . parameters , true , false ) ; } private void startLoggingProblems ( int errors , int warnings ) { this . parameters . put ( Logger . NUMBER_OF_PROBLEMS , new Integer ( errors + warnings ) ) ; this . parameters . put ( Logger . NUMBER_OF_ERRORS , new Integer ( errors ) ) ; this . parameters . put ( Logger . NUMBER_OF_WARNINGS , new Integer ( warnings ) ) ; printTag ( Logger . PROBLEMS , this . parameters , true , false ) ; } public void startLoggingSource ( CompilationResult compilationResult ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { ICompilationUnit compilationUnit = compilationResult . compilationUnit ; if ( compilationUnit != null ) { char [ ] fileName = compilationUnit . getFileName ( ) ; File f = new File ( new String ( fileName ) ) ; if ( fileName != null ) { this . parameters . put ( Logger . PATH , f . getAbsolutePath ( ) ) ; } char [ ] [ ] packageName = compilationResult . packageName ; if ( packageName != null ) { this . parameters . put ( Logger . PACKAGE , new String ( CharOperation . concatWith ( packageName , File . separatorChar ) ) ) ; } CompilationUnit unit = ( CompilationUnit ) compilationUnit ; String destinationPath = unit . destinationPath ; if ( destinationPath == null ) { destinationPath = this . main . destinationPath ; } if ( destinationPath != null && destinationPath != NONE ) { if ( File . separatorChar == '<CHAR_LIT:/>' ) { this . parameters . put ( Logger . OUTPUT , destinationPath ) ; } else { this . parameters . put ( Logger . OUTPUT , destinationPath . replace ( '<CHAR_LIT:/>' , File . separatorChar ) ) ; } } } printTag ( Logger . SOURCE , this . parameters , true , false ) ; } } public void startLoggingSources ( ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { printTag ( Logger . SOURCES , null , true , false ) ; } } public void startLoggingTasks ( int tasks ) { if ( ( this . tagBits & Logger . XML ) != <NUM_LIT:0> ) { this . parameters . put ( Logger . NUMBER_OF_TASKS , new Integer ( tasks ) ) ; printTag ( Logger . TASKS , this . parameters , true , false ) ; } } } public static class ResourceBundleFactory { private static HashMap Cache = new HashMap ( ) ; public static synchronized ResourceBundle getBundle ( Locale locale ) { ResourceBundle bundle = ( ResourceBundle ) Cache . get ( locale ) ; if ( bundle == null ) { bundle = ResourceBundle . getBundle ( Main . bundleName , locale ) ; Cache . put ( locale , bundle ) ; } return bundle ; } } boolean enableJavadocOn ; boolean warnJavadocOn ; boolean warnAllJavadocOn ; public Compiler batchCompiler ; public ResourceBundle bundle ; protected FileSystem . Classpath [ ] checkedClasspaths ; public Locale compilerLocale ; public CompilerOptions compilerOptions ; public CompilationProgress progress ; public String destinationPath ; public String [ ] destinationPaths ; private boolean didSpecifySource ; private boolean didSpecifyTarget ; public String [ ] encodings ; public int exportedClassFilesCounter ; public String [ ] filenames ; public String [ ] classNames ; public int globalErrorsCount ; public int globalProblemsCount ; public int globalTasksCount ; public int globalWarningsCount ; private File javaHomeCache ; private boolean javaHomeChecked = false ; public long lineCount0 ; public String log ; public Logger logger ; public int maxProblems ; public Map options ; public char [ ] [ ] ignoreOptionalProblemsFromFolders ; protected PrintWriter out ; public boolean proceed = true ; public boolean proceedOnError = false ; public boolean produceRefInfo = false ; public int currentRepetition , maxRepetition ; public boolean showProgress = false ; public long startTime ; public ArrayList pendingErrors ; public boolean systemExitWhenFinished = true ; public static final int TIMING_DISABLED = <NUM_LIT:0> ; public static final int TIMING_ENABLED = <NUM_LIT:1> ; public static final int TIMING_DETAILED = <NUM_LIT:2> ; public int timing = TIMING_DISABLED ; public CompilerStats [ ] compilerStats ; public boolean verbose = false ; private String [ ] expandedCommandLine ; private PrintWriter err ; protected ArrayList extraProblems ; public final static String bundleName = "<STR_LIT>" ; public static final int DEFAULT_SIZE_CLASSPATH = <NUM_LIT:4> ; public static final String NONE = "<STR_LIT:none>" ; public static boolean compile ( String commandLine ) { return new Main ( new PrintWriter ( System . out ) , new PrintWriter ( System . err ) , false , null , null ) . compile ( tokenize ( commandLine ) ) ; } public static boolean compile ( String commandLine , PrintWriter outWriter , PrintWriter errWriter ) { return new Main ( outWriter , errWriter , false , null , null ) . compile ( tokenize ( commandLine ) ) ; } public static boolean compile ( String [ ] commandLineArguments , PrintWriter outWriter , PrintWriter errWriter , CompilationProgress progress ) { return new Main ( outWriter , errWriter , false , null , progress ) . compile ( commandLineArguments ) ; } public static File [ ] [ ] getLibrariesFiles ( File [ ] files ) { FilenameFilter filter = new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return Util . isPotentialZipArchive ( name ) ; } } ; final int filesLength = files . length ; File [ ] [ ] result = new File [ filesLength ] [ ] ; for ( int i = <NUM_LIT:0> ; i < filesLength ; i ++ ) { File currentFile = files [ i ] ; if ( currentFile . exists ( ) && currentFile . isDirectory ( ) ) { result [ i ] = currentFile . listFiles ( filter ) ; } } return result ; } public static void main ( String [ ] argv ) { new Main ( new PrintWriter ( System . out ) , new PrintWriter ( System . err ) , true , null , null ) . compile ( argv ) ; } public static String [ ] tokenize ( String commandLine ) { int count = <NUM_LIT:0> ; String [ ] arguments = new String [ <NUM_LIT:10> ] ; StringTokenizer tokenizer = new StringTokenizer ( commandLine , "<STR_LIT>" , true ) ; String token = Util . EMPTY_STRING ; boolean insideQuotes = false ; boolean startNewToken = true ; while ( tokenizer . hasMoreTokens ( ) ) { token = tokenizer . nextToken ( ) ; if ( token . equals ( "<STR_LIT:U+0020>" ) ) { if ( insideQuotes ) { arguments [ count - <NUM_LIT:1> ] += token ; startNewToken = false ; } else { startNewToken = true ; } } else if ( token . equals ( "<STR_LIT:\">" ) ) { if ( ! insideQuotes && startNewToken ) { if ( count == arguments . length ) System . arraycopy ( arguments , <NUM_LIT:0> , ( arguments = new String [ count * <NUM_LIT:2> ] ) , <NUM_LIT:0> , count ) ; arguments [ count ++ ] = Util . EMPTY_STRING ; } insideQuotes = ! insideQuotes ; startNewToken = false ; } else { if ( insideQuotes ) { arguments [ count - <NUM_LIT:1> ] += token ; } else { if ( token . length ( ) > <NUM_LIT:0> && ! startNewToken ) { arguments [ count - <NUM_LIT:1> ] += token ; } else { if ( count == arguments . length ) System . arraycopy ( arguments , <NUM_LIT:0> , ( arguments = new String [ count * <NUM_LIT:2> ] ) , <NUM_LIT:0> , count ) ; String trimmedToken = token . trim ( ) ; if ( trimmedToken . length ( ) != <NUM_LIT:0> ) { arguments [ count ++ ] = trimmedToken ; } } } startNewToken = false ; } } System . arraycopy ( arguments , <NUM_LIT:0> , arguments = new String [ count ] , <NUM_LIT:0> , count ) ; return arguments ; } public Main ( PrintWriter outWriter , PrintWriter errWriter , boolean systemExitWhenFinished ) { this ( outWriter , errWriter , systemExitWhenFinished , null , null ) ; } public Main ( PrintWriter outWriter , PrintWriter errWriter , boolean systemExitWhenFinished , Map customDefaultOptions ) { this ( outWriter , errWriter , systemExitWhenFinished , customDefaultOptions , null ) ; } public Main ( PrintWriter outWriter , PrintWriter errWriter , boolean systemExitWhenFinished , Map customDefaultOptions , CompilationProgress compilationProgress ) { this . initialize ( outWriter , errWriter , systemExitWhenFinished , customDefaultOptions , compilationProgress ) ; this . relocalize ( ) ; } public void addExtraProblems ( CategorizedProblem problem ) { if ( this . extraProblems == null ) { this . extraProblems = new ArrayList ( ) ; } this . extraProblems . add ( problem ) ; } protected void addNewEntry ( ArrayList paths , String currentClasspathName , ArrayList currentRuleSpecs , String customEncoding , String destPath , boolean isSourceOnly , boolean rejectDestinationPathOnJars ) { int rulesSpecsSize = currentRuleSpecs . size ( ) ; AccessRuleSet accessRuleSet = null ; if ( rulesSpecsSize != <NUM_LIT:0> ) { AccessRule [ ] accessRules = new AccessRule [ currentRuleSpecs . size ( ) ] ; boolean rulesOK = true ; Iterator i = currentRuleSpecs . iterator ( ) ; int j = <NUM_LIT:0> ; while ( i . hasNext ( ) ) { String ruleSpec = ( String ) i . next ( ) ; char key = ruleSpec . charAt ( <NUM_LIT:0> ) ; String pattern = ruleSpec . substring ( <NUM_LIT:1> ) ; if ( pattern . length ( ) > <NUM_LIT:0> ) { switch ( key ) { case '<CHAR_LIT>' : accessRules [ j ++ ] = new AccessRule ( pattern . toCharArray ( ) , <NUM_LIT:0> ) ; break ; case '<CHAR_LIT>' : accessRules [ j ++ ] = new AccessRule ( pattern . toCharArray ( ) , IProblem . DiscouragedReference ) ; break ; case '<CHAR_LIT:->' : accessRules [ j ++ ] = new AccessRule ( pattern . toCharArray ( ) , IProblem . ForbiddenReference ) ; break ; case '<CHAR_LIT>' : accessRules [ j ++ ] = new AccessRule ( pattern . toCharArray ( ) , IProblem . ForbiddenReference , true ) ; break ; default : rulesOK = false ; } } else { rulesOK = false ; } } if ( rulesOK ) { accessRuleSet = new AccessRuleSet ( accessRules , AccessRestriction . COMMAND_LINE , currentClasspathName ) ; } else { if ( currentClasspathName . length ( ) != <NUM_LIT:0> ) { addPendingErrors ( this . bind ( "<STR_LIT>" , currentClasspathName ) ) ; } return ; } } if ( NONE . equals ( destPath ) ) { destPath = NONE ; } if ( rejectDestinationPathOnJars && destPath != null && Util . isPotentialZipArchive ( currentClasspathName ) ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentClasspathName ) ) ; } FileSystem . Classpath currentClasspath = FileSystem . getClasspath ( currentClasspathName , customEncoding , isSourceOnly , accessRuleSet , destPath ) ; if ( currentClasspath != null ) { paths . add ( currentClasspath ) ; } else if ( currentClasspathName . length ( ) != <NUM_LIT:0> ) { addPendingErrors ( this . bind ( "<STR_LIT>" , currentClasspathName ) ) ; } } void addPendingErrors ( String message ) { if ( this . pendingErrors == null ) { this . pendingErrors = new ArrayList ( ) ; } this . pendingErrors . add ( message ) ; } public String bind ( String id ) { return bind ( id , ( String [ ] ) null ) ; } public String bind ( String id , String binding ) { return bind ( id , new String [ ] { binding } ) ; } public String bind ( String id , String binding1 , String binding2 ) { return bind ( id , new String [ ] { binding1 , binding2 } ) ; } public String bind ( String id , String [ ] arguments ) { if ( id == null ) return "<STR_LIT>" ; String message = null ; try { message = this . bundle . getString ( id ) ; } catch ( MissingResourceException e ) { return "<STR_LIT>" + id + "<STR_LIT>" + Main . bundleName ; } return MessageFormat . format ( message , arguments ) ; } private boolean checkVMVersion ( long minimalSupportedVersion ) { String classFileVersion = System . getProperty ( "<STR_LIT>" ) ; if ( classFileVersion == null ) { return false ; } int index = classFileVersion . indexOf ( '<CHAR_LIT:.>' ) ; if ( index == - <NUM_LIT:1> ) { return false ; } int majorVersion ; try { majorVersion = Integer . parseInt ( classFileVersion . substring ( <NUM_LIT:0> , index ) ) ; } catch ( NumberFormatException e ) { return false ; } switch ( majorVersion ) { case <NUM_LIT> : return ClassFileConstants . JDK1_1 >= minimalSupportedVersion ; case <NUM_LIT> : return ClassFileConstants . JDK1_2 >= minimalSupportedVersion ; case <NUM_LIT> : return ClassFileConstants . JDK1_3 >= minimalSupportedVersion ; case <NUM_LIT> : return ClassFileConstants . JDK1_4 >= minimalSupportedVersion ; case <NUM_LIT> : return ClassFileConstants . JDK1_5 >= minimalSupportedVersion ; case <NUM_LIT> : return ClassFileConstants . JDK1_6 >= minimalSupportedVersion ; case <NUM_LIT> : return ClassFileConstants . JDK1_7 >= minimalSupportedVersion ; } return false ; } public boolean compile ( String [ ] argv ) { try { configure ( argv ) ; if ( this . progress != null ) this . progress . begin ( this . filenames == null ? <NUM_LIT:0> : this . filenames . length * this . maxRepetition ) ; if ( this . proceed ) { if ( this . showProgress ) this . logger . compiling ( ) ; for ( this . currentRepetition = <NUM_LIT:0> ; this . currentRepetition < this . maxRepetition ; this . currentRepetition ++ ) { this . globalProblemsCount = <NUM_LIT:0> ; this . globalErrorsCount = <NUM_LIT:0> ; this . globalWarningsCount = <NUM_LIT:0> ; this . globalTasksCount = <NUM_LIT:0> ; this . exportedClassFilesCounter = <NUM_LIT:0> ; if ( this . maxRepetition > <NUM_LIT:1> ) { this . logger . flush ( ) ; this . logger . logRepetition ( this . currentRepetition , this . maxRepetition ) ; } performCompilation ( ) ; } if ( this . compilerStats != null ) { this . logger . logAverage ( ) ; } if ( this . showProgress ) this . logger . printNewLine ( ) ; } if ( this . systemExitWhenFinished ) { this . logger . flush ( ) ; this . logger . close ( ) ; System . exit ( this . globalErrorsCount > <NUM_LIT:0> ? - <NUM_LIT:1> : <NUM_LIT:0> ) ; } } catch ( IllegalArgumentException e ) { this . logger . logException ( e ) ; if ( this . systemExitWhenFinished ) { this . logger . flush ( ) ; this . logger . close ( ) ; System . exit ( - <NUM_LIT:1> ) ; } return false ; } catch ( RuntimeException e ) { this . logger . logException ( e ) ; if ( this . systemExitWhenFinished ) { this . logger . flush ( ) ; this . logger . close ( ) ; System . exit ( - <NUM_LIT:1> ) ; } return false ; } finally { this . logger . flush ( ) ; this . logger . close ( ) ; if ( this . progress != null ) this . progress . done ( ) ; } if ( this . globalErrorsCount == <NUM_LIT:0> && ( this . progress == null || ! this . progress . isCanceled ( ) ) ) return true ; return false ; } public void configure ( String [ ] argv ) { if ( ( argv == null ) || ( argv . length == <NUM_LIT:0> ) ) { printUsage ( ) ; return ; } final int INSIDE_CLASSPATH_start = <NUM_LIT:1> ; final int INSIDE_DESTINATION_PATH = <NUM_LIT:3> ; final int INSIDE_TARGET = <NUM_LIT:4> ; final int INSIDE_LOG = <NUM_LIT:5> ; final int INSIDE_REPETITION = <NUM_LIT:6> ; final int INSIDE_SOURCE = <NUM_LIT:7> ; final int INSIDE_DEFAULT_ENCODING = <NUM_LIT:8> ; final int INSIDE_BOOTCLASSPATH_start = <NUM_LIT:9> ; final int INSIDE_MAX_PROBLEMS = <NUM_LIT:11> ; final int INSIDE_EXT_DIRS = <NUM_LIT:12> ; final int INSIDE_SOURCE_PATH_start = <NUM_LIT> ; final int INSIDE_ENDORSED_DIRS = <NUM_LIT:15> ; final int INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH = <NUM_LIT:16> ; final int INSIDE_PROCESSOR_PATH_start = <NUM_LIT> ; final int INSIDE_PROCESSOR_start = <NUM_LIT> ; final int INSIDE_S_start = <NUM_LIT> ; final int INSIDE_CLASS_NAMES = <NUM_LIT:20> ; final int INSIDE_WARNINGS_PROPERTIES = <NUM_LIT> ; final int DEFAULT = <NUM_LIT:0> ; ArrayList bootclasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; String sourcepathClasspathArg = null ; ArrayList sourcepathClasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; ArrayList classpaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; ArrayList extdirsClasspaths = null ; ArrayList endorsedDirClasspaths = null ; int index = - <NUM_LIT:1> ; int filesCount = <NUM_LIT:0> ; int classCount = <NUM_LIT:0> ; int argCount = argv . length ; int mode = DEFAULT ; this . maxRepetition = <NUM_LIT:0> ; boolean printUsageRequired = false ; String usageSection = null ; boolean printVersionRequired = false ; boolean didSpecifyDeprecation = false ; boolean didSpecifyCompliance = false ; boolean didSpecifyDisabledAnnotationProcessing = false ; boolean encounteredGroovySourceFile = false ; String customEncoding = null ; String customDestinationPath = null ; String currentSourceDirectory = null ; String currentArg = Util . EMPTY_STRING ; Set specifiedEncodings = null ; boolean needExpansion = false ; loop : for ( int i = <NUM_LIT:0> ; i < argCount ; i ++ ) { if ( argv [ i ] . startsWith ( "<STR_LIT:@>" ) ) { needExpansion = true ; break loop ; } } String [ ] newCommandLineArgs = null ; if ( needExpansion ) { newCommandLineArgs = new String [ argCount ] ; index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < argCount ; i ++ ) { String [ ] newArgs = null ; String arg = argv [ i ] . trim ( ) ; if ( arg . startsWith ( "<STR_LIT:@>" ) ) { try { LineNumberReader reader = new LineNumberReader ( new StringReader ( new String ( Util . getFileCharContent ( new File ( arg . substring ( <NUM_LIT:1> ) ) , null ) ) ) ) ; StringBuffer buffer = new StringBuffer ( ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( ! line . startsWith ( "<STR_LIT:#>" ) ) { buffer . append ( line ) . append ( "<STR_LIT:U+0020>" ) ; } } newArgs = tokenize ( buffer . toString ( ) ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , arg ) ) ; } } if ( newArgs != null ) { int newCommandLineArgsLength = newCommandLineArgs . length ; int newArgsLength = newArgs . length ; System . arraycopy ( newCommandLineArgs , <NUM_LIT:0> , ( newCommandLineArgs = new String [ newCommandLineArgsLength + newArgsLength - <NUM_LIT:1> ] ) , <NUM_LIT:0> , index ) ; System . arraycopy ( newArgs , <NUM_LIT:0> , newCommandLineArgs , index , newArgsLength ) ; index += newArgsLength ; } else { newCommandLineArgs [ index ++ ] = arg ; } } index = - <NUM_LIT:1> ; } else { newCommandLineArgs = argv ; for ( int i = <NUM_LIT:0> ; i < argCount ; i ++ ) { newCommandLineArgs [ i ] = newCommandLineArgs [ i ] . trim ( ) ; } } argCount = newCommandLineArgs . length ; this . expandedCommandLine = newCommandLineArgs ; while ( ++ index < argCount ) { if ( customEncoding != null ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg , customEncoding ) ) ; } currentArg = newCommandLineArgs [ index ] ; switch ( mode ) { case DEFAULT : if ( currentArg . startsWith ( "<STR_LIT>" ) ) { switch ( currentArg . length ( ) ) { case <NUM_LIT:7> : disableAll ( ProblemSeverities . Warning ) ; break ; case <NUM_LIT:8> : throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; default : int foldersStart = currentArg . indexOf ( '<CHAR_LIT:[>' ) + <NUM_LIT:1> ; int foldersEnd = currentArg . lastIndexOf ( '<CHAR_LIT:]>' ) ; if ( foldersStart <= <NUM_LIT:8> || foldersEnd == - <NUM_LIT:1> || foldersStart > foldersEnd || foldersEnd < currentArg . length ( ) - <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } String folders = currentArg . substring ( foldersStart , foldersEnd ) ; if ( folders . length ( ) > <NUM_LIT:0> ) { char [ ] [ ] currentFolders = decodeIgnoreOptionalProblemsFromFolders ( folders ) ; if ( this . ignoreOptionalProblemsFromFolders != null ) { int length = this . ignoreOptionalProblemsFromFolders . length + currentFolders . length ; char [ ] [ ] tempFolders = new char [ length ] [ ] ; System . arraycopy ( this . ignoreOptionalProblemsFromFolders , <NUM_LIT:0> , tempFolders , <NUM_LIT:0> , this . ignoreOptionalProblemsFromFolders . length ) ; System . arraycopy ( currentFolders , <NUM_LIT:0> , tempFolders , this . ignoreOptionalProblemsFromFolders . length , currentFolders . length ) ; this . ignoreOptionalProblemsFromFolders = tempFolders ; } else { this . ignoreOptionalProblemsFromFolders = currentFolders ; } } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } } mode = DEFAULT ; continue ; } if ( currentArg . startsWith ( "<STR_LIT:[>" ) ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } if ( currentArg . endsWith ( "<STR_LIT:]>" ) ) { int encodingStart = currentArg . indexOf ( '<CHAR_LIT:[>' ) + <NUM_LIT:1> ; if ( encodingStart <= <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } int encodingEnd = currentArg . length ( ) - <NUM_LIT:1> ; if ( encodingStart >= <NUM_LIT:1> ) { if ( encodingStart < encodingEnd ) { customEncoding = currentArg . substring ( encodingStart , encodingEnd ) ; try { new InputStreamReader ( new ByteArrayInputStream ( new byte [ <NUM_LIT:0> ] ) , customEncoding ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , customEncoding ) ) ; } } currentArg = currentArg . substring ( <NUM_LIT:0> , encodingStart - <NUM_LIT:1> ) ; } } if ( currentArg . endsWith ( SuffixConstants . SUFFIX_STRING_java ) || currentArg . endsWith ( "<STR_LIT>" ) ) { if ( currentArg . endsWith ( "<STR_LIT>" ) ) { encounteredGroovySourceFile = true ; } if ( this . filenames == null ) { this . filenames = new String [ argCount - index ] ; this . encodings = new String [ argCount - index ] ; this . destinationPaths = new String [ argCount - index ] ; } else if ( filesCount == this . filenames . length ) { int length = this . filenames . length ; System . arraycopy ( this . filenames , <NUM_LIT:0> , ( this . filenames = new String [ length + argCount - index ] ) , <NUM_LIT:0> , length ) ; System . arraycopy ( this . encodings , <NUM_LIT:0> , ( this . encodings = new String [ length + argCount - index ] ) , <NUM_LIT:0> , length ) ; System . arraycopy ( this . destinationPaths , <NUM_LIT:0> , ( this . destinationPaths = new String [ length + argCount - index ] ) , <NUM_LIT:0> , length ) ; } this . filenames [ filesCount ] = currentArg ; this . encodings [ filesCount ++ ] = customEncoding ; customEncoding = null ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( this . log != null ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; mode = INSIDE_LOG ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( this . maxRepetition > <NUM_LIT:0> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; mode = INSIDE_REPETITION ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( this . maxProblems > <NUM_LIT:0> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; mode = INSIDE_MAX_PROBLEMS ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_SOURCE ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_DEFAULT_ENCODING ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( didSpecifyCompliance ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } didSpecifyCompliance = true ; this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_3 ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( didSpecifyCompliance ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } didSpecifyCompliance = true ; this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_4 ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { if ( didSpecifyCompliance ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } didSpecifyCompliance = true ; this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_5 ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { if ( didSpecifyCompliance ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } didSpecifyCompliance = true ; this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_6 ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { if ( didSpecifyCompliance ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } didSpecifyCompliance = true ; this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_7 ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( this . destinationPath != null ) { StringBuffer errorMessage = new StringBuffer ( ) ; errorMessage . append ( currentArg ) ; if ( ( index + <NUM_LIT:1> ) < argCount ) { errorMessage . append ( '<CHAR_LIT:U+0020>' ) ; errorMessage . append ( newCommandLineArgs [ index + <NUM_LIT:1> ] ) ; } throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , errorMessage . toString ( ) ) ) ; } mode = INSIDE_DESTINATION_PATH ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_CLASSPATH_start ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( bootclasspaths . size ( ) > <NUM_LIT:0> ) { StringBuffer errorMessage = new StringBuffer ( ) ; errorMessage . append ( currentArg ) ; if ( ( index + <NUM_LIT:1> ) < argCount ) { errorMessage . append ( '<CHAR_LIT:U+0020>' ) ; errorMessage . append ( newCommandLineArgs [ index + <NUM_LIT:1> ] ) ; } throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , errorMessage . toString ( ) ) ) ; } mode = INSIDE_BOOTCLASSPATH_start ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( sourcepathClasspathArg != null ) { StringBuffer errorMessage = new StringBuffer ( ) ; errorMessage . append ( currentArg ) ; if ( ( index + <NUM_LIT:1> ) < argCount ) { errorMessage . append ( '<CHAR_LIT:U+0020>' ) ; errorMessage . append ( newCommandLineArgs [ index + <NUM_LIT:1> ] ) ; } throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , errorMessage . toString ( ) ) ) ; } mode = INSIDE_SOURCE_PATH_start ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( extdirsClasspaths != null ) { StringBuffer errorMessage = new StringBuffer ( ) ; errorMessage . append ( currentArg ) ; if ( ( index + <NUM_LIT:1> ) < argCount ) { errorMessage . append ( '<CHAR_LIT:U+0020>' ) ; errorMessage . append ( newCommandLineArgs [ index + <NUM_LIT:1> ] ) ; } throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , errorMessage . toString ( ) ) ) ; } mode = INSIDE_EXT_DIRS ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { if ( endorsedDirClasspaths != null ) { StringBuffer errorMessage = new StringBuffer ( ) ; errorMessage . append ( currentArg ) ; if ( ( index + <NUM_LIT:1> ) < argCount ) { errorMessage . append ( '<CHAR_LIT:U+0020>' ) ; errorMessage . append ( newCommandLineArgs [ index + <NUM_LIT:1> ] ) ; } throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , errorMessage . toString ( ) ) ) ; } mode = INSIDE_ENDORSED_DIRS ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; this . showProgress = true ; continue ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; int length = currentArg . length ( ) ; if ( length > <NUM_LIT:15> ) { if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_FatalOptionalError , CompilerOptions . ENABLED ) ; } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } } else { this . options . put ( CompilerOptions . OPTION_FatalOptionalError , CompilerOptions . DISABLED ) ; } this . proceedOnError = true ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; this . timing = TIMING_ENABLED ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; this . timing = TIMING_ENABLED | TIMING_DETAILED ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . logger . logVersion ( true ) ; this . proceed = false ; return ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { printVersionRequired = true ; mode = DEFAULT ; continue ; } if ( "<STR_LIT>" . equals ( currentArg ) ) { didSpecifyDeprecation = true ; this . options . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . WARNING ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { printUsageRequired = true ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { printUsageRequired = true ; usageSection = "<STR_LIT>" ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { this . systemExitWhenFinished = false ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { this . verbose = true ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { this . produceRefInfo = true ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; this . options . put ( CompilerOptions . OPTION_InlineJsr , CompilerOptions . ENABLED ) ; continue ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; String debugOption = currentArg ; int length = currentArg . length ( ) ; if ( length == <NUM_LIT:2> ) { this . options . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . GENERATE ) ; this . options . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . GENERATE ) ; this . options . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . GENERATE ) ; continue ; } if ( length > <NUM_LIT:3> ) { this . options . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . options . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . options . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . DO_NOT_GENERATE ) ; if ( length == <NUM_LIT:7> && debugOption . equals ( "<STR_LIT>" + NONE ) ) continue ; StringTokenizer tokenizer = new StringTokenizer ( debugOption . substring ( <NUM_LIT:3> , debugOption . length ( ) ) , "<STR_LIT:U+002C>" ) ; while ( tokenizer . hasMoreTokens ( ) ) { String token = tokenizer . nextToken ( ) ; if ( token . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . GENERATE ) ; } else if ( token . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . GENERATE ) ; } else if ( token . equals ( "<STR_LIT:source>" ) ) { this . options . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . GENERATE ) ; } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , debugOption ) ) ; } } continue ; } throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , debugOption ) ) ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; String warningOption = currentArg ; int length = currentArg . length ( ) ; if ( length == <NUM_LIT:10> && warningOption . equals ( "<STR_LIT>" + NONE ) ) { disableAll ( ProblemSeverities . Warning ) ; continue ; } if ( length <= <NUM_LIT:6> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , warningOption ) ) ; } int warnTokenStart ; boolean isEnabling ; switch ( warningOption . charAt ( <NUM_LIT:6> ) ) { case '<CHAR_LIT>' : warnTokenStart = <NUM_LIT:7> ; isEnabling = true ; break ; case '<CHAR_LIT:->' : warnTokenStart = <NUM_LIT:7> ; isEnabling = false ; break ; default : disableAll ( ProblemSeverities . Warning ) ; warnTokenStart = <NUM_LIT:6> ; isEnabling = true ; } StringTokenizer tokenizer = new StringTokenizer ( warningOption . substring ( warnTokenStart , warningOption . length ( ) ) , "<STR_LIT:U+002C>" ) ; int tokenCounter = <NUM_LIT:0> ; if ( didSpecifyDeprecation ) { this . options . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . WARNING ) ; } while ( tokenizer . hasMoreTokens ( ) ) { String token = tokenizer . nextToken ( ) ; tokenCounter ++ ; switch ( token . charAt ( <NUM_LIT:0> ) ) { case '<CHAR_LIT>' : isEnabling = true ; token = token . substring ( <NUM_LIT:1> ) ; break ; case '<CHAR_LIT:->' : isEnabling = false ; token = token . substring ( <NUM_LIT:1> ) ; } handleWarningToken ( token , isEnabling ) ; } if ( tokenCounter == <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } continue ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; String errorOption = currentArg ; int length = currentArg . length ( ) ; if ( length <= <NUM_LIT:5> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , errorOption ) ) ; } int errorTokenStart ; boolean isEnabling ; switch ( errorOption . charAt ( <NUM_LIT:5> ) ) { case '<CHAR_LIT>' : errorTokenStart = <NUM_LIT:6> ; isEnabling = true ; break ; case '<CHAR_LIT:->' : errorTokenStart = <NUM_LIT:6> ; isEnabling = false ; break ; default : disableAll ( ProblemSeverities . Error ) ; errorTokenStart = <NUM_LIT:5> ; isEnabling = true ; } StringTokenizer tokenizer = new StringTokenizer ( errorOption . substring ( errorTokenStart , errorOption . length ( ) ) , "<STR_LIT:U+002C>" ) ; int tokenCounter = <NUM_LIT:0> ; while ( tokenizer . hasMoreTokens ( ) ) { String token = tokenizer . nextToken ( ) ; tokenCounter ++ ; switch ( token . charAt ( <NUM_LIT:0> ) ) { case '<CHAR_LIT>' : isEnabling = true ; token = token . substring ( <NUM_LIT:1> ) ; break ; case '<CHAR_LIT:->' : isEnabling = false ; token = token . substring ( <NUM_LIT:1> ) ; break ; } handleErrorToken ( token , isEnabling ) ; } if ( tokenCounter == <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_TARGET ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_PreserveUnusedLocal , CompilerOptions . PRESERVE ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; this . enableJavadocOn = true ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; this . logger . setEmacs ( ) ; continue ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_PROCESSOR_PATH_start ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_PROCESSOR_start ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_GenerateClassFiles , CompilerOptions . DISABLED ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { didSpecifyDisabledAnnotationProcessing = true ; this . options . put ( CompilerOptions . OPTION_Process_Annotations , CompilerOptions . DISABLED ) ; mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_S_start ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; continue ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; continue ; } if ( currentArg . startsWith ( "<STR_LIT>" ) ) { mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = DEFAULT ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_CLASS_NAMES ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { mode = INSIDE_WARNINGS_PROPERTIES ; continue ; } if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_ReportMissingNonNullByDefaultAnnotation , CompilerOptions . WARNING ) ; continue ; } break ; case INSIDE_TARGET : if ( this . didSpecifyTarget ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } this . didSpecifyTarget = true ; if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_1 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_2 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_3 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_4 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT:5>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_5 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT:6>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_6 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_7 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_JSR14 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_CLDC1_1 ) ; this . options . put ( CompilerOptions . OPTION_InlineJsr , CompilerOptions . ENABLED ) ; } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } mode = DEFAULT ; continue ; case INSIDE_LOG : this . log = currentArg ; mode = DEFAULT ; continue ; case INSIDE_REPETITION : try { this . maxRepetition = Integer . parseInt ( currentArg ) ; if ( this . maxRepetition <= <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } mode = DEFAULT ; continue ; case INSIDE_MAX_PROBLEMS : try { this . maxProblems = Integer . parseInt ( currentArg ) ; if ( this . maxProblems <= <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } this . options . put ( CompilerOptions . OPTION_MaxProblemPerUnit , currentArg ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } mode = DEFAULT ; continue ; case INSIDE_SOURCE : if ( this . didSpecifySource ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } this . didSpecifySource = true ; if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_3 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_4 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT:5>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_5 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT:6>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_6 ) ; } else if ( currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) || currentArg . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_7 ) ; } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } mode = DEFAULT ; continue ; case INSIDE_DEFAULT_ENCODING : if ( specifiedEncodings != null ) { if ( ! specifiedEncodings . contains ( currentArg ) ) { if ( specifiedEncodings . size ( ) > <NUM_LIT:1> ) { this . logger . logWarning ( this . bind ( "<STR_LIT>" , currentArg , getAllEncodings ( specifiedEncodings ) ) ) ; } else { this . logger . logWarning ( this . bind ( "<STR_LIT>" , currentArg , getAllEncodings ( specifiedEncodings ) ) ) ; } } } else { specifiedEncodings = new HashSet ( ) ; } try { new InputStreamReader ( new ByteArrayInputStream ( new byte [ <NUM_LIT:0> ] ) , currentArg ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } specifiedEncodings . add ( currentArg ) ; this . options . put ( CompilerOptions . OPTION_Encoding , currentArg ) ; mode = DEFAULT ; continue ; case INSIDE_DESTINATION_PATH : setDestinationPath ( currentArg . equals ( NONE ) ? NONE : currentArg ) ; mode = DEFAULT ; continue ; case INSIDE_CLASSPATH_start : mode = DEFAULT ; index += processPaths ( newCommandLineArgs , index , currentArg , classpaths ) ; continue ; case INSIDE_BOOTCLASSPATH_start : mode = DEFAULT ; index += processPaths ( newCommandLineArgs , index , currentArg , bootclasspaths ) ; continue ; case INSIDE_SOURCE_PATH_start : mode = DEFAULT ; String [ ] sourcePaths = new String [ <NUM_LIT:1> ] ; index += processPaths ( newCommandLineArgs , index , currentArg , sourcePaths ) ; sourcepathClasspathArg = sourcePaths [ <NUM_LIT:0> ] ; continue ; case INSIDE_EXT_DIRS : if ( currentArg . indexOf ( "<STR_LIT>" ) != - <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , "<STR_LIT>" ) ) ; } StringTokenizer tokenizer = new StringTokenizer ( currentArg , File . pathSeparator , false ) ; extdirsClasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; while ( tokenizer . hasMoreTokens ( ) ) extdirsClasspaths . add ( tokenizer . nextToken ( ) ) ; mode = DEFAULT ; continue ; case INSIDE_ENDORSED_DIRS : if ( currentArg . indexOf ( "<STR_LIT>" ) != - <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , "<STR_LIT>" ) ) ; } tokenizer = new StringTokenizer ( currentArg , File . pathSeparator , false ) ; endorsedDirClasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; while ( tokenizer . hasMoreTokens ( ) ) endorsedDirClasspaths . add ( tokenizer . nextToken ( ) ) ; mode = DEFAULT ; continue ; case INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH : if ( currentArg . endsWith ( "<STR_LIT:]>" ) ) { customDestinationPath = currentArg . substring ( <NUM_LIT:0> , currentArg . length ( ) - <NUM_LIT:1> ) ; } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , "<STR_LIT>" + currentArg ) ) ; } break ; case INSIDE_PROCESSOR_PATH_start : mode = DEFAULT ; continue ; case INSIDE_PROCESSOR_start : mode = DEFAULT ; continue ; case INSIDE_S_start : mode = DEFAULT ; continue ; case INSIDE_CLASS_NAMES : tokenizer = new StringTokenizer ( currentArg , "<STR_LIT:U+002C>" ) ; if ( this . classNames == null ) { this . classNames = new String [ DEFAULT_SIZE_CLASSPATH ] ; } while ( tokenizer . hasMoreTokens ( ) ) { if ( this . classNames . length == classCount ) { System . arraycopy ( this . classNames , <NUM_LIT:0> , ( this . classNames = new String [ classCount * <NUM_LIT:2> ] ) , <NUM_LIT:0> , classCount ) ; } this . classNames [ classCount ++ ] = tokenizer . nextToken ( ) ; } mode = DEFAULT ; continue ; case INSIDE_WARNINGS_PROPERTIES : initializeWarnings ( currentArg ) ; mode = DEFAULT ; continue ; } if ( customDestinationPath == null ) { if ( File . separatorChar != '<CHAR_LIT:/>' ) { currentArg = currentArg . replace ( '<CHAR_LIT:/>' , File . separatorChar ) ; } if ( currentArg . endsWith ( "<STR_LIT>" ) ) { currentSourceDirectory = currentArg . substring ( <NUM_LIT:0> , currentArg . length ( ) - <NUM_LIT:3> ) ; mode = INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH ; continue ; } currentSourceDirectory = currentArg ; } File dir = new File ( currentSourceDirectory ) ; if ( ! dir . isDirectory ( ) ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentSourceDirectory ) ) ; } String [ ] result = FileFinder . find ( dir , SuffixConstants . SUFFIX_STRING_JAVA ) ; if ( NONE . equals ( customDestinationPath ) ) { customDestinationPath = NONE ; } if ( this . filenames != null ) { int length = result . length ; System . arraycopy ( this . filenames , <NUM_LIT:0> , ( this . filenames = new String [ length + filesCount ] ) , <NUM_LIT:0> , filesCount ) ; System . arraycopy ( this . encodings , <NUM_LIT:0> , ( this . encodings = new String [ length + filesCount ] ) , <NUM_LIT:0> , filesCount ) ; System . arraycopy ( this . destinationPaths , <NUM_LIT:0> , ( this . destinationPaths = new String [ length + filesCount ] ) , <NUM_LIT:0> , filesCount ) ; System . arraycopy ( result , <NUM_LIT:0> , this . filenames , filesCount , length ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . encodings [ filesCount + i ] = customEncoding ; this . destinationPaths [ filesCount + i ] = customDestinationPath ; } filesCount += length ; customEncoding = null ; customDestinationPath = null ; currentSourceDirectory = null ; } else { this . filenames = result ; filesCount = this . filenames . length ; this . encodings = new String [ filesCount ] ; this . destinationPaths = new String [ filesCount ] ; for ( int i = <NUM_LIT:0> ; i < filesCount ; i ++ ) { this . encodings [ i ] = customEncoding ; this . destinationPaths [ i ] = customDestinationPath ; } customEncoding = null ; customDestinationPath = null ; currentSourceDirectory = null ; } mode = DEFAULT ; continue ; } if ( this . enableJavadocOn ) { this . options . put ( CompilerOptions . OPTION_DocCommentSupport , CompilerOptions . ENABLED ) ; } else if ( this . warnJavadocOn || this . warnAllJavadocOn ) { this . options . put ( CompilerOptions . OPTION_DocCommentSupport , CompilerOptions . ENABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportUnusedParameterIncludeDocCommentReference , CompilerOptions . DISABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportUnusedDeclaredThrownExceptionIncludeDocCommentReference , CompilerOptions . DISABLED ) ; } if ( this . warnJavadocOn ) { this . options . put ( CompilerOptions . OPTION_ReportInvalidJavadocTags , CompilerOptions . ENABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportInvalidJavadocTagsDeprecatedRef , CompilerOptions . ENABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportInvalidJavadocTagsNotVisibleRef , CompilerOptions . ENABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportMissingJavadocTagsVisibility , CompilerOptions . PRIVATE ) ; } if ( encounteredGroovySourceFile ) { this . options . put ( CompilerOptions . OPTIONG_BuildGroovyFiles , CompilerOptions . ENABLED ) ; } else { this . options . put ( CompilerOptions . OPTIONG_BuildGroovyFiles , CompilerOptions . DISABLED ) ; } if ( printUsageRequired || ( filesCount == <NUM_LIT:0> && classCount == <NUM_LIT:0> ) ) { if ( usageSection == null ) { printUsage ( ) ; } else { printUsage ( usageSection ) ; } this . proceed = false ; return ; } if ( this . log != null ) { this . logger . setLog ( this . log ) ; } else { this . showProgress = false ; } this . logger . logVersion ( printVersionRequired ) ; validateOptions ( didSpecifyCompliance ) ; if ( ! didSpecifyDisabledAnnotationProcessing && CompilerOptions . versionToJdkLevel ( this . options . get ( CompilerOptions . OPTION_Compliance ) ) >= ClassFileConstants . JDK1_6 ) { this . options . put ( CompilerOptions . OPTION_Process_Annotations , CompilerOptions . ENABLED ) ; } this . logger . logCommandLineArguments ( newCommandLineArgs ) ; this . logger . logOptions ( this . options ) ; if ( this . maxRepetition == <NUM_LIT:0> ) { this . maxRepetition = <NUM_LIT:1> ; } if ( this . maxRepetition >= <NUM_LIT:3> && ( this . timing & TIMING_ENABLED ) != <NUM_LIT:0> ) { this . compilerStats = new CompilerStats [ this . maxRepetition ] ; } if ( filesCount != <NUM_LIT:0> ) { System . arraycopy ( this . filenames , <NUM_LIT:0> , ( this . filenames = new String [ filesCount ] ) , <NUM_LIT:0> , filesCount ) ; } if ( classCount != <NUM_LIT:0> ) { System . arraycopy ( this . classNames , <NUM_LIT:0> , ( this . classNames = new String [ classCount ] ) , <NUM_LIT:0> , classCount ) ; } setPaths ( bootclasspaths , sourcepathClasspathArg , sourcepathClasspaths , classpaths , extdirsClasspaths , endorsedDirClasspaths , customEncoding ) ; if ( specifiedEncodings != null && specifiedEncodings . size ( ) > <NUM_LIT:1> ) { this . logger . logWarning ( this . bind ( "<STR_LIT>" , ( String ) this . options . get ( CompilerOptions . OPTION_Encoding ) , getAllEncodings ( specifiedEncodings ) ) ) ; } if ( this . pendingErrors != null ) { for ( Iterator iterator = this . pendingErrors . iterator ( ) ; iterator . hasNext ( ) ; ) { String message = ( String ) iterator . next ( ) ; this . logger . logPendingError ( message ) ; } this . pendingErrors = null ; } } private static char [ ] [ ] decodeIgnoreOptionalProblemsFromFolders ( String folders ) { StringTokenizer tokenizer = new StringTokenizer ( folders , File . pathSeparator ) ; char [ ] [ ] result = new char [ tokenizer . countTokens ( ) ] [ ] ; int count = <NUM_LIT:0> ; while ( tokenizer . hasMoreTokens ( ) ) { String fileName = tokenizer . nextToken ( ) ; File file = new File ( fileName ) ; if ( file . exists ( ) ) { try { result [ count ++ ] = file . getCanonicalPath ( ) . toCharArray ( ) ; } catch ( IOException e ) { result [ count ++ ] = fileName . toCharArray ( ) ; } } else { result [ count ++ ] = fileName . toCharArray ( ) ; } } return result ; } private static String getAllEncodings ( Set encodings ) { int size = encodings . size ( ) ; String [ ] allEncodings = new String [ size ] ; encodings . toArray ( allEncodings ) ; Arrays . sort ( allEncodings ) ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } buffer . append ( allEncodings [ i ] ) ; } return String . valueOf ( buffer ) ; } private void initializeWarnings ( String propertiesFile ) { File file = new File ( propertiesFile ) ; if ( ! file . exists ( ) ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , propertiesFile ) ) ; } BufferedInputStream stream = null ; Properties properties = null ; try { stream = new BufferedInputStream ( new FileInputStream ( propertiesFile ) ) ; properties = new Properties ( ) ; properties . load ( stream ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , propertiesFile ) ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { } } } for ( Iterator iterator = properties . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; final String key = ( String ) entry . getKey ( ) ; if ( key . startsWith ( "<STR_LIT>" ) ) { this . options . put ( key , entry . getValue ( ) ) ; } } } protected void enableAll ( int severity ) { String newValue = null ; switch ( severity ) { case ProblemSeverities . Error : newValue = CompilerOptions . ERROR ; break ; case ProblemSeverities . Warning : newValue = CompilerOptions . WARNING ; break ; } Object [ ] entries = this . options . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { Map . Entry entry = ( Map . Entry ) entries [ i ] ; if ( ! ( entry . getKey ( ) instanceof String ) ) continue ; if ( ! ( entry . getValue ( ) instanceof String ) ) continue ; if ( ( ( String ) entry . getValue ( ) ) . equals ( CompilerOptions . IGNORE ) ) { this . options . put ( entry . getKey ( ) , newValue ) ; } } this . options . put ( CompilerOptions . OPTION_TaskTags , Util . EMPTY_STRING ) ; } protected void disableAll ( int severity ) { String checkedValue = null ; switch ( severity ) { case ProblemSeverities . Error : checkedValue = CompilerOptions . ERROR ; break ; case ProblemSeverities . Warning : checkedValue = CompilerOptions . WARNING ; break ; } Object [ ] entries = this . options . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { Map . Entry entry = ( Map . Entry ) entries [ i ] ; if ( ! ( entry . getKey ( ) instanceof String ) ) continue ; if ( ! ( entry . getValue ( ) instanceof String ) ) continue ; if ( ( ( String ) entry . getValue ( ) ) . equals ( checkedValue ) ) { this . options . put ( entry . getKey ( ) , CompilerOptions . IGNORE ) ; } } } public String extractDestinationPathFromSourceFile ( CompilationResult result ) { ICompilationUnit compilationUnit = result . compilationUnit ; if ( compilationUnit != null ) { char [ ] fileName = compilationUnit . getFileName ( ) ; int lastIndex = CharOperation . lastIndexOf ( java . io . File . separatorChar , fileName ) ; if ( lastIndex != - <NUM_LIT:1> ) { final String outputPathName = new String ( fileName , <NUM_LIT:0> , lastIndex ) ; final File output = new File ( outputPathName ) ; if ( output . exists ( ) && output . isDirectory ( ) ) { return outputPathName ; } } } return System . getProperty ( "<STR_LIT>" ) ; } public ICompilerRequestor getBatchRequestor ( ) { return new ICompilerRequestor ( ) { int lineDelta = <NUM_LIT:0> ; public void acceptResult ( CompilationResult compilationResult ) { if ( compilationResult . lineSeparatorPositions != null ) { int unitLineCount = compilationResult . lineSeparatorPositions . length ; this . lineDelta += unitLineCount ; if ( Main . this . showProgress && this . lineDelta > <NUM_LIT> ) { Main . this . logger . logProgress ( ) ; this . lineDelta = <NUM_LIT:0> ; } } Main . this . logger . startLoggingSource ( compilationResult ) ; if ( compilationResult . hasProblems ( ) || compilationResult . hasTasks ( ) ) { Main . this . logger . logProblems ( compilationResult . getAllProblems ( ) , compilationResult . compilationUnit . getContents ( ) , Main . this ) ; } outputClassFiles ( compilationResult ) ; Main . this . logger . endLoggingSource ( ) ; } } ; } public CompilationUnit [ ] getCompilationUnits ( ) { int fileCount = this . filenames . length ; CompilationUnit [ ] units = new CompilationUnit [ fileCount ] ; HashtableOfObject knownFileNames = new HashtableOfObject ( fileCount ) ; String defaultEncoding = ( String ) this . options . get ( CompilerOptions . OPTION_Encoding ) ; if ( Util . EMPTY_STRING . equals ( defaultEncoding ) ) defaultEncoding = null ; for ( int i = <NUM_LIT:0> ; i < fileCount ; i ++ ) { char [ ] charName = this . filenames [ i ] . toCharArray ( ) ; if ( knownFileNames . get ( charName ) != null ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , this . filenames [ i ] ) ) ; knownFileNames . put ( charName , charName ) ; File file = new File ( this . filenames [ i ] ) ; if ( ! file . exists ( ) ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , this . filenames [ i ] ) ) ; String encoding = this . encodings [ i ] ; if ( encoding == null ) encoding = defaultEncoding ; String fileName ; try { fileName = file . getCanonicalPath ( ) ; } catch ( IOException e ) { fileName = this . filenames [ i ] ; } units [ i ] = new CompilationUnit ( null , fileName , encoding , this . destinationPaths [ i ] , shouldIgnoreOptionalProblems ( this . ignoreOptionalProblemsFromFolders , fileName . toCharArray ( ) ) ) ; } return units ; } public IErrorHandlingPolicy getHandlingPolicy ( ) { return new IErrorHandlingPolicy ( ) { public boolean proceedOnErrors ( ) { return Main . this . proceedOnError ; } public boolean stopOnFirstError ( ) { return false ; } } ; } public File getJavaHome ( ) { if ( ! this . javaHomeChecked ) { this . javaHomeChecked = true ; this . javaHomeCache = Util . getJavaHome ( ) ; } return this . javaHomeCache ; } public FileSystem getLibraryAccess ( ) { return new FileSystem ( this . checkedClasspaths , this . filenames ) ; } public IProblemFactory getProblemFactory ( ) { return new DefaultProblemFactory ( this . compilerLocale ) ; } protected ArrayList handleBootclasspath ( ArrayList bootclasspaths , String customEncoding ) { final int bootclasspathsSize ; if ( ( bootclasspaths != null ) && ( ( bootclasspathsSize = bootclasspaths . size ( ) ) != <NUM_LIT:0> ) ) { String [ ] paths = new String [ bootclasspathsSize ] ; bootclasspaths . toArray ( paths ) ; bootclasspaths . clear ( ) ; for ( int i = <NUM_LIT:0> ; i < bootclasspathsSize ; i ++ ) { processPathEntries ( DEFAULT_SIZE_CLASSPATH , bootclasspaths , paths [ i ] , customEncoding , false , true ) ; } } else { bootclasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; try { Util . collectRunningVMBootclasspath ( bootclasspaths ) ; } catch ( IllegalStateException e ) { this . logger . logWrongJDK ( ) ; this . proceed = false ; return null ; } } return bootclasspaths ; } protected ArrayList handleClasspath ( ArrayList classpaths , String customEncoding ) { final int classpathsSize ; if ( ( classpaths != null ) && ( ( classpathsSize = classpaths . size ( ) ) != <NUM_LIT:0> ) ) { String [ ] paths = new String [ classpathsSize ] ; classpaths . toArray ( paths ) ; classpaths . clear ( ) ; for ( int i = <NUM_LIT:0> ; i < classpathsSize ; i ++ ) { processPathEntries ( DEFAULT_SIZE_CLASSPATH , classpaths , paths [ i ] , customEncoding , false , true ) ; } } else { classpaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; String classProp = System . getProperty ( "<STR_LIT>" ) ; if ( ( classProp == null ) || ( classProp . length ( ) == <NUM_LIT:0> ) ) { addPendingErrors ( this . bind ( "<STR_LIT>" ) ) ; final Classpath classpath = FileSystem . getClasspath ( System . getProperty ( "<STR_LIT>" ) , customEncoding , null ) ; if ( classpath != null ) { classpaths . add ( classpath ) ; } } else { StringTokenizer tokenizer = new StringTokenizer ( classProp , File . pathSeparator ) ; String token ; while ( tokenizer . hasMoreTokens ( ) ) { token = tokenizer . nextToken ( ) ; FileSystem . Classpath currentClasspath = FileSystem . getClasspath ( token , customEncoding , null ) ; if ( currentClasspath != null ) { classpaths . add ( currentClasspath ) ; } else if ( token . length ( ) != <NUM_LIT:0> ) { addPendingErrors ( this . bind ( "<STR_LIT>" , token ) ) ; } } } } ArrayList result = new ArrayList ( ) ; HashMap knownNames = new HashMap ( ) ; FileSystem . ClasspathSectionProblemReporter problemReporter = new FileSystem . ClasspathSectionProblemReporter ( ) { public void invalidClasspathSection ( String jarFilePath ) { addPendingErrors ( bind ( "<STR_LIT>" , jarFilePath ) ) ; } public void multipleClasspathSections ( String jarFilePath ) { addPendingErrors ( bind ( "<STR_LIT>" , jarFilePath ) ) ; } } ; while ( ! classpaths . isEmpty ( ) ) { Classpath current = ( Classpath ) classpaths . remove ( <NUM_LIT:0> ) ; String currentPath = current . getPath ( ) ; if ( knownNames . get ( currentPath ) == null ) { knownNames . put ( currentPath , current ) ; result . add ( current ) ; List linkedJars = current . fetchLinkedJars ( problemReporter ) ; if ( linkedJars != null ) { classpaths . addAll ( <NUM_LIT:0> , linkedJars ) ; } } } return result ; } protected ArrayList handleEndorseddirs ( ArrayList endorsedDirClasspaths ) { final File javaHome = getJavaHome ( ) ; if ( endorsedDirClasspaths == null ) { endorsedDirClasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; String endorsedDirsStr = System . getProperty ( "<STR_LIT>" ) ; if ( endorsedDirsStr == null ) { if ( javaHome != null ) { endorsedDirClasspaths . add ( javaHome . getAbsolutePath ( ) + "<STR_LIT>" ) ; } } else { StringTokenizer tokenizer = new StringTokenizer ( endorsedDirsStr , File . pathSeparator ) ; while ( tokenizer . hasMoreTokens ( ) ) { endorsedDirClasspaths . add ( tokenizer . nextToken ( ) ) ; } } } if ( endorsedDirClasspaths . size ( ) != <NUM_LIT:0> ) { File [ ] directoriesToCheck = new File [ endorsedDirClasspaths . size ( ) ] ; for ( int i = <NUM_LIT:0> ; i < directoriesToCheck . length ; i ++ ) directoriesToCheck [ i ] = new File ( ( String ) endorsedDirClasspaths . get ( i ) ) ; endorsedDirClasspaths . clear ( ) ; File [ ] [ ] endorsedDirsJars = getLibrariesFiles ( directoriesToCheck ) ; if ( endorsedDirsJars != null ) { for ( int i = <NUM_LIT:0> , max = endorsedDirsJars . length ; i < max ; i ++ ) { File [ ] current = endorsedDirsJars [ i ] ; if ( current != null ) { for ( int j = <NUM_LIT:0> , max2 = current . length ; j < max2 ; j ++ ) { FileSystem . Classpath classpath = FileSystem . getClasspath ( current [ j ] . getAbsolutePath ( ) , null , null ) ; if ( classpath != null ) { endorsedDirClasspaths . add ( classpath ) ; } } } else if ( directoriesToCheck [ i ] . isFile ( ) ) { addPendingErrors ( this . bind ( "<STR_LIT>" , directoriesToCheck [ i ] . getAbsolutePath ( ) ) ) ; } } } } return endorsedDirClasspaths ; } protected ArrayList handleExtdirs ( ArrayList extdirsClasspaths ) { final File javaHome = getJavaHome ( ) ; if ( extdirsClasspaths == null ) { extdirsClasspaths = new ArrayList ( DEFAULT_SIZE_CLASSPATH ) ; String extdirsStr = System . getProperty ( "<STR_LIT>" ) ; if ( extdirsStr == null ) { extdirsClasspaths . add ( javaHome . getAbsolutePath ( ) + "<STR_LIT>" ) ; } else { StringTokenizer tokenizer = new StringTokenizer ( extdirsStr , File . pathSeparator ) ; while ( tokenizer . hasMoreTokens ( ) ) extdirsClasspaths . add ( tokenizer . nextToken ( ) ) ; } } if ( extdirsClasspaths . size ( ) != <NUM_LIT:0> ) { File [ ] directoriesToCheck = new File [ extdirsClasspaths . size ( ) ] ; for ( int i = <NUM_LIT:0> ; i < directoriesToCheck . length ; i ++ ) directoriesToCheck [ i ] = new File ( ( String ) extdirsClasspaths . get ( i ) ) ; extdirsClasspaths . clear ( ) ; File [ ] [ ] extdirsJars = getLibrariesFiles ( directoriesToCheck ) ; if ( extdirsJars != null ) { for ( int i = <NUM_LIT:0> , max = extdirsJars . length ; i < max ; i ++ ) { File [ ] current = extdirsJars [ i ] ; if ( current != null ) { for ( int j = <NUM_LIT:0> , max2 = current . length ; j < max2 ; j ++ ) { FileSystem . Classpath classpath = FileSystem . getClasspath ( current [ j ] . getAbsolutePath ( ) , null , null ) ; if ( classpath != null ) { extdirsClasspaths . add ( classpath ) ; } } } else if ( directoriesToCheck [ i ] . isFile ( ) ) { addPendingErrors ( this . bind ( "<STR_LIT>" , directoriesToCheck [ i ] . getAbsolutePath ( ) ) ) ; } } } } return extdirsClasspaths ; } protected void handleWarningToken ( String token , boolean isEnabling ) { handleErrorOrWarningToken ( token , isEnabling , ProblemSeverities . Warning ) ; } protected void handleErrorToken ( String token , boolean isEnabling ) { handleErrorOrWarningToken ( token , isEnabling , ProblemSeverities . Error ) ; } private void setSeverity ( String compilerOptions , int severity , boolean isEnabling ) { if ( isEnabling ) { switch ( severity ) { case ProblemSeverities . Error : this . options . put ( compilerOptions , CompilerOptions . ERROR ) ; break ; case ProblemSeverities . Warning : this . options . put ( compilerOptions , CompilerOptions . WARNING ) ; break ; default : this . options . put ( compilerOptions , CompilerOptions . IGNORE ) ; } } else { switch ( severity ) { case ProblemSeverities . Error : String currentValue = ( String ) this . options . get ( compilerOptions ) ; if ( CompilerOptions . ERROR . equals ( currentValue ) ) { this . options . put ( compilerOptions , CompilerOptions . IGNORE ) ; } break ; case ProblemSeverities . Warning : currentValue = ( String ) this . options . get ( compilerOptions ) ; if ( CompilerOptions . WARNING . equals ( currentValue ) ) { this . options . put ( compilerOptions , CompilerOptions . IGNORE ) ; } break ; default : this . options . put ( compilerOptions , CompilerOptions . IGNORE ) ; } } } private void handleErrorOrWarningToken ( String token , boolean isEnabling , int severity ) { if ( token . length ( ) == <NUM_LIT:0> ) return ; switch ( token . charAt ( <NUM_LIT:0> ) ) { case '<CHAR_LIT:a>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportDeprecation , severity , isEnabling ) ; this . options . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { this . warnAllJavadocOn = this . warnJavadocOn = isEnabling ; setSeverity ( CompilerOptions . OPTION_ReportInvalidJavadoc , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportMissingJavadocTags , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportMissingJavadocComments , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportAssertIdentifier , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportDeadCode , severity , isEnabling ) ; this . options . put ( CompilerOptions . OPTION_ReportDeadCodeInTrivialIfStatement , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingOverrideAnnotation , severity , isEnabling ) ; this . options . put ( CompilerOptions . OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMethodCanBeStatic , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportMethodCanBePotentiallyStatic , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT:all>" ) ) { if ( isEnabling ) { enableAll ( severity ) ; } else { disableAll ( severity ) ; } return ; } break ; case '<CHAR_LIT:b>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportAutoboxing , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT:c>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMethodWithConstructorName , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportPossibleAccidentalBooleanAssignment , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportComparingIdentical , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNoImplicitStringConversion , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT:deprecation>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportDeprecation , severity , isEnabling ) ; this . options . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . DISABLED ) ; this . options . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . DISABLED ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingDeprecatedAnnotation , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportDiscouragedReference , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportDeadCode , severity , isEnabling ) ; this . options . put ( CompilerOptions . OPTION_ReportDeadCodeInTrivialIfStatement , CompilerOptions . DISABLED ) ; return ; } break ; case '<CHAR_LIT:e>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportIncompleteEnumSwitch , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { if ( isEnabling ) { switch ( severity ) { case ProblemSeverities . Error : setSeverity ( CompilerOptions . OPTION_ReportIncompleteEnumSwitch , severity , isEnabling ) ; break ; case ProblemSeverities . Warning : if ( CompilerOptions . IGNORE . equals ( this . options . get ( CompilerOptions . OPTION_ReportIncompleteEnumSwitch ) ) ) { setSeverity ( CompilerOptions . OPTION_ReportIncompleteEnumSwitch , severity , isEnabling ) ; } break ; default : } } this . options . put ( CompilerOptions . OPTION_ReportMissingEnumCaseDespiteDefault , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUndocumentedEmptyBlock , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportEnumIdentifier , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportFieldHiding , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportFinalParameterBound , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportFinallyBlockNotCompletingNormally , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportForbiddenReference , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportFallthroughCase , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportHiddenCatchBlock , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportLocalVariableHiding , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportFieldHiding , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportTypeParameterHiding , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingHashCodeMethod , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportIndirectStaticAccess , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportIncompatibleNonInheritedInterfaceMethod , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportAnnotationSuperInterface , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportRedundantSuperinterface , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_IncludeNullInfoFromAsserts , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { this . warnJavadocOn = isEnabling ; setSeverity ( CompilerOptions . OPTION_ReportInvalidJavadoc , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportMissingJavadocTags , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportLocalVariableHiding , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportHiddenCatchBlock , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNonExternalizedStringLiteral , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNoEffectAssignment , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNoImplicitStringConversion , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT:null>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNullReference , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportPotentialNullReference , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportRedundantNullCheck , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNullReference , severity , isEnabling ) ; if ( ! isEnabling ) { setSeverity ( CompilerOptions . OPTION_ReportPotentialNullReference , ProblemSeverities . Ignore , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportRedundantNullCheck , ProblemSeverities . Ignore , isEnabling ) ; } return ; } else if ( token . startsWith ( "<STR_LIT>" ) ) { String annotationNames = Util . EMPTY_STRING ; int start = token . indexOf ( '<CHAR_LIT:(>' ) ; int end = token . indexOf ( '<CHAR_LIT:)>' ) ; String nonNullAnnotName = null , nullableAnnotName = null , nonNullByDefaultAnnotName = null ; if ( isEnabling && start >= <NUM_LIT:0> && end >= <NUM_LIT:0> && start < end ) { annotationNames = token . substring ( start + <NUM_LIT:1> , end ) . trim ( ) ; int separator1 = annotationNames . indexOf ( '<CHAR_LIT>' ) ; if ( separator1 == - <NUM_LIT:1> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , token ) ) ; nullableAnnotName = annotationNames . substring ( <NUM_LIT:0> , separator1 ) . trim ( ) ; if ( nullableAnnotName . length ( ) == <NUM_LIT:0> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , token ) ) ; int separator2 = annotationNames . indexOf ( '<CHAR_LIT>' , separator1 + <NUM_LIT:1> ) ; if ( separator2 == - <NUM_LIT:1> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , token ) ) ; nonNullAnnotName = annotationNames . substring ( separator1 + <NUM_LIT:1> , separator2 ) . trim ( ) ; if ( nonNullAnnotName . length ( ) == <NUM_LIT:0> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , token ) ) ; nonNullByDefaultAnnotName = annotationNames . substring ( separator2 + <NUM_LIT:1> ) . trim ( ) ; if ( nonNullByDefaultAnnotName . length ( ) == <NUM_LIT:0> ) throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , token ) ) ; this . options . put ( CompilerOptions . OPTION_NullableAnnotationName , nullableAnnotName ) ; this . options . put ( CompilerOptions . OPTION_NonNullAnnotationName , nonNullAnnotName ) ; this . options . put ( CompilerOptions . OPTION_NonNullByDefaultAnnotationName , nonNullByDefaultAnnotName ) ; } this . options . put ( CompilerOptions . OPTION_AnnotationBasedNullAnalysis , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; setSeverity ( CompilerOptions . OPTION_ReportNullSpecViolation , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportNullAnnotationInferenceConflict , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportNullUncheckedConversion , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportRedundantNullAnnotation , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingSynchronizedOnInheritedMethod , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingOverrideAnnotation , severity , isEnabling ) ; this . options . put ( CompilerOptions . OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation , CompilerOptions . DISABLED ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportOverridingPackageDefaultMethod , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportParameterAssignment , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportRawTypeReference , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportRedundantSuperinterface , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnclosedCloseable , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportPotentiallyUnclosedCloseable , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportExplicitlyClosedAutoCloseable , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_ReportSpecialParameterHidingField , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportSyntheticAccessEmulation , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNonStaticAccessToStatic , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingSynchronizedOnInheritedMethod , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportEmptyStatement , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT:serial>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingSerialVersion , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { switch ( severity ) { case ProblemSeverities . Warning : this . options . put ( CompilerOptions . OPTION_SuppressWarnings , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; this . options . put ( CompilerOptions . OPTION_SuppressOptionalErrors , CompilerOptions . DISABLED ) ; break ; case ProblemSeverities . Error : this . options . put ( CompilerOptions . OPTION_SuppressWarnings , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; this . options . put ( CompilerOptions . OPTION_SuppressOptionalErrors , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; } return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportNonStaticAccessToStatic , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportIndirectStaticAccess , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportOverridingMethodWithoutSuperInvocation , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMethodCanBeStatic , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportMissingDefaultCase , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . startsWith ( "<STR_LIT>" ) ) { String taskTags = Util . EMPTY_STRING ; int start = token . indexOf ( '<CHAR_LIT:(>' ) ; int end = token . indexOf ( '<CHAR_LIT:)>' ) ; if ( start >= <NUM_LIT:0> && end >= <NUM_LIT:0> && start < end ) { taskTags = token . substring ( start + <NUM_LIT:1> , end ) . trim ( ) ; taskTags = taskTags . replace ( '<CHAR_LIT>' , '<CHAR_LIT:U+002C>' ) ; } if ( taskTags . length ( ) == <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , token ) ) ; } this . options . put ( CompilerOptions . OPTION_TaskTags , isEnabling ? taskTags : Util . EMPTY_STRING ) ; setSeverity ( CompilerOptions . OPTION_ReportTasks , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportTypeParameterHiding , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedLocal , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedParameter , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedImport , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedObjectAllocation , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedPrivateMember , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedLabel , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnnecessaryTypeCheck , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT:unchecked>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUncheckedTypeOperation , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnnecessaryElse , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedDeclaredThrownException , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) || token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnqualifiedFieldAccess , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT:unused>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedLocal , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedParameter , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedImport , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedPrivateMember , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedDeclaredThrownException , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedLabel , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedTypeArgumentsForMethodInvocation , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportRedundantSpecificationOfTypeArguments , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnusedTypeArgumentsForMethodInvocation , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportRedundantSpecificationOfTypeArguments , severity , isEnabling ) ; return ; } else if ( token . equals ( "<STR_LIT>" ) ) { this . options . put ( CompilerOptions . OPTION_ReportUnavoidableGenericTypeProblems , isEnabling ? CompilerOptions . ENABLED : CompilerOptions . DISABLED ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportVarargsArgumentNeedCast , severity , isEnabling ) ; return ; } break ; case '<CHAR_LIT>' : if ( token . equals ( "<STR_LIT>" ) ) { setSeverity ( CompilerOptions . OPTION_ReportUnhandledWarningToken , severity , isEnabling ) ; setSeverity ( CompilerOptions . OPTION_ReportUnusedWarningToken , severity , isEnabling ) ; return ; } break ; } String message = null ; switch ( severity ) { case ProblemSeverities . Warning : message = this . bind ( "<STR_LIT>" , token ) ; break ; case ProblemSeverities . Error : message = this . bind ( "<STR_LIT>" , token ) ; } addPendingErrors ( message ) ; } protected void initialize ( PrintWriter outWriter , PrintWriter errWriter , boolean systemExit ) { this . initialize ( outWriter , errWriter , systemExit , null , null ) ; } protected void initialize ( PrintWriter outWriter , PrintWriter errWriter , boolean systemExit , Map customDefaultOptions ) { this . initialize ( outWriter , errWriter , systemExit , customDefaultOptions , null ) ; } protected void initialize ( PrintWriter outWriter , PrintWriter errWriter , boolean systemExit , Map customDefaultOptions , CompilationProgress compilationProgress ) { this . logger = new Logger ( this , outWriter , errWriter ) ; this . proceed = true ; this . out = outWriter ; this . err = errWriter ; this . systemExitWhenFinished = systemExit ; this . options = new CompilerOptions ( ) . getMap ( ) ; this . ignoreOptionalProblemsFromFolders = null ; this . progress = compilationProgress ; if ( customDefaultOptions != null ) { this . didSpecifySource = customDefaultOptions . get ( CompilerOptions . OPTION_Source ) != null ; this . didSpecifyTarget = customDefaultOptions . get ( CompilerOptions . OPTION_TargetPlatform ) != null ; for ( Iterator iter = customDefaultOptions . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; this . options . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } else { this . didSpecifySource = false ; this . didSpecifyTarget = false ; } this . classNames = null ; } protected void initializeAnnotationProcessorManager ( ) { try { Class c = Class . forName ( "<STR_LIT>" ) ; AbstractAnnotationProcessorManager annotationManager = ( AbstractAnnotationProcessorManager ) c . newInstance ( ) ; annotationManager . configure ( this , this . expandedCommandLine ) ; annotationManager . setErr ( this . err ) ; annotationManager . setOut ( this . out ) ; this . batchCompiler . annotationProcessorManager = annotationManager ; } catch ( ClassNotFoundException e ) { } catch ( InstantiationException e ) { throw new org . eclipse . jdt . internal . compiler . problem . AbortCompilation ( ) ; } catch ( IllegalAccessException e ) { throw new org . eclipse . jdt . internal . compiler . problem . AbortCompilation ( ) ; } catch ( UnsupportedClassVersionError e ) { this . logger . logIncorrectVMVersionForAnnotationProcessing ( ) ; } } private static boolean isParentOf ( char [ ] folderName , char [ ] fileName ) { if ( folderName . length >= fileName . length ) { return false ; } if ( fileName [ folderName . length ] != '<STR_LIT:\\>' && fileName [ folderName . length ] != '<CHAR_LIT:/>' ) { return false ; } for ( int i = folderName . length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { if ( folderName [ i ] != fileName [ i ] ) { return false ; } } return true ; } public void outputClassFiles ( CompilationResult unitResult ) { if ( ! ( ( unitResult == null ) || ( unitResult . hasErrors ( ) && ! this . proceedOnError ) ) ) { ClassFile [ ] classFiles = unitResult . getClassFiles ( ) ; String currentDestinationPath = null ; boolean generateClasspathStructure = false ; CompilationUnit compilationUnit = ( CompilationUnit ) unitResult . compilationUnit ; if ( compilationUnit . destinationPath == null ) { if ( this . destinationPath == null ) { currentDestinationPath = extractDestinationPathFromSourceFile ( unitResult ) ; } else if ( this . destinationPath != NONE ) { currentDestinationPath = this . destinationPath ; generateClasspathStructure = true ; } } else if ( compilationUnit . destinationPath != NONE ) { currentDestinationPath = compilationUnit . destinationPath ; generateClasspathStructure = true ; } if ( currentDestinationPath != null ) { for ( int i = <NUM_LIT:0> , fileCount = classFiles . length ; i < fileCount ; i ++ ) { ClassFile classFile = classFiles [ i ] ; char [ ] filename = classFile . fileName ( ) ; int length = filename . length ; char [ ] relativeName = new char [ length + <NUM_LIT:6> ] ; System . arraycopy ( filename , <NUM_LIT:0> , relativeName , <NUM_LIT:0> , length ) ; System . arraycopy ( SuffixConstants . SUFFIX_class , <NUM_LIT:0> , relativeName , length , <NUM_LIT:6> ) ; CharOperation . replace ( relativeName , '<CHAR_LIT:/>' , File . separatorChar ) ; String relativeStringName = new String ( relativeName ) ; try { if ( this . compilerOptions . verbose ) this . out . println ( Messages . bind ( Messages . compilation_write , new String [ ] { String . valueOf ( this . exportedClassFilesCounter + <NUM_LIT:1> ) , relativeStringName } ) ) ; Util . writeToDisk ( generateClasspathStructure , currentDestinationPath , relativeStringName , classFile ) ; this . logger . logClassFile ( generateClasspathStructure , currentDestinationPath , relativeStringName ) ; this . exportedClassFilesCounter ++ ; } catch ( IOException e ) { this . logger . logNoClassFileCreated ( currentDestinationPath , relativeStringName , e ) ; } } this . batchCompiler . lookupEnvironment . releaseClassFiles ( classFiles ) ; } } } public void performCompilation ( ) { this . startTime = System . currentTimeMillis ( ) ; FileSystem environment = getLibraryAccess ( ) ; this . compilerOptions = new CompilerOptions ( this . options ) ; this . compilerOptions . performMethodsFullRecovery = false ; this . compilerOptions . performStatementsRecovery = false ; this . batchCompiler = new Compiler ( environment , getHandlingPolicy ( ) , this . compilerOptions , getBatchRequestor ( ) , getProblemFactory ( ) , this . out , this . progress ) ; this . batchCompiler . remainingIterations = this . maxRepetition - this . currentRepetition ; String setting = System . getProperty ( "<STR_LIT>" ) ; this . batchCompiler . useSingleThread = setting != null && setting . equals ( "<STR_LIT:true>" ) ; if ( this . compilerOptions . complianceLevel >= ClassFileConstants . JDK1_6 && this . compilerOptions . processAnnotations ) { if ( checkVMVersion ( ClassFileConstants . JDK1_6 ) ) { initializeAnnotationProcessorManager ( ) ; if ( this . classNames != null ) { this . batchCompiler . setBinaryTypes ( processClassNames ( this . batchCompiler . lookupEnvironment ) ) ; } } else { this . logger . logIncorrectVMVersionForAnnotationProcessing ( ) ; } } this . compilerOptions . verbose = this . verbose ; this . compilerOptions . produceReferenceInfo = this . produceRefInfo ; try { this . logger . startLoggingSources ( ) ; this . batchCompiler . compile ( getCompilationUnits ( ) ) ; } finally { this . logger . endLoggingSources ( ) ; } if ( this . extraProblems != null ) { loggingExtraProblems ( ) ; this . extraProblems = null ; } if ( this . compilerStats != null ) { this . compilerStats [ this . currentRepetition ] = this . batchCompiler . stats ; } this . logger . printStats ( ) ; environment . cleanup ( ) ; } protected void loggingExtraProblems ( ) { this . logger . loggingExtraProblems ( this ) ; } public void printUsage ( ) { printUsage ( "<STR_LIT>" ) ; } private void printUsage ( String sectionID ) { this . logger . logUsage ( this . bind ( sectionID , new String [ ] { System . getProperty ( "<STR_LIT>" ) , this . bind ( "<STR_LIT>" ) , this . bind ( "<STR_LIT>" ) , this . bind ( "<STR_LIT>" ) } ) ) ; this . logger . flush ( ) ; } private ReferenceBinding [ ] processClassNames ( LookupEnvironment environment ) { int length = this . classNames . length ; ReferenceBinding [ ] referenceBindings = new ReferenceBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String currentName = this . classNames [ i ] ; char [ ] [ ] compoundName = null ; if ( currentName . indexOf ( '<CHAR_LIT:.>' ) != - <NUM_LIT:1> ) { char [ ] typeName = currentName . toCharArray ( ) ; compoundName = CharOperation . splitOn ( '<CHAR_LIT:.>' , typeName ) ; } else { compoundName = new char [ ] [ ] { currentName . toCharArray ( ) } ; } ReferenceBinding type = environment . getType ( compoundName ) ; if ( type != null && type . isValidBinding ( ) ) { if ( type . isBinaryBinding ( ) ) { referenceBindings [ i ] = type ; } } else { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentName ) ) ; } } return referenceBindings ; } public void processPathEntries ( final int defaultSize , final ArrayList paths , final String currentPath , String customEncoding , boolean isSourceOnly , boolean rejectDestinationPathOnJars ) { String currentClasspathName = null ; String currentDestinationPath = null ; ArrayList currentRuleSpecs = new ArrayList ( defaultSize ) ; StringTokenizer tokenizer = new StringTokenizer ( currentPath , File . pathSeparator + "<STR_LIT:[]>" , true ) ; ArrayList tokens = new ArrayList ( ) ; while ( tokenizer . hasMoreTokens ( ) ) { tokens . add ( tokenizer . nextToken ( ) ) ; } final int start = <NUM_LIT:0> ; final int readyToClose = <NUM_LIT:1> ; final int readyToCloseEndingWithRules = <NUM_LIT:2> ; final int readyToCloseOrOtherEntry = <NUM_LIT:3> ; final int rulesNeedAnotherRule = <NUM_LIT:4> ; final int rulesStart = <NUM_LIT:5> ; final int rulesReadyToClose = <NUM_LIT:6> ; final int destinationPathReadyToClose = <NUM_LIT:7> ; final int readyToCloseEndingWithDestinationPath = <NUM_LIT:8> ; final int destinationPathStart = <NUM_LIT:9> ; final int bracketOpened = <NUM_LIT:10> ; final int bracketClosed = <NUM_LIT:11> ; final int error = <NUM_LIT> ; int state = start ; String token = null ; int cursor = <NUM_LIT:0> , tokensNb = tokens . size ( ) , bracket = - <NUM_LIT:1> ; while ( cursor < tokensNb && state != error ) { token = ( String ) tokens . get ( cursor ++ ) ; if ( token . equals ( File . pathSeparator ) ) { switch ( state ) { case start : case readyToCloseOrOtherEntry : case bracketOpened : break ; case readyToClose : case readyToCloseEndingWithRules : case readyToCloseEndingWithDestinationPath : state = readyToCloseOrOtherEntry ; addNewEntry ( paths , currentClasspathName , currentRuleSpecs , customEncoding , currentDestinationPath , isSourceOnly , rejectDestinationPathOnJars ) ; currentRuleSpecs . clear ( ) ; break ; case rulesReadyToClose : state = rulesNeedAnotherRule ; break ; case destinationPathReadyToClose : throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentPath ) ) ; case bracketClosed : cursor = bracket + <NUM_LIT:1> ; state = rulesStart ; break ; default : state = error ; } } else if ( token . equals ( "<STR_LIT:[>" ) ) { switch ( state ) { case start : currentClasspathName = "<STR_LIT>" ; case readyToClose : bracket = cursor - <NUM_LIT:1> ; case bracketClosed : state = bracketOpened ; break ; case readyToCloseEndingWithRules : state = destinationPathStart ; break ; case readyToCloseEndingWithDestinationPath : state = rulesStart ; break ; case bracketOpened : default : state = error ; } } else if ( token . equals ( "<STR_LIT:]>" ) ) { switch ( state ) { case rulesReadyToClose : state = readyToCloseEndingWithRules ; break ; case destinationPathReadyToClose : state = readyToCloseEndingWithDestinationPath ; break ; case bracketOpened : state = bracketClosed ; break ; case bracketClosed : default : state = error ; } } else { switch ( state ) { case start : case readyToCloseOrOtherEntry : state = readyToClose ; currentClasspathName = token ; break ; case rulesStart : if ( token . startsWith ( "<STR_LIT>" ) ) { if ( currentDestinationPath != null ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentPath ) ) ; } currentDestinationPath = token . substring ( <NUM_LIT:3> ) . trim ( ) ; state = destinationPathReadyToClose ; break ; } case rulesNeedAnotherRule : if ( currentDestinationPath != null ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentPath ) ) ; } state = rulesReadyToClose ; currentRuleSpecs . add ( token ) ; break ; case destinationPathStart : if ( ! token . startsWith ( "<STR_LIT>" ) ) { state = error ; } else { currentDestinationPath = token . substring ( <NUM_LIT:3> ) . trim ( ) ; state = destinationPathReadyToClose ; } break ; case bracketClosed : for ( int i = bracket ; i < cursor ; i ++ ) { currentClasspathName += ( String ) tokens . get ( i ) ; } state = readyToClose ; break ; case bracketOpened : break ; default : state = error ; } } if ( state == bracketClosed && cursor == tokensNb ) { cursor = bracket + <NUM_LIT:1> ; state = rulesStart ; } } switch ( state ) { case readyToCloseOrOtherEntry : break ; case readyToClose : case readyToCloseEndingWithRules : case readyToCloseEndingWithDestinationPath : addNewEntry ( paths , currentClasspathName , currentRuleSpecs , customEncoding , currentDestinationPath , isSourceOnly , rejectDestinationPathOnJars ) ; break ; case bracketOpened : case bracketClosed : default : if ( currentPath . length ( ) != <NUM_LIT:0> ) { addPendingErrors ( this . bind ( "<STR_LIT>" , currentPath ) ) ; } } } private int processPaths ( String [ ] args , int index , String currentArg , ArrayList paths ) { int localIndex = index ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = currentArg . length ( ) ; i < max ; i ++ ) { switch ( currentArg . charAt ( i ) ) { case '<CHAR_LIT:[>' : count ++ ; break ; case '<CHAR_LIT:]>' : count -- ; break ; } } if ( count == <NUM_LIT:0> ) { paths . add ( currentArg ) ; } else if ( count > <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } else { StringBuffer currentPath = new StringBuffer ( currentArg ) ; while ( true ) { if ( localIndex >= args . length ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } localIndex ++ ; String nextArg = args [ localIndex ] ; for ( int i = <NUM_LIT:0> , max = nextArg . length ( ) ; i < max ; i ++ ) { switch ( nextArg . charAt ( i ) ) { case '<CHAR_LIT:[>' : if ( count > <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , nextArg ) ) ; } count ++ ; break ; case '<CHAR_LIT:]>' : count -- ; break ; } } if ( count == <NUM_LIT:0> ) { currentPath . append ( '<CHAR_LIT:U+0020>' ) ; currentPath . append ( nextArg ) ; paths . add ( currentPath . toString ( ) ) ; return localIndex - index ; } else if ( count < <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , nextArg ) ) ; } else { currentPath . append ( '<CHAR_LIT:U+0020>' ) ; currentPath . append ( nextArg ) ; } } } return localIndex - index ; } private int processPaths ( String [ ] args , int index , String currentArg , String [ ] paths ) { int localIndex = index ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = currentArg . length ( ) ; i < max ; i ++ ) { switch ( currentArg . charAt ( i ) ) { case '<CHAR_LIT:[>' : count ++ ; break ; case '<CHAR_LIT:]>' : count -- ; break ; } } if ( count == <NUM_LIT:0> ) { paths [ <NUM_LIT:0> ] = currentArg ; } else { StringBuffer currentPath = new StringBuffer ( currentArg ) ; while ( true ) { localIndex ++ ; if ( localIndex >= args . length ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } String nextArg = args [ localIndex ] ; for ( int i = <NUM_LIT:0> , max = nextArg . length ( ) ; i < max ; i ++ ) { switch ( nextArg . charAt ( i ) ) { case '<CHAR_LIT:[>' : if ( count > <NUM_LIT:1> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } count ++ ; break ; case '<CHAR_LIT:]>' : count -- ; break ; } } if ( count == <NUM_LIT:0> ) { currentPath . append ( '<CHAR_LIT:U+0020>' ) ; currentPath . append ( nextArg ) ; paths [ <NUM_LIT:0> ] = currentPath . toString ( ) ; return localIndex - index ; } else if ( count < <NUM_LIT:0> ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , currentArg ) ) ; } else { currentPath . append ( '<CHAR_LIT:U+0020>' ) ; currentPath . append ( nextArg ) ; } } } return localIndex - index ; } public void relocalize ( ) { relocalize ( Locale . getDefault ( ) ) ; } private void relocalize ( Locale locale ) { this . compilerLocale = locale ; try { this . bundle = ResourceBundleFactory . getBundle ( locale ) ; } catch ( MissingResourceException e ) { System . out . println ( "<STR_LIT>" + Main . bundleName . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) + "<STR_LIT>" + locale ) ; throw e ; } } public void setDestinationPath ( String dest ) { this . destinationPath = dest ; } public void setLocale ( Locale locale ) { relocalize ( locale ) ; } protected void setPaths ( ArrayList bootclasspaths , String sourcepathClasspathArg , ArrayList sourcepathClasspaths , ArrayList classpaths , ArrayList extdirsClasspaths , ArrayList endorsedDirClasspaths , String customEncoding ) { bootclasspaths = handleBootclasspath ( bootclasspaths , customEncoding ) ; classpaths = handleClasspath ( classpaths , customEncoding ) ; if ( sourcepathClasspathArg != null ) { processPathEntries ( DEFAULT_SIZE_CLASSPATH , sourcepathClasspaths , sourcepathClasspathArg , customEncoding , true , false ) ; } extdirsClasspaths = handleExtdirs ( extdirsClasspaths ) ; endorsedDirClasspaths = handleEndorseddirs ( endorsedDirClasspaths ) ; bootclasspaths . addAll ( endorsedDirClasspaths ) ; bootclasspaths . addAll ( extdirsClasspaths ) ; bootclasspaths . addAll ( sourcepathClasspaths ) ; bootclasspaths . addAll ( classpaths ) ; classpaths = bootclasspaths ; classpaths = FileSystem . ClasspathNormalizer . normalize ( classpaths ) ; this . checkedClasspaths = new FileSystem . Classpath [ classpaths . size ( ) ] ; classpaths . toArray ( this . checkedClasspaths ) ; this . logger . logClasspath ( this . checkedClasspaths ) ; } private static boolean shouldIgnoreOptionalProblems ( char [ ] [ ] folderNames , char [ ] fileName ) { if ( folderNames == null || fileName == null ) { return false ; } for ( int i = <NUM_LIT:0> , max = folderNames . length ; i < max ; i ++ ) { char [ ] folderName = folderNames [ i ] ; if ( isParentOf ( folderName , fileName ) ) { return true ; } } return false ; } protected void validateOptions ( boolean didSpecifyCompliance ) { if ( didSpecifyCompliance ) { Object version = this . options . get ( CompilerOptions . OPTION_Compliance ) ; if ( CompilerOptions . VERSION_1_3 . equals ( version ) ) { if ( ! this . didSpecifySource ) this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_3 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_1 ) ; } else if ( CompilerOptions . VERSION_1_4 . equals ( version ) ) { if ( this . didSpecifySource ) { Object source = this . options . get ( CompilerOptions . OPTION_Source ) ; if ( CompilerOptions . VERSION_1_3 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_2 ) ; } else if ( CompilerOptions . VERSION_1_4 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_4 ) ; } } else { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_3 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_2 ) ; } } else if ( CompilerOptions . VERSION_1_5 . equals ( version ) ) { if ( this . didSpecifySource ) { Object source = this . options . get ( CompilerOptions . OPTION_Source ) ; if ( CompilerOptions . VERSION_1_3 . equals ( source ) || CompilerOptions . VERSION_1_4 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_4 ) ; } else if ( CompilerOptions . VERSION_1_5 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_5 ) ; } } else { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_5 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_5 ) ; } } else if ( CompilerOptions . VERSION_1_6 . equals ( version ) ) { if ( this . didSpecifySource ) { Object source = this . options . get ( CompilerOptions . OPTION_Source ) ; if ( CompilerOptions . VERSION_1_3 . equals ( source ) || CompilerOptions . VERSION_1_4 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_4 ) ; } else if ( CompilerOptions . VERSION_1_5 . equals ( source ) || CompilerOptions . VERSION_1_6 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_6 ) ; } } else { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_6 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_6 ) ; } } else if ( CompilerOptions . VERSION_1_7 . equals ( version ) ) { if ( this . didSpecifySource ) { Object source = this . options . get ( CompilerOptions . OPTION_Source ) ; if ( CompilerOptions . VERSION_1_3 . equals ( source ) || CompilerOptions . VERSION_1_4 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_4 ) ; } else if ( CompilerOptions . VERSION_1_5 . equals ( source ) || CompilerOptions . VERSION_1_6 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_6 ) ; } else if ( CompilerOptions . VERSION_1_7 . equals ( source ) ) { if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_7 ) ; } } else { this . options . put ( CompilerOptions . OPTION_Source , CompilerOptions . VERSION_1_7 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_7 ) ; } } } else if ( this . didSpecifySource ) { Object version = this . options . get ( CompilerOptions . OPTION_Source ) ; if ( CompilerOptions . VERSION_1_4 . equals ( version ) ) { if ( ! didSpecifyCompliance ) this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_4 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_4 ) ; } else if ( CompilerOptions . VERSION_1_5 . equals ( version ) ) { if ( ! didSpecifyCompliance ) this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_5 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_5 ) ; } else if ( CompilerOptions . VERSION_1_6 . equals ( version ) ) { if ( ! didSpecifyCompliance ) this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_6 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_6 ) ; } else if ( CompilerOptions . VERSION_1_7 . equals ( version ) ) { if ( ! didSpecifyCompliance ) this . options . put ( CompilerOptions . OPTION_Compliance , CompilerOptions . VERSION_1_7 ) ; if ( ! this . didSpecifyTarget ) this . options . put ( CompilerOptions . OPTION_TargetPlatform , CompilerOptions . VERSION_1_7 ) ; } } final Object sourceVersion = this . options . get ( CompilerOptions . OPTION_Source ) ; final Object compliance = this . options . get ( CompilerOptions . OPTION_Compliance ) ; if ( sourceVersion . equals ( CompilerOptions . VERSION_1_7 ) && CompilerOptions . versionToJdkLevel ( compliance ) < ClassFileConstants . JDK1_7 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) this . options . get ( CompilerOptions . OPTION_Compliance ) , CompilerOptions . VERSION_1_7 ) ) ; } else if ( sourceVersion . equals ( CompilerOptions . VERSION_1_6 ) && CompilerOptions . versionToJdkLevel ( compliance ) < ClassFileConstants . JDK1_6 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) this . options . get ( CompilerOptions . OPTION_Compliance ) , CompilerOptions . VERSION_1_6 ) ) ; } else if ( sourceVersion . equals ( CompilerOptions . VERSION_1_5 ) && CompilerOptions . versionToJdkLevel ( compliance ) < ClassFileConstants . JDK1_5 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) this . options . get ( CompilerOptions . OPTION_Compliance ) , CompilerOptions . VERSION_1_5 ) ) ; } else if ( sourceVersion . equals ( CompilerOptions . VERSION_1_4 ) && CompilerOptions . versionToJdkLevel ( compliance ) < ClassFileConstants . JDK1_4 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) this . options . get ( CompilerOptions . OPTION_Compliance ) , CompilerOptions . VERSION_1_4 ) ) ; } if ( this . didSpecifyTarget ) { final Object targetVersion = this . options . get ( CompilerOptions . OPTION_TargetPlatform ) ; if ( CompilerOptions . VERSION_JSR14 . equals ( targetVersion ) ) { if ( CompilerOptions . versionToJdkLevel ( sourceVersion ) < ClassFileConstants . JDK1_5 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , ( String ) sourceVersion ) ) ; } } else if ( CompilerOptions . VERSION_CLDC1_1 . equals ( targetVersion ) ) { if ( this . didSpecifySource && CompilerOptions . versionToJdkLevel ( sourceVersion ) >= ClassFileConstants . JDK1_4 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , ( String ) sourceVersion ) ) ; } if ( CompilerOptions . versionToJdkLevel ( compliance ) >= ClassFileConstants . JDK1_5 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , ( String ) sourceVersion ) ) ; } } else { if ( CompilerOptions . versionToJdkLevel ( sourceVersion ) >= ClassFileConstants . JDK1_7 && CompilerOptions . versionToJdkLevel ( targetVersion ) < ClassFileConstants . JDK1_7 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , CompilerOptions . VERSION_1_7 ) ) ; } if ( CompilerOptions . versionToJdkLevel ( sourceVersion ) >= ClassFileConstants . JDK1_6 && CompilerOptions . versionToJdkLevel ( targetVersion ) < ClassFileConstants . JDK1_6 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , CompilerOptions . VERSION_1_6 ) ) ; } if ( CompilerOptions . versionToJdkLevel ( sourceVersion ) >= ClassFileConstants . JDK1_5 && CompilerOptions . versionToJdkLevel ( targetVersion ) < ClassFileConstants . JDK1_5 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , CompilerOptions . VERSION_1_5 ) ) ; } if ( CompilerOptions . versionToJdkLevel ( sourceVersion ) >= ClassFileConstants . JDK1_4 && CompilerOptions . versionToJdkLevel ( targetVersion ) < ClassFileConstants . JDK1_4 ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) targetVersion , CompilerOptions . VERSION_1_4 ) ) ; } if ( CompilerOptions . versionToJdkLevel ( compliance ) < CompilerOptions . versionToJdkLevel ( targetVersion ) ) { throw new IllegalArgumentException ( this . bind ( "<STR_LIT>" , ( String ) this . options . get ( CompilerOptions . OPTION_Compliance ) , ( String ) targetVersion ) ) ; } } } } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import java . io . IOException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilationUnit ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CompilationUnit implements ICompilationUnit { public char [ ] contents ; public char [ ] fileName ; public char [ ] mainTypeName ; String encoding ; public String destinationPath ; private boolean ignoreOptionalProblems ; public CompilationUnit ( char [ ] contents , String fileName , String encoding ) { this ( contents , fileName , encoding , null ) ; } public CompilationUnit ( char [ ] contents , String fileName , String encoding , String destinationPath ) { this ( contents , fileName , encoding , destinationPath , false ) ; } public CompilationUnit ( char [ ] contents , String fileName , String encoding , String destinationPath , boolean ignoreOptionalProblems ) { this . contents = contents ; char [ ] fileNameCharArray = fileName . toCharArray ( ) ; switch ( File . separatorChar ) { case '<CHAR_LIT:/>' : if ( CharOperation . indexOf ( '<STR_LIT:\\>' , fileNameCharArray ) != - <NUM_LIT:1> ) { CharOperation . replace ( fileNameCharArray , '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) ; } break ; case '<STR_LIT:\\>' : if ( CharOperation . indexOf ( '<CHAR_LIT:/>' , fileNameCharArray ) != - <NUM_LIT:1> ) { CharOperation . replace ( fileNameCharArray , '<CHAR_LIT:/>' , '<STR_LIT:\\>' ) ; } } this . fileName = fileNameCharArray ; int start = CharOperation . lastIndexOf ( File . separatorChar , fileNameCharArray ) + <NUM_LIT:1> ; int end = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , fileNameCharArray ) ; if ( end == - <NUM_LIT:1> ) { end = fileNameCharArray . length ; } this . mainTypeName = CharOperation . subarray ( fileNameCharArray , start , end ) ; this . encoding = encoding ; this . destinationPath = destinationPath ; this . ignoreOptionalProblems = ignoreOptionalProblems ; } public char [ ] getContents ( ) { if ( this . contents != null ) return this . contents ; try { return Util . getFileCharContent ( new File ( new String ( this . fileName ) ) , this . encoding ) ; } catch ( IOException e ) { this . contents = CharOperation . NO_CHAR ; throw new AbortCompilationUnit ( null , e , this . encoding ) ; } } public char [ ] getFileName ( ) { return this . fileName ; } public char [ ] getMainTypeName ( ) { return this . mainTypeName ; } public char [ ] [ ] getPackageName ( ) { return null ; } public boolean ignoreOptionalProblems ( ) { return this . ignoreOptionalProblems ; } public String toString ( ) { return "<STR_LIT>" + new String ( this . fileName ) + "<STR_LIT:]>" ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . batch ; import java . io . File ; import java . io . InputStream ; import java . io . IOException ; import java . util . zip . ZipEntry ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ClasspathSourceJar extends ClasspathJar { private String encoding ; public ClasspathSourceJar ( File file , boolean closeZipFileAtEnd , AccessRuleSet accessRuleSet , String encoding , String destinationPath ) { super ( file , closeZipFileAtEnd , accessRuleSet , destinationPath ) ; this . encoding = encoding ; } public NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName , boolean asBinaryOnly ) { if ( ! isPackage ( qualifiedPackageName ) ) return null ; ZipEntry sourceEntry = this . zipFile . getEntry ( qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedBinaryFileName . length ( ) - <NUM_LIT:6> ) + SUFFIX_STRING_java ) ; if ( sourceEntry != null ) { try { InputStream stream = null ; char [ ] contents = null ; try { stream = this . zipFile . getInputStream ( sourceEntry ) ; contents = Util . getInputStreamAsCharArray ( stream , - <NUM_LIT:1> , this . encoding ) ; } finally { if ( stream != null ) stream . close ( ) ; } return new NameEnvironmentAnswer ( new CompilationUnit ( contents , qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedBinaryFileName . length ( ) - <NUM_LIT:6> ) + SUFFIX_STRING_java , this . encoding , this . destinationPath ) , fetchAccessRestriction ( qualifiedBinaryFileName ) ) ; } catch ( IOException e ) { } } return null ; } public NameEnvironmentAnswer findClass ( char [ ] typeName , String qualifiedPackageName , String qualifiedBinaryFileName ) { return findClass ( typeName , qualifiedPackageName , qualifiedBinaryFileName , false ) ; } public int getMode ( ) { return SOURCE ; } } </s>
<s> package org . eclipse . jdt . internal . compiler ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; public abstract class ASTVisitor { public void acceptProblem ( IProblem problem ) { } public void endVisit ( AllocationExpression allocationExpression , BlockScope scope ) { } public void endVisit ( AND_AND_Expression and_and_Expression , BlockScope scope ) { } public void endVisit ( AnnotationMethodDeclaration annotationTypeDeclaration , ClassScope classScope ) { } public void endVisit ( Argument argument , BlockScope scope ) { } public void endVisit ( Argument argument , ClassScope scope ) { } public void endVisit ( ArrayAllocationExpression arrayAllocationExpression , BlockScope scope ) { } public void endVisit ( ArrayInitializer arrayInitializer , BlockScope scope ) { } public void endVisit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , BlockScope scope ) { } public void endVisit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , ClassScope scope ) { } public void endVisit ( ArrayReference arrayReference , BlockScope scope ) { } public void endVisit ( ArrayTypeReference arrayTypeReference , BlockScope scope ) { } public void endVisit ( ArrayTypeReference arrayTypeReference , ClassScope scope ) { } public void endVisit ( AssertStatement assertStatement , BlockScope scope ) { } public void endVisit ( Assignment assignment , BlockScope scope ) { } public void endVisit ( BinaryExpression binaryExpression , BlockScope scope ) { } public void endVisit ( Block block , BlockScope scope ) { } public void endVisit ( BreakStatement breakStatement , BlockScope scope ) { } public void endVisit ( CaseStatement caseStatement , BlockScope scope ) { } public void endVisit ( CastExpression castExpression , BlockScope scope ) { } public void endVisit ( CharLiteral charLiteral , BlockScope scope ) { } public void endVisit ( ClassLiteralAccess classLiteral , BlockScope scope ) { } public void endVisit ( Clinit clinit , ClassScope scope ) { } public void endVisit ( CompilationUnitDeclaration compilationUnitDeclaration , CompilationUnitScope scope ) { } public void endVisit ( CompoundAssignment compoundAssignment , BlockScope scope ) { } public void endVisit ( ConditionalExpression conditionalExpression , BlockScope scope ) { } public void endVisit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { } public void endVisit ( ContinueStatement continueStatement , BlockScope scope ) { } public void endVisit ( DoStatement doStatement , BlockScope scope ) { } public void endVisit ( DoubleLiteral doubleLiteral , BlockScope scope ) { } public void endVisit ( EmptyStatement emptyStatement , BlockScope scope ) { } public void endVisit ( EqualExpression equalExpression , BlockScope scope ) { } public void endVisit ( ExplicitConstructorCall explicitConstructor , BlockScope scope ) { } public void endVisit ( ExtendedStringLiteral extendedStringLiteral , BlockScope scope ) { } public void endVisit ( FalseLiteral falseLiteral , BlockScope scope ) { } public void endVisit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { } public void endVisit ( FieldReference fieldReference , BlockScope scope ) { } public void endVisit ( FieldReference fieldReference , ClassScope scope ) { } public void endVisit ( FloatLiteral floatLiteral , BlockScope scope ) { } public void endVisit ( ForeachStatement forStatement , BlockScope scope ) { } public void endVisit ( ForStatement forStatement , BlockScope scope ) { } public void endVisit ( IfStatement ifStatement , BlockScope scope ) { } public void endVisit ( ImportReference importRef , CompilationUnitScope scope ) { } public void endVisit ( Initializer initializer , MethodScope scope ) { } public void endVisit ( InstanceOfExpression instanceOfExpression , BlockScope scope ) { } public void endVisit ( IntLiteral intLiteral , BlockScope scope ) { } public void endVisit ( Javadoc javadoc , BlockScope scope ) { } public void endVisit ( Javadoc javadoc , ClassScope scope ) { } public void endVisit ( JavadocAllocationExpression expression , BlockScope scope ) { } public void endVisit ( JavadocAllocationExpression expression , ClassScope scope ) { } public void endVisit ( JavadocArgumentExpression expression , BlockScope scope ) { } public void endVisit ( JavadocArgumentExpression expression , ClassScope scope ) { } public void endVisit ( JavadocArrayQualifiedTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocArrayQualifiedTypeReference typeRef , ClassScope scope ) { } public void endVisit ( JavadocArraySingleTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocArraySingleTypeReference typeRef , ClassScope scope ) { } public void endVisit ( JavadocFieldReference fieldRef , BlockScope scope ) { } public void endVisit ( JavadocFieldReference fieldRef , ClassScope scope ) { } public void endVisit ( JavadocImplicitTypeReference implicitTypeReference , BlockScope scope ) { } public void endVisit ( JavadocImplicitTypeReference implicitTypeReference , ClassScope scope ) { } public void endVisit ( JavadocMessageSend messageSend , BlockScope scope ) { } public void endVisit ( JavadocMessageSend messageSend , ClassScope scope ) { } public void endVisit ( JavadocQualifiedTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocQualifiedTypeReference typeRef , ClassScope scope ) { } public void endVisit ( JavadocReturnStatement statement , BlockScope scope ) { } public void endVisit ( JavadocReturnStatement statement , ClassScope scope ) { } public void endVisit ( JavadocSingleNameReference argument , BlockScope scope ) { } public void endVisit ( JavadocSingleNameReference argument , ClassScope scope ) { } public void endVisit ( JavadocSingleTypeReference typeRef , BlockScope scope ) { } public void endVisit ( JavadocSingleTypeReference typeRef , ClassScope scope ) { } public void endVisit ( LabeledStatement labeledStatement , BlockScope scope ) { } public void endVisit ( LocalDeclaration localDeclaration , BlockScope scope ) { } public void endVisit ( LongLiteral longLiteral , BlockScope scope ) { } public void endVisit ( MarkerAnnotation annotation , BlockScope scope ) { } public void endVisit ( MemberValuePair pair , BlockScope scope ) { } public void endVisit ( MessageSend messageSend , BlockScope scope ) { } public void endVisit ( MethodDeclaration methodDeclaration , ClassScope scope ) { } public void endVisit ( StringLiteralConcatenation literal , BlockScope scope ) { } public void endVisit ( NormalAnnotation annotation , BlockScope scope ) { } public void endVisit ( NullLiteral nullLiteral , BlockScope scope ) { } public void endVisit ( OR_OR_Expression or_or_Expression , BlockScope scope ) { } public void endVisit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , BlockScope scope ) { } public void endVisit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , ClassScope scope ) { } public void endVisit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , BlockScope scope ) { } public void endVisit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , ClassScope scope ) { } public void endVisit ( PostfixExpression postfixExpression , BlockScope scope ) { } public void endVisit ( PrefixExpression prefixExpression , BlockScope scope ) { } public void endVisit ( QualifiedAllocationExpression qualifiedAllocationExpression , BlockScope scope ) { } public void endVisit ( QualifiedNameReference qualifiedNameReference , BlockScope scope ) { } public void endVisit ( QualifiedNameReference qualifiedNameReference , ClassScope scope ) { } public void endVisit ( QualifiedSuperReference qualifiedSuperReference , BlockScope scope ) { } public void endVisit ( QualifiedSuperReference qualifiedSuperReference , ClassScope scope ) { } public void endVisit ( QualifiedThisReference qualifiedThisReference , BlockScope scope ) { } public void endVisit ( QualifiedThisReference qualifiedThisReference , ClassScope scope ) { } public void endVisit ( QualifiedTypeReference qualifiedTypeReference , BlockScope scope ) { } public void endVisit ( QualifiedTypeReference qualifiedTypeReference , ClassScope scope ) { } public void endVisit ( ReturnStatement returnStatement , BlockScope scope ) { } public void endVisit ( SingleMemberAnnotation annotation , BlockScope scope ) { } public void endVisit ( SingleNameReference singleNameReference , BlockScope scope ) { } public void endVisit ( SingleNameReference singleNameReference , ClassScope scope ) { } public void endVisit ( SingleTypeReference singleTypeReference , BlockScope scope ) { } public void endVisit ( SingleTypeReference singleTypeReference , ClassScope scope ) { } public void endVisit ( StringLiteral stringLiteral , BlockScope scope ) { } public void endVisit ( SuperReference superReference , BlockScope scope ) { } public void endVisit ( SwitchStatement switchStatement , BlockScope scope ) { } public void endVisit ( SynchronizedStatement synchronizedStatement , BlockScope scope ) { } public void endVisit ( ThisReference thisReference , BlockScope scope ) { } public void endVisit ( ThisReference thisReference , ClassScope scope ) { } public void endVisit ( ThrowStatement throwStatement , BlockScope scope ) { } public void endVisit ( TrueLiteral trueLiteral , BlockScope scope ) { } public void endVisit ( TryStatement tryStatement , BlockScope scope ) { } public void endVisit ( TypeDeclaration localTypeDeclaration , BlockScope scope ) { } public void endVisit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { } public void endVisit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { } public void endVisit ( TypeParameter typeParameter , BlockScope scope ) { } public void endVisit ( TypeParameter typeParameter , ClassScope scope ) { } public void endVisit ( UnaryExpression unaryExpression , BlockScope scope ) { } public void endVisit ( UnionTypeReference unionTypeReference , BlockScope scope ) { } public void endVisit ( UnionTypeReference unionTypeReference , ClassScope scope ) { } public void endVisit ( WhileStatement whileStatement , BlockScope scope ) { } public void endVisit ( Wildcard wildcard , BlockScope scope ) { } public void endVisit ( Wildcard wildcard , ClassScope scope ) { } public boolean visit ( AllocationExpression allocationExpression , BlockScope scope ) { return true ; } public boolean visit ( AND_AND_Expression and_and_Expression , BlockScope scope ) { return true ; } public boolean visit ( AnnotationMethodDeclaration annotationTypeDeclaration , ClassScope classScope ) { return true ; } public boolean visit ( Argument argument , BlockScope scope ) { return true ; } public boolean visit ( Argument argument , ClassScope scope ) { return true ; } public boolean visit ( ArrayAllocationExpression arrayAllocationExpression , BlockScope scope ) { return true ; } public boolean visit ( ArrayInitializer arrayInitializer , BlockScope scope ) { return true ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ArrayQualifiedTypeReference arrayQualifiedTypeReference , ClassScope scope ) { return true ; } public boolean visit ( ArrayReference arrayReference , BlockScope scope ) { return true ; } public boolean visit ( ArrayTypeReference arrayTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ArrayTypeReference arrayTypeReference , ClassScope scope ) { return true ; } public boolean visit ( AssertStatement assertStatement , BlockScope scope ) { return true ; } public boolean visit ( Assignment assignment , BlockScope scope ) { return true ; } public boolean visit ( BinaryExpression binaryExpression , BlockScope scope ) { return true ; } public boolean visit ( Block block , BlockScope scope ) { return true ; } public boolean visit ( BreakStatement breakStatement , BlockScope scope ) { return true ; } public boolean visit ( CaseStatement caseStatement , BlockScope scope ) { return true ; } public boolean visit ( CastExpression castExpression , BlockScope scope ) { return true ; } public boolean visit ( CharLiteral charLiteral , BlockScope scope ) { return true ; } public boolean visit ( ClassLiteralAccess classLiteral , BlockScope scope ) { return true ; } public boolean visit ( Clinit clinit , ClassScope scope ) { return true ; } public boolean visit ( CompilationUnitDeclaration compilationUnitDeclaration , CompilationUnitScope scope ) { return true ; } public boolean visit ( CompoundAssignment compoundAssignment , BlockScope scope ) { return true ; } public boolean visit ( ConditionalExpression conditionalExpression , BlockScope scope ) { return true ; } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { return true ; } public boolean visit ( ContinueStatement continueStatement , BlockScope scope ) { return true ; } public boolean visit ( DoStatement doStatement , BlockScope scope ) { return true ; } public boolean visit ( DoubleLiteral doubleLiteral , BlockScope scope ) { return true ; } public boolean visit ( EmptyStatement emptyStatement , BlockScope scope ) { return true ; } public boolean visit ( EqualExpression equalExpression , BlockScope scope ) { return true ; } public boolean visit ( ExplicitConstructorCall explicitConstructor , BlockScope scope ) { return true ; } public boolean visit ( ExtendedStringLiteral extendedStringLiteral , BlockScope scope ) { return true ; } public boolean visit ( FalseLiteral falseLiteral , BlockScope scope ) { return true ; } public boolean visit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { return true ; } public boolean visit ( FieldReference fieldReference , BlockScope scope ) { return true ; } public boolean visit ( FieldReference fieldReference , ClassScope scope ) { return true ; } public boolean visit ( FloatLiteral floatLiteral , BlockScope scope ) { return true ; } public boolean visit ( ForeachStatement forStatement , BlockScope scope ) { return true ; } public boolean visit ( ForStatement forStatement , BlockScope scope ) { return true ; } public boolean visit ( IfStatement ifStatement , BlockScope scope ) { return true ; } public boolean visit ( ImportReference importRef , CompilationUnitScope scope ) { return true ; } public boolean visit ( Initializer initializer , MethodScope scope ) { return true ; } public boolean visit ( InstanceOfExpression instanceOfExpression , BlockScope scope ) { return true ; } public boolean visit ( IntLiteral intLiteral , BlockScope scope ) { return true ; } public boolean visit ( Javadoc javadoc , BlockScope scope ) { return true ; } public boolean visit ( Javadoc javadoc , ClassScope scope ) { return true ; } public boolean visit ( JavadocAllocationExpression expression , BlockScope scope ) { return true ; } public boolean visit ( JavadocAllocationExpression expression , ClassScope scope ) { return true ; } public boolean visit ( JavadocArgumentExpression expression , BlockScope scope ) { return true ; } public boolean visit ( JavadocArgumentExpression expression , ClassScope scope ) { return true ; } public boolean visit ( JavadocArrayQualifiedTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocArrayQualifiedTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocArraySingleTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocArraySingleTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocFieldReference fieldRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocFieldReference fieldRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocImplicitTypeReference implicitTypeReference , BlockScope scope ) { return true ; } public boolean visit ( JavadocImplicitTypeReference implicitTypeReference , ClassScope scope ) { return true ; } public boolean visit ( JavadocMessageSend messageSend , BlockScope scope ) { return true ; } public boolean visit ( JavadocMessageSend messageSend , ClassScope scope ) { return true ; } public boolean visit ( JavadocQualifiedTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocQualifiedTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( JavadocReturnStatement statement , BlockScope scope ) { return true ; } public boolean visit ( JavadocReturnStatement statement , ClassScope scope ) { return true ; } public boolean visit ( JavadocSingleNameReference argument , BlockScope scope ) { return true ; } public boolean visit ( JavadocSingleNameReference argument , ClassScope scope ) { return true ; } public boolean visit ( JavadocSingleTypeReference typeRef , BlockScope scope ) { return true ; } public boolean visit ( JavadocSingleTypeReference typeRef , ClassScope scope ) { return true ; } public boolean visit ( LabeledStatement labeledStatement , BlockScope scope ) { return true ; } public boolean visit ( LocalDeclaration localDeclaration , BlockScope scope ) { return true ; } public boolean visit ( LongLiteral longLiteral , BlockScope scope ) { return true ; } public boolean visit ( MarkerAnnotation annotation , BlockScope scope ) { return true ; } public boolean visit ( MemberValuePair pair , BlockScope scope ) { return true ; } public boolean visit ( MessageSend messageSend , BlockScope scope ) { return true ; } public boolean visit ( MethodDeclaration methodDeclaration , ClassScope scope ) { return true ; } public boolean visit ( StringLiteralConcatenation literal , BlockScope scope ) { return true ; } public boolean visit ( NormalAnnotation annotation , BlockScope scope ) { return true ; } public boolean visit ( NullLiteral nullLiteral , BlockScope scope ) { return true ; } public boolean visit ( OR_OR_Expression or_or_Expression , BlockScope scope ) { return true ; } public boolean visit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference , ClassScope scope ) { return true ; } public boolean visit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , BlockScope scope ) { return true ; } public boolean visit ( ParameterizedSingleTypeReference parameterizedSingleTypeReference , ClassScope scope ) { return true ; } public boolean visit ( PostfixExpression postfixExpression , BlockScope scope ) { return true ; } public boolean visit ( PrefixExpression prefixExpression , BlockScope scope ) { return true ; } public boolean visit ( QualifiedAllocationExpression qualifiedAllocationExpression , BlockScope scope ) { return true ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , ClassScope scope ) { return true ; } public boolean visit ( QualifiedSuperReference qualifiedSuperReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedSuperReference qualifiedSuperReference , ClassScope scope ) { return true ; } public boolean visit ( QualifiedThisReference qualifiedThisReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedThisReference qualifiedThisReference , ClassScope scope ) { return true ; } public boolean visit ( QualifiedTypeReference qualifiedTypeReference , BlockScope scope ) { return true ; } public boolean visit ( QualifiedTypeReference qualifiedTypeReference , ClassScope scope ) { return true ; } public boolean visit ( ReturnStatement returnStatement , BlockScope scope ) { return true ; } public boolean visit ( SingleMemberAnnotation annotation , BlockScope scope ) { return true ; } public boolean visit ( SingleNameReference singleNameReference , BlockScope scope ) { return true ; } public boolean visit ( SingleNameReference singleNameReference , ClassScope scope ) { return true ; } public boolean visit ( SingleTypeReference singleTypeReference , BlockScope scope ) { return true ; } public boolean visit ( SingleTypeReference singleTypeReference , ClassScope scope ) { return true ; } public boolean visit ( StringLiteral stringLiteral , BlockScope scope ) { return true ; } public boolean visit ( SuperReference superReference , BlockScope scope ) { return true ; } public boolean visit ( SwitchStatement switchStatement , BlockScope scope ) { return true ; } public boolean visit ( SynchronizedStatement synchronizedStatement , BlockScope scope ) { return true ; } public boolean visit ( ThisReference thisReference , BlockScope scope ) { return true ; } public boolean visit ( ThisReference thisReference , ClassScope scope ) { return true ; } public boolean visit ( ThrowStatement throwStatement , BlockScope scope ) { return true ; } public boolean visit ( TrueLiteral trueLiteral , BlockScope scope ) { return true ; } public boolean visit ( TryStatement tryStatement , BlockScope scope ) { return true ; } public boolean visit ( TypeDeclaration localTypeDeclaration , BlockScope scope ) { return true ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { return true ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { return true ; } public boolean visit ( TypeParameter typeParameter , BlockScope scope ) { return true ; } public boolean visit ( TypeParameter typeParameter , ClassScope scope ) { return true ; } public boolean visit ( UnaryExpression unaryExpression , BlockScope scope ) { return true ; } public boolean visit ( UnionTypeReference unionTypeReference , BlockScope scope ) { return true ; } public boolean visit ( UnionTypeReference unionTypeReference , ClassScope scope ) { return true ; } public boolean visit ( WhileStatement whileStatement , BlockScope scope ) { return true ; } public boolean visit ( Wildcard wildcard , BlockScope scope ) { return true ; } public boolean visit ( Wildcard wildcard , ClassScope scope ) { return true ; } } </s>
<s> package org . eclipse . jdt . internal . compiler ; public interface IErrorHandlingPolicy { boolean proceedOnErrors ( ) ; boolean stopOnFirstError ( ) ; } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . BranchLabel ; import org . eclipse . jdt . internal . compiler . impl . BooleanConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class TrueLiteral extends MagicLiteral { static final char [ ] source = { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT:e>' } ; public TrueLiteral ( int s , int e ) { super ( s , e ) ; } public void computeConstant ( ) { this . constant = BooleanConstant . fromValue ( true ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateOptimizedBoolean ( BlockScope currentScope , CodeStream codeStream , BranchLabel trueLabel , BranchLabel falseLabel , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { if ( falseLabel == null ) { if ( trueLabel != null ) { codeStream . goto_ ( trueLabel ) ; } } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . BOOLEAN ; } public char [ ] source ( ) { return source ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; public abstract class TypeReference extends Expression { public static final TypeReference [ ] NO_TYPE_ARGUMENTS = new TypeReference [ <NUM_LIT:0> ] ; public static final TypeReference baseTypeReference ( int baseType , int dim ) { if ( dim == <NUM_LIT:0> ) { switch ( baseType ) { case ( TypeIds . T_void ) : return new SingleTypeReference ( TypeBinding . VOID . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_boolean ) : return new SingleTypeReference ( TypeBinding . BOOLEAN . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_char ) : return new SingleTypeReference ( TypeBinding . CHAR . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_float ) : return new SingleTypeReference ( TypeBinding . FLOAT . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_double ) : return new SingleTypeReference ( TypeBinding . DOUBLE . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_byte ) : return new SingleTypeReference ( TypeBinding . BYTE . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_short ) : return new SingleTypeReference ( TypeBinding . SHORT . simpleName , <NUM_LIT:0> ) ; case ( TypeIds . T_int ) : return new SingleTypeReference ( TypeBinding . INT . simpleName , <NUM_LIT:0> ) ; default : return new SingleTypeReference ( TypeBinding . LONG . simpleName , <NUM_LIT:0> ) ; } } switch ( baseType ) { case ( TypeIds . T_void ) : return new ArrayTypeReference ( TypeBinding . VOID . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_boolean ) : return new ArrayTypeReference ( TypeBinding . BOOLEAN . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_char ) : return new ArrayTypeReference ( TypeBinding . CHAR . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_float ) : return new ArrayTypeReference ( TypeBinding . FLOAT . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_double ) : return new ArrayTypeReference ( TypeBinding . DOUBLE . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_byte ) : return new ArrayTypeReference ( TypeBinding . BYTE . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_short ) : return new ArrayTypeReference ( TypeBinding . SHORT . simpleName , dim , <NUM_LIT:0> ) ; case ( TypeIds . T_int ) : return new ArrayTypeReference ( TypeBinding . INT . simpleName , dim , <NUM_LIT:0> ) ; default : return new ArrayTypeReference ( TypeBinding . LONG . simpleName , dim , <NUM_LIT:0> ) ; } } public void aboutToResolve ( Scope scope ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { return flowInfo ; } public void checkBounds ( Scope scope ) { } public abstract TypeReference copyDims ( int dim ) ; public int dimensions ( ) { return <NUM_LIT:0> ; } public abstract char [ ] getLastToken ( ) ; public char [ ] [ ] getParameterizedTypeName ( ) { return getTypeName ( ) ; } protected abstract TypeBinding getTypeBinding ( Scope scope ) ; public abstract char [ ] [ ] getTypeName ( ) ; protected TypeBinding internalResolveType ( Scope scope ) { this . constant = Constant . NotAConstant ; if ( this . resolvedType != null ) { if ( this . resolvedType . isValidBinding ( ) ) { return this . resolvedType ; } else { switch ( this . resolvedType . problemId ( ) ) { case ProblemReasons . NotFound : case ProblemReasons . NotVisible : case ProblemReasons . InheritedNameHidesEnclosingName : TypeBinding type = this . resolvedType . closestMatch ( ) ; if ( type == null ) return null ; return scope . environment ( ) . convertToRawType ( type , false ) ; default : return null ; } } } boolean hasError ; TypeBinding type = this . resolvedType = getTypeBinding ( scope ) ; if ( type == null ) { return null ; } else if ( ( hasError = ! type . isValidBinding ( ) ) == true ) { reportInvalidType ( scope ) ; switch ( type . problemId ( ) ) { case ProblemReasons . NotFound : case ProblemReasons . NotVisible : case ProblemReasons . InheritedNameHidesEnclosingName : type = type . closestMatch ( ) ; if ( type == null ) return null ; break ; default : return null ; } } if ( type . isArrayType ( ) && ( ( ArrayBinding ) type ) . leafComponentType == TypeBinding . VOID ) { scope . problemReporter ( ) . cannotAllocateVoidArray ( this ) ; return null ; } if ( ! ( this instanceof QualifiedTypeReference ) && isTypeUseDeprecated ( type , scope ) ) { reportDeprecatedType ( type , scope ) ; } type = scope . environment ( ) . convertToRawType ( type , false ) ; if ( type . leafComponentType ( ) . isRawType ( ) && ( this . bits & ASTNode . IgnoreRawTypeCheck ) == <NUM_LIT:0> && scope . compilerOptions ( ) . getSeverity ( CompilerOptions . RawTypeReference ) != ProblemSeverities . Ignore ) { scope . problemReporter ( ) . rawTypeReference ( this , type ) ; } if ( hasError ) { return type ; } return this . resolvedType = type ; } public boolean isTypeReference ( ) { return true ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope , int index ) { scope . problemReporter ( ) . deprecatedType ( type , this , index ) ; } protected void reportDeprecatedType ( TypeBinding type , Scope scope ) { scope . problemReporter ( ) . deprecatedType ( type , this , Integer . MAX_VALUE ) ; } protected void reportInvalidType ( Scope scope ) { if ( scope != null ) { CompilationUnitScope cuScope = scope . compilationUnitScope ( ) ; if ( ! cuScope . reportInvalidType ( this , this . resolvedType ) ) { return ; } } scope . problemReporter ( ) . invalidType ( this , this . resolvedType ) ; } public TypeBinding resolveSuperType ( ClassScope scope ) { TypeBinding superType = resolveType ( scope ) ; if ( superType == null ) return null ; if ( superType . isTypeVariable ( ) ) { if ( this . resolvedType . isValidBinding ( ) ) { this . resolvedType = new ProblemReferenceBinding ( getTypeName ( ) , ( ReferenceBinding ) this . resolvedType , ProblemReasons . IllegalSuperTypeVariable ) ; reportInvalidType ( scope ) ; } return null ; } return superType ; } public final TypeBinding resolveType ( BlockScope blockScope ) { return resolveType ( blockScope , true ) ; } public TypeBinding resolveType ( BlockScope scope , boolean checkBounds ) { return internalResolveType ( scope ) ; } public TypeBinding resolveType ( ClassScope scope ) { return internalResolveType ( scope ) ; } public TypeBinding resolveTypeArgument ( BlockScope blockScope , ReferenceBinding genericType , int rank ) { return resolveType ( blockScope , true ) ; } public TypeBinding resolveTypeArgument ( ClassScope classScope , ReferenceBinding genericType , int rank ) { ReferenceBinding ref = classScope . referenceContext . binding ; boolean pauseHierarchyCheck = false ; try { if ( ref . isHierarchyBeingConnected ( ) ) { ref . tagBits |= TagBits . PauseHierarchyCheck ; pauseHierarchyCheck = true ; } return resolveType ( classScope ) ; } finally { if ( pauseHierarchyCheck ) { ref . tagBits &= ~ TagBits . PauseHierarchyCheck ; } } } public abstract void traverse ( ASTVisitor visitor , BlockScope scope ) ; public abstract void traverse ( ASTVisitor visitor , ClassScope scope ) ; } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; public abstract class NumberLiteral extends Literal { char [ ] source ; public NumberLiteral ( char [ ] token , int s , int e ) { this ( s , e ) ; this . source = token ; } public NumberLiteral ( int s , int e ) { super ( s , e ) ; } public boolean isValidJavaStatement ( ) { return false ; } public char [ ] source ( ) { return this . source ; } protected static char [ ] removePrefixZerosAndUnderscores ( char [ ] token , boolean isLong ) { int max = token . length ; int start = <NUM_LIT:0> ; int end = max - <NUM_LIT:1> ; if ( isLong ) { end -- ; } if ( max > <NUM_LIT:1> && token [ <NUM_LIT:0> ] == '<CHAR_LIT:0>' ) { if ( max > <NUM_LIT:2> && ( token [ <NUM_LIT:1> ] == '<CHAR_LIT>' || token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { start = <NUM_LIT:2> ; } else if ( max > <NUM_LIT:2> && ( token [ <NUM_LIT:1> ] == '<CHAR_LIT:b>' || token [ <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { start = <NUM_LIT:2> ; } else { start = <NUM_LIT:1> ; } } boolean modified = false ; boolean ignore = true ; loop : for ( int i = start ; i < max ; i ++ ) { char currentChar = token [ i ] ; switch ( currentChar ) { case '<CHAR_LIT:0>' : if ( ignore && ! modified && ( i < end ) ) { modified = true ; } break ; case '<CHAR_LIT:_>' : modified = true ; break loop ; default : ignore = false ; } } if ( ! modified ) { return token ; } ignore = true ; StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( token , <NUM_LIT:0> , start ) ; loop : for ( int i = start ; i < max ; i ++ ) { char currentChar = token [ i ] ; switch ( currentChar ) { case '<CHAR_LIT:0>' : if ( ignore && ( i < end ) ) { continue loop ; } break ; case '<CHAR_LIT:_>' : continue loop ; default : ignore = false ; } buffer . append ( currentChar ) ; } return buffer . toString ( ) . toCharArray ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class DoStatement extends Statement { public Expression condition ; public Statement action ; private BranchLabel breakLabel , continueLabel ; int mergedInitStateIndex = - <NUM_LIT:1> ; int preConditionInitStateIndex = - <NUM_LIT:1> ; public DoStatement ( Expression condition , Statement action , int sourceStart , int sourceEnd ) { this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; this . condition = condition ; this . action = action ; if ( action instanceof EmptyStatement ) action . bits |= ASTNode . IsUsefulEmptyStatement ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { this . breakLabel = new BranchLabel ( ) ; this . continueLabel = new BranchLabel ( ) ; LoopingFlowContext loopingContext = new LoopingFlowContext ( flowContext , flowInfo , this , this . breakLabel , this . continueLabel , currentScope ) ; Constant cst = this . condition . constant ; boolean isConditionTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedTrue = cst != Constant . NotAConstant && cst . booleanValue ( ) == true ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; int previousMode = flowInfo . reachMode ( ) ; FlowInfo initsOnCondition = flowInfo ; UnconditionalFlowInfo actionInfo = flowInfo . nullInfoLessUnconditionalCopy ( ) ; if ( ( this . action != null ) && ! this . action . isEmptyBlock ( ) ) { actionInfo = this . action . analyseCode ( currentScope , loopingContext , actionInfo ) . unconditionalInits ( ) ; if ( ( actionInfo . tagBits & loopingContext . initsOnContinue . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != <NUM_LIT:0> ) { this . continueLabel = null ; } if ( ( this . condition . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { initsOnCondition = flowInfo . unconditionalInits ( ) . addInitializationsFrom ( actionInfo . mergedWith ( loopingContext . initsOnContinue ) ) ; } } if ( ( this . condition . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . condition . checkNPE ( currentScope , flowContext , initsOnCondition ) ; } actionInfo . setReachMode ( previousMode ) ; LoopingFlowContext condLoopContext ; FlowInfo condInfo = this . condition . analyseCode ( currentScope , ( condLoopContext = new LoopingFlowContext ( flowContext , flowInfo , this , null , null , currentScope ) ) , ( this . action == null ? actionInfo : ( actionInfo . mergedWith ( loopingContext . initsOnContinue ) ) ) . copy ( ) ) ; this . preConditionInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( actionInfo . mergedWith ( loopingContext . initsOnContinue ) ) ; if ( ! isConditionOptimizedFalse && this . continueLabel != null ) { loopingContext . complainOnDeferredFinalChecks ( currentScope , condInfo ) ; condLoopContext . complainOnDeferredFinalChecks ( currentScope , condInfo ) ; loopingContext . complainOnDeferredNullChecks ( currentScope , flowInfo . unconditionalCopy ( ) . addPotentialNullInfoFrom ( condInfo . initsWhenTrue ( ) . unconditionalInits ( ) ) ) ; condLoopContext . complainOnDeferredNullChecks ( currentScope , actionInfo . addPotentialNullInfoFrom ( condInfo . initsWhenTrue ( ) . unconditionalInits ( ) ) ) ; } if ( loopingContext . hasEscapingExceptions ( ) ) { FlowInfo loopbackFlowInfo = flowInfo . copy ( ) ; loopbackFlowInfo . mergedWith ( condInfo . initsWhenTrue ( ) . unconditionalCopy ( ) ) ; loopingContext . simulateThrowAfterLoopBack ( loopbackFlowInfo ) ; } FlowInfo mergedInfo = FlowInfo . mergedOptimizedBranches ( ( loopingContext . initsOnBreak . tagBits & FlowInfo . UNREACHABLE ) != <NUM_LIT:0> ? loopingContext . initsOnBreak : flowInfo . unconditionalCopy ( ) . addInitializationsFrom ( loopingContext . initsOnBreak ) , isConditionOptimizedTrue , ( condInfo . tagBits & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ? flowInfo . copy ( ) . addInitializationsFrom ( condInfo . initsWhenFalse ( ) ) : condInfo , false , ! isConditionTrue ) ; this . mergedInitStateIndex = currentScope . methodScope ( ) . recordInitializationStates ( mergedInfo ) ; return mergedInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; BranchLabel actionLabel = new BranchLabel ( codeStream ) ; if ( this . action != null ) actionLabel . tagBits |= BranchLabel . USED ; actionLabel . place ( ) ; this . breakLabel . initialize ( codeStream ) ; boolean hasContinueLabel = this . continueLabel != null ; if ( hasContinueLabel ) { this . continueLabel . initialize ( codeStream ) ; } if ( this . action != null ) { this . action . generateCode ( currentScope , codeStream ) ; } if ( hasContinueLabel ) { this . continueLabel . place ( ) ; if ( this . preConditionInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . preConditionInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . preConditionInitStateIndex ) ; } Constant cst = this . condition . optimizedBooleanConstant ( ) ; boolean isConditionOptimizedFalse = cst != Constant . NotAConstant && cst . booleanValue ( ) == false ; if ( isConditionOptimizedFalse ) { this . condition . generateCode ( currentScope , codeStream , false ) ; } else { this . condition . generateOptimizedBoolean ( currentScope , codeStream , actionLabel , null , true ) ; } } if ( this . mergedInitStateIndex != - <NUM_LIT:1> ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; codeStream . addDefinitelyAssignedVariables ( currentScope , this . mergedInitStateIndex ) ; } if ( this . breakLabel . forwardReferenceCount ( ) > <NUM_LIT:0> ) { this . breakLabel . place ( ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public StringBuffer printStatement ( int indent , StringBuffer output ) { printIndent ( indent , output ) . append ( "<STR_LIT>" ) ; if ( this . action == null ) output . append ( "<STR_LIT>" ) ; else { output . append ( '<STR_LIT:\n>' ) ; this . action . printStatement ( indent + <NUM_LIT:1> , output ) . append ( '<STR_LIT:\n>' ) ; } output . append ( "<STR_LIT>" ) ; return this . condition . printExpression ( <NUM_LIT:0> , output ) . append ( "<STR_LIT>" ) ; } public void resolve ( BlockScope scope ) { TypeBinding type = this . condition . resolveTypeExpecting ( scope , TypeBinding . BOOLEAN ) ; this . condition . computeConversion ( scope , type , type ) ; if ( this . action != null ) this . action . resolve ( scope ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . action != null ) { this . action . traverse ( visitor , scope ) ; } this . condition . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . FlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; public class QualifiedAllocationExpression extends AllocationExpression { public Expression enclosingInstance ; public TypeDeclaration anonymousType ; public QualifiedAllocationExpression ( ) { } public QualifiedAllocationExpression ( TypeDeclaration anonymousType ) { this . anonymousType = anonymousType ; anonymousType . allocation = this ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . enclosingInstance != null ) { flowInfo = this . enclosingInstance . analyseCode ( currentScope , flowContext , flowInfo ) ; } else { if ( this . binding != null && this . binding . declaringClass != null ) { ReferenceBinding superclass = this . binding . declaringClass . superclass ( ) ; if ( superclass != null && superclass . isMemberType ( ) && ! superclass . isStatic ( ) ) { currentScope . resetDeclaringClassMethodStaticFlag ( superclass . enclosingType ( ) ) ; } } } checkCapturedLocalInitializationIfNecessary ( ( ReferenceBinding ) ( this . anonymousType == null ? this . binding . declaringClass . erasure ( ) : this . binding . declaringClass . superclass ( ) . erasure ( ) ) , currentScope , flowInfo ) ; if ( this . arguments != null ) { boolean analyseResources = currentScope . compilerOptions ( ) . analyseResourceLeaks ; for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { if ( analyseResources ) { flowInfo = FakedTrackingVariable . markPassedToOutside ( currentScope , this . arguments [ i ] , flowInfo , false ) ; } flowInfo = this . arguments [ i ] . analyseCode ( currentScope , flowContext , flowInfo ) ; if ( ( this . arguments [ i ] . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . arguments [ i ] . checkNPE ( currentScope , flowContext , flowInfo ) ; } } analyseArguments ( currentScope , flowContext , flowInfo , this . binding , this . arguments ) ; } if ( this . anonymousType != null ) { flowInfo = this . anonymousType . analyseCode ( currentScope , flowContext , flowInfo ) ; } ReferenceBinding [ ] thrownExceptions ; if ( ( ( thrownExceptions = this . binding . thrownExceptions ) . length ) != <NUM_LIT:0> ) { if ( ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) { thrownExceptions = currentScope . environment ( ) . convertToRawTypes ( this . binding . thrownExceptions , true , true ) ; } flowContext . checkExceptionHandlers ( thrownExceptions , this , flowInfo . unconditionalCopy ( ) , currentScope ) ; } if ( currentScope . compilerOptions ( ) . analyseResourceLeaks && FakedTrackingVariable . isAnyCloseable ( this . resolvedType ) ) { FakedTrackingVariable . analyseCloseableAllocation ( currentScope , flowInfo , this ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; manageSyntheticAccessIfNecessary ( currentScope , flowInfo ) ; return flowInfo ; } public Expression enclosingInstance ( ) { return this . enclosingInstance ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { if ( ! valueRequired ) currentScope . problemReporter ( ) . unusedObjectAllocation ( this ) ; int pc = codeStream . position ; MethodBinding codegenBinding = this . binding . original ( ) ; ReferenceBinding allocatedType = codegenBinding . declaringClass ; codeStream . new_ ( allocatedType ) ; boolean isUnboxing = ( this . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; if ( valueRequired || isUnboxing ) { codeStream . dup ( ) ; } if ( this . type != null ) { codeStream . recordPositionsFrom ( pc , this . type . sourceStart ) ; } else { codeStream . ldc ( String . valueOf ( this . enumConstant . name ) ) ; codeStream . generateInlinedValue ( this . enumConstant . binding . id ) ; } if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticEnclosingInstanceValues ( currentScope , allocatedType , enclosingInstance ( ) , this ) ; } generateArguments ( this . binding , this . arguments , currentScope , codeStream ) ; if ( allocatedType . isNestedType ( ) ) { codeStream . generateSyntheticOuterArgumentValues ( currentScope , allocatedType , this ) ; } if ( this . syntheticAccessor == null ) { codeStream . invoke ( Opcodes . OPC_invokespecial , codegenBinding , null ) ; } else { for ( int i = <NUM_LIT:0> , max = this . syntheticAccessor . parameters . length - codegenBinding . parameters . length ; i < max ; i ++ ) { codeStream . aconst_null ( ) ; } codeStream . invoke ( Opcodes . OPC_invokespecial , this . syntheticAccessor , null ) ; } if ( valueRequired ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; } else if ( isUnboxing ) { codeStream . generateImplicitConversion ( this . implicitConversion ) ; switch ( postConversionType ( currentScope ) . id ) { case T_long : case T_double : codeStream . pop2 ( ) ; break ; default : codeStream . pop ( ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; if ( this . anonymousType != null ) { this . anonymousType . generateCode ( currentScope , codeStream ) ; } } public boolean isSuperAccess ( ) { return this . anonymousType != null ; } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { ReferenceBinding allocatedTypeErasure = ( ReferenceBinding ) this . binding . declaringClass . erasure ( ) ; if ( allocatedTypeErasure . isNestedType ( ) && currentScope . enclosingSourceType ( ) . isLocalType ( ) ) { if ( allocatedTypeErasure . isLocalType ( ) ) { ( ( LocalTypeBinding ) allocatedTypeErasure ) . addInnerEmulationDependent ( currentScope , this . enclosingInstance != null ) ; } else { currentScope . propagateInnerEmulation ( allocatedTypeErasure , this . enclosingInstance != null ) ; } } } } public StringBuffer printExpression ( int indent , StringBuffer output ) { if ( this . enclosingInstance != null ) this . enclosingInstance . printExpression ( <NUM_LIT:0> , output ) . append ( '<CHAR_LIT:.>' ) ; super . printExpression ( <NUM_LIT:0> , output ) ; if ( this . anonymousType != null ) { this . anonymousType . print ( indent , output ) ; } return output ; } public TypeBinding resolveType ( BlockScope scope ) { if ( this . anonymousType == null && this . enclosingInstance == null ) { return super . resolveType ( scope ) ; } this . constant = Constant . NotAConstant ; TypeBinding enclosingInstanceType = null ; ReferenceBinding enclosingInstanceReference = null ; TypeBinding receiverType = null ; boolean hasError = false ; boolean enclosingInstanceContainsCast = false ; boolean argsContainCast = false ; if ( this . enclosingInstance != null ) { if ( this . enclosingInstance instanceof CastExpression ) { this . enclosingInstance . bits |= ASTNode . DisableUnnecessaryCastCheck ; enclosingInstanceContainsCast = true ; } if ( ( enclosingInstanceType = this . enclosingInstance . resolveType ( scope ) ) == null ) { hasError = true ; } else if ( enclosingInstanceType . isBaseType ( ) || enclosingInstanceType . isArrayType ( ) ) { scope . problemReporter ( ) . illegalPrimitiveOrArrayTypeForEnclosingInstance ( enclosingInstanceType , this . enclosingInstance ) ; hasError = true ; } else if ( this . type instanceof QualifiedTypeReference ) { scope . problemReporter ( ) . illegalUsageOfQualifiedTypeReference ( ( QualifiedTypeReference ) this . type ) ; hasError = true ; } else if ( ! ( enclosingInstanceReference = ( ReferenceBinding ) enclosingInstanceType ) . canBeSeenBy ( scope ) ) { enclosingInstanceType = new ProblemReferenceBinding ( enclosingInstanceReference . compoundName , enclosingInstanceReference , ProblemReasons . NotVisible ) ; scope . problemReporter ( ) . invalidType ( this . enclosingInstance , enclosingInstanceType ) ; hasError = true ; } else { receiverType = ( ( SingleTypeReference ) this . type ) . resolveTypeEnclosing ( scope , ( ReferenceBinding ) enclosingInstanceType ) ; if ( receiverType != null && enclosingInstanceContainsCast ) { CastExpression . checkNeedForEnclosingInstanceCast ( scope , this . enclosingInstance , enclosingInstanceType , receiverType ) ; } } } else { if ( this . type == null ) { receiverType = scope . enclosingSourceType ( ) ; } else { receiverType = this . type . resolveType ( scope , true ) ; checkParameterizedAllocation : { if ( receiverType == null || ! receiverType . isValidBinding ( ) ) break checkParameterizedAllocation ; if ( this . type instanceof ParameterizedQualifiedTypeReference ) { ReferenceBinding currentType = ( ReferenceBinding ) receiverType ; do { if ( ( currentType . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ) break checkParameterizedAllocation ; if ( currentType . isRawType ( ) ) break checkParameterizedAllocation ; } while ( ( currentType = currentType . enclosingType ( ) ) != null ) ; ParameterizedQualifiedTypeReference qRef = ( ParameterizedQualifiedTypeReference ) this . type ; for ( int i = qRef . typeArguments . length - <NUM_LIT:2> ; i >= <NUM_LIT:0> ; i -- ) { if ( qRef . typeArguments [ i ] != null ) { scope . problemReporter ( ) . illegalQualifiedParameterizedTypeAllocation ( this . type , receiverType ) ; break ; } } } } } } if ( receiverType == null || ! receiverType . isValidBinding ( ) ) { hasError = true ; } final boolean isDiamond = this . type != null && ( this . type . bits & ASTNode . IsDiamond ) != <NUM_LIT:0> ; if ( this . typeArguments != null ) { int length = this . typeArguments . length ; boolean argHasError = scope . compilerOptions ( ) . sourceLevel < ClassFileConstants . JDK1_5 ; this . genericTypeArguments = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeReference typeReference = this . typeArguments [ i ] ; if ( ( this . genericTypeArguments [ i ] = typeReference . resolveType ( scope , true ) ) == null ) { argHasError = true ; } if ( argHasError && typeReference instanceof Wildcard ) { scope . problemReporter ( ) . illegalUsageOfWildcard ( typeReference ) ; } } if ( isDiamond ) { scope . problemReporter ( ) . diamondNotWithExplicitTypeArguments ( this . typeArguments ) ; return null ; } if ( argHasError ) { if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { this . arguments [ i ] . resolveType ( scope ) ; } } return null ; } } TypeBinding [ ] argumentTypes = Binding . NO_PARAMETERS ; if ( this . arguments != null ) { int length = this . arguments . length ; argumentTypes = new TypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression argument = this . arguments [ i ] ; if ( argument instanceof CastExpression ) { argument . bits |= ASTNode . DisableUnnecessaryCastCheck ; argsContainCast = true ; } if ( ( argumentTypes [ i ] = argument . resolveType ( scope ) ) == null ) { hasError = true ; } } } if ( hasError ) { if ( isDiamond ) { return null ; } if ( receiverType instanceof ReferenceBinding ) { ReferenceBinding referenceReceiver = ( ReferenceBinding ) receiverType ; if ( receiverType . isValidBinding ( ) ) { int length = this . arguments == null ? <NUM_LIT:0> : this . arguments . length ; TypeBinding [ ] pseudoArgs = new TypeBinding [ length ] ; for ( int i = length ; -- i >= <NUM_LIT:0> ; ) { pseudoArgs [ i ] = argumentTypes [ i ] == null ? TypeBinding . NULL : argumentTypes [ i ] ; } this . binding = scope . findMethod ( referenceReceiver , TypeConstants . INIT , pseudoArgs , this ) ; if ( this . binding != null && ! this . binding . isValidBinding ( ) ) { MethodBinding closestMatch = ( ( ProblemMethodBinding ) this . binding ) . closestMatch ; if ( closestMatch != null ) { if ( closestMatch . original ( ) . typeVariables != Binding . NO_TYPE_VARIABLES ) { closestMatch = scope . environment ( ) . createParameterizedGenericMethod ( closestMatch . original ( ) , ( RawTypeBinding ) null ) ; } this . binding = closestMatch ; MethodBinding closestMatchOriginal = closestMatch . original ( ) ; if ( closestMatchOriginal . isOrEnclosedByPrivateType ( ) && ! scope . isDefinedInMethod ( closestMatchOriginal ) ) { closestMatchOriginal . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } } } if ( this . anonymousType != null ) { scope . addAnonymousType ( this . anonymousType , referenceReceiver ) ; this . anonymousType . resolve ( scope ) ; return this . resolvedType = this . anonymousType . binding ; } } return this . resolvedType = receiverType ; } if ( this . anonymousType == null ) { if ( ! receiverType . canBeInstantiated ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , receiverType ) ; return this . resolvedType = receiverType ; } if ( isDiamond ) { TypeBinding [ ] inferredTypes = inferElidedTypes ( ( ( ParameterizedTypeBinding ) receiverType ) . genericType ( ) , receiverType . enclosingType ( ) , argumentTypes , scope ) ; if ( inferredTypes == null ) { scope . problemReporter ( ) . cannotInferElidedTypes ( this ) ; return this . resolvedType = null ; } receiverType = this . type . resolvedType = scope . environment ( ) . createParameterizedType ( ( ( ParameterizedTypeBinding ) receiverType ) . genericType ( ) , inferredTypes , ( ( ParameterizedTypeBinding ) receiverType ) . enclosingType ( ) ) ; } ReferenceBinding allocationType = ( ReferenceBinding ) receiverType ; if ( ( this . binding = scope . getConstructor ( allocationType , argumentTypes , this ) ) . isValidBinding ( ) ) { if ( isMethodUseDeprecated ( this . binding , scope , true ) ) { scope . problemReporter ( ) . deprecatedMethod ( this . binding , this ) ; } if ( checkInvocationArguments ( scope , null , allocationType , this . binding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } if ( this . typeArguments != null && this . binding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( this . binding , this . genericTypeArguments , this . typeArguments ) ; } } else { if ( this . binding . declaringClass == null ) { this . binding . declaringClass = allocationType ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , this . binding ) ; return this . resolvedType = receiverType ; } if ( ( this . binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . missingTypeInConstructor ( this , this . binding ) ; } if ( ! isDiamond && receiverType . isParameterizedTypeWithActualArguments ( ) ) { checkTypeArgumentRedundancy ( ( ParameterizedTypeBinding ) receiverType , receiverType . enclosingType ( ) , argumentTypes , scope ) ; } ReferenceBinding expectedType = this . binding . declaringClass . enclosingType ( ) ; if ( expectedType != enclosingInstanceType ) scope . compilationUnitScope ( ) . recordTypeConversion ( expectedType , enclosingInstanceType ) ; if ( enclosingInstanceType . isCompatibleWith ( expectedType ) || scope . isBoxingCompatibleWith ( enclosingInstanceType , expectedType ) ) { this . enclosingInstance . computeConversion ( scope , expectedType , enclosingInstanceType ) ; return this . resolvedType = receiverType ; } scope . problemReporter ( ) . typeMismatchError ( enclosingInstanceType , expectedType , this . enclosingInstance , null ) ; return this . resolvedType = receiverType ; } else { if ( isDiamond ) { scope . problemReporter ( ) . diamondNotWithAnoymousClasses ( this . type ) ; return null ; } } ReferenceBinding superType = ( ReferenceBinding ) receiverType ; if ( superType . isTypeVariable ( ) ) { superType = new ProblemReferenceBinding ( new char [ ] [ ] { superType . sourceName ( ) } , superType , ProblemReasons . IllegalSuperTypeVariable ) ; scope . problemReporter ( ) . invalidType ( this , superType ) ; return null ; } else if ( this . type != null && superType . isEnum ( ) ) { scope . problemReporter ( ) . cannotInstantiate ( this . type , superType ) ; return this . resolvedType = superType ; } ReferenceBinding anonymousSuperclass = superType . isInterface ( ) ? scope . getJavaLangObject ( ) : superType ; scope . addAnonymousType ( this . anonymousType , superType ) ; this . anonymousType . resolve ( scope ) ; this . resolvedType = this . anonymousType . binding ; if ( ( this . resolvedType . tagBits & TagBits . HierarchyHasProblems ) != <NUM_LIT:0> ) { return null ; } MethodBinding inheritedBinding = scope . getConstructor ( anonymousSuperclass , argumentTypes , this ) ; if ( ! inheritedBinding . isValidBinding ( ) ) { if ( inheritedBinding . declaringClass == null ) { inheritedBinding . declaringClass = anonymousSuperclass ; } if ( this . type != null && ! this . type . resolvedType . isValidBinding ( ) ) { return null ; } scope . problemReporter ( ) . invalidConstructor ( this , inheritedBinding ) ; return this . resolvedType ; } if ( ( inheritedBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { scope . problemReporter ( ) . missingTypeInConstructor ( this , inheritedBinding ) ; } if ( this . enclosingInstance != null ) { ReferenceBinding targetEnclosing = inheritedBinding . declaringClass . enclosingType ( ) ; if ( targetEnclosing == null ) { scope . problemReporter ( ) . unnecessaryEnclosingInstanceSpecification ( this . enclosingInstance , superType ) ; return this . resolvedType ; } else if ( ! enclosingInstanceType . isCompatibleWith ( targetEnclosing ) && ! scope . isBoxingCompatibleWith ( enclosingInstanceType , targetEnclosing ) ) { scope . problemReporter ( ) . typeMismatchError ( enclosingInstanceType , targetEnclosing , this . enclosingInstance , null ) ; return this . resolvedType ; } this . enclosingInstance . computeConversion ( scope , targetEnclosing , enclosingInstanceType ) ; } if ( this . arguments != null ) { if ( checkInvocationArguments ( scope , null , anonymousSuperclass , inheritedBinding , this . arguments , argumentTypes , argsContainCast , this ) ) { this . bits |= ASTNode . Unchecked ; } } if ( this . typeArguments != null && inheritedBinding . original ( ) . typeVariables == Binding . NO_TYPE_VARIABLES ) { scope . problemReporter ( ) . unnecessaryTypeArgumentsForMethodInvocation ( inheritedBinding , this . genericTypeArguments , this . typeArguments ) ; } this . binding = this . anonymousType . createDefaultConstructorWithBinding ( inheritedBinding , ( this . bits & ASTNode . Unchecked ) != <NUM_LIT:0> && this . genericTypeArguments == null ) ; return this . resolvedType ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . enclosingInstance != null ) this . enclosingInstance . traverse ( visitor , scope ) ; if ( this . typeArguments != null ) { for ( int i = <NUM_LIT:0> , typeArgumentsLength = this . typeArguments . length ; i < typeArgumentsLength ; i ++ ) { this . typeArguments [ i ] . traverse ( visitor , scope ) ; } } if ( this . type != null ) this . type . traverse ( visitor , scope ) ; if ( this . arguments != null ) { int argumentsLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , scope ) ; } if ( this . anonymousType != null ) this . anonymousType . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . impl . StringConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; public class StringLiteral extends Literal { char [ ] source ; int lineNumber ; public StringLiteral ( char [ ] token , int start , int end , int lineNumber ) { this ( start , end ) ; this . source = token ; this . lineNumber = lineNumber - <NUM_LIT:1> ; } public StringLiteral ( int s , int e ) { super ( s , e ) ; } public void computeConstant ( ) { this . constant = StringConstant . fromValue ( String . valueOf ( this . source ) ) ; } public ExtendedStringLiteral extendWith ( CharLiteral lit ) { return new ExtendedStringLiteral ( this , lit ) ; } public ExtendedStringLiteral extendWith ( StringLiteral lit ) { return new ExtendedStringLiteral ( this , lit ) ; } public StringLiteralConcatenation extendsWith ( StringLiteral lit ) { return new StringLiteralConcatenation ( this , lit ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) codeStream . ldc ( this . constant . stringValue ( ) ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return scope . getJavaLangString ( ) ; } public StringBuffer printExpression ( int indent , StringBuffer output ) { output . append ( '<STR_LIT:\">' ) ; for ( int i = <NUM_LIT:0> ; i < this . source . length ; i ++ ) { switch ( this . source [ i ] ) { case '<STR_LIT>' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\t>' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\n>' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\">' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : output . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\\>' : output . append ( "<STR_LIT>" ) ; break ; default : output . append ( this . source [ i ] ) ; } } output . append ( '<STR_LIT:\">' ) ; return output ; } public char [ ] source ( ) { return this . source ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . codegen . BranchLabel ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . flow . ExceptionHandlingFlowContext ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . flow . InitializationFlowContext ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . SyntheticMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . problem . AbortMethod ; public class Clinit extends AbstractMethodDeclaration { private static int ENUM_CONSTANTS_THRESHOLD = <NUM_LIT> ; private FieldBinding assertionSyntheticFieldBinding = null ; private FieldBinding classLiteralSyntheticField = null ; public Clinit ( CompilationResult compilationResult ) { super ( compilationResult ) ; this . modifiers = <NUM_LIT:0> ; this . selector = TypeConstants . CLINIT ; } public void analyseCode ( ClassScope classScope , InitializationFlowContext staticInitializerFlowContext , FlowInfo flowInfo ) { if ( this . ignoreFurtherInvestigation ) return ; try { ExceptionHandlingFlowContext clinitContext = new ExceptionHandlingFlowContext ( staticInitializerFlowContext . parent , this , Binding . NO_EXCEPTIONS , staticInitializerFlowContext , this . scope , FlowInfo . DEAD_END ) ; if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . NeedFreeReturn ; } flowInfo = flowInfo . mergedWith ( staticInitializerFlowContext . initsOnReturn ) ; FieldBinding [ ] fields = this . scope . enclosingSourceType ( ) . fields ( ) ; for ( int i = <NUM_LIT:0> , count = fields . length ; i < count ; i ++ ) { FieldBinding field ; if ( ( field = fields [ i ] ) . isStatic ( ) && field . isFinal ( ) && ( ! flowInfo . isDefinitelyAssigned ( fields [ i ] ) ) ) { this . scope . problemReporter ( ) . uninitializedBlankFinalField ( field , this . scope . referenceType ( ) . declarationOf ( field . original ( ) ) ) ; } } staticInitializerFlowContext . checkInitializerExceptions ( this . scope , clinitContext , flowInfo ) ; } catch ( AbortMethod e ) { this . ignoreFurtherInvestigation = true ; } } public void generateCode ( ClassScope classScope , ClassFile classFile ) { int clinitOffset = <NUM_LIT:0> ; if ( this . ignoreFurtherInvestigation ) { return ; } boolean restart = false ; do { try { clinitOffset = classFile . contentsOffset ; this . generateCode ( classScope , classFile , clinitOffset ) ; restart = false ; } catch ( AbortMethod e ) { if ( e . compilationResult == CodeStream . RESTART_IN_WIDE_MODE ) { classFile . contentsOffset = clinitOffset ; classFile . methodCount -- ; classFile . codeStream . resetInWideMode ( ) ; restart = true ; } else if ( e . compilationResult == CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE ) { classFile . contentsOffset = clinitOffset ; classFile . methodCount -- ; classFile . codeStream . resetForCodeGenUnusedLocals ( ) ; restart = true ; } else { classFile . contentsOffset = clinitOffset ; classFile . methodCount -- ; restart = false ; } } } while ( restart ) ; } private void generateCode ( ClassScope classScope , ClassFile classFile , int clinitOffset ) { ConstantPool constantPool = classFile . constantPool ; int constantPoolOffset = constantPool . currentOffset ; int constantPoolIndex = constantPool . currentIndex ; classFile . generateMethodInfoHeaderForClinit ( ) ; int codeAttributeOffset = classFile . contentsOffset ; classFile . generateCodeAttributeHeader ( ) ; CodeStream codeStream = classFile . codeStream ; resolve ( classScope ) ; codeStream . reset ( this , classFile ) ; TypeDeclaration declaringType = classScope . referenceContext ; MethodScope staticInitializerScope = declaringType . staticInitializerScope ; staticInitializerScope . computeLocalVariablePositions ( <NUM_LIT:0> , codeStream ) ; if ( this . assertionSyntheticFieldBinding != null ) { codeStream . generateClassLiteralAccessForType ( classScope . outerMostClassScope ( ) . enclosingSourceType ( ) , this . classLiteralSyntheticField ) ; codeStream . invokeJavaLangClassDesiredAssertionStatus ( ) ; BranchLabel falseLabel = new BranchLabel ( codeStream ) ; codeStream . ifne ( falseLabel ) ; codeStream . iconst_1 ( ) ; BranchLabel jumpLabel = new BranchLabel ( codeStream ) ; codeStream . decrStackSize ( <NUM_LIT:1> ) ; codeStream . goto_ ( jumpLabel ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; jumpLabel . place ( ) ; codeStream . fieldAccess ( Opcodes . OPC_putstatic , this . assertionSyntheticFieldBinding , null ) ; } final FieldDeclaration [ ] fieldDeclarations = declaringType . fields ; int sourcePosition = - <NUM_LIT:1> ; int remainingFieldCount = <NUM_LIT:0> ; if ( TypeDeclaration . kind ( declaringType . modifiers ) == TypeDeclaration . ENUM_DECL ) { int enumCount = declaringType . enumConstantsCounter ; if ( enumCount > ENUM_CONSTANTS_THRESHOLD ) { int begin = - <NUM_LIT:1> ; int count = <NUM_LIT:0> ; if ( fieldDeclarations != null ) { int max = fieldDeclarations . length ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; if ( fieldDecl . isStatic ( ) ) { if ( fieldDecl . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { if ( begin == - <NUM_LIT:1> ) { begin = i ; } count ++ ; if ( count > ENUM_CONSTANTS_THRESHOLD ) { SyntheticMethodBinding syntheticMethod = declaringType . binding . addSyntheticMethodForEnumInitialization ( begin , i ) ; codeStream . invoke ( Opcodes . OPC_invokestatic , syntheticMethod , null ) ; begin = i ; count = <NUM_LIT:1> ; } } } } if ( count != <NUM_LIT:0> ) { SyntheticMethodBinding syntheticMethod = declaringType . binding . addSyntheticMethodForEnumInitialization ( begin , max ) ; codeStream . invoke ( Opcodes . OPC_invokestatic , syntheticMethod , null ) ; } } } else if ( fieldDeclarations != null ) { for ( int i = <NUM_LIT:0> , max = fieldDeclarations . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; if ( fieldDecl . isStatic ( ) ) { if ( fieldDecl . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; } else { remainingFieldCount ++ ; } } } } codeStream . generateInlinedValue ( enumCount ) ; codeStream . anewarray ( declaringType . binding ) ; if ( enumCount > <NUM_LIT:0> ) { if ( fieldDeclarations != null ) { for ( int i = <NUM_LIT:0> , max = fieldDeclarations . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; if ( fieldDecl . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { codeStream . dup ( ) ; codeStream . generateInlinedValue ( fieldDecl . binding . id ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , fieldDecl . binding , null ) ; codeStream . aastore ( ) ; } } } } codeStream . fieldAccess ( Opcodes . OPC_putstatic , declaringType . enumValuesSyntheticfield , null ) ; if ( remainingFieldCount != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> , max = fieldDeclarations . length ; i < max && remainingFieldCount >= <NUM_LIT:0> ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; switch ( fieldDecl . getKind ( ) ) { case AbstractVariableDeclaration . ENUM_CONSTANT : break ; case AbstractVariableDeclaration . INITIALIZER : if ( ! fieldDecl . isStatic ( ) ) { break ; } remainingFieldCount -- ; sourcePosition = ( ( Initializer ) fieldDecl ) . block . sourceEnd ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; case AbstractVariableDeclaration . FIELD : if ( ! fieldDecl . binding . isStatic ( ) ) { break ; } remainingFieldCount -- ; sourcePosition = fieldDecl . declarationEnd ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; } } } } else { if ( fieldDeclarations != null ) { for ( int i = <NUM_LIT:0> , max = fieldDeclarations . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; switch ( fieldDecl . getKind ( ) ) { case AbstractVariableDeclaration . INITIALIZER : if ( ! fieldDecl . isStatic ( ) ) break ; sourcePosition = ( ( Initializer ) fieldDecl ) . block . sourceEnd ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; case AbstractVariableDeclaration . FIELD : if ( ! fieldDecl . binding . isStatic ( ) ) break ; sourcePosition = fieldDecl . declarationEnd ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; } } } } if ( codeStream . position == <NUM_LIT:0> ) { classFile . contentsOffset = clinitOffset ; classFile . methodCount -- ; constantPool . resetForClinit ( constantPoolIndex , constantPoolOffset ) ; } else { if ( ( this . bits & ASTNode . NeedFreeReturn ) != <NUM_LIT:0> ) { int before = codeStream . position ; codeStream . return_ ( ) ; if ( sourcePosition != - <NUM_LIT:1> ) { codeStream . recordPositionsFrom ( before , sourcePosition ) ; } } codeStream . recordPositionsFrom ( <NUM_LIT:0> , declaringType . sourceStart ) ; classFile . completeCodeAttributeForClinit ( codeAttributeOffset ) ; } } public boolean isClinit ( ) { return true ; } public boolean isInitializationMethod ( ) { return true ; } public boolean isStatic ( ) { return true ; } public void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) { } public StringBuffer print ( int tab , StringBuffer output ) { printIndent ( tab , output ) . append ( "<STR_LIT>" ) ; printBody ( tab + <NUM_LIT:1> , output ) ; return output ; } public void resolve ( ClassScope classScope ) { this . scope = new MethodScope ( classScope , classScope . referenceContext , true ) ; } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { visitor . visit ( this , classScope ) ; visitor . endVisit ( this , classScope ) ; } public void setAssertionSupport ( FieldBinding assertionSyntheticFieldBinding , boolean needClassLiteralField ) { this . assertionSyntheticFieldBinding = assertionSyntheticFieldBinding ; if ( needClassLiteralField ) { SourceTypeBinding sourceType = this . scope . outerMostClassScope ( ) . enclosingSourceType ( ) ; if ( ! sourceType . isInterface ( ) && ! sourceType . isBaseType ( ) ) { this . classLiteralSyntheticField = sourceType . addSyntheticFieldForClassLiteral ( sourceType , this . scope ) ; } } } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . parser . * ; import org . eclipse . jdt . internal . compiler . problem . * ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ConstructorDeclaration extends AbstractMethodDeclaration { public ExplicitConstructorCall constructorCall ; public TypeParameter [ ] typeParameters ; public ConstructorDeclaration ( CompilationResult compilationResult ) { super ( compilationResult ) ; } public void analyseCode ( ClassScope classScope , InitializationFlowContext initializerFlowContext , FlowInfo flowInfo , int initialReachMode ) { if ( this . ignoreFurtherInvestigation ) return ; int nonStaticFieldInfoReachMode = flowInfo . reachMode ( ) ; flowInfo . setReachMode ( initialReachMode ) ; checkUnused : { MethodBinding constructorBinding ; if ( ( constructorBinding = this . binding ) == null ) break checkUnused ; if ( ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) break checkUnused ; if ( constructorBinding . isUsed ( ) ) break checkUnused ; if ( constructorBinding . isPrivate ( ) ) { if ( ( this . binding . declaringClass . tagBits & TagBits . HasNonPrivateConstructor ) == <NUM_LIT:0> ) break checkUnused ; } else if ( ! constructorBinding . isOrEnclosedByPrivateType ( ) ) { break checkUnused ; } if ( this . constructorCall == null ) break checkUnused ; if ( this . constructorCall . accessMode != ExplicitConstructorCall . This ) { ReferenceBinding superClass = constructorBinding . declaringClass . superclass ( ) ; if ( superClass == null ) break checkUnused ; MethodBinding methodBinding = superClass . getExactConstructor ( Binding . NO_PARAMETERS ) ; if ( methodBinding == null ) break checkUnused ; if ( ! methodBinding . canBeSeenBy ( SuperReference . implicitSuperConstructorCall ( ) , this . scope ) ) break checkUnused ; } this . scope . problemReporter ( ) . unusedPrivateConstructor ( this ) ; } if ( isRecursive ( null ) ) { this . scope . problemReporter ( ) . recursiveConstructorInvocation ( this . constructorCall ) ; } try { ExceptionHandlingFlowContext constructorContext = new ExceptionHandlingFlowContext ( initializerFlowContext . parent , this , this . binding . thrownExceptions , initializerFlowContext , this . scope , FlowInfo . DEAD_END ) ; initializerFlowContext . checkInitializerExceptions ( this . scope , constructorContext , flowInfo ) ; if ( this . binding . declaringClass . isAnonymousType ( ) ) { ArrayList computedExceptions = constructorContext . extendedExceptions ; if ( computedExceptions != null ) { int size ; if ( ( size = computedExceptions . size ( ) ) > <NUM_LIT:0> ) { ReferenceBinding [ ] actuallyThrownExceptions ; computedExceptions . toArray ( actuallyThrownExceptions = new ReferenceBinding [ size ] ) ; this . binding . thrownExceptions = actuallyThrownExceptions ; } } } analyseArguments ( flowInfo ) ; if ( this . constructorCall != null ) { if ( this . constructorCall . accessMode == ExplicitConstructorCall . This ) { FieldBinding [ ] fields = this . binding . declaringClass . fields ( ) ; for ( int i = <NUM_LIT:0> , count = fields . length ; i < count ; i ++ ) { FieldBinding field ; if ( ! ( field = fields [ i ] ) . isStatic ( ) ) { flowInfo . markAsDefinitelyAssigned ( field ) ; } } } flowInfo = this . constructorCall . analyseCode ( this . scope , constructorContext , flowInfo ) ; } flowInfo . setReachMode ( nonStaticFieldInfoReachMode ) ; if ( this . statements != null ) { int complaintLevel = ( nonStaticFieldInfoReachMode & FlowInfo . UNREACHABLE ) == <NUM_LIT:0> ? Statement . NOT_COMPLAINED : Statement . COMPLAINED_FAKE_REACHABLE ; for ( int i = <NUM_LIT:0> , count = this . statements . length ; i < count ; i ++ ) { Statement stat = this . statements [ i ] ; if ( ( complaintLevel = stat . complainIfUnreachable ( flowInfo , this . scope , complaintLevel , true ) ) < Statement . COMPLAINED_UNREACHABLE ) { flowInfo = stat . analyseCode ( this . scope , constructorContext , flowInfo ) ; } } } if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . NeedFreeReturn ; } if ( ( this . constructorCall != null ) && ( this . constructorCall . accessMode != ExplicitConstructorCall . This ) ) { flowInfo = flowInfo . mergedWith ( constructorContext . initsOnReturn ) ; FieldBinding [ ] fields = this . binding . declaringClass . fields ( ) ; for ( int i = <NUM_LIT:0> , count = fields . length ; i < count ; i ++ ) { FieldBinding field ; if ( ( ! ( field = fields [ i ] ) . isStatic ( ) ) && field . isFinal ( ) && ( ! flowInfo . isDefinitelyAssigned ( fields [ i ] ) ) ) { this . scope . problemReporter ( ) . uninitializedBlankFinalField ( field , ( ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) ? ( ASTNode ) this . scope . referenceType ( ) : this ) ; } } } constructorContext . complainIfUnusedExceptionHandlers ( this ) ; this . scope . checkUnusedParameters ( this . binding ) ; this . scope . checkUnclosedCloseables ( flowInfo , null , null , null ) ; } catch ( AbortMethod e ) { this . ignoreFurtherInvestigation = true ; } } public void generateCode ( ClassScope classScope , ClassFile classFile ) { int problemResetPC = <NUM_LIT:0> ; if ( this . ignoreFurtherInvestigation ) { if ( this . binding == null ) return ; int problemsLength ; CategorizedProblem [ ] problems = this . scope . referenceCompilationUnit ( ) . compilationResult . getProblems ( ) ; CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; classFile . addProblemConstructor ( this , this . binding , problemsCopy ) ; return ; } boolean restart = false ; boolean abort = false ; do { try { problemResetPC = classFile . contentsOffset ; internalGenerateCode ( classScope , classFile ) ; restart = false ; } catch ( AbortMethod e ) { if ( e . compilationResult == CodeStream . RESTART_IN_WIDE_MODE ) { classFile . contentsOffset = problemResetPC ; classFile . methodCount -- ; classFile . codeStream . resetInWideMode ( ) ; restart = true ; } else if ( e . compilationResult == CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE ) { classFile . contentsOffset = problemResetPC ; classFile . methodCount -- ; classFile . codeStream . resetForCodeGenUnusedLocals ( ) ; restart = true ; } else { restart = false ; abort = true ; } } } while ( restart ) ; if ( abort ) { int problemsLength ; CategorizedProblem [ ] problems = this . scope . referenceCompilationUnit ( ) . compilationResult . getAllProblems ( ) ; CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; classFile . addProblemConstructor ( this , this . binding , problemsCopy , problemResetPC ) ; } } public void generateSyntheticFieldInitializationsIfNecessary ( MethodScope methodScope , CodeStream codeStream , ReferenceBinding declaringClass ) { if ( ! declaringClass . isNestedType ( ) ) return ; NestedTypeBinding nestedType = ( NestedTypeBinding ) declaringClass ; SyntheticArgumentBinding [ ] syntheticArgs = nestedType . syntheticEnclosingInstances ( ) ; if ( syntheticArgs != null ) { for ( int i = <NUM_LIT:0> , max = syntheticArgs . length ; i < max ; i ++ ) { SyntheticArgumentBinding syntheticArg ; if ( ( syntheticArg = syntheticArgs [ i ] ) . matchingField != null ) { codeStream . aload_0 ( ) ; codeStream . load ( syntheticArg ) ; codeStream . fieldAccess ( Opcodes . OPC_putfield , syntheticArg . matchingField , null ) ; } } } syntheticArgs = nestedType . syntheticOuterLocalVariables ( ) ; if ( syntheticArgs != null ) { for ( int i = <NUM_LIT:0> , max = syntheticArgs . length ; i < max ; i ++ ) { SyntheticArgumentBinding syntheticArg ; if ( ( syntheticArg = syntheticArgs [ i ] ) . matchingField != null ) { codeStream . aload_0 ( ) ; codeStream . load ( syntheticArg ) ; codeStream . fieldAccess ( Opcodes . OPC_putfield , syntheticArg . matchingField , null ) ; } } } } private void internalGenerateCode ( ClassScope classScope , ClassFile classFile ) { classFile . generateMethodInfoHeader ( this . binding ) ; int methodAttributeOffset = classFile . contentsOffset ; int attributeNumber = classFile . generateMethodInfoAttributes ( this . binding ) ; if ( ( ! this . binding . isNative ( ) ) && ( ! this . binding . isAbstract ( ) ) ) { TypeDeclaration declaringType = classScope . referenceContext ; int codeAttributeOffset = classFile . contentsOffset ; classFile . generateCodeAttributeHeader ( ) ; CodeStream codeStream = classFile . codeStream ; codeStream . reset ( this , classFile ) ; ReferenceBinding declaringClass = this . binding . declaringClass ; int enumOffset = declaringClass . isEnum ( ) ? <NUM_LIT:2> : <NUM_LIT:0> ; int argSlotSize = <NUM_LIT:1> + enumOffset ; if ( declaringClass . isNestedType ( ) ) { this . scope . extraSyntheticArguments = declaringClass . syntheticOuterLocalVariables ( ) ; this . scope . computeLocalVariablePositions ( declaringClass . getEnclosingInstancesSlotSize ( ) + <NUM_LIT:1> + enumOffset , codeStream ) ; argSlotSize += declaringClass . getEnclosingInstancesSlotSize ( ) ; argSlotSize += declaringClass . getOuterLocalVariablesSlotSize ( ) ; } else { this . scope . computeLocalVariablePositions ( <NUM_LIT:1> + enumOffset , codeStream ) ; } if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { LocalVariableBinding argBinding ; codeStream . addVisibleLocalVariable ( argBinding = this . arguments [ i ] . binding ) ; argBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; switch ( argBinding . type . id ) { case TypeIds . T_long : case TypeIds . T_double : argSlotSize += <NUM_LIT:2> ; break ; default : argSlotSize ++ ; break ; } } } MethodScope initializerScope = declaringType . initializerScope ; initializerScope . computeLocalVariablePositions ( argSlotSize , codeStream ) ; boolean needFieldInitializations = this . constructorCall == null || this . constructorCall . accessMode != ExplicitConstructorCall . This ; boolean preInitSyntheticFields = this . scope . compilerOptions ( ) . targetJDK >= ClassFileConstants . JDK1_4 ; if ( needFieldInitializations && preInitSyntheticFields ) { generateSyntheticFieldInitializationsIfNecessary ( this . scope , codeStream , declaringClass ) ; codeStream . recordPositionsFrom ( <NUM_LIT:0> , this . bodyStart ) ; } if ( this . constructorCall != null ) { this . constructorCall . generateCode ( this . scope , codeStream ) ; } if ( needFieldInitializations ) { if ( ! preInitSyntheticFields ) { generateSyntheticFieldInitializationsIfNecessary ( this . scope , codeStream , declaringClass ) ; } if ( declaringType . fields != null ) { for ( int i = <NUM_LIT:0> , max = declaringType . fields . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl ; if ( ! ( fieldDecl = declaringType . fields [ i ] ) . isStatic ( ) ) { fieldDecl . generateCode ( initializerScope , codeStream ) ; } } } } if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , max = this . statements . length ; i < max ; i ++ ) { this . statements [ i ] . generateCode ( this . scope , codeStream ) ; } } if ( this . ignoreFurtherInvestigation ) { throw new AbortMethod ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } if ( ( this . bits & ASTNode . NeedFreeReturn ) != <NUM_LIT:0> ) { codeStream . return_ ( ) ; } codeStream . exitUserScope ( this . scope ) ; codeStream . recordPositionsFrom ( <NUM_LIT:0> , this . bodyEnd ) ; try { classFile . completeCodeAttribute ( codeAttributeOffset ) ; } catch ( NegativeArraySizeException e ) { throw new AbortMethod ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } attributeNumber ++ ; if ( ( codeStream instanceof StackMapFrameCodeStream ) && needFieldInitializations && declaringType . fields != null ) { ( ( StackMapFrameCodeStream ) codeStream ) . resetSecretLocals ( ) ; } } classFile . completeMethodInfo ( this . binding , methodAttributeOffset , attributeNumber ) ; } public boolean isConstructor ( ) { return true ; } public boolean isDefaultConstructor ( ) { return ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ; } public boolean isInitializationMethod ( ) { return true ; } public boolean isRecursive ( ArrayList visited ) { if ( this . binding == null || this . constructorCall == null || this . constructorCall . binding == null || this . constructorCall . isSuperAccess ( ) || ! this . constructorCall . binding . isValidBinding ( ) ) { return false ; } ConstructorDeclaration targetConstructor = ( ( ConstructorDeclaration ) this . scope . referenceType ( ) . declarationOf ( this . constructorCall . binding . original ( ) ) ) ; if ( targetConstructor == null ) return false ; if ( this == targetConstructor ) return true ; if ( visited == null ) { visited = new ArrayList ( <NUM_LIT:1> ) ; } else { int index = visited . indexOf ( this ) ; if ( index >= <NUM_LIT:0> ) return index == <NUM_LIT:0> ; } visited . add ( this ) ; return targetConstructor . isRecursive ( visited ) ; } public void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) { if ( ( ( this . bits & ASTNode . IsDefaultConstructor ) != <NUM_LIT:0> ) && this . constructorCall == null ) { this . constructorCall = SuperReference . implicitSuperConstructorCall ( ) ; this . constructorCall . sourceStart = this . sourceStart ; this . constructorCall . sourceEnd = this . sourceEnd ; return ; } parser . parse ( this , unit , false ) ; } public StringBuffer printBody ( int indent , StringBuffer output ) { output . append ( "<STR_LIT>" ) ; if ( this . constructorCall != null ) { output . append ( '<STR_LIT:\n>' ) ; this . constructorCall . printStatement ( indent , output ) ; } if ( this . statements != null ) { for ( int i = <NUM_LIT:0> ; i < this . statements . length ; i ++ ) { output . append ( '<STR_LIT:\n>' ) ; this . statements [ i ] . printStatement ( indent , output ) ; } } output . append ( '<STR_LIT:\n>' ) ; printIndent ( indent == <NUM_LIT:0> ? <NUM_LIT:0> : indent - <NUM_LIT:1> , output ) . append ( '<CHAR_LIT:}>' ) ; return output ; } public void resolveJavadoc ( ) { if ( this . binding == null || this . javadoc != null ) { super . resolveJavadoc ( ) ; } else if ( ( this . bits & ASTNode . IsDefaultConstructor ) == <NUM_LIT:0> ) { if ( this . binding . declaringClass != null && ! this . binding . declaringClass . isLocalType ( ) ) { int javadocVisibility = this . binding . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; ClassScope classScope = this . scope . classScope ( ) ; ProblemReporter reporter = this . scope . problemReporter ( ) ; int severity = reporter . computeSeverity ( IProblem . JavadocMissing ) ; if ( severity != ProblemSeverities . Ignore ) { if ( classScope != null ) { javadocVisibility = Util . computeOuterMostVisibility ( classScope . referenceType ( ) , javadocVisibility ) ; } int javadocModifiers = ( this . binding . modifiers & ~ ExtraCompilerModifiers . AccVisibilityMASK ) | javadocVisibility ; reporter . javadocMissing ( this . sourceStart , this . sourceEnd , severity , javadocModifiers ) ; } } } } public void resolveStatements ( ) { SourceTypeBinding sourceType = this . scope . enclosingSourceType ( ) ; if ( ! CharOperation . equals ( sourceType . sourceName , this . selector ) ) { this . scope . problemReporter ( ) . missingReturnType ( this ) ; } if ( this . typeParameters != null ) { for ( int i = <NUM_LIT:0> , length = this . typeParameters . length ; i < length ; i ++ ) { this . typeParameters [ i ] . resolve ( this . scope ) ; } } if ( this . binding != null && ! this . binding . isPrivate ( ) ) { sourceType . tagBits |= TagBits . HasNonPrivateConstructor ; } if ( this . constructorCall != null ) { if ( sourceType . id == TypeIds . T_JavaLangObject && this . constructorCall . accessMode != ExplicitConstructorCall . This ) { if ( this . constructorCall . accessMode == ExplicitConstructorCall . Super ) { this . scope . problemReporter ( ) . cannotUseSuperInJavaLangObject ( this . constructorCall ) ; } this . constructorCall = null ; } else { this . constructorCall . resolve ( this . scope ) ; } } if ( ( this . modifiers & ExtraCompilerModifiers . AccSemicolonBody ) != <NUM_LIT:0> ) { this . scope . problemReporter ( ) . methodNeedBody ( this ) ; } super . resolveStatements ( ) ; } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { if ( visitor . visit ( this , classScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int typeParametersLength = this . typeParameters . length ; for ( int i = <NUM_LIT:0> ; i < typeParametersLength ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . arguments != null ) { int argumentLength = this . arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentLength ; i ++ ) this . arguments [ i ] . traverse ( visitor , this . scope ) ; } if ( this . thrownExceptions != null ) { int thrownExceptionsLength = this . thrownExceptions . length ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionsLength ; i ++ ) this . thrownExceptions [ i ] . traverse ( visitor , this . scope ) ; } if ( this . constructorCall != null ) this . constructorCall . traverse ( visitor , this . scope ) ; if ( this . statements != null ) { int statementsLength = this . statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) this . statements [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , classScope ) ; } public TypeParameter [ ] typeParameters ( ) { return this . typeParameters ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . flow . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class LocalDeclaration extends AbstractVariableDeclaration { public LocalVariableBinding binding ; public LocalDeclaration ( char [ ] name , int sourceStart , int sourceEnd ) { this . name = name ; this . sourceStart = sourceStart ; this . sourceEnd = sourceEnd ; this . declarationEnd = sourceEnd ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == <NUM_LIT:0> ) { this . bits |= ASTNode . IsLocalDeclarationReachable ; } if ( this . binding != null && this . type . resolvedType instanceof TypeVariableBinding ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . type . resolvedType ; MethodScope methodScope = this . binding . declaringScope . methodScope ( ) ; if ( methodScope != null && methodScope . referenceContext instanceof TypeDeclaration ) { methodScope = methodScope . enclosingMethodScope ( ) ; } AbstractMethodDeclaration methodDeclaration = ( methodScope != null ) ? methodScope . referenceMethod ( ) : null ; if ( methodDeclaration != null && methodDeclaration . binding != null ) { TypeVariableBinding [ ] typeVariables = methodDeclaration . binding . typeVariables ( ) ; if ( typeVariables == null ) typeVariables = Binding . NO_TYPE_VARIABLES ; if ( typeVariables == Binding . NO_TYPE_VARIABLES ) { if ( typeVariableBinding != null && typeVariableBinding . declaringElement instanceof TypeBinding ) currentScope . resetDeclaringClassMethodStaticFlag ( ( TypeBinding ) typeVariableBinding . declaringElement ) ; else currentScope . resetEnclosingMethodStaticFlag ( ) ; } else { boolean usesEnclosingTypeVar = false ; for ( int i = <NUM_LIT:0> ; i < typeVariables . length ; i ++ ) { if ( typeVariables [ i ] == this . type . resolvedType ) { usesEnclosingTypeVar = true ; break ; } } if ( ! usesEnclosingTypeVar ) { if ( typeVariableBinding != null && typeVariableBinding . declaringElement instanceof TypeBinding ) currentScope . resetDeclaringClassMethodStaticFlag ( ( TypeBinding ) typeVariableBinding . declaringElement ) ; else currentScope . resetEnclosingMethodStaticFlag ( ) ; } } } } if ( this . initialization == null ) { return flowInfo ; } if ( ( this . initialization . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ) { this . initialization . checkNPE ( currentScope , flowContext , flowInfo ) ; } FlowInfo preInitInfo = null ; boolean shouldAnalyseResource = this . binding != null && flowInfo . reachMode ( ) == FlowInfo . REACHABLE && currentScope . compilerOptions ( ) . analyseResourceLeaks && FakedTrackingVariable . isAnyCloseable ( this . initialization . resolvedType ) ; if ( shouldAnalyseResource ) { preInitInfo = flowInfo . unconditionalCopy ( ) ; FakedTrackingVariable . preConnectTrackerAcrossAssignment ( this , this . binding , this . initialization ) ; } flowInfo = this . initialization . analyseCode ( currentScope , flowContext , flowInfo ) . unconditionalInits ( ) ; if ( shouldAnalyseResource ) FakedTrackingVariable . handleResourceAssignment ( currentScope , preInitInfo , flowInfo , this , this . initialization , this . binding ) ; else FakedTrackingVariable . cleanUpAfterAssignment ( currentScope , Binding . LOCAL , this . initialization ) ; int nullStatus = this . initialization . nullStatus ( flowInfo ) ; if ( ! flowInfo . isDefinitelyAssigned ( this . binding ) ) { this . bits |= FirstAssignmentToLocal ; } else { this . bits &= ~ FirstAssignmentToLocal ; } flowInfo . markAsDefinitelyAssigned ( this . binding ) ; nullStatus = checkAssignmentAgainstNullAnnotation ( currentScope , flowContext , this . binding , nullStatus , this . initialization , this . initialization . resolvedType ) ; if ( ( this . binding . type . tagBits & TagBits . IsBaseType ) == <NUM_LIT:0> ) { flowInfo . markNullStatus ( this . binding , nullStatus ) ; } return flowInfo ; } public void checkModifiers ( ) { if ( ( ( this . modifiers & ExtraCompilerModifiers . AccJustFlag ) & ~ ClassFileConstants . AccFinal ) != <NUM_LIT:0> ) this . modifiers = ( this . modifiers & ~ ExtraCompilerModifiers . AccAlternateModifierProblem ) | ExtraCompilerModifiers . AccModifierProblem ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( this . binding . resolvedPosition != - <NUM_LIT:1> ) { codeStream . addVisibleLocalVariable ( this . binding ) ; } if ( ( this . bits & IsReachable ) == <NUM_LIT:0> ) { return ; } int pc = codeStream . position ; generateInit : { if ( this . initialization == null ) break generateInit ; if ( this . binding . resolvedPosition < <NUM_LIT:0> ) { if ( this . initialization . constant != Constant . NotAConstant ) break generateInit ; this . initialization . generateCode ( currentScope , codeStream , false ) ; break generateInit ; } this . initialization . generateCode ( currentScope , codeStream , true ) ; if ( this . binding . type . isArrayType ( ) && ( ( this . initialization instanceof CastExpression ) && ( ( ( CastExpression ) this . initialization ) . innermostCastedExpression ( ) . resolvedType == TypeBinding . NULL ) ) ) { codeStream . checkcast ( this . binding . type ) ; } codeStream . store ( this . binding , false ) ; if ( ( this . bits & ASTNode . FirstAssignmentToLocal ) != <NUM_LIT:0> ) { this . binding . recordInitializationStartPC ( codeStream . position ) ; } } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public int getKind ( ) { return LOCAL_VARIABLE ; } public void resolve ( BlockScope scope ) { TypeBinding variableType = this . type . resolveType ( scope , true ) ; checkModifiers ( ) ; if ( variableType != null ) { if ( variableType == TypeBinding . VOID ) { scope . problemReporter ( ) . variableTypeCannotBeVoid ( this ) ; return ; } if ( variableType . isArrayType ( ) && ( ( ArrayBinding ) variableType ) . leafComponentType == TypeBinding . VOID ) { scope . problemReporter ( ) . variableTypeCannotBeVoidArray ( this ) ; return ; } } Binding existingVariable = scope . getBinding ( this . name , Binding . VARIABLE , this , false ) ; if ( existingVariable != null && existingVariable . isValidBinding ( ) ) { if ( existingVariable instanceof LocalVariableBinding && this . hiddenVariableDepth == <NUM_LIT:0> ) { scope . problemReporter ( ) . redefineLocal ( this ) ; } else { scope . problemReporter ( ) . localVariableHiding ( this , existingVariable , false ) ; } } if ( ( this . modifiers & ClassFileConstants . AccFinal ) != <NUM_LIT:0> && this . initialization == null ) { this . modifiers |= ExtraCompilerModifiers . AccBlankFinal ; } this . binding = new LocalVariableBinding ( this , variableType , this . modifiers , false ) ; scope . addLocalVariable ( this . binding ) ; this . binding . setConstant ( Constant . NotAConstant ) ; if ( variableType == null ) { if ( this . initialization != null ) this . initialization . resolveType ( scope ) ; return ; } if ( this . initialization != null ) { if ( this . initialization instanceof ArrayInitializer ) { TypeBinding initializationType = this . initialization . resolveTypeExpecting ( scope , variableType ) ; if ( initializationType != null ) { ( ( ArrayInitializer ) this . initialization ) . binding = ( ArrayBinding ) initializationType ; this . initialization . computeConversion ( scope , variableType , initializationType ) ; } } else { this . initialization . setExpectedType ( variableType ) ; TypeBinding initializationType = this . initialization . resolveType ( scope ) ; if ( initializationType != null ) { if ( variableType != initializationType ) scope . compilationUnitScope ( ) . recordTypeConversion ( variableType , initializationType ) ; if ( this . initialization . isConstantValueOfTypeAssignableToType ( initializationType , variableType ) || initializationType . isCompatibleWith ( variableType ) ) { this . initialization . computeConversion ( scope , variableType , initializationType ) ; if ( initializationType . needsUncheckedConversion ( variableType ) ) { scope . problemReporter ( ) . unsafeTypeConversion ( this . initialization , initializationType , variableType ) ; } if ( this . initialization instanceof CastExpression && ( this . initialization . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , variableType , ( CastExpression ) this . initialization ) ; } } else if ( isBoxingCompatible ( initializationType , variableType , this . initialization , scope ) ) { this . initialization . computeConversion ( scope , variableType , initializationType ) ; if ( this . initialization instanceof CastExpression && ( this . initialization . bits & ASTNode . UnnecessaryCast ) == <NUM_LIT:0> ) { CastExpression . checkNeedForAssignedCast ( scope , variableType , ( CastExpression ) this . initialization ) ; } } else { if ( ( variableType . tagBits & TagBits . HasMissingType ) == <NUM_LIT:0> ) { scope . problemReporter ( ) . typeMismatchError ( initializationType , variableType , this . initialization , null ) ; } } } } if ( this . binding == Expression . getDirectBinding ( this . initialization ) ) { scope . problemReporter ( ) . assignmentHasNoEffect ( this , this . name ) ; } this . binding . setConstant ( this . binding . isFinal ( ) ? this . initialization . constant . castTo ( ( variableType . id << <NUM_LIT:4> ) + this . initialization . constant . typeID ( ) ) : Constant . NotAConstant ) ; } resolveAnnotations ( scope , this . annotations , this . binding ) ; scope . validateNullAnnotation ( this . binding . tagBits , this . type , this . annotations ) ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { if ( visitor . visit ( this , scope ) ) { if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = <NUM_LIT:0> ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , scope ) ; } this . type . traverse ( visitor , scope ) ; if ( this . initialization != null ) this . initialization . traverse ( visitor , scope ) ; } visitor . endVisit ( this , scope ) ; } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . flow . FlowInfo ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . * ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . problem . * ; import org . eclipse . jdt . internal . compiler . parser . * ; import org . eclipse . jdt . internal . compiler . util . Util ; public abstract class AbstractMethodDeclaration extends ASTNode implements ProblemSeverities , ReferenceContext { public MethodScope scope ; public char [ ] selector ; public int declarationSourceStart ; public int declarationSourceEnd ; public int modifiers ; public int modifiersSourceStart ; public Annotation [ ] annotations ; public Argument [ ] arguments ; public TypeReference [ ] thrownExceptions ; public Statement [ ] statements ; public int explicitDeclarations ; public MethodBinding binding ; public boolean ignoreFurtherInvestigation = false ; public Javadoc javadoc ; public int bodyStart ; public int bodyEnd = - <NUM_LIT:1> ; public CompilationResult compilationResult ; AbstractMethodDeclaration ( CompilationResult compilationResult ) { this . compilationResult = compilationResult ; } public void abort ( int abortLevel , CategorizedProblem problem ) { switch ( abortLevel ) { case AbortCompilation : throw new AbortCompilation ( this . compilationResult , problem ) ; case AbortCompilationUnit : throw new AbortCompilationUnit ( this . compilationResult , problem ) ; case AbortType : throw new AbortType ( this . compilationResult , problem ) ; default : throw new AbortMethod ( this . compilationResult , problem ) ; } } public void createArgumentBindings ( ) { if ( this . arguments != null && this . binding != null ) { for ( int i = <NUM_LIT:0> , length = this . arguments . length ; i < length ; i ++ ) { Argument argument = this . arguments [ i ] ; argument . createBinding ( this . scope , this . binding . parameters [ i ] ) ; if ( ( argument . binding . tagBits & ( TagBits . AnnotationNonNull | TagBits . AnnotationNullable ) ) != <NUM_LIT:0> ) { if ( this . binding . parameterNonNullness == null ) this . binding . parameterNonNullness = new Boolean [ this . arguments . length ] ; this . binding . parameterNonNullness [ i ] = Boolean . valueOf ( ( argument . binding . tagBits & TagBits . AnnotationNonNull ) != <NUM_LIT:0> ) ; } } } } public void bindArguments ( ) { if ( this . arguments != null ) { if ( this . binding == null ) { for ( int i = <NUM_LIT:0> , length = this . arguments . length ; i < length ; i ++ ) { this . arguments [ i ] . bind ( this . scope , null , true ) ; } return ; } boolean used = this . binding . isAbstract ( ) || this . binding . isNative ( ) ; AnnotationBinding [ ] [ ] paramAnnotations = null ; for ( int i = <NUM_LIT:0> , length = this . arguments . length ; i < length ; i ++ ) { Argument argument = this . arguments [ i ] ; argument . bind ( this . scope , this . binding . parameters [ i ] , used ) ; if ( argument . annotations != null ) { if ( paramAnnotations == null ) { paramAnnotations = new AnnotationBinding [ length ] [ ] ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { paramAnnotations [ j ] = Binding . NO_ANNOTATIONS ; } } paramAnnotations [ i ] = argument . binding . getAnnotations ( ) ; } else if ( paramAnnotations != null ) { paramAnnotations [ i ] = Binding . NO_ANNOTATIONS ; } } if ( paramAnnotations != null ) this . binding . setParameterAnnotations ( paramAnnotations ) ; } } public void bindThrownExceptions ( ) { if ( this . thrownExceptions != null && this . binding != null && this . binding . thrownExceptions != null ) { int thrownExceptionLength = this . thrownExceptions . length ; int length = this . binding . thrownExceptions . length ; if ( length == thrownExceptionLength ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . thrownExceptions [ i ] . resolvedType = this . binding . thrownExceptions [ i ] ; } } else { int bindingIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < thrownExceptionLength && bindingIndex < length ; i ++ ) { TypeReference thrownException = this . thrownExceptions [ i ] ; ReferenceBinding thrownExceptionBinding = this . binding . thrownExceptions [ bindingIndex ] ; char [ ] [ ] bindingCompoundName = thrownExceptionBinding . compoundName ; if ( bindingCompoundName == null ) continue ; if ( thrownException instanceof SingleTypeReference ) { int lengthName = bindingCompoundName . length ; char [ ] thrownExceptionTypeName = thrownException . getTypeName ( ) [ <NUM_LIT:0> ] ; if ( CharOperation . equals ( thrownExceptionTypeName , bindingCompoundName [ lengthName - <NUM_LIT:1> ] ) ) { thrownException . resolvedType = thrownExceptionBinding ; bindingIndex ++ ; } } else { if ( CharOperation . equals ( thrownException . getTypeName ( ) , bindingCompoundName ) ) { thrownException . resolvedType = thrownExceptionBinding ; bindingIndex ++ ; } } } } } } void analyseArguments ( FlowInfo flowInfo ) { if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , count = this . arguments . length ; i < count ; i ++ ) { if ( this . binding . parameterNonNullness != null ) { Boolean nonNullNess = this . binding . parameterNonNullness [ i ] ; if ( nonNullNess != null ) { if ( nonNullNess . booleanValue ( ) ) flowInfo . markAsDefinitelyNonNull ( this . arguments [ i ] . binding ) ; else flowInfo . markPotentiallyNullBit ( this . arguments [ i ] . binding ) ; } } flowInfo . markAsDefinitelyAssigned ( this . arguments [ i ] . binding ) ; } } } public CompilationResult compilationResult ( ) { return this . compilationResult ; } public void generateCode ( ClassScope classScope , ClassFile classFile ) { int problemResetPC = <NUM_LIT:0> ; classFile . codeStream . wideMode = false ; if ( this . ignoreFurtherInvestigation ) { if ( this . binding == null ) return ; int problemsLength ; CategorizedProblem [ ] problems = this . scope . referenceCompilationUnit ( ) . compilationResult . getProblems ( ) ; CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; classFile . addProblemMethod ( this , this . binding , problemsCopy ) ; return ; } boolean restart = false ; boolean abort = false ; do { try { problemResetPC = classFile . contentsOffset ; this . generateCode ( classFile ) ; restart = false ; } catch ( AbortMethod e ) { if ( e . compilationResult == CodeStream . RESTART_IN_WIDE_MODE ) { classFile . contentsOffset = problemResetPC ; classFile . methodCount -- ; classFile . codeStream . resetInWideMode ( ) ; restart = true ; } else if ( e . compilationResult == CodeStream . RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE ) { classFile . contentsOffset = problemResetPC ; classFile . methodCount -- ; classFile . codeStream . resetForCodeGenUnusedLocals ( ) ; restart = true ; } else { restart = false ; abort = true ; } } } while ( restart ) ; if ( abort ) { int problemsLength ; CategorizedProblem [ ] problems = this . scope . referenceCompilationUnit ( ) . compilationResult . getAllProblems ( ) ; CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; classFile . addProblemMethod ( this , this . binding , problemsCopy , problemResetPC ) ; } } public void generateCode ( ClassFile classFile ) { classFile . generateMethodInfoHeader ( this . binding ) ; int methodAttributeOffset = classFile . contentsOffset ; int attributeNumber = classFile . generateMethodInfoAttributes ( this . binding ) ; if ( ( ! this . binding . isNative ( ) ) && ( ! this . binding . isAbstract ( ) ) ) { int codeAttributeOffset = classFile . contentsOffset ; classFile . generateCodeAttributeHeader ( ) ; CodeStream codeStream = classFile . codeStream ; codeStream . reset ( this , classFile ) ; this . scope . computeLocalVariablePositions ( this . binding . isStatic ( ) ? <NUM_LIT:0> : <NUM_LIT:1> , codeStream ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> , max = this . arguments . length ; i < max ; i ++ ) { LocalVariableBinding argBinding ; codeStream . addVisibleLocalVariable ( argBinding = this . arguments [ i ] . binding ) ; argBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; } } if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , max = this . statements . length ; i < max ; i ++ ) this . statements [ i ] . generateCode ( this . scope , codeStream ) ; } if ( this . ignoreFurtherInvestigation ) { throw new AbortMethod ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } if ( ( this . bits & ASTNode . NeedFreeReturn ) != <NUM_LIT:0> ) { codeStream . return_ ( ) ; } codeStream . exitUserScope ( this . scope ) ; codeStream . recordPositionsFrom ( <NUM_LIT:0> , this . declarationSourceEnd ) ; try { classFile . completeCodeAttribute ( codeAttributeOffset ) ; } catch ( NegativeArraySizeException e ) { throw new AbortMethod ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } attributeNumber ++ ; } else { checkArgumentsSize ( ) ; } classFile . completeMethodInfo ( this . binding , methodAttributeOffset , attributeNumber ) ; } private void checkArgumentsSize ( ) { TypeBinding [ ] parameters = this . binding . parameters ; int size = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> , max = parameters . length ; i < max ; i ++ ) { switch ( parameters [ i ] . id ) { case TypeIds . T_long : case TypeIds . T_double : size += <NUM_LIT:2> ; break ; default : size ++ ; break ; } if ( size > <NUM_LIT> ) { this . scope . problemReporter ( ) . noMoreAvailableSpaceForArgument ( this . scope . locals [ i ] , this . scope . locals [ i ] . declaration ) ; } } } public CompilationUnitDeclaration getCompilationUnitDeclaration ( ) { if ( this . scope != null ) { return this . scope . compilationUnitScope ( ) . referenceContext ; } return null ; } public boolean hasErrors ( ) { return this . ignoreFurtherInvestigation ; } public boolean isAbstract ( ) { if ( this . binding != null ) return this . binding . isAbstract ( ) ; return ( this . modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ; } public boolean isAnnotationMethod ( ) { return false ; } public boolean isClinit ( ) { return false ; } public boolean isConstructor ( ) { return false ; } public boolean isDefaultConstructor ( ) { return false ; } public boolean isInitializationMethod ( ) { return false ; } public boolean isMethod ( ) { return false ; } public boolean isNative ( ) { if ( this . binding != null ) return this . binding . isNative ( ) ; return ( this . modifiers & ClassFileConstants . AccNative ) != <NUM_LIT:0> ; } public boolean isStatic ( ) { if ( this . binding != null ) return this . binding . isStatic ( ) ; return ( this . modifiers & ClassFileConstants . AccStatic ) != <NUM_LIT:0> ; } public abstract void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) ; public StringBuffer print ( int tab , StringBuffer output ) { if ( this . javadoc != null ) { this . javadoc . print ( tab , output ) ; } printIndent ( tab , output ) ; printModifiers ( this . modifiers , output ) ; if ( this . annotations != null ) printAnnotations ( this . annotations , output ) ; TypeParameter [ ] typeParams = typeParameters ( ) ; if ( typeParams != null ) { output . append ( '<CHAR_LIT>' ) ; int max = typeParams . length - <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < max ; j ++ ) { typeParams [ j ] . print ( <NUM_LIT:0> , output ) ; output . append ( "<STR_LIT:U+002CU+0020>" ) ; } typeParams [ max ] . print ( <NUM_LIT:0> , output ) ; output . append ( '<CHAR_LIT:>>' ) ; } printReturnType ( <NUM_LIT:0> , output ) . append ( this . selector ) . append ( '<CHAR_LIT:(>' ) ; if ( this . arguments != null ) { for ( int i = <NUM_LIT:0> ; i < this . arguments . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . arguments [ i ] . print ( <NUM_LIT:0> , output ) ; } } output . append ( '<CHAR_LIT:)>' ) ; if ( this . thrownExceptions != null ) { output . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < this . thrownExceptions . length ; i ++ ) { if ( i > <NUM_LIT:0> ) output . append ( "<STR_LIT:U+002CU+0020>" ) ; this . thrownExceptions [ i ] . print ( <NUM_LIT:0> , output ) ; } } printBody ( tab + <NUM_LIT:1> , output ) ; return output ; } public StringBuffer printBody ( int indent , StringBuffer output ) { if ( isAbstract ( ) || ( this . modifiers & ExtraCompilerModifiers . AccSemicolonBody ) != <NUM_LIT:0> ) return output . append ( '<CHAR_LIT:;>' ) ; output . append ( "<STR_LIT>" ) ; if ( this . statements != null ) { for ( int i = <NUM_LIT:0> ; i < this . statements . length ; i ++ ) { output . append ( '<STR_LIT:\n>' ) ; this . statements [ i ] . printStatement ( indent , output ) ; } } output . append ( '<STR_LIT:\n>' ) ; printIndent ( indent == <NUM_LIT:0> ? <NUM_LIT:0> : indent - <NUM_LIT:1> , output ) . append ( '<CHAR_LIT:}>' ) ; return output ; } public StringBuffer printReturnType ( int indent , StringBuffer output ) { return output ; } public void resolve ( ClassScope upperScope ) { if ( this . binding == null ) { this . ignoreFurtherInvestigation = true ; } try { bindArguments ( ) ; bindThrownExceptions ( ) ; resolveJavadoc ( ) ; resolveAnnotations ( this . scope , this . annotations , this . binding ) ; validateNullAnnotations ( ) ; resolveStatements ( ) ; if ( this . binding != null && ( this . binding . getAnnotationTagBits ( ) & TagBits . AnnotationDeprecated ) == <NUM_LIT:0> && ( this . binding . modifiers & ClassFileConstants . AccDeprecated ) != <NUM_LIT:0> && this . scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ) { this . scope . problemReporter ( ) . missingDeprecatedAnnotationForMethod ( this ) ; } } catch ( AbortMethod e ) { this . ignoreFurtherInvestigation = true ; } } public void resolveJavadoc ( ) { if ( this . binding == null ) return ; if ( this . javadoc != null ) { this . javadoc . resolve ( this . scope ) ; return ; } if ( this . binding . declaringClass != null && ! this . binding . declaringClass . isLocalType ( ) ) { int javadocVisibility = this . binding . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; ClassScope classScope = this . scope . classScope ( ) ; ProblemReporter reporter = this . scope . problemReporter ( ) ; int severity = reporter . computeSeverity ( IProblem . JavadocMissing ) ; if ( severity != ProblemSeverities . Ignore ) { if ( classScope != null ) { javadocVisibility = Util . computeOuterMostVisibility ( classScope . referenceType ( ) , javadocVisibility ) ; } int javadocModifiers = ( this . binding . modifiers & ~ ExtraCompilerModifiers . AccVisibilityMASK ) | javadocVisibility ; reporter . javadocMissing ( this . sourceStart , this . sourceEnd , severity , javadocModifiers ) ; } } } public void resolveStatements ( ) { if ( this . statements != null ) { for ( int i = <NUM_LIT:0> , length = this . statements . length ; i < length ; i ++ ) { this . statements [ i ] . resolve ( this . scope ) ; } } else if ( ( this . bits & UndocumentedEmptyBlock ) != <NUM_LIT:0> ) { if ( ! this . isConstructor ( ) || this . arguments != null ) { this . scope . problemReporter ( ) . undocumentedEmptyBlock ( this . bodyStart - <NUM_LIT:1> , this . bodyEnd + <NUM_LIT:1> ) ; } } } public void tagAsHavingErrors ( ) { this . ignoreFurtherInvestigation = true ; } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { } public TypeParameter [ ] typeParameters ( ) { return null ; } void validateNullAnnotations ( ) { if ( this . binding != null && this . binding . parameterNonNullness != null ) { int length = this . binding . parameters . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( this . binding . parameterNonNullness [ i ] != null ) { long nullAnnotationTagBit = this . binding . parameterNonNullness [ i ] . booleanValue ( ) ? TagBits . AnnotationNonNull : TagBits . AnnotationNullable ; this . scope . validateNullAnnotation ( nullAnnotationTagBit , this . arguments [ i ] . type , this . arguments [ i ] . annotations ) ; } } } } } </s>
<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . impl . FloatConstant ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . util . FloatUtil ; public class FloatLiteral extends NumberLiteral { float value ; public FloatLiteral ( char [ ] token , int s , int e ) { super ( token , s , e ) ; } public void computeConstant ( ) { Float computedValue ; boolean containsUnderscores = CharOperation . indexOf ( '<CHAR_LIT:_>' , this . source ) > <NUM_LIT:0> ; if ( containsUnderscores ) { this . source = CharOperation . remove ( this . source , '<CHAR_LIT:_>' ) ; } try { computedValue = Float . valueOf ( String . valueOf ( this . source ) ) ; } catch ( NumberFormatException e ) { try { float v = FloatUtil . valueOfHexFloatLiteral ( this . source ) ; if ( v == Float . POSITIVE_INFINITY ) { return ; } if ( Float . isNaN ( v ) ) { return ; } this . value = v ; this . constant = FloatConstant . fromValue ( v ) ; } catch ( NumberFormatException e1 ) { } return ; } final float floatValue = computedValue . floatValue ( ) ; if ( floatValue > Float . MAX_VALUE ) { return ; } if ( floatValue < Float . MIN_VALUE ) { boolean isHexaDecimal = false ; label : for ( int i = <NUM_LIT:0> ; i < this . source . length ; i ++ ) { switch ( this . source [ i ] ) { case '<CHAR_LIT:0>' : case '<CHAR_LIT:.>' : break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : isHexaDecimal = true ; break ; case '<CHAR_LIT:e>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : if ( isHexaDecimal ) { return ; } break label ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : break label ; default : return ; } } } this . value = floatValue ; this . constant = FloatConstant . fromValue ( this . value ) ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { int pc = codeStream . position ; if ( valueRequired ) { codeStream . generateConstant ( this . constant , this . implicitConversion ) ; } codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public TypeBinding literalType ( BlockScope scope ) { return TypeBinding . FLOAT ; } public void traverse ( ASTVisitor visitor , BlockScope scope ) { visitor . visit ( this , scope ) ; visitor . endVisit ( this , scope ) ; } } </s>