From 20e12e901e0b47e1369306a1a20bf5489dae36aa Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 14 Jan 2021 13:25:18 -0800 Subject: [PATCH 01/27] Move all qualifiers and util files checker-qual projects. --- .gitignore | 1 - checker-qual-android/build.gradle | 2 +- checker-qual/build.gradle | 38 ------------------- .../checker/builder/qual/CalledMethods.java | 0 .../builder/qual/NotCalledMethods.java | 0 .../checker/builder/qual/ReturnsReceiver.java | 0 .../calledmethods/qual/CalledMethods.java | 0 .../qual/CalledMethodsBottom.java | 0 .../qual/CalledMethodsPredicate.java | 0 .../qual/EnsuresCalledMethods.java | 0 .../qual/EnsuresCalledMethodsIf.java | 0 .../compilermsgs/qual/CompilerMessageKey.java | 0 .../qual/CompilerMessageKeyBottom.java | 0 .../qual/UnknownCompilerMessageKey.java | 0 .../compilermsgs/qual/package-info.java | 0 .../fenum/qual/AwtAlphaCompositingRule.java | 0 .../checker/fenum/qual/AwtColorSpace.java | 0 .../checker/fenum/qual/AwtCursorType.java | 0 .../checker/fenum/qual/AwtFlowLayout.java | 0 .../checker/fenum/qual/Fenum.java | 0 .../checker/fenum/qual/FenumBottom.java | 0 .../checker/fenum/qual/FenumTop.java | 0 .../checker/fenum/qual/FenumUnqualified.java | 0 .../checker/fenum/qual/PolyFenum.java | 0 .../fenum/qual/SwingBoxOrientation.java | 0 .../fenum/qual/SwingCompassDirection.java | 0 .../fenum/qual/SwingElementOrientation.java | 0 .../qual/SwingHorizontalOrientation.java | 0 .../fenum/qual/SwingSplitPaneOrientation.java | 0 .../fenum/qual/SwingTextOrientation.java | 0 .../fenum/qual/SwingTitleJustification.java | 0 .../fenum/qual/SwingTitlePosition.java | 0 .../fenum/qual/SwingVerticalOrientation.java | 0 .../checker/formatter/FormatUtil.java | 0 .../formatter/qual/ConversionCategory.java | 0 .../checker/formatter/qual/Format.java | 0 .../checker/formatter/qual/FormatBottom.java | 0 .../checker/formatter/qual/FormatMethod.java | 0 .../checker/formatter/qual/InvalidFormat.java | 0 .../checker/formatter/qual/ReturnsFormat.java | 0 .../checker/formatter/qual/UnknownFormat.java | 0 .../checker/guieffect/qual/AlwaysSafe.java | 0 .../checker/guieffect/qual/PolyUI.java | 0 .../checker/guieffect/qual/PolyUIEffect.java | 0 .../checker/guieffect/qual/PolyUIType.java | 0 .../checker/guieffect/qual/SafeEffect.java | 0 .../checker/guieffect/qual/SafeType.java | 0 .../checker/guieffect/qual/UI.java | 0 .../checker/guieffect/qual/UIEffect.java | 0 .../checker/guieffect/qual/UIPackage.java | 0 .../checker/guieffect/qual/UIType.java | 0 .../checker/i18n/qual/LocalizableKey.java | 0 .../i18n/qual/LocalizableKeyBottom.java | 0 .../checker/i18n/qual/Localized.java | 0 .../i18n/qual/UnknownLocalizableKey.java | 0 .../checker/i18n/qual/UnknownLocalized.java | 0 .../checker/i18nformatter/I18nFormatUtil.java | 0 .../i18nformatter/qual/I18nChecksFormat.java | 0 .../qual/I18nConversionCategory.java | 0 .../i18nformatter/qual/I18nFormat.java | 0 .../i18nformatter/qual/I18nFormatBottom.java | 0 .../i18nformatter/qual/I18nFormatFor.java | 0 .../i18nformatter/qual/I18nInvalidFormat.java | 0 .../i18nformatter/qual/I18nMakeFormat.java | 0 .../i18nformatter/qual/I18nUnknownFormat.java | 0 .../i18nformatter/qual/I18nValidFormat.java | 0 .../checker/index/qual/EnsuresLTLengthOf.java | 0 .../index/qual/EnsuresLTLengthOfIf.java | 0 .../checker/index/qual/GTENegativeOne.java | 0 .../checker/index/qual/HasSubsequence.java | 0 .../checker/index/qual/IndexFor.java | 0 .../checker/index/qual/IndexOrHigh.java | 0 .../checker/index/qual/IndexOrLow.java | 0 .../checker/index/qual/LTEqLengthOf.java | 0 .../checker/index/qual/LTLengthOf.java | 0 .../checker/index/qual/LTOMLengthOf.java | 0 .../checker/index/qual/LengthOf.java | 0 .../checker/index/qual/LessThan.java | 0 .../checker/index/qual/LessThanBottom.java | 0 .../checker/index/qual/LessThanUnknown.java | 0 .../checker/index/qual/LowerBoundBottom.java | 0 .../checker/index/qual/LowerBoundUnknown.java | 0 .../checker/index/qual/NegativeIndexFor.java | 0 .../checker/index/qual/NonNegative.java | 0 .../checker/index/qual/PolyIndex.java | 0 .../checker/index/qual/PolyLength.java | 0 .../checker/index/qual/PolyLowerBound.java | 0 .../checker/index/qual/PolySameLen.java | 0 .../checker/index/qual/PolyUpperBound.java | 0 .../checker/index/qual/Positive.java | 0 .../checker/index/qual/SameLen.java | 0 .../checker/index/qual/SameLenBottom.java | 0 .../checker/index/qual/SameLenUnknown.java | 0 .../checker/index/qual/SearchIndexBottom.java | 0 .../checker/index/qual/SearchIndexFor.java | 0 .../index/qual/SearchIndexUnknown.java | 0 .../index/qual/SubstringIndexBottom.java | 0 .../checker/index/qual/SubstringIndexFor.java | 0 .../index/qual/SubstringIndexUnknown.java | 0 .../checker/index/qual/UpperBoundBottom.java | 0 .../checker/index/qual/UpperBoundUnknown.java | 0 .../initialization/qual/FBCBottom.java | 0 .../initialization/qual/Initialized.java | 0 .../qual/NotOnlyInitialized.java | 0 .../qual/UnderInitialization.java | 0 .../qual/UnknownInitialization.java | 0 .../interning/qual/CompareToMethod.java | 0 .../checker/interning/qual/EqualsMethod.java | 0 .../checker/interning/qual/FindDistinct.java | 0 .../checker/interning/qual/InternMethod.java | 0 .../checker/interning/qual/Interned.java | 0 .../interning/qual/InternedDistinct.java | 0 .../checker/interning/qual/PolyInterned.java | 0 .../interning/qual/UnknownInterned.java | 0 .../interning/qual/UsesObjectEquals.java | 0 .../checker/lock/qual/EnsuresLockHeld.java | 0 .../checker/lock/qual/EnsuresLockHeldIf.java | 0 .../checker/lock/qual/GuardSatisfied.java | 0 .../checker/lock/qual/GuardedBy.java | 0 .../checker/lock/qual/GuardedByBottom.java | 0 .../checker/lock/qual/GuardedByUnknown.java | 0 .../checker/lock/qual/Holding.java | 0 .../checker/lock/qual/LockHeld.java | 0 .../checker/lock/qual/LockPossiblyHeld.java | 0 .../checker/lock/qual/LockingFree.java | 0 .../checker/lock/qual/MayReleaseLocks.java | 0 .../checker/lock/qual/PolyGuardedBy.java | 0 .../checker/lock/qual/ReleasesNoLocks.java | 0 .../checker/nullness/NullnessUtil.java | 0 .../checker/nullness/Opt.java | 0 .../nullness/qual/AssertNonNullIfNonNull.java | 0 .../checker/nullness/qual/EnsuresKeyFor.java | 0 .../nullness/qual/EnsuresKeyForIf.java | 0 .../checker/nullness/qual/EnsuresNonNull.java | 0 .../nullness/qual/EnsuresNonNullIf.java | 0 .../checker/nullness/qual/KeyFor.java | 0 .../checker/nullness/qual/KeyForBottom.java | 0 .../nullness/qual/MonotonicNonNull.java | 0 .../checker/nullness/qual/NonNull.java | 0 .../checker/nullness/qual/Nullable.java | 0 .../checker/nullness/qual/PolyKeyFor.java | 0 .../checker/nullness/qual/PolyNull.java | 0 .../nullness/qual/RequiresNonNull.java | 0 .../checker/nullness/qual/UnknownKeyFor.java | 0 .../checker/optional/qual/MaybePresent.java | 0 .../checker/optional/qual/PolyPresent.java | 0 .../checker/optional/qual/Present.java | 0 .../checker/propkey/qual/PropertyKey.java | 0 .../propkey/qual/PropertyKeyBottom.java | 0 .../propkey/qual/UnknownPropertyKey.java | 0 .../checker/regex/RegexUtil.java | 0 .../checker/regex/qual/PartialRegex.java | 0 .../checker/regex/qual/PolyRegex.java | 0 .../checker/regex/qual/Regex.java | 0 .../checker/regex/qual/RegexBottom.java | 0 .../checker/regex/qual/UnknownRegex.java | 0 .../signature/qual/ArrayWithoutPackage.java | 0 .../checker/signature/qual/BinaryName.java | 0 .../qual/BinaryNameOrPrimitiveType.java | 0 .../qual/BinaryNameWithoutPackage.java | 0 .../checker/signature/qual/CanonicalName.java | 0 .../signature/qual/CanonicalNameOrEmpty.java | 0 .../checker/signature/qual/ClassGetName.java | 0 .../signature/qual/ClassGetSimpleName.java | 0 .../qual/DotSeparatedIdentifiers.java | 0 ...otSeparatedIdentifiersOrPrimitiveType.java | 0 .../signature/qual/FieldDescriptor.java | 0 .../qual/FieldDescriptorForPrimitive.java | 0 .../qual/FieldDescriptorWithoutPackage.java | 0 .../checker/signature/qual/FqBinaryName.java | 0 .../signature/qual/FullyQualifiedName.java | 0 .../checker/signature/qual/Identifier.java | 0 .../qual/IdentifierOrPrimitiveType.java | 0 .../checker/signature/qual/InternalForm.java | 0 .../signature/qual/MethodDescriptor.java | 0 .../checker/signature/qual/PolySignature.java | 0 .../checker/signature/qual/PrimitiveType.java | 0 .../signature/qual/SignatureBottom.java | 0 .../signature/qual/SignatureUnknown.java | 0 .../checker/signedness/SignednessUtil.java | 0 .../signedness/SignednessUtilExtra.java | 0 .../checker/signedness/qual/PolySigned.java | 0 .../checker/signedness/qual/Signed.java | 0 .../signedness/qual/SignedPositive.java | 0 .../qual/SignedPositiveFromUnsigned.java | 0 .../signedness/qual/SignednessBottom.java | 0 .../signedness/qual/SignednessGlb.java | 0 .../signedness/qual/UnknownSignedness.java | 0 .../checker/signedness/qual/Unsigned.java | 0 .../checker/tainting/qual/PolyTainted.java | 0 .../checker/tainting/qual/Tainted.java | 0 .../checker/tainting/qual/Untainted.java | 0 .../checker/units/UnitsTools.java | 0 .../checker/units/qual/A.java | 0 .../checker/units/qual/Acceleration.java | 0 .../checker/units/qual/Angle.java | 0 .../checker/units/qual/Area.java | 0 .../checker/units/qual/C.java | 0 .../checker/units/qual/Current.java | 0 .../checker/units/qual/K.java | 0 .../checker/units/qual/Length.java | 0 .../checker/units/qual/Luminance.java | 0 .../checker/units/qual/Mass.java | 0 .../checker/units/qual/MixedUnits.java | 0 .../checker/units/qual/PolyUnit.java | 0 .../checker/units/qual/Prefix.java | 0 .../checker/units/qual/Speed.java | 0 .../checker/units/qual/Substance.java | 0 .../checker/units/qual/Temperature.java | 0 .../checker/units/qual/Time.java | 0 .../checker/units/qual/UnitsBottom.java | 0 .../checker/units/qual/UnitsMultiple.java | 0 .../checker/units/qual/UnitsRelations.java | 0 .../checker/units/qual/UnknownUnits.java | 0 .../checker/units/qual/cd.java | 0 .../checker/units/qual/degrees.java | 0 .../checker/units/qual/g.java | 0 .../checker/units/qual/h.java | 0 .../checker/units/qual/kg.java | 0 .../checker/units/qual/km.java | 0 .../checker/units/qual/km2.java | 0 .../checker/units/qual/kmPERh.java | 0 .../checker/units/qual/m.java | 0 .../checker/units/qual/m2.java | 0 .../checker/units/qual/mPERs.java | 0 .../checker/units/qual/mPERs2.java | 0 .../checker/units/qual/min.java | 0 .../checker/units/qual/mm.java | 0 .../checker/units/qual/mm2.java | 0 .../checker/units/qual/mol.java | 0 .../checker/units/qual/radians.java | 0 .../checker/units/qual/s.java | 0 .../common/aliasing/qual/LeakedToResult.java | 0 .../common/aliasing/qual/MaybeAliased.java | 0 .../common/aliasing/qual/MaybeLeaked.java | 0 .../common/aliasing/qual/NonLeaked.java | 0 .../common/aliasing/qual/Unique.java | 0 .../qual/EnsuresInitializedFields.java | 0 .../qual/InitializedFields.java | 0 .../qual/InitializedFieldsBottom.java | 0 .../qual/PolyInitializedFields.java | 0 .../common/reflection/qual/ClassBound.java | 0 .../common/reflection/qual/ClassVal.java | 0 .../reflection/qual/ClassValBottom.java | 0 .../common/reflection/qual/ForName.java | 0 .../common/reflection/qual/GetClass.java | 0 .../reflection/qual/GetConstructor.java | 0 .../common/reflection/qual/GetMethod.java | 0 .../common/reflection/qual/Invoke.java | 0 .../common/reflection/qual/MethodVal.java | 0 .../reflection/qual/MethodValBottom.java | 0 .../common/reflection/qual/NewInstance.java | 0 .../common/reflection/qual/UnknownClass.java | 0 .../common/reflection/qual/UnknownMethod.java | 0 .../returnsreceiver/qual/BottomThis.java | 0 .../common/returnsreceiver/qual/This.java | 0 .../returnsreceiver/qual/UnknownThis.java | 0 .../common/subtyping/qual/Bottom.java | 0 .../common/subtyping/qual/Unqualified.java | 0 .../common/util/report/qual/ReportCall.java | 0 .../util/report/qual/ReportCreation.java | 0 .../util/report/qual/ReportInherit.java | 0 .../util/report/qual/ReportOverride.java | 0 .../util/report/qual/ReportReadWrite.java | 0 .../util/report/qual/ReportUnqualified.java | 0 .../common/util/report/qual/ReportUse.java | 0 .../common/util/report/qual/ReportWrite.java | 0 .../common/value/qual/ArrayLen.java | 0 .../common/value/qual/ArrayLenRange.java | 0 .../common/value/qual/BoolVal.java | 0 .../common/value/qual/BottomVal.java | 0 .../common/value/qual/DoubleVal.java | 0 .../common/value/qual/EnsuresMinLenIf.java | 0 .../common/value/qual/EnumVal.java | 0 .../common/value/qual/IntRange.java | 0 .../qual/IntRangeFromGTENegativeOne.java | 0 .../value/qual/IntRangeFromNonNegative.java | 0 .../value/qual/IntRangeFromPositive.java | 0 .../common/value/qual/IntVal.java | 0 .../common/value/qual/MatchesRegex.java | 0 .../common/value/qual/MinLen.java | 0 .../value/qual/MinLenFieldInvariant.java | 0 .../common/value/qual/PolyValue.java | 0 .../value/qual/StaticallyExecutable.java | 0 .../common/value/qual/StringVal.java | 0 .../common/value/qual/UnknownVal.java | 0 .../dataflow/qual/Deterministic.java | 0 .../checkerframework/dataflow/qual/Pure.java | 0 .../dataflow/qual/SideEffectFree.java | 0 .../dataflow/qual/TerminatesExecution.java | 0 .../framework/qual/AnnotatedFor.java | 0 .../framework/qual/CFComment.java | 0 .../ConditionalPostconditionAnnotation.java | 0 .../framework/qual/Covariant.java | 0 .../framework/qual/DefaultFor.java | 0 .../framework/qual/DefaultQualifier.java | 0 .../qual/DefaultQualifierForUse.java | 0 .../qual/DefaultQualifierInHierarchy.java | 0 .../framework/qual/EnsuresQualifier.java | 0 .../framework/qual/EnsuresQualifierIf.java | 0 .../framework/qual/FieldInvariant.java | 0 .../framework/qual/FromByteCode.java | 0 .../framework/qual/FromStubFile.java | 0 .../framework/qual/HasQualifierParameter.java | 0 .../qual/IgnoreInWholeProgramInference.java | 0 .../framework/qual/InheritedAnnotation.java | 0 .../framework/qual/InvisibleQualifier.java | 0 .../framework/qual/JavaExpression.java | 0 .../framework/qual/LiteralKind.java | 0 .../framework/qual/MonotonicQualifier.java | 0 .../qual/NoDefaultQualifierForUse.java | 0 .../framework/qual/NoQualifierParameter.java | 0 .../framework/qual/PolymorphicQualifier.java | 0 .../qual/PostconditionAnnotation.java | 0 .../qual/PreconditionAnnotation.java | 0 .../framework/qual/QualifierArgument.java | 0 .../framework/qual/QualifierForLiterals.java | 0 .../framework/qual/RelevantJavaTypes.java | 0 .../framework/qual/RequiresQualifier.java | 0 .../framework/qual/StubFiles.java | 0 .../framework/qual/SubtypeOf.java | 0 .../framework/qual/TargetLocations.java | 0 .../framework/qual/TypeKind.java | 0 .../framework/qual/TypeUseLocation.java | 0 .../framework/qual/Unused.java | 0 .../framework/qual/UpperBoundFor.java | 0 .../framework/qual/package-info.java | 0 .../framework/util/PurityUnqualified.java | 0 328 files changed, 1 insertion(+), 40 deletions(-) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/builder/qual/CalledMethods.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/builder/qual/NotCalledMethods.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/builder/qual/ReturnsReceiver.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethods.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsPredicate.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethods.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethodsIf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKey.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKeyBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/compilermsgs/qual/UnknownCompilerMessageKey.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/compilermsgs/qual/package-info.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/AwtAlphaCompositingRule.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/AwtColorSpace.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/AwtCursorType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/AwtFlowLayout.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/Fenum.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/FenumBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/FenumTop.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/FenumUnqualified.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/PolyFenum.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingBoxOrientation.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingCompassDirection.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingElementOrientation.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingHorizontalOrientation.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingSplitPaneOrientation.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingTextOrientation.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitleJustification.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitlePosition.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/fenum/qual/SwingVerticalOrientation.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/ConversionCategory.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/Format.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/FormatBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/FormatMethod.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/InvalidFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/formatter/qual/UnknownFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/AlwaysSafe.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUI.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIEffect.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/SafeEffect.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/SafeType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/UI.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/UIEffect.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/UIPackage.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/guieffect/qual/UIType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKey.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKeyBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18n/qual/Localized.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalizableKey.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalized.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nConversionCategory.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nInvalidFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nMakeFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nUnknownFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOfIf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/GTENegativeOne.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/HasSubsequence.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/IndexFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/IndexOrHigh.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/IndexOrLow.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LTEqLengthOf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LTLengthOf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LTOMLengthOf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LengthOf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LessThan.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LessThanBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LessThanUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LowerBoundBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/LowerBoundUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/NegativeIndexFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/NonNegative.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/PolyIndex.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/PolyLength.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/PolyLowerBound.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/PolySameLen.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/PolyUpperBound.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/Positive.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SameLen.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SameLenBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SameLenUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SearchIndexBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SearchIndexFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SearchIndexUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/UpperBoundBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/index/qual/UpperBoundUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/initialization/qual/FBCBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/initialization/qual/Initialized.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/initialization/qual/NotOnlyInitialized.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/initialization/qual/UnderInitialization.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/initialization/qual/UnknownInitialization.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/CompareToMethod.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/EqualsMethod.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/FindDistinct.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/InternMethod.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/Interned.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/InternedDistinct.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/PolyInterned.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/UnknownInterned.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/interning/qual/UsesObjectEquals.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeld.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeldIf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/GuardSatisfied.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/GuardedBy.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/GuardedByBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/GuardedByUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/Holding.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/LockHeld.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/LockPossiblyHeld.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/LockingFree.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/MayReleaseLocks.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/PolyGuardedBy.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/lock/qual/ReleasesNoLocks.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/Opt.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/AssertNonNullIfNonNull.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyForIf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNull.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/KeyFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/KeyForBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/NonNull.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/Nullable.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/PolyKeyFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/PolyNull.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/RequiresNonNull.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/nullness/qual/UnknownKeyFor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/optional/qual/MaybePresent.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/optional/qual/PolyPresent.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/optional/qual/Present.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKey.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKeyBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/propkey/qual/UnknownPropertyKey.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/regex/RegexUtil.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/regex/qual/PartialRegex.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/regex/qual/PolyRegex.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/regex/qual/Regex.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/regex/qual/RegexBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/regex/qual/UnknownRegex.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/ArrayWithoutPackage.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/BinaryName.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameOrPrimitiveType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameWithoutPackage.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/CanonicalName.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/CanonicalNameOrEmpty.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/ClassGetName.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/ClassGetSimpleName.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiers.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiersOrPrimitiveType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorForPrimitive.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorWithoutPackage.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/FqBinaryName.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/FullyQualifiedName.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/Identifier.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/IdentifierOrPrimitiveType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/InternalForm.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/MethodDescriptor.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/PolySignature.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/PrimitiveType.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/SignatureBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signature/qual/SignatureUnknown.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/PolySigned.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/Signed.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositive.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositiveFromUnsigned.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/SignednessBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/SignednessGlb.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/UnknownSignedness.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/signedness/qual/Unsigned.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/tainting/qual/PolyTainted.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/tainting/qual/Tainted.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/tainting/qual/Untainted.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/UnitsTools.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/A.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Acceleration.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Angle.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Area.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/C.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Current.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/K.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Length.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Luminance.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Mass.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/MixedUnits.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Prefix.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Speed.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Substance.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Temperature.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/Time.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/UnitsBottom.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/UnitsMultiple.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/UnitsRelations.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/UnknownUnits.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/cd.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/degrees.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/g.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/h.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/kg.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/km.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/km2.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/kmPERh.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/m.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/m2.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/mPERs.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/mPERs2.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/min.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/mm.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/mm2.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/mol.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/radians.java (100%) rename {checker => checker-qual}/src/main/java/org/checkerframework/checker/units/qual/s.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/aliasing/qual/LeakedToResult.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/aliasing/qual/MaybeAliased.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/aliasing/qual/MaybeLeaked.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/aliasing/qual/NonLeaked.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/aliasing/qual/Unique.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/initializedfields/qual/EnsuresInitializedFields.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFields.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFieldsBottom.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/initializedfields/qual/PolyInitializedFields.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/ClassBound.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/ClassVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/ClassValBottom.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/ForName.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/GetClass.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/GetConstructor.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/GetMethod.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/Invoke.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/MethodVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/MethodValBottom.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/NewInstance.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/UnknownClass.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/reflection/qual/UnknownMethod.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/returnsreceiver/qual/BottomThis.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/returnsreceiver/qual/This.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/returnsreceiver/qual/UnknownThis.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/subtyping/qual/Bottom.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/subtyping/qual/Unqualified.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportCall.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportCreation.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportInherit.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportOverride.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportReadWrite.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportUnqualified.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportUse.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/util/report/qual/ReportWrite.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/ArrayLen.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/ArrayLenRange.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/BoolVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/BottomVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/DoubleVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/EnsuresMinLenIf.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/EnumVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/IntRange.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/IntRangeFromGTENegativeOne.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/IntRangeFromNonNegative.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/IntRangeFromPositive.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/IntVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/MatchesRegex.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/MinLen.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/MinLenFieldInvariant.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/PolyValue.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/StaticallyExecutable.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/StringVal.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/common/value/qual/UnknownVal.java (100%) rename {dataflow => checker-qual}/src/main/java/org/checkerframework/dataflow/qual/Deterministic.java (100%) rename {dataflow => checker-qual}/src/main/java/org/checkerframework/dataflow/qual/Pure.java (100%) rename {dataflow => checker-qual}/src/main/java/org/checkerframework/dataflow/qual/SideEffectFree.java (100%) rename {dataflow => checker-qual}/src/main/java/org/checkerframework/dataflow/qual/TerminatesExecution.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/AnnotatedFor.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/CFComment.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/ConditionalPostconditionAnnotation.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/Covariant.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/DefaultFor.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/DefaultQualifier.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/DefaultQualifierForUse.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/DefaultQualifierInHierarchy.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/EnsuresQualifier.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/EnsuresQualifierIf.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/FieldInvariant.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/FromByteCode.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/FromStubFile.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/HasQualifierParameter.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/IgnoreInWholeProgramInference.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/InheritedAnnotation.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/InvisibleQualifier.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/JavaExpression.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/LiteralKind.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/MonotonicQualifier.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/NoDefaultQualifierForUse.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/NoQualifierParameter.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/PolymorphicQualifier.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/PostconditionAnnotation.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/PreconditionAnnotation.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/QualifierArgument.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/QualifierForLiterals.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/RelevantJavaTypes.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/RequiresQualifier.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/StubFiles.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/SubtypeOf.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/TargetLocations.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/TypeKind.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/TypeUseLocation.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/Unused.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/UpperBoundFor.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/qual/package-info.java (100%) rename {framework => checker-qual}/src/main/java/org/checkerframework/framework/util/PurityUnqualified.java (100%) diff --git a/.gitignore b/.gitignore index 0d147a77b5d..4ea0558bb99 100644 --- a/.gitignore +++ b/.gitignore @@ -127,7 +127,6 @@ checker/tests/nullness-temp/*.class checker/jtreg/multipleexecutions/Main.class # Source is copied from elsewhere. -checker-qual/src checker-qual-android/src # Some tests produce output into the tests/ directory instead of the build/ directory. diff --git a/checker-qual-android/build.gradle b/checker-qual-android/build.gradle index b62d0fe82f0..092aa68918b 100644 --- a/checker-qual-android/build.gradle +++ b/checker-qual-android/build.gradle @@ -1,6 +1,6 @@ evaluationDependsOn(":checker-qual") -task copySources(type: Copy, dependsOn: ':checker-qual:copySources') { +task copySources(type: Copy) { description 'Copy checker-qual source to checker-qual-android' includeEmptyDirs = false diff --git a/checker-qual/build.gradle b/checker-qual/build.gradle index 6a81de3aa79..e6eb27aecea 100644 --- a/checker-qual/build.gradle +++ b/checker-qual/build.gradle @@ -8,52 +8,14 @@ buildscript { } } -task copySources(type: Copy) { - description 'Copy checker-qual source from other projects.' - includeEmptyDirs = false - doFirst { - // Delete the directory in case a previously copied file should no longer be in checker-qual - delete file('src/main/java') - } - - from files('../checker/src/main/java', '../dataflow/src/main/java', '../framework/src/main/java') - // Qualifiers - include '**/org/checkerframework/**/qual/*.java' - include '**/PurityUnqualified.java' // TODO: Should we move this into a qual directory? - // Utility classes - // If you change this list, also update ../LICENSE.txt . - include "**/FormatUtil.java" - include "**/I18nFormatUtil.java" - include "**/NullnessUtil.java" - include "**/Opt.java" - include "**/RegexUtil.java" - include "**/SignednessUtil.java" - include "**/SignednessUtilExtra.java" - include "**/UnitsTools.java" - - // Make files read only. - fileMode(0444) - - into file('src/main/java') -} - apply plugin: 'biz.aQute.bnd.builder' jar { - dependsOn copySources manifest { attributes('Export-Package': '*') } } -compileJava { - dependsOn copySources -} - -clean { - delete file('src/') -} - apply from: rootProject.file("gradle-mvn-push.gradle") /** Adds information to the publication for uploading to Maven repositories. */ diff --git a/checker/src/main/java/org/checkerframework/checker/builder/qual/CalledMethods.java b/checker-qual/src/main/java/org/checkerframework/checker/builder/qual/CalledMethods.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/builder/qual/CalledMethods.java rename to checker-qual/src/main/java/org/checkerframework/checker/builder/qual/CalledMethods.java diff --git a/checker/src/main/java/org/checkerframework/checker/builder/qual/NotCalledMethods.java b/checker-qual/src/main/java/org/checkerframework/checker/builder/qual/NotCalledMethods.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/builder/qual/NotCalledMethods.java rename to checker-qual/src/main/java/org/checkerframework/checker/builder/qual/NotCalledMethods.java diff --git a/checker/src/main/java/org/checkerframework/checker/builder/qual/ReturnsReceiver.java b/checker-qual/src/main/java/org/checkerframework/checker/builder/qual/ReturnsReceiver.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/builder/qual/ReturnsReceiver.java rename to checker-qual/src/main/java/org/checkerframework/checker/builder/qual/ReturnsReceiver.java diff --git a/checker/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethods.java b/checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethods.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethods.java rename to checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethods.java diff --git a/checker/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsPredicate.java b/checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsPredicate.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsPredicate.java rename to checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/CalledMethodsPredicate.java diff --git a/checker/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethods.java b/checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethods.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethods.java rename to checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethods.java diff --git a/checker/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethodsIf.java b/checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethodsIf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethodsIf.java rename to checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethodsIf.java diff --git a/checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKey.java b/checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKey.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKey.java rename to checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKey.java diff --git a/checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKeyBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKeyBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKeyBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/CompilerMessageKeyBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/UnknownCompilerMessageKey.java b/checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/UnknownCompilerMessageKey.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/UnknownCompilerMessageKey.java rename to checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/UnknownCompilerMessageKey.java diff --git a/checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/package-info.java b/checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/package-info.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/compilermsgs/qual/package-info.java rename to checker-qual/src/main/java/org/checkerframework/checker/compilermsgs/qual/package-info.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtAlphaCompositingRule.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtAlphaCompositingRule.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtAlphaCompositingRule.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtAlphaCompositingRule.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtColorSpace.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtColorSpace.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtColorSpace.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtColorSpace.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtCursorType.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtCursorType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtCursorType.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtCursorType.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtFlowLayout.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtFlowLayout.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/AwtFlowLayout.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/AwtFlowLayout.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/Fenum.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/Fenum.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/Fenum.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/Fenum.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/FenumBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/FenumBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/FenumBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/FenumBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/FenumTop.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/FenumTop.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/FenumTop.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/FenumTop.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/FenumUnqualified.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/FenumUnqualified.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/FenumUnqualified.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/FenumUnqualified.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/PolyFenum.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/PolyFenum.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/PolyFenum.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/PolyFenum.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingBoxOrientation.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingBoxOrientation.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingBoxOrientation.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingBoxOrientation.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingCompassDirection.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingCompassDirection.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingCompassDirection.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingCompassDirection.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingElementOrientation.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingElementOrientation.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingElementOrientation.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingElementOrientation.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingHorizontalOrientation.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingHorizontalOrientation.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingHorizontalOrientation.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingHorizontalOrientation.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingSplitPaneOrientation.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingSplitPaneOrientation.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingSplitPaneOrientation.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingSplitPaneOrientation.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingTextOrientation.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingTextOrientation.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingTextOrientation.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingTextOrientation.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitleJustification.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitleJustification.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitleJustification.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitleJustification.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitlePosition.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitlePosition.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitlePosition.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingTitlePosition.java diff --git a/checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingVerticalOrientation.java b/checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingVerticalOrientation.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/fenum/qual/SwingVerticalOrientation.java rename to checker-qual/src/main/java/org/checkerframework/checker/fenum/qual/SwingVerticalOrientation.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/ConversionCategory.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ConversionCategory.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/ConversionCategory.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ConversionCategory.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/Format.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/Format.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/Format.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/Format.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/FormatBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/FormatBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/FormatBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/FormatBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/FormatMethod.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/FormatMethod.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/FormatMethod.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/FormatMethod.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/InvalidFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/InvalidFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/InvalidFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/InvalidFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/qual/UnknownFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/UnknownFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/formatter/qual/UnknownFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/UnknownFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/AlwaysSafe.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/AlwaysSafe.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/AlwaysSafe.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/AlwaysSafe.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUI.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUI.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUI.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUI.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIEffect.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIEffect.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIEffect.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIEffect.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIType.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIType.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/PolyUIType.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/SafeEffect.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/SafeEffect.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/SafeEffect.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/SafeEffect.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/SafeType.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/SafeType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/SafeType.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/SafeType.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/UI.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UI.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/UI.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UI.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/UIEffect.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UIEffect.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/UIEffect.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UIEffect.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/UIPackage.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UIPackage.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/UIPackage.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UIPackage.java diff --git a/checker/src/main/java/org/checkerframework/checker/guieffect/qual/UIType.java b/checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UIType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/guieffect/qual/UIType.java rename to checker-qual/src/main/java/org/checkerframework/checker/guieffect/qual/UIType.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKey.java b/checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKey.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKey.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKey.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKeyBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKeyBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKeyBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/LocalizableKeyBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18n/qual/Localized.java b/checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/Localized.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18n/qual/Localized.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/Localized.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalizableKey.java b/checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalizableKey.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalizableKey.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalizableKey.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalized.java b/checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalized.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalized.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18n/qual/UnknownLocalized.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nConversionCategory.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nConversionCategory.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nConversionCategory.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nConversionCategory.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatFor.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nFormatFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nInvalidFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nInvalidFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nInvalidFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nInvalidFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nMakeFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nMakeFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nMakeFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nMakeFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nUnknownFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nUnknownFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nUnknownFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nUnknownFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java rename to checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOfIf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOfIf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOfIf.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOfIf.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/GTENegativeOne.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/GTENegativeOne.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/GTENegativeOne.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/GTENegativeOne.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/HasSubsequence.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/HasSubsequence.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/HasSubsequence.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/HasSubsequence.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/IndexFor.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/IndexFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/IndexFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/IndexFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/IndexOrHigh.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/IndexOrHigh.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/IndexOrHigh.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/IndexOrHigh.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/IndexOrLow.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/IndexOrLow.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/IndexOrLow.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/IndexOrLow.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LTEqLengthOf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LTEqLengthOf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LTEqLengthOf.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LTEqLengthOf.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LTLengthOf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LTLengthOf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LTLengthOf.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LTLengthOf.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LTOMLengthOf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LTOMLengthOf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LTOMLengthOf.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LTOMLengthOf.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LengthOf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LengthOf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LengthOf.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LengthOf.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LessThan.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LessThan.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LessThan.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LessThan.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LessThanBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LessThanBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LessThanBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LessThanBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LessThanUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LessThanUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LessThanUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LessThanUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LowerBoundBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LowerBoundBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LowerBoundBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LowerBoundBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/LowerBoundUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/LowerBoundUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/LowerBoundUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/LowerBoundUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/NegativeIndexFor.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/NegativeIndexFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/NegativeIndexFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/NegativeIndexFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/NonNegative.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/NonNegative.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/NonNegative.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/NonNegative.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/PolyIndex.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyIndex.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/PolyIndex.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyIndex.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/PolyLength.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyLength.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/PolyLength.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyLength.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/PolyLowerBound.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyLowerBound.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/PolyLowerBound.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyLowerBound.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/PolySameLen.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolySameLen.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/PolySameLen.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolySameLen.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/PolyUpperBound.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyUpperBound.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/PolyUpperBound.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/PolyUpperBound.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/Positive.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/Positive.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/Positive.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/Positive.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SameLen.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SameLen.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SameLen.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SameLen.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SameLenBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SameLenBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SameLenBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SameLenBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SameLenUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SameLenUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SameLenUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SameLenUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SearchIndexBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SearchIndexBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SearchIndexBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SearchIndexBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SearchIndexFor.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SearchIndexFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SearchIndexFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SearchIndexFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SearchIndexUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SearchIndexUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SearchIndexUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SearchIndexUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexFor.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/SubstringIndexUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/UpperBoundBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/UpperBoundBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/UpperBoundBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/UpperBoundBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/index/qual/UpperBoundUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/UpperBoundUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/index/qual/UpperBoundUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/index/qual/UpperBoundUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/initialization/qual/FBCBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/FBCBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/initialization/qual/FBCBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/FBCBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/initialization/qual/Initialized.java b/checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/Initialized.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/initialization/qual/Initialized.java rename to checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/Initialized.java diff --git a/checker/src/main/java/org/checkerframework/checker/initialization/qual/NotOnlyInitialized.java b/checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/NotOnlyInitialized.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/initialization/qual/NotOnlyInitialized.java rename to checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/NotOnlyInitialized.java diff --git a/checker/src/main/java/org/checkerframework/checker/initialization/qual/UnderInitialization.java b/checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/UnderInitialization.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/initialization/qual/UnderInitialization.java rename to checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/UnderInitialization.java diff --git a/checker/src/main/java/org/checkerframework/checker/initialization/qual/UnknownInitialization.java b/checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/UnknownInitialization.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/initialization/qual/UnknownInitialization.java rename to checker-qual/src/main/java/org/checkerframework/checker/initialization/qual/UnknownInitialization.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/CompareToMethod.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/CompareToMethod.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/CompareToMethod.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/CompareToMethod.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/EqualsMethod.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/EqualsMethod.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/EqualsMethod.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/EqualsMethod.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/FindDistinct.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/FindDistinct.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/FindDistinct.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/FindDistinct.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/InternMethod.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/InternMethod.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/InternMethod.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/InternMethod.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/Interned.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/Interned.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/Interned.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/Interned.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/InternedDistinct.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/InternedDistinct.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/InternedDistinct.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/InternedDistinct.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/PolyInterned.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/PolyInterned.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/PolyInterned.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/PolyInterned.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/UnknownInterned.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/UnknownInterned.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/UnknownInterned.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/UnknownInterned.java diff --git a/checker/src/main/java/org/checkerframework/checker/interning/qual/UsesObjectEquals.java b/checker-qual/src/main/java/org/checkerframework/checker/interning/qual/UsesObjectEquals.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/interning/qual/UsesObjectEquals.java rename to checker-qual/src/main/java/org/checkerframework/checker/interning/qual/UsesObjectEquals.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeld.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeld.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeld.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeld.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeldIf.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeldIf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeldIf.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeldIf.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/GuardSatisfied.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardSatisfied.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/GuardSatisfied.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardSatisfied.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/GuardedBy.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardedBy.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/GuardedBy.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardedBy.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/GuardedByBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardedByBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/GuardedByBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardedByBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/GuardedByUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardedByUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/GuardedByUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/GuardedByUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/Holding.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/Holding.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/Holding.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/Holding.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/LockHeld.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/LockHeld.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/LockHeld.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/LockHeld.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/LockPossiblyHeld.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/LockPossiblyHeld.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/LockPossiblyHeld.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/LockPossiblyHeld.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/LockingFree.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/LockingFree.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/LockingFree.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/LockingFree.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/MayReleaseLocks.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/MayReleaseLocks.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/MayReleaseLocks.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/MayReleaseLocks.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/PolyGuardedBy.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/PolyGuardedBy.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/PolyGuardedBy.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/PolyGuardedBy.java diff --git a/checker/src/main/java/org/checkerframework/checker/lock/qual/ReleasesNoLocks.java b/checker-qual/src/main/java/org/checkerframework/checker/lock/qual/ReleasesNoLocks.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/lock/qual/ReleasesNoLocks.java rename to checker-qual/src/main/java/org/checkerframework/checker/lock/qual/ReleasesNoLocks.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/Opt.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/Opt.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/Opt.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/Opt.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/AssertNonNullIfNonNull.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/AssertNonNullIfNonNull.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/AssertNonNullIfNonNull.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/AssertNonNullIfNonNull.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyFor.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyForIf.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyForIf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyForIf.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresKeyForIf.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNull.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNull.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNull.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNull.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/KeyFor.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/KeyFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/KeyFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/KeyFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/KeyForBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/KeyForBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/KeyForBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/KeyForBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/NonNull.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/NonNull.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/NonNull.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/NonNull.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/Nullable.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/Nullable.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/Nullable.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/Nullable.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/PolyKeyFor.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/PolyKeyFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/PolyKeyFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/PolyKeyFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/PolyNull.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/PolyNull.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/PolyNull.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/PolyNull.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/RequiresNonNull.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/RequiresNonNull.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/RequiresNonNull.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/RequiresNonNull.java diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/qual/UnknownKeyFor.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/UnknownKeyFor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/nullness/qual/UnknownKeyFor.java rename to checker-qual/src/main/java/org/checkerframework/checker/nullness/qual/UnknownKeyFor.java diff --git a/checker/src/main/java/org/checkerframework/checker/optional/qual/MaybePresent.java b/checker-qual/src/main/java/org/checkerframework/checker/optional/qual/MaybePresent.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/optional/qual/MaybePresent.java rename to checker-qual/src/main/java/org/checkerframework/checker/optional/qual/MaybePresent.java diff --git a/checker/src/main/java/org/checkerframework/checker/optional/qual/PolyPresent.java b/checker-qual/src/main/java/org/checkerframework/checker/optional/qual/PolyPresent.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/optional/qual/PolyPresent.java rename to checker-qual/src/main/java/org/checkerframework/checker/optional/qual/PolyPresent.java diff --git a/checker/src/main/java/org/checkerframework/checker/optional/qual/Present.java b/checker-qual/src/main/java/org/checkerframework/checker/optional/qual/Present.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/optional/qual/Present.java rename to checker-qual/src/main/java/org/checkerframework/checker/optional/qual/Present.java diff --git a/checker/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKey.java b/checker-qual/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKey.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKey.java rename to checker-qual/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKey.java diff --git a/checker/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKeyBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKeyBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKeyBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/propkey/qual/PropertyKeyBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/propkey/qual/UnknownPropertyKey.java b/checker-qual/src/main/java/org/checkerframework/checker/propkey/qual/UnknownPropertyKey.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/propkey/qual/UnknownPropertyKey.java rename to checker-qual/src/main/java/org/checkerframework/checker/propkey/qual/UnknownPropertyKey.java diff --git a/checker/src/main/java/org/checkerframework/checker/regex/RegexUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/RegexUtil.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/regex/RegexUtil.java rename to checker-qual/src/main/java/org/checkerframework/checker/regex/RegexUtil.java diff --git a/checker/src/main/java/org/checkerframework/checker/regex/qual/PartialRegex.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/qual/PartialRegex.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/regex/qual/PartialRegex.java rename to checker-qual/src/main/java/org/checkerframework/checker/regex/qual/PartialRegex.java diff --git a/checker/src/main/java/org/checkerframework/checker/regex/qual/PolyRegex.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/qual/PolyRegex.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/regex/qual/PolyRegex.java rename to checker-qual/src/main/java/org/checkerframework/checker/regex/qual/PolyRegex.java diff --git a/checker/src/main/java/org/checkerframework/checker/regex/qual/Regex.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/qual/Regex.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/regex/qual/Regex.java rename to checker-qual/src/main/java/org/checkerframework/checker/regex/qual/Regex.java diff --git a/checker/src/main/java/org/checkerframework/checker/regex/qual/RegexBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/qual/RegexBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/regex/qual/RegexBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/regex/qual/RegexBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/regex/qual/UnknownRegex.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/qual/UnknownRegex.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/regex/qual/UnknownRegex.java rename to checker-qual/src/main/java/org/checkerframework/checker/regex/qual/UnknownRegex.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/ArrayWithoutPackage.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/ArrayWithoutPackage.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/ArrayWithoutPackage.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/ArrayWithoutPackage.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/BinaryName.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/BinaryName.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/BinaryName.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/BinaryName.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameOrPrimitiveType.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameOrPrimitiveType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameOrPrimitiveType.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameOrPrimitiveType.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameWithoutPackage.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameWithoutPackage.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameWithoutPackage.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/BinaryNameWithoutPackage.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/CanonicalName.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/CanonicalName.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/CanonicalName.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/CanonicalName.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/CanonicalNameOrEmpty.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/CanonicalNameOrEmpty.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/CanonicalNameOrEmpty.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/CanonicalNameOrEmpty.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/ClassGetName.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/ClassGetName.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/ClassGetName.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/ClassGetName.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/ClassGetSimpleName.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/ClassGetSimpleName.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/ClassGetSimpleName.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/ClassGetSimpleName.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiers.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiers.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiers.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiers.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiersOrPrimitiveType.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiersOrPrimitiveType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiersOrPrimitiveType.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/DotSeparatedIdentifiersOrPrimitiveType.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptor.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptor.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptor.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorForPrimitive.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorForPrimitive.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorForPrimitive.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorForPrimitive.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorWithoutPackage.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorWithoutPackage.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorWithoutPackage.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FieldDescriptorWithoutPackage.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/FqBinaryName.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FqBinaryName.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/FqBinaryName.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FqBinaryName.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/FullyQualifiedName.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FullyQualifiedName.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/FullyQualifiedName.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/FullyQualifiedName.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/Identifier.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/Identifier.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/Identifier.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/Identifier.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/IdentifierOrPrimitiveType.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/IdentifierOrPrimitiveType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/IdentifierOrPrimitiveType.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/IdentifierOrPrimitiveType.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/InternalForm.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/InternalForm.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/InternalForm.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/InternalForm.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/MethodDescriptor.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/MethodDescriptor.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/MethodDescriptor.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/MethodDescriptor.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/PolySignature.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/PolySignature.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/PolySignature.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/PolySignature.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/PrimitiveType.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/PrimitiveType.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/PrimitiveType.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/PrimitiveType.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/SignatureBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/SignatureBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/SignatureBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/SignatureBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/signature/qual/SignatureUnknown.java b/checker-qual/src/main/java/org/checkerframework/checker/signature/qual/SignatureUnknown.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signature/qual/SignatureUnknown.java rename to checker-qual/src/main/java/org/checkerframework/checker/signature/qual/SignatureUnknown.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/PolySigned.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/PolySigned.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/PolySigned.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/PolySigned.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/Signed.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/Signed.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/Signed.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/Signed.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositive.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositive.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositive.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositive.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositiveFromUnsigned.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositiveFromUnsigned.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositiveFromUnsigned.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignedPositiveFromUnsigned.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/SignednessBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignednessBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/SignednessBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignednessBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/SignednessGlb.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignednessGlb.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/SignednessGlb.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/SignednessGlb.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/UnknownSignedness.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/UnknownSignedness.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/UnknownSignedness.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/UnknownSignedness.java diff --git a/checker/src/main/java/org/checkerframework/checker/signedness/qual/Unsigned.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/Unsigned.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/signedness/qual/Unsigned.java rename to checker-qual/src/main/java/org/checkerframework/checker/signedness/qual/Unsigned.java diff --git a/checker/src/main/java/org/checkerframework/checker/tainting/qual/PolyTainted.java b/checker-qual/src/main/java/org/checkerframework/checker/tainting/qual/PolyTainted.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/tainting/qual/PolyTainted.java rename to checker-qual/src/main/java/org/checkerframework/checker/tainting/qual/PolyTainted.java diff --git a/checker/src/main/java/org/checkerframework/checker/tainting/qual/Tainted.java b/checker-qual/src/main/java/org/checkerframework/checker/tainting/qual/Tainted.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/tainting/qual/Tainted.java rename to checker-qual/src/main/java/org/checkerframework/checker/tainting/qual/Tainted.java diff --git a/checker/src/main/java/org/checkerframework/checker/tainting/qual/Untainted.java b/checker-qual/src/main/java/org/checkerframework/checker/tainting/qual/Untainted.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/tainting/qual/Untainted.java rename to checker-qual/src/main/java/org/checkerframework/checker/tainting/qual/Untainted.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/UnitsTools.java b/checker-qual/src/main/java/org/checkerframework/checker/units/UnitsTools.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/UnitsTools.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/UnitsTools.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/A.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/A.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/A.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/A.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Acceleration.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Acceleration.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Acceleration.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Acceleration.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Angle.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Angle.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Angle.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Angle.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Area.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Area.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Area.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Area.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/C.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/C.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/C.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/C.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Current.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Current.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Current.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Current.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/K.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/K.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/K.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/K.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Length.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Length.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Length.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Length.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Luminance.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Luminance.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Luminance.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Luminance.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Mass.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Mass.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Mass.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Mass.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/MixedUnits.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/MixedUnits.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/MixedUnits.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/MixedUnits.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Prefix.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Prefix.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Prefix.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Prefix.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Speed.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Speed.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Speed.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Speed.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Substance.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Substance.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Substance.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Substance.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Temperature.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Temperature.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Temperature.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Temperature.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/Time.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/Time.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/Time.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/Time.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/UnitsBottom.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnitsBottom.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/UnitsBottom.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnitsBottom.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/UnitsMultiple.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnitsMultiple.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/UnitsMultiple.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnitsMultiple.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/UnitsRelations.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnitsRelations.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/UnitsRelations.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnitsRelations.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/UnknownUnits.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnknownUnits.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/UnknownUnits.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/UnknownUnits.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/cd.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/cd.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/cd.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/cd.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/degrees.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/degrees.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/degrees.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/degrees.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/g.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/g.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/g.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/g.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/h.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/h.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/h.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/h.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/kg.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/kg.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/kg.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/kg.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/km.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/km.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/km.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/km.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/km2.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/km2.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/km2.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/km2.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/kmPERh.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/kmPERh.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/kmPERh.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/kmPERh.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/m.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/m.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/m.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/m.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/m2.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/m2.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/m2.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/m2.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/mPERs.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/mPERs.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/mPERs.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/mPERs.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/mPERs2.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/mPERs2.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/mPERs2.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/mPERs2.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/min.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/min.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/min.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/min.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/mm.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/mm.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/mm.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/mm.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/mm2.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/mm2.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/mm2.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/mm2.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/mol.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/mol.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/mol.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/mol.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/radians.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/radians.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/radians.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/radians.java diff --git a/checker/src/main/java/org/checkerframework/checker/units/qual/s.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/s.java similarity index 100% rename from checker/src/main/java/org/checkerframework/checker/units/qual/s.java rename to checker-qual/src/main/java/org/checkerframework/checker/units/qual/s.java diff --git a/framework/src/main/java/org/checkerframework/common/aliasing/qual/LeakedToResult.java b/checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/LeakedToResult.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/aliasing/qual/LeakedToResult.java rename to checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/LeakedToResult.java diff --git a/framework/src/main/java/org/checkerframework/common/aliasing/qual/MaybeAliased.java b/checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/MaybeAliased.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/aliasing/qual/MaybeAliased.java rename to checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/MaybeAliased.java diff --git a/framework/src/main/java/org/checkerframework/common/aliasing/qual/MaybeLeaked.java b/checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/MaybeLeaked.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/aliasing/qual/MaybeLeaked.java rename to checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/MaybeLeaked.java diff --git a/framework/src/main/java/org/checkerframework/common/aliasing/qual/NonLeaked.java b/checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/NonLeaked.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/aliasing/qual/NonLeaked.java rename to checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/NonLeaked.java diff --git a/framework/src/main/java/org/checkerframework/common/aliasing/qual/Unique.java b/checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/Unique.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/aliasing/qual/Unique.java rename to checker-qual/src/main/java/org/checkerframework/common/aliasing/qual/Unique.java diff --git a/framework/src/main/java/org/checkerframework/common/initializedfields/qual/EnsuresInitializedFields.java b/checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/EnsuresInitializedFields.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/initializedfields/qual/EnsuresInitializedFields.java rename to checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/EnsuresInitializedFields.java diff --git a/framework/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFields.java b/checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFields.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFields.java rename to checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFields.java diff --git a/framework/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFieldsBottom.java b/checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFieldsBottom.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFieldsBottom.java rename to checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/InitializedFieldsBottom.java diff --git a/framework/src/main/java/org/checkerframework/common/initializedfields/qual/PolyInitializedFields.java b/checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/PolyInitializedFields.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/initializedfields/qual/PolyInitializedFields.java rename to checker-qual/src/main/java/org/checkerframework/common/initializedfields/qual/PolyInitializedFields.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/ClassBound.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ClassBound.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/ClassBound.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ClassBound.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/ClassVal.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ClassVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/ClassVal.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ClassVal.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/ClassValBottom.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ClassValBottom.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/ClassValBottom.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ClassValBottom.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/ForName.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ForName.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/ForName.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/ForName.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/GetClass.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/GetClass.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/GetClass.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/GetClass.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/GetConstructor.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/GetConstructor.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/GetConstructor.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/GetConstructor.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/GetMethod.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/GetMethod.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/GetMethod.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/GetMethod.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/Invoke.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/Invoke.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/Invoke.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/Invoke.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/MethodVal.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/MethodVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/MethodVal.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/MethodVal.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/MethodValBottom.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/MethodValBottom.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/MethodValBottom.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/MethodValBottom.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/NewInstance.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/NewInstance.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/NewInstance.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/NewInstance.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/UnknownClass.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/UnknownClass.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/UnknownClass.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/UnknownClass.java diff --git a/framework/src/main/java/org/checkerframework/common/reflection/qual/UnknownMethod.java b/checker-qual/src/main/java/org/checkerframework/common/reflection/qual/UnknownMethod.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/reflection/qual/UnknownMethod.java rename to checker-qual/src/main/java/org/checkerframework/common/reflection/qual/UnknownMethod.java diff --git a/framework/src/main/java/org/checkerframework/common/returnsreceiver/qual/BottomThis.java b/checker-qual/src/main/java/org/checkerframework/common/returnsreceiver/qual/BottomThis.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/returnsreceiver/qual/BottomThis.java rename to checker-qual/src/main/java/org/checkerframework/common/returnsreceiver/qual/BottomThis.java diff --git a/framework/src/main/java/org/checkerframework/common/returnsreceiver/qual/This.java b/checker-qual/src/main/java/org/checkerframework/common/returnsreceiver/qual/This.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/returnsreceiver/qual/This.java rename to checker-qual/src/main/java/org/checkerframework/common/returnsreceiver/qual/This.java diff --git a/framework/src/main/java/org/checkerframework/common/returnsreceiver/qual/UnknownThis.java b/checker-qual/src/main/java/org/checkerframework/common/returnsreceiver/qual/UnknownThis.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/returnsreceiver/qual/UnknownThis.java rename to checker-qual/src/main/java/org/checkerframework/common/returnsreceiver/qual/UnknownThis.java diff --git a/framework/src/main/java/org/checkerframework/common/subtyping/qual/Bottom.java b/checker-qual/src/main/java/org/checkerframework/common/subtyping/qual/Bottom.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/subtyping/qual/Bottom.java rename to checker-qual/src/main/java/org/checkerframework/common/subtyping/qual/Bottom.java diff --git a/framework/src/main/java/org/checkerframework/common/subtyping/qual/Unqualified.java b/checker-qual/src/main/java/org/checkerframework/common/subtyping/qual/Unqualified.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/subtyping/qual/Unqualified.java rename to checker-qual/src/main/java/org/checkerframework/common/subtyping/qual/Unqualified.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportCall.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportCall.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportCall.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportCall.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportCreation.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportCreation.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportCreation.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportCreation.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportInherit.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportInherit.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportInherit.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportInherit.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportOverride.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportOverride.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportOverride.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportOverride.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportReadWrite.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportReadWrite.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportReadWrite.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportReadWrite.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportUnqualified.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportUnqualified.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportUnqualified.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportUnqualified.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportUse.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportUse.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportUse.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportUse.java diff --git a/framework/src/main/java/org/checkerframework/common/util/report/qual/ReportWrite.java b/checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportWrite.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/util/report/qual/ReportWrite.java rename to checker-qual/src/main/java/org/checkerframework/common/util/report/qual/ReportWrite.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/ArrayLen.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/ArrayLen.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/ArrayLen.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/ArrayLen.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/ArrayLenRange.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/ArrayLenRange.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/ArrayLenRange.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/ArrayLenRange.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/BoolVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/BoolVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/BoolVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/BoolVal.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/BottomVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/BottomVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/BottomVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/BottomVal.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/DoubleVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/DoubleVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/DoubleVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/DoubleVal.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/EnsuresMinLenIf.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/EnsuresMinLenIf.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/EnsuresMinLenIf.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/EnsuresMinLenIf.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/EnumVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/EnumVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/EnumVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/EnumVal.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/IntRange.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRange.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/IntRange.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRange.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/IntRangeFromGTENegativeOne.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRangeFromGTENegativeOne.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/IntRangeFromGTENegativeOne.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRangeFromGTENegativeOne.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/IntRangeFromNonNegative.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRangeFromNonNegative.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/IntRangeFromNonNegative.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRangeFromNonNegative.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/IntRangeFromPositive.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRangeFromPositive.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/IntRangeFromPositive.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/IntRangeFromPositive.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/IntVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/IntVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/IntVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/IntVal.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/MatchesRegex.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/MatchesRegex.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/MatchesRegex.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/MatchesRegex.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/MinLen.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/MinLen.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/MinLen.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/MinLen.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/MinLenFieldInvariant.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/MinLenFieldInvariant.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/MinLenFieldInvariant.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/MinLenFieldInvariant.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/PolyValue.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/PolyValue.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/PolyValue.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/PolyValue.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/StaticallyExecutable.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/StaticallyExecutable.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/StaticallyExecutable.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/StaticallyExecutable.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/StringVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/StringVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/StringVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/StringVal.java diff --git a/framework/src/main/java/org/checkerframework/common/value/qual/UnknownVal.java b/checker-qual/src/main/java/org/checkerframework/common/value/qual/UnknownVal.java similarity index 100% rename from framework/src/main/java/org/checkerframework/common/value/qual/UnknownVal.java rename to checker-qual/src/main/java/org/checkerframework/common/value/qual/UnknownVal.java diff --git a/dataflow/src/main/java/org/checkerframework/dataflow/qual/Deterministic.java b/checker-qual/src/main/java/org/checkerframework/dataflow/qual/Deterministic.java similarity index 100% rename from dataflow/src/main/java/org/checkerframework/dataflow/qual/Deterministic.java rename to checker-qual/src/main/java/org/checkerframework/dataflow/qual/Deterministic.java diff --git a/dataflow/src/main/java/org/checkerframework/dataflow/qual/Pure.java b/checker-qual/src/main/java/org/checkerframework/dataflow/qual/Pure.java similarity index 100% rename from dataflow/src/main/java/org/checkerframework/dataflow/qual/Pure.java rename to checker-qual/src/main/java/org/checkerframework/dataflow/qual/Pure.java diff --git a/dataflow/src/main/java/org/checkerframework/dataflow/qual/SideEffectFree.java b/checker-qual/src/main/java/org/checkerframework/dataflow/qual/SideEffectFree.java similarity index 100% rename from dataflow/src/main/java/org/checkerframework/dataflow/qual/SideEffectFree.java rename to checker-qual/src/main/java/org/checkerframework/dataflow/qual/SideEffectFree.java diff --git a/dataflow/src/main/java/org/checkerframework/dataflow/qual/TerminatesExecution.java b/checker-qual/src/main/java/org/checkerframework/dataflow/qual/TerminatesExecution.java similarity index 100% rename from dataflow/src/main/java/org/checkerframework/dataflow/qual/TerminatesExecution.java rename to checker-qual/src/main/java/org/checkerframework/dataflow/qual/TerminatesExecution.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/AnnotatedFor.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/AnnotatedFor.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/AnnotatedFor.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/AnnotatedFor.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/CFComment.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/CFComment.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/CFComment.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/CFComment.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/ConditionalPostconditionAnnotation.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/ConditionalPostconditionAnnotation.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/ConditionalPostconditionAnnotation.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/ConditionalPostconditionAnnotation.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/Covariant.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/Covariant.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/Covariant.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/Covariant.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/DefaultFor.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultFor.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/DefaultFor.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultFor.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/DefaultQualifier.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultQualifier.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/DefaultQualifier.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultQualifier.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/DefaultQualifierForUse.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultQualifierForUse.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/DefaultQualifierForUse.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultQualifierForUse.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/DefaultQualifierInHierarchy.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultQualifierInHierarchy.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/DefaultQualifierInHierarchy.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/DefaultQualifierInHierarchy.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/EnsuresQualifier.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/EnsuresQualifier.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/EnsuresQualifier.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/EnsuresQualifier.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/EnsuresQualifierIf.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/EnsuresQualifierIf.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/EnsuresQualifierIf.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/EnsuresQualifierIf.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/FieldInvariant.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/FieldInvariant.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/FieldInvariant.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/FieldInvariant.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/FromByteCode.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/FromByteCode.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/FromByteCode.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/FromByteCode.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/FromStubFile.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/FromStubFile.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/FromStubFile.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/FromStubFile.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/HasQualifierParameter.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/HasQualifierParameter.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/HasQualifierParameter.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/HasQualifierParameter.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/IgnoreInWholeProgramInference.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/IgnoreInWholeProgramInference.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/IgnoreInWholeProgramInference.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/IgnoreInWholeProgramInference.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/InheritedAnnotation.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/InheritedAnnotation.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/InheritedAnnotation.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/InheritedAnnotation.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/InvisibleQualifier.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/InvisibleQualifier.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/InvisibleQualifier.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/InvisibleQualifier.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/JavaExpression.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/JavaExpression.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/JavaExpression.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/JavaExpression.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/LiteralKind.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/LiteralKind.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/LiteralKind.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/LiteralKind.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/MonotonicQualifier.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/MonotonicQualifier.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/MonotonicQualifier.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/MonotonicQualifier.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/NoDefaultQualifierForUse.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/NoDefaultQualifierForUse.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/NoDefaultQualifierForUse.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/NoDefaultQualifierForUse.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/NoQualifierParameter.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/NoQualifierParameter.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/NoQualifierParameter.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/NoQualifierParameter.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/PolymorphicQualifier.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/PolymorphicQualifier.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/PolymorphicQualifier.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/PolymorphicQualifier.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/PostconditionAnnotation.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/PostconditionAnnotation.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/PostconditionAnnotation.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/PostconditionAnnotation.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/PreconditionAnnotation.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/PreconditionAnnotation.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/PreconditionAnnotation.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/PreconditionAnnotation.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/QualifierArgument.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/QualifierArgument.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/QualifierArgument.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/QualifierArgument.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/QualifierForLiterals.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/QualifierForLiterals.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/QualifierForLiterals.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/QualifierForLiterals.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/RelevantJavaTypes.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/RelevantJavaTypes.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/RelevantJavaTypes.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/RelevantJavaTypes.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/RequiresQualifier.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/RequiresQualifier.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/RequiresQualifier.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/RequiresQualifier.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/StubFiles.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/StubFiles.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/StubFiles.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/StubFiles.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/SubtypeOf.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/SubtypeOf.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/SubtypeOf.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/SubtypeOf.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/TargetLocations.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/TargetLocations.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/TargetLocations.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/TargetLocations.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/TypeKind.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/TypeKind.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/TypeKind.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/TypeKind.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/TypeUseLocation.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/TypeUseLocation.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/TypeUseLocation.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/TypeUseLocation.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/Unused.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/Unused.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/Unused.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/Unused.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/UpperBoundFor.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/UpperBoundFor.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/UpperBoundFor.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/UpperBoundFor.java diff --git a/framework/src/main/java/org/checkerframework/framework/qual/package-info.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/package-info.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/qual/package-info.java rename to checker-qual/src/main/java/org/checkerframework/framework/qual/package-info.java diff --git a/framework/src/main/java/org/checkerframework/framework/util/PurityUnqualified.java b/checker-qual/src/main/java/org/checkerframework/framework/util/PurityUnqualified.java similarity index 100% rename from framework/src/main/java/org/checkerframework/framework/util/PurityUnqualified.java rename to checker-qual/src/main/java/org/checkerframework/framework/util/PurityUnqualified.java From 18fcd066a08a4b715e0ddb764819aeeb992d267d Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 14 Jan 2021 14:51:30 -0800 Subject: [PATCH 02/27] Try new way to need qualifier class names. --- .../framework/type/AnnotationClassLoader.java | 64 ++++--------------- 1 file changed, 11 insertions(+), 53 deletions(-) diff --git a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java index 758c551d8c7..aeacd58c351 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java +++ b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java @@ -22,6 +22,10 @@ import java.util.jar.JarFile; import java.util.regex.Pattern; import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.signature.qual.BinaryName; @@ -30,7 +34,6 @@ import org.checkerframework.common.basetype.BaseTypeChecker; import org.checkerframework.javacutil.AnnotationBuilder; import org.checkerframework.javacutil.AnnotationUtils; -import org.checkerframework.javacutil.BugInCF; import org.checkerframework.javacutil.InternalUtils; import org.checkerframework.javacutil.UserError; import org.plumelib.reflection.Signatures; @@ -89,6 +92,7 @@ public class AnnotationClassLoader { protected final ProcessingEnvironment processingEnv; /** The resource URL of the qual directory of a checker class. */ + @SuppressWarnings("UnusedVariable") private final URL resourceURL; /** The class loader used to load annotation classes. */ @@ -490,61 +494,16 @@ protected final void printPaths() { * Checker Framework. */ private void loadBundledAnnotationClasses() { - // if there's no resourceURL, then there's nothing we can load - if (resourceURL == null) { - return; - } - // retrieve the fully qualified class names of the annotations - Set<@BinaryName String> annotationNames; + Set<@BinaryName String> annotationNames = new LinkedHashSet<>(); - // see whether the resource URL has a protocol of jar or file - if (resourceURL.getProtocol().contentEquals("jar")) { - // if the checker class file is contained within a jar, then the - // resource URL for the qual directory will have the protocol - // "jar". This means the whole checker is loaded as a jar file. - - JarURLConnection connection; - // create a connection to the jar file - try { - connection = (JarURLConnection) resourceURL.openConnection(); + PackageElement pkgEle = checker.getElementUtils().getPackageElement(packageName); - // disable caching / connection sharing of the low level URLConnection to the Jar - // file - connection.setDefaultUseCaches(false); - connection.setUseCaches(false); - - // connect to the Jar file - connection.connect(); - } catch (IOException e) { - throw new BugInCF( - "AnnotationClassLoader: cannot open a connection to the Jar file " - + resourceURL.getFile()); + for (Element e : pkgEle.getEnclosedElements()) { + if (e.getKind() == ElementKind.ANNOTATION_TYPE) { + annotationNames.add(((TypeElement) e).getQualifiedName().toString()); } - - // open up that jar file and extract annotation class names - try (JarFile jarFile = connection.getJarFile()) { - // get class names inside the jar file within the particular package - annotationNames = getBundledAnnotationNamesFromJar(jarFile); - } catch (IOException e) { - throw new BugInCF( - "AnnotationClassLoader: cannot open the Jar file " + resourceURL.getFile()); - } - - } else if (resourceURL.getProtocol().contentEquals("file")) { - // if the checker class file is found within the file system itself - // within some directory (usually development build directories), - // then process the package as a file directory in the file system - // and load the annotations contained in the qual directory - - // open up the directory - File packageDir = new File(resourceURL.getFile()); - annotationNames = getAnnotationNamesFromDirectory(packageName, packageDir, packageDir); - } else { - // We do not support a resource URL with any other protocols, so create an empty set. - annotationNames = Collections.emptySet(); } - supportedBundledAnnotationClasses.addAll(loadAnnotationClasses(annotationNames)); } @@ -568,7 +527,7 @@ public final Set> getBundledAnnotationClasses() { * @param jar the JarFile containing the annotation class files * @return a set of fully qualified class names of the annotations */ - @SuppressWarnings("JdkObsolete") + @SuppressWarnings({"JdkObsolete", "UnusedMethod"}) private final Set<@BinaryName String> getBundledAnnotationNamesFromJar(final JarFile jar) { Set<@BinaryName String> annos = new LinkedHashSet<>(); @@ -787,7 +746,6 @@ public int compare(File o1, File o2) { protected final Set> loadAnnotationClasses( final @Nullable Set<@BinaryName String> annoNames) { Set> loadedClasses = new LinkedHashSet<>(); - if (annoNames != null && !annoNames.isEmpty()) { // loop through each class name & load the class for (String annoName : annoNames) { From d0f3932c41094b3c5931a5c5ec373815b21bc867 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 14 Jan 2021 15:49:17 -0800 Subject: [PATCH 03/27] Add back old code. --- .../framework/type/AnnotationClassLoader.java | 57 +++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java index aeacd58c351..feb0bd295e7 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java +++ b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java @@ -34,6 +34,7 @@ import org.checkerframework.common.basetype.BaseTypeChecker; import org.checkerframework.javacutil.AnnotationBuilder; import org.checkerframework.javacutil.AnnotationUtils; +import org.checkerframework.javacutil.BugInCF; import org.checkerframework.javacutil.InternalUtils; import org.checkerframework.javacutil.UserError; import org.plumelib.reflection.Signatures; @@ -496,12 +497,60 @@ protected final void printPaths() { private void loadBundledAnnotationClasses() { // retrieve the fully qualified class names of the annotations Set<@BinaryName String> annotationNames = new LinkedHashSet<>(); + // see whether the resource URL has a protocol of jar or file + if (resourceURL != null && resourceURL.getProtocol().contentEquals("jar")) { + // if the checker class file is contained within a jar, then the + // resource URL for the qual directory will have the protocol + // "jar". This means the whole checker is loaded as a jar file. + + JarURLConnection connection; + // create a connection to the jar file + try { + connection = (JarURLConnection) resourceURL.openConnection(); + + // disable caching / connection sharing of the low level URLConnection to the Jar + // file + connection.setDefaultUseCaches(false); + connection.setUseCaches(false); - PackageElement pkgEle = checker.getElementUtils().getPackageElement(packageName); + // connect to the Jar file + connection.connect(); + } catch (IOException e) { + throw new BugInCF( + "AnnotationClassLoader: cannot open a connection to the Jar file " + + resourceURL.getFile()); + } - for (Element e : pkgEle.getEnclosedElements()) { - if (e.getKind() == ElementKind.ANNOTATION_TYPE) { - annotationNames.add(((TypeElement) e).getQualifiedName().toString()); + // open up that jar file and extract annotation class names + try (JarFile jarFile = connection.getJarFile()) { + // get class names inside the jar file within the particular package + annotationNames = getBundledAnnotationNamesFromJar(jarFile); + } catch (IOException e) { + throw new BugInCF( + "AnnotationClassLoader: cannot open the Jar file " + resourceURL.getFile()); + } + + } else if (resourceURL != null && resourceURL.getProtocol().contentEquals("file")) { + // if the checker class file is found within the file system itself + // within some directory (usually development build directories), + // then process the package as a file directory in the file system + // and load the annotations contained in the qual directory + + // open up the directory + File packageDir = new File(resourceURL.getFile()); + annotationNames = getAnnotationNamesFromDirectory(packageName, packageDir, packageDir); + } else { + // We do not support a resource URL with any other protocols, so create an empty set. + annotationNames = Collections.emptySet(); + } + if (annotationNames.isEmpty()) { + PackageElement pkgEle = checker.getElementUtils().getPackageElement(packageName); + if (pkgEle != null) { + for (Element e : pkgEle.getEnclosedElements()) { + if (e.getKind() == ElementKind.ANNOTATION_TYPE) { + annotationNames.add(((TypeElement) e).getQualifiedName().toString()); + } + } } } supportedBundledAnnotationClasses.addAll(loadAnnotationClasses(annotationNames)); From 2811bfa568d5177d298c7cc43229e865dc2528f7 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Fri, 15 Jan 2021 09:22:32 -0800 Subject: [PATCH 04/27] Make type check. --- .../framework/type/AnnotationClassLoader.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java index feb0bd295e7..40bcc62a5c5 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java +++ b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java @@ -496,7 +496,7 @@ protected final void printPaths() { */ private void loadBundledAnnotationClasses() { // retrieve the fully qualified class names of the annotations - Set<@BinaryName String> annotationNames = new LinkedHashSet<>(); + Set<@BinaryName String> annotationNames; // see whether the resource URL has a protocol of jar or file if (resourceURL != null && resourceURL.getProtocol().contentEquals("jar")) { // if the checker class file is contained within a jar, then the @@ -548,7 +548,11 @@ private void loadBundledAnnotationClasses() { if (pkgEle != null) { for (Element e : pkgEle.getEnclosedElements()) { if (e.getKind() == ElementKind.ANNOTATION_TYPE) { - annotationNames.add(((TypeElement) e).getQualifiedName().toString()); + // Elements needs to be annotated. + @SuppressWarnings("signature:assignment.type.incompatible") + @BinaryName String annoBinName = + checker.getElementUtils().getBinaryName((TypeElement) e).toString(); + annotationNames.add(annoBinName); } } } From c01fe408c38db4e23cdba204c49558465e751700 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Fri, 15 Jan 2021 12:27:05 -0800 Subject: [PATCH 05/27] Move util classes to checker-util. --- checker-qual/build.gradle | 1 - checker-util/build.gradle | 30 + .../checker/formatter/FormatUtil.java | 326 +++++++++++ .../checker/i18nformatter/I18nFormatUtil.java | 408 ++++++++++++++ .../checker/nullness/NullnessUtil.java | 309 +++++++++++ .../checker/nullness/Opt.java | 143 +++++ .../checker/regex/RegexUtil.java | 333 +++++++++++ .../checker/signedness/SignednessUtil.java | 523 ++++++++++++++++++ .../signedness/SignednessUtilExtra.java | 68 +++ .../checker/units/UnitsTools.java | 138 +++++ settings.gradle | 2 + 11 files changed, 2280 insertions(+), 1 deletion(-) create mode 100644 checker-util/build.gradle create mode 100644 checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java create mode 100644 checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java diff --git a/checker-qual/build.gradle b/checker-qual/build.gradle index e6eb27aecea..d4063665c37 100644 --- a/checker-qual/build.gradle +++ b/checker-qual/build.gradle @@ -26,7 +26,6 @@ final checkerQualPom(publication) { name = 'Checker Qual' description = 'checker-qual contains annotations (type qualifiers)\n' + 'used by the Checker Framework to type-check Java source code.\n' + - 'It also contains utility classes for programmers to use at run time.\n' + '\n' + 'Please see artifact: org.checkerframework:checker' licenses { diff --git a/checker-util/build.gradle b/checker-util/build.gradle new file mode 100644 index 00000000000..0d5f8fc04ae --- /dev/null +++ b/checker-util/build.gradle @@ -0,0 +1,30 @@ +apply from: rootProject.file("gradle-mvn-push.gradle") + +/** Adds information to the publication for uploading to Maven repositories. */ +final checkerUtilPom(publication) { + sharedPublicationConfiguration(publication) + publication.from components.java + publication.pom { + name = 'Checker Util' + description = 'checker-util contains utility classes for programmers to use at run time.\n' + + '\n' + + 'Please see artifact: org.checkerframework:checker' + licenses { + license { + name = 'The MIT License' + url = 'http://opensource.org/licenses/MIT' + distribution = 'repo' + } + } + } +} +publishing { + publications { + checkerUtil(MavenPublication) { + checkerUtilPom it + } + } +} +signing { + sign publishing.publications.checkerUtil +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java b/checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java new file mode 100644 index 00000000000..608e07b5514 --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java @@ -0,0 +1,326 @@ +package org.checkerframework.checker.formatter; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.IllegalFormatConversionException; +import java.util.IllegalFormatException; +import java.util.Map; +import java.util.MissingFormatArgumentException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.checkerframework.checker.formatter.qual.ConversionCategory; +import org.checkerframework.checker.formatter.qual.ReturnsFormat; +import org.checkerframework.checker.regex.qual.Regex; +import org.checkerframework.framework.qual.AnnotatedFor; + +/** This class provides a collection of utilities to ease working with format strings. */ +@AnnotatedFor("nullness") +public class FormatUtil { + + /** + * A representation of a format specifier, which is represented by "%..." in the format string. + * Indicates how to convert a value into a string. + */ + private static class Conversion { + /** The index in the argument list. */ + private final int index; + /** The conversion category. */ + private final ConversionCategory cath; + + /** + * Construct a new Conversion. + * + * @param index the index in the argument list + * @param c the conversion character + */ + public Conversion(char c, int index) { + this.index = index; + this.cath = ConversionCategory.fromConversionChar(c); + } + + /** + * Returns the index in the argument list. + * + * @return the index in the argument list + */ + int index() { + return index; + } + + /** + * Returns the conversion category. + * + * @return the conversion category + */ + ConversionCategory category() { + return cath; + } + } + + /** + * Returns the first argument if the format string is satisfiable, and if the format's + * parameters match the passed {@link ConversionCategory}s. Otherwise throws an exception. + * + * @param format a format string + * @param cc an array of conversion categories + * @return the {@code format} argument + * @throws IllegalFormatException if the format string is incompatible with the conversion + * categories + */ + // TODO introduce more such functions, see RegexUtil for examples + @ReturnsFormat + public static String asFormat(String format, ConversionCategory... cc) + throws IllegalFormatException { + ConversionCategory[] fcc = formatParameterCategories(format); + if (fcc.length != cc.length) { + throw new ExcessiveOrMissingFormatArgumentException(cc.length, fcc.length); + } + + for (int i = 0; i < cc.length; i++) { + if (cc[i] != fcc[i]) { + throw new IllegalFormatConversionCategoryException(cc[i], fcc[i]); + } + } + + return format; + } + + /** + * Throws an exception if the format is not syntactically valid. + * + * @param format a format string + * @throws IllegalFormatException if the format string is invalid + */ + public static void tryFormatSatisfiability(String format) throws IllegalFormatException { + @SuppressWarnings({ + "unused", // called for side effect, to see if it throws an exception + "nullness:argument.type.incompatible" // it's not documented, but String.format permits + // a null array, which it treats as matching any format string (null is supplied to each + // format specifier). + }) + String unused = String.format(format, (Object[]) null); + } + + /** + * Returns a {@link ConversionCategory} for every conversion found in the format string. + * + *

