Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8323611

4.10.1.9 multianewarray: revise classDimension predicate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 21
    • specification
    • vm

      Two problems with 'classDimension', used to verify 'multianewarray':

      - The second rule, 'classDimension(_, Dimension)' matches *all types*, including array types—so allows the dimensionality of any type to be considered 0.

      - The name suggests that the element type will always be a class type, when it need not be.

      Proposed revised definition:

      arrayDimensions(arrayOf(X), XDimensions + 1) :-
          arrayDimensions(X, XDimensions).

      arrayDimensions(Type, 0) :-
          Type \= arrayOf(_).

      (And rename the usage in 'instructionIsTypeSafe'.)

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: