broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(pool, queries):
    table = {}
    idx = 1
    for e in pool:
        table[idx] = e
        idx += 2 if e[0] in ('Long', 'Double') else 1
    def utf(i):
        e = table.get(i)
        if e is None or e[0] != 'Utf8':
            raise LookupError(i)
        return e[1]
    def res(i):
        e = table.get(i)
        if e is None:
            raise LookupError(i)
        kind = e[0]
        if kind == 'Utf8':
            return e[1]
        if kind in ('Integer', 'Long', 'Double'):
            return e[1]
        if kind == 'String':
            return '"' + utf(e[1]) + '"'
        if kind == 'Class':
            return utf(e[1]).replace('/', '.')
        if kind == 'NameAndType':
            return utf(e[1]) + ':' + utf(e[2])
        if kind == 'Methodref':
            c = table.get(e[1])
            if c is None or c[0] != 'Class':
                raise LookupError(e[1])
            n = table.get(e[2])
            if n is None or n[0] != 'NameAndType':
                raise LookupError(e[2])
            return res(e[1]) + '.' + res(e[2])
        raise LookupError(i)
    out = []
    for q in queries:
        try:
            out.append(res(q))
        except LookupError as err:
            out.append(['bad-ref', err.args[0]])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: method reference',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [6]),
   ['java.lang.String.length1:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [9, 8]),
   [41, ['bad-ref', 8]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [12, 18]),
   ['"length1"', 7]),
  ('field reference',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [13]),
   ['java.lang.String.length1:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [14]),
   [['bad-ref', 1]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [15]),
   [['bad-ref', 9]]),
  ('nested package class name',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [17, 2]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [5]),
   ['length1:()I']),
  ('index zero is invalid',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [7]),
   ['java.lang.String.length2:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [10, 9]),
   [42, ['bad-ref', 9]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [13, 19]),
   ['"length2"', 14]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [14]),
   ['java.lang.String.length2:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [15]),
   [['bad-ref', 2]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [16]),
   [['bad-ref', 10]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [18, 3]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [6]),
   ['length2:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [8]),
   ['java.lang.String.length3:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [11, 10]),
   [43, ['bad-ref', 10]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [14, 20]),
   ['"length3"', 21]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [15]),
   ['java.lang.String.length3:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [16]),
   [['bad-ref', 3]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [17]),
   [['bad-ref', 11]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [19, 4]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [7]),
   ['length3:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [9]),
   ['java.lang.String.length4:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [12, 11]),
   [44, ['bad-ref', 11]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [15, 21]),
   ['"length4"', 28]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [16]),
   ['java.lang.String.length4:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [17]),
   [['bad-ref', 4]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [18]),
   [['bad-ref', 12]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [20, 5]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [8]),
   ['length4:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [10]),
   ['java.lang.String.length5:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [13, 12]),
   [45, ['bad-ref', 12]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [16, 22]),
   ['"length5"', 35]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [17]),
   ['java.lang.String.length5:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [18]),
   [['bad-ref', 5]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [19]),
   [['bad-ref', 13]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [21, 6]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [9]),
   ['length5:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [0]),
   [['bad-ref', 0]])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(pool, queries):
    table = {}
    idx = 1
    for e in pool:
        table[idx] = e
        idx += 2 if e[0] in ('Long', 'Double') else 1
    def utf(i):
        e = table.get(i)
        if e is None or e[0] != 'Utf8':
            raise LookupError(i)
        return e[1]
    def res(i):
        e = table.get(i)
        if e is None:
            raise LookupError(i)
        kind = e[0]
        if kind == 'Utf8':
            return e[1]
        if kind in ('Integer', 'Long', 'Double'):
            return e[1]
        if kind == 'String':
            return '"' + utf(e[1]) + '"'
        if kind == 'Class':
            return utf(e[1]).replace('/', '.')
        if kind == 'NameAndType':
            return utf(e[1]) + ':' + utf(e[2])
        if kind in ('Methodref', 'InterfaceMethodref'):
            c = table.get(e[1])
            if c is None or c[0] != 'Class':
                raise LookupError(e[1])
            n = table.get(e[2])
            if n is None or n[0] != 'NameAndType':
                raise LookupError(e[2])
            return res(e[1]) + '.' + res(e[2])
        raise LookupError(i)
    out = []
    for q in queries:
        try:
            out.append(res(q))
        except LookupError as err:
            out.append(['bad-ref', err.args[0]])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: method reference',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [6]),
   ['java.lang.String.length1:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [9, 8]),
   [41, ['bad-ref', 8]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [12, 18]),
   ['"length1"', 7]),
  ('field reference',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [13]),
   ['java.lang.String.length1:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [14]),
   [['bad-ref', 1]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [15]),
   [['bad-ref', 9]]),
  ('nested package class name',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [17, 2]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [5]),
   ['length1:()I']),
  ('index zero is invalid',
   ([['Utf8', 'java/lang/String'],
     ['Class', 1],
     ['Utf8', 'length1'],
     ['Utf8', '()I'],
     ['NameAndType', 3, 4],
     ['Methodref', 2, 5],
     ['Long', 1234567890124],
     ['Integer', 41],
     ['Double', 2.5],
     ['String', 3],
     ['Fieldref', 2, 5],
     ['Methodref', 1, 5],
     ['String', 9],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 16],
     ['Integer', 7]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [7]),
   ['java.lang.String.length2:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [10, 9]),
   [42, ['bad-ref', 9]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [13, 19]),
   ['"length2"', 14]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [14]),
   ['java.lang.String.length2:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [15]),
   [['bad-ref', 2]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [16]),
   [['bad-ref', 10]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [18, 3]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [6]),
   ['length2:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'java/lang/String'],
     ['Class', 2],
     ['Utf8', 'length2'],
     ['Utf8', '()I'],
     ['NameAndType', 4, 5],
     ['Methodref', 3, 6],
     ['Long', 1234567890125],
     ['Integer', 42],
     ['Double', 5.0],
     ['String', 4],
     ['Fieldref', 3, 6],
     ['Methodref', 2, 6],
     ['String', 10],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 17],
     ['Integer', 14]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [8]),
   ['java.lang.String.length3:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [11, 10]),
   [43, ['bad-ref', 10]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [14, 20]),
   ['"length3"', 21]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [15]),
   ['java.lang.String.length3:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [16]),
   [['bad-ref', 3]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [17]),
   [['bad-ref', 11]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [19, 4]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [7]),
   ['length3:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'java/lang/String'],
     ['Class', 3],
     ['Utf8', 'length3'],
     ['Utf8', '()I'],
     ['NameAndType', 5, 6],
     ['Methodref', 4, 7],
     ['Long', 1234567890126],
     ['Integer', 43],
     ['Double', 7.5],
     ['String', 5],
     ['Fieldref', 4, 7],
     ['Methodref', 3, 7],
     ['String', 11],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 18],
     ['Integer', 21]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [9]),
   ['java.lang.String.length4:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [12, 11]),
   [44, ['bad-ref', 11]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [15, 21]),
   ['"length4"', 28]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [16]),
   ['java.lang.String.length4:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [17]),
   [['bad-ref', 4]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [18]),
   [['bad-ref', 12]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [20, 5]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [8]),
   ['length4:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'java/lang/String'],
     ['Class', 4],
     ['Utf8', 'length4'],
     ['Utf8', '()I'],
     ['NameAndType', 6, 7],
     ['Methodref', 5, 8],
     ['Long', 1234567890127],
     ['Integer', 44],
     ['Double', 10.0],
     ['String', 6],
     ['Fieldref', 5, 8],
     ['Methodref', 4, 8],
     ['String', 12],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 19],
     ['Integer', 28]],
    [0]),
   [['bad-ref', 0]])],
 [('regression: method reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [10]),
   ['java.lang.String.length5:()I']),
  ('entries after a Long keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [13, 12]),
   [45, ['bad-ref', 12]]),
  ('entries after a Double keep their index',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [16, 22]),
   ['"length5"', 35]),
  ('field reference',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [17]),
   ['java.lang.String.length5:()I']),
  ('method reference with non-Class owner',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [18]),
   [['bad-ref', 5]]),
  ('string constant pointing at an Integer',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [19]),
   [['bad-ref', 13]]),
  ('nested package class name',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [21, 6]),
   ['java.util.Map$Entry', 'java.lang.String']),
  ('name and type',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [9]),
   ['length5:()I']),
  ('index zero is invalid',
   ([['Utf8', 'pad0'],
     ['Utf8', 'pad1'],
     ['Utf8', 'pad2'],
     ['Utf8', 'pad3'],
     ['Utf8', 'java/lang/String'],
     ['Class', 5],
     ['Utf8', 'length5'],
     ['Utf8', '()I'],
     ['NameAndType', 7, 8],
     ['Methodref', 6, 9],
     ['Long', 1234567890128],
     ['Integer', 45],
     ['Double', 12.5],
     ['String', 7],
     ['Fieldref', 6, 9],
     ['Methodref', 5, 9],
     ['String', 13],
     ['Utf8', 'java/util/Map$Entry'],
     ['Class', 20],
     ['Integer', 35]],
    [0]),
   [['bad-ref', 0]])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
