text
stringlengths
30
1.67M
<s> package org . eclipse . jdt . core . util ; public interface IConstantValueAttribute extends IClassFileAttribute { int getConstantValueIndex ( ) ; IConstantPoolEntry getConstantValue ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IFieldInfo { IConstantValueAttribute getConstantValueAttribute ( ) ; int getAccessFlags ( ) ; char [ ] getName ( ) ; int getNameIndex ( ) ; char [ ] getDescriptor ( ) ; int getDescriptorIndex ( ) ; boolean hasConstantValueAttribute ( ) ; boolean isSynthetic ( ) ; boolean isDeprecated ( ) ; int getAttributeCount ( ) ; IClassFileAttribute [ ] getAttributes ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IAnnotation { int getTypeIndex ( ) ; char [ ] getTypeName ( ) ; int getComponentsNumber ( ) ; IAnnotationComponent [ ] getComponents ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ILocalVariableTableEntry { int getStartPC ( ) ; int getLength ( ) ; int getNameIndex ( ) ; int getDescriptorIndex ( ) ; int getIndex ( ) ; char [ ] getName ( ) ; char [ ] getDescriptor ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; import java . util . Comparator ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . internal . core . SortElementsOperation ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . text . edits . TextEditGroup ; public final class CompilationUnitSorter { private CompilationUnitSorter ( ) { } private static void checkASTLevel ( int level ) { switch ( level ) { case AST . JLS2 : case AST . JLS3 : break ; default : throw new IllegalArgumentException ( ) ; } } public static final String RELATIVE_ORDER = "<STR_LIT>" ; public static void sort ( ICompilationUnit compilationUnit , int [ ] positions , Comparator comparator , int options , IProgressMonitor monitor ) throws JavaModelException { sort ( AST . JLS2 , compilationUnit , positions , comparator , options , monitor ) ; } public static void sort ( int level , ICompilationUnit compilationUnit , int [ ] positions , Comparator comparator , int options , IProgressMonitor monitor ) throws JavaModelException { if ( compilationUnit == null || comparator == null ) { throw new IllegalArgumentException ( ) ; } checkASTLevel ( level ) ; ICompilationUnit [ ] compilationUnits = new ICompilationUnit [ ] { compilationUnit } ; SortElementsOperation operation = new SortElementsOperation ( level , compilationUnits , positions , comparator ) ; operation . runOperation ( monitor ) ; } public static TextEdit sort ( CompilationUnit unit , Comparator comparator , int options , TextEditGroup group , IProgressMonitor monitor ) throws JavaModelException { if ( unit == null || comparator == null ) { throw new IllegalArgumentException ( ) ; } SortElementsOperation operation = new SortElementsOperation ( AST . JLS3 , new IJavaElement [ ] { unit . getJavaElement ( ) } , null , comparator ) ; return operation . calculateEdit ( unit , group ) ; } } </s>
<s> package org . eclipse . jdt . core . util ; public interface IParameterAnnotation { int getAnnotationsNumber ( ) ; IAnnotation [ ] getAnnotations ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ISourceAttribute extends IClassFileAttribute { int getSourceFileIndex ( ) ; char [ ] getSourceFileName ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ILocalVariableTypeTableEntry { int getStartPC ( ) ; int getLength ( ) ; int getNameIndex ( ) ; int getSignatureIndex ( ) ; int getIndex ( ) ; char [ ] getName ( ) ; char [ ] getSignature ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IClassFileReader { int ALL = <NUM_LIT> ; int CONSTANT_POOL = <NUM_LIT> ; int METHOD_INFOS = <NUM_LIT> + CONSTANT_POOL ; int FIELD_INFOS = <NUM_LIT> + CONSTANT_POOL ; int SUPER_INTERFACES = <NUM_LIT> + CONSTANT_POOL ; int CLASSFILE_ATTRIBUTES = <NUM_LIT> + CONSTANT_POOL ; int METHOD_BODIES = <NUM_LIT> ; int ALL_BUT_METHOD_BODIES = ALL & ~ METHOD_BODIES ; int getAccessFlags ( ) ; IFieldInfo [ ] getFieldInfos ( ) ; char [ ] [ ] getInterfaceNames ( ) ; int [ ] getInterfaceIndexes ( ) ; IInnerClassesAttribute getInnerClassesAttribute ( ) ; IMethodInfo [ ] getMethodInfos ( ) ; char [ ] getClassName ( ) ; int getClassIndex ( ) ; char [ ] getSuperclassName ( ) ; int getSuperclassIndex ( ) ; boolean isClass ( ) ; boolean isInterface ( ) ; ISourceAttribute getSourceFileAttribute ( ) ; IConstantPool getConstantPool ( ) ; int getMinorVersion ( ) ; int getMajorVersion ( ) ; int getAttributeCount ( ) ; IClassFileAttribute [ ] getAttributes ( ) ; int getMagic ( ) ; int getFieldsCount ( ) ; int getMethodsCount ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IStackMapAttribute extends IClassFileAttribute { int getNumberOfEntries ( ) ; IStackMapFrame [ ] getStackMapFrame ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IEnclosingMethodAttribute extends IClassFileAttribute { char [ ] getEnclosingClass ( ) ; int getEnclosingClassIndex ( ) ; char [ ] getMethodDescriptor ( ) ; int getMethodDescriptorIndex ( ) ; char [ ] getMethodName ( ) ; int getMethodNameIndex ( ) ; int getMethodNameAndTypeIndex ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IExceptionAttribute extends IClassFileAttribute { int getExceptionsNumber ( ) ; char [ ] [ ] getExceptionNames ( ) ; int [ ] getExceptionIndexes ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ICodeAttribute extends IClassFileAttribute { int getMaxLocals ( ) ; int getMaxStack ( ) ; ILineNumberAttribute getLineNumberAttribute ( ) ; ILocalVariableAttribute getLocalVariableAttribute ( ) ; IExceptionTableEntry [ ] getExceptionTable ( ) ; byte [ ] getBytecodes ( ) ; long getCodeLength ( ) ; int getAttributesCount ( ) ; IClassFileAttribute [ ] getAttributes ( ) ; int getExceptionTableLength ( ) ; void traverse ( IBytecodeVisitor visitor ) throws ClassFormatException ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IAnnotationComponent { int getComponentNameIndex ( ) ; char [ ] getComponentName ( ) ; IAnnotationComponentValue getComponentValue ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public class ByteCodeVisitorAdapter implements IBytecodeVisitor { public void _aaload ( int pc ) { } public void _aastore ( int pc ) { } public void _aconst_null ( int pc ) { } public void _aload_0 ( int pc ) { } public void _aload_1 ( int pc ) { } public void _aload_2 ( int pc ) { } public void _aload_3 ( int pc ) { } public void _aload ( int pc , int index ) { } public void _anewarray ( int pc , int index , IConstantPoolEntry constantClass ) { } public void _areturn ( int pc ) { } public void _arraylength ( int pc ) { } public void _astore_0 ( int pc ) { } public void _astore_1 ( int pc ) { } public void _astore_2 ( int pc ) { } public void _astore_3 ( int pc ) { } public void _astore ( int pc , int index ) { } public void _athrow ( int pc ) { } public void _baload ( int pc ) { } public void _bastore ( int pc ) { } public void _bipush ( int pc , byte _byte ) { } public void _caload ( int pc ) { } public void _castore ( int pc ) { } public void _checkcast ( int pc , int index , IConstantPoolEntry constantClass ) { } public void _d2f ( int pc ) { } public void _d2i ( int pc ) { } public void _d2l ( int pc ) { } public void _dadd ( int pc ) { } public void _daload ( int pc ) { } public void _dastore ( int pc ) { } public void _dcmpg ( int pc ) { } public void _dcmpl ( int pc ) { } public void _dconst_0 ( int pc ) { } public void _dconst_1 ( int pc ) { } public void _ddiv ( int pc ) { } public void _dload_0 ( int pc ) { } public void _dload_1 ( int pc ) { } public void _dload_2 ( int pc ) { } public void _dload_3 ( int pc ) { } public void _dload ( int pc , int index ) { } public void _dmul ( int pc ) { } public void _dneg ( int pc ) { } public void _drem ( int pc ) { } public void _dreturn ( int pc ) { } public void _dstore_0 ( int pc ) { } public void _dstore_1 ( int pc ) { } public void _dstore_2 ( int pc ) { } public void _dstore_3 ( int pc ) { } public void _dstore ( int pc , int index ) { } public void _dsub ( int pc ) { } public void _dup_x1 ( int pc ) { } public void _dup_x2 ( int pc ) { } public void _dup ( int pc ) { } public void _dup2_x1 ( int pc ) { } public void _dup2_x2 ( int pc ) { } public void _dup2 ( int pc ) { } public void _f2d ( int pc ) { } public void _f2i ( int pc ) { } public void _f2l ( int pc ) { } public void _fadd ( int pc ) { } public void _faload ( int pc ) { } public void _fastore ( int pc ) { } public void _fcmpg ( int pc ) { } public void _fcmpl ( int pc ) { } public void _fconst_0 ( int pc ) { } public void _fconst_1 ( int pc ) { } public void _fconst_2 ( int pc ) { } public void _fdiv ( int pc ) { } public void _fload_0 ( int pc ) { } public void _fload_1 ( int pc ) { } public void _fload_2 ( int pc ) { } public void _fload_3 ( int pc ) { } public void _fload ( int pc , int index ) { } public void _fmul ( int pc ) { } public void _fneg ( int pc ) { } public void _frem ( int pc ) { } public void _freturn ( int pc ) { } public void _fstore_0 ( int pc ) { } public void _fstore_1 ( int pc ) { } public void _fstore_2 ( int pc ) { } public void _fstore_3 ( int pc ) { } public void _fstore ( int pc , int index ) { } public void _fsub ( int pc ) { } public void _getfield ( int pc , int index , IConstantPoolEntry constantFieldref ) { } public void _getstatic ( int pc , int index , IConstantPoolEntry constantFieldref ) { } public void _goto_w ( int pc , int branchOffset ) { } public void _goto ( int pc , int branchOffset ) { } public void _i2b ( int pc ) { } public void _i2c ( int pc ) { } public void _i2d ( int pc ) { } public void _i2f ( int pc ) { } public void _i2l ( int pc ) { } public void _i2s ( int pc ) { } public void _iadd ( int pc ) { } public void _iaload ( int pc ) { } public void _iand ( int pc ) { } public void _iastore ( int pc ) { } public void _iconst_0 ( int pc ) { } public void _iconst_1 ( int pc ) { } public void _iconst_2 ( int pc ) { } public void _iconst_3 ( int pc ) { } public void _iconst_4 ( int pc ) { } public void _iconst_5 ( int pc ) { } public void _iconst_m1 ( int pc ) { } public void _idiv ( int pc ) { } public void _if_acmpeq ( int pc , int branchOffset ) { } public void _if_acmpne ( int pc , int branchOffset ) { } public void _if_icmpeq ( int pc , int branchOffset ) { } public void _if_icmpge ( int pc , int branchOffset ) { } public void _if_icmpgt ( int pc , int branchOffset ) { } public void _if_icmple ( int pc , int branchOffset ) { } public void _if_icmplt ( int pc , int branchOffset ) { } public void _if_icmpne ( int pc , int branchOffset ) { } public void _ifeq ( int pc , int branchOffset ) { } public void _ifge ( int pc , int branchOffset ) { } public void _ifgt ( int pc , int branchOffset ) { } public void _ifle ( int pc , int branchOffset ) { } public void _iflt ( int pc , int branchOffset ) { } public void _ifne ( int pc , int branchOffset ) { } public void _ifnonnull ( int pc , int branchOffset ) { } public void _ifnull ( int pc , int branchOffset ) { } public void _iinc ( int pc , int index , int _const ) { } public void _iload_0 ( int pc ) { } public void _iload_1 ( int pc ) { } public void _iload_2 ( int pc ) { } public void _iload_3 ( int pc ) { } public void _iload ( int pc , int index ) { } public void _imul ( int pc ) { } public void _ineg ( int pc ) { } public void _instanceof ( int pc , int index , IConstantPoolEntry constantClass ) { } public void _invokedynamic ( int pc , int index , IConstantPoolEntry nameEntry , IConstantPoolEntry descriptorEntry ) { } public void _invokeinterface ( int pc , int index , byte nargs , IConstantPoolEntry constantInterfaceMethodref ) { } public void _invokespecial ( int pc , int index , IConstantPoolEntry constantMethodref ) { } public void _invokestatic ( int pc , int index , IConstantPoolEntry constantMethodref ) { } public void _invokevirtual ( int pc , int index , IConstantPoolEntry constantMethodref ) { } public void _ior ( int pc ) { } public void _irem ( int pc ) { } public void _ireturn ( int pc ) { } public void _ishl ( int pc ) { } public void _ishr ( int pc ) { } public void _istore_0 ( int pc ) { } public void _istore_1 ( int pc ) { } public void _istore_2 ( int pc ) { } public void _istore_3 ( int pc ) { } public void _istore ( int pc , int index ) { } public void _isub ( int pc ) { } public void _iushr ( int pc ) { } public void _ixor ( int pc ) { } public void _jsr_w ( int pc , int branchOffset ) { } public void _jsr ( int pc , int branchOffset ) { } public void _l2d ( int pc ) { } public void _l2f ( int pc ) { } public void _l2i ( int pc ) { } public void _ladd ( int pc ) { } public void _laload ( int pc ) { } public void _land ( int pc ) { } public void _lastore ( int pc ) { } public void _lcmp ( int pc ) { } public void _lconst_0 ( int pc ) { } public void _lconst_1 ( int pc ) { } public void _ldc_w ( int pc , int index , IConstantPoolEntry constantPoolEntry ) { } public void _ldc ( int pc , int index , IConstantPoolEntry constantPoolEntry ) { } public void _ldc2_w ( int pc , int index , IConstantPoolEntry constantPoolEntry ) { } public void _ldiv ( int pc ) { } public void _lload_0 ( int pc ) { } public void _lload_1 ( int pc ) { } public void _lload_2 ( int pc ) { } public void _lload_3 ( int pc ) { } public void _lload ( int pc , int index ) { } public void _lmul ( int pc ) { } public void _lneg ( int pc ) { } public void _lookupswitch ( int pc , int defaultoffset , int npairs , int [ ] [ ] offset_pairs ) { } public void _lor ( int pc ) { } public void _lrem ( int pc ) { } public void _lreturn ( int pc ) { } public void _lshl ( int pc ) { } public void _lshr ( int pc ) { } public void _lstore_0 ( int pc ) { } public void _lstore_1 ( int pc ) { } public void _lstore_2 ( int pc ) { } public void _lstore_3 ( int pc ) { } public void _lstore ( int pc , int index ) { } public void _lsub ( int pc ) { } public void _lushr ( int pc ) { } public void _lxor ( int pc ) { } public void _monitorenter ( int pc ) { } public void _monitorexit ( int pc ) { } public void _multianewarray ( int pc , int index , int dimensions , IConstantPoolEntry constantClass ) { } public void _new ( int pc , int index , IConstantPoolEntry constantClass ) { } public void _newarray ( int pc , int atype ) { } public void _nop ( int pc ) { } public void _pop ( int pc ) { } public void _pop2 ( int pc ) { } public void _putfield ( int pc , int index , IConstantPoolEntry constantFieldref ) { } public void _putstatic ( int pc , int index , IConstantPoolEntry constantFieldref ) { } public void _ret ( int pc , int index ) { } public void _return ( int pc ) { } public void _saload ( int pc ) { } public void _sastore ( int pc ) { } public void _sipush ( int pc , short value ) { } public void _swap ( int pc ) { } public void _tableswitch ( int pc , int defaultoffset , int low , int high , int [ ] jump_offsets ) { } public void _wide ( int pc , int iincopcode , int index , int _const ) { } public void _wide ( int pc , int opcode , int index ) { } public void _breakpoint ( int pc ) { } public void _impdep1 ( int pc ) { } public void _impdep2 ( int pc ) { } } </s>
<s> package org . eclipse . jdt . core . util ; public interface IAnnotationComponentValue { int BYTE_TAG = '<CHAR_LIT>' ; int CHAR_TAG = '<CHAR_LIT>' ; int DOUBLE_TAG = '<CHAR_LIT>' ; int FLOAT_TAG = '<CHAR_LIT>' ; int INTEGER_TAG = '<CHAR_LIT>' ; int LONG_TAG = '<CHAR_LIT>' ; int SHORT_TAG = '<CHAR_LIT>' ; int BOOLEAN_TAG = '<CHAR_LIT:Z>' ; int STRING_TAG = '<CHAR_LIT>' ; int ENUM_TAG = '<CHAR_LIT:e>' ; int CLASS_TAG = '<CHAR_LIT:c>' ; int ANNOTATION_TAG = '<CHAR_LIT>' ; int ARRAY_TAG = '<CHAR_LIT:[>' ; IAnnotationComponentValue [ ] getAnnotationComponentValues ( ) ; IAnnotation getAnnotationValue ( ) ; IConstantPoolEntry getClassInfo ( ) ; int getClassInfoIndex ( ) ; IConstantPoolEntry getConstantValue ( ) ; int getConstantValueIndex ( ) ; char [ ] getEnumConstantName ( ) ; int getEnumConstantNameIndex ( ) ; char [ ] getEnumConstantTypeName ( ) ; int getEnumConstantTypeNameIndex ( ) ; int getTag ( ) ; int getValuesNumber ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ILocalVariableAttribute extends IClassFileAttribute { int getLocalVariableTableLength ( ) ; ILocalVariableTableEntry [ ] getLocalVariableTable ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IRuntimeVisibleParameterAnnotationsAttribute extends IClassFileAttribute { int getParametersNumber ( ) ; IParameterAnnotation [ ] getParameterAnnotations ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public class OpcodeStringValues implements IOpcodeMnemonics { public static final String [ ] BYTECODE_NAMES = new String [ <NUM_LIT> ] ; static { BYTECODE_NAMES [ NOP ] = "<STR_LIT>" ; BYTECODE_NAMES [ ACONST_NULL ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_M1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_4 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ICONST_5 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LCONST_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LCONST_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FCONST_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FCONST_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FCONST_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DCONST_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DCONST_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ BIPUSH ] = "<STR_LIT>" ; BYTECODE_NAMES [ SIPUSH ] = "<STR_LIT>" ; BYTECODE_NAMES [ LDC ] = "<STR_LIT>" ; BYTECODE_NAMES [ LDC_W ] = "<STR_LIT>" ; BYTECODE_NAMES [ LDC2_W ] = "<STR_LIT>" ; BYTECODE_NAMES [ ILOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ LLOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ FLOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ DLOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ ALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ ILOAD_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ILOAD_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ILOAD_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ILOAD_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LLOAD_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LLOAD_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LLOAD_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LLOAD_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FLOAD_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FLOAD_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FLOAD_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FLOAD_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DLOAD_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DLOAD_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DLOAD_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DLOAD_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ALOAD_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ALOAD_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ALOAD_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ALOAD_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ IALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ LALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ FALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ DALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ AALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ BALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ CALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ SALOAD ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ FSTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ DSTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ ASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISTORE_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISTORE_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISTORE_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISTORE_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSTORE_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSTORE_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSTORE_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSTORE_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FSTORE_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FSTORE_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FSTORE_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ FSTORE_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DSTORE_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DSTORE_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DSTORE_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DSTORE_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ASTORE_0 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ASTORE_1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ASTORE_2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ ASTORE_3 ] = "<STR_LIT>" ; BYTECODE_NAMES [ IASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ LASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ FASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ DASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ AASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ BASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ CASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ SASTORE ] = "<STR_LIT>" ; BYTECODE_NAMES [ POP ] = "<STR_LIT>" ; BYTECODE_NAMES [ POP2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DUP ] = "<STR_LIT>" ; BYTECODE_NAMES [ DUP_X1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DUP_X2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DUP2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DUP2_X1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ DUP2_X2 ] = "<STR_LIT>" ; BYTECODE_NAMES [ SWAP ] = "<STR_LIT>" ; BYTECODE_NAMES [ IADD ] = "<STR_LIT>" ; BYTECODE_NAMES [ LADD ] = "<STR_LIT>" ; BYTECODE_NAMES [ FADD ] = "<STR_LIT>" ; BYTECODE_NAMES [ DADD ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISUB ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSUB ] = "<STR_LIT>" ; BYTECODE_NAMES [ FSUB ] = "<STR_LIT>" ; BYTECODE_NAMES [ DSUB ] = "<STR_LIT>" ; BYTECODE_NAMES [ IMUL ] = "<STR_LIT>" ; BYTECODE_NAMES [ LMUL ] = "<STR_LIT>" ; BYTECODE_NAMES [ FMUL ] = "<STR_LIT>" ; BYTECODE_NAMES [ DMUL ] = "<STR_LIT>" ; BYTECODE_NAMES [ IDIV ] = "<STR_LIT>" ; BYTECODE_NAMES [ LDIV ] = "<STR_LIT>" ; BYTECODE_NAMES [ FDIV ] = "<STR_LIT>" ; BYTECODE_NAMES [ DDIV ] = "<STR_LIT>" ; BYTECODE_NAMES [ IREM ] = "<STR_LIT>" ; BYTECODE_NAMES [ LREM ] = "<STR_LIT>" ; BYTECODE_NAMES [ FREM ] = "<STR_LIT>" ; BYTECODE_NAMES [ DREM ] = "<STR_LIT>" ; BYTECODE_NAMES [ INEG ] = "<STR_LIT>" ; BYTECODE_NAMES [ LNEG ] = "<STR_LIT>" ; BYTECODE_NAMES [ FNEG ] = "<STR_LIT>" ; BYTECODE_NAMES [ DNEG ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISHL ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSHL ] = "<STR_LIT>" ; BYTECODE_NAMES [ ISHR ] = "<STR_LIT>" ; BYTECODE_NAMES [ LSHR ] = "<STR_LIT>" ; BYTECODE_NAMES [ IUSHR ] = "<STR_LIT>" ; BYTECODE_NAMES [ LUSHR ] = "<STR_LIT>" ; BYTECODE_NAMES [ IAND ] = "<STR_LIT>" ; BYTECODE_NAMES [ LAND ] = "<STR_LIT>" ; BYTECODE_NAMES [ IOR ] = "<STR_LIT>" ; BYTECODE_NAMES [ LOR ] = "<STR_LIT>" ; BYTECODE_NAMES [ IXOR ] = "<STR_LIT>" ; BYTECODE_NAMES [ LXOR ] = "<STR_LIT>" ; BYTECODE_NAMES [ IINC ] = "<STR_LIT>" ; BYTECODE_NAMES [ I2L ] = "<STR_LIT>" ; BYTECODE_NAMES [ I2F ] = "<STR_LIT>" ; BYTECODE_NAMES [ I2D ] = "<STR_LIT>" ; BYTECODE_NAMES [ L2I ] = "<STR_LIT>" ; BYTECODE_NAMES [ L2F ] = "<STR_LIT>" ; BYTECODE_NAMES [ L2D ] = "<STR_LIT>" ; BYTECODE_NAMES [ F2I ] = "<STR_LIT>" ; BYTECODE_NAMES [ F2L ] = "<STR_LIT>" ; BYTECODE_NAMES [ F2D ] = "<STR_LIT>" ; BYTECODE_NAMES [ D2I ] = "<STR_LIT>" ; BYTECODE_NAMES [ D2L ] = "<STR_LIT>" ; BYTECODE_NAMES [ D2F ] = "<STR_LIT>" ; BYTECODE_NAMES [ I2B ] = "<STR_LIT>" ; BYTECODE_NAMES [ I2C ] = "<STR_LIT>" ; BYTECODE_NAMES [ I2S ] = "<STR_LIT>" ; BYTECODE_NAMES [ LCMP ] = "<STR_LIT>" ; BYTECODE_NAMES [ FCMPL ] = "<STR_LIT>" ; BYTECODE_NAMES [ FCMPG ] = "<STR_LIT>" ; BYTECODE_NAMES [ DCMPL ] = "<STR_LIT>" ; BYTECODE_NAMES [ DCMPG ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFEQ ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFNE ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFLT ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFGE ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFGT ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFLE ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ICMPEQ ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ICMPNE ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ICMPLT ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ICMPGE ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ICMPGT ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ICMPLE ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ACMPEQ ] = "<STR_LIT>" ; BYTECODE_NAMES [ IF_ACMPNE ] = "<STR_LIT>" ; BYTECODE_NAMES [ GOTO ] = "<STR_LIT>" ; BYTECODE_NAMES [ JSR ] = "<STR_LIT>" ; BYTECODE_NAMES [ RET ] = "<STR_LIT>" ; BYTECODE_NAMES [ TABLESWITCH ] = "<STR_LIT>" ; BYTECODE_NAMES [ LOOKUPSWITCH ] = "<STR_LIT>" ; BYTECODE_NAMES [ IRETURN ] = "<STR_LIT>" ; BYTECODE_NAMES [ LRETURN ] = "<STR_LIT>" ; BYTECODE_NAMES [ FRETURN ] = "<STR_LIT>" ; BYTECODE_NAMES [ DRETURN ] = "<STR_LIT>" ; BYTECODE_NAMES [ ARETURN ] = "<STR_LIT>" ; BYTECODE_NAMES [ RETURN ] = "<STR_LIT>" ; BYTECODE_NAMES [ GETSTATIC ] = "<STR_LIT>" ; BYTECODE_NAMES [ PUTSTATIC ] = "<STR_LIT>" ; BYTECODE_NAMES [ GETFIELD ] = "<STR_LIT>" ; BYTECODE_NAMES [ PUTFIELD ] = "<STR_LIT>" ; BYTECODE_NAMES [ INVOKEVIRTUAL ] = "<STR_LIT>" ; BYTECODE_NAMES [ INVOKESPECIAL ] = "<STR_LIT>" ; BYTECODE_NAMES [ INVOKESTATIC ] = "<STR_LIT>" ; BYTECODE_NAMES [ INVOKEINTERFACE ] = "<STR_LIT>" ; BYTECODE_NAMES [ INVOKEDYNAMIC ] = "<STR_LIT>" ; BYTECODE_NAMES [ NEW ] = "<STR_LIT>" ; BYTECODE_NAMES [ NEWARRAY ] = "<STR_LIT>" ; BYTECODE_NAMES [ ANEWARRAY ] = "<STR_LIT>" ; BYTECODE_NAMES [ ARRAYLENGTH ] = "<STR_LIT>" ; BYTECODE_NAMES [ ATHROW ] = "<STR_LIT>" ; BYTECODE_NAMES [ CHECKCAST ] = "<STR_LIT>" ; BYTECODE_NAMES [ INSTANCEOF ] = "<STR_LIT>" ; BYTECODE_NAMES [ MONITORENTER ] = "<STR_LIT>" ; BYTECODE_NAMES [ MONITOREXIT ] = "<STR_LIT>" ; BYTECODE_NAMES [ WIDE ] = "<STR_LIT>" ; BYTECODE_NAMES [ MULTIANEWARRAY ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFNULL ] = "<STR_LIT>" ; BYTECODE_NAMES [ IFNONNULL ] = "<STR_LIT>" ; BYTECODE_NAMES [ GOTO_W ] = "<STR_LIT>" ; BYTECODE_NAMES [ JSR_W ] = "<STR_LIT>" ; BYTECODE_NAMES [ BREAKPOINT ] = "<STR_LIT>" ; BYTECODE_NAMES [ IMPDEP1 ] = "<STR_LIT>" ; BYTECODE_NAMES [ IMPDEP2 ] = "<STR_LIT>" ; } } </s>
<s> package org . eclipse . jdt . core . util ; public interface ILocalVariableTypeTableAttribute extends IClassFileAttribute { int getLocalVariableTypeTableLength ( ) ; ILocalVariableTypeTableEntry [ ] getLocalVariableTypeTable ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IOpcodeMnemonics { int NOP = <NUM_LIT:0x00> ; int ACONST_NULL = <NUM_LIT> ; int ICONST_M1 = <NUM_LIT> ; int ICONST_0 = <NUM_LIT> ; int ICONST_1 = <NUM_LIT> ; int ICONST_2 = <NUM_LIT> ; int ICONST_3 = <NUM_LIT> ; int ICONST_4 = <NUM_LIT> ; int ICONST_5 = <NUM_LIT> ; int LCONST_0 = <NUM_LIT> ; int LCONST_1 = <NUM_LIT> ; int FCONST_0 = <NUM_LIT> ; int FCONST_1 = <NUM_LIT> ; int FCONST_2 = <NUM_LIT> ; int DCONST_0 = <NUM_LIT> ; int DCONST_1 = <NUM_LIT> ; int BIPUSH = <NUM_LIT> ; int SIPUSH = <NUM_LIT> ; int LDC = <NUM_LIT> ; int LDC_W = <NUM_LIT> ; int LDC2_W = <NUM_LIT> ; int ILOAD = <NUM_LIT> ; int LLOAD = <NUM_LIT> ; int FLOAD = <NUM_LIT> ; int DLOAD = <NUM_LIT> ; int ALOAD = <NUM_LIT> ; int ILOAD_0 = <NUM_LIT> ; int ILOAD_1 = <NUM_LIT> ; int ILOAD_2 = <NUM_LIT> ; int ILOAD_3 = <NUM_LIT> ; int LLOAD_0 = <NUM_LIT> ; int LLOAD_1 = <NUM_LIT> ; int LLOAD_2 = <NUM_LIT> ; int LLOAD_3 = <NUM_LIT> ; int FLOAD_0 = <NUM_LIT> ; int FLOAD_1 = <NUM_LIT> ; int FLOAD_2 = <NUM_LIT> ; int FLOAD_3 = <NUM_LIT> ; int DLOAD_0 = <NUM_LIT> ; int DLOAD_1 = <NUM_LIT> ; int DLOAD_2 = <NUM_LIT> ; int DLOAD_3 = <NUM_LIT> ; int ALOAD_0 = <NUM_LIT> ; int ALOAD_1 = <NUM_LIT> ; int ALOAD_2 = <NUM_LIT> ; int ALOAD_3 = <NUM_LIT> ; int IALOAD = <NUM_LIT> ; int LALOAD = <NUM_LIT> ; int FALOAD = <NUM_LIT> ; int DALOAD = <NUM_LIT> ; int AALOAD = <NUM_LIT> ; int BALOAD = <NUM_LIT> ; int CALOAD = <NUM_LIT> ; int SALOAD = <NUM_LIT> ; int ISTORE = <NUM_LIT> ; int LSTORE = <NUM_LIT> ; int FSTORE = <NUM_LIT> ; int DSTORE = <NUM_LIT> ; int ASTORE = <NUM_LIT> ; int ISTORE_0 = <NUM_LIT> ; int ISTORE_1 = <NUM_LIT> ; int ISTORE_2 = <NUM_LIT> ; int ISTORE_3 = <NUM_LIT> ; int LSTORE_0 = <NUM_LIT> ; int LSTORE_1 = <NUM_LIT> ; int LSTORE_2 = <NUM_LIT> ; int LSTORE_3 = <NUM_LIT> ; int FSTORE_0 = <NUM_LIT> ; int FSTORE_1 = <NUM_LIT> ; int FSTORE_2 = <NUM_LIT> ; int FSTORE_3 = <NUM_LIT> ; int DSTORE_0 = <NUM_LIT> ; int DSTORE_1 = <NUM_LIT> ; int DSTORE_2 = <NUM_LIT> ; int DSTORE_3 = <NUM_LIT> ; int ASTORE_0 = <NUM_LIT> ; int ASTORE_1 = <NUM_LIT> ; int ASTORE_2 = <NUM_LIT> ; int ASTORE_3 = <NUM_LIT> ; int IASTORE = <NUM_LIT> ; int LASTORE = <NUM_LIT> ; int FASTORE = <NUM_LIT> ; int DASTORE = <NUM_LIT> ; int AASTORE = <NUM_LIT> ; int BASTORE = <NUM_LIT> ; int CASTORE = <NUM_LIT> ; int SASTORE = <NUM_LIT> ; int POP = <NUM_LIT> ; int POP2 = <NUM_LIT> ; int DUP = <NUM_LIT> ; int DUP_X1 = <NUM_LIT> ; int DUP_X2 = <NUM_LIT> ; int DUP2 = <NUM_LIT> ; int DUP2_X1 = <NUM_LIT> ; int DUP2_X2 = <NUM_LIT> ; int SWAP = <NUM_LIT> ; int IADD = <NUM_LIT> ; int LADD = <NUM_LIT> ; int FADD = <NUM_LIT> ; int DADD = <NUM_LIT> ; int ISUB = <NUM_LIT> ; int LSUB = <NUM_LIT> ; int FSUB = <NUM_LIT> ; int DSUB = <NUM_LIT> ; int IMUL = <NUM_LIT> ; int LMUL = <NUM_LIT> ; int FMUL = <NUM_LIT> ; int DMUL = <NUM_LIT> ; int IDIV = <NUM_LIT> ; int LDIV = <NUM_LIT> ; int FDIV = <NUM_LIT> ; int DDIV = <NUM_LIT> ; int IREM = <NUM_LIT> ; int LREM = <NUM_LIT> ; int FREM = <NUM_LIT> ; int DREM = <NUM_LIT> ; int INEG = <NUM_LIT> ; int LNEG = <NUM_LIT> ; int FNEG = <NUM_LIT> ; int DNEG = <NUM_LIT> ; int ISHL = <NUM_LIT> ; int LSHL = <NUM_LIT> ; int ISHR = <NUM_LIT> ; int LSHR = <NUM_LIT> ; int IUSHR = <NUM_LIT> ; int LUSHR = <NUM_LIT> ; int IAND = <NUM_LIT> ; int LAND = <NUM_LIT> ; int IOR = <NUM_LIT> ; int LOR = <NUM_LIT> ; int IXOR = <NUM_LIT> ; int LXOR = <NUM_LIT> ; int IINC = <NUM_LIT> ; int I2L = <NUM_LIT> ; int I2F = <NUM_LIT> ; int I2D = <NUM_LIT> ; int L2I = <NUM_LIT> ; int L2F = <NUM_LIT> ; int L2D = <NUM_LIT> ; int F2I = <NUM_LIT> ; int F2L = <NUM_LIT> ; int F2D = <NUM_LIT> ; int D2I = <NUM_LIT> ; int D2L = <NUM_LIT> ; int D2F = <NUM_LIT> ; int I2B = <NUM_LIT> ; int I2C = <NUM_LIT> ; int I2S = <NUM_LIT> ; int LCMP = <NUM_LIT> ; int FCMPL = <NUM_LIT> ; int FCMPG = <NUM_LIT> ; int DCMPL = <NUM_LIT> ; int DCMPG = <NUM_LIT> ; int IFEQ = <NUM_LIT> ; int IFNE = <NUM_LIT> ; int IFLT = <NUM_LIT> ; int IFGE = <NUM_LIT> ; int IFGT = <NUM_LIT> ; int IFLE = <NUM_LIT> ; int IF_ICMPEQ = <NUM_LIT> ; int IF_ICMPNE = <NUM_LIT> ; int IF_ICMPLT = <NUM_LIT> ; int IF_ICMPGE = <NUM_LIT> ; int IF_ICMPGT = <NUM_LIT> ; int IF_ICMPLE = <NUM_LIT> ; int IF_ACMPEQ = <NUM_LIT> ; int IF_ACMPNE = <NUM_LIT> ; int GOTO = <NUM_LIT> ; int JSR = <NUM_LIT> ; int RET = <NUM_LIT> ; int TABLESWITCH = <NUM_LIT> ; int LOOKUPSWITCH = <NUM_LIT> ; int IRETURN = <NUM_LIT> ; int LRETURN = <NUM_LIT> ; int FRETURN = <NUM_LIT> ; int DRETURN = <NUM_LIT> ; int ARETURN = <NUM_LIT> ; int RETURN = <NUM_LIT> ; int GETSTATIC = <NUM_LIT> ; int PUTSTATIC = <NUM_LIT> ; int GETFIELD = <NUM_LIT> ; int PUTFIELD = <NUM_LIT> ; int INVOKEVIRTUAL = <NUM_LIT> ; int INVOKESPECIAL = <NUM_LIT> ; int INVOKESTATIC = <NUM_LIT> ; int INVOKEINTERFACE = <NUM_LIT> ; int INVOKEDYNAMIC = <NUM_LIT> ; int NEW = <NUM_LIT> ; int NEWARRAY = <NUM_LIT> ; int ANEWARRAY = <NUM_LIT> ; int ARRAYLENGTH = <NUM_LIT> ; int ATHROW = <NUM_LIT> ; int CHECKCAST = <NUM_LIT> ; int INSTANCEOF = <NUM_LIT> ; int MONITORENTER = <NUM_LIT> ; int MONITOREXIT = <NUM_LIT> ; int WIDE = <NUM_LIT> ; int MULTIANEWARRAY = <NUM_LIT> ; int IFNULL = <NUM_LIT> ; int IFNONNULL = <NUM_LIT> ; int GOTO_W = <NUM_LIT> ; int JSR_W = <NUM_LIT> ; int BREAKPOINT = <NUM_LIT> ; int IMPDEP1 = <NUM_LIT> ; int IMPDEP2 = <NUM_LIT> ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IAttributeNamesConstants { char [ ] SYNTHETIC = "<STR_LIT>" . toCharArray ( ) ; char [ ] CONSTANT_VALUE = "<STR_LIT>" . toCharArray ( ) ; char [ ] LINE_NUMBER = "<STR_LIT>" . toCharArray ( ) ; char [ ] LOCAL_VARIABLE = "<STR_LIT>" . toCharArray ( ) ; char [ ] INNER_CLASSES = "<STR_LIT>" . toCharArray ( ) ; char [ ] CODE = "<STR_LIT>" . toCharArray ( ) ; char [ ] EXCEPTIONS = "<STR_LIT>" . toCharArray ( ) ; char [ ] SOURCE = "<STR_LIT>" . toCharArray ( ) ; char [ ] DEPRECATED = "<STR_LIT>" . toCharArray ( ) ; char [ ] SIGNATURE = "<STR_LIT>" . toCharArray ( ) ; char [ ] ENCLOSING_METHOD = "<STR_LIT>" . toCharArray ( ) ; char [ ] LOCAL_VARIABLE_TYPE_TABLE = "<STR_LIT>" . toCharArray ( ) ; char [ ] RUNTIME_VISIBLE_ANNOTATIONS = "<STR_LIT>" . toCharArray ( ) ; char [ ] RUNTIME_INVISIBLE_ANNOTATIONS = "<STR_LIT>" . toCharArray ( ) ; char [ ] RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "<STR_LIT>" . toCharArray ( ) ; char [ ] RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "<STR_LIT>" . toCharArray ( ) ; char [ ] ANNOTATION_DEFAULT = "<STR_LIT>" . toCharArray ( ) ; char [ ] STACK_MAP_TABLE = "<STR_LIT>" . toCharArray ( ) ; char [ ] STACK_MAP = "<STR_LIT>" . toCharArray ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IBytecodeVisitor { void _aaload ( int pc ) ; void _aastore ( int pc ) ; void _aconst_null ( int pc ) ; void _aload ( int pc , int index ) ; void _aload_0 ( int pc ) ; void _aload_1 ( int pc ) ; void _aload_2 ( int pc ) ; void _aload_3 ( int pc ) ; void _anewarray ( int pc , int index , IConstantPoolEntry constantClass ) ; void _areturn ( int pc ) ; void _arraylength ( int pc ) ; void _astore ( int pc , int index ) ; void _astore_0 ( int pc ) ; void _astore_1 ( int pc ) ; void _astore_2 ( int pc ) ; void _astore_3 ( int pc ) ; void _athrow ( int pc ) ; void _baload ( int pc ) ; void _bastore ( int pc ) ; void _bipush ( int pc , byte _byte ) ; void _caload ( int pc ) ; void _castore ( int pc ) ; void _checkcast ( int pc , int index , IConstantPoolEntry constantClass ) ; void _d2f ( int pc ) ; void _d2i ( int pc ) ; void _d2l ( int pc ) ; void _dadd ( int pc ) ; void _daload ( int pc ) ; void _dastore ( int pc ) ; void _dcmpg ( int pc ) ; void _dcmpl ( int pc ) ; void _dconst_0 ( int pc ) ; void _dconst_1 ( int pc ) ; void _ddiv ( int pc ) ; void _dload ( int pc , int index ) ; void _dload_0 ( int pc ) ; void _dload_1 ( int pc ) ; void _dload_2 ( int pc ) ; void _dload_3 ( int pc ) ; void _dmul ( int pc ) ; void _dneg ( int pc ) ; void _drem ( int pc ) ; void _dreturn ( int pc ) ; void _dstore ( int pc , int index ) ; void _dstore_0 ( int pc ) ; void _dstore_1 ( int pc ) ; void _dstore_2 ( int pc ) ; void _dstore_3 ( int pc ) ; void _dsub ( int pc ) ; void _dup ( int pc ) ; void _dup_x1 ( int pc ) ; void _dup_x2 ( int pc ) ; void _dup2 ( int pc ) ; void _dup2_x1 ( int pc ) ; void _dup2_x2 ( int pc ) ; void _f2d ( int pc ) ; void _f2i ( int pc ) ; void _f2l ( int pc ) ; void _fadd ( int pc ) ; void _faload ( int pc ) ; void _fastore ( int pc ) ; void _fcmpg ( int pc ) ; void _fcmpl ( int pc ) ; void _fconst_0 ( int pc ) ; void _fconst_1 ( int pc ) ; void _fconst_2 ( int pc ) ; void _fdiv ( int pc ) ; void _fload ( int pc , int index ) ; void _fload_0 ( int pc ) ; void _fload_1 ( int pc ) ; void _fload_2 ( int pc ) ; void _fload_3 ( int pc ) ; void _fmul ( int pc ) ; void _fneg ( int pc ) ; void _frem ( int pc ) ; void _freturn ( int pc ) ; void _fstore ( int pc , int index ) ; void _fstore_0 ( int pc ) ; void _fstore_1 ( int pc ) ; void _fstore_2 ( int pc ) ; void _fstore_3 ( int pc ) ; void _fsub ( int pc ) ; void _getfield ( int pc , int index , IConstantPoolEntry constantFieldref ) ; void _getstatic ( int pc , int index , IConstantPoolEntry constantFieldref ) ; void _goto ( int pc , int branchOffset ) ; void _goto_w ( int pc , int branchOffset ) ; void _i2b ( int pc ) ; void _i2c ( int pc ) ; void _i2d ( int pc ) ; void _i2f ( int pc ) ; void _i2l ( int pc ) ; void _i2s ( int pc ) ; void _iadd ( int pc ) ; void _iaload ( int pc ) ; void _iand ( int pc ) ; void _iastore ( int pc ) ; void _iconst_m1 ( int pc ) ; void _iconst_0 ( int pc ) ; void _iconst_1 ( int pc ) ; void _iconst_2 ( int pc ) ; void _iconst_3 ( int pc ) ; void _iconst_4 ( int pc ) ; void _iconst_5 ( int pc ) ; void _idiv ( int pc ) ; void _if_acmpeq ( int pc , int branchOffset ) ; void _if_acmpne ( int pc , int branchOffset ) ; void _if_icmpeq ( int pc , int branchOffset ) ; void _if_icmpne ( int pc , int branchOffset ) ; void _if_icmplt ( int pc , int branchOffset ) ; void _if_icmpge ( int pc , int branchOffset ) ; void _if_icmpgt ( int pc , int branchOffset ) ; void _if_icmple ( int pc , int branchOffset ) ; void _ifeq ( int pc , int branchOffset ) ; void _ifne ( int pc , int branchOffset ) ; void _iflt ( int pc , int branchOffset ) ; void _ifge ( int pc , int branchOffset ) ; void _ifgt ( int pc , int branchOffset ) ; void _ifle ( int pc , int branchOffset ) ; void _ifnonnull ( int pc , int branchOffset ) ; void _ifnull ( int pc , int branchOffset ) ; void _iinc ( int pc , int index , int _const ) ; void _iload ( int pc , int index ) ; void _iload_0 ( int pc ) ; void _iload_1 ( int pc ) ; void _iload_2 ( int pc ) ; void _iload_3 ( int pc ) ; void _imul ( int pc ) ; void _ineg ( int pc ) ; void _instanceof ( int pc , int index , IConstantPoolEntry constantClass ) ; void _invokedynamic ( int pc , int index , IConstantPoolEntry nameEntry , IConstantPoolEntry descriptorEntry ) ; void _invokeinterface ( int pc , int index , byte nargs , IConstantPoolEntry constantInterfaceMethodref ) ; void _invokespecial ( int pc , int index , IConstantPoolEntry constantMethodref ) ; void _invokestatic ( int pc , int index , IConstantPoolEntry constantMethodref ) ; void _invokevirtual ( int pc , int index , IConstantPoolEntry constantMethodref ) ; void _ior ( int pc ) ; void _irem ( int pc ) ; void _ireturn ( int pc ) ; void _ishl ( int pc ) ; void _ishr ( int pc ) ; void _istore ( int pc , int index ) ; void _istore_0 ( int pc ) ; void _istore_1 ( int pc ) ; void _istore_2 ( int pc ) ; void _istore_3 ( int pc ) ; void _isub ( int pc ) ; void _iushr ( int pc ) ; void _ixor ( int pc ) ; void _jsr ( int pc , int branchOffset ) ; void _jsr_w ( int pc , int branchOffset ) ; void _l2d ( int pc ) ; void _l2f ( int pc ) ; void _l2i ( int pc ) ; void _ladd ( int pc ) ; void _laload ( int pc ) ; void _land ( int pc ) ; void _lastore ( int pc ) ; void _lcmp ( int pc ) ; void _lconst_0 ( int pc ) ; void _lconst_1 ( int pc ) ; void _ldc ( int pc , int index , IConstantPoolEntry constantPoolEntry ) ; void _ldc_w ( int pc , int index , IConstantPoolEntry constantPoolEntry ) ; void _ldc2_w ( int pc , int index , IConstantPoolEntry constantPoolEntry ) ; void _ldiv ( int pc ) ; void _lload ( int pc , int index ) ; void _lload_0 ( int pc ) ; void _lload_1 ( int pc ) ; void _lload_2 ( int pc ) ; void _lload_3 ( int pc ) ; void _lmul ( int pc ) ; void _lneg ( int pc ) ; void _lookupswitch ( int pc , int defaultoffset , int npairs , int [ ] [ ] offset_pairs ) ; void _lor ( int pc ) ; void _lrem ( int pc ) ; void _lreturn ( int pc ) ; void _lshl ( int pc ) ; void _lshr ( int pc ) ; void _lstore ( int pc , int index ) ; void _lstore_0 ( int pc ) ; void _lstore_1 ( int pc ) ; void _lstore_2 ( int pc ) ; void _lstore_3 ( int pc ) ; void _lsub ( int pc ) ; void _lushr ( int pc ) ; void _lxor ( int pc ) ; void _monitorenter ( int pc ) ; void _monitorexit ( int pc ) ; void _multianewarray ( int pc , int index , int dimensions , IConstantPoolEntry constantClass ) ; void _new ( int pc , int index , IConstantPoolEntry constantClass ) ; void _newarray ( int pc , int atype ) ; void _nop ( int pc ) ; void _pop ( int pc ) ; void _pop2 ( int pc ) ; void _putfield ( int pc , int index , IConstantPoolEntry constantFieldref ) ; void _putstatic ( int pc , int index , IConstantPoolEntry constantFieldref ) ; void _ret ( int pc , int index ) ; void _return ( int pc ) ; void _saload ( int pc ) ; void _sastore ( int pc ) ; void _sipush ( int pc , short value ) ; void _swap ( int pc ) ; void _tableswitch ( int pc , int defaultoffset , int low , int high , int [ ] jump_offsets ) ; void _wide ( int pc , int opcode , int index ) ; void _wide ( int pc , int iincopcode , int index , int _const ) ; void _breakpoint ( int pc ) ; void _impdep1 ( int pc ) ; void _impdep2 ( int pc ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IRuntimeInvisibleParameterAnnotationsAttribute extends IClassFileAttribute { int getParametersNumber ( ) ; IParameterAnnotation [ ] getParameterAnnotations ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IInnerClassesAttributeEntry { int getAccessFlags ( ) ; int getInnerNameIndex ( ) ; int getOuterClassNameIndex ( ) ; int getInnerClassNameIndex ( ) ; char [ ] getInnerName ( ) ; char [ ] getOuterClassName ( ) ; char [ ] getInnerClassName ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface ILineNumberAttribute extends IClassFileAttribute { int getLineNumberTableLength ( ) ; int [ ] [ ] getLineNumberTable ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IConstantPoolEntry { int getKind ( ) ; int getClassInfoNameIndex ( ) ; int getClassIndex ( ) ; int getNameAndTypeIndex ( ) ; int getStringIndex ( ) ; String getStringValue ( ) ; int getIntegerValue ( ) ; float getFloatValue ( ) ; double getDoubleValue ( ) ; long getLongValue ( ) ; int getNameAndTypeInfoDescriptorIndex ( ) ; int getNameAndTypeInfoNameIndex ( ) ; char [ ] getClassInfoName ( ) ; char [ ] getClassName ( ) ; char [ ] getFieldName ( ) ; char [ ] getMethodName ( ) ; char [ ] getFieldDescriptor ( ) ; char [ ] getMethodDescriptor ( ) ; char [ ] getUtf8Value ( ) ; int getUtf8Length ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IStackMapTableAttribute extends IClassFileAttribute { int getNumberOfEntries ( ) ; IStackMapFrame [ ] getStackMapFrame ( ) ; } </s>
<s> package org . eclipse . jdt . core . util ; public interface IModifierConstants { int ACC_PUBLIC = <NUM_LIT> ; int ACC_PRIVATE = <NUM_LIT> ; int ACC_PROTECTED = <NUM_LIT> ; int ACC_STATIC = <NUM_LIT> ; int ACC_FINAL = <NUM_LIT> ; int ACC_SUPER = <NUM_LIT> ; int ACC_SYNCHRONIZED = <NUM_LIT> ; int ACC_VOLATILE = <NUM_LIT> ; int ACC_BRIDGE = <NUM_LIT> ; int ACC_TRANSIENT = <NUM_LIT> ; int ACC_VARARGS = <NUM_LIT> ; int ACC_NATIVE = <NUM_LIT> ; int ACC_INTERFACE = <NUM_LIT> ; int ACC_ABSTRACT = <NUM_LIT> ; int ACC_STRICT = <NUM_LIT> ; int ACC_SYNTHETIC = <NUM_LIT> ; int ACC_ANNOTATION = <NUM_LIT> ; int ACC_ENUM = <NUM_LIT> ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . EventObject ; public class BufferChangedEvent extends EventObject { private int length ; private int offset ; private String text ; private static final long serialVersionUID = <NUM_LIT> ; public BufferChangedEvent ( IBuffer buffer , int offset , int length , String text ) { super ( buffer ) ; this . offset = offset ; this . length = length ; this . text = text ; } public IBuffer getBuffer ( ) { return ( IBuffer ) this . source ; } public int getLength ( ) { return this . length ; } public int getOffset ( ) { return this . offset ; } public String getText ( ) { return this . text ; } } </s>
<s> package org . eclipse . jdt . core ; public interface ITypeHierarchyChangedListener { void typeHierarchyChanged ( ITypeHierarchy typeHierarchy ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . text . edits . UndoEdit ; public interface IBuffer { public interface ITextEditCapability { public UndoEdit applyTextEdit ( TextEdit edit , IProgressMonitor monitor ) throws JavaModelException ; } public void addBufferChangedListener ( IBufferChangedListener listener ) ; public void append ( char [ ] text ) ; public void append ( String text ) ; public void close ( ) ; public char getChar ( int position ) ; public char [ ] getCharacters ( ) ; public String getContents ( ) ; public int getLength ( ) ; public IOpenable getOwner ( ) ; public String getText ( int offset , int length ) throws IndexOutOfBoundsException ; public IResource getUnderlyingResource ( ) ; public boolean hasUnsavedChanges ( ) ; public boolean isClosed ( ) ; public boolean isReadOnly ( ) ; public void removeBufferChangedListener ( IBufferChangedListener listener ) ; public void replace ( int position , int length , char [ ] text ) ; public void replace ( int position , int length , String text ) ; public void save ( IProgressMonitor progress , boolean force ) throws JavaModelException ; public void setContents ( char [ ] contents ) ; public void setContents ( String contents ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . internal . core . JavaModelStatus ; public abstract class ClasspathContainerInitializer { public static final int ATTRIBUTE_NOT_SUPPORTED = <NUM_LIT:1> ; public static final int ATTRIBUTE_READ_ONLY = <NUM_LIT:2> ; public ClasspathContainerInitializer ( ) { } public abstract void initialize ( IPath containerPath , IJavaProject project ) throws CoreException ; public boolean canUpdateClasspathContainer ( IPath containerPath , IJavaProject project ) { return false ; } public void requestClasspathContainerUpdate ( IPath containerPath , IJavaProject project , IClasspathContainer containerSuggestion ) throws CoreException { } public String getDescription ( IPath containerPath , IJavaProject project ) { return containerPath . makeRelative ( ) . toString ( ) ; } public IClasspathContainer getFailureContainer ( final IPath containerPath , IJavaProject project ) { final String description = getDescription ( containerPath , project ) ; return new IClasspathContainer ( ) { public IClasspathEntry [ ] getClasspathEntries ( ) { return new IClasspathEntry [ <NUM_LIT:0> ] ; } public String getDescription ( ) { return description ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return containerPath ; } public String toString ( ) { return getDescription ( ) ; } } ; } public Object getComparisonID ( IPath containerPath , IJavaProject project ) { if ( containerPath == null ) { return null ; } else { return containerPath . segment ( <NUM_LIT:0> ) ; } } public IStatus getAccessRulesStatus ( IPath containerPath , IJavaProject project ) { if ( canUpdateClasspathContainer ( containerPath , project ) ) { return Status . OK_STATUS ; } return new JavaModelStatus ( ATTRIBUTE_READ_ONLY ) ; } public IStatus getAttributeStatus ( IPath containerPath , IJavaProject project , String attributeKey ) { if ( canUpdateClasspathContainer ( containerPath , project ) ) { return Status . OK_STATUS ; } return new JavaModelStatus ( ATTRIBUTE_READ_ONLY ) ; } public IStatus getSourceAttachmentStatus ( IPath containerPath , IJavaProject project ) { if ( canUpdateClasspathContainer ( containerPath , project ) ) { return Status . OK_STATUS ; } return new JavaModelStatus ( ATTRIBUTE_READ_ONLY ) ; } } </s>
<s> package org . eclipse . jdt . core ; public class CompletionContext { public static final int TL_MEMBER_START = <NUM_LIT:1> ; public static final int TL_STATEMENT_START = <NUM_LIT:2> ; public static final int TOKEN_KIND_UNKNOWN = <NUM_LIT:0> ; public static final int TOKEN_KIND_NAME = <NUM_LIT:1> ; public static final int TOKEN_KIND_STRING_LITERAL = <NUM_LIT:2> ; public boolean isInJavadoc ( ) { return false ; } public boolean isInJavadocText ( ) { return false ; } public boolean isInJavadocFormalReference ( ) { return false ; } public boolean isExtended ( ) { return false ; } public char [ ] [ ] getExpectedTypesSignatures ( ) { return null ; } public char [ ] [ ] getExpectedTypesKeys ( ) { return null ; } public char [ ] getToken ( ) { return null ; } public int getTokenKind ( ) { return - <NUM_LIT:1> ; } public int getTokenLocation ( ) { return - <NUM_LIT:1> ; } public int getTokenStart ( ) { return - <NUM_LIT:1> ; } public int getTokenEnd ( ) { return - <NUM_LIT:1> ; } public int getOffset ( ) { return - <NUM_LIT:1> ; } public IJavaElement getEnclosingElement ( ) { return null ; } public IJavaElement [ ] getVisibleElements ( String typeSignature ) { return null ; } } </s>
<s> package org . eclipse . jdt . core ; public interface IBufferChangedListener { public void bufferChanged ( BufferChangedEvent event ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IMemberValuePair { int K_INT = <NUM_LIT:1> ; int K_BYTE = <NUM_LIT:2> ; int K_SHORT = <NUM_LIT:3> ; int K_CHAR = <NUM_LIT:4> ; int K_FLOAT = <NUM_LIT:5> ; int K_DOUBLE = <NUM_LIT:6> ; int K_LONG = <NUM_LIT:7> ; int K_BOOLEAN = <NUM_LIT:8> ; int K_STRING = <NUM_LIT:9> ; int K_ANNOTATION = <NUM_LIT:10> ; int K_CLASS = <NUM_LIT:11> ; int K_QUALIFIED_NAME = <NUM_LIT:12> ; int K_SIMPLE_NAME = <NUM_LIT> ; int K_UNKNOWN = <NUM_LIT> ; String getMemberName ( ) ; Object getValue ( ) ; int getValueKind ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . dom . ASTParser ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . IBinding ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . text . edits . UndoEdit ; public interface ICompilationUnit extends ITypeRoot , IWorkingCopy , ISourceManipulation { public static final int NO_AST = <NUM_LIT:0> ; public static final int FORCE_PROBLEM_DETECTION = <NUM_LIT> ; public static final int ENABLE_STATEMENTS_RECOVERY = <NUM_LIT> ; public static final int ENABLE_BINDINGS_RECOVERY = <NUM_LIT> ; public static final int IGNORE_METHOD_BODIES = <NUM_LIT> ; public UndoEdit applyTextEdit ( TextEdit edit , IProgressMonitor monitor ) throws JavaModelException ; void becomeWorkingCopy ( IProblemRequestor problemRequestor , IProgressMonitor monitor ) throws JavaModelException ; void becomeWorkingCopy ( IProgressMonitor monitor ) throws JavaModelException ; void commitWorkingCopy ( boolean force , IProgressMonitor monitor ) throws JavaModelException ; IImportDeclaration createImport ( String name , IJavaElement sibling , IProgressMonitor monitor ) throws JavaModelException ; IImportDeclaration createImport ( String name , IJavaElement sibling , int flags , IProgressMonitor monitor ) throws JavaModelException ; IPackageDeclaration createPackageDeclaration ( String name , IProgressMonitor monitor ) throws JavaModelException ; IType createType ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException ; void discardWorkingCopy ( ) throws JavaModelException ; IJavaElement [ ] findElements ( IJavaElement element ) ; ICompilationUnit findWorkingCopy ( WorkingCopyOwner owner ) ; IType [ ] getAllTypes ( ) throws JavaModelException ; IImportDeclaration getImport ( String name ) ; IImportContainer getImportContainer ( ) ; IImportDeclaration [ ] getImports ( ) throws JavaModelException ; ICompilationUnit getPrimary ( ) ; WorkingCopyOwner getOwner ( ) ; IPackageDeclaration getPackageDeclaration ( String name ) ; IPackageDeclaration [ ] getPackageDeclarations ( ) throws JavaModelException ; IType getType ( String name ) ; IType [ ] getTypes ( ) throws JavaModelException ; ICompilationUnit getWorkingCopy ( IProgressMonitor monitor ) throws JavaModelException ; ICompilationUnit getWorkingCopy ( WorkingCopyOwner owner , IProblemRequestor problemRequestor , IProgressMonitor monitor ) throws JavaModelException ; public boolean hasResourceChanged ( ) ; boolean isWorkingCopy ( ) ; CompilationUnit reconcile ( int astLevel , boolean forceProblemDetection , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; CompilationUnit reconcile ( int astLevel , boolean forceProblemDetection , boolean enableStatementsRecovery , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; CompilationUnit reconcile ( int astLevel , int reconcileFlags , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; void restore ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface ICodeFormatter { String format ( String string , int indentationLevel , int [ ] positions , String lineSeparator ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; public interface IJavaModelStatus extends IStatus { IJavaElement [ ] getElements ( ) ; IPath getPath ( ) ; String getString ( ) ; boolean isDoesNotExist ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IMember extends IJavaElement , ISourceReference , ISourceManipulation , IParent { String [ ] getCategories ( ) throws JavaModelException ; IClassFile getClassFile ( ) ; ICompilationUnit getCompilationUnit ( ) ; IType getDeclaringType ( ) ; int getFlags ( ) throws JavaModelException ; ISourceRange getJavadocRange ( ) throws JavaModelException ; ISourceRange getNameRange ( ) throws JavaModelException ; int getOccurrenceCount ( ) ; ITypeRoot getTypeRoot ( ) ; IType getType ( String name , int occurrenceCount ) ; boolean isBinary ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IJavaModelStatusConstants { public static final int INVALID_CP_CONTAINER_ENTRY = <NUM_LIT> ; public static final int CP_CONTAINER_PATH_UNBOUND = <NUM_LIT> ; public static final int INVALID_CLASSPATH = <NUM_LIT> ; public static final int CP_VARIABLE_PATH_UNBOUND = <NUM_LIT> ; public static final int CORE_EXCEPTION = <NUM_LIT> ; public static final int INVALID_ELEMENT_TYPES = <NUM_LIT> ; public static final int NO_ELEMENTS_TO_PROCESS = <NUM_LIT> ; public static final int ELEMENT_DOES_NOT_EXIST = <NUM_LIT> ; public static final int NULL_PATH = <NUM_LIT> ; public static final int PATH_OUTSIDE_PROJECT = <NUM_LIT> ; public static final int RELATIVE_PATH = <NUM_LIT> ; public static final int DEVICE_PATH = <NUM_LIT> ; public static final int NULL_STRING = <NUM_LIT> ; public static final int READ_ONLY = <NUM_LIT> ; public static final int NAME_COLLISION = <NUM_LIT> ; public static final int INVALID_DESTINATION = <NUM_LIT> ; public static final int INVALID_PATH = <NUM_LIT> ; public static final int INDEX_OUT_OF_BOUNDS = <NUM_LIT> ; public static final int UPDATE_CONFLICT = <NUM_LIT> ; public static final int NULL_NAME = <NUM_LIT> ; public static final int INVALID_NAME = <NUM_LIT> ; public static final int INVALID_CONTENTS = <NUM_LIT> ; public static final int IO_EXCEPTION = <NUM_LIT> ; public static final int DOM_EXCEPTION = <NUM_LIT> ; public static final int TARGET_EXCEPTION = <NUM_LIT> ; public static final int BUILDER_INITIALIZATION_ERROR = <NUM_LIT> ; public static final int BUILDER_SERIALIZATION_ERROR = <NUM_LIT> ; public static final int EVALUATION_ERROR = <NUM_LIT> ; public static final int INVALID_SIBLING = <NUM_LIT> ; public static final int INVALID_RESOURCE = <NUM_LIT> ; public static final int INVALID_RESOURCE_TYPE = <NUM_LIT> ; public static final int INVALID_PROJECT = <NUM_LIT> ; public static final int INVALID_PACKAGE = <NUM_LIT> ; public static final int NO_LOCAL_CONTENTS = <NUM_LIT> ; public static final int INVALID_CLASSPATH_FILE_FORMAT = <NUM_LIT:1000> ; public static final int CLASSPATH_CYCLE = <NUM_LIT> ; public static final int DISABLED_CP_EXCLUSION_PATTERNS = <NUM_LIT> ; public static final int DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS = <NUM_LIT> ; public static final int INCOMPATIBLE_JDK_LEVEL = <NUM_LIT> ; public static final int COMPILER_FAILURE = <NUM_LIT> ; public static final int ELEMENT_NOT_ON_CLASSPATH = <NUM_LIT> ; public static final int CANNOT_RETRIEVE_ATTACHED_JAVADOC = <NUM_LIT> ; public static final int UNKNOWN_JAVADOC_FORMAT = <NUM_LIT> ; public static final int DEPRECATED_VARIABLE = <NUM_LIT> ; public static final int BAD_TEXT_EDIT_LOCATION = <NUM_LIT> ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface IClassFile extends ITypeRoot { ICompilationUnit becomeWorkingCopy ( IProblemRequestor problemRequestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; byte [ ] getBytes ( ) throws JavaModelException ; IType getType ( ) ; IJavaElement getWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory ) throws JavaModelException ; boolean isClass ( ) throws JavaModelException ; boolean isInterface ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IPath ; public interface IAccessRule { int K_ACCESSIBLE = <NUM_LIT:0> ; int K_NON_ACCESSIBLE = <NUM_LIT:1> ; int K_DISCOURAGED = <NUM_LIT:2> ; int IGNORE_IF_BETTER = <NUM_LIT> ; IPath getPattern ( ) ; int getKind ( ) ; boolean ignoreIfBetter ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . Map ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . dom . IAnnotationBinding ; import org . eclipse . jdt . core . dom . IMethodBinding ; import org . eclipse . jdt . core . dom . IPackageBinding ; import org . eclipse . jdt . core . dom . ITypeBinding ; import org . eclipse . jdt . core . dom . IVariableBinding ; import org . eclipse . jdt . core . eval . IEvaluationContext ; public interface IJavaProject extends IParent , IJavaElement , IOpenable { IClasspathEntry decodeClasspathEntry ( String encodedEntry ) ; String encodeClasspathEntry ( IClasspathEntry classpathEntry ) ; IJavaElement findElement ( IPath path ) throws JavaModelException ; IJavaElement findElement ( IPath path , WorkingCopyOwner owner ) throws JavaModelException ; IJavaElement findElement ( String bindingKey , WorkingCopyOwner owner ) throws JavaModelException ; IPackageFragment findPackageFragment ( IPath path ) throws JavaModelException ; IPackageFragmentRoot findPackageFragmentRoot ( IPath path ) throws JavaModelException ; IPackageFragmentRoot [ ] findPackageFragmentRoots ( IClasspathEntry entry ) ; IType findType ( String fullyQualifiedName ) throws JavaModelException ; IType findType ( String fullyQualifiedName , IProgressMonitor progressMonitor ) throws JavaModelException ; IType findType ( String fullyQualifiedName , WorkingCopyOwner owner ) throws JavaModelException ; IType findType ( String fullyQualifiedName , WorkingCopyOwner owner , IProgressMonitor progressMonitor ) throws JavaModelException ; IType findType ( String packageName , String typeQualifiedName ) throws JavaModelException ; IType findType ( String packageName , String typeQualifiedName , IProgressMonitor progressMonitor ) throws JavaModelException ; IType findType ( String packageName , String typeQualifiedName , WorkingCopyOwner owner ) throws JavaModelException ; IType findType ( String packageName , String typeQualifiedName , WorkingCopyOwner owner , IProgressMonitor progressMonitor ) throws JavaModelException ; IPackageFragmentRoot [ ] getAllPackageFragmentRoots ( ) throws JavaModelException ; Object [ ] getNonJavaResources ( ) throws JavaModelException ; String getOption ( String optionName , boolean inheritJavaCoreOptions ) ; Map getOptions ( boolean inheritJavaCoreOptions ) ; IPath getOutputLocation ( ) throws JavaModelException ; IPackageFragmentRoot getPackageFragmentRoot ( String externalLibraryPath ) ; IPackageFragmentRoot getPackageFragmentRoot ( IResource resource ) ; IPackageFragmentRoot [ ] getPackageFragmentRoots ( ) throws JavaModelException ; IPackageFragmentRoot [ ] getPackageFragmentRoots ( IClasspathEntry entry ) ; IPackageFragment [ ] getPackageFragments ( ) throws JavaModelException ; IProject getProject ( ) ; IClasspathEntry [ ] getRawClasspath ( ) throws JavaModelException ; String [ ] getRequiredProjectNames ( ) throws JavaModelException ; IClasspathEntry [ ] getResolvedClasspath ( boolean ignoreUnresolvedEntry ) throws JavaModelException ; boolean hasBuildState ( ) ; boolean hasClasspathCycle ( IClasspathEntry [ ] entries ) ; boolean isOnClasspath ( IJavaElement element ) ; boolean isOnClasspath ( IResource resource ) ; IEvaluationContext newEvaluationContext ( ) ; ITypeHierarchy newTypeHierarchy ( IRegion region , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IRegion region , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IType type , IRegion region , IProgressMonitor monitor ) throws JavaModelException ; ITypeHierarchy newTypeHierarchy ( IType type , IRegion region , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException ; IPath readOutputLocation ( ) ; IClasspathEntry [ ] readRawClasspath ( ) ; void setOption ( String optionName , String optionValue ) ; void setOptions ( Map newOptions ) ; void setOutputLocation ( IPath path , IProgressMonitor monitor ) throws JavaModelException ; void setRawClasspath ( IClasspathEntry [ ] entries , IPath outputLocation , boolean canModifyResources , IProgressMonitor monitor ) throws JavaModelException ; void setRawClasspath ( IClasspathEntry [ ] entries , boolean canModifyResources , IProgressMonitor monitor ) throws JavaModelException ; void setRawClasspath ( IClasspathEntry [ ] entries , IClasspathEntry [ ] referencedEntries , IPath outputLocation , IProgressMonitor monitor ) throws JavaModelException ; IClasspathEntry [ ] getReferencedClasspathEntries ( ) throws JavaModelException ; void setRawClasspath ( IClasspathEntry [ ] entries , IProgressMonitor monitor ) throws JavaModelException ; void setRawClasspath ( IClasspathEntry [ ] entries , IPath outputLocation , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface IElementChangedListener { public void elementChanged ( ElementChangedEvent event ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . jdt . core . compiler . IProblem ; public interface ICompletionRequestor { void acceptAnonymousType ( char [ ] superTypePackageName , char [ ] superTypeName , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptClass ( char [ ] packageName , char [ ] className , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptError ( IProblem error ) ; void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , char [ ] typePackageName , char [ ] typeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptKeyword ( char [ ] keywordName , int completionStart , int completionEnd , int relevance ) ; void acceptLabel ( char [ ] labelName , int completionStart , int completionEnd , int relevance ) ; void acceptLocalVariable ( char [ ] name , char [ ] typePackageName , char [ ] typeName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptMethodDeclaration ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) ; void acceptModifier ( char [ ] modifierName , int completionStart , int completionEnd , int relevance ) ; void acceptPackage ( char [ ] packageName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) ; void acceptType ( char [ ] packageName , char [ ] typeName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) ; void acceptVariableName ( char [ ] typePackageName , char [ ] typeName , char [ ] name , char [ ] completionName , int completionStart , int completionEnd , int relevance ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface IAnnotatable { IAnnotation getAnnotation ( String name ) ; IAnnotation [ ] getAnnotations ( ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; public interface IRegion { void add ( IJavaElement element ) ; boolean contains ( IJavaElement element ) ; IJavaElement [ ] getElements ( ) ; boolean remove ( IJavaElement element ) ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IPath ; public interface IClasspathContainer { int K_APPLICATION = <NUM_LIT:1> ; int K_SYSTEM = <NUM_LIT:2> ; int K_DEFAULT_SYSTEM = <NUM_LIT:3> ; IClasspathEntry [ ] getClasspathEntries ( ) ; String getDescription ( ) ; int getKind ( ) ; IPath getPath ( ) ; } </s>
<s> package org . eclipse . jdt . core ; public interface ILocalVariable extends IJavaElement , ISourceReference , IAnnotatable { String getElementName ( ) ; ISourceRange getNameRange ( ) ; String getTypeSignature ( ) ; } </s>
<s> package org . eclipse . jdt . core ; import java . io . OutputStream ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ITypeHierarchy { void addTypeHierarchyChangedListener ( ITypeHierarchyChangedListener listener ) ; boolean contains ( IType type ) ; boolean exists ( ) ; IType [ ] getAllClasses ( ) ; IType [ ] getAllInterfaces ( ) ; IType [ ] getAllSubtypes ( IType type ) ; IType [ ] getAllSuperclasses ( IType type ) ; IType [ ] getAllSuperInterfaces ( IType type ) ; IType [ ] getAllSupertypes ( IType type ) ; IType [ ] getAllTypes ( ) ; int getCachedFlags ( IType type ) ; IType [ ] getExtendingInterfaces ( IType type ) ; IType [ ] getImplementingClasses ( IType type ) ; IType [ ] getRootClasses ( ) ; IType [ ] getRootInterfaces ( ) ; IType [ ] getSubclasses ( IType type ) ; IType [ ] getSubtypes ( IType type ) ; IType getSuperclass ( IType type ) ; IType [ ] getSuperInterfaces ( IType type ) ; IType [ ] getSupertypes ( IType type ) ; IType getType ( ) ; void refresh ( IProgressMonitor monitor ) throws JavaModelException ; void removeTypeHierarchyChangedListener ( ITypeHierarchyChangedListener listener ) ; void store ( OutputStream outputStream , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ISourceManipulation { void copy ( IJavaElement container , IJavaElement sibling , String rename , boolean replace , IProgressMonitor monitor ) throws JavaModelException ; void delete ( boolean force , IProgressMonitor monitor ) throws JavaModelException ; void move ( IJavaElement container , IJavaElement sibling , String rename , boolean replace , IProgressMonitor monitor ) throws JavaModelException ; void rename ( String name , boolean replace , IProgressMonitor monitor ) throws JavaModelException ; } </s>
<s> package org . eclipse . jdt . core ; import java . util . EventObject ; public class ElementChangedEvent extends EventObject { public static final int POST_CHANGE = <NUM_LIT:1> ; public static final int PRE_AUTO_BUILD = <NUM_LIT:2> ; public static final int POST_RECONCILE = <NUM_LIT:4> ; private static final long serialVersionUID = - <NUM_LIT> ; private int type ; public ElementChangedEvent ( IJavaElementDelta delta , int type ) { super ( delta ) ; this . type = type ; } public IJavaElementDelta getDelta ( ) { return ( IJavaElementDelta ) this . source ; } public int getType ( ) { return this . type ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . OutputStreamWriter ; import java . io . Reader ; import java . util . ArrayList ; import java . util . HashMap ; import javax . xml . parsers . DocumentBuilder ; import javax . xml . parsers . DocumentBuilderFactory ; import javax . xml . parsers . ParserConfigurationException ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . IAccessRule ; import org . eclipse . jdt . core . IClasspathAttribute ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . core . util . Messages ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import org . w3c . dom . NodeList ; import org . xml . sax . InputSource ; import org . xml . sax . SAXException ; public class UserLibrary { private static final String CURRENT_VERSION = "<STR_LIT:1>" ; private static final String TAG_VERSION = "<STR_LIT:version>" ; private static final String TAG_USERLIBRARY = "<STR_LIT>" ; private static final String TAG_SOURCEATTACHMENT = "<STR_LIT>" ; private static final String TAG_SOURCEATTACHMENTROOT = "<STR_LIT>" ; private static final String TAG_PATH = "<STR_LIT:path>" ; private static final String TAG_ARCHIVE = "<STR_LIT>" ; private static final String TAG_SYSTEMLIBRARY = "<STR_LIT>" ; private boolean isSystemLibrary ; private IClasspathEntry [ ] entries ; public UserLibrary ( IClasspathEntry [ ] entries , boolean isSystemLibrary ) { Assert . isNotNull ( entries ) ; this . entries = entries ; this . isSystemLibrary = isSystemLibrary ; } public IClasspathEntry [ ] getEntries ( ) { return this . entries ; } public boolean isSystemLibrary ( ) { return this . isSystemLibrary ; } public boolean equals ( Object obj ) { if ( obj != null && obj . getClass ( ) == getClass ( ) ) { UserLibrary other = ( UserLibrary ) obj ; if ( this . entries . length == other . entries . length && this . isSystemLibrary == other . isSystemLibrary ) { for ( int i = <NUM_LIT:0> ; i < this . entries . length ; i ++ ) { if ( ! this . entries [ i ] . equals ( other . entries [ i ] ) ) { return false ; } } return true ; } } return false ; } public int hashCode ( ) { int hashCode = <NUM_LIT:0> ; if ( this . isSystemLibrary ) { hashCode ++ ; } for ( int i = <NUM_LIT:0> ; i < this . entries . length ; i ++ ) { hashCode = hashCode * <NUM_LIT> + this . entries . hashCode ( ) ; } return hashCode ; } public static String serialize ( IClasspathEntry [ ] entries , boolean isSystemLibrary ) throws IOException { ByteArrayOutputStream s = new ByteArrayOutputStream ( ) ; OutputStreamWriter writer = new OutputStreamWriter ( s , "<STR_LIT>" ) ; XMLWriter xmlWriter = new XMLWriter ( writer , null , true ) ; HashMap library = new HashMap ( ) ; library . put ( TAG_VERSION , String . valueOf ( CURRENT_VERSION ) ) ; library . put ( TAG_SYSTEMLIBRARY , String . valueOf ( isSystemLibrary ) ) ; xmlWriter . printTag ( TAG_USERLIBRARY , library , true , true , false ) ; for ( int i = <NUM_LIT:0> , length = entries . length ; i < length ; ++ i ) { ClasspathEntry cpEntry = ( ClasspathEntry ) entries [ i ] ; HashMap archive = new HashMap ( ) ; archive . put ( TAG_PATH , cpEntry . getPath ( ) . toString ( ) ) ; IPath sourceAttach = cpEntry . getSourceAttachmentPath ( ) ; if ( sourceAttach != null ) archive . put ( TAG_SOURCEATTACHMENT , sourceAttach ) ; IPath sourceAttachRoot = cpEntry . getSourceAttachmentRootPath ( ) ; if ( sourceAttachRoot != null ) archive . put ( TAG_SOURCEATTACHMENTROOT , sourceAttachRoot ) ; boolean hasExtraAttributes = cpEntry . extraAttributes != null && cpEntry . extraAttributes . length != <NUM_LIT:0> ; boolean hasRestrictions = cpEntry . getAccessRuleSet ( ) != null ; xmlWriter . printTag ( TAG_ARCHIVE , archive , true , true , ! ( hasExtraAttributes || hasRestrictions ) ) ; if ( hasExtraAttributes ) { cpEntry . encodeExtraAttributes ( xmlWriter , true , true ) ; } if ( hasRestrictions ) { cpEntry . encodeAccessRules ( xmlWriter , true , true ) ; } if ( hasExtraAttributes || hasRestrictions ) { xmlWriter . endTag ( TAG_ARCHIVE , true , true ) ; } } xmlWriter . endTag ( TAG_USERLIBRARY , true , true ) ; writer . flush ( ) ; writer . close ( ) ; return s . toString ( "<STR_LIT>" ) ; } public static UserLibrary createFromString ( Reader reader ) throws IOException { Element cpElement ; try { DocumentBuilder parser = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; cpElement = parser . parse ( new InputSource ( reader ) ) . getDocumentElement ( ) ; } catch ( SAXException e ) { throw new IOException ( Messages . file_badFormat ) ; } catch ( ParserConfigurationException e ) { throw new IOException ( Messages . file_badFormat ) ; } finally { reader . close ( ) ; } if ( ! cpElement . getNodeName ( ) . equalsIgnoreCase ( TAG_USERLIBRARY ) ) { throw new IOException ( Messages . file_badFormat ) ; } boolean isSystem = Boolean . valueOf ( cpElement . getAttribute ( TAG_SYSTEMLIBRARY ) ) . booleanValue ( ) ; NodeList list = cpElement . getChildNodes ( ) ; int length = list . getLength ( ) ; ArrayList res = new ArrayList ( length ) ; for ( int i = <NUM_LIT:0> ; i < length ; ++ i ) { Node node = list . item ( i ) ; if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { Element element = ( Element ) node ; if ( element . getNodeName ( ) . equals ( TAG_ARCHIVE ) ) { String path = element . getAttribute ( TAG_PATH ) ; IPath sourceAttach = element . hasAttribute ( TAG_SOURCEATTACHMENT ) ? new Path ( element . getAttribute ( TAG_SOURCEATTACHMENT ) ) : null ; IPath sourceAttachRoot = element . hasAttribute ( TAG_SOURCEATTACHMENTROOT ) ? new Path ( element . getAttribute ( TAG_SOURCEATTACHMENTROOT ) ) : null ; NodeList children = element . getElementsByTagName ( "<STR_LIT:*>" ) ; boolean [ ] foundChildren = new boolean [ children . getLength ( ) ] ; NodeList attributeList = ClasspathEntry . getChildAttributes ( ClasspathEntry . TAG_ATTRIBUTES , children , foundChildren ) ; IClasspathAttribute [ ] extraAttributes = ClasspathEntry . decodeExtraAttributes ( attributeList ) ; attributeList = ClasspathEntry . getChildAttributes ( ClasspathEntry . TAG_ACCESS_RULES , children , foundChildren ) ; IAccessRule [ ] accessRules = ClasspathEntry . decodeAccessRules ( attributeList ) ; IClasspathEntry entry = JavaCore . newLibraryEntry ( new Path ( path ) , sourceAttach , sourceAttachRoot , accessRules , extraAttributes , false ) ; res . add ( entry ) ; } } } IClasspathEntry [ ] entries = ( IClasspathEntry [ ] ) res . toArray ( new IClasspathEntry [ res . size ( ) ] ) ; return new UserLibrary ( entries , isSystem ) ; } public String toString ( ) { if ( this . entries == null ) return "<STR_LIT:null>" ; StringBuffer buffer = new StringBuffer ( ) ; int length = this . entries . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { buffer . append ( this . entries [ i ] . toString ( ) + '<STR_LIT:\n>' ) ; } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; public class OpenableElementInfo extends JavaElementInfo { protected IJavaElement [ ] children = JavaElement . NO_ELEMENTS ; protected boolean isStructureKnown = false ; public void addChild ( IJavaElement child ) { int length = this . children . length ; if ( length == <NUM_LIT:0> ) { this . children = new IJavaElement [ ] { child } ; } else { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( this . children [ i ] . equals ( child ) ) return ; } System . arraycopy ( this . children , <NUM_LIT:0> , this . children = new IJavaElement [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; this . children [ length ] = child ; } } public IJavaElement [ ] getChildren ( ) { return this . children ; } public boolean isStructureKnown ( ) { return this . isStructureKnown ; } public void removeChild ( IJavaElement child ) { for ( int i = <NUM_LIT:0> , length = this . children . length ; i < length ; i ++ ) { IJavaElement element = this . children [ i ] ; if ( element . equals ( child ) ) { if ( length == <NUM_LIT:1> ) { this . children = JavaElement . NO_ELEMENTS ; } else { IJavaElement [ ] newChildren = new IJavaElement [ length - <NUM_LIT:1> ] ; System . arraycopy ( this . children , <NUM_LIT:0> , newChildren , <NUM_LIT:0> , i ) ; if ( i < length - <NUM_LIT:1> ) System . arraycopy ( this . children , i + <NUM_LIT:1> , newChildren , i , length - <NUM_LIT:1> - i ) ; this . children = newChildren ; } break ; } } } public void setChildren ( IJavaElement [ ] children ) { this . children = children ; } public void setIsStructureKnown ( boolean newIsStructureKnown ) { this . isStructureKnown = newIsStructureKnown ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IMemberValuePair ; public class SourceAnnotationMethodInfo extends SourceMethodInfo { public int defaultValueStart = - <NUM_LIT:1> ; public int defaultValueEnd = - <NUM_LIT:1> ; public IMemberValuePair defaultValue ; public boolean isAnnotationMethod ( ) { return true ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . ClasspathContainerInitializer ; import org . eclipse . jdt . core . IClasspathContainer ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . core . util . Util ; public class UserLibraryClasspathContainerInitializer extends ClasspathContainerInitializer { public boolean canUpdateClasspathContainer ( IPath containerPath , IJavaProject project ) { return isUserLibraryContainer ( containerPath ) ; } public Object getComparisonID ( IPath containerPath , IJavaProject project ) { return containerPath ; } public String getDescription ( IPath containerPath , IJavaProject project ) { if ( isUserLibraryContainer ( containerPath ) ) { return containerPath . segment ( <NUM_LIT:1> ) ; } return super . getDescription ( containerPath , project ) ; } public void initialize ( IPath containerPath , IJavaProject project ) throws CoreException { if ( isUserLibraryContainer ( containerPath ) ) { String userLibName = containerPath . segment ( <NUM_LIT:1> ) ; UserLibrary userLibrary = JavaModelManager . getUserLibraryManager ( ) . getUserLibrary ( userLibName ) ; if ( userLibrary != null ) { UserLibraryClasspathContainer container = new UserLibraryClasspathContainer ( userLibName ) ; JavaCore . setClasspathContainer ( containerPath , new IJavaProject [ ] { project } , new IClasspathContainer [ ] { container } , null ) ; } else if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_no_user_library_found ( project , userLibName ) ; } } else if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_not_a_user_library ( project , containerPath ) ; } } private boolean isUserLibraryContainer ( IPath path ) { return path != null && path . segmentCount ( ) == <NUM_LIT:2> && JavaCore . USER_LIBRARY_CONTAINER_ID . equals ( path . segment ( <NUM_LIT:0> ) ) ; } public void requestClasspathContainerUpdate ( IPath containerPath , IJavaProject project , IClasspathContainer containerSuggestion ) throws CoreException { if ( isUserLibraryContainer ( containerPath ) ) { String name = containerPath . segment ( <NUM_LIT:1> ) ; if ( containerSuggestion != null ) { JavaModelManager . getUserLibraryManager ( ) . setUserLibrary ( name , containerSuggestion . getClasspathEntries ( ) , containerSuggestion . getKind ( ) == IClasspathContainer . K_SYSTEM ) ; } else { JavaModelManager . getUserLibraryManager ( ) . removeUserLibrary ( name ) ; } } } private void verbose_no_user_library_found ( IJavaProject project , String userLibraryName ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + userLibraryName ) ; } private void verbose_not_a_user_library ( IJavaProject project , IPath containerPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . LRUCache ; public class ElementCache extends OverflowingLRUCache { IJavaElement spaceLimitParent = null ; public ElementCache ( int size ) { super ( size ) ; } public ElementCache ( int size , int overflow ) { super ( size , overflow ) ; } protected boolean close ( LRUCacheEntry entry ) { Openable element = ( Openable ) entry . key ; try { if ( ! element . canBeRemovedFromCache ( ) ) { return false ; } else { element . close ( ) ; return true ; } } catch ( JavaModelException npe ) { return false ; } } protected void ensureSpaceLimit ( Object info , IJavaElement parent ) { int childrenSize = ( ( JavaElementInfo ) info ) . getChildren ( ) . length ; int spaceNeeded = <NUM_LIT:1> + ( int ) ( ( <NUM_LIT:1> + this . loadFactor ) * ( childrenSize + this . overflow ) ) ; if ( this . spaceLimit < spaceNeeded ) { shrink ( ) ; setSpaceLimit ( spaceNeeded ) ; this . spaceLimitParent = parent ; } } protected LRUCache newInstance ( int size , int newOverflow ) { return new ElementCache ( size , newOverflow ) ; } protected void resetSpaceLimit ( int defaultLimit , IJavaElement parent ) { if ( parent . equals ( this . spaceLimitParent ) ) { setSpaceLimit ( defaultLimit ) ; this . spaceLimitParent = null ; } } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . ISourceRange ; import org . eclipse . jdt . core . SourceRange ; public class CompilationUnitElementInfo extends OpenableElementInfo { protected int sourceLength ; protected long timestamp ; public int annotationNumber = <NUM_LIT:0> ; public int getSourceLength ( ) { return this . sourceLength ; } protected ISourceRange getSourceRange ( ) { return new SourceRange ( <NUM_LIT:0> , this . sourceLength ) ; } public void setSourceLength ( int newSourceLength ) { this . sourceLength = newSourceLength ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . ArrayList ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . JavaConventions ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class CreatePackageFragmentOperation extends JavaModelOperation { protected String [ ] pkgName ; public CreatePackageFragmentOperation ( IPackageFragmentRoot parentElement , String packageName , boolean force ) { super ( null , new IJavaElement [ ] { parentElement } , force ) ; this . pkgName = packageName == null ? null : Util . getTrimmedSimpleNames ( packageName ) ; } protected void executeOperation ( ) throws JavaModelException { try { JavaElementDelta delta = null ; PackageFragmentRoot root = ( PackageFragmentRoot ) getParentElement ( ) ; beginTask ( Messages . operation_createPackageFragmentProgress , this . pkgName . length ) ; IContainer parentFolder = ( IContainer ) root . resource ( ) ; String [ ] sideEffectPackageName = CharOperation . NO_STRINGS ; ArrayList results = new ArrayList ( this . pkgName . length ) ; char [ ] [ ] inclusionPatterns = root . fullInclusionPatternChars ( ) ; char [ ] [ ] exclusionPatterns = root . fullExclusionPatternChars ( ) ; int i ; for ( i = <NUM_LIT:0> ; i < this . pkgName . length ; i ++ ) { String subFolderName = this . pkgName [ i ] ; sideEffectPackageName = Util . arrayConcat ( sideEffectPackageName , subFolderName ) ; IResource subFolder = parentFolder . findMember ( subFolderName ) ; if ( subFolder == null ) { createFolder ( parentFolder , subFolderName , this . force ) ; parentFolder = parentFolder . getFolder ( new Path ( subFolderName ) ) ; IPackageFragment addedFrag = root . getPackageFragment ( sideEffectPackageName ) ; if ( ! Util . isExcluded ( parentFolder , inclusionPatterns , exclusionPatterns ) ) { if ( delta == null ) { delta = newJavaElementDelta ( ) ; } delta . added ( addedFrag ) ; } results . add ( addedFrag ) ; } else { parentFolder = ( IContainer ) subFolder ; } worked ( <NUM_LIT:1> ) ; } if ( results . size ( ) > <NUM_LIT:0> ) { this . resultElements = new IJavaElement [ results . size ( ) ] ; results . toArray ( this . resultElements ) ; if ( delta != null ) { addDelta ( delta ) ; } } } finally { done ( ) ; } } protected ISchedulingRule getSchedulingRule ( ) { if ( this . pkgName . length == <NUM_LIT:0> ) return null ; IResource parentResource = ( ( JavaElement ) getParentElement ( ) ) . resource ( ) ; IResource resource = ( ( IContainer ) parentResource ) . getFolder ( new Path ( this . pkgName [ <NUM_LIT:0> ] ) ) ; return resource . getWorkspace ( ) . getRuleFactory ( ) . createRule ( resource ) ; } public IJavaModelStatus verify ( ) { IJavaElement parentElement = getParentElement ( ) ; if ( parentElement == null ) { return new JavaModelStatus ( IJavaModelStatusConstants . NO_ELEMENTS_TO_PROCESS ) ; } String packageName = this . pkgName == null ? null : Util . concatWith ( this . pkgName , '<CHAR_LIT:.>' ) ; IJavaProject project = parentElement . getJavaProject ( ) ; if ( this . pkgName == null || ( this . pkgName . length > <NUM_LIT:0> && JavaConventions . validatePackageName ( packageName , project . getOption ( JavaCore . COMPILER_SOURCE , true ) , project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ) . getSeverity ( ) == IStatus . ERROR ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_NAME , packageName ) ; } IJavaElement root = getParentElement ( ) ; if ( root . isReadOnly ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . READ_ONLY , root ) ; } IContainer parentFolder = ( IContainer ) ( ( JavaElement ) root ) . resource ( ) ; int i ; for ( i = <NUM_LIT:0> ; i < this . pkgName . length ; i ++ ) { IResource subFolder = parentFolder . findMember ( this . pkgName [ i ] ) ; if ( subFolder != null ) { if ( subFolder . getType ( ) != IResource . FOLDER ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , subFolder . getFullPath ( ) . toString ( ) ) ) ; } parentFolder = ( IContainer ) subFolder ; } } return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . text . NumberFormat ; import java . util . Date ; public class VerboseElementCache extends ElementCache { private Object beingAdded ; private String name ; public VerboseElementCache ( int size , String name ) { super ( size ) ; this . name = name ; } protected boolean makeSpace ( int space ) { if ( this . beingAdded == null ) return super . makeSpace ( space ) ; String fillingRatio = toStringFillingRation ( this . name ) ; boolean result = super . makeSpace ( space ) ; String newFillingRatio = toStringFillingRation ( this . name ) ; if ( ! fillingRatio . equals ( newFillingRatio ) ) { System . out . println ( Thread . currentThread ( ) + "<STR_LIT:U+0020>" + new Date ( System . currentTimeMillis ( ) ) . toString ( ) ) ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + fillingRatio + "<STR_LIT>" + NumberFormat . getInstance ( ) . format ( fillingRatio ( ) ) + "<STR_LIT>" ) ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + ( ( JavaElement ) this . beingAdded ) . toStringWithAncestors ( ) ) ; System . out . println ( ) ; } return result ; } public Object put ( Object key , Object value ) { try { if ( this . beingAdded == null ) this . beingAdded = key ; return super . put ( key , value ) ; } finally { if ( key . equals ( this . beingAdded ) ) this . beingAdded = null ; } } } </s>
<s> package org . eclipse . jdt . internal . core ; public class SourceConstructorInfo extends SourceMethodElementInfo { private static final char [ ] RETURN_TYPE_NAME = new char [ ] { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' } ; public boolean isAnnotationMethod ( ) { return false ; } public boolean isConstructor ( ) { return true ; } public char [ ] getReturnTypeName ( ) { return RETURN_TYPE_NAME ; } protected void setReturnType ( char [ ] type ) { } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; public class SourceField extends NamedMember implements IField { protected SourceField ( JavaElement parent , String name ) { super ( parent , name ) ; } public boolean equals ( Object o ) { if ( ! ( o instanceof SourceField ) ) return false ; return super . equals ( o ) ; } public ASTNode findNode ( org . eclipse . jdt . core . dom . CompilationUnit ast ) { ASTNode node = super . findNode ( ast ) ; if ( node == null ) return null ; if ( node . getNodeType ( ) == ASTNode . ENUM_CONSTANT_DECLARATION ) { return node ; } return node . getParent ( ) ; } public Object getConstant ( ) throws JavaModelException { Object constant = null ; SourceFieldElementInfo info = ( SourceFieldElementInfo ) getElementInfo ( ) ; final char [ ] constantSourceChars = info . initializationSource ; if ( constantSourceChars == null ) { return null ; } String constantSource = new String ( constantSourceChars ) ; String signature = info . getTypeSignature ( ) ; try { if ( signature . equals ( Signature . SIG_INT ) ) { constant = new Integer ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_SHORT ) ) { constant = new Short ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_BYTE ) ) { constant = new Byte ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_BOOLEAN ) ) { constant = Boolean . valueOf ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_CHAR ) ) { if ( constantSourceChars . length != <NUM_LIT:3> ) { return null ; } constant = new Character ( constantSourceChars [ <NUM_LIT:1> ] ) ; } else if ( signature . equals ( Signature . SIG_DOUBLE ) ) { constant = new Double ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_FLOAT ) ) { constant = new Float ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_LONG ) ) { if ( constantSource . endsWith ( "<STR_LIT>" ) || constantSource . endsWith ( "<STR_LIT>" ) ) { int index = constantSource . lastIndexOf ( "<STR_LIT>" ) ; if ( index != - <NUM_LIT:1> ) { constant = new Long ( constantSource . substring ( <NUM_LIT:0> , index ) ) ; } else { constant = new Long ( constantSource . substring ( <NUM_LIT:0> , constantSource . lastIndexOf ( "<STR_LIT>" ) ) ) ; } } else { constant = new Long ( constantSource ) ; } } else if ( signature . equals ( "<STR_LIT>" ) ) { constant = constantSource ; } else if ( signature . equals ( "<STR_LIT>" ) ) { constant = constantSource ; } } catch ( NumberFormatException e ) { return null ; } return constant ; } public int getElementType ( ) { return FIELD ; } public String getKey ( ) { try { return getKey ( this , false ) ; } catch ( JavaModelException e ) { return null ; } } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_FIELD ; } public IJavaElement getPrimaryElement ( boolean checkOwner ) { if ( checkOwner ) { CompilationUnit cu = ( CompilationUnit ) getAncestor ( COMPILATION_UNIT ) ; if ( cu . isPrimary ( ) ) return this ; } IJavaElement primaryParent = this . parent . getPrimaryElement ( false ) ; return ( ( IType ) primaryParent ) . getField ( this . name ) ; } public String getTypeSignature ( ) throws JavaModelException { SourceFieldElementInfo info = ( SourceFieldElementInfo ) getElementInfo ( ) ; return info . getTypeSignature ( ) ; } public boolean isEnumConstant ( ) throws JavaModelException { return Flags . isEnum ( getFlags ( ) ) ; } public boolean isResolved ( ) { return false ; } public JavaElement resolved ( Binding binding ) { SourceRefElement resolvedHandle = new ResolvedSourceField ( this . parent , this . name , new String ( binding . computeUniqueKey ( ) ) ) ; resolvedHandle . occurrenceCount = this . occurrenceCount ; return resolvedHandle ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; if ( info == null ) { toStringName ( buffer ) ; buffer . append ( "<STR_LIT>" ) ; } else if ( info == NO_INFO ) { toStringName ( buffer ) ; } else { try { buffer . append ( Signature . toString ( getTypeSignature ( ) ) ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; toStringName ( buffer ) ; } catch ( JavaModelException e ) { buffer . append ( "<STR_LIT>" + getElementName ( ) ) ; } } } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . io . Writer ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . internal . compiler . util . GenericXMLWriter ; import org . eclipse . jdt . internal . core . util . Util ; class XMLWriter extends GenericXMLWriter { public XMLWriter ( Writer writer , IJavaProject project , boolean printXmlVersion ) { super ( writer , Util . getLineSeparator ( ( String ) null , project ) , printXmlVersion ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IBuffer ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . Document ; public class DocumentAdapter extends Document { private IBuffer buffer ; public DocumentAdapter ( IBuffer buffer ) { super ( buffer . getContents ( ) ) ; this . buffer = buffer ; } public void set ( String text ) { super . set ( text ) ; this . buffer . setContents ( text ) ; } public void replace ( int offset , int length , String text ) throws BadLocationException { super . replace ( offset , length , text ) ; this . buffer . replace ( offset , length , text ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; public class CancelableProblemFactory extends DefaultProblemFactory { public IProgressMonitor monitor ; public CancelableProblemFactory ( IProgressMonitor monitor ) { super ( ) ; this . monitor = monitor ; } public CategorizedProblem createProblem ( char [ ] originatingFileName , int problemId , String [ ] problemArguments , String [ ] messageArguments , int severity , int startPosition , int endPosition , int lineNumber , int columnNumber ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; return super . createProblem ( originatingFileName , problemId , problemArguments , messageArguments , severity , startPosition , endPosition , lineNumber , columnNumber ) ; } public CategorizedProblem createProblem ( char [ ] originatingFileName , int problemId , String [ ] problemArguments , int elaborationId , String [ ] messageArguments , int severity , int startPosition , int endPosition , int lineNumber , int columnNumber ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; return super . createProblem ( originatingFileName , problemId , problemArguments , elaborationId , messageArguments , severity , startPosition , endPosition , lineNumber , columnNumber ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . JavaModelException ; public class ResolvedBinaryType extends BinaryType { private String uniqueKey ; public ResolvedBinaryType ( JavaElement parent , String name , String uniqueKey ) { super ( parent , name ) ; this . uniqueKey = uniqueKey ; } public String getFullyQualifiedParameterizedName ( ) throws JavaModelException { return getFullyQualifiedParameterizedName ( getFullyQualifiedName ( '<CHAR_LIT:.>' ) , this . uniqueKey ) ; } public String getKey ( ) { return this . uniqueKey ; } public boolean isResolved ( ) { return true ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { super . toStringInfo ( tab , buffer , info , showResolvedInfo ) ; if ( showResolvedInfo ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . uniqueKey ) ; buffer . append ( "<STR_LIT:}>" ) ; } } public JavaElement unresolved ( ) { SourceRefElement handle = new BinaryType ( this . parent , this . name ) ; handle . occurrenceCount = this . occurrenceCount ; return handle ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . core . util . Messages ; public class MoveResourceElementsOperation extends CopyResourceElementsOperation { public MoveResourceElementsOperation ( IJavaElement [ ] elementsToMove , IJavaElement [ ] destContainers , boolean force ) { super ( elementsToMove , destContainers , force ) ; } protected String getMainTaskName ( ) { return Messages . operation_moveResourceProgress ; } protected boolean isMove ( ) { return true ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . Iterator ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IField ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . FieldDeclaration ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . VariableDeclarationFragment ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . internal . core . util . Messages ; public class CreateFieldOperation extends CreateTypeMemberOperation { public CreateFieldOperation ( IType parentElement , String source , boolean force ) { super ( parentElement , source , force ) ; } protected ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException { ASTNode node = super . generateElementAST ( rewriter , cu ) ; if ( node . getNodeType ( ) != ASTNode . FIELD_DECLARATION ) throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CONTENTS ) ) ; return node ; } protected IJavaElement generateResultHandle ( ) { return getType ( ) . getField ( getASTNodeName ( ) ) ; } public String getMainTaskName ( ) { return Messages . operation_createFieldProgress ; } private VariableDeclarationFragment getFragment ( ASTNode node ) { Iterator fragments = ( ( FieldDeclaration ) node ) . fragments ( ) . iterator ( ) ; if ( this . anchorElement != null ) { VariableDeclarationFragment fragment = null ; String fragmentName = this . anchorElement . getElementName ( ) ; while ( fragments . hasNext ( ) ) { fragment = ( VariableDeclarationFragment ) fragments . next ( ) ; if ( fragment . getName ( ) . getIdentifier ( ) . equals ( fragmentName ) ) { return fragment ; } } return fragment ; } else { return ( VariableDeclarationFragment ) fragments . next ( ) ; } } protected void initializeDefaultPosition ( ) { IType parentElement = getType ( ) ; try { IField [ ] fields = parentElement . getFields ( ) ; if ( fields != null && fields . length > <NUM_LIT:0> ) { final IField lastField = fields [ fields . length - <NUM_LIT:1> ] ; if ( parentElement . isEnum ( ) ) { IField field = lastField ; if ( ! field . isEnumConstant ( ) ) { createAfter ( lastField ) ; } } else { createAfter ( lastField ) ; } } else { IJavaElement [ ] elements = parentElement . getChildren ( ) ; if ( elements != null && elements . length > <NUM_LIT:0> ) { createBefore ( elements [ <NUM_LIT:0> ] ) ; } } } catch ( JavaModelException e ) { } } protected IJavaModelStatus verifyNameCollision ( ) { if ( this . createdNode != null ) { IType type = getType ( ) ; String fieldName = getASTNodeName ( ) ; if ( type . getField ( fieldName ) . exists ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , fieldName ) ) ; } } return JavaModelStatus . VERIFIED_OK ; } private String getASTNodeName ( ) { if ( this . alteredName != null ) return this . alteredName ; return getFragment ( this . createdNode ) . getName ( ) . getIdentifier ( ) ; } protected SimpleName rename ( ASTNode node , SimpleName newName ) { VariableDeclarationFragment fragment = getFragment ( node ) ; SimpleName oldName = fragment . getName ( ) ; fragment . setName ( newName ) ; return oldName ; } } </s>
<s> package org . eclipse . jdt . internal . core ; public interface INamingRequestor { void acceptNameWithPrefixAndSuffix ( char [ ] name , boolean isFirstPrefix , boolean isFirstSuffix , int reusedCharacters ) ; void acceptNameWithPrefix ( char [ ] name , boolean isFirstPrefix , int reusedCharacters ) ; void acceptNameWithSuffix ( char [ ] name , boolean isFirstSuffix , int reusedCharacters ) ; void acceptNameWithoutPrefixAndSuffix ( char [ ] name , int reusedCharacters ) ; } </s>
<s> package org . eclipse . jdt . internal . core ; import java . io . File ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Map ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; public class JavaModel extends Openable implements IJavaModel { public static HashSet existingExternalFiles = new HashSet ( ) ; public static HashSet existingExternalConfirmedFiles = new HashSet ( ) ; protected JavaModel ( ) throws Error { super ( null ) ; } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) { IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; int length = projects . length ; IJavaElement [ ] children = new IJavaElement [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IProject project = projects [ i ] ; if ( JavaProject . hasJavaNature ( project ) ) { children [ index ++ ] = getJavaProject ( project ) ; } } if ( index < length ) System . arraycopy ( children , <NUM_LIT:0> , children = new IJavaElement [ index ] , <NUM_LIT:0> , index ) ; info . setChildren ( children ) ; newElements . put ( this , info ) ; return true ; } public boolean contains ( IResource resource ) { switch ( resource . getType ( ) ) { case IResource . ROOT : case IResource . PROJECT : return true ; } IJavaProject [ ] projects ; try { projects = getJavaProjects ( ) ; } catch ( JavaModelException e ) { return false ; } for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { JavaProject project = ( JavaProject ) projects [ i ] ; if ( ! project . contains ( resource ) ) { return false ; } } return true ; } public void copy ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { runOperation ( new CopyResourceElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } else { runOperation ( new CopyElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } } protected Object createElementInfo ( ) { return new JavaModelInfo ( ) ; } public void delete ( IJavaElement [ ] elements , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { new DeleteResourceElementsOperation ( elements , force ) . runOperation ( monitor ) ; } else { new DeleteElementsOperation ( elements , force ) . runOperation ( monitor ) ; } } public boolean equals ( Object o ) { if ( ! ( o instanceof JavaModel ) ) return false ; return super . equals ( o ) ; } public int getElementType ( ) { return JAVA_MODEL ; } public static void flushExternalFileCache ( ) { existingExternalFiles = new HashSet ( ) ; existingExternalConfirmedFiles = new HashSet ( ) ; } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_JAVAPROJECT : if ( ! memento . hasMoreTokens ( ) ) return this ; String projectName = memento . nextToken ( ) ; JavaElement project = ( JavaElement ) getJavaProject ( projectName ) ; return project . getHandleFromMemento ( memento , owner ) ; } return null ; } protected void getHandleMemento ( StringBuffer buff ) { buff . append ( getElementName ( ) ) ; } protected char getHandleMementoDelimiter ( ) { Assert . isTrue ( false , "<STR_LIT>" ) ; return <NUM_LIT:0> ; } public IJavaProject getJavaProject ( String projectName ) { return new JavaProject ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( projectName ) , this ) ; } public IJavaProject getJavaProject ( IResource resource ) { switch ( resource . getType ( ) ) { case IResource . FOLDER : return new JavaProject ( ( ( IFolder ) resource ) . getProject ( ) , this ) ; case IResource . FILE : return new JavaProject ( ( ( IFile ) resource ) . getProject ( ) , this ) ; case IResource . PROJECT : return new JavaProject ( ( IProject ) resource , this ) ; default : throw new IllegalArgumentException ( Messages . element_invalidResourceForProject ) ; } } public IJavaProject [ ] getJavaProjects ( ) throws JavaModelException { ArrayList list = getChildrenOfType ( JAVA_PROJECT ) ; IJavaProject [ ] array = new IJavaProject [ list . size ( ) ] ; list . toArray ( array ) ; return array ; } public Object [ ] getNonJavaResources ( ) throws JavaModelException { return ( ( JavaModelInfo ) getElementInfo ( ) ) . getNonJavaResources ( ) ; } public IPath getPath ( ) { return Path . ROOT ; } public IResource resource ( PackageFragmentRoot root ) { return ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; } public IResource getUnderlyingResource ( ) { return null ; } public IWorkspace getWorkspace ( ) { return ResourcesPlugin . getWorkspace ( ) ; } public void move ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { runOperation ( new MoveResourceElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } else { runOperation ( new MoveElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } } public void refreshExternalArchives ( IJavaElement [ ] elementsScope , IProgressMonitor monitor ) throws JavaModelException { if ( elementsScope == null ) { elementsScope = new IJavaElement [ ] { this } ; } JavaModelManager . getJavaModelManager ( ) . getDeltaProcessor ( ) . checkExternalArchiveChanges ( elementsScope , monitor ) ; } public void rename ( IJavaElement [ ] elements , IJavaElement [ ] destinations , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { MultiOperation op ; if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { op = new RenameResourceElementsOperation ( elements , destinations , renamings , force ) ; } else { op = new RenameElementsOperation ( elements , destinations , renamings , force ) ; } op . runOperation ( monitor ) ; } protected void runOperation ( MultiOperation op , IJavaElement [ ] elements , IJavaElement [ ] siblings , String [ ] renamings , IProgressMonitor monitor ) throws JavaModelException { op . setRenamings ( renamings ) ; if ( siblings != null ) { for ( int i = <NUM_LIT:0> ; i < elements . length ; i ++ ) { op . setInsertBefore ( elements [ i ] , siblings [ i ] ) ; } } op . runOperation ( monitor ) ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( info == null ) { buffer . append ( "<STR_LIT>" ) ; } } public static Object getTarget ( IPath path , boolean checkResourceExistence ) { Object target = getWorkspaceTarget ( path ) ; if ( target != null ) return target ; return getExternalTarget ( path , checkResourceExistence ) ; } public static IResource getWorkspaceTarget ( IPath path ) { if ( path == null || path . getDevice ( ) != null ) return null ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace == null ) return null ; return workspace . getRoot ( ) . findMember ( path ) ; } public static Object getExternalTarget ( IPath path , boolean checkResourceExistence ) { if ( path == null ) return null ; ExternalFoldersManager externalFoldersManager = JavaModelManager . getExternalManager ( ) ; Object linkedFolder = externalFoldersManager . getFolder ( path ) ; if ( linkedFolder != null ) { if ( checkResourceExistence ) { File externalFile = new File ( path . toOSString ( ) ) ; if ( ! externalFile . isDirectory ( ) ) { return null ; } } return linkedFolder ; } File externalFile = new File ( path . toOSString ( ) ) ; if ( ! checkResourceExistence ) { return externalFile ; } else if ( existingExternalFilesContains ( externalFile ) ) { return externalFile ; } else { if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + path . toString ( ) ) ; } if ( externalFile . isFile ( ) ) { existingExternalFilesAdd ( externalFile ) ; return externalFile ; } } return null ; } private synchronized static void existingExternalFilesAdd ( File externalFile ) { existingExternalFiles . add ( externalFile ) ; } private synchronized static boolean existingExternalFilesContains ( File externalFile ) { return existingExternalFiles . contains ( externalFile ) ; } public static boolean isFile ( Object target ) { return getFile ( target ) != null ; } public static synchronized File getFile ( Object target ) { if ( existingExternalConfirmedFiles . contains ( target ) ) return ( File ) target ; if ( target instanceof File ) { File f = ( File ) target ; if ( f . isFile ( ) ) { existingExternalConfirmedFiles . add ( f ) ; return f ; } } return null ; } protected IStatus validateExistence ( IResource underlyingResource ) { return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . internal . core . util . Messages ; public class CreateInitializerOperation extends CreateTypeMemberOperation { protected int numberOfInitializers = <NUM_LIT:1> ; public CreateInitializerOperation ( IType parentElement , String source ) { super ( parentElement , source , false ) ; } protected ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException { ASTNode node = super . generateElementAST ( rewriter , cu ) ; if ( node . getNodeType ( ) != ASTNode . INITIALIZER ) throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CONTENTS ) ) ; return node ; } protected IJavaElement generateResultHandle ( ) { try { getType ( ) . getCompilationUnit ( ) . close ( ) ; if ( this . anchorElement == null ) { return getType ( ) . getInitializer ( this . numberOfInitializers ) ; } else { IJavaElement [ ] children = getType ( ) . getChildren ( ) ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { IJavaElement child = children [ i ] ; if ( child . equals ( this . anchorElement ) ) { if ( child . getElementType ( ) == IJavaElement . INITIALIZER && this . insertionPolicy == CreateElementInCUOperation . INSERT_AFTER ) { count ++ ; } return getType ( ) . getInitializer ( count ) ; } else if ( child . getElementType ( ) == IJavaElement . INITIALIZER ) { count ++ ; } } } } catch ( JavaModelException e ) { } return null ; } public String getMainTaskName ( ) { return Messages . operation_createInitializerProgress ; } protected SimpleName rename ( ASTNode node , SimpleName newName ) { return null ; } protected void initializeDefaultPosition ( ) { IType parentElement = getType ( ) ; try { IJavaElement [ ] elements = parentElement . getInitializers ( ) ; if ( elements != null && elements . length > <NUM_LIT:0> ) { this . numberOfInitializers = elements . length ; createAfter ( elements [ elements . length - <NUM_LIT:1> ] ) ; } else { elements = parentElement . getChildren ( ) ; if ( elements != null && elements . length > <NUM_LIT:0> ) { createBefore ( elements [ <NUM_LIT:0> ] ) ; } } } catch ( JavaModelException e ) { } } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . Map ; import java . util . Set ; import org . eclipse . jdt . core . IAnnotation ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . IParent ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . util . Util ; public class JavaElementDeltaBuilder { IJavaElement javaElement ; int maxDepth = Integer . MAX_VALUE ; Map infos ; Map annotationInfos ; Map oldPositions ; Map newPositions ; public JavaElementDelta delta = null ; HashSet added ; HashSet removed ; static class ListItem { public IJavaElement previous ; public IJavaElement next ; public ListItem ( IJavaElement previous , IJavaElement next ) { this . previous = previous ; this . next = next ; } } public JavaElementDeltaBuilder ( IJavaElement javaElement ) { this . javaElement = javaElement ; initialize ( ) ; recordElementInfo ( javaElement , ( JavaModel ) this . javaElement . getJavaModel ( ) , <NUM_LIT:0> ) ; } public JavaElementDeltaBuilder ( IJavaElement javaElement , int maxDepth ) { this . javaElement = javaElement ; this . maxDepth = maxDepth ; initialize ( ) ; recordElementInfo ( javaElement , ( JavaModel ) this . javaElement . getJavaModel ( ) , <NUM_LIT:0> ) ; } private void added ( IJavaElement element ) { this . added . add ( element ) ; ListItem current = getNewPosition ( element ) ; ListItem previous = null , next = null ; if ( current . previous != null ) previous = getNewPosition ( current . previous ) ; if ( current . next != null ) next = getNewPosition ( current . next ) ; if ( previous != null ) previous . next = current . next ; if ( next != null ) next . previous = current . previous ; } public void buildDeltas ( ) { this . delta = new JavaElementDelta ( this . javaElement ) ; if ( this . javaElement . getElementType ( ) >= IJavaElement . COMPILATION_UNIT ) { this . delta . fineGrained ( ) ; } recordNewPositions ( this . javaElement , <NUM_LIT:0> ) ; findAdditions ( this . javaElement , <NUM_LIT:0> ) ; findDeletions ( ) ; findChangesInPositioning ( this . javaElement , <NUM_LIT:0> ) ; trimDelta ( this . delta ) ; if ( this . delta . getAffectedChildren ( ) . length == <NUM_LIT:0> ) { this . delta . contentChanged ( ) ; } } private boolean equals ( char [ ] [ ] [ ] first , char [ ] [ ] [ ] second ) { if ( first == second ) return true ; if ( first == null || second == null ) return false ; if ( first . length != second . length ) return false ; for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( ! CharOperation . equals ( first [ i ] , second [ i ] ) ) return false ; return true ; } private void findAdditions ( IJavaElement newElement , int depth ) { JavaElementInfo oldInfo = getElementInfo ( newElement ) ; if ( oldInfo == null && depth < this . maxDepth ) { this . delta . added ( newElement ) ; added ( newElement ) ; } else { removeElementInfo ( newElement ) ; } if ( depth >= this . maxDepth ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; return ; } JavaElementInfo newInfo = null ; try { newInfo = ( JavaElementInfo ) ( ( JavaElement ) newElement ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } findContentChange ( oldInfo , newInfo , newElement ) ; if ( oldInfo != null && newElement instanceof IParent ) { IJavaElement [ ] children = newInfo . getChildren ( ) ; if ( children != null ) { int length = children . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { findAdditions ( children [ i ] , depth + <NUM_LIT:1> ) ; } } } } private void findChangesInPositioning ( IJavaElement element , int depth ) { if ( depth >= this . maxDepth || this . added . contains ( element ) || this . removed . contains ( element ) ) return ; if ( ! isPositionedCorrectly ( element ) ) { this . delta . changed ( element , IJavaElementDelta . F_REORDER ) ; } if ( element instanceof IParent ) { JavaElementInfo info = null ; try { info = ( JavaElementInfo ) ( ( JavaElement ) element ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } IJavaElement [ ] children = info . getChildren ( ) ; if ( children != null ) { int length = children . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { findChangesInPositioning ( children [ i ] , depth + <NUM_LIT:1> ) ; } } } } private void findAnnotationChanges ( IAnnotation [ ] oldAnnotations , IAnnotation [ ] newAnnotations , IJavaElement parent ) { ArrayList annotationDeltas = null ; for ( int i = <NUM_LIT:0> , length = newAnnotations . length ; i < length ; i ++ ) { IAnnotation newAnnotation = newAnnotations [ i ] ; Object oldInfo = this . annotationInfos . remove ( newAnnotation ) ; if ( oldInfo == null ) { JavaElementDelta annotationDelta = new JavaElementDelta ( newAnnotation ) ; annotationDelta . added ( ) ; if ( annotationDeltas == null ) annotationDeltas = new ArrayList ( ) ; annotationDeltas . add ( annotationDelta ) ; continue ; } else { AnnotationInfo newInfo = null ; try { newInfo = ( AnnotationInfo ) ( ( JavaElement ) newAnnotation ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } if ( ! Util . equalArraysOrNull ( ( ( AnnotationInfo ) oldInfo ) . members , newInfo . members ) ) { JavaElementDelta annotationDelta = new JavaElementDelta ( newAnnotation ) ; annotationDelta . changed ( IJavaElementDelta . F_CONTENT ) ; if ( annotationDeltas == null ) annotationDeltas = new ArrayList ( ) ; annotationDeltas . add ( annotationDelta ) ; } } } for ( int i = <NUM_LIT:0> , length = oldAnnotations . length ; i < length ; i ++ ) { IAnnotation oldAnnotation = oldAnnotations [ i ] ; if ( this . annotationInfos . remove ( oldAnnotation ) != null ) { JavaElementDelta annotationDelta = new JavaElementDelta ( oldAnnotation ) ; annotationDelta . removed ( ) ; if ( annotationDeltas == null ) annotationDeltas = new ArrayList ( ) ; annotationDeltas . add ( annotationDelta ) ; } } if ( annotationDeltas == null ) return ; int size = annotationDeltas . size ( ) ; if ( size > <NUM_LIT:0> ) { JavaElementDelta parentDelta = this . delta . changed ( parent , IJavaElementDelta . F_ANNOTATIONS ) ; parentDelta . annotationDeltas = ( IJavaElementDelta [ ] ) annotationDeltas . toArray ( new IJavaElementDelta [ size ] ) ; } } private void findContentChange ( JavaElementInfo oldInfo , JavaElementInfo newInfo , IJavaElement newElement ) { if ( oldInfo instanceof MemberElementInfo && newInfo instanceof MemberElementInfo ) { if ( ( ( MemberElementInfo ) oldInfo ) . getModifiers ( ) != ( ( MemberElementInfo ) newInfo ) . getModifiers ( ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_MODIFIERS ) ; } if ( oldInfo instanceof AnnotatableInfo && newInfo instanceof AnnotatableInfo ) { findAnnotationChanges ( ( ( AnnotatableInfo ) oldInfo ) . annotations , ( ( AnnotatableInfo ) newInfo ) . annotations , newElement ) ; } if ( oldInfo instanceof SourceMethodElementInfo && newInfo instanceof SourceMethodElementInfo ) { SourceMethodElementInfo oldSourceMethodInfo = ( SourceMethodElementInfo ) oldInfo ; SourceMethodElementInfo newSourceMethodInfo = ( SourceMethodElementInfo ) newInfo ; if ( ! CharOperation . equals ( oldSourceMethodInfo . getReturnTypeName ( ) , newSourceMethodInfo . getReturnTypeName ( ) ) || ! CharOperation . equals ( oldSourceMethodInfo . getTypeParameterNames ( ) , newSourceMethodInfo . getTypeParameterNames ( ) ) || ! equals ( oldSourceMethodInfo . getTypeParameterBounds ( ) , newSourceMethodInfo . getTypeParameterBounds ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; } } else if ( oldInfo instanceof SourceFieldElementInfo && newInfo instanceof SourceFieldElementInfo ) { if ( ! CharOperation . equals ( ( ( SourceFieldElementInfo ) oldInfo ) . getTypeName ( ) , ( ( SourceFieldElementInfo ) newInfo ) . getTypeName ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; } } else if ( oldInfo instanceof SourceTypeElementInfo && newInfo instanceof SourceTypeElementInfo ) { SourceTypeElementInfo oldSourceTypeInfo = ( SourceTypeElementInfo ) oldInfo ; SourceTypeElementInfo newSourceTypeInfo = ( SourceTypeElementInfo ) newInfo ; if ( ! CharOperation . equals ( oldSourceTypeInfo . getSuperclassName ( ) , newSourceTypeInfo . getSuperclassName ( ) ) || ! CharOperation . equals ( oldSourceTypeInfo . getInterfaceNames ( ) , newSourceTypeInfo . getInterfaceNames ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_SUPER_TYPES ) ; } if ( ! CharOperation . equals ( oldSourceTypeInfo . getTypeParameterNames ( ) , newSourceTypeInfo . getTypeParameterNames ( ) ) || ! equals ( oldSourceTypeInfo . getTypeParameterBounds ( ) , newSourceTypeInfo . getTypeParameterBounds ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; } HashMap oldTypeCategories = oldSourceTypeInfo . categories ; HashMap newTypeCategories = newSourceTypeInfo . categories ; if ( oldTypeCategories != null ) { Set elements ; if ( newTypeCategories != null ) { elements = new HashSet ( oldTypeCategories . keySet ( ) ) ; elements . addAll ( newTypeCategories . keySet ( ) ) ; } else elements = oldTypeCategories . keySet ( ) ; Iterator iterator = elements . iterator ( ) ; while ( iterator . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) iterator . next ( ) ; String [ ] oldCategories = ( String [ ] ) oldTypeCategories . get ( element ) ; String [ ] newCategories = newTypeCategories == null ? null : ( String [ ] ) newTypeCategories . get ( element ) ; if ( ! Util . equalArraysOrNull ( oldCategories , newCategories ) ) { this . delta . changed ( element , IJavaElementDelta . F_CATEGORIES ) ; } } } else if ( newTypeCategories != null ) { Iterator elements = newTypeCategories . keySet ( ) . iterator ( ) ; while ( elements . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) elements . next ( ) ; this . delta . changed ( element , IJavaElementDelta . F_CATEGORIES ) ; } } } } } private void findDeletions ( ) { Iterator iter = this . infos . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) iter . next ( ) ; this . delta . removed ( element ) ; removed ( element ) ; } } private JavaElementInfo getElementInfo ( IJavaElement element ) { return ( JavaElementInfo ) this . infos . get ( element ) ; } private ListItem getNewPosition ( IJavaElement element ) { return ( ListItem ) this . newPositions . get ( element ) ; } private ListItem getOldPosition ( IJavaElement element ) { return ( ListItem ) this . oldPositions . get ( element ) ; } private void initialize ( ) { this . infos = new HashMap ( <NUM_LIT:20> ) ; this . oldPositions = new HashMap ( <NUM_LIT:20> ) ; this . newPositions = new HashMap ( <NUM_LIT:20> ) ; this . oldPositions . put ( this . javaElement , new ListItem ( null , null ) ) ; this . newPositions . put ( this . javaElement , new ListItem ( null , null ) ) ; this . added = new HashSet ( <NUM_LIT:5> ) ; this . removed = new HashSet ( <NUM_LIT:5> ) ; } private void insertPositions ( IJavaElement [ ] elements , boolean isNew ) { int length = elements . length ; IJavaElement previous = null , current = null , next = ( length > <NUM_LIT:0> ) ? elements [ <NUM_LIT:0> ] : null ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { previous = current ; current = next ; next = ( i + <NUM_LIT:1> < length ) ? elements [ i + <NUM_LIT:1> ] : null ; if ( isNew ) { this . newPositions . put ( current , new ListItem ( previous , next ) ) ; } else { this . oldPositions . put ( current , new ListItem ( previous , next ) ) ; } } } private boolean isPositionedCorrectly ( IJavaElement element ) { ListItem oldListItem = getOldPosition ( element ) ; if ( oldListItem == null ) return false ; ListItem newListItem = getNewPosition ( element ) ; if ( newListItem == null ) return false ; IJavaElement oldPrevious = oldListItem . previous ; IJavaElement newPrevious = newListItem . previous ; if ( oldPrevious == null ) { return newPrevious == null ; } else { return oldPrevious . equals ( newPrevious ) ; } } private void recordElementInfo ( IJavaElement element , JavaModel model , int depth ) { if ( depth >= this . maxDepth ) { return ; } JavaElementInfo info = ( JavaElementInfo ) JavaModelManager . getJavaModelManager ( ) . getInfo ( element ) ; if ( info == null ) return ; this . infos . put ( element , info ) ; if ( element instanceof IParent ) { IJavaElement [ ] children = info . getChildren ( ) ; if ( children != null ) { insertPositions ( children , false ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) recordElementInfo ( children [ i ] , model , depth + <NUM_LIT:1> ) ; } } IAnnotation [ ] annotations = null ; if ( info instanceof AnnotatableInfo ) annotations = ( ( AnnotatableInfo ) info ) . annotations ; if ( annotations != null ) { if ( this . annotationInfos == null ) this . annotationInfos = new HashMap ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; for ( int i = <NUM_LIT:0> , length = annotations . length ; i < length ; i ++ ) { this . annotationInfos . put ( annotations [ i ] , manager . getInfo ( annotations [ i ] ) ) ; } } } private void recordNewPositions ( IJavaElement newElement , int depth ) { if ( depth < this . maxDepth && newElement instanceof IParent ) { JavaElementInfo info = null ; try { info = ( JavaElementInfo ) ( ( JavaElement ) newElement ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } IJavaElement [ ] children = info . getChildren ( ) ; if ( children != null ) { insertPositions ( children , true ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { recordNewPositions ( children [ i ] , depth + <NUM_LIT:1> ) ; } } } } private void removed ( IJavaElement element ) { this . removed . add ( element ) ; ListItem current = getOldPosition ( element ) ; ListItem previous = null , next = null ; if ( current . previous != null ) previous = getOldPosition ( current . previous ) ; if ( current . next != null ) next = getOldPosition ( current . next ) ; if ( previous != null ) previous . next = current . next ; if ( next != null ) next . previous = current . previous ; } private void removeElementInfo ( IJavaElement element ) { this . infos . remove ( element ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . delta == null ? "<STR_LIT>" : this . delta . toString ( ) ) ; return buffer . toString ( ) ; } private void trimDelta ( JavaElementDelta elementDelta ) { if ( elementDelta . getKind ( ) == IJavaElementDelta . REMOVED ) { IJavaElementDelta [ ] children = elementDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { elementDelta . removeAffectedChild ( ( JavaElementDelta ) children [ i ] ) ; } } else { IJavaElementDelta [ ] children = elementDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { trimDelta ( ( JavaElementDelta ) children [ i ] ) ; } } } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . * ; import java . util . zip . ZipEntry ; import java . util . zip . ZipException ; import java . util . zip . ZipFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . util . HashtableOfArrayToObject ; import org . eclipse . jdt . internal . core . util . Util ; public class JarPackageFragmentRoot extends PackageFragmentRoot { private final static ArrayList EMPTY_LIST = new ArrayList ( ) ; protected final IPath jarPath ; protected JarPackageFragmentRoot ( IPath externalJarPath , JavaProject project ) { super ( null , project ) ; this . jarPath = externalJarPath ; } protected JarPackageFragmentRoot ( IResource resource , JavaProject project ) { super ( resource , project ) ; this . jarPath = resource . getFullPath ( ) ; } protected boolean computeChildren ( OpenableElementInfo info , IResource underlyingResource ) throws JavaModelException { HashtableOfArrayToObject rawPackageInfo = new HashtableOfArrayToObject ( ) ; IJavaElement [ ] children ; ZipFile jar = null ; try { IJavaProject project = getJavaProject ( ) ; String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String compliance = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; jar = getJar ( ) ; rawPackageInfo . put ( CharOperation . NO_STRINGS , new ArrayList [ ] { EMPTY_LIST , EMPTY_LIST } ) ; for ( Enumeration e = jar . entries ( ) ; e . hasMoreElements ( ) ; ) { ZipEntry member = ( ZipEntry ) e . nextElement ( ) ; initRawPackageInfo ( rawPackageInfo , member . getName ( ) , member . isDirectory ( ) , sourceLevel , compliance ) ; } children = new IJavaElement [ rawPackageInfo . size ( ) ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = rawPackageInfo . keyTable . length ; i < length ; i ++ ) { String [ ] pkgName = ( String [ ] ) rawPackageInfo . keyTable [ i ] ; if ( pkgName == null ) continue ; children [ index ++ ] = getPackageFragment ( pkgName ) ; } } catch ( CoreException e ) { if ( e . getCause ( ) instanceof ZipException ) { Util . log ( e , "<STR_LIT>" + toStringWithAncestors ( ) ) ; children = NO_ELEMENTS ; } else if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( jar ) ; } info . setChildren ( children ) ; ( ( JarPackageFragmentRootInfo ) info ) . rawPackageInfo = rawPackageInfo ; return true ; } protected Object createElementInfo ( ) { return new JarPackageFragmentRootInfo ( ) ; } protected int determineKind ( IResource underlyingResource ) { return IPackageFragmentRoot . K_BINARY ; } public boolean equals ( Object o ) { if ( this == o ) return true ; if ( o instanceof JarPackageFragmentRoot ) { JarPackageFragmentRoot other = ( JarPackageFragmentRoot ) o ; return this . jarPath . equals ( other . jarPath ) ; } return false ; } public String getElementName ( ) { return this . jarPath . lastSegment ( ) ; } public ZipFile getJar ( ) throws CoreException { return JavaModelManager . getJavaModelManager ( ) . getZipFile ( getPath ( ) ) ; } public int getKind ( ) { return IPackageFragmentRoot . K_BINARY ; } int internalKind ( ) throws JavaModelException { return IPackageFragmentRoot . K_BINARY ; } public Object [ ] getNonJavaResources ( ) throws JavaModelException { Object [ ] defaultPkgResources = ( ( JarPackageFragment ) getPackageFragment ( CharOperation . NO_STRINGS ) ) . storedNonJavaResources ( ) ; int length = defaultPkgResources . length ; if ( length == <NUM_LIT:0> ) return defaultPkgResources ; Object [ ] nonJavaResources = new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { JarEntryResource nonJavaResource = ( JarEntryResource ) defaultPkgResources [ i ] ; nonJavaResources [ i ] = nonJavaResource . clone ( this ) ; } return nonJavaResources ; } public PackageFragment getPackageFragment ( String [ ] pkgName ) { return new JarPackageFragment ( this , pkgName ) ; } public IPath internalPath ( ) { if ( isExternal ( ) ) { return this . jarPath ; } else { return super . internalPath ( ) ; } } public IResource resource ( PackageFragmentRoot root ) { if ( this . resource == null ) { return null ; } return super . resource ( root ) ; } public IResource getUnderlyingResource ( ) throws JavaModelException { if ( isExternal ( ) ) { if ( ! exists ( ) ) throw newNotPresentException ( ) ; return null ; } else { return super . getUnderlyingResource ( ) ; } } public int hashCode ( ) { return this . jarPath . hashCode ( ) ; } private void initRawPackageInfo ( HashtableOfArrayToObject rawPackageInfo , String entryName , boolean isDirectory , String sourceLevel , String compliance ) { int lastSeparator = isDirectory ? entryName . length ( ) - <NUM_LIT:1> : entryName . lastIndexOf ( '<CHAR_LIT:/>' ) ; String [ ] pkgName = Util . splitOn ( '<CHAR_LIT:/>' , entryName , <NUM_LIT:0> , lastSeparator ) ; String [ ] existing = null ; int length = pkgName . length ; int existingLength = length ; while ( existingLength >= <NUM_LIT:0> ) { existing = ( String [ ] ) rawPackageInfo . getKey ( pkgName , existingLength ) ; if ( existing != null ) break ; existingLength -- ; } JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; for ( int i = existingLength ; i < length ; i ++ ) { if ( Util . isValidFolderNameForPackage ( pkgName [ i ] , sourceLevel , compliance ) ) { System . arraycopy ( existing , <NUM_LIT:0> , existing = new String [ i + <NUM_LIT:1> ] , <NUM_LIT:0> , i ) ; existing [ i ] = manager . intern ( pkgName [ i ] ) ; rawPackageInfo . put ( existing , new ArrayList [ ] { EMPTY_LIST , EMPTY_LIST } ) ; } else { if ( ! isDirectory ) { ArrayList [ ] children = ( ArrayList [ ] ) rawPackageInfo . get ( existing ) ; if ( children [ <NUM_LIT:1> ] == EMPTY_LIST ) children [ <NUM_LIT:1> ] = new ArrayList ( ) ; children [ <NUM_LIT:1> ] . add ( entryName ) ; } return ; } } if ( isDirectory ) return ; ArrayList [ ] children = ( ArrayList [ ] ) rawPackageInfo . get ( pkgName ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( entryName ) ) { if ( children [ <NUM_LIT:0> ] == EMPTY_LIST ) children [ <NUM_LIT:0> ] = new ArrayList ( ) ; String nameWithoutExtension = entryName . substring ( lastSeparator + <NUM_LIT:1> , entryName . length ( ) - <NUM_LIT:6> ) ; children [ <NUM_LIT:0> ] . add ( nameWithoutExtension ) ; } else { if ( children [ <NUM_LIT:1> ] == EMPTY_LIST ) children [ <NUM_LIT:1> ] = new ArrayList ( ) ; children [ <NUM_LIT:1> ] . add ( entryName ) ; } } public boolean isArchive ( ) { return true ; } public boolean isExternal ( ) { return resource ( ) == null ; } public boolean isReadOnly ( ) { return true ; } protected boolean resourceExists ( IResource underlyingResource ) { if ( underlyingResource == null ) { return JavaModel . getExternalTarget ( getPath ( ) , true ) != null ; } else { return super . resourceExists ( underlyingResource ) ; } } protected void toStringAncestors ( StringBuffer buffer ) { if ( isExternal ( ) ) return ; super . toStringAncestors ( buffer ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; public class BecomeWorkingCopyOperation extends JavaModelOperation { IProblemRequestor problemRequestor ; public BecomeWorkingCopyOperation ( CompilationUnit workingCopy , IProblemRequestor problemRequestor ) { super ( new IJavaElement [ ] { workingCopy } ) ; this . problemRequestor = problemRequestor ; } protected void executeOperation ( ) throws JavaModelException { CompilationUnit workingCopy = getWorkingCopy ( ) ; JavaModelManager . getJavaModelManager ( ) . getPerWorkingCopyInfo ( workingCopy , true , true , this . problemRequestor ) ; workingCopy . openWhenClosed ( workingCopy . createElementInfo ( ) , this . progressMonitor ) ; if ( ! workingCopy . isPrimary ( ) ) { JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; delta . added ( workingCopy ) ; addDelta ( delta ) ; } else { if ( workingCopy . getResource ( ) . isAccessible ( ) ) { JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; delta . changed ( workingCopy , IJavaElementDelta . F_PRIMARY_WORKING_COPY ) ; addDelta ( delta ) ; } else { JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; delta . added ( workingCopy , IJavaElementDelta . F_PRIMARY_WORKING_COPY ) ; addDelta ( delta ) ; } } this . resultElements = new IJavaElement [ ] { workingCopy } ; } protected CompilationUnit getWorkingCopy ( ) { return ( CompilationUnit ) getElementToProcess ( ) ; } public boolean isReadOnly ( ) { return true ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . IClasspathContainer ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . Util ; public class SetContainerOperation extends ChangeClasspathOperation { IPath containerPath ; IJavaProject [ ] affectedProjects ; IClasspathContainer [ ] respectiveContainers ; public SetContainerOperation ( IPath containerPath , IJavaProject [ ] affectedProjects , IClasspathContainer [ ] respectiveContainers ) { super ( new IJavaElement [ ] { JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) } , ! ResourcesPlugin . getWorkspace ( ) . isTreeLocked ( ) ) ; this . containerPath = containerPath ; this . affectedProjects = affectedProjects ; this . respectiveContainers = respectiveContainers ; } protected void executeOperation ( ) throws JavaModelException { checkCanceled ( ) ; try { beginTask ( "<STR_LIT>" , <NUM_LIT:1> ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE ) verbose_set_container ( ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_set_container_invocation_trace ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( manager . containerPutIfInitializingWithSameEntries ( this . containerPath , this . affectedProjects , this . respectiveContainers ) ) return ; final int projectLength = this . affectedProjects . length ; final IJavaProject [ ] modifiedProjects ; System . arraycopy ( this . affectedProjects , <NUM_LIT:0> , modifiedProjects = new IJavaProject [ projectLength ] , <NUM_LIT:0> , projectLength ) ; int remaining = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < projectLength ; i ++ ) { if ( isCanceled ( ) ) return ; JavaProject affectedProject = ( JavaProject ) this . affectedProjects [ i ] ; IClasspathContainer newContainer = this . respectiveContainers [ i ] ; if ( newContainer == null ) newContainer = JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ; boolean found = false ; if ( JavaProject . hasJavaNature ( affectedProject . getProject ( ) ) ) { IClasspathEntry [ ] rawClasspath = affectedProject . getRawClasspath ( ) ; for ( int j = <NUM_LIT:0> , cpLength = rawClasspath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = rawClasspath [ j ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_CONTAINER && entry . getPath ( ) . equals ( this . containerPath ) ) { found = true ; break ; } } } if ( ! found ) { modifiedProjects [ i ] = null ; manager . containerPut ( affectedProject , this . containerPath , newContainer ) ; continue ; } IClasspathContainer oldContainer = manager . containerGet ( affectedProject , this . containerPath ) ; if ( oldContainer == JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) { oldContainer = null ; } if ( ( oldContainer != null && oldContainer . equals ( this . respectiveContainers [ i ] ) ) || ( oldContainer == this . respectiveContainers [ i ] ) ) { modifiedProjects [ i ] = null ; continue ; } remaining ++ ; manager . containerPut ( affectedProject , this . containerPath , newContainer ) ; } if ( remaining == <NUM_LIT:0> ) return ; try { for ( int i = <NUM_LIT:0> ; i < projectLength ; i ++ ) { if ( isCanceled ( ) ) return ; JavaProject affectedProject = ( JavaProject ) modifiedProjects [ i ] ; if ( affectedProject == null ) continue ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_update_project ( affectedProject ) ; ClasspathChange classpathChange = affectedProject . getPerProjectInfo ( ) . resetResolvedClasspath ( ) ; classpathChanged ( classpathChange , i == <NUM_LIT:0> ) ; if ( this . canChangeResources ) { try { affectedProject . getProject ( ) . touch ( this . progressMonitor ) ; } catch ( CoreException e ) { if ( ! ExternalJavaProject . EXTERNAL_PROJECT_NAME . equals ( affectedProject . getElementName ( ) ) ) throw e ; } } } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) verbose_failure ( e ) ; if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } finally { for ( int i = <NUM_LIT:0> ; i < projectLength ; i ++ ) { if ( this . respectiveContainers [ i ] == null ) { manager . containerPut ( this . affectedProjects [ i ] , this . containerPath , null ) ; } } } } finally { done ( ) ; } } private void verbose_failure ( CoreException e ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + this . containerPath , System . err ) ; e . printStackTrace ( ) ; } private void verbose_update_project ( JavaProject affectedProject ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + affectedProject . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + this . containerPath ) ; } private void verbose_set_container ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + this . containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( this . affectedProjects , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { return ( ( IJavaProject ) o ) . getElementName ( ) ; } } ) + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( this . respectiveContainers , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } IClasspathContainer container = ( IClasspathContainer ) o ; buffer . append ( container . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; IClasspathEntry [ ] entries = container . getClasspathEntries ( ) ; if ( entries != null ) { for ( int i = <NUM_LIT:0> ; i < entries . length ; i ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( entries [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" ) ; } private void verbose_set_container_invocation_trace ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; public class InitializerWithChildrenInfo extends InitializerElementInfo { protected IJavaElement [ ] children ; public InitializerWithChildrenInfo ( IJavaElement [ ] children ) { this . children = children ; } public IJavaElement [ ] getChildren ( ) { return this . children ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . core . util . LRUCache ; import org . eclipse . jdt . internal . core . util . Util ; public class JavaModelCache { public static boolean VERBOSE = false ; public static final int DEFAULT_PROJECT_SIZE = <NUM_LIT:5> ; public static final int DEFAULT_ROOT_SIZE = <NUM_LIT> ; public static final int DEFAULT_PKG_SIZE = <NUM_LIT> ; public static final int DEFAULT_OPENABLE_SIZE = <NUM_LIT> ; public static final int DEFAULT_CHILDREN_SIZE = <NUM_LIT> * <NUM_LIT:20> ; public static final String RATIO_PROPERTY = "<STR_LIT>" ; public static final Object NON_EXISTING_JAR_TYPE_INFO = new Object ( ) ; protected double memoryRatio = - <NUM_LIT:1> ; protected Object modelInfo ; protected HashMap projectCache ; protected ElementCache rootCache ; protected ElementCache pkgCache ; protected ElementCache openableCache ; protected Map childrenCache ; protected LRUCache jarTypeCache ; public JavaModelCache ( ) { double ratio = getMemoryRatio ( ) ; double openableRatio = getOpenableRatio ( ) ; this . projectCache = new HashMap ( DEFAULT_PROJECT_SIZE ) ; if ( VERBOSE ) { this . rootCache = new VerboseElementCache ( ( int ) ( DEFAULT_ROOT_SIZE * ratio ) , "<STR_LIT>" ) ; this . pkgCache = new VerboseElementCache ( ( int ) ( DEFAULT_PKG_SIZE * ratio ) , "<STR_LIT>" ) ; this . openableCache = new VerboseElementCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * ratio * openableRatio ) , "<STR_LIT>" ) ; } else { this . rootCache = new ElementCache ( ( int ) ( DEFAULT_ROOT_SIZE * ratio ) ) ; this . pkgCache = new ElementCache ( ( int ) ( DEFAULT_PKG_SIZE * ratio ) ) ; this . openableCache = new ElementCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * ratio * openableRatio ) ) ; } this . childrenCache = new HashMap ( ( int ) ( DEFAULT_CHILDREN_SIZE * ratio * openableRatio ) ) ; resetJarTypeCache ( ) ; } private double getOpenableRatio ( ) { String property = System . getProperty ( RATIO_PROPERTY ) ; if ( property != null ) { try { return Double . parseDouble ( property ) ; } catch ( NumberFormatException e ) { Util . log ( e , "<STR_LIT>" + RATIO_PROPERTY + "<STR_LIT::U+0020>" + property ) ; } } return <NUM_LIT:1.0> ; } public Object getInfo ( IJavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return this . modelInfo ; case IJavaElement . JAVA_PROJECT : return this . projectCache . get ( element ) ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return this . rootCache . get ( element ) ; case IJavaElement . PACKAGE_FRAGMENT : return this . pkgCache . get ( element ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return this . openableCache . get ( element ) ; case IJavaElement . TYPE : Object result = this . jarTypeCache . get ( element ) ; if ( result != null ) return result ; else return this . childrenCache . get ( element ) ; default : return this . childrenCache . get ( element ) ; } } public IJavaElement getExistingElement ( IJavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return element ; case IJavaElement . JAVA_PROJECT : return element ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return ( IJavaElement ) this . rootCache . getKey ( element ) ; case IJavaElement . PACKAGE_FRAGMENT : return ( IJavaElement ) this . pkgCache . getKey ( element ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return ( IJavaElement ) this . openableCache . getKey ( element ) ; case IJavaElement . TYPE : return element ; default : return element ; } } protected double getMemoryRatio ( ) { if ( ( int ) this . memoryRatio == - <NUM_LIT:1> ) { long maxMemory = Runtime . getRuntime ( ) . maxMemory ( ) ; this . memoryRatio = maxMemory == Long . MAX_VALUE ? <NUM_LIT> : ( ( double ) maxMemory ) / ( <NUM_LIT> * <NUM_LIT> ) ; } return this . memoryRatio ; } protected Object peekAtInfo ( IJavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return this . modelInfo ; case IJavaElement . JAVA_PROJECT : return this . projectCache . get ( element ) ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return this . rootCache . peek ( element ) ; case IJavaElement . PACKAGE_FRAGMENT : return this . pkgCache . peek ( element ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return this . openableCache . peek ( element ) ; case IJavaElement . TYPE : Object result = this . jarTypeCache . peek ( element ) ; if ( result != null ) return result ; else return this . childrenCache . get ( element ) ; default : return this . childrenCache . get ( element ) ; } } protected void putInfo ( IJavaElement element , Object info ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : this . modelInfo = info ; break ; case IJavaElement . JAVA_PROJECT : this . projectCache . put ( element , info ) ; this . rootCache . ensureSpaceLimit ( info , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : this . rootCache . put ( element , info ) ; this . pkgCache . ensureSpaceLimit ( info , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : this . pkgCache . put ( element , info ) ; this . openableCache . ensureSpaceLimit ( info , element ) ; break ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : this . openableCache . put ( element , info ) ; break ; default : this . childrenCache . put ( element , info ) ; } } protected void removeInfo ( JavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : this . modelInfo = null ; break ; case IJavaElement . JAVA_PROJECT : this . projectCache . remove ( element ) ; this . rootCache . resetSpaceLimit ( ( int ) ( DEFAULT_ROOT_SIZE * getMemoryRatio ( ) ) , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : this . rootCache . remove ( element ) ; this . pkgCache . resetSpaceLimit ( ( int ) ( DEFAULT_PKG_SIZE * getMemoryRatio ( ) ) , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : this . pkgCache . remove ( element ) ; this . openableCache . resetSpaceLimit ( ( int ) ( DEFAULT_OPENABLE_SIZE * getMemoryRatio ( ) * getOpenableRatio ( ) ) , element ) ; break ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : this . openableCache . remove ( element ) ; break ; default : this . childrenCache . remove ( element ) ; } } protected void resetJarTypeCache ( ) { this . jarTypeCache = new LRUCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * getMemoryRatio ( ) ) ) ; } public String toString ( ) { return toStringFillingRation ( "<STR_LIT>" ) ; } public String toStringFillingRation ( String prefix ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( prefix ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . projectCache . size ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( prefix ) ; buffer . append ( this . rootCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; buffer . append ( prefix ) ; buffer . append ( this . pkgCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; buffer . append ( prefix ) ; buffer . append ( this . openableCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; buffer . append ( prefix ) ; buffer . append ( this . jarTypeCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; abstract class MemberElementInfo extends SourceRefElementInfo { protected int flags ; public int getNameSourceEnd ( ) { return - <NUM_LIT:1> ; } public int getNameSourceStart ( ) { return - <NUM_LIT:1> ; } public int getModifiers ( ) { return this . flags ; } protected void setFlags ( int flags ) { this . flags = flags ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . ASTParser ; import org . eclipse . jdt . core . dom . ChildListPropertyDescriptor ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . StructuralPropertyDescriptor ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . core . dom . rewrite . ListRewrite ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . text . edits . TextEdit ; public abstract class CreateElementInCUOperation extends JavaModelOperation { protected CompilationUnit cuAST ; protected static final int INSERT_LAST = <NUM_LIT:1> ; protected static final int INSERT_AFTER = <NUM_LIT:2> ; protected static final int INSERT_BEFORE = <NUM_LIT:3> ; protected int insertionPolicy = INSERT_LAST ; protected IJavaElement anchorElement = null ; protected boolean creationOccurred = true ; public CreateElementInCUOperation ( IJavaElement parentElement ) { super ( null , new IJavaElement [ ] { parentElement } ) ; initializeDefaultPosition ( ) ; } protected void checkCanceled ( ) { if ( ! this . isNested ) { super . checkCanceled ( ) ; } } public void createAfter ( IJavaElement sibling ) { setRelativePosition ( sibling , INSERT_AFTER ) ; } public void createBefore ( IJavaElement sibling ) { setRelativePosition ( sibling , INSERT_BEFORE ) ; } protected void executeOperation ( ) throws JavaModelException { try { beginTask ( getMainTaskName ( ) , getMainAmountOfWork ( ) ) ; JavaElementDelta delta = newJavaElementDelta ( ) ; ICompilationUnit unit = getCompilationUnit ( ) ; generateNewCompilationUnitAST ( unit ) ; if ( this . creationOccurred ) { unit . save ( null , false ) ; boolean isWorkingCopy = unit . isWorkingCopy ( ) ; if ( ! isWorkingCopy ) setAttribute ( HAS_MODIFIED_RESOURCE_ATTR , TRUE ) ; worked ( <NUM_LIT:1> ) ; this . resultElements = generateResultHandles ( ) ; if ( ! isWorkingCopy && ! Util . isExcluded ( unit ) && unit . getParent ( ) . exists ( ) ) { for ( int i = <NUM_LIT:0> ; i < this . resultElements . length ; i ++ ) { delta . added ( this . resultElements [ i ] ) ; } addDelta ( delta ) ; } } } finally { done ( ) ; } } protected abstract StructuralPropertyDescriptor getChildPropertyDescriptor ( ASTNode parent ) ; protected abstract ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException ; protected void generateNewCompilationUnitAST ( ICompilationUnit cu ) throws JavaModelException { this . cuAST = parse ( cu ) ; AST ast = this . cuAST . getAST ( ) ; ASTRewrite rewriter = ASTRewrite . create ( ast ) ; ASTNode child = generateElementAST ( rewriter , cu ) ; if ( child != null ) { ASTNode parent = ( ( JavaElement ) getParentElement ( ) ) . findNode ( this . cuAST ) ; if ( parent == null ) parent = this . cuAST ; insertASTNode ( rewriter , parent , child ) ; TextEdit edits = rewriter . rewriteAST ( ) ; applyTextEdit ( cu , edits ) ; } worked ( <NUM_LIT:1> ) ; } protected abstract IJavaElement generateResultHandle ( ) ; protected IJavaElement [ ] generateResultHandles ( ) { return new IJavaElement [ ] { generateResultHandle ( ) } ; } protected ICompilationUnit getCompilationUnit ( ) { return getCompilationUnitFor ( getParentElement ( ) ) ; } protected int getMainAmountOfWork ( ) { return <NUM_LIT:2> ; } public abstract String getMainTaskName ( ) ; protected ISchedulingRule getSchedulingRule ( ) { IResource resource = getCompilationUnit ( ) . getResource ( ) ; IWorkspace workspace = resource . getWorkspace ( ) ; return workspace . getRuleFactory ( ) . modifyRule ( resource ) ; } protected void initializeDefaultPosition ( ) { } protected void insertASTNode ( ASTRewrite rewriter , ASTNode parent , ASTNode child ) throws JavaModelException { StructuralPropertyDescriptor propertyDescriptor = getChildPropertyDescriptor ( parent ) ; if ( propertyDescriptor instanceof ChildListPropertyDescriptor ) { ChildListPropertyDescriptor childListPropertyDescriptor = ( ChildListPropertyDescriptor ) propertyDescriptor ; ListRewrite rewrite = rewriter . getListRewrite ( parent , childListPropertyDescriptor ) ; switch ( this . insertionPolicy ) { case INSERT_BEFORE : ASTNode element = ( ( JavaElement ) this . anchorElement ) . findNode ( this . cuAST ) ; if ( childListPropertyDescriptor . getElementType ( ) . isAssignableFrom ( element . getClass ( ) ) ) rewrite . insertBefore ( child , element , null ) ; else rewrite . insertLast ( child , null ) ; break ; case INSERT_AFTER : element = ( ( JavaElement ) this . anchorElement ) . findNode ( this . cuAST ) ; if ( childListPropertyDescriptor . getElementType ( ) . isAssignableFrom ( element . getClass ( ) ) ) rewrite . insertAfter ( child , element , null ) ; else rewrite . insertLast ( child , null ) ; break ; case INSERT_LAST : rewrite . insertLast ( child , null ) ; break ; } } else { rewriter . set ( parent , propertyDescriptor , child , null ) ; } } protected CompilationUnit parse ( ICompilationUnit cu ) throws JavaModelException { cu . makeConsistent ( this . progressMonitor ) ; ASTParser parser = ASTParser . newParser ( AST . JLS3 ) ; parser . setSource ( cu ) ; return ( CompilationUnit ) parser . createAST ( this . progressMonitor ) ; } protected void setAlteredName ( String newName ) { } protected void setRelativePosition ( IJavaElement sibling , int policy ) throws IllegalArgumentException { if ( sibling == null ) { this . anchorElement = null ; this . insertionPolicy = INSERT_LAST ; } else { this . anchorElement = sibling ; this . insertionPolicy = policy ; } } public IJavaModelStatus verify ( ) { if ( getParentElement ( ) == null ) { return new JavaModelStatus ( IJavaModelStatusConstants . NO_ELEMENTS_TO_PROCESS ) ; } if ( this . anchorElement != null ) { IJavaElement domPresentParent = this . anchorElement . getParent ( ) ; if ( domPresentParent . getElementType ( ) == IJavaElement . IMPORT_CONTAINER ) { domPresentParent = domPresentParent . getParent ( ) ; } if ( ! domPresentParent . equals ( getParentElement ( ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_SIBLING , this . anchorElement ) ; } } return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; public class TypeParameterElementInfo extends SourceRefElementInfo { public int nameStart = - <NUM_LIT:1> ; public int nameEnd = - <NUM_LIT:1> ; public char [ ] [ ] bounds ; public char [ ] [ ] boundsSignatures ; } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . internal . core . util . HashSetOfArray ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . jdt . internal . core . util . HashtableOfArrayToObject ; class JavaProjectElementInfo extends OpenableElementInfo { static final IPackageFragmentRoot [ ] NO_ROOTS = new IPackageFragmentRoot [ <NUM_LIT:0> ] ; static class ProjectCache { ProjectCache ( IPackageFragmentRoot [ ] allPkgFragmentRootsCache , Map rootToResolvedEntries , Map pkgFragmentsCaches ) { this . allPkgFragmentRootsCache = allPkgFragmentRootsCache ; this . rootToResolvedEntries = rootToResolvedEntries ; this . pkgFragmentsCaches = pkgFragmentsCaches ; } public IPackageFragmentRoot [ ] allPkgFragmentRootsCache ; public HashtableOfArrayToObject allPkgFragmentsCache ; public Map pkgFragmentsCaches ; public Map rootToResolvedEntries ; } private Object [ ] nonJavaResources ; ProjectCache projectCache ; static void addSuperPackageNames ( String [ ] pkgName , HashtableOfArrayToObject packageFragments ) { for ( int i = pkgName . length - <NUM_LIT:1> ; i > <NUM_LIT:0> ; i -- ) { if ( packageFragments . getKey ( pkgName , i ) == null ) { System . arraycopy ( pkgName , <NUM_LIT:0> , pkgName = new String [ i ] , <NUM_LIT:0> , i ) ; packageFragments . put ( pkgName , NO_ROOTS ) ; } } } public JavaProjectElementInfo ( ) { this . nonJavaResources = null ; } private Object [ ] computeNonJavaResources ( JavaProject project ) { IPath projectPath = project . getProject ( ) . getFullPath ( ) ; boolean srcIsProject = false ; boolean binIsProject = false ; char [ ] [ ] inclusionPatterns = null ; char [ ] [ ] exclusionPatterns = null ; IPath projectOutput = null ; boolean isClasspathResolved = true ; try { IClasspathEntry entry = project . getClasspathEntryFor ( projectPath ) ; if ( entry != null ) { srcIsProject = true ; inclusionPatterns = ( ( ClasspathEntry ) entry ) . fullInclusionPatternChars ( ) ; exclusionPatterns = ( ( ClasspathEntry ) entry ) . fullExclusionPatternChars ( ) ; } projectOutput = project . getOutputLocation ( ) ; binIsProject = projectPath . equals ( projectOutput ) ; } catch ( JavaModelException e ) { isClasspathResolved = false ; } Object [ ] resources = new IResource [ <NUM_LIT:5> ] ; int resourcesCounter = <NUM_LIT:0> ; try { IResource [ ] members = ( ( IContainer ) project . getResource ( ) ) . members ( ) ; int length = members . length ; if ( length > <NUM_LIT:0> ) { String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; IClasspathEntry [ ] classpath = project . getResolvedClasspath ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IResource res = members [ i ] ; switch ( res . getType ( ) ) { case IResource . FILE : IPath resFullPath = res . getFullPath ( ) ; String resName = res . getName ( ) ; if ( isClasspathResolved && isClasspathEntryOrOutputLocation ( resFullPath , res . getLocation ( ) , classpath , projectOutput ) ) { break ; } if ( srcIsProject && Util . isValidCompilationUnitName ( resName , sourceLevel , complianceLevel ) && ! Util . isExcluded ( res , inclusionPatterns , exclusionPatterns ) ) { break ; } if ( binIsProject && Util . isValidClassFileName ( resName , sourceLevel , complianceLevel ) ) { break ; } if ( resources . length == resourcesCounter ) { System . arraycopy ( resources , <NUM_LIT:0> , ( resources = new IResource [ resourcesCounter * <NUM_LIT:2> ] ) , <NUM_LIT:0> , resourcesCounter ) ; } resources [ resourcesCounter ++ ] = res ; break ; case IResource . FOLDER : resFullPath = res . getFullPath ( ) ; if ( ( srcIsProject && ! Util . isExcluded ( res , inclusionPatterns , exclusionPatterns ) && Util . isValidFolderNameForPackage ( res . getName ( ) , sourceLevel , complianceLevel ) ) || ( isClasspathResolved && isClasspathEntryOrOutputLocation ( resFullPath , res . getLocation ( ) , classpath , projectOutput ) ) ) { break ; } if ( resources . length == resourcesCounter ) { System . arraycopy ( resources , <NUM_LIT:0> , ( resources = new IResource [ resourcesCounter * <NUM_LIT:2> ] ) , <NUM_LIT:0> , resourcesCounter ) ; } resources [ resourcesCounter ++ ] = res ; } } } if ( resources . length != resourcesCounter ) { System . arraycopy ( resources , <NUM_LIT:0> , ( resources = new IResource [ resourcesCounter ] ) , <NUM_LIT:0> , resourcesCounter ) ; } } catch ( CoreException e ) { resources = NO_NON_JAVA_RESOURCES ; resourcesCounter = <NUM_LIT:0> ; } return resources ; } ProjectCache getProjectCache ( JavaProject project ) { ProjectCache cache = this . projectCache ; if ( cache == null ) { IPackageFragmentRoot [ ] roots ; Map reverseMap = new HashMap ( <NUM_LIT:3> ) ; try { roots = project . getAllPackageFragmentRoots ( reverseMap ) ; } catch ( JavaModelException e ) { roots = new IPackageFragmentRoot [ <NUM_LIT:0> ] ; reverseMap . clear ( ) ; } HashMap rootInfos = JavaModelManager . getJavaModelManager ( ) . deltaState . roots ; HashMap pkgFragmentsCaches = new HashMap ( ) ; int length = roots . length ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IPackageFragmentRoot root = roots [ i ] ; DeltaProcessor . RootInfo rootInfo = ( DeltaProcessor . RootInfo ) rootInfos . get ( root . getPath ( ) ) ; if ( rootInfo == null || rootInfo . project . equals ( project ) ) { roots [ i ] = root = ( IPackageFragmentRoot ) manager . getExistingElement ( root ) ; HashSetOfArray fragmentsCache = new HashSetOfArray ( ) ; initializePackageNames ( root , fragmentsCache ) ; pkgFragmentsCaches . put ( root , fragmentsCache ) ; } } cache = new ProjectCache ( roots , reverseMap , pkgFragmentsCaches ) ; this . projectCache = cache ; } return cache ; } Object [ ] getNonJavaResources ( JavaProject project ) { if ( this . nonJavaResources == null ) { this . nonJavaResources = computeNonJavaResources ( project ) ; } return this . nonJavaResources ; } private void initializePackageNames ( IPackageFragmentRoot root , HashSetOfArray fragmentsCache ) { IJavaElement [ ] frags = null ; try { if ( ! root . isOpen ( ) ) { PackageFragmentRootInfo info = root . isArchive ( ) ? new JarPackageFragmentRootInfo ( ) : new PackageFragmentRootInfo ( ) ; ( ( PackageFragmentRoot ) root ) . computeChildren ( info , ( ( JavaElement ) root ) . resource ( ) ) ; frags = info . children ; } else frags = root . getChildren ( ) ; } catch ( JavaModelException e ) { return ; } for ( int j = <NUM_LIT:0> , length = frags . length ; j < length ; j ++ ) { fragmentsCache . add ( ( ( PackageFragment ) frags [ j ] ) . names ) ; } } private boolean isClasspathEntryOrOutputLocation ( IPath path , IPath location , IClasspathEntry [ ] resolvedClasspath , IPath projectOutput ) { if ( projectOutput . equals ( path ) ) return true ; for ( int i = <NUM_LIT:0> , length = resolvedClasspath . length ; i < length ; i ++ ) { IClasspathEntry entry = resolvedClasspath [ i ] ; IPath entryPath ; if ( ( entryPath = entry . getPath ( ) ) . equals ( path ) || entryPath . equals ( location ) ) { return true ; } IPath output ; if ( ( output = entry . getOutputLocation ( ) ) != null && output . equals ( path ) ) { return true ; } } return false ; } NameLookup newNameLookup ( JavaProject project , ICompilationUnit [ ] workingCopies ) { ProjectCache cache = getProjectCache ( project ) ; HashtableOfArrayToObject allPkgFragmentsCache = cache . allPkgFragmentsCache ; if ( allPkgFragmentsCache == null ) { HashMap rootInfos = JavaModelManager . getJavaModelManager ( ) . deltaState . roots ; IPackageFragmentRoot [ ] allRoots = cache . allPkgFragmentRootsCache ; int length = allRoots . length ; allPkgFragmentsCache = new HashtableOfArrayToObject ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IPackageFragmentRoot root = allRoots [ i ] ; DeltaProcessor . RootInfo rootInfo = ( DeltaProcessor . RootInfo ) rootInfos . get ( root . getPath ( ) ) ; JavaProject rootProject = rootInfo == null ? project : rootInfo . project ; HashSetOfArray fragmentsCache ; if ( rootProject . equals ( project ) ) { fragmentsCache = ( HashSetOfArray ) cache . pkgFragmentsCaches . get ( root ) ; } else { ProjectCache rootProjectCache ; try { rootProjectCache = rootProject . getProjectCache ( ) ; } catch ( JavaModelException e ) { continue ; } fragmentsCache = ( HashSetOfArray ) rootProjectCache . pkgFragmentsCaches . get ( root ) ; } if ( fragmentsCache == null ) { fragmentsCache = new HashSetOfArray ( ) ; initializePackageNames ( root , fragmentsCache ) ; } Object [ ] [ ] set = fragmentsCache . set ; for ( int j = <NUM_LIT:0> , length2 = set . length ; j < length2 ; j ++ ) { String [ ] pkgName = ( String [ ] ) set [ j ] ; if ( pkgName == null ) continue ; Object existing = allPkgFragmentsCache . get ( pkgName ) ; if ( existing == null || existing == NO_ROOTS ) { allPkgFragmentsCache . put ( pkgName , root ) ; addSuperPackageNames ( pkgName , allPkgFragmentsCache ) ; } else { if ( existing instanceof PackageFragmentRoot ) { allPkgFragmentsCache . put ( pkgName , new IPackageFragmentRoot [ ] { ( PackageFragmentRoot ) existing , root } ) ; } else { IPackageFragmentRoot [ ] roots = ( IPackageFragmentRoot [ ] ) existing ; int rootLength = roots . length ; System . arraycopy ( roots , <NUM_LIT:0> , roots = new IPackageFragmentRoot [ rootLength + <NUM_LIT:1> ] , <NUM_LIT:0> , rootLength ) ; roots [ rootLength ] = root ; allPkgFragmentsCache . put ( pkgName , roots ) ; } } } } cache . allPkgFragmentsCache = allPkgFragmentsCache ; } return new NameLookup ( cache . allPkgFragmentRootsCache , cache . allPkgFragmentsCache , workingCopies , cache . rootToResolvedEntries ) ; } void resetCaches ( ) { this . projectCache = null ; } void setNonJavaResources ( Object [ ] resources ) { this . nonJavaResources = resources ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . internal . compiler . env . ISourceField ; public class SourceFieldElementInfo extends AnnotatableInfo implements ISourceField { protected char [ ] typeName ; protected char [ ] initializationSource ; public char [ ] getInitializationSource ( ) { return this . initializationSource ; } public char [ ] getTypeName ( ) { return this . typeName ; } protected String getTypeSignature ( ) { return Signature . createTypeSignature ( this . typeName , false ) ; } protected void setTypeName ( char [ ] typeName ) { this . typeName = typeName ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . ISourceReference ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . Messages ; public class RenameElementsOperation extends MoveElementsOperation { public RenameElementsOperation ( IJavaElement [ ] elements , IJavaElement [ ] destinations , String [ ] newNames , boolean force ) { super ( elements , destinations , force ) ; setRenamings ( newNames ) ; } protected String getMainTaskName ( ) { return Messages . operation_renameElementProgress ; } protected boolean isRename ( ) { return true ; } protected IJavaModelStatus verify ( ) { IJavaModelStatus status = super . verify ( ) ; if ( ! status . isOK ( ) ) return status ; if ( this . renamingsList == null || this . renamingsList . length == <NUM_LIT:0> ) return new JavaModelStatus ( IJavaModelStatusConstants . NULL_NAME ) ; return JavaModelStatus . VERIFIED_OK ; } protected void verify ( IJavaElement element ) throws JavaModelException { if ( element == null || ! element . exists ( ) ) error ( IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST , element ) ; if ( element . isReadOnly ( ) ) error ( IJavaModelStatusConstants . READ_ONLY , element ) ; if ( ! ( element instanceof ISourceReference ) ) error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; int elementType = element . getElementType ( ) ; if ( elementType < IJavaElement . TYPE || elementType == IJavaElement . INITIALIZER ) error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; verifyRenaming ( element ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; 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 . search . indexing . IIndexConstants ; public class HierarchyBinaryType implements IBinaryType { private int modifiers ; private char [ ] sourceName ; private char [ ] name ; private char [ ] enclosingTypeName ; private char [ ] superclass ; private char [ ] [ ] superInterfaces = NoInterface ; private char [ ] [ ] typeParameterSignatures ; private char [ ] genericSignature ; public HierarchyBinaryType ( int modifiers , char [ ] qualification , char [ ] sourceName , char [ ] enclosingTypeName , char [ ] [ ] typeParameterSignatures , char typeSuffix ) { this . modifiers = modifiers ; this . sourceName = sourceName ; if ( enclosingTypeName == null ) { this . name = CharOperation . concat ( qualification , sourceName , '<CHAR_LIT:/>' ) ; } else { this . name = CharOperation . concat ( qualification , '<CHAR_LIT:/>' , enclosingTypeName , '<CHAR_LIT>' , sourceName ) ; this . enclosingTypeName = CharOperation . concat ( qualification , enclosingTypeName , '<CHAR_LIT:/>' ) ; CharOperation . replace ( this . enclosingTypeName , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; } this . typeParameterSignatures = typeParameterSignatures ; CharOperation . replace ( this . name , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return null ; } public char [ ] getEnclosingMethod ( ) { return null ; } public char [ ] getEnclosingTypeName ( ) { return this . enclosingTypeName ; } public IBinaryField [ ] getFields ( ) { return null ; } public char [ ] getFileName ( ) { return null ; } public char [ ] getGenericSignature ( ) { if ( this . typeParameterSignatures != null && this . genericSignature == null ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , length = this . typeParameterSignatures . length ; i < length ; i ++ ) { buffer . append ( this . typeParameterSignatures [ i ] ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; if ( this . superclass == null ) buffer . append ( Signature . createTypeSignature ( "<STR_LIT>" , true ) ) ; else buffer . append ( Signature . createTypeSignature ( this . superclass , true ) ) ; if ( this . superInterfaces != null ) for ( int i = <NUM_LIT:0> , length = this . superInterfaces . length ; i < length ; i ++ ) buffer . append ( Signature . createTypeSignature ( this . superInterfaces [ i ] , true ) ) ; this . genericSignature = buffer . toString ( ) . toCharArray ( ) ; CharOperation . replace ( this . genericSignature , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; } return this . genericSignature ; } public char [ ] [ ] getInterfaceNames ( ) { return this . superInterfaces ; } public IBinaryNestedType [ ] getMemberTypes ( ) { return null ; } public IBinaryMethod [ ] getMethods ( ) { return null ; } public char [ ] [ ] [ ] getMissingTypeNames ( ) { return null ; } public int getModifiers ( ) { return this . modifiers ; } public char [ ] getName ( ) { return this . name ; } public char [ ] getSourceName ( ) { return this . sourceName ; } public char [ ] getSuperclassName ( ) { return this . superclass ; } public long getTagBits ( ) { return <NUM_LIT:0> ; } public boolean isAnonymous ( ) { return false ; } public boolean isBinaryType ( ) { return true ; } public boolean isLocal ( ) { return false ; } public boolean isMember ( ) { return false ; } public void recordSuperType ( char [ ] superTypeName , char [ ] superQualification , char superClassOrInterface ) { if ( superQualification != null ) { int length = superQualification . length ; if ( superQualification [ length - <NUM_LIT:1> ] == '<CHAR_LIT>' ) { char [ ] enclosingSuperName = CharOperation . lastSegment ( superQualification , '<CHAR_LIT:.>' ) ; superTypeName = CharOperation . concat ( enclosingSuperName , superTypeName ) ; superQualification = CharOperation . subarray ( superQualification , <NUM_LIT:0> , length - enclosingSuperName . length - <NUM_LIT:1> ) ; } } if ( superClassOrInterface == IIndexConstants . CLASS_SUFFIX ) { if ( TypeDeclaration . kind ( this . modifiers ) == TypeDeclaration . INTERFACE_DECL ) return ; char [ ] encodedName = CharOperation . concat ( superQualification , superTypeName , '<CHAR_LIT:/>' ) ; CharOperation . replace ( encodedName , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; this . superclass = encodedName ; } else { char [ ] encodedName = CharOperation . concat ( superQualification , superTypeName , '<CHAR_LIT:/>' ) ; CharOperation . replace ( encodedName , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; if ( this . superInterfaces == NoInterface ) { this . superInterfaces = new char [ ] [ ] { encodedName } ; } else { int length = this . superInterfaces . length ; System . arraycopy ( this . superInterfaces , <NUM_LIT:0> , this . superInterfaces = new char [ length + <NUM_LIT:1> ] [ ] , <NUM_LIT:0> , length ) ; this . superInterfaces [ length ] = encodedName ; } } } public char [ ] sourceFileName ( ) { return null ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; if ( this . modifiers == ClassFileConstants . AccPublic ) { buffer . append ( "<STR_LIT>" ) ; } switch ( TypeDeclaration . kind ( this . modifiers ) ) { case TypeDeclaration . CLASS_DECL : buffer . append ( "<STR_LIT>" ) ; break ; case TypeDeclaration . INTERFACE_DECL : buffer . append ( "<STR_LIT>" ) ; break ; case TypeDeclaration . ENUM_DECL : buffer . append ( "<STR_LIT>" ) ; break ; } if ( this . name != null ) { buffer . append ( this . name ) ; } if ( this . superclass != null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . superclass ) ; } int length ; if ( this . superInterfaces != null && ( length = this . superInterfaces . length ) != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { buffer . append ( this . superInterfaces [ i ] ) ; if ( i != length - <NUM_LIT:1> ) { buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Hashtable ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . ISafeRunnable ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . SafeRunner ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . core . search . SearchEngine ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class TypeHierarchy implements ITypeHierarchy , IElementChangedListener { public static boolean DEBUG = false ; static final byte VERSION = <NUM_LIT> ; static final byte SEPARATOR1 = '<STR_LIT:\n>' ; static final byte SEPARATOR2 = '<CHAR_LIT:U+002C>' ; static final byte SEPARATOR3 = '<CHAR_LIT:>>' ; static final byte SEPARATOR4 = '<STR_LIT>' ; static final byte COMPUTE_SUBTYPES = <NUM_LIT> ; static final byte CLASS = <NUM_LIT> ; static final byte INTERFACE = <NUM_LIT> ; static final byte COMPUTED_FOR = <NUM_LIT> ; static final byte ROOT = <NUM_LIT> ; static final byte [ ] NO_FLAGS = new byte [ ] { } ; static final int SIZE = <NUM_LIT:10> ; protected IJavaProject project ; protected IType focusType ; protected ICompilationUnit [ ] workingCopies ; protected Map classToSuperclass ; protected Map typeToSuperInterfaces ; protected Map typeToSubtypes ; protected Map typeFlags ; protected TypeVector rootClasses = new TypeVector ( ) ; protected ArrayList interfaces = new ArrayList ( <NUM_LIT:10> ) ; public ArrayList missingTypes = new ArrayList ( <NUM_LIT:4> ) ; protected static final IType [ ] NO_TYPE = new IType [ <NUM_LIT:0> ] ; protected IProgressMonitor progressMonitor = null ; protected ArrayList changeListeners = null ; public Map files = null ; protected Region packageRegion = null ; protected Region projectRegion = null ; protected boolean computeSubtypes ; IJavaSearchScope scope ; public boolean needsRefresh = true ; protected ChangeCollector changeCollector ; public TypeHierarchy ( ) { } public TypeHierarchy ( IType type , ICompilationUnit [ ] workingCopies , IJavaProject project , boolean computeSubtypes ) { this ( type , workingCopies , SearchEngine . createJavaSearchScope ( new IJavaElement [ ] { project } ) , computeSubtypes ) ; this . project = project ; } public TypeHierarchy ( IType type , ICompilationUnit [ ] workingCopies , IJavaSearchScope scope , boolean computeSubtypes ) { this . focusType = type == null ? null : ( IType ) ( ( JavaElement ) type ) . unresolved ( ) ; this . workingCopies = workingCopies ; this . computeSubtypes = computeSubtypes ; this . scope = scope ; } protected void initializeRegions ( ) { IType [ ] allTypes = getAllTypes ( ) ; for ( int i = <NUM_LIT:0> ; i < allTypes . length ; i ++ ) { IType type = allTypes [ i ] ; Openable o = ( Openable ) ( ( JavaElement ) type ) . getOpenableParent ( ) ; if ( o != null ) { ArrayList types = ( ArrayList ) this . files . get ( o ) ; if ( types == null ) { types = new ArrayList ( ) ; this . files . put ( o , types ) ; } types . add ( type ) ; } IPackageFragment pkg = type . getPackageFragment ( ) ; this . packageRegion . add ( pkg ) ; IJavaProject declaringProject = type . getJavaProject ( ) ; if ( declaringProject != null ) { this . projectRegion . add ( declaringProject ) ; } checkCanceled ( ) ; } } private void addAllCheckingDuplicates ( ArrayList list , IType [ ] collection ) { for ( int i = <NUM_LIT:0> ; i < collection . length ; i ++ ) { IType element = collection [ i ] ; if ( ! list . contains ( element ) ) { list . add ( element ) ; } } } protected void addInterface ( IType type ) { this . interfaces . add ( type ) ; } protected void addRootClass ( IType type ) { if ( this . rootClasses . contains ( type ) ) return ; this . rootClasses . add ( type ) ; } protected void addSubtype ( IType type , IType subtype ) { TypeVector subtypes = ( TypeVector ) this . typeToSubtypes . get ( type ) ; if ( subtypes == null ) { subtypes = new TypeVector ( ) ; this . typeToSubtypes . put ( type , subtypes ) ; } if ( ! subtypes . contains ( subtype ) ) { subtypes . add ( subtype ) ; } } public synchronized void addTypeHierarchyChangedListener ( ITypeHierarchyChangedListener listener ) { ArrayList listeners = this . changeListeners ; if ( listeners == null ) { this . changeListeners = listeners = new ArrayList ( ) ; } if ( listeners . size ( ) == <NUM_LIT:0> ) { JavaCore . addElementChangedListener ( this ) ; } if ( listeners . indexOf ( listener ) == - <NUM_LIT:1> ) { listeners . add ( listener ) ; } } private static Integer bytesToFlags ( byte [ ] bytes ) { if ( bytes != null && bytes . length > <NUM_LIT:0> ) { return new Integer ( new String ( bytes ) ) ; } else { return null ; } } public void cacheFlags ( IType type , int flags ) { this . typeFlags . put ( type , new Integer ( flags ) ) ; } protected void cacheSuperclass ( IType type , IType superclass ) { if ( superclass != null ) { this . classToSuperclass . put ( type , superclass ) ; addSubtype ( superclass , type ) ; } } protected void cacheSuperInterfaces ( IType type , IType [ ] superinterfaces ) { this . typeToSuperInterfaces . put ( type , superinterfaces ) ; for ( int i = <NUM_LIT:0> ; i < superinterfaces . length ; i ++ ) { IType superinterface = superinterfaces [ i ] ; if ( superinterface != null ) { addSubtype ( superinterface , type ) ; } } } protected void checkCanceled ( ) { if ( this . progressMonitor != null && this . progressMonitor . isCanceled ( ) ) { throw new OperationCanceledException ( ) ; } } protected void compute ( ) throws JavaModelException , CoreException { if ( this . focusType != null ) { HierarchyBuilder builder = new IndexBasedHierarchyBuilder ( this , this . scope ) ; builder . build ( this . computeSubtypes ) ; } } public boolean contains ( IType type ) { if ( this . classToSuperclass . get ( type ) != null ) { return true ; } if ( this . rootClasses . contains ( type ) ) return true ; if ( this . interfaces . contains ( type ) ) return true ; return false ; } public void elementChanged ( ElementChangedEvent event ) { if ( this . needsRefresh ) return ; if ( isAffected ( event . getDelta ( ) , event . getType ( ) ) ) { this . needsRefresh = true ; fireChange ( ) ; } } public boolean exists ( ) { if ( ! this . needsRefresh ) return true ; return ( this . focusType == null || this . focusType . exists ( ) ) && javaProject ( ) . exists ( ) ; } public void fireChange ( ) { ArrayList listeners = getClonedChangeListeners ( ) ; if ( listeners == null ) { return ; } if ( DEBUG ) { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT:]>" ) ; if ( this . focusType != null ) { System . out . println ( "<STR_LIT>" + ( ( JavaElement ) this . focusType ) . toStringWithAncestors ( ) ) ; } } for ( int i = <NUM_LIT:0> ; i < listeners . size ( ) ; i ++ ) { final ITypeHierarchyChangedListener listener = ( ITypeHierarchyChangedListener ) listeners . get ( i ) ; SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { listener . typeHierarchyChanged ( TypeHierarchy . this ) ; } } ) ; } } private synchronized ArrayList getClonedChangeListeners ( ) { ArrayList listeners = this . changeListeners ; if ( listeners == null ) { return null ; } return ( ArrayList ) listeners . clone ( ) ; } private static byte [ ] flagsToBytes ( Integer flags ) { if ( flags != null ) { return flags . toString ( ) . getBytes ( ) ; } else { return NO_FLAGS ; } } public IType [ ] getAllClasses ( ) { TypeVector classes = this . rootClasses . copy ( ) ; for ( Iterator iter = this . classToSuperclass . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { classes . add ( ( IType ) iter . next ( ) ) ; } return classes . elements ( ) ; } public IType [ ] getAllInterfaces ( ) { IType [ ] collection = new IType [ this . interfaces . size ( ) ] ; this . interfaces . toArray ( collection ) ; return collection ; } public IType [ ] getAllSubtypes ( IType type ) { return getAllSubtypesForType ( type ) ; } private IType [ ] getAllSubtypesForType ( IType type ) { ArrayList subTypes = new ArrayList ( ) ; getAllSubtypesForType0 ( type , subTypes ) ; IType [ ] subClasses = new IType [ subTypes . size ( ) ] ; subTypes . toArray ( subClasses ) ; return subClasses ; } private void getAllSubtypesForType0 ( IType type , ArrayList subs ) { IType [ ] subTypes = getSubtypesForType ( type ) ; if ( subTypes . length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < subTypes . length ; i ++ ) { IType subType = subTypes [ i ] ; subs . add ( subType ) ; getAllSubtypesForType0 ( subType , subs ) ; } } } public IType [ ] getAllSuperclasses ( IType type ) { IType superclass = getSuperclass ( type ) ; TypeVector supers = new TypeVector ( ) ; while ( superclass != null ) { supers . add ( superclass ) ; superclass = getSuperclass ( superclass ) ; } return supers . elements ( ) ; } public IType [ ] getAllSuperInterfaces ( IType type ) { ArrayList supers = getAllSuperInterfaces0 ( type , null ) ; if ( supers == null ) return NO_TYPE ; IType [ ] superinterfaces = new IType [ supers . size ( ) ] ; supers . toArray ( superinterfaces ) ; return superinterfaces ; } private ArrayList getAllSuperInterfaces0 ( IType type , ArrayList supers ) { IType [ ] superinterfaces = ( IType [ ] ) this . typeToSuperInterfaces . get ( type ) ; if ( superinterfaces == null ) return supers ; if ( superinterfaces . length != <NUM_LIT:0> ) { if ( supers == null ) supers = new ArrayList ( ) ; addAllCheckingDuplicates ( supers , superinterfaces ) ; for ( int i = <NUM_LIT:0> ; i < superinterfaces . length ; i ++ ) { supers = getAllSuperInterfaces0 ( superinterfaces [ i ] , supers ) ; } } IType superclass = ( IType ) this . classToSuperclass . get ( type ) ; if ( superclass != null ) { supers = getAllSuperInterfaces0 ( superclass , supers ) ; } return supers ; } public IType [ ] getAllSupertypes ( IType type ) { ArrayList supers = getAllSupertypes0 ( type , null ) ; if ( supers == null ) return NO_TYPE ; IType [ ] supertypes = new IType [ supers . size ( ) ] ; supers . toArray ( supertypes ) ; return supertypes ; } private ArrayList getAllSupertypes0 ( IType type , ArrayList supers ) { IType [ ] superinterfaces = ( IType [ ] ) this . typeToSuperInterfaces . get ( type ) ; if ( superinterfaces == null ) return supers ; if ( superinterfaces . length != <NUM_LIT:0> ) { if ( supers == null ) supers = new ArrayList ( ) ; addAllCheckingDuplicates ( supers , superinterfaces ) ; for ( int i = <NUM_LIT:0> ; i < superinterfaces . length ; i ++ ) { supers = getAllSuperInterfaces0 ( superinterfaces [ i ] , supers ) ; } } IType superclass = ( IType ) this . classToSuperclass . get ( type ) ; if ( superclass != null ) { if ( supers == null ) supers = new ArrayList ( ) ; supers . add ( superclass ) ; supers = getAllSupertypes0 ( superclass , supers ) ; } return supers ; } public IType [ ] getAllTypes ( ) { IType [ ] classes = getAllClasses ( ) ; int classesLength = classes . length ; IType [ ] allInterfaces = getAllInterfaces ( ) ; int interfacesLength = allInterfaces . length ; IType [ ] all = new IType [ classesLength + interfacesLength ] ; System . arraycopy ( classes , <NUM_LIT:0> , all , <NUM_LIT:0> , classesLength ) ; System . arraycopy ( allInterfaces , <NUM_LIT:0> , all , classesLength , interfacesLength ) ; return all ; } public int getCachedFlags ( IType type ) { Integer flagObject = ( Integer ) this . typeFlags . get ( type ) ; if ( flagObject != null ) { return flagObject . intValue ( ) ; } return - <NUM_LIT:1> ; } public IType [ ] getExtendingInterfaces ( IType type ) { if ( ! isInterface ( type ) ) return NO_TYPE ; return getExtendingInterfaces0 ( type ) ; } private IType [ ] getExtendingInterfaces0 ( IType extendedInterface ) { Iterator iter = this . typeToSuperInterfaces . entrySet ( ) . iterator ( ) ; ArrayList interfaceList = new ArrayList ( ) ; while ( iter . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; IType type = ( IType ) entry . getKey ( ) ; if ( ! isInterface ( type ) ) { continue ; } IType [ ] superInterfaces = ( IType [ ] ) entry . getValue ( ) ; if ( superInterfaces != null ) { for ( int i = <NUM_LIT:0> ; i < superInterfaces . length ; i ++ ) { IType superInterface = superInterfaces [ i ] ; if ( superInterface . equals ( extendedInterface ) ) { interfaceList . add ( type ) ; } } } } IType [ ] extendingInterfaces = new IType [ interfaceList . size ( ) ] ; interfaceList . toArray ( extendingInterfaces ) ; return extendingInterfaces ; } public IType [ ] getImplementingClasses ( IType type ) { if ( ! isInterface ( type ) ) { return NO_TYPE ; } return getImplementingClasses0 ( type ) ; } private IType [ ] getImplementingClasses0 ( IType interfce ) { Iterator iter = this . typeToSuperInterfaces . entrySet ( ) . iterator ( ) ; ArrayList iMenters = new ArrayList ( ) ; while ( iter . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; IType type = ( IType ) entry . getKey ( ) ; if ( isInterface ( type ) ) { continue ; } IType [ ] types = ( IType [ ] ) entry . getValue ( ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { IType iFace = types [ i ] ; if ( iFace . equals ( interfce ) ) { iMenters . add ( type ) ; } } } IType [ ] implementers = new IType [ iMenters . size ( ) ] ; iMenters . toArray ( implementers ) ; return implementers ; } public IType [ ] getRootClasses ( ) { return this . rootClasses . elements ( ) ; } public IType [ ] getRootInterfaces ( ) { IType [ ] allInterfaces = getAllInterfaces ( ) ; IType [ ] roots = new IType [ allInterfaces . length ] ; int rootNumber = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < allInterfaces . length ; i ++ ) { IType [ ] superInterfaces = getSuperInterfaces ( allInterfaces [ i ] ) ; if ( superInterfaces == null || superInterfaces . length == <NUM_LIT:0> ) { roots [ rootNumber ++ ] = allInterfaces [ i ] ; } } IType [ ] result = new IType [ rootNumber ] ; if ( result . length > <NUM_LIT:0> ) { System . arraycopy ( roots , <NUM_LIT:0> , result , <NUM_LIT:0> , rootNumber ) ; } return result ; } public IType [ ] getSubclasses ( IType type ) { if ( isInterface ( type ) ) { return NO_TYPE ; } TypeVector vector = ( TypeVector ) this . typeToSubtypes . get ( type ) ; if ( vector == null ) return NO_TYPE ; else return vector . elements ( ) ; } public IType [ ] getSubtypes ( IType type ) { return getSubtypesForType ( type ) ; } private IType [ ] getSubtypesForType ( IType type ) { TypeVector vector = ( TypeVector ) this . typeToSubtypes . get ( type ) ; if ( vector == null ) return NO_TYPE ; else return vector . elements ( ) ; } public IType getSuperclass ( IType type ) { if ( isInterface ( type ) ) { return null ; } return ( IType ) this . classToSuperclass . get ( type ) ; } public IType [ ] getSuperInterfaces ( IType type ) { IType [ ] types = ( IType [ ] ) this . typeToSuperInterfaces . get ( type ) ; if ( types == null ) { return NO_TYPE ; } return types ; } public IType [ ] getSupertypes ( IType type ) { IType superclass = getSuperclass ( type ) ; if ( superclass == null ) { return getSuperInterfaces ( type ) ; } else { TypeVector superTypes = new TypeVector ( getSuperInterfaces ( type ) ) ; superTypes . add ( superclass ) ; return superTypes . elements ( ) ; } } public IType getType ( ) { return this . focusType ; } protected IType [ ] growAndAddToArray ( IType [ ] array , IType [ ] additions ) { if ( array == null || array . length == <NUM_LIT:0> ) { return additions ; } IType [ ] old = array ; array = new IType [ old . length + additions . length ] ; System . arraycopy ( old , <NUM_LIT:0> , array , <NUM_LIT:0> , old . length ) ; System . arraycopy ( additions , <NUM_LIT:0> , array , old . length , additions . length ) ; return array ; } protected IType [ ] growAndAddToArray ( IType [ ] array , IType addition ) { if ( array == null || array . length == <NUM_LIT:0> ) { return new IType [ ] { addition } ; } IType [ ] old = array ; array = new IType [ old . length + <NUM_LIT:1> ] ; System . arraycopy ( old , <NUM_LIT:0> , array , <NUM_LIT:0> , old . length ) ; array [ old . length ] = addition ; return array ; } public boolean hasFineGrainChanges ( ) { ChangeCollector collector = this . changeCollector ; return collector != null && collector . needsRefresh ( ) ; } private boolean hasSubtypeNamed ( String simpleName ) { if ( this . focusType != null && this . focusType . getElementName ( ) . equals ( simpleName ) ) { return true ; } IType [ ] types = this . focusType == null ? getAllTypes ( ) : getAllSubtypes ( this . focusType ) ; for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { if ( types [ i ] . getElementName ( ) . equals ( simpleName ) ) { return true ; } } return false ; } private boolean hasTypeNamed ( String simpleName ) { IType [ ] types = getAllTypes ( ) ; for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { if ( types [ i ] . getElementName ( ) . equals ( simpleName ) ) { return true ; } } return false ; } boolean includesTypeOrSupertype ( IType type ) { try { if ( hasTypeNamed ( type . getElementName ( ) ) ) return true ; String superclassName = type . getSuperclassName ( ) ; if ( superclassName != null ) { int lastSeparator = superclassName . lastIndexOf ( '<CHAR_LIT:.>' ) ; String simpleName = superclassName . substring ( lastSeparator + <NUM_LIT:1> ) ; if ( hasTypeNamed ( simpleName ) ) return true ; } String [ ] superinterfaceNames = type . getSuperInterfaceNames ( ) ; if ( superinterfaceNames != null ) { for ( int i = <NUM_LIT:0> , length = superinterfaceNames . length ; i < length ; i ++ ) { String superinterfaceName = superinterfaceNames [ i ] ; int lastSeparator = superinterfaceName . lastIndexOf ( '<CHAR_LIT:.>' ) ; String simpleName = superinterfaceName . substring ( lastSeparator + <NUM_LIT:1> ) ; if ( hasTypeNamed ( simpleName ) ) return true ; } } } catch ( JavaModelException e ) { } return false ; } protected void initialize ( int size ) { if ( size < <NUM_LIT:10> ) { size = <NUM_LIT:10> ; } int smallSize = ( size / <NUM_LIT:2> ) ; this . classToSuperclass = new HashMap ( size ) ; this . interfaces = new ArrayList ( smallSize ) ; this . missingTypes = new ArrayList ( smallSize ) ; this . rootClasses = new TypeVector ( ) ; this . typeToSubtypes = new HashMap ( smallSize ) ; this . typeToSuperInterfaces = new HashMap ( smallSize ) ; this . typeFlags = new HashMap ( smallSize ) ; this . projectRegion = new Region ( ) ; this . packageRegion = new Region ( ) ; this . files = new HashMap ( <NUM_LIT:5> ) ; } public synchronized boolean isAffected ( IJavaElementDelta delta , int eventType ) { IJavaElement element = delta . getElement ( ) ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return isAffectedByJavaModel ( delta , element , eventType ) ; case IJavaElement . JAVA_PROJECT : return isAffectedByJavaProject ( delta , element , eventType ) ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return isAffectedByPackageFragmentRoot ( delta , element , eventType ) ; case IJavaElement . PACKAGE_FRAGMENT : return isAffectedByPackageFragment ( delta , ( PackageFragment ) element , eventType ) ; case IJavaElement . CLASS_FILE : case IJavaElement . COMPILATION_UNIT : return isAffectedByOpenable ( delta , element , eventType ) ; } return false ; } private boolean isAffectedByChildren ( IJavaElementDelta delta , int eventType ) { if ( ( delta . getFlags ( ) & IJavaElementDelta . F_CHILDREN ) > <NUM_LIT:0> ) { IJavaElementDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { if ( isAffected ( children [ i ] , eventType ) ) { return true ; } } } return false ; } private boolean isAffectedByJavaModel ( IJavaElementDelta delta , IJavaElement element , int eventType ) { switch ( delta . getKind ( ) ) { case IJavaElementDelta . ADDED : case IJavaElementDelta . REMOVED : return element . equals ( javaProject ( ) . getJavaModel ( ) ) ; case IJavaElementDelta . CHANGED : return isAffectedByChildren ( delta , eventType ) ; } return false ; } private boolean isAffectedByJavaProject ( IJavaElementDelta delta , IJavaElement element , int eventType ) { int kind = delta . getKind ( ) ; int flags = delta . getFlags ( ) ; if ( ( flags & IJavaElementDelta . F_OPENED ) != <NUM_LIT:0> ) { kind = IJavaElementDelta . ADDED ; } if ( ( flags & IJavaElementDelta . F_CLOSED ) != <NUM_LIT:0> ) { kind = IJavaElementDelta . REMOVED ; } switch ( kind ) { case IJavaElementDelta . ADDED : try { IClasspathEntry [ ] classpath = ( ( JavaProject ) javaProject ( ) ) . getExpandedClasspath ( ) ; for ( int i = <NUM_LIT:0> ; i < classpath . length ; i ++ ) { if ( classpath [ i ] . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT && classpath [ i ] . getPath ( ) . equals ( element . getPath ( ) ) ) { return true ; } } if ( this . focusType != null ) { classpath = ( ( JavaProject ) element ) . getExpandedClasspath ( ) ; IPath hierarchyProject = javaProject ( ) . getPath ( ) ; for ( int i = <NUM_LIT:0> ; i < classpath . length ; i ++ ) { if ( classpath [ i ] . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT && classpath [ i ] . getPath ( ) . equals ( hierarchyProject ) ) { return true ; } } } return false ; } catch ( JavaModelException e ) { return false ; } case IJavaElementDelta . REMOVED : IJavaElement [ ] pkgs = this . packageRegion . getElements ( ) ; for ( int i = <NUM_LIT:0> ; i < pkgs . length ; i ++ ) { IJavaProject javaProject = pkgs [ i ] . getJavaProject ( ) ; if ( javaProject != null && javaProject . equals ( element ) ) { return true ; } } return false ; case IJavaElementDelta . CHANGED : return isAffectedByChildren ( delta , eventType ) ; } return false ; } private boolean isAffectedByPackageFragment ( IJavaElementDelta delta , PackageFragment element , int eventType ) { switch ( delta . getKind ( ) ) { case IJavaElementDelta . ADDED : return this . projectRegion . contains ( element ) ; case IJavaElementDelta . REMOVED : return packageRegionContainsSamePackageFragment ( element ) ; case IJavaElementDelta . CHANGED : return isAffectedByChildren ( delta , eventType ) ; } return false ; } private boolean isAffectedByPackageFragmentRoot ( IJavaElementDelta delta , IJavaElement element , int eventType ) { switch ( delta . getKind ( ) ) { case IJavaElementDelta . ADDED : return this . projectRegion . contains ( element ) ; case IJavaElementDelta . REMOVED : case IJavaElementDelta . CHANGED : int flags = delta . getFlags ( ) ; if ( ( flags & IJavaElementDelta . F_ADDED_TO_CLASSPATH ) > <NUM_LIT:0> ) { if ( this . projectRegion != null ) { IPackageFragmentRoot root = ( IPackageFragmentRoot ) element ; IPath rootPath = root . getPath ( ) ; IJavaElement [ ] elements = this . projectRegion . getElements ( ) ; for ( int i = <NUM_LIT:0> ; i < elements . length ; i ++ ) { JavaProject javaProject = ( JavaProject ) elements [ i ] ; try { IClasspathEntry entry = javaProject . getClasspathEntryFor ( rootPath ) ; if ( entry != null ) { return true ; } } catch ( JavaModelException e ) { } } } } if ( ( flags & IJavaElementDelta . F_REMOVED_FROM_CLASSPATH ) > <NUM_LIT:0> || ( flags & IJavaElementDelta . F_CONTENT ) > <NUM_LIT:0> ) { IJavaElement [ ] pkgs = this . packageRegion . getElements ( ) ; for ( int i = <NUM_LIT:0> ; i < pkgs . length ; i ++ ) { if ( pkgs [ i ] . getParent ( ) . equals ( element ) ) { return true ; } } return false ; } } return isAffectedByChildren ( delta , eventType ) ; } protected boolean isAffectedByOpenable ( IJavaElementDelta delta , IJavaElement element , int eventType ) { if ( element instanceof CompilationUnit ) { CompilationUnit cu = ( CompilationUnit ) element ; ICompilationUnit focusCU = this . focusType != null ? this . focusType . getCompilationUnit ( ) : null ; if ( focusCU != null && focusCU . getOwner ( ) != cu . getOwner ( ) ) return false ; if ( eventType != ElementChangedEvent . POST_RECONCILE && ! cu . isPrimary ( ) && delta . getKind ( ) == IJavaElementDelta . ADDED ) return false ; ChangeCollector collector = this . changeCollector ; if ( collector == null ) { collector = new ChangeCollector ( this ) ; } try { collector . addChange ( cu , delta ) ; } catch ( JavaModelException e ) { if ( DEBUG ) e . printStackTrace ( ) ; } if ( cu . isWorkingCopy ( ) && eventType == ElementChangedEvent . POST_RECONCILE ) { this . changeCollector = collector ; return false ; } else { return collector . needsRefresh ( ) ; } } else if ( element instanceof ClassFile ) { switch ( delta . getKind ( ) ) { case IJavaElementDelta . REMOVED : return this . files . get ( element ) != null ; case IJavaElementDelta . ADDED : IType type = ( ( ClassFile ) element ) . getType ( ) ; String typeName = type . getElementName ( ) ; if ( hasSupertype ( typeName ) || subtypesIncludeSupertypeOf ( type ) || this . missingTypes . contains ( typeName ) ) { return true ; } break ; case IJavaElementDelta . CHANGED : IJavaElementDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { IJavaElementDelta child = children [ i ] ; IJavaElement childElement = child . getElement ( ) ; if ( childElement instanceof IType ) { type = ( IType ) childElement ; boolean hasVisibilityChange = ( delta . getFlags ( ) & IJavaElementDelta . F_MODIFIERS ) > <NUM_LIT:0> ; boolean hasSupertypeChange = ( delta . getFlags ( ) & IJavaElementDelta . F_SUPER_TYPES ) > <NUM_LIT:0> ; if ( ( hasVisibilityChange && hasSupertype ( type . getElementName ( ) ) ) || ( hasSupertypeChange && includesTypeOrSupertype ( type ) ) ) { return true ; } } } break ; } } return false ; } private boolean isInterface ( IType type ) { int flags = getCachedFlags ( type ) ; if ( flags == - <NUM_LIT:1> ) { try { return type . isInterface ( ) ; } catch ( JavaModelException e ) { return false ; } } else { return Flags . isInterface ( flags ) ; } } public IJavaProject javaProject ( ) { return this . focusType . getJavaProject ( ) ; } protected static byte [ ] readUntil ( InputStream input , byte separator ) throws JavaModelException , IOException { return readUntil ( input , separator , <NUM_LIT:0> ) ; } protected static byte [ ] readUntil ( InputStream input , byte separator , int offset ) throws IOException , JavaModelException { int length = <NUM_LIT:0> ; byte [ ] bytes = new byte [ SIZE ] ; byte b ; while ( ( b = ( byte ) input . read ( ) ) != separator && b != - <NUM_LIT:1> ) { if ( bytes . length == length ) { System . arraycopy ( bytes , <NUM_LIT:0> , bytes = new byte [ length * <NUM_LIT:2> ] , <NUM_LIT:0> , length ) ; } bytes [ length ++ ] = b ; } if ( b == - <NUM_LIT:1> ) { throw new JavaModelException ( new JavaModelStatus ( IStatus . ERROR ) ) ; } System . arraycopy ( bytes , <NUM_LIT:0> , bytes = new byte [ length + offset ] , offset , length ) ; return bytes ; } public static ITypeHierarchy load ( IType type , InputStream input , WorkingCopyOwner owner ) throws JavaModelException { try { TypeHierarchy typeHierarchy = new TypeHierarchy ( ) ; typeHierarchy . initialize ( <NUM_LIT:1> ) ; IType [ ] types = new IType [ SIZE ] ; int typeCount = <NUM_LIT:0> ; byte version = ( byte ) input . read ( ) ; if ( version != VERSION ) { throw new JavaModelException ( new JavaModelStatus ( IStatus . ERROR ) ) ; } byte generalInfo = ( byte ) input . read ( ) ; if ( ( generalInfo & COMPUTE_SUBTYPES ) != <NUM_LIT:0> ) { typeHierarchy . computeSubtypes = true ; } byte b ; byte [ ] bytes ; bytes = readUntil ( input , SEPARATOR1 ) ; if ( bytes . length > <NUM_LIT:0> ) { typeHierarchy . project = ( IJavaProject ) JavaCore . create ( new String ( bytes ) ) ; typeHierarchy . scope = SearchEngine . createJavaSearchScope ( new IJavaElement [ ] { typeHierarchy . project } ) ; } else { typeHierarchy . project = null ; typeHierarchy . scope = SearchEngine . createWorkspaceScope ( ) ; } { bytes = readUntil ( input , SEPARATOR1 ) ; byte [ ] missing ; int j = <NUM_LIT:0> ; int length = bytes . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { b = bytes [ i ] ; if ( b == SEPARATOR2 ) { missing = new byte [ i - j ] ; System . arraycopy ( bytes , j , missing , <NUM_LIT:0> , i - j ) ; typeHierarchy . missingTypes . add ( new String ( missing ) ) ; j = i + <NUM_LIT:1> ; } } System . arraycopy ( bytes , j , missing = new byte [ length - j ] , <NUM_LIT:0> , length - j ) ; typeHierarchy . missingTypes . add ( new String ( missing ) ) ; } while ( ( b = ( byte ) input . read ( ) ) != SEPARATOR1 && b != - <NUM_LIT:1> ) { bytes = readUntil ( input , SEPARATOR4 , <NUM_LIT:1> ) ; bytes [ <NUM_LIT:0> ] = b ; IType element = ( IType ) JavaCore . create ( new String ( bytes ) , owner ) ; if ( types . length == typeCount ) { System . arraycopy ( types , <NUM_LIT:0> , types = new IType [ typeCount * <NUM_LIT:2> ] , <NUM_LIT:0> , typeCount ) ; } types [ typeCount ++ ] = element ; bytes = readUntil ( input , SEPARATOR4 ) ; Integer flags = bytesToFlags ( bytes ) ; if ( flags != null ) { typeHierarchy . cacheFlags ( element , flags . intValue ( ) ) ; } byte info = ( byte ) input . read ( ) ; if ( ( info & INTERFACE ) != <NUM_LIT:0> ) { typeHierarchy . addInterface ( element ) ; } if ( ( info & COMPUTED_FOR ) != <NUM_LIT:0> ) { if ( ! element . equals ( type ) ) { throw new JavaModelException ( new JavaModelStatus ( IStatus . ERROR ) ) ; } typeHierarchy . focusType = element ; } if ( ( info & ROOT ) != <NUM_LIT:0> ) { typeHierarchy . addRootClass ( element ) ; } } while ( ( b = ( byte ) input . read ( ) ) != SEPARATOR1 && b != - <NUM_LIT:1> ) { bytes = readUntil ( input , SEPARATOR3 , <NUM_LIT:1> ) ; bytes [ <NUM_LIT:0> ] = b ; int subClass = new Integer ( new String ( bytes ) ) . intValue ( ) ; bytes = readUntil ( input , SEPARATOR1 ) ; int superClass = new Integer ( new String ( bytes ) ) . intValue ( ) ; typeHierarchy . cacheSuperclass ( types [ subClass ] , types [ superClass ] ) ; } while ( ( b = ( byte ) input . read ( ) ) != SEPARATOR1 && b != - <NUM_LIT:1> ) { bytes = readUntil ( input , SEPARATOR3 , <NUM_LIT:1> ) ; bytes [ <NUM_LIT:0> ] = b ; int subClass = new Integer ( new String ( bytes ) ) . intValue ( ) ; bytes = readUntil ( input , SEPARATOR1 ) ; IType [ ] superInterfaces = new IType [ ( bytes . length / <NUM_LIT:2> ) + <NUM_LIT:1> ] ; int interfaceCount = <NUM_LIT:0> ; int j = <NUM_LIT:0> ; byte [ ] b2 ; for ( int i = <NUM_LIT:0> ; i < bytes . length ; i ++ ) { if ( bytes [ i ] == SEPARATOR2 ) { b2 = new byte [ i - j ] ; System . arraycopy ( bytes , j , b2 , <NUM_LIT:0> , i - j ) ; j = i + <NUM_LIT:1> ; superInterfaces [ interfaceCount ++ ] = types [ new Integer ( new String ( b2 ) ) . intValue ( ) ] ; } } b2 = new byte [ bytes . length - j ] ; System . arraycopy ( bytes , j , b2 , <NUM_LIT:0> , bytes . length - j ) ; superInterfaces [ interfaceCount ++ ] = types [ new Integer ( new String ( b2 ) ) . intValue ( ) ] ; System . arraycopy ( superInterfaces , <NUM_LIT:0> , superInterfaces = new IType [ interfaceCount ] , <NUM_LIT:0> , interfaceCount ) ; typeHierarchy . cacheSuperInterfaces ( types [ subClass ] , superInterfaces ) ; } if ( b == - <NUM_LIT:1> ) { throw new JavaModelException ( new JavaModelStatus ( IStatus . ERROR ) ) ; } return typeHierarchy ; } catch ( IOException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . IO_EXCEPTION ) ; } } protected boolean packageRegionContainsSamePackageFragment ( PackageFragment element ) { IJavaElement [ ] pkgs = this . packageRegion . getElements ( ) ; for ( int i = <NUM_LIT:0> ; i < pkgs . length ; i ++ ) { PackageFragment pkg = ( PackageFragment ) pkgs [ i ] ; if ( Util . equalArraysOrNull ( pkg . names , element . names ) ) return true ; } return false ; } public synchronized void refresh ( IProgressMonitor monitor ) throws JavaModelException { try { this . progressMonitor = monitor ; if ( monitor != null ) { monitor . beginTask ( this . focusType != null ? Messages . bind ( Messages . hierarchy_creatingOnType , this . focusType . getFullyQualifiedName ( ) ) : Messages . hierarchy_creating , <NUM_LIT:100> ) ; } long start = - <NUM_LIT:1> ; if ( DEBUG ) { start = System . currentTimeMillis ( ) ; if ( this . computeSubtypes ) { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT:]>" ) ; } else { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT:]>" ) ; } if ( this . focusType != null ) { System . out . println ( "<STR_LIT>" + ( ( JavaElement ) this . focusType ) . toStringWithAncestors ( ) ) ; } } compute ( ) ; initializeRegions ( ) ; this . needsRefresh = false ; this . changeCollector = null ; if ( DEBUG ) { if ( this . computeSubtypes ) { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - start ) + "<STR_LIT>" ) ; } else { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - start ) + "<STR_LIT>" ) ; } System . out . println ( this . toString ( ) ) ; } } catch ( JavaModelException e ) { throw e ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } finally { if ( monitor != null ) { monitor . done ( ) ; } this . progressMonitor = null ; } } public synchronized void removeTypeHierarchyChangedListener ( ITypeHierarchyChangedListener listener ) { ArrayList listeners = this . changeListeners ; if ( listeners == null ) { return ; } listeners . remove ( listener ) ; if ( listeners . isEmpty ( ) ) { JavaCore . removeElementChangedListener ( this ) ; } } public void store ( OutputStream output , IProgressMonitor monitor ) throws JavaModelException { try { Hashtable hashtable = new Hashtable ( ) ; Hashtable hashtable2 = new Hashtable ( ) ; int count = <NUM_LIT:0> ; if ( this . focusType != null ) { Integer index = new Integer ( count ++ ) ; hashtable . put ( this . focusType , index ) ; hashtable2 . put ( index , this . focusType ) ; } Object [ ] types = this . classToSuperclass . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { Map . Entry entry = ( Map . Entry ) types [ i ] ; Object t = entry . getKey ( ) ; if ( hashtable . get ( t ) == null ) { Integer index = new Integer ( count ++ ) ; hashtable . put ( t , index ) ; hashtable2 . put ( index , t ) ; } Object superClass = entry . getValue ( ) ; if ( superClass != null && hashtable . get ( superClass ) == null ) { Integer index = new Integer ( count ++ ) ; hashtable . put ( superClass , index ) ; hashtable2 . put ( index , superClass ) ; } } types = this . typeToSuperInterfaces . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { Map . Entry entry = ( Map . Entry ) types [ i ] ; Object t = entry . getKey ( ) ; if ( hashtable . get ( t ) == null ) { Integer index = new Integer ( count ++ ) ; hashtable . put ( t , index ) ; hashtable2 . put ( index , t ) ; } Object [ ] sp = ( Object [ ] ) entry . getValue ( ) ; if ( sp != null ) { for ( int j = <NUM_LIT:0> ; j < sp . length ; j ++ ) { Object superInterface = sp [ j ] ; if ( sp [ j ] != null && hashtable . get ( superInterface ) == null ) { Integer index = new Integer ( count ++ ) ; hashtable . put ( superInterface , index ) ; hashtable2 . put ( index , superInterface ) ; } } } } output . write ( VERSION ) ; byte generalInfo = <NUM_LIT:0> ; if ( this . computeSubtypes ) { generalInfo |= COMPUTE_SUBTYPES ; } output . write ( generalInfo ) ; if ( this . project != null ) { output . write ( this . project . getHandleIdentifier ( ) . getBytes ( ) ) ; } output . write ( SEPARATOR1 ) ; for ( int i = <NUM_LIT:0> ; i < this . missingTypes . size ( ) ; i ++ ) { if ( i != <NUM_LIT:0> ) { output . write ( SEPARATOR2 ) ; } output . write ( ( ( String ) this . missingTypes . get ( i ) ) . getBytes ( ) ) ; } output . write ( SEPARATOR1 ) ; for ( int i = <NUM_LIT:0> ; i < count ; i ++ ) { IType t = ( IType ) hashtable2 . get ( new Integer ( i ) ) ; output . write ( t . getHandleIdentifier ( ) . getBytes ( ) ) ; output . write ( SEPARATOR4 ) ; output . write ( flagsToBytes ( ( Integer ) this . typeFlags . get ( t ) ) ) ; output . write ( SEPARATOR4 ) ; byte info = CLASS ; if ( this . focusType != null && this . focusType . equals ( t ) ) { info |= COMPUTED_FOR ; } if ( this . interfaces . contains ( t ) ) { info |= INTERFACE ; } if ( this . rootClasses . contains ( t ) ) { info |= ROOT ; } output . write ( info ) ; } output . write ( SEPARATOR1 ) ; types = this . classToSuperclass . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { Map . Entry entry = ( Map . Entry ) types [ i ] ; IJavaElement key = ( IJavaElement ) entry . getKey ( ) ; IJavaElement value = ( IJavaElement ) entry . getValue ( ) ; output . write ( ( ( Integer ) hashtable . get ( key ) ) . toString ( ) . getBytes ( ) ) ; output . write ( '<CHAR_LIT:>>' ) ; output . write ( ( ( Integer ) hashtable . get ( value ) ) . toString ( ) . getBytes ( ) ) ; output . write ( SEPARATOR1 ) ; } output . write ( SEPARATOR1 ) ; types = this . typeToSuperInterfaces . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { Map . Entry entry = ( Map . Entry ) types [ i ] ; IJavaElement key = ( IJavaElement ) entry . getKey ( ) ; IJavaElement [ ] values = ( IJavaElement [ ] ) entry . getValue ( ) ; if ( values . length > <NUM_LIT:0> ) { output . write ( ( ( Integer ) hashtable . get ( key ) ) . toString ( ) . getBytes ( ) ) ; output . write ( SEPARATOR3 ) ; for ( int j = <NUM_LIT:0> ; j < values . length ; j ++ ) { IJavaElement value = values [ j ] ; if ( j != <NUM_LIT:0> ) output . write ( SEPARATOR2 ) ; output . write ( ( ( Integer ) hashtable . get ( value ) ) . toString ( ) . getBytes ( ) ) ; } output . write ( SEPARATOR1 ) ; } } output . write ( SEPARATOR1 ) ; } catch ( IOException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . IO_EXCEPTION ) ; } } boolean subtypesIncludeSupertypeOf ( IType type ) { String superclassName = null ; try { superclassName = type . getSuperclassName ( ) ; } catch ( JavaModelException e ) { if ( DEBUG ) { e . printStackTrace ( ) ; } return false ; } if ( superclassName == null ) { superclassName = "<STR_LIT>" ; } int dot = - <NUM_LIT:1> ; String simpleSuper = ( dot = superclassName . lastIndexOf ( '<CHAR_LIT:.>' ) ) > - <NUM_LIT:1> ? superclassName . substring ( dot + <NUM_LIT:1> ) : superclassName ; if ( hasSubtypeNamed ( simpleSuper ) ) { return true ; } String [ ] interfaceNames = null ; try { interfaceNames = type . getSuperInterfaceNames ( ) ; } catch ( JavaModelException e ) { if ( DEBUG ) e . printStackTrace ( ) ; return false ; } for ( int i = <NUM_LIT:0> , length = interfaceNames . length ; i < length ; i ++ ) { dot = - <NUM_LIT:1> ; String interfaceName = interfaceNames [ i ] ; String simpleInterface = ( dot = interfaceName . lastIndexOf ( '<CHAR_LIT:.>' ) ) > - <NUM_LIT:1> ? interfaceName . substring ( dot ) : interfaceName ; if ( hasSubtypeNamed ( simpleInterface ) ) { return true ; } } return false ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; if ( this . focusType == null ) { buffer . append ( "<STR_LIT>" ) ; } else { toString ( buffer , this . focusType , <NUM_LIT:0> ) ; } if ( exists ( ) ) { if ( this . focusType != null ) { buffer . append ( "<STR_LIT>" ) ; toString ( buffer , this . focusType , <NUM_LIT:0> , true ) ; buffer . append ( "<STR_LIT>" ) ; toString ( buffer , this . focusType , <NUM_LIT:0> , false ) ; } else { if ( this . rootClasses . size > <NUM_LIT:0> ) { IJavaElement [ ] roots = Util . sortCopy ( getRootClasses ( ) ) ; buffer . append ( "<STR_LIT>" ) ; int length = roots . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IJavaElement root = roots [ i ] ; toString ( buffer , root , <NUM_LIT:1> ) ; toString ( buffer , root , <NUM_LIT:1> , true ) ; } buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IJavaElement root = roots [ i ] ; toString ( buffer , root , <NUM_LIT:1> ) ; toString ( buffer , root , <NUM_LIT:1> , false ) ; } } else if ( this . rootClasses . size == <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; } } } else { buffer . append ( "<STR_LIT>" ) ; } return buffer . toString ( ) ; } private void toString ( StringBuffer buffer , IJavaElement type , int indent , boolean ascendant ) { IType [ ] types = ascendant ? getSupertypes ( ( IType ) type ) : getSubtypes ( ( IType ) type ) ; IJavaElement [ ] sortedTypes = Util . sortCopy ( types ) ; for ( int i = <NUM_LIT:0> ; i < sortedTypes . length ; i ++ ) { toString ( buffer , sortedTypes [ i ] , indent + <NUM_LIT:1> ) ; toString ( buffer , sortedTypes [ i ] , indent + <NUM_LIT:1> , ascendant ) ; } } private void toString ( StringBuffer buffer , IJavaElement type , int indent ) { for ( int j = <NUM_LIT:0> ; j < indent ; j ++ ) { buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; } buffer . append ( ( ( JavaElement ) type ) . toStringWithAncestors ( false ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; } boolean hasSupertype ( String simpleName ) { for ( Iterator iter = this . classToSuperclass . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { IType superType = ( IType ) iter . next ( ) ; if ( superType . getElementName ( ) . equals ( simpleName ) ) { return true ; } } return false ; } protected void worked ( int work ) { if ( this . progressMonitor != null ) { this . progressMonitor . worked ( work ) ; checkCanceled ( ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . util . * ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . SimpleDelta ; public class ChangeCollector { HashMap changes = new HashMap ( ) ; TypeHierarchy hierarchy ; public ChangeCollector ( TypeHierarchy hierarchy ) { this . hierarchy = hierarchy ; } private void addAffectedChildren ( IJavaElementDelta delta ) throws JavaModelException { IJavaElementDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { IJavaElementDelta child = children [ i ] ; IJavaElement childElement = child . getElement ( ) ; switch ( childElement . getElementType ( ) ) { case IJavaElement . IMPORT_CONTAINER : addChange ( ( IImportContainer ) childElement , child ) ; break ; case IJavaElement . IMPORT_DECLARATION : addChange ( ( IImportDeclaration ) childElement , child ) ; break ; case IJavaElement . TYPE : addChange ( ( IType ) childElement , child ) ; break ; case IJavaElement . INITIALIZER : case IJavaElement . FIELD : case IJavaElement . METHOD : addChange ( ( IMember ) childElement , child ) ; break ; } } } public void addChange ( ICompilationUnit cu , IJavaElementDelta newDelta ) throws JavaModelException { int newKind = newDelta . getKind ( ) ; switch ( newKind ) { case IJavaElementDelta . ADDED : ArrayList allTypes = new ArrayList ( ) ; getAllTypesFromElement ( cu , allTypes ) ; for ( int i = <NUM_LIT:0> , length = allTypes . size ( ) ; i < length ; i ++ ) { IType type = ( IType ) allTypes . get ( i ) ; addTypeAddition ( type , ( SimpleDelta ) this . changes . get ( type ) ) ; } break ; case IJavaElementDelta . REMOVED : allTypes = new ArrayList ( ) ; getAllTypesFromHierarchy ( ( JavaElement ) cu , allTypes ) ; for ( int i = <NUM_LIT:0> , length = allTypes . size ( ) ; i < length ; i ++ ) { IType type = ( IType ) allTypes . get ( i ) ; addTypeRemoval ( type , ( SimpleDelta ) this . changes . get ( type ) ) ; } break ; case IJavaElementDelta . CHANGED : addAffectedChildren ( newDelta ) ; break ; } } private void addChange ( IImportContainer importContainer , IJavaElementDelta newDelta ) throws JavaModelException { int newKind = newDelta . getKind ( ) ; if ( newKind == IJavaElementDelta . CHANGED ) { addAffectedChildren ( newDelta ) ; return ; } SimpleDelta existingDelta = ( SimpleDelta ) this . changes . get ( importContainer ) ; if ( existingDelta != null ) { switch ( newKind ) { case IJavaElementDelta . ADDED : if ( existingDelta . getKind ( ) == IJavaElementDelta . REMOVED ) { this . changes . remove ( importContainer ) ; } break ; case IJavaElementDelta . REMOVED : if ( existingDelta . getKind ( ) == IJavaElementDelta . ADDED ) { this . changes . remove ( importContainer ) ; } break ; } } else { SimpleDelta delta = new SimpleDelta ( ) ; switch ( newKind ) { case IJavaElementDelta . ADDED : delta . added ( ) ; break ; case IJavaElementDelta . REMOVED : delta . removed ( ) ; break ; } this . changes . put ( importContainer , delta ) ; } } private void addChange ( IImportDeclaration importDecl , IJavaElementDelta newDelta ) { SimpleDelta existingDelta = ( SimpleDelta ) this . changes . get ( importDecl ) ; int newKind = newDelta . getKind ( ) ; if ( existingDelta != null ) { switch ( newKind ) { case IJavaElementDelta . ADDED : if ( existingDelta . getKind ( ) == IJavaElementDelta . REMOVED ) { this . changes . remove ( importDecl ) ; } break ; case IJavaElementDelta . REMOVED : if ( existingDelta . getKind ( ) == IJavaElementDelta . ADDED ) { this . changes . remove ( importDecl ) ; } break ; } } else { SimpleDelta delta = new SimpleDelta ( ) ; switch ( newKind ) { case IJavaElementDelta . ADDED : delta . added ( ) ; break ; case IJavaElementDelta . REMOVED : delta . removed ( ) ; break ; } this . changes . put ( importDecl , delta ) ; } } private void addChange ( IMember member , IJavaElementDelta newDelta ) throws JavaModelException { int newKind = newDelta . getKind ( ) ; switch ( newKind ) { case IJavaElementDelta . ADDED : ArrayList allTypes = new ArrayList ( ) ; getAllTypesFromElement ( member , allTypes ) ; for ( int i = <NUM_LIT:0> , length = allTypes . size ( ) ; i < length ; i ++ ) { IType innerType = ( IType ) allTypes . get ( i ) ; addTypeAddition ( innerType , ( SimpleDelta ) this . changes . get ( innerType ) ) ; } break ; case IJavaElementDelta . REMOVED : allTypes = new ArrayList ( ) ; getAllTypesFromHierarchy ( ( JavaElement ) member , allTypes ) ; for ( int i = <NUM_LIT:0> , length = allTypes . size ( ) ; i < length ; i ++ ) { IType type = ( IType ) allTypes . get ( i ) ; addTypeRemoval ( type , ( SimpleDelta ) this . changes . get ( type ) ) ; } break ; case IJavaElementDelta . CHANGED : addAffectedChildren ( newDelta ) ; break ; } } private void addChange ( IType type , IJavaElementDelta newDelta ) throws JavaModelException { int newKind = newDelta . getKind ( ) ; SimpleDelta existingDelta = ( SimpleDelta ) this . changes . get ( type ) ; switch ( newKind ) { case IJavaElementDelta . ADDED : addTypeAddition ( type , existingDelta ) ; ArrayList allTypes = new ArrayList ( ) ; getAllTypesFromElement ( type , allTypes ) ; for ( int i = <NUM_LIT:0> , length = allTypes . size ( ) ; i < length ; i ++ ) { IType innerType = ( IType ) allTypes . get ( i ) ; addTypeAddition ( innerType , ( SimpleDelta ) this . changes . get ( innerType ) ) ; } break ; case IJavaElementDelta . REMOVED : addTypeRemoval ( type , existingDelta ) ; allTypes = new ArrayList ( ) ; getAllTypesFromHierarchy ( ( JavaElement ) type , allTypes ) ; for ( int i = <NUM_LIT:0> , length = allTypes . size ( ) ; i < length ; i ++ ) { IType innerType = ( IType ) allTypes . get ( i ) ; addTypeRemoval ( innerType , ( SimpleDelta ) this . changes . get ( innerType ) ) ; } break ; case IJavaElementDelta . CHANGED : addTypeChange ( type , newDelta . getFlags ( ) , existingDelta ) ; addAffectedChildren ( newDelta ) ; break ; } } private void addTypeAddition ( IType type , SimpleDelta existingDelta ) throws JavaModelException { if ( existingDelta != null ) { switch ( existingDelta . getKind ( ) ) { case IJavaElementDelta . REMOVED : boolean hasChange = false ; if ( hasSuperTypeChange ( type ) ) { existingDelta . superTypes ( ) ; hasChange = true ; } if ( hasVisibilityChange ( type ) ) { existingDelta . modifiers ( ) ; hasChange = true ; } if ( ! hasChange ) { this . changes . remove ( type ) ; } break ; } } else { String typeName = type . getElementName ( ) ; if ( this . hierarchy . hasSupertype ( typeName ) || this . hierarchy . subtypesIncludeSupertypeOf ( type ) || this . hierarchy . missingTypes . contains ( typeName ) ) { SimpleDelta delta = new SimpleDelta ( ) ; delta . added ( ) ; this . changes . put ( type , delta ) ; } } } private void addTypeChange ( IType type , int newFlags , SimpleDelta existingDelta ) throws JavaModelException { if ( existingDelta != null ) { switch ( existingDelta . getKind ( ) ) { case IJavaElementDelta . CHANGED : int existingFlags = existingDelta . getFlags ( ) ; boolean hasChange = false ; if ( ( existingFlags & IJavaElementDelta . F_SUPER_TYPES ) != <NUM_LIT:0> && hasSuperTypeChange ( type ) ) { existingDelta . superTypes ( ) ; hasChange = true ; } if ( ( existingFlags & IJavaElementDelta . F_MODIFIERS ) != <NUM_LIT:0> && hasVisibilityChange ( type ) ) { existingDelta . modifiers ( ) ; hasChange = true ; } if ( ! hasChange ) { this . changes . remove ( type ) ; } break ; } } else { SimpleDelta typeDelta = null ; if ( ( newFlags & IJavaElementDelta . F_SUPER_TYPES ) != <NUM_LIT:0> && this . hierarchy . includesTypeOrSupertype ( type ) ) { typeDelta = new SimpleDelta ( ) ; typeDelta . superTypes ( ) ; } if ( ( newFlags & IJavaElementDelta . F_MODIFIERS ) != <NUM_LIT:0> && ( this . hierarchy . hasSupertype ( type . getElementName ( ) ) || type . equals ( this . hierarchy . focusType ) ) ) { if ( typeDelta == null ) { typeDelta = new SimpleDelta ( ) ; } typeDelta . modifiers ( ) ; } if ( typeDelta != null ) { this . changes . put ( type , typeDelta ) ; } } } private void addTypeRemoval ( IType type , SimpleDelta existingDelta ) { if ( existingDelta != null ) { switch ( existingDelta . getKind ( ) ) { case IJavaElementDelta . ADDED : this . changes . remove ( type ) ; break ; case IJavaElementDelta . CHANGED : existingDelta . removed ( ) ; break ; } } else { if ( this . hierarchy . contains ( type ) ) { SimpleDelta typeDelta = new SimpleDelta ( ) ; typeDelta . removed ( ) ; this . changes . put ( type , typeDelta ) ; } } } private void getAllTypesFromElement ( IJavaElement element , ArrayList allTypes ) throws JavaModelException { switch ( element . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : IType [ ] types = ( ( ICompilationUnit ) element ) . getTypes ( ) ; for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { IType type = types [ i ] ; allTypes . add ( type ) ; getAllTypesFromElement ( type , allTypes ) ; } break ; case IJavaElement . TYPE : types = ( ( IType ) element ) . getTypes ( ) ; for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { IType type = types [ i ] ; allTypes . add ( type ) ; getAllTypesFromElement ( type , allTypes ) ; } break ; case IJavaElement . INITIALIZER : case IJavaElement . FIELD : case IJavaElement . METHOD : IJavaElement [ ] children = ( ( IMember ) element ) . getChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { IType type = ( IType ) children [ i ] ; allTypes . add ( type ) ; getAllTypesFromElement ( type , allTypes ) ; } break ; } } private void getAllTypesFromHierarchy ( JavaElement element , ArrayList allTypes ) { switch ( element . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : ArrayList types = ( ArrayList ) this . hierarchy . files . get ( element ) ; if ( types != null ) { allTypes . addAll ( types ) ; } break ; case IJavaElement . TYPE : case IJavaElement . INITIALIZER : case IJavaElement . FIELD : case IJavaElement . METHOD : types = ( ArrayList ) this . hierarchy . files . get ( ( ( IMember ) element ) . getCompilationUnit ( ) ) ; if ( types != null ) { for ( int i = <NUM_LIT:0> , length = types . size ( ) ; i < length ; i ++ ) { IType type = ( IType ) types . get ( i ) ; if ( element . isAncestorOf ( type ) ) { allTypes . add ( type ) ; } } } break ; } } private boolean hasSuperTypeChange ( IType type ) throws JavaModelException { IType superclass = this . hierarchy . getSuperclass ( type ) ; String existingSuperclassName = superclass == null ? null : superclass . getElementName ( ) ; String newSuperclassName = type . getSuperclassName ( ) ; if ( existingSuperclassName != null && ! existingSuperclassName . equals ( newSuperclassName ) ) { return true ; } IType [ ] existingSuperInterfaces = this . hierarchy . getSuperInterfaces ( type ) ; String [ ] newSuperInterfaces = type . getSuperInterfaceNames ( ) ; if ( existingSuperInterfaces . length != newSuperInterfaces . length ) { return true ; } for ( int i = <NUM_LIT:0> , length = newSuperInterfaces . length ; i < length ; i ++ ) { String superInterfaceName = newSuperInterfaces [ i ] ; if ( ! superInterfaceName . equals ( newSuperInterfaces [ i ] ) ) { return true ; } } return false ; } private boolean hasVisibilityChange ( IType type ) throws JavaModelException { int existingFlags = this . hierarchy . getCachedFlags ( type ) ; int newFlags = type . getFlags ( ) ; return existingFlags != newFlags ; } public boolean needsRefresh ( ) { return this . changes . size ( ) != <NUM_LIT:0> ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; Iterator iterator = this . changes . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; buffer . append ( ( ( JavaElement ) entry . getKey ( ) ) . toDebugString ( ) ) ; buffer . append ( entry . getValue ( ) ) ; if ( iterator . hasNext ( ) ) { buffer . append ( '<STR_LIT:\n>' ) ; } } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . util . CompilerUtils ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . IGenericType ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . util . ResourceCompilationUnit ; import org . eclipse . jdt . internal . core . util . Util ; public abstract class HierarchyBuilder { protected TypeHierarchy hierarchy ; protected NameLookup nameLookup ; protected HierarchyResolver hierarchyResolver ; protected Map infoToHandle ; protected String focusQualifiedName ; public HierarchyBuilder ( TypeHierarchy hierarchy ) throws JavaModelException { this . hierarchy = hierarchy ; JavaProject project = ( JavaProject ) hierarchy . javaProject ( ) ; IType focusType = hierarchy . getType ( ) ; org . eclipse . jdt . core . ICompilationUnit unitToLookInside = focusType == null ? null : focusType . getCompilationUnit ( ) ; org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies = this . hierarchy . workingCopies ; org . eclipse . jdt . core . ICompilationUnit [ ] unitsToLookInside ; if ( unitToLookInside != null ) { int wcLength = workingCopies == null ? <NUM_LIT:0> : workingCopies . length ; if ( wcLength == <NUM_LIT:0> ) { unitsToLookInside = new org . eclipse . jdt . core . ICompilationUnit [ ] { unitToLookInside } ; } else { unitsToLookInside = new org . eclipse . jdt . core . ICompilationUnit [ wcLength + <NUM_LIT:1> ] ; unitsToLookInside [ <NUM_LIT:0> ] = unitToLookInside ; System . arraycopy ( workingCopies , <NUM_LIT:0> , unitsToLookInside , <NUM_LIT:1> , wcLength ) ; } } else { unitsToLookInside = workingCopies ; } if ( project != null ) { Map optionMap = project . getOptions ( true ) ; CompilerUtils . configureOptionsBasedOnNature ( optionMap , project ) ; SearchableEnvironment searchableEnvironment = project . newSearchableNameEnvironment ( unitsToLookInside ) ; this . nameLookup = searchableEnvironment . nameLookup ; this . hierarchyResolver = new HierarchyResolver ( searchableEnvironment , optionMap , this , new DefaultProblemFactory ( ) ) ; } this . infoToHandle = new HashMap ( <NUM_LIT:5> ) ; this . focusQualifiedName = focusType == null ? null : focusType . getFullyQualifiedName ( ) ; } public abstract void build ( boolean computeSubtypes ) throws JavaModelException , CoreException ; protected void buildSupertypes ( ) { IType focusType = getType ( ) ; if ( focusType == null ) return ; IGenericType type ; try { type = ( IGenericType ) ( ( JavaElement ) focusType ) . getElementInfo ( ) ; } catch ( JavaModelException e ) { return ; } this . hierarchyResolver . resolve ( type ) ; if ( ! this . hierarchy . contains ( focusType ) ) { this . hierarchy . addRootClass ( focusType ) ; } } public void connect ( IGenericType type , IType typeHandle , IType superclassHandle , IType [ ] superinterfaceHandles ) { if ( typeHandle == null ) return ; if ( TypeHierarchy . DEBUG ) { System . out . println ( "<STR_LIT>" + ( ( JavaElement ) typeHandle ) . toStringWithAncestors ( ) ) ; System . out . println ( "<STR_LIT>" + ( superclassHandle == null ? "<STR_LIT>" : ( ( JavaElement ) superclassHandle ) . toStringWithAncestors ( ) ) ) ; System . out . print ( "<STR_LIT>" ) ; if ( superinterfaceHandles == null || superinterfaceHandles . length == <NUM_LIT:0> ) { System . out . println ( "<STR_LIT>" ) ; } else { System . out . println ( ) ; for ( int i = <NUM_LIT:0> , length = superinterfaceHandles . length ; i < length ; i ++ ) { if ( superinterfaceHandles [ i ] == null ) continue ; System . out . println ( "<STR_LIT:U+0020U+0020U+0020U+0020>" + ( ( JavaElement ) superinterfaceHandles [ i ] ) . toStringWithAncestors ( ) ) ; } } } switch ( TypeDeclaration . kind ( type . getModifiers ( ) ) ) { case TypeDeclaration . CLASS_DECL : case TypeDeclaration . ENUM_DECL : if ( superclassHandle == null ) { this . hierarchy . addRootClass ( typeHandle ) ; } else { this . hierarchy . cacheSuperclass ( typeHandle , superclassHandle ) ; } break ; case TypeDeclaration . INTERFACE_DECL : case TypeDeclaration . ANNOTATION_TYPE_DECL : this . hierarchy . addInterface ( typeHandle ) ; break ; } if ( superinterfaceHandles == null ) { superinterfaceHandles = TypeHierarchy . NO_TYPE ; } this . hierarchy . cacheSuperInterfaces ( typeHandle , superinterfaceHandles ) ; this . hierarchy . cacheFlags ( typeHandle , type . getModifiers ( ) ) ; } protected IType getHandle ( IGenericType genericType , ReferenceBinding binding ) { if ( genericType == null ) return null ; if ( genericType instanceof HierarchyType ) { IType handle = ( IType ) this . infoToHandle . get ( genericType ) ; if ( handle == null ) { handle = ( ( HierarchyType ) genericType ) . typeHandle ; handle = ( IType ) ( ( JavaElement ) handle ) . resolved ( binding ) ; this . infoToHandle . put ( genericType , handle ) ; } return handle ; } else if ( genericType . isBinaryType ( ) ) { ClassFile classFile = ( ClassFile ) this . infoToHandle . get ( genericType ) ; if ( classFile == null ) { IType handle = lookupBinaryHandle ( ( IBinaryType ) genericType ) ; if ( handle == null ) return null ; classFile = ( ClassFile ) handle . getParent ( ) ; this . infoToHandle . put ( genericType , classFile ) ; } return new ResolvedBinaryType ( classFile , classFile . getTypeName ( ) , new String ( binding . computeUniqueKey ( ) ) ) ; } else if ( genericType instanceof SourceTypeElementInfo ) { IType handle = ( ( SourceTypeElementInfo ) genericType ) . getHandle ( ) ; return ( IType ) ( ( JavaElement ) handle ) . resolved ( binding ) ; } else return null ; } protected IType getType ( ) { return this . hierarchy . getType ( ) ; } protected IType lookupBinaryHandle ( IBinaryType typeInfo ) { int flag ; String qualifiedName ; switch ( TypeDeclaration . kind ( typeInfo . getModifiers ( ) ) ) { case TypeDeclaration . CLASS_DECL : flag = NameLookup . ACCEPT_CLASSES ; break ; case TypeDeclaration . INTERFACE_DECL : flag = NameLookup . ACCEPT_INTERFACES ; break ; case TypeDeclaration . ENUM_DECL : flag = NameLookup . ACCEPT_ENUMS ; break ; default : flag = NameLookup . ACCEPT_ANNOTATIONS ; break ; } char [ ] bName = typeInfo . getName ( ) ; qualifiedName = new String ( ClassFile . translatedName ( bName ) ) ; if ( qualifiedName . equals ( this . focusQualifiedName ) ) return getType ( ) ; NameLookup . Answer answer = this . nameLookup . findType ( qualifiedName , false , flag , true , false , false , null ) ; return answer == null || answer . type == null || ! answer . type . isBinary ( ) ? null : answer . type ; } protected void worked ( IProgressMonitor monitor , int work ) { if ( monitor != null ) { if ( monitor . isCanceled ( ) ) { throw new OperationCanceledException ( ) ; } else { monitor . worked ( work ) ; } } } protected ICompilationUnit createCompilationUnitFromPath ( Openable handle , IFile file ) { final char [ ] elementName = handle . getElementName ( ) . toCharArray ( ) ; return new ResourceCompilationUnit ( file , file . getLocationURI ( ) ) { public char [ ] getFileName ( ) { return elementName ; } } ; } protected IBinaryType createInfoFromClassFile ( Openable handle , IResource file ) { IBinaryType info = null ; try { info = Util . newClassFileReader ( file ) ; } catch ( org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException e ) { if ( TypeHierarchy . DEBUG ) { e . printStackTrace ( ) ; } return null ; } catch ( java . io . IOException e ) { if ( TypeHierarchy . DEBUG ) { e . printStackTrace ( ) ; } return null ; } catch ( CoreException e ) { if ( TypeHierarchy . DEBUG ) { e . printStackTrace ( ) ; } return null ; } this . infoToHandle . put ( info , handle ) ; return info ; } protected IBinaryType createInfoFromClassFileInJar ( Openable classFile ) { PackageFragment pkg = ( PackageFragment ) classFile . getParent ( ) ; String classFilePath = Util . concatWith ( pkg . names , classFile . getElementName ( ) , '<CHAR_LIT:/>' ) ; IBinaryType info = null ; java . util . zip . ZipFile zipFile = null ; try { zipFile = ( ( JarPackageFragmentRoot ) pkg . getParent ( ) ) . getJar ( ) ; info = org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader . read ( zipFile , classFilePath ) ; } catch ( org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException e ) { if ( TypeHierarchy . DEBUG ) { e . printStackTrace ( ) ; } return null ; } catch ( java . io . IOException e ) { if ( TypeHierarchy . DEBUG ) { e . printStackTrace ( ) ; } return null ; } catch ( CoreException e ) { if ( TypeHierarchy . DEBUG ) { e . printStackTrace ( ) ; } return null ; } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( zipFile ) ; } this . infoToHandle . put ( info , classFile ) ; return info ; } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . util . * ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . * ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObject ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObjectToInt ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . search . IndexQueryRequestor ; import org . eclipse . jdt . internal . core . search . JavaSearchParticipant ; import org . eclipse . jdt . internal . core . search . SubTypeSearchJob ; import org . eclipse . jdt . internal . core . search . indexing . IIndexConstants ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; import org . eclipse . jdt . internal . core . search . matching . MatchLocator ; import org . eclipse . jdt . internal . core . search . matching . SuperTypeReferencePattern ; import org . eclipse . jdt . internal . core . util . HandleFactory ; import org . eclipse . jdt . internal . core . util . Util ; public class IndexBasedHierarchyBuilder extends HierarchyBuilder implements SuffixConstants { public static final int MAXTICKS = <NUM_LIT> ; protected Map cuToHandle ; protected IJavaSearchScope scope ; protected Map binariesFromIndexMatches ; static class Queue { public char [ ] [ ] names = new char [ <NUM_LIT:10> ] [ ] ; public int start = <NUM_LIT:0> ; public int end = - <NUM_LIT:1> ; public void add ( char [ ] name ) { if ( ++ this . end == this . names . length ) { this . end -= this . start ; System . arraycopy ( this . names , this . start , this . names = new char [ this . end * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , this . end ) ; this . start = <NUM_LIT:0> ; } this . names [ this . end ] = name ; } public char [ ] retrieve ( ) { if ( this . start > this . end ) return null ; char [ ] name = this . names [ this . start ++ ] ; if ( this . start > this . end ) { this . start = <NUM_LIT:0> ; this . end = - <NUM_LIT:1> ; } return name ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; for ( int i = this . start ; i <= this . end ; i ++ ) { buffer . append ( this . names [ i ] ) . append ( '<STR_LIT:\n>' ) ; } return buffer . toString ( ) ; } } public IndexBasedHierarchyBuilder ( TypeHierarchy hierarchy , IJavaSearchScope scope ) throws JavaModelException { super ( hierarchy ) ; this . cuToHandle = new HashMap ( <NUM_LIT:5> ) ; this . binariesFromIndexMatches = new HashMap ( <NUM_LIT:10> ) ; this . scope = scope ; } public void build ( boolean computeSubtypes ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; try { manager . cacheZipFiles ( this ) ; if ( computeSubtypes ) { IType focusType = getType ( ) ; boolean focusIsObject = focusType . getElementName ( ) . equals ( new String ( IIndexConstants . OBJECT ) ) ; int amountOfWorkForSubtypes = focusIsObject ? <NUM_LIT:5> : <NUM_LIT> ; IProgressMonitor possibleSubtypesMonitor = this . hierarchy . progressMonitor == null ? null : new SubProgressMonitor ( this . hierarchy . progressMonitor , amountOfWorkForSubtypes ) ; HashSet localTypes = new HashSet ( <NUM_LIT:10> ) ; String [ ] allPossibleSubtypes ; if ( ( ( Member ) focusType ) . getOuterMostLocalContext ( ) == null ) { allPossibleSubtypes = determinePossibleSubTypes ( localTypes , possibleSubtypesMonitor ) ; } else { allPossibleSubtypes = CharOperation . NO_STRINGS ; } if ( allPossibleSubtypes != null ) { IProgressMonitor buildMonitor = this . hierarchy . progressMonitor == null ? null : new SubProgressMonitor ( this . hierarchy . progressMonitor , <NUM_LIT:100> - amountOfWorkForSubtypes ) ; this . hierarchy . initialize ( allPossibleSubtypes . length ) ; buildFromPotentialSubtypes ( allPossibleSubtypes , localTypes , buildMonitor ) ; } } else { this . hierarchy . initialize ( <NUM_LIT:1> ) ; buildSupertypes ( ) ; } } finally { manager . flushZipFiles ( this ) ; } } private void buildForProject ( JavaProject project , ArrayList potentialSubtypes , org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies , HashSet localTypes , IProgressMonitor monitor ) throws JavaModelException { int openablesLength = potentialSubtypes . size ( ) ; if ( openablesLength > <NUM_LIT:0> ) { Openable [ ] openables = new Openable [ openablesLength ] ; potentialSubtypes . toArray ( openables ) ; IPackageFragmentRoot [ ] roots = project . getPackageFragmentRoots ( ) ; int rootsLength = roots . length ; final HashtableOfObjectToInt indexes = new HashtableOfObjectToInt ( openablesLength ) ; for ( int i = <NUM_LIT:0> ; i < openablesLength ; i ++ ) { IJavaElement root = openables [ i ] . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; int index ; for ( index = <NUM_LIT:0> ; index < rootsLength ; index ++ ) { if ( roots [ index ] . equals ( root ) ) break ; } indexes . put ( openables [ i ] , index ) ; } Arrays . sort ( openables , new Comparator ( ) { public int compare ( Object a , Object b ) { int aIndex = indexes . get ( a ) ; int bIndex = indexes . get ( b ) ; if ( aIndex != bIndex ) return aIndex - bIndex ; return ( ( Openable ) b ) . getElementName ( ) . compareTo ( ( ( Openable ) a ) . getElementName ( ) ) ; } } ) ; IType focusType = getType ( ) ; boolean inProjectOfFocusType = focusType != null && focusType . getJavaProject ( ) . equals ( project ) ; org . eclipse . jdt . core . ICompilationUnit [ ] unitsToLookInside = null ; if ( inProjectOfFocusType ) { org . eclipse . jdt . core . ICompilationUnit unitToLookInside = focusType . getCompilationUnit ( ) ; if ( unitToLookInside != null ) { int wcLength = workingCopies == null ? <NUM_LIT:0> : workingCopies . length ; if ( wcLength == <NUM_LIT:0> ) { unitsToLookInside = new org . eclipse . jdt . core . ICompilationUnit [ ] { unitToLookInside } ; } else { unitsToLookInside = new org . eclipse . jdt . core . ICompilationUnit [ wcLength + <NUM_LIT:1> ] ; unitsToLookInside [ <NUM_LIT:0> ] = unitToLookInside ; System . arraycopy ( workingCopies , <NUM_LIT:0> , unitsToLookInside , <NUM_LIT:1> , wcLength ) ; } } else { unitsToLookInside = workingCopies ; } } SearchableEnvironment searchableEnvironment = project . newSearchableNameEnvironment ( unitsToLookInside ) ; this . nameLookup = searchableEnvironment . nameLookup ; Map options = project . getOptions ( true ) ; options . put ( JavaCore . COMPILER_TASK_TAGS , "<STR_LIT>" ) ; this . hierarchyResolver = new HierarchyResolver ( searchableEnvironment , options , this , new DefaultProblemFactory ( ) ) ; if ( focusType != null ) { Member declaringMember = ( ( Member ) focusType ) . getOuterMostLocalContext ( ) ; if ( declaringMember == null ) { if ( ! inProjectOfFocusType ) { char [ ] typeQualifiedName = focusType . getTypeQualifiedName ( '<CHAR_LIT:.>' ) . toCharArray ( ) ; String [ ] packageName = ( ( PackageFragment ) focusType . getPackageFragment ( ) ) . names ; if ( searchableEnvironment . findType ( typeQualifiedName , Util . toCharArrays ( packageName ) ) == null ) { return ; } } } else { Openable openable ; if ( declaringMember . isBinary ( ) ) { openable = ( Openable ) declaringMember . getClassFile ( ) ; } else { openable = ( Openable ) declaringMember . getCompilationUnit ( ) ; } localTypes = new HashSet ( ) ; localTypes . add ( openable . getPath ( ) . toString ( ) ) ; this . hierarchyResolver . resolve ( new Openable [ ] { openable } , localTypes , monitor ) ; return ; } } this . hierarchyResolver . resolve ( openables , localTypes , monitor ) ; } } private void buildFromPotentialSubtypes ( String [ ] allPotentialSubTypes , HashSet localTypes , IProgressMonitor monitor ) { IType focusType = getType ( ) ; HashMap wcPaths = new HashMap ( ) ; int wcLength ; org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies = this . hierarchy . workingCopies ; if ( workingCopies != null && ( wcLength = workingCopies . length ) > <NUM_LIT:0> ) { String [ ] newPaths = new String [ wcLength ] ; for ( int i = <NUM_LIT:0> ; i < wcLength ; i ++ ) { org . eclipse . jdt . core . ICompilationUnit workingCopy = workingCopies [ i ] ; String path = workingCopy . getPath ( ) . toString ( ) ; wcPaths . put ( path , workingCopy ) ; newPaths [ i ] = path ; } int potentialSubtypesLength = allPotentialSubTypes . length ; System . arraycopy ( allPotentialSubTypes , <NUM_LIT:0> , allPotentialSubTypes = new String [ potentialSubtypesLength + wcLength ] , <NUM_LIT:0> , potentialSubtypesLength ) ; System . arraycopy ( newPaths , <NUM_LIT:0> , allPotentialSubTypes , potentialSubtypesLength , wcLength ) ; } int length = allPotentialSubTypes . length ; Openable focusCU = ( Openable ) focusType . getCompilationUnit ( ) ; String focusPath = null ; if ( focusCU != null ) { focusPath = focusCU . getPath ( ) . toString ( ) ; if ( length > <NUM_LIT:0> ) { System . arraycopy ( allPotentialSubTypes , <NUM_LIT:0> , allPotentialSubTypes = new String [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; allPotentialSubTypes [ length ] = focusPath ; } else { allPotentialSubTypes = new String [ ] { focusPath } ; } length ++ ; } Arrays . sort ( allPotentialSubTypes ) ; ArrayList potentialSubtypes = new ArrayList ( ) ; try { HandleFactory factory = new HandleFactory ( ) ; IJavaProject currentProject = null ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , length * <NUM_LIT:2> ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { try { String resourcePath = allPotentialSubTypes [ i ] ; if ( i > <NUM_LIT:0> && resourcePath . equals ( allPotentialSubTypes [ i - <NUM_LIT:1> ] ) ) continue ; Openable handle ; org . eclipse . jdt . core . ICompilationUnit workingCopy = ( org . eclipse . jdt . core . ICompilationUnit ) wcPaths . get ( resourcePath ) ; if ( workingCopy != null ) { handle = ( Openable ) workingCopy ; } else { handle = resourcePath . equals ( focusPath ) ? focusCU : factory . createOpenable ( resourcePath , this . scope ) ; if ( handle == null ) continue ; } IJavaProject project = handle . getJavaProject ( ) ; if ( currentProject == null ) { currentProject = project ; potentialSubtypes = new ArrayList ( <NUM_LIT:5> ) ; } else if ( ! currentProject . equals ( project ) ) { buildForProject ( ( JavaProject ) currentProject , potentialSubtypes , workingCopies , localTypes , monitor ) ; currentProject = project ; potentialSubtypes = new ArrayList ( <NUM_LIT:5> ) ; } potentialSubtypes . add ( handle ) ; } catch ( JavaModelException e ) { continue ; } } try { if ( currentProject == null ) { currentProject = focusType . getJavaProject ( ) ; if ( focusType . isBinary ( ) ) { potentialSubtypes . add ( focusType . getClassFile ( ) ) ; } else { potentialSubtypes . add ( focusType . getCompilationUnit ( ) ) ; } } buildForProject ( ( JavaProject ) currentProject , potentialSubtypes , workingCopies , localTypes , monitor ) ; } catch ( JavaModelException e ) { } if ( ! this . hierarchy . contains ( focusType ) ) { try { currentProject = focusType . getJavaProject ( ) ; potentialSubtypes = new ArrayList ( ) ; if ( focusType . isBinary ( ) ) { potentialSubtypes . add ( focusType . getClassFile ( ) ) ; } else { potentialSubtypes . add ( focusType . getCompilationUnit ( ) ) ; } buildForProject ( ( JavaProject ) currentProject , potentialSubtypes , workingCopies , localTypes , monitor ) ; } catch ( JavaModelException e ) { } } if ( ! this . hierarchy . contains ( focusType ) ) { this . hierarchy . addRootClass ( focusType ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; } } protected ICompilationUnit createCompilationUnitFromPath ( Openable handle , IFile file ) { ICompilationUnit unit = super . createCompilationUnitFromPath ( handle , file ) ; this . cuToHandle . put ( unit , handle ) ; return unit ; } protected IBinaryType createInfoFromClassFile ( Openable classFile , IResource file ) { String documentPath = classFile . getPath ( ) . toString ( ) ; IBinaryType binaryType = ( IBinaryType ) this . binariesFromIndexMatches . get ( documentPath ) ; if ( binaryType != null ) { this . infoToHandle . put ( binaryType , classFile ) ; return binaryType ; } else { return super . createInfoFromClassFile ( classFile , file ) ; } } protected IBinaryType createInfoFromClassFileInJar ( Openable classFile ) { String filePath = ( ( ( ClassFile ) classFile ) . getType ( ) . getFullyQualifiedName ( '<CHAR_LIT>' ) ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) + SuffixConstants . SUFFIX_STRING_class ; IPackageFragmentRoot root = classFile . getPackageFragmentRoot ( ) ; IPath path = root . getPath ( ) ; String rootPath = path . getDevice ( ) == null ? path . toString ( ) : path . toOSString ( ) ; String documentPath = rootPath + IJavaSearchScope . JAR_FILE_ENTRY_SEPARATOR + filePath ; IBinaryType binaryType = ( IBinaryType ) this . binariesFromIndexMatches . get ( documentPath ) ; if ( binaryType != null ) { this . infoToHandle . put ( binaryType , classFile ) ; return binaryType ; } else { return super . createInfoFromClassFileInJar ( classFile ) ; } } private String [ ] determinePossibleSubTypes ( final HashSet localTypes , IProgressMonitor monitor ) { class PathCollector implements IPathRequestor { HashSet paths = new HashSet ( <NUM_LIT:10> ) ; public void acceptPath ( String path , boolean containsLocalTypes ) { this . paths . add ( path ) ; if ( containsLocalTypes ) { localTypes . add ( path ) ; } } } PathCollector collector = new PathCollector ( ) ; try { if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , MAXTICKS ) ; searchAllPossibleSubTypes ( getType ( ) , this . scope , this . binariesFromIndexMatches , collector , IJavaSearchConstants . WAIT_UNTIL_READY_TO_SEARCH , monitor ) ; } finally { if ( monitor != null ) monitor . done ( ) ; } HashSet paths = collector . paths ; int length = paths . size ( ) ; String [ ] result = new String [ length ] ; int count = <NUM_LIT:0> ; for ( Iterator iter = paths . iterator ( ) ; iter . hasNext ( ) ; ) { result [ count ++ ] = ( String ) iter . next ( ) ; } return result ; } public static void searchAllPossibleSubTypes ( IType type , IJavaSearchScope scope , final Map binariesFromIndexMatches , final IPathRequestor pathRequestor , int waitingPolicy , final IProgressMonitor progressMonitor ) { final Queue queue = new Queue ( ) ; final HashtableOfObject foundSuperNames = new HashtableOfObject ( <NUM_LIT:5> ) ; IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; IndexQueryRequestor searchRequestor = new IndexQueryRequestor ( ) { public boolean acceptIndexMatch ( String documentPath , SearchPattern indexRecord , SearchParticipant participant , AccessRuleSet access ) { SuperTypeReferencePattern record = ( SuperTypeReferencePattern ) indexRecord ; boolean isLocalOrAnonymous = record . enclosingTypeName == IIndexConstants . ONE_ZERO ; pathRequestor . acceptPath ( documentPath , isLocalOrAnonymous ) ; char [ ] typeName = record . simpleName ; if ( documentPath . toLowerCase ( ) . endsWith ( SUFFIX_STRING_class ) ) { int suffix = documentPath . length ( ) - SUFFIX_STRING_class . length ( ) ; HierarchyBinaryType binaryType = ( HierarchyBinaryType ) binariesFromIndexMatches . get ( documentPath ) ; if ( binaryType == null ) { char [ ] enclosingTypeName = record . enclosingTypeName ; if ( isLocalOrAnonymous ) { int lastSlash = documentPath . lastIndexOf ( '<CHAR_LIT:/>' ) ; int lastDollar = documentPath . lastIndexOf ( '<CHAR_LIT>' ) ; if ( lastDollar == - <NUM_LIT:1> ) { enclosingTypeName = null ; typeName = documentPath . substring ( lastSlash + <NUM_LIT:1> , suffix ) . toCharArray ( ) ; } else { enclosingTypeName = documentPath . substring ( lastSlash + <NUM_LIT:1> , lastDollar ) . toCharArray ( ) ; typeName = documentPath . substring ( lastDollar + <NUM_LIT:1> , suffix ) . toCharArray ( ) ; } } binaryType = new HierarchyBinaryType ( record . modifiers , record . pkgName , typeName , enclosingTypeName , record . typeParameterSignatures , record . classOrInterface ) ; binariesFromIndexMatches . put ( documentPath , binaryType ) ; } binaryType . recordSuperType ( record . superSimpleName , record . superQualification , record . superClassOrInterface ) ; } if ( ! isLocalOrAnonymous && ! foundSuperNames . containsKey ( typeName ) ) { foundSuperNames . put ( typeName , typeName ) ; queue . add ( typeName ) ; } return true ; } } ; int superRefKind ; try { superRefKind = type . isClass ( ) ? SuperTypeReferencePattern . ONLY_SUPER_CLASSES : SuperTypeReferencePattern . ALL_SUPER_TYPES ; } catch ( JavaModelException e ) { superRefKind = SuperTypeReferencePattern . ALL_SUPER_TYPES ; } SuperTypeReferencePattern pattern = new SuperTypeReferencePattern ( null , null , superRefKind , SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE ) ; MatchLocator . setFocus ( pattern , type ) ; SubTypeSearchJob job = new SubTypeSearchJob ( pattern , new JavaSearchParticipant ( ) , scope , searchRequestor ) ; int ticks = <NUM_LIT:0> ; queue . add ( type . getElementName ( ) . toCharArray ( ) ) ; try { while ( queue . start <= queue . end ) { if ( progressMonitor != null && progressMonitor . isCanceled ( ) ) return ; char [ ] currentTypeName = queue . retrieve ( ) ; if ( CharOperation . equals ( currentTypeName , IIndexConstants . OBJECT ) ) currentTypeName = null ; pattern . superSimpleName = currentTypeName ; indexManager . performConcurrentJob ( job , waitingPolicy , progressMonitor == null ? null : new NullProgressMonitor ( ) { public void setCanceled ( boolean value ) { progressMonitor . setCanceled ( value ) ; } public boolean isCanceled ( ) { return progressMonitor . isCanceled ( ) ; } public void subTask ( String name ) { progressMonitor . subTask ( name ) ; } } ) ; if ( progressMonitor != null && ++ ticks <= MAXTICKS ) progressMonitor . worked ( <NUM_LIT:1> ) ; if ( currentTypeName == null ) break ; } } finally { job . finished ( ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . internal . compiler . env . IGenericType ; public class HierarchyType implements IGenericType { public IType typeHandle ; public char [ ] name ; public int modifiers ; public char [ ] superclassName ; public char [ ] [ ] superInterfaceNames ; public HierarchyType ( IType typeHandle , char [ ] name , int modifiers , char [ ] superclassName , char [ ] [ ] superInterfaceNames ) { this . typeHandle = typeHandle ; this . name = name ; this . modifiers = modifiers ; this . superclassName = superclassName ; this . superInterfaceNames = superInterfaceNames ; } public char [ ] getFileName ( ) { return this . typeHandle . getCompilationUnit ( ) . getElementName ( ) . toCharArray ( ) ; } public int getModifiers ( ) { return this . modifiers ; } public boolean isBinaryType ( ) { return false ; } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . IErrorHandlingPolicy ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . IGenericType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . ISourceType ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . ITypeRequestor ; import org . eclipse . jdt . internal . compiler . lookup . BinaryTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . PackageBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; 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 . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . parser . SourceTypeConverter ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . util . Messages ; import org . eclipse . jdt . internal . core . ClassFile ; import org . eclipse . jdt . internal . core . CompilationUnit ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . Member ; import org . eclipse . jdt . internal . core . Openable ; import org . eclipse . jdt . internal . core . SourceTypeElementInfo ; import org . eclipse . jdt . internal . core . util . ASTNodeFinder ; import org . eclipse . jdt . internal . core . util . HandleFactory ; public class HierarchyResolver implements ITypeRequestor { private ReferenceBinding focusType ; private boolean superTypesOnly ; private boolean hasMissingSuperClass ; LookupEnvironment lookupEnvironment ; private CompilerOptions options ; HierarchyBuilder builder ; private ReferenceBinding [ ] typeBindings ; private int typeIndex ; private IGenericType [ ] typeModels ; private static final CompilationUnitDeclaration FakeUnit ; static { IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) ; ProblemReporter problemReporter = new ProblemReporter ( policy , new CompilerOptions ( ) , new DefaultProblemFactory ( ) ) ; CompilationResult result = new CompilationResult ( CharOperation . NO_CHAR , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ; FakeUnit = new CompilationUnitDeclaration ( problemReporter , result , <NUM_LIT:0> ) ; } public HierarchyResolver ( INameEnvironment nameEnvironment , Map settings , HierarchyBuilder builder , IProblemFactory problemFactory ) { this . options = new CompilerOptions ( settings ) ; IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies . exitAfterAllProblems ( ) ; ProblemReporter problemReporter = new ProblemReporter ( policy , this . options , problemFactory ) ; setEnvironment ( new LookupEnvironment ( this , this . options , problemReporter , nameEnvironment ) , builder ) ; } public HierarchyResolver ( LookupEnvironment lookupEnvironment , HierarchyBuilder builder ) { setEnvironment ( lookupEnvironment , builder ) ; } public void accept ( IBinaryType binaryType , PackageBinding packageBinding , AccessRestriction accessRestriction ) { IProgressMonitor progressMonitor = this . builder . hierarchy . progressMonitor ; if ( progressMonitor != null && progressMonitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; BinaryTypeBinding typeBinding = this . lookupEnvironment . createBinaryTypeFrom ( binaryType , packageBinding , accessRestriction ) ; try { this . remember ( binaryType , typeBinding ) ; } catch ( AbortCompilation e ) { } } public void accept ( ICompilationUnit sourceUnit , AccessRestriction accessRestriction ) { this . lookupEnvironment . problemReporter . abortDueToInternalError ( new StringBuffer ( Messages . accept_cannot ) . append ( sourceUnit . getFileName ( ) ) . toString ( ) ) ; } public void accept ( ISourceType [ ] sourceTypes , PackageBinding packageBinding , AccessRestriction accessRestriction ) { IProgressMonitor progressMonitor = this . builder . hierarchy . progressMonitor ; if ( progressMonitor != null && progressMonitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; ISourceType sourceType = sourceTypes [ <NUM_LIT:0> ] ; while ( sourceType . getEnclosingType ( ) != null ) sourceType = sourceType . getEnclosingType ( ) ; CompilationResult result = new CompilationResult ( sourceType . getFileName ( ) , <NUM_LIT:1> , <NUM_LIT:1> , this . options . maxProblemsPerUnit ) ; CompilationUnitDeclaration unit = SourceTypeConverter . buildCompilationUnit ( new ISourceType [ ] { sourceType } , SourceTypeConverter . MEMBER_TYPE , this . lookupEnvironment . problemReporter , result ) ; if ( unit != null ) { try { this . lookupEnvironment . buildTypeBindings ( unit , accessRestriction ) ; org . eclipse . jdt . core . ICompilationUnit cu = ( ( SourceTypeElementInfo ) sourceType ) . getHandle ( ) . getCompilationUnit ( ) ; rememberAllTypes ( unit , cu , false ) ; this . lookupEnvironment . completeTypeBindings ( unit , true ) ; } catch ( AbortCompilation e ) { } } } private IType findSuperClass ( IGenericType type , ReferenceBinding typeBinding ) { ReferenceBinding superBinding = typeBinding . superclass ( ) ; if ( superBinding != null ) { superBinding = ( ReferenceBinding ) superBinding . erasure ( ) ; if ( typeBinding . isHierarchyInconsistent ( ) ) { if ( superBinding . problemId ( ) == ProblemReasons . NotFound ) { this . hasMissingSuperClass = true ; this . builder . hierarchy . missingTypes . add ( new String ( superBinding . sourceName ) ) ; return null ; } else if ( ( superBinding . id == TypeIds . T_JavaLangObject ) ) { char [ ] superclassName ; char separator ; if ( type instanceof IBinaryType ) { superclassName = ( ( IBinaryType ) type ) . getSuperclassName ( ) ; separator = '<CHAR_LIT:/>' ; } else if ( type instanceof ISourceType ) { superclassName = ( ( ISourceType ) type ) . getSuperclassName ( ) ; separator = '<CHAR_LIT:.>' ; } else if ( type instanceof HierarchyType ) { superclassName = ( ( HierarchyType ) type ) . superclassName ; separator = '<CHAR_LIT:.>' ; } else { return null ; } if ( superclassName != null ) { int lastSeparator = CharOperation . lastIndexOf ( separator , superclassName ) ; char [ ] simpleName = lastSeparator == - <NUM_LIT:1> ? superclassName : CharOperation . subarray ( superclassName , lastSeparator + <NUM_LIT:1> , superclassName . length ) ; if ( ! CharOperation . equals ( simpleName , TypeConstants . OBJECT ) ) { this . hasMissingSuperClass = true ; this . builder . hierarchy . missingTypes . add ( new String ( simpleName ) ) ; return null ; } } } } for ( int t = this . typeIndex ; t >= <NUM_LIT:0> ; t -- ) { if ( this . typeBindings [ t ] == superBinding ) { return this . builder . getHandle ( this . typeModels [ t ] , superBinding ) ; } } } return null ; } private IType [ ] findSuperInterfaces ( IGenericType type , ReferenceBinding typeBinding ) { char [ ] [ ] superInterfaceNames ; char separator ; if ( type instanceof IBinaryType ) { superInterfaceNames = ( ( IBinaryType ) type ) . getInterfaceNames ( ) ; separator = '<CHAR_LIT:/>' ; } else if ( type instanceof ISourceType ) { ISourceType sourceType = ( ISourceType ) type ; if ( sourceType . getName ( ) . length == <NUM_LIT:0> ) { if ( typeBinding . superInterfaces ( ) != null && typeBinding . superInterfaces ( ) . length > <NUM_LIT:0> ) { superInterfaceNames = new char [ ] [ ] { sourceType . getSuperclassName ( ) } ; } else { superInterfaceNames = sourceType . getInterfaceNames ( ) ; } } else { if ( TypeDeclaration . kind ( sourceType . getModifiers ( ) ) == TypeDeclaration . ANNOTATION_TYPE_DECL ) superInterfaceNames = new char [ ] [ ] { TypeConstants . CharArray_JAVA_LANG_ANNOTATION_ANNOTATION } ; else superInterfaceNames = sourceType . getInterfaceNames ( ) ; } separator = '<CHAR_LIT:.>' ; } else if ( type instanceof HierarchyType ) { HierarchyType hierarchyType = ( HierarchyType ) type ; if ( hierarchyType . name . length == <NUM_LIT:0> ) { if ( typeBinding . superInterfaces ( ) != null && typeBinding . superInterfaces ( ) . length > <NUM_LIT:0> ) { superInterfaceNames = new char [ ] [ ] { hierarchyType . superclassName } ; } else { superInterfaceNames = hierarchyType . superInterfaceNames ; } } else { superInterfaceNames = hierarchyType . superInterfaceNames ; } separator = '<CHAR_LIT:.>' ; } else { return null ; } ReferenceBinding [ ] interfaceBindings = typeBinding . superInterfaces ( ) ; int bindingIndex = <NUM_LIT:0> ; int bindingLength = interfaceBindings == null ? <NUM_LIT:0> : interfaceBindings . length ; int length = superInterfaceNames == null ? <NUM_LIT:0> : superInterfaceNames . length ; IType [ ] superinterfaces = new IType [ length ] ; int index = <NUM_LIT:0> ; next : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] superInterfaceName = superInterfaceNames [ i ] ; int end = superInterfaceName . length ; int genericStart = CharOperation . indexOf ( Signature . C_GENERIC_START , superInterfaceName ) ; if ( genericStart != - <NUM_LIT:1> ) end = genericStart ; int lastSeparator = CharOperation . lastIndexOf ( separator , superInterfaceName , <NUM_LIT:0> , end ) ; int start = lastSeparator + <NUM_LIT:1> ; int lastDollar = CharOperation . lastIndexOf ( '<CHAR_LIT>' , superInterfaceName , start ) ; if ( lastDollar != - <NUM_LIT:1> ) start = lastDollar + <NUM_LIT:1> ; char [ ] simpleName = CharOperation . subarray ( superInterfaceName , start , end ) ; if ( bindingIndex < bindingLength ) { ReferenceBinding interfaceBinding = ( ReferenceBinding ) interfaceBindings [ bindingIndex ] . erasure ( ) ; if ( CharOperation . equals ( simpleName , interfaceBinding . sourceName ) ) { bindingIndex ++ ; for ( int t = this . typeIndex ; t >= <NUM_LIT:0> ; t -- ) { if ( this . typeBindings [ t ] == interfaceBinding ) { IType handle = this . builder . getHandle ( this . typeModels [ t ] , interfaceBinding ) ; if ( handle != null ) { superinterfaces [ index ++ ] = handle ; continue next ; } } } } } this . builder . hierarchy . missingTypes . add ( new String ( simpleName ) ) ; } if ( index != length ) System . arraycopy ( superinterfaces , <NUM_LIT:0> , superinterfaces = new IType [ index ] , <NUM_LIT:0> , index ) ; return superinterfaces ; } private void fixSupertypeBindings ( ) { for ( int current = this . typeIndex ; current >= <NUM_LIT:0> ; current -- ) { ReferenceBinding typeBinding = this . typeBindings [ current ] ; if ( ( typeBinding . tagBits & TagBits . HierarchyHasProblems ) == <NUM_LIT:0> ) continue ; if ( typeBinding instanceof SourceTypeBinding ) { if ( typeBinding instanceof LocalTypeBinding ) { LocalTypeBinding localTypeBinding = ( LocalTypeBinding ) typeBinding ; QualifiedAllocationExpression allocationExpression = localTypeBinding . scope . referenceContext . allocation ; TypeReference type ; if ( allocationExpression != null && ( type = allocationExpression . type ) != null && type . resolvedType != null ) { localTypeBinding . superclass = ( ReferenceBinding ) type . resolvedType ; continue ; } } ClassScope scope = ( ( SourceTypeBinding ) typeBinding ) . scope ; if ( scope != null ) { TypeDeclaration typeDeclaration = scope . referenceContext ; TypeReference superclassRef = typeDeclaration == null ? null : typeDeclaration . superclass ; TypeBinding superclass = superclassRef == null ? null : superclassRef . resolvedType ; if ( superclass != null ) { superclass = superclass . closestMatch ( ) ; } if ( superclass instanceof ReferenceBinding ) { if ( ! ( subTypeOfType ( ( ReferenceBinding ) superclass , typeBinding ) ) ) { ( ( SourceTypeBinding ) typeBinding ) . superclass = ( ReferenceBinding ) superclass ; } } TypeReference [ ] superInterfaces = typeDeclaration == null ? null : typeDeclaration . superInterfaces ; int length ; ReferenceBinding [ ] interfaceBindings = typeBinding . superInterfaces ( ) ; if ( superInterfaces != null && ( length = superInterfaces . length ) > ( interfaceBindings == null ? <NUM_LIT:0> : interfaceBindings . length ) ) { interfaceBindings = new ReferenceBinding [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeBinding superInterface = superInterfaces [ i ] . resolvedType ; if ( superInterface != null ) { superInterface = superInterface . closestMatch ( ) ; } if ( superInterface instanceof ReferenceBinding ) { if ( ! ( subTypeOfType ( ( ReferenceBinding ) superInterface , typeBinding ) ) ) { interfaceBindings [ index ++ ] = ( ReferenceBinding ) superInterface ; } } } if ( index < length ) System . arraycopy ( interfaceBindings , <NUM_LIT:0> , interfaceBindings = new ReferenceBinding [ index ] , <NUM_LIT:0> , index ) ; ( ( SourceTypeBinding ) typeBinding ) . superInterfaces = interfaceBindings ; } } } else if ( typeBinding instanceof BinaryTypeBinding ) { try { typeBinding . superclass ( ) ; } catch ( AbortCompilation e ) { ( ( BinaryTypeBinding ) typeBinding ) . tagBits &= ~ TagBits . HasUnresolvedSuperclass ; this . builder . hierarchy . missingTypes . add ( new String ( typeBinding . superclass ( ) . sourceName ( ) ) ) ; this . hasMissingSuperClass = true ; } try { typeBinding . superInterfaces ( ) ; } catch ( AbortCompilation e ) { ( ( BinaryTypeBinding ) typeBinding ) . tagBits &= ~ TagBits . HasUnresolvedSuperinterfaces ; } } } } private void remember ( IGenericType suppliedType , ReferenceBinding typeBinding ) { if ( typeBinding == null ) return ; if ( ++ this . typeIndex == this . typeModels . length ) { System . arraycopy ( this . typeModels , <NUM_LIT:0> , this . typeModels = new IGenericType [ this . typeIndex * <NUM_LIT:2> ] , <NUM_LIT:0> , this . typeIndex ) ; System . arraycopy ( this . typeBindings , <NUM_LIT:0> , this . typeBindings = new ReferenceBinding [ this . typeIndex * <NUM_LIT:2> ] , <NUM_LIT:0> , this . typeIndex ) ; } this . typeModels [ this . typeIndex ] = suppliedType ; this . typeBindings [ this . typeIndex ] = typeBinding ; } private void remember ( IType type , ReferenceBinding typeBinding ) { if ( ( ( CompilationUnit ) type . getCompilationUnit ( ) ) . isOpen ( ) ) { try { IGenericType genericType = ( IGenericType ) ( ( JavaElement ) type ) . getElementInfo ( ) ; remember ( genericType , typeBinding ) ; } catch ( JavaModelException e ) { return ; } } else { if ( typeBinding == null ) return ; TypeDeclaration typeDeclaration = ( ( SourceTypeBinding ) typeBinding ) . scope . referenceType ( ) ; char [ ] superclassName = null ; TypeReference superclass ; if ( ( typeDeclaration . bits & ASTNode . IsAnonymousType ) != <NUM_LIT:0> ) { superclass = typeDeclaration . allocation . type ; } else { superclass = typeDeclaration . superclass ; } if ( superclass != null ) { char [ ] [ ] typeName = superclass . getTypeName ( ) ; superclassName = typeName == null ? null : typeName [ typeName . length - <NUM_LIT:1> ] ; } char [ ] [ ] superInterfaceNames = null ; TypeReference [ ] superInterfaces = typeDeclaration . superInterfaces ; if ( superInterfaces != null ) { int length = superInterfaces . length ; superInterfaceNames = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeReference superInterface = superInterfaces [ i ] ; char [ ] [ ] typeName = superInterface . getTypeName ( ) ; superInterfaceNames [ i ] = typeName [ typeName . length - <NUM_LIT:1> ] ; } } HierarchyType hierarchyType = new HierarchyType ( type , typeDeclaration . name , typeDeclaration . binding . modifiers , superclassName , superInterfaceNames ) ; remember ( hierarchyType , typeDeclaration . binding ) ; } } private void rememberAllTypes ( CompilationUnitDeclaration parsedUnit , org . eclipse . jdt . core . ICompilationUnit cu , boolean includeLocalTypes ) { TypeDeclaration [ ] types = parsedUnit . types ; if ( types != null ) { for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { TypeDeclaration type = types [ i ] ; rememberWithMemberTypes ( type , cu . getType ( new String ( type . name ) ) ) ; } } if ( includeLocalTypes && parsedUnit . localTypes != null ) { HandleFactory factory = new HandleFactory ( ) ; HashSet existingElements = new HashSet ( parsedUnit . localTypeCount ) ; HashMap knownScopes = new HashMap ( parsedUnit . localTypeCount ) ; for ( int i = <NUM_LIT:0> ; i < parsedUnit . localTypeCount ; i ++ ) { LocalTypeBinding localType = parsedUnit . localTypes [ i ] ; ClassScope classScope = localType . scope ; TypeDeclaration typeDecl = classScope . referenceType ( ) ; IType typeHandle = ( IType ) factory . createElement ( classScope , cu , existingElements , knownScopes ) ; rememberWithMemberTypes ( typeDecl , typeHandle ) ; } } } private void rememberWithMemberTypes ( TypeDeclaration typeDecl , IType typeHandle ) { remember ( typeHandle , typeDecl . binding ) ; TypeDeclaration [ ] memberTypes = typeDecl . memberTypes ; if ( memberTypes != null ) { for ( int i = <NUM_LIT:0> , length = memberTypes . length ; i < length ; i ++ ) { TypeDeclaration memberType = memberTypes [ i ] ; rememberWithMemberTypes ( memberType , typeHandle . getType ( new String ( memberType . name ) ) ) ; } } } private void reportHierarchy ( IType focus , TypeDeclaration focusLocalType , ReferenceBinding binaryTypeBinding ) { if ( focus != null ) { if ( binaryTypeBinding != null ) { this . focusType = binaryTypeBinding ; } else { if ( focusLocalType != null ) { this . focusType = focusLocalType . binding ; } else { char [ ] fullyQualifiedName = focus . getFullyQualifiedName ( ) . toCharArray ( ) ; setFocusType ( CharOperation . splitOn ( '<CHAR_LIT:.>' , fullyQualifiedName ) ) ; } } } fixSupertypeBindings ( ) ; int objectIndex = - <NUM_LIT:1> ; IProgressMonitor progressMonitor = this . builder . hierarchy . progressMonitor ; for ( int current = this . typeIndex ; current >= <NUM_LIT:0> ; current -- ) { if ( progressMonitor != null && progressMonitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; ReferenceBinding typeBinding = this . typeBindings [ current ] ; if ( typeBinding . id == TypeIds . T_JavaLangObject ) { objectIndex = current ; continue ; } IGenericType suppliedType = this . typeModels [ current ] ; if ( ! subOrSuperOfFocus ( typeBinding ) ) { continue ; } IType superclass ; if ( typeBinding . isInterface ( ) ) { superclass = null ; } else { superclass = findSuperClass ( suppliedType , typeBinding ) ; } IType [ ] superinterfaces = findSuperInterfaces ( suppliedType , typeBinding ) ; this . builder . connect ( suppliedType , this . builder . getHandle ( suppliedType , typeBinding ) , superclass , superinterfaces ) ; } if ( objectIndex > - <NUM_LIT:1> && ( ! this . hasMissingSuperClass || this . focusType == null ) ) { IGenericType objectType = this . typeModels [ objectIndex ] ; this . builder . connect ( objectType , this . builder . getHandle ( objectType , this . typeBindings [ objectIndex ] ) , null , null ) ; } } private void reset ( ) { this . lookupEnvironment . reset ( ) ; this . focusType = null ; this . superTypesOnly = false ; this . typeIndex = - <NUM_LIT:1> ; this . typeModels = new IGenericType [ <NUM_LIT:5> ] ; this . typeBindings = new ReferenceBinding [ <NUM_LIT:5> ] ; } public void resolve ( IGenericType suppliedType ) { try { if ( suppliedType . isBinaryType ( ) ) { BinaryTypeBinding binaryTypeBinding = this . lookupEnvironment . cacheBinaryType ( ( IBinaryType ) suppliedType , false , null ) ; remember ( suppliedType , binaryTypeBinding ) ; int startIndex = this . typeIndex ; for ( int i = startIndex ; i <= this . typeIndex ; i ++ ) { IGenericType igType = this . typeModels [ i ] ; if ( igType != null && igType . isBinaryType ( ) ) { CompilationUnitDeclaration previousUnitBeingCompleted = this . lookupEnvironment . unitBeingCompleted ; try { if ( previousUnitBeingCompleted == null ) { this . lookupEnvironment . unitBeingCompleted = FakeUnit ; } ReferenceBinding typeBinding = this . typeBindings [ i ] ; typeBinding . superclass ( ) ; typeBinding . superInterfaces ( ) ; } catch ( AbortCompilation e ) { } finally { this . lookupEnvironment . unitBeingCompleted = previousUnitBeingCompleted ; } } } this . superTypesOnly = true ; reportHierarchy ( this . builder . getType ( ) , null , binaryTypeBinding ) ; } else { org . eclipse . jdt . core . ICompilationUnit cu = ( ( SourceTypeElementInfo ) suppliedType ) . getHandle ( ) . getCompilationUnit ( ) ; HashSet localTypes = new HashSet ( ) ; localTypes . add ( cu . getPath ( ) . toString ( ) ) ; this . superTypesOnly = true ; resolve ( new Openable [ ] { ( Openable ) cu } , localTypes , null ) ; } } catch ( AbortCompilation e ) { } finally { reset ( ) ; } } public void resolve ( Openable [ ] openables , HashSet localTypes , IProgressMonitor monitor ) { try { int openablesLength = openables . length ; CompilationUnitDeclaration [ ] parsedUnits = new CompilationUnitDeclaration [ openablesLength ] ; boolean [ ] hasLocalType = new boolean [ openablesLength ] ; org . eclipse . jdt . core . ICompilationUnit [ ] cus = new org . eclipse . jdt . core . ICompilationUnit [ openablesLength ] ; int unitsIndex = <NUM_LIT:0> ; CompilationUnitDeclaration focusUnit = null ; ReferenceBinding focusBinaryBinding = null ; IType focus = this . builder . getType ( ) ; Openable focusOpenable = null ; if ( focus != null ) { if ( focus . isBinary ( ) ) { focusOpenable = ( Openable ) focus . getClassFile ( ) ; } else { focusOpenable = ( Openable ) focus . getCompilationUnit ( ) ; } } Parser parser = LanguageSupportFactory . getParser ( this , this . lookupEnvironment . globalOptions , this . lookupEnvironment . problemReporter , true , <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> ; i < openablesLength ; i ++ ) { Openable openable = openables [ i ] ; if ( openable instanceof org . eclipse . jdt . core . ICompilationUnit ) { org . eclipse . jdt . core . ICompilationUnit cu = ( org . eclipse . jdt . core . ICompilationUnit ) openable ; boolean containsLocalType = false ; if ( localTypes == null ) { containsLocalType = true ; } else { IPath path = cu . getPath ( ) ; containsLocalType = localTypes . contains ( path . toString ( ) ) ; } CompilationUnitDeclaration parsedUnit = null ; if ( cu . isOpen ( ) ) { CompilationResult result = new CompilationResult ( ( ICompilationUnit ) cu , i , openablesLength , this . options . maxProblemsPerUnit ) ; SourceTypeElementInfo [ ] typeInfos = null ; try { IType [ ] topLevelTypes = cu . getTypes ( ) ; int topLevelLength = topLevelTypes . length ; if ( topLevelLength == <NUM_LIT:0> ) continue ; typeInfos = new SourceTypeElementInfo [ topLevelLength ] ; for ( int j = <NUM_LIT:0> ; j < topLevelLength ; j ++ ) { IType topLevelType = topLevelTypes [ j ] ; typeInfos [ j ] = ( SourceTypeElementInfo ) ( ( JavaElement ) topLevelType ) . getElementInfo ( ) ; } } catch ( JavaModelException e ) { } int flags = ! containsLocalType ? SourceTypeConverter . MEMBER_TYPE : SourceTypeConverter . FIELD_AND_METHOD | SourceTypeConverter . MEMBER_TYPE | SourceTypeConverter . LOCAL_TYPE ; parsedUnit = SourceTypeConverter . buildCompilationUnit ( typeInfos , flags , this . lookupEnvironment . problemReporter , result ) ; if ( containsLocalType ) parsedUnit . bits |= ASTNode . HasAllMethodBodies ; } else { IFile file = ( IFile ) cu . getResource ( ) ; ICompilationUnit sourceUnit = this . builder . createCompilationUnitFromPath ( openable , file ) ; CompilationResult unitResult = new CompilationResult ( sourceUnit , i , openablesLength , this . options . maxProblemsPerUnit ) ; parsedUnit = parser . dietParse ( sourceUnit , unitResult ) ; } if ( parsedUnit != null ) { hasLocalType [ unitsIndex ] = containsLocalType ; cus [ unitsIndex ] = cu ; parsedUnits [ unitsIndex ++ ] = parsedUnit ; try { this . lookupEnvironment . buildTypeBindings ( parsedUnit , null ) ; if ( openable . equals ( focusOpenable ) ) { focusUnit = parsedUnit ; } } catch ( AbortCompilation e ) { } } } else { ClassFile classFile = ( ClassFile ) openable ; IBinaryType binaryType = ( IBinaryType ) JavaModelManager . getJavaModelManager ( ) . getInfo ( classFile . getType ( ) ) ; if ( binaryType == null ) { if ( classFile . getPackageFragmentRoot ( ) . isArchive ( ) ) { binaryType = this . builder . createInfoFromClassFileInJar ( classFile ) ; } else { IResource file = classFile . resource ( ) ; binaryType = this . builder . createInfoFromClassFile ( classFile , file ) ; } } if ( binaryType != null ) { try { BinaryTypeBinding binaryTypeBinding = this . lookupEnvironment . cacheBinaryType ( binaryType , false , null ) ; remember ( binaryType , binaryTypeBinding ) ; if ( openable . equals ( focusOpenable ) ) { focusBinaryBinding = binaryTypeBinding ; } } catch ( AbortCompilation e ) { } } } } TypeDeclaration focusLocalType = null ; if ( focus != null && focusBinaryBinding == null && focusUnit != null && ( ( Member ) focus ) . getOuterMostLocalContext ( ) != null ) { focusLocalType = new ASTNodeFinder ( focusUnit ) . findType ( focus ) ; } for ( int i = <NUM_LIT:0> ; i <= this . typeIndex ; i ++ ) { IGenericType suppliedType = this . typeModels [ i ] ; if ( suppliedType != null && suppliedType . isBinaryType ( ) ) { CompilationUnitDeclaration previousUnitBeingCompleted = this . lookupEnvironment . unitBeingCompleted ; try { if ( previousUnitBeingCompleted == null ) { this . lookupEnvironment . unitBeingCompleted = FakeUnit ; } ReferenceBinding typeBinding = this . typeBindings [ i ] ; typeBinding . superclass ( ) ; typeBinding . superInterfaces ( ) ; } catch ( AbortCompilation e ) { } finally { this . lookupEnvironment . unitBeingCompleted = previousUnitBeingCompleted ; } } } for ( int i = <NUM_LIT:0> ; i < unitsIndex ; i ++ ) { CompilationUnitDeclaration parsedUnit = parsedUnits [ i ] ; if ( parsedUnit != null ) { try { if ( hasLocalType [ i ] ) { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; parser . getMethodBodies ( parsedUnit ) ; } } catch ( AbortCompilation e ) { hasLocalType [ i ] = false ; } } } try { this . lookupEnvironment . completeTypeBindings ( parsedUnits , hasLocalType , unitsIndex ) ; } catch ( AbortCompilation e ) { } worked ( monitor , <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> ; i < unitsIndex ; i ++ ) { CompilationUnitDeclaration parsedUnit = parsedUnits [ i ] ; if ( parsedUnit != null ) { boolean containsLocalType = hasLocalType [ i ] ; if ( containsLocalType ) { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; parsedUnit . scope . faultInTypes ( ) ; parsedUnit . resolve ( ) ; } rememberAllTypes ( parsedUnit , cus [ i ] , containsLocalType ) ; } } if ( focusBinaryBinding == null && focus != null && focus . isBinary ( ) ) { char [ ] fullyQualifiedName = focus . getFullyQualifiedName ( ) . toCharArray ( ) ; focusBinaryBinding = this . lookupEnvironment . getCachedType ( CharOperation . splitOn ( '<CHAR_LIT:.>' , fullyQualifiedName ) ) ; if ( focusBinaryBinding == null ) return ; } reportHierarchy ( focus , focusLocalType , focusBinaryBinding ) ; } catch ( ClassCastException e ) { } catch ( AbortCompilation e ) { if ( TypeHierarchy . DEBUG ) e . printStackTrace ( ) ; } finally { reset ( ) ; } } private void setEnvironment ( LookupEnvironment lookupEnvironment , HierarchyBuilder builder ) { this . lookupEnvironment = lookupEnvironment ; this . builder = builder ; this . typeIndex = - <NUM_LIT:1> ; this . typeModels = new IGenericType [ <NUM_LIT:5> ] ; this . typeBindings = new ReferenceBinding [ <NUM_LIT:5> ] ; } public ReferenceBinding setFocusType ( char [ ] [ ] compoundName ) { if ( compoundName == null || this . lookupEnvironment == null ) return null ; this . focusType = this . lookupEnvironment . getCachedType ( compoundName ) ; if ( this . focusType == null ) { this . focusType = this . lookupEnvironment . askForType ( compoundName ) ; if ( this . focusType == null ) { int length = compoundName . length ; char [ ] typeName = compoundName [ length - <NUM_LIT:1> ] ; int firstDollar = CharOperation . indexOf ( '<CHAR_LIT>' , typeName ) ; if ( firstDollar != - <NUM_LIT:1> ) { compoundName [ length - <NUM_LIT:1> ] = CharOperation . subarray ( typeName , <NUM_LIT:0> , firstDollar ) ; this . focusType = this . lookupEnvironment . askForType ( compoundName ) ; if ( this . focusType != null ) { char [ ] [ ] memberTypeNames = CharOperation . splitOn ( '<CHAR_LIT>' , typeName , firstDollar + <NUM_LIT:1> , typeName . length ) ; for ( int i = <NUM_LIT:0> ; i < memberTypeNames . length ; i ++ ) { this . focusType = this . focusType . getMemberType ( memberTypeNames [ i ] ) ; } } } } } return this . focusType ; } public boolean subOrSuperOfFocus ( ReferenceBinding typeBinding ) { if ( this . focusType == null ) return true ; try { if ( subTypeOfType ( this . focusType , typeBinding ) ) return true ; if ( ! this . superTypesOnly && subTypeOfType ( typeBinding , this . focusType ) ) return true ; } catch ( AbortCompilation e ) { } return false ; } private boolean subTypeOfType ( ReferenceBinding subType , ReferenceBinding typeBinding ) { if ( typeBinding == null || subType == null ) return false ; if ( subType == typeBinding ) return true ; ReferenceBinding superclass = subType . superclass ( ) ; if ( superclass != null ) superclass = ( ReferenceBinding ) superclass . erasure ( ) ; if ( subTypeOfType ( superclass , typeBinding ) ) return true ; ReferenceBinding [ ] superInterfaces = subType . superInterfaces ( ) ; if ( superInterfaces != null ) { for ( int i = <NUM_LIT:0> , length = superInterfaces . length ; i < length ; i ++ ) { ReferenceBinding superInterface = ( ReferenceBinding ) superInterfaces [ i ] . erasure ( ) ; if ( subTypeOfType ( superInterface , typeBinding ) ) return true ; } } return false ; } protected void worked ( IProgressMonitor monitor , int work ) { if ( monitor != null ) { if ( monitor . isCanceled ( ) ) { throw new OperationCanceledException ( ) ; } else { monitor . worked ( work ) ; } } } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jdt . core . IClassFile ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jdt . internal . core . Openable ; import org . eclipse . jdt . internal . core . SearchableEnvironment ; public class RegionBasedHierarchyBuilder extends HierarchyBuilder { public RegionBasedHierarchyBuilder ( TypeHierarchy hierarchy ) throws JavaModelException { super ( hierarchy ) ; } public void build ( boolean computeSubtypes ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; try { manager . cacheZipFiles ( this ) ; if ( this . hierarchy . focusType == null || computeSubtypes ) { IProgressMonitor typeInRegionMonitor = this . hierarchy . progressMonitor == null ? null : new SubProgressMonitor ( this . hierarchy . progressMonitor , <NUM_LIT:30> ) ; HashMap allOpenablesInRegion = determineOpenablesInRegion ( typeInRegionMonitor ) ; this . hierarchy . initialize ( allOpenablesInRegion . size ( ) ) ; IProgressMonitor buildMonitor = this . hierarchy . progressMonitor == null ? null : new SubProgressMonitor ( this . hierarchy . progressMonitor , <NUM_LIT> ) ; createTypeHierarchyBasedOnRegion ( allOpenablesInRegion , buildMonitor ) ; ( ( RegionBasedTypeHierarchy ) this . hierarchy ) . pruneDeadBranches ( ) ; } else { this . hierarchy . initialize ( <NUM_LIT:1> ) ; buildSupertypes ( ) ; } } finally { manager . flushZipFiles ( this ) ; } } private void createTypeHierarchyBasedOnRegion ( HashMap allOpenablesInRegion , IProgressMonitor monitor ) { try { int size = allOpenablesInRegion . size ( ) ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , size * <NUM_LIT:2> ) ; this . infoToHandle = new HashMap ( size ) ; Iterator javaProjects = allOpenablesInRegion . entrySet ( ) . iterator ( ) ; while ( javaProjects . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) javaProjects . next ( ) ; JavaProject project = ( JavaProject ) entry . getKey ( ) ; ArrayList allOpenables = ( ArrayList ) entry . getValue ( ) ; Openable [ ] openables = new Openable [ allOpenables . size ( ) ] ; allOpenables . toArray ( openables ) ; try { SearchableEnvironment searchableEnvironment = project . newSearchableNameEnvironment ( this . hierarchy . workingCopies ) ; this . nameLookup = searchableEnvironment . nameLookup ; this . hierarchyResolver . resolve ( openables , null , monitor ) ; } catch ( JavaModelException e ) { } } } finally { if ( monitor != null ) monitor . done ( ) ; } } private HashMap determineOpenablesInRegion ( IProgressMonitor monitor ) { try { HashMap allOpenables = new HashMap ( ) ; IJavaElement [ ] roots = ( ( RegionBasedTypeHierarchy ) this . hierarchy ) . region . getElements ( ) ; int length = roots . length ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , length ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IJavaElement root = roots [ i ] ; IJavaProject javaProject = root . getJavaProject ( ) ; ArrayList openables = ( ArrayList ) allOpenables . get ( javaProject ) ; if ( openables == null ) { openables = new ArrayList ( ) ; allOpenables . put ( javaProject , openables ) ; } switch ( root . getElementType ( ) ) { case IJavaElement . JAVA_PROJECT : injectAllOpenablesForJavaProject ( ( IJavaProject ) root , openables ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : injectAllOpenablesForPackageFragmentRoot ( ( IPackageFragmentRoot ) root , openables ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : injectAllOpenablesForPackageFragment ( ( IPackageFragment ) root , openables ) ; break ; case IJavaElement . CLASS_FILE : case IJavaElement . COMPILATION_UNIT : openables . add ( root ) ; break ; case IJavaElement . TYPE : IType type = ( IType ) root ; if ( type . isBinary ( ) ) { openables . add ( type . getClassFile ( ) ) ; } else { openables . add ( type . getCompilationUnit ( ) ) ; } break ; default : break ; } worked ( monitor , <NUM_LIT:1> ) ; } return allOpenables ; } finally { if ( monitor != null ) monitor . done ( ) ; } } private void injectAllOpenablesForJavaProject ( IJavaProject project , ArrayList openables ) { try { IPackageFragmentRoot [ ] devPathRoots = ( ( JavaProject ) project ) . getPackageFragmentRoots ( ) ; if ( devPathRoots == null ) { return ; } for ( int j = <NUM_LIT:0> ; j < devPathRoots . length ; j ++ ) { IPackageFragmentRoot root = devPathRoots [ j ] ; injectAllOpenablesForPackageFragmentRoot ( root , openables ) ; } } catch ( JavaModelException e ) { } } private void injectAllOpenablesForPackageFragment ( IPackageFragment packFrag , ArrayList openables ) { try { IPackageFragmentRoot root = ( IPackageFragmentRoot ) packFrag . getParent ( ) ; int kind = root . getKind ( ) ; if ( kind != <NUM_LIT:0> ) { boolean isSourcePackageFragment = ( kind == IPackageFragmentRoot . K_SOURCE ) ; if ( isSourcePackageFragment ) { ICompilationUnit [ ] cus = packFrag . getCompilationUnits ( ) ; for ( int i = <NUM_LIT:0> , length = cus . length ; i < length ; i ++ ) { openables . add ( cus [ i ] ) ; } } else { IClassFile [ ] classFiles = packFrag . getClassFiles ( ) ; for ( int i = <NUM_LIT:0> , length = classFiles . length ; i < length ; i ++ ) { openables . add ( classFiles [ i ] ) ; } } } } catch ( JavaModelException e ) { } } private void injectAllOpenablesForPackageFragmentRoot ( IPackageFragmentRoot root , ArrayList openables ) { try { IJavaElement [ ] packFrags = root . getChildren ( ) ; for ( int k = <NUM_LIT:0> ; k < packFrags . length ; k ++ ) { IPackageFragment packFrag = ( IPackageFragment ) packFrags [ k ] ; injectAllOpenablesForPackageFragment ( packFrag , openables ) ; } } catch ( JavaModelException e ) { return ; } } } </s>
<s> package org . eclipse . jdt . internal . core . hierarchy ; import java . util . ArrayList ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . internal . core . CompilationUnit ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . Openable ; import org . eclipse . jdt . internal . core . Region ; import org . eclipse . jdt . internal . core . TypeVector ; public class RegionBasedTypeHierarchy extends TypeHierarchy { protected IRegion region ; public RegionBasedTypeHierarchy ( IRegion region , ICompilationUnit [ ] workingCopies , IType type , boolean computeSubtypes ) { super ( type , workingCopies , ( IJavaSearchScope ) null , computeSubtypes ) ; Region newRegion = new Region ( ) { public void add ( IJavaElement element ) { if ( ! contains ( element ) ) { removeAllChildren ( element ) ; this . rootElements . add ( element ) ; if ( element . getElementType ( ) == IJavaElement . JAVA_PROJECT ) { try { IPackageFragmentRoot [ ] roots = ( ( IJavaProject ) element ) . getPackageFragmentRoots ( ) ; for ( int i = <NUM_LIT:0> , length = roots . length ; i < length ; i ++ ) { if ( roots [ i ] . isArchive ( ) && ! this . rootElements . contains ( roots [ i ] ) ) this . rootElements . add ( roots [ i ] ) ; } } catch ( JavaModelException e ) { } } this . rootElements . trimToSize ( ) ; } } } ; IJavaElement [ ] elements = region . getElements ( ) ; for ( int i = <NUM_LIT:0> , length = elements . length ; i < length ; i ++ ) { newRegion . add ( elements [ i ] ) ; } this . region = newRegion ; if ( elements . length > <NUM_LIT:0> ) this . project = elements [ <NUM_LIT:0> ] . getJavaProject ( ) ; } protected void initializeRegions ( ) { super . initializeRegions ( ) ; IJavaElement [ ] roots = this . region . getElements ( ) ; for ( int i = <NUM_LIT:0> ; i < roots . length ; i ++ ) { IJavaElement root = roots [ i ] ; if ( root instanceof IOpenable ) { this . files . put ( root , new ArrayList ( ) ) ; } else { Openable o = ( Openable ) ( ( JavaElement ) root ) . getOpenableParent ( ) ; if ( o != null ) { this . files . put ( o , new ArrayList ( ) ) ; } } checkCanceled ( ) ; } } protected void compute ( ) throws JavaModelException , CoreException { HierarchyBuilder builder = new RegionBasedHierarchyBuilder ( this ) ; builder . build ( this . computeSubtypes ) ; } protected boolean isAffectedByOpenable ( IJavaElementDelta delta , IJavaElement element , int eventType ) { if ( element instanceof CompilationUnit && ( ( CompilationUnit ) element ) . isWorkingCopy ( ) ) { return super . isAffectedByOpenable ( delta , element , eventType ) ; } if ( this . focusType == null ) { return this . region . contains ( element ) ; } else { return super . isAffectedByOpenable ( delta , element , eventType ) ; } } public IJavaProject javaProject ( ) { return this . project ; } public void pruneDeadBranches ( ) { pruneDeadBranches ( getRootClasses ( ) ) ; pruneDeadBranches ( getRootInterfaces ( ) ) ; } private boolean pruneDeadBranches ( IType type ) { TypeVector subtypes = ( TypeVector ) this . typeToSubtypes . get ( type ) ; if ( subtypes == null ) return true ; pruneDeadBranches ( subtypes . copy ( ) . elements ( ) ) ; subtypes = ( TypeVector ) this . typeToSubtypes . get ( type ) ; return ( subtypes == null || subtypes . size == <NUM_LIT:0> ) ; } private void pruneDeadBranches ( IType [ ] types ) { for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { IType type = types [ i ] ; if ( pruneDeadBranches ( type ) && ! this . region . contains ( type ) ) { removeType ( type ) ; } } } protected void removeType ( IType type ) { IType [ ] subtypes = getSubtypes ( type ) ; this . typeToSubtypes . remove ( type ) ; if ( subtypes != null ) { for ( int i = <NUM_LIT:0> ; i < subtypes . length ; i ++ ) { removeType ( subtypes [ i ] ) ; } } IType superclass = ( IType ) this . classToSuperclass . remove ( type ) ; if ( superclass != null ) { TypeVector types = ( TypeVector ) this . typeToSubtypes . get ( superclass ) ; if ( types != null ) types . remove ( type ) ; } IType [ ] superinterfaces = ( IType [ ] ) this . typeToSuperInterfaces . remove ( type ) ; if ( superinterfaces != null ) { for ( int i = <NUM_LIT:0> , length = superinterfaces . length ; i < length ; i ++ ) { IType superinterface = superinterfaces [ i ] ; TypeVector types = ( TypeVector ) this . typeToSubtypes . get ( superinterface ) ; if ( types != null ) types . remove ( type ) ; } } this . interfaces . remove ( type ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IMemberValuePair ; import org . eclipse . jdt . internal . core . util . Util ; public class MemberValuePair implements IMemberValuePair { String memberName ; public Object value ; public int valueKind = K_UNKNOWN ; public MemberValuePair ( String memberName ) { this . memberName = memberName ; } public MemberValuePair ( String memberName , Object value , int valueKind ) { this ( memberName ) ; this . value = value ; this . valueKind = valueKind ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof MemberValuePair ) ) { return false ; } MemberValuePair other = ( MemberValuePair ) obj ; return this . valueKind == other . valueKind && this . memberName . equals ( other . memberName ) && ( this . value == other . value || ( this . value != null && this . value . equals ( other . value ) ) || ( this . value instanceof Object [ ] && other . value instanceof Object [ ] && Util . equalArraysOrNull ( ( Object [ ] ) this . value , ( Object [ ] ) other . value ) ) ) ; } public String getMemberName ( ) { return this . memberName ; } public Object getValue ( ) { return this . value ; } public int getValueKind ( ) { return this . valueKind ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + ( ( this . memberName == null ) ? <NUM_LIT:0> : this . memberName . hashCode ( ) ) ; result = prime * result + ( ( this . value == null ) ? <NUM_LIT:0> : this . value . hashCode ( ) ) ; result = prime * result + this . valueKind ; return result ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElementDelta ; public class SimpleDelta { protected int kind = <NUM_LIT:0> ; protected int changeFlags = <NUM_LIT:0> ; public void added ( ) { this . kind = IJavaElementDelta . ADDED ; } public void changed ( int flags ) { this . kind = IJavaElementDelta . CHANGED ; this . changeFlags |= flags ; } public int getFlags ( ) { return this . changeFlags ; } public int getKind ( ) { return this . kind ; } public void modifiers ( ) { changed ( IJavaElementDelta . F_MODIFIERS ) ; } public void removed ( ) { this . kind = IJavaElementDelta . REMOVED ; this . changeFlags = <NUM_LIT:0> ; } public void superTypes ( ) { changed ( IJavaElementDelta . F_SUPER_TYPES ) ; } protected void toDebugString ( StringBuffer buffer ) { buffer . append ( "<STR_LIT:[>" ) ; switch ( getKind ( ) ) { case IJavaElementDelta . ADDED : buffer . append ( '<CHAR_LIT>' ) ; break ; case IJavaElementDelta . REMOVED : buffer . append ( '<CHAR_LIT:->' ) ; break ; case IJavaElementDelta . CHANGED : buffer . append ( '<CHAR_LIT>' ) ; break ; default : buffer . append ( '<CHAR_LIT>' ) ; break ; } buffer . append ( "<STR_LIT>" ) ; toDebugString ( buffer , getFlags ( ) ) ; buffer . append ( "<STR_LIT:}>" ) ; } protected boolean toDebugString ( StringBuffer buffer , int flags ) { boolean prev = false ; if ( ( flags & IJavaElementDelta . F_MODIFIERS ) != <NUM_LIT:0> ) { if ( prev ) buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; prev = true ; } if ( ( flags & IJavaElementDelta . F_SUPER_TYPES ) != <NUM_LIT:0> ) { if ( prev ) buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; prev = true ; } return prev ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; toDebugString ( buffer ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . io . * ; import java . net . URI ; import java . text . MessageFormat ; import java . util . * ; import java . util . Map . Entry ; import java . util . zip . ZipFile ; import javax . xml . parsers . DocumentBuilder ; import javax . xml . parsers . DocumentBuilderFactory ; import javax . xml . parsers . ParserConfigurationException ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . core . runtime . content . IContentTypeManager . ContentTypeChangeEvent ; import org . eclipse . core . runtime . content . IContentTypeManager . IContentTypeChangeListener ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . core . runtime . preferences . DefaultScope ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . IPreferencesService ; import org . eclipse . core . runtime . preferences . IScopeContext ; import org . eclipse . core . runtime . preferences . InstanceScope ; import org . eclipse . core . runtime . preferences . IEclipsePreferences . PreferenceChangeEvent ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . CompilationParticipant ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . internal . codeassist . CompletionEngine ; import org . eclipse . jdt . internal . codeassist . SelectionEngine ; import org . eclipse . jdt . internal . compiler . AbstractAnnotationProcessorManager ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObjectToInt ; import org . eclipse . jdt . internal . core . JavaProjectElementInfo . ProjectCache ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . core . hierarchy . TypeHierarchy ; import org . eclipse . jdt . internal . core . search . AbstractSearchScope ; import org . eclipse . jdt . internal . core . search . BasicSearchEngine ; import org . eclipse . jdt . internal . core . search . IRestrictedAccessTypeRequestor ; import org . eclipse . jdt . internal . core . search . JavaWorkspaceScope ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; import org . eclipse . jdt . internal . core . search . processing . JobManager ; import org . eclipse . jdt . internal . core . util . HashtableOfArrayToObject ; import org . eclipse . jdt . internal . core . util . LRUCache ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . jdt . internal . core . util . WeakHashSet ; import org . eclipse . jdt . internal . core . util . WeakHashSetOfCharArray ; import org . eclipse . jdt . internal . core . util . LRUCache . Stats ; import org . eclipse . jdt . internal . formatter . DefaultCodeFormatter ; import org . osgi . service . prefs . BackingStoreException ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import org . w3c . dom . NodeList ; import org . xml . sax . InputSource ; import org . xml . sax . SAXException ; public class JavaModelManager implements ISaveParticipant , IContentTypeChangeListener { static class ZipCache { private Map map ; Object owner ; ZipCache ( Object owner ) { this . map = new HashMap ( ) ; this . owner = owner ; } public void flush ( ) { Thread currentThread = Thread . currentThread ( ) ; Iterator iterator = this . map . values ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { try { ZipFile zipFile = ( ZipFile ) iterator . next ( ) ; if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + currentThread + "<STR_LIT>" + zipFile . getName ( ) ) ; } zipFile . close ( ) ; } catch ( IOException e ) { } } } public ZipFile getCache ( IPath path ) { return ( ZipFile ) this . map . get ( path ) ; } public void setCache ( IPath path , ZipFile zipFile ) { this . map . put ( path , zipFile ) ; } } final JavaModel javaModel = new JavaModel ( ) ; public HashMap variables = new HashMap ( <NUM_LIT:5> ) ; public HashSet variablesWithInitializer = new HashSet ( <NUM_LIT:5> ) ; public HashMap deprecatedVariables = new HashMap ( <NUM_LIT:5> ) ; public HashSet readOnlyVariables = new HashSet ( <NUM_LIT:5> ) ; public HashMap previousSessionVariables = new HashMap ( <NUM_LIT:5> ) ; private ThreadLocal variableInitializationInProgress = new ThreadLocal ( ) ; public HashMap containers = new HashMap ( <NUM_LIT:5> ) ; public HashMap previousSessionContainers = new HashMap ( <NUM_LIT:5> ) ; private ThreadLocal containerInitializationInProgress = new ThreadLocal ( ) ; ThreadLocal containersBeingInitialized = new ThreadLocal ( ) ; public static final int NO_BATCH_INITIALIZATION = <NUM_LIT:0> ; public static final int NEED_BATCH_INITIALIZATION = <NUM_LIT:1> ; public static final int BATCH_INITIALIZATION_IN_PROGRESS = <NUM_LIT:2> ; public static final int BATCH_INITIALIZATION_FINISHED = <NUM_LIT:3> ; public int batchContainerInitializations = NO_BATCH_INITIALIZATION ; public BatchInitializationMonitor batchContainerInitializationsProgress = new BatchInitializationMonitor ( ) ; public Hashtable containerInitializersCache = new Hashtable ( <NUM_LIT:5> ) ; private ThreadLocal classpathsBeingResolved = new ThreadLocal ( ) ; public JavaWorkspaceScope workspaceScope ; private WeakHashSet stringSymbols = new WeakHashSet ( <NUM_LIT:5> ) ; private WeakHashSetOfCharArray charArraySymbols = new WeakHashSetOfCharArray ( <NUM_LIT:5> ) ; private IConfigurationElement annotationProcessorManagerFactory = null ; public Map rootPathToAttachments = new Hashtable ( ) ; public final static String CP_VARIABLE_PREFERENCES_PREFIX = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String CP_USERLIBRARY_PREFERENCES_PREFIX = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String CP_ENTRY_IGNORE = "<STR_LIT>" ; public final static IPath CP_ENTRY_IGNORE_PATH = new Path ( CP_ENTRY_IGNORE ) ; public final static String TRUE = "<STR_LIT:true>" ; private final static int VARIABLES_AND_CONTAINERS_FILE_VERSION = <NUM_LIT:2> ; public static final String CPVARIABLE_INITIALIZER_EXTPOINT_ID = "<STR_LIT>" ; public static final String CPCONTAINER_INITIALIZER_EXTPOINT_ID = "<STR_LIT>" ; public static final String FORMATTER_EXTPOINT_ID = "<STR_LIT>" ; public static final String COMPILATION_PARTICIPANT_EXTPOINT_ID = "<STR_LIT>" ; public static final String ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID = "<STR_LIT>" ; private static final String RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS = "<STR_LIT>" ; public final static IPath VARIABLE_INITIALIZATION_IN_PROGRESS = new Path ( "<STR_LIT>" ) ; public final static IClasspathContainer CONTAINER_INITIALIZATION_IN_PROGRESS = new IClasspathContainer ( ) { public IClasspathEntry [ ] getClasspathEntries ( ) { return null ; } public String getDescription ( ) { return "<STR_LIT>" ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return null ; } public String toString ( ) { return getDescription ( ) ; } } ; private static final String BUFFER_MANAGER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String INDEX_MANAGER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String INDEX_MANAGER_ADVANCED_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String COMPILER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String JAVAMODEL_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String JAVAMODELCACHE_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String CP_RESOLVE_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String CP_RESOLVE_ADVANCED_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String CP_RESOLVE_FAILURE_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String ZIP_ACCESS_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String DELTA_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String DELTA_DEBUG_VERBOSE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String HIERARCHY_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String POST_ACTION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String BUILDER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String BUILDER_STATS_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String COMPLETION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String RESOLUTION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String SELECTION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String SEARCH_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String SOURCE_MAPPER_DEBUG_VERBOSE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String FORMATTER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String COMPLETION_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String SELECTION_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String DELTA_LISTENER_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String VARIABLE_INITIALIZER_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String CONTAINER_INITIALIZER_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String RECONCILE_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private final static String INDEXED_SECONDARY_TYPES = "<STR_LIT>" ; public static boolean PERF_VARIABLE_INITIALIZER = false ; public static boolean PERF_CONTAINER_INITIALIZER = false ; boolean resolveReferencedLibrariesForContainers = false ; public final static ICompilationUnit [ ] NO_WORKING_COPY = new ICompilationUnit [ <NUM_LIT:0> ] ; HashSet optionNames = new HashSet ( <NUM_LIT:20> ) ; Hashtable optionsCache ; public final IEclipsePreferences [ ] preferencesLookup = new IEclipsePreferences [ <NUM_LIT:2> ] ; static final int PREF_INSTANCE = <NUM_LIT:0> ; static final int PREF_DEFAULT = <NUM_LIT:1> ; static final Object [ ] [ ] NO_PARTICIPANTS = new Object [ <NUM_LIT:0> ] [ ] ; public static class CompilationParticipants { private final static int MAX_SOURCE_LEVEL = <NUM_LIT:7> ; private Object [ ] [ ] registeredParticipants = null ; private HashSet managedMarkerTypes ; public CompilationParticipant [ ] getCompilationParticipants ( IJavaProject project ) { final Object [ ] [ ] participantsPerSource = getRegisteredParticipants ( ) ; if ( participantsPerSource == NO_PARTICIPANTS ) return null ; String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; final int sourceLevelIndex = indexForSourceLevel ( sourceLevel ) ; final Object [ ] participants = participantsPerSource [ sourceLevelIndex ] ; int length = participants . length ; CompilationParticipant [ ] result = new CompilationParticipant [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( participants [ i ] instanceof IConfigurationElement ) { final IConfigurationElement configElement = ( IConfigurationElement ) participants [ i ] ; final int participantIndex = i ; SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { Object executableExtension = configElement . createExecutableExtension ( "<STR_LIT:class>" ) ; for ( int j = sourceLevelIndex ; j < MAX_SOURCE_LEVEL ; j ++ ) participantsPerSource [ j ] [ participantIndex ] = executableExtension ; } } ) ; } CompilationParticipant participant ; if ( ( participants [ i ] instanceof CompilationParticipant ) && ( participant = ( CompilationParticipant ) participants [ i ] ) . isActive ( project ) ) result [ index ++ ] = participant ; } if ( index == <NUM_LIT:0> ) return null ; if ( index < length ) System . arraycopy ( result , <NUM_LIT:0> , result = new CompilationParticipant [ index ] , <NUM_LIT:0> , index ) ; return result ; } public HashSet managedMarkerTypes ( ) { if ( this . managedMarkerTypes == null ) { getRegisteredParticipants ( ) ; } return this . managedMarkerTypes ; } private synchronized Object [ ] [ ] getRegisteredParticipants ( ) { if ( this . registeredParticipants != null ) { return this . registeredParticipants ; } this . managedMarkerTypes = new HashSet ( ) ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , COMPILATION_PARTICIPANT_EXTPOINT_ID ) ; if ( extension == null ) return this . registeredParticipants = NO_PARTICIPANTS ; final ArrayList modifyingEnv = new ArrayList ( ) ; final ArrayList creatingProblems = new ArrayList ( ) ; final ArrayList others = new ArrayList ( ) ; 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 ++ ) { final IConfigurationElement configElement = configElements [ j ] ; String elementName = configElement . getName ( ) ; if ( ! ( "<STR_LIT>" . equals ( elementName ) ) ) { continue ; } if ( TRUE . equals ( configElement . getAttribute ( "<STR_LIT>" ) ) ) modifyingEnv . add ( configElement ) ; else if ( TRUE . equals ( configElement . getAttribute ( "<STR_LIT>" ) ) ) creatingProblems . add ( configElement ) ; else others . add ( configElement ) ; IConfigurationElement [ ] managedMarkers = configElement . getChildren ( "<STR_LIT>" ) ; for ( int k = <NUM_LIT:0> , length = managedMarkers . length ; k < length ; k ++ ) { IConfigurationElement element = managedMarkers [ k ] ; String markerType = element . getAttribute ( "<STR_LIT>" ) ; if ( markerType != null ) this . managedMarkerTypes . add ( markerType ) ; } } } int size = modifyingEnv . size ( ) + creatingProblems . size ( ) + others . size ( ) ; if ( size == <NUM_LIT:0> ) return this . registeredParticipants = NO_PARTICIPANTS ; IConfigurationElement [ ] configElements = new IConfigurationElement [ size ] ; int index = <NUM_LIT:0> ; index = sortParticipants ( modifyingEnv , configElements , index ) ; index = sortParticipants ( creatingProblems , configElements , index ) ; index = sortParticipants ( others , configElements , index ) ; Object [ ] [ ] result = new Object [ MAX_SOURCE_LEVEL ] [ ] ; int length = configElements . length ; for ( int i = <NUM_LIT:0> ; i < MAX_SOURCE_LEVEL ; i ++ ) { result [ i ] = new Object [ length ] ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String sourceLevel = configElements [ i ] . getAttribute ( "<STR_LIT>" ) ; int sourceLevelIndex = indexForSourceLevel ( sourceLevel ) ; for ( int j = sourceLevelIndex ; j < MAX_SOURCE_LEVEL ; j ++ ) { result [ j ] [ i ] = configElements [ i ] ; } } return this . registeredParticipants = result ; } private int indexForSourceLevel ( String sourceLevel ) { if ( sourceLevel == null ) return <NUM_LIT:0> ; int majVersion = ( int ) ( CompilerOptions . versionToJdkLevel ( sourceLevel ) > > > <NUM_LIT:16> ) ; switch ( majVersion ) { case ClassFileConstants . MAJOR_VERSION_1_2 : return <NUM_LIT:1> ; case ClassFileConstants . MAJOR_VERSION_1_3 : return <NUM_LIT:2> ; case ClassFileConstants . MAJOR_VERSION_1_4 : return <NUM_LIT:3> ; case ClassFileConstants . MAJOR_VERSION_1_5 : return <NUM_LIT:4> ; case ClassFileConstants . MAJOR_VERSION_1_6 : return <NUM_LIT:5> ; case ClassFileConstants . MAJOR_VERSION_1_7 : return <NUM_LIT:6> ; default : return <NUM_LIT:0> ; } } private int sortParticipants ( ArrayList group , IConfigurationElement [ ] configElements , int index ) { int size = group . size ( ) ; if ( size == <NUM_LIT:0> ) return index ; Object [ ] elements = group . toArray ( ) ; Util . sort ( elements , new Util . Comparer ( ) { public int compare ( Object a , Object b ) { if ( a == b ) return <NUM_LIT:0> ; String id = ( ( IConfigurationElement ) a ) . getAttribute ( "<STR_LIT:id>" ) ; if ( id == null ) return - <NUM_LIT:1> ; IConfigurationElement [ ] requiredElements = ( ( IConfigurationElement ) b ) . getChildren ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = requiredElements . length ; i < length ; i ++ ) { IConfigurationElement required = requiredElements [ i ] ; if ( id . equals ( required . getAttribute ( "<STR_LIT:id>" ) ) ) return <NUM_LIT:1> ; } return - <NUM_LIT:1> ; } } ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) configElements [ index + i ] = ( IConfigurationElement ) elements [ i ] ; return index + size ; } } public final CompilationParticipants compilationParticipants = new CompilationParticipants ( ) ; public ThreadLocal abortOnMissingSource = new ThreadLocal ( ) ; private ExternalFoldersManager externalFoldersManager = ExternalFoldersManager . getExternalFoldersManager ( ) ; public static boolean conflictsWithOutputLocation ( IPath folderPath , JavaProject project ) { try { IPath outputLocation = project . getOutputLocation ( ) ; if ( outputLocation == null ) { return true ; } if ( outputLocation . isPrefixOf ( folderPath ) ) { IClasspathEntry [ ] classpath = project . getResolvedClasspath ( ) ; boolean isOutputUsed = false ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) { if ( entry . getPath ( ) . equals ( outputLocation ) ) { return false ; } if ( entry . getOutputLocation ( ) == null ) { isOutputUsed = true ; } } } return isOutputUsed ; } return false ; } catch ( JavaModelException e ) { return true ; } } public synchronized IClasspathContainer containerGet ( IJavaProject project , IPath containerPath ) { if ( containerIsInitializationInProgress ( project , containerPath ) ) { return CONTAINER_INITIALIZATION_IN_PROGRESS ; } Map projectContainers = ( Map ) this . containers . get ( project ) ; if ( projectContainers == null ) { return null ; } IClasspathContainer container = ( IClasspathContainer ) projectContainers . get ( containerPath ) ; return container ; } public synchronized IClasspathContainer containerGetDefaultToPreviousSession ( IJavaProject project , IPath containerPath ) { Map projectContainers = ( Map ) this . containers . get ( project ) ; if ( projectContainers == null ) return getPreviousSessionContainer ( containerPath , project ) ; IClasspathContainer container = ( IClasspathContainer ) projectContainers . get ( containerPath ) ; if ( container == null ) return getPreviousSessionContainer ( containerPath , project ) ; return container ; } private boolean containerIsInitializationInProgress ( IJavaProject project , IPath containerPath ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations == null ) return false ; HashSet projectInitializations = ( HashSet ) initializations . get ( project ) ; if ( projectInitializations == null ) return false ; return projectInitializations . contains ( containerPath ) ; } private void containerAddInitializationInProgress ( IJavaProject project , IPath containerPath ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations == null ) this . containerInitializationInProgress . set ( initializations = new HashMap ( ) ) ; HashSet projectInitializations = ( HashSet ) initializations . get ( project ) ; if ( projectInitializations == null ) initializations . put ( project , projectInitializations = new HashSet ( ) ) ; projectInitializations . add ( containerPath ) ; } public void containerBeingInitializedPut ( IJavaProject project , IPath containerPath , IClasspathContainer container ) { Map perProjectContainers = ( Map ) this . containersBeingInitialized . get ( ) ; if ( perProjectContainers == null ) this . containersBeingInitialized . set ( perProjectContainers = new HashMap ( ) ) ; HashMap perPathContainers = ( HashMap ) perProjectContainers . get ( project ) ; if ( perPathContainers == null ) perProjectContainers . put ( project , perPathContainers = new HashMap ( ) ) ; perPathContainers . put ( containerPath , container ) ; } public IClasspathContainer containerBeingInitializedGet ( IJavaProject project , IPath containerPath ) { Map perProjectContainers = ( Map ) this . containersBeingInitialized . get ( ) ; if ( perProjectContainers == null ) return null ; HashMap perPathContainers = ( HashMap ) perProjectContainers . get ( project ) ; if ( perPathContainers == null ) return null ; return ( IClasspathContainer ) perPathContainers . get ( containerPath ) ; } public IClasspathContainer containerBeingInitializedRemove ( IJavaProject project , IPath containerPath ) { Map perProjectContainers = ( Map ) this . containersBeingInitialized . get ( ) ; if ( perProjectContainers == null ) return null ; HashMap perPathContainers = ( HashMap ) perProjectContainers . get ( project ) ; if ( perPathContainers == null ) return null ; IClasspathContainer container = ( IClasspathContainer ) perPathContainers . remove ( containerPath ) ; if ( perPathContainers . size ( ) == <NUM_LIT:0> ) perPathContainers . remove ( project ) ; if ( perProjectContainers . size ( ) == <NUM_LIT:0> ) this . containersBeingInitialized . set ( null ) ; return container ; } public synchronized void containerPut ( IJavaProject project , IPath containerPath , IClasspathContainer container ) { if ( container == CONTAINER_INITIALIZATION_IN_PROGRESS ) { containerAddInitializationInProgress ( project , containerPath ) ; return ; } else { containerRemoveInitializationInProgress ( project , containerPath ) ; Map projectContainers = ( Map ) this . containers . get ( project ) ; if ( projectContainers == null ) { projectContainers = new HashMap ( <NUM_LIT:1> ) ; this . containers . put ( project , projectContainers ) ; } if ( container == null ) { projectContainers . remove ( containerPath ) ; } else { projectContainers . put ( containerPath , container ) ; } Map previousContainers = ( Map ) this . previousSessionContainers . get ( project ) ; if ( previousContainers != null ) { previousContainers . remove ( containerPath ) ; } } } public synchronized void containerRemove ( IJavaProject project ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations != null ) { initializations . remove ( project ) ; } this . containers . remove ( project ) ; } public boolean containerPutIfInitializingWithSameEntries ( IPath containerPath , IJavaProject [ ] projects , IClasspathContainer [ ] respectiveContainers ) { int projectLength = projects . length ; if ( projectLength != <NUM_LIT:1> ) return false ; final IClasspathContainer container = respectiveContainers [ <NUM_LIT:0> ] ; IJavaProject project = projects [ <NUM_LIT:0> ] ; if ( ! containerIsInitializationInProgress ( project , containerPath ) ) return false ; IClasspathContainer previousContainer = containerGetDefaultToPreviousSession ( project , containerPath ) ; if ( container == null ) { if ( previousContainer == null ) { containerPut ( project , containerPath , null ) ; return true ; } return false ; } final IClasspathEntry [ ] newEntries = container . getClasspathEntries ( ) ; if ( previousContainer == null ) if ( newEntries . length == <NUM_LIT:0> ) { containerPut ( project , containerPath , container ) ; return true ; } else { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( containerPath , projects , respectiveContainers , container , newEntries , null ) ; return false ; } final IClasspathEntry [ ] oldEntries = previousContainer . getClasspathEntries ( ) ; if ( oldEntries . length != newEntries . length ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( containerPath , projects , respectiveContainers , container , newEntries , oldEntries ) ; return false ; } for ( int i = <NUM_LIT:0> , length = newEntries . length ; i < length ; i ++ ) { if ( newEntries [ i ] == null ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( project , containerPath , newEntries ) ; return false ; } if ( ! newEntries [ i ] . equals ( oldEntries [ i ] ) ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( containerPath , projects , respectiveContainers , container , newEntries , oldEntries ) ; return false ; } } containerPut ( project , containerPath , container ) ; return true ; } private void verbose_missbehaving_container ( IPath containerPath , IJavaProject [ ] projects , IClasspathContainer [ ] respectiveContainers , final IClasspathContainer container , final IClasspathEntry [ ] newEntries , final IClasspathEntry [ ] oldEntries ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( projects , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { return ( ( IJavaProject ) o ) . getElementName ( ) ; } } ) + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( respectiveContainers , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } buffer . append ( container . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( oldEntries == null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; } else { for ( int j = <NUM_LIT:0> ; j < oldEntries . length ; j ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( oldEntries [ j ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( respectiveContainers , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } buffer . append ( container . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; for ( int j = <NUM_LIT:0> ; j < newEntries . length ; j ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( newEntries [ j ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" ) ; } void verbose_missbehaving_container ( IJavaProject project , IPath containerPath , IClasspathEntry [ ] classpathEntries ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( classpathEntries , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } buffer . append ( o ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" ) ; } void verbose_missbehaving_container_null_entries ( IJavaProject project , IPath containerPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" ) ; } private void containerRemoveInitializationInProgress ( IJavaProject project , IPath containerPath ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations == null ) return ; HashSet projectInitializations = ( HashSet ) initializations . get ( project ) ; if ( projectInitializations == null ) return ; projectInitializations . remove ( containerPath ) ; if ( projectInitializations . size ( ) == <NUM_LIT:0> ) initializations . remove ( project ) ; if ( initializations . size ( ) == <NUM_LIT:0> ) this . containerInitializationInProgress . set ( null ) ; } private synchronized void containersReset ( String [ ] containerIDs ) { for ( int i = <NUM_LIT:0> ; i < containerIDs . length ; i ++ ) { String containerID = containerIDs [ i ] ; Iterator projectIterator = this . containers . values ( ) . iterator ( ) ; while ( projectIterator . hasNext ( ) ) { Map projectContainers = ( Map ) projectIterator . next ( ) ; if ( projectContainers != null ) { Iterator containerIterator = projectContainers . keySet ( ) . iterator ( ) ; while ( containerIterator . hasNext ( ) ) { IPath containerPath = ( IPath ) containerIterator . next ( ) ; if ( containerID . equals ( containerPath . segment ( <NUM_LIT:0> ) ) ) { projectContainers . put ( containerPath , null ) ; } } } } } } public static IJavaElement create ( IResource resource , IJavaProject project ) { if ( resource == null ) { return null ; } int type = resource . getType ( ) ; switch ( type ) { case IResource . PROJECT : return JavaCore . create ( ( IProject ) resource ) ; case IResource . FILE : return create ( ( IFile ) resource , project ) ; case IResource . FOLDER : return create ( ( IFolder ) resource , project ) ; case IResource . ROOT : return JavaCore . create ( ( IWorkspaceRoot ) resource ) ; default : return null ; } } public static IJavaElement create ( IFile file , IJavaProject project ) { if ( file == null ) { return null ; } if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } if ( file . getFileExtension ( ) != null ) { String name = file . getName ( ) ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( name ) ) return createCompilationUnitFrom ( file , project ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( name ) ) return createClassFileFrom ( file , project ) ; return createJarPackageFragmentRootFrom ( file , project ) ; } return null ; } public static IJavaElement create ( IFolder folder , IJavaProject project ) { if ( folder == null ) { return null ; } IJavaElement element ; if ( project == null ) { project = JavaCore . create ( folder . getProject ( ) ) ; element = determineIfOnClasspath ( folder , project ) ; if ( element == null ) { IJavaProject [ ] projects ; try { projects = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) . getJavaProjects ( ) ; } catch ( JavaModelException e ) { return null ; } for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { project = projects [ i ] ; element = determineIfOnClasspath ( folder , project ) ; if ( element != null ) break ; } } } else { element = determineIfOnClasspath ( folder , project ) ; } return element ; } public static IClassFile createClassFileFrom ( IFile file , IJavaProject project ) { if ( file == null ) { return null ; } if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } IPackageFragment pkg = ( IPackageFragment ) determineIfOnClasspath ( file , project ) ; if ( pkg == null ) { PackageFragmentRoot root = ( PackageFragmentRoot ) project . getPackageFragmentRoot ( file . getParent ( ) ) ; pkg = root . getPackageFragment ( CharOperation . NO_STRINGS ) ; } return pkg . getClassFile ( file . getName ( ) ) ; } public static ICompilationUnit createCompilationUnitFrom ( IFile file , IJavaProject project ) { if ( file == null ) return null ; if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } IPackageFragment pkg = ( IPackageFragment ) determineIfOnClasspath ( file , project ) ; if ( pkg == null ) { PackageFragmentRoot root = ( PackageFragmentRoot ) project . getPackageFragmentRoot ( file . getParent ( ) ) ; pkg = root . getPackageFragment ( CharOperation . NO_STRINGS ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT>" + file . getFullPath ( ) ) ; } } return pkg . getCompilationUnit ( file . getName ( ) ) ; } public static IPackageFragmentRoot createJarPackageFragmentRootFrom ( IFile file , IJavaProject project ) { if ( file == null ) { return null ; } if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } IPath resourcePath = file . getFullPath ( ) ; try { IClasspathEntry entry = ( ( JavaProject ) project ) . getClasspathEntryFor ( resourcePath ) ; if ( entry != null ) { return project . getPackageFragmentRoot ( file ) ; } } catch ( JavaModelException e ) { } return null ; } public static IJavaElement determineIfOnClasspath ( IResource resource , IJavaProject project ) { IPath resourcePath = resource . getFullPath ( ) ; boolean isExternal = ExternalFoldersManager . isInternalPathForExternalFolder ( resourcePath ) ; if ( isExternal ) resourcePath = resource . getLocation ( ) ; try { JavaProjectElementInfo projectInfo = ( JavaProjectElementInfo ) getJavaModelManager ( ) . getInfo ( project ) ; ProjectCache projectCache = projectInfo == null ? null : projectInfo . projectCache ; HashtableOfArrayToObject allPkgFragmentsCache = projectCache == null ? null : projectCache . allPkgFragmentsCache ; IClasspathEntry [ ] entries = org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( resourcePath . lastSegment ( ) ) ? project . getRawClasspath ( ) : ( ( JavaProject ) project ) . getResolvedClasspath ( ) ; int length = entries . length ; if ( length > <NUM_LIT:0> ) { String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) continue ; IPath rootPath = entry . getPath ( ) ; if ( rootPath . equals ( resourcePath ) ) { return project . getPackageFragmentRoot ( resource ) ; } else if ( rootPath . isPrefixOf ( resourcePath ) ) { if ( ! Util . isExcluded ( resource , ( ( ClasspathEntry ) entry ) . fullInclusionPatternChars ( ) , ( ( ClasspathEntry ) entry ) . fullExclusionPatternChars ( ) ) ) { PackageFragmentRoot root = isExternal ? new ExternalPackageFragmentRoot ( rootPath , ( JavaProject ) project ) : ( PackageFragmentRoot ) ( ( JavaProject ) project ) . getFolderPackageFragmentRoot ( rootPath ) ; if ( root == null ) return null ; IPath pkgPath = resourcePath . removeFirstSegments ( rootPath . segmentCount ( ) ) ; if ( resource . getType ( ) == IResource . FILE ) { pkgPath = pkgPath . removeLastSegments ( <NUM_LIT:1> ) ; } String [ ] pkgName = pkgPath . segments ( ) ; if ( allPkgFragmentsCache != null && allPkgFragmentsCache . containsKey ( pkgName ) ) return root . getPackageFragment ( pkgName ) ; if ( pkgName . length != <NUM_LIT:0> && JavaConventions . validatePackageName ( Util . packageName ( pkgPath , sourceLevel , complianceLevel ) , sourceLevel , complianceLevel ) . getSeverity ( ) == IStatus . ERROR ) { return null ; } return root . getPackageFragment ( pkgName ) ; } } } } } catch ( JavaModelException npe ) { return null ; } return null ; } private static JavaModelManager MANAGER = new JavaModelManager ( ) ; private JavaModelCache cache ; private ThreadLocal temporaryCache = new ThreadLocal ( ) ; protected HashSet elementsOutOfSynchWithBuffers = new HashSet ( <NUM_LIT:11> ) ; public DeltaProcessingState deltaState = new DeltaProcessingState ( ) ; public IndexManager indexManager = null ; protected Map perProjectInfos = new HashMap ( <NUM_LIT:5> ) ; protected Map perWorkingCopyInfos = new HashMap ( <NUM_LIT:5> ) ; protected WeakHashMap searchScopes = new WeakHashMap ( ) ; public static class PerProjectInfo { private static final int JAVADOC_CACHE_INITIAL_SIZE = <NUM_LIT:10> ; static final IJavaModelStatus NEED_RESOLUTION = new JavaModelStatus ( ) ; public IProject project ; public Object savedState ; public boolean triedRead ; public IClasspathEntry [ ] rawClasspath ; public IClasspathEntry [ ] referencedEntries ; public IJavaModelStatus rawClasspathStatus ; public int rawTimeStamp = <NUM_LIT:0> ; public boolean writtingRawClasspath = false ; public IClasspathEntry [ ] resolvedClasspath ; public IJavaModelStatus unresolvedEntryStatus ; public Map rootPathToRawEntries ; public Map rootPathToResolvedEntries ; public IPath outputLocation ; public IEclipsePreferences preferences ; public Hashtable options ; public Hashtable secondaryTypes ; public LRUCache javadocCache ; public PerProjectInfo ( IProject project ) { this . triedRead = false ; this . savedState = null ; this . project = project ; this . javadocCache = new LRUCache ( JAVADOC_CACHE_INITIAL_SIZE ) ; } public synchronized IClasspathEntry [ ] getResolvedClasspath ( ) { if ( this . unresolvedEntryStatus == NEED_RESOLUTION ) return null ; return this . resolvedClasspath ; } public void forgetExternalTimestampsAndIndexes ( ) { IClasspathEntry [ ] classpath = this . resolvedClasspath ; if ( classpath == null ) return ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IndexManager indexManager = manager . indexManager ; Map externalTimeStamps = manager . deltaState . getExternalLibTimeStamps ( ) ; HashMap rootInfos = JavaModelManager . getDeltaState ( ) . otherRoots ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath path = entry . getPath ( ) ; if ( rootInfos . get ( path ) == null ) { externalTimeStamps . remove ( path ) ; indexManager . removeIndex ( path ) ; } } } } public void rememberExternalLibTimestamps ( ) { IClasspathEntry [ ] classpath = this . resolvedClasspath ; if ( classpath == null ) return ; Map externalTimeStamps = JavaModelManager . getJavaModelManager ( ) . deltaState . getExternalLibTimeStamps ( ) ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath path = entry . getPath ( ) ; if ( externalTimeStamps . get ( path ) == null ) { Object target = JavaModel . getExternalTarget ( path , true ) ; if ( target instanceof File ) { long timestamp = DeltaProcessor . getTimeStamp ( ( java . io . File ) target ) ; externalTimeStamps . put ( path , new Long ( timestamp ) ) ; } } } } } public synchronized ClasspathChange resetResolvedClasspath ( ) { JavaModelManager . getJavaModelManager ( ) . resetNonChainingJarsCache ( ) ; return setResolvedClasspath ( null , null , null , null , this . rawTimeStamp , true ) ; } private ClasspathChange setClasspath ( IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] referencedEntries , IPath newOutputLocation , IJavaModelStatus newRawClasspathStatus , IClasspathEntry [ ] newResolvedClasspath , Map newRootPathToRawEntries , Map newRootPathToResolvedEntries , IJavaModelStatus newUnresolvedEntryStatus , boolean addClasspathChange ) { ClasspathChange classpathChange = addClasspathChange ? addClasspathChange ( ) : null ; if ( referencedEntries != null ) this . referencedEntries = referencedEntries ; if ( this . referencedEntries == null ) this . referencedEntries = ClasspathEntry . NO_ENTRIES ; this . rawClasspath = newRawClasspath ; this . outputLocation = newOutputLocation ; this . rawClasspathStatus = newRawClasspathStatus ; this . resolvedClasspath = newResolvedClasspath ; this . rootPathToRawEntries = newRootPathToRawEntries ; this . rootPathToResolvedEntries = newRootPathToResolvedEntries ; this . unresolvedEntryStatus = newUnresolvedEntryStatus ; this . javadocCache = new LRUCache ( JAVADOC_CACHE_INITIAL_SIZE ) ; return classpathChange ; } protected ClasspathChange addClasspathChange ( ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; ClasspathChange classpathChange = manager . deltaState . addClasspathChange ( this . project , this . rawClasspath , this . outputLocation , this . resolvedClasspath ) ; return classpathChange ; } public ClasspathChange setRawClasspath ( IClasspathEntry [ ] newRawClasspath , IPath newOutputLocation , IJavaModelStatus newRawClasspathStatus ) { return setRawClasspath ( newRawClasspath , null , newOutputLocation , newRawClasspathStatus ) ; } public synchronized ClasspathChange setRawClasspath ( IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] referencedEntries , IPath newOutputLocation , IJavaModelStatus newRawClasspathStatus ) { this . rawTimeStamp ++ ; return setClasspath ( newRawClasspath , referencedEntries , newOutputLocation , newRawClasspathStatus , null , null , null , null , true ) ; } public ClasspathChange setResolvedClasspath ( IClasspathEntry [ ] newResolvedClasspath , Map newRootPathToRawEntries , Map newRootPathToResolvedEntries , IJavaModelStatus newUnresolvedEntryStatus , int timeStamp , boolean addClasspathChange ) { return setResolvedClasspath ( newResolvedClasspath , null , newRootPathToRawEntries , newRootPathToResolvedEntries , newUnresolvedEntryStatus , timeStamp , addClasspathChange ) ; } public synchronized ClasspathChange setResolvedClasspath ( IClasspathEntry [ ] newResolvedClasspath , IClasspathEntry [ ] referencedEntries , Map newRootPathToRawEntries , Map newRootPathToResolvedEntries , IJavaModelStatus newUnresolvedEntryStatus , int timeStamp , boolean addClasspathChange ) { if ( this . rawTimeStamp != timeStamp ) return null ; return setClasspath ( this . rawClasspath , referencedEntries , this . outputLocation , this . rawClasspathStatus , newResolvedClasspath , newRootPathToRawEntries , newRootPathToResolvedEntries , newUnresolvedEntryStatus , addClasspathChange ) ; } public synchronized IClasspathEntry [ ] [ ] readAndCacheClasspath ( JavaProject javaProject ) { IClasspathEntry [ ] [ ] classpath ; IJavaModelStatus status ; try { classpath = javaProject . readFileEntriesWithException ( null ) ; status = JavaModelStatus . VERIFIED_OK ; } catch ( CoreException e ) { classpath = new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_cannotReadClasspathFile , javaProject . getElementName ( ) ) ) ; } catch ( IOException e ) { classpath = new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; if ( Messages . file_badFormat . equals ( e . getMessage ( ) ) ) status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_xmlFormatError , javaProject . getElementName ( ) , Messages . file_badFormat ) ) ; else status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_cannotReadClasspathFile , javaProject . getElementName ( ) ) ) ; } catch ( ClasspathEntry . AssertionFailedException e ) { classpath = new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_illegalEntryInClasspathFile , new String [ ] { javaProject . getElementName ( ) , e . getMessage ( ) } ) ) ; } int rawClasspathLength = classpath [ <NUM_LIT:0> ] . length ; IPath output = null ; if ( rawClasspathLength > <NUM_LIT:0> ) { IClasspathEntry entry = classpath [ <NUM_LIT:0> ] [ rawClasspathLength - <NUM_LIT:1> ] ; if ( entry . getContentKind ( ) == ClasspathEntry . K_OUTPUT ) { output = entry . getPath ( ) ; IClasspathEntry [ ] copy = new IClasspathEntry [ rawClasspathLength - <NUM_LIT:1> ] ; System . arraycopy ( classpath [ <NUM_LIT:0> ] , <NUM_LIT:0> , copy , <NUM_LIT:0> , copy . length ) ; classpath [ <NUM_LIT:0> ] = copy ; } } setRawClasspath ( classpath [ <NUM_LIT:0> ] , classpath [ <NUM_LIT:1> ] , output , status ) ; return classpath ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . project . getFullPath ( ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( this . rawClasspath == null ) { buffer . append ( "<STR_LIT>" ) ; } else { for ( int i = <NUM_LIT:0> , length = this . rawClasspath . length ; i < length ; i ++ ) { buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; buffer . append ( this . rawClasspath [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; IClasspathEntry [ ] resolvedCP = this . resolvedClasspath ; if ( resolvedCP == null ) { buffer . append ( "<STR_LIT>" ) ; } else { for ( int i = <NUM_LIT:0> , length = resolvedCP . length ; i < length ; i ++ ) { buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; buffer . append ( resolvedCP [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; if ( this . unresolvedEntryStatus == NEED_RESOLUTION ) buffer . append ( "<STR_LIT>" ) ; else buffer . append ( this . unresolvedEntryStatus == null ? "<STR_LIT>" : this . unresolvedEntryStatus . toString ( ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( this . outputLocation == null ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( this . outputLocation ) ; } return buffer . toString ( ) ; } public boolean writeAndCacheClasspath ( JavaProject javaProject , final IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] newReferencedEntries , final IPath newOutputLocation ) throws JavaModelException { try { this . writtingRawClasspath = true ; if ( newReferencedEntries == null ) newReferencedEntries = this . referencedEntries ; if ( ! javaProject . writeFileEntries ( newRawClasspath , newReferencedEntries , newOutputLocation ) ) { return false ; } setRawClasspath ( newRawClasspath , newReferencedEntries , newOutputLocation , JavaModelStatus . VERIFIED_OK ) ; } finally { this . writtingRawClasspath = false ; } return true ; } public boolean writeAndCacheClasspath ( JavaProject javaProject , final IClasspathEntry [ ] newRawClasspath , final IPath newOutputLocation ) throws JavaModelException { return writeAndCacheClasspath ( javaProject , newRawClasspath , null , newOutputLocation ) ; } } public static class PerWorkingCopyInfo implements IProblemRequestor { int useCount = <NUM_LIT:0> ; IProblemRequestor problemRequestor ; CompilationUnit workingCopy ; public PerWorkingCopyInfo ( CompilationUnit workingCopy , IProblemRequestor problemRequestor ) { this . workingCopy = workingCopy ; this . problemRequestor = problemRequestor ; } public void acceptProblem ( IProblem problem ) { IProblemRequestor requestor = getProblemRequestor ( ) ; if ( requestor == null ) return ; requestor . acceptProblem ( problem ) ; } public void beginReporting ( ) { IProblemRequestor requestor = getProblemRequestor ( ) ; if ( requestor == null ) return ; requestor . beginReporting ( ) ; } public void endReporting ( ) { IProblemRequestor requestor = getProblemRequestor ( ) ; if ( requestor == null ) return ; requestor . endReporting ( ) ; } public IProblemRequestor getProblemRequestor ( ) { if ( this . problemRequestor == null && this . workingCopy . owner != null ) { return this . workingCopy . owner . getProblemRequestor ( this . workingCopy ) ; } return this . problemRequestor ; } public ICompilationUnit getWorkingCopy ( ) { return this . workingCopy ; } public boolean isActive ( ) { IProblemRequestor requestor = getProblemRequestor ( ) ; return requestor != null && requestor . isActive ( ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( ( ( JavaElement ) this . workingCopy ) . toStringWithAncestors ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . useCount ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . problemRequestor ) ; if ( this . problemRequestor == null ) { IProblemRequestor requestor = getProblemRequestor ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( requestor ) ; } return buffer . toString ( ) ; } } public static boolean VERBOSE = false ; public static boolean CP_RESOLVE_VERBOSE = false ; public static boolean CP_RESOLVE_VERBOSE_ADVANCED = false ; public static boolean CP_RESOLVE_VERBOSE_FAILURE = false ; public static boolean ZIP_ACCESS_VERBOSE = false ; private ThreadLocal zipFiles = new ThreadLocal ( ) ; private UserLibraryManager userLibraryManager ; private Set nonChainingJars ; public static class EclipsePreferencesListener implements IEclipsePreferences . IPreferenceChangeListener { public void preferenceChange ( IEclipsePreferences . PreferenceChangeEvent event ) { String propertyName = event . getKey ( ) ; if ( propertyName . startsWith ( JavaCore . PLUGIN_ID ) ) { if ( propertyName . startsWith ( CP_VARIABLE_PREFERENCES_PREFIX ) ) { String varName = propertyName . substring ( CP_VARIABLE_PREFERENCES_PREFIX . length ( ) ) ; JavaModelManager manager = getJavaModelManager ( ) ; if ( manager . variablesWithInitializer . contains ( varName ) ) { String oldValue = ( String ) event . getOldValue ( ) ; if ( oldValue == null ) { manager . variablesWithInitializer . remove ( varName ) ; } else { manager . getInstancePreferences ( ) . put ( varName , oldValue ) ; } } else { String newValue = ( String ) event . getNewValue ( ) ; IPath newPath ; if ( newValue != null && ! ( newValue = newValue . trim ( ) ) . equals ( CP_ENTRY_IGNORE ) ) { newPath = new Path ( newValue ) ; } else { newPath = null ; } try { SetVariablesOperation operation = new SetVariablesOperation ( new String [ ] { varName } , new IPath [ ] { newPath } , false ) ; operation . runOperation ( null ) ; } catch ( JavaModelException e ) { Util . log ( e , "<STR_LIT>" + varName + "<STR_LIT:U+0020toU+0020>" + newPath ) ; } } } else if ( propertyName . startsWith ( CP_CONTAINER_PREFERENCES_PREFIX ) ) { recreatePersistedContainer ( propertyName , ( String ) event . getNewValue ( ) , false ) ; } else if ( propertyName . equals ( JavaCore . CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_RESOURCE_COPY_FILTER ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_DUPLICATE_RESOURCE ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_INVALID_CLASSPATH ) || propertyName . equals ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS ) || propertyName . equals ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS ) || propertyName . equals ( JavaCore . CORE_INCOMPLETE_CLASSPATH ) || propertyName . equals ( JavaCore . CORE_CIRCULAR_CLASSPATH ) || propertyName . equals ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL ) ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IJavaModel model = manager . getJavaModel ( ) ; IJavaProject [ ] projects ; try { projects = model . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , pl = projects . length ; i < pl ; i ++ ) { JavaProject javaProject = ( JavaProject ) projects [ i ] ; manager . deltaState . addClasspathValidation ( javaProject ) ; try { javaProject . getProject ( ) . touch ( null ) ; } catch ( CoreException e ) { } } } catch ( JavaModelException e ) { } } else if ( propertyName . startsWith ( CP_USERLIBRARY_PREFERENCES_PREFIX ) ) { String libName = propertyName . substring ( CP_USERLIBRARY_PREFERENCES_PREFIX . length ( ) ) ; UserLibraryManager manager = JavaModelManager . getUserLibraryManager ( ) ; manager . updateUserLibrary ( libName , ( String ) event . getNewValue ( ) ) ; } } try { IJavaProject [ ] projects = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { ( ( JavaProject ) projects [ i ] ) . resetCaches ( ) ; } } catch ( JavaModelException e ) { } } } EclipsePreferencesListener instancePreferencesListener = new EclipsePreferencesListener ( ) ; IEclipsePreferences . INodeChangeListener instanceNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] ) { JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] = ( ( IScopeContext ) new InstanceScope ( ) ) . getNode ( JavaCore . PLUGIN_ID ) ; JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] . addPreferenceChangeListener ( new EclipsePreferencesListener ( ) ) ; } } } ; IEclipsePreferences . INodeChangeListener defaultNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] ) { JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] = ( ( IScopeContext ) new DefaultScope ( ) ) . getNode ( JavaCore . PLUGIN_ID ) ; } } } ; IEclipsePreferences . IPreferenceChangeListener propertyListener ; IEclipsePreferences . IPreferenceChangeListener resourcesPropertyListener ; private JavaModelManager ( ) { if ( Platform . isRunning ( ) ) { this . indexManager = new IndexManager ( ) ; this . nonChainingJars = loadNonChainingJarsCache ( ) ; String includeContainerReferencedLib = System . getProperty ( RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS ) ; this . resolveReferencedLibrariesForContainers = TRUE . equalsIgnoreCase ( includeContainerReferencedLib ) ; } } private void addDeprecatedOptions ( Hashtable options ) { options . put ( JavaCore . COMPILER_PB_INVALID_IMPORT , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_UNREACHABLE_CODE , JavaCore . ERROR ) ; } public void addNonChainingJar ( IPath path ) { if ( this . nonChainingJars != null ) this . nonChainingJars . add ( path ) ; } public void cacheZipFiles ( Object owner ) { ZipCache zipCache = ( ZipCache ) this . zipFiles . get ( ) ; if ( zipCache != null ) { return ; } this . zipFiles . set ( new ZipCache ( owner ) ) ; } public void closeZipFile ( ZipFile zipFile ) { if ( zipFile == null ) return ; if ( this . zipFiles . get ( ) != null ) { return ; } try { if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + zipFile . getName ( ) ) ; } zipFile . close ( ) ; } catch ( IOException e ) { } } public void configurePluginDebugOptions ( ) { if ( JavaCore . getPlugin ( ) . isDebugging ( ) ) { String option = Platform . getDebugOption ( BUFFER_MANAGER_DEBUG ) ; if ( option != null ) BufferManager . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( BUILDER_DEBUG ) ; if ( option != null ) JavaBuilder . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( COMPILER_DEBUG ) ; if ( option != null ) Compiler . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( BUILDER_STATS_DEBUG ) ; if ( option != null ) JavaBuilder . SHOW_STATS = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( COMPLETION_DEBUG ) ; if ( option != null ) CompletionEngine . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( CP_RESOLVE_DEBUG ) ; if ( option != null ) JavaModelManager . CP_RESOLVE_VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( CP_RESOLVE_ADVANCED_DEBUG ) ; if ( option != null ) JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( CP_RESOLVE_FAILURE_DEBUG ) ; if ( option != null ) JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( DELTA_DEBUG ) ; if ( option != null ) DeltaProcessor . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( DELTA_DEBUG_VERBOSE ) ; if ( option != null ) DeltaProcessor . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( HIERARCHY_DEBUG ) ; if ( option != null ) TypeHierarchy . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( INDEX_MANAGER_DEBUG ) ; if ( option != null ) JobManager . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( INDEX_MANAGER_ADVANCED_DEBUG ) ; if ( option != null ) IndexManager . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( JAVAMODEL_DEBUG ) ; if ( option != null ) JavaModelManager . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( JAVAMODELCACHE_DEBUG ) ; if ( option != null ) JavaModelCache . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( POST_ACTION_DEBUG ) ; if ( option != null ) JavaModelOperation . POST_ACTION_VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( RESOLUTION_DEBUG ) ; if ( option != null ) NameLookup . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( SEARCH_DEBUG ) ; if ( option != null ) BasicSearchEngine . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( SELECTION_DEBUG ) ; if ( option != null ) SelectionEngine . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( ZIP_ACCESS_DEBUG ) ; if ( option != null ) JavaModelManager . ZIP_ACCESS_VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( SOURCE_MAPPER_DEBUG_VERBOSE ) ; if ( option != null ) SourceMapper . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( FORMATTER_DEBUG ) ; if ( option != null ) DefaultCodeFormatter . DEBUG = option . equalsIgnoreCase ( TRUE ) ; } if ( PerformanceStats . ENABLED ) { CompletionEngine . PERF = PerformanceStats . isEnabled ( COMPLETION_PERF ) ; SelectionEngine . PERF = PerformanceStats . isEnabled ( SELECTION_PERF ) ; DeltaProcessor . PERF = PerformanceStats . isEnabled ( DELTA_LISTENER_PERF ) ; JavaModelManager . PERF_VARIABLE_INITIALIZER = PerformanceStats . isEnabled ( VARIABLE_INITIALIZER_PERF ) ; JavaModelManager . PERF_CONTAINER_INITIALIZER = PerformanceStats . isEnabled ( CONTAINER_INITIALIZER_PERF ) ; ReconcileWorkingCopyOperation . PERF = PerformanceStats . isEnabled ( RECONCILE_PERF ) ; } } public AbstractAnnotationProcessorManager createAnnotationProcessorManager ( ) { synchronized ( this ) { if ( this . annotationProcessorManagerFactory == null ) { IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID ) ; if ( extension == null ) return null ; IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { if ( i > <NUM_LIT:0> ) { Util . log ( null , "<STR_LIT>" + extensions [ i ] . getUniqueIdentifier ( ) ) ; break ; } IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { final IConfigurationElement configElement = configElements [ j ] ; if ( "<STR_LIT>" . equals ( configElement . getName ( ) ) ) { this . annotationProcessorManagerFactory = configElement ; break ; } } } } } if ( this . annotationProcessorManagerFactory == null ) { return null ; } final AbstractAnnotationProcessorManager [ ] apm = new AbstractAnnotationProcessorManager [ <NUM_LIT:1> ] ; apm [ <NUM_LIT:0> ] = null ; final IConfigurationElement factory = this . annotationProcessorManagerFactory ; SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { Object executableExtension = factory . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( executableExtension instanceof AbstractAnnotationProcessorManager ) { apm [ <NUM_LIT:0> ] = ( AbstractAnnotationProcessorManager ) executableExtension ; } } } ) ; return apm [ <NUM_LIT:0> ] ; } public int discardPerWorkingCopyInfo ( CompilationUnit workingCopy ) throws JavaModelException { JavaElementDeltaBuilder deltaBuilder = null ; if ( workingCopy . isPrimary ( ) && workingCopy . hasUnsavedChanges ( ) ) { deltaBuilder = new JavaElementDeltaBuilder ( workingCopy ) ; } PerWorkingCopyInfo info = null ; synchronized ( this . perWorkingCopyInfos ) { WorkingCopyOwner owner = workingCopy . owner ; Map workingCopyToInfos = ( Map ) this . perWorkingCopyInfos . get ( owner ) ; if ( workingCopyToInfos == null ) return - <NUM_LIT:1> ; info = ( PerWorkingCopyInfo ) workingCopyToInfos . get ( workingCopy ) ; if ( info == null ) return - <NUM_LIT:1> ; if ( -- info . useCount == <NUM_LIT:0> ) { workingCopyToInfos . remove ( workingCopy ) ; if ( workingCopyToInfos . isEmpty ( ) ) { this . perWorkingCopyInfos . remove ( owner ) ; } } } if ( info . useCount == <NUM_LIT:0> ) { removeInfoAndChildren ( workingCopy ) ; workingCopy . closeBuffer ( ) ; if ( deltaBuilder != null ) { deltaBuilder . buildDeltas ( ) ; if ( deltaBuilder . delta != null ) { getDeltaProcessor ( ) . registerJavaModelDelta ( deltaBuilder . delta ) ; } } } return info . useCount ; } public void doneSaving ( ISaveContext context ) { } public void flushZipFiles ( Object owner ) { ZipCache zipCache = ( ZipCache ) this . zipFiles . get ( ) ; if ( zipCache == null ) { return ; } if ( zipCache . owner == owner ) { this . zipFiles . set ( null ) ; zipCache . flush ( ) ; } } public synchronized boolean forceBatchInitializations ( boolean initAfterLoad ) { switch ( this . batchContainerInitializations ) { case NO_BATCH_INITIALIZATION : this . batchContainerInitializations = NEED_BATCH_INITIALIZATION ; return true ; case BATCH_INITIALIZATION_FINISHED : if ( initAfterLoad ) return false ; this . batchContainerInitializations = NEED_BATCH_INITIALIZATION ; return true ; } return false ; } private synchronized boolean batchContainerInitializations ( ) { switch ( this . batchContainerInitializations ) { case NEED_BATCH_INITIALIZATION : this . batchContainerInitializations = BATCH_INITIALIZATION_IN_PROGRESS ; return true ; case BATCH_INITIALIZATION_IN_PROGRESS : return true ; } return false ; } private synchronized void batchInitializationFinished ( ) { this . batchContainerInitializations = BATCH_INITIALIZATION_FINISHED ; } public IClasspathContainer getClasspathContainer ( final IPath containerPath , final IJavaProject project ) throws JavaModelException { IClasspathContainer container = containerGet ( project , containerPath ) ; if ( container == null ) { if ( batchContainerInitializations ( ) ) { try { container = initializeAllContainers ( project , containerPath ) ; } finally { batchInitializationFinished ( ) ; } } else { container = initializeContainer ( project , containerPath ) ; containerBeingInitializedRemove ( project , containerPath ) ; SetContainerOperation operation = new SetContainerOperation ( containerPath , new IJavaProject [ ] { project } , new IClasspathContainer [ ] { container } ) ; operation . runOperation ( null ) ; } } return container ; } public IClasspathEntry [ ] getReferencedClasspathEntries ( IClasspathEntry libraryEntry , IJavaProject project ) { IClasspathEntry [ ] referencedEntries = ( ( ClasspathEntry ) libraryEntry ) . resolvedChainedLibraries ( ) ; if ( project == null ) return referencedEntries ; PerProjectInfo perProjectInfo = getPerProjectInfo ( project . getProject ( ) , false ) ; if ( perProjectInfo == null ) return referencedEntries ; List pathToReferencedEntries = new ArrayList ( referencedEntries . length ) ; for ( int index = <NUM_LIT:0> ; index < referencedEntries . length ; index ++ ) { if ( pathToReferencedEntries . contains ( referencedEntries [ index ] . getPath ( ) ) ) continue ; IClasspathEntry persistedEntry = null ; if ( ( persistedEntry = ( IClasspathEntry ) perProjectInfo . rootPathToResolvedEntries . get ( referencedEntries [ index ] . getPath ( ) ) ) != null ) { referencedEntries [ index ] = persistedEntry ; } pathToReferencedEntries . add ( referencedEntries [ index ] . getPath ( ) ) ; } return referencedEntries ; } public DeltaProcessor getDeltaProcessor ( ) { return this . deltaState . getDeltaProcessor ( ) ; } public static DeltaProcessingState getDeltaState ( ) { return MANAGER . deltaState ; } protected HashSet getElementsOutOfSynchWithBuffers ( ) { return this . elementsOutOfSynchWithBuffers ; } public static ExternalFoldersManager getExternalManager ( ) { return MANAGER . externalFoldersManager ; } public static IndexManager getIndexManager ( ) { return MANAGER . indexManager ; } public synchronized Object getInfo ( IJavaElement element ) { HashMap tempCache = ( HashMap ) this . temporaryCache . get ( ) ; if ( tempCache != null ) { Object result = tempCache . get ( element ) ; if ( result != null ) { return result ; } } return this . cache . getInfo ( element ) ; } public synchronized IJavaElement getExistingElement ( IJavaElement element ) { return this . cache . getExistingElement ( element ) ; } public HashSet getExternalWorkingCopyProjects ( ) { synchronized ( this . perWorkingCopyInfos ) { HashSet result = null ; Iterator values = this . perWorkingCopyInfos . values ( ) . iterator ( ) ; while ( values . hasNext ( ) ) { Map ownerCopies = ( Map ) values . next ( ) ; Iterator workingCopies = ownerCopies . keySet ( ) . iterator ( ) ; while ( workingCopies . hasNext ( ) ) { ICompilationUnit workingCopy = ( ICompilationUnit ) workingCopies . next ( ) ; IJavaProject project = workingCopy . getJavaProject ( ) ; if ( project . getElementName ( ) . equals ( ExternalJavaProject . EXTERNAL_PROJECT_NAME ) ) { if ( result == null ) result = new HashSet ( ) ; result . add ( project ) ; } } } return result ; } } public IEclipsePreferences getInstancePreferences ( ) { return this . preferencesLookup [ PREF_INSTANCE ] ; } public Hashtable getDefaultOptions ( ) { Hashtable defaultOptions = new Hashtable ( <NUM_LIT:10> ) ; IEclipsePreferences defaultPreferences = getDefaultPreferences ( ) ; Iterator iterator = this . optionNames . iterator ( ) ; while ( iterator . hasNext ( ) ) { String propertyName = ( String ) iterator . next ( ) ; String value = defaultPreferences . get ( propertyName , null ) ; if ( value != null ) defaultOptions . put ( propertyName , value ) ; } defaultOptions . put ( JavaCore . CORE_ENCODING , JavaCore . getEncoding ( ) ) ; addDeprecatedOptions ( defaultOptions ) ; return defaultOptions ; } public IEclipsePreferences getDefaultPreferences ( ) { return this . preferencesLookup [ PREF_DEFAULT ] ; } public final JavaModel getJavaModel ( ) { return this . javaModel ; } public final static JavaModelManager getJavaModelManager ( ) { return MANAGER ; } public Object getLastBuiltState ( IProject project , IProgressMonitor monitor ) { if ( ! JavaProject . hasJavaNature ( project ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( project + "<STR_LIT>" ) ; return null ; } PerProjectInfo info = getPerProjectInfo ( project , true ) ; if ( ! info . triedRead ) { info . triedRead = true ; try { if ( monitor != null ) monitor . subTask ( Messages . bind ( Messages . build_readStateProgress , project . getName ( ) ) ) ; info . savedState = readState ( project ) ; } catch ( CoreException e ) { e . printStackTrace ( ) ; } } return info . savedState ; } public String getOption ( String optionName ) { if ( JavaCore . CORE_ENCODING . equals ( optionName ) ) { return JavaCore . getEncoding ( ) ; } if ( isDeprecatedOption ( optionName ) ) { return JavaCore . ERROR ; } String propertyName = optionName ; if ( this . optionNames . contains ( propertyName ) ) { IPreferencesService service = Platform . getPreferencesService ( ) ; String value = service . get ( optionName , null , this . preferencesLookup ) ; return value == null ? null : value . trim ( ) ; } return null ; } public Hashtable getOptions ( ) { Hashtable cachedOptions ; if ( ( cachedOptions = this . optionsCache ) != null ) return new Hashtable ( cachedOptions ) ; if ( ! Platform . isRunning ( ) ) { return this . optionsCache = getDefaultOptionsNoInitialization ( ) ; } Hashtable options = new Hashtable ( <NUM_LIT:10> ) ; IPreferencesService service = Platform . getPreferencesService ( ) ; Iterator iterator = this . optionNames . iterator ( ) ; while ( iterator . hasNext ( ) ) { String propertyName = ( String ) iterator . next ( ) ; String propertyValue = service . get ( propertyName , null , this . preferencesLookup ) ; if ( propertyValue != null ) { options . put ( propertyName , propertyValue ) ; } } options . put ( JavaCore . CORE_ENCODING , JavaCore . getEncoding ( ) ) ; addDeprecatedOptions ( options ) ; Util . fixTaskTags ( options ) ; this . optionsCache = new Hashtable ( options ) ; return options ; } private Hashtable getDefaultOptionsNoInitialization ( ) { Map defaultOptionsMap = new CompilerOptions ( ) . getMap ( ) ; defaultOptionsMap . put ( JavaCore . COMPILER_LOCAL_VARIABLE_ATTR , JavaCore . GENERATE ) ; defaultOptionsMap . put ( JavaCore . COMPILER_CODEGEN_UNUSED_LOCAL , JavaCore . PRESERVE ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_TAGS , JavaCore . DEFAULT_TASK_TAGS ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_PRIORITIES , JavaCore . DEFAULT_TASK_PRIORITIES ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_CASE_SENSITIVE , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . COMPILER_DOC_COMMENT_SUPPORT , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_RESOURCE_COPY_FILTER , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_INVALID_CLASSPATH , JavaCore . ABORT ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_DUPLICATE_RESOURCE , JavaCore . WARNING ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER , JavaCore . CLEAN ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_ORDER , JavaCore . IGNORE ) ; defaultOptionsMap . put ( JavaCore . CORE_INCOMPLETE_CLASSPATH , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_CIRCULAR_CLASSPATH , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL , JavaCore . IGNORE ) ; defaultOptionsMap . put ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS , JavaCore . ENABLED ) ; defaultOptionsMap . putAll ( DefaultCodeFormatterConstants . getEclipseDefaultSettings ( ) ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_VISIBILITY_CHECK , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_DEPRECATION_CHECK , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_IMPLICIT_QUALIFICATION , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_FIELD_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FIELD_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FINAL_FIELD_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_LOCAL_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_ARGUMENT_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_FIELD_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FIELD_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_LOCAL_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_ARGUMENT_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_FORBIDDEN_REFERENCE_CHECK , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_DISCOURAGED_REFERENCE_CHECK , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_CAMEL_CASE_MATCH , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_SUGGEST_STATIC_IMPORTS , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC , "<STR_LIT>" ) ; return new Hashtable ( defaultOptionsMap ) ; } public PerProjectInfo getPerProjectInfo ( IProject project , boolean create ) { synchronized ( this . perProjectInfos ) { PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info == null && create ) { info = new PerProjectInfo ( project ) ; this . perProjectInfos . put ( project , info ) ; } return info ; } } public PerProjectInfo getPerProjectInfoCheckExistence ( IProject project ) throws JavaModelException { JavaModelManager . PerProjectInfo info = getPerProjectInfo ( project , false ) ; if ( info == null ) { if ( ! JavaProject . hasJavaNature ( project ) ) { throw ( ( JavaProject ) JavaCore . create ( project ) ) . newNotPresentException ( ) ; } info = getPerProjectInfo ( project , true ) ; } return info ; } public PerWorkingCopyInfo getPerWorkingCopyInfo ( CompilationUnit workingCopy , boolean create , boolean recordUsage , IProblemRequestor problemRequestor ) { synchronized ( this . perWorkingCopyInfos ) { WorkingCopyOwner owner = workingCopy . owner ; Map workingCopyToInfos = ( Map ) this . perWorkingCopyInfos . get ( owner ) ; if ( workingCopyToInfos == null && create ) { workingCopyToInfos = new HashMap ( ) ; this . perWorkingCopyInfos . put ( owner , workingCopyToInfos ) ; } PerWorkingCopyInfo info = workingCopyToInfos == null ? null : ( PerWorkingCopyInfo ) workingCopyToInfos . get ( workingCopy ) ; if ( info == null && create ) { info = new PerWorkingCopyInfo ( workingCopy , problemRequestor ) ; workingCopyToInfos . put ( workingCopy , info ) ; } if ( info != null && recordUsage ) info . useCount ++ ; return info ; } } public IClasspathContainer getPreviousSessionContainer ( IPath containerPath , IJavaProject project ) { Map previousContainerValues = ( Map ) this . previousSessionContainers . get ( project ) ; if ( previousContainerValues != null ) { IClasspathContainer previousContainer = ( IClasspathContainer ) previousContainerValues . get ( containerPath ) ; if ( previousContainer != null ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_reentering_project_container_access ( containerPath , project , previousContainer ) ; return previousContainer ; } } return null ; } private void verbose_reentering_project_container_access ( IPath containerPath , IJavaProject project , IClasspathContainer previousContainer ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' ) ; buffer . append ( "<STR_LIT>" + containerPath + '<STR_LIT:\n>' ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( previousContainer . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; IClasspathEntry [ ] entries = previousContainer . getClasspathEntries ( ) ; if ( entries != null ) { for ( int j = <NUM_LIT:0> ; j < entries . length ; j ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( entries [ j ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; Util . verbose ( buffer . toString ( ) ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public IPath getPreviousSessionVariable ( String variableName ) { IPath previousPath = ( IPath ) this . previousSessionVariables . get ( variableName ) ; if ( previousPath != null ) { if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_reentering_variable_access ( variableName , previousPath ) ; return previousPath ; } return null ; } private void verbose_reentering_variable_access ( String variableName , IPath previousPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName + '<STR_LIT:\n>' + "<STR_LIT>" + previousPath ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public HashMap getTemporaryCache ( ) { HashMap result = ( HashMap ) this . temporaryCache . get ( ) ; if ( result == null ) { result = new HashMap ( ) ; this . temporaryCache . set ( result ) ; } return result ; } private File getVariableAndContainersFile ( ) { return JavaCore . getPlugin ( ) . getStateLocation ( ) . append ( "<STR_LIT>" ) . toFile ( ) ; } public static String [ ] getRegisteredVariableNames ( ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; ArrayList variableList = new ArrayList ( <NUM_LIT:5> ) ; 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 ++ ) { String varAttribute = configElements [ j ] . getAttribute ( "<STR_LIT>" ) ; if ( varAttribute != null ) variableList . add ( varAttribute ) ; } } } String [ ] variableNames = new String [ variableList . size ( ) ] ; variableList . toArray ( variableNames ) ; return variableNames ; } public static String [ ] getRegisteredContainerIDs ( ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; ArrayList containerIDList = new ArrayList ( <NUM_LIT:5> ) ; 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 ++ ) { String idAttribute = configElements [ j ] . getAttribute ( "<STR_LIT:id>" ) ; if ( idAttribute != null ) containerIDList . add ( idAttribute ) ; } } } String [ ] containerIDs = new String [ containerIDList . size ( ) ] ; containerIDList . toArray ( containerIDs ) ; return containerIDs ; } public IClasspathEntry resolveVariableEntry ( IClasspathEntry entry , boolean usePreviousSession ) { if ( entry . getEntryKind ( ) != IClasspathEntry . CPE_VARIABLE ) return entry ; IPath resolvedPath = getResolvedVariablePath ( entry . getPath ( ) , usePreviousSession ) ; if ( resolvedPath == null ) return null ; resolvedPath = ClasspathEntry . resolveDotDot ( resolvedPath ) ; Object target = JavaModel . getTarget ( resolvedPath , false ) ; if ( target == null ) return null ; if ( target instanceof IResource ) { IResource resolvedResource = ( IResource ) target ; switch ( resolvedResource . getType ( ) ) { case IResource . PROJECT : return JavaCore . newProjectEntry ( resolvedPath , entry . getAccessRules ( ) , entry . combineAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; case IResource . FILE : return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; case IResource . FOLDER : return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; } } if ( target instanceof File ) { File externalFile = JavaModel . getFile ( target ) ; if ( externalFile != null ) { return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; } else { if ( resolvedPath . isAbsolute ( ) ) { return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; } } } return null ; } public IPath getResolvedVariablePath ( IPath variablePath , boolean usePreviousSession ) { if ( variablePath == null ) return null ; int count = variablePath . segmentCount ( ) ; if ( count == <NUM_LIT:0> ) return null ; String variableName = variablePath . segment ( <NUM_LIT:0> ) ; IPath resolvedPath = usePreviousSession ? getPreviousSessionVariable ( variableName ) : JavaCore . getClasspathVariable ( variableName ) ; if ( resolvedPath == null ) return null ; if ( count > <NUM_LIT:1> ) { resolvedPath = resolvedPath . append ( variablePath . removeFirstSegments ( <NUM_LIT:1> ) ) ; } return resolvedPath ; } private File getSerializationFile ( IProject project ) { if ( ! project . exists ( ) ) return null ; IPath workingLocation = project . getWorkingLocation ( JavaCore . PLUGIN_ID ) ; return workingLocation . append ( "<STR_LIT>" ) . toFile ( ) ; } public static UserLibraryManager getUserLibraryManager ( ) { if ( MANAGER . userLibraryManager == null ) { UserLibraryManager libraryManager = new UserLibraryManager ( ) ; synchronized ( MANAGER ) { if ( MANAGER . userLibraryManager == null ) { MANAGER . userLibraryManager = libraryManager ; } } } return MANAGER . userLibraryManager ; } public ICompilationUnit [ ] getWorkingCopies ( WorkingCopyOwner owner , boolean addPrimary ) { synchronized ( this . perWorkingCopyInfos ) { ICompilationUnit [ ] primaryWCs = addPrimary && owner != DefaultWorkingCopyOwner . PRIMARY ? getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) : null ; Map workingCopyToInfos = ( Map ) this . perWorkingCopyInfos . get ( owner ) ; if ( workingCopyToInfos == null ) return primaryWCs ; int primaryLength = primaryWCs == null ? <NUM_LIT:0> : primaryWCs . length ; int size = workingCopyToInfos . size ( ) ; ICompilationUnit [ ] result = new ICompilationUnit [ primaryLength + size ] ; int index = <NUM_LIT:0> ; if ( primaryWCs != null ) { for ( int i = <NUM_LIT:0> ; i < primaryLength ; i ++ ) { ICompilationUnit primaryWorkingCopy = primaryWCs [ i ] ; ICompilationUnit workingCopy = LanguageSupportFactory . newCompilationUnit ( ( PackageFragment ) primaryWorkingCopy . getParent ( ) , primaryWorkingCopy . getElementName ( ) , owner ) ; if ( ! workingCopyToInfos . containsKey ( workingCopy ) ) result [ index ++ ] = primaryWorkingCopy ; } if ( index != primaryLength ) System . arraycopy ( result , <NUM_LIT:0> , result = new ICompilationUnit [ index + size ] , <NUM_LIT:0> , index ) ; } Iterator iterator = workingCopyToInfos . values ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { result [ index ++ ] = ( ( JavaModelManager . PerWorkingCopyInfo ) iterator . next ( ) ) . getWorkingCopy ( ) ; } return result ; } } public JavaWorkspaceScope getWorkspaceScope ( ) { if ( this . workspaceScope == null ) { this . workspaceScope = new JavaWorkspaceScope ( ) ; } return this . workspaceScope ; } public ZipFile getZipFile ( IPath path ) throws CoreException { ZipCache zipCache ; ZipFile zipFile ; if ( ( zipCache = ( ZipCache ) this . zipFiles . get ( ) ) != null && ( zipFile = zipCache . getCache ( path ) ) != null ) { return zipFile ; } File localFile = null ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IResource file = root . findMember ( path ) ; if ( file != null ) { URI location ; if ( file . getType ( ) != IResource . FILE || ( location = file . getLocationURI ( ) ) == null ) { throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . file_notFound , path . toString ( ) ) , null ) ) ; } localFile = Util . toLocalFile ( location , null ) ; if ( localFile == null ) throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . file_notFound , path . toString ( ) ) , null ) ) ; } else { localFile = path . toFile ( ) ; } try { if ( ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + localFile ) ; } zipFile = new ZipFile ( localFile ) ; if ( zipCache != null ) { zipCache . setCache ( path , zipFile ) ; } return zipFile ; } catch ( IOException e ) { throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . status_IOException , e ) ) ; } } public boolean hasTemporaryCache ( ) { return this . temporaryCache . get ( ) != null ; } private IClasspathContainer initializeAllContainers ( IJavaProject javaProjectToInit , IPath containerToInit ) throws JavaModelException { if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_batching_containers_initialization ( javaProjectToInit , containerToInit ) ; final HashMap allContainerPaths = new HashMap ( ) ; IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IProject project = projects [ i ] ; if ( ! JavaProject . hasJavaNature ( project ) ) continue ; IJavaProject javaProject = new JavaProject ( project , getJavaModel ( ) ) ; HashSet paths = ( HashSet ) allContainerPaths . get ( javaProject ) ; IClasspathEntry [ ] rawClasspath = javaProject . getRawClasspath ( ) ; for ( int j = <NUM_LIT:0> , length2 = rawClasspath . length ; j < length2 ; j ++ ) { IClasspathEntry entry = rawClasspath [ j ] ; IPath path = entry . getPath ( ) ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_CONTAINER && containerGet ( javaProject , path ) == null ) { if ( paths == null ) { paths = new HashSet ( ) ; allContainerPaths . put ( javaProject , paths ) ; } paths . add ( path ) ; } } } if ( javaProjectToInit != null ) { HashSet containerPaths = ( HashSet ) allContainerPaths . get ( javaProjectToInit ) ; if ( containerPaths == null ) { containerPaths = new HashSet ( ) ; allContainerPaths . put ( javaProjectToInit , containerPaths ) ; } containerPaths . add ( containerToInit ) ; } boolean ok = false ; try { IWorkspaceRunnable runnable = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor monitor ) throws CoreException { try { Set entrySet = allContainerPaths . entrySet ( ) ; int length = entrySet . size ( ) ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , length ) ; Map . Entry [ ] entries = new Map . Entry [ length ] ; entrySet . toArray ( entries ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Map . Entry entry = entries [ i ] ; IJavaProject javaProject = ( IJavaProject ) entry . getKey ( ) ; HashSet pathSet = ( HashSet ) entry . getValue ( ) ; if ( pathSet == null ) continue ; int length2 = pathSet . size ( ) ; IPath [ ] paths = new IPath [ length2 ] ; pathSet . toArray ( paths ) ; for ( int j = <NUM_LIT:0> ; j < length2 ; j ++ ) { IPath path = paths [ j ] ; initializeContainer ( javaProject , path ) ; IClasspathContainer container = containerBeingInitializedGet ( javaProject , path ) ; if ( container != null ) { containerPut ( javaProject , path , container ) ; } } if ( monitor != null ) monitor . worked ( <NUM_LIT:1> ) ; } Map perProjectContainers = ( Map ) JavaModelManager . this . containersBeingInitialized . get ( ) ; if ( perProjectContainers != null ) { Iterator entriesIterator = perProjectContainers . entrySet ( ) . iterator ( ) ; while ( entriesIterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entriesIterator . next ( ) ; IJavaProject project = ( IJavaProject ) entry . getKey ( ) ; HashMap perPathContainers = ( HashMap ) entry . getValue ( ) ; Iterator containersIterator = perPathContainers . entrySet ( ) . iterator ( ) ; while ( containersIterator . hasNext ( ) ) { Map . Entry containerEntry = ( Map . Entry ) containersIterator . next ( ) ; IPath containerPath = ( IPath ) containerEntry . getKey ( ) ; IClasspathContainer container = ( IClasspathContainer ) containerEntry . getValue ( ) ; SetContainerOperation operation = new SetContainerOperation ( containerPath , new IJavaProject [ ] { project } , new IClasspathContainer [ ] { container } ) ; operation . runOperation ( monitor ) ; } } JavaModelManager . this . containersBeingInitialized . set ( null ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; } } } ; IProgressMonitor monitor = this . batchContainerInitializationsProgress ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace . isTreeLocked ( ) ) runnable . run ( monitor ) ; else workspace . run ( runnable , null , IWorkspace . AVOID_UPDATE , monitor ) ; ok = true ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } finally { if ( ! ok ) { this . containerInitializationInProgress . set ( null ) ; } } return containerGet ( javaProjectToInit , containerToInit ) ; } private void verbose_batching_containers_initialization ( IJavaProject javaProjectToInit , IPath containerToInit ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + ( javaProjectToInit == null ? "<STR_LIT:null>" : javaProjectToInit . getElementName ( ) ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerToInit ) ; } IClasspathContainer initializeContainer ( IJavaProject project , IPath containerPath ) throws JavaModelException { IProgressMonitor monitor = this . batchContainerInitializationsProgress ; if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; IClasspathContainer container = null ; final ClasspathContainerInitializer initializer = JavaCore . getClasspathContainerInitializer ( containerPath . segment ( <NUM_LIT:0> ) ) ; if ( initializer != null ) { if ( CP_RESOLVE_VERBOSE ) verbose_triggering_container_initialization ( project , containerPath , initializer ) ; if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_triggering_container_initialization_invocation_trace ( ) ; PerformanceStats stats = null ; if ( JavaModelManager . PERF_CONTAINER_INITIALIZER ) { stats = PerformanceStats . getStats ( JavaModelManager . CONTAINER_INITIALIZER_PERF , this ) ; stats . startRun ( containerPath + "<STR_LIT>" + project . getPath ( ) ) ; } containerPut ( project , containerPath , CONTAINER_INITIALIZATION_IN_PROGRESS ) ; boolean ok = false ; try { if ( monitor != null ) monitor . subTask ( Messages . bind ( Messages . javamodel_configuring , initializer . getDescription ( containerPath , project ) ) ) ; initializer . initialize ( containerPath , project ) ; if ( monitor != null ) monitor . subTask ( "<STR_LIT>" ) ; container = containerBeingInitializedGet ( project , containerPath ) ; if ( container == null && containerGet ( project , containerPath ) == CONTAINER_INITIALIZATION_IN_PROGRESS ) { container = initializer . getFailureContainer ( containerPath , project ) ; if ( container == null ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_container_null_failure_container ( project , containerPath , initializer ) ; return null ; } if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_container_using_failure_container ( project , containerPath , initializer ) ; containerPut ( project , containerPath , container ) ; } ok = true ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } catch ( RuntimeException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } catch ( Error e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } finally { if ( JavaModelManager . PERF_CONTAINER_INITIALIZER ) { stats . endRun ( ) ; } if ( ! ok ) { containerRemoveInitializationInProgress ( project , containerPath ) ; if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_container_initialization_failed ( project , containerPath , container , initializer ) ; } } if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_container_value_after_initialization ( project , containerPath , container ) ; } else { container = ( new ClasspathContainerInitializer ( ) { public void initialize ( IPath path , IJavaProject javaProject ) throws CoreException { } } ) . getFailureContainer ( containerPath , project ) ; if ( CP_RESOLVE_VERBOSE_ADVANCED || CP_RESOLVE_VERBOSE_FAILURE ) verbose_no_container_initializer_found ( project , containerPath ) ; } return container ; } private void verbose_no_container_initializer_found ( IJavaProject project , IPath containerPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath ) ; } private void verbose_container_value_after_initialization ( IJavaProject project , IPath containerPath , IClasspathContainer container ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' ) ; buffer . append ( "<STR_LIT>" + containerPath + '<STR_LIT:\n>' ) ; if ( container != null ) { buffer . append ( "<STR_LIT>" + container . getDescription ( ) + "<STR_LIT>" ) ; IClasspathEntry [ ] entries = container . getClasspathEntries ( ) ; if ( entries != null ) { for ( int i = <NUM_LIT:0> ; i < entries . length ; i ++ ) { buffer . append ( "<STR_LIT>" + entries [ i ] + '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( "<STR_LIT>" ) ; } Util . verbose ( buffer . toString ( ) ) ; } private void verbose_container_initialization_failed ( IJavaProject project , IPath containerPath , IClasspathContainer container , ClasspathContainerInitializer initializer ) { if ( container == CONTAINER_INITIALIZATION_IN_PROGRESS ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } else { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } } private void verbose_container_null_failure_container ( IJavaProject project , IPath containerPath , ClasspathContainerInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private void verbose_container_using_failure_container ( IJavaProject project , IPath containerPath , ClasspathContainerInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private void verbose_triggering_container_initialization ( IJavaProject project , IPath containerPath , ClasspathContainerInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private void verbose_triggering_container_initialization_invocation_trace ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public void initializePreferences ( ) { this . preferencesLookup [ PREF_INSTANCE ] = ( ( IScopeContext ) new InstanceScope ( ) ) . getNode ( JavaCore . PLUGIN_ID ) ; this . preferencesLookup [ PREF_DEFAULT ] = ( ( IScopeContext ) new DefaultScope ( ) ) . getNode ( JavaCore . PLUGIN_ID ) ; this . instanceNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] ) { JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] = ( ( IScopeContext ) new InstanceScope ( ) ) . getNode ( JavaCore . PLUGIN_ID ) ; JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] . addPreferenceChangeListener ( new EclipsePreferencesListener ( ) ) ; } } } ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_INSTANCE ] . parent ( ) ) . addNodeChangeListener ( this . instanceNodeListener ) ; this . preferencesLookup [ PREF_INSTANCE ] . addPreferenceChangeListener ( this . instancePreferencesListener = new EclipsePreferencesListener ( ) ) ; this . defaultNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] ) { JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] = ( ( IScopeContext ) new DefaultScope ( ) ) . getNode ( JavaCore . PLUGIN_ID ) ; } } } ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_DEFAULT ] . parent ( ) ) . addNodeChangeListener ( this . defaultNodeListener ) ; } public synchronized char [ ] intern ( char [ ] array ) { return this . charArraySymbols . add ( array ) ; } public synchronized String intern ( String s ) { return ( String ) this . stringSymbols . add ( new String ( s ) ) ; } private HashSet getClasspathBeingResolved ( ) { HashSet result = ( HashSet ) this . classpathsBeingResolved . get ( ) ; if ( result == null ) { result = new HashSet ( ) ; this . classpathsBeingResolved . set ( result ) ; } return result ; } public boolean isClasspathBeingResolved ( IJavaProject project ) { return getClasspathBeingResolved ( ) . contains ( project ) ; } private boolean isDeprecatedOption ( String optionName ) { return JavaCore . COMPILER_PB_INVALID_IMPORT . equals ( optionName ) || JavaCore . COMPILER_PB_UNREACHABLE_CODE . equals ( optionName ) ; } public boolean isNonChainingJar ( IPath path ) { return this . nonChainingJars != null && this . nonChainingJars . contains ( path ) ; } public void setClasspathBeingResolved ( IJavaProject project , boolean classpathIsResolved ) { if ( classpathIsResolved ) { getClasspathBeingResolved ( ) . add ( project ) ; } else { getClasspathBeingResolved ( ) . remove ( project ) ; } } private Set loadNonChainingJarsCache ( ) { Set nonChainingJarsCache = new HashSet ( ) ; File nonChainingJarsFile = getNonChainingJarsFile ( ) ; DataInputStream in = null ; try { in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( nonChainingJarsFile ) ) ) ; int size = in . readInt ( ) ; while ( size -- > <NUM_LIT:0> ) { String path = in . readUTF ( ) ; nonChainingJarsCache . add ( Path . fromPortableString ( path ) ) ; } } catch ( IOException e ) { if ( nonChainingJarsFile . exists ( ) ) Util . log ( e , "<STR_LIT>" ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException e ) { } } } return Collections . synchronizedSet ( nonChainingJarsCache ) ; } private File getNonChainingJarsFile ( ) { return JavaCore . getPlugin ( ) . getStateLocation ( ) . append ( "<STR_LIT>" ) . toFile ( ) ; } private Set getNonChainingJarsCache ( ) throws CoreException { if ( this . nonChainingJars != null && this . nonChainingJars . size ( ) > <NUM_LIT:0> ) { return this . nonChainingJars ; } Set result = new HashSet ( ) ; IJavaProject [ ] projects = getJavaModel ( ) . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject javaProject = projects [ i ] ; IClasspathEntry [ ] classpath = ( ( JavaProject ) javaProject ) . getResolvedClasspath ( ) ; for ( int j = <NUM_LIT:0> , length2 = classpath . length ; j < length2 ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; IPath path ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY && ! result . contains ( path = entry . getPath ( ) ) && ClasspathEntry . resolvedChainedLibraries ( path ) . length == <NUM_LIT:0> ) { result . add ( path ) ; } } } this . nonChainingJars = Collections . synchronizedSet ( result ) ; return this . nonChainingJars ; } public void loadVariablesAndContainers ( ) throws CoreException { QualifiedName qName = new QualifiedName ( JavaCore . PLUGIN_ID , "<STR_LIT>" ) ; String xmlString = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getPersistentProperty ( qName ) ; try { if ( xmlString != null ) { StringReader reader = new StringReader ( xmlString ) ; Element cpElement ; try { DocumentBuilder parser = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; cpElement = parser . parse ( new InputSource ( reader ) ) . getDocumentElement ( ) ; } catch ( SAXException e ) { return ; } catch ( ParserConfigurationException e ) { return ; } finally { reader . close ( ) ; } if ( cpElement == null ) return ; if ( ! cpElement . getNodeName ( ) . equalsIgnoreCase ( "<STR_LIT>" ) ) { return ; } NodeList list = cpElement . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; ++ i ) { Node node = list . item ( i ) ; short type = node . getNodeType ( ) ; if ( type == Node . ELEMENT_NODE ) { Element element = ( Element ) node ; if ( element . getNodeName ( ) . equalsIgnoreCase ( "<STR_LIT>" ) ) { variablePut ( element . getAttribute ( "<STR_LIT:name>" ) , new Path ( element . getAttribute ( "<STR_LIT:path>" ) ) ) ; } } } } } catch ( IOException e ) { } finally { if ( xmlString != null ) { ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . setPersistentProperty ( qName , null ) ; } } loadVariablesAndContainers ( getDefaultPreferences ( ) ) ; loadVariablesAndContainers ( getInstancePreferences ( ) ) ; File file = getVariableAndContainersFile ( ) ; DataInputStream in = null ; try { in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( file ) ) ) ; switch ( in . readInt ( ) ) { case <NUM_LIT:2> : new VariablesAndContainersLoadHelper ( in ) . load ( ) ; break ; case <NUM_LIT:1> : int size = in . readInt ( ) ; while ( size -- > <NUM_LIT:0> ) { String varName = in . readUTF ( ) ; String pathString = in . readUTF ( ) ; if ( CP_ENTRY_IGNORE . equals ( pathString ) ) continue ; IPath varPath = Path . fromPortableString ( pathString ) ; this . variables . put ( varName , varPath ) ; this . previousSessionVariables . put ( varName , varPath ) ; } IJavaModel model = getJavaModel ( ) ; int projectSize = in . readInt ( ) ; while ( projectSize -- > <NUM_LIT:0> ) { String projectName = in . readUTF ( ) ; IJavaProject project = model . getJavaProject ( projectName ) ; int containerSize = in . readInt ( ) ; while ( containerSize -- > <NUM_LIT:0> ) { IPath containerPath = Path . fromPortableString ( in . readUTF ( ) ) ; int length = in . readInt ( ) ; byte [ ] containerString = new byte [ length ] ; in . readFully ( containerString ) ; recreatePersistedContainer ( project , containerPath , new String ( containerString ) , true ) ; } } break ; } } catch ( IOException e ) { if ( file . exists ( ) ) Util . log ( e , "<STR_LIT>" ) ; } catch ( RuntimeException e ) { if ( file . exists ( ) ) Util . log ( e , "<STR_LIT>" ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException e ) { } } } String [ ] registeredVariables = getRegisteredVariableNames ( ) ; for ( int i = <NUM_LIT:0> ; i < registeredVariables . length ; i ++ ) { String varName = registeredVariables [ i ] ; this . variables . put ( varName , null ) ; } containersReset ( getRegisteredContainerIDs ( ) ) ; } private void loadVariablesAndContainers ( IEclipsePreferences preferences ) { try { String [ ] propertyNames = preferences . keys ( ) ; int variablePrefixLength = CP_VARIABLE_PREFERENCES_PREFIX . length ( ) ; for ( int i = <NUM_LIT:0> ; i < propertyNames . length ; i ++ ) { String propertyName = propertyNames [ i ] ; if ( propertyName . startsWith ( CP_VARIABLE_PREFERENCES_PREFIX ) ) { String varName = propertyName . substring ( variablePrefixLength ) ; String propertyValue = preferences . get ( propertyName , null ) ; if ( propertyValue != null ) { String pathString = propertyValue . trim ( ) ; if ( CP_ENTRY_IGNORE . equals ( pathString ) ) { preferences . remove ( propertyName ) ; continue ; } IPath varPath = new Path ( pathString ) ; this . variables . put ( varName , varPath ) ; this . previousSessionVariables . put ( varName , varPath ) ; } } else if ( propertyName . startsWith ( CP_CONTAINER_PREFERENCES_PREFIX ) ) { String propertyValue = preferences . get ( propertyName , null ) ; if ( propertyValue != null ) { preferences . remove ( propertyName ) ; recreatePersistedContainer ( propertyName , propertyValue , true ) ; } } } } catch ( BackingStoreException e1 ) { } } private static final class PersistedClasspathContainer implements IClasspathContainer { private final IPath containerPath ; private final IClasspathEntry [ ] entries ; private final IJavaProject project ; PersistedClasspathContainer ( IJavaProject project , IPath containerPath , IClasspathEntry [ ] entries ) { super ( ) ; this . containerPath = containerPath ; this . entries = entries ; this . project = project ; } public IClasspathEntry [ ] getClasspathEntries ( ) { return this . entries ; } public String getDescription ( ) { return "<STR_LIT>" + this . containerPath + "<STR_LIT>" + this . project . getElementName ( ) + "<STR_LIT>" ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return this . containerPath ; } public String toString ( ) { return getDescription ( ) ; } } private final class VariablesAndContainersLoadHelper { private static final int ARRAY_INCREMENT = <NUM_LIT> ; private IClasspathEntry [ ] allClasspathEntries ; private int allClasspathEntryCount ; private final Map allPaths ; private String [ ] allStrings ; private int allStringsCount ; private final DataInputStream in ; VariablesAndContainersLoadHelper ( DataInputStream in ) { super ( ) ; this . allClasspathEntries = null ; this . allClasspathEntryCount = <NUM_LIT:0> ; this . allPaths = new HashMap ( ) ; this . allStrings = null ; this . allStringsCount = <NUM_LIT:0> ; this . in = in ; } void load ( ) throws IOException { loadProjects ( getJavaModel ( ) ) ; loadVariables ( ) ; } private IAccessRule loadAccessRule ( ) throws IOException { int problemId = loadInt ( ) ; IPath pattern = loadPath ( ) ; return new ClasspathAccessRule ( pattern . toString ( ) . toCharArray ( ) , problemId ) ; } private IAccessRule [ ] loadAccessRules ( ) throws IOException { int count = loadInt ( ) ; if ( count == <NUM_LIT:0> ) return ClasspathEntry . NO_ACCESS_RULES ; IAccessRule [ ] rules = new IAccessRule [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) rules [ i ] = loadAccessRule ( ) ; return rules ; } private IClasspathAttribute loadAttribute ( ) throws IOException { String name = loadString ( ) ; String value = loadString ( ) ; return new ClasspathAttribute ( name , value ) ; } private IClasspathAttribute [ ] loadAttributes ( ) throws IOException { int count = loadInt ( ) ; if ( count == <NUM_LIT:0> ) return ClasspathEntry . NO_EXTRA_ATTRIBUTES ; IClasspathAttribute [ ] attributes = new IClasspathAttribute [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) attributes [ i ] = loadAttribute ( ) ; return attributes ; } private boolean loadBoolean ( ) throws IOException { return this . in . readBoolean ( ) ; } private IClasspathEntry [ ] loadClasspathEntries ( ) throws IOException { int count = loadInt ( ) ; IClasspathEntry [ ] entries = new IClasspathEntry [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) entries [ i ] = loadClasspathEntry ( ) ; return entries ; } private IClasspathEntry loadClasspathEntry ( ) throws IOException { int id = loadInt ( ) ; if ( id < <NUM_LIT:0> || id > this . allClasspathEntryCount ) throw new IOException ( "<STR_LIT>" ) ; if ( id < this . allClasspathEntryCount ) return this . allClasspathEntries [ id ] ; int contentKind = loadInt ( ) ; int entryKind = loadInt ( ) ; IPath path = loadPath ( ) ; IPath [ ] inclusionPatterns = loadPaths ( ) ; IPath [ ] exclusionPatterns = loadPaths ( ) ; IPath sourceAttachmentPath = loadPath ( ) ; IPath sourceAttachmentRootPath = loadPath ( ) ; IPath specificOutputLocation = loadPath ( ) ; boolean isExported = loadBoolean ( ) ; IAccessRule [ ] accessRules = loadAccessRules ( ) ; boolean combineAccessRules = loadBoolean ( ) ; IClasspathAttribute [ ] extraAttributes = loadAttributes ( ) ; IClasspathEntry entry = new ClasspathEntry ( contentKind , entryKind , path , inclusionPatterns , exclusionPatterns , sourceAttachmentPath , sourceAttachmentRootPath , specificOutputLocation , isExported , accessRules , combineAccessRules , extraAttributes ) ; IClasspathEntry [ ] array = this . allClasspathEntries ; if ( array == null || id == array . length ) { array = new IClasspathEntry [ id + ARRAY_INCREMENT ] ; if ( id != <NUM_LIT:0> ) System . arraycopy ( this . allClasspathEntries , <NUM_LIT:0> , array , <NUM_LIT:0> , id ) ; this . allClasspathEntries = array ; } array [ id ] = entry ; this . allClasspathEntryCount = id + <NUM_LIT:1> ; return entry ; } private void loadContainers ( IJavaProject project ) throws IOException { boolean projectIsAccessible = project . getProject ( ) . isAccessible ( ) ; int count = loadInt ( ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) { IPath path = loadPath ( ) ; IClasspathEntry [ ] entries = loadClasspathEntries ( ) ; if ( ! projectIsAccessible ) continue ; IClasspathContainer container = new PersistedClasspathContainer ( project , path , entries ) ; containerPut ( project , path , container ) ; Map oldContainers = ( Map ) JavaModelManager . this . previousSessionContainers . get ( project ) ; if ( oldContainers == null ) { oldContainers = new HashMap ( ) ; JavaModelManager . this . previousSessionContainers . put ( project , oldContainers ) ; } oldContainers . put ( path , container ) ; } } private int loadInt ( ) throws IOException { return this . in . readInt ( ) ; } private IPath loadPath ( ) throws IOException { if ( loadBoolean ( ) ) return null ; String portableString = loadString ( ) ; IPath path = ( IPath ) this . allPaths . get ( portableString ) ; if ( path == null ) { path = Path . fromPortableString ( portableString ) ; this . allPaths . put ( portableString , path ) ; } return path ; } private IPath [ ] loadPaths ( ) throws IOException { int count = loadInt ( ) ; IPath [ ] pathArray = new IPath [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) pathArray [ i ] = loadPath ( ) ; return pathArray ; } private void loadProjects ( IJavaModel model ) throws IOException { int count = loadInt ( ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) { String projectName = loadString ( ) ; loadContainers ( model . getJavaProject ( projectName ) ) ; } } private String loadString ( ) throws IOException { int id = loadInt ( ) ; if ( id < <NUM_LIT:0> || id > this . allStringsCount ) throw new IOException ( "<STR_LIT>" ) ; if ( id < this . allStringsCount ) return this . allStrings [ id ] ; String string = this . in . readUTF ( ) ; String [ ] array = this . allStrings ; if ( array == null || id == array . length ) { array = new String [ id + ARRAY_INCREMENT ] ; if ( id != <NUM_LIT:0> ) System . arraycopy ( this . allStrings , <NUM_LIT:0> , array , <NUM_LIT:0> , id ) ; this . allStrings = array ; } array [ id ] = string ; this . allStringsCount = id + <NUM_LIT:1> ; return string ; } private void loadVariables ( ) throws IOException { int size = loadInt ( ) ; Map loadedVars = new HashMap ( size ) ; for ( int i = <NUM_LIT:0> ; i < size ; ++ i ) { String varName = loadString ( ) ; IPath varPath = loadPath ( ) ; if ( varPath != null ) loadedVars . put ( varName , varPath ) ; } JavaModelManager . this . previousSessionVariables . putAll ( loadedVars ) ; JavaModelManager . this . variables . putAll ( loadedVars ) ; } } protected synchronized Object peekAtInfo ( IJavaElement element ) { HashMap tempCache = ( HashMap ) this . temporaryCache . get ( ) ; if ( tempCache != null ) { Object result = tempCache . get ( element ) ; if ( result != null ) { return result ; } } return this . cache . peekAtInfo ( element ) ; } public void prepareToSave ( ISaveContext context ) { } protected synchronized void putInfos ( IJavaElement openedElement , Map newElements ) { Object existingInfo = this . cache . peekAtInfo ( openedElement ) ; if ( openedElement instanceof IParent ) { closeChildren ( existingInfo ) ; } for ( Iterator it = newElements . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; IJavaElement element = ( IJavaElement ) entry . getKey ( ) ; if ( element instanceof JarPackageFragmentRoot ) { Object info = entry . getValue ( ) ; it . remove ( ) ; this . cache . putInfo ( element , info ) ; } } Iterator iterator = newElements . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; this . cache . putInfo ( ( IJavaElement ) entry . getKey ( ) , entry . getValue ( ) ) ; } } private void closeChildren ( Object info ) { if ( info instanceof JavaElementInfo ) { IJavaElement [ ] children = ( ( JavaElementInfo ) info ) . getChildren ( ) ; for ( int i = <NUM_LIT:0> , size = children . length ; i < size ; ++ i ) { JavaElement child = ( JavaElement ) children [ i ] ; try { child . close ( ) ; } catch ( JavaModelException e ) { } } } } protected synchronized void putJarTypeInfo ( IJavaElement type , Object info ) { this . cache . jarTypeCache . put ( type , info ) ; } protected Object readState ( IProject project ) throws CoreException { File file = getSerializationFile ( project ) ; if ( file != null && file . exists ( ) ) { try { DataInputStream in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( file ) ) ) ; try { String pluginID = in . readUTF ( ) ; if ( ! pluginID . equals ( JavaCore . PLUGIN_ID ) ) throw new IOException ( Messages . build_wrongFileFormat ) ; String kind = in . readUTF ( ) ; if ( ! kind . equals ( "<STR_LIT>" ) ) throw new IOException ( Messages . build_wrongFileFormat ) ; if ( in . readBoolean ( ) ) return JavaBuilder . readState ( project , in ) ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getName ( ) ) ; } finally { in . close ( ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Platform . PLUGIN_ERROR , "<STR_LIT>" + project . getName ( ) , e ) ) ; } } else if ( JavaBuilder . DEBUG ) { if ( file == null ) System . out . println ( "<STR_LIT>" + project ) ; else System . out . println ( "<STR_LIT>" + file . getPath ( ) + "<STR_LIT>" ) ; } return null ; } public static void recreatePersistedContainer ( String propertyName , String containerString , boolean addToContainerValues ) { int containerPrefixLength = CP_CONTAINER_PREFERENCES_PREFIX . length ( ) ; int index = propertyName . indexOf ( '<CHAR_LIT>' , containerPrefixLength ) ; if ( containerString != null ) containerString = containerString . trim ( ) ; if ( index > <NUM_LIT:0> ) { String projectName = propertyName . substring ( containerPrefixLength , index ) . trim ( ) ; IJavaProject project = getJavaModelManager ( ) . getJavaModel ( ) . getJavaProject ( projectName ) ; IPath containerPath = new Path ( propertyName . substring ( index + <NUM_LIT:1> ) . trim ( ) ) ; recreatePersistedContainer ( project , containerPath , containerString , addToContainerValues ) ; } } private static void recreatePersistedContainer ( final IJavaProject project , final IPath containerPath , String containerString , boolean addToContainerValues ) { if ( ! project . getProject ( ) . isAccessible ( ) ) return ; if ( containerString == null ) { getJavaModelManager ( ) . containerPut ( project , containerPath , null ) ; } else { IClasspathEntry [ ] entries ; try { entries = ( ( JavaProject ) project ) . decodeClasspath ( containerString , null ) [ <NUM_LIT:0> ] ; } catch ( IOException e ) { Util . log ( e , "<STR_LIT>" + containerString ) ; entries = JavaProject . INVALID_CLASSPATH ; } if ( entries != JavaProject . INVALID_CLASSPATH ) { final IClasspathEntry [ ] containerEntries = entries ; IClasspathContainer container = new IClasspathContainer ( ) { public IClasspathEntry [ ] getClasspathEntries ( ) { return containerEntries ; } public String getDescription ( ) { return "<STR_LIT>" + containerPath + "<STR_LIT>" + project . getElementName ( ) + "<STR_LIT:]>" ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return containerPath ; } public String toString ( ) { return getDescription ( ) ; } } ; if ( addToContainerValues ) { getJavaModelManager ( ) . containerPut ( project , containerPath , container ) ; } Map projectContainers = ( Map ) getJavaModelManager ( ) . previousSessionContainers . get ( project ) ; if ( projectContainers == null ) { projectContainers = new HashMap ( <NUM_LIT:1> ) ; getJavaModelManager ( ) . previousSessionContainers . put ( project , projectContainers ) ; } projectContainers . put ( containerPath , container ) ; } } } public void rememberScope ( AbstractSearchScope scope ) { this . searchScopes . put ( scope , null ) ; } public synchronized Object removeInfoAndChildren ( JavaElement element ) throws JavaModelException { Object info = this . cache . peekAtInfo ( element ) ; if ( info != null ) { boolean wasVerbose = false ; try { if ( JavaModelCache . VERBOSE ) { String elementType ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_PROJECT : elementType = "<STR_LIT>" ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : elementType = "<STR_LIT:root>" ; break ; case IJavaElement . PACKAGE_FRAGMENT : elementType = "<STR_LIT>" ; break ; case IJavaElement . CLASS_FILE : elementType = "<STR_LIT>" ; break ; case IJavaElement . COMPILATION_UNIT : elementType = "<STR_LIT>" ; break ; default : elementType = "<STR_LIT>" ; } System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + elementType + "<STR_LIT:U+0020>" + element . toStringWithAncestors ( ) ) ; wasVerbose = true ; JavaModelCache . VERBOSE = false ; } element . closing ( info ) ; if ( element instanceof IParent ) { closeChildren ( info ) ; } this . cache . removeInfo ( element ) ; if ( wasVerbose ) { System . out . println ( this . cache . toStringFillingRation ( "<STR_LIT>" ) ) ; } } finally { JavaModelCache . VERBOSE = wasVerbose ; } return info ; } return null ; } public void removePerProjectInfo ( JavaProject javaProject , boolean removeExtJarInfo ) { synchronized ( this . perProjectInfos ) { IProject project = javaProject . getProject ( ) ; PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info != null ) { this . perProjectInfos . remove ( project ) ; if ( removeExtJarInfo ) { info . forgetExternalTimestampsAndIndexes ( ) ; } } } resetNonChainingJarsCache ( ) ; } public void resetProjectOptions ( JavaProject javaProject ) { synchronized ( this . perProjectInfos ) { IProject project = javaProject . getProject ( ) ; PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info != null ) { info . options = null ; } } } public void resetProjectPreferences ( JavaProject javaProject ) { synchronized ( this . perProjectInfos ) { IProject project = javaProject . getProject ( ) ; PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info != null ) { info . preferences = null ; } } } public static final void doNotUse ( ) { MANAGER . deltaState . doNotUse ( ) ; MANAGER = new JavaModelManager ( ) ; } protected synchronized void resetJarTypeCache ( ) { this . cache . resetJarTypeCache ( ) ; } public void resetNonChainingJarsCache ( ) { if ( this . nonChainingJars != null ) this . nonChainingJars . clear ( ) ; } public void resetTemporaryCache ( ) { this . temporaryCache . set ( null ) ; } public void rollback ( ISaveContext context ) { } private void saveState ( PerProjectInfo info , ISaveContext context ) throws CoreException { if ( context . getKind ( ) == ISaveContext . SNAPSHOT ) return ; if ( info . triedRead ) saveBuiltState ( info ) ; } private void saveBuiltState ( PerProjectInfo info ) throws CoreException { if ( JavaBuilder . DEBUG ) System . out . println ( Messages . bind ( Messages . build_saveStateProgress , info . project . getName ( ) ) ) ; File file = getSerializationFile ( info . project ) ; if ( file == null ) return ; long t = System . currentTimeMillis ( ) ; try { DataOutputStream out = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ; try { out . writeUTF ( JavaCore . PLUGIN_ID ) ; out . writeUTF ( "<STR_LIT>" ) ; if ( info . savedState == null ) { out . writeBoolean ( false ) ; } else { out . writeBoolean ( true ) ; JavaBuilder . writeState ( info . savedState , out ) ; } } finally { out . close ( ) ; } } catch ( RuntimeException e ) { try { file . delete ( ) ; } catch ( SecurityException se ) { } throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Platform . PLUGIN_ERROR , Messages . bind ( Messages . build_cannotSaveState , info . project . getName ( ) ) , e ) ) ; } catch ( IOException e ) { try { file . delete ( ) ; } catch ( SecurityException se ) { } throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Platform . PLUGIN_ERROR , Messages . bind ( Messages . build_cannotSaveState , info . project . getName ( ) ) , e ) ) ; } if ( JavaBuilder . DEBUG ) { t = System . currentTimeMillis ( ) - t ; System . out . println ( Messages . bind ( Messages . build_saveStateComplete , String . valueOf ( t ) ) ) ; } } private void saveNonChainingJarsCache ( ) throws CoreException { File file = getNonChainingJarsFile ( ) ; DataOutputStream out = null ; try { out = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ; Set nonChainingJarsCache = getNonChainingJarsCache ( ) ; synchronized ( nonChainingJarsCache ) { out . writeInt ( nonChainingJarsCache . size ( ) ) ; Iterator entries = nonChainingJarsCache . iterator ( ) ; while ( entries . hasNext ( ) ) { IPath path = ( IPath ) entries . next ( ) ; out . writeUTF ( path . toPortableString ( ) ) ; } } } catch ( IOException e ) { IStatus status = new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , IStatus . ERROR , "<STR_LIT>" , e ) ; throw new CoreException ( status ) ; } finally { if ( out != null ) { try { out . close ( ) ; } catch ( IOException e ) { } } } } private void saveVariablesAndContainers ( ISaveContext context ) throws CoreException { File file = getVariableAndContainersFile ( ) ; DataOutputStream out = null ; try { out = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ; out . writeInt ( VARIABLES_AND_CONTAINERS_FILE_VERSION ) ; new VariablesAndContainersSaveHelper ( out ) . save ( context ) ; } catch ( IOException e ) { IStatus status = new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , IStatus . ERROR , "<STR_LIT>" , e ) ; throw new CoreException ( status ) ; } finally { if ( out != null ) { try { out . close ( ) ; } catch ( IOException e ) { } } } } private final class VariablesAndContainersSaveHelper { private final HashtableOfObjectToInt classpathEntryIds ; private final DataOutputStream out ; private final HashtableOfObjectToInt stringIds ; VariablesAndContainersSaveHelper ( DataOutputStream out ) { super ( ) ; this . classpathEntryIds = new HashtableOfObjectToInt ( ) ; this . out = out ; this . stringIds = new HashtableOfObjectToInt ( ) ; } void save ( ISaveContext context ) throws IOException , JavaModelException { IProject project = context . getProject ( ) ; if ( project == null ) { saveProjects ( getJavaModel ( ) . getJavaProjects ( ) ) ; } else { saveProjects ( new IJavaProject [ ] { JavaCore . create ( project ) } ) ; } switch ( context . getKind ( ) ) { case ISaveContext . FULL_SAVE : case ISaveContext . SNAPSHOT : HashMap varsToSave = null ; Iterator iterator = JavaModelManager . this . variables . entrySet ( ) . iterator ( ) ; IEclipsePreferences defaultPreferences = getDefaultPreferences ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; String varName = ( String ) entry . getKey ( ) ; if ( defaultPreferences . get ( CP_VARIABLE_PREFERENCES_PREFIX + varName , null ) != null || CP_ENTRY_IGNORE_PATH . equals ( entry . getValue ( ) ) ) { if ( varsToSave == null ) varsToSave = new HashMap ( JavaModelManager . this . variables ) ; varsToSave . remove ( varName ) ; } } saveVariables ( varsToSave != null ? varsToSave : JavaModelManager . this . variables ) ; break ; default : } } private void saveAccessRule ( ClasspathAccessRule rule ) throws IOException { saveInt ( rule . problemId ) ; savePath ( rule . getPattern ( ) ) ; } private void saveAccessRules ( IAccessRule [ ] rules ) throws IOException { int count = rules == null ? <NUM_LIT:0> : rules . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) saveAccessRule ( ( ClasspathAccessRule ) rules [ i ] ) ; } private void saveAttribute ( IClasspathAttribute attribute ) throws IOException { saveString ( attribute . getName ( ) ) ; saveString ( attribute . getValue ( ) ) ; } private void saveAttributes ( IClasspathAttribute [ ] attributes ) throws IOException { int count = attributes == null ? <NUM_LIT:0> : attributes . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) saveAttribute ( attributes [ i ] ) ; } private void saveClasspathEntries ( IClasspathEntry [ ] entries ) throws IOException { int count = entries == null ? <NUM_LIT:0> : entries . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) saveClasspathEntry ( entries [ i ] ) ; } private void saveClasspathEntry ( IClasspathEntry entry ) throws IOException { if ( saveNewId ( entry , this . classpathEntryIds ) ) { saveInt ( entry . getContentKind ( ) ) ; saveInt ( entry . getEntryKind ( ) ) ; savePath ( entry . getPath ( ) ) ; savePaths ( entry . getInclusionPatterns ( ) ) ; savePaths ( entry . getExclusionPatterns ( ) ) ; savePath ( entry . getSourceAttachmentPath ( ) ) ; savePath ( entry . getSourceAttachmentRootPath ( ) ) ; savePath ( entry . getOutputLocation ( ) ) ; this . out . writeBoolean ( entry . isExported ( ) ) ; saveAccessRules ( entry . getAccessRules ( ) ) ; this . out . writeBoolean ( entry . combineAccessRules ( ) ) ; saveAttributes ( entry . getExtraAttributes ( ) ) ; } } private void saveContainers ( IJavaProject project , Map containerMap ) throws IOException { saveInt ( containerMap . size ( ) ) ; for ( Iterator i = containerMap . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Entry entry = ( Entry ) i . next ( ) ; IPath path = ( IPath ) entry . getKey ( ) ; IClasspathContainer container = ( IClasspathContainer ) entry . getValue ( ) ; IClasspathEntry [ ] cpEntries = null ; if ( container == null ) { container = getPreviousSessionContainer ( path , project ) ; } if ( container != null ) cpEntries = container . getClasspathEntries ( ) ; savePath ( path ) ; saveClasspathEntries ( cpEntries ) ; } } private void saveInt ( int value ) throws IOException { this . out . writeInt ( value ) ; } private boolean saveNewId ( Object key , HashtableOfObjectToInt map ) throws IOException { int id = map . get ( key ) ; if ( id == - <NUM_LIT:1> ) { int newId = map . size ( ) ; map . put ( key , newId ) ; saveInt ( newId ) ; return true ; } else { saveInt ( id ) ; return false ; } } private void savePath ( IPath path ) throws IOException { if ( path == null ) { this . out . writeBoolean ( true ) ; } else { this . out . writeBoolean ( false ) ; saveString ( path . toPortableString ( ) ) ; } } private void savePaths ( IPath [ ] paths ) throws IOException { int count = paths == null ? <NUM_LIT:0> : paths . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) savePath ( paths [ i ] ) ; } private void saveProjects ( IJavaProject [ ] projects ) throws IOException , JavaModelException { int count = projects . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) { IJavaProject project = projects [ i ] ; saveString ( project . getElementName ( ) ) ; Map containerMap = ( Map ) JavaModelManager . this . containers . get ( project ) ; if ( containerMap == null ) { containerMap = Collections . EMPTY_MAP ; } else { containerMap = new HashMap ( containerMap ) ; } saveContainers ( project , containerMap ) ; } } private void saveString ( String string ) throws IOException { if ( saveNewId ( string , this . stringIds ) ) this . out . writeUTF ( string ) ; } private void saveVariables ( Map map ) throws IOException { saveInt ( map . size ( ) ) ; for ( Iterator i = map . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Entry entry = ( Entry ) i . next ( ) ; String varName = ( String ) entry . getKey ( ) ; IPath varPath = ( IPath ) entry . getValue ( ) ; saveString ( varName ) ; savePath ( varPath ) ; } } } private void traceVariableAndContainers ( String action , long start ) { Long delta = new Long ( System . currentTimeMillis ( ) - start ) ; Long length = new Long ( getVariableAndContainersFile ( ) . length ( ) ) ; String pattern = "<STR_LIT>" ; String message = MessageFormat . format ( pattern , new Object [ ] { action , length , delta } ) ; System . out . println ( message ) ; } public void saving ( ISaveContext context ) throws CoreException { long start = - <NUM_LIT:1> ; if ( VERBOSE ) start = System . currentTimeMillis ( ) ; saveVariablesAndContainers ( context ) ; if ( VERBOSE ) traceVariableAndContainers ( "<STR_LIT>" , start ) ; switch ( context . getKind ( ) ) { case ISaveContext . FULL_SAVE : { saveNonChainingJarsCache ( ) ; context . needDelta ( ) ; IndexManager manager = this . indexManager ; if ( manager != null && this . workspaceScope != null ) { manager . cleanUpIndexes ( ) ; } } case ISaveContext . SNAPSHOT : { this . externalFoldersManager . cleanUp ( null ) ; } } IProject savedProject = context . getProject ( ) ; if ( savedProject != null ) { if ( ! JavaProject . hasJavaNature ( savedProject ) ) return ; PerProjectInfo info = getPerProjectInfo ( savedProject , true ) ; saveState ( info , context ) ; return ; } ArrayList vStats = null ; ArrayList values = null ; synchronized ( this . perProjectInfos ) { values = new ArrayList ( this . perProjectInfos . values ( ) ) ; } Iterator iterator = values . iterator ( ) ; while ( iterator . hasNext ( ) ) { try { PerProjectInfo info = ( PerProjectInfo ) iterator . next ( ) ; saveState ( info , context ) ; } catch ( CoreException e ) { if ( vStats == null ) vStats = new ArrayList ( ) ; vStats . add ( e . getStatus ( ) ) ; } } if ( vStats != null ) { IStatus [ ] stats = new IStatus [ vStats . size ( ) ] ; vStats . toArray ( stats ) ; throw new CoreException ( new MultiStatus ( JavaCore . PLUGIN_ID , IStatus . ERROR , stats , Messages . build_cannotSaveStates , null ) ) ; } this . deltaState . saveExternalLibTimeStamps ( ) ; } public void secondaryTypeAdding ( String path , char [ ] typeName , char [ ] packageName ) { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( path ) ; buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( '<CHAR_LIT:[>' ) ; buffer . append ( new String ( packageName ) ) ; buffer . append ( '<CHAR_LIT:.>' ) ; buffer . append ( new String ( typeName ) ) ; buffer . append ( '<CHAR_LIT:]>' ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } IWorkspaceRoot wRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IResource resource = wRoot . findMember ( path ) ; if ( resource != null ) { if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( path ) && resource . getType ( ) == IResource . FILE ) { IProject project = resource . getProject ( ) ; try { PerProjectInfo projectInfo = getPerProjectInfoCheckExistence ( project ) ; HashMap indexedSecondaryTypes = null ; if ( projectInfo . secondaryTypes == null ) { projectInfo . secondaryTypes = new Hashtable ( <NUM_LIT:3> ) ; indexedSecondaryTypes = new HashMap ( <NUM_LIT:3> ) ; projectInfo . secondaryTypes . put ( INDEXED_SECONDARY_TYPES , indexedSecondaryTypes ) ; } else { indexedSecondaryTypes = ( HashMap ) projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) ; if ( indexedSecondaryTypes == null ) { indexedSecondaryTypes = new HashMap ( <NUM_LIT:3> ) ; projectInfo . secondaryTypes . put ( INDEXED_SECONDARY_TYPES , indexedSecondaryTypes ) ; } } HashMap allTypes = ( HashMap ) indexedSecondaryTypes . get ( resource ) ; if ( allTypes == null ) { allTypes = new HashMap ( <NUM_LIT:3> ) ; indexedSecondaryTypes . put ( resource , allTypes ) ; } ICompilationUnit unit = JavaModelManager . createCompilationUnitFrom ( ( IFile ) resource , null ) ; if ( unit != null ) { String typeString = new String ( typeName ) ; IType type = unit . getType ( typeString ) ; String packageString = type . getPackageFragment ( ) . getElementName ( ) ; HashMap packageTypes = ( HashMap ) allTypes . get ( packageString ) ; if ( packageTypes == null ) { packageTypes = new HashMap ( <NUM_LIT:3> ) ; allTypes . put ( packageString , packageTypes ) ; } packageTypes . put ( typeString , type ) ; } if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Iterator entries = indexedSecondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; IFile file = ( IFile ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + file . getFullPath ( ) + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } } catch ( JavaModelException jme ) { } } } } public Map secondaryTypes ( IJavaProject project , boolean waitForIndexes , IProgressMonitor monitor ) throws JavaModelException { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( project . getElementName ( ) ) ; buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( waitForIndexes ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } final PerProjectInfo projectInfo = getPerProjectInfoCheckExistence ( project . getProject ( ) ) ; Map indexingSecondaryCache = projectInfo . secondaryTypes == null ? null : ( Map ) projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) ; if ( projectInfo . secondaryTypes != null && indexingSecondaryCache == null ) { return projectInfo . secondaryTypes ; } if ( projectInfo . secondaryTypes == null ) { return secondaryTypesSearching ( project , waitForIndexes , monitor , projectInfo ) ; } boolean indexing = this . indexManager . awaitingJobsCount ( ) > <NUM_LIT:0> ; if ( indexing ) { if ( ! waitForIndexes ) { return projectInfo . secondaryTypes ; } while ( this . indexManager . awaitingJobsCount ( ) > <NUM_LIT:0> ) { if ( monitor != null && monitor . isCanceled ( ) ) { return projectInfo . secondaryTypes ; } try { Thread . sleep ( <NUM_LIT:10> ) ; } catch ( InterruptedException e ) { return projectInfo . secondaryTypes ; } } } return secondaryTypesMerging ( projectInfo . secondaryTypes ) ; } private Hashtable secondaryTypesMerging ( Hashtable secondaryTypes ) { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Util . verbose ( "<STR_LIT>" ) ; Iterator entries = secondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String packName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + packName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } HashMap indexedSecondaryTypes = ( HashMap ) secondaryTypes . remove ( INDEXED_SECONDARY_TYPES ) ; if ( indexedSecondaryTypes == null ) { return secondaryTypes ; } Iterator entries = indexedSecondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; IFile file = ( IFile ) entry . getKey ( ) ; secondaryTypesRemoving ( secondaryTypes , file ) ; HashMap fileSecondaryTypes = ( HashMap ) entry . getValue ( ) ; Iterator entries2 = fileSecondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries2 . hasNext ( ) ) { Map . Entry entry2 = ( Map . Entry ) entries2 . next ( ) ; String packageName = ( String ) entry2 . getKey ( ) ; HashMap cachedTypes = ( HashMap ) secondaryTypes . get ( packageName ) ; if ( cachedTypes == null ) { secondaryTypes . put ( packageName , entry2 . getValue ( ) ) ; } else { HashMap types = ( HashMap ) entry2 . getValue ( ) ; Iterator entries3 = types . entrySet ( ) . iterator ( ) ; while ( entries3 . hasNext ( ) ) { Map . Entry entry3 = ( Map . Entry ) entries3 . next ( ) ; String typeName = ( String ) entry3 . getKey ( ) ; cachedTypes . put ( typeName , entry3 . getValue ( ) ) ; } } } } if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; entries = secondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String packName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + packName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } return secondaryTypes ; } private Map secondaryTypesSearching ( IJavaProject project , boolean waitForIndexes , IProgressMonitor monitor , final PerProjectInfo projectInfo ) throws JavaModelException { if ( VERBOSE || BasicSearchEngine . VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( project . getElementName ( ) ) ; buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( waitForIndexes ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } final Hashtable secondaryTypes = new Hashtable ( <NUM_LIT:3> ) ; IRestrictedAccessTypeRequestor nameRequestor = new IRestrictedAccessTypeRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { String key = packageName == null ? "<STR_LIT>" : new String ( packageName ) ; HashMap types = ( HashMap ) secondaryTypes . get ( key ) ; if ( types == null ) types = new HashMap ( <NUM_LIT:3> ) ; types . put ( new String ( simpleTypeName ) , path ) ; secondaryTypes . put ( key , types ) ; } } ; IPackageFragmentRoot [ ] allRoots = project . getAllPackageFragmentRoots ( ) ; int length = allRoots . length , size = <NUM_LIT:0> ; IPackageFragmentRoot [ ] allSourceFolders = new IPackageFragmentRoot [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( allRoots [ i ] . getKind ( ) == IPackageFragmentRoot . K_SOURCE ) { allSourceFolders [ size ++ ] = allRoots [ i ] ; } } if ( size < length ) { System . arraycopy ( allSourceFolders , <NUM_LIT:0> , allSourceFolders = new IPackageFragmentRoot [ size ] , <NUM_LIT:0> , size ) ; } new BasicSearchEngine ( ) . searchAllSecondaryTypeNames ( allSourceFolders , nameRequestor , waitForIndexes , monitor ) ; Iterator packages = secondaryTypes . values ( ) . iterator ( ) ; while ( packages . hasNext ( ) ) { HashMap types = ( HashMap ) packages . next ( ) ; Iterator names = types . entrySet ( ) . iterator ( ) ; while ( names . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) names . next ( ) ; String typeName = ( String ) entry . getKey ( ) ; String path = ( String ) entry . getValue ( ) ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( path ) ) { IFile file = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( new Path ( path ) ) ; ICompilationUnit unit = JavaModelManager . createCompilationUnitFrom ( file , null ) ; IType type = unit . getType ( typeName ) ; types . put ( typeName , type ) ; } else { types . remove ( typeName ) ; } } } if ( projectInfo . secondaryTypes == null || projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) != null ) { projectInfo . secondaryTypes = secondaryTypes ; if ( VERBOSE || BasicSearchEngine . VERBOSE ) { System . out . print ( Thread . currentThread ( ) + "<STR_LIT>" ) ; System . out . println ( ) ; Iterator entries = secondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String qualifiedName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + qualifiedName + '<CHAR_LIT:->' + entry . getValue ( ) ) ; } } } return projectInfo . secondaryTypes ; } public void secondaryTypesRemoving ( IFile file , boolean cleanIndexCache ) { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( file . getName ( ) ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } if ( file != null ) { PerProjectInfo projectInfo = getPerProjectInfo ( file . getProject ( ) , false ) ; if ( projectInfo != null && projectInfo . secondaryTypes != null ) { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" + file . getProject ( ) . getName ( ) ) ; } secondaryTypesRemoving ( projectInfo . secondaryTypes , file ) ; HashMap indexingCache = ( HashMap ) projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) ; if ( ! cleanIndexCache ) { if ( indexingCache == null ) { projectInfo . secondaryTypes . put ( INDEXED_SECONDARY_TYPES , new HashMap ( ) ) ; } return ; } if ( indexingCache != null ) { Set keys = indexingCache . keySet ( ) ; int filesSize = keys . size ( ) , filesCount = <NUM_LIT:0> ; IFile [ ] removed = null ; Iterator cachedFiles = keys . iterator ( ) ; while ( cachedFiles . hasNext ( ) ) { IFile cachedFile = ( IFile ) cachedFiles . next ( ) ; if ( file . equals ( cachedFile ) ) { if ( removed == null ) removed = new IFile [ filesSize ] ; filesSize -- ; removed [ filesCount ++ ] = cachedFile ; } } if ( removed != null ) { for ( int i = <NUM_LIT:0> ; i < filesCount ; i ++ ) { indexingCache . remove ( removed [ i ] ) ; } } } } } } private void secondaryTypesRemoving ( Hashtable secondaryTypesMap , IFile file ) { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; Iterator entries = secondaryTypesMap . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String qualifiedName = ( String ) entry . getKey ( ) ; buffer . append ( qualifiedName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( file . getFullPath ( ) ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } Set packageEntries = secondaryTypesMap . entrySet ( ) ; int packagesSize = packageEntries . size ( ) , removedPackagesCount = <NUM_LIT:0> ; String [ ] removedPackages = null ; Iterator packages = packageEntries . iterator ( ) ; while ( packages . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) packages . next ( ) ; String packName = ( String ) entry . getKey ( ) ; if ( packName != INDEXED_SECONDARY_TYPES ) { HashMap types = ( HashMap ) entry . getValue ( ) ; Set nameEntries = types . entrySet ( ) ; int namesSize = nameEntries . size ( ) , removedNamesCount = <NUM_LIT:0> ; String [ ] removedNames = null ; Iterator names = nameEntries . iterator ( ) ; while ( names . hasNext ( ) ) { Map . Entry entry2 = ( Map . Entry ) names . next ( ) ; String typeName = ( String ) entry2 . getKey ( ) ; JavaElement type = ( JavaElement ) entry2 . getValue ( ) ; if ( file . equals ( type . resource ( ) ) ) { if ( removedNames == null ) removedNames = new String [ namesSize ] ; namesSize -- ; removedNames [ removedNamesCount ++ ] = typeName ; } } if ( removedNames != null ) { for ( int i = <NUM_LIT:0> ; i < removedNamesCount ; i ++ ) { types . remove ( removedNames [ i ] ) ; } } if ( types . size ( ) == <NUM_LIT:0> ) { if ( removedPackages == null ) removedPackages = new String [ packagesSize ] ; packagesSize -- ; removedPackages [ removedPackagesCount ++ ] = packName ; } } } if ( removedPackages != null ) { for ( int i = <NUM_LIT:0> ; i < removedPackagesCount ; i ++ ) { secondaryTypesMap . remove ( removedPackages [ i ] ) ; } } if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Iterator entries = secondaryTypesMap . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String qualifiedName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + qualifiedName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } } protected void setBuildOrder ( String [ ] javaBuildOrder ) throws JavaModelException { if ( ! JavaCore . COMPUTE . equals ( JavaCore . getOption ( JavaCore . CORE_JAVA_BUILD_ORDER ) ) ) return ; if ( javaBuildOrder == null || javaBuildOrder . length <= <NUM_LIT:1> ) return ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; IWorkspaceDescription description = workspace . getDescription ( ) ; String [ ] wksBuildOrder = description . getBuildOrder ( ) ; String [ ] newOrder ; if ( wksBuildOrder == null ) { newOrder = javaBuildOrder ; } else { int javaCount = javaBuildOrder . length ; HashMap newSet = new HashMap ( javaCount ) ; for ( int i = <NUM_LIT:0> ; i < javaCount ; i ++ ) { newSet . put ( javaBuildOrder [ i ] , javaBuildOrder [ i ] ) ; } int removed = <NUM_LIT:0> ; int oldCount = wksBuildOrder . length ; for ( int i = <NUM_LIT:0> ; i < oldCount ; i ++ ) { if ( newSet . containsKey ( wksBuildOrder [ i ] ) ) { wksBuildOrder [ i ] = null ; removed ++ ; } } newOrder = new String [ oldCount - removed + javaCount ] ; System . arraycopy ( javaBuildOrder , <NUM_LIT:0> , newOrder , <NUM_LIT:0> , javaCount ) ; int index = javaCount ; for ( int i = <NUM_LIT:0> ; i < oldCount ; i ++ ) { if ( wksBuildOrder [ i ] != null ) { newOrder [ index ++ ] = wksBuildOrder [ i ] ; } } } description . setBuildOrder ( newOrder ) ; try { workspace . setDescription ( description ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } public void setLastBuiltState ( IProject project , Object state ) { if ( JavaProject . hasJavaNature ( project ) ) { PerProjectInfo info = getPerProjectInfo ( project , true ) ; info . triedRead = true ; info . savedState = state ; } if ( state == null ) { try { File file = getSerializationFile ( project ) ; if ( file != null && file . exists ( ) ) file . delete ( ) ; } catch ( SecurityException se ) { } } } public void setOptions ( Hashtable newOptions ) { try { Hashtable cachedValue = newOptions == null ? null : new Hashtable ( newOptions ) ; IEclipsePreferences defaultPreferences = getDefaultPreferences ( ) ; IEclipsePreferences instancePreferences = getInstancePreferences ( ) ; if ( newOptions == null ) { instancePreferences . clear ( ) ; } else { Enumeration keys = newOptions . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = ( String ) keys . nextElement ( ) ; if ( ! this . optionNames . contains ( key ) ) continue ; if ( key . equals ( JavaCore . CORE_ENCODING ) ) { if ( cachedValue != null ) { cachedValue . put ( key , JavaCore . getEncoding ( ) ) ; } continue ; } String value = ( String ) newOptions . get ( key ) ; String defaultValue = defaultPreferences . get ( key , null ) ; if ( defaultValue != null && defaultValue . equals ( value ) ) { instancePreferences . remove ( key ) ; } else { instancePreferences . put ( key , value ) ; } } } instancePreferences . flush ( ) ; Util . fixTaskTags ( cachedValue ) ; this . optionsCache = cachedValue ; } catch ( BackingStoreException e ) { } } public void startup ( ) throws CoreException { try { configurePluginDebugOptions ( ) ; this . cache = new JavaModelCache ( ) ; JavaCore . getPlugin ( ) . getStateLocation ( ) ; initializePreferences ( ) ; this . propertyListener = new IEclipsePreferences . IPreferenceChangeListener ( ) { public void preferenceChange ( PreferenceChangeEvent event ) { JavaModelManager . this . optionsCache = null ; } } ; new InstanceScope ( ) . getNode ( JavaCore . PLUGIN_ID ) . addPreferenceChangeListener ( this . propertyListener ) ; this . resourcesPropertyListener = new IEclipsePreferences . IPreferenceChangeListener ( ) { public void preferenceChange ( PreferenceChangeEvent event ) { if ( ResourcesPlugin . PREF_ENCODING . equals ( event . getKey ( ) ) ) { JavaModelManager . this . optionsCache = null ; } } } ; String resourcesPluginId = ResourcesPlugin . getPlugin ( ) . getBundle ( ) . getSymbolicName ( ) ; new InstanceScope ( ) . getNode ( resourcesPluginId ) . addPreferenceChangeListener ( this . resourcesPropertyListener ) ; Platform . getContentTypeManager ( ) . addContentTypeChangeListener ( this ) ; long start = - <NUM_LIT:1> ; if ( VERBOSE ) start = System . currentTimeMillis ( ) ; loadVariablesAndContainers ( ) ; if ( VERBOSE ) traceVariableAndContainers ( "<STR_LIT>" , start ) ; this . deltaState . initializeRootsWithPreviousSession ( ) ; final IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; workspace . addResourceChangeListener ( this . deltaState , IResourceChangeEvent . PRE_BUILD | IResourceChangeEvent . POST_BUILD | IResourceChangeEvent . POST_CHANGE | IResourceChangeEvent . PRE_DELETE | IResourceChangeEvent . PRE_CLOSE | IResourceChangeEvent . PRE_REFRESH ) ; startIndexing ( ) ; Job processSavedState = new Job ( Messages . savedState_jobName ) { protected IStatus run ( IProgressMonitor monitor ) { try { workspace . run ( new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor progress ) throws CoreException { ISavedState savedState = workspace . addSaveParticipant ( JavaCore . PLUGIN_ID , JavaModelManager . this ) ; if ( savedState != null ) { JavaModelManager . this . deltaState . getDeltaProcessor ( ) . overridenEventType = IResourceChangeEvent . POST_CHANGE ; savedState . processResourceChangeEvents ( JavaModelManager . this . deltaState ) ; } } } , monitor ) ; } catch ( CoreException e ) { return e . getStatus ( ) ; } return Status . OK_STATUS ; } } ; processSavedState . setSystem ( true ) ; processSavedState . setPriority ( Job . SHORT ) ; processSavedState . schedule ( ) ; } catch ( RuntimeException e ) { shutdown ( ) ; throw e ; } } private void startIndexing ( ) { if ( this . indexManager != null ) this . indexManager . reset ( ) ; } public void shutdown ( ) { IEclipsePreferences preferences = new InstanceScope ( ) . getNode ( JavaCore . PLUGIN_ID ) ; try { preferences . flush ( ) ; } catch ( BackingStoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; workspace . removeResourceChangeListener ( this . deltaState ) ; workspace . removeSaveParticipant ( JavaCore . PLUGIN_ID ) ; Platform . getContentTypeManager ( ) . removeContentTypeChangeListener ( this ) ; if ( this . indexManager != null ) { this . indexManager . shutdown ( ) ; } preferences . removePreferenceChangeListener ( this . propertyListener ) ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_DEFAULT ] . parent ( ) ) . removeNodeChangeListener ( this . defaultNodeListener ) ; this . preferencesLookup [ PREF_DEFAULT ] = null ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_INSTANCE ] . parent ( ) ) . removeNodeChangeListener ( this . instanceNodeListener ) ; this . preferencesLookup [ PREF_INSTANCE ] . removePreferenceChangeListener ( this . instancePreferencesListener ) ; this . preferencesLookup [ PREF_INSTANCE ] = null ; String resourcesPluginId = ResourcesPlugin . getPlugin ( ) . getBundle ( ) . getSymbolicName ( ) ; new InstanceScope ( ) . getNode ( resourcesPluginId ) . removePreferenceChangeListener ( this . resourcesPropertyListener ) ; try { Job . getJobManager ( ) . join ( JavaCore . PLUGIN_ID , null ) ; } catch ( InterruptedException e ) { } } public synchronized IPath variableGet ( String variableName ) { HashSet initializations = variableInitializationInProgress ( ) ; if ( initializations . contains ( variableName ) ) { return VARIABLE_INITIALIZATION_IN_PROGRESS ; } return ( IPath ) this . variables . get ( variableName ) ; } private synchronized IPath variableGetDefaultToPreviousSession ( String variableName ) { IPath variablePath = ( IPath ) this . variables . get ( variableName ) ; if ( variablePath == null ) return getPreviousSessionVariable ( variableName ) ; return variablePath ; } private HashSet variableInitializationInProgress ( ) { HashSet initializations = ( HashSet ) this . variableInitializationInProgress . get ( ) ; if ( initializations == null ) { initializations = new HashSet ( ) ; this . variableInitializationInProgress . set ( initializations ) ; } return initializations ; } public synchronized String [ ] variableNames ( ) { int length = this . variables . size ( ) ; String [ ] result = new String [ length ] ; Iterator vars = this . variables . keySet ( ) . iterator ( ) ; int index = <NUM_LIT:0> ; while ( vars . hasNext ( ) ) { result [ index ++ ] = ( String ) vars . next ( ) ; } return result ; } public synchronized void variablePut ( String variableName , IPath variablePath ) { HashSet initializations = variableInitializationInProgress ( ) ; if ( variablePath == VARIABLE_INITIALIZATION_IN_PROGRESS ) { initializations . add ( variableName ) ; return ; } else { initializations . remove ( variableName ) ; if ( variablePath == null ) { this . variables . put ( variableName , CP_ENTRY_IGNORE_PATH ) ; this . variablesWithInitializer . remove ( variableName ) ; this . deprecatedVariables . remove ( variableName ) ; } else { this . variables . put ( variableName , variablePath ) ; } this . previousSessionVariables . remove ( variableName ) ; } } public void variablePreferencesPut ( String variableName , IPath variablePath ) { String variableKey = CP_VARIABLE_PREFERENCES_PREFIX + variableName ; if ( variablePath == null ) { getInstancePreferences ( ) . remove ( variableKey ) ; } else { getInstancePreferences ( ) . put ( variableKey , variablePath . toString ( ) ) ; } try { getInstancePreferences ( ) . flush ( ) ; } catch ( BackingStoreException e ) { } } public boolean variablePutIfInitializingWithSameValue ( String [ ] variableNames , IPath [ ] variablePaths ) { if ( variableNames . length != <NUM_LIT:1> ) return false ; String variableName = variableNames [ <NUM_LIT:0> ] ; IPath oldPath = variableGetDefaultToPreviousSession ( variableName ) ; if ( oldPath == null ) return false ; IPath newPath = variablePaths [ <NUM_LIT:0> ] ; if ( ! oldPath . equals ( newPath ) ) return false ; variablePut ( variableName , newPath ) ; return true ; } public void contentTypeChanged ( ContentTypeChangeEvent event ) { Util . resetJavaLikeExtensions ( ) ; IJavaProject [ ] projects ; try { projects = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) . getJavaProjects ( ) ; } catch ( JavaModelException e ) { return ; } for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject project = projects [ i ] ; final PerProjectInfo projectInfo = getPerProjectInfo ( project . getProject ( ) , false ) ; if ( projectInfo != null ) { projectInfo . secondaryTypes = null ; } } } public synchronized String cacheToString ( String prefix ) { return this . cache . toStringFillingRation ( prefix ) ; } public Stats debugNewOpenableCacheStats ( ) { return this . cache . openableCache . new Stats ( ) ; } public int getOpenableCacheSize ( ) { return this . cache . openableCache . getSpaceLimit ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . eval ; import org . eclipse . jdt . core . eval . IGlobalVariable ; import org . eclipse . jdt . internal . eval . GlobalVariable ; class GlobalVariableWrapper implements IGlobalVariable { GlobalVariable variable ; GlobalVariableWrapper ( GlobalVariable variable ) { this . variable = variable ; } public String getInitializer ( ) { char [ ] initializer = this . variable . getInitializer ( ) ; if ( initializer != null ) { return new String ( initializer ) ; } else { return null ; } } public String getName ( ) { return new String ( this . variable . getName ( ) ) ; } public String getTypeName ( ) { return new String ( this . variable . getTypeName ( ) ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . eval ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . IJavaModelMarker ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . eval . ICodeSnippetRequestor ; import org . eclipse . jdt . internal . compiler . ClassFile ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . eval . IRequestor ; public class RequestorWrapper implements IRequestor { ICodeSnippetRequestor requestor ; public RequestorWrapper ( ICodeSnippetRequestor requestor ) { this . requestor = requestor ; } public boolean acceptClassFiles ( ClassFile [ ] classFiles , char [ ] codeSnippetClassName ) { int length = classFiles . length ; byte [ ] [ ] classFileBytes = new byte [ length ] [ ] ; String [ ] [ ] compoundNames = new String [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ClassFile classFile = classFiles [ i ] ; classFileBytes [ i ] = classFile . getBytes ( ) ; char [ ] [ ] classFileCompundName = classFile . getCompoundName ( ) ; int length2 = classFileCompundName . length ; String [ ] compoundName = new String [ length2 ] ; for ( int j = <NUM_LIT:0> ; j < length2 ; j ++ ) { compoundName [ j ] = new String ( classFileCompundName [ j ] ) ; } compoundNames [ i ] = compoundName ; } return this . requestor . acceptClassFiles ( classFileBytes , compoundNames , codeSnippetClassName == null ? null : new String ( codeSnippetClassName ) ) ; } public void acceptProblem ( CategorizedProblem problem , char [ ] fragmentSource , int fragmentKind ) { try { IMarker marker = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . createMarker ( IJavaModelMarker . TRANSIENT_PROBLEM ) ; marker . setAttribute ( IJavaModelMarker . ID , problem . getID ( ) ) ; marker . setAttribute ( IMarker . CHAR_START , problem . getSourceStart ( ) ) ; marker . setAttribute ( IMarker . CHAR_END , problem . getSourceEnd ( ) + <NUM_LIT:1> ) ; marker . setAttribute ( IMarker . LINE_NUMBER , problem . getSourceLineNumber ( ) ) ; marker . setAttribute ( IMarker . MESSAGE , problem . getMessage ( ) ) ; marker . setAttribute ( IMarker . SEVERITY , ( problem . isWarning ( ) ? IMarker . SEVERITY_WARNING : IMarker . SEVERITY_ERROR ) ) ; marker . setAttribute ( IMarker . SOURCE_ID , JavaBuilder . SOURCE_ID ) ; this . requestor . acceptProblem ( marker , new String ( fragmentSource ) , fragmentKind ) ; } catch ( CoreException e ) { e . printStackTrace ( ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core . eval ; import java . util . Locale ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . eval . ICodeSnippetRequestor ; import org . eclipse . jdt . core . eval . IEvaluationContext ; import org . eclipse . jdt . core . eval . IGlobalVariable ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . builder . NameEnvironment ; import org . eclipse . jdt . internal . core . builder . ProblemFactory ; import org . eclipse . jdt . internal . eval . EvaluationContext ; import org . eclipse . jdt . internal . eval . GlobalVariable ; import org . eclipse . jdt . internal . eval . IRequestor ; import org . eclipse . jdt . internal . eval . InstallException ; public class EvaluationContextWrapper implements IEvaluationContext { protected EvaluationContext context ; protected JavaProject project ; public EvaluationContextWrapper ( EvaluationContext context , JavaProject project ) { this . context = context ; this . project = project ; } public IGlobalVariable [ ] allVariables ( ) { GlobalVariable [ ] vars = this . context . allVariables ( ) ; int length = vars . length ; GlobalVariableWrapper [ ] result = new GlobalVariableWrapper [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = new GlobalVariableWrapper ( vars [ i ] ) ; } return result ; } protected void checkBuilderState ( ) { return ; } public void codeComplete ( String codeSnippet , int position , ICompletionRequestor requestor ) throws JavaModelException { codeComplete ( codeSnippet , position , requestor , DefaultWorkingCopyOwner . PRIMARY ) ; } public void codeComplete ( String codeSnippet , int position , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { if ( requestor == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } codeComplete ( codeSnippet , position , new org . eclipse . jdt . internal . codeassist . CompletionRequestorWrapper ( requestor ) , owner ) ; } public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor ) throws JavaModelException { codeComplete ( codeSnippet , position , requestor , DefaultWorkingCopyOwner . PRIMARY ) ; } public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { codeComplete ( codeSnippet , position , requestor , DefaultWorkingCopyOwner . PRIMARY , null ) ; } public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { codeComplete ( codeSnippet , position , requestor , owner , null ) ; } public void codeComplete ( String codeSnippet , int position , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { SearchableEnvironment environment = this . project . newSearchableNameEnvironment ( owner ) ; this . context . complete ( codeSnippet . toCharArray ( ) , position , environment , requestor , this . project . getOptions ( true ) , this . project , owner , monitor ) ; } public IJavaElement [ ] codeSelect ( String codeSnippet , int offset , int length ) throws JavaModelException { return codeSelect ( codeSnippet , offset , length , DefaultWorkingCopyOwner . PRIMARY ) ; } public IJavaElement [ ] codeSelect ( String codeSnippet , int offset , int length , WorkingCopyOwner owner ) throws JavaModelException { SearchableEnvironment environment = this . project . newSearchableNameEnvironment ( owner ) ; SelectionRequestor requestor = new SelectionRequestor ( environment . nameLookup , null ) ; this . context . select ( codeSnippet . toCharArray ( ) , offset , offset + length - <NUM_LIT:1> , environment , requestor , this . project . getOptions ( true ) , owner ) ; return requestor . getElements ( ) ; } public void deleteVariable ( IGlobalVariable variable ) { if ( variable instanceof GlobalVariableWrapper ) { GlobalVariableWrapper wrapper = ( GlobalVariableWrapper ) variable ; this . context . deleteVariable ( wrapper . variable ) ; } else { throw new Error ( "<STR_LIT>" ) ; } } public void evaluateCodeSnippet ( String codeSnippet , String [ ] localVariableTypeNames , String [ ] localVariableNames , int [ ] localVariableModifiers , IType declaringType , boolean isStatic , boolean isConstructorCall , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws org . eclipse . jdt . core . JavaModelException { checkBuilderState ( ) ; int length = localVariableTypeNames . length ; char [ ] [ ] varTypeNames = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { varTypeNames [ i ] = localVariableTypeNames [ i ] . toCharArray ( ) ; } length = localVariableNames . length ; char [ ] [ ] varNames = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { varNames [ i ] = localVariableNames [ i ] . toCharArray ( ) ; } Map options = this . project . getOptions ( true ) ; if ( declaringType != null ) { this . context . setPackageName ( declaringType . getPackageFragment ( ) . getElementName ( ) . toCharArray ( ) ) ; ICompilationUnit compilationUnit = declaringType . getCompilationUnit ( ) ; if ( compilationUnit != null ) { IImportDeclaration [ ] imports = compilationUnit . getImports ( ) ; int importsLength = imports . length ; if ( importsLength != <NUM_LIT:0> ) { char [ ] [ ] importsNames = new char [ importsLength ] [ ] ; for ( int i = <NUM_LIT:0> ; i < importsLength ; i ++ ) { importsNames [ i ] = imports [ i ] . getElementName ( ) . toCharArray ( ) ; } this . context . setImports ( importsNames ) ; options . put ( CompilerOptions . OPTION_ReportUnusedImport , CompilerOptions . IGNORE ) ; } } else { SourceMapper sourceMapper = ( ( ClassFile ) declaringType . getClassFile ( ) ) . getSourceMapper ( ) ; if ( sourceMapper != null ) { char [ ] [ ] imports = sourceMapper . getImports ( ( BinaryType ) declaringType ) ; if ( imports != null ) { this . context . setImports ( imports ) ; options . put ( CompilerOptions . OPTION_ReportUnusedImport , CompilerOptions . IGNORE ) ; } } } } INameEnvironment environment = null ; try { this . context . evaluate ( codeSnippet . toCharArray ( ) , varTypeNames , varNames , localVariableModifiers , declaringType == null ? null : declaringType . getFullyQualifiedName ( ) . toCharArray ( ) , isStatic , isConstructorCall , environment = getBuildNameEnvironment ( ) , options , getInfrastructureEvaluationRequestor ( requestor ) , getProblemFactory ( ) ) ; } catch ( InstallException e ) { handleInstallException ( e ) ; } finally { if ( environment != null ) environment . cleanup ( ) ; } } public void evaluateCodeSnippet ( String codeSnippet , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException { checkBuilderState ( ) ; INameEnvironment environment = null ; try { this . context . evaluate ( codeSnippet . toCharArray ( ) , environment = getBuildNameEnvironment ( ) , this . project . getOptions ( true ) , getInfrastructureEvaluationRequestor ( requestor ) , getProblemFactory ( ) ) ; } catch ( InstallException e ) { handleInstallException ( e ) ; } finally { if ( environment != null ) environment . cleanup ( ) ; } } public void evaluateVariable ( IGlobalVariable variable , ICodeSnippetRequestor requestor , IProgressMonitor progressMonitor ) throws JavaModelException { checkBuilderState ( ) ; INameEnvironment environment = null ; try { this . context . evaluateVariable ( ( ( GlobalVariableWrapper ) variable ) . variable , environment = getBuildNameEnvironment ( ) , this . project . getOptions ( true ) , getInfrastructureEvaluationRequestor ( requestor ) , getProblemFactory ( ) ) ; } catch ( InstallException e ) { handleInstallException ( e ) ; } finally { if ( environment != null ) environment . cleanup ( ) ; } } protected INameEnvironment getBuildNameEnvironment ( ) { return new NameEnvironment ( getProject ( ) ) ; } public char [ ] getVarClassName ( ) { return this . context . getVarClassName ( ) ; } public String [ ] getImports ( ) { char [ ] [ ] imports = this . context . getImports ( ) ; int length = imports . length ; String [ ] result = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = new String ( imports [ i ] ) ; } return result ; } public EvaluationContext getInfrastructureEvaluationContext ( ) { return this . context ; } protected IRequestor getInfrastructureEvaluationRequestor ( ICodeSnippetRequestor requestor ) { return new RequestorWrapper ( requestor ) ; } public String getPackageName ( ) { return new String ( this . context . getPackageName ( ) ) ; } protected IProblemFactory getProblemFactory ( ) { return ProblemFactory . getProblemFactory ( Locale . getDefault ( ) ) ; } public IJavaProject getProject ( ) { return this . project ; } protected void handleInstallException ( InstallException e ) throws JavaModelException { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . EVALUATION_ERROR , e . toString ( ) ) ) ; } public IGlobalVariable newVariable ( String typeName , String name , String initializer ) { GlobalVariable newVar = this . context . newVariable ( typeName . toCharArray ( ) , name . toCharArray ( ) , ( initializer == null ) ? null : initializer . toCharArray ( ) ) ; return new GlobalVariableWrapper ( newVar ) ; } public void setImports ( String [ ] imports ) { int length = imports . length ; char [ ] [ ] result = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = imports [ i ] . toCharArray ( ) ; } this . context . setImports ( result ) ; } public void setPackageName ( String packageName ) { this . context . setPackageName ( packageName . toCharArray ( ) ) ; } public void validateImports ( ICodeSnippetRequestor requestor ) { checkBuilderState ( ) ; INameEnvironment environment = null ; try { this . context . evaluateImports ( environment = getBuildNameEnvironment ( ) , getInfrastructureEvaluationRequestor ( requestor ) , getProblemFactory ( ) ) ; } finally { if ( environment != null ) environment . cleanup ( ) ; } } public void codeComplete ( String codeSnippet , int position , final org . eclipse . jdt . core . ICodeCompletionRequestor requestor ) throws JavaModelException { if ( requestor == null ) { codeComplete ( codeSnippet , position , ( ICompletionRequestor ) null ) ; return ; } codeComplete ( codeSnippet , position , new ICompletionRequestor ( ) { public void acceptAnonymousType ( char [ ] superTypePackageName , char [ ] superTypeName , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptClass ( char [ ] packageName , char [ ] className , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptClass ( packageName , className , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptError ( IProblem error ) { } public void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , char [ ] typePackageName , char [ ] typeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptField ( declaringTypePackageName , declaringTypeName , name , typePackageName , typeName , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptInterface ( packageName , interfaceName , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptKeyword ( char [ ] keywordName , int completionStart , int completionEnd , int relevance ) { requestor . acceptKeyword ( keywordName , completionStart , completionEnd ) ; } public void acceptLabel ( char [ ] labelName , int completionStart , int completionEnd , int relevance ) { requestor . acceptLabel ( labelName , completionStart , completionEnd ) ; } public void acceptLocalVariable ( char [ ] name , char [ ] typePackageName , char [ ] typeName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptMethod ( declaringTypePackageName , declaringTypeName , selector , parameterPackageNames , parameterTypeNames , returnTypePackageName , returnTypeName , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptMethodDeclaration ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptModifier ( char [ ] modifierName , int completionStart , int completionEnd , int relevance ) { requestor . acceptModifier ( modifierName , completionStart , completionEnd ) ; } public void acceptPackage ( char [ ] packageName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { requestor . acceptPackage ( packageName , completionName , completionStart , completionEnd ) ; } public void acceptType ( char [ ] packageName , char [ ] typeName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { requestor . acceptType ( packageName , typeName , completionName , completionStart , completionEnd ) ; } public void acceptVariableName ( char [ ] typePackageName , char [ ] typeName , char [ ] name , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { } } ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ; import org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . Literal ; import org . eclipse . jdt . internal . compiler . ast . NullLiteral ; import org . eclipse . jdt . internal . compiler . ast . OperatorIds ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . UnaryExpression ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScanner ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Util ; public class LocalVariable extends SourceRefElement implements ILocalVariable { String name ; public int declarationSourceStart , declarationSourceEnd ; public int nameStart , nameEnd ; String typeSignature ; public IAnnotation [ ] annotations ; public LocalVariable ( JavaElement parent , String name , int declarationSourceStart , int declarationSourceEnd , int nameStart , int nameEnd , String typeSignature , org . eclipse . jdt . internal . compiler . ast . Annotation [ ] astAnnotations ) { super ( parent ) ; this . name = name ; this . declarationSourceStart = declarationSourceStart ; this . declarationSourceEnd = declarationSourceEnd ; this . nameStart = nameStart ; this . nameEnd = nameEnd ; this . typeSignature = typeSignature ; this . annotations = getAnnotations ( astAnnotations ) ; } protected void closing ( Object info ) { } protected Object createElementInfo ( ) { return null ; } public boolean equals ( Object o ) { if ( ! ( o instanceof LocalVariable ) ) return false ; LocalVariable other = ( LocalVariable ) o ; return this . declarationSourceStart == other . declarationSourceStart && this . declarationSourceEnd == other . declarationSourceEnd && this . nameStart == other . nameStart && this . nameEnd == other . nameEnd && super . equals ( o ) ; } public boolean exists ( ) { return this . parent . exists ( ) ; } protected void generateInfos ( Object info , HashMap newElements , IProgressMonitor pm ) { } public IAnnotation getAnnotation ( String annotationName ) { for ( int i = <NUM_LIT:0> , length = this . annotations . length ; i < length ; i ++ ) { IAnnotation annotation = this . annotations [ i ] ; if ( annotation . getElementName ( ) . equals ( annotationName ) ) return annotation ; } return super . getAnnotation ( annotationName ) ; } public IAnnotation [ ] getAnnotations ( ) throws JavaModelException { return this . annotations ; } private IAnnotation [ ] getAnnotations ( org . eclipse . jdt . internal . compiler . ast . Annotation [ ] astAnnotations ) { int length ; if ( astAnnotations == null || ( length = astAnnotations . length ) == <NUM_LIT:0> ) return Annotation . NO_ANNOTATIONS ; IAnnotation [ ] result = new IAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = getAnnotation ( astAnnotations [ i ] , this ) ; } return result ; } private IAnnotation getAnnotation ( final org . eclipse . jdt . internal . compiler . ast . Annotation annotation , JavaElement parentElement ) { final int typeStart = annotation . type . sourceStart ( ) ; final int typeEnd = annotation . type . sourceEnd ( ) ; final int sourceStart = annotation . sourceStart ( ) ; final int sourceEnd = annotation . declarationSourceEnd ; class LocalVarAnnotation extends Annotation { IMemberValuePair [ ] memberValuePairs ; public LocalVarAnnotation ( JavaElement localVar , String elementName ) { super ( localVar , elementName ) ; } public IMemberValuePair [ ] getMemberValuePairs ( ) throws JavaModelException { return this . memberValuePairs ; } public ISourceRange getNameRange ( ) throws JavaModelException { return new SourceRange ( typeStart , typeEnd - typeStart + <NUM_LIT:1> ) ; } public ISourceRange getSourceRange ( ) throws JavaModelException { return new SourceRange ( sourceStart , sourceEnd - sourceStart + <NUM_LIT:1> ) ; } public boolean exists ( ) { return this . parent . exists ( ) ; } } String annotationName = new String ( CharOperation . concatWith ( annotation . type . getTypeName ( ) , '<CHAR_LIT:.>' ) ) ; LocalVarAnnotation localVarAnnotation = new LocalVarAnnotation ( parentElement , annotationName ) ; org . eclipse . jdt . internal . compiler . ast . MemberValuePair [ ] astMemberValuePairs = annotation . memberValuePairs ( ) ; int length ; IMemberValuePair [ ] memberValuePairs ; if ( astMemberValuePairs == null || ( length = astMemberValuePairs . length ) == <NUM_LIT:0> ) { memberValuePairs = Annotation . NO_MEMBER_VALUE_PAIRS ; } else { memberValuePairs = new IMemberValuePair [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . ast . MemberValuePair astMemberValuePair = astMemberValuePairs [ i ] ; MemberValuePair memberValuePair = new MemberValuePair ( new String ( astMemberValuePair . name ) ) ; memberValuePair . value = getAnnotationMemberValue ( memberValuePair , astMemberValuePair . value , localVarAnnotation ) ; memberValuePairs [ i ] = memberValuePair ; } } localVarAnnotation . memberValuePairs = memberValuePairs ; return localVarAnnotation ; } private Object getAnnotationMemberValue ( MemberValuePair memberValuePair , Expression expression , JavaElement parentElement ) { if ( expression instanceof NullLiteral ) { return null ; } else if ( expression instanceof Literal ) { ( ( Literal ) expression ) . computeConstant ( ) ; return Util . getAnnotationMemberValue ( memberValuePair , expression . constant ) ; } else if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . Annotation ) { memberValuePair . valueKind = IMemberValuePair . K_ANNOTATION ; return getAnnotation ( ( org . eclipse . jdt . internal . compiler . ast . Annotation ) expression , parentElement ) ; } else if ( expression instanceof ClassLiteralAccess ) { ClassLiteralAccess classLiteral = ( ClassLiteralAccess ) expression ; char [ ] typeName = CharOperation . concatWith ( classLiteral . type . getTypeName ( ) , '<CHAR_LIT:.>' ) ; memberValuePair . valueKind = IMemberValuePair . K_CLASS ; return new String ( typeName ) ; } else if ( expression instanceof QualifiedNameReference ) { char [ ] qualifiedName = CharOperation . concatWith ( ( ( QualifiedNameReference ) expression ) . tokens , '<CHAR_LIT:.>' ) ; memberValuePair . valueKind = IMemberValuePair . K_QUALIFIED_NAME ; return new String ( qualifiedName ) ; } else if ( expression instanceof SingleNameReference ) { char [ ] simpleName = ( ( SingleNameReference ) expression ) . token ; if ( simpleName == RecoveryScanner . FAKE_IDENTIFIER ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } memberValuePair . valueKind = IMemberValuePair . K_SIMPLE_NAME ; return new String ( simpleName ) ; } else if ( expression instanceof ArrayInitializer ) { memberValuePair . valueKind = - <NUM_LIT:1> ; Expression [ ] expressions = ( ( ArrayInitializer ) expression ) . expressions ; int length = expressions == null ? <NUM_LIT:0> : expressions . length ; Object [ ] values = new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { int previousValueKind = memberValuePair . valueKind ; Object value = getAnnotationMemberValue ( memberValuePair , expressions [ i ] , parentElement ) ; if ( previousValueKind != - <NUM_LIT:1> && memberValuePair . valueKind != previousValueKind ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; } values [ i ] = value ; } if ( memberValuePair . valueKind == - <NUM_LIT:1> ) memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return values ; } else if ( expression instanceof UnaryExpression ) { UnaryExpression unaryExpression = ( UnaryExpression ) expression ; if ( ( unaryExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT == OperatorIds . MINUS ) { if ( unaryExpression . expression instanceof Literal ) { Literal subExpression = ( Literal ) unaryExpression . expression ; subExpression . computeConstant ( ) ; return Util . getNegativeAnnotationMemberValue ( memberValuePair , subExpression . constant ) ; } } memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } else { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_COUNT : return getHandleUpdatingCountFromMemento ( memento , owner ) ; } return this ; } protected void getHandleMemento ( StringBuffer buff ) { ( ( JavaElement ) getParent ( ) ) . getHandleMemento ( buff ) ; buff . append ( getHandleMementoDelimiter ( ) ) ; buff . append ( this . name ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . declarationSourceStart ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . declarationSourceEnd ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . nameStart ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . nameEnd ) ; buff . append ( JEM_COUNT ) ; escapeMementoName ( buff , this . typeSignature ) ; if ( this . occurrenceCount > <NUM_LIT:1> ) { buff . append ( JEM_COUNT ) ; buff . append ( this . occurrenceCount ) ; } } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_LOCALVARIABLE ; } public IResource getCorrespondingResource ( ) { return null ; } public String getElementName ( ) { return this . name ; } public int getElementType ( ) { return LOCAL_VARIABLE ; } public ISourceRange getNameRange ( ) { return new SourceRange ( this . nameStart , this . nameEnd - this . nameStart + <NUM_LIT:1> ) ; } public IPath getPath ( ) { return this . parent . getPath ( ) ; } public IResource resource ( ) { return this . parent . resource ( ) ; } public String getSource ( ) throws JavaModelException { IOpenable openable = this . parent . getOpenableParent ( ) ; IBuffer buffer = openable . getBuffer ( ) ; if ( buffer == null ) { return null ; } ISourceRange range = getSourceRange ( ) ; int offset = range . getOffset ( ) ; int length = range . getLength ( ) ; if ( offset == - <NUM_LIT:1> || length == <NUM_LIT:0> ) { return null ; } try { return buffer . getText ( offset , length ) ; } catch ( RuntimeException e ) { return null ; } } public ISourceRange getSourceRange ( ) { return new SourceRange ( this . declarationSourceStart , this . declarationSourceEnd - this . declarationSourceStart + <NUM_LIT:1> ) ; } public String getTypeSignature ( ) { return this . typeSignature ; } public IResource getUnderlyingResource ( ) throws JavaModelException { return this . parent . getUnderlyingResource ( ) ; } public int hashCode ( ) { return Util . combineHashCodes ( this . parent . hashCode ( ) , this . nameStart ) ; } public boolean isStructureKnown ( ) throws JavaModelException { return true ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; if ( info != NO_INFO ) { buffer . append ( Signature . toString ( getTypeSignature ( ) ) ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; } toStringName ( buffer ) ; } } </s>