/** * Construct full namespace for an ExtModClassRef entry * * @param ref the entry * @return the namespace it encodes */ private String resolveClassRef(ExtModClassRefEntry ref) { TermNameEntry e = termNameMap.get(ref.nameRef()); if (e == null) return null; String base = ""; if (ref.symbolRef() != -1) { ExtModClassRefEntry classRef = extModClassRefEntriesMap.get(ref.symbolRef()); if (classRef == null) return null; base = resolveClassRef(classRef) + "."; } return base + e.name(); }
/** * Update a ExtModClassRef to encode a different namespace, the existing entry is re-used but any * parent components of the namespace result in new ExtModClassRef being added to the table to * avoid disrupting other entries which may depend on the parent ExtModClassRef/TermName entries * of the existing entry for purposes we don't understand. * * @param ref the entry to update * @param with array of namespace components to use instead */ private void updateClassRef(ExtModClassRefEntry ref, String[] with) { entries.add(new TermNameEntry(with[with.length - 1])); int termRef = entries.size() - 1; int symbolRef = -1; if (with.length > 1) symbolRef = addClassRef(Arrays.copyOf(with, with.length - 1)); ref.update(termRef, symbolRef); }