public static ResolvedTypeMunger readInnerClass(VersionedDataInputStream stream, ISourceContext context) throws IOException { /* int version = */stream.readInt(); UnresolvedType targetType = UnresolvedType.read(stream); String memberTypeName = stream.readUTF(); ISourceLocation sourceLocation = readSourceLocation(stream); List<String> typeVarAliases = readInTypeAliases(stream); NewMemberClassTypeMunger newInstance = new NewMemberClassTypeMunger(targetType, memberTypeName); newInstance.setTypeVariableAliases(typeVarAliases); newInstance.setSourceLocation(sourceLocation); return newInstance; }
@Override public void write(CompressingDataOutputStream stream) throws IOException { kind.write(stream); stream.writeInt(version); targetType.write(stream); stream.writeUTF(memberTypeName); writeSourceLocation(stream); writeOutTypeAliases(stream); }
public static ResolvedTypeMunger read(VersionedDataInputStream s, ISourceContext context) throws IOException { Kind kind = Kind.read(s); if (kind == Field) { return NewFieldTypeMunger.readField(s, context); } else if (kind == Method) { return NewMethodTypeMunger.readMethod(s, context); } else if (kind == Constructor) { return NewConstructorTypeMunger.readConstructor(s, context); } else if (kind == MethodDelegate) { return MethodDelegateTypeMunger.readMethod(s, context, false); } else if (kind == FieldHost) { return MethodDelegateTypeMunger.FieldHostTypeMunger.readFieldHost(s, context); } else if (kind == MethodDelegate2) { return MethodDelegateTypeMunger.readMethod(s, context, true); } else if (kind == InnerClass) { return NewMemberClassTypeMunger.readInnerClass(s, context); } else { throw new RuntimeException("unimplemented"); } }
private boolean mungeNewMemberType(BcelClassWeaver classWeaver, NewMemberClassTypeMunger munger) { World world = classWeaver.getWorld(); ResolvedType onType = world.resolve(munger.getTargetType()); if (onType.isRawType()) { onType = onType.getGenericType(); } return onType.equals(classWeaver.getLazyClassGen().getType()); }