getfield/putfield operands resolve to bad-ref errors.

pool lists entries in file order; indexes start at 1 and Long/Double entries occupy two indexes (the second is unusable). Resolution: Utf8 -> text; Integer/Long/Double -> value; String -> quoted Utf8 text; Class -> Utf8 binary name with "/" turned into "."; NameAndType -> "name:descriptor"; Methodref and Fieldref -> "Class.name:descriptor" where the owner must be a Class entry and the second index a NameAndType. Any index that is missing or of the wrong kind yields ["bad-ref", index].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(desc, is_static):
    names = {'B': 'byte', 'C': 'char', 'D': 'double', 'F': 'float', 'I': 'int', 'J': 'long', 'S': 'short', 'Z': 'boolean'}
    def field(i, allow_void):
        dims = 0
        while i < len(desc) and desc[i] == '[':
            dims += 1
            i += 1
        if dims > 255 or i >= len(desc):
            return None, i, 0
        c = desc[i]
        if c == 'L':
            j = desc.find(';', i)
            if j < 0 or j == i + 1:
                return None, i, 0
            base = desc[i + 1:j].replace('/', '.')
            i = j + 1
        elif c in names:
            base = names[c]
            i += 1
        elif c == 'V' and allow_void and dims == 0:
            base = 'void'
            i += 1
        else:
            return None, i, 0
        width = 2 if c in 'JD' else 1
        return base + '[]' * dims, i, width
    if not desc.startswith('('):
        return ['ClassFormatError', 0]
    i = 1
    args = []
    slots = 0 if is_static else 1
    while i < len(desc) and desc[i] != ')':
        t, i, w = field(i, False)
        if t is None:
            return ['ClassFormatError', i]
        args.append(t)
        slots += w
    if i >= len(desc):
        return ['ClassFormatError', i]
    ret, j, _ = field(i + 1, True)
    if ret is None or j != len(desc):
        return ['ClassFormatError', j]
    return {'args': args, 'slots': slots, 'ret': ret}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;I)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int'], 'ret': 'void', 'slots': 8}),
  ('instance method reserves this slot',
   ('(JDI)J', False),
   {'args': ['long', 'double', 'int'], 'ret': 'long', 'slots': 6}),
  ('void array return rejected', ('(I)[V', True), ['ClassFormatError', 4]),
  ('void argument rejected', ('(IV)V', True), ['ClassFormatError', 2]),
  ('empty class name rejected', ('(IL;)V', False), ['ClassFormatError', 2]),
  ('trailing characters rejected', ('(ILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 17]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[II)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int'],
    'ret': 'void',
    'slots': 2}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[II)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;II)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int'],
    'ret': 'void',
    'slots': 9}),
  ('instance method reserves this slot',
   ('(JDII)J', False),
   {'args': ['long', 'double', 'int', 'int'], 'ret': 'long', 'slots': 7}),
  ('void array return rejected', ('(II)[V', True), ['ClassFormatError', 5]),
  ('void argument rejected', ('(IIV)V', True), ['ClassFormatError', 3]),
  ('empty class name rejected', ('(IIL;)V', False), ['ClassFormatError', 3]),
  ('trailing characters rejected', ('(IILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 18]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[III)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int'],
    'ret': 'void',
    'slots': 3}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[III)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;III)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int', 'int'],
    'ret': 'void',
    'slots': 10}),
  ('instance method reserves this slot',
   ('(JDIII)J', False),
   {'args': ['long', 'double', 'int', 'int', 'int'], 'ret': 'long', 'slots': 8}),
  ('void array return rejected', ('(III)[V', True), ['ClassFormatError', 6]),
  ('void argument rejected', ('(IIIV)V', True), ['ClassFormatError', 4]),
  ('empty class name rejected', ('(IIIL;)V', False), ['ClassFormatError', 4]),
  ('trailing characters rejected', ('(IIILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 19]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIII)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int',
             'int'],
    'ret': 'void',
    'slots': 4}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIII)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;IIII)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int', 'int', 'int'],
    'ret': 'void',
    'slots': 11}),
  ('instance method reserves this slot',
   ('(JDIIII)J', False),
   {'args': ['long', 'double', 'int', 'int', 'int', 'int'], 'ret': 'long', 'slots': 9}),
  ('void array return rejected', ('(IIII)[V', True), ['ClassFormatError', 7]),
  ('void argument rejected', ('(IIIIV)V', True), ['ClassFormatError', 5]),
  ('empty class name rejected', ('(IIIIL;)V', False), ['ClassFormatError', 5]),
  ('trailing characters rejected', ('(IIIILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 20]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIII)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int',
             'int',
             'int'],
    'ret': 'void',
    'slots': 5}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIII)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;IIIII)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int', 'int', 'int', 'int'],
    'ret': 'void',
    'slots': 12}),
  ('instance method reserves this slot',
   ('(JDIIIII)J', False),
   {'args': ['long', 'double', 'int', 'int', 'int', 'int', 'int'], 'ret': 'long', 'slots': 10}),
  ('void array return rejected', ('(IIIII)[V', True), ['ClassFormatError', 8]),
  ('void argument rejected', ('(IIIIIV)V', True), ['ClassFormatError', 6]),
  ('empty class name rejected', ('(IIIIIL;)V', False), ['ClassFormatError', 6]),
  ('trailing characters rejected', ('(IIIIILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 21]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIIII)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int',
             'int',
             'int',
             'int'],
    'ret': 'void',
    'slots': 6}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIIII)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(desc, is_static):
    names = {'B': 'byte', 'C': 'char', 'D': 'double', 'F': 'float', 'I': 'int', 'J': 'long', 'S': 'short', 'Z': 'boolean'}
    def field(i, allow_void):
        dims = 0
        while i < len(desc) and desc[i] == '[':
            dims += 1
            i += 1
        if dims > 255 or i >= len(desc):
            return None, i, 0
        c = desc[i]
        if c == 'L':
            j = desc.find(';', i)
            if j < 0 or j == i + 1:
                return None, i, 0
            base = desc[i + 1:j].replace('/', '.')
            i = j + 1
        elif c in names:
            base = names[c]
            i += 1
        elif c == 'V' and allow_void and dims == 0:
            base = 'void'
            i += 1
        else:
            return None, i, 0
        width = 2 if dims == 0 and c == 'J' else 1
        return base + '[]' * dims, i, width
    if not desc.startswith('('):
        return ['ClassFormatError', 0]
    i = 1
    args = []
    slots = 0 if is_static else 1
    while i < len(desc) and desc[i] != ')':
        t, i, w = field(i, False)
        if t is None:
            return ['ClassFormatError', i]
        args.append(t)
        slots += w
    if i >= len(desc):
        return ['ClassFormatError', i]
    ret, j, _ = field(i + 1, True)
    if ret is None or j != len(desc):
        return ['ClassFormatError', j]
    return {'args': args, 'slots': slots, 'ret': ret}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;I)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int'], 'ret': 'void', 'slots': 8}),
  ('instance method reserves this slot',
   ('(JDI)J', False),
   {'args': ['long', 'double', 'int'], 'ret': 'long', 'slots': 6}),
  ('void array return rejected', ('(I)[V', True), ['ClassFormatError', 4]),
  ('void argument rejected', ('(IV)V', True), ['ClassFormatError', 2]),
  ('empty class name rejected', ('(IL;)V', False), ['ClassFormatError', 2]),
  ('trailing characters rejected', ('(ILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 17]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[II)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int'],
    'ret': 'void',
    'slots': 2}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[II)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;II)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int'],
    'ret': 'void',
    'slots': 9}),
  ('instance method reserves this slot',
   ('(JDII)J', False),
   {'args': ['long', 'double', 'int', 'int'], 'ret': 'long', 'slots': 7}),
  ('void array return rejected', ('(II)[V', True), ['ClassFormatError', 5]),
  ('void argument rejected', ('(IIV)V', True), ['ClassFormatError', 3]),
  ('empty class name rejected', ('(IIL;)V', False), ['ClassFormatError', 3]),
  ('trailing characters rejected', ('(IILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 18]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[III)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int'],
    'ret': 'void',
    'slots': 3}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[III)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;III)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int', 'int'],
    'ret': 'void',
    'slots': 10}),
  ('instance method reserves this slot',
   ('(JDIII)J', False),
   {'args': ['long', 'double', 'int', 'int', 'int'], 'ret': 'long', 'slots': 8}),
  ('void array return rejected', ('(III)[V', True), ['ClassFormatError', 6]),
  ('void argument rejected', ('(IIIV)V', True), ['ClassFormatError', 4]),
  ('empty class name rejected', ('(IIIL;)V', False), ['ClassFormatError', 4]),
  ('trailing characters rejected', ('(IIILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 19]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIII)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int',
             'int'],
    'ret': 'void',
    'slots': 4}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIII)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;IIII)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int', 'int', 'int'],
    'ret': 'void',
    'slots': 11}),
  ('instance method reserves this slot',
   ('(JDIIII)J', False),
   {'args': ['long', 'double', 'int', 'int', 'int', 'int'], 'ret': 'long', 'slots': 9}),
  ('void array return rejected', ('(IIII)[V', True), ['ClassFormatError', 7]),
  ('void argument rejected', ('(IIIIV)V', True), ['ClassFormatError', 5]),
  ('empty class name rejected', ('(IIIIL;)V', False), ['ClassFormatError', 5]),
  ('trailing characters rejected', ('(IIIILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 20]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIII)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int',
             'int',
             'int'],
    'ret': 'void',
    'slots': 5}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIII)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])],
 [('regression: mixed wide and array arguments',
   ('(IJ[JD[[Ljava/lang/String;IIIII)V', True),
   {'args': ['int', 'long', 'long[]', 'double', 'java.lang.String[][]', 'int', 'int', 'int', 'int', 'int'],
    'ret': 'void',
    'slots': 12}),
  ('instance method reserves this slot',
   ('(JDIIIII)J', False),
   {'args': ['long', 'double', 'int', 'int', 'int', 'int', 'int'], 'ret': 'long', 'slots': 10}),
  ('void array return rejected', ('(IIIII)[V', True), ['ClassFormatError', 8]),
  ('void argument rejected', ('(IIIIIV)V', True), ['ClassFormatError', 6]),
  ('empty class name rejected', ('(IIIIIL;)V', False), ['ClassFormatError', 6]),
  ('trailing characters rejected', ('(IIIIILpkg/A;)Lpkg/B;x', False), ['ClassFormatError', 21]),
  ('255 array dimensions accepted',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIIII)V',
    True),
   {'args': ['int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]',
             'int',
             'int',
             'int',
             'int',
             'int'],
    'ret': 'void',
    'slots': 6}),
  ('256 array dimensions rejected',
   ('([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[IIIIII)V',
    True),
   ['ClassFormatError', 257]),
  ('control: missing parenthesis', ('I)V', True), ['ClassFormatError', 0])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Methods taking long[] or double[] parameters get oversized frames and shifted locals.

Parse a method descriptor "(args)ret". Field types: B C D F I J S Z, L<binary name>; with a non-empty name, and up to 255 leading "[" dimensions. V is allowed only as a non-array return type. Local-slot count: one extra slot for "this" unless static; J and D take two slots unless they are array element types. Return {args (readable names, "[]" per dimension), slots, ret} or ["ClassFormatError", position].

split: open-access