Repository navigation
Conversation
…at has no bound The new test still crashes, in BaseTypeVisitor.isValidUse.
Revert the limitToBound change; getBoundQualifiers now returns a bound in every hierarchy, so its callers, such as limitToBound and BaseTypeVisitor.isValidUse, need no special case.
…erriding method, and cache the test bounds
… bound in limitToBound
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
Land after #8639.
AnnotatedTypeFactory.getTypeDeclarationBoundsreturns the qualifier upper bounds for a use of a type, and a checker can override it, asInterningAnnotatedTypeFactorydoes for enum types. Two places ignored such an override, because they calledQualifierUpperBounds.getBoundQualifiersdirectly:QualifierUpperBounds.limitToBound, which limits the qualifiers thatPropagationTreeAnnotatorgives to a cast or to the elements of an array initializer.BaseTypeVisitor.isValidUse(AnnotatedDeclaredType, AnnotatedDeclaredType, Tree), which checks a use of a declared type. Its caller,BaseTypeValidator.visitDeclared, passes adeclarationTypewhose primary qualifiers come fromgetTypeDeclarationBounds, and overrides such asGuiEffectVisitor.isValidUseandNTDVisitor.isValidUseread the bounds fromdeclarationType. The default implementation now does too, instead of recomputing the bounds and ignoringdeclarationType's qualifiers.Now
limitToBoundcallsgetTypeDeclarationBounds, andisValidUseuses the primary qualifiers ofdeclarationType.The test factory
H1H2AnnotatedTypeFactorynow overridesgetTypeDeclarationBoundsso that a class namedH1S1Boundedhas the bound@H1S1, though no annotation on the class says so. The new testframework/tests/h1h2checker/TypeDeclarationBoundsOverride.javachecks a use, a cast, and an array initializer ofH1S1Bounded. Without the fix, all 4 of its checks fail.The Interning Checker's override is not observable through these paths, because
InterningTypeAnnotatoralready adds@Internedto every enum type.