Skip to content

Commit

Permalink
Further advanced new API implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Winterhalter committed Dec 31, 2015
1 parent 9d98ed0 commit 0f15762
Show file tree
Hide file tree
Showing 7 changed files with 723 additions and 136 deletions.
4 changes: 2 additions & 2 deletions byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java
Expand Up @@ -507,13 +507,13 @@ public DynamicType.Builder<? extends Enum<?>> makeEnumeration(Collection<? exten
if (values.isEmpty()) { if (values.isEmpty()) {
throw new IllegalArgumentException("Require at least one enumeration constant"); throw new IllegalArgumentException("Require at least one enumeration constant");
} }
TypeDescription.Generic enumType = new TypeDescription.Generic.OfNonGenericType.ForLoadedType(Enum.class); TypeDescription.Generic enumType = TypeDescription.Generic.Builder.parameterizedType(Enum.class, TargetType.class).asType();
return new SubclassDynamicTypeBuilder<Enum<?>>(classFileVersion, return new SubclassDynamicTypeBuilder<Enum<?>>(classFileVersion,
namingStrategy.subclass(enumType.asErasure()), namingStrategy.subclass(enumType.asErasure()),
auxiliaryTypeNamingStrategy, auxiliaryTypeNamingStrategy,
implementationContextFactory, implementationContextFactory,
interfaceTypes, interfaceTypes,
Visibility.PUBLIC.getMask() | TypeManifestation.FINAL.getMask() | EnumerationState.ENUMERATION.getMask(), ModifierContributor.Resolver.of(Visibility.PUBLIC, TypeManifestation.FINAL, EnumerationState.ENUMERATION).resolve(),
typeAttributeAppender, typeAttributeAppender,
ignoredMethods, ignoredMethods,
classVisitorWrapper, classVisitorWrapper,
Expand Down
Expand Up @@ -1342,6 +1342,14 @@ class Token implements ByteCodeElement.Token<Token> {
*/ */
private final Object defaultValue; private final Object defaultValue;


public Token(int modifiers) {
this(MethodDescription.CONSTRUCTOR_INTERNAL_NAME, modifiers, TypeDescription.Generic.VOID);
}

public Token(String name, int modifiers, TypeDescription.Generic returnType) {
this(name, modifiers, returnType, Collections.<TypeDescription.Generic>emptyList());
}

/** /**
* Creates a new method token with simple values. * Creates a new method token with simple values.
* *
Expand Down
Expand Up @@ -968,6 +968,10 @@ public Token(TypeDescription.Generic typeDescription, List<? extends AnnotationD
this(typeDescription, annotationDescriptions, NO_NAME, NO_MODIFIERS); this(typeDescription, annotationDescriptions, NO_NAME, NO_MODIFIERS);
} }


public Token(TypeDescription.Generic typeDescription, String name, Integer modifiers) {
this(typeDescription, Collections.<AnnotationDescription>emptyList(), name, modifiers);
}

/** /**
* Creates a new parameter token. * Creates a new parameter token.
* *
Expand Down

0 comments on commit 0f15762

Please sign in to comment.