<s> package org . eclipse . jdt . internal . compiler . impl ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; public class IrritantSet { public final static int GROUP_MASK = ASTNode . Bit32 | ASTNode . Bit31 | ASTNode . Bit30 ; public final static int GROUP_SHIFT = 29 ; public final static int GROUP_MAX = 3 ; public final static int GROUP0 = 0 << GROUP_SHIFT ; public final static int GROUP1 = 1 << GROUP_SHIFT ; public final static int GROUP2 = 2 << GROUP_SHIFT ; public static final IrritantSet ALL = new IrritantSet ( 0xFFFFFFFF & ~ GROUP_MASK ) ; public static final IrritantSet BOXING = new IrritantSet ( CompilerOptions . AutoBoxing ) ; public static final IrritantSet CAST = new IrritantSet ( CompilerOptions . UnnecessaryTypeCheck ) ; public static final IrritantSet DEPRECATION = new IrritantSet ( CompilerOptions . UsingDeprecatedAPI ) ; public static final IrritantSet DEP_ANN = new IrritantSet ( CompilerOptions . MissingDeprecatedAnnotation ) ; public static final IrritantSet FALLTHROUGH = new IrritantSet ( CompilerOptions . FallthroughCase ) ; public static final IrritantSet FINALLY = new IrritantSet ( CompilerOptions . FinallyBlockNotCompleting ) ; public static final IrritantSet HIDING = new IrritantSet ( CompilerOptions . MaskedCatchBlock ) ; public static final IrritantSet INCOMPLETE_SWITCH = new IrritantSet ( CompilerOptions . MissingEnumConstantCase ) ; public static final IrritantSet NLS = new IrritantSet ( CompilerOptions . NonExternalizedString ) ; public static final IrritantSet NULL = new IrritantSet ( CompilerOptions . NullReference ) ; public static final IrritantSet RAW = new IrritantSet ( CompilerOptions . RawTypeReference ) ; public static final IrritantSet RESTRICTION = new IrritantSet ( CompilerOptions . ForbiddenReference ) ; public static final IrritantSet SERIAL = new IrritantSet ( CompilerOptions . MissingSerialVersion ) ; public static final IrritantSet STATIC_ACCESS = new IrritantSet ( CompilerOptions . IndirectStaticAccess ) ; public static final IrritantSet STATIC_METHOD = new IrritantSet ( CompilerOptions . MethodCanBeStatic ) ; public static final IrritantSet SYNTHETIC_ACCESS = new IrritantSet ( CompilerOptions . AccessEmulation ) ; public static final IrritantSet SYNCHRONIZED = new IrritantSet ( CompilerOptions . MissingSynchronizedModifierInInheritedMethod ) ; public static final IrritantSet SUPER = new IrritantSet ( CompilerOptions . OverridingMethodWithoutSuperInvocation ) ; public static final IrritantSet UNUSED = new IrritantSet ( CompilerOptions . UnusedLocalVariable ) ; public static final IrritantSet UNCHECKED = new IrritantSet ( CompilerOptions . UncheckedTypeOperation ) ; public static final IrritantSet UNQUALIFIED_FIELD_ACCESS = new IrritantSet ( CompilerOptions . UnqualifiedFieldAccess ) ; public static final IrritantSet RESOURCE = new IrritantSet ( CompilerOptions . UnclosedCloseable ) ; public static final IrritantSet JAVADOC = new IrritantSet ( CompilerOptions . InvalidJavadoc ) ; public static final IrritantSet COMPILER_DEFAULT_ERRORS = new IrritantSet ( 0 ) ; public static final IrritantSet COMPILER_DEFAULT_WARNINGS = new IrritantSet ( 0 ) ; static { COMPILER_DEFAULT_WARNINGS . set ( CompilerOptions . MethodWithConstructorName | CompilerOptions . OverriddenPackageDefaultMethod | CompilerOptions . UsingDeprecatedAPI | CompilerOptions . MaskedCatchBlock | CompilerOptions . UnusedLocalVariable | CompilerOptions . NoImplicitStringConversion | CompilerOptions . AssertUsedAsAnIdentifier | CompilerOptions . UnusedImport | CompilerOptions . NonStaticAccessToStatic | CompilerOptions . NoEffectAssignment | CompilerOptions . IncompatibleNonInheritedInterfaceMethod | CompilerOptions . UnusedPrivateMember | CompilerOptions . FinallyBlockNotCompleting ) . set ( CompilerOptions . UncheckedTypeOperation | CompilerOptions . FinalParameterBound | CompilerOptions . MissingSerialVersion | CompilerOptions . EnumUsedAsAnIdentifier | CompilerOptions . ForbiddenReference | CompilerOptions . VarargsArgumentNeedCast | CompilerOptions . NullReference | CompilerOptions . AnnotationSuperInterface | CompilerOptions . TypeHiding | CompilerOptions . DiscouragedReference | CompilerOptions . UnhandledWarningToken | CompilerOptions . RawTypeReference | CompilerOptions . UnusedLabel | CompilerOptions . UnusedTypeArguments | CompilerOptions . UnusedWarningToken | CompilerOptions . ComparingIdentical | CompilerOptions . MissingEnumConstantCase ) . set ( CompilerOptions . DeadCode | CompilerOptions . Tasks | CompilerOptions . UnclosedCloseable | CompilerOptions . NullUncheckedConversion | CompilerOptions . RedundantNullAnnotation ) ; COMPILER_DEFAULT_ERRORS . set ( CompilerOptions . NullSpecViolation | CompilerOptions . NullAnnotationInferenceConflict ) ; ALL . setAll ( ) ; HIDING . set ( CompilerOptions . FieldHiding ) . set ( CompilerOptions . LocalVariableHiding ) . set ( CompilerOptions . TypeHiding ) ; NULL . set ( CompilerOptions . PotentialNullReference ) . set ( CompilerOptions . RedundantNullCheck ) . set ( CompilerOptions . NullSpecViolation ) . set ( CompilerOptions . NullAnnotationInferenceConflict ) . set ( CompilerOptions . NullUncheckedConversion ) . set ( CompilerOptions . RedundantNullAnnotation ) ; RESTRICTION . set ( CompilerOptions . DiscouragedReference ) ; STATIC_ACCESS . set ( CompilerOptions . NonStaticAccessToStatic ) ; UNUSED . set ( CompilerOptions . UnusedArgument ) . set ( CompilerOptions . UnusedPrivateMember ) . set ( CompilerOptions . UnusedDeclaredThrownException ) . set ( CompilerOptions . UnusedLabel ) . set ( CompilerOptions . UnusedImport ) . set ( CompilerOptions . UnusedTypeArguments ) . set ( CompilerOptions . RedundantSuperinterface ) . set ( CompilerOptions . DeadCode ) . set ( CompilerOptions . UnusedObjectAllocation ) . set ( CompilerOptions . RedundantSpecificationOfTypeArguments ) ; STATIC_METHOD . set ( CompilerOptions . MethodCanBePotentiallyStatic ) ; RESOURCE . set ( CompilerOptions . PotentiallyUnclosedCloseable ) . set ( CompilerOptions . ExplicitlyClosedAutoCloseable ) ; INCOMPLETE_SWITCH . set ( CompilerOptions . MissingDefaultCase ) ; String suppressRawWhenUnchecked = System . getProperty ( "" ) ; if ( suppressRawWhenUnchecked != null && "true" . equalsIgnoreCase ( suppressRawWhenUnchecked ) ) { UNCHECKED . set ( CompilerOptions . RawTypeReference ) ; } JAVADOC . set ( CompilerOptions . MissingJavadocComments ) . set ( CompilerOptions . MissingJavadocTags ) ; } private int [ ] bits = new int [ GROUP_MAX ] ; public IrritantSet ( int singleGroupIrritants ) { initialize ( singleGroupIrritants ) ; } public IrritantSet ( IrritantSet other ) { initialize ( other ) ; } public boolean areAllSet ( ) { for ( int i = 0 ; i < GROUP_MAX ; i ++ ) { if ( this . bits [ i ] != ( 0xFFFFFFFF & ~ GROUP_MASK ) ) return false ; } return true ; } public IrritantSet clear ( int singleGroupIrritants ) { int group = ( singleGroupIrritants & GROUP_MASK ) >> GROUP_SHIFT ; this . bits [ group ] &= ~ singleGroupIrritants ; return this ; } public IrritantSet clearAll ( ) { for ( int i = 0 ; i < GROUP_MAX ; i ++ ) { this . bits [ i ] = 0 ; } return this ; } public void initialize ( int singleGroupIrritants ) { if ( singleGroupIrritants == 0 ) return ; int group = ( singleGroupIrritants & GROUP_MASK ) >> GROUP_SHIFT ; this . bits [ group ] = singleGroupIrritants & ~ GROUP_MASK ; } public void initialize ( IrritantSet other ) { if ( other == null ) return ; System . arraycopy ( other . bits , 0 , this . bits = new int [ GROUP_MAX ] , 0 , GROUP_MAX ) ; } public boolean isAnySet ( IrritantSet other ) { if ( other == null ) return false ; for ( int i = 0 ; i < GROUP_MAX ; i ++ ) { if ( ( this . bits [ i ] & other . bits [ i ] ) != 0 ) return true ; } return false ; } public boolean hasSameIrritants ( IrritantSet irritantSet ) { if ( irritantSet == null ) return false ; for ( int i = 0 ; i < GROUP_MAX ; i ++ ) { if ( this . bits [ i ] != irritantSet . bits [ i ] ) return false ; } return true ; } public boolean isSet ( int singleGroupIrritants ) { int group = ( singleGroupIrritants & GROUP_MASK ) >> GROUP_SHIFT ; return ( this . bits [ group ] & singleGroupIrritants ) != 0 ; } public IrritantSet set ( int singleGroupIrritants ) { int group = ( singleGroupIrritants & GROUP_MASK ) >> GROUP_SHIFT ; this . bits [ group ] |= ( singleGroupIrritants & ~ GROUP_MASK ) ; return this ; } public IrritantSet set ( IrritantSet other ) { if ( other == null ) return this ; boolean wasNoOp = true ; for ( int i = 0 ; i < GROUP_MAX ; i ++ ) { int otherIrritant = other . bits [ i ] & ~ GROUP_MASK ; if ( ( this . bits [ i ] & otherIrritant ) != otherIrritant ) { wasNoOp = false ; this . bits [ i ] |= otherIrritant ; } } return wasNoOp ? null : this ; } public IrritantSet setAll ( ) { for ( int i = 0 ; i < GROUP_MAX ; i ++ ) { this . bits [ i ] |= 0xFFFFFFFF & ~ GROUP_MASK ; } return this ; } } </s>