private static void parseArgumentsList(String value, GenericType type) { if (value == null) { return; } while (value.length() > 0) { String typeStr = getNextType(value); int len = typeStr.length(); int wildcard = WILDCARD_NO; switch (typeStr.charAt(0)) { case '*': wildcard = WILDCARD_UNBOUND; break; case '+': wildcard = WILDCARD_EXTENDS; break; case '-': wildcard = WILDCARD_SUPER; break; } type.getWildcards().add(wildcard); if (wildcard != WILDCARD_NO) { typeStr = typeStr.substring(1); } type.getArguments().add(typeStr.length() == 0 ? null : new GenericType(typeStr)); value = value.substring(len); } }
private static void appendClassName(GenericType type, StringBuilder buffer) { List<GenericType> enclosingClasses = type.getEnclosingClasses(); if (enclosingClasses.isEmpty()) { String name = type.value.replace('/', '.'); buffer.append(DecompilerContext.getImportCollector().getShortName(name)); } else { for (GenericType tp : enclosingClasses) { if (buffer.length() == 0) { buffer.append(DecompilerContext.getImportCollector().getShortName(tp.value.replace('/', '.'))); } else { buffer.append(tp.value); } appendTypeArguments(tp, buffer); buffer.append('.'); } buffer.append(type.value); } appendTypeArguments(type, buffer); }
String cl = getNextClassSignature(signature); GenericType type11 = new GenericType(CodeConstants.TYPE_OBJECT, 0, name); parseArgumentsList(args, type11); enclosingClasses.add(type11); parseArgumentsList(args, this); break;
private static void appendTypeArguments(GenericType type, StringBuilder buffer) { if (!type.getArguments().isEmpty()) { buffer.append('<'); for (int i = 0; i < type.getArguments().size(); i++) { if (i > 0) { buffer.append(", "); int wildcard = type.getWildcards().get(i); switch (wildcard) { case GenericType.WILDCARD_UNBOUND: GenericType genPar = type.getArguments().get(i); if (genPar != null) { buffer.append(getGenericCastTypeName(genPar));
public static GenericClassDescriptor parseClassSignature(String signature) { String original = signature; try { GenericClassDescriptor descriptor = new GenericClassDescriptor(); signature = parseFormalParameters(signature, descriptor.fparameters, descriptor.fbounds); String superCl = GenericType.getNextType(signature); descriptor.superclass = new GenericType(superCl); signature = signature.substring(superCl.length()); while (signature.length() > 0) { String superIf = GenericType.getNextType(signature); descriptor.superinterfaces.add(new GenericType(superIf)); signature = signature.substring(superIf.length()); } return descriptor; } catch (RuntimeException e) { DecompilerContext.getLogger().writeMessage("Invalid signature: " + original, IFernflowerLogger.Severity.WARN); return null; } }
public GenericType decreaseArrayDim() { assert arrayDim > 0 : this; return new GenericType(this, arrayDim - 1); }
isVarArg &= parameterType.arrayDim > 0; if (isVarArg) { parameterType = parameterType.decreaseArrayDim();
String par = GenericType.getNextType(parameters); parameterTypes.add(new GenericType(par)); parameters = parameters.substring(par.length()); String ret = GenericType.getNextType(signature); GenericType returnType = new GenericType(ret); signature = signature.substring(ret.length()); String[] exceptions = signature.split("\\^"); for (int i = 1; i < exceptions.length; i++) { exceptionTypes.add(new GenericType(exceptions[i]));
private static void appendTypeArguments(GenericType type, StringBuilder buffer) { if (!type.getArguments().isEmpty()) { buffer.append('<'); for (int i = 0; i < type.getArguments().size(); i++) { if (i > 0) { buffer.append(", "); int wildcard = type.getWildcards().get(i); switch (wildcard) { case GenericType.WILDCARD_UNBOUND: GenericType genPar = type.getArguments().get(i); if (genPar != null) { buffer.append(getGenericCastTypeName(genPar));
public static GenericFieldDescriptor parseFieldSignature(String signature) { try { return new GenericFieldDescriptor(new GenericType(signature)); } catch (RuntimeException e) { DecompilerContext.getLogger().writeMessage("Invalid signature: " + signature, IFernflowerLogger.Severity.WARN); return null; } }
parameterType = parameterType.decreaseArrayDim();
private static void parseArgumentsList(String value, GenericType type) { if (value == null) { return; } while (value.length() > 0) { String typeStr = getNextType(value); int len = typeStr.length(); int wildcard = WILDCARD_NO; switch (typeStr.charAt(0)) { case '*': wildcard = WILDCARD_UNBOUND; break; case '+': wildcard = WILDCARD_EXTENDS; break; case '-': wildcard = WILDCARD_SUPER; break; } type.getWildcards().add(wildcard); if (wildcard != WILDCARD_NO) { typeStr = typeStr.substring(1); } type.getArguments().add(typeStr.length() == 0 ? null : new GenericType(typeStr)); value = value.substring(len); } }
String bound = GenericType.getNextType(value); lstBounds.add(new GenericType(bound)); value = value.substring(bound.length());
String cl = getNextClassSignature(signature); GenericType type11 = new GenericType(CodeConstants.TYPE_OBJECT, 0, name); parseArgumentsList(args, type11); enclosingClasses.add(type11); parseArgumentsList(args, this); break;
public GenericType decreaseArrayDim() { assert arrayDim > 0 : this; return new GenericType(type, arrayDim - 1, value); }
private static void appendClassName(GenericType type, StringBuilder buffer) { List<GenericType> enclosingClasses = type.getEnclosingClasses(); if (enclosingClasses.isEmpty()) { String name = type.value.replace('/', '.'); buffer.append(DecompilerContext.getImportCollector().getShortName(name)); } else { for (GenericType tp : enclosingClasses) { if (buffer.length() == 0) { buffer.append(DecompilerContext.getImportCollector().getShortName(tp.value.replace('/', '.'))); } else { buffer.append(tp.value); } appendTypeArguments(tp, buffer); buffer.append('.'); } buffer.append(type.value); } appendTypeArguments(type, buffer); }
public static GenericClassDescriptor parseClassSignature(String signature) { String original = signature; try { GenericClassDescriptor descriptor = new GenericClassDescriptor(); signature = parseFormalParameters(signature, descriptor.fparameters, descriptor.fbounds); String superCl = GenericType.getNextType(signature); descriptor.superclass = new GenericType(superCl); signature = signature.substring(superCl.length()); while (signature.length() > 0) { String superIf = GenericType.getNextType(signature); descriptor.superinterfaces.add(new GenericType(superIf)); signature = signature.substring(superIf.length()); } return descriptor; } catch (RuntimeException e) { DecompilerContext.getLogger().writeMessage("Invalid signature: " + original, IFernflowerLogger.Severity.WARN); return null; } }
public static GenericFieldDescriptor parseFieldSignature(String signature) { try { GenericFieldDescriptor descriptor = new GenericFieldDescriptor(); descriptor.type = new GenericType(signature); return descriptor; } catch (RuntimeException e) { DecompilerContext.getLogger().writeMessage("Invalid signature: " + signature, IFernflowerLogger.Severity.WARN); return null; } }
public static GenericMethodDescriptor parseMethodSignature(String signature) { String original = signature; try { GenericMethodDescriptor descriptor = new GenericMethodDescriptor(); signature = parseFormalParameters(signature, descriptor.fparameters, descriptor.fbounds); int to = signature.indexOf(")"); String pars = signature.substring(1, to); signature = signature.substring(to + 1); while (pars.length() > 0) { String par = GenericType.getNextType(pars); descriptor.params.add(new GenericType(par)); pars = pars.substring(par.length()); } String par = GenericType.getNextType(signature); descriptor.ret = new GenericType(par); signature = signature.substring(par.length()); if (signature.length() > 0) { String[] exceptions = signature.split("\\^"); for (int i = 1; i < exceptions.length; i++) { descriptor.exceptions.add(new GenericType(exceptions[i])); } } return descriptor; } catch (RuntimeException e) { DecompilerContext.getLogger().writeMessage("Invalid signature: " + original, IFernflowerLogger.Severity.WARN); return null; } }
String bound = GenericType.getNextType(value); lstBounds.add(new GenericType(bound)); value = value.substring(bound.length());