Throws an exception if the format is not syntactically valid. + */ + public static ConversionCategory[] formatParameterCategories(String format) + throws IllegalFormatException { + tryFormatSatisfiability(format); + + int last = -1; // index of last argument referenced + int lasto = -1; // last ordinary index + int maxindex = -1; + + Conversion[] cs = parse(format); + Map conv = new HashMap<>(); + + for (Conversion c : cs) { + int index = c.index(); + switch (index) { + case -1: // relative index + break; + case 0: // ordinary index + lasto++; + last = lasto; + break; + default: // explicit index + last = index - 1; + break; + } + maxindex = Math.max(maxindex, last); + Integer lastKey = last; + conv.put( + last, + ConversionCategory.intersect( + conv.containsKey(lastKey) + ? conv.get(lastKey) + : ConversionCategory.UNUSED, + c.category())); + } + + ConversionCategory[] res = new ConversionCategory[maxindex + 1]; + for (int i = 0; i <= maxindex; ++i) { + Integer key = i; // autoboxing prevents recognizing that containsKey => get() != null + res[i] = conv.containsKey(key) ? conv.get(key) : ConversionCategory.UNUSED; + } + return res; + } + + /** + * A regex that matches a format specifier. Its syntax is specified in the See {@code + * Formatter} documentation. + * + *

+     * %[argument_index$][flags][width][.precision][t]conversion
+     * group 1            2      3      4           5 6
+     * 
+ * + * For dates and times, the [t] is required and precision must not be provided. For types other + * than dates and times, the [t] must not be provided. + */ + private static final @Regex(6) String formatSpecifier = + "%(\\d+\\$)?([-#+ 0,(\\<]*)?(\\d+)?(\\.\\d+)?([tT])?([a-zA-Z%])"; + /** The capturing group for the optional {@code t} character. */ + private static final int formatSpecifierT = 5; + /** + * The capturing group for the last character in a format specifier, which is the conversion + * character unless the {@code t} character was given. + */ + private static final int formatSpecifierConversion = 6; + + /** + * A Pattern that matches a format specifier. + * + * @see #formatSpecifier + */ + private static @Regex(6) Pattern fsPattern = Pattern.compile(formatSpecifier); + + /** + * Return the index, in the argument list, of the value that will be formatted by the matched + * format specifier. + * + * @param m a matcher that matches a format specifier + * @return the index of the argument to format + */ + private static int indexFromFormat(Matcher m) { + int index; + String s = m.group(1); + if (s != null) { // explicit index + index = Integer.parseInt(s.substring(0, s.length() - 1)); + } else { + String group2 = m.group(2); // not @Deterministic, so extract into local var + if (group2 != null && group2.contains(String.valueOf('<'))) { + index = -1; // relative index + } else { + index = 0; // ordinary index + } + } + return index; + } + + /** + * Returns the conversion character from a format specifier.. + * + * @param m a matcher that matches a format specifier + * @return the conversion character from the format specifier + */ + @SuppressWarnings( + "nullness:dereference.of.nullable") // group formatSpecifierConversion always exists + private static char conversionCharFromFormat(@Regex(6) Matcher m) { + String tGroup = m.group(formatSpecifierT); + if (tGroup != null) { + return tGroup.charAt(0); // This is the letter "t" or "T". + } else { + return m.group(formatSpecifierConversion).charAt(0); + } + } + + /** + * Return the conversion character that is in the given format specifier. + * + * @param formatSpecifier a format + * specifier + * @return the conversion character that is in the given format specifier + * @deprecated This method is public only for testing. Use private method {@code + * #conversionCharFromFormat(Matcher)}. + */ + @Deprecated // used only for testing. Use conversionCharFromFormat(Matcher). + public static char conversionCharFromFormat(String formatSpecifier) { + Matcher m = fsPattern.matcher(formatSpecifier); + assert m.find(); + return conversionCharFromFormat(m); + } + + /** + * Parse the given format string, return information about its format specifiers. + * + * @param format a format string + * @return the list of Conversions from the format specifiers in the format string + */ + private static Conversion[] parse(String format) { + ArrayList cs = new ArrayList<>(); + @Regex(7) Matcher m = fsPattern.matcher(format); + while (m.find()) { + char c = conversionCharFromFormat(m); + switch (c) { + case '%': + case 'n': + break; + default: + cs.add(new Conversion(c, indexFromFormat(m))); + } + } + return cs.toArray(new Conversion[cs.size()]); + } + + public static class ExcessiveOrMissingFormatArgumentException + extends MissingFormatArgumentException { + private static final long serialVersionUID = 17000126L; + + private final int expected; + private final int found; + + /** + * Constructs an instance of this class with the actual argument length and the expected + * one. + */ + public ExcessiveOrMissingFormatArgumentException(int expected, int found) { + super("-"); + this.expected = expected; + this.found = found; + } + + public int getExpected() { + return expected; + } + + public int getFound() { + return found; + } + + @Override + public String getMessage() { + return String.format("Expected %d arguments but found %d.", expected, found); + } + } + + public static class IllegalFormatConversionCategoryException + extends IllegalFormatConversionException { + private static final long serialVersionUID = 17000126L; + + private final ConversionCategory expected; + private final ConversionCategory found; + + /** + * Constructs an instance of this class with the mismatched conversion and the expected one. + */ + public IllegalFormatConversionCategoryException( + ConversionCategory expected, ConversionCategory found) { + super( + expected.chars == null || expected.chars.length() == 0 + ? '-' + : expected.chars.charAt(0), + found.types == null ? Object.class : found.types[0]); + this.expected = expected; + this.found = found; + } + + public ConversionCategory getExpected() { + return expected; + } + + public ConversionCategory getFound() { + return found; + } + + @Override + public String getMessage() { + return String.format("Expected category %s but found %s.", expected, found); + } + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java b/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java new file mode 100644 index 00000000000..5e537931178 --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java @@ -0,0 +1,408 @@ +package org.checkerframework.checker.i18nformatter; + +import java.text.ChoiceFormat; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.IllegalFormatException; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import org.checkerframework.checker.i18nformatter.qual.I18nChecksFormat; +import org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory; +import org.checkerframework.checker.i18nformatter.qual.I18nValidFormat; +import org.checkerframework.checker.interning.qual.InternedDistinct; +import org.checkerframework.checker.nullness.qual.EnsuresNonNull; +import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.nullness.qual.RequiresNonNull; +import org.checkerframework.framework.qual.AnnotatedFor; + +/** + * This class provides a collection of utilities to ease working with i18n format strings. + * + * @checker_framework.manual #i18n-formatter-checker Internationalization Format String Checker + */ +@AnnotatedFor("nullness") +public class I18nFormatUtil { + + /** + * Throws an exception if the format is not syntactically valid. + * + * @param format the format string to parse + */ + @SuppressWarnings( + "nullness:argument.type.incompatible") // It's not documented, but passing null as the + // argument array is supported. + public static void tryFormatSatisfiability(String format) throws IllegalFormatException { + MessageFormat.format(format, (Object[]) null); + } + + /** + * Returns a {@link I18nConversionCategory} for every conversion found in the format string. + * + * @param format the format string to parse + * @throws IllegalFormatException if the format is not syntactically valid + */ + public static I18nConversionCategory[] formatParameterCategories(String format) + throws IllegalFormatException { + tryFormatSatisfiability(format); + I18nConversion[] cs = MessageFormatParser.parse(format); + + int maxIndex = -1; + Map conv = new HashMap<>(); + + for (I18nConversion c : cs) { + int index = c.index; + Integer indexKey = index; + conv.put( + indexKey, + I18nConversionCategory.intersect( + c.category, + conv.containsKey(indexKey) + ? conv.get(indexKey) + : I18nConversionCategory.UNUSED)); + maxIndex = Math.max(maxIndex, index); + } + + I18nConversionCategory[] res = new I18nConversionCategory[maxIndex + 1]; + for (int i = 0; i <= maxIndex; i++) { + Integer indexKey = i; + res[i] = + conv.containsKey(indexKey) ? conv.get(indexKey) : I18nConversionCategory.UNUSED; + } + return res; + } + + /** + * Returns true if the format string is satisfiable, and if the format's parameters match the + * passed {@link I18nConversionCategory}s. Otherwise an error is thrown. + * + * @param format a format string + * @param cc a list of expected categories for the string's format specifiers + * @return true if the format string's specifiers are the given categories, in order + */ + // TODO introduce more such functions, see RegexUtil for examples + @I18nChecksFormat + public static boolean hasFormat(String format, I18nConversionCategory... cc) { + I18nConversionCategory[] fcc = formatParameterCategories(format); + if (fcc.length != cc.length) { + return false; + } + + for (int i = 0; i < cc.length; i++) { + if (!I18nConversionCategory.isSubsetOf(cc[i], fcc[i])) { + return false; + } + } + return true; + } + + @I18nValidFormat + public static boolean isFormat(String format) { + try { + formatParameterCategories(format); + } catch (Exception e) { + return false; + } + return true; + } + + private static class I18nConversion { + public int index; + public I18nConversionCategory category; + + public I18nConversion(int index, I18nConversionCategory category) { + this.index = index; + this.category = category; + } + + @Override + public String toString() { + return category.toString() + "(index: " + index + ")"; + } + } + + private static class MessageFormatParser { + + public static int maxOffset; + + /** The locale to use for formatting numbers and dates. Is set in {@link #parse}. */ + private static @MonotonicNonNull Locale locale; + + /** + * An array of formatters, which are used to format the arguments. Is set in {@link #parse}. + */ + private static @MonotonicNonNull List categories; + + /** + * The argument numbers corresponding to each formatter. (The formatters are stored in the + * order they occur in the pattern, not in the order in which the arguments are specified.) + * Is set in {@link #parse}. + */ + private static @MonotonicNonNull List argumentIndices; + + // I think this means the number of format specifiers in the format string. + /** The number of subformats. */ + private static int numFormat; + + // Indices for segments + private static final int SEG_RAW = 0; + private static final int SEG_INDEX = 1; + private static final int SEG_TYPE = 2; + private static final int SEG_MODIFIER = 3; // modifier or subformat + + // Indices for type keywords + private static final int TYPE_NULL = 0; + private static final int TYPE_NUMBER = 1; + private static final int TYPE_DATE = 2; + private static final int TYPE_TIME = 3; + private static final int TYPE_CHOICE = 4; + + private static final String[] TYPE_KEYWORDS = {"", "number", "date", "time", "choice"}; + + // Indices for number modifiers + private static final int MODIFIER_DEFAULT = 0; // common in number and date-time + private static final int MODIFIER_CURRENCY = 1; + private static final int MODIFIER_PERCENT = 2; + private static final int MODIFIER_INTEGER = 3; + + private static final String[] NUMBER_MODIFIER_KEYWORDS = { + "", "currency", "percent", "integer" + }; + + private static final String[] DATE_TIME_MODIFIER_KEYWORDS = { + "", "short", "medium", "long", "full" + }; + + @EnsuresNonNull({"categories", "argumentIndices", "locale"}) + public static I18nConversion[] parse(String pattern) { + MessageFormatParser.categories = new ArrayList<>(); + MessageFormatParser.argumentIndices = new ArrayList<>(); + MessageFormatParser.locale = Locale.getDefault(Locale.Category.FORMAT); + applyPattern(pattern); + + I18nConversion[] ret = new I18nConversion[MessageFormatParser.numFormat]; + for (int i = 0; i < MessageFormatParser.numFormat; i++) { + ret[i] = new I18nConversion(argumentIndices.get(i), categories.get(i)); + } + return ret; + } + + @SuppressWarnings("nullness:dereference.of.nullable") // complex rules for segments[i] + @RequiresNonNull({"argumentIndices", "categories", "locale"}) + private static void applyPattern(String pattern) { + @Nullable StringBuilder[] segments = new StringBuilder[4]; + // Allocate only segments[SEG_RAW] here. The rest are + // allocated on demand. + segments[SEG_RAW] = new StringBuilder(); + + int part = SEG_RAW; + MessageFormatParser.numFormat = 0; + boolean inQuote = false; + int braceStack = 0; + maxOffset = -1; + for (int i = 0; i < pattern.length(); ++i) { + char ch = pattern.charAt(i); + if (part == SEG_RAW) { + if (ch == '\'') { + if (i + 1 < pattern.length() && pattern.charAt(i + 1) == '\'') { + segments[part].append(ch); // handle doubles + ++i; + } else { + inQuote = !inQuote; + } + } else if (ch == '{' && !inQuote) { + part = SEG_INDEX; + if (segments[SEG_INDEX] == null) { + segments[SEG_INDEX] = new StringBuilder(); + } + } else { + segments[part].append(ch); + } + } else { + if (inQuote) { // just copy quotes in parts + segments[part].append(ch); + if (ch == '\'') { + inQuote = false; + } + } else { + switch (ch) { + case ',': + if (part < SEG_MODIFIER) { + if (segments[++part] == null) { + segments[part] = new StringBuilder(); + } + } else { + segments[part].append(ch); + } + break; + case '{': + ++braceStack; + segments[part].append(ch); + break; + case '}': + if (braceStack == 0) { + part = SEG_RAW; + makeFormat(numFormat, segments); + numFormat++; + // throw away other segments + segments[SEG_INDEX] = null; + segments[SEG_TYPE] = null; + segments[SEG_MODIFIER] = null; + } else { + --braceStack; + segments[part].append(ch); + } + break; + case ' ': + // Skip any leading space chars for SEG_TYPE. + if (part != SEG_TYPE || segments[SEG_TYPE].length() > 0) { + segments[part].append(ch); + } + break; + case '\'': + inQuote = true; + segments[part].append(ch); + break; + default: + segments[part].append(ch); + break; + } + } + } + } + if (braceStack == 0 && part != 0) { + maxOffset = -1; + throw new IllegalArgumentException("Unmatched braces in the pattern"); + } + } + + /** Side-effects {@code categories} field, adding to it an I18nConversionCategory. */ + @RequiresNonNull({"argumentIndices", "categories", "locale"}) + private static void makeFormat(int offsetNumber, @Nullable StringBuilder[] textSegments) { + String[] segments = new String[textSegments.length]; + for (int i = 0; i < textSegments.length; i++) { + StringBuilder oneseg = textSegments[i]; + segments[i] = (oneseg != null) ? oneseg.toString() : ""; + } + + // get the argument number + int argumentNumber; + try { + argumentNumber = Integer.parseInt(segments[SEG_INDEX]); // always + // unlocalized! + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "can't parse argument number: " + segments[SEG_INDEX], e); + } + if (argumentNumber < 0) { + throw new IllegalArgumentException("negative argument number: " + argumentNumber); + } + + int oldMaxOffset = maxOffset; + maxOffset = offsetNumber; + argumentIndices.add(argumentNumber); + + // now get the format + I18nConversionCategory category = null; + if (segments[SEG_TYPE].length() != 0) { + int type = findKeyword(segments[SEG_TYPE], TYPE_KEYWORDS); + switch (type) { + case TYPE_NULL: + category = I18nConversionCategory.GENERAL; + break; + case TYPE_NUMBER: + switch (findKeyword(segments[SEG_MODIFIER], NUMBER_MODIFIER_KEYWORDS)) { + case MODIFIER_DEFAULT: + case MODIFIER_CURRENCY: + case MODIFIER_PERCENT: + case MODIFIER_INTEGER: + break; + default: // DecimalFormat pattern + try { + new DecimalFormat( + segments[SEG_MODIFIER], + DecimalFormatSymbols.getInstance(locale)); + } catch (IllegalArgumentException e) { + maxOffset = oldMaxOffset; + // invalid decimal subformat pattern + throw e; + } + break; + } + category = I18nConversionCategory.NUMBER; + break; + case TYPE_DATE: + case TYPE_TIME: + int mod = findKeyword(segments[SEG_MODIFIER], DATE_TIME_MODIFIER_KEYWORDS); + if (mod >= 0 && mod < DATE_TIME_MODIFIER_KEYWORDS.length) { + // nothing to do + } else { + // SimpleDateFormat pattern + try { + new SimpleDateFormat(segments[SEG_MODIFIER], locale); + } catch (IllegalArgumentException e) { + maxOffset = oldMaxOffset; + // invalid date subformat pattern + throw e; + } + } + category = I18nConversionCategory.DATE; + break; + case TYPE_CHOICE: + if (segments[SEG_MODIFIER].length() == 0) { + throw new IllegalArgumentException( + "Choice Pattern requires Subformat Pattern: " + + segments[SEG_MODIFIER]); + } + try { + // ChoiceFormat pattern + new ChoiceFormat(segments[SEG_MODIFIER]); + } catch (Exception e) { + maxOffset = oldMaxOffset; + // invalid choice subformat pattern + throw new IllegalArgumentException( + "Choice Pattern incorrect: " + segments[SEG_MODIFIER], e); + } + category = I18nConversionCategory.NUMBER; + break; + default: + maxOffset = oldMaxOffset; + throw new IllegalArgumentException( + "unknown format type: " + segments[SEG_TYPE]); + } + } else { + category = I18nConversionCategory.GENERAL; + } + categories.add(category); + } + + /** + * Return the index of s in list. If not found, return the index of + * s.trim().toLowerCase(Locale.ROOT) in list. If still not found, return -1. + */ + private static final int findKeyword(String s, String[] list) { + for (int i = 0; i < list.length; ++i) { + if (s.equals(list[i])) { + return i; + } + } + + // Try trimmed lowercase. + @SuppressWarnings("interning:assignment.type.incompatible") // test if value changed + @InternedDistinct String ls = s.trim().toLowerCase(Locale.ROOT); + if (ls != s) { // Don't loop if the string trim().toLowerCase returned the same object. + for (int i = 0; i < list.length; ++i) { + if (ls.equals(list[i])) { + return i; + } + } + } + return -1; + } + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java b/checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java new file mode 100644 index 00000000000..127a55e80bc --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java @@ -0,0 +1,309 @@ +package org.checkerframework.checker.nullness; + +import org.checkerframework.checker.nullness.qual.EnsuresNonNull; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.framework.qual.AnnotatedFor; + +/** + * Utility class for the Nullness Checker. + * + *

To avoid the need to write the NullnessUtil class name, do: + * + *

import static org.checkerframework.checker.nullness.NullnessUtil.castNonNull;
+ * + * or + * + *
import static org.checkerframework.checker.nullness.NullnessUtil.*;
+ * + *

Runtime Dependency: If you use this class, you must distribute (or link to) {@code + * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own + * project. + */ +@SuppressWarnings({ + "nullness", // Nullness utilities are trusted regarding nullness. + "cast" // Casts look redundant if Nullness Checker is not run. +}) +@AnnotatedFor("nullness") +public final class NullnessUtil { + + private NullnessUtil() { + throw new AssertionError("shouldn't be instantiated"); + } + + /** + * A method that suppresses warnings from the Nullness Checker. + * + *

The method takes a possibly-null reference, unsafely casts it to have the @NonNull type + * qualifier, and returns it. The Nullness Checker considers both the return value, and also the + * argument, to be non-null after the method call. Therefore, the {@code castNonNull} method can + * be used either as a cast expression or as a statement. The Nullness Checker issues no + * warnings in any of the following code: + * + *


+     *   // one way to use as a cast:
+     *  {@literal @}NonNull String s = castNonNull(possiblyNull1);
+     *
+     *   // another way to use as a cast:
+     *   castNonNull(possiblyNull2).toString();
+     *
+     *   // one way to use as a statement:
+     *   castNonNull(possiblyNull3);
+     *   possiblyNull3.toString();`
+     * }
+ * + * The {@code castNonNull} method is intended to be used in situations where the programmer + * definitively knows that a given reference is not null, but the type system is unable to make + * this deduction. It is not intended for defensive programming, in which a programmer cannot + * prove that the value is not null but wishes to have an earlier indication if it is. See the + * Checker Framework Manual for further discussion. + * + *

The method throws {@link AssertionError} if Java assertions are enabled and the argument + * is {@code null}. If the exception is ever thrown, then that indicates that the programmer + * misused the method by using it in a circumstance where its argument can be null. + * + * @param the type of the reference + * @param ref a reference of @Nullable type, that is non-null at run time + * @return the argument, casted to have the type qualifier @NonNull + */ + public static @EnsuresNonNull("#1") @NonNull T castNonNull( + @Nullable T ref) { + assert ref != null : "Misuse of castNonNull: called with a null argument"; + return (@NonNull T) ref; + } + + /** + * Suppress warnings from the Nullness Checker, with a custom error message. See {@link + * #castNonNull(Object)} for documentation. + * + * @see #castNonNull(Object) + * @param the type of the reference + * @param ref a reference of @Nullable type, that is non-null at run time + * @param message text to include if this method is misused + * @return the argument, casted to have the type qualifier @NonNull + */ + public static @EnsuresNonNull("#1") @NonNull T castNonNull( + @Nullable T ref, String message) { + assert ref != null : "Misuse of castNonNull: called with a null argument: " + message; + return (@NonNull T) ref; + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [] castNonNullDeep(T @Nullable [] arr) { + return (@NonNull T[]) castNonNullArray(arr, null); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @param message text to include if this method is misused + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [] castNonNullDeep(T @Nullable [] arr, String message) { + return (@NonNull T[]) castNonNullArray(arr, message); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type of the component type of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][] castNonNullDeep(T @Nullable [] @Nullable [] arr) { + return (@NonNull T[][]) castNonNullArray(arr, null); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type of the component type of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @param message text to include if this method is misused + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][] castNonNullDeep(T @Nullable [] @Nullable [] arr, String message) { + return (@NonNull T[][]) castNonNullArray(arr, message); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type (three levels in) of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][][] castNonNullDeep(T @Nullable [] @Nullable [] @Nullable [] arr) { + return (@NonNull T[][][]) castNonNullArray(arr, null); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type (three levels in) of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @param message text to include if this method is misused + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][][] castNonNullDeep( + T @Nullable [] @Nullable [] @Nullable [] arr, String message) { + return (@NonNull T[][][]) castNonNullArray(arr, message); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][][][] castNonNullDeep( + T @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr) { + return (@NonNull T[][][][]) castNonNullArray(arr, null); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type (four levels in) of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @param message text to include if this method is misused + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][][][] castNonNullDeep( + T @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr, String message) { + return (@NonNull T[][][][]) castNonNullArray(arr, message); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type (four levels in) of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][][][][] castNonNullDeep( + T @Nullable [] @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr) { + return (@NonNull T[][][][][]) castNonNullArray(arr, null); + } + + /** + * Like castNonNull, but whereas that method only checks and casts the reference itself, this + * traverses all levels of the argument array. The array is recursively checked to ensure that + * all elements at every array level are non-null. + * + * @param the component type (five levels in) of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @param message text to include if this method is misused + * @return the argument, casted to have the type qualifier @NonNull at all levels + * @see #castNonNull(Object) + */ + public static @EnsuresNonNull("#1") + @NonNull T @NonNull [][][][][] castNonNullDeep( + T @Nullable [] @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr, + String message) { + return (@NonNull T[][][][][]) castNonNullArray(arr, message); + } + + /** + * The implementation of castNonNullDeep. + * + * @param the component type (five levels in) of the array + * @param arr an array all of whose elements, and their elements recursively, are non-null at + * run time + * @param message text to include if there is a non-null value, or null to use uncustomized + * message + * @return the argument, casted to have the type qualifier @NonNull at all levels + */ + private static @NonNull T @NonNull [] castNonNullArray( + T @Nullable [] arr, @Nullable String message) { + assert arr != null + : "Misuse of castNonNullArray: called with a null array argument" + + ((message == null) ? "" : (": " + message)); + for (int i = 0; i < arr.length; ++i) { + assert arr[i] != null + : "Misuse of castNonNull: called with a null array element" + + ((message == null) ? "" : (": " + message)); + checkIfArray(arr[i], message); + } + return (@NonNull T[]) arr; + } + + /** + * If the argument is an array, requires it to be non-null at all levels. + * + * @param ref a value; if an array, all of its elements, and their elements recursively, are + * non-null at run time + * @param message text to include if there is a non-null value, or null to use uncustomized + * message + */ + private static void checkIfArray(@NonNull Object ref, @Nullable String message) { + assert ref != null + : "Misuse of checkIfArray: called with a null argument" + + ((message == null) ? "" : (": " + message)); + Class comp = ref.getClass().getComponentType(); + if (comp != null) { + // comp is non-null for arrays, otherwise null. + if (comp.isPrimitive()) { + // Nothing to do for arrays of primitive type: primitives are + // never null. + } else { + castNonNullArray((Object[]) ref, message); + } + } + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java b/checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java new file mode 100644 index 00000000000..36a93442c0c --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java @@ -0,0 +1,143 @@ +package org.checkerframework.checker.nullness; + +import java.util.NoSuchElementException; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; +import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.framework.qual.AnnotatedFor; + +/** + * Utility class for the Nullness Checker, providing every method in {@link java.util.Optional}, but + * written for possibly-null references rather than for the {@code Optional} type. + * + *

To avoid the need to write the {@code Opt} class name at invocation sites, do: + * + *

import static org.checkerframework.checker.nullness.Opt.orElse;
+ * + * or + * + *
import static org.checkerframework.checker.nullness.Opt.*;
+ * + *

Runtime Dependency: If you use this class, you must distribute (or link to) {@code + * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own + * project. + * + * @see java.util.Optional + */ +@AnnotatedFor("nullness") +public final class Opt { + + /** The Opt class cannot be instantiated. */ + private Opt() { + throw new AssertionError("shouldn't be instantiated"); + } + + /** + * If primary is non-null, returns it, otherwise throws NoSuchElementException. + * + * @param the type of the argument + * @param primary a non-null value to return + * @return {@code primary} if it is non-null + * @throws NoSuchElementException if primary is null + * @see java.util.Optional#get() + */ + // `primary` is @NonNull; otherwise, the method could throw an exception. + public static T get(T primary) { + if (primary == null) { + throw new NoSuchElementException("No value present"); + } + return primary; + } + + /** + * Returns true if primary is non-null, false if primary is null. + * + * @see java.util.Optional#isPresent() + */ + @EnsuresNonNullIf(expression = "#1", result = true) + public static boolean isPresent(@Nullable Object primary) { + return primary != null; + } + + /** + * If primary is non-null, invoke the specified consumer with the value, otherwise do nothing. + * + * @see java.util.Optional#ifPresent(Consumer) + */ + public static void ifPresent(T primary, Consumer<@NonNull ? super @NonNull T> consumer) { + if (primary != null) { + consumer.accept(primary); + } + } + + /** + * If primary is non-null, and its value matches the given predicate, return the value. If + * primary is null or its non-null value does not match the predicate, return null. + * + * @see java.util.Optional#filter(Predicate) + */ + public static @Nullable T filter( + T primary, Predicate<@NonNull ? super @NonNull T> predicate) { + if (primary == null) { + return null; + } else { + return predicate.test(primary) ? primary : null; + } + } + + /** + * If primary is non-null, apply the provided mapping function to it and return the result. If + * primary is null, return null. + * + * @see java.util.Optional#map(Function) + */ + public static @Nullable U map( + T primary, Function<@NonNull ? super @NonNull T, ? extends U> mapper) { + if (primary == null) { + return null; + } else { + return mapper.apply(primary); + } + } + + // flatMap would have the same signature and implementation as map + + /** + * Return primary if it is non-null. If primary is null, return other. + * + * @see java.util.Optional#orElse(Object) + */ + public static @NonNull T orElse(T primary, @NonNull T other) { + return primary != null ? primary : other; + } + + /** + * Return primary if it is non-null. If primary is null, invoke {@code other} and return the + * result of that invocation. + * + * @see java.util.Optional#orElseGet(Supplier) + */ + public static @NonNull T orElseGet(T primary, Supplier other) { + return primary != null ? primary : other.get(); + } + + /** + * Return primary if it is non-null. If primary is null, throw an exception to be created by the + * provided supplier. + * + * @see java.util.Optional#orElseThrow(Supplier) + */ + // `primary` is @NonNull; otherwise, the method could throw an exception. + public static T orElseThrow( + T primary, Supplier exceptionSupplier) throws X { + if (primary != null) { + return primary; + } else { + throw exceptionSupplier.get(); + } + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java b/checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java new file mode 100644 index 00000000000..4709fadcc5d --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java @@ -0,0 +1,333 @@ +// This class should be kept in sync with org.plumelib.util.RegexUtil in the plume-util project. + +package org.checkerframework.checker.regex; + +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; +import org.checkerframework.checker.index.qual.GTENegativeOne; +import org.checkerframework.checker.lock.qual.GuardSatisfied; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.regex.qual.Regex; +import org.checkerframework.dataflow.qual.Pure; +import org.checkerframework.dataflow.qual.SideEffectFree; +import org.checkerframework.framework.qual.AnnotatedFor; +import org.checkerframework.framework.qual.EnsuresQualifierIf; + +/** + * Utility methods for regular expressions, most notably for testing whether a string is a regular + * expression. + * + *

For an example of intended use, see section Testing whether a string is a + * regular expression in the Checker Framework manual. + * + *

Runtime Dependency: If you use this class, you must distribute (or link to) {@code + * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own + * project. + */ +@AnnotatedFor("nullness") +public final class RegexUtil { + + /** This class is a collection of methods; it does not represent anything. */ + private RegexUtil() { + throw new Error("do not instantiate"); + } + + /** + * A checked version of {@link PatternSyntaxException}. + * + *

This exception is useful when an illegal regex is detected but the contextual information + * to report a helpful error message is not available at the current depth in the call stack. By + * using a checked PatternSyntaxException the error must be handled up the call stack where a + * better error message can be reported. + * + *

Typical usage is: + * + *

+     * void myMethod(...) throws CheckedPatternSyntaxException {
+     *   ...
+     *   if (! isRegex(myString)) {
+     *     throw new CheckedPatternSyntaxException(...);
+     *   }
+     *   ... Pattern.compile(myString) ...
+     * 
+ * + * Simply calling {@code Pattern.compile} would have a similar effect, in that {@code + * PatternSyntaxException} would be thrown at run time if {@code myString} is not a regular + * expression. There are two problems with such an approach. First, a client of {@code myMethod} + * might forget to handle the exception, since {@code PatternSyntaxException} is not checked. + * Also, the Regex Checker would issue a warning about the call to {@code Pattern.compile} that + * might throw an exception. The above usage pattern avoids both problems. + * + * @see PatternSyntaxException + */ + public static class CheckedPatternSyntaxException extends Exception { + + private static final long serialVersionUID = 6266881831979001480L; + + /** The PatternSyntaxException that this is a wrapper around. */ + private final PatternSyntaxException pse; + + /** + * Constructs a new CheckedPatternSyntaxException equivalent to the given {@link + * PatternSyntaxException}. + * + *

Consider calling this constructor with the result of {@link RegexUtil#regexError}. + * + * @param pse the PatternSyntaxException to be wrapped + */ + public CheckedPatternSyntaxException(PatternSyntaxException pse) { + this.pse = pse; + } + + /** + * Constructs a new CheckedPatternSyntaxException. + * + * @param desc a description of the error + * @param regex the erroneous pattern + * @param index the approximate index in the pattern of the error, or {@code -1} if the + * index is not known + */ + public CheckedPatternSyntaxException(String desc, String regex, @GTENegativeOne int index) { + this(new PatternSyntaxException(desc, regex, index)); + } + + /** + * Retrieves the description of the error. + * + * @return the description of the error + */ + public String getDescription() { + return pse.getDescription(); + } + + /** + * Retrieves the error index. + * + * @return the approximate index in the pattern of the error, or {@code -1} if the index is + * not known + */ + public int getIndex() { + return pse.getIndex(); + } + + /** + * Returns a multi-line string containing the description of the syntax error and its index, + * the erroneous regular-expression pattern, and a visual indication of the error index + * within the pattern. + * + * @return the full detail message + */ + @Override + @Pure + public String getMessage(@GuardSatisfied CheckedPatternSyntaxException this) { + return pse.getMessage(); + } + + /** + * Retrieves the erroneous regular-expression pattern. + * + * @return the erroneous pattern + */ + public String getPattern() { + return pse.getPattern(); + } + } + + /** + * Returns true if the argument is a syntactically valid regular expression. + * + * @param s string to check for being a regular expression + * @return true iff s is a regular expression + */ + @Pure + @EnsuresQualifierIf(result = true, expression = "#1", qualifier = Regex.class) + public static boolean isRegex(String s) { + return isRegex(s, 0); + } + + /** + * Returns true if the argument is a syntactically valid regular expression with at least the + * given number of groups. + * + * @param s string to check for being a regular expression + * @param groups number of groups expected + * @return true iff s is a regular expression with {@code groups} groups + */ + @SuppressWarnings("regex") // RegexUtil; for purity, catches an exception + @Pure + // @EnsuresQualifierIf annotation is extraneous because this method is special-cased + // in RegexTransfer. + @EnsuresQualifierIf(result = true, expression = "#1", qualifier = Regex.class) + public static boolean isRegex(String s, int groups) { + Pattern p; + try { + p = Pattern.compile(s); + } catch (PatternSyntaxException e) { + return false; + } + return getGroupCount(p) >= groups; + } + + /** + * Returns true if the argument is a syntactically valid regular expression. + * + * @param c char to check for being a regular expression + * @return true iff c is a regular expression + */ + @SuppressWarnings({ + "regex", "lock" + }) // RegexUtil; temp value used in pure method is equal up to equals but not up to == + @Pure + @EnsuresQualifierIf(result = true, expression = "#1", qualifier = Regex.class) + public static boolean isRegex(final char c) { + return isRegex(Character.toString(c)); + } + + /** + * Returns null if the argument is a syntactically valid regular expression. Otherwise returns a + * string describing why the argument is not a regex. + * + * @param s string to check for being a regular expression + * @return null, or a string describing why the argument is not a regex + */ + @SideEffectFree + public static @Nullable String regexError(String s) { + return regexError(s, 0); + } + + /** + * Returns null if the argument is a syntactically valid regular expression with at least the + * given number of groups. Otherwise returns a string describing why the argument is not a + * regex. + * + * @param s string to check for being a regular expression + * @param groups number of groups expected + * @return null, or a string describing why the argument is not a regex + */ + @SuppressWarnings({"regex", "not.sef"}) // RegexUtil; + @SideEffectFree + public static @Nullable String regexError(String s, int groups) { + try { + Pattern p = Pattern.compile(s); + int actualGroups = getGroupCount(p); + if (actualGroups < groups) { + return regexErrorMessage(s, groups, actualGroups); + } + } catch (PatternSyntaxException e) { + return e.getMessage(); + } + return null; + } + + /** + * Returns null if the argument is a syntactically valid regular expression. Otherwise returns a + * PatternSyntaxException describing why the argument is not a regex. + * + * @param s string to check for being a regular expression + * @return null, or a PatternSyntaxException describing why the argument is not a regex + */ + @SideEffectFree + public static @Nullable PatternSyntaxException regexException(String s) { + return regexException(s, 0); + } + + /** + * Returns null if the argument is a syntactically valid regular expression with at least the + * given number of groups. Otherwise returns a PatternSyntaxException describing why the + * argument is not a regex. + * + * @param s string to check for being a regular expression + * @param groups number of groups expected + * @return null, or a PatternSyntaxException describing why the argument is not a regex + */ + @SuppressWarnings("regex") // RegexUtil + @SideEffectFree + public static @Nullable PatternSyntaxException regexException(String s, int groups) { + try { + Pattern p = Pattern.compile(s); + int actualGroups = getGroupCount(p); + if (actualGroups < groups) { + return new PatternSyntaxException( + regexErrorMessage(s, groups, actualGroups), s, -1); + } + } catch (PatternSyntaxException pse) { + return pse; + } + return null; + } + + /** + * Returns the argument as a {@code @Regex String} if it is a regex, otherwise throws an error. + * The purpose of this method is to suppress Regex Checker warnings. It should be very rarely + * needed. + * + * @param s string to check for being a regular expression + * @return its argument + * @throws Error if argument is not a regex + */ + @SideEffectFree + // The return type annotation is a conservative bound. + public static @Regex String asRegex(String s) { + return asRegex(s, 0); + } + + /** + * Returns the argument as a {@code @Regex(groups) String} if it is a regex with at least the + * given number of groups, otherwise throws an error. The purpose of this method is to suppress + * Regex Checker warnings. It should be very rarely needed. + * + * @param s string to check for being a regular expression + * @param groups number of groups expected + * @return its argument + * @throws Error if argument is not a regex + */ + @SuppressWarnings("regex") // RegexUtil + @SideEffectFree + // The return type annotation is irrelevant; it is special-cased by + // RegexAnnotatedTypeFactory. + public static @Regex String asRegex(String s, int groups) { + try { + Pattern p = Pattern.compile(s); + int actualGroups = getGroupCount(p); + if (actualGroups < groups) { + throw new Error(regexErrorMessage(s, groups, actualGroups)); + } + return s; + } catch (PatternSyntaxException e) { + throw new Error(e); + } + } + + /** + * Generates an error message for s when expectedGroups are needed, but s only has actualGroups. + * + * @param s string to check for being a regular expression + * @param expectedGroups the number of needed capturing groups + * @param actualGroups the number of groups that {@code s} has + * @return an error message for s when expectedGroups groups are needed, but s only has + * actualGroups groups + */ + @SideEffectFree + private static String regexErrorMessage(String s, int expectedGroups, int actualGroups) { + return "regex \"" + + s + + "\" has " + + actualGroups + + " groups, but " + + expectedGroups + + " groups are needed."; + } + + /** + * Return the count of groups in the argument. + * + * @param p pattern whose groups to count + * @return the count of groups in the argument + */ + @SuppressWarnings("lock") // does not depend on object identity + @Pure + private static int getGroupCount(Pattern p) { + return p.matcher("").groupCount(); + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java b/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java new file mode 100644 index 00000000000..948ab11dcbd --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java @@ -0,0 +1,523 @@ +package org.checkerframework.checker.signedness; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import org.checkerframework.checker.signedness.qual.Unsigned; +import org.checkerframework.framework.qual.AnnotatedFor; + +/** + * Provides static utility methods for unsigned values. Most of these re-implement functionality + * that was introduced in JDK 8, making it available in earlier versions of Java. Others provide new + * functionality. {@link SignednessUtilExtra} has more methods that reference packages that Android + * does not provide. + * + * @checker_framework.manual #signedness-utilities Utility routines for manipulating unsigned values + */ +@AnnotatedFor("nullness") +public final class SignednessUtil { + + private SignednessUtil() { + throw new Error("Do not instantiate"); + } + + /** + * Wraps an unsigned byte array into a ByteBuffer. This method is a wrapper around {@link + * java.nio.ByteBuffer#wrap(byte[]) wrap(byte[])}, but assumes that the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer wrapUnsigned(@Unsigned byte[] array) { + return ByteBuffer.wrap(array); + } + + /** + * Wraps an unsigned byte array into a ByteBuffer. This method is a wrapper around {@link + * java.nio.ByteBuffer#wrap(byte[], int, int) wrap(byte[], int, int)}, but assumes that the + * input should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer wrapUnsigned(@Unsigned byte[] array, int offset, int length) { + return ByteBuffer.wrap(array, offset, length); + } + + /** + * Gets an unsigned int from the ByteBuffer b. This method is a wrapper around {@link + * java.nio.ByteBuffer#getInt() getInt()}, but assumes that the result should be interpreted as + * unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned int getUnsignedInt(ByteBuffer b) { + return b.getInt(); + } + + /** + * Gets an unsigned short from the ByteBuffer b. This method is a wrapper around {@link + * java.nio.ByteBuffer#getShort() getShort()}, but assumes that the result should be interpreted + * as unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned short getUnsignedShort(ByteBuffer b) { + return b.getShort(); + } + + /** + * Gets an unsigned byte from the ByteBuffer b. This method is a wrapper around {@link + * java.nio.ByteBuffer#get() get()}, but assumes that the result should be interpreted as + * unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned byte getUnsigned(ByteBuffer b) { + return b.get(); + } + + /** + * Gets an unsigned byte from the ByteBuffer b at i. This method is a wrapper around {@link + * java.nio.ByteBuffer#get(int) get(int)}, but assumes that the result should be interpreted as + * unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned byte getUnsigned(ByteBuffer b, int i) { + return b.get(i); + } + + /** + * Populates an unsigned byte array from the ByteBuffer b at i with l bytes. This method is a + * wrapper around {@link java.nio.ByteBuffer#get(byte[] bs, int, int) get(byte[], int, int)}, + * but assumes that the bytes should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer getUnsigned(ByteBuffer b, byte[] bs, int i, int l) { + return b.get(bs, i, l); + } + + /** + * Places an unsigned byte into the ByteBuffer b. This method is a wrapper around {@link + * java.nio.ByteBuffer#put(byte) put(byte)}, but assumes that the input should be interpreted as + * unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsigned(ByteBuffer b, @Unsigned byte ubyte) { + return b.put(ubyte); + } + + /** + * Places an unsigned byte into the ByteBuffer b at i. This method is a wrapper around {@link + * java.nio.ByteBuffer#put(int, byte) put(int, byte)}, but assumes that the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsigned(ByteBuffer b, int i, @Unsigned byte ubyte) { + return b.put(i, ubyte); + } + + /** + * Places an unsigned int into the IntBuffer b. This method is a wrapper around {@link + * java.nio.IntBuffer#put(int) put(int)}, but assumes that the input should be interpreted as + * unsigned. + */ + @SuppressWarnings("signedness") + public static IntBuffer putUnsigned(IntBuffer b, @Unsigned int uint) { + return b.put(uint); + } + + /** + * Places an unsigned int into the IntBuffer b at i. This method is a wrapper around {@link + * java.nio.IntBuffer#put(int, int) put(int, int)}, but assumes that the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static IntBuffer putUnsigned(IntBuffer b, int i, @Unsigned int uint) { + return b.put(i, uint); + } + + /** + * Places an unsigned int array into the IntBuffer b. This method is a wrapper around {@link + * java.nio.IntBuffer#put(int[]) put(int[])}, but assumes that the input should be interpreted + * as unsigned. + */ + @SuppressWarnings("signedness") + public static IntBuffer putUnsigned(IntBuffer b, @Unsigned int[] uints) { + return b.put(uints); + } + + /** + * Places an unsigned int array into the IntBuffer b at i with length l. This method is a + * wrapper around {@link java.nio.IntBuffer#put(int[], int, int) put(int[], int, int)}, but + * assumes that the input should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static IntBuffer putUnsigned(IntBuffer b, @Unsigned int[] uints, int i, int l) { + return b.put(uints, i, l); + } + + /** + * Gets an unsigned int from the IntBuffer b at i. This method is a wrapper around {@link + * java.nio.IntBuffer#get(int) get(int)}, but assumes that the output should be interpreted as + * unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned int getUnsigned(IntBuffer b, int i) { + return b.get(i); + } + + /** + * Places an unsigned short into the ByteBuffer b. This method is a wrapper around {@link + * java.nio.ByteBuffer#putShort(short) putShort(short)}, but assumes that the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsignedShort(ByteBuffer b, @Unsigned short ushort) { + return b.putShort(ushort); + } + + /** + * Places an unsigned short into the ByteBuffer b at i. This method is a wrapper around {@link + * java.nio.ByteBuffer#putShort(int, short) putShort(int, short)}, but assumes that the input + * should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsignedShort(ByteBuffer b, int i, @Unsigned short ushort) { + return b.putShort(i, ushort); + } + + /** + * Places an unsigned int into the ByteBuffer b. This method is a wrapper around {@link + * java.nio.ByteBuffer#putInt(int) putInt(int)}, but assumes that the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsignedInt(ByteBuffer b, @Unsigned int uint) { + return b.putInt(uint); + } + + /** + * Places an unsigned int into the ByteBuffer b at i. This method is a wrapper around {@link + * java.nio.ByteBuffer#putInt(int, int) putInt(int, int)}, but assumes that the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsignedInt(ByteBuffer b, int i, @Unsigned int uint) { + return b.putInt(i, uint); + } + + /** + * Places an unsigned long into the ByteBuffer b at i. This method is a wrapper around {@link + * java.nio.ByteBuffer#putLong(int, long) putLong(int, long)}, but assumes that the input should + * be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static ByteBuffer putUnsignedLong(ByteBuffer b, int i, @Unsigned long ulong) { + return b.putLong(i, ulong); + } + + /** + * Reads an unsigned char from the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#readChar() readChar()}, but assumes the output should be interpreted + * as unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned char readUnsignedChar(RandomAccessFile f) throws IOException { + return f.readChar(); + } + + /** + * Reads an unsigned int from the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#readInt() readInt()}, but assumes the output should be interpreted + * as unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned int readUnsignedInt(RandomAccessFile f) throws IOException { + return f.readInt(); + } + + /** + * Reads an unsigned long from the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#readLong() readLong()}, but assumes the output should be interpreted + * as unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned long readUnsignedLong(RandomAccessFile f) throws IOException { + return f.readLong(); + } + + /** + * Reads up to {@code len} bytes of data from this file into an unsigned array of bytes. This + * method is a wrapper around {@link java.io.RandomAccessFile#read(byte[], int, int) + * read(byte[], int, int)}, but assumes the output should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static int readUnsigned(RandomAccessFile f, @Unsigned byte b[], int off, int len) + throws IOException { + return f.read(b, off, len); + } + + /** + * Reads a file fully into an unsigned byte array. This method is a wrapper around {@link + * java.io.RandomAccessFile#readFully(byte[]) readFully(byte[])}, but assumes the output should + * be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void readFullyUnsigned(RandomAccessFile f, @Unsigned byte b[]) + throws IOException { + f.readFully(b); + } + + /** + * Writes len unsigned bytes to the RandomAccessFile f at offset off. This method is a wrapper + * around {@link java.io.RandomAccessFile#write(byte[], int, int) write(byte[], int, int)}, but + * assumes the input should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void writeUnsigned(RandomAccessFile f, @Unsigned byte[] bs, int off, int len) + throws IOException { + f.write(bs, off, len); + } + + /** + * Writes an unsigned byte to the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#writeByte(int) writeByte(int)}, but assumes the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void writeUnsignedByte(RandomAccessFile f, @Unsigned byte b) throws IOException { + f.writeByte(Byte.toUnsignedInt(b)); + } + + /** + * Writes an unsigned char to the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#writeChar(int) writeChar(int)}, but assumes the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void writeUnsignedChar(RandomAccessFile f, @Unsigned char c) throws IOException { + f.writeChar(toUnsignedInt(c)); + } + + /** + * Writes an unsigned short to the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#writeShort(int) writeShort(int)}, but assumes the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void writeUnsignedShort(RandomAccessFile f, @Unsigned short s) + throws IOException { + f.writeShort(Short.toUnsignedInt(s)); + } + + /** + * Writes an unsigned byte to the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#writeInt(int) writeInt(int)}, but assumes the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void writeUnsignedInt(RandomAccessFile f, @Unsigned int i) throws IOException { + f.writeInt(i); + } + + /** + * Writes an unsigned byte to the RandomAccessFile f. This method is a wrapper around {@link + * java.io.RandomAccessFile#writeLong(long) writeLong(long)}, but assumes the input should be + * interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void writeUnsignedLong(RandomAccessFile f, @Unsigned long l) throws IOException { + f.writeLong(l); + } + + /** + * Gets an array of unsigned bytes from the ByteBuffer b and stores them in the array bs. This + * method is a wrapper around {@link java.nio.ByteBuffer#get(byte[]) get(byte[])}, but assumes + * that the array of bytes should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void getUnsigned(ByteBuffer b, @Unsigned byte[] bs) { + b.get(bs); + } + + /** + * Compares two unsigned shorts x and y. + * + * @return a negative number iff x {@literal <} y, a positive number iff x {@literal >} y, and + * zero iff x == y. + */ + @SuppressWarnings("signedness") + public static int compareUnsigned(@Unsigned short x, @Unsigned short y) { + return Integer.compareUnsigned(Short.toUnsignedInt(x), Short.toUnsignedInt(y)); + } + + /** + * Compares two unsigned bytes x and y. + * + * @return a negative number iff x {@literal <} y, a positive number iff x {@literal >} y, and + * zero iff x == y. + */ + @SuppressWarnings("signedness") + public static int compareUnsigned(@Unsigned byte x, @Unsigned byte y) { + return Integer.compareUnsigned(Byte.toUnsignedInt(x), Byte.toUnsignedInt(y)); + } + + /** Produces a string representation of the unsigned short s. */ + @SuppressWarnings("signedness") + public static String toUnsignedString(@Unsigned short s) { + return Long.toString(Short.toUnsignedLong(s)); + } + + /** Produces a string representation of the unsigned short s in base radix. */ + @SuppressWarnings("signedness") + public static String toUnsignedString(@Unsigned short s, int radix) { + return Integer.toUnsignedString(Short.toUnsignedInt(s), radix); + } + + /** Produces a string representation of the unsigned byte b. */ + @SuppressWarnings("signedness") + public static String toUnsignedString(@Unsigned byte b) { + return Integer.toUnsignedString(Byte.toUnsignedInt(b)); + } + + /** Produces a string representation of the unsigned byte b in base radix. */ + @SuppressWarnings("signedness") + public static String toUnsignedString(@Unsigned byte b, int radix) { + return Integer.toUnsignedString(Byte.toUnsignedInt(b), radix); + } + + /* + * Creates a BigInteger representing the same value as unsigned long. + * + * This is a reimplementation of Java 8's + * {@link Long.toUnsignedBigInteger(long)}. + */ + @SuppressWarnings("signedness") + private static @Unsigned BigInteger toUnsignedBigInteger(@Unsigned long l) { + // Java 8 version: return Long.toUnsignedBigInteger(l); + if (l >= 0L) { + return BigInteger.valueOf(l); + } else { + int upper = (int) (l >>> 32); + int lower = (int) l; + + // return (upper << 32) + lower + return BigInteger.valueOf(Integer.toUnsignedLong(upper)) + .shiftLeft(32) + .add(BigInteger.valueOf(Integer.toUnsignedLong(lower))); + } + } + + /** Returns an unsigned short representing the same value as an unsigned byte. */ + public static @Unsigned short toUnsignedShort(@Unsigned byte b) { + return (short) (((int) b) & 0xff); + } + + /** Returns an unsigned long representing the same value as an unsigned char. */ + public static @Unsigned long toUnsignedLong(@Unsigned char c) { + return ((long) c) & 0xffL; + } + + /** Returns an unsigned int representing the same value as an unsigned char. */ + public static @Unsigned int toUnsignedInt(@Unsigned char c) { + return ((int) c) & 0xff; + } + + /** Returns an unsigned short representing the same value as an unsigned char. */ + public static @Unsigned short toUnsignedShort(@Unsigned char c) { + return (short) (((int) c) & 0xff); + } + + /** Returns a float representing the same value as the unsigned byte. */ + public static float toFloat(@Unsigned byte b) { + return toUnsignedBigInteger(Byte.toUnsignedLong(b)).floatValue(); + } + + /** Returns a float representing the same value as the unsigned short. */ + public static float toFloat(@Unsigned short s) { + return toUnsignedBigInteger(Short.toUnsignedLong(s)).floatValue(); + } + + /** Returns a float representing the same value as the unsigned int. */ + public static float toFloat(@Unsigned int i) { + return toUnsignedBigInteger(Integer.toUnsignedLong(i)).floatValue(); + } + + /** Returns a float representing the same value as the unsigned long. */ + public static float toFloat(@Unsigned long l) { + return toUnsignedBigInteger(l).floatValue(); + } + + /** Returns a double representing the same value as the unsigned byte. */ + public static double toDouble(@Unsigned byte b) { + return toUnsignedBigInteger(Byte.toUnsignedLong(b)).doubleValue(); + } + + /** Returns a double representing the same value as the unsigned short. */ + public static double toDouble(@Unsigned short s) { + return toUnsignedBigInteger(Short.toUnsignedLong(s)).doubleValue(); + } + + /** Returns a double representing the same value as the unsigned int. */ + public static double toDouble(@Unsigned int i) { + return toUnsignedBigInteger(Integer.toUnsignedLong(i)).doubleValue(); + } + + /** Returns a double representing the same value as the unsigned long. */ + public static double toDouble(@Unsigned long l) { + return toUnsignedBigInteger(l).doubleValue(); + } + + /** Returns an unsigned byte representing the same value as the float. */ + @SuppressWarnings("signedness") + public static @Unsigned byte byteFromFloat(float f) { + assert f >= 0; + return (byte) f; + } + + /** Returns an unsigned short representing the same value as the float. */ + @SuppressWarnings("signedness") + public static @Unsigned short shortFromFloat(float f) { + assert f >= 0; + return (short) f; + } + + /** Returns an unsigned int representing the same value as the float. */ + @SuppressWarnings("signedness") + public static @Unsigned int intFromFloat(float f) { + assert f >= 0; + return (int) f; + } + + /** Returns an unsigned long representing the same value as the float. */ + @SuppressWarnings("signedness") + public static @Unsigned long longFromFloat(float f) { + assert f >= 0; + return (long) f; + } + + /** Returns an unsigned byte representing the same value as the double. */ + @SuppressWarnings("signedness") + public static @Unsigned byte byteFromDouble(double d) { + assert d >= 0; + return (byte) d; + } + + /** Returns an unsigned short representing the same value as the double. */ + @SuppressWarnings("signedness") + public static @Unsigned short shortFromDouble(double d) { + assert d >= 0; + return (short) d; + } + + /** Returns an unsigned int representing the same value as the double. */ + @SuppressWarnings("signedness") + public static @Unsigned int intFromDouble(double d) { + assert d >= 0; + return (int) d; + } + + /** Returns an unsigned long representing the same value as the double. */ + @SuppressWarnings("signedness") + public static @Unsigned long longFromDouble(double d) { + assert d >= 0; + return (long) d; + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java b/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java new file mode 100644 index 00000000000..6b38b1d5202 --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java @@ -0,0 +1,68 @@ +package org.checkerframework.checker.signedness; + +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import org.checkerframework.checker.signedness.qual.Unsigned; +import org.checkerframework.framework.qual.AnnotatedFor; + +/** + * Provides more static utility methods for unsigned values. These methods use Java packages not + * included in Android. {@link SignednessUtil} has more methods. + * + * @checker_framework.manual #signedness-utilities Utility routines for manipulating unsigned values + */ +@AnnotatedFor("nullness") +public class SignednessUtilExtra { + /** Do not instantiate this class. */ + private SignednessUtilExtra() { + throw new Error("Do not instantiate"); + } + + /** Gets the unsigned width of a {@code Dimension}. */ + @SuppressWarnings("signedness") + public static @Unsigned int dimensionUnsignedWidth(Dimension dim) { + return dim.width; + } + + /** Gets the unsigned height of a {@code Dimension}. */ + @SuppressWarnings("signedness") + public static @Unsigned int dimensionUnsignedHeight(Dimension dim) { + return dim.height; + } + + /** + * Sets rgb of BufferedImage b given unsigned ints. This method is a wrapper around {@link + * java.awt.image.BufferedImage#setRGB(int, int, int, int, int[], int, int) setRGB(int, int, + * int, int, int[], int, int)}, but assumes that the input should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static void setUnsignedRGB( + BufferedImage b, + int startX, + int startY, + int w, + int h, + @Unsigned int[] rgbArray, + int offset, + int scansize) { + b.setRGB(startX, startY, w, h, rgbArray, offset, scansize); + } + + /** + * Gets rgb of BufferedImage b as unsigned ints. This method is a wrapper around {@link + * java.awt.image.BufferedImage#getRGB(int, int, int, int, int[], int, int) getRGB(int, int, + * int, int, int[], int, int)}, but assumes that the output should be interpreted as unsigned. + */ + @SuppressWarnings("signedness") + public static @Unsigned int[] getUnsignedRGB( + BufferedImage b, + int startX, + int startY, + int w, + int h, + @Unsigned int[] rgbArray, + int offset, + int scansize) { + return b.getRGB(startX, startY, w, h, rgbArray, offset, scansize); + } +} diff --git a/checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java b/checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java new file mode 100644 index 00000000000..56f128df42c --- /dev/null +++ b/checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java @@ -0,0 +1,138 @@ +package org.checkerframework.checker.units; + +import org.checkerframework.checker.units.qual.A; +import org.checkerframework.checker.units.qual.C; +import org.checkerframework.checker.units.qual.K; +import org.checkerframework.checker.units.qual.cd; +import org.checkerframework.checker.units.qual.degrees; +import org.checkerframework.checker.units.qual.g; +import org.checkerframework.checker.units.qual.h; +import org.checkerframework.checker.units.qual.kg; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.kmPERh; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.mPERs2; +import org.checkerframework.checker.units.qual.min; +import org.checkerframework.checker.units.qual.mm; +import org.checkerframework.checker.units.qual.mm2; +import org.checkerframework.checker.units.qual.mol; +import org.checkerframework.checker.units.qual.radians; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.framework.qual.AnnotatedFor; + +// TODO: add fromTo methods for all useful unit combinations. + +/** Utility methods to generate annotated types and to convert between them. */ +@SuppressWarnings({"units", "checkstyle:constantname"}) +@AnnotatedFor("nullness") +public class UnitsTools { + // Acceleration + public static final @mPERs2 int mPERs2 = 1; + + // Angle + public static final @radians double rad = 1; + public static final @degrees double deg = 1; + + public static @radians double toRadians(@degrees double angdeg) { + return Math.toRadians(angdeg); + } + + public static @degrees double toDegrees(@radians double angrad) { + return Math.toDegrees(angrad); + } + + // Area + public static final @mm2 int mm2 = 1; + public static final @m2 int m2 = 1; + public static final @km2 int km2 = 1; + + // Current + public static final @A int A = 1; + + // Luminance + public static final @cd int cd = 1; + + // Lengths + public static final @mm int mm = 1; + public static final @m int m = 1; + public static final @km int km = 1; + + public static @m int fromMilliMeterToMeter(@mm int mm) { + return mm / 1000; + } + + public static @mm int fromMeterToMilliMeter(@m int m) { + return m * 1000; + } + + public static @km int fromMeterToKiloMeter(@m int m) { + return m / 1000; + } + + public static @m int fromKiloMeterToMeter(@km int km) { + return km * 1000; + } + + // Mass + public static final @g int g = 1; + public static final @kg int kg = 1; + + public static @kg int fromGramToKiloGram(@g int g) { + return g / 1000; + } + + public static @g int fromKiloGramToGram(@kg int kg) { + return kg * 1000; + } + + // Speed + public static final @mPERs int mPERs = 1; + public static final @kmPERh int kmPERh = 1; + + public static @kmPERh double fromMeterPerSecondToKiloMeterPerHour(@mPERs double mps) { + return mps * 3.6d; + } + + public static @mPERs double fromKiloMeterPerHourToMeterPerSecond(@kmPERh double kmph) { + return kmph / 3.6d; + } + + // Substance + public static final @mol int mol = 1; + + // Temperature + public static final @K int K = 1; + public static final @C int C = 1; + + public static @C int fromKelvinToCelsius(@K int k) { + return k - (int) 273.15; + } + + public static @K int fromCelsiusToKelvin(@C int c) { + return c + (int) 273.15; + } + + // Time + public static final @s int s = 1; + public static final @min int min = 1; + public static final @h int h = 1; + + public static @min int fromSecondToMinute(@s int s) { + return s / 60; + } + + public static @s int fromMinuteToSecond(@min int min) { + return min * 60; + } + + public static @h int fromMinuteToHour(@min int min) { + return min / 60; + } + + public static @min int fromHourToMinute(@h int h) { + return h * 60; + } +} diff --git a/settings.gradle b/settings.gradle index 63bb6ca8e59..405d3256375 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,3 +13,5 @@ includeBuild ('../annotation-tools/annotation-file-utilities') { } } } +include 'checker-util' + From da3c50018be6eb863bf9d1cd0a1810b44c9ed020 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Fri, 15 Jan 2021 12:59:26 -0800 Subject: [PATCH 06/27] Corrections. --- LICENSE.txt | 8 +++----- checker-util/LICENSE.txt | 22 ++++++++++++++++++++++ checker-util/build.gradle | 3 +++ 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 checker-util/LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt index 0e641883be3..49dbfa2889b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -11,11 +11,9 @@ the parts that you might want to include with your own program. * The annotations and utility files are licensed under the MIT License. (The text of this license also appears below.) This applies to the - checker-qual*.jar and all the files that appear in it: every file in a - qual/ directory, plus utility files FormatUtil.java, - I18nFormatUtil.java, NullnessUtil.java, Opt.java, PurityUnqualified.java, - RegexUtil.java, SignednessUtil.java, SignednessUtilExtra.java, and - UnitsTools.java. It also applies to the cleanroom implementations of + checker-qual*.jar and checker-util.jar and all the files that appear in it, + all files in checker-qual and checker-util directories. + It also applies to the cleanroom implementations of third-party annotations (in checker/src/testannotations/, framework/src/main/java/org/jmlspecs/, and framework/src/main/java/com/google/). diff --git a/checker-util/LICENSE.txt b/checker-util/LICENSE.txt new file mode 100644 index 00000000000..47fa7199abf --- /dev/null +++ b/checker-util/LICENSE.txt @@ -0,0 +1,22 @@ +Checker Framework utilities +Copyright 2004-present by the Checker Framework developers + +MIT License: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/checker-util/build.gradle b/checker-util/build.gradle index 0d5f8fc04ae..2894b8c575b 100644 --- a/checker-util/build.gradle +++ b/checker-util/build.gradle @@ -1,3 +1,6 @@ +dependencies { + implementation project(':checker-qual') +} apply from: rootProject.file("gradle-mvn-push.gradle") /** Adds information to the publication for uploading to Maven repositories. */ From c10a47014ccd04360462ee044beed57ca767c4de Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Fri, 15 Jan 2021 13:12:31 -0800 Subject: [PATCH 07/27] Use checker-util.jawr. --- docs/manual/external-tools.tex | 1 + docs/manual/formatter-checker.tex | 2 +- docs/manual/nullness-checker.tex | 2 +- docs/manual/regex-checker.tex | 2 +- docs/manual/signedness-checker.tex | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/manual/external-tools.tex b/docs/manual/external-tools.tex index ed101c88713..3f456538157 100644 --- a/docs/manual/external-tools.tex +++ b/docs/manual/external-tools.tex @@ -518,6 +518,7 @@ \begin{itemize} \item \: \url{https://search.maven.org/artifact/com.google.errorprone/javac/9%2B181-r4173-1/jar} \item \: \url{https://search.maven.org/artifact/org.checkerframework/checker-qual/3.9.1/jar} +\item \ (optional): \url{https://search.maven.org/artifact/org.checkerframework/checker-util/3.9.1/jar} \item \: \url{https://search.maven.org/artifact/org.checkerframework/checker/3.9.1/jar} \end{itemize} diff --git a/docs/manual/formatter-checker.tex b/docs/manual/formatter-checker.tex index b645f331c44..094a5828e79 100644 --- a/docs/manual/formatter-checker.tex +++ b/docs/manual/formatter-checker.tex @@ -581,7 +581,7 @@ \end{Verbatim} \noindent -To use the \ class, the \ file +To use the \ class, the \ file must be on the classpath at run time. % LocalWords: printf InvalidFormat Formatter FormatBottom specifier's diff --git a/docs/manual/nullness-checker.tex b/docs/manual/nullness-checker.tex index 909a15e2910..90e1815386a 100644 --- a/docs/manual/nullness-checker.tex +++ b/docs/manual/nullness-checker.tex @@ -675,7 +675,7 @@ the argument is \. However, it is not intended for general defensive programming; see Section~\ref{defensive-programming}. - To use the \ method, the \ file + To use the \ method, the \ file must be on the classpath at run time. \begin{sloppypar} diff --git a/docs/manual/regex-checker.tex b/docs/manual/regex-checker.tex index 11b5d462b2d..9f2e7117762 100644 --- a/docs/manual/regex-checker.tex +++ b/docs/manual/regex-checker.tex @@ -168,7 +168,7 @@ \refclass{checker/regex}{RegexUtil.CheckedPatternSyntaxException}. \end{sloppypar} -To use the \ class, the \ file +To use the \ class, the \ file must be on the classpath at run time. \begin{figure} diff --git a/docs/manual/signedness-checker.tex b/docs/manual/signedness-checker.tex index 9ca0ac40666..f8eadb24695 100644 --- a/docs/manual/signedness-checker.tex +++ b/docs/manual/signedness-checker.tex @@ -259,7 +259,7 @@ Class \refclass{checker/signedness}{SignednessUtilExtra} contains more utility methods that reference packages not included in Android. This class is not -included in \code{checker-qual.jar}, so you may want to copy the methods to your code. +included in \code{checker-util.jar}, so you may want to copy the methods to your code. \sectionAndLabel{Local type refinement}{signedness-refinement} From f2dfe0c409281a35bc2d3ee9a34625f428d8ca7b Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Fri, 15 Jan 2021 14:20:08 -0800 Subject: [PATCH 08/27] Add change log. --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 523b38b22be..fc193b01ab5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ Version 3.10.0, February 1, 2021 **User-visible changes:** +Move utility classes from checker-qual.jar to the new checker-util.jar. + Replaced several error message keys by `expression.parameter.name`: * `contracts.precondition.expression.parameter.name` * `contracts.postcondition.expression.parameter.name` From 6b744305a6c4686cb5c98033d29143d7f7a0264a Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 10:23:26 -0800 Subject: [PATCH 09/27] Fix merge. --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 024be2ed226..aeb825f68f7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,7 +6,8 @@ Move utility classes from checker-qual.jar to the new checker-util.jar. When supplying the `-Ainfer=...` command-line argument, you must also supply `-Awarns`. -Replaced several error message keys: * `contracts.precondition.expression.parameter.name` +Replaced several error message keys: + * `contracts.precondition.expression.parameter.name` * `contracts.postcondition.expression.parameter.name` * `contracts.conditional.postcondition.expression.parameter.name` * `method.declaration.expression.parameter.name` From 888742f6722131f17c509d955d59ec0fa94222a0 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 10:30:29 -0800 Subject: [PATCH 10/27] Remove util classes. --- .../checker/formatter/FormatUtil.java | 326 ----------- .../checker/i18nformatter/I18nFormatUtil.java | 408 -------------- .../checker/nullness/NullnessUtil.java | 309 ----------- .../checker/nullness/Opt.java | 143 ----- .../checker/regex/RegexUtil.java | 333 ----------- .../checker/signedness/SignednessUtil.java | 523 ------------------ .../signedness/SignednessUtilExtra.java | 68 --- .../checker/units/UnitsTools.java | 138 ----- checker/build.gradle | 1 + 9 files changed, 1 insertion(+), 2248 deletions(-) delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/nullness/Opt.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/regex/RegexUtil.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java delete mode 100644 checker-qual/src/main/java/org/checkerframework/checker/units/UnitsTools.java diff --git a/checker-qual/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java deleted file mode 100644 index 608e07b5514..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java +++ /dev/null @@ -1,326 +0,0 @@ -package org.checkerframework.checker.formatter; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.IllegalFormatConversionException; -import java.util.IllegalFormatException; -import java.util.Map; -import java.util.MissingFormatArgumentException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.checkerframework.checker.formatter.qual.ConversionCategory; -import org.checkerframework.checker.formatter.qual.ReturnsFormat; -import org.checkerframework.checker.regex.qual.Regex; -import org.checkerframework.framework.qual.AnnotatedFor; - -/** This class provides a collection of utilities to ease working with format strings. */ -@AnnotatedFor("nullness") -public class FormatUtil { - - /** - * A representation of a format specifier, which is represented by "%..." in the format string. - * Indicates how to convert a value into a string. - */ - private static class Conversion { - /** The index in the argument list. */ - private final int index; - /** The conversion category. */ - private final ConversionCategory cath; - - /** - * Construct a new Conversion. - * - * @param index the index in the argument list - * @param c the conversion character - */ - public Conversion(char c, int index) { - this.index = index; - this.cath = ConversionCategory.fromConversionChar(c); - } - - /** - * Returns the index in the argument list. - * - * @return the index in the argument list - */ - int index() { - return index; - } - - /** - * Returns the conversion category. - * - * @return the conversion category - */ - ConversionCategory category() { - return cath; - } - } - - /** - * Returns the first argument if the format string is satisfiable, and if the format's - * parameters match the passed {@link ConversionCategory}s. Otherwise throws an exception. - * - * @param format a format string - * @param cc an array of conversion categories - * @return the {@code format} argument - * @throws IllegalFormatException if the format string is incompatible with the conversion - * categories - */ - // TODO introduce more such functions, see RegexUtil for examples - @ReturnsFormat - public static String asFormat(String format, ConversionCategory... cc) - throws IllegalFormatException { - ConversionCategory[] fcc = formatParameterCategories(format); - if (fcc.length != cc.length) { - throw new ExcessiveOrMissingFormatArgumentException(cc.length, fcc.length); - } - - for (int i = 0; i < cc.length; i++) { - if (cc[i] != fcc[i]) { - throw new IllegalFormatConversionCategoryException(cc[i], fcc[i]); - } - } - - return format; - } - - /** - * Throws an exception if the format is not syntactically valid. - * - * @param format a format string - * @throws IllegalFormatException if the format string is invalid - */ - public static void tryFormatSatisfiability(String format) throws IllegalFormatException { - @SuppressWarnings({ - "unused", // called for side effect, to see if it throws an exception - "nullness:argument.type.incompatible" // it's not documented, but String.format permits - // a null array, which it treats as matching any format string (null is supplied to each - // format specifier). - }) - String unused = String.format(format, (Object[]) null); - } - - /** - * Returns a {@link ConversionCategory} for every conversion found in the format string. - * - *

Throws an exception if the format is not syntactically valid. - */ - public static ConversionCategory[] formatParameterCategories(String format) - throws IllegalFormatException { - tryFormatSatisfiability(format); - - int last = -1; // index of last argument referenced - int lasto = -1; // last ordinary index - int maxindex = -1; - - Conversion[] cs = parse(format); - Map conv = new HashMap<>(); - - for (Conversion c : cs) { - int index = c.index(); - switch (index) { - case -1: // relative index - break; - case 0: // ordinary index - lasto++; - last = lasto; - break; - default: // explicit index - last = index - 1; - break; - } - maxindex = Math.max(maxindex, last); - Integer lastKey = last; - conv.put( - last, - ConversionCategory.intersect( - conv.containsKey(lastKey) - ? conv.get(lastKey) - : ConversionCategory.UNUSED, - c.category())); - } - - ConversionCategory[] res = new ConversionCategory[maxindex + 1]; - for (int i = 0; i <= maxindex; ++i) { - Integer key = i; // autoboxing prevents recognizing that containsKey => get() != null - res[i] = conv.containsKey(key) ? conv.get(key) : ConversionCategory.UNUSED; - } - return res; - } - - /** - * A regex that matches a format specifier. Its syntax is specified in the See {@code - * Formatter} documentation. - * - *

-     * %[argument_index$][flags][width][.precision][t]conversion
-     * group 1            2      3      4           5 6
-     * 
- * - * For dates and times, the [t] is required and precision must not be provided. For types other - * than dates and times, the [t] must not be provided. - */ - private static final @Regex(6) String formatSpecifier = - "%(\\d+\\$)?([-#+ 0,(\\<]*)?(\\d+)?(\\.\\d+)?([tT])?([a-zA-Z%])"; - /** The capturing group for the optional {@code t} character. */ - private static final int formatSpecifierT = 5; - /** - * The capturing group for the last character in a format specifier, which is the conversion - * character unless the {@code t} character was given. - */ - private static final int formatSpecifierConversion = 6; - - /** - * A Pattern that matches a format specifier. - * - * @see #formatSpecifier - */ - private static @Regex(6) Pattern fsPattern = Pattern.compile(formatSpecifier); - - /** - * Return the index, in the argument list, of the value that will be formatted by the matched - * format specifier. - * - * @param m a matcher that matches a format specifier - * @return the index of the argument to format - */ - private static int indexFromFormat(Matcher m) { - int index; - String s = m.group(1); - if (s != null) { // explicit index - index = Integer.parseInt(s.substring(0, s.length() - 1)); - } else { - String group2 = m.group(2); // not @Deterministic, so extract into local var - if (group2 != null && group2.contains(String.valueOf('<'))) { - index = -1; // relative index - } else { - index = 0; // ordinary index - } - } - return index; - } - - /** - * Returns the conversion character from a format specifier.. - * - * @param m a matcher that matches a format specifier - * @return the conversion character from the format specifier - */ - @SuppressWarnings( - "nullness:dereference.of.nullable") // group formatSpecifierConversion always exists - private static char conversionCharFromFormat(@Regex(6) Matcher m) { - String tGroup = m.group(formatSpecifierT); - if (tGroup != null) { - return tGroup.charAt(0); // This is the letter "t" or "T". - } else { - return m.group(formatSpecifierConversion).charAt(0); - } - } - - /** - * Return the conversion character that is in the given format specifier. - * - * @param formatSpecifier a format - * specifier - * @return the conversion character that is in the given format specifier - * @deprecated This method is public only for testing. Use private method {@code - * #conversionCharFromFormat(Matcher)}. - */ - @Deprecated // used only for testing. Use conversionCharFromFormat(Matcher). - public static char conversionCharFromFormat(String formatSpecifier) { - Matcher m = fsPattern.matcher(formatSpecifier); - assert m.find(); - return conversionCharFromFormat(m); - } - - /** - * Parse the given format string, return information about its format specifiers. - * - * @param format a format string - * @return the list of Conversions from the format specifiers in the format string - */ - private static Conversion[] parse(String format) { - ArrayList cs = new ArrayList<>(); - @Regex(7) Matcher m = fsPattern.matcher(format); - while (m.find()) { - char c = conversionCharFromFormat(m); - switch (c) { - case '%': - case 'n': - break; - default: - cs.add(new Conversion(c, indexFromFormat(m))); - } - } - return cs.toArray(new Conversion[cs.size()]); - } - - public static class ExcessiveOrMissingFormatArgumentException - extends MissingFormatArgumentException { - private static final long serialVersionUID = 17000126L; - - private final int expected; - private final int found; - - /** - * Constructs an instance of this class with the actual argument length and the expected - * one. - */ - public ExcessiveOrMissingFormatArgumentException(int expected, int found) { - super("-"); - this.expected = expected; - this.found = found; - } - - public int getExpected() { - return expected; - } - - public int getFound() { - return found; - } - - @Override - public String getMessage() { - return String.format("Expected %d arguments but found %d.", expected, found); - } - } - - public static class IllegalFormatConversionCategoryException - extends IllegalFormatConversionException { - private static final long serialVersionUID = 17000126L; - - private final ConversionCategory expected; - private final ConversionCategory found; - - /** - * Constructs an instance of this class with the mismatched conversion and the expected one. - */ - public IllegalFormatConversionCategoryException( - ConversionCategory expected, ConversionCategory found) { - super( - expected.chars == null || expected.chars.length() == 0 - ? '-' - : expected.chars.charAt(0), - found.types == null ? Object.class : found.types[0]); - this.expected = expected; - this.found = found; - } - - public ConversionCategory getExpected() { - return expected; - } - - public ConversionCategory getFound() { - return found; - } - - @Override - public String getMessage() { - return String.format("Expected category %s but found %s.", expected, found); - } - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java deleted file mode 100644 index 5e537931178..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java +++ /dev/null @@ -1,408 +0,0 @@ -package org.checkerframework.checker.i18nformatter; - -import java.text.ChoiceFormat; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.MessageFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.IllegalFormatException; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import org.checkerframework.checker.i18nformatter.qual.I18nChecksFormat; -import org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory; -import org.checkerframework.checker.i18nformatter.qual.I18nValidFormat; -import org.checkerframework.checker.interning.qual.InternedDistinct; -import org.checkerframework.checker.nullness.qual.EnsuresNonNull; -import org.checkerframework.checker.nullness.qual.MonotonicNonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.checker.nullness.qual.RequiresNonNull; -import org.checkerframework.framework.qual.AnnotatedFor; - -/** - * This class provides a collection of utilities to ease working with i18n format strings. - * - * @checker_framework.manual #i18n-formatter-checker Internationalization Format String Checker - */ -@AnnotatedFor("nullness") -public class I18nFormatUtil { - - /** - * Throws an exception if the format is not syntactically valid. - * - * @param format the format string to parse - */ - @SuppressWarnings( - "nullness:argument.type.incompatible") // It's not documented, but passing null as the - // argument array is supported. - public static void tryFormatSatisfiability(String format) throws IllegalFormatException { - MessageFormat.format(format, (Object[]) null); - } - - /** - * Returns a {@link I18nConversionCategory} for every conversion found in the format string. - * - * @param format the format string to parse - * @throws IllegalFormatException if the format is not syntactically valid - */ - public static I18nConversionCategory[] formatParameterCategories(String format) - throws IllegalFormatException { - tryFormatSatisfiability(format); - I18nConversion[] cs = MessageFormatParser.parse(format); - - int maxIndex = -1; - Map conv = new HashMap<>(); - - for (I18nConversion c : cs) { - int index = c.index; - Integer indexKey = index; - conv.put( - indexKey, - I18nConversionCategory.intersect( - c.category, - conv.containsKey(indexKey) - ? conv.get(indexKey) - : I18nConversionCategory.UNUSED)); - maxIndex = Math.max(maxIndex, index); - } - - I18nConversionCategory[] res = new I18nConversionCategory[maxIndex + 1]; - for (int i = 0; i <= maxIndex; i++) { - Integer indexKey = i; - res[i] = - conv.containsKey(indexKey) ? conv.get(indexKey) : I18nConversionCategory.UNUSED; - } - return res; - } - - /** - * Returns true if the format string is satisfiable, and if the format's parameters match the - * passed {@link I18nConversionCategory}s. Otherwise an error is thrown. - * - * @param format a format string - * @param cc a list of expected categories for the string's format specifiers - * @return true if the format string's specifiers are the given categories, in order - */ - // TODO introduce more such functions, see RegexUtil for examples - @I18nChecksFormat - public static boolean hasFormat(String format, I18nConversionCategory... cc) { - I18nConversionCategory[] fcc = formatParameterCategories(format); - if (fcc.length != cc.length) { - return false; - } - - for (int i = 0; i < cc.length; i++) { - if (!I18nConversionCategory.isSubsetOf(cc[i], fcc[i])) { - return false; - } - } - return true; - } - - @I18nValidFormat - public static boolean isFormat(String format) { - try { - formatParameterCategories(format); - } catch (Exception e) { - return false; - } - return true; - } - - private static class I18nConversion { - public int index; - public I18nConversionCategory category; - - public I18nConversion(int index, I18nConversionCategory category) { - this.index = index; - this.category = category; - } - - @Override - public String toString() { - return category.toString() + "(index: " + index + ")"; - } - } - - private static class MessageFormatParser { - - public static int maxOffset; - - /** The locale to use for formatting numbers and dates. Is set in {@link #parse}. */ - private static @MonotonicNonNull Locale locale; - - /** - * An array of formatters, which are used to format the arguments. Is set in {@link #parse}. - */ - private static @MonotonicNonNull List categories; - - /** - * The argument numbers corresponding to each formatter. (The formatters are stored in the - * order they occur in the pattern, not in the order in which the arguments are specified.) - * Is set in {@link #parse}. - */ - private static @MonotonicNonNull List argumentIndices; - - // I think this means the number of format specifiers in the format string. - /** The number of subformats. */ - private static int numFormat; - - // Indices for segments - private static final int SEG_RAW = 0; - private static final int SEG_INDEX = 1; - private static final int SEG_TYPE = 2; - private static final int SEG_MODIFIER = 3; // modifier or subformat - - // Indices for type keywords - private static final int TYPE_NULL = 0; - private static final int TYPE_NUMBER = 1; - private static final int TYPE_DATE = 2; - private static final int TYPE_TIME = 3; - private static final int TYPE_CHOICE = 4; - - private static final String[] TYPE_KEYWORDS = {"", "number", "date", "time", "choice"}; - - // Indices for number modifiers - private static final int MODIFIER_DEFAULT = 0; // common in number and date-time - private static final int MODIFIER_CURRENCY = 1; - private static final int MODIFIER_PERCENT = 2; - private static final int MODIFIER_INTEGER = 3; - - private static final String[] NUMBER_MODIFIER_KEYWORDS = { - "", "currency", "percent", "integer" - }; - - private static final String[] DATE_TIME_MODIFIER_KEYWORDS = { - "", "short", "medium", "long", "full" - }; - - @EnsuresNonNull({"categories", "argumentIndices", "locale"}) - public static I18nConversion[] parse(String pattern) { - MessageFormatParser.categories = new ArrayList<>(); - MessageFormatParser.argumentIndices = new ArrayList<>(); - MessageFormatParser.locale = Locale.getDefault(Locale.Category.FORMAT); - applyPattern(pattern); - - I18nConversion[] ret = new I18nConversion[MessageFormatParser.numFormat]; - for (int i = 0; i < MessageFormatParser.numFormat; i++) { - ret[i] = new I18nConversion(argumentIndices.get(i), categories.get(i)); - } - return ret; - } - - @SuppressWarnings("nullness:dereference.of.nullable") // complex rules for segments[i] - @RequiresNonNull({"argumentIndices", "categories", "locale"}) - private static void applyPattern(String pattern) { - @Nullable StringBuilder[] segments = new StringBuilder[4]; - // Allocate only segments[SEG_RAW] here. The rest are - // allocated on demand. - segments[SEG_RAW] = new StringBuilder(); - - int part = SEG_RAW; - MessageFormatParser.numFormat = 0; - boolean inQuote = false; - int braceStack = 0; - maxOffset = -1; - for (int i = 0; i < pattern.length(); ++i) { - char ch = pattern.charAt(i); - if (part == SEG_RAW) { - if (ch == '\'') { - if (i + 1 < pattern.length() && pattern.charAt(i + 1) == '\'') { - segments[part].append(ch); // handle doubles - ++i; - } else { - inQuote = !inQuote; - } - } else if (ch == '{' && !inQuote) { - part = SEG_INDEX; - if (segments[SEG_INDEX] == null) { - segments[SEG_INDEX] = new StringBuilder(); - } - } else { - segments[part].append(ch); - } - } else { - if (inQuote) { // just copy quotes in parts - segments[part].append(ch); - if (ch == '\'') { - inQuote = false; - } - } else { - switch (ch) { - case ',': - if (part < SEG_MODIFIER) { - if (segments[++part] == null) { - segments[part] = new StringBuilder(); - } - } else { - segments[part].append(ch); - } - break; - case '{': - ++braceStack; - segments[part].append(ch); - break; - case '}': - if (braceStack == 0) { - part = SEG_RAW; - makeFormat(numFormat, segments); - numFormat++; - // throw away other segments - segments[SEG_INDEX] = null; - segments[SEG_TYPE] = null; - segments[SEG_MODIFIER] = null; - } else { - --braceStack; - segments[part].append(ch); - } - break; - case ' ': - // Skip any leading space chars for SEG_TYPE. - if (part != SEG_TYPE || segments[SEG_TYPE].length() > 0) { - segments[part].append(ch); - } - break; - case '\'': - inQuote = true; - segments[part].append(ch); - break; - default: - segments[part].append(ch); - break; - } - } - } - } - if (braceStack == 0 && part != 0) { - maxOffset = -1; - throw new IllegalArgumentException("Unmatched braces in the pattern"); - } - } - - /** Side-effects {@code categories} field, adding to it an I18nConversionCategory. */ - @RequiresNonNull({"argumentIndices", "categories", "locale"}) - private static void makeFormat(int offsetNumber, @Nullable StringBuilder[] textSegments) { - String[] segments = new String[textSegments.length]; - for (int i = 0; i < textSegments.length; i++) { - StringBuilder oneseg = textSegments[i]; - segments[i] = (oneseg != null) ? oneseg.toString() : ""; - } - - // get the argument number - int argumentNumber; - try { - argumentNumber = Integer.parseInt(segments[SEG_INDEX]); // always - // unlocalized! - } catch (NumberFormatException e) { - throw new IllegalArgumentException( - "can't parse argument number: " + segments[SEG_INDEX], e); - } - if (argumentNumber < 0) { - throw new IllegalArgumentException("negative argument number: " + argumentNumber); - } - - int oldMaxOffset = maxOffset; - maxOffset = offsetNumber; - argumentIndices.add(argumentNumber); - - // now get the format - I18nConversionCategory category = null; - if (segments[SEG_TYPE].length() != 0) { - int type = findKeyword(segments[SEG_TYPE], TYPE_KEYWORDS); - switch (type) { - case TYPE_NULL: - category = I18nConversionCategory.GENERAL; - break; - case TYPE_NUMBER: - switch (findKeyword(segments[SEG_MODIFIER], NUMBER_MODIFIER_KEYWORDS)) { - case MODIFIER_DEFAULT: - case MODIFIER_CURRENCY: - case MODIFIER_PERCENT: - case MODIFIER_INTEGER: - break; - default: // DecimalFormat pattern - try { - new DecimalFormat( - segments[SEG_MODIFIER], - DecimalFormatSymbols.getInstance(locale)); - } catch (IllegalArgumentException e) { - maxOffset = oldMaxOffset; - // invalid decimal subformat pattern - throw e; - } - break; - } - category = I18nConversionCategory.NUMBER; - break; - case TYPE_DATE: - case TYPE_TIME: - int mod = findKeyword(segments[SEG_MODIFIER], DATE_TIME_MODIFIER_KEYWORDS); - if (mod >= 0 && mod < DATE_TIME_MODIFIER_KEYWORDS.length) { - // nothing to do - } else { - // SimpleDateFormat pattern - try { - new SimpleDateFormat(segments[SEG_MODIFIER], locale); - } catch (IllegalArgumentException e) { - maxOffset = oldMaxOffset; - // invalid date subformat pattern - throw e; - } - } - category = I18nConversionCategory.DATE; - break; - case TYPE_CHOICE: - if (segments[SEG_MODIFIER].length() == 0) { - throw new IllegalArgumentException( - "Choice Pattern requires Subformat Pattern: " - + segments[SEG_MODIFIER]); - } - try { - // ChoiceFormat pattern - new ChoiceFormat(segments[SEG_MODIFIER]); - } catch (Exception e) { - maxOffset = oldMaxOffset; - // invalid choice subformat pattern - throw new IllegalArgumentException( - "Choice Pattern incorrect: " + segments[SEG_MODIFIER], e); - } - category = I18nConversionCategory.NUMBER; - break; - default: - maxOffset = oldMaxOffset; - throw new IllegalArgumentException( - "unknown format type: " + segments[SEG_TYPE]); - } - } else { - category = I18nConversionCategory.GENERAL; - } - categories.add(category); - } - - /** - * Return the index of s in list. If not found, return the index of - * s.trim().toLowerCase(Locale.ROOT) in list. If still not found, return -1. - */ - private static final int findKeyword(String s, String[] list) { - for (int i = 0; i < list.length; ++i) { - if (s.equals(list[i])) { - return i; - } - } - - // Try trimmed lowercase. - @SuppressWarnings("interning:assignment.type.incompatible") // test if value changed - @InternedDistinct String ls = s.trim().toLowerCase(Locale.ROOT); - if (ls != s) { // Don't loop if the string trim().toLowerCase returned the same object. - for (int i = 0; i < list.length; ++i) { - if (ls.equals(list[i])) { - return i; - } - } - } - return -1; - } - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java deleted file mode 100644 index 127a55e80bc..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java +++ /dev/null @@ -1,309 +0,0 @@ -package org.checkerframework.checker.nullness; - -import org.checkerframework.checker.nullness.qual.EnsuresNonNull; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.framework.qual.AnnotatedFor; - -/** - * Utility class for the Nullness Checker. - * - *

To avoid the need to write the NullnessUtil class name, do: - * - *

import static org.checkerframework.checker.nullness.NullnessUtil.castNonNull;
- * - * or - * - *
import static org.checkerframework.checker.nullness.NullnessUtil.*;
- * - *

Runtime Dependency: If you use this class, you must distribute (or link to) {@code - * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own - * project. - */ -@SuppressWarnings({ - "nullness", // Nullness utilities are trusted regarding nullness. - "cast" // Casts look redundant if Nullness Checker is not run. -}) -@AnnotatedFor("nullness") -public final class NullnessUtil { - - private NullnessUtil() { - throw new AssertionError("shouldn't be instantiated"); - } - - /** - * A method that suppresses warnings from the Nullness Checker. - * - *

The method takes a possibly-null reference, unsafely casts it to have the @NonNull type - * qualifier, and returns it. The Nullness Checker considers both the return value, and also the - * argument, to be non-null after the method call. Therefore, the {@code castNonNull} method can - * be used either as a cast expression or as a statement. The Nullness Checker issues no - * warnings in any of the following code: - * - *


-     *   // one way to use as a cast:
-     *  {@literal @}NonNull String s = castNonNull(possiblyNull1);
-     *
-     *   // another way to use as a cast:
-     *   castNonNull(possiblyNull2).toString();
-     *
-     *   // one way to use as a statement:
-     *   castNonNull(possiblyNull3);
-     *   possiblyNull3.toString();`
-     * }
- * - * The {@code castNonNull} method is intended to be used in situations where the programmer - * definitively knows that a given reference is not null, but the type system is unable to make - * this deduction. It is not intended for defensive programming, in which a programmer cannot - * prove that the value is not null but wishes to have an earlier indication if it is. See the - * Checker Framework Manual for further discussion. - * - *

The method throws {@link AssertionError} if Java assertions are enabled and the argument - * is {@code null}. If the exception is ever thrown, then that indicates that the programmer - * misused the method by using it in a circumstance where its argument can be null. - * - * @param the type of the reference - * @param ref a reference of @Nullable type, that is non-null at run time - * @return the argument, casted to have the type qualifier @NonNull - */ - public static @EnsuresNonNull("#1") @NonNull T castNonNull( - @Nullable T ref) { - assert ref != null : "Misuse of castNonNull: called with a null argument"; - return (@NonNull T) ref; - } - - /** - * Suppress warnings from the Nullness Checker, with a custom error message. See {@link - * #castNonNull(Object)} for documentation. - * - * @see #castNonNull(Object) - * @param the type of the reference - * @param ref a reference of @Nullable type, that is non-null at run time - * @param message text to include if this method is misused - * @return the argument, casted to have the type qualifier @NonNull - */ - public static @EnsuresNonNull("#1") @NonNull T castNonNull( - @Nullable T ref, String message) { - assert ref != null : "Misuse of castNonNull: called with a null argument: " + message; - return (@NonNull T) ref; - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [] castNonNullDeep(T @Nullable [] arr) { - return (@NonNull T[]) castNonNullArray(arr, null); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @param message text to include if this method is misused - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [] castNonNullDeep(T @Nullable [] arr, String message) { - return (@NonNull T[]) castNonNullArray(arr, message); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type of the component type of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][] castNonNullDeep(T @Nullable [] @Nullable [] arr) { - return (@NonNull T[][]) castNonNullArray(arr, null); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type of the component type of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @param message text to include if this method is misused - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][] castNonNullDeep(T @Nullable [] @Nullable [] arr, String message) { - return (@NonNull T[][]) castNonNullArray(arr, message); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type (three levels in) of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][][] castNonNullDeep(T @Nullable [] @Nullable [] @Nullable [] arr) { - return (@NonNull T[][][]) castNonNullArray(arr, null); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type (three levels in) of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @param message text to include if this method is misused - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][][] castNonNullDeep( - T @Nullable [] @Nullable [] @Nullable [] arr, String message) { - return (@NonNull T[][][]) castNonNullArray(arr, message); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][][][] castNonNullDeep( - T @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr) { - return (@NonNull T[][][][]) castNonNullArray(arr, null); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type (four levels in) of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @param message text to include if this method is misused - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][][][] castNonNullDeep( - T @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr, String message) { - return (@NonNull T[][][][]) castNonNullArray(arr, message); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type (four levels in) of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][][][][] castNonNullDeep( - T @Nullable [] @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr) { - return (@NonNull T[][][][][]) castNonNullArray(arr, null); - } - - /** - * Like castNonNull, but whereas that method only checks and casts the reference itself, this - * traverses all levels of the argument array. The array is recursively checked to ensure that - * all elements at every array level are non-null. - * - * @param the component type (five levels in) of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @param message text to include if this method is misused - * @return the argument, casted to have the type qualifier @NonNull at all levels - * @see #castNonNull(Object) - */ - public static @EnsuresNonNull("#1") - @NonNull T @NonNull [][][][][] castNonNullDeep( - T @Nullable [] @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr, - String message) { - return (@NonNull T[][][][][]) castNonNullArray(arr, message); - } - - /** - * The implementation of castNonNullDeep. - * - * @param the component type (five levels in) of the array - * @param arr an array all of whose elements, and their elements recursively, are non-null at - * run time - * @param message text to include if there is a non-null value, or null to use uncustomized - * message - * @return the argument, casted to have the type qualifier @NonNull at all levels - */ - private static @NonNull T @NonNull [] castNonNullArray( - T @Nullable [] arr, @Nullable String message) { - assert arr != null - : "Misuse of castNonNullArray: called with a null array argument" - + ((message == null) ? "" : (": " + message)); - for (int i = 0; i < arr.length; ++i) { - assert arr[i] != null - : "Misuse of castNonNull: called with a null array element" - + ((message == null) ? "" : (": " + message)); - checkIfArray(arr[i], message); - } - return (@NonNull T[]) arr; - } - - /** - * If the argument is an array, requires it to be non-null at all levels. - * - * @param ref a value; if an array, all of its elements, and their elements recursively, are - * non-null at run time - * @param message text to include if there is a non-null value, or null to use uncustomized - * message - */ - private static void checkIfArray(@NonNull Object ref, @Nullable String message) { - assert ref != null - : "Misuse of checkIfArray: called with a null argument" - + ((message == null) ? "" : (": " + message)); - Class comp = ref.getClass().getComponentType(); - if (comp != null) { - // comp is non-null for arrays, otherwise null. - if (comp.isPrimitive()) { - // Nothing to do for arrays of primitive type: primitives are - // never null. - } else { - castNonNullArray((Object[]) ref, message); - } - } - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/nullness/Opt.java b/checker-qual/src/main/java/org/checkerframework/checker/nullness/Opt.java deleted file mode 100644 index 36a93442c0c..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/nullness/Opt.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.checkerframework.checker.nullness; - -import java.util.NoSuchElementException; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.function.Supplier; -import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.framework.qual.AnnotatedFor; - -/** - * Utility class for the Nullness Checker, providing every method in {@link java.util.Optional}, but - * written for possibly-null references rather than for the {@code Optional} type. - * - *

To avoid the need to write the {@code Opt} class name at invocation sites, do: - * - *

import static org.checkerframework.checker.nullness.Opt.orElse;
- * - * or - * - *
import static org.checkerframework.checker.nullness.Opt.*;
- * - *

Runtime Dependency: If you use this class, you must distribute (or link to) {@code - * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own - * project. - * - * @see java.util.Optional - */ -@AnnotatedFor("nullness") -public final class Opt { - - /** The Opt class cannot be instantiated. */ - private Opt() { - throw new AssertionError("shouldn't be instantiated"); - } - - /** - * If primary is non-null, returns it, otherwise throws NoSuchElementException. - * - * @param the type of the argument - * @param primary a non-null value to return - * @return {@code primary} if it is non-null - * @throws NoSuchElementException if primary is null - * @see java.util.Optional#get() - */ - // `primary` is @NonNull; otherwise, the method could throw an exception. - public static T get(T primary) { - if (primary == null) { - throw new NoSuchElementException("No value present"); - } - return primary; - } - - /** - * Returns true if primary is non-null, false if primary is null. - * - * @see java.util.Optional#isPresent() - */ - @EnsuresNonNullIf(expression = "#1", result = true) - public static boolean isPresent(@Nullable Object primary) { - return primary != null; - } - - /** - * If primary is non-null, invoke the specified consumer with the value, otherwise do nothing. - * - * @see java.util.Optional#ifPresent(Consumer) - */ - public static void ifPresent(T primary, Consumer<@NonNull ? super @NonNull T> consumer) { - if (primary != null) { - consumer.accept(primary); - } - } - - /** - * If primary is non-null, and its value matches the given predicate, return the value. If - * primary is null or its non-null value does not match the predicate, return null. - * - * @see java.util.Optional#filter(Predicate) - */ - public static @Nullable T filter( - T primary, Predicate<@NonNull ? super @NonNull T> predicate) { - if (primary == null) { - return null; - } else { - return predicate.test(primary) ? primary : null; - } - } - - /** - * If primary is non-null, apply the provided mapping function to it and return the result. If - * primary is null, return null. - * - * @see java.util.Optional#map(Function) - */ - public static @Nullable U map( - T primary, Function<@NonNull ? super @NonNull T, ? extends U> mapper) { - if (primary == null) { - return null; - } else { - return mapper.apply(primary); - } - } - - // flatMap would have the same signature and implementation as map - - /** - * Return primary if it is non-null. If primary is null, return other. - * - * @see java.util.Optional#orElse(Object) - */ - public static @NonNull T orElse(T primary, @NonNull T other) { - return primary != null ? primary : other; - } - - /** - * Return primary if it is non-null. If primary is null, invoke {@code other} and return the - * result of that invocation. - * - * @see java.util.Optional#orElseGet(Supplier) - */ - public static @NonNull T orElseGet(T primary, Supplier other) { - return primary != null ? primary : other.get(); - } - - /** - * Return primary if it is non-null. If primary is null, throw an exception to be created by the - * provided supplier. - * - * @see java.util.Optional#orElseThrow(Supplier) - */ - // `primary` is @NonNull; otherwise, the method could throw an exception. - public static T orElseThrow( - T primary, Supplier exceptionSupplier) throws X { - if (primary != null) { - return primary; - } else { - throw exceptionSupplier.get(); - } - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/regex/RegexUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/regex/RegexUtil.java deleted file mode 100644 index 4709fadcc5d..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/regex/RegexUtil.java +++ /dev/null @@ -1,333 +0,0 @@ -// This class should be kept in sync with org.plumelib.util.RegexUtil in the plume-util project. - -package org.checkerframework.checker.regex; - -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; -import org.checkerframework.checker.index.qual.GTENegativeOne; -import org.checkerframework.checker.lock.qual.GuardSatisfied; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.checker.regex.qual.Regex; -import org.checkerframework.dataflow.qual.Pure; -import org.checkerframework.dataflow.qual.SideEffectFree; -import org.checkerframework.framework.qual.AnnotatedFor; -import org.checkerframework.framework.qual.EnsuresQualifierIf; - -/** - * Utility methods for regular expressions, most notably for testing whether a string is a regular - * expression. - * - *

For an example of intended use, see section Testing whether a string is a - * regular expression in the Checker Framework manual. - * - *

Runtime Dependency: If you use this class, you must distribute (or link to) {@code - * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own - * project. - */ -@AnnotatedFor("nullness") -public final class RegexUtil { - - /** This class is a collection of methods; it does not represent anything. */ - private RegexUtil() { - throw new Error("do not instantiate"); - } - - /** - * A checked version of {@link PatternSyntaxException}. - * - *

This exception is useful when an illegal regex is detected but the contextual information - * to report a helpful error message is not available at the current depth in the call stack. By - * using a checked PatternSyntaxException the error must be handled up the call stack where a - * better error message can be reported. - * - *

Typical usage is: - * - *

-     * void myMethod(...) throws CheckedPatternSyntaxException {
-     *   ...
-     *   if (! isRegex(myString)) {
-     *     throw new CheckedPatternSyntaxException(...);
-     *   }
-     *   ... Pattern.compile(myString) ...
-     * 
- * - * Simply calling {@code Pattern.compile} would have a similar effect, in that {@code - * PatternSyntaxException} would be thrown at run time if {@code myString} is not a regular - * expression. There are two problems with such an approach. First, a client of {@code myMethod} - * might forget to handle the exception, since {@code PatternSyntaxException} is not checked. - * Also, the Regex Checker would issue a warning about the call to {@code Pattern.compile} that - * might throw an exception. The above usage pattern avoids both problems. - * - * @see PatternSyntaxException - */ - public static class CheckedPatternSyntaxException extends Exception { - - private static final long serialVersionUID = 6266881831979001480L; - - /** The PatternSyntaxException that this is a wrapper around. */ - private final PatternSyntaxException pse; - - /** - * Constructs a new CheckedPatternSyntaxException equivalent to the given {@link - * PatternSyntaxException}. - * - *

Consider calling this constructor with the result of {@link RegexUtil#regexError}. - * - * @param pse the PatternSyntaxException to be wrapped - */ - public CheckedPatternSyntaxException(PatternSyntaxException pse) { - this.pse = pse; - } - - /** - * Constructs a new CheckedPatternSyntaxException. - * - * @param desc a description of the error - * @param regex the erroneous pattern - * @param index the approximate index in the pattern of the error, or {@code -1} if the - * index is not known - */ - public CheckedPatternSyntaxException(String desc, String regex, @GTENegativeOne int index) { - this(new PatternSyntaxException(desc, regex, index)); - } - - /** - * Retrieves the description of the error. - * - * @return the description of the error - */ - public String getDescription() { - return pse.getDescription(); - } - - /** - * Retrieves the error index. - * - * @return the approximate index in the pattern of the error, or {@code -1} if the index is - * not known - */ - public int getIndex() { - return pse.getIndex(); - } - - /** - * Returns a multi-line string containing the description of the syntax error and its index, - * the erroneous regular-expression pattern, and a visual indication of the error index - * within the pattern. - * - * @return the full detail message - */ - @Override - @Pure - public String getMessage(@GuardSatisfied CheckedPatternSyntaxException this) { - return pse.getMessage(); - } - - /** - * Retrieves the erroneous regular-expression pattern. - * - * @return the erroneous pattern - */ - public String getPattern() { - return pse.getPattern(); - } - } - - /** - * Returns true if the argument is a syntactically valid regular expression. - * - * @param s string to check for being a regular expression - * @return true iff s is a regular expression - */ - @Pure - @EnsuresQualifierIf(result = true, expression = "#1", qualifier = Regex.class) - public static boolean isRegex(String s) { - return isRegex(s, 0); - } - - /** - * Returns true if the argument is a syntactically valid regular expression with at least the - * given number of groups. - * - * @param s string to check for being a regular expression - * @param groups number of groups expected - * @return true iff s is a regular expression with {@code groups} groups - */ - @SuppressWarnings("regex") // RegexUtil; for purity, catches an exception - @Pure - // @EnsuresQualifierIf annotation is extraneous because this method is special-cased - // in RegexTransfer. - @EnsuresQualifierIf(result = true, expression = "#1", qualifier = Regex.class) - public static boolean isRegex(String s, int groups) { - Pattern p; - try { - p = Pattern.compile(s); - } catch (PatternSyntaxException e) { - return false; - } - return getGroupCount(p) >= groups; - } - - /** - * Returns true if the argument is a syntactically valid regular expression. - * - * @param c char to check for being a regular expression - * @return true iff c is a regular expression - */ - @SuppressWarnings({ - "regex", "lock" - }) // RegexUtil; temp value used in pure method is equal up to equals but not up to == - @Pure - @EnsuresQualifierIf(result = true, expression = "#1", qualifier = Regex.class) - public static boolean isRegex(final char c) { - return isRegex(Character.toString(c)); - } - - /** - * Returns null if the argument is a syntactically valid regular expression. Otherwise returns a - * string describing why the argument is not a regex. - * - * @param s string to check for being a regular expression - * @return null, or a string describing why the argument is not a regex - */ - @SideEffectFree - public static @Nullable String regexError(String s) { - return regexError(s, 0); - } - - /** - * Returns null if the argument is a syntactically valid regular expression with at least the - * given number of groups. Otherwise returns a string describing why the argument is not a - * regex. - * - * @param s string to check for being a regular expression - * @param groups number of groups expected - * @return null, or a string describing why the argument is not a regex - */ - @SuppressWarnings({"regex", "not.sef"}) // RegexUtil; - @SideEffectFree - public static @Nullable String regexError(String s, int groups) { - try { - Pattern p = Pattern.compile(s); - int actualGroups = getGroupCount(p); - if (actualGroups < groups) { - return regexErrorMessage(s, groups, actualGroups); - } - } catch (PatternSyntaxException e) { - return e.getMessage(); - } - return null; - } - - /** - * Returns null if the argument is a syntactically valid regular expression. Otherwise returns a - * PatternSyntaxException describing why the argument is not a regex. - * - * @param s string to check for being a regular expression - * @return null, or a PatternSyntaxException describing why the argument is not a regex - */ - @SideEffectFree - public static @Nullable PatternSyntaxException regexException(String s) { - return regexException(s, 0); - } - - /** - * Returns null if the argument is a syntactically valid regular expression with at least the - * given number of groups. Otherwise returns a PatternSyntaxException describing why the - * argument is not a regex. - * - * @param s string to check for being a regular expression - * @param groups number of groups expected - * @return null, or a PatternSyntaxException describing why the argument is not a regex - */ - @SuppressWarnings("regex") // RegexUtil - @SideEffectFree - public static @Nullable PatternSyntaxException regexException(String s, int groups) { - try { - Pattern p = Pattern.compile(s); - int actualGroups = getGroupCount(p); - if (actualGroups < groups) { - return new PatternSyntaxException( - regexErrorMessage(s, groups, actualGroups), s, -1); - } - } catch (PatternSyntaxException pse) { - return pse; - } - return null; - } - - /** - * Returns the argument as a {@code @Regex String} if it is a regex, otherwise throws an error. - * The purpose of this method is to suppress Regex Checker warnings. It should be very rarely - * needed. - * - * @param s string to check for being a regular expression - * @return its argument - * @throws Error if argument is not a regex - */ - @SideEffectFree - // The return type annotation is a conservative bound. - public static @Regex String asRegex(String s) { - return asRegex(s, 0); - } - - /** - * Returns the argument as a {@code @Regex(groups) String} if it is a regex with at least the - * given number of groups, otherwise throws an error. The purpose of this method is to suppress - * Regex Checker warnings. It should be very rarely needed. - * - * @param s string to check for being a regular expression - * @param groups number of groups expected - * @return its argument - * @throws Error if argument is not a regex - */ - @SuppressWarnings("regex") // RegexUtil - @SideEffectFree - // The return type annotation is irrelevant; it is special-cased by - // RegexAnnotatedTypeFactory. - public static @Regex String asRegex(String s, int groups) { - try { - Pattern p = Pattern.compile(s); - int actualGroups = getGroupCount(p); - if (actualGroups < groups) { - throw new Error(regexErrorMessage(s, groups, actualGroups)); - } - return s; - } catch (PatternSyntaxException e) { - throw new Error(e); - } - } - - /** - * Generates an error message for s when expectedGroups are needed, but s only has actualGroups. - * - * @param s string to check for being a regular expression - * @param expectedGroups the number of needed capturing groups - * @param actualGroups the number of groups that {@code s} has - * @return an error message for s when expectedGroups groups are needed, but s only has - * actualGroups groups - */ - @SideEffectFree - private static String regexErrorMessage(String s, int expectedGroups, int actualGroups) { - return "regex \"" - + s - + "\" has " - + actualGroups - + " groups, but " - + expectedGroups - + " groups are needed."; - } - - /** - * Return the count of groups in the argument. - * - * @param p pattern whose groups to count - * @return the count of groups in the argument - */ - @SuppressWarnings("lock") // does not depend on object identity - @Pure - private static int getGroupCount(Pattern p) { - return p.matcher("").groupCount(); - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java deleted file mode 100644 index 948ab11dcbd..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java +++ /dev/null @@ -1,523 +0,0 @@ -package org.checkerframework.checker.signedness; - -import java.io.IOException; -import java.io.RandomAccessFile; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import org.checkerframework.checker.signedness.qual.Unsigned; -import org.checkerframework.framework.qual.AnnotatedFor; - -/** - * Provides static utility methods for unsigned values. Most of these re-implement functionality - * that was introduced in JDK 8, making it available in earlier versions of Java. Others provide new - * functionality. {@link SignednessUtilExtra} has more methods that reference packages that Android - * does not provide. - * - * @checker_framework.manual #signedness-utilities Utility routines for manipulating unsigned values - */ -@AnnotatedFor("nullness") -public final class SignednessUtil { - - private SignednessUtil() { - throw new Error("Do not instantiate"); - } - - /** - * Wraps an unsigned byte array into a ByteBuffer. This method is a wrapper around {@link - * java.nio.ByteBuffer#wrap(byte[]) wrap(byte[])}, but assumes that the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer wrapUnsigned(@Unsigned byte[] array) { - return ByteBuffer.wrap(array); - } - - /** - * Wraps an unsigned byte array into a ByteBuffer. This method is a wrapper around {@link - * java.nio.ByteBuffer#wrap(byte[], int, int) wrap(byte[], int, int)}, but assumes that the - * input should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer wrapUnsigned(@Unsigned byte[] array, int offset, int length) { - return ByteBuffer.wrap(array, offset, length); - } - - /** - * Gets an unsigned int from the ByteBuffer b. This method is a wrapper around {@link - * java.nio.ByteBuffer#getInt() getInt()}, but assumes that the result should be interpreted as - * unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned int getUnsignedInt(ByteBuffer b) { - return b.getInt(); - } - - /** - * Gets an unsigned short from the ByteBuffer b. This method is a wrapper around {@link - * java.nio.ByteBuffer#getShort() getShort()}, but assumes that the result should be interpreted - * as unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned short getUnsignedShort(ByteBuffer b) { - return b.getShort(); - } - - /** - * Gets an unsigned byte from the ByteBuffer b. This method is a wrapper around {@link - * java.nio.ByteBuffer#get() get()}, but assumes that the result should be interpreted as - * unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned byte getUnsigned(ByteBuffer b) { - return b.get(); - } - - /** - * Gets an unsigned byte from the ByteBuffer b at i. This method is a wrapper around {@link - * java.nio.ByteBuffer#get(int) get(int)}, but assumes that the result should be interpreted as - * unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned byte getUnsigned(ByteBuffer b, int i) { - return b.get(i); - } - - /** - * Populates an unsigned byte array from the ByteBuffer b at i with l bytes. This method is a - * wrapper around {@link java.nio.ByteBuffer#get(byte[] bs, int, int) get(byte[], int, int)}, - * but assumes that the bytes should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer getUnsigned(ByteBuffer b, byte[] bs, int i, int l) { - return b.get(bs, i, l); - } - - /** - * Places an unsigned byte into the ByteBuffer b. This method is a wrapper around {@link - * java.nio.ByteBuffer#put(byte) put(byte)}, but assumes that the input should be interpreted as - * unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsigned(ByteBuffer b, @Unsigned byte ubyte) { - return b.put(ubyte); - } - - /** - * Places an unsigned byte into the ByteBuffer b at i. This method is a wrapper around {@link - * java.nio.ByteBuffer#put(int, byte) put(int, byte)}, but assumes that the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsigned(ByteBuffer b, int i, @Unsigned byte ubyte) { - return b.put(i, ubyte); - } - - /** - * Places an unsigned int into the IntBuffer b. This method is a wrapper around {@link - * java.nio.IntBuffer#put(int) put(int)}, but assumes that the input should be interpreted as - * unsigned. - */ - @SuppressWarnings("signedness") - public static IntBuffer putUnsigned(IntBuffer b, @Unsigned int uint) { - return b.put(uint); - } - - /** - * Places an unsigned int into the IntBuffer b at i. This method is a wrapper around {@link - * java.nio.IntBuffer#put(int, int) put(int, int)}, but assumes that the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static IntBuffer putUnsigned(IntBuffer b, int i, @Unsigned int uint) { - return b.put(i, uint); - } - - /** - * Places an unsigned int array into the IntBuffer b. This method is a wrapper around {@link - * java.nio.IntBuffer#put(int[]) put(int[])}, but assumes that the input should be interpreted - * as unsigned. - */ - @SuppressWarnings("signedness") - public static IntBuffer putUnsigned(IntBuffer b, @Unsigned int[] uints) { - return b.put(uints); - } - - /** - * Places an unsigned int array into the IntBuffer b at i with length l. This method is a - * wrapper around {@link java.nio.IntBuffer#put(int[], int, int) put(int[], int, int)}, but - * assumes that the input should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static IntBuffer putUnsigned(IntBuffer b, @Unsigned int[] uints, int i, int l) { - return b.put(uints, i, l); - } - - /** - * Gets an unsigned int from the IntBuffer b at i. This method is a wrapper around {@link - * java.nio.IntBuffer#get(int) get(int)}, but assumes that the output should be interpreted as - * unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned int getUnsigned(IntBuffer b, int i) { - return b.get(i); - } - - /** - * Places an unsigned short into the ByteBuffer b. This method is a wrapper around {@link - * java.nio.ByteBuffer#putShort(short) putShort(short)}, but assumes that the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsignedShort(ByteBuffer b, @Unsigned short ushort) { - return b.putShort(ushort); - } - - /** - * Places an unsigned short into the ByteBuffer b at i. This method is a wrapper around {@link - * java.nio.ByteBuffer#putShort(int, short) putShort(int, short)}, but assumes that the input - * should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsignedShort(ByteBuffer b, int i, @Unsigned short ushort) { - return b.putShort(i, ushort); - } - - /** - * Places an unsigned int into the ByteBuffer b. This method is a wrapper around {@link - * java.nio.ByteBuffer#putInt(int) putInt(int)}, but assumes that the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsignedInt(ByteBuffer b, @Unsigned int uint) { - return b.putInt(uint); - } - - /** - * Places an unsigned int into the ByteBuffer b at i. This method is a wrapper around {@link - * java.nio.ByteBuffer#putInt(int, int) putInt(int, int)}, but assumes that the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsignedInt(ByteBuffer b, int i, @Unsigned int uint) { - return b.putInt(i, uint); - } - - /** - * Places an unsigned long into the ByteBuffer b at i. This method is a wrapper around {@link - * java.nio.ByteBuffer#putLong(int, long) putLong(int, long)}, but assumes that the input should - * be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static ByteBuffer putUnsignedLong(ByteBuffer b, int i, @Unsigned long ulong) { - return b.putLong(i, ulong); - } - - /** - * Reads an unsigned char from the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#readChar() readChar()}, but assumes the output should be interpreted - * as unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned char readUnsignedChar(RandomAccessFile f) throws IOException { - return f.readChar(); - } - - /** - * Reads an unsigned int from the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#readInt() readInt()}, but assumes the output should be interpreted - * as unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned int readUnsignedInt(RandomAccessFile f) throws IOException { - return f.readInt(); - } - - /** - * Reads an unsigned long from the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#readLong() readLong()}, but assumes the output should be interpreted - * as unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned long readUnsignedLong(RandomAccessFile f) throws IOException { - return f.readLong(); - } - - /** - * Reads up to {@code len} bytes of data from this file into an unsigned array of bytes. This - * method is a wrapper around {@link java.io.RandomAccessFile#read(byte[], int, int) - * read(byte[], int, int)}, but assumes the output should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static int readUnsigned(RandomAccessFile f, @Unsigned byte b[], int off, int len) - throws IOException { - return f.read(b, off, len); - } - - /** - * Reads a file fully into an unsigned byte array. This method is a wrapper around {@link - * java.io.RandomAccessFile#readFully(byte[]) readFully(byte[])}, but assumes the output should - * be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void readFullyUnsigned(RandomAccessFile f, @Unsigned byte b[]) - throws IOException { - f.readFully(b); - } - - /** - * Writes len unsigned bytes to the RandomAccessFile f at offset off. This method is a wrapper - * around {@link java.io.RandomAccessFile#write(byte[], int, int) write(byte[], int, int)}, but - * assumes the input should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void writeUnsigned(RandomAccessFile f, @Unsigned byte[] bs, int off, int len) - throws IOException { - f.write(bs, off, len); - } - - /** - * Writes an unsigned byte to the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#writeByte(int) writeByte(int)}, but assumes the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void writeUnsignedByte(RandomAccessFile f, @Unsigned byte b) throws IOException { - f.writeByte(Byte.toUnsignedInt(b)); - } - - /** - * Writes an unsigned char to the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#writeChar(int) writeChar(int)}, but assumes the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void writeUnsignedChar(RandomAccessFile f, @Unsigned char c) throws IOException { - f.writeChar(toUnsignedInt(c)); - } - - /** - * Writes an unsigned short to the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#writeShort(int) writeShort(int)}, but assumes the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void writeUnsignedShort(RandomAccessFile f, @Unsigned short s) - throws IOException { - f.writeShort(Short.toUnsignedInt(s)); - } - - /** - * Writes an unsigned byte to the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#writeInt(int) writeInt(int)}, but assumes the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void writeUnsignedInt(RandomAccessFile f, @Unsigned int i) throws IOException { - f.writeInt(i); - } - - /** - * Writes an unsigned byte to the RandomAccessFile f. This method is a wrapper around {@link - * java.io.RandomAccessFile#writeLong(long) writeLong(long)}, but assumes the input should be - * interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void writeUnsignedLong(RandomAccessFile f, @Unsigned long l) throws IOException { - f.writeLong(l); - } - - /** - * Gets an array of unsigned bytes from the ByteBuffer b and stores them in the array bs. This - * method is a wrapper around {@link java.nio.ByteBuffer#get(byte[]) get(byte[])}, but assumes - * that the array of bytes should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void getUnsigned(ByteBuffer b, @Unsigned byte[] bs) { - b.get(bs); - } - - /** - * Compares two unsigned shorts x and y. - * - * @return a negative number iff x {@literal <} y, a positive number iff x {@literal >} y, and - * zero iff x == y. - */ - @SuppressWarnings("signedness") - public static int compareUnsigned(@Unsigned short x, @Unsigned short y) { - return Integer.compareUnsigned(Short.toUnsignedInt(x), Short.toUnsignedInt(y)); - } - - /** - * Compares two unsigned bytes x and y. - * - * @return a negative number iff x {@literal <} y, a positive number iff x {@literal >} y, and - * zero iff x == y. - */ - @SuppressWarnings("signedness") - public static int compareUnsigned(@Unsigned byte x, @Unsigned byte y) { - return Integer.compareUnsigned(Byte.toUnsignedInt(x), Byte.toUnsignedInt(y)); - } - - /** Produces a string representation of the unsigned short s. */ - @SuppressWarnings("signedness") - public static String toUnsignedString(@Unsigned short s) { - return Long.toString(Short.toUnsignedLong(s)); - } - - /** Produces a string representation of the unsigned short s in base radix. */ - @SuppressWarnings("signedness") - public static String toUnsignedString(@Unsigned short s, int radix) { - return Integer.toUnsignedString(Short.toUnsignedInt(s), radix); - } - - /** Produces a string representation of the unsigned byte b. */ - @SuppressWarnings("signedness") - public static String toUnsignedString(@Unsigned byte b) { - return Integer.toUnsignedString(Byte.toUnsignedInt(b)); - } - - /** Produces a string representation of the unsigned byte b in base radix. */ - @SuppressWarnings("signedness") - public static String toUnsignedString(@Unsigned byte b, int radix) { - return Integer.toUnsignedString(Byte.toUnsignedInt(b), radix); - } - - /* - * Creates a BigInteger representing the same value as unsigned long. - * - * This is a reimplementation of Java 8's - * {@link Long.toUnsignedBigInteger(long)}. - */ - @SuppressWarnings("signedness") - private static @Unsigned BigInteger toUnsignedBigInteger(@Unsigned long l) { - // Java 8 version: return Long.toUnsignedBigInteger(l); - if (l >= 0L) { - return BigInteger.valueOf(l); - } else { - int upper = (int) (l >>> 32); - int lower = (int) l; - - // return (upper << 32) + lower - return BigInteger.valueOf(Integer.toUnsignedLong(upper)) - .shiftLeft(32) - .add(BigInteger.valueOf(Integer.toUnsignedLong(lower))); - } - } - - /** Returns an unsigned short representing the same value as an unsigned byte. */ - public static @Unsigned short toUnsignedShort(@Unsigned byte b) { - return (short) (((int) b) & 0xff); - } - - /** Returns an unsigned long representing the same value as an unsigned char. */ - public static @Unsigned long toUnsignedLong(@Unsigned char c) { - return ((long) c) & 0xffL; - } - - /** Returns an unsigned int representing the same value as an unsigned char. */ - public static @Unsigned int toUnsignedInt(@Unsigned char c) { - return ((int) c) & 0xff; - } - - /** Returns an unsigned short representing the same value as an unsigned char. */ - public static @Unsigned short toUnsignedShort(@Unsigned char c) { - return (short) (((int) c) & 0xff); - } - - /** Returns a float representing the same value as the unsigned byte. */ - public static float toFloat(@Unsigned byte b) { - return toUnsignedBigInteger(Byte.toUnsignedLong(b)).floatValue(); - } - - /** Returns a float representing the same value as the unsigned short. */ - public static float toFloat(@Unsigned short s) { - return toUnsignedBigInteger(Short.toUnsignedLong(s)).floatValue(); - } - - /** Returns a float representing the same value as the unsigned int. */ - public static float toFloat(@Unsigned int i) { - return toUnsignedBigInteger(Integer.toUnsignedLong(i)).floatValue(); - } - - /** Returns a float representing the same value as the unsigned long. */ - public static float toFloat(@Unsigned long l) { - return toUnsignedBigInteger(l).floatValue(); - } - - /** Returns a double representing the same value as the unsigned byte. */ - public static double toDouble(@Unsigned byte b) { - return toUnsignedBigInteger(Byte.toUnsignedLong(b)).doubleValue(); - } - - /** Returns a double representing the same value as the unsigned short. */ - public static double toDouble(@Unsigned short s) { - return toUnsignedBigInteger(Short.toUnsignedLong(s)).doubleValue(); - } - - /** Returns a double representing the same value as the unsigned int. */ - public static double toDouble(@Unsigned int i) { - return toUnsignedBigInteger(Integer.toUnsignedLong(i)).doubleValue(); - } - - /** Returns a double representing the same value as the unsigned long. */ - public static double toDouble(@Unsigned long l) { - return toUnsignedBigInteger(l).doubleValue(); - } - - /** Returns an unsigned byte representing the same value as the float. */ - @SuppressWarnings("signedness") - public static @Unsigned byte byteFromFloat(float f) { - assert f >= 0; - return (byte) f; - } - - /** Returns an unsigned short representing the same value as the float. */ - @SuppressWarnings("signedness") - public static @Unsigned short shortFromFloat(float f) { - assert f >= 0; - return (short) f; - } - - /** Returns an unsigned int representing the same value as the float. */ - @SuppressWarnings("signedness") - public static @Unsigned int intFromFloat(float f) { - assert f >= 0; - return (int) f; - } - - /** Returns an unsigned long representing the same value as the float. */ - @SuppressWarnings("signedness") - public static @Unsigned long longFromFloat(float f) { - assert f >= 0; - return (long) f; - } - - /** Returns an unsigned byte representing the same value as the double. */ - @SuppressWarnings("signedness") - public static @Unsigned byte byteFromDouble(double d) { - assert d >= 0; - return (byte) d; - } - - /** Returns an unsigned short representing the same value as the double. */ - @SuppressWarnings("signedness") - public static @Unsigned short shortFromDouble(double d) { - assert d >= 0; - return (short) d; - } - - /** Returns an unsigned int representing the same value as the double. */ - @SuppressWarnings("signedness") - public static @Unsigned int intFromDouble(double d) { - assert d >= 0; - return (int) d; - } - - /** Returns an unsigned long representing the same value as the double. */ - @SuppressWarnings("signedness") - public static @Unsigned long longFromDouble(double d) { - assert d >= 0; - return (long) d; - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java b/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java deleted file mode 100644 index 6b38b1d5202..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.checkerframework.checker.signedness; - -import java.awt.Dimension; -import java.awt.image.BufferedImage; -import org.checkerframework.checker.signedness.qual.Unsigned; -import org.checkerframework.framework.qual.AnnotatedFor; - -/** - * Provides more static utility methods for unsigned values. These methods use Java packages not - * included in Android. {@link SignednessUtil} has more methods. - * - * @checker_framework.manual #signedness-utilities Utility routines for manipulating unsigned values - */ -@AnnotatedFor("nullness") -public class SignednessUtilExtra { - /** Do not instantiate this class. */ - private SignednessUtilExtra() { - throw new Error("Do not instantiate"); - } - - /** Gets the unsigned width of a {@code Dimension}. */ - @SuppressWarnings("signedness") - public static @Unsigned int dimensionUnsignedWidth(Dimension dim) { - return dim.width; - } - - /** Gets the unsigned height of a {@code Dimension}. */ - @SuppressWarnings("signedness") - public static @Unsigned int dimensionUnsignedHeight(Dimension dim) { - return dim.height; - } - - /** - * Sets rgb of BufferedImage b given unsigned ints. This method is a wrapper around {@link - * java.awt.image.BufferedImage#setRGB(int, int, int, int, int[], int, int) setRGB(int, int, - * int, int, int[], int, int)}, but assumes that the input should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static void setUnsignedRGB( - BufferedImage b, - int startX, - int startY, - int w, - int h, - @Unsigned int[] rgbArray, - int offset, - int scansize) { - b.setRGB(startX, startY, w, h, rgbArray, offset, scansize); - } - - /** - * Gets rgb of BufferedImage b as unsigned ints. This method is a wrapper around {@link - * java.awt.image.BufferedImage#getRGB(int, int, int, int, int[], int, int) getRGB(int, int, - * int, int, int[], int, int)}, but assumes that the output should be interpreted as unsigned. - */ - @SuppressWarnings("signedness") - public static @Unsigned int[] getUnsignedRGB( - BufferedImage b, - int startX, - int startY, - int w, - int h, - @Unsigned int[] rgbArray, - int offset, - int scansize) { - return b.getRGB(startX, startY, w, h, rgbArray, offset, scansize); - } -} diff --git a/checker-qual/src/main/java/org/checkerframework/checker/units/UnitsTools.java b/checker-qual/src/main/java/org/checkerframework/checker/units/UnitsTools.java deleted file mode 100644 index 56f128df42c..00000000000 --- a/checker-qual/src/main/java/org/checkerframework/checker/units/UnitsTools.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.checkerframework.checker.units; - -import org.checkerframework.checker.units.qual.A; -import org.checkerframework.checker.units.qual.C; -import org.checkerframework.checker.units.qual.K; -import org.checkerframework.checker.units.qual.cd; -import org.checkerframework.checker.units.qual.degrees; -import org.checkerframework.checker.units.qual.g; -import org.checkerframework.checker.units.qual.h; -import org.checkerframework.checker.units.qual.kg; -import org.checkerframework.checker.units.qual.km; -import org.checkerframework.checker.units.qual.km2; -import org.checkerframework.checker.units.qual.kmPERh; -import org.checkerframework.checker.units.qual.m; -import org.checkerframework.checker.units.qual.m2; -import org.checkerframework.checker.units.qual.mPERs; -import org.checkerframework.checker.units.qual.mPERs2; -import org.checkerframework.checker.units.qual.min; -import org.checkerframework.checker.units.qual.mm; -import org.checkerframework.checker.units.qual.mm2; -import org.checkerframework.checker.units.qual.mol; -import org.checkerframework.checker.units.qual.radians; -import org.checkerframework.checker.units.qual.s; -import org.checkerframework.framework.qual.AnnotatedFor; - -// TODO: add fromTo methods for all useful unit combinations. - -/** Utility methods to generate annotated types and to convert between them. */ -@SuppressWarnings({"units", "checkstyle:constantname"}) -@AnnotatedFor("nullness") -public class UnitsTools { - // Acceleration - public static final @mPERs2 int mPERs2 = 1; - - // Angle - public static final @radians double rad = 1; - public static final @degrees double deg = 1; - - public static @radians double toRadians(@degrees double angdeg) { - return Math.toRadians(angdeg); - } - - public static @degrees double toDegrees(@radians double angrad) { - return Math.toDegrees(angrad); - } - - // Area - public static final @mm2 int mm2 = 1; - public static final @m2 int m2 = 1; - public static final @km2 int km2 = 1; - - // Current - public static final @A int A = 1; - - // Luminance - public static final @cd int cd = 1; - - // Lengths - public static final @mm int mm = 1; - public static final @m int m = 1; - public static final @km int km = 1; - - public static @m int fromMilliMeterToMeter(@mm int mm) { - return mm / 1000; - } - - public static @mm int fromMeterToMilliMeter(@m int m) { - return m * 1000; - } - - public static @km int fromMeterToKiloMeter(@m int m) { - return m / 1000; - } - - public static @m int fromKiloMeterToMeter(@km int km) { - return km * 1000; - } - - // Mass - public static final @g int g = 1; - public static final @kg int kg = 1; - - public static @kg int fromGramToKiloGram(@g int g) { - return g / 1000; - } - - public static @g int fromKiloGramToGram(@kg int kg) { - return kg * 1000; - } - - // Speed - public static final @mPERs int mPERs = 1; - public static final @kmPERh int kmPERh = 1; - - public static @kmPERh double fromMeterPerSecondToKiloMeterPerHour(@mPERs double mps) { - return mps * 3.6d; - } - - public static @mPERs double fromKiloMeterPerHourToMeterPerSecond(@kmPERh double kmph) { - return kmph / 3.6d; - } - - // Substance - public static final @mol int mol = 1; - - // Temperature - public static final @K int K = 1; - public static final @C int C = 1; - - public static @C int fromKelvinToCelsius(@K int k) { - return k - (int) 273.15; - } - - public static @K int fromCelsiusToKelvin(@C int c) { - return c + (int) 273.15; - } - - // Time - public static final @s int s = 1; - public static final @min int min = 1; - public static final @h int h = 1; - - public static @min int fromSecondToMinute(@s int s) { - return s / 60; - } - - public static @s int fromMinuteToSecond(@min int min) { - return min * 60; - } - - public static @h int fromMinuteToHour(@min int min) { - return min / 60; - } - - public static @min int fromHourToMinute(@h int h) { - return h * 60; - } -} diff --git a/checker/build.gradle b/checker/build.gradle index 280dc3883db..a417dea7531 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -24,6 +24,7 @@ dependencies { exclude group: 'com.google.errorprone', module: 'javac' } implementation project(':checker-qual') + implementation project(':checker-util') // As of 2019-12-16, the version of reflection-util in the Annotation // File Utilities takes priority over this version, in the fat jar // file. :-( So update it and re-build it locally when updating this. From 6fe38281c13eade45813c66487248c46ab763411 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 10:32:05 -0800 Subject: [PATCH 11/27] Revert changes. --- .../framework/type/AnnotationClassLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java index 3664e8d4cfb..feb15c9363c 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java +++ b/framework/src/main/java/org/checkerframework/framework/type/AnnotationClassLoader.java @@ -93,7 +93,6 @@ public class AnnotationClassLoader { protected final ProcessingEnvironment processingEnv; /** The resource URL of the qual directory of a checker class. */ - @SuppressWarnings("UnusedVariable") private final URL resourceURL; /** The class loader used to load annotation classes. */ @@ -581,7 +580,7 @@ public final Set> getBundledAnnotationClasses() { * @param jar the JarFile containing the annotation class files * @return a set of fully qualified class names of the annotations */ - @SuppressWarnings({"JdkObsolete", "UnusedMethod"}) + @SuppressWarnings("JdkObsolete") private final Set<@BinaryName String> getBundledAnnotationNamesFromJar(final JarFile jar) { Set<@BinaryName String> annos = new LinkedHashSet<>(); @@ -800,6 +799,7 @@ public int compare(File o1, File o2) { protected final Set> loadAnnotationClasses( final @Nullable Set<@BinaryName String> annoNames) { Set> loadedClasses = new LinkedHashSet<>(); + if (annoNames != null && !annoNames.isEmpty()) { // loop through each class name & load the class for (String annoName : annoNames) { From 714fef7ad311da4c2decdf3a2f49fa6648203019 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 10:33:02 -0800 Subject: [PATCH 12/27] Tweak. --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 405d3256375..b9c8372f507 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,7 @@ include 'dataflow' include 'framework' include 'checker-qual' include 'checker-qual-android' +include 'checker-util' include 'framework-test' includeBuild ('../annotation-tools/annotation-file-utilities') { if (!file('../annotation-tools/annotation-file-utilities').exists()) { @@ -13,5 +14,4 @@ includeBuild ('../annotation-tools/annotation-file-utilities') { } } } -include 'checker-util' From d3d78e05e56c007decd93fad7cd4fbef167fd2ce Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 10:33:52 -0800 Subject: [PATCH 13/27] Tweak. --- settings.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index b9c8372f507..9f5adcc37e3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,4 +14,3 @@ includeBuild ('../annotation-tools/annotation-file-utilities') { } } } - From c2baf7e9f5006bcb67d55e28717ad3a2b83cdab0 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 10:34:47 -0800 Subject: [PATCH 14/27] Tweak. --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index aeb825f68f7..3019409fb86 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,7 +2,7 @@ Version 3.10.0, February 1, 2021 **User-visible changes:** -Move utility classes from checker-qual.jar to the new checker-util.jar. +Moved utility classes from checker-qual.jar to the new checker-util.jar. When supplying the `-Ainfer=...` command-line argument, you must also supply `-Awarns`. From 045a14d610c308c247b0227e26b8566b53506ca5 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 12:50:53 -0800 Subject: [PATCH 15/27] Adapt CheckerMain. --- checker/build.gradle | 9 ++++++++ .../framework/util/CheckerMain.java | 22 ++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/checker/build.gradle b/checker/build.gradle index a417dea7531..f2e5e4779bf 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -75,6 +75,15 @@ task copyJarsToDist(dependsOn: shadowJar, group: 'Build') { } } + copy { + from file(project(':checker-util').tasks.getByName("jar").archivePath) + into "${projectDir}/dist" + rename { String fileName -> + // remove version number on checker-util.jar + fileName.replace(fileName, "checker-util.jar") + } + } + copy { from configurations.javacJar into "${projectDir}/dist" diff --git a/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java b/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java index eb3be61fa18..b670911a431 100644 --- a/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java +++ b/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java @@ -67,6 +67,9 @@ public static void main(String[] args) { /** The path to checker-qual.jar. */ protected final File checkerQualJar; + /** The path to checker-util.jar. */ + protected final File checkerUtilJar; + private final List compilationBootclasspath; private final List runtimeClasspath; @@ -95,6 +98,12 @@ public static void main(String[] args) { */ public static final String CHECKER_QUAL_PATH_OPT = "-checkerQualJar"; + /** + * Option name for specifying an alternative checker-util.jar location. The accompanying value + * MUST be the path to the jar file (NOT the path to its encompassing directory) + */ + public static final String CHECKER_UTIL_PATH_OPT = "-checkerQualJar"; + /** * Option name for specifying an alternative javac.jar location. The accompanying value MUST be * the path to the jar file (NOT the path to its encompassing directory) @@ -123,6 +132,10 @@ public CheckerMain(final File checkerJar, final List args) { extractFileArg( CHECKER_QUAL_PATH_OPT, new File(searchPath, "checker-qual.jar"), args); + this.checkerUtilJar = + extractFileArg( + CHECKER_UTIL_PATH_OPT, new File(searchPath, "checker-util.jar"), args); + this.javacJar = extractFileArg(JAVAC_PATH_OPT, new File(searchPath, "javac.jar"), args); this.compilationBootclasspath = createCompilationBootclasspath(args); @@ -139,10 +152,9 @@ public CheckerMain(final File checkerJar, final List args) { /** Assert that required jars exist. */ protected void assertValidState() { if (SystemUtil.getJreVersion() < 9) { - assertFilesExist(Arrays.asList(javacJar, checkerJar, checkerQualJar)); + assertFilesExist(Arrays.asList(javacJar, checkerJar, checkerQualJar, checkerUtilJar)); } else { - // TODO: once the jdk11 jars exist, check for them. - assertFilesExist(Arrays.asList(checkerJar, checkerQualJar)); + assertFilesExist(Arrays.asList(checkerJar, checkerQualJar, checkerUtilJar)); } } @@ -175,6 +187,8 @@ protected List createCompilationBootclasspath(final List argsLis protected List createCpOpts(final List argsList) { final List extractedOpts = extractCpOpts(argsList); extractedOpts.add(0, this.checkerQualJar.getAbsolutePath()); + extractedOpts.add(0, this.checkerUtilJar.getAbsolutePath()); + return extractedOpts; } @@ -188,6 +202,8 @@ protected List createPpOpts(final List argsList) { extractedOpts.addAll(this.cpOpts); } extractedOpts.add(0, this.checkerJar.getAbsolutePath()); + extractedOpts.add(0, this.checkerUtilJar.getAbsolutePath()); + return extractedOpts; } From 058880ac446c8f849f9324f0bb9a75b355c8a195 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 13:44:58 -0800 Subject: [PATCH 16/27] Add Javadoc. --- .../java/org/checkerframework/framework/util/CheckerMain.java | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java b/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java index b670911a431..935b9aadee1 100644 --- a/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java +++ b/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java @@ -70,6 +70,7 @@ public static void main(String[] args) { /** The path to checker-util.jar. */ protected final File checkerUtilJar; + /** Compilation bootclasspath. */ private final List compilationBootclasspath; private final List runtimeClasspath; From 7513fb437e57d189e18e795fcc39fb5e8e88d064 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 15:06:42 -0800 Subject: [PATCH 17/27] Move util classes to util packages. --- .../checker/formatter/{ => util}/FormatUtil.java | 2 +- .../checker/i18nformatter/{ => util}/I18nFormatUtil.java | 2 +- .../checker/nullness/{ => util}/NullnessUtil.java | 2 +- .../org/checkerframework/checker/nullness/{ => util}/Opt.java | 2 +- .../checkerframework/checker/regex/{ => util}/RegexUtil.java | 2 +- .../checker/signedness/{ => util}/SignednessUtil.java | 2 +- .../checker/signedness/{ => util}/SignednessUtilExtra.java | 2 +- .../checkerframework/checker/units/{ => util}/UnitsTools.java | 2 +- .../checker/formatter/FormatterAnnotatedTypeFactory.java | 1 + .../checkerframework/checker/formatter/FormatterTransfer.java | 1 + .../i18nformatter/I18nFormatterAnnotatedTypeFactory.java | 1 + .../checker/i18nformatter/I18nFormatterTreeUtil.java | 1 + .../checker/regex/RegexAnnotatedTypeFactory.java | 1 + .../checkerframework/checker/test/junit/FormatterUnitTest.java | 2 +- .../checker/test/junit/I18nFormatterUnitTest.java | 2 +- 15 files changed, 15 insertions(+), 10 deletions(-) rename checker-util/src/main/java/org/checkerframework/checker/formatter/{ => util}/FormatUtil.java (99%) rename checker-util/src/main/java/org/checkerframework/checker/i18nformatter/{ => util}/I18nFormatUtil.java (99%) rename checker-util/src/main/java/org/checkerframework/checker/nullness/{ => util}/NullnessUtil.java (99%) rename checker-util/src/main/java/org/checkerframework/checker/nullness/{ => util}/Opt.java (98%) rename checker-util/src/main/java/org/checkerframework/checker/regex/{ => util}/RegexUtil.java (99%) rename checker-util/src/main/java/org/checkerframework/checker/signedness/{ => util}/SignednessUtil.java (99%) rename checker-util/src/main/java/org/checkerframework/checker/signedness/{ => util}/SignednessUtilExtra.java (97%) rename checker-util/src/main/java/org/checkerframework/checker/units/{ => util}/UnitsTools.java (98%) diff --git a/checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java b/checker-util/src/main/java/org/checkerframework/checker/formatter/util/FormatUtil.java similarity index 99% rename from checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java rename to checker-util/src/main/java/org/checkerframework/checker/formatter/util/FormatUtil.java index 608e07b5514..3e68432877c 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/formatter/FormatUtil.java +++ b/checker-util/src/main/java/org/checkerframework/checker/formatter/util/FormatUtil.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.formatter; +package org.checkerframework.checker.formatter.util; import java.util.ArrayList; import java.util.HashMap; diff --git a/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java b/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/util/I18nFormatUtil.java similarity index 99% rename from checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java rename to checker-util/src/main/java/org/checkerframework/checker/i18nformatter/util/I18nFormatUtil.java index 5e537931178..3c1923aa193 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatUtil.java +++ b/checker-util/src/main/java/org/checkerframework/checker/i18nformatter/util/I18nFormatUtil.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.i18nformatter; +package org.checkerframework.checker.i18nformatter.util; import java.text.ChoiceFormat; import java.text.DecimalFormat; diff --git a/checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java similarity index 99% rename from checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java rename to checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java index 127a55e80bc..66330a2a06a 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/nullness/NullnessUtil.java +++ b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.nullness; +package org.checkerframework.checker.nullness.util; import org.checkerframework.checker.nullness.qual.EnsuresNonNull; import org.checkerframework.checker.nullness.qual.NonNull; diff --git a/checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java similarity index 98% rename from checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java rename to checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java index 36a93442c0c..fab76be95ac 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/nullness/Opt.java +++ b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.nullness; +package org.checkerframework.checker.nullness.util; import java.util.NoSuchElementException; import java.util.function.Consumer; diff --git a/checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java b/checker-util/src/main/java/org/checkerframework/checker/regex/util/RegexUtil.java similarity index 99% rename from checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java rename to checker-util/src/main/java/org/checkerframework/checker/regex/util/RegexUtil.java index 4709fadcc5d..80f8175e1c1 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/regex/RegexUtil.java +++ b/checker-util/src/main/java/org/checkerframework/checker/regex/util/RegexUtil.java @@ -1,6 +1,6 @@ // This class should be kept in sync with org.plumelib.util.RegexUtil in the plume-util project. -package org.checkerframework.checker.regex; +package org.checkerframework.checker.regex.util; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; diff --git a/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java b/checker-util/src/main/java/org/checkerframework/checker/signedness/util/SignednessUtil.java similarity index 99% rename from checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java rename to checker-util/src/main/java/org/checkerframework/checker/signedness/util/SignednessUtil.java index 948ab11dcbd..01697609f83 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtil.java +++ b/checker-util/src/main/java/org/checkerframework/checker/signedness/util/SignednessUtil.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.signedness; +package org.checkerframework.checker.signedness.util; import java.io.IOException; import java.io.RandomAccessFile; diff --git a/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java b/checker-util/src/main/java/org/checkerframework/checker/signedness/util/SignednessUtilExtra.java similarity index 97% rename from checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java rename to checker-util/src/main/java/org/checkerframework/checker/signedness/util/SignednessUtilExtra.java index 6b38b1d5202..12d26060de1 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/signedness/SignednessUtilExtra.java +++ b/checker-util/src/main/java/org/checkerframework/checker/signedness/util/SignednessUtilExtra.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.signedness; +package org.checkerframework.checker.signedness.util; import java.awt.Dimension; import java.awt.image.BufferedImage; diff --git a/checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java b/checker-util/src/main/java/org/checkerframework/checker/units/util/UnitsTools.java similarity index 98% rename from checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java rename to checker-util/src/main/java/org/checkerframework/checker/units/util/UnitsTools.java index 56f128df42c..b8569baba07 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/units/UnitsTools.java +++ b/checker-util/src/main/java/org/checkerframework/checker/units/util/UnitsTools.java @@ -1,4 +1,4 @@ -package org.checkerframework.checker.units; +package org.checkerframework.checker.units.util; import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.C; diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/FormatterAnnotatedTypeFactory.java b/checker/src/main/java/org/checkerframework/checker/formatter/FormatterAnnotatedTypeFactory.java index 534b77e8326..f4600198846 100644 --- a/checker/src/main/java/org/checkerframework/checker/formatter/FormatterAnnotatedTypeFactory.java +++ b/checker/src/main/java/org/checkerframework/checker/formatter/FormatterAnnotatedTypeFactory.java @@ -11,6 +11,7 @@ import org.checkerframework.checker.formatter.qual.FormatMethod; import org.checkerframework.checker.formatter.qual.InvalidFormat; import org.checkerframework.checker.formatter.qual.UnknownFormat; +import org.checkerframework.checker.formatter.util.FormatUtil; import org.checkerframework.checker.signature.qual.CanonicalName; import org.checkerframework.common.basetype.BaseAnnotatedTypeFactory; import org.checkerframework.common.basetype.BaseTypeChecker; diff --git a/checker/src/main/java/org/checkerframework/checker/formatter/FormatterTransfer.java b/checker/src/main/java/org/checkerframework/checker/formatter/FormatterTransfer.java index 8c49feba27a..db9c75d1afe 100644 --- a/checker/src/main/java/org/checkerframework/checker/formatter/FormatterTransfer.java +++ b/checker/src/main/java/org/checkerframework/checker/formatter/FormatterTransfer.java @@ -3,6 +3,7 @@ import javax.lang.model.element.AnnotationMirror; import org.checkerframework.checker.formatter.FormatterTreeUtil.Result; import org.checkerframework.checker.formatter.qual.ConversionCategory; +import org.checkerframework.checker.formatter.util.FormatUtil; import org.checkerframework.dataflow.analysis.RegularTransferResult; import org.checkerframework.dataflow.analysis.TransferInput; import org.checkerframework.dataflow.analysis.TransferResult; diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterAnnotatedTypeFactory.java b/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterAnnotatedTypeFactory.java index f773139c099..892218eb505 100644 --- a/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterAnnotatedTypeFactory.java +++ b/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterAnnotatedTypeFactory.java @@ -18,6 +18,7 @@ import org.checkerframework.checker.i18nformatter.qual.I18nFormatFor; import org.checkerframework.checker.i18nformatter.qual.I18nInvalidFormat; import org.checkerframework.checker.i18nformatter.qual.I18nUnknownFormat; +import org.checkerframework.checker.i18nformatter.util.I18nFormatUtil; import org.checkerframework.checker.signature.qual.CanonicalName; import org.checkerframework.common.basetype.BaseAnnotatedTypeFactory; import org.checkerframework.common.basetype.BaseTypeChecker; diff --git a/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterTreeUtil.java b/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterTreeUtil.java index 0202ddc3e9c..5ecede17776 100644 --- a/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterTreeUtil.java +++ b/checker/src/main/java/org/checkerframework/checker/i18nformatter/I18nFormatterTreeUtil.java @@ -30,6 +30,7 @@ import org.checkerframework.checker.i18nformatter.qual.I18nInvalidFormat; import org.checkerframework.checker.i18nformatter.qual.I18nMakeFormat; import org.checkerframework.checker.i18nformatter.qual.I18nValidFormat; +import org.checkerframework.checker.i18nformatter.util.I18nFormatUtil; import org.checkerframework.checker.signature.qual.BinaryName; import org.checkerframework.common.basetype.BaseTypeChecker; import org.checkerframework.dataflow.cfg.node.ArrayCreationNode; diff --git a/checker/src/main/java/org/checkerframework/checker/regex/RegexAnnotatedTypeFactory.java b/checker/src/main/java/org/checkerframework/checker/regex/RegexAnnotatedTypeFactory.java index c3b992cf9e6..6de49109d53 100644 --- a/checker/src/main/java/org/checkerframework/checker/regex/RegexAnnotatedTypeFactory.java +++ b/checker/src/main/java/org/checkerframework/checker/regex/RegexAnnotatedTypeFactory.java @@ -21,6 +21,7 @@ import org.checkerframework.checker.regex.qual.Regex; import org.checkerframework.checker.regex.qual.RegexBottom; import org.checkerframework.checker.regex.qual.UnknownRegex; +import org.checkerframework.checker.regex.util.RegexUtil; import org.checkerframework.common.basetype.BaseAnnotatedTypeFactory; import org.checkerframework.common.basetype.BaseTypeChecker; import org.checkerframework.framework.flow.CFAbstractAnalysis; diff --git a/checker/src/test/java/org/checkerframework/checker/test/junit/FormatterUnitTest.java b/checker/src/test/java/org/checkerframework/checker/test/junit/FormatterUnitTest.java index 6c3f4180201..20b67868668 100644 --- a/checker/src/test/java/org/checkerframework/checker/test/junit/FormatterUnitTest.java +++ b/checker/src/test/java/org/checkerframework/checker/test/junit/FormatterUnitTest.java @@ -1,6 +1,6 @@ package org.checkerframework.checker.test.junit; -import org.checkerframework.checker.formatter.FormatUtil; +import org.checkerframework.checker.formatter.util.FormatUtil; import org.junit.Assert; import org.junit.Test; diff --git a/checker/src/test/java/org/checkerframework/checker/test/junit/I18nFormatterUnitTest.java b/checker/src/test/java/org/checkerframework/checker/test/junit/I18nFormatterUnitTest.java index b48e4b954a9..ca85671f9dc 100644 --- a/checker/src/test/java/org/checkerframework/checker/test/junit/I18nFormatterUnitTest.java +++ b/checker/src/test/java/org/checkerframework/checker/test/junit/I18nFormatterUnitTest.java @@ -1,7 +1,7 @@ package org.checkerframework.checker.test.junit; -import org.checkerframework.checker.i18nformatter.I18nFormatUtil; import org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory; +import org.checkerframework.checker.i18nformatter.util.I18nFormatUtil; import org.junit.Assert; import org.junit.Test; From 90a55b05866804adc57975c977b61825cef9a284 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 15:12:56 -0800 Subject: [PATCH 18/27] Now that checker-qual does not copy source. --- build.gradle | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index fe367a0a261..25a1ebe39fa 100644 --- a/build.gradle +++ b/build.gradle @@ -223,7 +223,6 @@ allprojects { } // Error prone depends on checker-qual.jar, so don't run it on that project to avoid a circular dependency. - // All the classes in checker-qual are also in checker, so they are checked. // TODO: enable Error Prone on test classes. if (it.name.equals('compileJava') && !project.name.startsWith('checker-qual')) { // Error Prone must be available in the annotation processor path @@ -397,7 +396,7 @@ task allJavadoc(type: Javadoc, group: "Documentation") { description = 'Generates a global API documentation for all the modules' dependsOn(':checker:shadowJar', 'getPlumeScripts', 'getHtmlTools') destinationDir = file("${rootDir}/docs/api") - source(project(':checker').sourceSets.main.allJava, project(':framework').sourceSets.main.allJava, + source(project(':checker-qual').sourceSets.main.allJava, project(':checker').sourceSets.main.allJava, project(':framework').sourceSets.main.allJava, project(':dataflow').sourceSets.main.allJava, project(':javacutil').sourceSets.main.allJava) classpath = configurations.allProjects @@ -456,7 +455,7 @@ def createJavadocTask(taskName, taskDescription, memberLevel) { destinationDir = file("${rootDir}/docs/tmpapi") destinationDir.mkdirs() subprojects.forEach { - if (!it.name.startsWith("checker-qual")) { + if (!it.name.startsWith("checker-qual-android")) { source += it.sourceSets.main.allJava } } @@ -601,8 +600,8 @@ subprojects { task checkFormat(type: Exec, dependsOn: [getCodeFormatScripts, pythonIsInstalled], group: 'Format') { description 'Check whether the source code is properly formatted' - // checker-qual* projects have no source, so skip - onlyIf {!project.name.startsWith('checker-qual') } + // checker-qual-android project have no source, so skip + onlyIf {!project.name.startsWith('checker-qual-android') } executable 'python3' doFirst { @@ -620,8 +619,8 @@ subprojects { task reformat(type: Exec, dependsOn: [getCodeFormatScripts, pythonIsInstalled], group: 'Format') { description 'Format the Java source code' - // checker-qual* projects have no source, so skip - onlyIf { !project.name.startsWith('checker-qual') } + // checker-qual-android project have no source, so skip + onlyIf {!project.name.startsWith('checker-qual-android') } executable 'python3' doFirst { args += "${formatScriptsHome}/run-google-java-format.py" @@ -650,7 +649,7 @@ subprojects { relocate 'plume', 'org.checkerframework.plume' } - if (!project.name.startsWith('checker-qual')) { + if (!project.name.startsWith('checker-qual-android')) { task tags(type: Exec) { description 'Create Emacs TAGS table' commandLine "bash", "-c", "find . \\( -name build \\) -prune -o -name '*.java' -print | sort-directory-order | xargs ctags -e -f TAGS" From 9ff73c2e8d27d233f86bf302e6149bbaf1a7213f Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 15:19:02 -0800 Subject: [PATCH 19/27] Fixes. --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 25a1ebe39fa..8bf5583c515 100644 --- a/build.gradle +++ b/build.gradle @@ -396,7 +396,7 @@ task allJavadoc(type: Javadoc, group: "Documentation") { description = 'Generates a global API documentation for all the modules' dependsOn(':checker:shadowJar', 'getPlumeScripts', 'getHtmlTools') destinationDir = file("${rootDir}/docs/api") - source(project(':checker-qual').sourceSets.main.allJava, project(':checker').sourceSets.main.allJava, project(':framework').sourceSets.main.allJava, + source(project(':checker-util').sourceSets.main.allJava, project(':checker-qual').sourceSets.main.allJava, project(':checker').sourceSets.main.allJava, project(':framework').sourceSets.main.allJava, project(':dataflow').sourceSets.main.allJava, project(':javacutil').sourceSets.main.allJava) classpath = configurations.allProjects @@ -667,7 +667,7 @@ subprojects { // Adds manifest to all Jar files tasks.withType(Jar) { includeEmptyDirs = false - if (archiveFileName.get().startsWith("checker-qual")) { + if (archiveFileName.get().startsWith("checker-qual") || archiveFileName.get().startsWith("checker-util")) { metaInf { from './LICENSE.txt' } @@ -682,7 +682,7 @@ subprojects { if (! archiveFileName.get().endsWith("source.jar")) { attributes('Automatic-Module-Name': "org.checkerframework." + project.name.replaceAll('-', '.')) } - if (archiveFileName.get().startsWith("checker-qual")) { + if (archiveFileName.get().startsWith("checker-qual") || archiveFileName.get().startsWith("checker-util")) { attributes("Bundle-License": "MIT") } else { attributes("Bundle-License": "(GPL-2.0-only WITH Classpath-exception-2.0)") From 3425e909a18c3060dfa35869f69e1fc19b0c50e0 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 15:30:29 -0800 Subject: [PATCH 20/27] Manual changes. --- .../units-extension/UnitsExtensionDemo.java | 2 +- docs/manual/creating-a-checker.tex | 2 +- docs/manual/faq.tex | 2 +- docs/manual/formatter-checker.tex | 2 +- docs/manual/i18n-format-checker.tex | 6 +++--- docs/manual/nullness-checker.tex | 2 +- docs/manual/regex-checker.tex | 20 +++++++++---------- docs/manual/signedness-checker.tex | 4 ++-- docs/manual/warnings.tex | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/examples/units-extension/UnitsExtensionDemo.java b/docs/examples/units-extension/UnitsExtensionDemo.java index a8179efb026..b30c31c002b 100644 --- a/docs/examples/units-extension/UnitsExtensionDemo.java +++ b/docs/examples/units-extension/UnitsExtensionDemo.java @@ -1,6 +1,6 @@ -import org.checkerframework.checker.units.UnitsTools; import org.checkerframework.checker.units.qual.Prefix; import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; import qual.Frequency; import qual.Hz; import qual.kHz; diff --git a/docs/manual/creating-a-checker.tex b/docs/manual/creating-a-checker.tex index 1efaebe4199..d5059daa805 100644 --- a/docs/manual/creating-a-checker.tex +++ b/docs/manual/creating-a-checker.tex @@ -1286,7 +1286,7 @@ \end{enumerate} The Regex Checker's dataflow customization for the -\refmethod{checker/regex}{RegexUtil}{asRegex}{-java.lang.String-} +\refmethod{checker/regex/util}{RegexUtil}{asRegex}{-java.lang.String-} run-time check is used as a running example. If needed, you can find more details about the implementation of diff --git a/docs/manual/faq.tex b/docs/manual/faq.tex index 3422073441c..9139663f69d 100644 --- a/docs/manual/faq.tex +++ b/docs/manual/faq.tex @@ -663,7 +663,7 @@ Some checkers have library methods that you can explicitly insert in your source code. Examples include the Nullness Checker's -\refmethod{checker/nullness}{NullnessUtil}{castNonNull}{-T-} method (see +\refmethod{checker/nullness/util}{NullnessUtil}{castNonNull}{-T-} method (see Section~\ref{suppressing-warnings-with-assertions}) and the Regex Checker's \ class (see Section~\ref{regexutil-methods}). But, it would be better to have more general support that does not require diff --git a/docs/manual/formatter-checker.tex b/docs/manual/formatter-checker.tex index 094a5828e79..721c828dab1 100644 --- a/docs/manual/formatter-checker.tex +++ b/docs/manual/formatter-checker.tex @@ -542,7 +542,7 @@ obtained from an external resource, then the string must be trusted or tested. One way to test a string is to call the -\refmethod{checker/formatter}{FormatUtil}{asFormat}{-java.lang.String-org.checkerframework.checker.formatter.qual.ConversionCategory...-} +\refmethod{checker/formatter/util}{FormatUtil}{asFormat}{-java.lang.String-org.checkerframework.checker.formatter.qual.ConversionCategory...-} method to check whether the format string is valid and its format specifiers match certain conversion categories. If this is not the case, \ raises an exception. Your code should diff --git a/docs/manual/i18n-format-checker.tex b/docs/manual/i18n-format-checker.tex index 2b17ae3e6c8..1b278bb0b83 100644 --- a/docs/manual/i18n-format-checker.tex +++ b/docs/manual/i18n-format-checker.tex @@ -364,12 +364,12 @@ \sectionAndLabel{Testing whether a string has an i18n format type}{i18n-format-testing} In the case that the checker cannot infer the i18n format type of a string, -you can use the \refmethod{checker/i18nformatter}{I18nFormatUtil}{hasFormat}{-java.lang.String-org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory...-} +you can use the \refmethod{checker/i18nformatter/util}{I18nFormatUtil}{hasFormat}{-java.lang.String-org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory...-} method to define the type of the string in the scope of a conditional statement. \begin{description} -\item[\refmethod{checker/i18nformatter}{I18nFormatUtil}{hasFormat}{-java.lang.String-org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory...-}] +\item[\refmethod{checker/i18nformatter/util}{I18nFormatUtil}{hasFormat}{-java.lang.String-org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory...-}] returns \ if the given string has the given i18n format type. \end{description} @@ -389,7 +389,7 @@ MessageFormat.format(value, "Text", new Date()); \end{Verbatim} \item Using the - \refmethod{checker/i18nformatter}{I18nFormatUtil}{hasFormat}{-java.lang.String-org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory...-} + \refmethod{checker/util/i18nformatter}{I18nFormatUtil}{hasFormat}{-java.lang.String-org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory...-} method to check whether a format string has particular conversion categories. \begin{Verbatim} diff --git a/docs/manual/nullness-checker.tex b/docs/manual/nullness-checker.tex index 90e1815386a..4b380c2c8ca 100644 --- a/docs/manual/nullness-checker.tex +++ b/docs/manual/nullness-checker.tex @@ -649,7 +649,7 @@ If you need to suppress a warning within an expression, then sometimes writing an assertion is not convenient. In such a case, you can suppress warnings by writing a call to the -\refmethod{checker/nullness}{NullnessUtil}{castNonNull}{-T-} method. +\refmethod{checker/nullness/util}{NullnessUtil}{castNonNull}{-T-} method. The rest of this section discusses the \ method. The Nullness Checker considers both the return value, and also the diff --git a/docs/manual/regex-checker.tex b/docs/manual/regex-checker.tex index 9f2e7117762..72ae0542480 100644 --- a/docs/manual/regex-checker.tex +++ b/docs/manual/regex-checker.tex @@ -130,14 +130,14 @@ \begin{description} -\item[\refmethod{checker/regex}{RegexUtil}{isRegex}{-java.lang.String-}] +\item[\refmethod{checker/regex/util}{RegexUtil}{isRegex}{-java.lang.String-}] returns \ if its argument is a valid regular expression. -\item[\refmethod{checker/regex}{RegexUtil}{regexError}{-java.lang.String-}] +\item[\refmethod{checker/regex/util}{RegexUtil}{regexError}{-java.lang.String-}] returns a \ error message if its argument is not a valid regular expression, or \ if its argument is a valid regular expression. -\item[\refmethod{checker/regex}{RegexUtil}{regexException}{-java.lang.String-}] +\item[\refmethod{checker/regex/util}{RegexUtil}{regexException}{-java.lang.String-}] returns the \sunjavadoc{java.base/java/util/regex/PatternSyntaxException.html}{Pattern\-Syntax\-Exception} that \sunjavadoc{java.base/java/util/regex/Pattern.html\#compile(java.lang.String)}{Pattern.compile(String)} @@ -148,10 +148,10 @@ An additional version of each of these methods is also provided that takes an additional group count parameter. The -\refmethod{checker/regex}{RegexUtil}{isRegex}{-java.lang.String-int-} method +\refmethod{checker/regex/util}{RegexUtil}{isRegex}{-java.lang.String-int-} method verifies that the argument has at least the given number of groups. The -\refmethod{checker/regex}{RegexUtil}{regexError}{-java.lang.String-int-} and -\refmethod{checker/regex}{RegexUtil}{regexException}{-java.lang.String-int-} +\refmethod{checker/regex/util}{RegexUtil}{regexError}{-java.lang.String-int-} and +\refmethod{checker/regex/util}{RegexUtil}{regexException}{-java.lang.String-int-} methods return a \ error message and \, respectively, detailing why the given String is not a syntactically valid regular expression with at least the given number of capturing groups. @@ -160,12 +160,12 @@ If you detect that a \ is not a valid regular expression but would like to report the error higher up the call stack (potentially where you can provide a more detailed error message) you can throw a -\refclass{checker/regex}{RegexUtil.CheckedPatternSyntaxException}. This exception is +\refclass{checker/regex/util}{RegexUtil.CheckedPatternSyntaxException}. This exception is functionally the same as a \sunjavadoc{java.base/java/util/regex/PatternSyntaxException.html}{Pattern\-Syntax\-Exception} except it is checked to guarantee that the error will be handled up the call stack. For more details, see the Javadoc for -\refclass{checker/regex}{RegexUtil.CheckedPatternSyntaxException}. +\refclass{checker/regex/util}{RegexUtil.CheckedPatternSyntaxException}. \end{sloppypar} To use the \ class, the \ file @@ -195,7 +195,7 @@ regular expression is syntactically valid, but the Regex Checker cannot conclude this and issues a warning about possible use of an invalid regular expression, then you can use the -\refmethod{checker/regex}{RegexUtil}{asRegex}{-java.lang.String-} method to suppress the +\refmethod{checker/regex/util}{RegexUtil}{asRegex}{-java.lang.String-} method to suppress the warning. You can think of this method @@ -204,7 +204,7 @@ error if its argument is not a valid regular expression, but you should only use it when you are sure it will not throw an error. -There is an additional \refmethod{checker/regex}{RegexUtil}{asRegex}{-java.lang.String-int-} +There is an additional \refmethod{checker/regex/util}{RegexUtil}{asRegex}{-java.lang.String-int-} method that takes a capturing group parameter. This method works the same as described above, but returns a \code{@Regex String} with the parameter on the annotation set to the value of the capturing group parameter passed to the method. diff --git a/docs/manual/signedness-checker.tex b/docs/manual/signedness-checker.tex index f8eadb24695..77f34123f2d 100644 --- a/docs/manual/signedness-checker.tex +++ b/docs/manual/signedness-checker.tex @@ -251,13 +251,13 @@ \sectionAndLabel{Utility routines for manipulating unsigned values}{signedness-utilities} -Class \refclass{checker/signedness}{SignednessUtil} provides static +Class \refclass{checker/signedness/util}{SignednessUtil} provides static utility methods for working with unsigned values. They are properly annotated with \refqualclass{checker/signedness/qual}{Unsigned} where appropriate, so using them may reduce the number of annotations that you need to write. -Class \refclass{checker/signedness}{SignednessUtilExtra} contains more utility +Class \refclass{checker/signedness/util}{SignednessUtilExtra} contains more utility methods that reference packages not included in Android. This class is not included in \code{checker-util.jar}, so you may want to copy the methods to your code. diff --git a/docs/manual/warnings.tex b/docs/manual/warnings.tex index 1a0cdcaddcd..796a1058891 100644 --- a/docs/manual/warnings.tex +++ b/docs/manual/warnings.tex @@ -469,7 +469,7 @@ Sometimes methods such as -\refmethod{checker/nullness}{NullnessUtil}{castNonNull}{-T-} are used +\refmethod{checker/nullness/util}{NullnessUtil}{castNonNull}{-T-} are used instead of assertions. Just as for assertions, you can treat them as debugging aids or as documentation. If you know that a particular codebase uses @@ -478,7 +478,7 @@ fail at run time), then you can suppress warnings related to it. Annotate its definition just as -\refmethod{checker/nullness}{NullnessUtil}{castNonNull}{-T-} is annotated (see the +\refmethod{checker/nullness/util}{NullnessUtil}{castNonNull}{-T-} is annotated (see the source code for the Checker Framework). % TODO: % For an assert statement, XXXXX. From 68450cf4d605ca468a8dfb61941b4325aaf4092c Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 15:32:23 -0800 Subject: [PATCH 21/27] Tweak change log. --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 3019409fb86..ba7802114bd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Version 3.10.0, February 1, 2021 **User-visible changes:** Moved utility classes from checker-qual.jar to the new checker-util.jar. +Also, added `util` to the end of all the packages of the utility classes. When supplying the `-Ainfer=...` command-line argument, you must also supply `-Awarns`. From 15ec3d900ef8195d18a57b8dd7de3203e3b33d7e Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Wed, 20 Jan 2021 15:49:23 -0800 Subject: [PATCH 22/27] Grammar fixes --- LICENSE.txt | 6 +++--- build.gradle | 4 ++-- changelog.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 49dbfa2889b..f849a0e2c3b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -10,9 +10,9 @@ A few parts of the Checker Framework have more permissive licenses, notably the parts that you might want to include with your own program. * The annotations and utility files are licensed under the MIT License. - (The text of this license also appears below.) This applies to the - checker-qual*.jar and checker-util.jar and all the files that appear in it, - all files in checker-qual and checker-util directories. + (The text of this license also appears below.) This applies to + checker-qual*.jar and checker-util.jar and all the files that appear in + them, which is all files in checker-qual and checker-util directories. It also applies to the cleanroom implementations of third-party annotations (in checker/src/testannotations/, framework/src/main/java/org/jmlspecs/, and diff --git a/build.gradle b/build.gradle index 8bf5583c515..9901ec2b97f 100644 --- a/build.gradle +++ b/build.gradle @@ -600,7 +600,7 @@ subprojects { task checkFormat(type: Exec, dependsOn: [getCodeFormatScripts, pythonIsInstalled], group: 'Format') { description 'Check whether the source code is properly formatted' - // checker-qual-android project have no source, so skip + // checker-qual-android project has no source, so skip onlyIf {!project.name.startsWith('checker-qual-android') } executable 'python3' @@ -619,7 +619,7 @@ subprojects { task reformat(type: Exec, dependsOn: [getCodeFormatScripts, pythonIsInstalled], group: 'Format') { description 'Format the Java source code' - // checker-qual-android project have no source, so skip + // checker-qual-android project has no source, so skip onlyIf {!project.name.startsWith('checker-qual-android') } executable 'python3' doFirst { diff --git a/changelog.txt b/changelog.txt index ba7802114bd..7e43b386759 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,7 +2,7 @@ Version 3.10.0, February 1, 2021 **User-visible changes:** -Moved utility classes from checker-qual.jar to the new checker-util.jar. +Moved utility classes from `checker-qual.jar` to the new `checker-util.jar`. Also, added `util` to the end of all the packages of the utility classes. When supplying the `-Ainfer=...` command-line argument, you must also supply `-Awarns`. From e9793f7068c303eeb926b543518e67fd0919e87d Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Wed, 20 Jan 2021 15:50:02 -0800 Subject: [PATCH 23/27] Fix. --- .../java/org/checkerframework/framework/util/CheckerMain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java b/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java index 935b9aadee1..f1519057c80 100644 --- a/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java +++ b/framework/src/main/java/org/checkerframework/framework/util/CheckerMain.java @@ -103,7 +103,7 @@ public static void main(String[] args) { * Option name for specifying an alternative checker-util.jar location. The accompanying value * MUST be the path to the jar file (NOT the path to its encompassing directory) */ - public static final String CHECKER_UTIL_PATH_OPT = "-checkerQualJar"; + public static final String CHECKER_UTIL_PATH_OPT = "-checkerUtilJar"; /** * Option name for specifying an alternative javac.jar location. The accompanying value MUST be From 83e49835d508c03774534ec244ef288dc237d0a5 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 21 Jan 2021 09:39:06 -0800 Subject: [PATCH 24/27] Fix units test imports. --- checker/tests/units/Addition.java | 31 +++++++++++++++++++++-- checker/tests/units/BasicUnits.java | 16 ++++++++++-- checker/tests/units/Consistency.java | 9 +++++-- checker/tests/units/Division.java | 14 ++++++++-- checker/tests/units/Manual.java | 6 +++-- checker/tests/units/Multiples.java | 17 +++++++++++-- checker/tests/units/PolyUnitTest.java | 6 +++-- checker/tests/units/SubtractionUnits.java | 31 +++++++++++++++++++++-- checker/tests/units/Units.java | 7 ++--- checker/tests/units/UnqualTest.java | 2 +- 10 files changed, 119 insertions(+), 20 deletions(-) diff --git a/checker/tests/units/Addition.java b/checker/tests/units/Addition.java index 1a2a4be6ac8..67a6a6df284 100644 --- a/checker/tests/units/Addition.java +++ b/checker/tests/units/Addition.java @@ -1,5 +1,32 @@ -import org.checkerframework.checker.units.UnitsTools; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.A; +import org.checkerframework.checker.units.qual.Acceleration; +import org.checkerframework.checker.units.qual.Area; +import org.checkerframework.checker.units.qual.C; +import org.checkerframework.checker.units.qual.Current; +import org.checkerframework.checker.units.qual.K; +import org.checkerframework.checker.units.qual.Length; +import org.checkerframework.checker.units.qual.Luminance; +import org.checkerframework.checker.units.qual.Mass; +import org.checkerframework.checker.units.qual.Substance; +import org.checkerframework.checker.units.qual.Temperature; +import org.checkerframework.checker.units.qual.Time; +import org.checkerframework.checker.units.qual.cd; +import org.checkerframework.checker.units.qual.g; +import org.checkerframework.checker.units.qual.h; +import org.checkerframework.checker.units.qual.kg; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.kmPERh; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.mPERs2; +import org.checkerframework.checker.units.qual.min; +import org.checkerframework.checker.units.qual.mm; +import org.checkerframework.checker.units.qual.mm2; +import org.checkerframework.checker.units.qual.mol; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class Addition { // Addition is legal when the operands have the same units. diff --git a/checker/tests/units/BasicUnits.java b/checker/tests/units/BasicUnits.java index 692928a3441..95e0d0c9fdf 100644 --- a/checker/tests/units/BasicUnits.java +++ b/checker/tests/units/BasicUnits.java @@ -1,5 +1,17 @@ -import org.checkerframework.checker.units.*; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.Area; +import org.checkerframework.checker.units.qual.Prefix; +import org.checkerframework.checker.units.qual.degrees; +import org.checkerframework.checker.units.qual.h; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.kmPERh; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.mPERs2; +import org.checkerframework.checker.units.qual.radians; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class BasicUnits { diff --git a/checker/tests/units/Consistency.java b/checker/tests/units/Consistency.java index 094127e798e..3a42759a77b 100644 --- a/checker/tests/units/Consistency.java +++ b/checker/tests/units/Consistency.java @@ -1,5 +1,10 @@ -import org.checkerframework.checker.units.*; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.Area; +import org.checkerframework.checker.units.qual.Length; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.util.UnitsTools; /** * One possible future extension is adding method annotations to check for consistency of arguments. diff --git a/checker/tests/units/Division.java b/checker/tests/units/Division.java index c7fed127493..745653374e6 100644 --- a/checker/tests/units/Division.java +++ b/checker/tests/units/Division.java @@ -1,5 +1,15 @@ -import org.checkerframework.checker.units.*; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.h; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.kmPERh; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.mPERs2; +import org.checkerframework.checker.units.qual.mm; +import org.checkerframework.checker.units.qual.mm2; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class Division { void d() { diff --git a/checker/tests/units/Manual.java b/checker/tests/units/Manual.java index 28f6dfbdcb0..d4df3842e11 100644 --- a/checker/tests/units/Manual.java +++ b/checker/tests/units/Manual.java @@ -1,5 +1,7 @@ -import org.checkerframework.checker.units.UnitsTools; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; // Include all the examples from the manual here, // to ensure they work as expected. diff --git a/checker/tests/units/Multiples.java b/checker/tests/units/Multiples.java index 9cfc2765b45..5371921b7f9 100644 --- a/checker/tests/units/Multiples.java +++ b/checker/tests/units/Multiples.java @@ -1,5 +1,18 @@ -import org.checkerframework.checker.units.UnitsTools; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.Prefix; +import org.checkerframework.checker.units.qual.g; +import org.checkerframework.checker.units.qual.h; +import org.checkerframework.checker.units.qual.kg; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.kmPERh; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.mPERs2; +import org.checkerframework.checker.units.qual.mm; +import org.checkerframework.checker.units.qual.mm2; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class Multiples { void m() { diff --git a/checker/tests/units/PolyUnitTest.java b/checker/tests/units/PolyUnitTest.java index 46a75cc94df..df848df97ba 100644 --- a/checker/tests/units/PolyUnitTest.java +++ b/checker/tests/units/PolyUnitTest.java @@ -1,5 +1,7 @@ -import org.checkerframework.checker.units.*; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.PolyUnit; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class PolyUnitTest { diff --git a/checker/tests/units/SubtractionUnits.java b/checker/tests/units/SubtractionUnits.java index 3da657c29f8..d48a63f1052 100644 --- a/checker/tests/units/SubtractionUnits.java +++ b/checker/tests/units/SubtractionUnits.java @@ -1,5 +1,32 @@ -import org.checkerframework.checker.units.UnitsTools; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.A; +import org.checkerframework.checker.units.qual.Acceleration; +import org.checkerframework.checker.units.qual.Area; +import org.checkerframework.checker.units.qual.C; +import org.checkerframework.checker.units.qual.Current; +import org.checkerframework.checker.units.qual.K; +import org.checkerframework.checker.units.qual.Length; +import org.checkerframework.checker.units.qual.Luminance; +import org.checkerframework.checker.units.qual.Mass; +import org.checkerframework.checker.units.qual.Substance; +import org.checkerframework.checker.units.qual.Temperature; +import org.checkerframework.checker.units.qual.Time; +import org.checkerframework.checker.units.qual.cd; +import org.checkerframework.checker.units.qual.g; +import org.checkerframework.checker.units.qual.h; +import org.checkerframework.checker.units.qual.kg; +import org.checkerframework.checker.units.qual.km; +import org.checkerframework.checker.units.qual.km2; +import org.checkerframework.checker.units.qual.kmPERh; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.m2; +import org.checkerframework.checker.units.qual.mPERs; +import org.checkerframework.checker.units.qual.mPERs2; +import org.checkerframework.checker.units.qual.min; +import org.checkerframework.checker.units.qual.mm; +import org.checkerframework.checker.units.qual.mm2; +import org.checkerframework.checker.units.qual.mol; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class SubtractionUnits { // Subtraction is legal when the operands have the same units. diff --git a/checker/tests/units/Units.java b/checker/tests/units/Units.java index a4119abc50b..5139ee7178d 100644 --- a/checker/tests/units/Units.java +++ b/checker/tests/units/Units.java @@ -1,7 +1,8 @@ -import static org.checkerframework.checker.units.UnitsTools.s; +import static org.checkerframework.checker.units.util.UnitsTools.s; -import org.checkerframework.checker.units.*; -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.m; +import org.checkerframework.checker.units.qual.s; +import org.checkerframework.checker.units.util.UnitsTools; public class Units { @m int m1 = 5 * UnitsTools.m; diff --git a/checker/tests/units/UnqualTest.java b/checker/tests/units/UnqualTest.java index 2baf9bc7e74..3e7b0704ecd 100644 --- a/checker/tests/units/UnqualTest.java +++ b/checker/tests/units/UnqualTest.java @@ -1,4 +1,4 @@ -import org.checkerframework.checker.units.qual.*; +import org.checkerframework.checker.units.qual.kg; public class UnqualTest { // :: error: (assignment.type.incompatible) From 7a19a36f9122efa573eb91a4fa138724d6a50d50 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 21 Jan 2021 09:52:11 -0800 Subject: [PATCH 25/27] Correct util imports. --- .../checker/formatter/qual/ReturnsFormat.java | 2 +- .../checker/i18nformatter/qual/I18nChecksFormat.java | 4 ++-- .../checker/i18nformatter/qual/I18nValidFormat.java | 2 +- .../checker/nullness/util/NullnessUtil.java | 4 ++-- .../checkerframework/checker/nullness/util/Opt.java | 4 ++-- checker/jtreg/multipleexecutions/Test.java | 2 +- .../checkerframework/checker/regex/RegexTransfer.java | 6 +++--- checker/tests/formatter/FlowFormatter.java | 2 +- checker/tests/i18n-formatter/HasFormat.java | 2 +- checker/tests/i18n-formatter/IsFormat.java | 2 +- checker/tests/nullness/Issue1555.java | 2 +- checker/tests/nullness/flow/Issue1345.java | 2 +- checker/tests/nullness/flow/TestNullnessUtil.java | 4 ++-- checker/tests/nullness/flow/TestOpt.java | 4 ++-- checker/tests/regex/Continue.java | 2 +- checker/tests/regex/GroupCounts.java | 2 +- checker/tests/regex/Issue3267.java | 2 +- checker/tests/regex/Issue3281.java | 2 +- checker/tests/regex/MatcherGroupCount.java | 2 +- checker/tests/regex/RegexUtilTest.java | 10 +++++----- checker/tests/regex/TestIsRegex.java | 2 +- checker/tests/regex/TestRegex.java | 2 +- checker/tests/signedness/Utils.java | 2 +- 23 files changed, 34 insertions(+), 34 deletions(-) diff --git a/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java index 2a8d37cba7f..ef34fd3c1a4 100644 --- a/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java +++ b/checker-qual/src/main/java/org/checkerframework/checker/formatter/qual/ReturnsFormat.java @@ -17,7 +17,7 @@ *

  • On success, the method returns the passed format string unmodified. * * - * An example is {@link org.checkerframework.checker.formatter.FormatUtil#asFormat}. + * An example is {@link org.checkerframework.checker.formatter.util.FormatUtil#asFormat}. * * @checker_framework.manual #formatter-checker Format String Checker */ diff --git a/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java index 8e2a9423af5..b37f899b299 100644 --- a/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java +++ b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nChecksFormat.java @@ -8,8 +8,8 @@ /** * This annotation is used internally to annotate {@link - * org.checkerframework.checker.i18nformatter.I18nFormatUtil#hasFormat} (and will potentially be - * used to annotate more such functions in the future). + * org.checkerframework.checker.i18nformatter.util.I18nFormatUtil#hasFormat} (and will potentially + * be used to annotate more such functions in the future). * *

    Attach this annotation to a method with the following properties: * diff --git a/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java index d43146b2775..32859648892 100644 --- a/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java +++ b/checker-qual/src/main/java/org/checkerframework/checker/i18nformatter/qual/I18nValidFormat.java @@ -8,7 +8,7 @@ /** * This annotation is used internally to annotate {@link - * org.checkerframework.checker.i18nformatter.I18nFormatUtil#isFormat}. + * org.checkerframework.checker.i18nformatter.util.I18nFormatUtil#isFormat}. * * @checker_framework.manual #i18n-formatter-checker Internationalization Format String Checker */ diff --git a/checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java index 66330a2a06a..9f419f6ad29 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java +++ b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/NullnessUtil.java @@ -10,11 +10,11 @@ * *

    To avoid the need to write the NullnessUtil class name, do: * - *

    import static org.checkerframework.checker.nullness.NullnessUtil.castNonNull;
    + *
    import static org.checkerframework.checker.nullness.util.NullnessUtil.castNonNull;
    * * or * - *
    import static org.checkerframework.checker.nullness.NullnessUtil.*;
    + *
    import static org.checkerframework.checker.nullness.util.NullnessUtil.*;
    * *

    Runtime Dependency: If you use this class, you must distribute (or link to) {@code * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own diff --git a/checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java index fab76be95ac..0c7d6f4849b 100644 --- a/checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java +++ b/checker-util/src/main/java/org/checkerframework/checker/nullness/util/Opt.java @@ -16,11 +16,11 @@ * *

    To avoid the need to write the {@code Opt} class name at invocation sites, do: * - *

    import static org.checkerframework.checker.nullness.Opt.orElse;
    + *
    import static org.checkerframework.checker.nullness.util.Opt.orElse;
    * * or * - *
    import static org.checkerframework.checker.nullness.Opt.*;
    + *
    import static org.checkerframework.checker.nullness.util.Opt.*;
    * *

    Runtime Dependency: If you use this class, you must distribute (or link to) {@code * checker-qual.jar}, along with your binaries. Or, you can can copy this class into your own diff --git a/checker/jtreg/multipleexecutions/Test.java b/checker/jtreg/multipleexecutions/Test.java index 94ecf3196d1..5322099b53d 100644 --- a/checker/jtreg/multipleexecutions/Test.java +++ b/checker/jtreg/multipleexecutions/Test.java @@ -1,5 +1,5 @@ -import org.checkerframework.checker.regex.RegexUtil; import org.checkerframework.checker.regex.qual.Regex; +import org.checkerframework.checker.regex.util.RegexUtil; public class Test { void foo(String simple) { diff --git a/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java b/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java index b445685b775..5823bb135cc 100644 --- a/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java +++ b/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java @@ -29,7 +29,7 @@ public class RegexTransfer extends CFTransfer { // isRegex and asRegex are tested as signatures (string name plus formal parameters), not // ExecutableElement, because they exist in two packages: - // org.checkerframework.checker.regex.RegexUtil.isRegex(String,int) + // org.checkerframework.checker.regex.util.RegexUtil.isRegex(String,int) // org.plumelib.util.RegexUtil.isRegex(String,int) // and org.plumelib.util might not be on the classpath. private static final String IS_REGEX_METHOD_NAME = "isRegex"; @@ -221,8 +221,8 @@ private TransferResult handleMatcherGroupCount( /** * Returns true if the given receiver is a class named "RegexUtil". Examples of such classes are - * org.checkerframework.checker.regex.RegexUtil and org.plumelib.util.RegexUtil, and the user - * might copy one into their own project. + * org.checkerframework.checker.regex.util.RegexUtil and org.plumelib.util.RegexUtil, and the + * user might copy one into their own project. */ private boolean isRegexUtil(String receiver) { return receiver.equals("RegexUtil") || receiver.endsWith(".RegexUtil"); diff --git a/checker/tests/formatter/FlowFormatter.java b/checker/tests/formatter/FlowFormatter.java index ba28821b72f..48f8fa0c844 100644 --- a/checker/tests/formatter/FlowFormatter.java +++ b/checker/tests/formatter/FlowFormatter.java @@ -1,8 +1,8 @@ import java.util.Date; import java.util.Formatter; -import org.checkerframework.checker.formatter.FormatUtil; import org.checkerframework.checker.formatter.qual.ConversionCategory; import org.checkerframework.checker.formatter.qual.Format; +import org.checkerframework.checker.formatter.util.FormatUtil; import org.junit.Assert; public class FlowFormatter { diff --git a/checker/tests/i18n-formatter/HasFormat.java b/checker/tests/i18n-formatter/HasFormat.java index 0404462ccf3..52ec7e59b65 100644 --- a/checker/tests/i18n-formatter/HasFormat.java +++ b/checker/tests/i18n-formatter/HasFormat.java @@ -1,7 +1,7 @@ import java.text.MessageFormat; import java.util.Date; -import org.checkerframework.checker.i18nformatter.I18nFormatUtil; import org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory; +import org.checkerframework.checker.i18nformatter.util.I18nFormatUtil; public class HasFormat { diff --git a/checker/tests/i18n-formatter/IsFormat.java b/checker/tests/i18n-formatter/IsFormat.java index 50aefe47bb6..61fe0b43fd0 100644 --- a/checker/tests/i18n-formatter/IsFormat.java +++ b/checker/tests/i18n-formatter/IsFormat.java @@ -1,6 +1,6 @@ import java.text.MessageFormat; -import org.checkerframework.checker.i18nformatter.I18nFormatUtil; import org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory; +import org.checkerframework.checker.i18nformatter.util.I18nFormatUtil; public class IsFormat { public static void test1(String cc) { diff --git a/checker/tests/nullness/Issue1555.java b/checker/tests/nullness/Issue1555.java index 147b8ed650d..451989b72ab 100644 --- a/checker/tests/nullness/Issue1555.java +++ b/checker/tests/nullness/Issue1555.java @@ -1,8 +1,8 @@ // Test case for Issue 1555 // https://github.com/typetools/checker-framework/issues/1555 -import org.checkerframework.checker.nullness.NullnessUtil; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.checkerframework.checker.nullness.util.NullnessUtil; public class Issue1555 { diff --git a/checker/tests/nullness/flow/Issue1345.java b/checker/tests/nullness/flow/Issue1345.java index 0ba39878e00..3f83d52dd2b 100644 --- a/checker/tests/nullness/flow/Issue1345.java +++ b/checker/tests/nullness/flow/Issue1345.java @@ -5,8 +5,8 @@ import java.math.BigDecimal; import java.util.stream.Stream; -import org.checkerframework.checker.nullness.Opt; import org.checkerframework.checker.nullness.qual.*; +import org.checkerframework.checker.nullness.util.Opt; public class Issue1345 { diff --git a/checker/tests/nullness/flow/TestNullnessUtil.java b/checker/tests/nullness/flow/TestNullnessUtil.java index c37567095f5..aec51c8426d 100644 --- a/checker/tests/nullness/flow/TestNullnessUtil.java +++ b/checker/tests/nullness/flow/TestNullnessUtil.java @@ -1,7 +1,7 @@ -import org.checkerframework.checker.nullness.NullnessUtil; import org.checkerframework.checker.nullness.qual.*; +import org.checkerframework.checker.nullness.util.NullnessUtil; -/** Test class org.checkerframework.checker.nullness.NullnessUtil. */ +/** Test class org.checkerframework.checker.nullness.util.NullnessUtil. */ public class TestNullnessUtil { void testRef1(@Nullable Object o) { // one way to use as a cast: diff --git a/checker/tests/nullness/flow/TestOpt.java b/checker/tests/nullness/flow/TestOpt.java index 4af6697e690..f2407e1dad1 100644 --- a/checker/tests/nullness/flow/TestOpt.java +++ b/checker/tests/nullness/flow/TestOpt.java @@ -1,7 +1,7 @@ -import org.checkerframework.checker.nullness.Opt; import org.checkerframework.checker.nullness.qual.*; +import org.checkerframework.checker.nullness.util.Opt; -/** Test class org.checkerframework.checker.nullness.Opt. */ +/** Test class org.checkerframework.checker.nullness.util.Opt. */ public class TestOpt { void foo1(@Nullable Object p) { if (Opt.isPresent(p)) { diff --git a/checker/tests/regex/Continue.java b/checker/tests/regex/Continue.java index 680996ef42b..67186bdc524 100644 --- a/checker/tests/regex/Continue.java +++ b/checker/tests/regex/Continue.java @@ -1,5 +1,5 @@ import java.util.regex.Pattern; -import org.checkerframework.checker.regex.RegexUtil; +import org.checkerframework.checker.regex.util.RegexUtil; public class Continue { diff --git a/checker/tests/regex/GroupCounts.java b/checker/tests/regex/GroupCounts.java index 2c62cf41a1d..91038972bff 100644 --- a/checker/tests/regex/GroupCounts.java +++ b/checker/tests/regex/GroupCounts.java @@ -1,7 +1,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.checkerframework.checker.regex.RegexUtil; import org.checkerframework.checker.regex.qual.Regex; +import org.checkerframework.checker.regex.util.RegexUtil; public class GroupCounts { void testGroupCount() { diff --git a/checker/tests/regex/Issue3267.java b/checker/tests/regex/Issue3267.java index 116d80057d6..c51905f0618 100644 --- a/checker/tests/regex/Issue3267.java +++ b/checker/tests/regex/Issue3267.java @@ -2,7 +2,7 @@ // https://github.com/typetools/checker-framework/issues/3267 import java.util.regex.Pattern; -import org.checkerframework.checker.regex.RegexUtil; +import org.checkerframework.checker.regex.util.RegexUtil; public class Issue3267 { void foo(String s) { diff --git a/checker/tests/regex/Issue3281.java b/checker/tests/regex/Issue3281.java index a8729a7e418..c23e6bf2a58 100644 --- a/checker/tests/regex/Issue3281.java +++ b/checker/tests/regex/Issue3281.java @@ -3,8 +3,8 @@ // @skip-test until the bug is fixed -import org.checkerframework.checker.regex.RegexUtil; import org.checkerframework.checker.regex.qual.Regex; +import org.checkerframework.checker.regex.util.RegexUtil; public class Issue3281 { diff --git a/checker/tests/regex/MatcherGroupCount.java b/checker/tests/regex/MatcherGroupCount.java index c5ecb64e606..7ba59767384 100644 --- a/checker/tests/regex/MatcherGroupCount.java +++ b/checker/tests/regex/MatcherGroupCount.java @@ -2,7 +2,7 @@ // https://github.com/typetools/checker-framework/issues/291 import java.util.regex.*; -import org.checkerframework.checker.regex.RegexUtil; +import org.checkerframework.checker.regex.util.RegexUtil; public class MatcherGroupCount { public static void main(String[] args) { diff --git a/checker/tests/regex/RegexUtilTest.java b/checker/tests/regex/RegexUtilTest.java index 7d24089baf4..f0dc6315140 100644 --- a/checker/tests/regex/RegexUtilTest.java +++ b/checker/tests/regex/RegexUtilTest.java @@ -3,10 +3,10 @@ public class RegexUtilTest { void fullyQualifiedRegexUtil(String s) { - if (org.checkerframework.checker.regex.RegexUtil.isRegex(s, 2)) { + if (org.checkerframework.checker.regex.util.RegexUtil.isRegex(s, 2)) { @Regex(2) String s2 = s; } - @Regex(2) String s2 = org.checkerframework.checker.regex.RegexUtil.asRegex(s, 2); + @Regex(2) String s2 = org.checkerframework.checker.regex.util.RegexUtil.asRegex(s, 2); } void unqualifiedRegexUtil(String s) { @@ -17,12 +17,12 @@ void unqualifiedRegexUtil(String s) { } void fullyQualifiedRegexUtilNoParamsArg(String s) { - if (org.checkerframework.checker.regex.RegexUtil.isRegex(s)) { + if (org.checkerframework.checker.regex.util.RegexUtil.isRegex(s)) { @Regex String s2 = s; @Regex(0) String s3 = s; } - @Regex String s2 = org.checkerframework.checker.regex.RegexUtil.asRegex(s); - @Regex(0) String s3 = org.checkerframework.checker.regex.RegexUtil.asRegex(s); + @Regex String s2 = org.checkerframework.checker.regex.util.RegexUtil.asRegex(s); + @Regex(0) String s3 = org.checkerframework.checker.regex.util.RegexUtil.asRegex(s); } void unqualifiedRegexUtilNoParamsArg(String s) { diff --git a/checker/tests/regex/TestIsRegex.java b/checker/tests/regex/TestIsRegex.java index 735868f1264..d4cccd32f3c 100644 --- a/checker/tests/regex/TestIsRegex.java +++ b/checker/tests/regex/TestIsRegex.java @@ -1,7 +1,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.checkerframework.checker.regex.RegexUtil; import org.checkerframework.checker.regex.qual.*; +import org.checkerframework.checker.regex.util.RegexUtil; public class TestIsRegex { void test1(String str1) throws Exception { diff --git a/checker/tests/regex/TestRegex.java b/checker/tests/regex/TestRegex.java index 0d871287789..f932b12e7a7 100644 --- a/checker/tests/regex/TestRegex.java +++ b/checker/tests/regex/TestRegex.java @@ -13,7 +13,7 @@ public void Concatenation2() { // test-case for issue 148 class Search { public static void main(String[] args) { - if (!org.checkerframework.checker.regex.RegexUtil.isRegex(args[0], 4)) { + if (!org.checkerframework.checker.regex.util.RegexUtil.isRegex(args[0], 4)) { return; } @Regex(4) String regex = args[0]; diff --git a/checker/tests/signedness/Utils.java b/checker/tests/signedness/Utils.java index 15b47c8b51d..4b86cecae05 100644 --- a/checker/tests/signedness/Utils.java +++ b/checker/tests/signedness/Utils.java @@ -1,6 +1,6 @@ import java.nio.ByteBuffer; -import org.checkerframework.checker.signedness.SignednessUtil; import org.checkerframework.checker.signedness.qual.*; +import org.checkerframework.checker.signedness.util.SignednessUtil; public class Utils { From abfeb2b729a988acb32046e3c0764e6e4e613f7a Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 21 Jan 2021 10:27:34 -0800 Subject: [PATCH 26/27] Fix. --- .../org/checkerframework/framework/qual/PurityUnqualified.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/checker-qual/src/main/java/org/checkerframework/framework/qual/PurityUnqualified.java b/checker-qual/src/main/java/org/checkerframework/framework/qual/PurityUnqualified.java index 1c15af257dc..231f999ab98 100644 --- a/checker-qual/src/main/java/org/checkerframework/framework/qual/PurityUnqualified.java +++ b/checker-qual/src/main/java/org/checkerframework/framework/qual/PurityUnqualified.java @@ -5,9 +5,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.checkerframework.framework.qual.DefaultQualifierInHierarchy; -import org.checkerframework.framework.qual.InvisibleQualifier; -import org.checkerframework.framework.qual.SubtypeOf; /** * An annotation intended solely for representing an unqualified type in the qualifier hierarchy for From 9e8417715dfc49b610ee2979da831dbe3a129d75 Mon Sep 17 00:00:00 2001 From: Suzanne Millstein Date: Thu, 21 Jan 2021 10:42:38 -0800 Subject: [PATCH 27/27] Add javadoc. --- .../java/org/checkerframework/checker/regex/RegexTransfer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java b/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java index 5823bb135cc..2cc7b61eab7 100644 --- a/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java +++ b/checker/src/main/java/org/checkerframework/checker/regex/RegexTransfer.java @@ -223,6 +223,9 @@ private TransferResult handleMatcherGroupCount( * Returns true if the given receiver is a class named "RegexUtil". Examples of such classes are * org.checkerframework.checker.regex.util.RegexUtil and org.plumelib.util.RegexUtil, and the * user might copy one into their own project. + * + * @param receiver some string + * @return true if the given receiver is a class named "RegexUtil" */ private boolean isRegexUtil(String receiver) { return receiver.equals("RegexUtil") || receiver.endsWith(".RegexUtil");