Skip to content

Commit

Permalink
Renamed variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jan 13, 2016
1 parent 6ade875 commit 264b318
Show file tree
Hide file tree
Showing 29 changed files with 300 additions and 290 deletions.
12 changes: 6 additions & 6 deletions byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java
Expand Up @@ -214,25 +214,25 @@ protected ByteBuddy(ClassFileVersion classFileVersion,
* {@link ConstructorStrategy} by {@link ByteBuddy#subclass(Class, ConstructorStrategy)}.
* </p>
*
* @param superType The super class or interface type to extend.
* @param superClass The super class or interface type to extend.
* @param <T> A loaded type that the generated class is guaranteed to inherit.
* @return A type builder for creating a new class extending the provided class or interface.
*/
public <T> DynamicType.Builder<T> subclass(Class<T> superType) {
return subclass(new TypeDescription.ForLoadedType(superType));
public <T> DynamicType.Builder<T> subclass(Class<T> superClass) {
return subclass(new TypeDescription.ForLoadedType(superClass));
}

/**
* Creates a new builder for subclassing the provided type. If the provided type is an interface, a new class implementing
* this interface type is created.
*
* @param superType The super class or interface type to extend.
* @param superClass The super class or interface type to extend.
* @param constructorStrategy A constructor strategy that determines the
* @param <T> A loaded type that the generated class is guaranteed to inherit.
* @return A type builder for creating a new class extending the provided class or interface.
*/
public <T> DynamicType.Builder<T> subclass(Class<T> superType, ConstructorStrategy constructorStrategy) {
return subclass(new TypeDescription.ForLoadedType(superType), constructorStrategy);
public <T> DynamicType.Builder<T> subclass(Class<T> superClass, ConstructorStrategy constructorStrategy) {
return subclass(new TypeDescription.ForLoadedType(superClass), constructorStrategy);
}

/**
Expand Down
20 changes: 10 additions & 10 deletions byte-buddy-dep/src/main/java/net/bytebuddy/NamingStrategy.java
Expand Up @@ -17,10 +17,10 @@ public interface NamingStrategy {
/**
* Determines a new name when creating a new type that subclasses the provided type.
*
* @param superType The super type of the created type.
* @param superClass The super type of the created type.
* @return The name of the dynamic type.
*/
String subclass(TypeDescription.Generic superType);
String subclass(TypeDescription.Generic superClass);

/**
* Determines a name for the dynamic type when redefining the provided type.
Expand All @@ -44,17 +44,17 @@ public interface NamingStrategy {
abstract class AbstractBase implements NamingStrategy {

@Override
public String subclass(TypeDescription.Generic superType) {
return name(superType.asErasure());
public String subclass(TypeDescription.Generic superClass) {
return name(superClass.asErasure());
}

/**
* Determines a new name when creating a new type that subclasses the provided type.
*
* @param superType The super type of the created type.
* @param superClass The super type of the created type.
* @return The name of the dynamic type.
*/
protected abstract String name(TypeDescription superType);
protected abstract String name(TypeDescription superClass);

@Override
public String redefine(TypeDescription typeDescription) {
Expand Down Expand Up @@ -158,8 +158,8 @@ public SuffixingRandom(String suffix, BaseNameResolver baseNameResolver, String
}

@Override
protected String name(TypeDescription superType) {
String baseName = baseNameResolver.resolve(superType);
protected String name(TypeDescription superClass) {
String baseName = baseNameResolver.resolve(superClass);
if (baseName.startsWith(JAVA_PACKAGE) && !javaLangPackagePrefix.equals("")) {
baseName = javaLangPackagePrefix + "." + baseName;
}
Expand Down Expand Up @@ -343,8 +343,8 @@ public PrefixingRandom(String prefix) {
}

@Override
protected String name(TypeDescription superType) {
return String.format("%s.%s$%s", prefix, superType.getName(), randomString.nextString());
protected String name(TypeDescription superClass) {
return String.format("%s.%s$%s", prefix, superClass.getName(), randomString.nextString());
}

@Override
Expand Down
Expand Up @@ -66,9 +66,9 @@ protected TypeConstantDissolvingClassVisitor(ClassVisitor classVisitor) {
}

@Override
public void visit(int version, int modifiers, String name, String signature, String superTypeName, String[] interfaceName) {
public void visit(int version, int modifiers, String name, String signature, String superClassName, String[] interfaceName) {
supportsTypeConstants = ClassFileVersion.ofMinorMajor(version).isAtLeast(ClassFileVersion.JAVA_V5);
super.visit(version, modifiers, name, signature, superTypeName, interfaceName);
super.visit(version, modifiers, name, signature, superClassName, interfaceName);
}

@Override
Expand Down
Expand Up @@ -280,7 +280,12 @@ public interface TypeDescription extends TypeDefinition, TypeVariableSource {
*/
boolean isAnnotationValue(Object value);

boolean isPackageDescription();
/**
* Checks if this type represents a class that is a place holder for a package description.
*
* @return {@code true} if this type represents a package description.
*/
boolean isPackageType();

/**
* Represents a generic type of the Java programming language. A non-generic {@link TypeDescription} is considered to be
Expand Down Expand Up @@ -839,8 +844,8 @@ public Boolean onParameterizedType(Generic parameterizedType) {
if (typeDescription.equals(parameterizedType.asErasure())) {
return true;
}
Generic superType = parameterizedType.getSuperClass();
if (superType != null && isAssignableFrom(superType)) {
Generic superClass = parameterizedType.getSuperClass();
if (superClass != null && isAssignableFrom(superClass)) {
return true;
}
for (Generic interfaceType : parameterizedType.getInterfaces()) {
Expand Down Expand Up @@ -1004,8 +1009,8 @@ public Boolean onParameterizedType(Generic parameterizedType) {
throw new IllegalArgumentException("Incompatible generic types: " + parameterizedType + " and " + this.parameterizedType);
}
}
Generic superType = parameterizedType.getSuperClass();
if (superType != null && isAssignableFrom(superType)) {
Generic superClass = parameterizedType.getSuperClass();
if (superClass != null && isAssignableFrom(superClass)) {
return true;
}
for (Generic interfaceType : parameterizedType.getInterfaces()) {
Expand All @@ -1031,8 +1036,8 @@ public Boolean onNonGenericType(Generic typeDescription) {
if (parameterizedType.asErasure().equals(typeDescription.asErasure())) {
return true;
}
Generic superType = typeDescription.getSuperClass();
if (superType != null && isAssignableFrom(superType)) {
Generic superClass = typeDescription.getSuperClass();
if (superClass != null && isAssignableFrom(superClass)) {
return true;
}
for (Generic interfaceType : typeDescription.getInterfaces()) {
Expand Down Expand Up @@ -3565,10 +3570,10 @@ abstract class OfNonGenericType extends AbstractBase {

@Override
public Generic getSuperClass() {
Generic superType = asErasure().getSuperClass();
return superType == null
Generic superClass = asErasure().getSuperClass();
return superClass == null
? UNDEFINED
: superType.accept(Visitor.TypeVariableErasing.INSTANCE);
: superClass.accept(Visitor.TypeVariableErasing.INSTANCE);
}

@Override
Expand Down Expand Up @@ -4357,10 +4362,10 @@ public Sort getSort() {

@Override
public Generic getSuperClass() {
Generic superType = asErasure().getSuperClass();
return superType == null
Generic superClass = asErasure().getSuperClass();
return superClass == null
? UNDEFINED
: superType.accept(Visitor.Substitutor.ForTypeVariableBinding.bind(this));
: superClass.accept(Visitor.Substitutor.ForTypeVariableBinding.bind(this));
}

@Override
Expand Down Expand Up @@ -5203,18 +5208,18 @@ public ForLoadedSuperType(Class<?> type) {

@Override
protected Generic resolve() {
java.lang.reflect.Type superType = type.getGenericSuperclass();
return superType == null
java.lang.reflect.Type superClass = type.getGenericSuperclass();
return superClass == null
? UNDEFINED
: Sort.describe(superType, getAnnotationReader());
: Sort.describe(superClass, getAnnotationReader());
}

@Override
public TypeDescription asErasure() {
Class<?> superType = type.getSuperclass();
return superType == null
Class<?> superClass = type.getSuperclass();
return superClass == null
? TypeDescription.UNDEFINED
: new ForLoadedType(superType);
: new ForLoadedType(superClass);
}

@Override
Expand Down Expand Up @@ -6134,8 +6139,8 @@ private static boolean isAssignable(TypeDescription sourceType, TypeDescription
return !targetType.isPrimitive();
}
// (4) The sub type has a super type and this super type is assignable to the super type.
Generic superType = targetType.getSuperClass();
if (superType != null && sourceType.isAssignableFrom(superType.asErasure())) {
Generic superClass = targetType.getSuperClass();
if (superClass != null && sourceType.isAssignableFrom(superClass.asErasure())) {
return true;
}
// (5) If the target type is an interface, any of this type's interfaces might be assignable to it.
Expand Down Expand Up @@ -6279,13 +6284,13 @@ public String getGenericSignature() {
}
generic = true;
}
Generic superType = getSuperClass();
Generic superClass = getSuperClass();
// The object type itself is non generic and implicitly returns a non-generic signature
if (superType == null) {
superType = TypeDescription.Generic.OBJECT;
if (superClass == null) {
superClass = TypeDescription.Generic.OBJECT;
}
superType.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitSuperclass()));
generic = generic || !superType.getSort().isNonGeneric();
superClass.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitSuperclass()));
generic = generic || !superClass.getSort().isNonGeneric();
for (Generic interfaceType : getInterfaces()) {
interfaceType.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitInterface()));
generic = generic || !interfaceType.getSort().isNonGeneric();
Expand Down Expand Up @@ -6315,15 +6320,16 @@ public boolean isVisibleTo(TypeDescription typeDescription) {

@Override
public AnnotationList getInheritedAnnotations() {
Generic superClass = getSuperClass();
AnnotationList declaredAnnotations = getDeclaredAnnotations();
if (getSuperClass() == null) {
if (superClass == null) {
return declaredAnnotations;
} else {
Set<TypeDescription> annotationTypes = new HashSet<TypeDescription>();
for (AnnotationDescription annotationDescription : declaredAnnotations) {
annotationTypes.add(annotationDescription.getAnnotationType());
}
return new AnnotationList.Explicit(CompoundList.of(declaredAnnotations, getSuperClass().asErasure().getInheritedAnnotations().inherited(annotationTypes)));
return new AnnotationList.Explicit(CompoundList.of(declaredAnnotations, superClass.asErasure().getInheritedAnnotations().inherited(annotationTypes)));
}
}

Expand Down Expand Up @@ -6431,7 +6437,7 @@ public <T> T accept(TypeVariableSource.Visitor<T> visitor) {
}

@Override
public boolean isPackageDescription() {
public boolean isPackageType() {
return getSimpleName().equals(PackageDescription.PACKAGE_CLASS_NAME);
}

Expand Down Expand Up @@ -6938,7 +6944,7 @@ class Latent extends AbstractBase.OfSimpleType {
/**
* The super type or {@code null} if no such type exists.
*/
private final Generic superType;
private final Generic superClass;

/**
* The interfaces that this type implements.
Expand All @@ -6950,19 +6956,19 @@ class Latent extends AbstractBase.OfSimpleType {
*
* @param name The name of the type.
* @param modifiers The modifiers of the type.
* @param superType The super type or {@code null} if no such type exists.
* @param superClass The super type or {@code null} if no such type exists.
* @param interfaces The interfaces that this type implements.
*/
public Latent(String name, int modifiers, Generic superType, List<? extends Generic> interfaces) {
public Latent(String name, int modifiers, Generic superClass, List<? extends Generic> interfaces) {
this.name = name;
this.modifiers = modifiers;
this.superType = superType;
this.superClass = superClass;
this.interfaces = interfaces;
}

@Override
public Generic getSuperClass() {
return superType;
return superClass;
}

@Override
Expand Down

0 comments on commit 264b318

Please sign in to comment.